Subject: Re: bug#76503: [GCD] Migrating repositories, issues, and patches to Codeberg

From: Ludovic Courtès <[email-masked]>
Date: Sat, 19 Apr 2025 11:29:38 +0200

Hi Jason,

Jason Conroy <[email-masked]> writes:

> The gitea and forgejo client CLIs have an option called "dump-repo"[1]
> which appears relevant. The call requires a hostname and user creds,
> so
> I don't think it's specifically a server-side tool. Unfortunately, it
> tends to hammer the backend service with lots of API calls[2]. Also,
> judging from the code[3], it seems to have no concept of incremental
> operation: if the export fails for any reason (such as backend
> timeout),
> the client just deletes the partially-written archive.

OK, sounds like brute-force approach.

> More recently, Forgejo has been developing an on-disk format for data
> dumps to/from various kinds of forges. It's called F3 ("Friendly Forge
> Format") [4] and there exists a reference implementation[5] that can
> write the archives and talk to forgejo backends. Its project page
> states
> that the tool is designed for "mirroring", which suggests that
> efficient
> incremental syncs might be possible.

Nice!  It looks like the right kind of tool.

I wanted to give it a try so I ran “guix import go
code.forgejo.org/f3/gof3/v3”, tweaked the result (file attached), but
then I’m stuck with a build failure of
go-github-com-davidmz-go-pageant-1.0.2.  If Go-savvy people are reading
this, your guidance is welcome!

> P.S. Although my opinion as a lurker won't count for much, :) I
> support
> this GCD. Up-thread, some discussions on ease-of-use ("it takes N
> steps
> to do it this way, vs. N+2 steps that way") make the tacit assumption
> that the user handles every step correctly. But in the real world
> where
> users make mistakes, I see value in a webservice-based workflow that
> provides instantaneous and very visible feedback to users, as compared
> to an asynchronous workflow that's driven by emails and several
> loosely-coupled services.

I agree.  Thanks for sharing your views and your findings on
backup/mirroring!

Ludo’.

(define-module (gnu packages f3)
  #:use-module (guix)
  #:use-module (guix git-download)
  #:use-module (guix build-system go)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages golang-build)
  #:use-module (gnu packages golang-check)
  #:use-module (gnu packages golang-xyz)
  #:use-module (gnu packages golang-web)
  #:use-module ((guix licenses) #:prefix license:))

(define-public go-github-com-42wim-httpsig
  (package
    (name "go-github-com-42wim-httpsig")
    (version "1.2.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/42wim/httpsig")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0r6q3g0ghccnvqsw7g3g18s710q8haq5vzpvhrb48vmbcj0pdyn8"))))
    (build-system go-build-system)
    (arguments
     (list
      #:import-path "github.com/42wim/httpsig"))
    (propagated-inputs (list go-golang-org-x-crypto))
    (home-page "https://github.com/42wim/httpsig")
    (synopsis "httpsig")
    (description
     "This package implements HTTP request and response signing and verification.
Supports the major MAC and asymmetric key signature algorithms.  It has several
safety restrictions: One, none of the widely known non-cryptographically safe
algorithms are permitted; Two, the RSA SHA256 algorithms must be available in
the binary (and it should, barring export restrictions); Finally, the library
assumes either the Authorizationn or Signature headers are to be set (but not
both).")
    (license license:bsd-3)))

(define-public go-github-com-davidmz-go-pageant
  (package
    (name "go-github-com-davidmz-go-pageant")
    (version "1.0.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/davidmz/go-pageant")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0b333bnzi8wncakff7b890gg4md9pcbhs9fdv5bhh68r5pm2dz41"))))
    (build-system go-build-system)
    (arguments
     (list
      #:import-path "github.com/davidmz/go-pageant"))
    (propagated-inputs (list go-golang-org-x-crypto))
    (home-page "https://github.com/davidmz/go-pageant")
    (synopsis #f)
    (description
     "Package pageant provides an interface to @code{PyTTY} pageant.exe utility.  This
package is windows-only.")
    (license license:expat)))

(define-public go-github-com-santhosh-tekuri-jsonschema
  (package
    (name "go-github-com-santhosh-tekuri-jsonschema")
    (version "6.0.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/santhosh-tekuri/jsonschema")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0681b359f30f9pkyi4rl1k0rq8w83mn25n323l4lis61f2d2kizy"))))
    (build-system go-build-system)
    (arguments
     (list
      #:import-path "github.com/santhosh-tekuri/jsonschema/v6"
      #:unpack-path "github.com/santhosh-tekuri/jsonschema"))
    (propagated-inputs (list go-golang-org-x-text
                             go-github-com-dlclark-regexp2))
    (home-page "https://github.com/santhosh-tekuri/jsonschema")
    (synopsis "jsonschema v6.0.0")
    (description
     "see @@url{https://pkg.go.dev/github.com/santhosh-tekuri/jsonschema/v6,godoc} for
examples.")
    (license license:asl2.0)))

(define-public go-gitlab-com-gitlab-org-api-client-go
  (package
    (name "go-gitlab-com-gitlab-org-api-client-go")
    (version "0.127.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitlab.com/gitlab-org/api/client-go.git")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1bhk18sazvgpii5ahpi9jn94pgy5kqw3qgsw1wbqfg04vjs4g4cf"))))
    (build-system go-build-system)
    (arguments
     (list
      #:go go-1.22
      #:import-path "gitlab.com/gitlab-org/api/client-go"))
    (propagated-inputs (list go-golang-org-x-time
                             go-golang-org-x-oauth2
                             go-go-uber-org-mock
                             go-github-com-stretchr-testify
                             go-github-com-hashicorp-go-retryablehttp
                             go-github-com-hashicorp-go-cleanhttp
                             go-github-com-google-go-querystring))
    (home-page "https://gitlab.com/gitlab-org/api/client-go")
    (synopsis "GitLab client-go (former")
    (description "Copyright 2022, Daniela Filipe Bento.")
    (license license:asl2.0)))

(define-public go-code-forgejo-org-f3-gof3
  (package
    (name "go-code-forgejo-org-f3-gof3")
    (version "3.10.7")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://code.forgejo.org/f3/gof3.git")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "031hq66diwjiphdghcwm4fhlfmwbnxa1zsc4ccyhsgxn7c3svqzh"))))
    (build-system go-build-system)
    (arguments
     (list
      ;; #:go go-1.24
      #:import-path "code.forgejo.org/f3/gof3/v3"
      #:unpack-path "code.forgejo.org/f3/gof3"))
    (propagated-inputs (list go-golang-org-x-crypto
                             go-gitlab-com-gitlab-org-api-client-go
                             go-github-com-urfave-cli-v2
                             go-github-com-stretchr-testify
                             go-github-com-santhosh-tekuri-jsonschema
                             go-github-com-hashicorp-go-version
                             go-github-com-google-go-cmp
                             go-github-com-davidmz-go-pageant
                             go-github-com-42wim-httpsig))
    (home-page "https://code.forgejo.org/f3/gof3")
    (synopsis "gof3")
    (description
     "As a CLI or as a library, @code{GoF3} provides a single operation: mirroring.
The origin and destination are designated by the URL of a forge and a path to
the resource.  For instance, @@code{mirror --from-type forgejo --from
https://code.forgejo.org/forgejo/lxc-helpers --to-type F3 --to /some/directory}
will mirror a project in a local directory using the F3 format.")
    (license license:expat)))