Use SRI hashes on jlink

This commit is contained in:
Artemis Tosini 2021-11-18 22:11:03 +00:00
parent cbbe164e4a
commit 51cd0c4b2a
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
3 changed files with 4 additions and 4 deletions

View file

@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
version = conf.version; version = conf.version;
src = fetchurl { src = fetchurl {
inherit (conf) url sha256 curlOpts; inherit (conf) url hash curlOpts;
}; };
dontConfigure = true; dontConfigure = true;

View file

@ -30,12 +30,12 @@ for nix_arch, jlink_arch in arches:
url = URL_FORMAT.format(version=version.replace('.', ''), arch=jlink_arch) url = URL_FORMAT.format(version=version.replace('.', ''), arch=jlink_arch)
out = subprocess.run( out = subprocess.run(
['nix-prefetch', f'{{fetchurl}}: fetchurl {{ url = "{url}"; curlOpts = "{CURL_OPTS}"; }}'], stdout=subprocess.PIPE, check=True) ['nix-prefetch', f'{{fetchurl}}: fetchurl {{ url = "{url}"; curlOpts = "{CURL_OPTS}"; }}'], stdout=subprocess.PIPE, check=True)
sha256 = out.stdout.decode('utf8').strip() file_hash = out.stdout.decode('utf8').strip()
out_obj[nix_arch] = { out_obj[nix_arch] = {
'url': url, 'url': url,
'version': version, 'version': version,
'curlOpts': CURL_OPTS, 'curlOpts': CURL_OPTS,
'sha256': sha256 'hash': file_hash
} }
out_file = open(os.path.join(BASE_DIR, 'version.json'), 'w') out_file = open(os.path.join(BASE_DIR, 'version.json'), 'w')

View file

@ -1 +1 @@
{"x86_64-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_x86_64.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "sha256": "sha256-kr1zCzvGx4pmhPeWEoXlouOMnZY69V59/cF8hakv7ps="}, "i686-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_i686.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "sha256": "sha256-d8gVsn3hYU39m15Tu5VkqOnocPTXyuCKmvLZsRw6fNw="}, "armv7l-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_arm.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "sha256": "sha256-ze5EEjboQuT4UVxw/rU3w4Pgsk5yHoLARURQxonl26w="}, "aarch64-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_arm64.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "sha256": "sha256-NFzo2udZ2ZuHdwG4ZGftI139LZPIrdso5adiMG09uh0="}} {"x86_64-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_x86_64.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "hash": "sha256-kr1zCzvGx4pmhPeWEoXlouOMnZY69V59/cF8hakv7ps="}, "i686-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_i686.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "hash": "sha256-d8gVsn3hYU39m15Tu5VkqOnocPTXyuCKmvLZsRw6fNw="}, "armv7l-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_arm.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "hash": "sha256-ze5EEjboQuT4UVxw/rU3w4Pgsk5yHoLARURQxonl26w="}, "aarch64-linux": {"url": "https://www.segger.com/downloads/jlink/JLink_Linux_V758b_arm64.tgz", "version": "7.58b", "curlOpts": "-d accept_license_agreement=accepted -d submit=Download+software", "hash": "sha256-NFzo2udZ2ZuHdwG4ZGftI139LZPIrdso5adiMG09uh0="}}