Bug 40039: Add production enhancements to build-git-snapshot tool
this patch adds some useful features to allow the build-git-snapshot tool to build production packages
the patch adds the following options:
--urgency, -u
the urgency string for the resulting package. Default is '$urgency'.
--incr, -i
set debian revision (default = '-1')
--(no)autochangelog
whether or not to update the debian/changelog file.
Default is to update it.
note: this patch does not change any of the existing behaviour of the tool
test plan to come...
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3e7c839714)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
989f159f48
commit
14662a012e
|
|
@ -28,20 +28,28 @@ use POSIX qw/strftime/;
|
|||
|
||||
my $basetgz;
|
||||
my $buildresult;
|
||||
my $distribution='squeeze-dev';
|
||||
my $distribution='testing';
|
||||
my $git_checks='all';
|
||||
my $version='16.06~git';
|
||||
my $auto_version=1;
|
||||
my $auto_changelog=1;
|
||||
my $need_help;
|
||||
my $incr;
|
||||
my $urgency='medium';
|
||||
my $debug;
|
||||
|
||||
my $release_str;
|
||||
|
||||
GetOptions(
|
||||
'basetgz|b=s' => \$basetgz,
|
||||
'basetgz|b=s' => \$basetgz,
|
||||
'buildresult|r=s' => \$buildresult,
|
||||
'distribution|D=s' => \$distribution,
|
||||
'git-checks|g=s' => \$git_checks,
|
||||
'version|v=s' => \$version,
|
||||
'incr|i=s' => \$incr,
|
||||
'urgency|u=s' => \$urgency,
|
||||
'autoversion!' => \$auto_version,
|
||||
'autochangelog!' => \$auto_changelog,
|
||||
'help|h' => \$need_help,
|
||||
'debug|d' => \$debug,
|
||||
);
|
||||
|
|
@ -102,7 +110,7 @@ Options:
|
|||
Default is whatever pdebuild uses.
|
||||
--distribution, -D
|
||||
the distribution value to set in the changelog when editing it. Default
|
||||
is 'squeeze-dev'.
|
||||
is 'testing'.
|
||||
--git-checks, -g
|
||||
what level of git checks are run to determine if the working copy is
|
||||
clean enough. One of 'all' (any changes are bad), 'modified' (only
|
||||
|
|
@ -110,9 +118,16 @@ Options:
|
|||
(checking git status is skipped totally.) Default is 'all'.
|
||||
--version, -v
|
||||
the version string for the resulting package. Default is '$version'.
|
||||
--urgency, -u
|
||||
the urgency string for the resulting package. Default is '$urgency'.
|
||||
--incr, -i
|
||||
set debian revision (default = '-1')
|
||||
--(no)autoversion
|
||||
whether or not to use the date and git commit ID in the version value.
|
||||
Default is to include it.
|
||||
--(no)autochangelog
|
||||
whether or not to update the debian/changelog file.
|
||||
Default is to update it.
|
||||
--debug, -d
|
||||
EOH
|
||||
exit;
|
||||
|
|
@ -124,11 +139,14 @@ sub latest_sha1 {
|
|||
|
||||
sub adjust_debian_changelog {
|
||||
my ($newversion) = @_;
|
||||
# debian revision
|
||||
$newversion .= "-1";
|
||||
$newversion .= $incr ? "-$incr" : "-1";
|
||||
|
||||
sys_command_output( qq{dch --force-distribution -D "$distribution" -v "$newversion" "Building git snapshot."} );
|
||||
sys_command_output( qq{dch -r "Building git snapshot."} );
|
||||
$release_str = "New upstream ";
|
||||
$release_str .= 'SECURITY ' if $urgency eq 'high';
|
||||
$release_str .= "release ($version)";
|
||||
|
||||
sys_command_output( qq{dch --urgency $urgency -b --force-distribution -D "$distribution" -v "$newversion" "$release_str"} );
|
||||
sys_command_output( qq{dch -r "$release_str"} );
|
||||
}
|
||||
|
||||
sub reset_debian_changelog {
|
||||
|
|
@ -141,7 +159,7 @@ sub build_package {
|
|||
|
||||
my $pdebuildopts = $buildresult ? "--buildresult $buildresult" : "";
|
||||
my $pdebuildbasetgz = $basetgz ? "-- --use-network yes --basetgz /var/cache/pbuilder/" . $basetgz . ".tgz" : "";
|
||||
sys_command_output_screen( "pdebuild $pdebuildbasetgz $pdebuildopts" );
|
||||
sys_command_output_screen( "pdebuild --debbuildopts -sa $pdebuildbasetgz $pdebuildopts" );
|
||||
}
|
||||
|
||||
everything_is_committed() or die "cannot build: uncommited changes";
|
||||
|
|
@ -150,7 +168,7 @@ my $newversion = $auto_version
|
|||
? sprintf ('%s%s.%s', $version, strftime("+%Y%m%d%H%M%S", localtime), latest_sha1())
|
||||
: $version;
|
||||
|
||||
adjust_debian_changelog( $newversion );
|
||||
adjust_debian_changelog( $newversion ) if $auto_changelog;
|
||||
build_package( $newversion );
|
||||
reset_debian_changelog();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue