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

Bug#260443: kernel-source-2.6.7 rules file does not support non-digit revision numbers



Hi,

Nathaniel McCallum writes:

> Package: kernel-source-2.6.7
> Version: 2.6.7-3
> 
> We are creating a custom debian distribution and need to use
> non-alpha characters in the revision.  However, the rules file does
> not support this.  There is a patch to fix this at
> http://www.no-name-yet.com/patches/

Thanks a lot.  In fact, we also need to support this, because after
the release of sarge, there will be security updates, whose Debian
revisions typically contain non-digit characters.

Anyway, I slightly changed your patch in three ways: First, I used
functions built into make where possible.  Second, I avoided the use
of sort, which does not use the same algorithm as Debian packaging
tools for comparing revisions, and instead used an awk command to
simply revert the order of revisions extracted from the changelog.
Third, I put the previous revision into in extra variable to avoid
duplicating that long stretch of awk.

Please check out the attached new version of the patch.

Regards, Jens.

--- debian/rules.orig	Wed Jun 23 17:30:19 2004
+++ debian/rules	Tue Jul 20 22:57:39 2004
@@ -14,12 +14,12 @@
 release	:= $(shell head -1 debian/changelog | sed 's/^.*(\(.*\)-.*).*$$/\1/')
 version	:= $(shell head -1 debian/changelog | sed 's/^.*(\(.*\)).*$$/\1/')
 
-# extract the latest Debian revision from the changelog
-revisions := $(shell head -1 debian/changelog | sed 's/^.*(.*-\(.*\)).*$$/\1/')
+# extract all the Debian revisions for this release from the changelog
+revisions := $(shell grep "^kernel-source-$(release) " debian/changelog | sed 's/^.*(.*-\(.*\)).*$$/\1/' | awk '{for(i=1;i<=NF;i++){a[++j]=$$i}}END{for(i=j;i>=1;i--){print a[i]}}')
 
 # set the current Debian revision to the latest by default;
 # note that for some targets, the two may actually be different.
-revision ?= $(revisions)
+revision ?= $(word $(words $(revisions)),$(revisions))
 
 version.Debian: debian/changelog
 	sed 's/^[^ ]* (\([^)]*\)).*/\1/; q' $< > $@
@@ -53,7 +53,7 @@
 .PHONY:		monolith
 monolith:	stamp-monolith
 stamp-monolith:	stamp-monolith-prepare \
-	$(foreach revision,$(shell seq 1 $(revisions)),stamp-monolith-$(revision))
+	$(foreach revision,$(revisions),stamp-monolith-$(revision))
 	rm -rf $(DIFFDIR)
 
 stamp-monolith-prepare:
@@ -72,12 +72,13 @@
 	touch $@
 
 # for the first revision, we diff against the original
-ifeq ($(revision),1)
+ifeq ($(revision),$(firstword $(revisions)))
 PREVPACKAGE = $(PACKAGE).orig
 prevrelease = $(release)
 else
-PREVPACKAGE = $(PACKAGE)-$$(($(revision)-1))
-prevrelease = $(release)-$$(($(revision)-1))
+prerevision = $(shell echo $(revisions) | awk '{ for (i=2;i<=NF;i++) if ($$i == "$(revision)") print $$(i-1) }')
+PREVPACKAGE = $(PACKAGE)-$(prerevision)
+prevrelease = $(release)-$(prerevision)
 endif
 
 $(MONODIR)/patch-$(release)-$(revision):
-- 
J'qbpbe, le m'en fquz pe j'qbpbe!
Le veux aimeb et mqubib panz je pézqbpbe je djuz tqtaj!

Reply to: