lemmy-server, lemmy-ui: adapt update script to new nix-prefetch-github
This commit is contained in:
parent
412b28f7b2
commit
4fb8ca7420
4 changed files with 17 additions and 21 deletions
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"serverVersion": "0.18.2",
|
||||
"uiVersion": "0.18.2",
|
||||
"serverSha256": "sha256-T08CjsRREgGJb1vXJrYihYaCin8NNHtsG+2PUHoI4Ho=",
|
||||
"serverCargoSha256": "sha256-nTZcLOpsbdeGzpz3PzgXZEGZHMbvSDA5rB2A3S9tMF8=",
|
||||
"uiSha256": "sha256-qFFnmdCONjfPyfp8v0VonPQP8G5b2DVpxEUAQT731Z0=",
|
||||
"uiYarnDepsSha256": "sha256-fRJpA9WstNNNOePoqotJKYmlikkcjc34iM0WO8+a/3Q="
|
||||
"serverHash": "sha256-T08CjsRREgGJb1vXJrYihYaCin8NNHtsG+2PUHoI4Ho=",
|
||||
"serverCargoHash": "sha256-nTZcLOpsbdeGzpz3PzgXZEGZHMbvSDA5rB2A3S9tMF8=",
|
||||
"uiHash": "sha256-qFFnmdCONjfPyfp8v0VonPQP8G5b2DVpxEUAQT731Z0=",
|
||||
"uiYarnDepsHash": "sha256-fRJpA9WstNNNOePoqotJKYmlikkcjc34iM0WO8+a/3Q="
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec {
|
|||
owner = "LemmyNet";
|
||||
repo = "lemmy";
|
||||
rev = version;
|
||||
sha256 = pinData.serverSha256;
|
||||
hash = pinData.serverHash;
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ rustPlatform.buildRustPackage rec {
|
|||
echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
|
||||
'';
|
||||
|
||||
cargoSha256 = pinData.serverCargoSha256;
|
||||
cargoHash = pinData.serverCargoHash;
|
||||
|
||||
buildInputs = [ postgresql ]
|
||||
++ lib.optionals stdenv.isDarwin [ libiconv Security ];
|
||||
|
|
|
@ -40,7 +40,7 @@ let
|
|||
repo = name;
|
||||
rev = version;
|
||||
fetchSubmodules = true;
|
||||
sha256 = pinData.uiSha256;
|
||||
hash = pinData.uiHash;
|
||||
};
|
||||
in
|
||||
mkYarnPackage {
|
||||
|
@ -52,7 +52,7 @@ mkYarnPackage {
|
|||
packageJSON = ./package.json;
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = src + "/yarn.lock";
|
||||
sha256 = pinData.uiYarnDepsSha256;
|
||||
hash = pinData.uiYarnDepsHash;
|
||||
};
|
||||
|
||||
yarnPreBuild = ''
|
||||
|
|
|
@ -29,10 +29,10 @@ SERVER_REPO = "lemmy"
|
|||
class Pin:
|
||||
serverVersion: str
|
||||
uiVersion: str
|
||||
serverSha256: str = ""
|
||||
serverCargoSha256: str = ""
|
||||
uiSha256: str = ""
|
||||
uiYarnDepsSha256: str = ""
|
||||
serverHash: str = ""
|
||||
serverCargoHash: str = ""
|
||||
uiHash: str = ""
|
||||
uiYarnDepsHash: str = ""
|
||||
|
||||
filename: Optional[str] = None
|
||||
|
||||
|
@ -83,11 +83,7 @@ def prefetch_github(owner: str, repo: str, rev: str) -> str:
|
|||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
sha256 = json.loads(proc.stdout)["sha256"]
|
||||
if not sha256.startswith("sha256-"): # Work around bug in nix-prefetch-github
|
||||
return "sha256-" + sha256
|
||||
|
||||
return sha256
|
||||
return json.loads(proc.stdout)["hash"]
|
||||
|
||||
|
||||
def get_latest_tag(owner: str, repo: str, prerelease: bool = False) -> str:
|
||||
|
@ -144,9 +140,9 @@ def get_fod_hash(attr: str) -> str:
|
|||
|
||||
|
||||
def make_server_pin(pin: Pin, attr: str) -> None:
|
||||
pin.serverSha256 = prefetch_github(OWNER, SERVER_REPO, pin.serverVersion)
|
||||
pin.serverHash = prefetch_github(OWNER, SERVER_REPO, pin.serverVersion)
|
||||
pin.write()
|
||||
pin.serverCargoSha256 = get_fod_hash(attr)
|
||||
pin.serverCargoHash = get_fod_hash(attr)
|
||||
pin.write()
|
||||
|
||||
|
||||
|
@ -159,9 +155,9 @@ def make_ui_pin(pin: Pin, package_json: str, attr: str) -> None:
|
|||
with open(os.path.join(SCRIPT_DIR, package_json), "wb") as fd:
|
||||
fd.write(resp.read())
|
||||
|
||||
pin.uiSha256 = prefetch_github(OWNER, UI_REPO, pin.uiVersion)
|
||||
pin.uiHash = prefetch_github(OWNER, UI_REPO, pin.uiVersion)
|
||||
pin.write()
|
||||
pin.uiYarnDepsSha256 = get_fod_hash(attr)
|
||||
pin.uiYarnDepsHash = get_fod_hash(attr)
|
||||
pin.write()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue