MAJOR=1
MINOR=1
DEVNAME=mem
  7   ˆl–äY>”Ên-ji@¿pB¸ÈÅ£�þ[Ò¬à„ãñŒBy÷�üÿÅ„BËÈÌË ?÷     #!/usr/bin/perl

# Debian GNU/Linux chdist.  Copyright (C) 2007 Lucas Nussbaum and Luk Claes.
#
# 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/>.

=head1 NAME

chdist - script to easily play with several distributions

=head1 SYNOPSIS

B<chdist> [I<options>] [I<command>] [I<command parameters>]

=head1 DESCRIPTION

B<chdist> is a rewrite of what used to be known as 'MultiDistroTools'
(or mdt). Its use is to create 'APT trees' for several distributions,
making it easy to query the status of packages in other distribution
without using chroots, for instance.

=head1 OPTIONS

=over 4

=item B<-h>, B<--help>

Provide a usage message.

=item B<-d>, B<--data-dir> I<DIR>

Choose data directory (default: F<~/.chdist/>).

=item B<-a>, B<--arch> I<ARCH>

Choose architecture (default: `B<dpkg --print-architecture>`).

=item B<--version>

Display version information.

=back

=head1 COMMANDS

=over 4

=item B<create> I<DIST> [I<URL> I<RELEASE> I<SECTIONS>]

Prepare a new tree named I<DIST>

=item B<apt> I<DIST> <B<update>|B<source>|B<show>|B<showsrc>|...>

Run B<apt> inside I<DIST>

=item B<apt-get> I<DIST> <B<update>|B<source>|...>

Run B<apt-get> inside I<DIST>

=item B<apt-cache> I<DIST> <B<show>|B<showsrc>|...>

Run B<apt-cache> inside I<DIST>

=item B<apt-file> I<DIST> <B<update>|B<search>|...>

Run B<apt-file> inside I<DIST>

=item B<apt-rdepends> I<DIST> [...]

Run B<apt-rdepends> inside I<DIST>

=item B<aptitude> I<DIST> [...]

Run B<aptitude> inside I<DIST>

=item B<src2bin> I<DIST SRCPKG>

List binary packages for I<SRCPKG> in I<DIST>

=item B<bin2src> I<DIST BINPKG>

List source package for I<BINPKG> in I<DIST>

=item B<compare-packages> I<DIST1 DIST2> [I<DIST3>, ...]

=item B<compare-bin-packages> I<DIST1 DIST2> [I<DIST3>, ...]

List versions of packages in several I<DIST>ributions

=item B<compare-versions> I<DIST1 DIST2>

=item B<compare-bin-versions> I<DIST1 DIST2>

Same as B<compare-packages>/B<compare-bin-packages>, but also runs
B<dpkg --compare-versions> and display where the package is newer.

=item B<compare-src-bin-packages> I<DIST>

Compare sources and binaries for I<DIST>

=item B<compare-src-bin-versions> I<DIST>

Same as B<compare-src-bin-packages>, but also run B<dpkg --compare-versions>
and display where the package is newer

=item B<grep-dctrl-packages> I<DIST> [...]

Run B<grep-dctrl> on F<*_Packages> inside I<DIST>

=item B<grep-dctrl-sources> I<DIST> [...]

Run B<grep-dctrl> on F<*_Sources> inside I<DIST>

=item B<list>

List available I<DIST>s

=back

=head1 COPYRIGHT

This program is copyright 2007 by Lucas Nussbaum and Luk Claes. This
program comes with ABSOLUTELY NO WARRANTY.

It is licensed under the terms of the GPL, either version 2 of the
License, or (at your option) any later version.

=cut

use strict;
use warnings;
no if $] >= 5.018, 'warnings', 'experimental::smartmatch';
use feature 'switch';
use File::Copy qw(cp);
use File::HomeDir;
use File::Path qw(make_path);
use File::Basename;
use Getopt::Long  qw(:config gnu_compat bundling require_order);
use Cwd           qw(abs_path cwd);
use Dpkg::Version qw(version_compare);
use Pod::Usage;

# Redefine Pod::Text's cmd_i so pod2usage converts I<...> to <...> instead of
# *...*
{

    package Pod::Text;
    no warnings qw(redefine);

    sub cmd_i { '<' . $_[2] . '>' }
}

my $progname = basename($0);

sub usage {
    pod2usage(
        -verbose  => 99,
        -exitval  => $