remove support for old dpkg without multiarch support

This commit is contained in:
Johannes 'josch' Schauer 2016-12-24 13:19:27 +01:00
parent aa2cfef40b
commit 2bd1bd4eee

View file

@ -36,7 +36,7 @@ sub main {
$setupsh $configsh $omitrequired $omitpreinst @reinstall $tgzname @check $setupsh $configsh $omitrequired $omitpreinst @reinstall $tgzname @check
$explicit_suite $allow_recommends %omitdebsrc @dsclist %flatfile $explicit_suite $allow_recommends %omitdebsrc @dsclist %flatfile
%important $addimportant @debconf %hooks $warn_count @foreignarches %important $addimportant @debconf %hooks $warn_count @foreignarches
$olddpkg $ignorenative $markauto $default_release/; $ignorenative $markauto $default_release/;
setlocale(LC_MESSAGES, ""); setlocale(LC_MESSAGES, "");
textdomain("multistrap"); textdomain("multistrap");
@ -200,7 +200,7 @@ sub main {
if (not -d "${dir}dev") { if (not -d "${dir}dev") {
mkdir_fatal ("${dir}dev"); mkdir_fatal ("${dir}dev");
} }
if (($olddpkg == 0) and (scalar (@foreignarches) > 0)) { if (scalar (@foreignarches) > 0) {
open (VMA, ">${dir}${dpkgdir}arch"); open (VMA, ">${dir}${dpkgdir}arch");
print VMA "$host\n"; print VMA "$host\n";
foreach my $farch (@foreignarches) { foreach my $farch (@foreignarches) {
@ -249,17 +249,13 @@ sub main {
my $component = (exists $flatfile{$aptsrc}) ? "" my $component = (exists $flatfile{$aptsrc}) ? ""
: (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; : (defined $components{$aptsrc}) ? $components{$aptsrc} : "main";
if (defined $mirror and defined $suite) { if (defined $mirror and defined $suite) {
if ($olddpkg != 0) { if (scalar (@foreignarches) == 0) {
print SOURCES "deb $mirror $suite $component\n"; print SOURCES "deb [arch=$arch] $mirror $suite $component\n";
} else { } else {
if (scalar (@foreignarches) == 0) { foreach my $farch (@foreignarches) {
print SOURCES "deb [arch=$arch] $mirror $suite $component\n"; print SOURCES "deb [arch=$farch] $mirror $suite $component\n";
} else {
foreach my $farch (@foreignarches) {
print SOURCES "deb [arch=$farch] $mirror $suite $component\n";
}
}
} }
}
print SOURCES "deb-src $mirror $suite $component\n" if (not defined $omitdebsrc{$aptsrc}); print SOURCES "deb-src $mirror $suite $component\n" if (not defined $omitdebsrc{$aptsrc});
close SOURCES; close SOURCES;
} }
@ -440,17 +436,13 @@ sub main {
my $component = (exists $flatfile{$aptsrc}) ? "" my $component = (exists $flatfile{$aptsrc}) ? ""
: (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; : (defined $components{$aptsrc}) ? $components{$aptsrc} : "main";
if (defined $mirror and defined $suite) { if (defined $mirror and defined $suite) {
if ($olddpkg != 0) { if (scalar (@foreignarches) == 0) {
print SOURCES "deb $mirror $suite $component\n"; print SOURCES "deb [arch=$arch] $mirror $suite $component\n";
} else { } else {
if (scalar (@foreignarches) == 0) { foreach my $farch (@foreignarches) {
print SOURCES "deb [arch=$arch] $mirror $suite $component\n"; print SOURCES "deb [arch=$farch] $mirror $suite $component\n";
} else {
foreach my $farch (@foreignarches) {
print SOURCES "deb [arch=$farch] $mirror $suite $component\n";
}
}
} }
}
print SOURCES "deb-src $mirror $suite $component\n" if (not defined $omitdebsrc{$aptsrc}); print SOURCES "deb-src $mirror $suite $component\n" if (not defined $omitdebsrc{$aptsrc});
close SOURCES; close SOURCES;
} }
@ -1159,12 +1151,11 @@ will be created - it is not packed into a .tgz once complete.
} }
sub cascade { sub cascade {
my $progname = basename($0);
$olddpkg = &check_multiarch_dpkg;
$file = shift; $file = shift;
my @req_arches=(); my @req_arches=();
my $config = Config::Auto::parse($file, format => 'ini'); my $config = Config::Auto::parse($file, format => 'ini');
if (not defined $config or (scalar keys %$config) == 0) { if (not defined $config or (scalar keys %$config) == 0) {
my $progname = basename($0);
die ("$progname: ". sprintf(_g("Failed to parse '%s'!\n"), $file)); die ("$progname: ". sprintf(_g("Failed to parse '%s'!\n"), $file));
} }
my $type; my $type;
@ -1243,11 +1234,8 @@ sub cascade {
push (@{$hooks{'N'}}, $fl) if ($hf =~ /^native/); push (@{$hooks{'N'}}, $fl) if ($hf =~ /^native/);
} }
} }
my @ma=(); my @ma = split(' ',$keys{$section}{'multiarch'})
if ($olddpkg == 0) { if (defined $keys{$section}{'multiarch'});
@ma = split(' ',$keys{$section}{'multiarch'})
if (defined $keys{$section}{'multiarch'});
}
push @foreignarches, @ma; push @foreignarches, @ma;
my @d=(); my @d=();
@d = split(' ', lc($keys{$section}{'debootstrap'})) @d = split(' ', lc($keys{$section}{'debootstrap'}))
@ -1297,15 +1285,7 @@ sub cascade {
push @req_arches, $frgn_arch; push @req_arches, $frgn_arch;
} }
} }
if ($olddpkg == 0) { $packages{$section} = join(' ', @tmp);
$packages{$section} = join(' ', @tmp);
} else {
my $dpkgmsg = sprintf (_g("ERR: Unsupportable option: 'architecture'. ".
"Current dpkg version does not support MultiArch. ".
"Packages for '%s' have been ignored.\n"), $section);
warn $dpkgmsg;
$warn_count++;
}
} else { } else {
if (ref ($keys{$section}{'packages'}) eq 'ARRAY') { if (ref ($keys{$section}{'packages'}) eq 'ARRAY') {
$packages{$section}=join(' ', @{$keys{$section}{'packages'}}); $packages{$section}=join(' ', @{$keys{$section}{'packages'}});
@ -1345,13 +1325,6 @@ sub cascade {
uniq_sort (\@extrapkgs); uniq_sort (\@extrapkgs);
} }
# returns zero on success, non-zero on fail
sub check_multiarch_dpkg {
my $retval = system ("dpkg --print-foreign-architectures > /dev/null 2>&1");
$retval >>=8;
return $retval;
}
sub system_fatal { sub system_fatal {
my $cmd = shift; my $cmd = shift;
my $retval = system ("$cmd"); my $retval = system ("$cmd");
@ -1490,9 +1463,7 @@ sub dump_config {
} else { } else {
$msg .= sprintf(_g("Cannot determine architecture from '%s'. Using %s.\n"), $file, $host); $msg .= sprintf(_g("Cannot determine architecture from '%s'. Using %s.\n"), $file, $host);
} }
if ($olddpkg != 0) { if (scalar (@foreignarches) > 0) {
printf "MultiArch:\t\t%s\n",_g("Currently installed dpkg does not support MultiArch.");
} elsif (scalar (@foreignarches) > 0) {
$plural = ngettext("Foreign architecture", "Foreign architectures", scalar @foreignarches); $plural = ngettext("Foreign architecture", "Foreign architectures", scalar @foreignarches);
printf ("MultiArch:\t\t%s: %s\n", $plural, join(" ", sort @foreignarches)); printf ("MultiArch:\t\t%s: %s\n", $plural, join(" ", sort @foreignarches));
} }