diff -Nru distro-info-0.8.1/debian/changelog distro-info-0.8.2/debian/changelog --- distro-info-0.8.1/debian/changelog 2012-04-03 11:02:37.000000000 +0000 +++ distro-info-0.8.2/debian/changelog 2012-04-05 09:39:55.000000000 +0000 @@ -1,3 +1,10 @@ +distro-info (0.8.2) unstable; urgency=low + + * Drop liblist-compare-perl from Build-Depends. Use our own list comparison + functions in the test suite. + + -- Stefano Rivera Thu, 05 Apr 2012 11:39:55 +0200 + distro-info (0.8.1) unstable; urgency=low * Fix build failure due to wrong variable type. diff -Nru distro-info-0.8.1/debian/control distro-info-0.8.2/debian/control --- distro-info-0.8.1/debian/control 2012-04-02 21:52:22.000000000 +0000 +++ distro-info-0.8.2/debian/control 2012-04-05 07:56:11.000000000 +0000 @@ -5,7 +5,6 @@ Uploaders: Stefano Rivera Build-Depends: debhelper (>= 8), distro-info-data (>= 0.7~), - liblist-compare-perl, pylint, python-all (>= 2.6.3-3~), python-setuptools, diff -Nru distro-info-0.8.1/perl/test.pl distro-info-0.8.2/perl/test.pl --- distro-info-0.8.1/perl/test.pl 2011-10-18 20:09:43.000000000 +0000 +++ distro-info-0.8.2/perl/test.pl 2012-04-05 07:55:57.000000000 +0000 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# Copyright (C) 2011, Stefano Rivera +# Copyright (C) 2011-2012, Stefano Rivera # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,19 +16,52 @@ use strict; use warnings; -use Test::Simple tests => 23; -use List::Compare; +use Test::Simple tests => 28; use lib '.'; use Debian::DistroInfo; +sub unique { + my ($needles, $haystack) = @_; + my $unique = 0; + + my %hash = (); + @hash{@$haystack}=(); + for my $needle (@$needles) { + $unique++ if not exists($hash{$needle}); + } + return $unique; +} + +sub symmetric_difference { + my ($a, $b) = @_; + return unique($a, $b) + unique($b, $a); +} + +my @all = (); +my @returned = (); + +# Test our helpers: +@all = ('a', 'b', 'c'); +@returned = ('a', 'b', 'c'); +ok(unique(\@all, \@returned) == 0, 'unique: Matching lists'); +ok(symmetric_difference(\@all, \@returned) == 0, + 'symmetric_difference: Matching lists'); +@returned = ('a', 'b'); +ok(unique(\@all, \@returned) == 1, 'unique: 1 Unique Item'); +ok(unique(\@returned, \@all) == 0, 'unique: 1 Unique Item in the haystack'); +ok(symmetric_difference(\@all, \@returned) == 1, + 'symmetric_difference: 1 Unique Item'); + +# Test DistroInfo: +my @expected = (); my $date = Debian::DistroInfo::convert_date('2011-01-10'); my $deb = DebianDistroInfo->new(); -my @all = ('buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge', +@all = ('buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'sid', 'experimental'); -my @returned = $deb->all($date); -ok(List::Compare->new(\@all, \@returned)->get_unique == 0, 'Debian all'); +@returned = $deb->all($date); +ok(unique(\@all, \@returned) == 0, 'Debian all'); ok($deb->devel($date) eq 'sid', 'Debian devel'); ok($deb->old($date) eq 'etch', 'Debian oldstable'); @@ -38,15 +71,15 @@ ok($deb->valid('stable'), 'Debian valid'); ok(!$deb->valid('foobar'), 'Debian invalid'); -my @expected = ('lenny', 'squeeze', 'sid', 'experimental'); +@expected = ('lenny', 'squeeze', 'sid', 'experimental'); @returned = $deb->supported($date); -ok(List::Compare->new(\@expected, \@returned)->get_symmetric_difference == 0, +ok(symmetric_difference(\@expected, \@returned) == 0, 'Debian supported'); @expected = ('buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge', 'etch'); @returned = $deb->unsupported($date); -ok(List::Compare->new(\@expected, \@returned)->get_symmetric_difference == 0, +ok(symmetric_difference(\@expected, \@returned) == 0, 'Debian unsupported'); ok(!defined($deb->codename('foo')), 'Debian codename, invalid'); @@ -58,7 +91,7 @@ @all = ('warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', 'maverick', 'natty'); @returned = $ubu->all($date); -ok(List::Compare->new(\@all, \@returned)->get_unique == 0, 'Ubuntu all'); +ok(unique(\@all, \@returned) == 0, 'Ubuntu all'); ok($ubu->devel($date) eq 'natty', 'Ubuntu devel'); ok($ubu->lts($date) eq 'lucid', 'Ubuntu LTS'); @@ -71,11 +104,13 @@ @expected = ('dapper', 'hardy', 'karmic', 'lucid', 'maverick', 'natty'); @returned = $ubu->supported($date); -ok(List::Compare->new(\@expected, \@returned)->get_symmetric_difference == 0, +ok(symmetric_difference(\@expected, \@returned) == 0, 'Ubuntu supported'); @expected = ('warty', 'hoary', 'breezy', 'edgy', 'feisty', 'gutsy', 'intrepid', 'jaunty'); @returned = $ubu->unsupported($date); -ok(List::Compare->new(\@expected, \@returned)->get_symmetric_difference == 0, +ok(symmetric_difference(\@expected, \@returned) == 0, 'Ubuntu unsupported'); + +# vi: set et sta sw=4 ts=4: diff -Nru distro-info-0.8.1/shell/distro-info-util.sh distro-info-0.8.2/shell/distro-info-util.sh --- distro-info-0.8.1/shell/distro-info-util.sh 2012-03-23 21:34:07.000000000 +0000 +++ distro-info-0.8.2/shell/distro-info-util.sh 2012-04-05 07:17:48.000000000 +0000 @@ -184,7 +184,7 @@ callback="lts";; #END ubuntu# #BEGIN debian# - -o|--oldstable) + -o|--oldstable|--old) [ -z "$callback" ] || { not_exactly_one; return 1; } callback="oldstable";; -t|--testing) diff -Nru distro-info-0.8.1/test-debian-distro-info distro-info-0.8.2/test-debian-distro-info --- distro-info-0.8.1/test-debian-distro-info 2012-04-02 23:23:48.000000000 +0000 +++ distro-info-0.8.2/test-debian-distro-info 2012-04-03 12:18:17.000000000 +0000 @@ -45,6 +45,8 @@ testOldstable() { success "--oldstable --date=2011-01-10" "etch" success "-c --date=2008-07-06 -o" "sarge" + # Compatibility with 0.2.2 + success "--old --date=2011-01-10" "etch" } testStable() {