anyk: 3.26.0 -> 3.33.0

This commit is contained in:
Patrick Chilton 2024-05-06 17:58:29 +02:00
parent d95cd83e5b
commit d796bb97aa
3 changed files with 41 additions and 11 deletions

View File

@ -15,13 +15,11 @@
, python3
}:
let
# Downloads can be found here: https://nav.gov.hu/nyomtatvanyok/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/AbevJava
# There are no versioned download URLs but archive.org can be used to preserve them.
# The original download URL is: https://nav.gov.hu/pfile/programFile?path=/nyomtatvanyok/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/AbevJava
# You can put the URL here to create a fresh archive URL: https://web.archive.org/save
abevjavaSrc = fetchzip {
url = "https://web.archive.org/web/20231106112510if_/https://nav.gov.hu/pfile/programFile?path=/nyomtatvanyok/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/AbevJava";
sha256 = "sha256-qt0mHv3HI6C8OltFjSR47+RLSnmB2Si5U8rXEvdN4/c=";
# Run update.py to update this file.
inherit (lib.importJSON ./version.json) version url sha256;
src = fetchzip {
inherit url sha256;
extension = "zip";
stripRoot = false;
};
@ -49,7 +47,7 @@ let
(runCommandLocal "anyk-patch" {} ''
mkdir $out
cd $out
${unzip}/bin/unzip ${abevjavaSrc}/application/abevjava.jar hu/piller/enykp/niszws/ClientStubBuilder.class
${unzip}/bin/unzip ${src}/application/abevjava.jar hu/piller/enykp/niszws/ClientStubBuilder.class
${python3}/bin/python ${./patch_paths.py} hu/piller/enykp/niszws/ClientStubBuilder.class
'')
];
@ -89,9 +87,7 @@ let
'';
in stdenv.mkDerivation {
pname = "anyk";
version = "3.26.0";
src = abevjavaSrc;
inherit version src;
dontConfigure = true;
dontBuild = true;

29
pkgs/by-name/an/anyk/update.py Executable file
View File

@ -0,0 +1,29 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (p: [p.waybackpy])"
import subprocess
from pathlib import Path
import re
import json
import waybackpy
# NAV doesn't provide stable versioned URLs so we put the download link in Wayback Machine to preserve it.
print("Archiving...")
save_api = waybackpy.WaybackMachineSaveAPI("https://nav.gov.hu/pfile/programFile?path=/nyomtatvanyok/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/AbevJava")
url = save_api.save()
print("Prefetching...")
sha256, unpack_path = subprocess.check_output(["nix-prefetch-url", "--unpack", "--print-path", url], universal_newlines=True).split("\n")[:2]
print("Extracting version...")
manifest = (Path(unpack_path) / "META-INF" / "MANIFEST.MF").read_text()
version = re.search("Implementation-Version: (.+)", manifest).group(1)
print("Writing version.json...")
(Path(__file__).parent / "version.json").write_text(json.dumps({
"url": url,
"sha256": sha256,
"version": version,
}, indent=2) + "\n")

View File

@ -0,0 +1,5 @@
{
"url": "https://web.archive.org/web/20240506155046/https://nav.gov.hu/pfile/programFile?path=/nyomtatvanyok/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/AbevJava",
"sha256": "1bvhk8b5b1f5f940zzmpx7xp858p2a27iwqij43fs4kqagz2v782",
"version": "3.33.0"
}