From 2bd1bd4eee0b615019de9b65448915ba5dbc6fc7 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sat, 24 Dec 2016 13:19:27 +0100 Subject: [PATCH] remove support for old dpkg without multiarch support --- multistrap | 67 ++++++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 48 deletions(-) diff --git a/multistrap b/multistrap index dd68449..69d58ce 100755 --- a/multistrap +++ b/multistrap @@ -36,7 +36,7 @@ sub main { $setupsh $configsh $omitrequired $omitpreinst @reinstall $tgzname @check $explicit_suite $allow_recommends %omitdebsrc @dsclist %flatfile %important $addimportant @debconf %hooks $warn_count @foreignarches - $olddpkg $ignorenative $markauto $default_release/; + $ignorenative $markauto $default_release/; setlocale(LC_MESSAGES, ""); textdomain("multistrap"); @@ -200,7 +200,7 @@ sub main { if (not -d "${dir}dev") { mkdir_fatal ("${dir}dev"); } - if (($olddpkg == 0) and (scalar (@foreignarches) > 0)) { + if (scalar (@foreignarches) > 0) { open (VMA, ">${dir}${dpkgdir}arch"); print VMA "$host\n"; foreach my $farch (@foreignarches) { @@ -249,17 +249,13 @@ sub main { my $component = (exists $flatfile{$aptsrc}) ? "" : (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; if (defined $mirror and defined $suite) { - if ($olddpkg != 0) { - print SOURCES "deb $mirror $suite $component\n"; - } else { - if (scalar (@foreignarches) == 0) { - print SOURCES "deb [arch=$arch] $mirror $suite $component\n"; - } else { - foreach my $farch (@foreignarches) { - print SOURCES "deb [arch=$farch] $mirror $suite $component\n"; - } - } + if (scalar (@foreignarches) == 0) { + print SOURCES "deb [arch=$arch] $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}); close SOURCES; } @@ -440,17 +436,13 @@ sub main { my $component = (exists $flatfile{$aptsrc}) ? "" : (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; if (defined $mirror and defined $suite) { - if ($olddpkg != 0) { - print SOURCES "deb $mirror $suite $component\n"; - } else { - if (scalar (@foreignarches) == 0) { - print SOURCES "deb [arch=$arch] $mirror $suite $component\n"; - } else { - foreach my $farch (@foreignarches) { - print SOURCES "deb [arch=$farch] $mirror $suite $component\n"; - } - } + if (scalar (@foreignarches) == 0) { + print SOURCES "deb [arch=$arch] $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}); close SOURCES; } @@ -1159,12 +1151,11 @@ will be created - it is not packed into a .tgz once complete. } sub cascade { - my $progname = basename($0); - $olddpkg = &check_multiarch_dpkg; $file = shift; my @req_arches=(); my $config = Config::Auto::parse($file, format => 'ini'); if (not defined $config or (scalar keys %$config) == 0) { + my $progname = basename($0); die ("$progname: ". sprintf(_g("Failed to parse '%s'!\n"), $file)); } my $type; @@ -1243,11 +1234,8 @@ sub cascade { push (@{$hooks{'N'}}, $fl) if ($hf =~ /^native/); } } - my @ma=(); - if ($olddpkg == 0) { - @ma = split(' ',$keys{$section}{'multiarch'}) - if (defined $keys{$section}{'multiarch'}); - } + my @ma = split(' ',$keys{$section}{'multiarch'}) + if (defined $keys{$section}{'multiarch'}); push @foreignarches, @ma; my @d=(); @d = split(' ', lc($keys{$section}{'debootstrap'})) @@ -1297,15 +1285,7 @@ sub cascade { push @req_arches, $frgn_arch; } } - if ($olddpkg == 0) { - $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++; - } + $packages{$section} = join(' ', @tmp); } else { if (ref ($keys{$section}{'packages'}) eq 'ARRAY') { $packages{$section}=join(' ', @{$keys{$section}{'packages'}}); @@ -1345,13 +1325,6 @@ sub cascade { 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 { my $cmd = shift; my $retval = system ("$cmd"); @@ -1490,9 +1463,7 @@ sub dump_config { } else { $msg .= sprintf(_g("Cannot determine architecture from '%s'. Using %s.\n"), $file, $host); } - if ($olddpkg != 0) { - printf "MultiArch:\t\t%s\n",_g("Currently installed dpkg does not support MultiArch."); - } elsif (scalar (@foreignarches) > 0) { + if (scalar (@foreignarches) > 0) { $plural = ngettext("Foreign architecture", "Foreign architectures", scalar @foreignarches); printf ("MultiArch:\t\t%s: %s\n", $plural, join(" ", sort @foreignarches)); }