pull up r19389 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 2 Apr 2007 23:17:18 +0000 (23:17 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 2 Apr 2007 23:17:18 +0000 (23:17 +0000)
 r19389@cathode-dark-space:  kpkoch | 2007-04-02 17:03:36 -0400
 Target_Version: 1.6.1
 Ticket: 5490
 Tags: pullup

 Add svnbranch; change internal names to svntag and svnbranch.  Implement cvs tags and svn tags and branches.

 Move reading of kerberos.ver to after files are fetched.

ticket: 5490

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19390 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/build/BKWconfig.xml
src/windows/build/bkw.pl

index a7a34ee2a3560cc0bfad217cca6ae4e269e87569..35ba0565056fe4b7a2df1a27a4e4b75123565640 100644 (file)
@@ -4,8 +4,9 @@
     <CommandLine>\r
         <!-- The most changeable parameters can be specified on the command line.    -->\r
         <Tags>\r
-            <cvs value="" />\r
-            <svn value=""/>\r
+            <cvs        value="" />\r
+            <svntag     value="" />\r
+            <svnbranch  value="" />\r
             </Tags>\r
         <Directories>\r
             <!--    Sources will be checked out of repositories into <src>.  The structure\r
index 6c9fad1f5b3137858e392299316e6dc09df31f70..49f4c9ab5d54d6ef8411cee6af1e6097c830906e 100644 (file)
@@ -49,8 +49,9 @@ Usage: $0 (-f --config) config-file [options] NMAKE-options
                 update   | up  ) Options are to checkout, update or \r
                 skip          /  take no action [skip].\r
     /username /u name  username used to access svn if checking out.\r
-    /cvstag /c tag   \\ If non-empty, the tag is appended to cvs and svn\r
-    /svntag /s tag   / commands to select the rev to fetch.\r
+    /cvstag /c tag     use -r <tag> in cvs command\r
+    /svnbranch /b tag  append /branches/<tag> to svn path.\r
+    /svntag /s tag     append /tags/<tag> to svn path.\r
     /debug /d          Do debug make instead of release make.\r
     /nomake            Skip make step.\r
     /clean             Build clean target.\r
@@ -90,6 +91,7 @@ sub main {
            'help|h|?',\r
            'cvstag|c:s',\r
            'svntag|s:s',\r
+           'svnbranch|b:s',\r
            'srcdir|r:s',\r
            'outdir|o:s',\r
            'debug|d',\r
@@ -168,18 +170,19 @@ sub main {
     @fetch      = $config->{Stages}->{FetchSources}->{Config};\r
 \r
     # Update the configuration with overrides from the command line:\r
-    $tags[0]->{cvs}->{value} = $OPT->{cvstag}                   if exists $OPT->{cvstag};\r
-    $tags[0]->{svn}->{value} = $OPT->{svnurl}                   if exists $OPT->{svnurl};\r
-    $paths[0]->{src}->{path} = $OPT->{srcdir}                   if exists $OPT->{srcdir};\r
-    $paths[0]->{out}->{path} = $OPT->{outdir}                   if exists $OPT->{outdir};\r
-    $switches[0]->{debug}->{value} = $OPT->{debug}              if exists $OPT->{debug};\r
-    $switches[0]->{clean}->{value} = 1                          if exists $OPT->{clean};\r
+    $tags[0]->{cvs}->{value}            = $OPT->{cvstag}        if exists $OPT->{cvstag};\r
+    $tags[0]->{svntag}->{value}         = $OPT->{svntag}        if exists $OPT->{svntag};\r
+    $tags[0]->{svnbranch}->{value}      = $OPT->{svnbranch}     if exists $OPT->{svnbranch};\r
+    $paths[0]->{src}->{path}            = $OPT->{srcdir}        if exists $OPT->{srcdir};\r
+    $paths[0]->{out}->{path}            = $OPT->{outdir}        if exists $OPT->{outdir};\r
+    $switches[0]->{debug}->{value}      = $OPT->{debug}         if exists $OPT->{debug};\r
+    $switches[0]->{clean}->{value}      = 1                     if exists $OPT->{clean};\r
     $switches[0]->{repository}->{value} = $OPT->{repository}    if exists $OPT->{repository};\r
-    $fetch[0]->{USERNAME}->{name} = $OPT->{username}            if exists $OPT->{username};\r
-    $switches[0]->{nomake}->{value} = 1                         if exists $OPT->{nomake};\r
-    $switches[0]->{nopackage}->{value} = 1                      if exists $OPT->{nopackage};\r
-    $switches[0]->{verbose}->{value} = $OPT->{verbose}          if exists $OPT->{verbose};\r
-    $switches[0]->{vverbose}->{value} = $OPT->{verbose}         if exists $OPT->{vverbose};\r
+    $fetch[0]->{USERNAME}->{name}       = $OPT->{username}      if exists $OPT->{username};\r
+    $switches[0]->{nomake}->{value}     = 1                     if exists $OPT->{nomake};\r
+    $switches[0]->{nopackage}->{value}  = 1                     if exists $OPT->{nopackage};\r
+    $switches[0]->{verbose}->{value}    = $OPT->{verbose}       if exists $OPT->{verbose};\r
+    $switches[0]->{vverbose}->{value}   = $OPT->{verbose}       if exists $OPT->{vverbose};\r
     if (exists $OPT->{logfile}) {\r
         $switches[0]->{logfile}->{path} = $OPT->{logfile};\r
         $switches[0]->{logfile}->{value} = 1;\r
@@ -213,60 +216,6 @@ sub main {
     #print "cvs tag: $tags[0]->{cvs}->{value}\n";\r
     #print "CVSROOT:   $fetch[0]->{CVSROOT}->{name}\n";\r
 \r
-    # We read in the version information to be able to update the site-local files in the install build areas:\r
-    local $version_path = $config->{Stages}->{Package}->{Config}->{Paths}->{Versions}->{path};\r
-    open(DAT, "$src/$version_path")     or die "Could not open $version_path.";\r
-    @raw = <DAT>;\r
-    close DAT;\r
-    foreach $line (@raw) {\r
-        chomp $line;\r
-        if ($line =~ /#define/) {                   # Process #define lines:\r
-            $line =~ s/#define//;                   # Remove #define token\r
-            $line =~ s/^\s+//;                      #  and leading & trailing whitespace\r
-            $line =~ s/\s+$//;\r
-            local @qr = split("\"", $line);         # Try splitting with quotes\r
-            if (exists $qr[1]) {\r
-                $qr[0] =~ s/^\s+//;                 #  Clean up whitespace\r
-                $qr[0] =~ s/\s+$//;\r
-                $config->{Versions}->{$qr[0]} = $qr[1]; # Save string\r
-                }\r
-            else {                                  # No quotes, so\r
-                local @ar = split(" ", $line);      #  split with space\r
-                $ar[0] =~ s/^\s+//;                 #  Clean up whitespace\r
-                $ar[0] =~ s/\s+$//;\r
-                $config->{Versions}->{$ar[0]} = $ar[1]; # and  save numeric value\r
-                }\r
-            }\r
-        }\r
-\r
-    # Check that the versions we will need for site-local have been defined:\r
-    my @required_versions = ('VER_PROD_MAJOR', 'VER_PROD_MINOR', 'VER_PROD_REV', \r
-                             'VER_PROD_MAJOR_STR', 'VER_PROD_MINOR_STR', 'VER_PROD_REV_STR', \r
-                             'VER_PRODUCTNAME_STR');\r
-    $requirements_met   = 1;\r
-    $first_missing      = 0;\r
-    $error_list         = "";\r
-    foreach my $required (@required_versions) {\r
-        if (! exists $config->{Versions}->{$required}) {\r
-            $requirements_met = 0;\r
-            if (!$first_missing) {\r
-                $first_missing = 1;\r
-                $error_list = "Fatal -- The following version(s) are not defined in $src/$version_path.\n";\r
-                }\r
-            $error_list .= "$required\n";\r
-            }\r
-        }\r
-    if (!$requirements_met) {\r
-        print $error_list;\r
-        exit(0);\r
-        }\r
-    # Apply any of these tags to filestem:\r
-    my $filestem    = $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name};\r
-    $filestem       =~ s/%VERSION_MAJOR%/$config->{Versions}->{'VER_PROD_MAJOR_STR'}/;\r
-    $filestem       =~ s/%VERSION_MINOR%/$config->{Versions}->{'VER_PROD_MINOR_STR'}/;\r
-    $filestem       =~ s/%VERSION_PATCH%/$config->{Versions}->{'VER_PROD_REV_STR'}/;\r
-    $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name}    = $filestem;\r
-        \r
     # Test the unix find command:\r
     if (! exists $config->{CommandLine}->{Directories}->{unixfind}->{path})    {\r
         $config->{CommandLine}->{Directories}->{unixfind}->{path}   = "C:\\tools\\cygwin\\bin";\r
@@ -275,7 +224,6 @@ sub main {
 \r
     local $savedPATH    = $ENV{PATH};\r
     $ENV{PATH}          = $unixfind.";".$savedPATH;\r
-print "PATH now $ENV{PATH}\n";\r
     print "Info -- chdir to ".`cd`."\n"         if ($verbose);\r
     if (-e "a.tmp") {!system("rm a.tmp")        or die "Fatal -- Couldn't clean temporary file a.tmp.";}\r
     !system("find . -name a.tmp > b.tmp 2>&1")  or die "Fatal -- find test failed.";\r
@@ -284,6 +232,12 @@ print "PATH now $ENV{PATH}\n";
     if ($filesize > 0) {\r
         die "Fatal -- $unixfind does not appear to be a path to a UNIX find command.";\r
         }\r
+        \r
+    # Don't allow /svntag and /svnbranch simultaneously:\r
+    if ( (length $tags[0]->{svntag}->{value} > 0)   && \r
+         (length $tags[0]->{svnbranch}->{value} > 0) ) {\r
+        die "Fatal -- Can't specify both /SVNTAG and /SVNBRANCH.";\r
+        }\r
 \r
 ##-- Assemble configuration from config file and command line.\r
 \r
@@ -342,22 +296,26 @@ print "PATH now $ENV{PATH}\n";
     if ($rverb =~ /skip/) {print "Info -- *** Skipping repository access.\n"    if ($verbose);}\r
     else {\r
         if ($verbose) {print "Info -- *** Begin fetching sources.\n";}\r
-        if (! -d $wd) {                        ## xcopy will create the entire path for us.\r
+        local $cvspath = "$src";\r
+        if (! -d $cvspath) {                        ## xcopy will create the entire path for us.\r
             !system("echo foo > a.tmp")                     or die "Fatal -- Couldn't create temporary file in ".`cd`;\r
-            !system("echo F | xcopy a.tmp $wd\\CVS\\a.tmp") or die "Fatal -- Couldn't xcopy to $wd\\CVS.";\r
+            !system("echo F | xcopy a.tmp $cvspath\\a.tmp") or die "Fatal -- Couldn't xcopy to $cvspath.";\r
             !system("rm a.tmp")                             or die "Fatal -- Couldn't remove temporary file.";\r
-            !system("rm $wd\\CVS\\a.tmp")                   or die "Fatal -- Couldn't remove temporary file.";\r
+            !system("rm $cvspath\\a.tmp")                   or die "Fatal -- Couldn't remove temporary file.";\r
             }\r
         \r
         # Set up cvs environment variables:\r
-        $ENV{CVSROOT}   = $fetch[0]->{CVSROOT}->{name};\r
-        chdir($src)                                         or die "Fatal -- couldn't chdir to $src\n";\r
-        print "Info -- chdir to ".`cd`."\n"                 if ($verbose);\r
-        my $krb5dir     = "$wd\\athena\\auth\\krb5";\r
+        $ENV{CVSROOT}       = $fetch[0]->{CVSROOT}->{name};\r
+        local $krb5dir      = "$wd\\athena\\auth\\krb5";\r
+\r
+        local $cvscmdroot   = "cvs $rverb";\r
+        if (length $tags[0]->{cvs}->{value} > 0) {\r
+            $cvscmdroot .= " -r $tags[0]->{cvs}->{value}";\r
+            }\r
 \r
-        my $cvscmdroot  = "cvs $rverb";\r
-        my $cvscmd      = $cvscmdroot;\r
         if ($rverb =~ /checkout/) {        \r
+            chdir($src)                                     or die "Fatal -- couldn't chdir to $src\n";\r
+            print "Info -- chdir to ".`cd`."\n"             if ($verbose);\r
             my @cvsmodules    = (    \r
                 'krb',  \r
                 'pismere/athena/util/lib/delaydlls', \r
@@ -366,34 +324,109 @@ print "PATH now $ENV{PATH}\n";
                 );\r
 \r
             foreach my $module (@cvsmodules) {\r
-                $cvscmd = $cvscmdroot." ".$module;\r
-                $cvscmd .= " ".$tags[0]->{cvs}->{value} if ($tags[0]->{cvs}->{value});\r
+                local $cvscmd = $cvscmdroot." ".$module;\r
                 if ($verbose) {print "Info -- cvs command: $cvscmd\n";}\r
-                !system($cvscmd)                        or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";\r
+                !system($cvscmd)    or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";\r
                 }\r
             }\r
         else {                ## Update.\r
-            $cvscmd = $cvscmdroot;\r
-            $cvscmd .= " ".$tags[0]->{cvs}->{value}     if ($tags[0]->{cvs}->{value});\r
-            if ($verbose) {print "Info -- cvs command: $cvscmd\n";}\r
-            !system($cvscmd)                            or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";\r
+            chdir($wd)                                      or die "Fatal -- couldn't chdir to $wd\n";\r
+            print "Info -- chdir to ".`cd`."\n"             if ($verbose);\r
+            if ($verbose) {print "Info -- cvs command: $cvscmdroot\n";}\r
+            !system($cvscmdroot)    or die "Fatal -- command \"$cvscmdroot\" failed; return code $?\n";\r
             }\r
-                    \r
+\r
         # Set up svn environment variable:\r
         $ENV{SVN_SSH} = "plink.exe";\r
         # If  the directory structure doesn't exist, many cd commands will fail.\r
-        if (! -d $krb5dir) {mkdir($krb5dir)             or die "Fatal -- Couldn't  create $krb5dir";}\r
+        if (! -d $krb5dir) {                                ## xcopy will create the entire path for us.\r
+            !system("echo foo > a.tmp")                     or die "Fatal -- Couldn't create temporary file in ".`cd`;\r
+            !system("echo F | xcopy a.tmp $krb5dir\\a.tmp") or die "Fatal -- Couldn't xcopy to $krb5dir.";\r
+            !system("rm a.tmp")                             or die "Fatal -- Couldn't remove temporary file.";\r
+            !system("rm $krb5dir\\a.tmp")                   or die "Fatal -- Couldn't remove temporary file.";\r
+            }\r
+\r
         chdir($krb5dir)                                 or die "Fatal -- Couldn't chdir to $krb5dir";\r
         print "Info -- chdir to ".`cd`."\n"             if ($verbose);\r
         my $svncmd = "svn $rverb ";\r
         if ($rverb =~ /checkout/) {        # Append the rest of the checkout command:\r
             chdir("..");\r
-            $svncmd .= "svn+ssh://".$fetch[0]->{USERNAME}->{name}."@".$fetch[0]->{SVNURL}->{name}."/krb5/trunk krb5";\r
+            $svncmd .= "svn+ssh://".$fetch[0]->{USERNAME}->{name}."@".$fetch[0]->{SVNURL}->{name}."/krb5/";\r
+            if (length $tags[0]->{svntag}->{value} > 0) {\r
+                $svncmd .= "tags/$tags[0]->{svntag}->{value}";\r
+                }\r
+            elsif (length $tags[0]->{svnbranch}->{value} > 0) {\r
+                $svncmd .= "branches/$tags[0]->{svnbranch}->{value}";\r
+                }\r
+            else {\r
+                $svncmd .= "trunk";\r
+                }\r
+\r
+            $svncmd .= " krb5";\r
+\r
             }\r
-        if ($tags[0]->{svn}->{value}) {$svncmd .= " ".$tags[0]->{svn}->{value};}    # Add any specific tag\r
         if ($verbose) {print "Info -- svn command: $svncmd\n";}\r
         !system($svncmd)            or die "Fatal -- command \"$svncmd\" failed; return code $?\n";\r
 \r
+        ##++ Read in the version information to be able to update the \r
+        #  site-local files in the install build areas.\r
+        # ** Do this now (after repository update and before first zip) \r
+        #    because making zip files requires some configuration data be set up.\r
+        local $version_path = $config->{Stages}->{Package}->{Config}->{Paths}->{Versions}->{path};\r
+        open(DAT, "$src/$version_path")     or die "Could not open $version_path.";\r
+        @raw = <DAT>;\r
+        close DAT;\r
+        foreach $line (@raw) {\r
+            chomp $line;\r
+            if ($line =~ /#define/) {                   # Process #define lines:\r
+                $line =~ s/#define//;                   # Remove #define token\r
+                $line =~ s/^\s+//;                      #  and leading & trailing whitespace\r
+                $line =~ s/\s+$//;\r
+                local @qr = split("\"", $line);         # Try splitting with quotes\r
+                if (exists $qr[1]) {\r
+                    $qr[0] =~ s/^\s+//;                 #  Clean up whitespace\r
+                    $qr[0] =~ s/\s+$//;\r
+                    $config->{Versions}->{$qr[0]} = $qr[1]; # Save string\r
+                    }\r
+                else {                                  # No quotes, so\r
+                    local @ar = split(" ", $line);      #  split with space\r
+                    $ar[0] =~ s/^\s+//;                 #  Clean up whitespace\r
+                    $ar[0] =~ s/\s+$//;\r
+                    $config->{Versions}->{$ar[0]} = $ar[1]; # and  save numeric value\r
+                    }\r
+                }\r
+            }\r
+    \r
+        # Check that the versions we will need for site-local have been defined:\r
+        my @required_versions = ('VER_PROD_MAJOR', 'VER_PROD_MINOR', 'VER_PROD_REV', \r
+                                 'VER_PROD_MAJOR_STR', 'VER_PROD_MINOR_STR', 'VER_PROD_REV_STR', \r
+                                 'VER_PRODUCTNAME_STR');\r
+        $requirements_met   = 1;\r
+        $first_missing      = 0;\r
+        $error_list         = "";\r
+        foreach my $required (@required_versions) {\r
+            if (! exists $config->{Versions}->{$required}) {\r
+                $requirements_met = 0;\r
+                if (!$first_missing) {\r
+                    $first_missing = 1;\r
+                    $error_list = "Fatal -- The following version(s) are not defined in $src/$version_path.\n";\r
+                    }\r
+                $error_list .= "$required\n";\r
+                }\r
+            }\r
+        if (!$requirements_met) {\r
+            print $error_list;\r
+            exit(0);\r
+            }\r
+    \r
+        # Apply any of these tags to filestem:\r
+        my $filestem    = $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name};\r
+        $filestem       =~ s/%VERSION_MAJOR%/$config->{Versions}->{'VER_PROD_MAJOR_STR'}/;\r
+        $filestem       =~ s/%VERSION_MINOR%/$config->{Versions}->{'VER_PROD_MINOR_STR'}/;\r
+        $filestem       =~ s/%VERSION_PATCH%/$config->{Versions}->{'VER_PROD_REV_STR'}/;\r
+        $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name}    = $filestem;\r
+        ##-- Read in the version information & set config info.\r
+\r
         if ($rverb =~ /checkout/) {        \r
             if (! $bOutputCleaned) {                    ## In case somebody cleaned $out before us.\r
                 if (-d $out)    {!system("rm -rf $out/*")   or die "Fatal -- Couldn't clean $out."}    ## Clean output directory.\r