Subject: bug#38630: closed (Re: [bug#38630] Software Heritage (swh): Fix API change, causing repeatedly submitting archives)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 17 Dec 2019 22:33:01 +0000

Your bug report

#38630: Software Heritage (swh): Fix API change, causing repeatedly submitting archives

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
38630: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38630
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#38630] Software Heritage (swh): Fix API change, causing repeatedly submitting archives
From: Björn Höfling <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked]
Date: Tue, 17 Dec 2019 23:32:40 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

On Tue, 17 Dec 2019 17:41:04 +0100
Ludovic Courtès <[email-masked]> wrote:

> > I have not communicated with SWH about that, especially I have not
> > asked SWH why they broke the API without updating the version
> > number.  
> 
> Yeah, that’s weird, I’ve pinged them on IRC.
> 
> It seems that the removal was intentional as part of
> <https://forge.softwareheritage.org/D2167>, but it wasn’t clear
> whether the API breakage should have happened.  This led them to open
> a new task: <https://forge.softwareheritage.org/T2158>.  We should
> keep an eye on it.

I will be frequently linting and see what's happening :-)

[..]

> In the meantime, your patch looks like the right move, so you can
> push it.

Thanks for your review and further information, pushed as

356a79becc4061d158c68718ad169abac1ab672f

Closing this ticket.

Björn

Subject: Software Heritage (swh): Fix API change, causing repeatedly submitting archives
From: Björn Höfling <[email-masked]>
To: <[email-masked]>
Date: Sun, 15 Dec 2019 22:34:33 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix,

when linting, I recognized that the archival linter was repeatedly
sending packages to the SWH, despite that the package was already
archived.

With some investigations, I noticed they changed the API. Here's a
patch that fixes it.

I have not communicated with SWH about that, especially I have not asked
SWH why they broke the API without updating the version number.

Björn

From a5ada85d168b45d517d8faf0d79ad5beccc26911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20H=C3=B6fling?=
 <[email-masked]>
Date: Sun, 15 Dec 2019 22:00:56 +0100
Subject: [PATCH] swh: Fix API call for getting origin.

When using the archival linter, git origins already in the archive where
not recognized due to an API change and where repeatedly asked for archival.
This is fixed here.

* guix/swh.scm (lookup-origin): Fix API URI for getting origin.
(<origin>): Fix comment with API URI example.
---
 guix/swh.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/swh.scm b/guix/swh.scm
index 7acad05928..372e4c84d1 100644
--- a/guix/swh.scm
+++ b/guix/swh.scm
@@ -244,7 +244,7 @@ FALSE-IF-404? is true, return #f upon 404 responses."
        docstring
        (call (swh-url components ...) json->value)))))
 
-;; <https://archive.softwareheritage.org/api/1/origin/git/url/https://github.com/guix-mirror/guix/>
+;; <https://archive.softwareheritage.org/api/1/origin//https://github.com/guix-mirror/guix/get>
 (define-json-mapping <origin> make-origin origin?
   json->origin
   (id origin-id)
@@ -365,7 +365,7 @@ FALSE-IF-404? is true, return #f upon 404 responses."
 
 (define-query (lookup-origin url)
   "Return an origin for URL."
-  (path "/api/1/origin/git/url" url)
+  (path "/api/1/origin" url "get")
   json->origin)
 
 (define-query (lookup-content hash type)
-- 
2.23.0