apt-file-2.5.2ubuntu1/0000775000000000000000000000000012141424345011435 5ustar apt-file-2.5.2ubuntu1/apt-file.1.sgml0000664000000000000000000003004512141424343014161 0ustar
sjg@debian.org
Sebastien Gross J. May 2003
apt-file 1 apt-file APT package searching utility -- command-line interface apt-file action pattern apt-file file ... apt-file binary-packet.deb ... DESCRIPTION apt-file is a command line tool for searching files in packages for the APT package management system. Some actions are required to run the search: find Alias for . list List the contents of a package matching the pattern. This action is very close to the dpkg -L command except the package does not need to be installed or fetched. purge remove all Contents-* files from the cache directory. search Search in which package a file is included. A list of all packages containing the pattern is returned. apt-file will only search for filenames, not directory names. This is due to the format of the Contents files it searches. show Alias for . update Resynchronize the package contents from their sources. The lists of the contents of packages are fetched from the location(s) specified in /etc/apt/sources.list. This command attempts to fetch the Contents-<ARCH>.gz files from remote sources. For downloading these uses either the curl or wget commands as specified in apt-file.conf. OPTIONS architecture Sets architecture to architecture. This option is useful if you search a package for a different architecture from the one installed on your system. It determines how the $ARCH variable in sources.list is expanded (but it does not influence the search in any other way). cache-directory Sets the cache directory to cache-directory instead of its default. If executed as non-root user, the default is $HOME/.cache/apt-file with fall-back to /var/cache/apt/apt-file. The latter is also the default if apt-file is called as root. cdrom-mount-point Use cdrom-mount-point instead of apt's. Use contents of the given .deb archives(s) as patterns. Useful for searching for file conflicts with other packages. Implies . Read patterns from the given file(s), one per line. Use - as filename for stdin. If no files are given, then the list will be read from stdin. This is much faster than invoking apt-file many times. Do not expand search pattern with generic characters at pattern's start and end. Ignore case when searching for pattern. Only display package name; do not display file names. Skip schemes that are listed in the interactive line in apt-file.conf. This is useful if you want to call 'apt-file update' in cron jobs and skip all schemes that may require user input. sources.list Sets the sources.list file to a different value from its default /etc/apt/sources.list. Run apt-file in verbose mode. Treat pattern as a (perl) regular expression. See perlreref(1) for details. Without this option, pattern is treated as a literal string to search for. Run in dummy mode (no action). Display a short help screen. CONFIGURATION FILE The apt-file configuration file can be found in /etc/apt/apt-file.conf. A string expansion is done on several values. See the string expansion section. destination This variable describes how cached files will be named. http | ftp | ssh | rsh | file | cdrom Defines the commands used to fetch files. String expansion A sources.list entry is defined as: deb uri dist component1 component2 ... A uri is defined as: proto:/[/][user[:password]@]host[:port][/path] <host> replace with the hostname <port> replace with the port number <uri> replace with full uri <path> replace with full path (relative to / on the host) <dist> replace with distribution name <comp> replace with component name <cache> replace with cache directory <dest> replace with destination expanded value. <cdrom> replace with cdrom-mount-point. BUGS The cdrom backend has not been tested. Non-release lines in sources.list are not handled by apt-file. There is only one Contents file per distribution that contains all components (i.e. main, contrib, and non-free). Threrefore, apt-file will display search results from all components, even if not all components are included in the sources.list file. When a new line has been added to the sources.list and apt-file update has not been run, apt-file does not print a warning message. Complex regular expressions that match the leading slash may not work correctly. As a workaround, try to pull the leading slash to the beginning of the regular expression. For example, use "/(usr/bin/vim|sbin/lvm)" instead of "/usr/bin/vim|/sbin/lvm". FILES /etc/apt/sources.list Locations to fetch package contents from. /etc/apt/sources.list.d/ Directory with additional sources.list snippets /etc/apt/apt-file.conf Configuration file for apt-file. SEE ALSO auto-apt(1), apt-cache(8), apt-cdrom(8), dpkg(8), dselect(8), sources.list(5), apt.conf(5), apt_preferences(5). The APT users guide in /usr/share/doc/apt/ AUTHOR apt-file was written by Sebastien J. Gross sjg@debian.org.
apt-file-2.5.2ubuntu1/apt-file0000775000000000000000000005711512141424343013073 0ustar #!/usr/bin/perl -w # # apt-file - APT package searching utility -- command-line interface # # (c) 2001 Sebastien J. Gross # # This package 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; version 2 dated June, 1991. # # This package 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 package; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. use strict; use Config::File "read_config_file"; use Getopt::Long qw/:config no_ignore_case/; use Data::Dumper; use File::Basename; use File::Path; use File::Temp; use AptPkg::Config '$_config'; use List::MoreUtils qw/uniq/; use POSIX qw/WIFSIGNALED WTERMSIG/; my $Conf; sub error($) { print STDERR "E: ", shift, $! ? ": $!" : "", "\n"; undef $!; exit 1; } sub errorx($) { print STDERR "E: ", shift, "\n"; exit 1; } sub warning($) { print STDERR "W: ", shift, $! ? ": $!" : "", "\n"; undef $!; } sub warningx($) { print STDERR "W: ", shift, "\n"; } sub debug($;$) { return if !defined $Conf->{verbose}; my ( $msg, $use_errstr ) = @_; print STDERR "D: ", $msg; print STDERR $! ? ": $!" : "" if $use_errstr; print STDERR "\n"; undef $!; } sub debug_line($) { return if !defined $Conf->{verbose}; print STDERR shift; } sub unique($) { my $seen = (); return [ grep { !$seen->{$_}++ } @{ (shift) } ]; } sub reverse_hash($) { my $hash = shift; my $ret; foreach my $key ( keys %$hash ) { foreach ( @{ $hash->{$key} } ) { push @{ $ret->{$_} }, $key; } } return $ret; } # find_command # looks through the PATH environment variable for the command named by # $conf->{$scheme}, if that command doesn't exist, it will look for # $conf->{${scheme}2}, and so on until it runs out of configured # commands or an executable is found. # sub find_command { my $conf = shift; my $scheme = shift; my $i = 1; while (1) { my $key = $scheme; $key = $key . $i if $i != 1; return unless defined $conf->{$key}; my $cmd = $conf->{$key}; $cmd =~ s/^[( ]+//; $cmd =~ s/ .*//; if ( $cmd =~ m{^/} and -x $cmd ) { return $conf->{$key}; } for my $path ( split( /:/, $ENV{'PATH'} ) ) { return $conf->{$key} if -x ( $path . '/' . $cmd ); } $i = $i + 1; } } sub parse_sources_list($) { my $file = shift; my $uri; my @uri_items; my @tmp; my $line; my $ret; my ( $cmd, $dest ); my @files = ref $file ? @$file : [$file]; foreach $file ( grep -f, @files ) { debug "reading sources file $file"; open( SOURCE, "< $file" ) || error "Can't open $file"; while () { next if /^\s*(?:$ |[#] |deb- |rpm- ) /xo; chomp; my $line = $_; debug "got \'$line\'"; $line =~ s{([^/])\#.*$}{$1}o; $line =~ s{^(\S+\s+)\[\S+\]}{$1}o; $line =~ s{\s+}{ }go; $line =~ s{^\s+}{}o; # CDROM entry if ( @tmp = $line =~ m/^([^\[]*) \[ ([^\]]*) \] (.*)$ /xo ) { $tmp[1] =~ s/ /_/g; $line = $tmp[0] . '[' . $tmp[1] . ']' . $tmp[2]; } # Handle $(ARCH) in sources.list $line =~ s/\$\(ARCH\)/$Conf->{arch}/g; debug "kept \'$line\'"; my ( $pkg, $uri, $dist, @extra ) = split /\s+/, $line; $uri =~ s{/+$}{}; my ( $scheme, $user, $passwd, $host, $port, $path, $query, $fragment ) = $uri =~ m|^ (?:([^:/?\#]+):)? # scheme (?:// (?: ([^:@]*) #username (?::([^@]*))? #passwd @)? ([^:/?\#]*) # host (?::(\d+))? # port )? ([^?\#]*) # path (?:\?([^\#]*))? # query (?:\#(.*))? # fragment |ox; my $fetch = []; foreach (@extra) { push @$fetch, m{(.*?)/(?:.*)}o ? "$dist/$1" : "$dist"; } foreach ( @{ ( unique $fetch) } ) { if ( !defined $Conf->{"${scheme}"} ) { warningx "Don't know how to handle $scheme"; next; } $dist = $_; if ( !$Conf->{is_search} ) { $cmd = find_command( $Conf, $scheme ); die "Could not find suitable command for $scheme" unless $cmd; } else { $cmd = ""; } $dest = $Conf->{destination}; my $cache = $Conf->{cache}; my $arch = $Conf->{arch}; my $cdrom = $Conf->{cdrom_mount}; foreach my $var ( qw/host port user passwd path dist pkg cache arch uri cdrom/ ) { map { $_ =~ s{<$var(?:\|(.+?))?>} { defined eval "\$$var" ? eval "\$$var" : defined $1 ? $1 : ""; }gsex; } ( $cmd, $dest ); } $dest =~ s{(/|_)+}{_}go; $cmd =~ s//$dest/g; my $hash; foreach ( qw/host port user passwd path dist pkg uri line dest cmd scheme/ ) { $hash->{$_} = eval "\$$_"; } push @$ret, $hash; } } close SOURCE; } return $ret; } sub fetch_files ($) { umask 0022; if ( !-d $Conf->{cache} ) { eval { mkpath([$Conf->{cache}]) }; if ($@) { error "Can't create $Conf->{cache}: $@"; } if ($Conf->{is_user_cache}) { print "apt-file is now using the user's cache directory.\n", "If you want to switch back to the system-wide cache ", "directory,\n run 'apt-file purge'\n"; } } error "Can't write in $Conf->{cache}" if !-w $Conf->{cache}; foreach ( @{ (shift) } ) { if ( $Conf->{"non_interactive"} && $Conf->{interactive}->{ $_->{scheme} } ) { debug "Ignoring interactive scheme $_->{scheme}"; next; } local %ENV = %ENV; my $proxy = defined $_->{host} && $_config->get("Acquire::$_->{scheme}::Proxy::$_->{host}") || $_config->get("Acquire::$_->{scheme}::Proxy"); if ($proxy) { # wget expects lower case, curl expects upper case (except for http). # we just set/unset both delete $ENV{no_proxy}; delete $ENV{NO_PROXY}; delete $ENV{all_proxy}; delete $ENV{ALL_PROXY}; if ( $proxy =~ /^(?:DIRECT|false)$/i ) { debug "not using proxy"; delete $ENV{ lc("$_->{scheme}_proxy") }; delete $ENV{ uc("$_->{scheme}_proxy") }; } else { debug "using proxy: $proxy"; $ENV{ lc("$_->{scheme}_proxy") } = $proxy; $ENV{ uc("$_->{scheme}_proxy") } = $proxy; } } debug $_->{cmd}; my $cmd = $_->{cmd}; $cmd = "set -x; $cmd" if $Conf->{verbose}; $cmd = "($cmd) < /dev/null" if $Conf->{non_interactive}; if (!defined $Conf->{dummy}) { system($cmd); if (WIFSIGNALED($?)) { error("Update aborted by signal " .WTERMSIG($?)); } } } } sub print_winners ($$) { my ( $db, $matchfname ) = @_; my $filtered_db; # $db is a hash from package name to array of file names. It is # a superset of the matching cases, so first we filter this by the # real pattern. foreach my $key ( keys %$db ) { if ( $matchfname || ( $key =~ /$Conf->{pattern}/ ) ) { $filtered_db->{$key} = $db->{$key}; } } # Now print the winners if ( !defined $Conf->{package_only} ) { foreach my $key ( sort keys %$filtered_db ) { foreach ( uniq sort @{ $filtered_db->{$key} } ) { print "$key: $_\n"; } } } else { print map {"$_\n"} ( sort keys %$filtered_db ); } exit 0; } sub find_newest { my $name = shift; my @candidates = ("$Conf->{cache}/$name"); push @candidates, "$Conf->{user_cache}/$name" if $Conf->{user_cache}; my $file; my $mtime = 0; while (my $next = shift @candidates) { next unless -f $next; my $next_mtime = (stat($next))[9]; if ($next_mtime > $mtime) { $file = $next; $mtime = $next_mtime; } } return $file; } sub do_grep($$) { my ( $data, $pattern ) = @_; my $ret; my ( $pkgs, $fname ); debug "regexp: $pattern"; $| = 1; my $zcat; if ($Conf->{is_regexp}) { $zcat = 'zcat'; } else { delete $ENV{$_} foreach qw{GREP_OPTIONS GREP_COLOR POSIXLY_CORRECT GREP_COLORS}; my $ignore_case = $Conf->{ignore_case} ? "-i" : ""; if ($Conf->{from_file}) { $zcat = "zfgrep $ignore_case -f $Conf->{zgrep_tmpfile}"; } else { my $zgrep_pattern = $Conf->{pattern}; $zgrep_pattern =~ s{^\\/}{}; $zcat = "zfgrep $ignore_case -- $zgrep_pattern"; } } my $regexp = eval { $Conf->{ignore_case} ? qr/$pattern/i : qr/$pattern/ }; error($@) if $@; my $quick_regexp = escape_parens($regexp); my %seen = (); foreach (@$data) { my $file = find_newest($_->{dest}) or next; # Skip already searched files: next if $seen{$file}++; $file = quotemeta $file; debug "Search in $file using $zcat"; open( ZCAT, "$zcat $file |" ) || warning "Can't $zcat $file"; while () { # faster, non-capturing search first next if !/$quick_regexp/o; next if !( ( $fname, $pkgs ) = /$regexp/o ); # skip header lines # we can safely assume that the name of the top level directory # does not contain spaces next if !m{^[^\s/]*/}; debug_line "."; foreach ( split /,/, $pkgs ) { # Put leading slash on file name push @{ $ret->{"/$fname"} }, basename $_; } } close ZCAT; debug_line "\n"; } return reverse_hash($ret); } sub escape_parens { my $pattern = shift; # turn any capturing ( ... ) into non capturing (?: ... ) $pattern =~ s{ (?{pattern}; # If pattern starts with /, we need to match both ^pattern-without-slash # (which is put in $pattern) and ^.*pattern (put in $pattern2). # Later, they will be or'ed together. my $pattern2; if ( $Conf->{is_regexp} ) { if (!$Conf->{from_file}) { ($pattern, $pattern2) = fix_regexp($pattern); } } elsif ( substr( $pattern, 0, 2 ) eq '\/' ) { if ( $Conf->{fixed_strings} ) { # remove leading / $pattern = substr( $pattern, 2 ); } else { # If pattern starts with /, match both ^pattern-without-slash # and ^.*pattern. $pattern2 = '.*?' . $pattern; $pattern = substr( $pattern, 2 ); } } else { $pattern = '.*?' . $pattern unless $Conf->{fixed_strings}; } if ( ! defined $Conf->{fixed_strings} && ! defined $Conf->{is_regexp} ) { $pattern .= '[^\s]*'; $pattern2 .= '[^\s]*' if defined $pattern2; } $pattern = "$pattern|$pattern2" if defined $pattern2; $pattern = '^(' . $pattern . ')\s+(\S+)\s*$'; my $ret = do_grep $data, $pattern; print_winners $ret, 1; } sub grep_package($) { my $data = shift; my $pkgpat = $Conf->{pattern}; if ( $Conf->{is_regexp} ) { if ( $pkgpat !~ s{^(\^|\\A)}{} ) { $pkgpat = '\S*' . $pkgpat; } if ( $pkgpat !~ s{(\$|\\[zZ])$}{} ) { $pkgpat = $pkgpat . '\S*'; } $pkgpat = escape_parens($pkgpat); } elsif ($Conf->{fixed_strings}) { $pkgpat = $Conf->{pattern}; } else { $pkgpat = '\S*' . $Conf->{pattern}; } # File name may contain spaces, so match template is # ($fname, $pkgs) = (line =~ '^\s*(.*?)\s+(\S+)\s*$') my $pattern = join "", ( '^\s*(.*?)\s+', '(\S*/', $pkgpat, defined $Conf->{fixed_strings} || defined $Conf->{regexp} ? '(?:,\S*|)' : '\S*', ')\s*$', ); my $ret = do_grep $data, $pattern; print_winners $ret, 0; } sub purge_cache($) { my $data = shift; foreach (glob("$Conf->{cache}/*_Contents-*")) { debug "Purging $_"; next if defined $Conf->{dummy}; next if ( unlink $_ ) > 0; warning "Can't remove $_"; } if ($Conf->{is_user_cache}) { rmdir($Conf->{cache}); } } sub print_help { my $err_code = shift || 0; print <<"EOF"; apt-file [options] action [pattern] apt-file [options] -f action apt-file [options] -D action Configuration options: --architecture -a Use specific architecture --cache -c Cache directory --cdrom-mount -d Use specific cdrom mountpoint --dummy -y run in dummy mode (no action) --fixed-string -F Do not expand pattern --from-deb -D Use file list of .deb package(s) as patterns; implies -F --from-file -f Read patterns from file(s), one per line (use '-' for stdin) --ignore-case -i Ignore case distinctions --non-interactive -N Skip schemes requiring user input (useful in cron jobs) --package-only -l Only display packages name --regexp -x pattern is a regular expression --sources-list -s sources.list location --verbose -v run in verbose mode --help -h Show this help. -- End of options (neccessary if pattern starts with a '-') Action: update Fetch Contents files from apt-sources. search|find Search files in packages list|show List files in packages purge Remove cache files EOF exit $err_code; } sub get_options() { my %options = ( "sources-list|s=s" => \$Conf->{sources_list}, "cache|c=s" => \$Conf->{cache}, "architecture|a=s" => \$Conf->{arch}, "cdrom-mount|d=s" => \$Conf->{cdrom_mount}, "verbose|v" => \$Conf->{verbose}, "ignore-case|i" => \$Conf->{ignore_case}, "regexp|x" => \$Conf->{is_regexp}, "dummy|y" => \$Conf->{dummy}, "package-only|l" => \$Conf->{package_only}, "fixed-string|F" => \$Conf->{fixed_strings}, "from-file|f" => \$Conf->{from_file}, "from-deb|D" => \$Conf->{from_deb}, "non-interactive|N" => \$Conf->{non_interactive}, "help|h" => \$Conf->{help}, ); Getopt::Long::Configure("bundling"); GetOptions(%options) || print_help 1; } sub dir_is_empty { my ($path) = @_; defined $path or return 1; -d $path or return 1; opendir DIR, $path or die "Cannot read cache directory $path: $!\n"; while ( my $entry = readdir DIR ) { next if ( $entry =~ /^\.\.?$/ ); closedir DIR; return 0; } closedir DIR; return 1; } sub main { my $conf_file; if (exists $ENV{APT_FILE_CONFIG} && -f $ENV{APT_FILE_CONFIG}) { $conf_file = $ENV{APT_FILE_CONFIG}; } elsif (exists $ENV{HOME} && -f "$ENV{HOME}/.apt-file.conf") { $conf_file = "$ENV{HOME}/.apt-file.conf"; } elsif (-f "/etc/apt/apt-file.conf") { $conf_file = "/etc/apt/apt-file.conf"; } errorx "No config file found\n" if !defined $conf_file; $Conf = read_config_file $conf_file; get_options(); my $interactive = $Conf->{interactive}; defined $interactive or $interactive = "cdrom rsh ssh"; $Conf->{interactive} = {}; foreach my $s ( split /\s+/, $interactive ) { $Conf->{interactive}{$s} = 1; if ( !$Conf->{$s} ) { warn "interactive scheme $s does not exist\n"; } } $_config->init; $Conf->{arch} ||= $_config->{'APT::Architecture'}; $Conf->{sources_list} = [ $Conf->{sources_list} ? $Conf->{sources_list} : ( $_config->get_file('Dir::Etc::sourcelist'), glob( $_config->get_dir('Dir::Etc::sourceparts') . '/*.list' ) ) ]; $Conf->{cdrom_mount} ||= $_config->{'Acquire::cdrom::Mount'} || "/cdrom"; $Conf->{action} = shift @ARGV || "none"; if ($Conf->{from_file} || $Conf->{from_deb}) { use Regexp::Assemble; my $ra = Regexp::Assemble->new; my @list; if ($Conf->{from_deb}) { $Conf->{from_file} = 1; $Conf->{fixed_strings} = 1; $Conf->{is_regexp} = 0; debug("this is a .deb file, calling dpkg-deb to get contents"); my @content; foreach my $deb (@ARGV) { push @content, qx{dpkg-deb -c \Q$deb}; if ($? != 0) { error("Couldn't get contents from $deb"); } } foreach my $line (@content) { next if $line =~ m{/$}; # skip dirs my @fields = split(/\s+/, $line); my $filename = $fields[5]; $filename =~ s{^\.}{}; push @list, "$filename\n"; } } else { # normal text files # - assume "STDIN" if no arguments are given. push @ARGV, '-' unless @ARGV; foreach my $file (@ARGV) { if ($file eq '-') { push @list, ; next; } open(my $fh, '<', $file) or error("Can't open $file"); push @list, <$fh>; close($fh); } } if ($Conf->{is_regexp}) { foreach my $line (@list) { chomp $line; my ($p1, $p2) = fix_regexp($line); $ra->add($p1); $ra->add($p2) if defined $p2; } } else { # create tmpfile for zgrep with patterns that have leading slash removed my @zgrep_list = @list; map { s{^/}{} } @zgrep_list; my $tmpfile = File::Temp->new(); print $tmpfile @zgrep_list; $tmpfile->flush(); $Conf->{zgrep_tmpfile} = $tmpfile; # create actual search pattern @list = map {quotemeta} @list; $ra->add(@list); } $Conf->{pattern} = $ra->as_string(indent => 0); } else { $Conf->{pattern} = shift @ARGV; if ( defined $Conf->{pattern} ) { $Conf->{pattern} = quotemeta( $Conf->{pattern} ) unless $Conf->{is_regexp}; } } undef $!; my $actions = { update => \&fetch_files, search => \&grep_file, find => \&grep_file, list => \&grep_package, show => \&grep_package, purge => \&purge_cache, }; $Conf->{help} = 2 if $Conf->{action} =~ m/search|find|list|show/ && !defined $Conf->{pattern}; $Conf->{help} = 2 if !defined $actions->{ $Conf->{action} } && !defined $Conf->{help}; print_help( $Conf->{help} - 1 ) if defined $Conf->{help}; $Conf->{is_search} = 1 if $Conf->{action} =~ m/search|find|list|show/; if (!$Conf->{cache}) { my $sys_cache = $_config->get_dir('Dir::Cache') . 'apt-file'; $sys_cache =~ s{/\s*$}{}; $Conf->{cache} = $sys_cache; if ( $> != 0) { my $user_cache; # consider cache in $HOME if run as non-root if ( exists $ENV{XDG_CACHE_HOME} ) { $user_cache = "$ENV{XDG_CACHE_HOME}/apt-file"; } elsif (exists $ENV{HOME}) { $user_cache = "$ENV{HOME}/.cache/apt-file"; } if ($Conf->{is_search}) { # for search, consider both caches $Conf->{user_cache} = $user_cache; } else { # for fetch/purge, only consider the user cache $Conf->{cache} = $user_cache; $Conf->{is_user_cache} = 1; } } } debug "Using cache directory $Conf->{cache}"; my $sources = parse_sources_list $Conf->{sources_list}; errorx "No valid sources in @{$Conf->{sources_list}}" if !defined $sources; if ( $Conf->{is_search} && dir_is_empty( $Conf->{cache} ) && dir_is_empty( $Conf->{user_cache} ) ) { errorx "The cache is empty. You need to run 'apt-file update' first."; } $actions->{ $Conf->{action} }->($sources); } main(); __END__ # our style is roughly "perltidy -pbp" # vim:sts=4:sw=4:expandtab apt-file-2.5.2ubuntu1/apt-file.conf0000664000000000000000000000414012141424343014002 0ustar # Apt-file configuration file # Substitutions are made as follows: # host => remote hostname # port => remote port # uri => complete URI from sources.list # path => path from / # dist => the distribution name # cache => path to the local cache dir # dest => the destination file name inside the cache dir # cdrom => cdrom mount point # Where are located Packages destination = __dists__Contents-.gz # common code blocks can be defined as variables and be used as $check_cmd, etc. later check_cmd = ( ( gunzip -l "/_tmp" >/dev/null 2>&1 || (echo "File is not gzipped."; false) ) && mv "/_tmp" "/" 2>&1 ) error_cmd = ( rm -f "/_tmp"; echo "Can't get /dists//Contents-.gz" ) post_dl_cmd = $check_cmd || $error_cmd # Fetch methods using diffindex-download: # -i : ignore missing files # -q : be quiet # -n : download full file if more than patches would be necessary http = diffindex-download -i "/dists//Contents-.gz" / https = diffindex-download -i "/dists//Contents-.gz" / ftp = diffindex-download -i "/dists//Contents-.gz" / # In debtorrent URLs, we have to replace 'debtorrent' by 'http', and we always download the full file debtorrent = diffindex-download -i -n 0 "http://:/dists//Contents-.gz" / ssh = scp -P "@://dists//Contents-.gz" "/_tmp" && $post_dl_cmd rsh = rcp -l "://dists//Contents-.gz" "/_tmp" && $post_dl_cmd file = cp "//dists//Contents-.gz" "/" copy = cp "//dists//Contents-.gz" "/" cdrom = echo "Put CDROM labeled in the cdrom device and press [ENTER]" > /dev/stderr ; read DUMMY ; mount ""; cp "/dists//Contents-.gz" "/" ; umount "" # Schemes that might require user input on 'apt-file update' # These will be skipped if -N is given interactive = cdrom rsh ssh apt-file-2.5.2ubuntu1/diffindex-rred.1.sgml0000664000000000000000000000333512141424343015354 0ustar
sf@debian.org
Stefan Fritsch January 2009
diffindex-rred 1 diffindex-rred Restricted restricted ed diffindex-rred diff1 DESCRIPTION diffindex-rred is a command line tool for applying diff --ed style patches, as used in APT's diff/Index format. It can efficiently apply several patches in one run and does not need to read the whole source file into memory. The source file is taken from stdin. The patched file is written to stdout. Compressed patch files are decompressed automatically if they have the proper .gz, .bz2, or .lzo extension. diffindex-rred is used by diffindex-download. SEE ALSO apt-file(1), diffindex-download(1) AUTHOR diffindex-rred was written by Stefan Fritsch sf@debian.org.
apt-file-2.5.2ubuntu1/apt-file.bash_completion0000664000000000000000000000135412141424343016227 0ustar have apt-file && _apt_file() { local cur prev COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} case "$prev" in list | show) COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ); return 0 ;; search | find) _filedir return 0 ;; esac; if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-c -v -V -a -s -l -F -y -H -N -d \ --cache --verbose --version --architecture \ --sources-list --package-only --fixed-string \ --architecture --cdrom-mount --non-interactive \ --dummy --help' -- $cur ) ) else COMPREPLY=( $( compgen -W 'update search list find \ show purge' -- $cur ) ) fi return 0 } complete -f -F _apt_file apt-file apt-file-2.5.2ubuntu1/diffindex-download0000775000000000000000000002464112141424343015135 0ustar #!/usr/bin/perl # Copyright 2008 Stefan Fritsch # # 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 . use strict; use warnings; use File::Temp qw{tempdir}; use POSIX qw{WIFEXITED WEXITSTATUS WTERMSIG}; use File::Copy; use Getopt::Std; $Getopt::Std::STANDARD_HELP_VERSION=1; my %opts; getopts( 'n:qvhdikc:', \%opts ) or usage(3); usage(0) if $opts{h}; usage(1) if scalar @ARGV != 2; my $max_patches = defined $opts{n} ? $opts{n} : 50; my $debug = $opts{d}; my $verbose = -t STDOUT; if ($opts{q} ) { $verbose = 0; } if ($opts{v}) { $verbose = 1; } # handle ssl certificates my $curl_opts = ''; if ($opts{k}) { if ($opts{c}) { usage(1); } else { $curl_opts .= ' -k'; } } elsif ($opts{c}) { if (-d $opts{c}) { $curl_opts .= " --capath $opts{c}"; } elsif (-f $opts{c}) { $curl_opts .= " --cacert $opts{c}"; } } my $rred = "diffindex-rred"; my %decompress = ( "gz" => "gzip -dc", "bz2" => "bzip2 -dc", "lzo" => "lzop -dc", "" => "cat", ); my %compress = ( "gz" => "gzip -c", "bz2" => "bzip2 -c", "lzo" => "lzop -c", "" => "cat", ); my $re_sum = qr/[0-9a-f]{40}/i; my ( $url, $target ) = @ARGV; $url or die; $target or die; my $basename = $target; my $baseurl = $url; my $algo = ""; my $url_algo = ""; if ( $basename =~ s{\.(gz|bz2|lzo)}{} ) { $algo = $1; } if ( $baseurl =~ s{\.(gz|bz2|lzo)}{} ) { $url_algo = $1; } my $oldindexfile = "$basename.IndexDiff"; if ( !-e $target ) { download_full(); exit 0; } my $tmpdir = tempdir(CLEANUP => 1); my $newindexfile = "$tmpdir/Index"; my $newindex; my $current_sum; # try using the diffs to download the new file # if something goes wrong we throw an exception and download the full file eval { if (!$max_patches) { die "Patch download disabled.\n"; } my $index_url = "$baseurl.diff/Index"; info("Downloading Index $index_url:\n"); if (url_not_found($index_url)) { die "No Index available.\n"; } { # don't make curl print the progress bar for the index my $verbose; download( $index_url, $newindexfile, $oldindexfile ); } if ( ! -e $newindexfile ) { info("Index is up-to-date.\n"); exit 0; } eval { # try to get sha1sum from old Index file my $oldindex = parse_index($oldindexfile); $current_sum = $oldindex->{Current}->{sum}; }; if ($@) { # calculate sha1sum if not successful info("Calculating old sha1sum...\n"); my $result = qx/$decompress{$algo} $target | sha1sum/; if ( $? == 0 and $result =~ /^($re_sum)\s/ ) { $current_sum = lc($1); } else { die "Could not get sha1sum of old file\n"; } } $newindex = parse_index($newindexfile); if ( $current_sum eq $newindex->{Current}->{sum} ) { info("File is up-to-date.\n"); move( $newindexfile, $oldindexfile ) if !-e $oldindexfile; exit 0; } my @patches; my $patch = $newindex->{History}->{$current_sum} or die "local file too old\n"; while ( scalar @patches <= $max_patches ) { if ( !defined $newindex->{$patch} ) { die "something wrong with index: $patch missing\n"; } push @patches, $patch; $patch = $newindex->{$patch}->{next}; last if !defined $patch; } die "would require more than $max_patches patches\n" if defined $patch; info( "Downloading " . scalar @patches . " patches:\n" ); my @args = map { ( "$baseurl.diff/$_.gz", "$tmpdir/$_.gz" ) } @patches; download(@args); info("Applying patches...\n"); @args = map { "$tmpdir/" . quotemeta($_) . ".gz" } @patches; system_or_die( "$decompress{$algo} $target | $rred @args | $compress{$algo} > ${target}_new", "Failed to apply patches with $rred", [ "${target}_new", $oldindexfile ] ); move( "${target}_new", $target ); move( $newindexfile, $oldindexfile ); }; if ($@) { # something went wrong, download full file warn "$@" if $verbose; if ( $@ =~ /signal 2/ ) { # exit if CTRL-C was pressed exit 2; } download_full(); } exit 0; ########################## END of main ####################################### # args: url, filename [, url, filename [, ...]] [, oldfile] # (we want to be able to download multpile files with http keepalive) # download only if remote is newer than oldfile sub download { my $oldfile; $oldfile = pop(@_) if scalar @_ % 2; my %urls = @_; my $command = "curl -L -f -g $curl_opts"; $command .= " -sS" if !$verbose; $command .= " -z $oldfile" if ($oldfile && -e $oldfile); foreach my $url ( keys %urls ) { $command .= " " . quotemeta($url) . " -o " . quotemeta( $urls{$url} ); } system_or_die( $command, "Download of " . join( " ", keys %urls ) . " failed", [ values %urls ] ); } sub download_full { if ( url_not_found($url) ) { info("Ignoring source without Contents File:\n $url\n"); return; } info("Downloading complete file $url\n"); download( $url, "${target}_new", $target ); if (! -e "${target}_new") { info("File is up-to-date.\n"); exit(0); } if ( $url_algo ne $algo ) { system_or_die( "$decompress{$url_algo} ${target}_new | $compress{$algo} > ${target}_new2", "Recompression from '$url_algo' to '$algo' failed", [ "${target}_new", "${target}_new2" ] ); move( "${target}_new2", $target ); unlink "${target}_new"; } else { move( "${target}_new", $target ); } unlink $oldindexfile if -e $oldindexfile; } sub url_not_found { my $url = shift; my $cmd = "curl -L -s -I -g $curl_opts" . quotemeta($url); my $headers = qx{$cmd}; debug("'$cmd' ($?):\n$headers"); if ( WIFEXITED($?) && WEXITSTATUS($?) == 19 ) { # FTP file not found return 1; } if ( $headers =~ m{^HTTP/1.. 404}m ) { return 1; } return 0; } sub parse_index { my $file = shift; my $data = {}; open( my $fh, "<", $file ) or die "could not open $file\n"; my ( $section, $previous, $line ); while ( defined( $line = <$fh> ) ) { if ( $line =~ m{^SHA1-Current:\s*($re_sum)\s+(\d+)\s*$}m ) { if ( $data->{Current} ) { die "Invalid Index $file:$.: Multiple SHA1-Current\n"; } $data->{Current}->{sum} = lc($1); $data->{Current}->{size} = $2; } elsif ( $line =~ m{^SHA1-(History|Patches):\s*$} ) { $section = $1; if ( $data->{$section} ) { die "Invalid Index $file:$.: Multiple SHA1-$1\n"; } $previous = undef; } elsif ( $line =~ m{^\s+($re_sum)\s+(\d+)\s+(\S+)\s*$} ) { my ( $sum, $size, $name ) = ( lc($1), $2, $3 ); if ( !defined $section ) { die "Invalid Index $file:$.: File info without section\n"; } if ( $name =~ /[^-\w.,]/ ) { die "Patch name $name contains invalid characters\n"; } $data->{$section}->{$sum} = $name; if ( $section eq 'History' ) { $data->{$name}->{sum} = $sum; $data->{$name}->{size} = $size; if ( defined $previous ) { $data->{$previous}->{next} = $name; } $previous = $name; } else { $data->{$name}->{patch_sum} = $sum; $data->{$name}->{patch_size} = $size; } } elsif ( $line =~ m{^#} or $line =~ m{^\s*$} ) { next; } else { die "Invalid Index $file:$.: $line\n"; } } close($fh); foreach $section (qw/History Patches Current/) { defined $data->{$section} or die "Invalid Index: Missing SHA1-$section in $file\n"; } return $data; } # call system($command) # On failure: print $msg, call code or unlink files in $cleanup, then die sub system_or_die { my ( $command, $msg, $cleanup ) = @_; $command = '/bin/bash -c "set -o pipefail; "' . quotemeta($command); debug("Executing '$command'\n"); system($command); if ( WIFEXITED($?) ) { if ( WEXITSTATUS($?) != 0 ) { warn "$msg\n" if $msg; cleanup($cleanup); die "Command exited with code " . WEXITSTATUS($?) . "\n"; } else { return; } } else { warn "$msg\n" if $msg; cleanup($cleanup); die "Command died with signal " . WTERMSIG($?) . "\n"; } } sub cleanup { my $clean = shift; $clean || return; if (ref($clean) eq 'ARRAY') { unlink(@{$clean}); } elsif (ref($clean) eq 'CODE') { eval { $clean->(); }; } elsif (ref($clean) eq '') { unlink($clean); } else { die 'invalid argument in cleanup'; } } sub info { print @_ if $verbose; } sub debug { print @_ if $debug; } sub usage { my $rv = shift; print << "EOF"; Usage: $0 [-n ] [-i] [-q] [-d] [-k|-c cacerts] -n don't download more than num patches, download whole file instead (use large num with slow network / fast CPU and small num with fast network / slow CPU) -i don't exit with errror if URL does not exist -q be quiet -d print additional debug messages -k with https: do not verify peer certificate -c use file as CA certificate bundle (see --cacert in curl man page) -c use dir as CA certificate directory (see --capath in curl man page) EOF exit $rv; } sub HELP_MESSAGE { usage(0); } # our style is roughly "perltidy -pbp" # vim:sts=4:sw=4:expandtab apt-file-2.5.2ubuntu1/apt-file.spec0000664000000000000000000000354312141424343014015 0ustar Name: apt-file Summary: APT package search utility Version: 0.2.4 Release: 2 Source: %{name}-%{version}.tar.gz Group: System Copyright: GPL BuildRoot: /tmp/making_of_%{name}_%{version} Patch: %{name}-%{version}-rpm URL: http://apt4rpm.sourceforge.net Packager: apt4rpm-devel@lists.sourceforge.net Requires: perl-libwww-perl >= 5.53, perl-AppConfig >= 1.52, gzip >= 1.2.4 #---------------------------------------------------------- %define PREFIX /usr %define DOCS debian/copyright changelog README TODO #---------------------------------------------------------- %description apt-file is a command line tool for searching packages for the APT packaging system. Unlike apt-cache, you can search in which package a file is inclued or list the contents of a package without installing or fetching it. #---------------------------------------------------------- %prep [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT #---------------------------------------------------------- %setup #---------------------------------------------------------- %build #---------------------------------------------------------- %install install -d -m 755 $RPM_BUILD_ROOT/etc/apt install -d -m 755 $RPM_BUILD_ROOT%{PREFIX}/bin install -d -m 755 $RPM_BUILD_ROOT%{PREFIX}/share/man/man1 install -m 755 apt-file $RPM_BUILD_ROOT%{PREFIX}/bin install -m 644 apt-file.1 $RPM_BUILD_ROOT%{PREFIX}/share/man/man1 install -m 644 apt-file.conf $RPM_BUILD_ROOT/etc/apt #---------------------------------------------------------- %clean [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT #---------------------------------------------------------- %files %defattr(-,root,root) %config(noreplace) /etc/apt/apt-file.conf %{PREFIX}/bin/* %doc %{DOCS} %doc %{_mandir}/man1/* %changelog * Mon May 02 2002 R Bos - Initial rpm version apt-file-2.5.2ubuntu1/rapt-file.1.sgml0000664000000000000000000000762312141424343014351 0ustar
thijs@debian.org
Thijs Kinkhorst May 2012
rapt-file 1 rapt-file APT package searching utility -- search remotely rapt-file action DESCRIPTION rapt-file is a command line tool for searching files in packages for the APT package management system. It differs from apt-file in that it works with remote package indices, so it doesn't need to download full Contents files. find Alias for . list List the contents of a package matching the pattern. This action is very close to the dpkg -L command except the package does not need to be installed or fetched. search Search in which package a file is included. A list of all packages containing the pattern is returned. rapt-file will only search for filenames, not directory names. This is due to the format of the Contents files it searches. show Alias for . OPTIONS architecture Sets architecture to architecture. This option is useful if you search a package for a different architecture from the one installed on your system. It determines how the $ARCH variable in sources.list is expanded (but it does not influence the search in any other way). Only display package name; do not display file names. Run rapt-file in verbose mode. Display a short help screen. FILES /etc/apt/sources.list Locations to fetch package contents from. /etc/apt/sources.list.d/ Directory with additional sources.list snippets AUTHOR rapt-file was written by Enrico Zini enrico@debian.org.
apt-file-2.5.2ubuntu1/TODO.diffindex0000664000000000000000000000020212141424343014054 0ustar calculate and compare sha1 sum of result help message for diffindex-download options for verbose/quiet/curl progress bar handling apt-file-2.5.2ubuntu1/debian/0000775000000000000000000000000012141730524012656 5ustar apt-file-2.5.2ubuntu1/debian/apt-file.do-apt-file-update0000664000000000000000000000014212141424344017657 0ustar #!/bin/sh # # This script gets called from the update-notifier hook. # /usr/bin/apt-file update apt-file-2.5.2ubuntu1/debian/copyright0000664000000000000000000000072012141424344014610 0ustar This package was debianized by Sebastien J. Gross on Sat, 13 Oct 2001 21:36:47 +0200. Authors: Sebastien J. Gross Enrico Zini (for rapt-file) Stefan Fritsch (for diffindex-*) Copyright: Copyright 2001-5 Sebastien J. Gross License: This software is distributed under the GNU General Public License, which can be found at /usr/share/common-licenses/GPL-2. apt-file-2.5.2ubuntu1/debian/docs0000664000000000000000000000000712141424344013526 0ustar README apt-file-2.5.2ubuntu1/debian/apt-file.is-cache-empty0000664000000000000000000000056212141424344017114 0ustar #!/bin/sh # This script checks if the cache directory is empty # # TODO: might exclude obsolete files from check, so it returns false/1 in case of upgrades. for dir in $XDG_CACHE_HOME/apt-file $HOME/.cache/apt-file /var/cache/apt/apt-file do if [ -d $dir ] && [ -n "$(find $dir -mindepth 1 -not -name '*tmp')" ] then # Cache is not empty exit 1 fi done exit 0 apt-file-2.5.2ubuntu1/debian/compat0000664000000000000000000000000212141424344014054 0ustar 8 apt-file-2.5.2ubuntu1/debian/apt-file.postrm0000664000000000000000000000027312141424344015627 0ustar #! /bin/sh # postremoval script for apt-file set -e; if [ "purge" = "$1" ]; then rm -fr /var/cache/apt/apt-file/ rm -f /var/lib/update-notifier/user.d/apt-file-update fi; #DEBHELPER# apt-file-2.5.2ubuntu1/debian/control0000664000000000000000000000261112141730417014262 0ustar Source: apt-file Section: admin Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Niels Thykier Uploaders: Thijs Kinkhorst , Enrico Zini Build-Depends: debhelper (>= 8), docbook, docbook-utils, libconfig-file-perl, libapt-pkg-perl, liblist-moreutils-perl, libregexp-assemble-perl, libfile-temp-perl, libtest-minimumversion-perl, libtest-strict-perl, perl, perl (>= 5.12) | libtest-simple-perl (>= 0.93) Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/collab-maint/deb-maint/apt-file/trunk/ Vcs-svn: svn://s/anonscm.debian.org/viewvc/collab-maint/deb-maint/apt-file/trunk/ Package: apt-file Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, curl, libconfig-file-perl, libapt-pkg-perl, liblist-moreutils-perl, libregexp-assemble-perl, libfile-temp-perl Recommends: python, python-apt Suggests: openssh-client, sudo Description: search for files within Debian packages (command-line interface) apt-file is a command line tool for searching files contained in packages for the APT packaging system. You can search in which package a file is included or list the contents of a package without installing or fetching it. If you would prefer not to download the large files used by apt-file you can run rapt-file, which calls a remote server to do the searches. apt-file-2.5.2ubuntu1/debian/apt-file.update-notifier0000664000000000000000000000105612141424344017402 0ustar Name: apt-file update needed Name-ja_JP: apt-file ã®æ›´æ–°ãŒå¿…è¦ã§ã™ Priority: Medium Command: "/usr/share/apt-file/do-apt-file-update" Terminal: True DisplayIf: /usr/share/apt-file/is-cache-empty Description: You may need to update or create the apt-file cache. Running this command likely needs an active internet connection. Description-ja_JP: apt-file ã®ã‚­ãƒ£ãƒƒã‚·ãƒ¥ã‚’æ›´æ–°ã€ã¾ãŸã¯ä½œæˆã—ãªã‘れã°ã„ã‘ã¾ã›ã‚“。 ã“ã®ã‚³ãƒžãƒ³ãƒ‰ã®å®Ÿè¡Œã«ã¯ã€ã‚¤ãƒ³ã‚¿ãƒ¼ãƒãƒƒãƒˆæŽ¥ç¶šãŒæœ‰åйã«ãªã£ã¦ã„ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ apt-file-2.5.2ubuntu1/debian/dirs0000664000000000000000000000011512141424344013537 0ustar etc/apt usr/bin usr/share/apt-file usr/share/man/man1 var/cache/apt/apt-file apt-file-2.5.2ubuntu1/debian/changelog0000664000000000000000000006307312141730524014541 0ustar apt-file (2.5.2ubuntu1) saucy; urgency=low * Merge from Debian unstable. Remaining changes: - Fix location of Contents files for Ubuntu. -- Bhavani Shankar Mon, 06 May 2013 19:03:12 +0530 apt-file (2.5.2) unstable; urgency=low [ Stefan Fritsch ] * Properly detect failed attempt to apply patches. Closes: #687221 [ Niels Thykier ] * New maintainer. (Closes: #703366) Kudos to Stefan Fritsch for his work on apt-file. * When using "-f" and no files are given, default to stdin. (Closes: #703594) * Bump Standards-Versions to 3.9.4 - no changes required. * Use the canonical URIs for the Vcs-* fields. -- Niels Thykier Sun, 05 May 2013 09:32:24 +0200 apt-file (2.5.1ubuntu1) raring-proposed; urgency=low * Merge from Debian unstable (LP: #1073472). Remaining changes: - Fix location of Contents files for Ubuntu. -- Chase Douglas Wed, 31 Oct 2012 10:09:50 +0100 apt-file (2.5.1) unstable; urgency=low [ Thijs Kinkhorst ] * Fix searching for patterns that start with a '-'. This still requires specifying '--' before the pattern (closes: #631438, LP: #801336) * Unset env variables that may influence the behaviour of grep (closes: #617183). * Japanese translation of update-notifier text by Hideki Yamane (closes: #641199). * Improve man page layout and help output text. Thanks Jari Aalto for the patch! (Closes: #651695) * rapt-file: replace dpkg-architecture call with dpkg --architecture, obsoleting the depends-heavy recommendation on dpkg-dev. Thanks helix84 (Closes: #671225). * Checked for policy 3.9.3, no changes needed. Add explicit python recommendation, even though we transitively recommended it via python-apt already, to satisfy Lintian. * Add rapt-file manual page (Closes: #613005). [ Enrico Zini ] * rapt-file: Updated distribution names, now it works on wheezy. (Closes: #663592) * rapt-file: deal with missing /etc/apt/sources.list. (Closes: #636564) -- Thijs Kinkhorst Sun, 03 Jun 2012 10:26:36 +0200 apt-file (2.5.0ubuntu1) oneiric; urgency=low * Fix location of Contents files for Ubuntu. (LP: #817622) -- Jean-Louis Dupond Sat, 06 Aug 2011 00:16:02 +0200 apt-file (2.5.0) unstable; urgency=low [ Paul Wise ] * rapt-file: Drop python-apt wrapper shell script, detect the lack of a python apt module in the rapt-file python code (Closes: #619414). * mention rapt-file in the package description (Closes: #623632) [ Thijs Kinkhorst ] * apt-file: Include compontent in Contents file search paths so we use ftp-master's new Contents files locations. This may break compatibility with older suites that do not have this configuration (Closes: #624734). * rapt-file: Ignore files not ending in .list in sources.list.d (Closes: #607861). * rapt-file: Recommend dpkg-dev because we use dpkg-architecture (Closes: #613006). * Correct scp invocation in apt-file.conf (Closes: #624290). * Small packaging cleanups. -- Thijs Kinkhorst Sun, 24 Jul 2011 16:01:09 +0000 apt-file (2.4.2) unstable; urgency=low * Correct empty cache detection logic. Closes: #612347 -- Stefan Fritsch Tue, 08 Feb 2011 00:15:17 +0100 apt-file (2.4.1) unstable; urgency=low * Recommend python-apt for rapt-file. Closes: #609571 * If both the per-user cache and the system cache contain data, use the newer one. Closes: #609810 * Bump standards-version (no changes) -- Stefan Fritsch Sun, 06 Feb 2011 22:45:17 +0100 apt-file (2.4.0) unstable; urgency=low * Add -f option to read many patterns from a file or from stdin. * Add -D option to search for file conflicts with a given .deb file. Closes: #514985 * Add https support to default apt-file.conf. Closes: #582254. LP: #331091 * Add options to diffindex-download to set CA certificates and to disable certificate verification. * Don't use su-to-root in update-notifier anymore and drop Suggests: menu. LP: #508089 * Abort 'apt-file update' if the user pressed Control-C. LP: #499039 * Don't append an OS error string to an error or warning message if the message has nothing to do with the last OS operation. * Convert to source format 3.0 (native). -- Stefan Fritsch Wed, 26 May 2010 22:58:20 +0200 apt-file (2.3.4) unstable; urgency=low * Fix diffindex-download not allowing IPv6 literall addresses in URLs. Closes: #581191 * Fix bashism in cdrom section of apt-file.conf. Closes: #579050 * Bump Standards-Version (no changes). -- Stefan Fritsch Wed, 12 May 2010 00:06:38 +0200 apt-file (2.3.3) unstable; urgency=low * Fix search for unanchored regex with leading slash (bug introduced in 2.3.1, closes: #563688). -- Stefan Fritsch Fri, 08 Jan 2010 20:00:36 +0100 apt-file (2.3.2) unstable; urgency=low * Downgrade 'Recommends: menu' to 'Suggests: menu' (closes: #543353). * Update postinst message to mention the possibility to run 'apt-file update' as non-root (closes: #540905). * Mention in the man page that apt-file will display results from all components (e.g. non-free), even if those components are not listed in the sources.list file (closes: #552986). * Make the update-notifier hook also look into the user's cache before asking to update (closes: #534191). * When creating a cache in the user's home dir, print a message how to switch back to the system wide cache directory (closes: #541327). -- Stefan Fritsch Sun, 13 Dec 2009 12:48:19 +0100 apt-file (2.3.1) unstable; urgency=low [ Thijs Kinkhorst ] * Note in manpage that directories are not found (closes: #557181). [ Stefan Fritsch ] * Rework anchoring logic for package and regexp searches (closes: #557719). * Bump Standards-Version (no changes). -- Stefan Fritsch Sun, 29 Nov 2009 14:00:44 +0100 apt-file (2.3.0) unstable; urgency=low * Add initial version of rapt-file, which does not rely on the downloaded file lists, but queries dde.debian.net for every search. It does not offer all features of apt-file (closes: #518764). * Add Enrico to Uploaders. * Fix perl warning when $HOME is not set (closes: #527303) * Make diffindex-download check if stdout is a terminal instead of stdin, to determine if it should be quiet. This fixes 'apt-file -N' disabling the download progress report (closes: #526393) * Bump Standards-Version: - add support for DEB_BUILD_OPTIONS=nocheck -- Stefan Fritsch Mon, 03 Aug 2009 21:38:45 +0200 apt-file (2.2.2) unstable; urgency=low * diffindex-download improvements for the case when diff/Index is not available (LP: #316155): - make error message less noisy - don't calculate the sha1sum of the old file, it's futile anyway - don't redownload the full file if it has not changed -- Stefan Fritsch Mon, 16 Feb 2009 22:46:33 +0100 apt-file (2.2.1) unstable; urgency=low * Fix ftp download (closes: #511672). -- Stefan Fritsch Tue, 13 Jan 2009 21:04:33 +0100 apt-file (2.2.0) unstable; urgency=low * Ship 'diffindex-download' and 'diffindex-rred' for downloading patches instead of the full Contents files. Use this for http and ftp in default config file (closes: #373589). * diffindex-download uses curl with progress meter enabled by default (can be changed in apt-file.conf). Closes: #381613 Therefore always depend on curl and remove dependency on wget. * diffindex-download prints some error messages if no connection is possible (closes: #357031). * Make 'apt-file purge' remove old content files even if the sources.list line has been removed in the meantime (closes: #507092). * Make tests not require wget or curl during build-time. Thanks James Westby (closes: #506554). -- Stefan Fritsch Tue, 06 Jan 2009 16:59:04 +0100 apt-file (2.1.6) unstable; urgency=low * Use ~/.cache/apt-file as cache directory if called as non-root user, but fall back to the old /var/cache/apt/apt-file. This allows to use 'apt-file update' as non-root (closes: #443728). * No longer search for apt-file.conf in the current directory. Instead, allow to choose the config file with the APT_FILE_CONFIG environment variable. * Update bash completion (closes: #502655). * Add some tests and run them during build. -- Stefan Fritsch Wed, 12 Nov 2008 17:04:10 +0100 apt-file (2.1.5) unstable; urgency=low * Fix wrong permissions for cache directory created by old versions (closes: #495519). * Fix leading slashes being ignored when searching, a regression introduced by the fix for #483624 (closes: #496127). * Give meaningful error message if cache dir cannot be read. * Bump standards version (no changes). -- Stefan Fritsch Sat, 23 Aug 2008 18:56:17 +0200 apt-file (2.1.4) unstable; urgency=low [ Stefan Fritsch ] * Fix perl warning during apt-file update (closes: #484292). * Fix perl warning in some regexp searches (closes: #487856). [ Thijs Kinkhorst ] * Make instruction about apt-file update in postinst more generic (Closes: #489821). -- Stefan Fritsch Wed, 09 Jul 2008 00:02:03 +0200 apt-file (2.1.3) unstable; urgency=low [ Thijs Kinkhorst ] * Recommend menu rather than depend on it since it's not strictly necessary (Closes: #483406). [ Stefan Fritsch ] * Fix substring search when absolute path is given (Closes: #483624). -- Stefan Fritsch Sat, 31 May 2008 16:14:21 +0200 apt-file (2.1.2) unstable; urgency=low * Add new option --non-interactive/-N to skip schemes that may require user interaction during 'apt-file update'. This is useful for cron jobs. * Change BEGIN block to make 'perl -c' work. * Accept 'false' as an alias for 'DIRECT' in apt's proxy configuration (closes: #476961) and ignore case. Also print the selected proxy in verbose mode. * Run perltidy on the source code. -- Stefan Fritsch Sun, 18 May 2008 19:15:26 +0200 apt-file (2.1.1) unstable; urgency=low [ Thijs Kinkhorst ] * Fix dashism (!) in is-cache-empty (Closes: #472592). * Ship cache dir in package to prevent warnings while apt-file has not yet been run (closes: #474545). * Add docbook build-depends for manpages. [ Stefan Fritsch ] * With curl, use -f to abort on any error and not just on 404s. * Allow absolute paths for commands in apt-file.conf. * Do not reorder commands' STDOUT and STDERR. * Make is-cache-empty ignore *tmp (closes: #474227). * Extract proxy information from apt config and set environment variables accordingly (closes: #350716). * Slightly increase speed of regexp searches. * Use package version in 'apt-file --version' output. * Clarify pattern syntax in man page (closes: #474334). * Clarify use of --architecture option in man page (closes: #472807). * Handle debtorrent: urls in sources.list (thanks to Jö Fahlke, closes: #461315). -- Stefan Fritsch Sun, 06 Apr 2008 18:09:53 +0200 apt-file (2.1.0) unstable; urgency=low [ Stefan Fritsch ] * Hijack package. New maintainer. * Add Thijs as uploader. * Acknowledge NMU (closes: #397381). Thanks to Gunnar Wolf and Kevin Glynn. * Import changes from Ubuntu. This fixes these bugs: - Regular expression search with -x does not really work (Closes: #259446) - fails to read /etc/apt/sources.list.d/ (Closes: #353275) - manpage says dpkg -S when it means dpkg -L (Closes: #376828) - please apply more complete patch to fix output (Closes: #382312) - silently fails when there are no file lists (Closes: #408309) - bash_completion: `_apt-file': not a valid identifier (Closes: #441041) - bash_completion does not complete filename after search command (Closes: #448358) - typo in apt-file.conf (Closes: #451840) Thanks to Daniel Hahler, Emmet Hikory, and Barry deFreese. * Fix misleading error message when cache dir does not exist (Closes: #456166). * Set umask on apt-file update to ensure cache is always world readable (Closes: #361878). * Don't show files repeatedly which are in the same package in several suites (Closes: #402228). * Allow bundling of short options (Closes: #384013). * Correctly extract file and directory names from apt config (Closes: #446621). * Use zfgrep to speed up non-regex searches (Closes: #470488). To be able to do this, we need a different way to trim the header of Contents.gz than used in the patch for bug #382312 (Closes: #293942). * Pass 'set -x' to the shell when in verbose mode. * Refactor apt-file.conf: - Move common code blocks in apt-file.conf to separate variables. - Use gunzip -l instead of file to check if a file is gzipped. - Fix misleading comments (Closes: #356790). - Remove chmod 644 since we now set umask correctly. * Correctly handle parentheses in regexp searches (Closes: #467619). * Correctly handle fixed string (-F) searches (Closes: #469375). * Remove update-notifier hook file when package is purged. * Remove cdbs build dependency. * Add vcs header to debian/control. [ Thijs Kinkhorst ] * Remove ancient versioned-depends on essential package gzip. * Add missing debhelper compat file. * Correct misspelled architecture variable name, makes architecture selection work again. Thanks Enno Cramer (Closes: #364411). * Change suggestion from ssh to openssh-client (Closes: #375578). * Many documentation cleanups (thanks Era Eriksson for some, Closes: #320322, #412133). * Rebuild man page from sgml during package build. * Change section to admin, following override. * Drop -N parameter from wget command since it's not allowed in combination with -O according to the manual (Closes: #380736). -- Thijs Kinkhorst Mon, 24 Mar 2008 10:47:28 +0100 apt-file (2.0.8.2ubuntu4) hardy; urgency=low * apt-file.bash_completion: use _apt_file instead of _apt-file for completion function (LP: #173057, Closes: #441041) -- Daniel Hahler Sun, 09 Mar 2008 17:42:01 +0100 apt-file (2.0.8.2ubuntu3) hardy; urgency=low * Improved "need to run apt-file update" experience (LP: #154180) - debian/apt-file.postinst: - Do not call apt-file update anymore directly - install update-notifier hook - debian/control: Depend on "menu" for su-to-root - apt-file: test if the cache directory is empty for actions search/find and show/list. * apt-file: reverted removal of leading slash in pattern and implement logic to match both without slash at the beginning and with slash inside (LP: #181600). Apply the same logic to regexp patterns (-x). * debian/rules: - moved DH_COMPAT=3 to debian/compat (increased to 5) - Fixed debian-rules-ignores-make-clean-error - Dropped binary-arch target * Fix typos/wording in README * apt-file.conf: Add integrity check for fetched files (LP: #176753) * apt-file: find_command: remove leading spaces and open parentheses before looking for the command, so that the new defaults in apt-file.conf work * apt-file: print output from command after executing it, so that errors and notes from there get to the user * debian/apt-file.postrm: added DEBHELPER marker * debian/control: - Dropped Build-Depends-Indep: debhelper (>> 3.0.0) - Build-Depends: debhelper (>= 5), cdbs - Standards-Version: 3.7.3 - Recommend "file", which gets used optionally for the integrity check * apt-file.bash_completion: filename/directory completion for "search", patch taken from Debian bug #448358 * apt-file/do_grep: only search in all cache files once (LP: #174134) * apt-file: fix display of warning in purge_cache, if the file cannot be deleted * Applied patches from Kevin Glynn in a lot of places, see Debian bug #382312). Thanks! * Support files in /etc/apt/sources.list.d/ (LP: #190602) (Closes: #353275) Patches from Amos Shapira and Andrew Schulman. -- Daniel Hahler Fri, 15 Feb 2008 00:18:52 +0100 apt-file (2.0.8.2ubuntu2) gutsy; urgency=low [Matti Lindell] * debian/control: Change Maintainer to XSBC-Original-Maintainer * Remove spurious files left from merge (LP: #119887) [Emmet Hikory] * Change manpage "list" description from dpkg -S to dpkg -L (LP: #107004) * Add bash-completion for apt-file show (LP: #106997) * Add apt-file.postinst to run apt-file update on install (LP: #74097) -- Emmet Hikory Sun, 17 Jun 2007 08:13:23 +0900 apt-file (2.0.8.2ubuntu1) feisty; urgency=low * Re-merge from Debian unstable. * Kept Ubuntu changes: *apt-file (2.0.8ubuntu2) edgy; urgency=low * Fix regexp handling (Closes Malone: #33485) * Thanks to Chris Moore * Fix man page issue (Closes Malone: #33483) * Thanks again to Chris Moore *apt-file (2.0.8ubuntu1) edgy; urgency=low * Fixed a typo in apt-file.conf * Stephen Hermann -- Barry deFreese Wed, 6 Dec 2006 22:08:41 -0500 apt-file (2.0.8.2) unstable; urgency=low * Non-maintainer upload. * The Contents.gz files map a file to the list of packages that contain it. do_grep grabs all these packages, this fix post-processes its result so that we only print out the packages that do match the given pattern. Also, take account that a file name may have spaces and avoid false positives by tightening the grep pattern. NOTE: this is a minimal NMU patch to close important bug #382312 (it also closes two similar bugs). There is a more complete patch available in the bts for #382312 that I think would make apt-file much more useful and closes other bugs. (Closes: #382312, #376607, #358821) * Updated Version String to 2.0.8.2 (Closes: #376458) -- Kevin Glynn Mon, 6 Nov 2006 15:47:57 -0600 apt-file (2.0.8.1) unstable; urgency=low * Non-maintainer upload by Gunnar Wolf * Updated dependency on libconfigfile-perl to libconfig-file-perl; updated the reference in code to ConfigFile to point to Config::File instead as well. (Closes: #387018) -- Gunnar Wolf Fri, 27 Oct 2006 13:38:03 -0500 apt-file (2.0.8) unstable; urgency=low * Allow curl to redirect (Closes: #363670) * Download to temp file when using curl (Closes: #349585) * Remove cache when package purge (Closes: #362031) * Close old bugs (Closes: #319867) -- Sebastien J. Gross Thu, 20 Apr 2006 12:13:45 +0200 apt-file (2.0.7) unstable; urgency=low * change cache dir to /var/cache/apt-/apt-file (Closes: #341169) * fixed up "bad file descriptor" error when running in debug (Closes: #348527) * Changes configuration file to handle 404s and not erase existing Contents files (Closes: #349585) * changed configuration to not complain if Contents files are not in cache yet (Closes: #316310, #317964) * changed configuration to softly ignore missing Contents files (Closes: #316311) * changed configuration to permissions in cache directory (Closes: #319066) * minor fixes (Closes: #320318, #323641, #323682, #320313) * add find command as a search alias (Closes: #320737) -- Sebastien J. Gross Thu, 2 Mar 2006 00:12:54 +0100 apt-file (2.0.6) unstable; urgency=low * Now ftp method works (Closes: #307971, #307973) * Add wget methods to config file (in comments) (Closes: #307972) -- Sebastien J. Gross Mon, 9 May 2005 15:04:43 +0200 apt-file (2.0.5) unstable; urgency=low * Remove duplicate lines (Closes: #238852) * Search error fix (Closes: #276394) * Remove tailling slash (Closes: #280690) * Add notes on both curl and wget (Closes: #307714, #229540, #226070) * Old bug closed (Closes: #217678) -- Sebastien J. Gross Thu, 5 May 2005 18:00:15 +0200 apt-file (2.0.4) unstable; urgency=low * Update configuration file from wget to curl (Closes: #186846) * Fixed some typos (Closes: #264967, #236719) * Changes license/copyright (Closes: #290057) * Explicitly change Contents file to 644 (Closes: #271349) * "show" is now an alias for "list" (Closes: #286757) * add bash_completion (Closes: #301997) -- Sebastien J. Gross Wed, 4 May 2005 15:32:10 +0200 apt-file (2.0.3-7) unstable; urgency=low * Add french man page (Closes: #235338) * As the wget backend can be changed in configuration file, apt-file recommends but does not depend on it (see #183942) (Closes: #237802, #242582) -- Sebastien J. Gross Tue, 29 Jun 2004 10:56:58 +0200 apt-file (2.0.3-6) unstable; urgency=low * Added -x option (Thanks to Olaf Klischat) -- Sebastien J. Gross Mon, 15 Mar 2004 00:38:23 +0100 apt-file (2.0.3-5) unstable; urgency=low * Fixed write in current directory when using FTP (Closes: #226969) -- Sebastien J. Gross Wed, 14 Jan 2004 01:56:07 +0100 apt-file (2.0.3-4) unstable; urgency=low * Fixed uninitialized values (Closes: #195198, #203607, #211439) * Fixed lines begining with spaces (Closes: #225269) * Fixed copy method in configuration file (Closes: #224485) -- Sebastien J. Gross Mon, 12 Jan 2004 13:49:56 +0100 apt-file (2.0.3-3) unstable; urgency=low * Fixed typo in debian/changelog (Closes: #196959) * Fixed vendors information is included in sources.list (Closes: #206358) * Fixed update fails if experimental is used (Closes: #216894) Fixes thanks to Marc 'HE' Brockschmidt -- Sebastien J. Gross Wed, 22 Oct 2003 22:13:28 +0200 apt-file (2.0.3-2) unstable; urgency=low * Remove leading slash in pattern (Closes: #190122) -- Sebastien J. Gross Fri, 16 May 2003 15:14:51 +0200 apt-file (2.0.3-1) unstable; urgency=low * Fixed some typos in manpage (Closes: #176774) * Regexp optimization (case insensitive support) (Closes: #193480) * Recommends wget (Closes: #183942) * Do not store empty files (Closes: #183270) * Quote filename passed to zcat (Closes: #185664) * Handles right cdrom device (Closes: #182382) -- Sebastien J. Gross Fri, 16 May 2003 12:42:47 +0200 apt-file (2.0.2-1) unstable; urgency=low * Fixed inexistent content files (Closes: #172596) -- Sebastien J. Gross Wed, 11 Dec 2002 12:25:35 +0100 apt-file (2.0.1-2) unstable; urgency=low * Check pattern argument (Closes: #171573) -- Sebastien J. Gross Tue, 3 Dec 2002 14:42:08 +0100 apt-file (2.0.1-1) unstable; urgency=low * Fix non-release line in sources.list causes failure (Closes: #171490) -- Sebastien J. Gross Tue, 3 Dec 2002 12:13:15 +0100 apt-file (2.0.0) unstable; urgency=low * Entire program rewriting (Closes: #128553, #161393, #131146, #149188, #153544, #167258, #170720, #128769, #128850, #130308, #132966, #155769, #159569, #170672, #170674, #147442, #158038, #127338, #141039) -- Sebastien J. Gross Mon, 2 Dec 2002 17:56:06 +0100 apt-file (0.2.3-3) unstable; urgency=low * Does not check write privilege but for update (Closes: #128466) * Fix typo in man page (Closes: #128551, #131366) * Update description (Closes: #133042) -- Sebastien J. Gross Sat, 23 Feb 2002 17:17:03 +0100 apt-file (0.2.3-2) unstable; urgency=low * Fix return code * use http_proxy if needed -- Sebastien J. Gross Wed, 9 Jan 2002 15:37:33 +0100 apt-file (0.2.3-1) unstable; urgency=low * Use ftp_proxy if needed (Closes: #128289) * Warns if file not found while fetching (Closes: #128290) -- Sebastien J. Gross Tue, 8 Jan 2002 16:42:49 +0100 apt-file (0.2.2-5) unstable; urgency=low * Use locale architecture (closes #127025) * Create cache directory if unexistant (closes #128007) * Check write privilege on cache dir (closes #128008, #128007) -- Sebastien J. Gross Mon, 7 Jan 2002 14:09:49 +0100 apt-file (0.2.2-4) unstable; urgency=low * Fix Undefined value (closes #127339) * Now use by default auto-apt cache dir (see Bug#126908) * Fix tabs breaks in sources.list (closes #127553) -- Sebastien J. Gross Fri, 4 Jan 2002 12:08:25 +0100 apt-file (0.2.2-3) unstable; urgency=low * Fix package description (closes #126639) * Add auto-apt(1) cache support (closes #126908) -- Sebastien J. Gross Sun, 30 Dec 2001 02:12:24 +0100 apt-file (0.2.2-2) unstable; urgency=low * Fix missing coma (closes #126862) -- Sebastien J. Gross Sat, 29 Dec 2001 14:21:02 +0100 apt-file (0.2.2-1) unstable; urgency=low * Fix pattern search * Add multiple packages files * Add in to the Debian Project (closes #125386) -- Sebastien J. Gross Thu, 20 Dec 2001 17:50:15 +0100 apt-file (0.2.1-3) unstable; urgency=low * Add netbase and libwww-perl dependencies -- Sebastien J. Gross Thu, 20 Dec 2001 01:11:15 +0100 apt-file (0.2.1-2) unstable; urgency=low * Conf file location update -- Sebastien J. Gross Tue, 13 Nov 2001 04:45:25 +0200 apt-file (0.2.1-1) unstable; urgency=low * Improved regexp search * Add --version option * Disabled --recursive option * Add `gzip' dependancy * Add conffile -- Sebastien J. Gross Mon, 12 Nov 2001 21:55:25 +0200 apt-file (0.2.0-2) unstable; urgency=low * Changed bad value for CONF_FILE -- Sebastien J. Gross Wed, 17 Oct 2001 11:22:00 +0200 apt-file (0.2.0-1) unstable; urgency=low * Initial Release. -- Sebastien J. Gross Sat, 13 Oct 2001 21:36:47 +0200 Local variables: mode: debian-changelog End: apt-file-2.5.2ubuntu1/debian/apt-file.postinst0000664000000000000000000000134112141424344016163 0ustar #!/bin/sh set -e #DEBHELPER# if [ "$1" != configure ]; then exit 0 fi # fix wrong permissions created by old versions if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.1.5~ && ! dpkg-statoverride --list /var/cache/apt/apt-file > /dev/null 2>&1 then chmod 755 /var/cache/apt/apt-file fi unud=/var/lib/update-notifier/user.d if /usr/share/apt-file/is-cache-empty; then echo "The system-wide cache is empty. You may want to run 'apt-file update'" echo "as root to update the cache. You can also run 'apt-file update' as" echo "normal user to use a cache in the user's home directory." fi if [ -d $unud ]; then cp -f /usr/share/apt-file/apt-file-update.update-notifier \ "$unud/apt-file-update" fi apt-file-2.5.2ubuntu1/debian/source/0000775000000000000000000000000012141424345014157 5ustar apt-file-2.5.2ubuntu1/debian/source/format0000664000000000000000000000001512141424344015365 0ustar 3.0 (native) apt-file-2.5.2ubuntu1/debian/rules0000775000000000000000000000365112141424344013743 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) TEST_TARGET = else TEST_TARGET = test endif ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) jobs = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) PAR_ARGS=-j $(jobs) endif VERSION=$(shell dpkg-parsechangelog |egrep ^Version: | cut -d ' ' -f 2) build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: dh_testdir # Add here commands to compile the package. $(MAKE) all $(TEST_TARGET) #/usr/bin/docbook-to-man debian/apt-file.sgml > apt-file.1 touch build-stamp clean:: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/apt-file. $(MAKE) install DESTDIR=$(CURDIR)/debian/apt-file perl -p -i -e 's/^use constant VERSION.*/use constant VERSION => "$(VERSION)";/' debian/apt-file/usr/bin/apt-file install -m 644 debian/apt-file.update-notifier debian/apt-file/usr/share/apt-file/apt-file-update.update-notifier install -m 755 debian/apt-file.do-apt-file-update debian/apt-file/usr/share/apt-file/do-apt-file-update install -m 755 debian/apt-file.is-cache-empty debian/apt-file/usr/share/apt-file/is-cache-empty install -m 755 rapt-file debian/apt-file/usr/bin/rapt-file # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installdocs # dh_installcron dh_installman dh_installchangelogs dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_perl dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep .PHONY: build clean binary-indep binary-arch binary install apt-file-2.5.2ubuntu1/diffindex-download.1.sgml0000664000000000000000000000702112141424343016223 0ustar
sf@debian.org
Stefan Fritsch January 2009
diffindex-download 1 diffindex-download Download utility for Debian Contents files diffindex-download URL filename DESCRIPTION diffindex-download is a command line tool for downloading Contents files. It uses APT's diff/Index format patches when available to avoid downloading the full file. diffindex-download is used by apt-file. OPTIONS number If more than number patches would be necessary, download the whole file. Specifying 0 to always download the whole file is possible. Don't verify the peer certificate when using https. cacert If cacert is a directory: Use cacert as CA certificate path. Otherwise use cacert as CA certificate bundle. See the --capath and --cacert options in the curl(1) man page. Don't exit with errror if the URL does not exist. This is useful as some archives don't provide Contents files. Be quiet (opposite of -v). The default if stdout is not a terminal. Be verbose (opposite of -q). The default if stdout is a terminal. Print additional debug info. Display a short help screen. SEE ALSO apt-file(1), diffindex-rred(1), curl(1) AUTHOR diffindex-download was written by Stefan Fritsch sf@debian.org.
apt-file-2.5.2ubuntu1/tests-diffindex/0000775000000000000000000000000012141424345014535 5ustar apt-file-2.5.2ubuntu1/tests-diffindex/F1.diff20000664000000000000000000000005412141424344015715 0ustar 0a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 . apt-file-2.5.2ubuntu1/tests-diffindex/08.diff10000664000000000000000000000001112141424343015665 0ustar 4d 1a . apt-file-2.5.2ubuntu1/tests-diffindex/01.in0000664000000000000000000000000012141424344015272 0ustar apt-file-2.5.2ubuntu1/tests-diffindex/05.in0000664000000000000000000000002312141424344015303 0ustar 1 2 3 4 5 6 . . . apt-file-2.5.2ubuntu1/tests-diffindex/F1.diff10000664000000000000000000000001412141424344015710 0ustar s/.// 1a . apt-file-2.5.2ubuntu1/tests-diffindex/03.diff0000664000000000000000000000003012141424344015601 0ustar 8c . 4c .. . s/.// a . apt-file-2.5.2ubuntu1/tests-diffindex/02.diff0000664000000000000000000000002012141424344015577 0ustar 3,4c c . 1c a . apt-file-2.5.2ubuntu1/tests-diffindex/06.in0000664000000000000000000000000012141424344015277 0ustar apt-file-2.5.2ubuntu1/tests-diffindex/08.diff30000664000000000000000000000002012141424344015670 0ustar 7a 9 10 11 . 1d apt-file-2.5.2ubuntu1/tests-diffindex/08.wanted0000664000000000000000000000002312141424344016162 0ustar 3 5 6 7 8 9 10 11 apt-file-2.5.2ubuntu1/tests-diffindex/04.wanted0000664000000000000000000000002612141424344016161 0ustar 1 2 3 4 . 5 6 . .. . apt-file-2.5.2ubuntu1/tests-diffindex/02.wanted0000664000000000000000000000001012141424344016150 0ustar a 2 c 5 apt-file-2.5.2ubuntu1/tests-diffindex/09.in0000664000000000000000000000002312141424344015307 0ustar 1 2 3 4 5 6 . . . apt-file-2.5.2ubuntu1/tests-diffindex/01.diff0000664000000000000000000000001312141424344015600 0ustar 0a 1 2 3 . apt-file-2.5.2ubuntu1/tests-diffindex/03.wanted0000664000000000000000000000002212141424344016154 0ustar 1 2 3 . 5 6 . . apt-file-2.5.2ubuntu1/tests-diffindex/07.diff0000664000000000000000000000000512141424343015606 0ustar 1,3d apt-file-2.5.2ubuntu1/tests-diffindex/04.diff0000664000000000000000000000003212141424344015604 0ustar 8c .. . 4a .. . s/.// a . apt-file-2.5.2ubuntu1/tests-diffindex/06.diff0000664000000000000000000000010112141424344015603 0ustar 0a 1 .. . s/.// a 2 .. . s/.// a 3 .. . s/.// a 4 .. . s/.// a . apt-file-2.5.2ubuntu1/tests-diffindex/05.diff0000664000000000000000000000006012141424343015605 0ustar 10a .. . s/.// a .. . s/.// a .. . s/.// a . 2d apt-file-2.5.2ubuntu1/tests-diffindex/08.in0000664000000000000000000000001012141424344015302 0ustar 1 2 3 4 apt-file-2.5.2ubuntu1/tests-diffindex/F1.in0000664000000000000000000000001012141424344015321 0ustar 1 2 3 4 apt-file-2.5.2ubuntu1/tests-diffindex/07.wanted0000664000000000000000000000000012141424344016154 0ustar apt-file-2.5.2ubuntu1/tests-diffindex/01.wanted0000664000000000000000000000000612141424344016154 0ustar 1 2 3 apt-file-2.5.2ubuntu1/tests-diffindex/F2.diff.gz0000664000000000000000000000006012141424344016250 0ustar ‹™çG9.diffHäÒÓãÒã*Ö×Ó×çÂËá2Já<îa·0apt-file-2.5.2ubuntu1/tests-diffindex/09.diff.gz0000664000000000000000000000006012141424344016231 0ustar ‹™çG9.diff34HäÒÓãÒã*Ö×Ó×çÂËá2Já<îa·0apt-file-2.5.2ubuntu1/tests-diffindex/F1.diff30000664000000000000000000000002012141424344015707 0ustar 7a 9 10 11 . 1d apt-file-2.5.2ubuntu1/tests-diffindex/Makefile0000664000000000000000000000005512141424344016174 0ustar test: ./runtests clean: rm -f *.out *.tmp apt-file-2.5.2ubuntu1/tests-diffindex/F2.in0000664000000000000000000000002312141424344015326 0ustar 1 2 3 4 5 6 . . . apt-file-2.5.2ubuntu1/tests-diffindex/05.wanted0000664000000000000000000000002712141424344016163 0ustar 1 3 4 5 6 . . . . . . apt-file-2.5.2ubuntu1/tests-diffindex/runtests0000775000000000000000000000230112141424343016344 0ustar #!/bin/bash -eu RRED=../diffindex-rred RC=0 for t in [0-9]*.in ; do n=${t%.in} echo -n Test $n: if ! $RRED $n.diff* < $t > $n.out ; then echo FAILED RC=1 elif ! cmp $n.wanted $n.out 2> /dev/null; then echo FAILED "(unexpexted output)" RC=1 else echo PASS rm $n.out fi done for t in F*.in ; do n=${t%.in} echo -n Test $n: if $RRED $n.diff* < $t > $n.out 2> $n.stderr; then echo FAILED "(returned 0 but should have exited with error)" RC=1 elif [ ! -s $n.stderr ]; then echo FAILED "(should have given some error message)" RC=1 else echo PASS rm $n.out $n.stderr fi done # do some more tests aplying two diffs at the same time for i1 in {01,02,03,07,08}.in ; do for i2 in {01,02,03,07,08}.in ; do for i3 in {01,02,03,07,08}.in ; do n1=${i1%.in} n2=${i2%.in} n3=${i3%.in} echo -n Test "$n1->$n2->$n3:" diff --ed $i1 $i2 > $n1.$n2.1.tmp || true diff --ed $i2 $i3 > $n2.$n3.2.tmp || true if ! $RRED $n1.$n2.1.tmp $n2.$n3.2.tmp < $i1 > $n1.$n2.$n3.out ; then echo FAILED RC=1 elif ! cmp $n1.$n2.$n3.out $i3 2> /dev/null ; then echo FAILED "(unexpexted output)" RC=1 else echo PASS rm $n1.$n2.$n3.out $n1.$n2.1.tmp $n2.$n3.2.tmp fi done done done exit $RC apt-file-2.5.2ubuntu1/tests-diffindex/06.wanted0000664000000000000000000000002012141424344016155 0ustar 1 . 2 . 3 . 4 . apt-file-2.5.2ubuntu1/tests-diffindex/04.in0000664000000000000000000000002312141424344015302 0ustar 1 2 3 4 5 6 . . . apt-file-2.5.2ubuntu1/tests-diffindex/08.diff20000664000000000000000000000002012141424344015667 0ustar 4a 5 6 7 8 . 3d apt-file-2.5.2ubuntu1/tests-diffindex/03.in0000664000000000000000000000002312141424344015301 0ustar 1 2 3 4 5 6 . . . apt-file-2.5.2ubuntu1/tests-diffindex/02.in0000664000000000000000000000001212141424344015276 0ustar 1 2 3 4 5 apt-file-2.5.2ubuntu1/tests-diffindex/07.in0000664000000000000000000000000612141424344015306 0ustar 1 2 3 apt-file-2.5.2ubuntu1/tests-diffindex/09.wanted0000664000000000000000000000002712141424344016167 0ustar 1 3 4 5 6 . . . . . . apt-file-2.5.2ubuntu1/apt-file.fr.1.sgml0000664000000000000000000002276312141424343014577 0ustar
sjg@debian.org
Sebastien Gross J. Mai 2003
apt-file 1 apt-file utilitaire APT de recherche de paquet -- interface en ligne de commande apt-file action motif DESCRIPTION apt-file est un outil en ligne de commande de recherche de paquets pour le sytème de paquet APT. Il est nécessaire de faire quelques actions avant de pouvoir lancer une recherche : update Resynchronise le contenu des paquets depuis leurs sources. Les contenus de paquets sont récupérés depuis les adresses spécifiées dans /etc/apt/sources.list. Cette commande essaie de récupérer le fichier Contents-<ARCH>.gz depuis la source distante. search Recherche dans quel paquet un fichier est inclus. Une liste de tous les paquets contenant le motif motif est affichée. list Liste le contenu d'un paquet correspondant au motif motif. Cette action ressemble beaucoup à la commande dpkg -L sauf que les paquets n'ont pas besoin d'être installés ou récupérés. purge Supprime tous les fichiers Content-<ARCH>.gz dans le répertoire de cache. OPTIONS répertoire-de-cache Fixe le répertoire de cache à répertoire-de-cache au lieu de sa valeur par défaut (/var/cache/apt). Vous pourrez alors utiliser apt-file même si vous n'avez pas les droits d'administrateur. Lance la commande apt-file en mode bavard. point-de-montage-du-cédérom Utilise point-de-montage-du-cédérom à la place de celui la commande apt. Ne développe pas motif. architecture Positionne l'architecture à architecture. Cette option est utile si vous cherchez un paquet pour une architecture différente de celle sur laquelle votre système est installé. sources.list Positionne le fichier sources.list à une valeur différente de celle par défaut (/etc/apt/sources.list). Affiche seulement le nom du paquet. N'affiche pas le nom des fichiers. N'étend pas le motif de recherche avec des caractères génériques au début et à la fin du motif. Lance en mode simulation (pas d'action). Affiche un court message d'aide. FICHIER DE CONFIGURATION Le fichier de configuration de apt-file (/etc/apt/apt-file.conf) a changé entre la version 1 et la version 2. Maintenant, seules les méthodes de récupération sont définies dans le fichier de configuration. Il est donc plus facile de configurer des mandataires. Une expansion de chaîne est faite sur plusieurs valeurs. Regardez la section expansion de chaînes. destination Cette variable décrit la manière de nommer les fichiers en cache. http | ftp | ssh | rsh | file | cdrom Voici les commandes utilisées pour récuperer les fichiers. Expansion de chaînes Une entrée du sources.list est définie ainsi : deb uri dist composant1 composant2 ... une uri, est définie ainsi : proto:/[/][utilisateur[:motdepasse]@]hôte[:port][/chemin] <hôte> remplace le nom de l'hôte. <port> remplace le numéro du port. <uri> remplace l'uri complète. <chemin> remplace le chemin complet (relatif à la racine de l'hôte) <dist> remplace le nom de la distribution <comp> remplace le nom du composant <cache> remplace le nom du répertoire de cache <dest> remplace destination par sa valeur étendue. <cdrom> remplace point-de-montage-du-cédérom. FICHIERS /etc/apt/sources.list Adresse où récupérer le contenu des paquets. /etc/apt/apt-file.conf Fichier de configuration pour apt-file. VOIR AUSSI auto-apt(1), apt-cache(8), apt-cdrom(8), dpkg(8), dselect(8), sources.list(5), apt.conf(5), apt_preferences(5). Le guide de l'utilisateur d'APT dans /usr/share/doc/apt/ BOGUES la méthode pour les cédéroms n'a pas encore été testé. Les lignes qui n'ont pas de version ne sont pas gérées par apt-file. AUTEUR apt-file a été écrit par Sebastien J. Gross sjg@debian.org. TRADUCTION Julien Louis leonptitlouis@ifrance.com
apt-file-2.5.2ubuntu1/README0000664000000000000000000000062112141424343012312 0ustar DESCRIPTION apt-file allows you to find in which package a file is included. This application has the same behaviour as the web version found at http://packages.debian.org. Additionally you can list all files included in a package without installing or downloading it (see dpkg -S and dpkg --contents for more details about listing a package content). See the apt-file(1) man page for more details apt-file-2.5.2ubuntu1/Makefile0000664000000000000000000000256212141424343013100 0ustar # # apt-file - APT package searching utility -- command-line interface # Makefile # #DESTDIR=debian/apt-file INSTALL=install DOCBOOK2MAN=docbook2man BINDIR=$(DESTDIR)/usr/bin ETCDIR=$(DESTDIR)/etc/apt MANDIR=$(DESTDIR)/usr/share/man/man1 COMPDIR=$(DESTDIR)/etc/bash_completion.d all: man install: $(INSTALL) -d -m 755 $(MANDIR) $(INSTALL) -m 644 apt-file.1 $(MANDIR) $(INSTALL) -m 644 diffindex-download.1 $(MANDIR) $(INSTALL) -m 644 diffindex-rred.1 $(MANDIR) $(INSTALL) -m 644 rapt-file.1 $(MANDIR) $(INSTALL) -d -m 755 $(BINDIR) $(INSTALL) -m 755 apt-file $(BINDIR) $(INSTALL) -m 755 diffindex-download $(BINDIR) $(INSTALL) -m 755 diffindex-rred $(BINDIR) $(INSTALL) -d -m 755 $(ETCDIR) $(INSTALL) -m 644 apt-file.conf $(ETCDIR) $(INSTALL) -d -m 755 $(COMPDIR) $(INSTALL) -m 644 apt-file.bash_completion $(COMPDIR)/apt-file uninstall: rm -f $(BINDIR)/apt-file rm -f $(ETCDIR)/apt-file.conf rm -f $(MANDIR)/apt-file.1 rm -f $(MANDIR)/rapt-file.1 man: $(DOCBOOK2MAN) apt-file.1.sgml $(DOCBOOK2MAN) diffindex-download.1.sgml $(DOCBOOK2MAN) diffindex-rred.1.sgml $(DOCBOOK2MAN) apt-file.fr.1.sgml $(DOCBOOK2MAN) rapt-file.1.sgml test: prove make -C tests-apt-file test make -C tests-diffindex test clean: rm -f *~ manpage.* apt-file.1 rapt-file.1 apt-file.fr.1 diffindex-download.1 diffindex-rred.1 make -C tests-apt-file clean make -C tests-diffindex clean apt-file-2.5.2ubuntu1/changelog0000664000000000000000000000337612141424343013316 0ustar [For newer changes, please refer to debian/changelog] Version 2.0.3 2003-05-16 Fixed some typos in manpage Regexp optimization (case insensitive support) Do not store empty files Quote filename passed to zcat Handles right cdrom device Remove leading / in pattern Version 2.0.2 2002-12-11 Creates inexistent content files fix. Version 2.0.1 2002-12-03 Non-release line in sources.list causes failure Support for $(ARCH) in sources.list Check pattern argument for both list and search options Version 2.0.0 2002-12-02 Entirelly rewrote the program Now fetch commands are external thus no proxy problem. Version 0.2.5 2002-05-09 use ->mirror instead of -> request, http files won't be downloaded again if they are unchanged (thanks to Ariel Shkedi ) Version 0.2.4 2002-05-03 Add RPM support (thanks to Richard Bos ) Version 0.2.3 2002-01-08 Use ftp_proxy if needed Warns if file not found while fetching Version 0.2.2 2002-01-07 Use locale architecture Create cache directory if unexistant Check write privilege on cache dir 2002-01-04 Fix Undefined value in main() Now use by default auto-apt cache dir Fix tabs breaks in sources.list 2001-12-29 Fix typo 2001-12-21 Fix some command line parse problems 2001-12-20 Fix pattern search Add multiple packages files version 0.2.1 2001-11-12 Emproved regexp search Add --version option Remove --recursive option version 0.2.0 2001-10-17 Changed bad value for CONF_FILE 2001-10-15 First realease apt-file-2.5.2ubuntu1/diffindex-rred0000775000000000000000000002107212141424343014255 0ustar #!/usr/bin/perl -w # Copyright 2008 Stefan Fritsch # # 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 . use strict; use File::Temp qw/tmpnam/; if ( !scalar @ARGV or $ARGV[0] eq '-h' or $ARGV[0] eq '--help' ) { print << "EOF"; usage: $0 [ [...] ] Input will be taken from stdin and written to stdout. The files diff1 ... need to be ed style diffs from 'diff --ed'. *.gz, *.bz2, and *.lzo patches are decompressed automatically EOF exit 1 if !scalar @ARGV; exit 0; } my $patches; my $filename; foreach my $filename (@ARGV) { if ( $filename =~ m{\.gz$} ) { $filename = "gunzip -c $filename |"; } elsif ( $filename =~ m{\.bz2$} ) { $filename = "bunzip2 -c $filename |"; } elsif ( $filename =~ m{\.lzo$} ) { $filename = "lzop -dc $filename |"; } else { $filename = "<$filename"; } $patches = merge_patches(read_patch($filename), $patches); } my $cur = 1; my $p; while (defined ($p = $patches->() )) { my ( $op, $lines, $lines_ref ) = @{$p}; if ( $op eq 'D' ) { die "Invalid number in D: $lines" unless $lines > 0; while ($lines-- > 0) { my $line = ; if ( !defined $line ) { die "end of input while at: @{$p}\n"; } } } elsif ($op eq 'I') { print @{$lines_ref}; } elsif ($op eq 'C') { die "Invalid number in C: $lines" unless $lines > 0; while ($lines-- > 0) { my $line = ; if ( !defined $line ) { die "end of input while at: @{$p}\n"; } print $line; } } } # copy rest of file my $line; while ( defined( $line = ) ) { print $line; } # Reads a diff --ed style patch file # Returns iterator function over patch hunks # - in reverse order # - converted into simple operations: _C_opy, _I_nsert, _D_elete # Each hunk is an array consisting of # - operation # - number of lines # - ref to array of lines (only for insert) sub read_patch { my $filename = shift; open( my $fh_patch, $filename ) or die "Could not open '$filename'\n"; my $line; my @hunks; # current position in the file my $num; while ( defined( $line = <$fh_patch> ) ) { chomp $line; my ($op, $n, $m); if ( $line =~ /^(\d+)(a)$/ ) { # Na: add lines after line N $n = $1; $op = $2; $m = $n; $n++; } elsif ( $line =~ /^(\d+)([cd])$/ ) { # Nd: remove line N # Nc: remove line N, then insert after line N-1 $n = $1; $op = $2; $m = $n; } elsif ( $line =~ /^(\d+),(\d+)([cd])$/ ) { # N,Md: remove lines N to M # N,Mc: remove lines N to M, then insert after line M-1 $n = $1; $m = $2; $op = $3; } elsif ( $line eq 's/.//' ) { # replace inserted ".." line by "." my $lines_ref = $hunks[0]->[2]; if ( ref($lines_ref) ne 'ARRAY') { die "Invalid format:$filename:$.:$line:Not preceeded by add or change\n"; } if ( $lines_ref->[-1] ne "..\n" ) { die "Invalid format:$filename:$.:$line:Not preceeded by '..'\n"; } else { $lines_ref->[-1] = ".\n"; } } elsif ( $line eq 'a' ) { # insert some more lines after the 's/.//' replacement my $lines_ref = $hunks[0]->[2]; if ( ref($lines_ref) ne 'ARRAY' ) { die "Invalid format:$filename:$.:$line:Not preceeded by add or change\n"; } while ( defined( $line = <$fh_patch> ) and $line ne ".\n" ) { push @$lines_ref, $line; $hunks[0]->[1]++; } } else { die "Invalid format:$filename:$.:$line\n"; } if (!defined $op) { # we are merging with the last op next; } if ( $num ) { if ( $num < $n || $num < $m ) { die "Not in reverse order:$filename:$.:$line\n$num\n"; } my $copy = $num - $m - 1; unshift @hunks, [ 'C', $copy ] if $copy; } $num = $n; if ($op eq 'd' || $op eq 'c') { unshift @hunks, [ 'D', $m - $n + 1]; } if ($op eq 'a' || $op eq 'c') { my @lines; while ( defined( $line = <$fh_patch> ) and $line ne ".\n" ) { push @lines, $line; } unshift @hunks, [ 'I', scalar @lines, \@lines ]; } } if (defined $num && $num > 1) { # copy the rest of the file, i.e. the beginning since we are operating # in reverse order unshift @hunks, [ 'C', $num - 1]; } #print STDERR "@$_\n" foreach (@hunks); #print STDERR "\n"; close($fh_patch) or die "Error reading patch"; return sub { shift @hunks }; } # merges two patches # in1 is applied first, then in2 # returns iterator function over merged patch hunks sub merge_patches { my ($in1, $in2) = @_; return $in1 unless $in2; return $in2 unless $in1; my $cur1 = $in1->(); my $cur2 = $in2->(); return sub { my $ret; while (1) { #print STDERR "in:cur1: @$cur1\n" if $cur1; #print STDERR "in:cur2: @$cur2\n" if $cur2; if (!defined $cur1) { $ret = $cur2; $cur2 = $in2->(); last; } if (!defined $cur2) { $ret = $cur1; $cur1 = $in1->(); last; } if ($cur1->[0] eq 'I') { $ret = $cur1; $cur1 = $in1->(); last; } elsif ($cur2->[0] eq 'D') { $ret = $cur2; $cur2 = $in2->(); last; } elsif ($cur1->[1] >= $cur2->[1]) { if ($cur2->[0] eq 'C') { $ret = [ $cur1->[0], $cur2->[1] ]; } elsif ($cur1->[0] eq 'D') { # cur2 was 'I'; discard it $cur1->[1] -= $cur2->[1]; $cur1 = $in1->() unless $cur1->[1] > 0; $cur2 = $in2->(); next; } else { # cur2 is 'I', cur1 is 'C' $ret = $cur2; } $cur1->[1] -= $cur2->[1]; $cur2 = $in2->(); $cur1 = $in1->() unless $cur1->[1] > 0; last; } else { # cur1 is smaller than cur2 if ($cur1->[0] eq 'D') { if ($cur2->[0] eq 'I') { my $n = $cur1->[1]; my $list_ref = $cur2->[2]; $cur2->[2] = [@{$list_ref}[$n .. $#{$list_ref}]]; $cur2->[1] -= $n; $cur1 = $in1->(); next; } else { $ret = $cur1; $cur2->[1] -= $cur1->[1]; $cur1 = $in1->(); last; } } else { # cur1 is 'C' my $n = $cur1->[1]; $ret = [ $cur2->[0], $n]; if ($cur2->[0] eq 'I') { my $list_ref = $cur2->[2]; push @$ret, [@{$list_ref}[0 .. $n -1]]; $cur2->[2] = [@{$list_ref}[$n .. $#{$list_ref}]] } $cur2->[1] -= $n; $cur1 = $in1->(); last; } } } #print STDERR "out:ret: @$ret\n" if $ret; return $ret; }; } # our style is roughly "perltidy -pbp" # vim:sts=4:sw=4:expandtab apt-file-2.5.2ubuntu1/tests-apt-file/0000775000000000000000000000000012141424345014276 5ustar apt-file-2.5.2ubuntu1/tests-apt-file/sources.list0000664000000000000000000000010412141424344016650 0ustar deb http://site1/debian sid main deb http://site1/debian lenny main apt-file-2.5.2ubuntu1/tests-apt-file/cache/0000775000000000000000000000000012141424345015341 5ustar apt-file-2.5.2ubuntu1/tests-apt-file/cache/site1_debian_dists_sid_Contents-fooarch0000664000000000000000000000347311617066550025172 0ustar This file maps each file available in the Debian GNU/Linux system to the package from which it originates. It includes packages from the DIST distribution for the ARCH architecture. You can use this list to determine which package contains a specific file, or whether or not a specific file is available. The list is updated weekly, each architecture on a different day. When a file is contained in more than one package, all packages are listed. When a directory is contained in more than one package, only the first is listed. The best way to search quickly for a file is with the Unix `grep' utility, as in `grep CONTENTS': $ grep nose Contents etc/nosendfile net/sendfile usr/X11R6/bin/noseguy x11/xscreensaver usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg usr/lib/cfengine/bin/noseyparker admin/cfengine This list contains files in all packages, even though not all of the packages are installed on an actual system at once. If you want to find out which packages on an installed Debian system provide a particular file, you can use `dpkg --search ': $ dpkg --search /usr/bin/dselect dpkg: /usr/bin/dselect FILE LOCATION bin/afio utils/afio bin/ash shells/ash bin/bash shells/bash bin/bash-minimal shells/bash-minimal bin/bash-static shells/bash-static usr/debug/bin/bash shells/bash-debug usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko misc/user-mode-linux usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko misc/user-mode-linux usr/lib/perl5/Template.pm perl/libtemplate-perl usr/bin/mp3gain audio/mp3gain apt-file-2.5.2ubuntu1/tests-apt-file/cache/site1_debian_dists_lenny_Contents-fooarch0000664000000000000000000000324311617066550025533 0ustar This file maps each file available in the Debian GNU/Linux system to the package from which it originates. It includes packages from the DIST distribution for the ARCH architecture. You can use this list to determine which package contains a specific file, or whether or not a specific file is available. The list is updated weekly, each architecture on a different day. When a file is contained in more than one package, all packages are listed. When a directory is contained in more than one package, only the first is listed. The best way to search quickly for a file is with the Unix `grep' utility, as in `grep CONTENTS': $ grep nose Contents etc/nosendfile net/sendfile usr/X11R6/bin/noseguy x11/xscreensaver usr/X11R6/man/man1/noseguy.1x.gz x11/xscreensaver usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param graphics/ucbmpeg usr/lib/cfengine/bin/noseyparker admin/cfengine This list contains files in all packages, even though not all of the packages are installed on an actual system at once. If you want to find out which packages on an installed Debian system provide a particular file, you can use `dpkg --search ': $ dpkg --search /usr/bin/dselect dpkg: /usr/bin/dselect FILE LOCATION bin/afio utils/afio bin/bash shells/bash bin/bash-minimal shells/bash-minimal bin/bash-static shells/bash-static usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko misc/user-mode-linux usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko misc/user-mode-linux apt-file-2.5.2ubuntu1/tests-apt-file/Makefile0000664000000000000000000000045312141424344015737 0ustar TEST_PRG=../apt-file TEST_SOURCE=./sources.list TEST_CACHE=./cache TEST_CONFIG=../apt-file.conf test: set -e ; for a in cache/*fooarch ; do gzip -c < $$a > $$a.gz ; done ./runtests APT_FILE_CONFIG=$(TEST_CONFIG) $(TEST_PRG) -s $(TEST_SOURCE) -c $(TEST_CACHE) -a fooarch clean: rm -f cache/*.gz apt-file-2.5.2ubuntu1/tests-apt-file/runtests0000775000000000000000000000366012141424344016117 0ustar #!/usr/bin/perl -w use strict; use POSIX qw/WIFEXITED WEXITSTATUS/; use File::Temp qw/tempdir /; my @tests = glob("t/*.test"); my $fail = 0; my $pass = 0; my $tmpdir = tempdir(CLEANUP => 1) or die "could not create tempdir"; if (!scalar @ARGV) { die "apt-file command not given"; } foreach my $t (sort @tests) { $t =~ m{/([^/]*).test$}; my $name = $1; my $vars = readvars($t); my $this_fail; if (!defined $vars) { $fail++; next; } if (!defined $vars->{args}) { warn "'args' not defined in $t\n"; $fail++; next; } $vars->{rc} = 0 if ! defined $vars->{rc}; my $cmd = "@ARGV $vars->{args}"; system("$cmd > $tmpdir/$name.out 2> $tmpdir/$name.err"); if (!WIFEXITED($?)) { warn "FAIL: $name: Error executing $cmd\n"; $this_fail = 1; next; } if (WEXITSTATUS($?) != $vars->{rc}) { print "FAIL: $name: RC expected $vars->{rc}, got " . WEXITSTATUS($?) . "\n"; $this_fail = 1; } if (-s "$tmpdir/$name.err" && ! $vars->{stderr} ) { print "FAIL: $name: Unexpected output on stderr:\n"; system("cat $tmpdir/$name.err"); $this_fail = 1; } my $expected = "t/$name.out"; if (system("diff -u $expected $tmpdir/$name.out") != 0) { print "FAIL: $name: Expected and actual output differ\n"; $this_fail = 1; } if ($this_fail) { $fail++; print "Test $name tests for bug #$vars->{bug}\n" if $vars->{bug}; } else { print "PASS: $name\n"; $pass++; } } my $total = $pass + $fail; print "Tests passed: $pass/$total\n" if $pass; print "Tests failed: $fail/$total\n" if $fail; exit(1) if ($fail); exit(0); sub readvars { my $file = shift; my %vars; my $fh; if (!open ($fh, "<", $file)) { warn "Could not open $file\n"; return; } while (defined (my $line = <$fh>)) { chomp $line; $line =~ s/^\s+//; $line =~ /^#/ and next; $line =~ /^$/ and next; if ($line =~ /^([^=]+)=(.*)$/) { $vars{$1}=$2; } else { warn "Invalid syntax in $file:$.\n"; return; } } return \%vars; } apt-file-2.5.2ubuntu1/tests-apt-file/t/0000775000000000000000000000000012141424345014541 5ustar apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp2.in0000664000000000000000000000002112141424344020457 0ustar /v?fat/ /bin/.*i apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex1.test0000664000000000000000000000003012141424345017661 0ustar args=list -x 'ash-[dm]' apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored2.test0000664000000000000000000000002712141424344020477 0ustar args=search -x '^/bin' apt-file-2.5.2ubuntu1/tests-apt-file/t/absoulte_path.test0000664000000000000000000000004112141424344020266 0ustar args=search /bin/bash bug=483624 apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp3.out0000664000000000000000000000006012141424344020664 0ustar afio: /bin/afio bash-debug: /usr/debug/bin/bash apt-file-2.5.2ubuntu1/tests-apt-file/t/regex1.out0000664000000000000000000000024012141424344016460 0ustar mp3gain: /usr/bin/mp3gain user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored3.test0000664000000000000000000000002412141424344021530 0ustar args=list -x 'ash$' apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored3.test0000664000000000000000000000002512141424344020476 0ustar args=search -x 'm\Z' apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp2.test0000664000000000000000000000005112141424344021033 0ustar args=-x -f search t/from_file_regexp2.in apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_fixed.out0000664000000000000000000000000012141424344020225 0ustar apt-file-2.5.2ubuntu1/tests-apt-file/t/list_fixed.test0000664000000000000000000000003412141424344017570 0ustar args=list -F ash bug=557719 apt-file-2.5.2ubuntu1/tests-apt-file/t/absoulte_path_fixed.test0000664000000000000000000000004412141424344021450 0ustar args=search -F /bin/bash bug=469375 apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble.test0000664000000000000000000000003012141424344017221 0ustar args=search bin/noseguy apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_fixed.test0000664000000000000000000000003312141424344020403 0ustar args=search -F bin/noseguy apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_fixed.out0000664000000000000000000000002012141424345020403 0ustar bash: /bin/bash apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored4.out0000664000000000000000000000015412141424344020332 0ustar afio: /bin/afio ash: /bin/ash bash: /bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_list.out0000664000000000000000000000000012141424344020101 0ustar apt-file-2.5.2ubuntu1/tests-apt-file/t/regex1.test0000664000000000000000000000002212141424344016626 0ustar args=search -x /m apt-file-2.5.2ubuntu1/tests-apt-file/t/slashes.test0000664000000000000000000000003512141424345017102 0ustar args=search /fat. bug=496127 apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_list.test0000664000000000000000000000002212141424344020255 0ustar args=list ucbmpeg apt-file-2.5.2ubuntu1/tests-apt-file/t/list1.test0000664000000000000000000000001612141424344016472 0ustar args=list ash apt-file-2.5.2ubuntu1/tests-apt-file/t/slashes.out0000664000000000000000000000010212141424344016724 0ustar user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored1.out0000664000000000000000000000005512141424344020327 0ustar libtemplate-perl: /usr/lib/perl5/Template.pm apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_leading_slash.out0000664000000000000000000000024612141424344021262 0ustar afio: /bin/afio ash: /bin/ash bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static mp3gain: /usr/bin/mp3gain apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_with_parens.test0000664000000000000000000000010712141424344021154 0ustar args=search --regexp '(etc/perl|usr/lib/perl5)/Template.pm' bug=467619 apt-file-2.5.2ubuntu1/tests-apt-file/t/list2.out0000664000000000000000000000015612141424345016331 0ustar bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static apt-file-2.5.2ubuntu1/tests-apt-file/t/list2.test0000664000000000000000000000001712141424344016474 0ustar args=list bash apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored4.out0000664000000000000000000000001612141424344021362 0ustar ash: /bin/ash apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_fixed.in0000664000000000000000000000003312141424345020206 0ustar /bin/bash /kernel/fs/vfat/ apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored1.test0000664000000000000000000000002212141424344021524 0ustar args=list -x '^a' apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_with_parens.out0000664000000000000000000000005512141424344021006 0ustar libtemplate-perl: /usr/lib/perl5/Template.pm apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored2.out0000664000000000000000000000001612141424344021360 0ustar ash: /bin/ash apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_regex.test0000664000000000000000000000003312141424344020416 0ustar args=search -x bin/noseguy apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored3.out0000664000000000000000000000003612141424344021363 0ustar ash: /bin/ash bash: /bin/bash apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp2.out0000664000000000000000000000035612141424345020674 0ustar afio: /bin/afio bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static mp3gain: /usr/bin/mp3gain user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored5.out0000664000000000000000000000003612141424344021365 0ustar ash: /bin/ash bash: /bin/bash apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored5.test0000664000000000000000000000002512141424344021533 0ustar args=list -x 'ash\Z' apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored2.out0000664000000000000000000000015412141424344020330 0ustar afio: /bin/afio ash: /bin/ash bash: /bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static apt-file-2.5.2ubuntu1/tests-apt-file/t/list_fixed.out0000664000000000000000000000001612141424344017420 0ustar ash: /bin/ash apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp4.out0000664000000000000000000000013612141424344020671 0ustar ash: /bin/ash bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored2.test0000664000000000000000000000002412141424344021527 0ustar args=list -x '^ash' apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored1.out0000664000000000000000000000003612141424344021361 0ustar afio: /bin/afio ash: /bin/ash apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_normal.test0000664000000000000000000000004512141424344020752 0ustar args=-f search t/from_file_normal.in apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp1.test0000664000000000000000000000005112141424344021032 0ustar args=-x -f search t/from_file_regexp1.in apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_normal.out0000664000000000000000000000026212141424345020604 0ustar bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp1.out0000664000000000000000000000020612141424344020664 0ustar user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko user-mode-linux: /usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble.out0000664000000000000000000000000012141424344017046 0ustar apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored4.test0000664000000000000000000000003012141424344020473 0ustar args=search -x '\A/bin' apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp1.in0000664000000000000000000000002212141424345020460 0ustar /v?fat/ /bin/.*i$ apt-file-2.5.2ubuntu1/tests-apt-file/t/absoulte_path_fixed.out0000664000000000000000000000002012141424344021272 0ustar bash: /bin/bash apt-file-2.5.2ubuntu1/tests-apt-file/t/absoulte_path.out0000664000000000000000000000015612141424344020125 0ustar bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored1.test0000664000000000000000000000002412141424344020473 0ustar args=search -x 'm$' apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex_anchored4.test0000664000000000000000000000002512141424345021533 0ustar args=list -x '\Aash' apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_fixed.test0000664000000000000000000000004712141424344020563 0ustar args=-F -f search t/from_file_fixed.in apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp3.in0000664000000000000000000000002012141424344020457 0ustar io$ ^/usr/debug apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_leading_slash.test0000664000000000000000000000004112141424344021423 0ustar args=search -x '/bin' bug=563688 apt-file-2.5.2ubuntu1/tests-apt-file/t/list1.out0000664000000000000000000000017412141424344016327 0ustar ash: /bin/ash bash: /bin/bash bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal bash-static: /bin/bash-static apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp4.test0000664000000000000000000000005112141424344021035 0ustar args=-x -f search t/from_file_regexp4.in apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp3.test0000664000000000000000000000005112141424344021034 0ustar args=-x -f search t/from_file_regexp3.in apt-file-2.5.2ubuntu1/tests-apt-file/t/preamble_regex.out0000664000000000000000000000000012141424345020241 0ustar apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_normal.in0000664000000000000000000000003312141424344020376 0ustar /bin/bash /kernel/fs/vfat/ apt-file-2.5.2ubuntu1/tests-apt-file/t/from_file_regexp4.in0000664000000000000000000000006212141424344020466 0ustar /bin/(ba|a)sh$ ^/bin/bash-minimal$ ^/bin/mp3gain$ apt-file-2.5.2ubuntu1/tests-apt-file/t/list_regex1.out0000664000000000000000000000010012141424344017506 0ustar bash-debug: /usr/debug/bin/bash bash-minimal: /bin/bash-minimal apt-file-2.5.2ubuntu1/tests-apt-file/t/regex_anchored3.out0000664000000000000000000000005512141424344020331 0ustar libtemplate-perl: /usr/lib/perl5/Template.pm apt-file-2.5.2ubuntu1/t/0000775000000000000000000000000012141424345011700 5ustar apt-file-2.5.2ubuntu1/t/minimum-version.t0000775000000000000000000000053712135000456015227 0ustar #!/usr/bin/perl -w use strict; use warnings; use Test::More; eval 'use Test::MinimumVersion'; plan skip_all => 'Test::MinimumVersion required to run this test' if $@; # sarge was released with 5.8.4, etch with 5.8.8, lenny with 5.10.0 our $REQUIRED = 'v5.10.0'; all_minimum_version_ok($REQUIRED, { paths => ['.'] , no_plan => 1}); done_testing(); apt-file-2.5.2ubuntu1/t/strict.t0000775000000000000000000000025712135000456013400 0ustar #!/usr/bin/perl -w use strict; use warnings; use Test::More; eval 'use Test::Strict'; plan skip_all => 'Test::Strict required to run this test' if $@; all_perl_files_ok(); apt-file-2.5.2ubuntu1/rapt-file0000775000000000000000000001444512141424343013254 0ustar #!/usr/bin/python # # apt-file - APT package searching utility -- command-line interface # # Copyright (c) 2009 Enrico Zini # # This package 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; version 2 dated June, 1991. # # This package 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 package; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. VERSION="0.1" import sys, subprocess, os, os.path import cPickle as pickle from urllib2 import urlopen def unpickle(inputfd): unp = pickle.Unpickler(inputfd) unp.find_global = None while True: try: yield unp.load() except EOFError: break def get_architecture(opts): if opts.arch: return opts.arch else: return subprocess.Popen(["dpkg", "--print-architecture"], stdout=subprocess.PIPE).communicate()[0].strip() DIST_WHITELIST = set(["sid", "squeeze", "lenny", "wheezy"]) DIST_ALIASES = { "unstable": "sid", "testing": "wheezy", "stable": "squeeze", "oldstable": "lenny", } def get_dists(opts): if opts.sources: infiles = [opts.sources] else: infiles = [] if os.path.exists("/etc/apt/sources.list"): infiles.append("/etc/apt/sources.list") sld = "/etc/apt/sources.list.d" if os.path.isdir(sld): for f in os.listdir(sld): if f.endswith(".list"): infiles.append(os.path.join(sld, f)) dists = set() for f in infiles: for line in open(f): line = line.strip() if not line or line[0] == "#": continue line = line.split() if len(line) < 4: continue dist = line[2].split("/")[0] dist = DIST_ALIASES.get(dist, dist) if dist in DIST_WHITELIST: dists.add(dist) return sorted(dists) import optparse class Parser(optparse.OptionParser): def __init__(self, *args, **kwargs): optparse.OptionParser.__init__(self, *args, **kwargs) def print_help(self, out=sys.stdout): optparse.OptionParser.print_help(self, out) print >>out print >>out, "Action:" print >>out, " update Fetch Contents files from apt-sources (ignored)" print >>out, " search|find Search files in packages" print >>out, " list|show List files in packages" print >>out, " purge Remove cache files (ignored)" def error(self, msg): sys.stderr.write("%s: error: %s\n\n" % (self.get_prog_name(), msg)) self.print_help(sys.stderr) sys.exit(2) parser = Parser(usage="usage: %prog [options] action [pattern]", version="%prog "+ VERSION, description="Search files in packages") parser.add_option("-s", "--sources-list", metavar="FILE", dest="sources", help="sources.list location") parser.add_option("-a", "--architecture", dest="arch", help="Use specific architecture") parser.add_option("-l", "--package-only", dest="pkgonly", action="store_true", help="Only display package names") parser.add_option("-v", "--verbose", action="store_true", help="run in verbose mode") parser.add_option("-c", "--cache", dest="dir", help="Cache directory (ignored)") parser.add_option("-d", "--cdrom-mount", dest="cdrom", help="Use specific cdrom mountpoint (ignored)") parser.add_option("-N", "--non-interactive", action="store_true", help="Skip schemes requiring user input (useful in cron jobs) (ignored)") parser.add_option("-x", "--regexp", action="store_true", help="pattern is a regular expression (ignored)") parser.add_option("-y", "--dummy", action="store_true", help="run in dummy mode (no action) (ignored)"); parser.add_option("-i", "--ignore-case", action="store_true", help="Ignore case distinctions (ignored)") parser.add_option("-F", "--fixed-string", action="store_true", help="Do not expand pattern (ignored)") (options, args) = parser.parse_args() action = args and args.pop(0) or None # Skip ignored actions if action in ("update", "purge"): sys.exit(0) elif action in ("search", "find"): pattern = args.pop(0) arch = get_architecture(options) dists = get_dists(options) pkgs = set() for dist in dists: url = "http://dde.debian.net/dde/q/aptfile/byfile/%s-%s/%s?t=pickle" % (dist, arch, pattern) if options.verbose: print >>sys.stderr, "Querying %s..." % url for res in unpickle(urlopen(url)): for pkg in res: pkgs.add(pkg) if options.pkgonly: for pkg in sorted(pkgs): print pkg else: import warnings # Yes, apt, thanks, I know, the api isn't stable, thank you so very much #warnings.simplefilter('ignore', FutureWarning) warnings.filterwarnings("ignore","apt API not stable yet") try: import apt except ImportError: sys.stderr.write("%s: error: %s\n\n" % (self.get_prog_name(), "please install the python apt module")) sys.exit(2) warnings.resetwarnings() cache = apt.Cache() for pkg in sorted(pkgs): if not pkg in cache: continue p = cache[pkg] v = p.candidate if not v: continue print pkg, "-", v.summary sys.exit(0) elif action in ("list", "show"): pattern = args.pop(0) arch = get_architecture(options) dists = get_dists(options) files = set() for dist in dists: url = "http://dde.debian.net/dde/q/aptfile/bypackage/%s-%s/%s?t=pickle" % (dist, arch, pattern) if options.verbose: print >>sys.stderr, "Querying %s..." % url for res in unpickle(urlopen(url)): for f in res[0]: files.add(f) for f in sorted(files): print f sys.exit(0) elif action is None: parser.print_help() sys.exit(0) else: parser.error("Action '%s' is not valid" % action)