Skip to content

Instantly share code, notes, and snippets.

@mwhudson
Created June 28, 2019 12:27
Show Gist options
  • Save mwhudson/111bb84f7bc594087e5d16ec68119820 to your computer and use it in GitHub Desktop.
Save mwhudson/111bb84f7bc594087e5d16ec68119820 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
sub usage () {
die 'ppa-version ppa:$user/$archive $package [$series] [$arch]';
}
$ARGV[0] =~ /^ppa:([a-z-]+)\/([a-z0-9.-]+)/ || usage;
my $package = $ARGV[1] || usage;
my $series = $ARGV[2] || qx/distro-info --devel/;
chomp($series);
my $arch = $ARGV[3] || "amd64";
my $url = "http://ppa.launchpad.net/$1/$2/ubuntu/dists/$series/main/binary-$arch/Packages.gz";
exec "sh", "-c", "curl --silent $url | zcat | grep-dctrl -FPackage -n -w $package -sVersion";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment