GNU bug report logs -
#43817
[PATCH 0/1] guix: build: hg: Add 'guard' to handle error.
Previous Next
Reported by: zimoun <zimon.toutoune <at> gmail.com>
Date: Mon, 5 Oct 2020 16:36:02 UTC
Severity: normal
Tags: patch
Done: Mathieu Othacehe <othacehe <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43817 in the body.
You can then email your comments to 43817 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#43817
; Package
guix-patches
.
(Mon, 05 Oct 2020 16:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
zimoun <zimon.toutoune <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 05 Oct 2020 16:36:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Dear,
This patch allows to gently report failure with 'hg clone'.
For example, let consider the package using 'hg-fetch':
--8<---------------cut here---------------start------------->8---
(define-module (hello)
#:use-module (guix packages)
#:use-module (gnu packages base)
#:use-module (guix hg-download))
(define-public hi-hg
(package
(inherit hello)
(name "hi-hg")
(source (origin
(method hg-fetch)
(uri (hg-reference
(url "https://example.org/hg")
(changeset "314a11282586")))
(sha256
(base32
"1yb0rsrbjg2bwyhfk677crhw0k7ijm6slaq0qq7cd4lznlz2yvji"))))
(home-page "https://example.org/hg")))
--8<---------------cut here---------------end--------------->8---
Then, the current behaviour report an (opinionated: ugly!) backtrace:
--8<---------------cut here---------------start------------->8---
$ guix build -L /tmp/foo/ hi-hg
The following derivations will be built:
/gnu/store/awdr7qhl6hyjgr1m9a40zfnban9ip98x-hi-hg-2.10.drv
/gnu/store/bgdwj7ajkm9xwcyib83wpby1zb9l8si2-hg-checkout.drv
building /gnu/store/bgdwj7ajkm9xwcyib83wpby1zb9l8si2-hg-checkout.drv...
guile: warning: failed to install locale
warning: connection security to example.org is disabled per current settings; communication is susceptible to eavesdropping and tampering
abort: HTTP Error 404: Not Found
Backtrace:
3 (primitive-load "/gnu/store/rf02zx0dscns2bzzics9i93l1xm?")
In ice-9/eval.scm:
293:34 2 (_ #<directory (guile-user) 7ffff5bb8f00>)
In guix/build/hg.scm:
38:2 1 (hg-fetch "https://example.org/hg" "314a11282586" "/gn?" ?)
In guix/build/utils.scm:
654:6 0 (invoke _ . _)
guix/build/utils.scm:654:6: In procedure invoke:
ERROR:
1. &invoke-error:
program: "/gnu/store/0qx1yjfnjn77jag9rmv4z49vfrzk5bgc-mercurial-5.5.1/bin/hg"
arguments: ("clone" "https://example.org/hg" "--rev" "314a11282586" "--insecure" "/gnu/store/6x6hccx9cqpfrcav79inl43ys6frgvw2-hg-checkout")
exit-status: 255
term-signal: #f
stop-signal: #f
builder for `/gnu/store/bgdwj7ajkm9xwcyib83wpby1zb9l8si2-hg-checkout.drv' failed with exit code 1
build of /gnu/store/bgdwj7ajkm9xwcyib83wpby1zb9l8si2-hg-checkout.drv failed
View build log at '/var/log/guix/drvs/bg/dwj7ajkm9xwcyib83wpby1zb9l8si2-hg-checkout.drv.bz2'.
cannot build derivation `/gnu/store/awdr7qhl6hyjgr1m9a40zfnban9ip98x-hi-hg-2.10.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/awdr7qhl6hyjgr1m9a40zfnban9ip98x-hi-hg-2.10.drv' failed
--8<---------------cut here---------------end--------------->8---
Instead, the proposing patch handles the error and reports:
--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build -L /tmp/foo/ hi-hg
The following derivations will be built:
/gnu/store/zam0r6fvyp9qkzp6kf087iifvnhw140n-hi-hg-2.10.drv
/gnu/store/z4y6xhnaipx0p7sx4ink0bll9i7rww87-hg-checkout.drv
building /gnu/store/z4y6xhnaipx0p7sx4ink0bll9i7rww87-hg-checkout.drv...
guile: warning: failed to install locale
warning: connection security to example.org is disabled per current settings; communication is susceptible to eavesdropping and tampering
abort: HTTP Error 404: Not Found
hg-fetch: '/gnu/store/0qx1yjfnjn77jag9rmv4z49vfrzk5bgc-mercurial-5.5.1/bin/hg clone https://example.org/hg --rev 314a11282586 --insecure /gnu/store/6x6hccx9cqpfrcav79inl43ys6frgvw2-hg-checkout' failed with exit code 255
Trying content-addressed mirror at berlin.guix.gnu.org...
Trying content-addressed mirror at berlin.guix.gnu.org...
builder for `/gnu/store/z4y6xhnaipx0p7sx4ink0bll9i7rww87-hg-checkout.drv' failed to produce output path `/gnu/store/6x6hccx9cqpfrcav79inl43ys6frgvw2-hg-checkout'
build of /gnu/store/z4y6xhnaipx0p7sx4ink0bll9i7rww87-hg-checkout.drv failed
View build log at '/var/log/guix/drvs/z4/y6xhnaipx0p7sx4ink0bll9i7rww87-hg-checkout.drv.bz2'.
cannot build derivation `/gnu/store/zam0r6fvyp9qkzp6kf087iifvnhw140n-hi-hg-2.10.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/zam0r6fvyp9qkzp6kf087iifvnhw140n-hi-hg-2.10.drv' failed
--8<---------------cut here---------------end--------------->8---
(Note: the code is highly copied from guix/build/git.scm. :-))
All the best,
simon
zimoun (1):
guix: build: hg: Add 'guard' to handle error.
guix/build/hg.scm | 50 +++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 17 deletions(-)
base-commit: 2b73e50c31a61b5dcef35a1e4b9484d9dbcb0fbc
--
2.28.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#43817
; Package
guix-patches
.
(Mon, 05 Oct 2020 16:37:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 43817 <at> debbugs.gnu.org (full text, mbox):
* guix/build/hg.scm (hg-fetch): Add 'guard' to handle error.
---
guix/build/hg.scm | 50 +++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/guix/build/hg.scm b/guix/build/hg.scm
index b3e3ff7ac3..9245181d8b 100644
--- a/guix/build/hg.scm
+++ b/guix/build/hg.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016 Ricardo Wurmus <rekado <at> elephly.net>
;;; Copyright © 2018 Mark H Weaver <mhw <at> netris.org>
;;; Copyright © 2018 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune <at> gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,8 @@
(define-module (guix build hg)
#:use-module (guix build utils)
+ #:use-module (srfi srfi-34)
+ #:use-module (ice-9 format)
#:export (hg-fetch))
;;; Commentary:
@@ -35,22 +38,35 @@
"Fetch CHANGESET from URL into DIRECTORY. CHANGESET must be a valid
Mercurial changeset identifier. Return #t on success, #f otherwise."
- (invoke hg-command
- "clone" url
- "--rev" changeset
- ;; Disable TLS certificate verification. The hash of
- ;; the checkout is known in advance anyway.
- "--insecure"
- directory)
-
- ;; The contents of '.hg' vary as a function of the current
- ;; status of the Mercurial repo. Since we want a fixed
- ;; output, this directory needs to be taken out.
- ;; Since the '.hg' file is also in sub-modules, we have to
- ;; search for it in all sub-directories.
- (for-each delete-file-recursively
- (find-files directory "^\\.hg$" #:directories? #t))
-
- #t)
+ (mkdir-p directory)
+
+ (guard (c ((invoke-error? c)
+ (format (current-error-port)
+ "hg-fetch: '~a~{ ~a~}' failed with exit code ~a~%"
+ (invoke-error-program c)
+ (invoke-error-arguments c)
+ (or (invoke-error-exit-status c) ;XXX: not quite accurate
+ (invoke-error-stop-signal c)
+ (invoke-error-term-signal c)))
+ (delete-file-recursively directory)
+ #f))
+ (with-directory-excursion directory
+ (invoke hg-command
+ "clone" url
+ "--rev" changeset
+ ;; Disable TLS certificate verification. The hash of
+ ;; the checkout is known in advance anyway.
+ "--insecure"
+ directory)
+
+ ;; The contents of '.hg' vary as a function of the current
+ ;; status of the Mercurial repo. Since we want a fixed
+ ;; output, this directory needs to be taken out.
+ ;; Since the '.hg' file is also in sub-modules, we have to
+ ;; search for it in all sub-directories.
+ (for-each delete-file-recursively
+ (find-files directory "^\\.hg$" #:directories? #t))
+
+ #t)))
;;; hg.scm ends here
--
2.28.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#43817
; Package
guix-patches
.
(Mon, 05 Oct 2020 16:48:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 43817 <at> debbugs.gnu.org (full text, mbox):
* guix/build/svn.scm (svn-fetch): Add 'guard' to handle error.
---
guix/build/svn.scm | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 33783f3056..0afe887487 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha <at> totakura.in>
;;; Copyright © 2018 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune <at> gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,8 @@
(define-module (guix build svn)
#:use-module (guix build utils)
+ #:use-module (srfi srfi-34)
+ #:use-module (ice-9 format)
#:export (svn-fetch))
;;; Commentary:
@@ -36,7 +39,20 @@
(password #f))
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
valid Subversion revision. Return #t on success, #f otherwise."
- (apply invoke svn-command
+ (mkdir-p directory)
+
+ (guard (c ((invoke-error? c)
+ (format (current-error-port)
+ "svn-fetch: '~a~{ ~a~}' failed with exit code ~a~%"
+ (invoke-error-program c)
+ (invoke-error-arguments c)
+ (or (invoke-error-exit-status c) ;XXX: not quite accurate
+ (invoke-error-stop-signal c)
+ (invoke-error-term-signal c)))
+ (delete-file-recursively directory)
+ #f))
+ (with-directory-excursion directory
+ (apply invoke svn-command
"export" "--non-interactive"
;; Trust the server certificate. This is OK as we
;; verify the checksum later. This can be removed when
@@ -50,6 +66,6 @@ valid Subversion revision. Return #t on success, #f otherwise."
'()
(list "--ignore-externals"))
,url ,directory))
- #t)
+ #t)))
;;; svn.scm ends here
--
2.28.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#43817
; Package
guix-patches
.
(Mon, 05 Oct 2020 16:50:01 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
On Mon, 5 Oct 2020 at 18:35, zimoun <zimon.toutoune <at> gmail.com> wrote:
> This patch allows to gently report failure with 'hg clone'.
>
> For example, let consider the package using 'hg-fetch':
The patch dealing with 'svn-fetch' is also in this thread.
All the best,
simon
Reply sent
to
Mathieu Othacehe <othacehe <at> gnu.org>
:
You have taken responsibility.
(Tue, 06 Oct 2020 08:27:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
zimoun <zimon.toutoune <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 06 Oct 2020 08:27:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 43817-done <at> debbugs.gnu.org (full text, mbox):
Hello zimoun,
> This patch allows to gently report failure with 'hg clone'.
I applied both patches with minor edits.
Thanks,
Mathieu
Information forwarded
to
guix-patches <at> gnu.org
:
bug#43817
; Package
guix-patches
.
(Wed, 07 Oct 2020 17:30:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 43817-done <at> debbugs.gnu.org (full text, mbox):
Hi Mathieu,
On Tue, 6 Oct 2020 at 10:26, Mathieu Othacehe <othacehe <at> gnu.org> wrote:
> > This patch allows to gently report failure with 'hg clone'.
>
> I applied both patches with minor edits.
Thank you. Paul spotted out an issue that I missed about the patch
tweaking 'svn-fetch'. Now, it is fixed; see patch in [1]. Well, I am
not a Git's guru but "git am --scissors" should do the job.
[1] https://lists.gnu.org/archive/html/guix-commits/2020-10/msg00470.html
Sorry for the annoyance.
Thanks,
simon
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 05 Nov 2020 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.