[buildd-tools-devel] Bug#475777: [PATCH] sbuild: Add support for appending a tag at the end of version numbers
Tim Abbott
tabbott at MIT.EDU
Sat Apr 11 20:58:41 UTC 2009
Signed-off-by: Tim Abbott <tabbott at mit.edu>
---
lib/Sbuild.pm | 14 +++++++++++---
lib/Sbuild/Build.pm | 23 ++++++++++++++++-------
lib/Sbuild/Conf.pm | 3 +++
lib/Sbuild/Options.pm | 12 +++++++++++-
man/sbuild.1.in | 6 ++++++
5 files changed, 47 insertions(+), 11 deletions(-)
diff --git a/lib/Sbuild.pm b/lib/Sbuild.pm
index ecc2138..1b54a8e 100644
--- a/lib/Sbuild.pm
+++ b/lib/Sbuild.pm
@@ -61,7 +61,7 @@ sub do_version_cmp ($$);
sub order ($);
sub version_cmp_single ($$);
sub split_version ($);
-sub binNMU_version ($$);
+sub binNMU_version ($$$);
sub parse_date ($);
sub isin ($@);
sub copy ($);
@@ -211,11 +211,19 @@ sub split_version ($) {
return( $epoch, $vers, $revision );
}
-sub binNMU_version ($$) {
+sub binNMU_version ($$$) {
my $v = shift;
my $binNMUver = shift;
+ my $append_to_version = shift;
- return "$v+b$binNMUver";
+ my $ver = $v;
+ if (defined($append_to_version) && $append_to_version) {
+ $ver .= $append_to_version;
+ }
+ if (defined($binNMUver) && $binNMUver) {
+ $ver .= "+b$binNMUver";
+ }
+ return $ver;
}
my %monname = ('jan', 0, 'feb', 1, 'mar', 2, 'apr', 3, 'may', 4, 'jun', 5,
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 0ec6065..9e52789 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -148,8 +148,9 @@ sub set_version {
my $oversion = $version; # Original version (no binNMU addition)
# Add binNMU to version if needed.
- if ($self->get_conf('BIN_NMU')) {
- $version = binNMU_version($version, $self->get_conf('BIN_NMU_VERSION'));
+ if ($self->get_conf('BIN_NMU') || $self->get_conf('APPEND_TO_VERSION')) {
+ $version = binNMU_version($version, $self->get_conf('BIN_NMU_VERSION'),
+ $self->get_conf('APPEND_TO_VERSION'));
}
(my $sversion = $version) =~ s/^\d+://; # Strip epoch
@@ -638,7 +639,7 @@ sub build {
}
}
- if ($self->get_conf('BIN_NMU')) {
+ if ($self->get_conf('BIN_NMU') || $self->get_conf('APPEND_TO_VERSION')) {
$self->log_subsubsection("Hack binNMU version");
$self->set('Pkg Fail Stage', "hack-binNMU");
if (open( F, "<$dscdir/debian/changelog" )) {
@@ -656,12 +657,20 @@ sub build {
return 0;
}
$dists = $self->get_conf('DISTRIBUTION');
+
print F "$name ($NMUversion) $dists; urgency=low\n\n";
- print F " * Binary-only non-maintainer upload for $arch; ",
- "no source changes.\n";
- print F " * ", join( " ", split( "\n", $self->get_conf('BIN_NMU') )), "\n\n";
- print F " -- " . $self->get_conf('MAINTAINER_NAME') . " $date\n\n";
+ if ($self->get_conf('APPEND_TO_VERSION')) {
+ print F " * Append ", $self->get_conf('APPEND_TO_VERSION'),
+ " to version number; no source changes\n";
+ }
+ if ($self->get_conf('BIN_NMU')) {
+ print F " * Binary-only non-maintainer upload for $arch; ",
+ "no source changes.\n";
+ print F " * ", join( " ", split( "\n", $self->get_conf('BIN_NMU') )), "\n";
+ }
+ print F "\n";
+ print F " -- " . $self->get_conf('MAINTAINER_NAME') . " $date\n\n";
print F $firstline, $text;
close( F );
$self->log("*** Created changelog entry for bin-NMU version $NMUversion\n");
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index 7c4a14a..943b278 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -419,6 +419,9 @@ sub init_allowed_keys {
'BIN_NMU_VERSION' => {
DEFAULT => undef
},
+ 'APPEND_TO_VERSION' => {
+ DEFAULT => undef
+ },
'GCC_SNAPSHOT' => {
DEFAULT => 0
},
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index 8273191..8ee63db 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -56,7 +56,7 @@ sub new {
sub parse_options {
my $self = shift;
- return GetOptions ("h|help" => sub { help_text("1", "sbuild"); },
+ my $ret = GetOptions ("h|help" => sub { help_text("1", "sbuild"); },
"V|version" => sub {version_text("sbuild"); },
"arch=s" => sub {
$self->set_conf('ARCH', $_[1]);
@@ -107,6 +107,9 @@ sub parse_options {
"binNMU=i" => sub {
$self->set_conf('BIN_NMU_VERSION', $_[1]);
},
+ "append-to-version=s" => sub {
+ $self->set_conf('APPEND_TO_VERSION', $_[1]);
+ },
"c|chroot=s" => sub {
$self->set_conf('CHROOT', $_[1]);
},
@@ -180,6 +183,13 @@ sub parse_options {
if $self->get_conf('VERBOSE');
},
);
+
+ if (defined($self->get_conf('APPEND_TO_VERSION')) &&
+ $self->get_conf('BUILD_SOURCE') != 0) {
+ # See <http://bugs.debian.org/475777> for details
+ die "The --append-to-version option is incompatible with a source upload\n";
+ }
+ return $ret;
}
1;
diff --git a/man/sbuild.1.in b/man/sbuild.1.in
index ad5d3f3..e940bcb 100644
--- a/man/sbuild.1.in
+++ b/man/sbuild.1.in
@@ -31,6 +31,7 @@ sbuild \- build debian packages from source
.RB [ \-\-force\-orig\-source ]
.RB [ \-\-make\-binNMU=\fIchangelog-entry\fP ]
.RB [ \-\-binNMU=\fINMU-version\fP ]
+.RB [ \-\-append\-to\-version=\fIstring\fP ]
.RB [ \-\-add-depends=\fIdependency\fP ]
.RB [ \-\-add-conflicts=\fIdependency\fP ]
.RB [ \-\-add-depends\-indep=\fIdependency\fP ]
@@ -202,6 +203,11 @@ mails will be modified by \fBsbuild\fR automatically.
The version number of the binary NMU. This should be used in conjunction with
\-\-make\-binNMU. \fIversion\fP is a single number for the (+b\fIn\fR) format
used for binary NMUs.
+.TP
+.BR "\-\-append\-to\-version=\fIstring\P"
+This option is similar to --make-binNMU except that it allows the user to
+specify an arbitrary string to be appended to the version number (immediately
+before the '+' in the Debian revision if --make-binNMU is also provided).
.SH ENVIRONMENT VARIABLES
The following environment variables are used by \fBsbuild\fR:
.IP "DEBEMAIL"
--
1.6.2.1
More information about the Buildd-tools-devel
mailing list