[PATCH 0/3] Improve launchpad updater

  • Done
  • quality assurance status badge
Details
2 participants
  • Arun Isaac
  • Ludovic Courtès
Owner
unassigned
Submitted by
Arun Isaac
Severity
normal
A
A
Arun Isaac wrote on 4 Jul 2020 20:25
(address . guix-patches@gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704182548.25280-1-arunisaac@systemreboot.net
This patchset fixes a bug in the launchpad importer, and improves it to
recognize more URLs and extensions. `guix refresh --list-updaters` reports an
improvement in coverage from 0.1% to 0.2%.

On a side note, all our updaters try to detect the URL format through a series
of guesses. But, all our packages already encode information about how to
construct the source URL from the version. If we could somehow tap into that
information, our updaters would be much simpler. Unfortunately, all the uri
fields of packages are strings. We would need them to be functions that take
the version as an argument. This is a major conversion. Is it feasible? Any
better ideas?

Arun Isaac (3):
import: launchpad: Handle list of source URLs correctly.
import: launchpad: Recognize the .orig.tar.gz extension.
import: launchpad: Recognize more URLs.

guix/import/launchpad.scm | 38 +++++++++++++++++++++++++++++---------
1 file changed, 29 insertions(+), 9 deletions(-)

--
2.26.2
A
A
Arun Isaac wrote on 4 Jul 2020 20:33
[PATCH 1/3] import: launchpad: Handle list of source URLs correctly.
(address . 42192@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704183332.25445-1-arunisaac@systemreboot.net
* guix/import/launchpad.scm (updated-launchpad-url): Return updated URL when
package has a list of URLs, not the old URL.
---
guix/import/launchpad.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (22 lines)
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index c7375837c7..1162cbe123 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,7 +66,7 @@ false if none is recognized"
((? string?)
(updated-url source-uri))
((source-uri ...)
- (find updated-url source-uri))))))
+ (any updated-url source-uri))))))
(_ #f)))
(define (launchpad-package? package)
--
2.26.2
A
A
Arun Isaac wrote on 4 Jul 2020 20:33
[PATCH 3/3] import: launchpad: Recognize more URLs.
(address . 42192@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704183332.25445-3-arunisaac@systemreboot.net
* guix/import/launchpad.scm (updated-launchpad-url): Recognize more URLs.
---
guix/import/launchpad.scm | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)

Toggle diff (48 lines)
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index c991ccfe6e..fd3cfa8444 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -46,15 +46,35 @@ false if none is recognized"
(version (package-version old-package))
(repo (launchpad-repository url)))
(cond
- ((and
- (>= (length (string-split version #\.)) 2)
- (string=? (string-append "https://launchpad.net/"
- repo "/" (version-major+minor version)
- "/" version "/+download/" repo "-" version ext)
- url))
+ ((< (length (string-split version #\.)) 2) #f)
+ ((string=? (string-append "https://launchpad.net/"
+ repo "/" (version-major+minor version)
+ "/" version "/+download/" repo "-" version ext)
+ url)
(string-append "https://launchpad.net/"
repo "/" (version-major+minor new-version)
"/" new-version "/+download/" repo "-" new-version ext))
+ ((string=? (string-append "https://launchpad.net/"
+ repo "/" (version-major+minor version)
+ "/" version "/+download/" repo "_" version ext)
+ url)
+ (string-append "https://launchpad.net/"
+ repo "/" (version-major+minor new-version)
+ "/" new-version "/+download/" repo "-" new-version ext))
+ ((string=? (string-append "https://launchpad.net/"
+ repo "/trunk/" version "/+download/"
+ repo "-" version ext)
+ url)
+ (string-append "https://launchpad.net/"
+ repo "/trunk/" new-version
+ "/+download/" repo "-" new-version ext))
+ ((string=? (string-append "https://launchpad.net/"
+ repo "/trunk/" version "/+download/"
+ repo "_" version ext)
+ url)
+ (string-append "https://launchpad.net/"
+ repo "/trunk/" new-version
+ "/+download/" repo "_" new-version ext))
(#t #f))))) ; Some URLs are not recognised.
(match (package-source old-package)
--
2.26.2
A
A
Arun Isaac wrote on 4 Jul 2020 20:33
[PATCH 2/3] import: launchpad: Recognize the .orig.tar.gz extension.
(address . 42192@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704183332.25445-2-arunisaac@systemreboot.net
* guix/import/launchpad.scm (find-extension): Recognize the .orig.tar.gz
extension.
---
guix/import/launchpad.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index 1162cbe123..c991ccfe6e 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -32,7 +32,7 @@
"Return the extension of the archive e.g. '.tar.gz' given a URL, or
false if none is recognized"
(find (lambda (x) (string-suffix? x url))
- (list ".tar.gz" ".tar.bz2" ".tar.xz"
+ (list ".orig.tar.gz" ".tar.gz" ".tar.bz2" ".tar.xz"
".zip" ".tar" ".tgz" ".tbz" ".love")))
(define (updated-launchpad-url old-package new-version)
--
2.26.2
L
L
Ludovic Courtès wrote on 31 Aug 2020 15:29
Re: [bug#42192] [PATCH 0/3] Improve launchpad updater
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 42192@debbugs.gnu.org)
87pn77c5a9.fsf@gnu.org
Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

Toggle quote (4 lines)
> This patchset fixes a bug in the launchpad importer, and improves it to
> recognize more URLs and extensions. `guix refresh --list-updaters` reports an
> improvement in coverage from 0.1% to 0.2%.

All three patches LGTM, thank you!

Toggle quote (8 lines)
> On a side note, all our updaters try to detect the URL format through a series
> of guesses. But, all our packages already encode information about how to
> construct the source URL from the version. If we could somehow tap into that
> information, our updaters would be much simpler. Unfortunately, all the uri
> fields of packages are strings. We would need them to be functions that take
> the version as an argument. This is a major conversion. Is it feasible? Any
> better ideas?

I sympathize with the idea, but I think it’s a bit too ambitious. All
in all, what we currently have seems like a reasonable tradeoff.

Ludo’.
A
A
Arun Isaac wrote on 1 Sep 2020 19:20
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 42192-done@debbugs.gnu.org)
87zh691ki9.fsf@systemreboot.net
Toggle quote (6 lines)
>> This patchset fixes a bug in the launchpad importer, and improves it to
>> recognize more URLs and extensions. `guix refresh --list-updaters` reports an
>> improvement in coverage from 0.1% to 0.2%.
>
> All three patches LGTM, thank you!

Pushed to master, thanks for the review!

Toggle quote (3 lines)
> I sympathize with the idea, but I think it’s a bit too ambitious. All
> in all, what we currently have seems like a reasonable tradeoff.

Fair enough. :-)
Closed
?