[PATCH v14 0/2] Add jpm.

  • Done
  • quality assurance status badge
Details
3 participants
  • jgart
  • Omar Bassam
  • Suhail Singh
Owner
unassigned
Submitted by
Suhail Singh
Severity
normal

Debbugs page

S
S
Suhail Singh wrote 5 days ago
(address . guix-patches@gnu.org)
cover.1736126524.git.suhail@bayesians.ca
Hello Guix,

This is same as v14 in #72925. Starting a new issue in the hope of
working around mumi issue [1].

Copying below cover-letter content from v14 in #72925 for convenience:

Toggle quote (49 lines)
> v14 is the same as v13, but has been rebased onto master.
>
> Given a profile containing only jpm, bash, coreutils-minimal and
> nss-certs and loading it using something like the below:
>
> #+begin_src sh
> guix shell --pure -CPWN \
> -E '.*GTK.*|.*XDG.*|.*DISPLAY.*|TERM|INSIDE_EMACS' \
> -p /path/to/profile
> #+end_src
>
>
> I have tested using the below commands:
>
> #+begin_src sh
> cd /tmp
> mkdir -p review-72925 && cd review-72925
> jpm install -l sh
> jpm install -l spork
> #+end_src
>
>
> For "sh", the below successfully works in janet repl which is loaded via
> "jpm -l repl":
>
> #+begin_src janet
> (import sh)
> (sh/$ touch foo.txt)
> #+end_src
>
>
> For spork, I the following example has been tested as working in a janet
> repl invoked via "jpm -l repl":
>
> #+begin_src janet
> (import spork/tasker)
>
> (def t (tasker/new-tasker))
>
> (ev/spawn
> (tasker/run-executors t))
>
> (tasker/queue-task t ["echo" "hello," "world"])
> (tasker/queue-task t ["echo" "hello," "world"])
> (tasker/queue-task t ["echo" "hello," "world"])
> (tasker/queue-task t ["sleep" "5"])
> #+end_src



Omar Bassam (1):
gnu: Add jpm package.

Suhail (1):
gnu: Improve user-experience for jpm.

gnu/packages/lisp.scm | 91 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)


base-commit: ddbb59f9bc5eb6dfaf1fc24881bb62f11960d664
S
S
Suhail Singh wrote on 7 Oct 2024 20:31
[PATCH v14 1/2] gnu: Add jpm package.
(address . 75394@debbugs.gnu.org)
cbc083aff26b193825734964a994a04b4212b8db.1736126524.git.suhail@bayesians.ca
* gnu/packages/lisp.scm (jpm): New variable.

Change-Id: I9f5ab89a38622689b5d3545abe5d87906dc61f3b
Signed-off-by: Suhail <suhail@bayesians.ca>
---
gnu/packages/lisp.scm | 73 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)

Toggle diff (98 lines)
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 9cc630eec2..f99ad68828 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -29,6 +29,7 @@
;;; Copyright © 2024 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2024 bigbug <bigbookofbug@proton.me>
;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
+;;; Copyright © 2024 Omar Bassam <omar.bassam88@gmail.com>
;;; Copyright © 2024 David Pflug <david@pflug.io>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;;
@@ -64,6 +65,7 @@ (define-module (gnu packages lisp)
#:use-module (guix build-system gnu)
#:use-module (guix build-system haskell)
#:use-module (guix build-system trivial)
+ #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
#:use-module (gnu packages admin)
#:use-module (gnu packages algebra)
#:use-module (gnu packages autotools)
@@ -919,6 +921,77 @@ (define-public janet
assembler, PEG) is less than 1MB.")
(license license:expat)))
+(define-public jpm
+ (package
+ (name "jpm")
+ (version "1.1.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/janet-lang/jpm")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "05rdxigmiy7vf93s16a8n2029lq33073jccz1rjl4iisxj6piw4l"))))
+ (build-system copy-build-system)
+ (arguments
+ (list
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "configs/linux_config.janet"
+ (("/usr/local")
+ #$output)
+ (("\"cc\"")
+ (string-append "\""
+ (search-input-file inputs "/bin/gcc")
+ "\""))
+ (("\"c\\+\\+\"")
+ (string-append "\""
+ (search-input-file inputs "/bin/g++")
+ "\""))
+ (("\"git\"")
+ (string-append "\""
+ (search-input-file inputs "/bin/git")
+ "\""))
+ (("\"curl\"")
+ (string-append "\""
+ (search-input-file inputs "/bin/curl")
+ "\"")))
+ (substitute* "jpm/shutil.janet"
+ (("cp")
+ (string-append (search-input-file inputs "/bin/cp"))))
+ (setenv "PREFIX"
+ #$output)))
+ (replace 'install
+ (lambda _
+ (for-each (lambda (dir)
+ (mkdir-p (string-append #$output "/" dir)))
+ '("lib/janet/jpm" "share/man/man1"))
+ (invoke "janet" "bootstrap.janet"
+ "configs/linux_config.janet")
+ (wrap-program (string-append #$output "/bin/jpm")
+ `("JANET_HEADERPATH" ":" =
+ (,(string-append #$janet "/include/janet")))
+ `("JANET_LIBPATH" ":" =
+ (,(string-append #$janet "/lib")))))))))
+ (inputs (list bash-minimal
+ coreutils-minimal
+ curl
+ gcc
+ git-minimal/pinned))
+ (propagated-inputs (list janet))
+ (native-search-paths
+ (list $SSL_CERT_DIR $SSL_CERT_FILE))
+ (home-page "https://janet-lang.org/")
+ (synopsis "Janet Project Manager for the Janet programming language")
+ (description
+ "@code{jpm} is the Janet Project Manager tool. It is a build
+tool and its main uses are installing dependencies, compiling C/C++ to native
+libraries, and other management tasks for Janet projects.")
+ (license license:expat)))
+
(define-public lisp-repl-core-dumper
(package
(name "lisp-repl-core-dumper")
S
S
Suhail Singh wrote on 7 Oct 2024 20:22
[PATCH v14 2/2] gnu: Improve user-experience for jpm.
(address . 75394@debbugs.gnu.org)
68d09c78846a198ba4499f89f53e4b3782208c9d.1736126524.git.suhail@bayesians.ca
* gnu/packages/lisp.scm (jpm): Ensure jpm respects JANET_HEADERPATH and
JANET_LIBPATH if set by user. Ensure gcc/g++ is able to find header files and
compilation-related utilities.

Change-Id: Ic7218dbd10e6fabddded50894b82492de8cabc88
---
gnu/packages/lisp.scm | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)

Toggle diff (59 lines)
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index f99ad68828..eb3063d3d9 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -30,6 +30,7 @@
;;; Copyright © 2024 bigbug <bigbookofbug@proton.me>
;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
;;; Copyright © 2024 Omar Bassam <omar.bassam88@gmail.com>
+;;; Copyright © 2024 Suhail Singh <suhail@bayesians.ca>
;;; Copyright © 2024 David Pflug <david@pflug.io>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;;
@@ -965,22 +966,39 @@ (define-public jpm
(setenv "PREFIX"
#$output)))
(replace 'install
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
(for-each (lambda (dir)
(mkdir-p (string-append #$output "/" dir)))
'("lib/janet/jpm" "share/man/man1"))
(invoke "janet" "bootstrap.janet"
"configs/linux_config.janet")
- (wrap-program (string-append #$output "/bin/jpm")
- `("JANET_HEADERPATH" ":" =
- (,(string-append #$janet "/include/janet")))
- `("JANET_LIBPATH" ":" =
- (,(string-append #$janet "/lib")))))))))
+ (let ((gcc-toolchain (assoc-ref inputs "gcc-toolchain"))
+ (core-min (assoc-ref inputs "coreutils-minimal")))
+ (wrap-program (string-append #$output "/bin/jpm")
+ `("JANET_HEADERPATH" ":" prefix
+ (,(string-append #$janet "/include/janet")))
+ `("JANET_LIBPATH" ":" prefix
+ (,(string-append #$janet "/lib")))
+ `("C_INCLUDE_PATH" ":" prefix
+ (,(string-append gcc-toolchain "/include")))
+ `("CPLUS_INCLUDE_PATH" ":" prefix
+ (,(string-append gcc-toolchain "/include/c++")
+ ,(string-append gcc-toolchain "/include")))
+ `("LIBRARY_PATH" ":" prefix
+ (,(string-append gcc-toolchain "/lib")
+ ,(string-append gcc-toolchain "/lib64")))
+ `("PATH" ":" prefix
+ (,(string-append gcc-toolchain "/bin")
+ ,(string-append core-min "/bin"))))))))))
(inputs (list bash-minimal
coreutils-minimal
curl
gcc
- git-minimal/pinned))
+ git-minimal/pinned
+ ;; Lazily resolve the gcc-toolchain to avoid a circular
+ ;; dependency.
+ (module-ref (resolve-interface '(gnu packages commencement))
+ 'gcc-toolchain)))
(propagated-inputs (list janet))
(native-search-paths
(list $SSL_CERT_DIR $SSL_CERT_FILE))
J
J
jgart wrote 5 days ago
Re: [PATCH v14 0/2] Add jpm.
(address . 75394-done@debbugs.gnu.org)(name . Suhail Singh)(address . suhailsingh247@gmail.com)
874j2csn85.fsf@dismail.de
Thanks! applied.

Should we add janet specific documentation in a follow up ticket somewhere?

--
all the best,
jgart
Closed
S
S
Suhail Singh wrote 4 days ago
(name . jgart)(address . jgart@dismail.de)
87o70j75f7.fsf@gmail.com
jgart <jgart@dismail.de> writes:

Toggle quote (2 lines)
> Should we add janet specific documentation

As in the "docs" target in the janet Makefile?

--
Suhail
Closed
J
J
jgart wrote 4 days ago
(name . Suhail Singh)(address . suhailsingh247@gmail.com)
9f8503607e764a20dd86dbb6cd2e9148baeffc08@dismail.de
Toggle quote (3 lines)
>
> As in the "docs" target in the janet Makefile?
>
I mean in the info manual for GNU Guix.

Do you intend to contribute a janet-build-system after this? In that case, then you can document any special instructions for using Guix with janet.

all best,

jgart
Attachment: file
Closed
S
S
Suhail Singh wrote 4 days ago
(name . jgart)(address . jgart@dismail.de)
87frlv721h.fsf@gmail.com
"jgart" <jgart@dismail.de> writes:

Toggle quote (2 lines)
> Do you intend to contribute a janet-build-system after this?

Not being a janet user, likely not any time soon. I wasn't even
intending to contribute jpm, I was simply helping review Omar's
submission. Omar had, at one point however, mentioned a
janet-build-system [1].

Toggle quote (3 lines)
> In that case, then you can document any special instructions for using
> Guix with janet.

I do agree that that would be helpful.


--
Suhail
Closed
O
O
Omar Bassam wrote 4 days ago
(name . Suhail Singh)(address . suhailsingh247@gmail.com)
877c77ccwy.fsf@gmail.com
Suhail Singh <suhailsingh247@gmail.com> writes:

Toggle quote (10 lines)
> "jgart" <jgart@dismail.de> writes:
>
>> Do you intend to contribute a janet-build-system after this?
>
> Not being a janet user, likely not any time soon. I wasn't even
> intending to contribute jpm, I was simply helping review Omar's
> submission. Omar had, at one point however, mentioned a
> janet-build-system [1].
>

Yes, Thanks Suhail, your reviews helped me alot. This was my first
contribution to guix and I learned alot from it.

I would like to contribute more to guix and would like to take building
a janet-build-system as a start. I would appreciate any guidance or
recommendations on where to start to learn about building a custom build
system.

Toggle quote (6 lines)
>> In that case, then you can document any special instructions for using
>> Guix with janet.
>
> I do agree that that would be helpful.
>

I am not sure where should such document be added?

Toggle quote (2 lines)
Many Thanks to all,
Omar Bassam
Closed
S
S
Suhail Singh wrote 2 days ago
Re: [bug#75394] [PATCH v14 0/2] Add jpm.
(name . Omar Bassam)(address . omar.bassam88@gmail.com)
87jzb5tja5.fsf@gmail.com
Omar Bassam <omar.bassam88@gmail.com> writes:

Toggle quote (2 lines)
> Yes, Thanks Suhail, your reviews helped me alot.

You're welcome :)

Toggle quote (5 lines)
> I would like to contribute more to guix and would like to take building
> a janet-build-system as a start. I would appreciate any guidance or
> recommendations on where to start to learn about building a custom build
> system.

I don't have any specific guidance other than to look at existing build
system definitions. Perhaps jgart has some thoughts?

Toggle quote (8 lines)
>>> In that case, then you can document any special instructions for using
>>> Guix with janet.
>>
>> I do agree that that would be helpful.
>>
>
> I am not sure where should such document be added?

I am no authority, but perhaps the Cookbook? Jgart, thoughts?

--
Suhail
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75394@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75394
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch