[Build-common-hackers] Bug#293197: support for Cpu/System fields

Robert Millan Robert Millan <rmh@debian.org>, 293197@bugs.debian.org
Tue, 01 Feb 2005 19:17:52 +0100


This is a multi-part MIME message sent by reportbug.

--===============0621531167==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: cdbs
Version: 0.4.26-1.1
Severity: wishlist
Tags: patch

This patch implements support for Cpu/System fields in debian/control.in for
packages that have enabled DEB_AUTO_UPDATE_DEBIAN_CONTROL.  This functionality
is to be implemented in dpkg in the long term, but for now we can have it in
cdbs as a test case.

Don't forget to replace x.y with the first version of cdbs that supports this
feature.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: kfreebsd-i386 (i386)
Kernel: GNU/kFreeBSD 5.3-1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)

-- no debconf information

--===============0621531167==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cpu-system.diff"

diff -ur cdbs-0.4.26.old/debian/control.in cdbs-0.4.26/debian/control.in
--- cdbs-0.4.26.old/debian/control.in	2004-09-24 19:43:06.000000000 +0200
+++ cdbs-0.4.26/debian/control.in	2005-02-01 13:44:33.000000000 +0100
@@ -8,7 +8,8 @@
 Standards-Version: 3.5.10
 
 Package: cdbs
-Architecture: all
+Cpu: all
+System: all
 Conflicts: build-common
 Recommends: autotools-dev, debhelper (>= 4.1.0)
 Description: common build system for Debian packages
diff -ur cdbs-0.4.26.old/1/rules/buildcore.mk.in cdbs-0.4.26/1/rules/buildcore.mk.in
--- cdbs-0.4.26.old/1/rules/buildcore.mk.in	2004-09-24 19:42:07.000000000 +0200
+++ cdbs-0.4.26/1/rules/buildcore.mk.in	2005-02-01 13:44:17.000000000 +0100
@@ -101,11 +101,24 @@
 # add stuff to this rule.
 clean:: testdir testroot cleanbuilddir
 
+ifneq (, $(DEB_AUTO_UPDATE_DEBIAN_CONTROL))
+control_cpu		:= $(shell grep "^Cpu:" debian/control.in | sed -e "s/^.*: //g" -e "s/ /,/g")
+ifneq (, $(control_cpu))
+ifeq ($(_cdbs_bootstrap), )
+CDBS_BUILD_DEPENDS	:= $(CDBS_BUILD_DEPENDS), cdbs (>= x.y)
+endif
+CDBS_BUILD_DEPENDS	:= $(CDBS_BUILD_DEPENDS), type-handling (>= 0.2.5)
+control_system		:= $(shell grep "^System:" debian/control.in | sed -e "s/^.*: //g" -e "s/ /,/g")
+control_arch		:= $(shell type-handling $(control_cpu) $(control_system))
+endif
+endif
 debian/control::
 ifneq ($(DEB_AUTO_UPDATE_DEBIAN_CONTROL),)
-	cat debian/control.in \
-	| sed "s/@cdbs@/$(CDBS_BUILD_DEPENDS)/g" \
-	> debian/control
+	sed \
+		-e "s/@cdbs@/$(CDBS_BUILD_DEPENDS)/g" \
+		-e "s/^Cpu: .*/Architecture: $(control_arch)/g" \
+		-e "/^System: /d" \
+	< debian/control.in > debian/control
 endif
 
 # This rule is called before the common-install target.  It's currently only

--===============0621531167==--