Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[build] git_describe is enough, no need for a separate version specif…
…ication.

Also made some error messages nicer
  • Loading branch information
moritz committed Mar 3, 2011
1 parent 191305f commit e0bfb29
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
17 changes: 9 additions & 8 deletions Configure.pl
Expand Up @@ -7,7 +7,7 @@
use Getopt::Long;
use Cwd;
use lib "build/lib";
use Parrot::CompareRevisions qw(compare_revs parse_revision_file read_config);
use Parrot::CompareRevisions qw(compare_revs parse_revision_file read_config version_from_git_describe);

MAIN: {
my %options;
Expand Down Expand Up @@ -53,23 +53,24 @@
my %config = read_config(@parrot_config_exe);

# Determine the revision of Parrot we require
my ($req, $reqpar) = parse_revision_file;
my $git_describe = parse_revision_file;
my $parrot_version = version_from_git_describe($git_describe);

my $parrot_errors = '';
if (!%config) {
if (!%config) {
$parrot_errors .= "Unable to locate parrot_config\n";
}
else {
if ($config{git_describe}) {
# a parrot built from git
if (compare_revs($req, $config{'git_describe'}) > 0) {
$parrot_errors .= "Parrot revision $req required (currently $config{'git_describe'})\n";
if (compare_revs($git_describe, $config{'git_describe'}) > 0) {
$parrot_errors .= "Parrot revision $git_describe required (currently $config{'git_describe'})\n";
}
}
else {
# not built from a git repo - let's assume it's a release
if (version_int($reqpar) > version_int($config{'VERSION'})) {
$parrot_errors .= "Parrot version $reqpar required (currently $config{VERSION})\n";
if (version_int($parrot_version) > version_int($config{'VERSION'})) {
$parrot_errors .= "Parrot version $parrot_version required (currently $config{VERSION})\n";
}
}
}
Expand All @@ -78,7 +79,7 @@
die <<"END";
===SORRY!===
$parrot_errors
To automatically clone (git) and build a copy of parrot $req,
To automatically clone (git) and build a copy of parrot $git_describe,
try re-running Configure.pl with the '--gen-parrot' option.
Or, use the '--parrot-config' option to explicitly specify
the location of parrot_config to be used to build Rakudo Perl.
Expand Down
4 changes: 2 additions & 2 deletions build/gen_parrot.pl
Expand Up @@ -28,7 +28,7 @@ =head2 DESCRIPTION
my $slash = $^O eq 'MSWin32' ? '\\' : '/';

# Determine the revision of Parrot we require
my ($req, $reqpar) = parse_revision_file;
my $req = parse_revision_file;

{
no warnings;
Expand All @@ -39,7 +39,7 @@ =head2 DESCRIPTION
close $REV;
$revision =~ s/\s.*//s;
if (compare_revs($revision, $req) >= 0) {
print "Parrot $revision already available ($req required)\n";
print "Parrot $revision already available ($req required). that's new enough.\n";
exit(0);
}
}
Expand Down
24 changes: 21 additions & 3 deletions build/lib/Parrot/CompareRevisions.pm
Expand Up @@ -3,16 +3,29 @@ use strict;
use warnings;

use base qw(Exporter);
our @EXPORT_OK = qw(compare_revs parse_git_describe parse_revision_file read_config);
our @EXPORT_OK = qw(
parse_revision_file
parse_git_describe
version_from_git_describe
compare_revs
read_config
);

sub config_check {

}

sub parse_revision_file {
my $filename = shift || 'build/PARROT_REVISION';
open my $REQ, '<', $filename
or die "cannot open '$filename' for reading: $!\n";
my ($req, $reqpar) = split(' ', <$REQ>);
local $/;
my $str = <$REQ>;
close $REQ;
$str =~ s/\A\s+//;
$str =~ s/\s*\z//;

return $req, $reqpar
return $str;
}

sub parse_git_describe {
Expand All @@ -25,6 +38,11 @@ sub parse_git_describe {
return @c;
}

sub version_from_git_describe {
my @chunks = (parse_git_describe @_)[0..2];
return join '.', @chunks;
}

sub compare_revs {
my ($aa, $bb) = @_;
return 1 if $bb =~ /^r?\d+$/;
Expand Down
12 changes: 7 additions & 5 deletions docs/release_guide.pod
Expand Up @@ -107,16 +107,18 @@ the release announcement).
=item 2.

Once Parrot issues its monthly release, edit Rakudo's
build/PARROT_REVISION file to contain the C<git describe --tags> output
and release number corresponding to Parrot's monthly
release. For example, for November 2010 PARROT_REVISION file
contained "RELEASE_2_10_1 2.10.0". As always, test to make sure Rakudo
still builds and passes its tests. Once build/PARROT_REVISION
F<build/PARROT_REVISION> file to contain the C<git describe --tags>
output corresponding to Parrot's monthly release.
Once C<build/PARROT_REVISION>
has been set to the Parrot release, it must not be changed until
after the Rakudo release. In other words, we want each
monthly release of Rakudo to be able to be built using
the immediately prior release of Parrot.

(Old releases required you to add both the version and the
C<git describe> output to the PARROT_REVISION file. This is
not necessary anymore).

=item 3.

The short period following the Parrot release until the
Expand Down

0 comments on commit e0bfb29

Please sign in to comment.