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