]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Add a "make rpmball" target
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Mon, 10 Mar 2014 12:46:56 +0000 (12:46 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 11 Mar 2014 11:42:04 +0000 (11:42 +0000)
Build a simplistic dummy package, similar to "make debball", for
developers on rpm-based systems.

[ Fixed some trailing whitespace -iwj ]

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
CC: Olaf Hering <olaf@aepfle.de>
CC: Don Slutz <dslutz@verizon.com>
CC: M A Young <m.a.young@durham.ac.uk>
Tested-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Makefile
tools/misc/mkrpm [new file with mode: 0644]

index 4c5d1b68d9d8660db2bdd6b4c783885263b8993f..91ca28006beeb12ab4cd42988f175c8875fe86ba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -152,6 +152,13 @@ world:
 debball: dist
        fakeroot sh ./tools/misc/mkdeb $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
+# Package a build in an rpmball file, that is inside a .rpm format
+# container to allow for easy and clean removal. This is not intended
+# to be a full featured policy compliant .rpm package.
+.PHONY: rpmball
+rpmball: dist
+       bash ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
+
 # clean doesn't do a kclean
 .PHONY: clean
 clean::
diff --git a/tools/misc/mkrpm b/tools/misc/mkrpm
new file mode 100644 (file)
index 0000000..a9aa5e2
--- /dev/null
@@ -0,0 +1,76 @@
+#!/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]}
+
+[[ -n "$release" ]] || release="0"
+
+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
+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