unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: zimoun <zimon.toutoune@gmail.com>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: SWH and lookup (bug?)
Date: Fri, 29 Oct 2021 16:57:10 +0200	[thread overview]
Message-ID: <87h7czzxo9.fsf@gnu.org> (raw)
In-Reply-To: <86bl3b94tx.fsf@gmail.com> (zimoun's message of "Tue, 26 Oct 2021 17:35:38 +0200")

zimoun <zimon.toutoune@gmail.com> skribis:

> For instance, try with the package ’sway’ (search bar [1]:
> https://github.com/swaywm/sway).  SWH says the status for archiving
> succeeded.  Even, it is archived for instance there [2].
>
> Then if you give a look at the visit webpage, it says that the
> repository had been visited several times on 2021 [3].
>
> 1: <https://archive.softwareheritage.org/save/#requests>
> 2: <https://archive.softwareheritage.org/browse/origin/directory/?origin_url=https://github.com/swaywm/sway&release=1.5.1>
> 3: <https://archive.softwareheritage.org/browse/origin/visits/?origin_url=https://github.com/swaywm/sway>
>
>
> However, I get this:
>
> $ guix lint -c archival sway                    
> gnu/packages/wm.scm:1527:5: sway@1.5.1: scheduled Software Heritage archival

Indeed, I’m getting that as well.

Right now Sway’s origin refers to the “1.5.1” tag.

I found the problem:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix swh)
scheme@(guile-user)> (lookup-origin-revision "https://github.com/swaywm/sway" "1.5.1")
$2 = #f
scheme@(guile-user)> (lookup-origin "https://github.com/swaywm/sway")
$3 = #<<origin> visits-url: "https://archive.softwareheritage.org/api/1/origin/https://github.com/swaywm/sway/visits/" type: #<unspecified> url: "https://github.com/swaywm/sway">
scheme@(guile-user)> (car (origin-visits $3))
$4 = #<<visit> date: #<date nanosecond: 490956 second: 6 minute: 45 hour: 14 day: 29 month: 10 year: 2021 zone-offset: 0> origin: "https://github.com/swaywm/sway" url: "https://archive.softwareheritage.org/api/1/origin/https://github.com/swaywm/sway/visit/41/" snapshot-url: "https://archive.softwareheritage.org/api/1/snapshot/10ba0257e3290ce4504c2413f32b9358d72975d6/" status: full number: 41>
scheme@(guile-user)> (define s (visit-snapshot $4))
scheme@(guile-user)> ,pp (map branch-name (snapshot-branches s))
*** output flushed ***
scheme@(guile-user)> (length (snapshot-branches s))
$6 = 1000
scheme@(guile-user)> (filter (lambda (b)
			       (string-prefix? "refs/tags" (branch-name b)))
			     (snapshot-branches s))
$7 = ()
scheme@(guile-user)> ,use(srfi srfi-1)
scheme@(guile-user)> ,pp (take (snapshot-branches s) 10)
$8 = (#<<branch> name: "refs/pull/2715/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/2f258eff6fd2c89a94caa658c1ea22beb76d728a/">
 #<<branch> name: "refs/pull/2713/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/4e4898e90f4d9b721091137a744deac335e73f12/">
 #<<branch> name: "refs/pull/2712/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/d129108cddc485299443d0b98c3bdf3f9839aa1c/">
 #<<branch> name: "refs/pull/271/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/20cb390323b19dc0c767ba63925def7f51c31044/">
 #<<branch> name: "refs/pull/2709/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/426c33f4dc2515867a0d3b04cb865d5cad091d10/">
 #<<branch> name: "refs/pull/2708/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/b1a0e95e8e6ecf66542cc62e6109949de59afb5e/">
 #<<branch> name: "refs/pull/2704/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/6194a445d3b10e8afc968712faccdd1d127a8beb/">
 #<<branch> name: "refs/pull/2703/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/f16529e2588f5e71d6777f4c06dfb58b29308cd0/">
 #<<branch> name: "refs/pull/2701/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/baeb28ea6230ef9aa409ee52abe208720120e45c/">
 #<<branch> name: "refs/pull/270/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/a32cbb52ce81ee38d2928ba873ff7fc182df8393/">)
--8<---------------cut here---------------end--------------->8---

This snapshot has more than 1,000 branches, mostly ‘refs/pull’ branches.
But by default, the endpoint used by ‘visit-snapshot’ only returns the
first 1,000 branches, and then it’s up to the caller to use the
pagination mechanism.

It’s not implemented though!  It turns out the ‘refs/tags’ “branches”
were not among the first thousand branches, so the code incorrectly
thinks that the tag is missing.

The solution is to implement pagination (yuk!), or to use an endpoint to
look up a branch by name instead of using ‘snapshot-branches’ (is there
such an endpoint?).

Thoughts?

Ludo’.


  reply	other threads:[~2021-10-29 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 15:35 SWH and lookup (bug?) zimoun
2021-10-29 14:57 ` Ludovic Courtès [this message]
2021-11-02 11:23   ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7czzxo9.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).