sort duplicate sources list entries and use dedicated sources list files

git-svn-id: http://emdebian.org/svn/current@7121 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2010-04-21 14:23:42 +00:00
parent 02888a842e
commit e52a364fa4
5 changed files with 101 additions and 11 deletions

View file

@ -0,0 +1,26 @@
# Example multistrap configuration file for a cross chroot for armel
# Need to use cascading to select the toolchain for the requested arch.
[General]
arch=
directory=
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=false
# extract all downloaded archives (default is true)
unpack=true
# the order of sections is not important.
# the debootstrap option determines which repository
# is used to calculate the list of Priority: required packages.
debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains
# Lenny toolchains need -base from Lenny.
[Base]
packages=gcc-4.2-base dpkg-dev binutils-multiarch
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=stable

View file

@ -0,0 +1,33 @@
# Example multistrap configuration file for a cross chroot for armel
# Need to use cascading to select the toolchain for the requested arch.
[General]
arch=
directory=
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=false
# extract all downloaded archives (default is true)
unpack=true
# the order of sections is not important.
# the debootstrap option determines which repository
# is used to calculate the list of Priority: required packages.
debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains
# Lenny toolchains need -base from Lenny.
[Base]
packages=gcc-4.2-base
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=stable
# this is a duplicate if the suite is the same as the toolchain.
[Debian]
packages=dpkg-dev binutils-multiarch
source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring
suite=testing

View file

@ -25,8 +25,9 @@ source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring keyring=debian-archive-keyring
suite=stable suite=stable
# this is a duplicate if the suite is the same as the toolchain.
[Debian] [Debian]
packages=dpkg-dev binutils-multiarch packages=dpkg-dev binutils-multiarch
source=http://ftp.uk.debian.org/debian source=http://ftp.uk.debian.org/debian
keyring=debian-archive-keyring keyring=debian-archive-keyring
suite=stable suite=unstable

4
debian/changelog vendored
View file

@ -10,8 +10,10 @@ multistrap (2.1.2) experimental; urgency=low
* Add support for reinstalling packages known to fail due to preinst * Add support for reinstalling packages known to fail due to preinst
problems. problems.
* Add a simple C file to test the compiler inside the chroot * Add a simple C file to test the compiler inside the chroot
* sort duplicate sources list entries and use dedicated sources list
files
-- Neil Williams <codehelp@debian.org> Tue, 20 Apr 2010 18:15:22 +0100 -- Neil Williams <neilw@toby-churchill.com> Wed, 21 Apr 2010 15:23:23 +0100
multistrap (2.1.1) experimental; urgency=low multistrap (2.1.1) experimental; urgency=low

View file

@ -31,7 +31,7 @@ use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror
$component $repo @dirs @touch %sources $section %keys $host $key $value $component $repo @dirs @touch %sources $section %keys $host $key $value
$type $file $config $tidy $noauth $keyring %keyrings $deflist $cfgdir $type $file $config $tidy $noauth $keyring %keyrings $deflist $cfgdir
@extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun @extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun
$omitpreinst @reinstall $tgzname /; $omitpreinst @reinstall $tgzname %uniq /;
setlocale(LC_MESSAGES, ""); setlocale(LC_MESSAGES, "");
textdomain("multistrap"); textdomain("multistrap");
@ -237,7 +237,14 @@ foreach $repo (sort keys %suites)
mkdir "$dir/${cachedir}archives/partial"; mkdir "$dir/${cachedir}archives/partial";
} }
} }
foreach my $aptsrc (@aptsources) %uniq=();
foreach my $line (@debootstrap)
{
$uniq{$line}++;
}
@debootstrap=sort keys %uniq;
%uniq=();
foreach my $aptsrc (@debootstrap)
{ {
if (defined $deflist) if (defined $deflist)
{ {
@ -248,7 +255,7 @@ foreach my $aptsrc (@aptsources)
} }
elsif (-d "${dir}etc/apt/") elsif (-d "${dir}etc/apt/")
{ {
open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap-${aptsrc}.list")
or die _g("Cannot open sources list"). $!; or die _g("Cannot open sources list"). $!;
$mirror = $sources{$aptsrc}; $mirror = $sources{$aptsrc};
$suite = $suites{$aptsrc}; $suite = $suites{$aptsrc};
@ -324,7 +331,7 @@ foreach my $sect (sort keys %packages)
chomp($str); chomp($str);
$str .= " " . join (' ', values %keyrings) . " "; $str .= " " . join (' ', values %keyrings) . " ";
chomp($str); chomp($str);
my %uniq=(); %uniq=();
@s = split (' ', $str); @s = split (' ', $str);
foreach my $a (@s) foreach my $a (@s)
{ {
@ -353,11 +360,28 @@ if (-l "${dir}lib64" ) {
} }
else else
{ {
printf (_g("\nMultistrap system installed successfully in %s.\n\n"), $dir); printf (_g("\nMultistrap system installed successfully in %s.\n"), $dir);
} }
} }
# cleanly separate the debootstrap sources from the final apt sources.
unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list")
if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list");
opendir (LISTS, "${dir}etc/apt/sources.list.d/")
or die (_g("Cannot read apt sources list directory.\n"));
my @sources=grep(!m:\.\.?$:, readdir LISTS);
closedir (LISTS);
foreach my $filelist (@sources)
{
next if (-d $filelist);
unlink ("${dir}etc/apt/sources.list.d/$filelist");
}
%uniq=();
foreach my $line (@aptsources)
{
$uniq{$line}++;
}
@aptsources=sort keys %uniq;
%uniq=();
foreach my $aptsrc (@aptsources) foreach my $aptsrc (@aptsources)
{ {
if (defined $deflist) if (defined $deflist)
@ -369,7 +393,7 @@ foreach my $aptsrc (@aptsources)
} }
elsif (-d "${dir}etc/apt/") elsif (-d "${dir}etc/apt/")
{ {
open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap-${aptsrc}.list")
or die _g("Cannot open sources list"). $!; or die _g("Cannot open sources list"). $!;
$mirror = $sources{$aptsrc}; $mirror = $sources{$aptsrc};
$suite = $suites{$aptsrc}; $suite = $suites{$aptsrc};
@ -381,6 +405,8 @@ END
close SOURCES; close SOURCES;
} }
} }
# altered the sources, so get apt to update.
(not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt;
if (defined $tgzname) if (defined $tgzname)
{ {
@ -391,12 +417,14 @@ if (defined $tgzname)
$retval /= 256; $retval /= 256;
if ($retval == 0) if ($retval == 0)
{ {
printf (_g("\nRemoving build directory: '%s'\n\n"), $dir); printf (_g("\nRemoving build directory: '%s'\n"), $dir);
system ("rm -rf $dir/*"); system ("rm -rf $dir/*");
} }
printf (_g("\nMultistrap system packaged successfully as %s.\n\n"), $tgzname); my $final_path=`realpath $dir/../$tgzname`;
chomp ($final_path);
printf (_g("\nMultistrap system packaged successfully as %s.\n"), $final_path);
} }
print "\n";
exit 0; exit 0;
sub our_version { sub our_version {