With this patch, dpkg understands the following syntax for debian/control (while maintaining full backwards compatibility). Some examples: Build-Depends: bin86 [cpu: i386] ..where "bin86" is required only on _cpu_ i386 with any kernel (unlike [i386] which silently implies linux). Build-Depends: kernel-headers-2.4 [system: linux] ..where "kernel-headers-2.4" is required only on linux-gnu systems, on any cpu. Analogously, the "Architecture" field is split. Some examples: Package: grub Cpu: i386 System: any Package: modutils Cpu: any System: linux diff -ur dpkg-1.10.26.old/scripts/controllib.pl dpkg-1.10.26/scripts/controllib.pl --- dpkg-1.10.26.old/scripts/controllib.pl 2005-01-11 17:55:11.000000000 +0100 +++ dpkg-1.10.26/scripts/controllib.pl 2005-01-24 03:37:51.000000000 +0100 @@ -76,6 +76,15 @@ $arch=`dpkg-architecture -qDEB_HOST_ARCH`; $? && &subprocerr("dpkg-architecture -qDEB_HOST_ARCH"); chomp $arch; + + $cpu=`dpkg-architecture -qDEB_HOST_GNU_CPU`; + $? && &subprocerr("dpkg-architecture -qDEB_HOST_GNU_CPU"); + chomp $cpu; + + $system=`dpkg-architecture -qDEB_HOST_GNU_SYSTEM`; + $? && &subprocerr("dpkg-architecture -qDEB_HOST_GNU_SYSTEM"); + chomp $system; + $substvar{'Arch'}= $arch; } @@ -170,9 +179,9 @@ sub parsedep { my ($dep_line, $use_arch, $reduce_arch) = @_; my @dep_list; + findarch; if (!$host_arch) { - $host_arch = `dpkg-architecture -qDEB_HOST_ARCH`; - chomp $host_arch; + $host_arch = $arch; } foreach my $dep_and (split(/,\s*/m, $dep_line)) { my @or_list = (); @@ -182,6 +191,17 @@ $package = $1 if ($dep_or =~ s/^([a-zA-Z0-9][a-zA-Z0-9+._-]*)\s*//m); ($relation, $version) = ($1, $2) if ($dep_or =~ s/^\((=|<=|>=|<>?)\s*([^)]+).*\)\s*//m); my @arches = split(/\s+/m, $1) if ($use_arch && $dep_or =~ s/^\[([^]]+)\]\s*//m); + + if ($arches[0] eq 'cpu:') { + $host_arch = $cpu; + } + if ($arches[0] eq 'system:') { + $host_arch = $system; + } + if (($host_arch eq $cpu) || ($host_arch eq $system)) { + $arches = shift @arches; + } + if ($reduce_arch && @arches) { my $seen_arch=''; diff -ur dpkg-1.10.26.old/scripts/dpkg-gencontrol.pl dpkg-1.10.26/scripts/dpkg-gencontrol.pl --- dpkg-1.10.26.old/scripts/dpkg-gencontrol.pl 2005-01-11 17:55:11.000000000 +0100 +++ dpkg-1.10.26/scripts/dpkg-gencontrol.pl 2005-01-24 02:01:25.000000000 +0100 @@ -46,7 +46,7 @@ } $i=100;grep($fieldimps{$_}=$i--, - qw(Package Version Section Priority Architecture Essential + qw(Package Version Section Priority Architecture System Cpu Essential Pre-Depends Depends Recommends Suggests Enhances Optional Conflicts Replaces Provides Installed-Size Origin Maintainer Bugs Source Description Build-Depends Build-Depends-Indep @@ -144,6 +144,39 @@ " appear in package's list (@archlist)"); $f{$_}= $arch; } + } elsif (m/^Cpu$|^System$/) { + if (($_ eq 'System') && ($ccpu eq '')) { + $csystem= $v; + } elsif (($_ eq 'Cpu') && ($csystem eq '')) { + $ccpu= $v; + } else { + if ($ccpu eq '') { $ccpu= $v; } else { $csystem= $v; } + if ($ccpu eq 'all') { + $f{Architecture}= 'all'; + } elsif ($ccpu eq 'any') { + if (($csystem eq 'all') || ($csystem eq 'any')) { + $f{Architecture}= $arch; + } else { + @syslist= split(/\s+/,$csystem); + grep($system eq $_, @syslist) || + &error("current build system $system does not". + " appear in package's list (@syslist)"); + $f{Architecture}= $arch; + } + } else { + @cpulist= split(/\s+/,$ccpu); + grep($cpu eq $_, @cpulist) || + &error("current build cpu $cpu does not". + " appear in package's list (@cpulist)"); + if (!($csystem eq 'all') && !($csystem eq 'any')) { + @syslist= split(/\s+/,$csystem); + grep($system eq $_, @syslist) || + &error("current build system $system does not". + " appear in package's list (@syslist)"); + } + $f{Architecture}= $arch; + } + } } elsif (s/^X[CS]*B[CS]*-//i) { $f{$_}= $v; } elsif (!m/^X[CS]+-/i) {