Merge pull request #299539 from otavio/renode-upd-script

renode: use standard nix-update-script
This commit is contained in:
Nick Cao 2024-03-28 10:15:32 -04:00 committed by GitHub
commit 6bb2039d63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 29 deletions

View File

@ -1,11 +1,9 @@
{ renode
, fetchurl
, buildUnstable ? true
, writeScript
}:
(renode.override {
inherit buildUnstable;
}).overrideAttrs (finalAttrs: _: {
renode.overrideAttrs (finalAttrs: _: {
pname = "renode-unstable";
version = "1.15.0+20240323git3bd8e280d";
@ -13,4 +11,25 @@
url = "https://builds.renode.io/renode-${finalAttrs.version}.linux-portable.tar.gz";
hash = "sha256-hIPBM9PE6vtqo8XJvOWS3mIa9Vr7v9bcMdXmeQzBYsk=";
};
passthru.updateScript =
let
versionRegex = "[0-9\.\+]+[^\+]*.";
in
writeScript "${finalAttrs.pname}-updater" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl gnugrep gnused pup
latestVersion=$(
curl -sS https://builds.renode.io \
| pup 'a text{}' \
| egrep 'renode-${versionRegex}\.linux-portable\.tar\.gz' \
| head -n1 \
| sed -e 's,renode-\(.*\)\.linux-portable\.tar\.gz,\1,g'
)
update-source-version ${finalAttrs.pname} "$latestVersion" \
--file=pkgs/by-name/re/${finalAttrs.pname}/package.nix \
--system=x86_64-linux
'';
})

View File

@ -3,13 +3,12 @@
, fetchurl
, autoPatchelfHook
, makeWrapper
, writeScript
, nix-update-script
, glibcLocales
, python3Packages
, gtk-sharp-2_0
, gtk2-x11
, screen
, buildUnstable ? false
}:
let
@ -69,29 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru.updateScript =
let
versionRegex =
if buildUnstable
then "[0-9\.\+]+[^\+]*."
else "[0-9\.]+[^\+]*.";
in
writeScript "${finalAttrs.pname}-updater" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl gnugrep gnused pup
latestVersion=$(
curl -sS https://builds.renode.io \
| pup 'a text{}' \
| egrep 'renode-${versionRegex}\.linux-portable\.tar\.gz' \
| head -n1 \
| sed -e 's,renode-\(.*\)\.linux-portable\.tar\.gz,\1,g'
)
update-source-version ${finalAttrs.pname} "$latestVersion" \
--file=pkgs/by-name/re/${finalAttrs.pname}/package.nix \
--system=x86_64-linux
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Virtual development framework for complex embedded systems";