[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally b
From: |
Ludovic Courtès |
Subject: |
bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull. |
Date: |
Tue, 20 Oct 2020 23:06:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hi Maxim,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> (define (main . args)
> (match args
> ((commit version)
> - (with-store store
> - (let* ((source (add-to-store store
> - "guix-checkout" ;dummy name
> - #t "sha256" %top-srcdir
> - #:select? version-controlled?))
> - (hash (query-path-hash store source))
> + (with-directory-excursion %top-srcdir
> + (or (getenv "GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT")
> + (commit-already-pushed? (find-origin-remote) commit)
> + (leave (G_ "Commit ~a is not pushed upstream. Aborting.~%")
> commit))
> + (let* ((hash (with-temporary-git-worktree commit
> + (nix-base32-string->bytevector
> + (string-trim-both
> + (with-output-to-string
> + (lambda ()
> + (guix-hash "-rx" ".")))))))
> (location (package-definition-location))
> (old-hash (content-hash-value
> - (origin-hash (package-source guix)))))
> + (origin-hash (package-source guix)))))
> (edit-expression location
> (update-definition commit hash
> #:old-hash old-hash
> - #:version version))
> -
> - ;; 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!
Ludo’, who’s always wary of shelling out.
bug#43893: [PATCH v2] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/11
- bug#43893: [PATCH v2] maint: update-guix-package: Prevent accidentally breaking guix pull., Marius Bakke, 2020/10/13
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/13
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull.,
Ludovic Courtès <=
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/20
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/21
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/23
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/23
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/25
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/25
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/25
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Maxim Cournoyer, 2020/10/30
- bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/31
bug#43893: [PATCH v3] maint: update-guix-package: Prevent accidentally breaking guix pull., Ludovic Courtès, 2020/10/25