GNU bug report logs - #50618
[PATCH] import: stackage: Don’t try to update packages not available on Stackage.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Thu, 16 Sep 2021 11:33:01 UTC

Severity: normal

Tags: patch

Done: Lars-Dominik Braun <lars <at> 6xq.net>

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 50618 in the body.
You can then email your comments to 50618 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to lars <at> 6xq.net, guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Thu, 16 Sep 2021 11:33:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to lars <at> 6xq.net, guix-patches <at> gnu.org. (Thu, 16 Sep 2021 11:33:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] import: stackage: Don’t try to update packages not available on Stackage.
Date: Thu, 16 Sep 2021 13:31:51 +0200
Previously, the ‘hackage-package?’ predicate was used which meant that
the updater would try to update non-Stackage packages, and lead to messages
like these:

  $ guix refresh -t stackage
  warning: failed to parse https://hackage.haskell.org/package/hurl/hurl.cabal
  warning: failed to parse https://hackage.haskell.org/package/idris/idris.cabal

Since ‘hurl’ and ‘idris’ aren’t available on the current Stackage LTS release,
they should be filtered out before the Stackage updater even tries to update
them.

* stackage.scm (stackage-package?): New procedure.
(%stackage-updater): Use it.
---
 guix/import/stackage.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index bbd903a2cd..5b19e2a03a 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017 Federico Beffa <beffa <at> fbengineering.ch>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
+;;; Copyright © 2021 Xinglu Chem <public <at> yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +26,7 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
+  #:use-module (guix http-client)
   #:use-module (guix import json)
   #:use-module (guix import hackage)
   #:use-module (guix import utils)
@@ -141,11 +143,22 @@ PACKAGE or #f if the package is not included in the Stackage LTS release."
                 (version version)
                 (urls (list url))))))))))
 
+(define (stackage-package? package)
+  "Whether PACKAGE is available on the default Stackage LTS release."
+  (and (hackage-package? package)
+       (guard (c ((and (http-get-error? c)
+                       (= 404 (http-get-error-code c)))
+                  #f))
+         (let* ((name (guix-package->hackage-name package))
+                (url (string-append (%stackage-url) "/lts-"
+                                    %default-lts-version "/package/" name)))
+           (http-fetch url)))))
+
 (define %stackage-updater
   (upstream-updater
    (name 'stackage)
    (description "Updater for Stackage LTS packages")
-   (pred hackage-package?)
+   (pred stackage-package?)
    (latest latest-lts-release)))
 
 ;;; stackage.scm ends here

base-commit: a840caccaee8c9492f4cc8a7ba802ef54391f199
-- 
2.33.0







Information forwarded to guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Wed, 22 Sep 2021 06:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 50618 <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 50618 <at> debbugs.gnu.org
Subject: Re: [bug#50618] [PATCH] import: stackage: Don’t try to update packages
 not available on Stackage.
Date: Wed, 22 Sep 2021 08:07:32 +0200
Hi,

> +(define (stackage-package? package)
> +  "Whether PACKAGE is available on the default Stackage LTS release."
> +  (and (hackage-package? package)
> +       (guard (c ((and (http-get-error? c)
> +                       (= 404 (http-get-error-code c)))
> +                  #f))
> +         (let* ((name (guix-package->hackage-name package))
> +                (url (string-append (%stackage-url) "/lts-"
> +                                    %default-lts-version "/package/" name)))
> +           (http-fetch url)))))
> +
since stackage-lts-info-fetch is memoized, wouldn’t it be cheaper
to look up the package there? (At least for lots of packages.)

Cheers,
Lars





Information forwarded to guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Wed, 22 Sep 2021 12:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 50618 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Lars-Dominik Braun <lars <at> 6xq.net>
Cc: 50618 <at> debbugs.gnu.org
Subject: Re: [bug#50618] [PATCH] import: stackage: Don’t
 try to update packages not available on Stackage.
Date: Wed, 22 Sep 2021 14:37:39 +0200
[Message part 1 (text/plain, inline)]
On Wed, Sep 22 2021, Lars-Dominik Braun wrote:

> Hi,
>
>> +(define (stackage-package? package)
>> +  "Whether PACKAGE is available on the default Stackage LTS release."
>> +  (and (hackage-package? package)
>> +       (guard (c ((and (http-get-error? c)
>> +                       (= 404 (http-get-error-code c)))
>> +                  #f))
>> +         (let* ((name (guix-package->hackage-name package))
>> +                (url (string-append (%stackage-url) "/lts-"
>> +                                    %default-lts-version "/package/" name)))
>> +           (http-fetch url)))))
>> +
> since stackage-lts-info-fetch is memoized, wouldn’t it be cheaper
> to look up the package there? (At least for lots of packages.)

Ah, good idea!  I will test if what the difference is terms of time.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Wed, 22 Sep 2021 15:33:01 GMT) Full text and rfc822 format available.

Message #14 received at 50618 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: 50618 <at> debbugs.gnu.org
Cc: Lars-Dominik Braun <lars <at> 6xq.net>
Subject: [PATCH v2] import: stackage: Don’t try to update packages not available on Stackage.
Date: Wed, 22 Sep 2021 17:31:49 +0200
Previously, the ‘hackage-package?’ predicate was used which meant that
the updater would try to update non-Stackage packages, and lead to messages
like these:

  $ guix refresh -t stackage
  warning: failed to parse https://hackage.haskell.org/package/hurl/hurl.cabal
  warning: failed to parse https://hackage.haskell.org/package/idris/idris.cabal

Since ‘hurl’ and ‘idris’ aren’t available on the current Stackage LTS release,
they should be filtered out before the Stackage updater even tries to update
them.

* stackage.scm (stackage-package?): New procedure.
(%stackage-updater): Use it.
---
Changes since v1:

* Use ‘stackage-lts-info-fetch’ to improve performance.

 guix/import/stackage.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index bbd903a2cd..9b757f1986 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017 Federico Beffa <beffa <at> fbengineering.ch>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
+;;; Copyright © 2021 Xinglu Chem <public <at> yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,10 +22,13 @@
 (define-module (guix import stackage)
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
+  #:use-module (srfi srfi-43)
   #:use-module (guix import json)
   #:use-module (guix import hackage)
   #:use-module (guix import utils)
@@ -141,11 +145,23 @@ (define latest-lts-release
                 (version version)
                 (urls (list url))))))))))
 
+(define (stackage-package? package)
+  "Whether PACKAGE is available on the default Stackage LTS release."
+  (and (hackage-package? package)
+       (let ((packages (lts-info-packages
+                        (stackage-lts-info-fetch %default-lts-version)))
+             (hackage-name (guix-package->hackage-name package)))
+         (vector-any identity
+                     (vector-map
+                      (lambda (_ metadata)
+                        (string=? (cdr (list-ref metadata 2)) hackage-name))
+                      packages)))))
+
 (define %stackage-updater
   (upstream-updater
    (name 'stackage)
    (description "Updater for Stackage LTS packages")
-   (pred hackage-package?)
+   (pred stackage-package?)
    (latest latest-lts-release)))
 
 ;;; stackage.scm ends here

base-commit: 33bc3fb2a5f30a6e21f1b8d6d43867d921bd951c
-- 
2.33.0







Information forwarded to guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Mon, 27 Sep 2021 09:19:01 GMT) Full text and rfc822 format available.

Message #17 received at 50618 <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 50618 <at> debbugs.gnu.org
Subject: Re: [PATCH v2] import: stackage: Don’t
 try to update packages not available on Stackage.
Date: Mon, 27 Sep 2021 11:18:25 +0200
Hi,

for some reason I cannot get this patch to apply. `git am` fails and also
`patch -Np1` spits out an error:

patching file guix/import/stackage.scm
patch: **** malformed patch at line 47: @@ -141,11 +145,23 @@

Can you push it somewhere?

Thanks,
Lars





Information forwarded to guix-patches <at> gnu.org:
bug#50618; Package guix-patches. (Mon, 27 Sep 2021 09:57:02 GMT) Full text and rfc822 format available.

Message #20 received at 50618 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Lars-Dominik Braun <lars <at> 6xq.net>
Cc: 50618 <at> debbugs.gnu.org
Subject: Re: [PATCH v2] import: stackage: Don’t try to
 update packages not available on Stackage.
Date: Mon, 27 Sep 2021 11:56:02 +0200
[Message part 1 (text/plain, inline)]
On Mon, Sep 27 2021, Lars-Dominik Braun wrote:

> Hi,
>
> for some reason I cannot get this patch to apply. `git am` fails and also
> `patch -Np1` spits out an error:
>
> patching file guix/import/stackage.scm
> patch: **** malformed patch at line 47: @@ -141,11 +145,23 @@

Hmm, it seems to fail for me as well, but with a different error.  I
have attached the patch below.

> Can you push it somewhere?

Sure, but I think its easier for you to just apply the attached patch.

  <https://git.yoctocell.xyz/guix/log/?h=stackage-import-predicate>

[0001-import-stackage-Don-t-try-to-update-packages-not-ava.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Reply sent to Lars-Dominik Braun <lars <at> 6xq.net>:
You have taken responsibility. (Mon, 27 Sep 2021 12:00:01 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Mon, 27 Sep 2021 12:00:02 GMT) Full text and rfc822 format available.

Message #25 received at 50618-done <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 50618-done <at> debbugs.gnu.org
Subject: Re: [PATCH v2] import: stackage: Don’t
 try to update packages not available on Stackage.
Date: Mon, 27 Sep 2021 13:59:02 +0200
Hi,

> Sure, but I think its easier for you to just apply the attached patch.
> 
>   <https://git.yoctocell.xyz/guix/log/?h=stackage-import-predicate>
> 
applied as 9c5e5ca1c0de56a0d5b2b924de10548172095b58.

Thank you very much!
Lars





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 26 Oct 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.