f35500dabcf4527f5a1a482d4e0da03c44f01f63
hiram
  Thu May 15 14:03:05 2025 -0700
correctly rsync only in the case where the contrib/track directory does actually exist refs #35917

diff --git src/hg/utils/otto/genArk/alphaBetaPush.pl src/hg/utils/otto/genArk/alphaBetaPush.pl
index 527f97e4f38..9df192ad648 100755
--- src/hg/utils/otto/genArk/alphaBetaPush.pl
+++ src/hg/utils/otto/genArk/alphaBetaPush.pl
@@ -100,87 +100,91 @@
     }
 }
 close ($fh);
 printf $lf "# found %d beta hub.txt files\n", $betaCount;
 printf $lf "# found %d public hub.txt files\n", $publicCount;
 
 my $cmd = "";
 my $cmdOut = "";
 
 if ($betaCount > 0) {
   printf $lf "# found %d beta hub.txt files\n", $betaCount;
   foreach my $accession (keys %betaList) {
      my $pathDir = $betaList{$accession};
      printf $lf "# %s %s\n", $accession, $pathDir;
      foreach my $betaTrack (keys %betaContrib) {
+        if ( -d "$pathDir/contrib/$betaTrack" ) {
           $cmd = qq(ssh qateam\@hgwbeta mkdir -p "$pathDir/contrib/$betaTrack" 2>&1);
           printf $lf "%s\n", $cmd;
           $cmdOut = `$cmd`;
           if (length($cmdOut) > 1) {
              printf $lf "%s\n", $cmdOut;
           } else {
              printf $lf "# ssh mkdir $pathDir/contrib/$betaTrack successfull\n";
           }
           $cmd = qq(rsync --stats -a -L --itemize-changes "$pathDir/contrib/$betaTrack/" "qateam\@hgwbeta:$pathDir/contrib/$betaTrack/" 2>&1);
           printf $lf "%s\n", $cmd;
           $cmdOut = `$cmd`;
           if (length($cmdOut) > 1) {
              printf $lf "%s\n", $cmdOut;
           } else {
              printf $lf "# rsync output mysteriously empty ?\n";
           }
-     }
+        }	#	if ( -d "$pathDir/contrib/$betaTrack" )
+     }		#	foreach my $betaTrack (keys %betaContrib)
      $cmd = qq(rsync --stats -a -L --itemize-changes "$pathDir/beta.hub.txt" "qateam\@hgwbeta:$pathDir/hub.txt" 2>&1);
      printf $lf "%s\n", $cmd;
      $cmdOut = `$cmd`;
      if (length($cmdOut) > 1) {
         printf $lf "%s\n", $cmdOut;
      } else {
         printf $lf "# rsync output mysteriously empty ? '%s'\n", $cmdOut;
      }
      printf $lf "https://hgwbeta.soe.ucsc.edu/cgi-bin/hgTracks?genome=%s&hubUrl=%s/hub.txt\n", $accession, $pathDir;
-  }
-}
+  }	#	foreach my $accession (keys %betaList)
+}	#	if ($betaCount > 0)
 
 if ($publicCount > 0) {
   printf $lf "# found %d public hub.txt files\n", $publicCount;
   foreach my $accession (keys %publicList) {
      printf $lf "# %s %s\n", $accession, $publicList{$accession};
      foreach my $machName ( @machList ) {
        printf $lf "push %s public to %s\n", $accession, $machName;
        my $pathDir = $publicList{$accession};
        foreach my $publicTrack (keys %publicContrib) {
+          if ( -d "$pathDir/contrib/$publicTrack" ) {
             $cmd = qq(ssh qateam\@$machName mkdir -p "$pathDir/contrib/$publicTrack" 2>&1);
             printf $lf "%s\n", $cmd;
             $cmdOut = `$cmd`;
             if (length($cmdOut) > 1) {
                printf $lf "%s\n", $cmdOut;
             } else {
                printf $lf "# ssh mkdir $machName $pathDir/contrib/$publicTrack successfull\n";
             }
             $cmd = qq(rsync --stats -a -L --itemize-changes "$pathDir/contrib/$publicTrack/" "qateam\@$machName:$pathDir/contrib/$publicTrack/" 2>&1);
             printf $lf "%s\n", $cmd;
             $cmdOut = `$cmd`;
             if (length($cmdOut) > 1) {
                printf $lf "%s\n", $cmdOut;
             } else {
                printf $lf "# rsync output mysteriously empty ?\n";
             }
-       }
+          }	#	if ( -d "$pathDir/contrib/$publicTrack" )
+       }	#	foreach my $publicTrack (keys %publicContrib)
        $cmd = qq(rsync --stats -a -L --itemize-changes "$pathDir/public.hub.txt" "qateam\@$machName:$pathDir/hub.txt" 2>&1);
        printf $lf "%s\n", $cmd;
        $cmdOut = `$cmd`;
        if (length($cmdOut) > 1) {
           printf $lf "%s\n", $cmdOut;
        } else {
           printf $lf "# rsync output mysteriously empty ? '%s'\n", $cmdOut;
        }
        if ($machName =~ m/^hgw/) {
          printf $lf "https://$machName.soe.ucsc.edu/cgi-bin/hgTracks?genome=%s&hubUrl=%s/hub.txt\n", $accession, $pathDir;
        } else {
          printf $lf "https://genome-euro.ucsc.edu/cgi-bin/hgTracks?genome=%s&hubUrl=%s/hub.txt\n", $accession, $pathDir;
        }
      }	#	foreach my $machName ( @machList )
   }	#	foreach my $accession (keys %publicList)
-}
+}	#	if ($publicCount > 0)
 
 close ($lf);