nim-lang / choosenim

Official tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
36 stars 8 forks source link

Missing `.git` extension of osinfo dependency URL breaks nimble `--depsOnly` / ` --offline` #29

Closed SpotlightKid closed 2 months ago

SpotlightKid commented 2 months ago

This change here:

https://github.com/nim-lang/choosenim/commit/dcd0cd6ccc6b1f70248da2c5dad331cbe9964178

breaks the use of nimble install --depsOnly followed by nimble build --offline to separate the downloading of dependencies from the actual build step.

Nimble then doesn't recognize it is dealing with a Git commit hash and thinks it already has installed the latest osinfo version 0.3.2 (from a dependency of another module) and then tries to download it again during the build step, which fails because of the --offline switch.

Adding .git to the URL path (i.e. https://github.com/nim-lang/osinfo.git#437486dff62eb9d91ab1e55c780f84dd0d225e2b) fixes it.

Here's a log from a failed attempt trying to build the choosenim AUR package for version 0.8.6, which uses this approach:

$ LC_ALL=C makepkg -fi
==> Making package: choosenim 0.8.6-1 (Wed Sep 18 16:27:12 2024)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found choosenim-0.8.6.tar.gz
==> Validating source files with sha256sums...
    choosenim-0.8.6.tar.gz ... Passed
==> Extracting sources...
  -> Extracting choosenim-0.8.6.tar.gz with bsdtar
==> Starting prepare()...
  Verifying dependencies for choosenim@0.8.6
     Info:  Dependency on https://github.com/nim-lang/sat@any version already satisfied
  Verifying dependencies for sat@0.1.0
     Info:  Dependency on nimble@#ed0b6ee already satisfied
  Verifying dependencies for nimble@0.14.2
     Info:  Dependency on sat@any version already satisfied
  Verifying dependencies for sat@0.1.0
     Info:  Dependency on checksums@any version already satisfied
  Verifying dependencies for checksums@0.2.1
     Info:  Dependency on analytics@>= 0.3.0 already satisfied
  Verifying dependencies for analytics@0.3.0
     Info:  Dependency on uuids@>= 0.1.7 already satisfied
  Verifying dependencies for uuids@0.1.12
     Info:  Dependency on isaac@>= 0.1.3 already satisfied
  Verifying dependencies for isaac@0.1.3
     Info:  Dependency on osinfo@>= 0.3.0 already satisfied
  Verifying dependencies for osinfo@0.3.2
     Info:  Dependency on puppy@>= 1.2.1 already satisfied
  Verifying dependencies for puppy@2.1.2
     Info:  Dependency on libcurl@>= 1.0.0 already satisfied
  Verifying dependencies for libcurl@1.0.0
     Info:  Dependency on zippy@>= 0.10.0 already satisfied
  Verifying dependencies for zippy@0.10.16
     Info:  Dependency on webby@>= 0.2.0 already satisfied
  Verifying dependencies for webby@0.2.1
 Installing https://github.com/nim-lang/osinfo@#437486dff62eb9d91ab1e55c780f84dd0d225e2b
Downloading https://github.com/nim-lang/osinfo using git
  Verifying dependencies for osinfo@0.3.2
 Installing osinfo@0.3.2
  Warning:  A package "osinfo@0.3.2" with checksum "dfddaced2aae46e61e22635b7a7b7beee846017b" already exists in the cache.
  Warning:  No nimblemeta.json file found in /home/chris/work/aur/choosenim/src/nimble/pkgs2/osinfo-0.3.2-dfddaced2aae46e61e22635b7a7b7beee846017b/src
     Info:  Dependency on zippy@>= 0.7.2 already satisfied
  Verifying dependencies for zippy@0.10.16
==> Removing existing $pkgdir/ directory...
==> Starting build()...
  Verifying dependencies for choosenim@0.8.6
     Info:  Dependency on https://github.com/nim-lang/sat@any version already satisfied
  Verifying dependencies for sat@0.1.0
     Info:  Dependency on nimble@#ed0b6ee already satisfied
  Verifying dependencies for nimble@0.14.2
     Info:  Dependency on sat@any version already satisfied
  Verifying dependencies for sat@0.1.0
     Info:  Dependency on checksums@any version already satisfied
  Verifying dependencies for checksums@0.2.1
     Info:  Dependency on analytics@>= 0.3.0 already satisfied
  Verifying dependencies for analytics@0.3.0
     Info:  Dependency on uuids@>= 0.1.7 already satisfied
  Verifying dependencies for uuids@0.1.12
     Info:  Dependency on isaac@>= 0.1.3 already satisfied
  Verifying dependencies for isaac@0.1.3
     Info:  Dependency on osinfo@>= 0.3.0 already satisfied
  Verifying dependencies for osinfo@0.3.2
     Info:  Dependency on puppy@>= 1.2.1 already satisfied
  Verifying dependencies for puppy@2.1.2
     Info:  Dependency on libcurl@>= 1.0.0 already satisfied
  Verifying dependencies for libcurl@1.0.0
     Info:  Dependency on zippy@>= 0.10.0 already satisfied
  Verifying dependencies for zippy@0.10.16
     Info:  Dependency on webby@>= 0.2.0 already satisfied
  Verifying dependencies for webby@0.2.1
 Installing https://github.com/nim-lang/osinfo@#437486dff62eb9d91ab1e55c780f84dd0d225e2b
       Tip: 27 messages have been suppressed, use --verbose to show them.
download.nim(463)        downloadPkg

    Error:  Cannot download in offline mode.
==> ERROR: A failure occurred in build().
    Aborting...

I am adding a workaround to the PKGBUILD, which fixes choosenim.nimble before the build for now.

The proper solution, IMHO, would be to make a 0.3.3 or 0.4.0 release of osinfo and require that in choosenim. A tool like choosenim shouldn't really depend on unreleased package versions.