cff0a237099d06f16896ec781a85cccb1a663849
braney
  Mon Dec 21 14:21:59 2020 -0800
make sure that trackDb cache on hubs keeps track of files that are
included in the trackDb.txt file

diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c
index 085790e..8965f7f 100644
--- src/hg/lib/trackDbCustom.c
+++ src/hg/lib/trackDbCustom.c
@@ -288,33 +288,34 @@
 char *file;
 
 if (startsWith("include", line))
     {
     splitPath(raFile, incFile, NULL, NULL);
     nextWord(&line);
     file = nextQuotedWord(&line);
     strcat(incFile, file);
     *releaseTag = nextWord(&line);
     return cloneString(incFile);
     }
 else
     return NULL;
 }
 
-struct trackDb *trackDbFromOpenRa(struct lineFile *lf, char *releaseTag)
+struct trackDb *trackDbFromOpenRa(struct lineFile *lf, char *releaseTag, struct dyString *incFiles)
 /* Load track info from ra file already opened as lineFile into list.  If releaseTag is
- * non-NULL then only load tracks that mesh with release. */
+ * non-NULL then only load tracks that mesh with release. If incFiles is not-NULL, put
+ * list of included files in there. */
 {
 char *raFile = lf->fileName;
 char *line, *word;
 struct trackDb *btList = NULL, *bt;
 boolean done = FALSE;
 char *incFile;
 
 for (;;)
     {
     /* Seek to next line that starts with 'track' */
     for (;;)
         {
         char *subRelease;
 
         if (!lineFileNextFull(lf, &line, NULL, NULL, NULL))
@@ -322,32 +323,34 @@
             done = TRUE;
 	   break;
 	   }
 	line = skipLeadingSpaces(line);
         if (startsWithWord("track", line))
             {
             lineFileReuseFull(lf); // NOTE: only works with previous lineFileNextFull call
             break;
             }
         else if ((incFile = trackDbInclude(raFile, line, &subRelease)) != NULL)
             {
             if (subRelease)
                 trackDbCheckValidRelease(subRelease);
             if (releaseTag && subRelease && !sameString(subRelease, releaseTag))
                 errAbort("Include with release %s inside include with release %s line %d of %s", subRelease, releaseTag, lf->lineIx, lf->fileName);
-            struct trackDb *incTdb = trackDbFromRa(incFile, subRelease);
+            struct trackDb *incTdb = trackDbFromRa(incFile, subRelease, incFiles);
             btList = slCat(btList, incTdb);
+            if (incFiles)
+                dyStringPrintf(incFiles, "%s\n", incFile);
             }
 	}
     if (done)
         break;
 
     /* Allocate track structure and fill it in until next blank line. */
     bt = trackDbNew();
     slAddHead(&btList, bt);
     for (;;)
         {
         /* Break at blank line or EOF. */
         if (!lineFileNextFull(lf, &line, NULL, NULL, NULL))  // NOTE: joins continuation lines
             break;
         line = skipLeadingSpaces(line);
         if (line == NULL || line[0] == 0)
@@ -385,36 +388,37 @@
 char *words[5];
 
 int count = chopString(cloneString(tag), ",", words, ArraySize(words));
 if (count > 3)
     return FALSE;
 
 int ii;
 for(ii=0; ii < count; ii++)
     if (!sameString(words[ii], "alpha") && !sameString(words[ii], "beta") &&
         !sameString(words[ii], "public"))
             return FALSE;
 
 return TRUE;
 }
 
-struct trackDb *trackDbFromRa(char *raFile, char *releaseTag)
+struct trackDb *trackDbFromRa(char *raFile, char *releaseTag, struct dyString *incFiles)
 /* Load track info from ra file into list.  If releaseTag is non-NULL
- * then only load tracks that mesh with release. */
+ * then only load tracks that mesh with release. if incFiles is non-null, 
+ * add included file names to it.*/
 {
 struct lineFile *lf = udcWrapShortLineFile(raFile, NULL, 16*1024*1024);
-struct trackDb *tdbList = trackDbFromOpenRa(lf, releaseTag);
+struct trackDb *tdbList = trackDbFromOpenRa(lf, releaseTag, incFiles);
 lineFileClose(&lf);
 return tdbList;
 }
 
 struct hash *trackDbHashSettings(struct trackDb *tdb)
 /* Force trackDb to hash up it's settings.  Usually this is just
  * done on demand. Returns settings hash. */
 {
 if (tdb->settingsHash == NULL)
     tdb->settingsHash = trackDbSettingsFromString(tdb, tdb->settings);
 return tdb->settingsHash;
 }
 
 struct hash *trackDbSettingsFromString(struct trackDb *tdb, char *string)
 /* Return hash of key/value pairs from string.  Differs