[maven-debian-helper] 04/07: Generate debian/watch for GitHub projects
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Thu Nov 12 18:21:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository maven-debian-helper.
commit 733dd6d3156807bea3f34d2f7e77d394e6b55c78
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Thu Nov 12 18:10:24 2015 +0100
Generate debian/watch for GitHub projects
---
debian/TODO | 1 -
debian/changelog | 1 +
.../debian/maven/packager/GenerateDebianFilesMojo.java | 17 +++++++++++++++++
maven-packager-utils/src/main/resources/watch.github.vm | 2 ++
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/debian/TODO b/debian/TODO
index c1530f1..0d2e003 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -1,6 +1,5 @@
o mh_make: When ignoring a module, update orig-tar.sh and git-import-orig to filter out the module directory
o mh_make: support ignore module, ignored module must be removed from the parent pom before launching Maven to generate the project files
-o Create watch for Github - Cannot recognize the download url (scm:git:git at github.com:sonatype/plexus-compiler.git).
o Update copyright notice and include maven.pm
o Migrate documentation generation to reStructuredText - python-docutils
o #638001: mh_resolve_dependencies could avoid to search POMs provided by this package
diff --git a/debian/changelog b/debian/changelog
index 4002fca..3186ca9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ maven-debian-helper (1.6.14) UNRELEASED; urgency=medium
* Changed the debian/rules template to use DH by default instead of CDBS.
A rules file using CDBS can still be generated by adding the --cdbs
parameter to mh_make (Closes: #786340)
+ * Generate debian/watch for GitHub projects
-- Emmanuel Bourg <ebourg at apache.org> Thu, 12 Nov 2015 10:10:31 +0100
diff --git a/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java b/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
index 207fa6e..3cc2fa0 100644
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
@@ -28,6 +28,8 @@ import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Developer;
@@ -413,6 +415,20 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
}
+ if (downloadUrl != null && downloadUrl.startsWith("scm:git:") && downloadUrl.contains("github")) {
+ Pattern pattern = Pattern.compile("github\\.com/([^/]+)/([^/\\.]+)");
+ Matcher matcher = pattern.matcher(downloadUrl);
+ if (matcher.find()) {
+ downloadType = DownloadType.GITHUB;
+ downloadUrl = downloadUrl.substring("scm:git:".length());
+
+ context.put("userId", matcher.group(1));
+ context.put("repository", matcher.group(2));
+
+ generateFile(context, "watch.github.vm", outputDirectory, "watch");
+ }
+ }
+
if (downloadType == DownloadType.UNKNOWN) {
System.err.println("Cannot recognize the download url (" +
downloadUrl + ").");
@@ -613,6 +629,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
int SVN = 1;
int CVS = 2;
int TARBALL = 3;
+ int GITHUB = 4;
}
}
diff --git a/maven-packager-utils/src/main/resources/watch.github.vm b/maven-packager-utils/src/main/resources/watch.github.vm
new file mode 100644
index 0000000..1ad7237
--- /dev/null
+++ b/maven-packager-utils/src/main/resources/watch.github.vm
@@ -0,0 +1,2 @@
+version=3
+https://github.com/${userId}/${repository}/tags .*/(?:.*?)([\d\.]+)\.tar\.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git
More information about the pkg-java-commits
mailing list