summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-07-21 14:39:35 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-07-21 14:39:35 -0700
commitdcb9d9bafc9f0587011d8ff84a1f1837d66b4bdc (patch)
treed5898ec2d1a512f48e0d5eae11a1bd33a68491f0
parentdff6bb120cd12cc25433fdbe4dbe84d8202d6d57 (diff)
generate d/watch for GitHub projects recommended by uscan(1)
-rw-r--r--debian/changelog4
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm22
2 files changed, 23 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index ab82835..d164a70 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ dh-make-elpa (0.9) UNRELEASED; urgency=medium
* Stop generating binary dependency on 'emacsen-common'.
dh-elpa adds to ${misc:Depends}.
+ * When the 'upstream' remote is GitHub, generate a watch file using
+ the GitHub releases page, rather than using mode=git.
+ This is less taxing on the QA servers checking for new upstream
+ releases (see uscan(1)).
-- Sean Whitton <spwhitton@spwhitton.name> Fri, 21 Jul 2017 14:14:22 -0700
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index 24dcf40..d2737ac 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -306,7 +306,7 @@ sub create_docs {
# TODO again, assumes tags are of the form v1.0.0
sub create_watch {
my $self = shift;
- my ( $repo, $upstream_url );
+ my ( $repo, $upstream_url, $watch_file_content );
try {
$repo = Git::Repository->new( git_dir => $self->main_file('.git') );
@@ -316,9 +316,25 @@ sub create_watch {
return;
};
+ # try to take advantage of GitHub's release page, since mode=git
+ # is much more taxing for QA team's servers
+ if ( $upstream_url =~ /github\.com\/([^\/]+)\/([^\/]+)/ ) {
+ my $user = $1;
+ my $project = $2;
+ $watch_file_content = <<EOT;
+version=4
+opts="filenamemangle=s/(?:.*?)?v?(\\d[\\d.]*)\\.tar\\.gz/$project-\$1.tar.gz/" \\
+ https://github.com/$user/$project/tags \\
+ (?:.*?/)?v?(\\d[\\d.]*)\\.tar\\.gz debian uupdate
+EOT
+ } else {
+ $watch_file_content = "version=4\nopts=\"mode=git\" "
+ . $upstream_url
+ . " refs/tags/v([\\d\\.\\d\\.]+) debian\n";
+ }
+
my $fh = $self->_file_w( $self->debian_file("watch") );
- $fh->printf("version=4\nopts=\"mode=git\" %s refs/tags/v([\\d\\.\\d\\.]+) debian\n",
- $upstream_url);
+ $fh->printf($watch_file_content);
$fh->close;
}