[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Add a "make rpmball" target



On 03/03/14 17:34, Don Slutz wrote:
On 03/03/14 11:07, George Dunlap wrote:
On 03/03/2014 02:59 PM, George Dunlap wrote:
Build a simplistic dummy package, similar to "make debball", for
developers on rpm-based systems.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

I meant to add, I've tested this running as root, but not as a normal user -- 
I'd appreciate it if someone could give it a try...


As a user I get:
...
sh ./tools/misc/mkrpm /home/don/xen $(make -C xen xenversion | grep -v :)
error: line 3: Illegal char '-' in: Version: 4.5-unstable
make: *** [rpmball] Error 1

   -Don Slutz



And applying a version "fix":



From 40c6b19abf44aaf7496b4c77536677fc0d463931 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@xxxxxxxxxxx>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 75e845b..6def25d 100644
--- a/Makefile
+++ b/Makefile
@@ -157,7 +157,7 @@ debball: dist
 # to be a full featured policy compliant .rpm package.
 .PHONY: rpmball
 rpmball: dist
-       sh ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep 
-v :)
+       sh ./tools/misc/mkrpm $(XEN_ROOT) $$(git describe --long --dirty | tr - 
_)

 # clean doesn't do a kclean
 .PHONY: clean
--
1.7.11.7


Leads me to:
...
Wrote: 
/home/don/xen/dist/rpm/RPMS/x86_64/xen-4.4.0_rc5_45_g40c6b19-unstable.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.yagtO6
+ umask 022
+ cd /home/don/xen/dist/rpm/BUILD
+ rm -rf 
/home/don/xen/dist/rpm/BUILDROOT/xen-4.4.0_rc5_45_g40c6b19-unstable.x86_64
+ exit 0
dcs-xen-54:~/xen>ls -l 
/home/don/xen/dist/rpm/RPMS/x86_64/xen-4.4.0_rc5_45_g40c6b19-unstable.x86_64.rpm
ls: cannot access 
/home/don/xen/dist/rpm/RPMS/x86_64/xen-4.4.0_rc5_45_g40c6b19-unstable.x86_64.rpm:
 No such file or directory
dcs-xen-54:~/xen>find dist/rpm
find: `dist/rpm': No such file or directory

So after building the rpm you delete it.

   -Don Slutz


 -George

---
CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
CC: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)
  create mode 100644 tools/misc/mkrpm

diff --git a/Makefile b/Makefile
index 4e48457..75e845b 100644
--- a/Makefile
+++ b/Makefile
@@ -152,6 +152,13 @@ world:
  debball: dist
      fakeroot sh ./tools/misc/mkdeb $(XEN_ROOT) $$($(MAKE) -C xen xenversion | 
grep -v :)
  +# 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
+    sh ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep -v :)
+
  # 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..7d20788
--- /dev/null
+++ b/tools/misc/mkrpm
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# 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 test -z "$1" -o -z "$2" ; then
+  echo "usage: $0 path-to-XEN_ROOT xen-version"
+  exit 1
+fi
+
+xenroot="$1"
+
+cd $xenroot
+version=$2
+
+# Prepare the directory to package
+cd dist
+rm -rf rpm
+
+# Fill in the rpm boilerplate
+mkdir -p rpm/SPEC
+cat >rpm/SPEC/xen.spec <<EOF
+Summary: Xen development build, version $version
+Name: xen
+Version: $version
+Release: unstable
+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
+
+# Don't include xen-syms
+rm -f boot/xen-syms*
+# Remove all the "linked" xen-*.gz files
+rm -f \$(find boot/ -type l)
+# Rename the real xen.gz binary, if necessary.
+if [[ ! -e boot/%{name}-%{version}-%{release}.gz ]] ; then
+    mv boot/xen-*.gz boot/%{name}-%{version}-%{release}.gz
+fi
+
+
+%clean
+rm -rf \$RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+/*
+
+%post
+# Point xen.gz to the real binary.
+cd /boot
+ln -sf %{name}-%{version}-%{release}.gz xen.gz
+EOF
+
+# Package it up
+rpmbuild --define "_xenroot $xenroot" --define "_topdir $PWD/rpm" -bb 
rpm/SPEC/xen.spec
+
+# Tidy up after ourselves
+mv rpm/RPMS/*/*.rpm .
+rm -rf rpm


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.