Mic92 / nix-update

Swiss-knife for updating nix packages.
MIT License
450 stars 44 forks source link

"v" prefix disappears from download url #189

Closed teto closed 1 year ago

teto commented 1 year ago

following up on https://github.com/ripose-jp/Memento/releases/tag/v1.2.1 I tried to run nix-update but the v disappears from the tag which makes the download fail:

nix-update memento
$ nix eval --json --impure --expr 
let

  pkgs = import /home/teto/nixpkgs;
  args =  builtins.functionArgs pkgs;
  inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //
           (if args ? overlays then { overlays = [ ]; } else {});
  pkg = (pkgs inputs)."memento";
  sanitizePosition = x: x;

  raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);

  position = if pkg ? isRubyGem then
    raw_version_position
  else if pkg ? isPhpExtension then
    raw_version_position
   else
    sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
  name = pkg.name;
  old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
  inherit raw_version_position;
  filename = position.file;
  line = position.line;
  urls = pkg.src.urls or null;
  url = pkg.src.url or null;
  rev = pkg.src.rev or null;
  hash = pkg.src.outputHash or null;
  go_modules = pkg.goModules.outputHash or null;
  go_modules_old = pkg.go-modules.outputHash or null;
  cargo_deps = pkg.cargoDeps.outputHash or null;
  raw_cargo_lock =
    if pkg ? cargoDeps.lockFile then
      let
        inherit (pkg.cargoDeps) lockFile;
        res = builtins.tryEval (sanitizePosition {
          file = toString lockFile;
        });
      in
      if res.success then res.value.file else false
    else
      null;
  npm_deps = pkg.npmDeps.outputHash or null;
  tests = builtins.attrNames (pkg.passthru.tests or {});
  has_update_script = pkg.passthru.updateScript or null != null;
  src_homepage = pkg.src.meta.homepage or null;
  changelog = pkg.meta.changelog or null;
} --extra-experimental-features flakes nix-command
fetch https://github.com/ripose-jp/Memento/releases.atom
Update v1.1.0 -> 1.2.1 in /home/teto/nixpkgs/pkgs/applications/video/memento/default.nix
$ nix-build --expr let src = (import /home/teto/nixpkgs (if (builtins.hasAttr "config" (builtins.functionArgs (import /home/teto/nixpkgs))) then { config.checkMeta = false; overlays = []; } else { }))."memento".src; in (src.overrideAttrs or (f: src // f src)) (_: { outputHash = ""; outputHashAlgo = "sha256"; }) --extra-experimental-features flakes nix-command
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
  /nix/store/jd537018hgi75y6s5k1p67qcqcdpb1ap-source.drv
building '/nix/store/jd537018hgi75y6s5k1p67qcqcdpb1ap-source.drv'...

trying https://github.com/ripose-jp/Memento/archive/1.2.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0    14    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0
curl: (22) The requested URL returned error: 404
error: cannot download source from any mirror
note: keeping build directory '/tmp/nix-build-source.drv-2'
error: boost::bad_format_string: format-string is ill-formed

using nix-update from unstable, aka 0.19.3

figsoda commented 1 year ago

seems like an issue with memento's packaging, version should not contain v

--- a/pkgs/applications/video/memento/default.nix
+++ b/pkgs/applications/video/memento/default.nix
@@ -22,12 +22,12 @@ let
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "memento";
-  version = "v1.1.0";
+  version = "1.1.0";

   src = fetchFromGitHub {
     owner = "ripose-jp";
     repo = "Memento";
-    rev = finalAttrs.version;
+    rev = "v${finalAttrs.version}";
     hash = "sha256-29AzQ+Z2PNs65Tvmt2Z5Ra2G3Yhm4LVBpAqvnSsnE0Y=";
   };
teto commented 1 year ago

ok that fixed it ty.