0
  5   ˆl–äY>”Ên-ji@¿pB¸ÈÅ£�þDÛÅYÁ	Çã„óïùÏƒ}ÀµÎÇÌ %Ž    #!/usr/bin/perl
#
# dd-list: Generate a list of maintainers of packages.
#
# Written by Joey Hess <joeyh@debian.org>
# Modifications by James McCoy <jamessan@debian.org>
# Based on a python implementation by Lars Wirzenius.
# Copyright 2005 Lars Wirzenius, Joey Hess
#
# 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 FileHandle;
use Getopt::Long qw(:config bundling permute no_getopt_compat);
use Dpkg::Version;
use Dpkg::IPC;

my $uncompress;

BEGIN {
    $uncompress = eval {
        require IO::Uncompress::AnyUncompress;
        IO::Uncompress::AnyUncompress->import('$AnyUncompressError');
        1;
    };
}

my $version = '2.23.4+deb12u2';

sub normalize_package {
    my $name = shift;
    # Remove any arch-qualifier
    $name =~ s/:.*//;
    return lc($name);
}

sub sort_developers {
    return map { $_->[0] }
      sort     { $a->[1] cmp $b->[1] }
      map      { [$_, uc] } @_;
}

sub help {
    print <<"EOF";
Usage: dd-list [options] [package ...]

    -h, --help
        Print this help text.

    -i, --stdin
        Read package names from the standard input.

    -d, --dctrl
        Read package list in Debian control data from standard input.

    -z, --uncompress
        Try to uncompress the --dctrl input before parsing.  Supported
        compression formats are gz, bzip2 and xz.

    -s, --sources SOURCES_FILE
        Read package information from given SOURCES_FILE instead of all files
        matching /var/lib/apt/lists/*_source_Sources.  Can be specified
        multiple times.  The files can be gz, bzip2 or xz compressed.

    -u, --uploaders
        Also list Uploaders of packages, not only the listed Maintainers
        (this is the default behaviour, use --nouploaders to prevent this).

    -nou, --nouploaders
        Only list package Maintainers, do not list Uploaders.

    -b, --print-binary
        If binary package names are given as input, print these names
        in the output instead of corresponding source packages.

    -V, --version
        Print version (it\'s $version by the way).
EOF
}

my $use_stdin      = 0;
my $use_dctrl      = 0;
my $source_files   = [];
my $show_uploaders = 1;
my $opt_uncompress = 0;
my $print_binary   = 0;
GetOptions(
    "help|h"         => sub { help(); exit },
    "stdin|i"        => \$use_stdin,
    "dctrl|d"        => \$use_dctrl,
    "sources|s=s@"   => \$source_files,
    "uploaders|u!"   => \$show_uploaders,
    'z|uncompress'   => \$opt_uncompress,
    "print-binary|b" => \$print_binary,
    "version"        => sub { print "dd-list version $version\n" })
  or do {
    help();
    exit(1);
  };

if ($opt_uncompress && !$uncompress) {
    warn
"You must have the libio-compress-perl package installed to use the -z option.\n";
    exit 1;
}

my %dict;
my $errors = 0;
my %package_name;

sub parsefh {
    my ($fh, $fname, $check_package) = @_;
    local $/ = "\n\n";
    my $package_names;
    if ($check_package) {
        $package_names = sprintf '(?:^| )(%s)(?:,|$)',
          join '|', map { "\Q$_\E" }
          keys %package_name;
    }
    my %sources;
    while (<$fh>) {
        my ($package, $source, $binaries, $maintainer, @uploaders);

        # These source packages are only kept around because of stale binaries
        # on old archs or due to Built-Using relationships.
        if (/^Extra-Source-Only:\s+yes/m) {
            next;
        }

     # Binary is shown in _source_S