Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Change update-flake to use heartwood release tags
Michael Raitza committed 2 years ago
commit 26f44b43ca586b3546166c45084917ad22bed9c4
parent c8e91ac218ddb13ec6876ef51c5dc87708f4b914
3 files changed +23 -34
modified flake.lock
@@ -64,17 +64,16 @@
        "rust-overlay": "rust-overlay"
      },
      "locked": {
-
        "lastModified": 1713957958,
-
        "narHash": "sha256-cqR6xVAYghtdWZE6JkqDQf/4hQ7GSnOK67Gj8pyYO8E=",
-
        "ref": "master",
-
        "rev": "c607619683e859fd715a23377c03fb08dc8090f4",
-
        "revCount": 1872,
+
        "lastModified": 1714387799,
+
        "narHash": "sha256-tjuNtf1+QvW0JBlLPV/rxD4jrSeG8amyUacNZyoTShU=",
+
        "ref": "refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0-rc.6",
+
        "rev": "0c610887ce36151726d56955018f1fb7a9f0a5d2",
+
        "revCount": 1883,
        "type": "git",
        "url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git"
      },
      "original": {
-
        "ref": "master",
-
        "rev": "c607619683e859fd715a23377c03fb08dc8090f4",
+
        "ref": "refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0-rc.6",
        "type": "git",
        "url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git"
      }
@@ -120,11 +119,11 @@
        ]
      },
      "locked": {
-
        "lastModified": 1708308739,
-
        "narHash": "sha256-FtKWP6d51kz8282jfziNNcCBpAvEzv2TtKH6dYIXCuA=",
+
        "lastModified": 1711419061,
+
        "narHash": "sha256-+5M/czgYGqs/jKmi8bvYC+JUYboUKNTfkRiesXopeXQ=",
        "owner": "oxalica",
        "repo": "rust-overlay",
-
        "rev": "d45281ce1027a401255db01ea44972afbc569b7e",
+
        "rev": "4c11d2f698ff1149f76b69e72852d5d75f492d0c",
        "type": "github"
      },
      "original": {
modified flake.nix
@@ -4,7 +4,7 @@
    nixpkgs.follows = "heartwood/nixpkgs";
    flake-utils.follows = "heartwood/flake-utils";
    heartwood = {
-
      url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git?ref=master&rev=c607619683e859fd715a23377c03fb08dc8090f4";
+
      url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git?ref=refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0-rc.6";
    };
  };

@@ -89,13 +89,6 @@
          ];
          checkPhase = ''
            runHook preCheck
-
            heartwoodRev="${heartwood.rev or "unknown"}"
-
            expRev=$(cat tests/support/heartwood-release)
-
            if [ "''${heartwoodRev#$expRev}" = "$heartwoodRev" ]; then
-
              printf "Error: Expecting heartwood binaries revision '%s', got '%s'" "$expRev" "$heartwoodRev" >&2
-
              exit 1
-
            fi
-
            echo unknown > tests/support/heartwood-release
            scripts/install-binaries -l ${checkBins}/bin
            scripts/check
            {
modified scripts/update-flake
@@ -5,14 +5,13 @@ set -e
usage() {
  printf \
    'Update flake and heartwood-release to the requested heartwood version.
-
When called without arguments, reads HASH from tests/support/hearwood-version.
+
When called without arguments, reads RELEASE from tests/support/hearwood-release.

USAGE:
-
  update-flake [-h] [PATH|HASH]
+
  update-flake [-h] [PATH|TAG]

OPTIONS:
-
  PATH\t\tPath to heartwood git repo; uses current HEAD.
-
  HASH\t\tUpdate heartwood version to HASH.
+
  RELEASE\t\tUpdate heartwood version to TAG.
  -h --help\tPrint this help.\n'
}

@@ -22,12 +21,8 @@ while [ $# -ne 0 ]; do
    usage >&2
    exit
    ;;
-
  */*)
-
    hash=$(git -C "$1" rev-parse --verify HEAD)
-
    shift
-
    ;;
  *)
-
    hash=$1
+
    release=$1
    shift
    ;;
  esac
@@ -45,21 +40,23 @@ if [ ! -e "$root/tests/support/heartwood-release" ]; then
  )
fi

-
if [ -z "$hash" ]; then
-
  # No hash given, take from heartwood-release
+
if [ -z "$release" ]; then
+
  # No release given, take from heartwood-release
  if [ -e "$root/tests/support/heartwood-release" ]; then
-
    hash=$(cat "$root/tests/support/heartwood-release")
-
    [ -n "$hash" ] || {
+
    release=$(cat "$root/tests/support/heartwood-release")
+
    [ -n "$release" ] || {
      printf "Error reading heartwood-release\n" >&2
      exit 1
    }
  fi
else
-
  printf '%s\n' "$hash" >$root/tests/support/heartwood-release
+
  printf '%s\n' "$release" >$root/tests/support/heartwood-release
fi

if [ -e "$root/flake.nix" ]; then
-
  sed -E -e '/url.*git\+https.*'"$rid"'/s/(rev=)[0-9a-f]{40,40}/\1'"$hash"'/' "$root/flake.nix" >$root/flake.nix.tmp
+
  query="ref=refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v$release";
+

+
  sed -E -e '/url.*git\+https.*'"$rid"'/s|\?.*";|?'"$query"'";|' "$root/flake.nix" >$root/flake.nix.tmp
  mv "$root/flake.nix.tmp" "$root/flake.nix"

  # If running on a nix-enabled system, also update npmDepsHash.
@@ -70,7 +67,7 @@ if [ -e "$root/flake.nix" ]; then
    sed -E -e '/npmDepsHash/s#".*"#"'"$npmDepsHash"'"#' "$root/flake.nix" >$root/flake.nix.tmp
    mv "$root/flake.nix.tmp" "$root/flake.nix"

-
    nix --experimental-features 'nix-command flakes' flake update "$root"
+
    nix --experimental-features 'nix-command flakes' flake update --flake git+file://"$root"
  else
    printf >&2 'Node dependencies may be out of date!
Re-run on a nix-enabled system to update npmDepsHash.\n'