# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.68) AC_INIT([GNU Guix], [m4_esyscmd([build-aux/git-version-gen .tarball-version])], [bug-guix@gnu.org], [guix], [https://www.gnu.org/software/guix/]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \ color-tests parallel-tests -Woverride -Wno-portability]) # Enable silent rules by default. AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([guix.scm]) AC_CONFIG_MACRO_DIR([m4]) dnl For the C++ code. This must be used early. AC_USE_SYSTEM_EXTENSIONS AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.18.1]) GUIX_SYSTEM_TYPE GUIX_ASSERT_SUPPORTED_SYSTEM AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH], [file name of the store (defaults to /gnu/store)]), [storedir="$withval"], [storedir="/gnu/store"]) AC_SUBST(storedir) AC_ARG_WITH([bash-completion-dir], AC_HELP_STRING([--with-bash-completion-dir=DIR], [name of the Bash completion directory]), [bashcompletiondir="$withval"], [bashcompletiondir='${sysconfdir}/bash_completion.d']) AC_SUBST([bashcompletiondir]) AC_ARG_WITH([zsh-completion-dir], AC_HELP_STRING([--with-zsh-completion-dir=DIR], [name of the Zsh completion directory]), [zshcompletiondir="$withval"], [zshcompletiondir='${datadir}/zsh/site-functions']) AC_SUBST([zshcompletiondir]) AC_ARG_WITH([fish-completion-dir], AC_HELP_STRING([--with-fish-completion-dir=DIR], [name of the Fish completion directory]), [fishcompletiondir="$withval"], [fishcompletiondir='${datadir}/fish/vendor_completions.d']) AC_SUBST([fishcompletiondir]) AC_ARG_WITH([selinux-policy-dir], AC_HELP_STRING([--with-selinux-policy-dir=DIR], [name of the SELinux policy directory]), [selinux_policydir="$withval"], [selinux_policydir='${datadir}/
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 François Joulaud <francois.joulaud@radiofrance.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;;; Summary
;; Tests for guix/import/go.scm

(define-module (tests-import-go)
  #:use-module (guix base32)
  #:use-module (guix build-system go)
  #:use-module (guix import go)
  #:use-module (guix base32)
  #:use-module ((guix utils) #:select (call-with-temporary-directory))
  #:use-module (guix tests)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-19)
  #:use-module (srfi srfi-64)
  #:use-module (web response))

(define go.mod-requirements
  (@@ (guix import go) go.mod-requirements))

(define parse-go.mod
  (@@ (guix import go) parse-go.mod))

(define fixture-go-mod-simple
  "module my/thing
go 1.12
require other/thing v1.0.2
require new/thing/v2 v2.3.4
exclude old/thing v1.2.3
replace bad/thing v1.4.5 => good/thing v1.4.5
")

(define fixture-go-mod-with-block
  "module M

require (
         A v1
         B v1.0.0
         C v1.0.0
         D v1.2.3
         E dev
)

exclude D v1.2.3
")

(define fixture-go-mod-complete
  "module M

go 1.13

replace github.com/myname/myproject/myapi => ./api

replace github.com/mymname/myproject/thissdk => ../sdk

replace launchpad.net/gocheck => github.com/go-check/check v0.0.0-20140225173054-eb6ee6f84d0a

require (
	github.com/user/project v1.1.11
	github.com/user/project/sub/directory v1.1.12
	bitbucket.org/user/project v1.11.20
	bitbucket.org/user/project/sub/directory v1.11.21
	launchpad.net/project v1.1.13
	launchpad.net/project/series v1.1.14
	launchpad.net/project/series/sub/directory v1.1.15
	launchpad.net/~user/project/branch v1.1.16
	launchpad.net/~user/project/branch/sub/directory v1.1.17
	hub.jazz.net/git/user/project v1.1.18
	hub.jazz.net/git/user/project/sub/directory v1.1.19
	k8s.io/kubernetes/subproject v1.1.101
	one.example.com/abitrary/repo v1.1.111
	two.example.com/abitrary/repo v0.0.2
	\"quoted.example.com/abitrary/repo\" v0.0.2
)

replace two.example.com/abitrary/repo => github.com/corp/arbitrary-repo v0.0.2

replace (
	golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
	golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
)

")

(define fixture-go-mod-unparsable
  "module my/thing
go 1.12 // avoid feature X
require other/thing v1.0.2
// Security issue: CVE-XXXXX
exclude old/thing v1.2.3
new-directive another/thing yet-another/thing
replace (
        bad/thing v1.4.5 => good/thing v1.4.5
        // Unparseable
        bad/thing [v1.4.5, v1.9.7] => good/thing v2.0.0
)
")

(define fixture-go-mod-retract
  "retract v0.9.1

retract (
	v1.9.2
	[v1.0.0, v1.7.9]
)
")

(define fixture-go-mod-strings
  "require `example.com/\"some-repo\"` v1.9.3
require (
        `example.com/\"another.repo\"` v1.0.0
        \"example.com/special!repo\" v9.3.1
)
replace \"example.com/\\\"some-repo\\\"\" => `launchpad.net/some-repo` v1.9.3
replace (
        \"example.com/\\\"another.repo\\\"\" => launchpad.net/another-repo v1.0.0
)
")

(define fixtures-go-check-test
  (let ((version
         "{\"Version\":\"v0.0.0-20201130134442-10cb98267c6c\",\"Time\":\"2020-11-30T13:44:42Z\"}")
        (go.info
         "{\"Version\":\"v0.0.0-20201130134442-10cb98267c6c\",\"Time\":\"2020-11-30T13:44:42Z\"}")
        (go.mod
          "module gopkg.in/check.v1

go 1.11

require github.com/kr/pretty v0.2.1
")
        (go-get
           "<!DOCTYPE html>
<html lang=\"en\" >
  <head>
    <meta charset=\"utf-8\">
  <link rel=\"dns-prefetch\" href=\"https://github.githubassets.com\">
    <script crossorigin=\"anonymous\" defer=\"defer\" integrity=\"sha512-aw5tciVT0IsECUmMuwp9ez60QReE2/yFNL1diLgZnOom6RhU8+0lG3RlAKto4JwbCoEP15E41Pksd7rK5BKfCQ==\" type=\"application/javascript\" src=\"https://github.githubassets.com/assets/topic-suggestions-6b0e6d72.js\"></script>
      <meta name=\"viewport\" content=\"width=device-width\">

   <title>GitHub - go-check/check: Rich testing for the Go language</title>
   <meta name=\"description\" content=\"Rich testing for the Go language. Contribute to go-check/check development by creating an account on GitHub.\">
   <link rel=\"search\" type=\"application/opensearchdescription+xml\" href=\"/opensearch.xml\" title=\"GitHub\">
   <link rel=\"fluid-icon\" href=\"https://github.com/fluidicon.png\" title=\"GitHub\">
   <!-- To prevent page flashing, the optimizely JS needs to be loaded in the
                     <head> tag before the DOM renders -->
   <meta name=\"hostname\" content=\"github.com\">
   <meta name=\"user-login\" content=\"\">
   <link href=\"https://github.com/go-check/check/commits/v1.atom\" rel=\"alternate\" title=\"Recent Commits to check:v1\" type=\"application/atom+xml\">
   <meta name=\"go-import\" content=\"github.com/go-check/check git https://github.com/go-check/check.git\">
  </head>
  <body class=\"logged-out env-production page-responsive\" style=\"word-wrap: break-word;\">
  </body>
</html>
")
        (pkg.go.dev "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n</head>\n<body class=\"Site Site--wide Site--redesign\">