9fd216eead545fa281a34a20561eb8df1c8c44f6 braney Fri May 28 09:52:53 2021 -0700 make adding the cartVersion pseudo-track an optional thing diff --git src/hg/makeDb/hgTrackDb/hgTrackDb.c src/hg/makeDb/hgTrackDb/hgTrackDb.c index 2f0380b..38b0de6 100644 --- src/hg/makeDb/hgTrackDb/hgTrackDb.c +++ src/hg/makeDb/hgTrackDb/hgTrackDb.c @@ -42,48 +42,51 @@ " - the source tree file: src/hg/lib/trackDb.sql\n" " - the table name in the CREATE statement is replaced by the\n" " - table name specified on this command line.\n" " hgRoot - a directory name to prepend to org to locate the hierarchy:\n" " hgRoot/trackDb.ra - top level trackDb.ra file processed first\n" " hgRoot/org/trackDb.ra - second level file processed second\n" " hgRoot/org/database/trackDb.ra - third level file processed last\n" " - for no directory hierarchy use .\n" " -strict - only include tables that exist (and complain about missing html files).\n" " -raName=trackDb.ra - Specify a file name to use other than trackDb.ra\n" " for the ra files.\n" " -release=alpha|beta|public - Include trackDb entries with this release tag only.\n" " -settings - for trackDb scanning, output table name, type line,\n" " - and settings hash to stderr while loading everything.\n" " -gbdbList - list of files to confirm existance of bigDataUrl files\n" + " -addVersion - add cartVersion pseudo-table\n" ); } static struct optionSpec optionSpecs[] = { {"raName", OPTION_STRING}, {"strict", OPTION_BOOLEAN}, {"release", OPTION_STRING}, {"settings", OPTION_BOOLEAN}, {"gbdbList", OPTION_STRING}, + {"addVersion", OPTION_BOOLEAN}, {NULL, 0} }; static char *raName = "trackDb.ra"; static char *release = "alpha"; static char *gbdbList = NULL; static struct hash *gbdbHash = NULL; +static boolean addVersion = FALSE; // release tags #define RELEASE_ALPHA (1 << 0) #define RELEASE_BETA (1 << 1) #define RELEASE_PUBLIC (1 << 2) unsigned releaseBit = RELEASE_ALPHA; static bool showSettings = FALSE; static boolean hasNonAsciiChars(char *text) /* Check if text has any non-printing or non-ascii characters */ { char *c; for (c = text; *c != '\0'; c++) @@ -817,30 +820,31 @@ cartVerTdb->settings = cloneString("cartVersion"); return cartVerTdb; } void hgTrackDb(char *org, char *database, char *trackDbName, char *sqlFile, char *hgRoot, boolean strict) /* hgTrackDb - Create trackDb table from text files. */ { struct trackDb *td; char *tab = rTempName(getTempDir(), trackDbName, ".tab"); struct trackDb *tdbList = buildTrackDb(org, database, hgRoot, strict); tdbList = flatten(tdbList); slSort(&tdbList, trackDbCmp); +if (addVersion) slAddTail(&tdbList, makeCartVersionTrack()); verbose(1, "Loaded %d track descriptions total\n", slCount(tdbList)); /* Write to tab-separated file; hold off on html, since it must be encoded */ { verbose(2, "Starting write of tabs to %s\n", tab); FILE *f = mustOpen(tab, "w"); for (td = tdbList; td != NULL; td = td->next) { hVarSubstTrackDb(td, database); char *hold = td->html; td->html = ""; subChar(td->type, '\t', ' '); /* Tabs confuse things. */ subChar(td->shortLabel, '\t', ' '); /* Tabs confuse things. */ subChar(td->longLabel, '\t', ' '); /* Tabs confuse things. */ @@ -944,22 +948,23 @@ } int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, optionSpecs); if (argc != 6) usage(); raName = optionVal("raName", raName); showSettings = optionExists("settings"); if (strchr(raName, '/') != NULL) errAbort("-raName value should be a file name without directories"); release = optionVal("release", release); releaseBit = getReleaseBit(release); gbdbList = optionVal("gbdbList", gbdbList); +addVersion = optionExists("addVersion"); if (gbdbList) gbdbHash = hashLines(gbdbList); hgTrackDb(argv[1], argv[2], argv[3], argv[4], argv[5], optionExists("strict")); return 0; }