summaryrefslogtreecommitdiff
path: root/guix/build-system
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2021-03-24 15:28:33 +0200
committerEfraim Flashner <efraim@flashner.co.il>2021-03-24 20:50:44 +0200
commit2aab587f842908a886e3bd08b028885dddd650e0 (patch)
tree87c0723a9ae2c69ab6920d90b6e87ad8510492fe /guix/build-system
parent5664bcdcb0e4c10dfe48dd5e4730fc3c746a21e2 (diff)
parent65c46e79e0495fe4d32f6f2725d7233fff10fd70 (diff)
downloadguix-patches-2aab587f842908a886e3bd08b028885dddd650e0.tar
guix-patches-2aab587f842908a886e3bd08b028885dddd650e0.tar.gz
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'guix/build-system')
-rw-r--r--guix/build-system/cargo.scm5
-rw-r--r--guix/build-system/go.scm35
-rw-r--r--guix/build-system/node.scm2
-rw-r--r--guix/build-system/python.scm6
4 files changed, 41 insertions, 7 deletions
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index ed69746a3b..0c76ba9355 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
+;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -77,8 +78,10 @@ to NAME and VERSION."
(vendor-dir "guix-vendor")
(cargo-build-flags ''("--release"))
(cargo-test-flags ''("--release"))
+ (cargo-package-flags ''("--no-metadata" "--no-verify"))
(features ''())
(skip-build? #f)
+ (install-source? #t)
(phases '(@ (guix build cargo-build-system)
%standard-phases))
(outputs '("out"))
@@ -106,8 +109,10 @@ to NAME and VERSION."
#:vendor-dir ,vendor-dir
#:cargo-build-flags ,cargo-build-flags
#:cargo-test-flags ,cargo-test-flags
+ #:cargo-package-flags ,cargo-package-flags
#:features ,features
#:skip-build? ,skip-build?
+ #:install-source? ,install-source?
#:tests? ,(and tests? (not skip-build?))
#:phases ,phases
#:outputs %outputs
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f8ebaefb27..0e2c1cd2ee 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -26,9 +26,12 @@
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
#:export (%go-build-system-modules
go-build
- go-build-system))
+ go-build-system
+
+ go-version->git-ref))
;; Commentary:
;;
@@ -37,6 +40,36 @@
;;
;; Code:
+(define %go-version-rx
+ (make-regexp (string-append
+ "(v?[0-9]\\.[0-9]\\.[0-9])" ;"v" prefix can be omitted in version prefix
+ "(-|-pre\\.0\\.|-0\\.)" ;separator
+ "([0-9]{14})-" ;timestamp
+ "([0-9A-Fa-f]{12})"))) ;commit hash
+
+(define (go-version->git-ref version)
+ "Parse VERSION, a \"pseudo-version\" as defined at
+<https://golang.org/ref/mod#pseudo-versions>, and extract the commit hash from
+it, defaulting to full VERSION if a pseudo-version pattern is not recognized."
+ ;; A module version like v1.2.3 is introduced by tagging a revision in the
+ ;; underlying source repository. Untagged revisions can be referred to
+ ;; using a "pseudo-version" like v0.0.0-yyyymmddhhmmss-abcdefabcdef, where
+ ;; the time is the commit time in UTC and the final suffix is the prefix of
+ ;; the commit hash (see: https://golang.org/ref/mod#pseudo-versions).
+ (let* ((version
+ ;; If a source code repository has a v2.0.0 or later tag for a file
+ ;; tree with no go.mod, the version is considered to be part of the
+ ;; v1 module's available versions and is given an +incompatible
+ ;; suffix
+ ;; (see:https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning).
+ (if (string-suffix? "+incompatible" version)
+ (string-drop-right version 13)
+ version))
+ (match (regexp-exec %go-version-rx version)))
+ (if match
+ (match:substring match 4)
+ version)))
+
(define %go-build-system-modules
;; Build-side modules imported and used by default.
`((guix build go-build-system)
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 05c24c47d5..a8c5eed09b 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -18,8 +18,6 @@
(define-module (guix build-system node)
#:use-module (guix store)
- #:use-module (guix build json)
- #:use-module (guix build union)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix derivations)
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 2bb6fa87ca..9f3159a960 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -105,8 +105,7 @@ pre-defined variants."
;; Otherwise build the new package object graph.
((eq? (package-build-system p) python-build-system)
- (package
- (inherit p)
+ (package/inherit p
(location (package-location p))
(name (let ((name (package-name p)))
(string-append new-prefix
@@ -138,8 +137,7 @@ pre-defined variants."
(define (strip-python2-variant p)
"Remove the 'python2-variant' property from P."
- (package
- (inherit p)
+ (package/inherit p
(properties (alist-delete 'python2-variant (package-properties p)))))
(define* (lower name