set-version.pl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/perl
  2. $version = $ARGV[0];
  3. if ($version eq "--all" or $version eq "-a") {
  4. $all = 1;
  5. $version = $ARGV[1]
  6. }
  7. if ($version eq "--only" or $version eq "-o") {
  8. $only = 1;
  9. $version = $ARGV[1]
  10. }
  11. die "No version given" unless $version=~/\S/;
  12. $date = `date "+%B %Y"`; chomp $date;
  13. $year = `date "+%Y"` ; chomp $year;
  14. print STDERR "Changing version to \"$version\" and date to \"$date\" in all relevant files\n" ;
  15. if (not $only) {
  16. print STDERR join("\n",glob("lisp/*.el")),"\n";
  17. $cmd = qq{s/^(;; Version:)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\(defconst org-version )"(\\S+)"/\$1"$version"/};
  18. $c1 = "perl -pi -e '$cmd' lisp/*.el";
  19. system($c1);
  20. print STDERR "doc/org.texi\n";
  21. $cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
  22. $c1 = "perl -pi -e '$cmd' doc/org.texi";
  23. system($c1);
  24. print STDERR "doc/orgguide.texi\n";
  25. $cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
  26. $c1 = "perl -pi -e '$cmd' doc/orgguide.texi";
  27. system($c1);
  28. print STDERR "doc/orgcard.tex\n";
  29. $cmd = qq{s/^\\\\def\\\\orgversionnumber\\{\\S+\\}/\\\\def\\\\orgversionnumber{$version}/;s/\\\\def\\\\versionyear\\{\\S+\\}/\\\\def\\\\versionyear{$year}/;s/\\\\def\\\\year\\{\\S+\\}/\\\\def\\\\year{$year}/;};
  30. $c1 = "perl -pi -e '$cmd' doc/orgcard.tex";
  31. system($c1);
  32. print STDERR "README\n";
  33. $cmd = qq{s/^(The version of this release is:)\\s+(\\S+)[ \t]*\$/\$1 $version/;};
  34. $c1 = "perl -pi -e '$cmd' README";
  35. system($c1);
  36. }