From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH v3 2/2] Add a "make rpmball" target Date: Mon, 10 Mar 2014 12:39:13 -0400 Message-ID: <531DEAB1.1010305@terremark.com> References: <1394455616-5653-1-git-send-email-george.dunlap@eu.citrix.com> <1394455616-5653-2-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394455616-5653-2-git-send-email-george.dunlap@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap , xen-devel@lists.xen.org Cc: Olaf Hering , Ian Campbell , Dario Faggioli , Don Slutz , M A Young , Ian Jackson List-Id: xen-devel@lists.xenproject.org On 03/10/14 08:46, George Dunlap wrote: > Build a simplistic dummy package, similar to "make debball", for > developers on rpm-based systems. This one builds fine on CentOS 5.10 and Fedora 17 So: Tested-by: -Don Slutz > Signed-off-by: George Dunlap > --- > v3: > - Make more directories in temporary rpm area, so that rpmbuild > from CentOS 5.x works > v2: > - use --no-print-directory rather than '| grep -v :' > - use find boot/ -type l -delete rather > - bash-ify the script, so that we can... > - use string manipulation to break down version and release numbers > - Don't delete xen-syms, xen-*.gz links > > CC: Ian Jackson > CC: Ian Campbell > CC: Dario Faggioli > CC: Olaf Hering > CC: Don Slutz > CC: M A Young > --- > Makefile | 7 +++++ > tools/misc/mkrpm | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 83 insertions(+) > create mode 100644 tools/misc/mkrpm > > diff --git a/Makefile b/Makefile > index 4c5d1b6..91ca280 100644 > --- 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 > index 0000000..fb47b6d > --- /dev/null > +++ b/tools/misc/mkrpm > @@ -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 < +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