Hi, Maxim Cournoyer <maxim.courno...@gmail.com> skribis:
> Ludovic Courtès <l...@gnu.org> writes: [...] >>> - ;; Re-add SOURCE to the store, but this time under the real name >>> used >>> - ;; in the 'origin'. This allows us to build the package without >>> - ;; having to make a real checkout; thus, it also works when >>> working >>> - ;; on a private branch. >>> - (reload-module >>> - (resolve-module '(gnu packages package-management))) >>> - >>> - (let* ((source (add-to-store store >>> - (origin-file-name (package-source >>> guix)) >>> - #t "sha256" source)) >>> - (root (store-path-package-name source))) >>> - >>> - ;; Add an indirect GC root for SOURCE in the current directory. >>> - (false-if-exception (delete-file root)) >>> - (symlink source root) >>> - (add-indirect-root store >>> - (string-append (getcwd) "/" root)) >>> - >>> - (format #t "source code for commit ~a: ~a (GC root: ~a)~%" >>> - commit source root))))) >> >> I realize it was maybe enough to wrap this whole portion (starting from >> “Re-add SOURCE”) in (unless (getenv >> "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT") …)? Running ‘guix build guix’ >> would have forced the source derivation to be built. >> >> Anyhow, thanks for working on it! > > Sorry, I'm a bit lost. Are you suggesting that we should restore the > code following the ;; Re-add SOURCE [...], but wrapped with unless to > make it conditional to GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT being > defined? That part depends on SOURCE, a store file name, which we don't > have anymore since we no longer add the sources to the store to compute > the hash. I’m saying that the solution to the initial problem (that if you don’t run ‘guix build guix -S --check’ you’re not sure ‘guix’ is referring to a valid upstream commit) could have been to simply not do the trick above. The trick at “Re-add SOURCE” is here precisely to prevent attempts to re-download, as the comment explains, and this is what has been causing these troubles. The advantages (to me) would have been simpler code, no shelling out to ‘git’, and no fiddling with files under $PWD. BTW, in ‘make release’ does ‘make update-guix-package’ and expects it to work with a not-pushed-yet commit. So it’s a case where we need GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT=yes. Thanks, Ludo’.