GNU bug report logs - #63145
[PATCH 1/3] gnu: maven-*-*: Fix - add missing shebang to the sisu.sh.

Previous Next

Package: guix-patches;

Reported by: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>

Date: Fri, 28 Apr 2023 13:14:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 63145 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Fri, 28 Apr 2023 13:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rostislav Svoboda <rostislav.svoboda <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 28 Apr 2023 13:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Rostislav Svoboda <Rostislav.Svoboda <at> gmail.com>
Subject: [PATCH 1/3] gnu: maven-*-*: Fix - add missing shebang to the sisu.sh.
Date: Fri, 28 Apr 2023 15:13:10 +0200
* gnu/packages/maven.scm
  - maven-settings-builder
  - maven-model-builder
  - maven-resolver-provider
  - maven-core-bootstrap
  - maven-embedder
  The sisu.sh script must have a shebang on the first line, otherwise an
  'In execvp of ...: Exec format error' is indicated.
---
 gnu/packages/maven.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index fc3a63c263..a3122bfa32 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1365,6 +1365,9 @@ (define-public maven-settings-builder
        #:test-dir "maven-settings-builder/src/test"
        #:phases
        (modify-phases %standard-phases
+         (add-before 'patch-source-shebangs 'add-missing-shebang
+           (lambda _
+             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
@@ -1396,6 +1399,9 @@ (define-public maven-model-builder
        #:test-dir "src/test"
        #:phases
        (modify-phases %standard-phases
+         (add-before 'patch-source-shebangs 'add-missing-shebang
+           (lambda _
+             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
          (add-before 'configure 'chdir
            (lambda _
              ;; Required for tests that rely on the package's default
@@ -1501,6 +1507,9 @@ (define-public maven-resolver-provider
        #:tests? #f; dependency loop on maven-core (@Component RepositorySystem)
        #:phases
        (modify-phases %standard-phases
+         (add-before 'patch-source-shebangs 'add-missing-shebang
+           (lambda _
+             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
@@ -1591,6 +1600,9 @@ (define-public maven-core-bootstrap
          #:tests? #f
          #:phases
          (modify-phases %standard-phases
+           (add-before 'patch-source-shebangs 'add-missing-shebang
+             (lambda _
+               (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
            (add-before 'configure 'chdir
              (lambda _
                ;; Required for generating components.xml in maven-core
@@ -1822,6 +1834,9 @@ (define-public maven-embedder
        #:jdk ,icedtea-8
        #:phases
        (modify-phases %standard-phases
+         (add-before 'patch-source-shebangs 'add-missing-shebang
+           (lambda _
+             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Fri, 28 Apr 2023 13:15:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Rostislav Svoboda <Rostislav.Svoboda <at> gmail.com>
Subject: [PATCH 2/3] gnu: maven-*-*: DRY add-missing-shebangs.
Date: Fri, 28 Apr 2023 15:13:11 +0200
* gnu/packages/maven.scm
  - maven-settings-builder
  - maven-model-builder
  - maven-resolver-provider
  - maven-core-bootstrap
  - maven-embedder
  Implement common functionality just once in the `add-missing-shebangs`.
---
 gnu/packages/maven.scm | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index a3122bfa32..6990d091cf 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1354,6 +1354,11 @@ (define-public maven-settings
 tool.  This package contains strictly the model for Maven settings, that is
 simply plain java objects.")))
 
+(define add-missing-shebang
+  `(lambda _
+     ;; -i, --in-place   edit files in place
+     (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+
 (define-public maven-settings-builder
   (package
     (inherit maven-artifact)
@@ -1366,8 +1371,7 @@ (define-public maven-settings-builder
        #:phases
        (modify-phases %standard-phases
          (add-before 'patch-source-shebangs 'add-missing-shebang
-           (lambda _
-             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+           ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
@@ -1400,8 +1404,7 @@ (define-public maven-model-builder
        #:phases
        (modify-phases %standard-phases
          (add-before 'patch-source-shebangs 'add-missing-shebang
-           (lambda _
-             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+           ,add-missing-shebang)
          (add-before 'configure 'chdir
            (lambda _
              ;; Required for tests that rely on the package's default
@@ -1508,8 +1511,7 @@ (define-public maven-resolver-provider
        #:phases
        (modify-phases %standard-phases
          (add-before 'patch-source-shebangs 'add-missing-shebang
-           (lambda _
-             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+           ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
@@ -1601,8 +1603,7 @@ (define-public maven-core-bootstrap
          #:phases
          (modify-phases %standard-phases
            (add-before 'patch-source-shebangs 'add-missing-shebang
-             (lambda _
-               (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+             ,add-missing-shebang)
            (add-before 'configure 'chdir
              (lambda _
                ;; Required for generating components.xml in maven-core
@@ -1835,8 +1836,7 @@ (define-public maven-embedder
        #:phases
        (modify-phases %standard-phases
          (add-before 'patch-source-shebangs 'add-missing-shebang
-           (lambda _
-             (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
+           ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
            (lambda _
              (mkdir-p "build/classes/META-INF/sisu")
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Fri, 28 Apr 2023 13:15:03 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Rostislav Svoboda <Rostislav.Svoboda <at> gmail.com>
Subject: [PATCH 3/3] gnu: maven-*-*: DRY generate-sisu-named.
Date: Fri, 28 Apr 2023 15:13:12 +0200
* gnu/packages/maven.scm
  - maven-settings-builder
  - maven-model-builder
  - maven-resolver-provider
  - maven-core-bootstrap
  - maven-embedder
  Implement common functionality just once in the `generate-sisu-named`.
---
 gnu/packages/maven.scm | 41 +++++++++++++----------------------------
 1 file changed, 13 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 6990d091cf..34a1fae4b5 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1359,6 +1359,14 @@ (define add-missing-shebang
      ;; -i, --in-place   edit files in place
      (invoke "sed" "-i" "1s;^;#!/bin/sh\\n\\n;" "./sisu.sh")))
 
+(define* (generate-sisu-named sisu-path #:optional (src-path ""))
+  (let ((sisu-sh (string-append sisu-path "sisu.sh")))
+    `(lambda _
+       (mkdir-p "build/classes/META-INF/sisu")
+       (chmod  ,sisu-sh #o755)
+       (invoke ,sisu-sh ,(string-append src-path "src/main/java")
+               "build/classes/META-INF/sisu/javax.inject.Named"))))
+
 (define-public maven-settings-builder
   (package
     (inherit maven-artifact)
@@ -1373,11 +1381,7 @@ (define-public maven-settings-builder
          (add-before 'patch-source-shebangs 'add-missing-shebang
            ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
-           (lambda _
-             (mkdir-p "build/classes/META-INF/sisu")
-             (chmod "sisu.sh" #o755)
-             (invoke "./sisu.sh" "maven-settings-builder/src/main/java"
-                     "build/classes/META-INF/sisu/javax.inject.Named")))
+           ,(generate-sisu-named "./" "maven-settings-builder/"))
          (replace 'install (install-from-pom "maven-settings-builder/pom.xml")))))
     (propagated-inputs
      (list java-plexus-utils
@@ -1416,11 +1420,7 @@ (define-public maven-model-builder
                                "build/classes")
              #t))
          (add-before 'build 'generate-sisu-named
-           (lambda _
-             (mkdir-p "build/classes/META-INF/sisu")
-             (chmod "../sisu.sh" #o755)
-             (invoke "../sisu.sh" "src/main/java"
-                     "build/classes/META-INF/sisu/javax.inject.Named")))
+           ,(generate-sisu-named "../"))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (propagated-inputs
@@ -1513,12 +1513,7 @@ (define-public maven-resolver-provider
          (add-before 'patch-source-shebangs 'add-missing-shebang
            ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
-           (lambda _
-             (mkdir-p "build/classes/META-INF/sisu")
-             (chmod "./sisu.sh" #o755)
-             (invoke "./sisu.sh" "maven-resolver-provider/src/main/java"
-                     "build/classes/META-INF/sisu/javax.inject.Named")
-             #t))
+           ,(generate-sisu-named "./" "maven-resolver-provider/"))
          (replace 'install
            (install-from-pom "maven-resolver-provider/pom.xml")))))
     (propagated-inputs
@@ -1627,12 +1622,7 @@ (define-public maven-core-bootstrap
                  (("\\$\\{distributionName\\}") "Apache Maven"))
                #t))
            (add-before 'build 'generate-sisu-named
-             (lambda _
-               (mkdir-p "build/classes/META-INF/sisu")
-               (chmod "../sisu.sh" #o755)
-               (invoke "../sisu.sh" "src/main/java"
-                       "build/classes/META-INF/sisu/javax.inject.Named")
-               #t))
+             ,(generate-sisu-named "../"))
            (add-before 'build 'generate-models
              (lambda* (#:key inputs #:allow-other-keys)
                (define (modello-single-mode file version mode)
@@ -1838,12 +1828,7 @@ (define-public maven-embedder
          (add-before 'patch-source-shebangs 'add-missing-shebang
            ,add-missing-shebang)
          (add-before 'build 'generate-sisu-named
-           (lambda _
-             (mkdir-p "build/classes/META-INF/sisu")
-             (chmod "sisu.sh" #o755)
-             (invoke "./sisu.sh" "maven-embedder/src/main/java"
-                     "build/classes/META-INF/sisu/javax.inject.Named")
-             #t))
+           ,(generate-sisu-named "./" "maven-embeder/"))
          (add-before 'build 'copy-resources
            (lambda _
              (mkdir-p "build/classes/")
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Fri, 28 Apr 2023 20:32:02 GMT) Full text and rfc822 format available.

Message #14 received at 63145 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
Cc: 63145 <at> debbugs.gnu.org
Subject: Re: bug#63145: [PATCH 1/3] gnu: maven-*-*: Fix - add missing
 shebang to the sisu.sh.
Date: Fri, 28 Apr 2023 22:30:53 +0200
Hi Rostislav,

I pushed patches minutes ago fixing the same thing:

  https://issues.guix.gnu.org/63094

They lack the nice factorization that you add, but they use
‘substitute*’ instead of calling out to ‘sed’, which is the preferred
way to do it.

We could definitely factorize along the lines of what you propose.
Would you like to update these two patches?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Sat, 29 Apr 2023 10:26:01 GMT) Full text and rfc822 format available.

Message #17 received at 63145 <at> debbugs.gnu.org (full text, mbox):

From: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 63145 <at> debbugs.gnu.org
Subject: Re: bug#63145: [PATCH 1/3] gnu: maven-*-*: Fix - add missing shebang
 to the sisu.sh.
Date: Sat, 29 Apr 2023 12:24:45 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

> We could definitely factorize along the lines of what you propose.
> Would you like to update these two patches?

Here are the updated patches.

Cheers Bost
[0002-gnu-maven-DRY-generate-sisu-named.patch (text/x-patch, attachment)]
[0001-gnu-maven-DRY-add-missing-shebang.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#63145; Package guix-patches. (Thu, 29 Jun 2023 21:25:01 GMT) Full text and rfc822 format available.

Message #20 received at 63145 <at> debbugs.gnu.org (full text, mbox):

From: Bruno Victal <mirai <at> makinata.eu>
To: Rostislav Svoboda <rostislav.svoboda <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 63145 <at> debbugs.gnu.org
Subject: Re: [bug#63145] [PATCH 1/3] gnu: maven-*-*: Fix - add missing shebang
 to the sisu.sh.
Date: Thu, 29 Jun 2023 22:24:29 +0100
Hi Rostislav,

On 2023-04-28 14:13, Rostislav Svoboda wrote:
> * gnu/packages/maven.scm
>   - maven-settings-builder
>   - maven-model-builder
>   - maven-resolver-provider
>   - maven-core-bootstrap
>   - maven-embedder
>   The sisu.sh script must have a shebang on the first line, otherwise an
>   'In execvp of ...: Exec format error' is indicated.

I think there's something strange going on with the maven-3.0-… packages, as I'm getting:

--8<---------------cut here---------------start------------->8---
## Guix commit is 94ac93042f09b4ba68b7b64ed1feeebd3dab1ea4.

$ ./pre-inst-env guix build maven-settings-builder <at> 3.0
…
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `generate-sisu-named'
phase `generate-sisu-named' succeeded after 0.1 seconds
starting phase `generate-components.xml'
In execvp of ./components.sh: Exec format error
error: in phase 'generate-components.xml': uncaught exception:
%exception #<&invoke-error program: "./components.sh" arguments: ("maven-settings-builder/src/main/java" "build/classes/META-INF/plexus/components.xml") exit-status: 127 term-signal: #f stop-signal: #f> 
phase `generate-components.xml' failed after 0.0 seconds
command "./components.sh" "maven-settings-builder/src/main/java" "build/classes/META-INF/plexus/components.xml" failed with status 127
builder for `/gnu/store/czr1iwlh0krl0qwskkg6s862x2r9shhy-maven-settings-builder-3.0.drv' failed with exit code 1
build of /gnu/store/czr1iwlh0krl0qwskkg6s862x2r9shhy-maven-settings-builder-3.0.drv failed
…

--8<---------------cut here---------------end--------------->8---


-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.





This bug report was last modified 300 days ago.

Previous Next


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