GNU bug report logs - #48999
[PATCH] import: hackage: Accept local source for package.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Sun, 13 Jun 2021 09:47:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Xinglu Chen <public <at> yoctocell.xyz>
To: 48999 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>, zimoun <zimon.toutoune <at> gmail.com>
Subject: [bug#48999] [PATCH v2 2/3] import: utils: Add predicates for checking VCS repositories.
Date: Sun, 04 Jul 2021 13:54:18 +0200
* guix/import/utils.scm (git-repository?, hg-repository?): New procedures.
---
 guix/import/utils.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index d817318a91..bcf26ae363 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2020 Helio Machado <0x2b3bfa0+guix <at> googlemail.com>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,6 +44,7 @@
   #:use-module (ice-9 rdelim)
   #:use-module (ice-9 receive)
   #:use-module (ice-9 regex)
+  #:use-module (ice-9 ftw)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-11)
@@ -74,6 +76,9 @@
 
             guix-name
 
+            git-repository?
+            hg-repository?
+            
             recursive-import))
 
 (define (factorize-uri uri version)
@@ -422,6 +427,16 @@ separated by PRED."
                                       (chr (char-downcase chr)))
                                     name)))
 
+(define (git-repository? directory)
+  "Check whether DIRECTORY is a Git repository."
+  (let ((contents (scandir directory)))
+    (if (member ".git" contents) #t #f)))
+
+(define (hg-repository? directory)
+  "Check whether DIRECTORY is a Hg repository."
+  (let ((contents (scandir directory)))
+    (if (member ".hg" contents) #t #f)))
+
 (define (topological-sort nodes
                           node-dependencies
                           node-name)
-- 
2.32.0






This bug report was last modified 3 years and 345 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.