On Thu, 06 May 2010 at 22:10:43 -0400, Felipe Sateler wrote:
> Csound's debian/control has a build-depends with contidionals depending
> on architecture. These are copied verbatim to the dummy package's
> debian/control, thus dpkg-gencontrol chokes because conditional archs
> are not supported in binary packages:
[...]
> dpkg-gencontrol: error: the Depends field contains an arch-specific
> dependency but the package is architecture all

This seems to work OK if equivs is directed to make an arch 'any' package;
I attach a patch to do this automatically when needed, and a second patch
to add a --arch option which is passed through to equivs (so you can make an
armel package (with the armel dependencies) on an i386, for instance).

Also available in a git repository:
http://git.debian.org/?p=users/smcv/devscripts.git;a=shortlog;h=refs/heads/arch-dep

    Simon
From f849b3681cdce7ed68fa520ba8205f733a9d01a3 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sun, 23 May 2010 11:15:27 +0100
Subject: [PATCH 1/2] mk-build-deps: build an arch 'any' package if dependencies change by arch

Closes: #580600
Signed-off-by: Simon McVittie <[email protected]>
---
 scripts/mk-build-deps.pl |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index 4655b15..bae04e4 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -181,17 +181,25 @@ while ($control = shift) {
     }
     close CONTROL;
 
+    my $equivs_build = 'equivs-build';
+    my $arch = 'all';
+
+    if ($build_deps =~ /\[|\]/) {
+        $arch = 'any';
+    }
+
     # Now, running equivs-build:
 
     die "$progname: Unable to find package name in '$control'\n" unless $name;
     die "$progname: Unable to find build-deps for $name\n" unless $build_deps;
 
-    open EQUIVS, "| equivs-build -"
+    open EQUIVS, "| $equivs_build -"
 	or die "$progname: Failed to execute equivs-build: $!\n";
     print EQUIVS "Section: devel\n" .
 	"Priority: optional\n".
 	"Standards-Version: 3.7.3\n\n".
 	"Package: ".$name."-build-deps\n".
+	"Architecture: $arch\n".
 	"Depends: $build_deps\n";
     print EQUIVS "Version: $version\n" if $version;
 
-- 
1.7.1

From 1e49f663c76a28166d2bf47c032485585585af1f Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sun, 23 May 2010 11:16:01 +0100
Subject: [PATCH 2/2] mk-build-deps: add --arch option, mirroring equivs' --arch option

Signed-off-by: Simon McVittie <[email protected]>
---
 scripts/mk-build-deps.pl |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index bae04e4..4fa90b7 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -55,6 +55,13 @@ When installing the generated package use the specified tool.
 Remove the package file after installing it. Ignored if used without
 the install switch.
 
+=item B<-a> I<foo>, B<--arch> I<foo>
+
+If the source package has architecture-specific build dependencies, produce
+a package for architecture I<foo>, not for the system architecture. (If the
+source package does not have architecture-specific build dependencies,
+the package produced is always for the pseudo-architecture B<all>.)
+
 =item B<-h>, B<--help>
 
 Show a summary of options.
@@ -85,7 +92,7 @@ use Pod::Usage;
 my $progname = basename($0);
 my $opt_install;
 my $opt_remove=0;
-my ($opt_help, $opt_version);
+my ($opt_help, $opt_version, $opt_arch);
 my $control;
 my $install_tool;
 my @packages;
@@ -128,6 +135,7 @@ GetOptions("help|h" => \$opt_help,
            "install|i" => \$opt_install,
            "remove|r" => \$opt_remove,
            "tool|t=s" => \$install_tool,
+	   "arch|a=s" => \$opt_arch,
            )
     or pod2usage({ -exitval => 1, -verbose => 0 });
 
@@ -186,6 +194,10 @@ while ($control = shift) {
 
     if ($build_deps =~ /\[|\]/) {
         $arch = 'any';
+
+        if (defined $opt_arch) {
+            $equivs_build .= " --arch=$opt_arch";
+        }
     }
 
     # Now, running equivs-build:
-- 
1.7.1

Attachment: signature.asc
Description: Digital signature

Reply via email to