[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

another way debian-cd is broken now



So the main Debian archive's Packages files have changed in the past
couple of days. Previously, if there was a binary-all .deb, it would 
have a symlink to it in binary-<arch>. And the Packages file would have
a Filename field that points to that symlink.

This has changed. The Filename field now dereferences the symlink, so it
points to the actual file in binary-all.

Now, in add_packages, around line 40, we have the following code:

        if ($arch eq "all" and -l "$source/$file") {

Well, this test is always going to fail now. $file is the value of
Filename, and it never points to a symlink anymore. So the code that
makes the link in binary-<arch> is never going to run.

Then debian-cd generates its own Packages file for binary-<arch>, and
without those crucial symlinks, all the binary-all packages get left out.

The resulting cd (er, I mean coaster) has binary-all packages on it, but
they are not installable via apt.

I attach an add_packages file that seems to fix this. Diff it yourself, I
don't have time -- all this mess with the archive being changed has
thrown my deadline into chaos, and I'l be here all night picking up the
pieces.

Now I'm wondering what else this ill-advised modification of stable
after it was released has broken. Debian-cd makes some really dumb
assumptions about the archive, IMHO.

(BTW, the FileName issue is fixed now in the archive.)

-- 
see shy jo
#!/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+)/mi and $p = $1;
	m/^Filename: (\S+)/mi and $file = $1;
	m/^Architecture: (\S+)/mi and $arch = $1;
	m/^Section: (\S+)/mi and $section = $1;

if (! defined $file) {
	print "no file for $_\n";
}

	$source = ($section =~ /non-US/) ? $nonus : $mirror;

	# This is a hack to allow the local debs to be located elsewhere.
	if ($file=~m:local/:) {
		$source=$localdebs;
	}
	# If arch=all, filename may or may not be a symlink.
	# (It used to be one; the Packages files on the archive are now
	# created differently, so the link is dereferenced.)
	# So.. this code is for the case where it is a symlink.
	#   we suppose that the link points to .../binary-all/...
	#   and we reproduce a similar setup on the CD
	if ($arch eq "all" and -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;
	}
	# This code is for the case where it is not a symlink.
	# In this case, we need to make a symlink from binary-all to
	# binary-<arch>.
	elsif ($arch eq "all") {
print "DEBUG: arch all, not a link... $file\n";
		my $newfile=$file;
		$newfile =~ s#/binary-all/#/binary-$ENV{'ARCH'}/#g;
		if ($section =~ /non-US/) {
			# TODO (but it should never happen?)
			die "sorry, I don't know how to handle this";
		}
		else {
			$file =~ m#/([^/]+/[^/]+)$# and $name = $1;
print "DEBUG: symlink(../../binary-all/$name to $dir/$newfile)\n";
			symlink ("../../binary-all/$name", "$dir/$newfile");
		}
	}
	# 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";



Reply to: