Re: updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53

2023-03-15 Thread Martin Castillo
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




updating restic: go-build-system trying to resolve host names with nonexistent dnscache at [::1]:53

2023-03-12 Thread Martin Castillo

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;;; 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 %sta