pbuilder/em_multistrap : Allow retention of source packages outside the rootfs for source distribution and allow separate configuration of the apt sources inside the rootfs.

git-svn-id: http://emdebian.org/svn/current@5753 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2009-03-29 15:37:34 +00:00
parent bd9eb8a89f
commit cecaffcddc
2 changed files with 24 additions and 5 deletions

3
debian/changelog vendored
View file

@ -1,5 +1,8 @@
emdebian-rootfs (1.8.0) unstable; urgency=low emdebian-rootfs (1.8.0) unstable; urgency=low
* Initial split from emdebian-tools source package. * Initial split from emdebian-tools source package.
* pbuilder/em_multistrap : Allow retention of source packages outside
the rootfs for source distribution and allow separate configuration
of the apt sources inside the rootfs.
-- Neil Williams <codehelp@debian.org> Thu, 26 Mar 2009 21:59:13 +0000 -- Neil Williams <codehelp@debian.org> Thu, 26 Mar 2009 21:59:13 +0000

View file

@ -21,14 +21,14 @@ use File::Basename;
use Parse::Debian::Packages; use Parse::Debian::Packages;
use strict; use strict;
use warnings; use warnings;
use vars qw/ $progname $ourversion $dstrap $extra use vars qw/ $progname $ourversion $dstrap $extra @aptsources
@archives $deb $cachedir $config_str %packages $retval $str $retries @archives $deb $cachedir $config_str %packages $retval $str $retries
$dir $include $arch $foreign $suite $url $unpack $dir $include $arch $foreign $suite $url $unpack $sourcedir
@e $sourcesname $libdir $dpkgdir @debootstrap %suites $mirror $etcdir @e $sourcesname $libdir $dpkgdir @debootstrap %suites $mirror $etcdir
$repo @dirs @touch %sources $section %keys $host $key $value $type $repo @dirs @touch %sources $section %keys $host $key $value $type
$file $config $tidy $noauth $keyring %keyrings /; $file $config $tidy $noauth $keyring %keyrings /;
$progname = basename($0); $progname = basename($0);
$ourversion = "0.0.5"; $ourversion = "0.0.6";
$unpack = "true"; $unpack = "true";
while( @ARGV ) { while( @ARGV ) {
@ -55,6 +55,11 @@ while( @ARGV ) {
elsif (/^(--tidy-up)$/) { elsif (/^(--tidy-up)$/) {
$tidy++; $tidy++;
} }
elsif (/^(--source-dir)$/) {
$sourcedir = shift (@ARGV);
$sourcedir .= ($sourcedir =~ m:/$:) ? '' : "/";
$sourcedir = (-d $sourcedir) ? $sourcedir : undef;
}
elsif (/^(--no-auth)$/) { elsif (/^(--no-auth)$/) {
$noauth++; $noauth++;
} }
@ -76,6 +81,7 @@ foreach $key (%$config)
%packages=(); %packages=();
%suites=(); %suites=();
%keyrings=(); %keyrings=();
@aptsources=();
foreach $section (sort keys %keys) foreach $section (sort keys %keys)
{ {
if ($section eq "general") if ($section eq "general")
@ -91,7 +97,11 @@ foreach $section (sort keys %keys)
($keys{$section}{'cleanup'} eq "true")); ($keys{$section}{'cleanup'} eq "true"));
$noauth++ if ((defined $keys{$section}{'noauth'}) and $noauth++ if ((defined $keys{$section}{'noauth'}) and
($keys{$section}{'noauth'} eq "true")); ($keys{$section}{'noauth'} eq "true"));
$sourcedir = $keys{$section}{'retainsources'} if
((defined $keys{$section}{'retainsources'}) and
(-d $keys{$section}{'retainsources'}));
@debootstrap = split(' ', lc($keys{$section}{'debootstrap'})); @debootstrap = split(' ', lc($keys{$section}{'debootstrap'}));
@aptsources = split (' ', lc($keys{$section}{'aptsources'}));
} }
else else
{ {
@ -160,12 +170,15 @@ foreach $repo (sort keys %suites)
if (not -e "$dir/${cachedir}archives/partial") { if (not -e "$dir/${cachedir}archives/partial") {
mkdir "$dir/${cachedir}archives/partial"; mkdir "$dir/${cachedir}archives/partial";
} }
}
foreach my $aptsrc (@aptsources)
{
if (-d "${dir}etc/apt/") if (-d "${dir}etc/apt/")
{ {
open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list")
or die "Cannot open sources list $!"; or die "Cannot open sources list $!";
$mirror = $sources{$repo}; $mirror = $sources{$aptsrc};
$suite = $suites{$repo}; $suite = $suites{$aptsrc};
print SOURCES<<END; print SOURCES<<END;
deb $mirror $suite main deb $mirror $suite main
deb-src $mirror $suite main deb-src $mirror $suite main
@ -374,7 +387,10 @@ sub tidy_apt
{ {
next if (-d $file); next if (-d $file);
next unless ($file =~ /\.deb$/); next unless ($file =~ /\.deb$/);
(defined $sourcedir) ?
system ("mv ${dir}${cachedir}archives/$file $sourcedir/$file") :
unlink ("${dir}${cachedir}archives/$file"); unlink ("${dir}${cachedir}archives/$file");
;
} }
} }
} }