summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-09-10 09:54:59 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-09-10 09:54:59 -0700
commit183d1e48565c838b9f1803086e26dd18b1c64a65 (patch)
treeac059c117cc17ebcc0bcd9365c5d0dc2482c20ee /lib
parentc726142a4822f0d05e179e6a7a3bddcdfcca5f75 (diff)
add --version
Diffstat (limited to 'lib')
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm8
-rw-r--r--lib/DhMakeELPA/Config.pm19
2 files changed, 21 insertions, 6 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index f9714b4..0d932c8 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -28,7 +28,11 @@ sub extract_basic {
$self->debian_dir( $self->main_file('debian') );
$self->find_bins();
$self->pkgname(basename(cwd())); # TODO better?
- $self->elpa_version($self->extract_version());
+ if ( $self->cfg->version ) {
+ $self->elpa_version($self->cfg->version);
+ } else {
+ $self->elpa_version($self->extract_version());
+ }
# Find the homepage, license and copyright by looking at the root
# .el file, if it exists, of the binary package with the shortest
@@ -231,7 +235,7 @@ sub extract_version {
if (defined $version) {
return $version;
} else {
- die "Could not determine package version by examining *.el files";
+ die "Could not determine package version by examining *.el files.\nPlease specify --version.";
}
}
diff --git a/lib/DhMakeELPA/Config.pm b/lib/DhMakeELPA/Config.pm
index 9560a2b..7820191 100644
--- a/lib/DhMakeELPA/Config.pm
+++ b/lib/DhMakeELPA/Config.pm
@@ -7,13 +7,15 @@ our $VERSION = '0.1.0';
use base 'DhMakePerl::Config';
+use Getopt::Long;
+
=head1 NAME
DhMakeELPA::Config - dh-make-elpa configuration class
=cut
-my @OPTIONS = ( 'pkg-emacsen!' );
+my @OPTIONS = ( 'pkg-emacsen!', 'version=s' );
my @COMMANDS = ( 'make' );
@@ -38,12 +40,21 @@ use constant DEFAULTS => {
source_format => '3.0 (quilt)',
};
+# most of this function is from dh-make-perl
sub parse_command_line_options {
my $self = shift;
- # Will probably want to use GetOpt when more than one option
-
- $self->pkg_emacsen(grep { $_ eq '--pkg-emacsen' } @ARGV);
+ Getopt::Long::Configure( qw( pass_through no_auto_abbrev no_ignore_case ) );
+ my %opts;
+ GetOptions( \%opts, @OPTIONS )
+ or die "Error parsing command-line options\n";
+
+ while ( my ( $k, $v ) = each %opts ) {
+ my $field = $k;
+ $field =~ s/-/_/g;
+ $self->$field( $opts{$k} );
+ $self->_explicitly_set->{$k} = 1;
+ }
# TODO
$self->command("make");