Skip to contentSkip to conversation

Add a "make rpmball" target

PATCH In review George Dunlap 7 participants 24 messages Mar 3, 2014 – Mar 4, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a "make rpmball" target

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
 Makefile         |    7 +++++
 tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 tools/misc/mkrpm
Makefile +7 -0
index 4e48457..75e845b 100644
@@ -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::
tools/misc/mkrpm new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

-George

Quoted 116 lines

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +7 -0
index 4e48457..75e845b 100644
@@ -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::
tools/misc/mkrpm new file +82 -0
new file mode 100644
index 0000000..7d20788
@@ -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
#2 lore raw
Quoted 8 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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

Quoted 123 lines

-George

Quoted 105 lines

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +6 -0
index 4e48457..75e845b 100644
@@ -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::
tools/misc/mkrpm new file +72 -0
new file mode 100644
index 0000000..7d20788
@@ -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.

tools/misc/mkrpm line 82

Quoted 10 lines
tools/misc/mkrpm new file +10 -0
+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
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 10 lines · Don Slutz
Quoted 8 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

Quoted 9 lines

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 <[email protected]>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 75e845b..6def25d 100644
@@ -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
Signature · 19 lines
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
Quoted 129 lines
Quoted 115 lines

-George

Quoted 113 lines

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +6 -0
index 4e48457..75e845b 100644
@@ -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::
tools/misc/mkrpm new file +80 -0
new file mode 100644
index 0000000..7d20788
@@ -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
Quoted 8 lines

tools/misc/mkrpm line 82

Quoted 2 lines
tools/misc/mkrpm new file +2 -0
+mv rpm/RPMS/*/*.rpm .
+rm -rf rpm

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 44 lines · Don Slutz
Quoted 11 lines · Don Slutz
Quoted 9 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

Quoted 9 lines

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 <[email protected]>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

---
Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 75e845b..6def25d 100644
@@ -157,7 +157,7 @@ debball: dist
 # to be a full featured policy compliant .rpm package.

.PHONY: rpmball
rpmball: dist

Makefile

Quoted 4 lines
Makefile +1 -3
-       sh ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep 
-v :)
+       sh ./tools/misc/mkrpm $(XEN_ROOT) $$(git describe --long --dirty | tr 
- _)

You can't assume git will work; it doesn't for the tarball releases.

Michael Young

#5 lore raw
Quoted 50 lines · M A Young
Quoted 43 lines · Don Slutz
Quoted 10 lines · Don Slutz
Quoted 8 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

Quoted 9 lines

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 <[email protected]>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

---
Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 75e845b..6def25d 100644
@@ -157,7 +157,7 @@ debball: dist
 # to be a full featured policy compliant .rpm package.

.PHONY: rpmball
rpmball: dist

Makefile debball: dist · line 160

Quoted 2 lines
Makefile +1 -1
-       sh ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep -v :)
+       sh ./tools/misc/mkrpm $(XEN_ROOT) $$(git describe --long --dirty | tr - _)

You can't assume git will work; it doesn't for the tarball releases.

Quoted 1 line

Michael Young

How about "| cut -d- -f1":

dcs-xen-54:~/xen>make -C xen xenversion | grep -v : | cut -d- -f1 4.5

-Don Slutz

#6 lore raw
Quoted 53 lines · Don Slutz
Quoted 52 lines · M A Young
Quoted 41 lines · Don Slutz
Quoted 10 lines · Don Slutz
Quoted 8 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

Quoted 9 lines

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 <[email protected]>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

---
Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 75e845b..6def25d 100644
@@ -157,7 +157,7 @@ debball: dist
 # to be a full featured policy compliant .rpm package.
Quoted 6 lines

.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 - _)

You can't assume git will work; it doesn't for the tarball releases.

Quoted 6 lines
Quoted 1 line

Michael Young

How about "| cut -d- -f1":

dcs-xen-54:~/xen>make -C xen xenversion | grep -v : | cut -d- -f1 4.5

or you could do
make -C xen xenversion XEN_EXTRAVERSION="" | grep -v :
or even
make --no-print-directory -C xen xenversion XEN_EXTRAVERSION=""

Michael Young

#7 lore raw
Quoted 63 lines · M A Young
Quoted 59 lines · Don Slutz
Quoted 54 lines · M A Young
Quoted 43 lines · Don Slutz
Quoted 11 lines · Don Slutz
Quoted 9 lines · George Dunlap
Quoted 4 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

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...

Quoted 10 lines

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 <[email protected]>
Date: Mon, 3 Mar 2014 17:59:17 -0500
Subject: [PATCH] Adjust version

---
Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 75e845b..6def25d 100644
@@ -157,7 +157,7 @@ debball: dist
 # to be a full featured policy compliant .rpm package.
Quoted 6 lines

.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 - _)

You can't assume git will work; it doesn't for the tarball releases.

Quoted 1 line

Michael Young

How about "| cut -d- -f1":

Quoted 7 lines
Quoted 2 lines

dcs-xen-54:~/xen>make -C xen xenversion | grep -v : | cut -d- -f1 4.5

or you could do
make -C xen xenversion XEN_EXTRAVERSION="" | grep -v :
or even
make --no-print-directory -C xen xenversion XEN_EXTRAVERSION=""

Yes, sorry about that -- I tested "make rpmball", then changed something, then tested calling "mkrpm" directly without testing the whole thing. :-/

What I did instead was modify the mkrpm script to parse "xxxx-yy" as "version-release". (And if there's no "-yy", to just make it "0".) New iteration coming.

-George

#8 lore raw
In reply to George Dunlap

tools/misc/mkrpm line 48

Quoted 3 lines · George Dunlap

+%install

tools/misc/mkrpm new file +2 -0
+rm -rf \$RPM_BUILD_ROOT
+mkdir -p \$RPM_BUILD_ROOT

Newer rpms are supposed to do that automatically, but I dont know what "newer" actually means. And certainly it does not hurt to keep this.

tools/misc/mkrpm line 57

Quoted 9 lines
tools/misc/mkrpm new file +9 -0
+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)

"find $paht -type l -delete"?

Quoted 3 lines

+%files
+%defattr(-,root,root,-)
+/*

In this case, to avoid package conflicts, add some tags like:

Obsoletes: xen-libs
Obsoletes: xen-tools

Also "Release: unstable" could be some automatically increasing number, like 'date +%s'. This avoids the need for "rpm -Uvh --force xen.rpm". Not sure how package managers deal with missing digits in the Release:
tag. If in doubt, set it to 0.

Olaf

#9 lore raw
Quoted 9 lines · Olaf Hering

tools/misc/mkrpm line 48

Quoted 3 lines · George Dunlap

+%install

tools/misc/mkrpm new file +2 -0
+rm -rf \$RPM_BUILD_ROOT
+mkdir -p \$RPM_BUILD_ROOT

Newer rpms are supposed to do that automatically, but I dont know what "newer" actually means. And certainly it does not hurt to keep this.

Quoted 10 lines

tools/misc/mkrpm line 57

Quoted 9 lines
tools/misc/mkrpm new file +9 -0
+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)

"find $paht -type l -delete"?

Ack.

Quoted 8 lines
Quoted 4 lines

+%files
+%defattr(-,root,root,-)
+/*

In this case, to avoid package conflicts, add some tags like:

Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

Quoted 4 lines

Also "Release: unstable" could be some automatically increasing number, like 'date +%s'. This avoids the need for "rpm -Uvh --force xen.rpm". Not sure how package managers deal with missing digits in the Release:
tag. If in doubt, set it to 0.

I'll give this a think.

Thanks for the feedback!

-George

#10 lore raw
Quoted 27 lines · George Dunlap
Quoted 9 lines · Olaf Hering

tools/misc/mkrpm line 48

Quoted 3 lines · George Dunlap

+%install

tools/misc/mkrpm new file +2 -0
+rm -rf \$RPM_BUILD_ROOT
+mkdir -p \$RPM_BUILD_ROOT

Newer rpms are supposed to do that automatically, but I dont know what "newer" actually means. And certainly it does not hurt to keep this.

Quoted 10 lines

tools/misc/mkrpm line 57

Quoted 9 lines
tools/misc/mkrpm new file +9 -0
+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)

"find $paht -type l -delete"?

Ack.

Quoted 4 lines
Quoted 4 lines

+%files
+%defattr(-,root,root,-)
+/*

Quoted 6 lines
Quoted 4 lines

In this case, to avoid package conflicts, add some tags like:

Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

"remove another named package(s) when this package is installed" -- I think that's a bit more than we want in the rpmball. I'd much rather the developer have to remove the conflicting packages themselves, rather than have it done automatically.

-George

#11 lore raw
Quoted 4 lines · George Dunlap

"remove another named package(s) when this package is installed" -- I think that's a bit more than we want in the rpmball. I'd much rather the developer have to remove the conflicting packages themselves, rather than have it done automatically.

It would mean "rpm -e --nodeps xen-tools xen-libs" has to be used. If any other package depends on the xen-libs for example, then in my opinion its better to get a clear "libxl.so.4 is required by XY" when doing "rpm -U xen.rpm".

Olaf

#12 lore raw
In reply to George Dunlap
Quoted 4 lines · George Dunlap
Quoted 3 lines

In this case, to avoid package conflicts, add some tags like:
Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

In my case it would replace the distro xen,xen-libs,xen-tools.rpm with the new xen.rpm. If none of these packages are installed, its a nop.

Olaf

#13 lore raw
Quoted 10 lines · Olaf Hering
Quoted 4 lines · George Dunlap
Quoted 3 lines

In this case, to avoid package conflicts, add some tags like:
Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

In my case it would replace the distro xen,xen-libs,xen-tools.rpm with the new xen.rpm. If none of these packages are installed, its a nop.

+1

In principle, I'd agree with George on the fact that is should well be the developer to take care of this.

However, having the system thinking that, e.g., xen-libs is installed, would allow one to install xen related libvirt distro packages, and test them with the latest Xen, which would be pretty cool!

Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw
Quoted 10 lines · Dario Faggioli
Quoted 9 lines · Olaf Hering
Quoted 4 lines · George Dunlap
Quoted 3 lines

In this case, to avoid package conflicts, add some tags like:
Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

In my case it would replace the distro xen,xen-libs,xen-tools.rpm with the new xen.rpm. If none of these packages are installed, its a nop.

Quoted 8 lines

+1

In principle, I'd agree with George on the fact that is should well be the developer to take care of this.

However, having the system thinking that, e.g., xen-libs is installed, would allow one to install xen related libvirt distro packages, and test them with the latest Xen, which would be pretty cool!

Ah, you mean, it *also* counts as one of those packages for dependency tracking?

I can definitely see how that could be useful.

Any opinions, Ian / Ian?

-George

#15 lore raw

George Dunlap writes ("Re: [Xen-devel] [PATCH] Add a "make rpmball" target"):

Quoted 13 lines · Dario Faggioli
Quoted 12 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

In this case, to avoid package conflicts, add some tags like:
Obsoletes: xen-libs
Obsoletes: xen-tools

What exactly would this be for?

In my case it would replace the distro xen,xen-libs,xen-tools.rpm with the new xen.rpm. If none of these packages are installed, its a nop.

+1

In principle, I'd agree with George on the fact that is should well be the developer to take care of this.

Quoted 8 lines
Quoted 3 lines

However, having the system thinking that, e.g., xen-libs is installed, would allow one to install xen related libvirt distro packages, and test them with the latest Xen, which would be pretty cool!

Ah, you mean, it *also* counts as one of those packages for dependency tracking?

I can definitely see how that could be useful.

Quite.

Quoted 1 line

Any opinions, Ian / Ian?

I'm no expert on rpm. Is there a way to get the desirable effect (satisfying dependencies) without the undesirable one (unexpectedly deinstalling the sysadmin's other xen packages) ?

Ian.

#16 lore raw
Quoted 9 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [PATCH] Add a "make rpmball" target"):

Quoted 4 lines

Ah, you mean, it *also* counts as one of those packages for dependency tracking?

I can definitely see how that could be useful.

Quite.

Indeed. :-)

Quoted 6 lines
Quoted 1 line

Any opinions, Ian / Ian?

I'm no expert on rpm. Is there a way to get the desirable effect (satisfying dependencies) without the undesirable one (unexpectedly deinstalling the sysadmin's other xen packages) ?

I think something like "Provides: xxx" can help with this, at least on Fedora:
http://fedoraproject.org/wiki/How_to_create_an_RPM_package#Other_tags

As soon as rpmball builds for me (see the other e-mail I just sent), I'll be happy to help experimenting with it.

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#17 lore raw
In reply to Ian Jackson
Quoted 3 lines · Ian Jackson

I'm no expert on rpm. Is there a way to get the desirable effect (satisfying dependencies) without the undesirable one (unexpectedly deinstalling the sysadmin's other xen packages) ?

rpm does that itself because the new xen.rpm has a provides "libxyz.so.0() (64bit)" and other packages linking against that SONAME have a requires "libxyz.so.0() (64bit)" so rpm and package managers above rpm can find the relationship between the two packages.

I dont see an undesirable effect because the selfcompiled xen.rpm contains everything required to run a dom0.

Olaf

#18 lore raw

Olaf Hering writes ("Re: [Xen-devel] [PATCH] Add a "make rpmball" target"):

Quoted 5 lines · Ian Jackson
Quoted 3 lines

I'm no expert on rpm. Is there a way to get the desirable effect (satisfying dependencies) without the undesirable one (unexpectedly deinstalling the sysadmin's other xen packages) ?

Quoted 7 lines

rpm does that itself because the new xen.rpm has a provides "libxyz.so.0() (64bit)" and other packages linking against that SONAME have a requires "libxyz.so.0() (64bit)" so rpm and package managers above rpm can find the relationship between the two packages.

I dont see an undesirable effect because the selfcompiled xen.rpm contains everything required to run a dom0.

I think it's undesirable if installing this rpmball causes (by default) the deinstallation or replacement of distro-provided Xen packages.

Ian.

#19 lore raw
In reply to George Dunlap
Quoted 1 line · George Dunlap

Any opinions, Ian / Ian?

The approach we have taken with the .deb equivalent is that the result is basically "a tarball which can be cleanly uninstalled, for developer use" not "a package which is well integrated with the overall system". People who want an integrated "end user" package should use the one from the proper package maintainer for the distro.

In other words I think it should be up to the person installing this thing to not install packaged Xen from the distro at the same time and deal with any resulting conflicts etc themselves.

Ian.

#20 lore raw
In reply to George Dunlap
Quoted 2 lines · George Dunlap

Ah, you mean, it *also* counts as one of those packages for dependency tracking?

No. Obsoletes does just what the name suggests: It means the new xen.rpm will replace an existing xen.rpm and also packages providing or being named like the strings in the Obsoletes: tag.

Adding a Provides: tag is just for package managers above rpm as a hint during dist upgrade to track package renames.

For the purpose of xen-unstable a "Name: xen" and "Obsoletes: xen-xyz" is the right way to replace the distro provided xen related packages with the catch-all single selfcompiled xen.rpm.

Olaf

#21 lore raw
In reply to George Dunlap
Quoted 64 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +7 -0
index 4e48457..75e845b 100644
@@ -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::
tools/misc/mkrpm new file +26 -0
new file mode 100644
index 0000000..7d20788
@@ -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

tools/misc/mkrpm line 36

Quoted 10 lines
tools/misc/mkrpm new file +10 -0
+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}

Does this correctly stop the striping of debug symbols? Or does it just prevent the debuginfo packaging.

Quoted 9 lines
tools/misc/mkrpm new file +9 -0
+
+%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
+

tools/misc/mkrpm line 55

Quoted 10 lines
tools/misc/mkrpm new file +10 -0
+%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*

But this is an important file if you want to use crash on /proc/vmcore. So removing it for a developer rpm does not make sense to me.

Quoted 9 lines
tools/misc/mkrpm new file +9 -0
+# 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

tools/misc/mkrpm line 74

Quoted 10 lines
tools/misc/mkrpm new file +10 -0
+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

So 1st you unlink, then you make a new (maybe the same) link?

-Don Slutz

Quoted 8 lines
tools/misc/mkrpm new file +8 -0
+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
#22 lore raw
Quoted 72 lines · Don Slutz
Quoted 71 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

---
CC: Ian Jackson <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Dario Faggioli <[email protected]>

---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   82
++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 89 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +7 -0
index 4e48457..75e845b 100644
@@ -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::

tools/misc/mkrpm new file +31 -0
new file mode 100644
index 0000000..7d20788
@@ -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
Quoted 8 lines

tools/misc/mkrpm line 36

Quoted 5 lines
tools/misc/mkrpm new file +5 -0
+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}

Does this correctly stop the striping of debug symbols? Or does it just prevent the debuginfo packaging.

Don't know actually -- this was taken from the XenServer xen.spec.

Quoted 15 lines
Quoted 15 lines
tools/misc/mkrpm new file +14 -0
+
+%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/
Quoted 8 lines

tools/misc/mkrpm line 55

Quoted 5 lines
tools/misc/mkrpm new file +5 -0
+
+cd \$RPM_BUILD_ROOT
+
+# Don't include xen-syms
+rm -f boot/xen-syms*

But this is an important file if you want to use crash on /proc/vmcore. So removing it for a developer rpm does not make sense to me.

Yes, you're right. Actually, the reason I deleted this file is that the auto-install CentOS image I used to install my test machine creates a separate /boot partition that is tiny -- and if I included xen-syms, I couldn't install the rpm.

But that's something I should work around / fix in my own system.

Quoted 14 lines
Quoted 14 lines
tools/misc/mkrpm new file +13 -0
+# 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,-)
Quoted 8 lines

tools/misc/mkrpm line 74

Quoted 6 lines
tools/misc/mkrpm new file +6 -0
+/*
+
+%post
+# Point xen.gz to the real binary.
+cd /boot
+ln -sf %{name}-%{version}-%{release}.gz xen.gz

So 1st you unlink, then you make a new (maybe the same) link?

Again, this is an artifact of the way I had my system configured. The reason I did this was so that I could install this while keeping the xen4centos xen-hypervisor package installed. But I think you're right, it would be better to just uninstall the old package, and leave the links as they are.

Thanks for the review -- v2 coming soon.

-George

#23 lore raw
In reply to George Dunlap
Quoted 3 lines · George Dunlap

Build a simplistic dummy package, similar to "make debball", for developers on rpm-based systems.

Importing this produced the following output:

$ stg import -M /home/dario/patch-export.mbox 
Checking for changes in the working directory ... done
Importing patch "add-a-make-rpmball-target" ... <stdin>:43: trailing whitespace.
if test -z "$1" -o -z "$2" ; then 
<stdin>:46: trailing whitespace.
fi 
<stdin>:106: trailing whitespace.
# Point xen.gz to the real binary. 
<stdin>:108: trailing whitespace.
ln -sf %{name}-%{version}-%{release}.gz xen.gz 
warning: 4 lines add whitespace errors.
done
Now at patch "add-a-make-rpmball-target"

Trying to `make rpmball' both on debian (after having installed the relevant rpm* packages) and on Fedora tells me this:

install -d -m0755 -p /home/dario/Sources/xen/xen/xen.git/dist/
install -m0644 -p ./COPYING /home/dario/Sources/xen/xen/xen.git/dist
install -m0644 -p ./README /home/dario/Sources/xen/xen/xen.git/dist
install -m0755 -p ./install.sh /home/dario/Sources/xen/xen/xen.git/dist
sh ./tools/misc/mkrpm /home/dario/Sources/xen/xen/xen.git $(make -C xen xenversion | grep -v :)
error: line 3: Illegal char '-' in: Version: 4.5-unstable
make: *** [rpmball] Error 1

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel