Blame SPECS/copy-jdk-configs.spec

b2e8bb
%global project copy_jdk_configs
b2e8bb
%global file %{project}.lua
9ff854
%global fixFile %{project}_fixFiles.sh
b2e8bb
%global rpm_state_dir %{_localstatedir}/lib/rpm-state
b2e8bb
b2e8bb
Name:    copy-jdk-configs
b2e8bb
9ff854
# hash relevant to version tag
9ff854
%global  htag 3f9d6c4448f867a95fb166416a41c45c7e795c10
9ff854
Version: 2.2
549425
Release: 5%{?dist}
b2e8bb
Summary: JDKs configuration files copier
b2e8bb
b2e8bb
License:  BSD
9ff854
URL:      https://pagure.io/%{project}
9ff854
Source0:  %{URL}/blob/%{htag}/f/%{file}
9ff854
Source1:  %{URL}/blob/%{htag}/f/LICENSE
9ff854
Source2:  %{URL}/blob/%{htag}/f/%{fixFile}
b2e8bb
549425
Patch1: newPolices.patch
549425
b2e8bb
# 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)
b2e8bb
%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g) 
b2e8bb
b2e8bb
BuildArch: noarch
b2e8bb
b2e8bb
Requires: lua
b2e8bb
#Requires: lua-posix
b2e8bb
b2e8bb
%description
b2e8bb
Utility script to transfer JDKs configuration files between updates or for
9ff854
archiving. With script to fix incorrectly created rpmnew files
b2e8bb
b2e8bb
%prep
b2e8bb
cp -a %{SOURCE1} .
b2e8bb
b2e8bb
b2e8bb
%build
b2e8bb
#blob
b2e8bb
b2e8bb
%pretrans -p <lua>
b2e8bb
function createPretransScript()
b2e8bb
-- the sript must be available during pretrans, so multiply it to tmp
b2e8bb
  os.execute("mkdir -p %{rpm_state_dir}")
b2e8bb
  temp_path="%{rpm_state_dir}/%{file}"
b2e8bb
-- print("generating " .. temp_path)
b2e8bb
  file = io.open(temp_path, "w")
b2e8bb
  file:write([[%{pretrans_install}]])
b2e8bb
  file:close()
b2e8bb
end
b2e8bb
b2e8bb
-- in netinst, the above call may fail. pcall should save instalation (as there is nothing to copy anyway)
b2e8bb
-- https://bugzilla.redhat.com/show_bug.cgi?id=1295701
b2e8bb
-- todo, decide whether to check for {rpm_state_dir} and skip on not-existing, or keep creating
b2e8bb
if pcall(createPretransScript) then
b2e8bb
-- ok
b2e8bb
else
b2e8bb
--  print("Error running %{name} pretrans.")
b2e8bb
end
b2e8bb
b2e8bb
%install
b2e8bb
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
b2e8bb
cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
549425
pushd $RPM_BUILD_ROOT/%{_libexecdir}/
549425
patch -p1 < %{PATCH1}
549425
rm -f *.orig
549425
rm -f *.rej
549425
popd
b2e8bb
chmod 644 $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
9ff854
cp -a %{SOURCE2} $RPM_BUILD_ROOT/%{_libexecdir}/%{fixFile}
b2e8bb
b2e8bb
%posttrans
b2e8bb
# remove file created in pretrans
b2e8bb
# echo "removing %{rpm_state_dir}/%{file}" || :
b2e8bb
rm "%{rpm_state_dir}/%{file}" 2> /dev/null || :
b2e8bb
b2e8bb
%files 
b2e8bb
%{_libexecdir}/%{file}
9ff854
%{_libexecdir}/%{fixFile}
b2e8bb
%license LICENSE
b2e8bb
b2e8bb
%changelog
549425
* Tue Nov 21 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-5
549425
- adapted (added policy subdir) patch1: newPolices.patch
549425
- Resolves: rhbz#1513697
549425
549425
* Thu Nov 16 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-4
549425
- added an daplied in install patch1: newPolices.patch
549425
- Resolves: rhbz#1513697
549425
9ff854
* Mon Jun 19 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-3
9ff854
- updated to latest head
9ff854
- Resolves: rhbz#1427463
9ff854
9ff854
* Tue Jun 13 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-1
9ff854
- added "jre/lib/security/blacklisted.certs" to cared files
9ff854
- moved to newest release 2.1
9ff854
- moved to new upstream at pagure.io
9ff854
- added new script of copy_jdk_configs_fixFiles.sh 
9ff854
- copy_jdk_configs.lua  aligned to it
9ff854
- Resolves: rhbz#1427463
9ff854
9ff854
* Tue Dec 01 2016 Jiri Vanek <jvanek@redhat.com> - 1.3-1
9ff854
- updated to upstream 1.3 (adding jre/lib/security/cacerts file)
9ff854
- Resolves: rhbz#1399719
9ff854
b2e8bb
* Tue Aug 09 2016 Jiri Vanek <jvanek@redhat.com> - 1.2-1
b2e8bb
- updated to 1,3 which fixing nss minor issue
b2e8bb
- Resolves: rhbz#1296430
b2e8bb
b2e8bb
* Tue Jul 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-5
b2e8bb
- posttrans silenced, the error is appearing only in state, when there is nothing to copy
b2e8bb
- Resolves: rhbz#1296430
b2e8bb
b2e8bb
* Tue Apr 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
b2e8bb
- commented requires on lua posix to stop blocking composes.
b2e8bb
- changed it to 644 to dont mislead by executable flags
b2e8bb
- Resolves: rhbz#1296430
b2e8bb
b2e8bb
* Tue Apr 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
b2e8bb
- inital commit to rhel
b2e8bb
- Resolves: rhbz#1296430
b2e8bb
b2e8bb
* Fri Jan 08 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
b2e8bb
- pretrasn lua call now done in pcall (protected call)
b2e8bb
- also posttrans now always return 0
b2e8bb
b2e8bb
* Wed Dec 16 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-2
b2e8bb
- package now "installs" also during pretrans, so pretrasn scripts can use it
b2e8bb
- pretrasn "install" is removed in postrans
b2e8bb
b2e8bb
* Wed Nov 25 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-1
b2e8bb
- initial package