From 14f49aa6d36d70e15c03052d47ccbcb096e4dbca Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 24 Sep 2016 08:16:02 -0700 Subject: [PATCH] travis/cleanup-bintray: use dpkg --compare-versions (#2453) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit …instead of lexicographically sorting strings, which fails for the following situation: 4.12-96-g086276b 4.12-97-g59c070b 4.12-108-gb850cfb This bug resulted in new packages being built and uploaded, then immediately deleted. Thanks to eeemsi for reporting the issue. --- travis/cleanup-bintray.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/travis/cleanup-bintray.pl b/travis/cleanup-bintray.pl index 296ae388..e89efb1b 100755 --- a/travis/cleanup-bintray.pl +++ b/travis/cleanup-bintray.pl @@ -25,7 +25,9 @@ my $client = HTTP::Tiny->new( my $resp = $client->get($apiurl); die "Getting versions failed: HTTP status $resp->{status} (content: $resp->{content})" unless $resp->{success}; my $decoded = decode_json($resp->{content}); -my @versions = reverse sort @{$decoded->{versions}}; +my @versions = reverse sort { + (system("/usr/bin/dpkg", "--compare-versions", "$a", "gt", "$b") == 0) ? 1 : -1 +} @{$decoded->{versions}}; # Keep the most recent 5 versions. splice(@versions, 0, 5); -- 2.39.2