How do I find out the particular Daml SDK and LF version of a specific DAR
- sormeterOP
How do I determine the SDK version used to build a particular DAR?
Is it possible to determine the LF version as well?I see the SDK version is include in the MANIFEST.mf of the dar if i explode it out – is this the best way of retrieving?
❯ jar -xvf mydar-1.1.1.dar
inflated: META-INF/MANIFEST.MF❯ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: damlc
Name: my-dar-1.1.1
Sdk-Version: 2.6.7 - WallaceKelly 1
See Daml SDK version for a given DAR? - #2 by WallaceKelly for the SDK part of the question.
…Although, the MANIFEST.MF approach looks good too.
And regarding the Daml LF, see Daml-LF version for a given DAR?.
- sormeter
ah nice i wasn’t aware of daml damlc inspect
- Michael_Schaeffer
Are you aware if there is documentation of the contents of
MANIFEST.MF, or if it’s considered an implementation detail and should therefore be viewed as an opaque blob by a ‘well behaved’ application?I’m specifically interested I programatic ways to extract out package ID from a DAR. (And would rather not have to shell out to
daml damlc inspect-dar) - Michael_Schaeffer
For reference, here’s Python code that invokes
daml damlc inspect-darto determine a main package ID:import json import subprocess def get_dar_main_package_id(dar_path): completed = subprocess.run( ["daml", "damlc", "inspect-dar", "--json", str(dar_path)], capture_output=True, text=True, ) if completed.returncode != 0: raise Exception( f"Error inspecting DAR at {dar_path} for package ID, rc={completed.returncode} error output:\n{completed.stderr}" ) dar_inspect_text = completed.stdout try: dar_inspect_results = json.loads(dar_inspect_text) main_package_id = dar_inspect_results["main_package_id"] except: LOG.exception( "Error parsing DAR metadata for main package ID, Text:\n%r", dar_inspect_text, ) raise Exception("Error parsing DAR metadata for main package ID") return main_package_idDerived from here: daml-dit-ddit/daml_dit_ddit/subcommand_build.py at 784c396129aa804f05677072c604abcc1341e22d · digital-asset/daml-dit-ddit · GitHub
- WallaceKelly
Michael_Schaeffer:Are you aware if there is documentation of the contents of
MANIFEST.MFI don’t see anything in the Reference: Daml Packages. However…
It appears to be identical to the Java JAR file manifests.
Here is an example. That
Sdk-Version:key looks very tempting!Manifest-Version: 1.0 Created-By: damlc Name: test-0.0.1 Sdk-Version: 2.9.5 Main-Dalf: test-0.0.1-1feddc71f441f4c0478296a8d81... Dalfs: test-0.0.1-1feddc71f441f4c0478296a8d8144e... Format: daml-lf Encryption: non-encrypted - sormeter 1
Are you aware if there is documentation of the contents of
MANIFEST.MFAgree, I believe technically it is derived from / inspired by the JAR manifest spec, but I believe it should be treated as an internal implementation detail, with the caveat that its contents and form could change across versions.
Probably better to rely on the daml damlc inspect or daml damlc inspect-dar commands rather than parsing the manifest directly.