mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
Commit438c5ffa44("rpmball: Adjust to new rpm, do not require --force") attempted to handle stricter directory permissions in newer distributions. This introduced a few issues: - /boot used to be a constant prior commit6475d70005("use BOOT_DIR as xen.gz install location"), since this commit the location has to be referenced via ${BOOT_DIR} - it assumed the prefix and the various configurable paths match the glob pattern /*/*/* Adjust the code to build a filelist on demand and filter directories from an installed filesystem.rpm. This works on a SUSE system, and will likely work on a RedHat based system as well. Take the opportunity to replace the usage of $RPM_BUILD_ROOT with %buildroot, and use pushd/popd pairs. Signed-off-by: Olaf Hering <olaf@aepfle.de> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
89 lines
2.1 KiB
Bash
89 lines
2.1 KiB
Bash
#!/bin/bash
|
|
#
|
|
# mkrpm: package the dist/install output of a Xen build in an .rpm
|
|
#
|
|
# Takes 2 arguments, the path to the dist directory and the version
|
|
|
|
set -e
|
|
|
|
if [[ -z "$1" || -z "$2" ]] ; then
|
|
echo "usage: $0 path-to-XEN_ROOT xen-version"
|
|
exit 1
|
|
fi
|
|
|
|
xenroot="$1"
|
|
|
|
# rpmbuild doesn't like dashes in the version; break it down into
|
|
# version and release. Default to "0" if there isn't a release.
|
|
v=(${2/-/ })
|
|
version=${v[0]}
|
|
release="${v[1]:-0}${PKG_RELEASE:+.$PKG_RELEASE}"
|
|
|
|
cd $xenroot
|
|
|
|
# Prepare the directory to package
|
|
cd dist
|
|
rm -rf rpm
|
|
|
|
# Fill in the rpm boilerplate
|
|
mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
|
cat >rpm/SPECS/xen.spec <<EOF
|
|
Summary: Xen development build, version $version
|
|
Name: xen$PKG_SUFFIX
|
|
Version: $version
|
|
Release: $release
|
|
License: GPL
|
|
Group: System/Hypervisor
|
|
URL: https://xenbits.xenproject.org/git-http/xen.git
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
%define _binary_payload w1.gzdio
|
|
%define __spec_install_post /usr/lib/rpm/brp-compress || :
|
|
%define debug_package %{nil}
|
|
|
|
%description
|
|
This package contains the Xen hypervisor and associated tools, built
|
|
from a source tree. It is not a fully packaged and supported Xen, just
|
|
the output of a xen "make dist" wrapped in an .rpm to make it easy to
|
|
uninstall.
|
|
|
|
%build
|
|
|
|
%install
|
|
rm -rf %buildroot
|
|
mkdir -p %buildroot
|
|
pushd %_xenroot
|
|
dist/install.sh %buildroot
|
|
|
|
rm -f dist/filesystem.txt
|
|
rm -f dist/directories.txt
|
|
rm -f dist/files.txt
|
|
find %buildroot -type d | sed 's|^%buildroot||' | sort > dist/directories.txt
|
|
find %buildroot -type f | sed 's|^%buildroot||' | sort > dist/files.txt
|
|
find %buildroot -type l | sed 's|^%buildroot||' | sort >> dist/files.txt
|
|
if rpm -ql filesystem > dist/filesystem.txt
|
|
then
|
|
while read
|
|
do
|
|
sed -i "s|^\${REPLY}$||" dist/directories.txt
|
|
done < dist/filesystem.txt
|
|
fi
|
|
sed 's|^|%%dir |' dist/directories.txt >> dist/files.txt
|
|
popd
|
|
|
|
%clean
|
|
rm -rf %buildroot
|
|
|
|
%files -f %_xenroot/dist/files.txt
|
|
%defattr(-,root,root,-)
|
|
|
|
%post
|
|
EOF
|
|
|
|
# Package it up
|
|
rpmbuild --define "_xenroot $xenroot" --define "_topdir $PWD/rpm" -bb rpm/SPECS/xen.spec
|
|
|
|
# Tidy up after ourselves
|
|
mv rpm/RPMS/*/*.rpm .
|
|
rm -rf rpm
|