mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
release.pl: support point releases
This commit is contained in:
parent
948c3fe0df
commit
8979d5596d
@ -13,49 +13,15 @@ use warnings;
|
|||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
|
|
||||||
my $newmajor;
|
my $dryrun;
|
||||||
my $newminor;
|
|
||||||
my $releasename;
|
|
||||||
my $help;
|
|
||||||
|
|
||||||
my $result = GetOptions(
|
sub updateCMakeLists($$$$) {
|
||||||
"major" => \$newmajor,
|
my($major,$minor,$patch,$release) = @_;
|
||||||
"minor" => \$newminor,
|
|
||||||
"releasename=s" => \$releasename,
|
|
||||||
"help" => \$help
|
|
||||||
);
|
|
||||||
|
|
||||||
$releasename = shift @ARGV;
|
if( $dryrun ) {
|
||||||
|
print "DRYRUN: Update CMakeLists.txt to $major.$minor.$patch ($release)\n";
|
||||||
pod2usage(1) if $help or !defined $releasename;
|
return;
|
||||||
|
}
|
||||||
my $major;
|
|
||||||
my $minor;
|
|
||||||
open F, "CMakeLists.txt";
|
|
||||||
while(<F>) {
|
|
||||||
if(/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/) {
|
|
||||||
$major = $1;
|
|
||||||
} elsif(/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/) {
|
|
||||||
$minor = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close F;
|
|
||||||
|
|
||||||
if( defined $newmajor ) {
|
|
||||||
die "New major must be equal or greater than old major $major" if $newmajor <= $major;
|
|
||||||
$newminor = 0 unless defined $newminor;
|
|
||||||
} else {
|
|
||||||
$newmajor = $major;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( defined $newminor ) {
|
|
||||||
die "New minor must be greater than current minor $minor" if $newmajor==$major && $newminor<=$minor;
|
|
||||||
} else {
|
|
||||||
$newminor = $minor + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub updateCMakeLists {
|
|
||||||
my($major,$minor,$release) = @_;
|
|
||||||
|
|
||||||
rename "CMakeLists.txt", "CMakeLists.txt.orig" or die "cannot rename CMakeLists.txt: $!";
|
rename "CMakeLists.txt", "CMakeLists.txt.orig" or die "cannot rename CMakeLists.txt: $!";
|
||||||
open I, "CMakeLists.txt.orig";
|
open I, "CMakeLists.txt.orig";
|
||||||
@ -63,6 +29,7 @@ sub updateCMakeLists {
|
|||||||
while(<I>) {
|
while(<I>) {
|
||||||
s/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MAJOR "$major")/;
|
s/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MAJOR "$major")/;
|
||||||
s/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MINOR "$minor")/;
|
s/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MINOR "$minor")/;
|
||||||
|
s/SET\(CPACK_PACKAGE_VERSION_PATCH "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_PATCH "$patch")/;
|
||||||
s/SET\(RELEASE_NAME "(.+)"\)/SET(RELEASE_NAME "$release")/;
|
s/SET\(RELEASE_NAME "(.+)"\)/SET(RELEASE_NAME "$release")/;
|
||||||
print O;
|
print O;
|
||||||
}
|
}
|
||||||
@ -70,70 +37,168 @@ sub updateCMakeLists {
|
|||||||
close I;
|
close I;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub run($$) {
|
||||||
|
my($cmd, $errmsg) = @_;
|
||||||
|
if( $dryrun ) {
|
||||||
|
print "DRYRUN: $cmd\n";
|
||||||
|
} elsif( system($cmd) != 0 ) {
|
||||||
|
print STDERR "error: $errmsg [$?]";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $newreleasename;
|
||||||
|
my $help;
|
||||||
|
my $domajor;
|
||||||
|
my $dominor;
|
||||||
|
my $dopoint;
|
||||||
|
|
||||||
|
my $result = GetOptions(
|
||||||
|
"major" => \$domajor,
|
||||||
|
"minor" => \$dominor,
|
||||||
|
"point" => \$dopoint,
|
||||||
|
"releasename=s" => \$newreleasename,
|
||||||
|
"help" => \$help,
|
||||||
|
"dryrun" => \$dryrun,
|
||||||
|
);
|
||||||
|
|
||||||
|
pod2usage(1) if $help;
|
||||||
|
|
||||||
|
my $i = 0;
|
||||||
|
$i++ if defined $domajor;
|
||||||
|
$i++ if defined $dominor;
|
||||||
|
$i++ if defined $dopoint;
|
||||||
|
pod2usage("Exactly one of -major, -minor or -point expected") if $i!=1;
|
||||||
|
pod2usage("Release name for major and minor releases expected") if !$dopoint && !defined $newreleasename;
|
||||||
|
pod2usage("No CMakeLists.txt in current directory") unless -r "CMakeLists.txt";
|
||||||
|
|
||||||
|
my $major;
|
||||||
|
my $minor;
|
||||||
|
my $patch;
|
||||||
|
my $releasename;
|
||||||
|
open F, "CMakeLists.txt";
|
||||||
|
while(<F>) {
|
||||||
|
if(/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/) {
|
||||||
|
$major = $1;
|
||||||
|
} elsif(/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/) {
|
||||||
|
$minor = $1;
|
||||||
|
} elsif(/SET\(CPACK_PACKAGE_VERSION_PATCH "(\d+)"\)/) {
|
||||||
|
$patch = $1;
|
||||||
|
} elsif(/SET\(RELEASE_NAME \"(.*)\"\)/) {
|
||||||
|
$releasename = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close F;
|
||||||
|
|
||||||
|
my $branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`;
|
||||||
|
$branch =~ s/\s+$//;
|
||||||
|
pod2usage("Not on a branch") unless $branch;
|
||||||
|
pod2usage("Current branch is $branch. master or a release branch expected") if $branch !~ /^(master|release-(\d+)_(\d+))$/;
|
||||||
|
pod2usage("Version mismatch ($2.$3 in branch $branch vs. $major.$minor in CMakeLists.txt)") if $branch ne "master" && ( $major != $2 || $minor != $3 );
|
||||||
|
pod2usage("Release name Master expected on master branch" ) if $branch eq "master" && $releasename ne "Master";
|
||||||
|
|
||||||
|
if( $branch eq "master" ) {
|
||||||
|
pod2usage("No point releases on master branch") if $dopoint;
|
||||||
|
pod2usage("No new release name for major/minor release") unless $newreleasename || $newreleasename eq $releasename;
|
||||||
|
} else {
|
||||||
|
pod2usage("Only point releases on release branches") if !$dopoint;
|
||||||
|
pod2usage("New release names only for new minor releases") if $newreleasename;
|
||||||
|
$newreleasename = $releasename;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $newmajor;
|
||||||
|
my $newminor;
|
||||||
|
my $newpatch;
|
||||||
|
if( $domajor ) {
|
||||||
|
$newmajor = $major + 1;
|
||||||
|
$newminor = 0;
|
||||||
|
$newpatch = 0;
|
||||||
|
} elsif( $dominor ) {
|
||||||
|
$newmajor = $major;
|
||||||
|
$newminor = $minor + 1;
|
||||||
|
$newpatch = 0;
|
||||||
|
} elsif( $dopoint ) {
|
||||||
|
$newmajor = $major;
|
||||||
|
$newminor = $minor;
|
||||||
|
$newpatch = $patch + 1;
|
||||||
|
} else {
|
||||||
|
pod2usage("No version change");
|
||||||
|
}
|
||||||
|
|
||||||
|
pod2usage("Splash images/splash/splash-$newmajor.$newminor.png not found") unless -r "images/splash/splash-$newmajor.$newminor.png";
|
||||||
|
pod2usage("NSIS image ms-windows/Installer-Files/WelcomeFinishPage-$newmajor.$newminor.bmp not found") unless -r "ms-windows/Installer-Files/WelcomeFinishPage-$newmajor.$newminor.bmp";
|
||||||
|
|
||||||
print "Last pull rebase...\n";
|
print "Last pull rebase...\n";
|
||||||
system( "git pull --rebase" ) == 0 or die "git pull rebase failed";
|
run( "git pull --rebase", "git pull rebase failed" );
|
||||||
|
|
||||||
my $release = "$newmajor.$newminor";
|
my $release = "$newmajor.$newminor";
|
||||||
|
my $version = "$release.$newpatch";
|
||||||
my $relbranch = "release-${newmajor}_${newminor}";
|
my $relbranch = "release-${newmajor}_${newminor}";
|
||||||
my $reltag = "final-${newmajor}_${newminor}_0";
|
my $reltag = "final-${newmajor}_${newminor}_${newpatch}";
|
||||||
|
|
||||||
print "Pulling transifex translations...\n";
|
unless( $dopoint ) {
|
||||||
system( "scripts/pull_ts.sh" ) == 0 or die "pull_ts.sh failed";
|
print "Pulling transifex translations...\n";
|
||||||
system( "git add i18n/*.ts" ) == 0 or die "adding translations failed";
|
run( "scripts/pull_ts.sh", "pull_ts.sh failed" );
|
||||||
system( "git commit -a -m \"translation update to $release from transifex\"") == 0 or die "could not commit translation updates";
|
run( "git add i18n/*.ts", "adding translations failed" );
|
||||||
|
run( "git commit -a -m \"translation update for $release from transifex\"", "could not commit translation updates" );
|
||||||
|
}
|
||||||
|
|
||||||
print "Updating changelog...\n";
|
print "Updating changelog...\n";
|
||||||
system( "scripts/create_changelog.sh" ) == 0 or die "create_changelog.sh failed";
|
run( "scripts/create_changelog.sh", "create_changelog.sh failed" );
|
||||||
system( "git commit -a -m \"changelog update for $release\"") == 0 or die "could not commit changelog update";
|
|
||||||
|
|
||||||
print "Creating branch...\n";
|
unless( $dopoint ) {
|
||||||
system( "git checkout -b $relbranch" ) == 0 or die "git checkout release branch failed";
|
run( "git commit -a -m \"changelog update for $release\"", "could not commit changelog update" );
|
||||||
updateCMakeLists($newmajor,$newminor,$releasename);
|
|
||||||
|
|
||||||
print "Updating branch...\n";
|
print "Creating and checking out branch...\n";
|
||||||
system( "dch -r ''" ) == 0 or die "dch failed";
|
run( "git checkout -b $relbranch", "git checkout release branch failed" );
|
||||||
system( "dch --newversion $newmajor.$newminor.0 'Release of $release'" ) == 0 or die "dch failed";
|
|
||||||
system( "cp debian/changelog /tmp" ) == 0 or die "backup changelog failed";
|
|
||||||
|
|
||||||
if( -f "images/splash/splash-release.png" ) {
|
|
||||||
system( "cp -v images/splash/splash-release.png images/splash/splash.png" ) == 0 or die "splash png switch failed";
|
|
||||||
} else {
|
|
||||||
print "WARNING: NO images/splash/splash-release.png\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( -f "images/splash/splash-release.xcf.bz2" ) {
|
updateCMakeLists($newmajor,$newminor,$newpatch,$releasename);
|
||||||
system( "cp -v images/splash/splash-release.xcf.bz2 images/splash/splash.xcf.bz2" ) == 0 or die "splash xcf switch failed";
|
|
||||||
} else {
|
|
||||||
print "WARNING: NO images/splash/splash-release.xcf.bz2\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if( -f "ms-windows/Installer-Files/WelcomeFinishPage-release.bmp" ) {
|
print "Updating version...\n";
|
||||||
system( "cp -v ms-windows/Installer-Files/WelcomeFinishPage-release.bmp ms-windows/Installer-Files/WelcomeFinishPage.bmp" ) == 0 or die "installer bitmap switch failed";
|
run( "dch -r ''", "dch failed" );
|
||||||
} else {
|
run( "dch --newversion $version 'Release of $version'", "dch failed" );
|
||||||
print "WARNING: NO ms-windows/Installer-Files/WelcomeFinishPage-release.bmp\n";
|
run( "cp debian/changelog /tmp", "backup changelog failed" );
|
||||||
}
|
|
||||||
|
|
||||||
system( "git commit -a -m 'Release of $release ($releasename)'" ) == 0 or die "release commit failed";
|
unless( $dopoint ) {
|
||||||
system( "git tag $reltag -m 'Version $release'" ) == 0 or die "tag failed";
|
run( "cp -v images/splash/splash-$newmajor.$newminor.png images/splash/splash.png", "splash png switch failed" );
|
||||||
|
run( "cp -v ms-windows/Installer-Files/WelcomeFinishPage-$newmajor.$newminor.bmp ms-windows/Installer-Files/WelcomeFinishPage.bmp", "installer bitmap switch failed" );
|
||||||
|
|
||||||
|
if( -f "images/splash/splash-release.xcf.bz2" ) {
|
||||||
|
run( "cp -v images/splash/splash-$newmajor.$newminor.xcf.bz2 images/splash/splash.xcf.bz2", "splash xcf switch failed" );
|
||||||
|
} else {
|
||||||
|
print "WARNING: NO images/splash/splash-release.xcf.bz2\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
run( "git commit -a -m 'Release of $release ($releasename)'", "release commit failed" );
|
||||||
|
run( "git tag $reltag -m 'Version $release'", "tag failed" );
|
||||||
|
} else {
|
||||||
|
run( "git commit -a -m 'Release of $version'", "release commit failed" );
|
||||||
|
run( "git tag $reltag -m 'Version $version'", "tag failed" );
|
||||||
|
}
|
||||||
|
|
||||||
print "Producing archive...\n";
|
print "Producing archive...\n";
|
||||||
system( "git archive --format tar --prefix=qgis-$release.0/ $reltag | bzip2 -c >qgis-$release.0.tar.bz2" ) == 0 or die "git archive failed";
|
run( "git archive --format tar --prefix=qgis-$version/ $reltag | bzip2 -c >qgis-$version.tar.bz2", "git archive failed" );
|
||||||
system( "md5sum qgis-$newmajor.$newminor.0.tar.bz2 >qgis-$release.0.tar.bz2.md5" ) == 0 or die "md5sum failed";
|
run( "md5sum qgis-$version.tar.bz2 >qgis-$version.tar.bz2.md5", "md5sum failed" );
|
||||||
|
|
||||||
$newminor++;
|
unless( $dopoint ) {
|
||||||
|
$newminor++;
|
||||||
|
|
||||||
print "Updating master...\n";
|
print "Updating master...\n";
|
||||||
system( "git checkout master" ) == 0 or die "checkout master failed";
|
run( "git checkout master", "checkout master failed" );
|
||||||
updateCMakeLists($newmajor,$newminor,"Master");
|
updateCMakeLists($newmajor,$newminor,0,"Master");
|
||||||
system( "cp /tmp/changelog debian" ) == 0 or die "restore changelog failed";
|
run( "cp /tmp/changelog debian", "restore changelog failed" );
|
||||||
system("dch -r ''" ) == 0 or die "dch failed";
|
run( "dch -r ''", "dch failed" );
|
||||||
system( "dch --newversion $newmajor.$newminor.0 'New development version $newmajor.$newminor after branch of $release'" ) == 0 or die "dch failed";
|
run( "dch --newversion $newmajor.$newminor.0 'New development version $newmajor.$newminor after branch of $release'", "dch failed" );
|
||||||
system( "git commit -a -m 'Bump version to $newmajor.$newminor'" ) == 0 or die "bump version failed";
|
run( "git commit -a -m 'Bump version to $newmajor.$newminor'", "bump version failed" );
|
||||||
|
}
|
||||||
|
|
||||||
|
my $topush = ($dopoint ? "" : "master ") . "$relbranch $reltag";
|
||||||
|
|
||||||
print "Push dry-run...\n";
|
print "Push dry-run...\n";
|
||||||
system( "git push -n origin master $relbranch $reltag" ) == 0 or die "git push -n failed";
|
run( "git push -n origin $topush", "push dry run failed" );
|
||||||
|
print "Now manually push and upload the tarballs :\n\tgit push origin $topush\n\trsync qgis-$version.tar.bz2* qgis.org:/var/www/downloads/\n\n";
|
||||||
|
|
||||||
print "Now manually push and upload the tarballs :\n\tgit push origin master $relbranch $reltag\n\trsync qgis-$release.0.tar.bz2* qgis.org:/var/www/downloads/\n\n";
|
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
@ -141,10 +206,12 @@ release.pl - create a new release
|
|||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
release.pl [options] releasename
|
release.pl {{-major|-minor} -releasename=releasename|-point}
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-major=newmajor new major number for release (defaults to current major version number)
|
-major do a new major release
|
||||||
-minor=newminor new minor number for release (defaults to current minor + 1 or 0 when major version number was increased)
|
-minor do a new minor release
|
||||||
next master will become minor + 1
|
-point do a new point release
|
||||||
|
-releasename=name new release name for master/minor release
|
||||||
|
-dryrun just echo but don't run any commands
|
||||||
=cut
|
=cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user