Skip to contentSkip to conversation

tools: Use --no-print-directory instead of grep for debball version

PATCH Applied George Dunlap 4 participants 8 messages Mar 10, 2014 – Mar 11, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 tools: Use --no-print-directory instead of grep for debball version

Save a fork, and also avoid :) being interpreted as a smiley.

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

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 4e48457..4c5d1b6 100644
@@ -150,7 +150,7 @@ world:
 # to be a full featured policy compliant .deb package.
 .PHONY: debball
 debball: dist
-	fakeroot sh ./tools/misc/mkdeb $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep -v :)
+	fakeroot sh ./tools/misc/mkdeb $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
 # clean doesn't do a kclean
 .PHONY: clean
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 2/2 Add a "make rpmball" target

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

---
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 <[email protected]>
CC Ian Campbell <[email protected]>
CC Dario Faggioli <[email protected]>
CC Olaf Hering <[email protected]>
CC Don Slutz <[email protected]>
CC M A Young <[email protected]>
---
 Makefile         |    7 +++++
 tools/misc/mkrpm |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)
 create mode 100644 tools/misc/mkrpm
Makefile +7 -0
index 4c5d1b6..91ca280 100644
@@ -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::
tools/misc/mkrpm new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v3 2/2] Add a "make rpmball" target

George Dunlap writes ("[PATCH v3 2/2] Add a "make rpmball" target"):

Quoted 2 lines

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

This is obviously a good thing to have but I'll wait for feedback before committing this as I can't easily test it myself.

Thanks,
Ian.

#3 lore raw

Re: [PATCH v3 2/2] Add a "make rpmball" target

Quoted 5 lines · Ian Jackson

George Dunlap writes ("[PATCH v3 2/2] Add a "make rpmball" target"):

Quoted 2 lines

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

This is obviously a good thing to have but I'll wait for feedback before committing this as I can't easily test it myself.

Well given that I can't test things on Don's system either, it may be more sensible to check this in as it is, and allow him to fix it so that it works for him.

(Although then it may break for me, but we can hope that later versions of rpmbuild are more likely to be compatible with earlier versions...)

-George

Acked-by
#4 lore raw

Re: [PATCH v3 2/2] Add a "make rpmball" target

Quoted 10 lines · George Dunlap
Quoted 5 lines · Ian Jackson

George Dunlap writes ("[PATCH v3 2/2] Add a "make rpmball" target"):

Quoted 2 lines

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

This is obviously a good thing to have but I'll wait for feedback before committing this as I can't easily test it myself.

Well given that I can't test things on Don's system either, it may be more sensible to check this in as it is, and allow him to fix it so that it works for him.

Personally I think this is a sensible approach, plus it looks like Don has now tested it and it works, so good.

I've glanced at it, but I don't think this sort of thing needs especially thorough review so:

Quoted 5 lines

(Although then it may break for me, but we can hope that later versions of rpmbuild are more likely to be compatible with earlier versions...)

-George

Applied
#5 lore raw

Re: [PATCH v3 2/2] Add a "make rpmball" target

Ian Campbell writes ("Re: [PATCH v3 2/2] Add a "make rpmball" target"):

Quoted 7 lines · George Dunlap
Quoted 3 lines

Well given that I can't test things on Don's system either, it may be more sensible to check this in as it is, and allow him to fix it so that it works for him.

Personally I think this is a sensible approach, plus it looks like Don has now tested it and it works, so good.

Right.

Quoted 4 lines

I've glanced at it, but I don't think this sort of thing needs especially thorough review so:

Applied, thanks everyone.

Ian.

Tested-by on v3 2/2
#6 lore raw

Re: [PATCH v3 2/2] Add a "make rpmball" target

In reply to George Dunlap
Quoted 2 lines · George Dunlap

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:

-Don Slutz

Quoted 124 lines

---
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 <[email protected]>
CC Ian Campbell <[email protected]>
CC Dario Faggioli <[email protected]>
CC Olaf Hering <[email protected]>
CC Don Slutz <[email protected]>
CC M A Young <[email protected]>
---
  Makefile         |    7 +++++
  tools/misc/mkrpm |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 83 insertions(+)

create mode 100644 tools/misc/mkrpm

Makefile +7 -0
index 4c5d1b6..91ca280 100644
@@ -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::
tools/misc/mkrpm new file +76 -0
new file mode 100644
index 0000000..fb47b6d
@@ -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
Acked-by on v3 1/2
#7 lore raw
In reply to George Dunlap

George Dunlap writes ("[PATCH v3 1/2] tools: Use --no-print-directory instead of grep for debball version"):

Quoted 1 line

Save a fork, and also avoid :) being interpreted as a smiley.

I was going to ask when --no-print-directory was introduced in make, but I guess we don't care aout compatibility to ancient makes in the debball target.

Quoted 1 line