release 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/env perl
  2. # Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
  3. # This program is free software: you can redistribute it and/or modify it under
  4. # the terms of the GNU General Public License as published by the Free Software
  5. # Foundation, either version 3 of the License, or (at your option) any later
  6. # version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this program. If not, see <http://www.gnu.org/licenses/>.
  14. use strict;
  15. use warnings;
  16. use version;
  17. my $dir = shift;
  18. unless (-d $dir) {
  19. die <<"EOT";
  20. Usage: $0 DIR [RELEASE]
  21. DIR is the directory where the tarballs for each tag are created.
  22. It must already exist.
  23. If an optional RELEASE such as 2.3.0 is provided, then only tags
  24. equal or greater than 2.3.0 will be considered. The default is 2.3.0.
  25. EOT
  26. }
  27. my $min = version->parse(shift || "2.3.0");
  28. my @tags = grep { /(\d+\.\d+\.\d+)/ and version->parse($1) >= $min }
  29. split(/\n/, qx{git tag --list});
  30. unless (@tags) {
  31. die "git tag --list produced no list of tags >= $min\n";
  32. }
  33. for my $tag (@tags) {
  34. my $fname = "$dir/oddmuse-$tag.tar.gz";
  35. if (-f $fname) {
  36. warn "Skipping $tag as $fname already exists\n";
  37. next;
  38. }
  39. print "Preparing $tag\n";
  40. system("git", "checkout", $tag) == 0
  41. or die "Failed to git checkout $tag\n";
  42. system("make", "prepare") == 0
  43. or die "Failed to run make prepare for tag $tag\n";
  44. system("mv", "build", "oddmuse-$tag") == 0
  45. or die "Failed to rename the build directory to oddmuse-$tag\n";
  46. system("tar", "czf", "oddmuse-$tag.tar.gz", "oddmuse-$tag") == 0
  47. or die "Failed to build tarball oddmuse-$tag.tar.gz\n";
  48. system("mv", "oddmuse-$tag.tar.gz", $fname) == 0
  49. or die "Failed to move the tarball oddmuse-$tag.tar.gz\n";
  50. system("rm", "-rf", "oddmuse-$tag") == 0
  51. or die "Failed to remove the directory oddmuse-$tag\n";
  52. }
  53. system("git", "checkout", "main") == 0
  54. or die "Failed to git checkout main\n";