summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-04-03 21:30:03 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-04-03 21:30:03 -0700
commitc8152637dd73eac5f719bfa03cd6f106bc9c3d2e (patch)
tree038b222a4f724f91e776683fbb184d4bda7bc92c /lib
parent70bd58396c85dc8d40a618f2a64551e92b57f6a8 (diff)
create docs and watch
Diffstat (limited to 'lib')
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm32
-rw-r--r--lib/DhMakeELPA/Command/make.pm2
2 files changed, 33 insertions, 1 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index 5baf8c0..8d2bd20 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -9,6 +9,8 @@ use File::Grep qw{fgrep};
use Array::Utils qw{array_minus};
use DhMakeELPA::MELPA;
use File::Copy;
+use File::Spec::Functions qw(catfile);
+use Git::Repository;
use base 'DhMakePerl::Command::Packaging';
@@ -232,10 +234,38 @@ sub create_gbp_conf {
) {
if ( -e $source ) {
print "Using gbp-conf: $source\n" if $self->cfg->verbose;
- copy($source, $file)
+ copy($source, $file);
last;
};
}
}
+# TODO more complex case with more than one binary package
+sub create_docs {
+ my $self = shift;
+
+ if ( keys %{$self->bins} le 1 && glob("*.md") gt 0 ) {
+ my $fh = $self->_file_w( $self->debian_file('docs') );
+ $fh->print( "*.md\n" );
+ $fh->close;
+ }
+}
+
+# TODO document that this relies on having a remote called 'upstream'
+# TODO again, assumes tags are of the form v1.0.0
+sub create_watch {
+ my $self = shift;
+
+ if ( my $repo = Git::Repository->new( git_dir => $self->main_file('.git') ) ) {
+ my $upstream_url;
+ eval { $upstream_url = $repo->run(( "remote", "get-url", "upstream" )) };
+ unless ($@) {
+ my $fh = $self->_file_w( $self->debian_file("watch") );
+ $fh->printf("version=4\nopts=\"mode=git\" %s refs/tags/v([\\d\\.\\d\\.]+) debian",
+ $upstream_url);
+ $fh->close;
+ }
+ }
+}
+
1;
diff --git a/lib/DhMakeELPA/Command/make.pm b/lib/DhMakeELPA/Command/make.pm
index dd9999f..3efb3ce 100644
--- a/lib/DhMakeELPA/Command/make.pm
+++ b/lib/DhMakeELPA/Command/make.pm
@@ -32,6 +32,8 @@ sub execute {
$self->create_rules();
$self->create_control();
$self->create_copyright();
+ $self->create_docs();
+ $self->create_watch();
$self->create_gbp_conf() if $self->cfg->pkg_emacsen;
$self->output_caveat();