|
Lines 28-47
use POSIX qw/strftime/;
Link Here
|
| 28 |
|
28 |
|
| 29 |
my $basetgz; |
29 |
my $basetgz; |
| 30 |
my $buildresult; |
30 |
my $buildresult; |
| 31 |
my $distribution='squeeze-dev'; |
31 |
my $distribution='testing'; |
| 32 |
my $git_checks='all'; |
32 |
my $git_checks='all'; |
| 33 |
my $version='16.06~git'; |
33 |
my $version='16.06~git'; |
| 34 |
my $auto_version=1; |
34 |
my $auto_version=1; |
|
|
35 |
my $auto_changelog=1; |
| 35 |
my $need_help; |
36 |
my $need_help; |
|
|
37 |
my $incr; |
| 38 |
my $urgency='medium'; |
| 36 |
my $debug; |
39 |
my $debug; |
| 37 |
|
40 |
|
|
|
41 |
my $release_str; |
| 42 |
|
| 38 |
GetOptions( |
43 |
GetOptions( |
| 39 |
'basetgz|b=s' => \$basetgz, |
44 |
'basetgz|b=s' => \$basetgz, |
| 40 |
'buildresult|r=s' => \$buildresult, |
45 |
'buildresult|r=s' => \$buildresult, |
| 41 |
'distribution|D=s' => \$distribution, |
46 |
'distribution|D=s' => \$distribution, |
| 42 |
'git-checks|g=s' => \$git_checks, |
47 |
'git-checks|g=s' => \$git_checks, |
| 43 |
'version|v=s' => \$version, |
48 |
'version|v=s' => \$version, |
|
|
49 |
'incr|i=s' => \$incr, |
| 50 |
'urgency|u=s' => \$urgency, |
| 44 |
'autoversion!' => \$auto_version, |
51 |
'autoversion!' => \$auto_version, |
|
|
52 |
'autochangelog!' => \$auto_changelog, |
| 45 |
'help|h' => \$need_help, |
53 |
'help|h' => \$need_help, |
| 46 |
'debug|d' => \$debug, |
54 |
'debug|d' => \$debug, |
| 47 |
); |
55 |
); |
|
Lines 102-108
Options:
Link Here
|
| 102 |
Default is whatever pdebuild uses. |
110 |
Default is whatever pdebuild uses. |
| 103 |
--distribution, -D |
111 |
--distribution, -D |
| 104 |
the distribution value to set in the changelog when editing it. Default |
112 |
the distribution value to set in the changelog when editing it. Default |
| 105 |
is 'squeeze-dev'. |
113 |
is 'testing'. |
| 106 |
--git-checks, -g |
114 |
--git-checks, -g |
| 107 |
what level of git checks are run to determine if the working copy is |
115 |
what level of git checks are run to determine if the working copy is |
| 108 |
clean enough. One of 'all' (any changes are bad), 'modified' (only |
116 |
clean enough. One of 'all' (any changes are bad), 'modified' (only |
|
Lines 110-118
Options:
Link Here
|
| 110 |
(checking git status is skipped totally.) Default is 'all'. |
118 |
(checking git status is skipped totally.) Default is 'all'. |
| 111 |
--version, -v |
119 |
--version, -v |
| 112 |
the version string for the resulting package. Default is '$version'. |
120 |
the version string for the resulting package. Default is '$version'. |
|
|
121 |
--urgency, -u |
| 122 |
the urgency string for the resulting package. Default is '$urgency'. |
| 123 |
--incr, -i |
| 124 |
set debian revision (default = '-1') |
| 113 |
--(no)autoversion |
125 |
--(no)autoversion |
| 114 |
whether or not to use the date and git commit ID in the version value. |
126 |
whether or not to use the date and git commit ID in the version value. |
| 115 |
Default is to include it. |
127 |
Default is to include it. |
|
|
128 |
--(no)autochangelog |
| 129 |
whether or not to update the debian/changelog file. |
| 130 |
Default is to update it. |
| 116 |
--debug, -d |
131 |
--debug, -d |
| 117 |
EOH |
132 |
EOH |
| 118 |
exit; |
133 |
exit; |
|
Lines 124-134
sub latest_sha1 {
Link Here
|
| 124 |
|
139 |
|
| 125 |
sub adjust_debian_changelog { |
140 |
sub adjust_debian_changelog { |
| 126 |
my ($newversion) = @_; |
141 |
my ($newversion) = @_; |
| 127 |
# debian revision |
142 |
$newversion .= $incr ? "-$incr" : "-1"; |
| 128 |
$newversion .= "-1"; |
143 |
|
|
|
144 |
$release_str = "New upstream "; |
| 145 |
$release_str .= 'SECURITY ' if $urgency eq 'high'; |
| 146 |
$release_str .= "release ($version)"; |
| 129 |
|
147 |
|
| 130 |
sys_command_output( qq{dch --force-distribution -D "$distribution" -v "$newversion" "Building git snapshot."} ); |
148 |
sys_command_output( qq{dch --urgency $urgency -b --force-distribution -D "$distribution" -v "$newversion" "$release_str"} ); |
| 131 |
sys_command_output( qq{dch -r "Building git snapshot."} ); |
149 |
sys_command_output( qq{dch -r "$release_str"} ); |
| 132 |
} |
150 |
} |
| 133 |
|
151 |
|
| 134 |
sub reset_debian_changelog { |
152 |
sub reset_debian_changelog { |
|
Lines 141-147
sub build_package {
Link Here
|
| 141 |
|
159 |
|
| 142 |
my $pdebuildopts = $buildresult ? "--buildresult $buildresult" : ""; |
160 |
my $pdebuildopts = $buildresult ? "--buildresult $buildresult" : ""; |
| 143 |
my $pdebuildbasetgz = $basetgz ? "-- --use-network yes --basetgz /var/cache/pbuilder/" . $basetgz . ".tgz" : ""; |
161 |
my $pdebuildbasetgz = $basetgz ? "-- --use-network yes --basetgz /var/cache/pbuilder/" . $basetgz . ".tgz" : ""; |
| 144 |
sys_command_output_screen( "pdebuild $pdebuildbasetgz $pdebuildopts" ); |
162 |
sys_command_output_screen( "pdebuild --debbuildopts -sa $pdebuildbasetgz $pdebuildopts" ); |
| 145 |
} |
163 |
} |
| 146 |
|
164 |
|
| 147 |
everything_is_committed() or die "cannot build: uncommited changes"; |
165 |
everything_is_committed() or die "cannot build: uncommited changes"; |
|
Lines 150-156
my $newversion = $auto_version
Link Here
|
| 150 |
? sprintf ('%s%s.%s', $version, strftime("+%Y%m%d%H%M%S", localtime), latest_sha1()) |
168 |
? sprintf ('%s%s.%s', $version, strftime("+%Y%m%d%H%M%S", localtime), latest_sha1()) |
| 151 |
: $version; |
169 |
: $version; |
| 152 |
|
170 |
|
| 153 |
adjust_debian_changelog( $newversion ); |
171 |
adjust_debian_changelog( $newversion ) if $auto_changelog; |
| 154 |
build_package( $newversion ); |
172 |
build_package( $newversion ); |
| 155 |
reset_debian_changelog(); |
173 |
reset_debian_changelog(); |
| 156 |
|
174 |
|
| 157 |
- |
|
|