[PATCH] gnu: Add prips.

  • Done
  • quality assurance status badge
Details
3 participants
  • david larsson
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
david larsson
Severity
normal
D
D
david larsson wrote on 1 Apr 2021 15:11
(address . guix-patches@gnu.org)
f593d19bedfbb19ebba6ecad15981df2@selfhosted.xyz
From 22cc953d3e663bb842d5a0b970577a3d54f6fef1 Mon Sep 17 00:00:00 2001
From: methuselah-0 <david.larsson@selfhosted.xyz>
Date: Thu, 1 Apr 2021 15:10:45 +0200
Subject: [PATCH] gnu: Add prips.

* gnu/packages/admin.scm (prips): New variable.
---
gnu/packages/admin.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index df7973395d..f6cb62a568 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -39,6 +39,7 @@
;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hyunseok Kim <lasnesne@lagunposprasihopre.org>
+;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1019,6 +1020,39 @@ recursive runs on the generated subnets. (also
IPv6)
@end itemize\n")
(license license:bsd-3)))

+(define-public prips
+ (package
+ (name "prips")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://devel.ringlet.net/files/sys/"
+ name "/" name "-" version ".tar.xz"))
+ (sha256
+ (base32
"1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags (list "CC=gcc")
+ #:phases (modify-phases
+ %standard-phases
+ (delete 'configure)
+ (delete 'check)
+ (replace 'install
+ (lambda _
+ (let*
+ ((bin-dir (string-append %output "/bin"))
+ (bin-file (string-append bin-dir "/prips")))
+ (mkdir-p bin-dir)
+ (copy-file "prips" bin-file)
+ (chmod bin-file #o700)))))))
+ (synopsis "Tool that prints the IP addresses in a given range")
+ (description "Prips can be used to print all of the IP addresses in
+ a given range. This allows the enhancement of tools only work
+ on one host at a time (e.g. whois).")
+ (home-page "https://devel.ringlet.net/sysutils/prips/")
+ (license license:gpl2)))
+
(define-public alive
(package
(name "alive")
--
2.30.2
From 22cc953d3e663bb842d5a0b970577a3d54f6fef1 Mon Sep 17 00:00:00 2001
From: methuselah-0 <david.larsson@selfhosted.xyz>
Date: Thu, 1 Apr 2021 15:10:45 +0200
Subject: [PATCH] gnu: Add prips.

* gnu/packages/admin.scm (prips): New variable.
---
gnu/packages/admin.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (54 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index df7973395d..f6cb62a568 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -39,6 +39,7 @@
;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hyunseok Kim <lasnesne@lagunposprasihopre.org>
+;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1019,6 +1020,39 @@ recursive runs on the generated subnets. (also IPv6)
@end itemize\n")
(license license:bsd-3)))
+(define-public prips
+ (package
+ (name "prips")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://devel.ringlet.net/files/sys/"
+ name "/" name "-" version ".tar.xz"))
+ (sha256
+ (base32 "1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags (list "CC=gcc")
+ #:phases (modify-phases
+ %standard-phases
+ (delete 'configure)
+ (delete 'check)
+ (replace 'install
+ (lambda _
+ (let*
+ ((bin-dir (string-append %output "/bin"))
+ (bin-file (string-append bin-dir "/prips")))
+ (mkdir-p bin-dir)
+ (copy-file "prips" bin-file)
+ (chmod bin-file #o700)))))))
+ (synopsis "Tool that prints the IP addresses in a given range")
+ (description "Prips can be used to print all of the IP addresses in
+ a given range. This allows the enhancement of tools only work
+ on one host at a time (e.g. whois).")
+ (home-page "https://devel.ringlet.net/sysutils/prips/")
+ (license license:gpl2)))
+
(define-public alive
(package
(name "alive")
--
2.30.2
M
M
Maxime Devos wrote on 1 Apr 2021 21:44
94325c646a58888160ed6548dc5f646629e8374d.camel@telenet.be
Hi,

Some comments on the patch.

On Thu, 2021-04-01 at 15:11 +0200, david larsson wrote:
Toggle quote (17 lines)
> [...]
> +(define-public prips
> + (package
> + (name "prips")
> + (version "1.1.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (string-append "https://devel.ringlet.net/files/sys/"
> + name "/" name "-" version ".tar.xz"))
> + (sha256
> + (base32
> "1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
> + (build-system gnu-build-system)
> + (arguments
> + '(#:make-flags (list "CC=gcc")

As "CC=gcc" is a constant, I would write '("CC=gcc") here,
though admittedly this is largely a matter of taste.

Another problem: when cross-compiling, "gcc" will be a
compiler for the build system, not the host system (assuming
I got the terminology right). Instead, write

`(#:make-flags (list (string-append "CC" ,(cc-for-target)))
...)

(The quasiquote ` is important.)
(TODO to self: fix other packages that incorrectly set "CC=gcc" ...)

Toggle quote (3 lines)
> + #:phases (modify-phases
> + %standard-phases

%standard-phases shouldn't be on a separate line here.

Toggle quote (3 lines)
> + (delete 'configure)
> + (delete 'check)

Prips has some tests, so don't delete this phase.

Toggle quote (6 lines)
> + (replace 'install
> + (lambda _
> + (let*
> + ((bin-dir (string-append %output "/bin"))
> + (bin-file (string-append bin-dir "/prips")))

The ((bin-dir ...)) should be on the same line as 'let*'.

Toggle quote (4 lines)
> + (mkdir-p bin-dir)
> + (copy-file "prips" bin-file)
> + (chmod bin-file #o700)))))))

Why are you making bin/prips writable? Shouldn't this be
(chmod bin-file #o600) instead?

Toggle quote (4 lines)
> + (synopsis "Tool that prints the IP addresses in a given range")
> + (description "Prips can be used to print all of the IP addresses in
> + a given range. This allows the enhancement of tools only work

‘Enhancement’ is rather vague and leaning towards marketing-speak.
I do not have an alternative suggestion however.

Toggle quote (4 lines)
> + on one host at a time (e.g. whois).")
> + (home-page "https://devel.ringlet.net/sysutils/prips/")
> + (license license:gpl2)))

I looked at the source code and it seems prips is actually gpl2+.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYIADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYGYirhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uybAQCxoal1eunp70qhVEm7IQnbnP+P
tpvkpTfUHSVTquYNxwD+Mqj0hgYwCTQkhxLAKt2ni8I8NojCq1ilGXK7YZL5rwc=
=eMbV
-----END PGP SIGNATURE-----


D
D
david larsson wrote on 5 Apr 2021 15:09
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 47540@debbugs.gnu.org)
04a8eb1efe98cd5ada24e870b39a3671@selfhosted.xyz
On 2021-04-01 21:44, Maxime Devos wrote:

Toggle quote (14 lines)
>> + (arguments
>> + '(#:make-flags (list "CC=gcc")
>
> As "CC=gcc" is a constant, I would write '("CC=gcc") here,
> though admittedly this is largely a matter of taste.
> Another problem: when cross-compiling, "gcc" will be a
> compiler for the build system, not the host system (assuming
> I got the terminology right). Instead, write
>
> `(#:make-flags (list (string-append "CC" ,(cc-for-target)))
> ...)
>
> (The quasiquote ` is important.)

Fixed.

Toggle quote (5 lines)
>> + #:phases (modify-phases
>> + %standard-phases
>
> %standard-phases shouldn't be on a separate line here.

Fixed.

Toggle quote (6 lines)
>
>> + (delete 'configure)
>> + (delete 'check)
>
> Prips has some tests, so don't delete this phase.

I tried to fix but this fails.

Toggle quote (17 lines)
>
>> + (replace 'install
>> + (lambda _
>> + (let*
>> + ((bin-dir (string-append %output "/bin"))
>> + (bin-file (string-append bin-dir
>> "/prips")))
>
> The ((bin-dir ...)) should be on the same line as 'let*'.
>
>> + (mkdir-p bin-dir)
>> + (copy-file "prips" bin-file)
>> + (chmod bin-file #o700)))))))
>
> Why are you making bin/prips writable? Shouldn't this be
> (chmod bin-file #o600) instead?

I don't know for sure why that happened, but it's fixed to #o600 now.

Toggle quote (8 lines)
>> + (synopsis "Tool that prints the IP addresses in a given range")
>> + (description "Prips can be used to print all of the IP addresses
>> in
>> + a given range. This allows the enhancement of tools only work
>
> ‘Enhancement’ is rather vague and leaning towards marketing-speak.
> I do not have an alternative suggestion however.

This was an exact quote from website or something.

Toggle quote (4 lines)
>> + (license license:gpl2)))
>
> I looked at the source code and it seems prips is actually gpl2+.

Fixed.

Toggle quote (3 lines)
> Greetings,
> Maxime.

Thanks for your review!

This is what it looks like now, and failing the check phase:

(define-public prips
(package
(name "prips")
(version "1.1.1")
(source
(origin
(method url-fetch)
name "/" name "-" version ".tar.xz"))
(sha256
(base32
"1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
#:phases (modify-phases %standard-phases
(delete 'configure)
;(delete 'check)
(replace 'install
(lambda _
(let*
((bin-dir (string-append %output "/bin"))
(bin-file (string-append bin-dir "/prips")))
(mkdir-p bin-dir)
(copy-file "prips" bin-file)
(chmod bin-file #o600)))))))
(synopsis "Tool that prints the IP addresses in a given range")
(description "Prips can be used to print all of the IP addresses in
a given range. This allows the enhancement of tools only work
on one host at a time (e.g. whois).")
(license license:gpl2+)))

The logs:
---------------

starting phase `check'
make: *** No rule to make target 'check'. Stop.

Test suite failed, dumping logs.
command "make" "check" "-j" "2" "CC=gcc" failed with status 2



Best regards,
David

---------------
D
D
david larsson wrote on 5 Apr 2021 19:38
(name . Maxime Devos)(address . maximedevos@telenet.be)
ea92da0164f63dd67d800709a902cb18@selfhosted.xyz
Here's a new patch which has the fixes you mentioned, except I still
haven't readded the configure and test phases as I don't know how to
make them work.

Best regards,
David
From 87377a4918ab8c5fda939d0696e725425e32fee3 Mon Sep 17 00:00:00 2001
From: methuselah-0 <david.larsson@selfhosted.xyz>
Date: Mon, 5 Apr 2021 19:36:27 +0200
Subject: [PATCH] gnu: Add prips.

gnu/packages/admin.scm (prips): New variable.
---
gnu/packages/admin.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index df7973395d..fd5a661738 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -39,6 +39,7 @@
;;; Copyright ?? 2021 Stefan Reich??r <stefan@xsteve.at>
;;; Copyright ?? 2021 qblade <qblade@protonmail.com>
;;; Copyright ?? 2021 Hyunseok Kim <lasnesne@lagunposprasihopre.org>
+;;; Copyright ?? 2021 David Larsson <david.larsson@selfhosted.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1019,6 +1020,38 @@ recursive runs on the generated subnets. (also IPv6)
@end itemize\n")
(license license:bsd-3)))
+(define-public prips
+ (package
+ (name "prips")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://devel.ringlet.net/files/sys/"
+ name "/" name "-" version ".tar.xz"))
+ (sha256
+ (base32 "1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'check)
+ (replace 'install
+ (lambda _
+ (let*
+ ((bin-dir (string-append %output "/bin"))
+ (bin-file (string-append bin-dir "/prips")))
+ (mkdir-p bin-dir)
+ (copy-file "prips" bin-file)
+ (chmod bin-file #o600)))))))
+ (synopsis "Tool that prints the IP addresses in a given range")
+ (description "Prips can be used to print all of the IP addresses in
+ a given range. This allows the enhancement of tools only work
+ on one host at a time (e.g. whois).")
+ (home-page "https://devel.ringlet.net/sysutils/prips/")
+ (license license:gpl2+)))
+
(define-public alive
(package
(name "alive")
--
2.30.2
M
M
Maxime Devos wrote on 6 Apr 2021 16:04
(name . david larsson)(address . david.larsson@selfhosted.xyz)
96ad7a4cc63b104b2cc5eac5997b6ac2854fe101.camel@telenet.be
[...]
Toggle quote (13 lines)
> +(define-public prips
> + (package
> + (name "prips")
> + (version "1.1.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (string-append "https://devel.ringlet.net/files/sys/"
> + name "/" name "-" version ".tar.xz"))
> + (sha256
> + (base32 "1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
> + (build-system gnu-build-system)

Add ‘(native-inputs `(("perl-test-harness" ,perl-test-harness)))’ such that
the makefile can find the 'prove' binary.

Toggle quote (3 lines)
> + (arguments
> + `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))

Add ‘#:test-target "test"’ here, as the makefile has a 'test' target
instead of a 'check' target.

Toggle quote (4 lines)
> + #:phases (modify-phases %standard-phases
> + (delete 'configure)
> + (delete 'check)

and remove the (delete 'check).

The package now builds successfully for me.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYGxqaxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gz+AP9up3IG1370MAdxFkbp5eJpn6FL
o4e5VGaAagu1k4LcQwEA65WQ82qp2WON7l43zxSFLev+SYXBp+AtqUb56OWHEgc=
=OqGY
-----END PGP SIGNATURE-----


D
D
david larsson wrote on 8 Apr 2021 21:28
(name . Maxime Devos)(address . maximedevos@telenet.be)
444cc65de656858b59e577dce74009bb@selfhosted.xyz
On 2021-04-06 16:04, Maxime Devos wrote:

Toggle quote (4 lines)
> Add ‘(native-inputs `(("perl-test-harness" ,perl-test-harness)))’ such
> that
> the makefile can find the 'prove' binary.

Fixed.

Toggle quote (10 lines)
>
> Add ‘#:test-target "test"’ here, as the makefile has a 'test' target
> instead of a 'check' target.
>
>> + #:phases (modify-phases %standard-phases
>> + (delete 'configure)
>> + (delete 'check)
>
> and remove the (delete 'check).

Fixed.

Toggle quote (2 lines)
> The package now builds successfully for me.

For me as well.

Toggle quote (3 lines)
> Greetings,
> Maxime.

Thanks for your review and help with improving this package!

Best regards,
David
From 85cf7b9d22801d9b3bac8956b358fce4c32dcb4c Mon Sep 17 00:00:00 2001
From: methuselah-0 <david.larsson@selfhosted.xyz>
Date: Thu, 8 Apr 2021 21:26:23 +0200
Subject: [PATCH] gnu: Add prips.

gnu/packages/admin.scm (prips): New variable.
---
gnu/packages/admin.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (54 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index df7973395d..15ac8841c6 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -39,6 +39,7 @@
;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hyunseok Kim <lasnesne@lagunposprasihopre.org>
+;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1019,6 +1020,39 @@ recursive runs on the generated subnets. (also IPv6)
@end itemize\n")
(license license:bsd-3)))
+(define-public prips
+ (package
+ (name "prips")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://devel.ringlet.net/files/sys/"
+ name "/" name "-" version ".tar.xz"))
+ (sha256
+ (base32 "1a33vbl4w603mk6mm5r3vhk87fy3dfk5wdpch0yd3ncbkg3fmvqn"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
+ #:test-target "test"
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'install
+ (lambda _
+ (let*
+ ((bin-dir (string-append %output "/bin"))
+ (bin-file (string-append bin-dir "/prips")))
+ (mkdir-p bin-dir)
+ (copy-file "prips" bin-file)
+ (chmod bin-file #o600)))))))
+ (native-inputs `(("perl-test-harness" ,perl-test-harness)))
+ (synopsis "Tool that prints the IP addresses in a given range")
+ (description "Prips can be used to print all of the IP addresses in
+ a given range. This allows the enhancement of tools only work
+ on one host at a time (e.g. whois).")
+ (home-page "https://devel.ringlet.net/sysutils/prips/")
+ (license license:gpl2+)))
+
(define-public alive
(package
(name "alive")
--
2.30.2
L
L
Ludovic Courtès wrote on 12 Apr 2021 12:47
Re: bug#47540: [PATCH] gnu: Add prips.
(name . david larsson)(address . david.larsson@selfhosted.xyz)
87h7kbrd82.fsf_-_@gnu.org
Hi,

david larsson <david.larsson@selfhosted.xyz> skribis:

Toggle quote (7 lines)
> From 85cf7b9d22801d9b3bac8956b358fce4c32dcb4c Mon Sep 17 00:00:00 2001
> From: methuselah-0 <david.larsson@selfhosted.xyz>
> Date: Thu, 8 Apr 2021 21:26:23 +0200
> Subject: [PATCH] gnu: Add prips.
>
> gnu/packages/admin.scm (prips): New variable.

[...]

Toggle quote (9 lines)
> + (replace 'install
> + (lambda _
> + (let*
> + ((bin-dir (string-append %output "/bin"))
> + (bin-file (string-append bin-dir "/prips")))
> + (mkdir-p bin-dir)
> + (copy-file "prips" bin-file)
> + (chmod bin-file #o600)))))))

That installed a non-executable file. I fixed this with the patch
below, which also make the style more consistent.

Thanks David, and thanks Maxime for the review!

Ludo’.
Toggle diff (22 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index f3e8774b75..512ac320e6 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1070,13 +1070,10 @@ recursive runs on the generated subnets. (also IPv6)
#:phases (modify-phases %standard-phases
(delete 'configure)
(replace 'install
- (lambda _
- (let*
- ((bin-dir (string-append %output "/bin"))
- (bin-file (string-append bin-dir "/prips")))
- (mkdir-p bin-dir)
- (copy-file "prips" bin-file)
- (chmod bin-file #o600)))))))
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (install-file "prips"
+ (string-append out "/bin"))))))))
(native-inputs `(("perl-test-harness" ,perl-test-harness)))
(synopsis "Tool that prints the IP addresses in a given range")
(description "Prips can be used to print all of the IP addresses in
Closed
?