mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
An increasing version and/or release number helps to update existing packages without --force as in "rpm Uvh --force xen.rpm". Instead its possible to do "rpm -Fvh *.rpm" to update only already installed packages. The usage of --force disables essentials checks such as file conflict detection. As a result the new xen.rpm may overwrite files owned by other packages. With the current way of calculating version-release it is difficult to get an increasing release number into the spec file. The release is always zero unless "make make XEN_VENDORVERSION=`date +.%s`" is used, which has the bad side effect that xen.gz always gets a different filename every time. Update mkrpm to recognize PKG_RELEASE=. Its value will be appended to the Release string. It can be filled with a time stamp, like: make rpmball PKG_RELEASE="`date +%Y%m%d%H%M%S`" Signed-off-by: Olaf Hering <olaf@aepfle.de> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Cc: George Dunlap <george.dunlap@eu.citrix.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
75 lines
1.6 KiB
Bash
75 lines
1.6 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: http://xenbits.xenproject.org/xen.git
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
%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 \$RPM_BUILD_ROOT
|
|
mkdir -p \$RPM_BUILD_ROOT
|
|
cd %{_xenroot}
|
|
dist/install.sh \$RPM_BUILD_ROOT/
|
|
|
|
cd \$RPM_BUILD_ROOT
|
|
|
|
%clean
|
|
rm -rf \$RPM_BUILD_ROOT
|
|
|
|
%files
|
|
%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
|