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

Re: Important information regarding upcoming dpkg 1.16.2 upload

On Wed, 14 Mar 2012, Raphael Hertzog wrote:
> If it outputs nothing on your system, then you're fine. Otherwise
> it should give you some instructions to follow to bring it back to a
> coherent state.

There was a bug in the script. An updated version is attached.

Note that it will list your foreign packages (on INFO: lines)
but if it outputs nothing else then you're fine. It will print
lines starting with "PROBLEM: " if it detects something wrong.

Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/

use Dpkg::Control;
use Dpkg::Index;

my $arch = `dpkg --print-architecture`;

my $status = Dpkg::Index->new(type => CTRL_FILE_STATUS);

sub find_foreign {
    my $a = shift;
    return ($a ne $arch and $a ne "all");

# Detect multiple instances which are not M-A: same
foreach my $foreign ($status->get("Architecture" => \&find_foreign)) {
    my $pkg = $foreign->{'Package'};
    my $pkgarch = $foreign->{'Package'} . ':' . $foreign->{'Architecture'};
    my $ma = $foreign->{'Multi-Arch'} || 'no';

    print "INFO: Foreign package detected: $pkgarch (Multi-Arch: $ma)\n";

    my @pkgs = $status->get("Package" => $pkg);
    if (scalar(@pkgs) > 1) {
	foreach my $item (@pkgs) {
	    $pkgarch = $item->{'Package'} . ':' . $item->{'Architecture'};
	    if ($item->{'Multi-Arch'} ne "same") {
		print "PROBLEM: one instance of $pkg is not Multi-Arch: same";
		print "SOLUTION: dpkg -P $pkgarch";

# Find broken packages
foreach my $pkg ($status->get()) {
    my $ma = $pkg->{'Multi-Arch'} || '';
    next if ($pkg->{'Status'} =~ m/ not-installed$/);

    my $pkgarch = $pkg->{'Package'};
    if ($ma eq "same") {
	$pkgarch = $pkg->{'Package'} . ':' . $pkg->{'Architecture'};

    if (! -e "/var/lib/dpkg/info/$pkgarch.list") {
	print "PROBLEM: $pkgarch has missing info files\n";
	print "SOLUTION: apt-get --reinstall install $pkgarch\n";

Reply to: