unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Janneke Nieuwenhuizen <janneke@gnu.org>
To: 64708@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#64708] [PATCH 3/8] gnu: commencement: Add git-fetch-from-tarball utility.
Date: Tue, 18 Jul 2023 15:14:59 +0200	[thread overview]
Message-ID: <161bab138845fe307ec92b8fea181e00ece86e58.1689685375.git.janneke@gnu.org> (raw)
In-Reply-To: <cover.1689685374.git.janneke@gnu.org>

From: Ludovic Courtès <ludo@gnu.org>

* gnu/packages/commencement.scm (git-fetch-from-tarball): New procedure.
---
 gnu/packages/commencement.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index d0603e62c8..1d69c2a80f 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -57,7 +57,10 @@ (define-module (gnu packages commencement)
   #:use-module (gnu packages xml)
   #:use-module (guix gexp)
   #:use-module (guix packages)
+  #:use-module ((guix store) #:select (%store-monad))
+  #:use-module (guix monads)
   #:use-module (guix download)
+  #:use-module ((guix git-download) #:select (git-reference git-file-name))
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
@@ -90,6 +93,34 @@ (define-module (gnu packages commencement)
 ;;;
 ;;; Code:
 
+(define* (git-fetch-from-tarball tarball)
+  (lambda* (url hash-algo hash
+                #:optional name
+                #:key (system (%current-system))
+                (guile %bootstrap-guile))
+    (mlet %store-monad ((guile (package->derivation guile system)))
+      (gexp->derivation
+       (or name "git-checkout")
+       (with-imported-modules '((guix build utils))
+         #~(begin
+             (use-modules (guix build utils)
+                          (ice-9 ftw)
+                          (ice-9 match))
+             (setenv "PATH"
+                     #+(file-append %bootstrap-coreutils&co "/bin"))
+             (invoke (string-append #+tar "/bin/tar")
+                     "xf" #$tarball)
+             (match (scandir ".")
+               (("." ".." directory)
+                (copy-recursively directory #$output)))))
+       #:recursive? #t
+       #:hash-algo hash-algo
+       #:hash hash
+       #:system system
+       #:guile-for-build guile
+       #:graft? #f
+       #:local-build? #t))))
+
 (define bootar
   (package
     (name "bootar")
-- 
2.40.1





  parent reply	other threads:[~2023-07-18 13:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 13:11 [bug#64708] [PATCH 0/8] Fix cross build and native build for the Hurd Janneke Nieuwenhuizen
2023-07-18 13:14 ` [bug#64708] [PATCH 1/8] gnu: commencement: Add autoconf-boot0 Janneke Nieuwenhuizen
2023-07-18 13:14 ` [bug#64708] [PATCH 2/8] gnu: commencement: Add automake-boot0 Janneke Nieuwenhuizen
2023-07-18 13:14 ` Janneke Nieuwenhuizen [this message]
2023-07-18 21:13   ` [bug#64708] [PATCH 0/8] Fix cross build and native build for the Hurd Ludovic Courtès
2023-07-19  9:11     ` Josselin Poiret via Guix-patches via
2023-07-18 13:15 ` [bug#64708] [PATCH 4/8] gnu: commencement: gnumach-headers-boot0: Update to 1.8+git20221224 Janneke Nieuwenhuizen
2023-07-18 21:16   ` [bug#64708] [PATCH 0/8] Fix cross build and native build for the Hurd Ludovic Courtès
2023-07-18 21:31     ` Janneke Nieuwenhuizen
2023-07-18 22:21       ` Ludovic Courtès
2023-07-19  5:00         ` Janneke Nieuwenhuizen
2023-07-18 13:15 ` [bug#64708] [PATCH 5/8] gnu: commencement: mig-boot0: Update to 1.8+git20230520 Janneke Nieuwenhuizen
2023-07-18 21:17   ` [bug#64708] [PATCH 0/8] Fix cross build and native build for the Hurd Ludovic Courtès
2023-07-18 13:15 ` [bug#64708] [PATCH 6/8] gnu: commencement: hurd-headers-boot0: Update to 0.9.git20230216 Janneke Nieuwenhuizen
2023-07-18 13:15 ` [bug#64708] [PATCH 7/8] gnu: commencement: hurd-minimal-boot0: " Janneke Nieuwenhuizen
2023-07-18 13:15 ` [bug#64708] [PATCH 8/8] gnu: mig: Update to 1.8+git20230520 Janneke Nieuwenhuizen
2023-07-18 21:20   ` [bug#64708] [PATCH 0/8] Fix cross build and native build for the Hurd Ludovic Courtès
2023-07-18 21:38     ` Janneke Nieuwenhuizen
2023-07-19  9:08       ` Josselin Poiret via Guix-patches via
2023-07-19  9:32         ` Janneke Nieuwenhuizen
2023-07-18 21:23 ` Ludovic Courtès
2023-07-19  5:53   ` bug#64708: " Janneke Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161bab138845fe307ec92b8fea181e00ece86e58.1689685375.git.janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=64708@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).