diff mbox series

[bug#57460,18/20] TEMP REMOVE import: git: Restrict to non-github origins.

Message ID 0ba96b5f2dfd841ab080e7a3373b6e335b62fd59.1661691695.git.h.goebel@crazy-compilers.com
State New
Headers show
Series Refresh to specific version | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hartmut Goebel Aug. 28, 2022, 1:18 p.m. UTC
This commit will be dropped and not be committed to the main branch!

'guix refresh -t generic-git' reported a lot of packages which are hosted at
github and are already handled by the github updater.  So whether the package
is updates using the github updater or the generic-git updater would be
non-deterministic.

And indeed 'guix refresh --list-updaters' without this change reported 31.2%
for the github updater and 34.9% for the generic-git updater.  With this
patch, it's only 3.7% for the generic-git updater.  (Still the sum of the
percent-values is 112%, anyhow better then the 146% prior to this change.)

Beside these statistical issues, this patch has another effect:  If the github
updater fails to pick a (later) version the generic-git updater was
triggered.  Anyhow: Why should the generic-git updater be able to find
a (later) version, if the github updater did not?

* guix/import/github.scm: Export 'github-package?'.
* guix/import/git.scm(git-package?): Also check for not github-package?.
---
 guix/import/git.scm    | 4 +++-
 guix/import/github.scm | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Liliana Marie Prikler Aug. 28, 2022, 5:26 p.m. UTC | #1
Am Sonntag, dem 28.08.2022 um 15:18 +0200 schrieb Hartmut Goebel:
> Anyhow: Why should the generic-git updater be able to find
> a (later) version, if the github updater did not?
Because someone at Microsoft could mess up the API in a way that yields
empty results while keeping regular git unchanged.  I think fallbacks
are nice to have, they are already rare enough to find in Guix.

> And indeed 'guix refresh --list-updaters' without this change
> reported 31.2% for the github updater and 34.9% for the generic-git
> updater.  With this patch, it's only 3.7% for the generic-git
> updater.  (Still the sum of the percent-values is 112%, anyhow better
> then the 146% prior to this change.)
Perhaps instead of generating a lazy sum, we should (via an appropriate
option) generate a histogram counting/reporting the packages covered by
0,1,2,... updaters.

Cheers
diff mbox series

Patch

diff --git a/guix/import/git.scm b/guix/import/git.scm
index fdac51edfd..02a851655d 100644
--- a/guix/import/git.scm
+++ b/guix/import/git.scm
@@ -25,6 +25,7 @@ 
   #:use-module (guix git)
   #:use-module (guix git-download)
   #:use-module (guix i18n)
+  #:use-module ((guix import github)  #:select (github-package?))
   #:use-module (guix packages)
   #:use-module (guix upstream)
   #:use-module (guix utils)
@@ -213,7 +214,8 @@  tag, or #false and #false if the latest version could not be determined."
   (match (package-source package)
     ((? origin? origin)
      (and (eq? (origin-method origin) git-fetch)
-          (git-reference? (origin-uri origin))))
+          (git-reference? (origin-uri origin))
+          (not (github-package? package))))
     (_ #f)))
 
 (define* (import-git-release package #:key (version #f))
diff --git a/guix/import/github.scm b/guix/import/github.scm
index facdc96e24..01aa23ba15 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -42,7 +42,7 @@ 
   #:use-module (guix http-client)
   #:use-module (web uri)
   #:use-module (web response)
-  #:export (%github-api %github-updater))
+  #:export (%github-api %github-updater github-package?))
 
 ;; For tests.
 (define %github-api (make-parameter "https://api.github.com"))