unknown
  5  -ˆl–Ü4ý(TÐ;â�À·q ©‹Fÿ�þDÌ YÆˆáD	#mù×ƒ|@ÖÄÔ #ð   -#!/usr/bin/perl
#
# Copyright Â© 1999 Roderick Schertler
# Copyright Â© 2002 Wichert Akkerman <wakkerma@debian.org>
# Copyright Â© 2006-2009, 2011-2015 Guillem Jover <guillem@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

use strict;
use warnings;

use Getopt::Long qw(:config posix_default bundling_values no_ignorecase);
use List::Util qw(any);
use File::Find;

use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control;
use Dpkg::Checksums;
use Dpkg::Compression::FileHandle;
use Dpkg::Compression;

textdomain('dpkg-dev');

# Hash of lists. The constants below describe what is in the lists.
my %override;
use constant {
    O_PRIORITY      => 0,
    O_SECTION       => 1,
    O_MAINT_FROM    => 2,   # undef for non-specific, else listref
    O_MAINT_TO      => 3,   # undef if there's no maint override
};

my %extra_override;

my %priority = (
    'extra' => 1,
    'optional' => 2,
    'standard' => 3,
    'important' => 4,
    'required' => 5,
);

# Switches

my $debug = 0;
my $no_sort = 0;
my $src_override = undef;
my $extra_override_file = undef;
my @sources;

my @option_spec = (
    'debug!' => \$debug,
    'help|?' => sub { usage(); exit 0; },
    'version' => sub { version(); exit 0; },
    'no-sort|n' => \$no_sort,
    'source-override|s=s' => \$src_override,
    'extra-override|e=s' => \$extra_override_file,
);

sub version {
    printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
}

sub usage {
    printf g_(
"Usage: %s [<option>...] <binary-path> [<override-file> [<path-prefix>]] > Sources

Options:
  -n, --no-sort            don't sort by package before outputting.
  -e, --extra-override <file>
                           use extra override file.
  -s, --source-override <file>
                           use file for additional source overrides, default
                           is regular override file with .src appended.
      --debug              turn debugging on.
  -?, --help               show this help message.
      --version            show the version.

See the man page for the full documentation.
"), $Dpkg::PROGNAME;
}

sub load_override {
    my $file = shift;
    local $_;

    my $comp_file = Dpkg::Compression::FileHandle->new(filename => $file);
    while (<$comp_file>) {
        s/#.*//;
	next if /^\s*$/;
	s/\s+$//;

	my @data = split ' ', $_, 4;
	unless (@data == 3 || @data == 4) {
	    warning(g_('invalid override entry at line %d (%d fields)'),
	            $., 0 + @data);
	    next;
	}
	my ($package, $priority, $section, $maintainer) = @data;
	if (exists $override{$package}) {
	    warning(g_('ignoring duplicate override entry for %s at line %d'),
	            $package, $.);
	    next;
	}
	if (!$priority{$priority}) {
	    warning(g_('ignoring override entry for %s, invalid priority %s'),
	            $package, $priority);
	    next;
	}

	$override{$package} = [];
	$override{$package}[O_PRIORITY] = $priority;
	$override{$package}[O_SECTION] = $section;
	if (!defined $maintainer) {
	    # do nothing
        } elsif ($maintainer =~ /^(.*\S)\s*=>\s*(.*)$/) {
	    $override{$package}[O_MAINT_FROM] = [split m{\s*//\s*}, $1];
	    $override{$package}[O_MAINT_TO] = $2;
        } else {
	    $override{$package}[O_MAINT_TO] = $maintainer;
	}
    }
    close($comp_file);
}

sub load_src_override {
    my ($user_file, $regular_file) = @_;
    my ($file);
    local $_;

    if (defined $user_file) {
