copy-jdk-configs-vl.spec 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. %global project copy_jdk_configs
  2. %global file %{project}.lua
  3. %global rpm_state_dir %{_localstatedir}/lib/rpm-state
  4. Name: copy-jdk-configs
  5. Version: 1.1
  6. Release: 5%{?_dist_release}
  7. Summary: JDKs configuration files copier
  8. License: BSD
  9. URL: https://hg.fedorahosted.org/hg/%{project}
  10. Source0: https://hg.fedorahosted.org/hg/copy_jdk_configs/raw-file/%{project}-%{version}/%{file}
  11. Source1: https://hg.fedorahosted.org/hg/copy_jdk_configs/raw-file/%{project}-%{version}/LICENSE
  12. Vendor: Project Vine
  13. Distribution: Vine Linux
  14. # we need to duplicate msot of the percents in that script so they survive rpm expansion (even in that sed they have to be duplicated)
  15. %global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g)
  16. BuildArch: noarch
  17. Requires: lua
  18. Requires: lua-posix
  19. %description
  20. Utility script to transfer JDKs configuration files between updates or for
  21. archiving.
  22. %prep
  23. cp -a %{SOURCE1} .
  24. %build
  25. #blob
  26. %pretrans -p <lua>
  27. function createPretransScript()
  28. -- the sript must be available during pretrans, so multiply it to tmp
  29. os.execute("mkdir -p %{rpm_state_dir}")
  30. temp_path="%{rpm_state_dir}/%{file}"
  31. -- print("generating " .. temp_path)
  32. file = io.open(temp_path, "w")
  33. file:write([[%{pretrans_install}]])
  34. file:close()
  35. end
  36. -- in netinst, the above call may fail. pcall should save instalation (as there is nothing to copy anyway)
  37. -- https://bugzilla.redhat.com/show_bug.cgi?id=1295701
  38. -- todo, decide whether to check for {rpm_state_dir} and skip on not-existing, or keep creating
  39. if pcall(createPretransScript) then
  40. -- ok
  41. else
  42. -- print("Error running %{name} pretrans.")
  43. end
  44. %install
  45. mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
  46. cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
  47. %posttrans
  48. # remove file created in pretrans
  49. # echo "removing %{rpm_state_dir}/%{file}" || :
  50. rm "%{rpm_state_dir}/%{file}" || :
  51. %files
  52. %{_libexecdir}/%{file}
  53. %license LICENSE
  54. %changelog
  55. * Mon Jun 20 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.1-5
  56. - initial build for Vine Linux.
  57. * Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-4
  58. - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
  59. * Fri Jan 08 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
  60. - pretrasn lua call now done in pcall (protected call)
  61. - also posttrans now always return 0
  62. * Wed Dec 16 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-2
  63. - package now "installs" also during pretrans, so pretrasn scripts can use it
  64. - pretrasn "install" is removed in postrans
  65. * Wed Nov 25 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-1
  66. - initial package