[PATCH] gnu: Add ncdu-ng.

  • Done
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • phodina
Owner
unassigned
Submitted by
phodina
Severity
normal
P
P
phodina wrote on 27 Jan 2022 15:22
(name . Guix Patches)(address . guix-patches@gnu.org)
6vXo33nNBkLPCf4VQTY3L-RrWG8JHPVjtgprEQk8vcmVXfDXty5cr6Dyj_qkc21iYmzHrVTKJukBnNWkx6FebmPZJyUZk3KBHaG5b2DksCM=@protonmail.com
Hello,

here is a patch for the ncdu. As version 2.0.* are based on Zig I decided to create a new variable instead of updating the old one.

FIY this is my first encounter with Zig and I just briefly swept through the documentation and I don't know if cross-compilation won't be an issue since the previous versions are just plain C.

If you think there is no need to do this and we can just simply update let me know and I'll send updated patch.

----
Petr
Attachment: file
From 3e6ad4ef4f928314bd69cae18a05be317e1b26ab Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Thu, 27 Jan 2022 14:56:39 +0100
Subject: [PATCH] gnu: Add ncdu-ng.

* gnu/packages/ncdu.scm (ncdu-ng): New variable.

Toggle diff (58 lines)
diff --git a/gnu/packages/ncdu.scm b/gnu/packages/ncdu.scm
index d6e4522bf0..01084976f0 100644
--- a/gnu/packages/ncdu.scm
+++ b/gnu/packages/ncdu.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,8 +21,10 @@
(define-module (gnu packages ncdu)
#:use-module (gnu packages)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages zig)
#:use-module (guix licenses)
#:use-module (guix packages)
+ #:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix build-system gnu))
@@ -49,3 +52,32 @@ (define-public ncdu
(string-append "https://g.blicky.net/ncdu.git/plain/COPYING?id=v"
version)))
(home-page "https://dev.yorhel.nl/ncdu")))
+
+(define-public ncdu-ng
+ (package
+ (inherit ncdu)
+ (name "ncdu-ng")
+ (version "2.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://dev.yorhel.nl/download/ncdu-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0j3w8xixz1zkzcpk0xrh6y3r7sii3h3y31lbvs5iqc5q7q6day9g"))))
+ (arguments
+ `(#:tests? #f
+ #:make-flags
+ (list (string-append "PREFIX="
+ (assoc-ref %outputs "out"))
+ ,(string-append "CC="
+ (cc-for-target)))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'set-home-dir
+ (lambda* _
+ ;; Zig caches build
+ (setenv "HOME" "/tmp")))
+ (delete 'configure))))
+ (native-inputs (list zig))
+ (inputs (list ncurses))))
--
2.34.0
E
E
Efraim Flashner wrote on 1 Feb 2022 12:03
(name . phodina)(address . phodina@protonmail.com)(address . 53583@debbugs.gnu.org)
YfkTjZs4XxhjVk98@3900XT
On Thu, Jan 27, 2022 at 02:22:58PM +0000, phodina via Guix-patches via wrote:
Toggle quote (8 lines)
> Hello,
>
> here is a patch for the ncdu. As version 2.0.* are based on Zig I decided to create a new variable instead of updating the old one.
>
> FIY this is my first encounter with Zig and I just briefly swept through the documentation and I don't know if cross-compilation won't be an issue since the previous versions are just plain C.
>
> If you think there is no need to do this and we can just simply update let me know and I'll send updated patch.

I also packaged ncdu@2 locally, to try out packaging a zig program. I
was unable to build zig for aarch64 due to the memory requirements
during the linking stage, so for now I agree it makes sense to have a
separate zig version and not just upgrade to the new version.

Also I'm attaching my copy if you want to take a look and see about
merging the two.

Toggle quote (71 lines)
> ----
> Petr

> From 3e6ad4ef4f928314bd69cae18a05be317e1b26ab Mon Sep 17 00:00:00 2001
> From: Petr Hodina <phodina@protonmail.com>
> Date: Thu, 27 Jan 2022 14:56:39 +0100
> Subject: [PATCH] gnu: Add ncdu-ng.
>
> * gnu/packages/ncdu.scm (ncdu-ng): New variable.
>
> diff --git a/gnu/packages/ncdu.scm b/gnu/packages/ncdu.scm
> index d6e4522bf0..01084976f0 100644
> --- a/gnu/packages/ncdu.scm
> +++ b/gnu/packages/ncdu.scm
> @@ -1,6 +1,7 @@
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
> ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
> +;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -20,8 +21,10 @@
> (define-module (gnu packages ncdu)
> #:use-module (gnu packages)
> #:use-module (gnu packages ncurses)
> + #:use-module (gnu packages zig)
> #:use-module (guix licenses)
> #:use-module (guix packages)
> + #:use-module (guix utils)
> #:use-module (guix download)
> #:use-module (guix build-system gnu))
>
> @@ -49,3 +52,32 @@ (define-public ncdu
> (string-append "https://g.blicky.net/ncdu.git/plain/COPYING?id=v"
> version)))
> (home-page "https://dev.yorhel.nl/ncdu")))
> +
> +(define-public ncdu-ng
> + (package
> + (inherit ncdu)
> + (name "ncdu-ng")
> + (version "2.0.1")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "https://dev.yorhel.nl/download/ncdu-"
> + version ".tar.gz"))
> + (sha256
> + (base32
> + "0j3w8xixz1zkzcpk0xrh6y3r7sii3h3y31lbvs5iqc5q7q6day9g"))))
> + (arguments
> + `(#:tests? #f
> + #:make-flags
> + (list (string-append "PREFIX="
> + (assoc-ref %outputs "out"))
> + ,(string-append "CC="
> + (cc-for-target)))
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'set-home-dir
> + (lambda* _
> + ;; Zig caches build
> + (setenv "HOME" "/tmp")))
> + (delete 'configure))))
> + (native-inputs (list zig))
> + (inputs (list ncurses))))
> --
> 2.34.0
>


--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il> ;;; ;;; This file is an addendum to GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (dfsg main ncdu) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (gnu packages ncdu) #:use-module (gnu packages perl) #:use-module (gnu packages zig)) (define-public ncdu-2 (package (inherit ncdu) (name "ncdu2") ; only to prevent it from being installed by accident (version "2.0.1") (source (origin (method url-fetch) (uri (string-append "https://dev.yorhel.nl/download/ncdu-" version ".tar.gz")) (sha256 (base32 "0j3w8xixz1zkzcpk0xrh6y3r7sii3h3y31lbvs5iqc5q7q6day9g")))) (arguments (list #:make-flags #~(list (string-append "PREFIX=" #$output) (string-append "CC=" #$(cc-for-target))) #:phases #~(modify-phases %standard-phases (delete 'configure) ; No configure script. (add-before 'build 'pre-build (lambda _ (setenv "ZIG_GLOBAL_CACHE_DIR" (mkdtemp "/tmp/zig-cache-XXXXXX")))) (add-after 'build 'build-manpage (lambda _ (delete-file "ncdu.1") (invoke "make" "doc"))) (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? (invoke "zig" "test" "build.zig"))))))) (native-inputs (list perl zig))))
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmH5E4sACgkQQarn3Mo9
g1FvOA//dE82l02yIesgvHx+mGxmzNpHlWK7zSlH45bLl7UZA/loKRScGTYXWqA3
OYtz/+FEAls1L8+mGTsOySarJoITLdRX+Rktn7/Pv/dRNPhguW9KaC4lNvr41g/v
ct7C3PkpxxJJURdLSJO+A4x6CAIhY41cX9eRNvF2OjxHmJiQ6StYhi3I0QvRlInQ
8lKbrF397UOCWLNCYvkvmjUZk1A27fYiOQYFP3iA7oY/9qbGkzhBTjKHHHUSEOdb
KQ8nB/EgfI3NUfmzUGyeAx/sQGGziOcrTLGMcWdJAh8Ya78jKuFwx0F+VtuxAx1l
6CT63n7k2cH7/of38PsaRxaPxkGfA05mOdno+Y5leClY6yth+l6VwNcscX0cFbKR
6yvkN08q77VRI4IfYk4NuxGczsPoXQOH4VxV0WbervMB+uWATP+HsozvGj23+Tsd
zZUfLrUuZGf7F6lHFj7X3DO1UxxByw61Z9OxGNYemmDXctysdKdl7uYWsO8LFPVa
3qevcnebrgLY9X4z8WVbxmQmj5ZAQlft/bTSLno31U5YvQeDZzc8+5dbeU70PUi2
DIwJgN4tOL507ZxhcOBkdB5OEmf1SuBzWetOclAXmexP0qbTCpJ8Y9n7dEzEgJy0
nSBwTmgdUpK4tPkaleceRBBP1m+fhlelqZDOS5/BUAWuE/Z/Aa8=
=pPI0
-----END PGP SIGNATURE-----


P
P
phodina wrote on 6 Feb 2022 08:19
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 53583@debbugs.gnu.org)
DTL3G5msimJ2yzzoNZrdh6XYo98F8B0atu1Ya5xsbxPTLuJOhu-8JIAHs6xC4hT6f0yIpz1znjqe40khu6PAvRYy0ar_ISucffJITo7kPMM=@protonmail.com
Hi Efraim,

Sent with ProtonMail Secure Email.

------- Original Message -------

On Tuesday, February 1st, 2022 at 12:03 PM, Efraim Flashner <efraim@flashner.co.il> wrote:

Toggle quote (167 lines)
> On Thu, Jan 27, 2022 at 02:22:58PM +0000, phodina via Guix-patches via wrote:
>
> > Hello,
> >
> > here is a patch for the ncdu. As version 2.0.* are based on Zig I decided to create a new variable instead of updating the old one.
> >
> > FIY this is my first encounter with Zig and I just briefly swept through the documentation and I don't know if cross-compilation won't be an issue since the previous versions are just plain C.
> >
> > If you think there is no need to do this and we can just simply update let me know and I'll send updated patch.
>
> I also packaged ncdu@2 locally, to try out packaging a zig program. I
>
> was unable to build zig for aarch64 due to the memory requirements
>
> during the linking stage, so for now I agree it makes sense to have a
>
> separate zig version and not just upgrade to the new version.
>
> Also I'm attaching my copy if you want to take a look and see about
>
> merging the two.
>
> > Petr
>
> > From 3e6ad4ef4f928314bd69cae18a05be317e1b26ab Mon Sep 17 00:00:00 2001
> >
> > From: Petr Hodina phodina@protonmail.com
> >
> > Date: Thu, 27 Jan 2022 14:56:39 +0100
> >
> > Subject: [PATCH] gnu: Add ncdu-ng.
> >
> > - gnu/packages/ncdu.scm (ncdu-ng): New variable.
> >
> > diff --git a/gnu/packages/ncdu.scm b/gnu/packages/ncdu.scm
> >
> > index d6e4522bf0..01084976f0 100644
> >
> > --- a/gnu/packages/ncdu.scm
> >
> > +++ b/gnu/packages/ncdu.scm
> >
> > @@ -1,6 +1,7 @@
> >
> > ;;; GNU Guix --- Functional package management for GNU
> >
> > ;;; Copyright © 2014 John Darrington jmd@gnu.org
> >
> > ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice me@tobias.gr
> >
> > +;;; Copyright © 2022 Petr Hodina phodina@protonmail.com
> >
> > ;;;
> >
> > ;;; This file is part of GNU Guix.
> >
> > ;;;
> >
> > @@ -20,8 +21,10 @@
> >
> > (define-module (gnu packages ncdu)
> >
> > #:use-module (gnu packages)
> >
> > #:use-module (gnu packages ncurses)
> >
> > - #:use-module (gnu packages zig)
> >
> > #:use-module (guix licenses)
> >
> > #:use-module (guix packages)
> > - #:use-module (guix utils)
> >
> > #:use-module (guix download)
> >
> > #:use-module (guix build-system gnu))
> >
> > @@ -49,3 +52,32 @@ (define-public ncdu
> >
> > (string-append "https://g.blicky.net/ncdu.git/plain/COPYING?id=v"
> >
> > version)))
> >
> > (home-page "https://dev.yorhel.nl/ncdu")))
> >
> > +
> >
> > +(define-public ncdu-ng
> >
> > - (package
> > - (inherit ncdu)
> > - (name "ncdu-ng")
> > - (version "2.0.1")
> > - (source (origin
> > - (method url-fetch)
> >
> >
> > - (uri (string-append "https://dev.yorhel.nl/download/ncdu-"
> >
> >
> > - version ".tar.gz"))
> >
> >
> > - (sha256
> >
> >
> > - (base32
> >
> >
> > - "0j3w8xixz1zkzcpk0xrh6y3r7sii3h3y31lbvs5iqc5q7q6day9g"))))
> >
> >
> > - (arguments
> > - `(#:tests? #f
> >
> >
> > - #:make-flags
> >
> >
> > - (list (string-append "PREFIX="
> >
> >
> > - (assoc-ref %outputs "out"))
> >
> >
> > - ,(string-append "CC="
> >
> >
> > - (cc-for-target)))
> >
> >
> > - #:phases
> >
> >
> > - (modify-phases %standard-phases
> >
> >
> > - (add-after 'unpack 'set-home-dir
> >
> >
> > - (lambda* _
> >
> >
> > - ;; Zig caches build
> >
> >
> > - (setenv "HOME" "/tmp")))
> >
> >
> > - (delete 'configure))))
> >
> >
> > - (native-inputs (list zig))
> > - (inputs (list ncurses))))
> >
> > --
> >
> > 2.34.0
>
> --
>
> Efraim Flashner efraim@flashner.co.il ????? ?????
>
> GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
>
> Confidentiality cannot be guaranteed on emails sent or received unencrypted

I've reviewed and tested your patch on x86_64 machine and it build successfully. I also wasn't able to build Zig on my ARM machines (Raspberry and PBP) so it should definitely have it's own definition (at least for now).

I agree with keeping a note why there number 2 in the name.

Thanks for the phase with setting ZIG_GLOBAL_CACHE_DIR as this what helpful in my understanding of Zig.

Otherwise the patch LGTM.

----
Petr
E
E
Efraim Flashner wrote on 6 Mar 2022 13:16
(name . phodina)(address . phodina@protonmail.com)(address . 53583-done@debbugs.gnu.org)
YiSmJHAJ8+FY0T7t@3900XT
ncdu2 pushed.

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmIkpiQACgkQQarn3Mo9
g1F7mxAAt1oIqqIJcZ/m0tx05LuLJLF3wCdsC+7m/cUbav0kSyRRzhxFbuL9xH5r
U40VTLm0DpHpWRKrMBDf3bsp5hMBLGtX2b9pu1VX2/+8BiddwVPQKi/O31oVHiVA
GXrxiG9jZ2NVnBbsk4HuySva5bFV9pUFFCYaqhIhhnXCf2jRKmRBd/kblvtEa8Oq
b2ciTjEkPRFt0h3WNgiUiMWul8W63mK6eGrFt/Kjpc7lXo3trChDz7scc8GyaIJF
+ExHBDBKblLic2eHjw/XJYu9hBzc2KwGGU9dKQzadsDoPguZ5OVYmcqLYFogiu+n
MF0KHjaxko6UYkt6d52bs/c0L907yOFH1YwFBlG471ZZpw5WCYn0oUnXgHxlVJQo
nKviHnA7Z4351jj9mxVZDkYjIzk9shAr+bstq18yO9ps2QxTF/w047RFHfRqoeNF
Xg92O4nCdF10Jx1eWN/BipjE9EeCE0TgPvoGwnLHUVQ8kOxcjtwDiAgWeq4dO50W
r7+umj/jxRBI7rPDSAcNlOGzx9uK6/vSPP0zdU3N8Mb0WxKbS0C9u/uB0niJYJqG
GWoQKsJ+ErZUHg7HKiE3T3rebryIhcr/REVLATNsnOCTLTbU47ZmIlEvBEwKvjPp
QHNgFW2rUkT2o14/6/BD7zUHX48Gtf0jWBruLXA9uq8NhEqi8Z0=
=u16P
-----END PGP SIGNATURE-----


Closed
?