summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parentdff6bb120cd12cc25433fdbe4dbe84d8202d6d57 (diff)
generate d/watch for GitHub projects recommended by uscan(1)
Diffstat (limited to 'lib')
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm22
1 files changed, 19 insertions, 3 deletions
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;
}