Custom Download

* Download a set of packages into a pool structure for use as a partial mirror

{{{#!/usr/bin/perl -w # # Do Custom Download 0.4 # Download a set of packages and sources for a custom deb pool # Copyright (C) 2007 Daniel Dickinson <cshore@wightman.ca> # # This program is free software; you can redistribute it and/or modify # it under the terms version 2 of the GNU General Public License as # published by the Free Software Foundation.

# 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Core modules use IO::File; use strict; use warnings; use File::Temp; use Fcntl qw/F_SETFD F_GETFD/; use Cwd;

# libcarp-clan-perl use Carp::Clan;

# libgetopt-mixed-perl use Getopt::Mixed "nextOption";

# libapt-pkg-perl use ?AptPkg::Config '$_config'; use ?AptPkg::System '$_system'; use ?AptPkg::Version;

use constant TRUE => 1; use constant FALSE => 0;

use constant EXIT_OK => 0; use constant EXIT_BAD_COMMAND_LINE => 1; use constant EXIT_UNREADABLE_FILE => 2; use constant EXIT_REPEATED_FIELD => 3; use constant EXIT_MISSING_FIELD => 4; use constant EXIT_MULTIPLE_STDIN => 5; use constant EXIT_BAD_ARCHIVE => 6; use constant EXIT_MISSING_FIELD_NAME => 7; use constant EXIT_BAD_SOURCE_FILES_FIELD => 8; use constant EXIT_STDIN_ERR => 9; use constant EXIT_FILE_OPEN_FAILED => 10; use constant EXIT_NO_HIGH_FIELDS => 11; use constant EXIT_NO_VERSION_FOR_PACKAGE => 12; use constant EXIT_CHDIR_FAILED => 13; use constant EXIT_WGET_TEMP_CLEARONEXEC_FAILED => 14; use constant EXIT_CWD_CHDIR_FAILED => 15;

use constant GERMINATE_HEADER_LINES => 2;

my $pkg_control_dir = ; my @distros; my @components; my @ignore_missing; my $include_installer = TRUE; my $from_germinate = FALSE; my $quiet = FALSE; my $verbose = 0; my $source_list_filename; my $binary_list_filename; my $pool_dir; my $archive = 'http://archive.debian.org/debian/'; my %binaries; my %sources; my @archs; my $filename; my $wget_list_handle; my $wget_filename; my %apt_ftparchive_file; my $download_size = 0; my $skip_download = FALSE; my $keep_wget_file = FALSE;

my @required_binary_fields = qw/Package Version Filename Architecture Size/; my @required_source_fields = qw/Package Version Directory Architecture Files/;

# TODO: _?FileList & ?SourceList for dists/components/Packages.gz

&parse_command_line();

if ((defined $pkg_control_dir) && ($pkg_control_dir ne )) {

} else {

}

if ((defined $pool_dir) && ($pool_dir ne )) {

} else {

}

if ($verbose > 0) {

}

if ((defined $archive) && ($archive ne )) {

} else {

}

if ($verbose > 0) {

}

if (!$quiet) {

}

&parse_package_control_files($pkg_control_dir, \@distros, \@components,

if (!$quiet) {

}

if (!$quiet) {

}

if (!$keep_wget_file) {

} else {

}

&process_package_lists($binary_list_filename, $source_list_filename);

if (!$quiet) {

}

if (!$quiet) {

}

if (!$skip_download) {

} else {

}

sub do_download {

}

sub process_package_lists {

}

sub process_package_list {

}

sub process_package {

while (($version, $fields) = each (%{$ver_hash})) {

}

sub emit_ftparchive_list {

}

sub filter_package {

}

sub trim {

}

sub print_error_exit {

}

sub parse_command_line {


\n";


\n";


\n";

Custom Apt Pool 0.4 Download a set of packages and sources for a custom deb pool Copyright (C) 2007 Daniel Dickinson <cshore@wightman.ca> Usage: do-custom-download.pl [options] [-a archive] -d=distro[,distro[,...]]

-a mirror --archive=mirror : Mirror and root dir from which to download

-l path --pkg-control=path : Where to look for package control files (relative

-d distro --distro=distro : Comma-separated list of distributions (e.g

--no-installer : Don't include installer packages -c component,.. --component=... : Comma-separated list of components to

-k architecture --architecture=architecture : Comma-separated lists of

-g --from-germinate : Package list is from germinate -p --pool : Directory containing the pool subdirectory -q --quiet : No messages, not even error (exit code only) -v --verbose : Display debugging messages This program is free software; you can redistribute it and/or modify it under the terms of the version 2 of the GNU General Public License as published by the Free Software Foundation. EOT

}

sub parse_package_control_files {

}

sub parse_package_control_package {

}

sub parse_package_control_file {

} }}}