Bug#762175: Introduce kernel versions?
On Fri, 2014-09-19 at 10:43 +0200, Samuel Thibault wrote:
> Only the gnumach-image-1.4{-,xen}-486{,-dbg} packages
> need to have a different version, and these only contain
> /boot/gnumach-1.4{,-xen}-486{,-dbg}.gz
> The other packages don't need to be co-installable.
>
> > but at least this is a first step towards kernel versions.
>
> Sure, please continue, that can only help some people.
Attached is a patch enabling building custom kernels. The old packages
gnumach-image-$(VERSION){,-xen}-486{,-dbg} are now built as
gnumach-image-$(DEB_VERSION){,-xen}-486{,-dbg} where currently
VERSION=1.4 and DEB_VERSION=1.4-12 (from debian/changelog) if the
environment variable CUSTOM_KERNEL=yes is set. Not setting it should
behave as before, with DEB_VERSION := $(VERSION)
(Maybe it would be better to create four additional packages if building
a custom kernel, but that would be even more work to accomplish?)
Thanks!
--- a/debian/rules.orig 2014-08-11 23:19:07.000000000 +0200
+++ b/debian/rules 2014-09-22 17:49:08.000000000 +0200
@@ -6,20 +6,24 @@
FULL_VERSION := $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
NOEPOCH_VERSION := $(shell echo $(FULL_VERSION) | sed -e 's/.*://g')
+DEB_VERSION := $(NOEPOCH_VERSION)
TAR_VERSION := $(shell echo $(NOEPOCH_VERSION) | sed -e 's/-.*//g')
VERSION := $(shell echo $(TAR_VERSION) | sed -e 's/\.dfsg.*//g')
MAJOR := $(shell echo $(VERSION) | sed -e 's/\..*//g')
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+ifneq ($(CUSTOM_KERNEL), yes)
+DEB_VERSION := $(VERSION)
+endif
MACHINE := 486
-pkg := gnumach-image-$(VERSION)-$(MACHINE)
-pkg_xen := gnumach-image-$(VERSION)-xen-$(MACHINE)
+pkg := gnumach-image-$(DEB_VERSION)-$(MACHINE)
+pkg_xen := gnumach-image-$(DEB_VERSION)-xen-$(MACHINE)
pkg_udeb := kernel-image-$(VERSION)-$(MACHINE)-di
pkg_xen_udeb := kernel-image-$(VERSION)-xen-$(MACHINE)-di
-pkg_dbg := gnumach-image-$(VERSION)-$(MACHINE)-dbg
-pkg_xen_dbg := gnumach-image-$(VERSION)-xen-$(MACHINE)-dbg
+pkg_dbg := gnumach-image-$(DEB_VERSION)-$(MACHINE)-dbg
+pkg_xen_dbg := gnumach-image-$(DEB_VERSION)-xen-$(MACHINE)-dbg
pkg_common := gnumach-common
pkg_dev := gnumach-dev
@@ -59,7 +63,12 @@
--disable-pcmcia-group \
--disable-wireless-group
+ifeq ($(CUSTOM_KERNEL), yes)
+configure: configure.ac debian/control.stamp
+ @echo Building a custom kernel: "$(DEB_VERSION)"
+else
configure: configure.ac
+endif
autoreconf -fi
build/config.status: configure
@@ -94,6 +103,43 @@
$(common_configure) \
--enable-platform=xen
+ifeq ($(CUSTOM_KERNEL), yes)
+OUT := debian/control.tmp
+A1 := gnumach-image-$(VERSION)-486
+A2 := gnumach-image-$(DEB_VERSION)-486
+B1 := gnumach-image-$(VERSION)-xen-486
+B2 := gnumach-image-$(DEB_VERSION)-xen-486
+debian/control.stamp:
+# Backup selected *.install
+ if [ ! -f "debian/$(A1).install.bck" ] ; then \
+ cp -p debian/$(A1).install debian/$(A1).install.bck; \
+ mv debian/$(A1).install debian/$(A2).install; \
+ fi
+ if [ ! -f "debian/$(A1)-dbg.install.bck" ] ; then \
+ cp -p debian/$(A1)-dbg.install debian/$(A1)-dbg.install.bck; \
+ mv debian/$(A1)-dbg.install debian/$(A2)-dbg.install; \
+ fi
+ if [ ! -f "debian/$(B1).install.bck" ] ; then \
+ cp -p debian/$(B1).install debian/$(B1).install.bck; \
+ mv debian/$(B1).install debian/$(B2).install; \
+ fi
+ if [ ! -f "debian/$(B1)-dbg.install.bck" ] ; then \
+ cp -p debian/$(B1)-dbg.install debian/$(B1)-dbg.install.bck; \
+ mv debian/$(B1)-dbg.install debian/$(B2)-dbg.install; \
+ fi
+# Backup original debian/control
+ if [ ! -f "debian/control.bck" ] ; then \
+ cp -p debian/control debian/control.bck; \
+ fi
+# Save original debian/control to a working copy
+ cp debian/control $(OUT)
+# VERSION=1.4, DEB_VERSION=1.4-12.1
+ egrep 'Package: $(A1)' $(OUT) | sed -i -e 's/Package: $(A1)/Package: $(A2)/' $(OUT)
+ egrep '$(B1)' $(OUT) | sed -i -e 's/Package: $(B1)/Package: $(B2)/' $(OUT)
+ mv $(OUT) debian/control
+ touch $@
+endif
+
build-arch: build/stamp build-xen/stamp build-dbg/stamp build-xen-dbg/stamp
build-indep: build-arch
build: build-arch build-indep
@@ -159,6 +205,31 @@
rm -f debian/gnumach-image-*.postinst
rm -f debian/gnumach-image-*.postrm
+# Restore original debian/control
+ifeq ($(CUSTOM_KERNEL), yes)
+ -rm debian/control.stamp
+ if [ -f debian/control.bck ] ; then \
+ mv debian/control.bck debian/control; \
+ fi
+# Restore selected *.install
+ if [ -f "debian/$(A1).install.bck" ] ; then \
+ mv debian/$(A1).install.bck debian/$(A1).install; \
+ rm debian/$(A2).install; \
+ fi
+ if [ -f "debian/$(A1)-dbg.install.bck" ] ; then \
+ mv debian/$(A1)-dbg.install.bck debian/$(A1)-dbg.install; \
+ rm debian/$(A2)-dbg.install; \
+ fi
+ if [ -f "debian/$(B1).install.bck" ] ; then \
+ mv debian/$(B1).install.bck debian/$(B1).install; \
+ rm debian/$(B2).install; \
+ fi
+ if [ -f "debian/$(B1)-dbg.install.bck" ] ; then \
+ mv debian/$(B1)-dbg.install.bck debian/$(B1)-dbg.install; \
+ rm debian/$(B2)-dbg.install; \
+ fi
+endif
+
dh_clean
install: build
@@ -182,21 +253,21 @@
mkdir -p $(D_UDEB)/boot
cp $(D)/boot/gnumach $(D_UDEB)/boot/
- mv $(D)/boot/gnumach $(D)/boot/gnumach-$(VERSION)-$(MACHINE)
+ mv $(D)/boot/gnumach $(D)/boot/gnumach-$(DEB_VERSION)-$(MACHINE)
mkdir -p $(D_XEN_UDEB)/boot
cp $(D_XEN)/boot/gnumach $(D_XEN_UDEB)/boot/
- mv $(D_XEN)/boot/gnumach $(D_XEN)/boot/gnumach-$(VERSION)-xen-$(MACHINE)
- mv $(D_DBG)/boot/gnumach $(D_DBG)/boot/gnumach-$(VERSION)-$(MACHINE)-dbg
- mv $(D_XEN_DBG)/boot/gnumach $(D_XEN_DBG)/boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg
+ mv $(D_XEN)/boot/gnumach $(D_XEN)/boot/gnumach-$(DEB_VERSION)-xen-$(MACHINE)
+ mv $(D_DBG)/boot/gnumach $(D_DBG)/boot/gnumach-$(DEB_VERSION)-$(MACHINE)-dbg
+ mv $(D_XEN_DBG)/boot/gnumach $(D_XEN_DBG)/boot/gnumach-$(DEB_VERSION)-xen-$(MACHINE)-dbg
ifeq ($(DEB_HOST_ARCH_OS),hurd)
for script in preinst prerm postinst postrm ; do \
for prefix in "" -xen ; do \
for suffix in "" -dbg ; do \
- sed -e "s/@VERSION@/$(VERSION)/g" \
- -e "s/@RELEASE@/$(VERSION)$$prefix-$(MACHINE)$$suffix/g" \
+ sed -e "s/@VERSION@/$(DEB_VERSION)/g" \
+ -e "s/@RELEASE@/$(DEB_VERSION)$$prefix-$(MACHINE)$$suffix/g" \
debian/gnumach-image.$$script.in \
- > debian/gnumach-image-$(VERSION)$$prefix-$(MACHINE)$$suffix.$$script ; \
+ > debian/gnumach-image-$(DEB_VERSION)$$prefix-$(MACHINE)$$suffix.$$script ; \
done ; \
done ; \
done
@@ -238,12 +309,12 @@
dh_link -a
dh_strip -a -N$(pkg_dbg) -N$(pkg_xen_dbg)
dh_compress -a -N$(pkg) -N$(pkg_udeb) -N$(pkg_xen) -N$(pkg_xen_udeb) -N$(pkg_dbg) -N$(pkg_xen_dbg)
- dh_compress -p$(pkg) boot/gnumach-$(VERSION)-$(MACHINE)
+ dh_compress -p$(pkg) boot/gnumach-$(DEB_VERSION)-$(MACHINE)
dh_compress -p$(pkg_udeb) boot/gnumach
- dh_compress -p$(pkg_xen) boot/gnumach-$(VERSION)-xen-$(MACHINE)
+ dh_compress -p$(pkg_xen) boot/gnumach-$(DEB_VERSION)-xen-$(MACHINE)
dh_compress -p$(pkg_xen_udeb) boot/gnumach
- dh_compress -p$(pkg_dbg) boot/gnumach-$(VERSION)-$(MACHINE)-dbg
- dh_compress -p$(pkg_xen_dbg) boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg
+ dh_compress -p$(pkg_dbg) boot/gnumach-$(DEB_VERSION)-$(MACHINE)-dbg
+ dh_compress -p$(pkg_xen_dbg) boot/gnumach-$(DEB_VERSION)-xen-$(MACHINE)-dbg
dh_fixperms -a
dh_installdeb -a
dh_gencontrol -a
Reply to: