[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/08: guix build: Factorize 'package-git-url'.
From: |
guix-commits |
Subject: |
05/08: guix build: Factorize 'package-git-url'. |
Date: |
Sun, 17 Mar 2019 17:55:12 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 0c0ff42a243b2da4f1deb52fe3961801008341da
Author: Ludovic Courtès <address@hidden>
Date: Tue Mar 12 22:12:18 2019 +0100
guix build: Factorize 'package-git-url'.
* guix/scripts/build.scm (package-git-url): New procedure.
(evaluate-git-replacement-specs): Use it.
---
guix/scripts/build.scm | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 5883dbf..7b24cc8 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -275,6 +275,19 @@ current 'gnutls' package, after which version 3.5.4 is
grafted onto them."
(define %not-equal
(char-set-complement (char-set #\=)))
+(define (package-git-url package)
+ "Return the URL of the Git repository for package, or raise an error if
+the source of PACKAGE is not fetched from a Git repository."
+ (let ((source (package-source package)))
+ (cond ((and (origin? source)
+ (git-reference? (origin-uri source)))
+ (git-reference-url (origin-uri source)))
+ ((git-checkout? source)
+ (git-checkout-url source))
+ (else
+ (leave (G_ "the source of ~a is not a Git reference~%")
+ (package-full-name package))))))
+
(define (evaluate-git-replacement-specs specs proc)
"Parse SPECS, a list of strings like \"guile=stable-2.2\", and return a list
of package pairs, where (PROC PACKAGE URL BRANCH-OR-COMMIT) returns the
@@ -285,15 +298,7 @@ syntax, or if a package it refers to could not be found."
((name branch-or-commit)
(let* ((old (specification->package name))
(source (package-source old))
- (url (cond ((and (origin? source)
- (git-reference? (origin-uri source)))
- (git-reference-url (origin-uri source)))
- ((git-checkout? source)
- (git-checkout-url source))
- (else
- (leave (G_ "the source of ~a is not a Git \
-reference~%")
- (package-full-name old))))))
+ (url (package-git-url old)))
(cons old (proc old url branch-or-commit))))
(x
(leave (G_ "invalid replacement specification: ~s~%") spec))))
- branch master updated (19c0cdb -> d831b19), guix-commits, 2019/03/17
- 06/08: guix build: Transformation options match packages by spec., guix-commits, 2019/03/17
- 04/08: packages: Add 'package-input-rewriting/spec'., guix-commits, 2019/03/17
- 08/08: guix build: '--with-branch' strips slashes from the version string., guix-commits, 2019/03/17
- 07/08: guix build: '--with-commit' makes recursive checkouts., guix-commits, 2019/03/17
- 03/08: guix build: Add '--with-git-url'., guix-commits, 2019/03/17
- 05/08: guix build: Factorize 'package-git-url'.,
guix-commits <=
- 02/08: scripts: 'warn-about-old-distro' looks at the age of the running Guix., guix-commits, 2019/03/17
- 01/08: describe: Add 'current-profile-date'., guix-commits, 2019/03/17