Stream: implementers
Topic: FHIR Cache packages.ini
Gino Canessa (Feb 11 2022 at 19:17):
Hi all, is the packages.ini
file used in .fhir/packages
documented anywhere? I want to make sure I am using it correctly when downloading packages. Thanks! (tagging @Grahame Grieve for best-guess-at-who-knows-what-this-is =)
Grahame Grieve (Feb 11 2022 at 19:21):
not documented anywhere. I think I'm the only one that uses it. And it's purely decorative - it caches the package size (sum of all the files in bytes) and the date it was downloaded (or first seen, if something else installs it).
The only use of both these fields is if someone brings up my package cache browser, and then they have columns for package size and download date
Gino Canessa (Feb 11 2022 at 19:26):
Hmm.. I assume it is preferable to use it for things like code-gen (instead of the separate cache it maintains today). But, that means I need to be able to download and add to it.
I am trying to reconcile the tagging/structure I used for published/ci/local with what is present. Overall, it is straightforward, but I was grabbing the version.info
from CI builds to figure out if I need to re-download the build or not. I assume I should switch over to package.json:date
for the logic?
Grahame Grieve (Feb 11 2022 at 19:34):
well, here's my logic:
Grahame Grieve (Feb 11 2022 at 19:34):
private NpmPackage checkCurrency(String id, NpmPackage p) throws IOException {
checkBuildLoaded();
// special case: current versions roll over, and we have to check their currency
try {
String url = ciList.get(id);
JsonObject json = JsonTrackingParser.fetchJson(Utilities.pathURL(url, "package.manifest.json"));
String currDate = JSONUtil.str(json, "date");
String packDate = p.date();
if (!currDate.equals(packDate))
return null; // nup, we need a new copy
return p;
} catch (Exception e) {
return p;
}
}
Grahame Grieve (Feb 11 2022 at 19:36):
in english: I use the date stated in the json at {url}/package.manifest.json where {url} is the source of the package, and I compare that to the date in the package manifest. And if all that fails somehow, then I don't check currency at all
Gino Canessa (Feb 11 2022 at 19:41):
Sweet, thanks! I assume I am correct in:
#{number}
means published,#current
means CI-Build, and#dev
means local machine build?
Grahame Grieve (Feb 11 2022 at 19:44):
yes. that is documented somewhere. dev falls back to current if there's no local build
Gino Canessa (Feb 11 2022 at 19:48):
Good stuff. I'll update mine to match, thanks.
Last updated: Apr 12 2022 at 19:14 UTC