Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
43021 commits behind, 89 commits ahead of the upstream repository.
  • Simon Marlow's avatar
    043d70f0
    sanitise naming of package lists · 043d70f0
    Simon Marlow authored
    The *predicates* all start with "PKGS_THAT_...", e.g.:
    
      PKGS_THAT_BUILD_WITH_STAGE0   (previously "PACKAGES_STAGE0")
      PKGS_THAT_BUILD_WITH_STAGE2   (previously "STAGE2_PACKAGES")
      PKGS_THAT_USE_TH              (previously "TH_PACKAGES)
      etc. (there are a few more)
    
    the lists of packages to build are now consistently named:
    
      PACKAGES_STAGE0
      PACKAGES_STAGE1  (previously just "PACKAGES")
      PACKAGES_STAGE2
    043d70f0
    History
    sanitise naming of package lists
    Simon Marlow authored
    The *predicates* all start with "PKGS_THAT_...", e.g.:
    
      PKGS_THAT_BUILD_WITH_STAGE0   (previously "PACKAGES_STAGE0")
      PKGS_THAT_BUILD_WITH_STAGE2   (previously "STAGE2_PACKAGES")
      PKGS_THAT_USE_TH              (previously "TH_PACKAGES)
      etc. (there are a few more)
    
    the lists of packages to build are now consistently named:
    
      PACKAGES_STAGE0
      PACKAGES_STAGE1  (previously just "PACKAGES")
      PACKAGES_STAGE2
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
boot 7.05 KiB
#!/usr/bin/perl -w

use strict;

use Cwd;
use File::Path 'rmtree';
use File::Basename;

my %required_tag;
my $validate;
my $curdir;

$required_tag{"-"} = 1;
$validate = 0;

$curdir = &cwd()
    or die "Can't find current directory: $!";

while ($#ARGV ne -1) {
    my $arg = shift @ARGV;

    if ($arg =~ /^--required-tag=(.*)/) {
        $required_tag{$1} = 1;
    }
    elsif ($arg =~ /^--validate$/) {
        $validate = 1;
    }
    else {
        die "Bad arg: $arg";
    }
}

sub sanity_check_line_endings {
    local $/ = undef;
    open FILE, "packages" or die "Couldn't open file: $!";
    binmode FILE;
    my $string = <FILE>;
    close FILE;

    if ($string =~ /\r/) {
        print STDERR <<EOF;
Found ^M in packages.
Perhaps you need to run
    git config --global core.autocrlf false
and re-check out the tree?
EOF
        exit 1;
    }
}

sub sanity_check_tree {
    my $tag;
    my $dir;

    # Check that we have all boot packages.
    open PACKAGES, "< packages";
    while (<PACKAGES>) {
        if (/^#/) {
            # Comment; do nothing
        }
        elsif (/^([a-zA-Z0-9\/.-]+) +([^ ]+) +[^ ]+ +[^ ]+$/) {
            $dir = $1;
            $tag = $2;

            # If $tag is not "-" then it is an optional repository, so its
            # absence isn't an error.
            if (defined($required_tag{$tag})) {
                # We would like to just check for a .git directory here,
                # but in an lndir tree we avoid making .git directories,
                # so it doesn't exist. We therefore require that every repo