Debian::Packages::Compare(3) emdebian repository comparison support


Version 3.0.0


Read the Packages file, create a hash of Package and version - once per arch, one per suite, one pair per repo. The underlying libparse-debian-packages-perl is a very simple module, there probably isn't any point putting extra data into the comparison hashes, get the data necessary and load the full Packages data separately using get_single_package.

This module is currently tied to the repository layout used by reprepro in order to identify the architecture list and various other pieces of meta-data. In time, functions can be added to provide such lists.

The module expects to find all repositories beneath a single base directory:


If $base is undefined or if the repository directories cannot be found, subsequent functions each return undef.


Example code:

 use Debian::Packages::Compare;
 my $base = '/path/to/repositories/'
 my $debu  = &read_packages ('unstable', 'filter');
 my $gripu = &read_packages ('unstable', 'grip');
 my %debianunstable = %$debu  if (defined $debu);
 my %gripunstable   = %$gripu if (defined $gripu);
 foreach my $pkg (sort keys %debianunstable)
   if ($debianunstable{$pkg}{'source'} ne $gripunstable{$pkg}{'source'})
     # $pkg is either not in grip repository or is a different version

The main features for subsequent versions will involve more verbose error handling.

 perl -MDebian::Packages::Compare -MData::Dumper -e '&set_base("/opt/reprepro"); \
  $c = &read_packages("testing","grip"); print Dumper ($$c{"dpkg"});';


Requires the reprepro file layout, currently.

Reads the supported architectures and returns a list.


Requires the reprepro file layout, currently.

Reads the supported locale roots and returns a list.


Similar to get_locale_roots but for ordinary repositories so that component splits (like dev and doc in Emdebian Grip) can be implicitly supported. Note that repositories with contrib or non-free will likely get confused results with this kind of support.


Parses the conf/distributions file for the specified repository and retrieves the list of configured suite names - a collated unique list of the Suite: and Codename: variables in conf/distributions.


Parses the conf/distributions file for the specified repository and retrieves the list of configured suite names that are NOT ReadOnly. Codename: variables are NOT included.


Set the base directory of the repository (repositories) to be compared. The module expects to find all repositories beneath a single base directory:



Similar to read_binaries but expects a GZip compressed Sources.gz file. Not usually called directly.


Reads the Packages file and creates a hash of the packages, architectures and versions in the respective repository (under the $base directory) and suite for the defined @archlist, including details of Sources.

Takes two parameters - the suite name and the repository name.

Returns undef if the Packages file cannot be found.

e.g. for the Grip repository:

 $hash{'sed'}{'source'} => '4.1.5-8'
 $hash{'sed'}{'armel'} => '4.1.5-8em1'


Specialised function that handles the locale-root organisation of the TDeb repository. The internal locale root component structure is hidden in the returned hash, the component name is listed separately and contained in the package name. Source data is retained under the original source package name and referenced in the hash:

The locale root is contained in $list{$package}{'locale'} and the source package name in $list{$package}{'source'}


 $hash{'sed-locale-pt-br}{'source'} => 'sed'
 $hash{'sed-locale-pt-br}{'locale'} => 'pt'
 $hash{'sed-locale-pt-br}{'armel'} => '4.1.5-8'
 $hash{'sed'}{'source'} => '4.1.5-8'


Retrieve the full Packages record for a single package, binary (single architecture) or source (.dsc).


Compare two repositories for the same suite and return a list of source packages that are in the first repository but not in the second. (Older versions are ignored.)

TODO: need a get_outdated_sources and get_outdated_binaries too.


Compare two repositories for the same suite and return a list of binary packages that exist in both repositories as source packages but only exist as binary packages in the first repository, not in the second.

Emdebian version suffixes are automatically cleared in the comparison.


Compare two repositories, each with unstable and testing, return a list of source packages that are suitable for migration.

To be suitable for migration, a package must exist in the first repository at the same version in both unstable and testing. It must also exist in the second repository for unstable and be the same version as in the first repository. Finally, the source package must either be absent from testing in the second repository or be at a lower version than in unstable.

This is a Debian-only feature and no support is available for repositories that do not implement unstable and testing suites in precisely the same manner as Debian.

All data is reloaded fresh each time the function is run.

 1. repo1 unstable must match repo1 testing
 2. repo1 unstable must match repo2 unstable
 3. repo2 unstable must B<be newer> than repo2 testing
 4. All architectures are compared, including source.

Returns undef in case of error.

The returned hash is indexed under the source package name.

To get the list of packages that raised a complaint about missing sources, call get_britney_complaint - the returned list will be undefined unless get_britney_list has already been called.


If get_britney_list comes up with source packages that are missing for a testing migration, get_britney_complaint returns the list of source package names that were identified.

If get_britney_list has not been called, returns undef.

If there are no complaints, also returns undef.

Copyright and Licence

 Copyright (C) 2008  Neil Williams <[email protected]>
 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; either version 3 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
 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 <>.


Neil Williams, "<[email protected]>"


Please report any bugs or feature requests to the Debian Bug Tracking System using "reportbug libdebian-packages-compare-perl".