Make the "tag" column of the packages file always present
authorIan Lynagh <igloo@earth.li>
Sun, 15 Aug 2010 15:16:57 +0000 (15:16 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 15 Aug 2010 15:16:57 +0000 (15:16 +0000)
It makes the parsing simpler if we always have the same number of columns

boot
darcs-all
packages

diff --git a/boot b/boot
index 339f21d..6683ad5 100644 (file)
--- a/boot
+++ b/boot
@@ -8,6 +8,7 @@ use Cwd;
 system("/usr/bin/perl", "-w", "boot-pkgs") == 0
     or die "Running boot-pkgs failed: $?";
 
 system("/usr/bin/perl", "-w", "boot-pkgs") == 0
     or die "Running boot-pkgs failed: $?";
 
+my $tag;
 my $dir;
 my $curdir;
 
 my $dir;
 my $curdir;
 
@@ -20,21 +21,22 @@ while (<PACKAGES>) {
     if (/^#/) {
         # Comment; do nothing
     }
     if (/^#/) {
         # Comment; do nothing
     }
-    elsif (/^([a-zA-Z0-9\/.-]+) *[^ ]+ *[^ ]+$/) {
+    elsif (/^([a-zA-Z0-9\/.-]+) *([^ ]+) *[^ ]+ *[^ ]+$/) {
         $dir = $1;
         $dir = $1;
+        $tag = $2;
         
         
-        # We would like to just check for an _darcs directory here, but in
-        # an lndir tree we avoid making _darcs directories, so it doesn't
-        # exist. We therefore require that every repo has a LICENSE file
-        # instead.
-        if (! -f "$dir/LICENSE") {
-            print STDERR "Error: $dir/LICENSE doesn't exist.\n";
-            die "Maybe you haven't done './darcs-all get'?";
-        }
-    }
-    elsif (/^([a-zA-Z0-9\/.-]+) *[^ ]+ *[^ ]+ *[^ ]+$/) {
-        # These are lines which refer to optional repositories, so their
+        # If $tag is not "-" then it is an optional repository, so its
         # absence isn't an error.
         # absence isn't an error.
+        if ($tag eq "-") {
+            # We would like to just check for an _darcs directory here,
+            # but in an lndir tree we avoid making _darcs directories,
+            # so it doesn't exist. We therefore require that every repo
+            # has a LICENSE file instead.
+            if (! -f "$dir/LICENSE") {
+                print STDERR "Error: $dir/LICENSE doesn't exist.\n";
+                die "Maybe you haven't done './darcs-all get'?";
+            }
+        }
     }
     else {
         die "Bad line in packages file: $_";
     }
     else {
         die "Bad line in packages file: $_";
index 72aff54..9eee3c6 100644 (file)
--- a/darcs-all
+++ b/darcs-all
@@ -166,9 +166,9 @@ sub darcsall {
 
     foreach (@repos) {
         chomp;
 
     foreach (@repos) {
         chomp;
-        if (/^([^# ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
+        if (/^([^# ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) {
             $localpath = $1;
             $localpath = $1;
-            $tag = defined($2) ? $2 : "";
+            $tag = $2;
             $remotepath = $3;
 
             if ($checked_out_tree) {
             $remotepath = $3;
 
             if ($checked_out_tree) {
@@ -190,7 +190,7 @@ sub darcsall {
                     darcs (@_, "--repodir", $localpath);
                 }
             }
                     darcs (@_, "--repodir", $localpath);
                 }
             }
-            elsif ($tag eq "") {
+            elsif ($tag eq "-") {
                 message "== Required repo $localpath is missing! Skipping";
             }
             else {
                 message "== Required repo $localpath is missing! Skipping";
             }
             else {
@@ -227,9 +227,9 @@ sub darcsget {
 
     foreach (@repos) {
         chomp;
 
     foreach (@repos) {
         chomp;
-        if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+) +([^ ]+)$/) {
+        if (/^([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) {
             $localpath = $1;
             $localpath = $1;
-            $tag = defined($2) ? $2 : "";
+            $tag = $2;
             $remotepath = $3;
 
             if ($checked_out_tree) {
             $remotepath = $3;
 
             if ($checked_out_tree) {
@@ -239,7 +239,7 @@ sub darcsget {
                 $path = "$repo_base/$remotepath";
             }
 
                 $path = "$repo_base/$remotepath";
             }
 
-            if (($tag eq "") || defined($tags{$tag})) {
+            if (($tag eq "-") || defined($tags{$tag})) {
                 if (-d $localpath) {
                     warning("$localpath already present; omitting");
                 }
                 if (-d $localpath) {
                     warning("$localpath already present; omitting");
                 }
index 23aa5e0..53d1a21 100644 (file)
--- a/packages
+++ b/packages
@@ -1,5 +1,5 @@
 # Despite the name "package", this file contains the master list of 
 # Despite the name "package", this file contains the master list of 
-# the *repositories* that make up GHC.
+# the *repositories* that make up GHC. It is parsed by boot and darcs-all.
 #
 # Some of this information is duplicated elsewhere in the build system:
 #    See Trac #3896
 #
 # Some of this information is duplicated elsewhere in the build system:
 #    See Trac #3896
 #    - nofib and testsuite are optional helpers
 #
 # The format of the lines in this file is:
 #    - nofib and testsuite are optional helpers
 #
 # The format of the lines in this file is:
-#   localpath    (optional) tag    remotepath    VCS
+#   localpath    tag    remotepath    VCS
 # where
 #   * 'localpath' is where to put the repository in a checked out tree,
 #   * 'remotepath' is where the repository is in the central repository,
 #   * 'VCS' is what version control system the repo uses,
 # where
 #   * 'localpath' is where to put the repository in a checked out tree,
 #   * 'remotepath' is where the repository is in the central repository,
 #   * 'VCS' is what version control system the repo uses,
-#   * The 'tag', if present, determines when "darcs-all get" will get the
-#     repo. If there is no tag then it will always get it, but if there
+#   * The 'tag' determines when "darcs-all get" will get the
+#     repo. If the tag is "-" then it will always get it, but if there
 #     is a tag then a corresponding flag must be given to darcs-all, e.g.
 #     if you want to get the packages with an "extralibs" or "testsuite"
 #     tag then you need to use "darcs-all --extra --testsuite get".
 #     Support for new tags must be manually added to the darcs-all script.
 #
 # Lines that start with a '#' are comments.
 #     is a tag then a corresponding flag must be given to darcs-all, e.g.
 #     if you want to get the packages with an "extralibs" or "testsuite"
 #     tag then you need to use "darcs-all --extra --testsuite get".
 #     Support for new tags must be manually added to the darcs-all script.
 #
 # Lines that start with a '#' are comments.
-.                                       ghc                             git
-ghc-tarballs                            ghc-tarballs                    darcs
-utils/hsc2hs                            hsc2hs                          darcs
-utils/haddock                           haddock2                        darcs
-libraries/array                         packages/array                  darcs
-libraries/base                          packages/base                   darcs
-libraries/binary                        packages/binary                 darcs
-libraries/bytestring                    packages/bytestring             darcs
-libraries/Cabal                         packages/Cabal                  darcs
-libraries/containers                    packages/containers             darcs
-libraries/directory                     packages/directory              darcs
-libraries/dph                           packages/dph                    darcs
-libraries/extensible-exceptions         packages/extensible-exceptions  darcs
-libraries/filepath                      packages/filepath               darcs
-libraries/ghc-prim                      packages/ghc-prim               darcs
-libraries/haskeline                     packages/haskeline              darcs
-libraries/haskell98                     packages/haskell98              darcs
-libraries/haskell2010                   packages/haskell2010            darcs
-libraries/hpc                           packages/hpc                    darcs
-libraries/integer-gmp                   packages/integer-gmp            darcs
-libraries/integer-simple                packages/integer-simple         darcs
-libraries/mtl                           packages/mtl                    darcs
-libraries/old-locale                    packages/old-locale             darcs
-libraries/old-time                      packages/old-time               darcs
-libraries/pretty                        packages/pretty                 darcs
-libraries/process                       packages/process                darcs
-libraries/random                        packages/random                 darcs
-libraries/template-haskell              packages/template-haskell       darcs
-libraries/terminfo                      packages/terminfo               darcs
-libraries/unix                          packages/unix                   darcs
-libraries/utf8-string                   packages/utf8-string            darcs
-libraries/Win32                         packages/Win32                  darcs
-libraries/xhtml                         packages/xhtml                  darcs
-testsuite                   testsuite   testsuite                       darcs
-nofib                       nofib       nofib                           darcs
-libraries/deepseq           extra       packages/deepseq                darcs
-libraries/parallel          extra       packages/parallel               darcs
-libraries/stm               extra       packages/stm                    darcs
+.                               -           ghc                             git
+ghc-tarballs                    -           ghc-tarballs                    darcs
+utils/hsc2hs                    -           hsc2hs                          darcs
+utils/haddock                   -           haddock2                        darcs
+libraries/array                 -           packages/array                  darcs
+libraries/base                  -           packages/base                   darcs
+libraries/binary                -           packages/binary                 darcs
+libraries/bytestring            -           packages/bytestring             darcs
+libraries/Cabal                 -           packages/Cabal                  darcs
+libraries/containers            -           packages/containers             darcs
+libraries/directory             -           packages/directory              darcs
+libraries/dph                   -           packages/dph                    darcs
+libraries/extensible-exceptions -           packages/extensible-exceptions  darcs
+libraries/filepath              -           packages/filepath               darcs
+libraries/ghc-prim              -           packages/ghc-prim               darcs
+libraries/haskeline             -           packages/haskeline              darcs
+libraries/haskell98             -           packages/haskell98              darcs
+libraries/haskell2010           -           packages/haskell2010            darcs
+libraries/hpc                   -           packages/hpc                    darcs
+libraries/integer-gmp           -           packages/integer-gmp            darcs
+libraries/integer-simple        -           packages/integer-simple         darcs
+libraries/mtl                   -           packages/mtl                    darcs
+libraries/old-locale            -           packages/old-locale             darcs
+libraries/old-time              -           packages/old-time               darcs
+libraries/pretty                -           packages/pretty                 darcs
+libraries/process               -           packages/process                darcs
+libraries/random                -           packages/random                 darcs
+libraries/template-haskell      -           packages/template-haskell       darcs
+libraries/terminfo              -           packages/terminfo               darcs
+libraries/unix                  -           packages/unix                   darcs
+libraries/utf8-string           -           packages/utf8-string            darcs
+libraries/Win32                 -           packages/Win32                  darcs
+libraries/xhtml                 -           packages/xhtml                  darcs
+testsuite                       testsuite   testsuite                       darcs
+nofib                           nofib       nofib                           darcs
+libraries/deepseq               extra       packages/deepseq                darcs
+libraries/parallel              extra       packages/parallel               darcs
+libraries/stm                   extra       packages/stm                    darcs