unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCHES] gnu: bootstrap: Fix egrep and fgrep in bootstrap binaries
@ 2015-01-07 14:02 Mark H Weaver
  2015-01-07 17:20 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Mark H Weaver @ 2015-01-07 14:02 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

The first of these two patches adds support for optional "snippets" to
'package-from-tarball', which is used to unpack the bootstrap tarballs.

The second patch uses this new feature to patch the shebangs in 'egrep'
and 'fgrep' immediately after unpacking the static-binaries bootstrap
tarball.

Obviously, this is for core-updates, the first 2 out of 6 remaining
patches needed for ARM.  It is a prerequisite for ARM support, because
'fgrep' is typically needed for ARM specific tests in configure scripts.

What do you think?

      Mark



[-- Attachment #2: [PATCH 1/2] gnu: bootstrap: Add support for snippets to 'package-from-tarball' --]
[-- Type: text/x-patch, Size: 2014 bytes --]

From 00e491bc64f6aa1fcebd19d1aa7370d1708d9d3a Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Wed, 31 Dec 2014 03:38:26 -0500
Subject: [PATCH 1/2] gnu: bootstrap: Add support for snippets to
 'package-from-tarball'.

* gnu/packages/bootstrap.scm (package-from-tarball): Add new keyword
  argument #:snippet.
---
 gnu/packages/bootstrap.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 5a19783..05444dd 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,10 +88,13 @@
                      (patch patch))
                     (origin-patches source))))))
 
-(define (package-from-tarball name source program-to-test description)
+(define* (package-from-tarball name source program-to-test description
+                               #:key snippet)
   "Return a package that correspond to the extraction of SOURCE.
 PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to
-check whether everything is alright."
+check whether everything is alright.  If SNIPPET is provided, it is
+evaluated after extracting SOURCE.  SNIPPET should return true if
+successful, or false to signal an error."
   (package
     (name name)
     (version "0")
@@ -112,6 +116,7 @@ check whether everything is alright."
            (with-directory-excursion out
              (and (zero? (system* tar "xvf"
                                   (string-append builddir "/binaries.tar")))
+                  ,@(if snippet (list snippet) '())
                   (zero? (system* (string-append "bin/" ,program-to-test)
                                   "--version"))))))))
     (inputs
-- 
2.1.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: [PATCH 2/2] gnu: bootstrap: Fix egrep and fgrep after unpacking bootstrap binaries --]
[-- Type: text/x-patch, Size: 1685 bytes --]

From 34412a7202cabafd25daaa045f70aa567e867d3b Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Wed, 31 Dec 2014 03:41:50 -0500
Subject: [PATCH 2/2] gnu: bootstrap: Fix egrep and fgrep after unpacking
 bootstrap binaries.

* gnu/packages/bootstrap.scm (%bootstrap-coreutils&co): Add #:snippet argument
  to 'package-from-tarball' that calls 'patch-shebang' on egrep and fgrep
  after unpacking.  Test 'fgrep' instead of 'true'.
---
 gnu/packages/bootstrap.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 05444dd..f1110d9 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -264,8 +264,15 @@ $out/bin/guile --version~%"
                               ("mips64el-linux"
                                (base32
                                 "072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
-                        "true"                    ; the program to test
-                        "Bootstrap binaries of Coreutils, Awk, etc."))
+                        "fgrep"                    ; the program to test
+                        "Bootstrap binaries of Coreutils, Awk, etc."
+                        #:snippet
+                        '(let ((path (list (string-append (getcwd) "/bin"))))
+                           (chmod "bin" #o755)
+                           (patch-shebang "bin/egrep" path)
+                           (patch-shebang "bin/fgrep" path)
+                           (chmod "bin" #o555)
+                           #t)))
 
 (define %bootstrap-binutils
   (package-from-tarball "binutils-bootstrap"
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHES] gnu: bootstrap: Fix egrep and fgrep in bootstrap binaries
  2015-01-07 14:02 [PATCHES] gnu: bootstrap: Fix egrep and fgrep in bootstrap binaries Mark H Weaver
@ 2015-01-07 17:20 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-01-07 17:20 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> From 00e491bc64f6aa1fcebd19d1aa7370d1708d9d3a Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> Date: Wed, 31 Dec 2014 03:38:26 -0500
> Subject: [PATCH 1/2] gnu: bootstrap: Add support for snippets to
>  'package-from-tarball'.
>
> * gnu/packages/bootstrap.scm (package-from-tarball): Add new keyword
>   argument #:snippet.

[...]

>             (with-directory-excursion out
>               (and (zero? (system* tar "xvf"
>                                    (string-append builddir "/binaries.tar")))
> +                  ,@(if snippet (list snippet) '())

I wonder if this should be:

  (begin ,@(if snippet (list snippet) '()))

No big deal though.  OK for this patch.

> From 34412a7202cabafd25daaa045f70aa567e867d3b Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> Date: Wed, 31 Dec 2014 03:41:50 -0500
> Subject: [PATCH 2/2] gnu: bootstrap: Fix egrep and fgrep after unpacking
>  bootstrap binaries.
>
> * gnu/packages/bootstrap.scm (%bootstrap-coreutils&co): Add #:snippet argument
>   to 'package-from-tarball' that calls 'patch-shebang' on egrep and fgrep
>   after unpacking.  Test 'fgrep' instead of 'true'.

OK.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-07 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 14:02 [PATCHES] gnu: bootstrap: Fix egrep and fgrep in bootstrap binaries Mark H Weaver
2015-01-07 17:20 ` Ludovic Courtès

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).