[Patch] Problem with new binary-all structure
Hi,
I had a few problems building potato images for the last month. Beside
the stuff Joey Hess has already fixed tools/add_packages died always.
A closer look on the mirror showed, that a lot of binary-all packages
are not a link in binary-{$ARCH} but a real file...
My add_packages should be below the message and fixes the bug and
includes Joey`s patch for non-US.
Bye, Michael
#!/usr/bin/perl -w
use strict;
my $dir = shift;
if (! -d $dir) {
die "$dir is not a directory ...";
}
my $mirror = $ENV{'MIRROR'} || die "Set the MIRROR var ...\n";
my $localdebs = $ENV{'LOCALDEBS'} || $mirror;
my $nonus = $ENV{'NONUS'} || '';
my $basedir = $ENV{'BASEDIR'} || die "Set the BASEDIR var ...\n";
require "$basedir/tools/link.pl";
open (LIST, "$basedir/tools/apt-selection cache show @ARGV |")
|| die "Can't fork : $!\n";
$/ = ''; # Browse by paragraph
my ($p, $file, $arch, $d, $realfile, $source, $section, $name);
while (defined($_ = <LIST>)) {
m/^Package: (\S+)/m and $p = $1;
m/^Filename: (\S+)/mi and $file = $1;
m/^Architecture: (\S+)/m and $arch = $1;
m/^Section: (\S+)/m and $section = $1;
$source = ($section =~ /non-US/) ? $nonus : $mirror;
# This is a hack to allow the local debs to be located elsewhere.
$source=$localdebs if $file=~m:local/:;
# If arch=all and filename is a symbolic link
# we suppose that the link points to .../binary-all/...
# and we reproduce a similar setup on the CD
if ($arch eq "all") {
if (-l "$source/$file") {
if ($section =~ /non-US/) {
$file =~ m#/([^/]+)$# and $name = $1;
symlink ("../binary-all/$name", "$dir/$file");
} else {
$file =~ m#/([^/]+/[^/]+)$# and $name = $1;
symlink ("../../binary-all/$name", "$dir/$file");
}
$file =~ s#/binary-$ENV{'ARCH'}/#/binary-all/#g;
}
elsif ($file=~ /binary-all/) {
my $newfile=$file;
$newfile =~ s#/binary-all/#/binary-$ENV{'ARCH'}/#g;
if ($section =~ /non-US/) {
$file =~ m#/([^/]+)$# and $name = $1;
symlink ("../binary-all/$name", "$dir/$newfile");
}
else {
$file =~ m#/([^/]+/[^/]+)$# and $name = $1;
symlink ("../../binary-all/$name", "$dir/$newfile");
}
}
else {
print "Source: $source/$file no Link but binary-all\n";
}
}
# And we put the file in the CD tree (with a (hard) link)
$realfile = real_file ("$source/$file");
good_link ($realfile, "$dir/$file");
}
close LIST or die "Something went wrong with apt-cache : $@ ($!)\n";
--
Michael Schlueter,Rheinische Strasse 91,44137 Dortmund,0231-7275286
schlue@debian.org
Reply to: