bd0a18827dcd91e4fae812f795e2a39968535627 braney Thu Jan 21 16:52:04 2021 -0800 when building beta or public, check on hgwbeta and hgw0 for files referenced by bigDataUrl rather than assuming that they exist if they exist on dev diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 65f20fa..075ab64 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -3920,60 +3920,77 @@ if (loadOneTrackDb(db, where, one->name, &tdbList, loaded)) foundOne = TRUE; } if (!foundOne) errAbort("can not find any trackDb tables for %s, check db.trackDb specification in hg.conf", db); slNameFreeList(&tableList); hashFree(&loaded); /* fill in supertrack fields, if any in settings */ trackDbSuperMarkup(tdbList); trackDbAddTableField(tdbList); return tdbList; } -boolean trackDataAccessible(char *database, struct trackDb *tdb) +boolean trackDataAccessibleRemote(char *database, struct trackDb *tdb, char *remoteLogin) /* Return TRUE if underlying data are accessible - meaning the track has either * a bigDataUrl with remote URL (http:// etc), a bigDataUrl with an existing local file, * or a database table with the same name. - * Note: this returns FALSE for composite tracks; use this on subtracks or simple tracks. */ + * Note: this returns FALSE for composite tracks; use this on subtracks or simple tracks. + * + * if remoteLogin is not NULL, use it when looking for the file */ { if (startsWith("mathWig", tdb->type)) return TRUE; // assume mathWig data is available. Fail at load time if it isn't char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl"); if (bigDataUrl != NULL) { bigDataUrl = replaceChars(bigDataUrl, "$D", database); char *bigDataUrlLocal = hReplaceGbdb(bigDataUrl); if (hasProtocol(bigDataUrlLocal)) return TRUE; else + { + if (remoteLogin == NULL) return fileExists(bigDataUrlLocal); + else + return remoteFileExists(remoteLogin, bigDataUrlLocal); + } } else { // we now allow references to native tracks in track hubs tdb->table = trackHubSkipHubName(tdb->table); // if it's copied from a custom track, wait to find data later if (isCustomTrack(tdb->table)) return TRUE; return (hTableForTrack(database, tdb->table) != NULL); } } +boolean trackDataAccessible(char *database, struct trackDb *tdb) +/* Return TRUE if underlying data are accessible - meaning the track has either + * a bigDataUrl with remote URL (http:// etc), a bigDataUrl with an existing local file, + * or a database table with the same name. + * Note: this returns FALSE for composite tracks; use this on subtracks or simple tracks. */ +{ +return trackDataAccessibleRemote(database, tdb, NULL); +} + + static void addTrackIfDataAccessible(char *database, struct trackDb *tdb, boolean privateHost, struct trackDb **tdbRetList) /* check if a trackDb entry should be included in display, and if so * add it to the list, otherwise free it */ { if ((!tdb->private || privateHost) && trackDataAccessible(database, tdb)) slAddHead(tdbRetList, tdb); else if (tdbIsDownloadsOnly(tdb)) { // While it would be good to make table NULL, since we should support tracks // without tables (composties, etc) and even data tracks without tables (bigWigs). // However, some CGIs still need careful bullet-proofing. I have done so with // hgTrackUi, hgTracks, hgTable and hgGenome //if (tdb->table != NULL && sameString(tdb->table,tdb->track)) // tdb->table = NULL;