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
* 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

View file

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