unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53
@ 2023-03-13  0:26 Martin Castillo
  2023-03-15 16:28 ` Martin Castillo
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Castillo @ 2023-03-13  0:26 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 2259 bytes --]

Hi,

the packaged restic is at 0.9.6 while upstream is at 0.15.1. I thought 
I'd try to update the package to learn how to package things for guix. 
I'm a complete noob with that, and I have zero experience with go.

I'm using guix system in qemu with
qemu-system-x86_64   -drive media=disk,file=geex-unenc.img,format=raw 
-bios /usr/share/ovmf/x64/OVMF.fd  -m 2G   -smp 3 -nic 
user,model=virtio-net-pci,hostfwd=tcp::2223-:22 -enable-kvm

I used guix edit restic as a starting point and saved it in 
~/packages/restic.scm. I removed all other programs, renamed restic to 
restic-new, adjusted the hash, removed a patch for an older go, and used 
a newer go version for the build system, as 1.17 is too old for restic 0.15.

Now the build fails trying to download dependencies:

$ guix build -L packages/ -K --fallback restic-new
...
go: downloading github.com/klauspost/compress v1.15.15
go: downloading golang.org/x/text v0.6.0
go: downloading github.com/pkg/xattr v0.4.10-0.20221120235825-35026bbbd013
go: downloading github.com/hashicorp/golang-lru/v2 v2.0.1
internal/backend/gs/gs.go:14:2: cloud.google.com/go/storage@v1.29.0: Get 
"https://proxy.golang.org/cloud.google.com/go/storage/@v/v1.29.0.zip": 
dial tcp: lookup proxy.golang.org on [::1]:53: read udp 
[::1]:36438->[::1]:53: read: connection refused
internal/backend/azure/azure.go:22:2: 
github.com/Azure/azure-sdk-for-go/sdk/azcore@v1.3.0: Get 
"https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/azcore/@v/v1.3.0.zip": 
dial tcp: lookup proxy.golang.org on [::1]:53: read udp 
[::1]:52528->[::1]:53: read: connection refused
...
build failed: exit status 1
exit status 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "go" arguments: ("run" "build.go") 
exit-status: 1 term-signal: #f stop-signal: #f>
phase `build' failed after 2.4 seconds
command "go" "run" "build.go" failed with status 1

Looks like go trys using ipv6 for the dns lookup. But
/etc/resolv.conf says
nameserver 10.0.2.3

I don't have a nameserver running on ::1. And this inside qemu, where I 
didn't set up anything specifically for ipv6. I have only site and link 
local ipv6 addresses. Why does go-build-system try to resolve the host 
names at [::1]:53?

Martin Castillo

[-- Attachment #2: restic.scm --]
[-- Type: text/x-scheme, Size: 7386 bytes --]

;;; GNU Guix --- Functional package management for GNU

(define-module (restic)
  #:use-module (guix gexp)
  #:use-module (guix packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system go)
  #:use-module (gnu packages)
  #:use-module (gnu packages acl)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages base)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages crypto)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages datastructures)
  #:use-module (gnu packages digest)
  #:use-module (gnu packages dbm)
  #:use-module (gnu packages dejagnu)
  #:use-module (gnu packages ftp)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages gperf)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages guile-xyz)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mcrypt)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages nettle)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages onc-rpc)
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages ssh)
  #:use-module (gnu packages time)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages valgrind)
  #:use-module (gnu packages xml))

(define-public restic-new
  (package
    (name "restic-new")
    (version "0.15.1")
    ;; TODO Try packaging the bundled / vendored dependencies in the 'vendor/'
    ;; directory.
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/restic/restic/releases/download/"
                    "v" version "/restic-" version ".tar.gz"))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "0lhck49zzkdaya20naxf8aryg9p8smk0fr5abnimh0dcrpyq5qzw"))
              ;(patches
               ;(search-patches "restic-0.9.6-fix-tests-for-go1.15.patch"))
               ))
    (build-system go-build-system)
    (arguments
     `(#:import-path "github.com/restic/restic"
       #:go ,go-1.20
      ;; We don't need to install the source code for end-user applications.
       #:install-source? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'build
           (lambda* (#:key inputs #:allow-other-keys)
             (with-directory-excursion "src/github.com/restic/restic"
               ;; Disable 'restic self-update'.  It makes little sense in Guix.
               (substitute* "build.go" (("selfupdate") ""))
               (setenv "HOME" (getcwd)) ; for $HOME/.cache/go-build
               (invoke "go" "run" "build.go"))))

         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (with-directory-excursion "src/github.com/restic/restic"
                 ;; Disable FUSE tests.
                 (setenv "RESTIC_TEST_FUSE" "0")
                 (invoke "go" "run" "build.go" "--test")))))

         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (src "src/github.com/restic/restic"))
               (install-file (string-append src "/restic")
                             (string-append out "/bin"))
               #t)))

         (add-after 'install 'install-docs
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (man "/share/man")
                    (man-section (string-append man "/man"))
                    (src "src/github.com/restic/restic/doc/man/"))
               ;; Install all the man pages to "out".
               (for-each
                 (lambda (file)
                   (install-file file
                                 (string-append out man-section
                                                (string-take-right file 1))))
                 (find-files src "\\.[1-9]"))
               #t)))

         (add-after 'install-docs 'install-shell-completion
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (etc (string-append out "/etc"))
                    (share (string-append out "/share")))
               (for-each
                (lambda (shell)
                  (let* ((shell-name (symbol->string shell))
                         (dir (string-append "etc/completion/" shell-name)))
                    (mkdir-p dir)
                    (invoke (string-append bin "/restic") "generate"
                            (string-append "--" shell-name "-completion")
                            (string-append dir "/"
                                           (case shell
                                             ((bash) "restic")
                                             ((zsh) "_restic"))))))
                '(bash zsh))
               (with-directory-excursion "etc/completion"
                 (install-file "bash/restic"
                               (string-append etc "/bash_completion.d"))
                 (install-file "zsh/_restic"
                               (string-append share "/zsh/site-functions")))
               #t))))))
    (home-page "https://restic.net/")
    (synopsis "Backup program with multiple revisions, encryption and more")
    (description "Restic is a program that does backups right and was designed
with the following principles in mind:

@itemize
@item Easy: Doing backups should be a frictionless process, otherwise you
might be tempted to skip it.  Restic should be easy to configure and use, so
that, in the event of a data loss, you can just restore it.  Likewise,
restoring data should not be complicated.

@item Fast: Backing up your data with restic should only be limited by your
network or hard disk bandwidth so that you can backup your files every day.
Nobody does backups if it takes too much time.  Restoring backups should only
transfer data that is needed for the files that are to be restored, so that
this process is also fast.

@item Verifiable: Much more important than backup is restore, so restic
enables you to easily verify that all data can be restored.  @item Secure:
Restic uses cryptography to guarantee confidentiality and integrity of your
data.  The location the backup data is stored is assumed not to be a trusted
environment (e.g.  a shared space where others like system administrators are
able to access your backups).  Restic is built to secure your data against
such attackers.

@item Efficient: With the growth of data, additional snapshots should only
take the storage of the actual increment.  Even more, duplicate data should be
de-duplicated before it is actually written to the storage back end to save
precious backup space.
@end itemize")
    (license license:bsd-2)))


[-- Attachment #3: restic-new-0.15.1.drv.gz --]
[-- Type: application/gzip, Size: 79836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53
  2023-03-13  0:26 updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53 Martin Castillo
@ 2023-03-15 16:28 ` Martin Castillo
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Castillo @ 2023-03-15 16:28 UTC (permalink / raw)
  To: help-guix

Am 13.03.23 um 01:26 schrieb Martin Castillo> Now the build fails trying 
to download dependencies:

Ok, naturally, we don't want go to access the internet to get the 
dependencies.

I tried adding (inputs (list go-github-com-minio-sha256-simd))
to the package, but go still tries to get that. Go doesn't care about 
the symlinked package at src/github.com/minio/sha256-simd.

(Someone added that symlinking to go-build-system once, so it may have 
worked with earlier (<1.18) go versions? 
https://issues.guix.gnu.org/50493 references 
https://issues.guix.gnu.org/50227 , which I don't understand, but seems 
to try to get rid of the symlinking and replace it with something better?)

If I run go run build.go manually in the failed dir, the dependencies 
get downloaded to

[...]
/pkg/mod/cache/download/google.golang.org/genproto
/pkg/mod/cache/download/google.golang.org/grpc
/pkg/mod/cache/download/google.golang.org/protobuf
/pkg/mod/cache/download/go.opencensus.io
/pkg/mod/cache/download/gopkg.in/
/pkg/mod/cloud.google.com
/pkg/mod/github.com
/pkg/mod/golang.org
/pkg/mod/google.golang.org
/pkg/mod/go.opencensus.io@v0.24.0
/pkg/mod/gopkg.in
etc.

and not to /src/github.com/ or such, where inputs get symlinked at.

My conclusion: go-build-system needs to be updated to account for the 
new way go handles dependencies.

Is this correct? And is this issue 50227?


Martin

> 
> Looks like go trys using ipv6 for the dns lookup. But
> /etc/resolv.conf says
> nameserver 10.0.2.3
> 
> I don't have a nameserver running on ::1. And this inside qemu, where I 
> didn't set up anything specifically for ipv6. I have only site and link 
> local ipv6 addresses. Why does go-build-system try to resolve the host 
> names at [::1]:53?
> 
> Martin Castillo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-15 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13  0:26 updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53 Martin Castillo
2023-03-15 16:28 ` Martin Castillo

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).