* [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage.
@ 2021-09-16 11:31 Xinglu Chen
2021-09-22 6:07 ` Lars-Dominik Braun
2021-09-22 15:31 ` [bug#50618] [PATCH v2] " Xinglu Chen
0 siblings, 2 replies; 7+ messages in thread
From: Xinglu Chen @ 2021-09-16 11:31 UTC (permalink / raw)
To: 50618; +Cc: Lars-Dominik Braun
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@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Xinglu Chem <public@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-16 11:31 [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage Xinglu Chen
@ 2021-09-22 6:07 ` Lars-Dominik Braun
2021-09-22 12:37 ` Xinglu Chen
2021-09-22 15:31 ` [bug#50618] [PATCH v2] " Xinglu Chen
1 sibling, 1 reply; 7+ messages in thread
From: Lars-Dominik Braun @ 2021-09-22 6:07 UTC (permalink / raw)
To: Xinglu Chen; +Cc: 50618
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-22 6:07 ` Lars-Dominik Braun
@ 2021-09-22 12:37 ` Xinglu Chen
0 siblings, 0 replies; 7+ messages in thread
From: Xinglu Chen @ 2021-09-22 12:37 UTC (permalink / raw)
To: Lars-Dominik Braun; +Cc: 50618
[-- Attachment #1: Type: text/plain, Size: 816 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#50618] [PATCH v2] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-16 11:31 [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage Xinglu Chen
2021-09-22 6:07 ` Lars-Dominik Braun
@ 2021-09-22 15:31 ` Xinglu Chen
2021-09-27 9:18 ` Lars-Dominik Braun
1 sibling, 1 reply; 7+ messages in thread
From: Xinglu Chen @ 2021-09-22 15:31 UTC (permalink / raw)
To: 50618; +Cc: Lars-Dominik Braun
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@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Xinglu Chem <public@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#50618] [PATCH v2] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-22 15:31 ` [bug#50618] [PATCH v2] " Xinglu Chen
@ 2021-09-27 9:18 ` Lars-Dominik Braun
2021-09-27 9:56 ` Xinglu Chen
0 siblings, 1 reply; 7+ messages in thread
From: Lars-Dominik Braun @ 2021-09-27 9:18 UTC (permalink / raw)
To: Xinglu Chen; +Cc: 50618
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#50618] [PATCH v2] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-27 9:18 ` Lars-Dominik Braun
@ 2021-09-27 9:56 ` Xinglu Chen
2021-09-27 11:59 ` bug#50618: " Lars-Dominik Braun
0 siblings, 1 reply; 7+ messages in thread
From: Xinglu Chen @ 2021-09-27 9:56 UTC (permalink / raw)
To: Lars-Dominik Braun; +Cc: 50618
[-- Attachment #1.1: Type: text/plain, Size: 547 bytes --]
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>
[-- Attachment #1.2: 0001-import-stackage-Don-t-try-to-update-packages-not-ava.patch --]
[-- Type: text/x-patch, Size: 3139 bytes --]
From 49f705217487aacfd6ab0b794b07eea9262d7661 Mon Sep 17 00:00:00 2001
Message-Id: <49f705217487aacfd6ab0b794b07eea9262d7661.1632736427.git.public@yoctocell.xyz>
From: Xinglu Chen <public@yoctocell.xyz>
Date: Thu, 16 Sep 2021 13:29:42 +0200
Subject: [PATCH] =?UTF-8?q?import:=20stackage:=20Don=E2=80=99t=20try=20to?=
=?UTF-8?q?=20update=20packages=20not=20available=20on=20Stackage.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index bbd903a2cd..731e69651e 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2017 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2021 Xinglu Chem <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,10 +22,12 @@
(define-module (guix import stackage)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
+ #:use-module (ice-9 control)
#: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 +144,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: 8c6c33a2a5bf385e1589b405ee7f842684ed80c1
--
2.33.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#50618: [PATCH v2] import: stackage: Don’t try to update packages not available on Stackage.
2021-09-27 9:56 ` Xinglu Chen
@ 2021-09-27 11:59 ` Lars-Dominik Braun
0 siblings, 0 replies; 7+ messages in thread
From: Lars-Dominik Braun @ 2021-09-27 11:59 UTC (permalink / raw)
To: Xinglu Chen; +Cc: 50618-done
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-27 12:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-16 11:31 [bug#50618] [PATCH] import: stackage: Don’t try to update packages not available on Stackage Xinglu Chen
2021-09-22 6:07 ` Lars-Dominik Braun
2021-09-22 12:37 ` Xinglu Chen
2021-09-22 15:31 ` [bug#50618] [PATCH v2] " Xinglu Chen
2021-09-27 9:18 ` Lars-Dominik Braun
2021-09-27 9:56 ` Xinglu Chen
2021-09-27 11:59 ` bug#50618: " Lars-Dominik Braun
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.