Re: [PATCH] gnu: Add erlang.
I don't have anything else packaged. I've only dabbled with Erlang myself. You can start a REPL with: % erl -Steve On Mar 16, 2016 9:21 PM, "Leo Famulari" wrote: > On Wed, Mar 16, 2016 at 05:18:57PM -0700, Steve Sprang wrote: > > Oops, I didn't follow up on this. I made the suggested changes to the > > patch. I also bumped the version to 18.3, which has subsequently > > become available. > > This is awesome! > > Do you have any erlang programs packaged that we can try it out with? Or > is there some "hello world" thing I can try for this package? >
Re: [PATCH] gnu: Add erlang.
Oops, I didn't follow up on this. I made the suggested changes to the patch. I also bumped the version to 18.3, which has subsequently become available. -Steve On Sun, Feb 21, 2016 at 12:54 PM, Ludovic Courtès wrote: > Efraim Flashner skribis: > >> On Fri, 12 Feb 2016 19:44:46 -0500 >> Leo Famulari wrote: >> >>> On Sat, Feb 06, 2016 at 12:45:39PM -0800, Steve Sprang wrote: >>> > It looks like downloading the tarball from erlang.org works now. >>> > Here's an improved patch. >>> > + (lambda* _ >>> > + (let ((escripts >>> > + (append >>> > + (find-files "." "\\.escript") >>> > + (find-files "lib/stdlib/test/escript_SUITE_data/") >>> > + '("erts/lib_src/utils/make_atomics_api" >>> > + "erts/preloaded/src/add_abstract_code" >>> > + "lib/diameter/bin/diameterc" >>> > + "lib/reltool/examples/display_args" >>> > + "lib/reltool/examples/mnesia_core_dump_viewer" >>> > + "lib/snmp/src/compile/snmpc.src" >>> > + "make/verify_runtime_dependencies" >>> > + "make/emd2exml.in" >>> > + (substitute* escripts >>> > + (("/usr/bin/env") (which "env")) >>> > + (add-before >>> > + 'configure 'set-erl-top >>> > + (lambda* _ >>> > + (setenv "ERL_TOP" (getcwd) >>> >>> I _think_ that 'lambda _' would be appropriate here. I need a real >>> Schemer to weigh in ;) >>> >> >> I'm definately not a "real schemer," but since the lambda only leads into the >> let (ie. one item), I'm pretty sure 'lambda _' should be sufficient. > > Correct. ‘lambda*’ is for when one wants to use optional or keyword > arguments (info "(guile) lambda* and define*"). > > Ludo’. > From 4f96f16df0393d3bf03ec7e701d1c875565023cd Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sat, 6 Feb 2016 12:40:53 -0800 Subject: [PATCH] gnu: Add erlang. * gnu/packages/erlang.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/erlang.scm | 78 + 2 files changed, 79 insertions(+) create mode 100644 gnu/packages/erlang.scm diff --git a/gnu-system.am b/gnu-system.am index 634093a..7b2ca30 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -102,6 +102,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/enchant.scm \ gnu/packages/engineering.scm \ gnu/packages/enlightenment.scm \ + gnu/packages/erlang.scm \ gnu/packages/fcitx.scm \ gnu/packages/feh.scm \ gnu/packages/figlet.scm \ diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm new file mode 100644 index 000..35796fd --- /dev/null +++ b/gnu/packages/erlang.scm @@ -0,0 +1,78 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Steve Sprang +;;; +;;; This file is part of 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 (gnu packages erlang) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages perl) + #:use-module (gnu packages tls)) + +(define-public erlang + (package +(name "erlang") +(version "18.3") +(source (origin + (method url-fetch) + (uri (string-append +"http://erlang.org/download/otp_src_"; +version +".tar.gz")) + (sha256 + (base32 +"1hy9slq9gjvwdb504dmvp6rax90isnky6chqkyq5v4ybl4lq3azx" +(build-system
Re: [PATCH] gnu: Add erlang.
It looks like downloading the tarball from erlang.org works now. Here's an improved patch. -Steve On Thu, Jan 7, 2016 at 1:56 AM, Andy Wingo wrote: > On Wed 06 Jan 2016 17:07, l...@gnu.org (Ludovic Courtès) writes: > >> On Mon 04 Jan 2016 06:20, Steve Sprang writes: >> >>> From http://www.erlang.org/download/otp_src_18.2.1.tar.gz... >>> ERROR: Bad qstring header component: kMSMAn68110840 >> >> I think we should implement the proposed change. Could you look >> into it? > > Done on master in 6d7c09c8a9900794a855b9c69c57c3d1736506ed. I'd > cherry-pick back to 2.0 but I don't have a checkout on this machine; > please feel free :) > > Cheers, > > Andy From 0a1a045ef67e5e70d003c230c72b78a13e38b69b Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sat, 6 Feb 2016 12:40:53 -0800 Subject: [PATCH] gnu: Add erlang. * gnu/packages/erlang.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/erlang.scm | 80 + 2 files changed, 81 insertions(+) create mode 100644 gnu/packages/erlang.scm diff --git a/gnu-system.am b/gnu-system.am index 95150b6..0d00456 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -101,6 +101,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/enchant.scm \ gnu/packages/engineering.scm \ gnu/packages/enlightenment.scm \ + gnu/packages/erlang.scm \ gnu/packages/fcitx.scm \ gnu/packages/feh.scm \ gnu/packages/figlet.scm \ diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm new file mode 100644 index 000..ea36784 --- /dev/null +++ b/gnu/packages/erlang.scm @@ -0,0 +1,80 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Steve Sprang +;;; +;;; This file is part of 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 (gnu packages erlang) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages perl) + #:use-module (gnu packages tls)) + +(define-public erlang + (package +(name "erlang") +(version "18.2.1") +(source (origin + (method url-fetch) + (uri (string-append +"http://erlang.org/download/otp_src_"; +version +".tar.gz")) + (sha256 + (base32 +"16p37yylj8h5wvh251r71cw67b79l15a1wdhlm7bcpfsxsznxmw2" +(build-system gnu-build-system) +(native-inputs + `(("perl" ,perl))) +(inputs + `(("ncurses" ,ncurses) + ("openssl" ,openssl))) +(arguments + `(#:phases + (modify-phases %standard-phases + (add-after + 'patch-source-shebangs 'patch-source-env + (lambda* _ + (let ((escripts + (append + (find-files "." "\\.escript") + (find-files "lib/stdlib/test/escript_SUITE_data/") + '("erts/lib_src/utils/make_atomics_api" + "erts/preloaded/src/add_abstract_code" + "lib/diameter/bin/diameterc" + "lib/reltool/examples/display_args" + "lib/reltool/examples/mnesia_core_dump_viewer" + "lib/snmp/src/compile/snmpc.src" + "make/verify_runtime_dependencies" + "make/emd2exml.in" + (substitute* escripts + (("/usr/bin/env") (which "env")) + (add-before + 'configure 'set-erl-top + (lambda* _ + (setenv "ERL_TOP" (getcwd) + #:test-target "release_tests")) +(home-page "http://erlang.org/";) +(synopsis "The Erlang programming language") +(description + "Erlang is a programming language used to build massively +scalable soft real-time systems with requirements on high +availability. Some of its uses are in telecoms, banking, e-commerce, +computer telephony and instant messaging. Erlang's runtime system has +built-in support for concurrency, distribution and fault tolerance.") +(license license:asl2.0))) -- 2.6.3
Re: [PATCH] gnu: Add erlang.
I originally tried that tarball but I get an error downloading it: $ guix download http://www.erlang.org/download/otp_src_18.2.1.tar.gz >From http://www.erlang.org/download/otp_src_18.2.1.tar.gz... ERROR: Bad qstring header component: kMSMAn68110840 -Steve On Sun, Jan 3, 2016 at 8:39 PM, Leo Famulari wrote: > On Sun, Jan 03, 2016 at 07:56:07PM -0800, Steve Sprang wrote: >> Add the Erlang programming language. >> >> Is there a better way to substitute "/usr/bin/env" with (which "env")? >> There are a number of files throughout the source tree that require >> the substitution, but there's not a handy way to identify many of them >> without explicitly listing them. >> >> -Steve > >> From d31d3b2ece298b3e7610890390a7a12f865be881 Mon Sep 17 00:00:00 2001 >> From: Steve Sprang >> Date: Sun, 3 Jan 2016 19:46:40 -0800 >> Subject: [PATCH] gnu: Add erlang. >> >> * gnu/packages/erlang.scm: New file. >> * gnu-system.am (GNU_SYSTEM_MODULES): Add it. >> --- >> gnu-system.am | 1 + >> gnu/packages/erlang.scm | 82 >> + >> 2 files changed, 83 insertions(+) >> create mode 100644 gnu/packages/erlang.scm >> >> diff --git a/gnu-system.am b/gnu-system.am >> index c0f8fac..19d0ec5 100644 >> --- a/gnu-system.am >> +++ b/gnu-system.am >> @@ -99,6 +99,7 @@ GNU_SYSTEM_MODULES =\ > > [...] > >> +(native-inputs >> + `(("perl" ,perl) >> + ("autoconf" ,autoconf))) > > The tarball available on erlang.org is already bootstrapped. If we use > that one, we don't need to explicitly include autoconf and we don't need > the 'prep-configure phase. > > This seems to be the correct URL for downloading the current and past > releases (there is no "archive" directory linked anywhere that I saw): > http://www.erlang.org/download/otp_src_18.2.1.tar.gz > >> +(inputs >> + `(("ncurses" ,ncurses) >> + ("openssl" ,openssl))) >> +(arguments >> + `(#:phases >> + (modify-phases %standard-phases >> + (add-after >> + 'patch-source-shebangs 'patch-source-env >> +(lambda* _ >> + (let ((escripts >> + (append >> + (find-files "." "\\.escript") >> + (find-files "lib/stdlib/test/escript_SUITE_data/") >> + '("erts/lib_src/utils/make_atomics_api" >> +"erts/preloaded/src/add_abstract_code" >> +"lib/diameter/bin/diameterc" >> +"lib/reltool/examples/display_args" >> +"lib/reltool/examples/mnesia_core_dump_viewer" >> +"lib/snmp/src/compile/snmpc.src" >> +"make/verify_runtime_dependencies" >> +"make/emd2exml.in" >> +(substitute* escripts >> + (("/usr/bin/env") (which "env")) >> + (add-before >> + 'configure 'prep-configure >> +(lambda* _ >> + (setenv "ERL_TOP" (getcwd)) >> + (zero? (system* "./otp_build" "autoconf") >> + #:test-target "release_tests")) >> +(home-page "http://erlang.org/";) >> +(synopsis "The Erlang programming language") >> +(description >> + "Erlang is a programming language used to build massively >> +scalable soft real-time systems with requirements on high >> +availability. Some of its uses are in telecoms, banking, e-commerce, >> +computer telephony and instant messaging. Erlang's runtime system has >> +built-in support for concurrency, distribution and fault tolerance.") >> +(license license:asl2.0))) >> -- >> 2.6.3 >> >
[PATCH] gnu: Add erlang.
Add the Erlang programming language. Is there a better way to substitute "/usr/bin/env" with (which "env")? There are a number of files throughout the source tree that require the substitution, but there's not a handy way to identify many of them without explicitly listing them. -Steve From d31d3b2ece298b3e7610890390a7a12f865be881 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sun, 3 Jan 2016 19:46:40 -0800 Subject: [PATCH] gnu: Add erlang. * gnu/packages/erlang.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/erlang.scm | 82 + 2 files changed, 83 insertions(+) create mode 100644 gnu/packages/erlang.scm diff --git a/gnu-system.am b/gnu-system.am index c0f8fac..19d0ec5 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -99,6 +99,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/enchant.scm \ gnu/packages/engineering.scm \ gnu/packages/enlightenment.scm \ + gnu/packages/erlang.scm \ gnu/packages/fcitx.scm \ gnu/packages/feh.scm \ gnu/packages/figlet.scm \ diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm new file mode 100644 index 000..9349363 --- /dev/null +++ b/gnu/packages/erlang.scm @@ -0,0 +1,82 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Steve Sprang +;;; +;;; This file is part of 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 (gnu packages erlang) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages autotools) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages perl) + #:use-module (gnu packages tls)) + +(define-public erlang + (package +(name "erlang") +(version "18.2.1") +(source (origin + (method url-fetch) + (uri (string-append +"https://github.com/erlang/otp/archive/OTP-"; + version ".tar.gz")) + (sha256 + (base32 +"101jpgyd2qvpi12ckxkxhs12n9lv7wc4vi8mrdh7b4q54vvdf1r2" +(build-system gnu-build-system) +(native-inputs + `(("perl" ,perl) + ("autoconf" ,autoconf))) +(inputs + `(("ncurses" ,ncurses) + ("openssl" ,openssl))) +(arguments + `(#:phases + (modify-phases %standard-phases + (add-after + 'patch-source-shebangs 'patch-source-env + (lambda* _ + (let ((escripts + (append + (find-files "." "\\.escript") + (find-files "lib/stdlib/test/escript_SUITE_data/") + '("erts/lib_src/utils/make_atomics_api" + "erts/preloaded/src/add_abstract_code" + "lib/diameter/bin/diameterc" + "lib/reltool/examples/display_args" + "lib/reltool/examples/mnesia_core_dump_viewer" + "lib/snmp/src/compile/snmpc.src" + "make/verify_runtime_dependencies" + "make/emd2exml.in" + (substitute* escripts + (("/usr/bin/env") (which "env")) + (add-before + 'configure 'prep-configure + (lambda* _ + (setenv "ERL_TOP" (getcwd)) + (zero? (system* "./otp_build" "autoconf") + #:test-target "release_tests")) +(home-page "http://erlang.org/";) +(synopsis "The Erlang programming language") +(description + "Erlang is a programming language used to build massively +scalable soft real-time systems with requirements on high +availability. Some of its uses are in telecoms, banking, e-commerce, +computer telephony and instant messaging. Erlang's runtime system has +built-in support for concurrency, distribution and fault tolerance.") +(license license:asl2.0))) -- 2.6.3
Re: [PATCH] download: Fix some minor progress-logging regressions.
This patch is still pending. I don't want it to fall through the cracks. :-) Thanks! -Steve On Thu, Sep 17, 2015 at 2:44 PM, Mathieu Lirzin wrote: > Steve Sprang writes: > >> Here's attempt #2. > [...] >> @@ -101,15 +101,14 @@ width of the bar is BAR-WIDTH." >> >> (define (string-pad-middle left right len) >>"Combine LEFT and RIGHT with enough padding in the middle so that the >> -resulting string has length at least LEN. This right justifies RIGHT." >> - (string-append left >> - (string-pad right (max 0 (- len (string-length left)) >> - >> -(define (store-url-abbreviation url) >> - "Return a friendlier version of URL for display." >> - (let ((store-path (string-append (%store-directory) "/" (basename url >> -;; Take advantage of the implementation for store paths. >> -(store-path-abbreviation store-path))) >> +resulting string has length at least LEN (it may overflow). If the string >> +does not overflow, the last char in RIGHT will be flush with the LEN >> +column." >> + (let* ((total-used (+ (string-length left) >> +(string-length right))) >> + (num-spaces (max 1 (- len total-used))) >> + (padding(make-string num-spaces #\space))) >> +(string-append left padding right))) > > The phrasing is fine for me. Thanks again. > > -- > Mathieu Lirzin
Re: [PATCH] download: Fix some minor progress-logging regressions.
Here's attempt #2. -Steve On Thu, Sep 17, 2015 at 12:44 PM, Steve Sprang wrote: > On Thu, Sep 17, 2015 at 11:18 AM, Mathieu Lirzin wrote: >> Steve Sprang writes: >> >>> From 11440f61cebd49d31d165f6433ec6e4b1afe728f Mon Sep 17 00:00:00 2001 >>> From: Steve Sprang >>> Date: Thu, 17 Sep 2015 04:22:01 -0700 >>> Subject: [PATCH] download: Fix some minor progress-logging regressions. >>> >>> * guix/build/download.scm >>> (string-pad-middle): Allow resulting padded string to overflow. >>> (store-url-abbreviation): Remove unnecessary procedure. >>> (progress-proc): Default abbreviation should be basename. >> >> What about something like "(progress-proc): Use BASENAME as default for >> parameter 'abbreviation'." ? > > Ok, sounds good. > >>> (url-fetch): Insert some newlines for readability. >> >> I would prefer "Display" instead of "Insert" to not confuse with >> insertion of newlines in the source code (even if such change won't be >> notified in the commit log) :) > > Ok. > >>> --- >>> guix/build/download.scm | 20 +--- >>> 1 file changed, 9 insertions(+), 11 deletions(-) >>> >>> diff --git a/guix/build/download.scm b/guix/build/download.scm >>> index 9b72e8f..e6de4d2 100644 >>> --- a/guix/build/download.scm >>> +++ b/guix/build/download.scm >>> @@ -100,15 +100,13 @@ width of the bar is BAR-WIDTH." >>> >>> (define (string-pad-middle left right len) >>>"Combine LEFT and RIGHT with enough padding in the middle so that the >>> -resulting string has length at least LEN. This right justifies RIGHT." >> ^^^ >> Maybe it's only because of my poor english but I don't understand the >> meaning of the last sentence. > > Yes, the phrasing is awkward. Basically the effect is that the RIGHT > string will be flush with the right edge when the string is LEN width > (i.e. it is right-justified as in typography). I will try to phrase it > better. > > I have to head out for the moment, but I will send a tweaked patch later > today. > > -Steve > >> Otherwise this looks good to me. >> >> -- >> Mathieu Lirzin From 65fe041c63a58ae5c72ef33f05349ca04afa470b Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Thu, 17 Sep 2015 04:22:01 -0700 Subject: [PATCH] download: Fix some minor progress-logging regressions. * guix/build/download.scm (string-pad-middle): Allow resulting padded string to overflow. (store-url-abbreviation): Remove unnecessary procedure. (progress-proc): Use BASENAME as default for parameter 'abbreviation'. (url-fetch): Display extra newlines for readability. --- guix/build/download.scm | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index d362fc1..be4a581 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -101,15 +101,14 @@ width of the bar is BAR-WIDTH." (define (string-pad-middle left right len) "Combine LEFT and RIGHT with enough padding in the middle so that the -resulting string has length at least LEN. This right justifies RIGHT." - (string-append left - (string-pad right (max 0 (- len (string-length left)) - -(define (store-url-abbreviation url) - "Return a friendlier version of URL for display." - (let ((store-path (string-append (%store-directory) "/" (basename url -;; Take advantage of the implementation for store paths. -(store-path-abbreviation store-path))) +resulting string has length at least LEN (it may overflow). If the string +does not overflow, the last char in RIGHT will be flush with the LEN +column." + (let* ((total-used (+ (string-length left) +(string-length right))) + (num-spaces (max 1 (- len total-used))) + (padding(make-string num-spaces #\space))) +(string-append left padding right))) (define* (store-path-abbreviation store-path #:optional (prefix-length 6)) "Return an abbreviation of STORE-PATH for display, showing PREFIX-LENGTH @@ -121,7 +120,7 @@ characters of the hash." (define* (progress-proc file size #:optional (log-port (current-output-port)) -#:key (abbreviation identity)) +#:key (abbreviation basename)) "Return a procedure to show the progress of FILE's download, which is SIZE bytes long. The returned procedure is suitable for use as an argument to `dump-port'. The progress report is written to LOG-PORT, with ABBREVIATION @@ -519,7 +518,7 @@ on success." (_ (list (string->uri url)) (define (fetch uri file) -(format #t "starting download of `~a' from `~a'...~%" +(format #t "~%Starting download of ~a~%From ~a...~%" file (uri->string uri)) (case (uri-scheme uri) ((http https) -- 2.5.0
Re: [PATCH] download: Fix some minor progress-logging regressions.
On Thu, Sep 17, 2015 at 11:18 AM, Mathieu Lirzin wrote: > Steve Sprang writes: > >> From 11440f61cebd49d31d165f6433ec6e4b1afe728f Mon Sep 17 00:00:00 2001 >> From: Steve Sprang >> Date: Thu, 17 Sep 2015 04:22:01 -0700 >> Subject: [PATCH] download: Fix some minor progress-logging regressions. >> >> * guix/build/download.scm >> (string-pad-middle): Allow resulting padded string to overflow. >> (store-url-abbreviation): Remove unnecessary procedure. >> (progress-proc): Default abbreviation should be basename. > > What about something like "(progress-proc): Use BASENAME as default for > parameter 'abbreviation'." ? Ok, sounds good. >> (url-fetch): Insert some newlines for readability. > > I would prefer "Display" instead of "Insert" to not confuse with > insertion of newlines in the source code (even if such change won't be > notified in the commit log) :) Ok. >> --- >> guix/build/download.scm | 20 +--- >> 1 file changed, 9 insertions(+), 11 deletions(-) >> >> diff --git a/guix/build/download.scm b/guix/build/download.scm >> index 9b72e8f..e6de4d2 100644 >> --- a/guix/build/download.scm >> +++ b/guix/build/download.scm >> @@ -100,15 +100,13 @@ width of the bar is BAR-WIDTH." >> >> (define (string-pad-middle left right len) >>"Combine LEFT and RIGHT with enough padding in the middle so that the >> -resulting string has length at least LEN. This right justifies RIGHT." > ^^^ > Maybe it's only because of my poor english but I don't understand the > meaning of the last sentence. Yes, the phrasing is awkward. Basically the effect is that the RIGHT string will be flush with the right edge when the string is LEN width (i.e. it is right-justified as in typography). I will try to phrase it better. I have to head out for the moment, but I will send a tweaked patch later today. -Steve > Otherwise this looks good to me. > > -- > Mathieu Lirzin
[PATCH] download: Fix some minor progress-logging regressions.
Just some small tweaks to fix up logging. -Steve From 11440f61cebd49d31d165f6433ec6e4b1afe728f Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Thu, 17 Sep 2015 04:22:01 -0700 Subject: [PATCH] download: Fix some minor progress-logging regressions. * guix/build/download.scm (string-pad-middle): Allow resulting padded string to overflow. (store-url-abbreviation): Remove unnecessary procedure. (progress-proc): Default abbreviation should be basename. (url-fetch): Insert some newlines for readability. --- guix/build/download.scm | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 9b72e8f..e6de4d2 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -100,15 +100,13 @@ width of the bar is BAR-WIDTH." (define (string-pad-middle left right len) "Combine LEFT and RIGHT with enough padding in the middle so that the -resulting string has length at least LEN. This right justifies RIGHT." - (string-append left - (string-pad right (max 0 (- len (string-length left)) - -(define (store-url-abbreviation url) - "Return a friendlier version of URL for display." - (let ((store-path (string-append (%store-directory) "/" (basename url -;; Take advantage of the implementation for store paths. -(store-path-abbreviation store-path))) +resulting string has length at least LEN (it may overflow). This right +justifies RIGHT." + (let* ((total-used (+ (string-length left) +(string-length right))) + (num-spaces (max 1 (- len total-used))) + (padding(make-string num-spaces #\space))) +(string-append left padding right))) (define* (store-path-abbreviation store-path #:optional (prefix-length 6)) "Return an abbreviation of STORE-PATH for display, showing PREFIX-LENGTH @@ -120,7 +118,7 @@ characters of the hash." (define* (progress-proc file size #:optional (log-port (current-output-port)) -#:key (abbreviation identity)) +#:key (abbreviation basename)) "Return a procedure to show the progress of FILE's download, which is SIZE bytes long. The returned procedure is suitable for use as an argument to `dump-port'. The progress report is written to LOG-PORT, with ABBREVIATION @@ -518,7 +516,7 @@ on success." (_ (list (string->uri url)) (define (fetch uri file) -(format #t "starting download of `~a' from `~a'...~%" +(format #t "~%Starting download of ~a~%From ~a...~%" file (uri->string uri)) (case (uri-scheme uri) ((http https) -- 2.5.0
[PATCH] download: Only show hours in the elapsed time if necessary.
Drop hours from the elapsed time (unless necessary) since most downloads will be much faster than that. -Steve From 5f4cafc1c0b6d261b0f19a77c64e8700784c8d9a Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Wed, 16 Sep 2015 20:43:58 -0700 Subject: [PATCH] download: Only show hours in the elapsed time if necessary. * guix/build/download.scm (seconds->string): Conditionally include hours in timestamp. --- guix/build/download.scm | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 9b72e8f..d362fc1 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -63,16 +63,17 @@ object, as an inexact number." (/ (time-nanosecond duration) 1e9))) (define (seconds->string duration) - "Given DURATION in seconds, return a string representing it in 'hh:mm:ss' -format." + "Given DURATION in seconds, return a string representing it in 'mm:ss' or +'hh:mm:ss' format, as needed." (if (not (number? duration)) - "00:00:00" + "00:00" (let* ((total-seconds (nearest-exact-integer duration)) (extra-seconds (modulo total-seconds 3600)) - (hours (quotient total-seconds 3600)) + (num-hours (quotient total-seconds 3600)) + (hours (and (positive? num-hours) num-hours)) (mins (quotient extra-seconds 60)) (secs (modulo extra-seconds 60))) -(format #f "~2,'0d:~2,'0d:~2,'0d" hours mins secs +(format #f "~@[~2,'0d:~]~2,'0d:~2,'0d" hours mins secs (define (byte-count->string size) "Given SIZE in bytes, return a string representing it in a human-readable -- 2.5.0
Re: [PATCH] substitute: Improve readability of substitute-related output.
Thanks for the feedback! Here's an updated patch. Let me know if I missed anything. I agree that we can drop hours from the elapsed time (or adaptively add them if needed). I will send a fix for that in a subsequent patch. On Tue, Sep 15, 2015 at 1:22 AM, Ludovic Courtès wrote: > Steve Sprang skribis: > > > I added newlines to split up output and visually separate multiple > > substitutions. Since the download size is unknown, we can't use a > progress > > bar, but I made the output more consistent with the progress bar > behavior. > > I also shortened the hash after it's been repeated in full twice (once > for > > the store and once for the download URL). > > Nice. > > > Patched behavior: > > > > Found valid signature for > > /gnu/store/sin6c3n1440f8kza0k4hdms38fbb4dv0-boost-1.58.0 > > From > http://hydra.gnu.org/nar/sin6c3n1440f8kza0k4hdms38fbb4dv0-boost-1.58.0 > > Downloading sin6c3…boost-1.58.0 (110.6MiB installed)... > > sin6c3…boost-1.58.0 911KiB/s 00:00:11 | 9.4MiB > > transferred > > Looks good to me. > > Regarding elapsed time, I wonder if we should get rid of hours–i.e., > print “00:11” in this case. Most of the time downloads last less than > an hour, and when it lasts more, it’s OK to either print 100:11 or > 01:03:11. WDYT? > > > From 95936bf25394d2985f9331cb8fa08d5b30cb64a5 Mon Sep 17 00:00:00 2001 > > From: Steve Sprang > > Date: Mon, 14 Sep 2015 22:31:11 -0700 > > Subject: [PATCH] substitute: Improve readability of substitute-related > output. > > > > * guix/build/download.scm (flexible-space, truncated-url): New > procedures. > > (progress-proc): Generate a better indeterminate progress string. > > (nearest-exact-integer, seconds->string, byte-count->string): Move > to... > > * guix/utils.scm: ...here. > > * guix/store.scm (truncated-store-path): New procedure. > > * guix/scripts/substitute.scm (assert-valid-narinfo): Add newlines to > output. > > (process-substitution): Use byte-count->string and > truncated-store-path. > > In general, it is best to make a separate patch that simply moves > procedures from one file to another. > > However, most of the time, (guix build …) modules must not use (guix …) > modules (info "(guix) G-Expressions"). This is the case here. > > So what I would suggest is to export those helper procedures from (guix > build download) itself, as is done for ‘progress-proc’ et al. > > > +(define* (flexible-space left right #:optional (columns 80)) > > + "Return a string of spaces which can be used to separate LEFT and > RIGHT so > > +that RIGHT is justified to a width of COLUMNS." > > What about this slightly more idiomatic procedure instead: > > (define (string-pad-middle left right len) > ;; + docstring > (string-append left >(string-pad right (max 0 (- len (string-length > left)) > > > +(define (truncated-url url) > > + "Return a friendlier version of URL for display." > > + (let ((store-path (string-append (%store-prefix) "/" (basename url > > +;; take advantage of the implementation for store paths > > +(truncated-store-path store-path))) > > What about calling it ‘store-url-abbreviation’, to convey that it’s > similar in spirit to ‘uri-abbreviation’, but specialized? > > > (define* (progress-proc file size #:optional (log-port > (current-output-port))) > >"Return a procedure to show the progress of FILE's download, which is > SIZE > > bytes long. The returned procedure is suitable for use as an argument > to > > @@ -130,24 +115,26 @@ bytes long. The returned procedure is suitable > for use as an argument to > > (seconds->string elapsed) > > (progress-bar %) %)) > > ;; TODO: Make this adapt to the actual terminal > width. > > - (cols 80) > > - (num-spaces (max 1 (- cols (+ (string-length left) > > - (string-length > right) > > - (gap(make-string num-spaces #\space))) > > + (gap(flexible-space left right))) > > (format log-port "~a~a~a" left gap right) > > This would become: > > (display (string-pad-middle left right cols) log-port) > > Could you send an updated patch? > > Thank you! > > Ludo’. > From c8a04ac71e347de49a2795c4ef503a5abac2f882 Mon S
[PATCH] substitute: Improve readability of substitute-related output.
Here's my attempt at making substitute-related logging a little easier to grok. I added newlines to split up output and visually separate multiple substitutions. Since the download size is unknown, we can't use a progress bar, but I made the output more consistent with the progress bar behavior. I also shortened the hash after it's been repeated in full twice (once for the store and once for the download URL). Current behavior: found valid signature for '/gnu/store/ayad3km6vzv70777icacgx0jzlyfsr8z-python2-pyicu-1.8', from ' http://hydra.gnu.org/nar/ayad3km6vzv70777icacgx0jzlyfsr8z-python2-pyicu-1.8' downloading `/gnu/store/ayad3km6vzv70777icacgx0jzlyfsr8z-python2-pyicu-1.8' (0.8 MiB installed)... http://hydra.gnu.org/nar/ayad3km6vzv70777icacgx0jzlyfsr8z-python2-pyicu-1.8 220KiB transferred (127KiB/s) found valid signature for '/gnu/store/8q38qgmly775c17wp9frkq88j38blh67-python2-simplejson-3.3.0', from ' http://hydra.gnu.org/nar/8q38qgmly775c17wp9frkq88j38blh67-python2-simplejson-3.3.0 ' downloading `/gnu/store/8q38qgmly775c17wp9frkq88j38blh67-python2-simplejson-3.3.0' (0.4 MiB installed)... http://hydra.gnu.org/nar/8q38qgmly775c17wp9frkq88j38blh67-python2-simplejson-3.3.0 78KiB transferred (149KiB/s) Patched behavior: Found valid signature for /gnu/store/sin6c3n1440f8kza0k4hdms38fbb4dv0-boost-1.58.0 >From http://hydra.gnu.org/nar/sin6c3n1440f8kza0k4hdms38fbb4dv0-boost-1.58.0 Downloading sin6c3…boost-1.58.0 (110.6MiB installed)... sin6c3…boost-1.58.0 911KiB/s 00:00:11 | 9.4MiB transferred Found valid signature for /gnu/store/svznj538ppnginrnqnrqxn6dsxq6rhg5-aspell-0.60.6.1 From http://hydra.gnu.org/nar/svznj538ppnginrnqnrqxn6dsxq6rhg5-aspell-0.60.6.1 Downloading svznj5…aspell-0.60.6.1 (3.5MiB installed)... svznj5…aspell-0.60.6.192KiB/s 00:00:09 | 836KiB transferred -Steve From 95936bf25394d2985f9331cb8fa08d5b30cb64a5 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Mon, 14 Sep 2015 22:31:11 -0700 Subject: [PATCH] substitute: Improve readability of substitute-related output. * guix/build/download.scm (flexible-space, truncated-url): New procedures. (progress-proc): Generate a better indeterminate progress string. (nearest-exact-integer, seconds->string, byte-count->string): Move to... * guix/utils.scm: ...here. * guix/store.scm (truncated-store-path): New procedure. * guix/scripts/substitute.scm (assert-valid-narinfo): Add newlines to output. (process-substitution): Use byte-count->string and truncated-store-path. --- guix/build/download.scm | 71 ++--- guix/scripts/substitute.scm | 11 +++ guix/store.scm | 11 ++- guix/utils.scm | 41 +- 4 files changed, 85 insertions(+), 49 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 31d60fb..e205f31 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -24,6 +24,8 @@ #:use-module (web response) #:use-module (guix ftp-client) #:use-module (guix build utils) + #:use-module (guix store) + #:use-module (guix utils) #:use-module (rnrs io ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -49,43 +51,12 @@ ;; Size of the HTTP receive buffer. 65536) -(define (nearest-exact-integer x) - "Given a real number X, return the nearest exact integer, with ties going to -the nearest exact even integer." - (inexact->exact (round x))) - (define (duration->seconds duration) "Return the number of seconds represented by DURATION, a 'time-duration' object, as an inexact number." (+ (time-second duration) (/ (time-nanosecond duration) 1e9))) -(define (seconds->string duration) - "Given DURATION in seconds, return a string representing it in 'hh:mm:ss' -format." - (if (not (number? duration)) - "00:00:00" - (let* ((total-seconds (nearest-exact-integer duration)) - (extra-seconds (modulo total-seconds 3600)) - (hours (quotient total-seconds 3600)) - (mins (quotient extra-seconds 60)) - (secs (modulo extra-seconds 60))) -(format #f "~2,'0d:~2,'0d:~2,'0d" hours mins secs - -(define (byte-count->string size) - "Given SIZE in bytes, return a string representing it in a human-readable -way." - (let ((KiB 1024.) -(MiB (expt 1024. 2)) -(GiB (expt 1024. 3)) -(TiB (expt 1024. 4))) -(cond - ((< size KiB) (format #f "~dB" (nearest-exact-integer size))) - ((< size MiB) (format #f "~dKiB" (nearest-exact-integer (/ size KiB - ((< size GiB) (format #f "~,1fMiB" (/ size MiB))) - ((< size TiB) (format #f "~,2fGiB" (/ size GiB))) - (else (format #
Re: [PATCH] build: Fix potential type error when generating human-friendly byte count strings.
Hi Mark, Does the updated patch look okay? I'm making some related changes and it would be easier if this patch was integrated. Thanks! -Steve On Wed, Sep 9, 2015 at 8:31 PM, Steve Sprang wrote: > Sure thing. Here you go. > > -Steve > > On Wed, Sep 9, 2015 at 7:42 PM, Mark H Weaver wrote: > >> Steve Sprang writes: >> >> > This is a follow up tweak to my previous "progress bar" patch. With a >> > really slow throughput it's possible to get fractional sub-KiB byte >> > counts, so I added some additional number massaging. >> >> Sounds good! Looks good to me except for a few minor nits on this >> auxiliary procedure: >> >> > +(define (number->integer n) >> > + "Given an arbitrary number N, round it and return the exact result." >> > + (inexact->exact (round n))) >> >> How about calling it "nearest-exact-integer"? Also, it makes sense only >> for real numbers, not arbitrary numbers, and the variable name N is >> conventionally used to denote natural numbers, and X for real numbers. >> >> So, how about naming the argument 'x', and using something closer to the >> following docstring: >> >> "Given a real number X, return the nearest exact integer, with ties >> going to the nearest exact even integer." >> >> Otherwise, looks good to me. Can you send an updated patch? >> >> Mark >> > >
Re: [PATCH] build: Fix potential type error when generating human-friendly byte count strings.
Sure thing. Here you go. -Steve On Wed, Sep 9, 2015 at 7:42 PM, Mark H Weaver wrote: > Steve Sprang writes: > > > This is a follow up tweak to my previous "progress bar" patch. With a > > really slow throughput it's possible to get fractional sub-KiB byte > > counts, so I added some additional number massaging. > > Sounds good! Looks good to me except for a few minor nits on this > auxiliary procedure: > > > +(define (number->integer n) > > + "Given an arbitrary number N, round it and return the exact result." > > + (inexact->exact (round n))) > > How about calling it "nearest-exact-integer"? Also, it makes sense only > for real numbers, not arbitrary numbers, and the variable name N is > conventionally used to denote natural numbers, and X for real numbers. > > So, how about naming the argument 'x', and using something closer to the > following docstring: > > "Given a real number X, return the nearest exact integer, with ties > going to the nearest exact even integer." > > Otherwise, looks good to me. Can you send an updated patch? > > Mark > From 922d9ae8b6f2c13638b49fcc8b79f8d464f01244 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Wed, 9 Sep 2015 13:59:52 -0700 Subject: [PATCH] build: Fix potential type error when generating human-friendly byte count strings. * guix/build/download.scm (nearest-exact-integer): New function. (seconds->string): Use new rounding function. (byte-count->string): Use new rounding function. --- guix/build/download.scm | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 6e85174..31d60fb 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -49,6 +49,11 @@ ;; Size of the HTTP receive buffer. 65536) +(define (nearest-exact-integer x) + "Given a real number X, return the nearest exact integer, with ties going to +the nearest exact even integer." + (inexact->exact (round x))) + (define (duration->seconds duration) "Return the number of seconds represented by DURATION, a 'time-duration' object, as an inexact number." @@ -60,7 +65,7 @@ object, as an inexact number." format." (if (not (number? duration)) "00:00:00" - (let* ((total-seconds (inexact->exact (round duration))) + (let* ((total-seconds (nearest-exact-integer duration)) (extra-seconds (modulo total-seconds 3600)) (hours (quotient total-seconds 3600)) (mins (quotient extra-seconds 60)) @@ -75,8 +80,8 @@ way." (GiB (expt 1024. 3)) (TiB (expt 1024. 4))) (cond - ((< size KiB) (format #f "~dB" (inexact->exact size))) - ((< size MiB) (format #f "~dKiB" (inexact->exact (round (/ size KiB) + ((< size KiB) (format #f "~dB" (nearest-exact-integer size))) + ((< size MiB) (format #f "~dKiB" (nearest-exact-integer (/ size KiB ((< size GiB) (format #f "~,1fMiB" (/ size MiB))) ((< size TiB) (format #f "~,2fGiB" (/ size GiB))) (else (format #f "~,3fTiB" (/ size TiB)) -- 2.5.0
[PATCH] build: Fix potential type error when generating human-friendly byte count strings.
This is a follow up tweak to my previous "progress bar" patch. With a really slow throughput it's possible to get fractional sub-KiB byte counts, so I added some additional number massaging. -Steve From daccd58e5fbe366ebcd33092f70ca45bc79285e0 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Wed, 9 Sep 2015 13:59:52 -0700 Subject: [PATCH] build: Fix potential type error when generating human-friendly byte count strings. * guix/build/download.scm (number->integer): New function. (seconds->string): Use new rounding function. (byte-count->string): Use new rounding function. --- guix/build/download.scm | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index 6e85174..a0b8d92 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -49,6 +49,10 @@ ;; Size of the HTTP receive buffer. 65536) +(define (number->integer n) + "Given an arbitrary number N, round it and return the exact result." + (inexact->exact (round n))) + (define (duration->seconds duration) "Return the number of seconds represented by DURATION, a 'time-duration' object, as an inexact number." @@ -60,7 +64,7 @@ object, as an inexact number." format." (if (not (number? duration)) "00:00:00" - (let* ((total-seconds (inexact->exact (round duration))) + (let* ((total-seconds (number->integer duration)) (extra-seconds (modulo total-seconds 3600)) (hours (quotient total-seconds 3600)) (mins (quotient extra-seconds 60)) @@ -75,8 +79,8 @@ way." (GiB (expt 1024. 3)) (TiB (expt 1024. 4))) (cond - ((< size KiB) (format #f "~dB" (inexact->exact size))) - ((< size MiB) (format #f "~dKiB" (inexact->exact (round (/ size KiB) + ((< size KiB) (format #f "~dB" (number->integer size))) + ((< size MiB) (format #f "~dKiB" (number->integer (/ size KiB ((< size GiB) (format #f "~,1fMiB" (/ size MiB))) ((< size TiB) (format #f "~,2fGiB" (/ size GiB))) (else (format #f "~,3fTiB" (/ size TiB)) -- 2.5.0
[PATCH] build: Improve information density and appearance of download progress output.
This patch adds Arch/pacman style output when invoking 'guix download'. Previous output: $ guix download ftp://ftp.gnu.org/gnu/guile/guile-2.0.11.tar.gz starting download of `/tmp/guix-file.IgqbP2' from ` ftp://ftp.gnu.org/gnu/guile/guile-2.0.11.tar.gz'... ftp://ftp.gnu.org/.../guile-2.0.11.tar.gz 29.6% of 7339.9 KiB (781. KiB/s) Patched output: $ guix download ftp://ftp.gnu.org/gnu/guile/guile-2.0.11.tar.gz starting download of `/tmp/guix-file.ULgbny' from ` ftp://ftp.gnu.org/gnu/guile/guile-2.0.11.tar.gz'... guile-2.0.11.tar.gz 7.2MiB 1.1MiB/s 00:00:02 [### ] 36.6% -Steve From 21f9829fab68e4660b19b651154f3c873b4d595e Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sat, 5 Sep 2015 11:32:39 -0700 Subject: [PATCH] build: Improve information density and appearance of download progress output. * guix/build/download.scm (seconds->string): New function. (byte-count->string): New function. (progress-bar): New function. (throughput->string): Remove function. (progress-proc): Display base file name, elapsed time, and progress bar. --- guix/build/download.scm | 79 + 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/guix/build/download.scm b/guix/build/download.scm index ae59b01..e954963 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver +;;; Copyright © 2015 Steve Sprang ;;; ;;; This file is part of GNU Guix. ;;; @@ -54,17 +55,46 @@ object, as an inexact number." (+ (time-second duration) (/ (time-nanosecond duration) 1e9))) -(define (throughput->string throughput) - "Given THROUGHPUT, measured in bytes per second, return a string -representing it in a human-readable way." - (if (> throughput 3e6) - (format #f "~,2f MiB/s" (/ throughput (expt 2. 20))) - (format #f "~,0f KiB/s" (/ throughput 1024.0 +(define (seconds->string duration) + "Given DURATION in seconds, return a string representing it in 'hh:mm:ss' +format." + (if (not (number? duration)) + "00:00:00" + (let* ((total-seconds (inexact->exact (round duration))) + (extra-seconds (modulo total-seconds 3600)) + (hours (quotient total-seconds 3600)) + (mins (quotient extra-seconds 60)) + (secs (modulo extra-seconds 60))) +(format #f "~2,'0d:~2,'0d:~2,'0d" hours mins secs + +(define (byte-count->string size) + "Given SIZE in bytes, return a string representing it in a human-readable +way." + (let ((KiB 1024.) +(MiB (expt 1024. 2)) +(GiB (expt 1024. 3)) +(TiB (expt 1024. 4))) +(cond + ((< size KiB) (format #f "~dB" (inexact->exact size))) + ((< size MiB) (format #f "~dKiB" (inexact->exact (round (/ size KiB) + ((< size GiB) (format #f "~,1fMiB" (/ size MiB))) + ((< size TiB) (format #f "~,2fGiB" (/ size GiB))) + (else (format #f "~,3fTiB" (/ size TiB)) + +(define* (progress-bar % #:optional (bar-width 20)) + "Return % as a string representing an ASCII-art progress bar. The total +width of the bar is BAR-WIDTH." + (let* ((fraction (/ % 100)) + (filled (inexact->exact (floor (* fraction bar-width + (empty(- bar-width filled))) +(format #f "[~a~a]" +(make-string filled #\#) +(make-string empty #\space (define* (progress-proc file size #:optional (log-port (current-output-port))) - "Return a procedure to show the progress of FILE's download, which is -SIZE byte long. The returned procedure is suitable for use as an -argument to `dump-port'. The progress report is written to LOG-PORT." + "Return a procedure to show the progress of FILE's download, which is SIZE +bytes long. The returned procedure is suitable for use as an argument to +`dump-port'. The progress report is written to LOG-PORT." ;; XXX: Because of <http://bugs.gnu.org/19939> this procedure is often not ;; called as frequently as we'd like too; this is especially bad with Nginx ;; on hydra.gnu.org, which returns whole nars as a single chunk. @@ -83,14 +113,24 @@ argument to `dump-port'. The progress report is written to LOG-PORT." (if (number? size) (lambda (transferred cont) (with-elapsed-time elapsed - (let ((% (* 100.0 (/ transferred size))) -(throughput (if elapsed -(/ transferred elapsed) -
[PATCH] gnu: Add pass.
I'm not sure if there's a good way to enable tests here, so they are currently disabled. -Steve From adef360ea4ec41aa23ec7aef43341c12bf27ca3c Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sat, 22 Aug 2015 19:49:21 -0700 Subject: [PATCH] gnu: Add pass. * gnu/packages/password-utils.scm (pass): New variable. --- gnu/packages/password-utils.scm | 53 - 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm index 4aef371..0beddaf 100644 --- a/gnu/packages/password-utils.scm +++ b/gnu/packages/password-utils.scm @@ -20,7 +20,12 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) #:use-module (guix download) - #:use-module (guix packages)) + #:use-module (guix packages) + #:use-module (gnu packages) + #:use-module (gnu packages admin) + #:use-module (gnu packages gnupg) + #:use-module (gnu packages version-control) + #:use-module (gnu packages xdisorg)) (define-public pwgen (package @@ -41,3 +46,49 @@ (description "Pwgen generates passwords which can be easily memorized by a human.") (license license:gpl2))) + +(define-public pass + (package +(name "pass") +(version "1.6.5") +(source + (origin + (method url-fetch) + (uri (string-append + "http://git.zx2c4.com/password-store/snapshot/"; + "password-store-" version ".tar.xz")) + (sha256 +(base32 "05bk3lrp5jwg0v338lvylp7glpliydzz4jf5pjr6k3kagrv3jyik" +(build-system gnu-build-system) +(inputs `(("git" ,git) + ("gnupg" ,gnupg) + ("pwgen" ,pwgen) + ("tree" ,tree) + ("xclip" ,xclip))) +(arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'build) ; pass is implemented as a shell script + (add-after + 'install 'set-path + (lambda* (#:key inputs outputs #:allow-other-keys) +(let ((out (assoc-ref outputs "out")) + (input->path (lambda (input) + (string-append + (assoc-ref inputs (car input)) + "/bin" + ;; pass executes its inputs as helper programs at runtime + (wrap-program (string-append out "/bin/pass") +`("PATH" ":" prefix ,(map input->path inputs))) + #:make-flags + (list (string-append "PREFIX=" %output) + "FORCE_ALL=1") ; bash-completion + #:test-target "test" + #:tests? #f)) ; tests hang +(home-page "http://www.passwordstore.org/";) +(synopsis "Simple password manager") +(description "Pass is a simple password manager which uses GnuPG and +ordinary directories.") +(license license:gpl2+))) + -- 2.4.3
Re: [PATCH] gnu: Add pwgen.
Sure, here you go. -Steve On Wed, Aug 19, 2015 at 12:12 PM, Mark H Weaver wrote: > Steve Sprang writes: > > > From 54acc1b8327291b66120cc83e03b140c242393aa Mon Sep 17 00:00:00 2001 > > From: Steve Sprang > > Date: Tue, 18 Aug 2015 11:09:03 -0700 > > Subject: [PATCH] gnu: Add pwgen. > > > > * gnu/packages/password-utils.scm: New file. > > * gnu-system.am (GNU_SYSTEM_MODULES): Add it. > > --- > > gnu-system.am | 1 + > > gnu/packages/password-utils.scm | 43 > + > > 2 files changed, 44 insertions(+) > > create mode 100644 gnu/packages/password-utils.scm > > > > diff --git a/gnu-system.am b/gnu-system.am > > index 9f46f7b..6a086dc 100644 > > --- a/gnu-system.am > > +++ b/gnu-system.am > > @@ -239,6 +239,7 @@ GNU_SYSTEM_MODULES = \ > >gnu/packages/ots.scm \ > >gnu/packages/package-management.scm\ > >gnu/packages/parallel.scm \ > > + gnu/packages/password-utils.scm\ > >gnu/packages/patchutils.scm\ > >gnu/packages/pciutils.scm \ > >gnu/packages/pcre.scm \ > > diff --git a/gnu/packages/password-utils.scm > b/gnu/packages/password-utils.scm > > new file mode 100644 > > index 000..e13495f > > --- /dev/null > > +++ b/gnu/packages/password-utils.scm > > @@ -0,0 +1,43 @@ > > +;;; GNU Guix --- Functional package management for GNU > > +;;; Copyright © 2015 Steve Sprang > > +;;; > > +;;; This file is part of 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 (gnu packages password-utils) > > + #:use-module ((guix licenses) #:prefix license:) > > + #:use-module (guix build-system gnu) > > + #:use-module (guix download) > > + #:use-module (guix packages)) > > + > > +(define-public pwgen > > + (package > > +(name "pwgen") > > +(version "2.07") > > +(source > > + (origin > > + (method url-fetch) > > + (uri (string-append "mirror://sourceforge/pwgen/pwgen-" > > + version ".tar.gz")) > > + (sha256 > > +(base32 > "0mhmw700kkh238fzivcwnwi94bj9f3h36yfh3k3j2v19b0zmjx7b" > > +(build-system gnu-build-system) > > +(arguments > > + `(#:tests? #f)) > > Please add a comment saying why tests are disabled. In this case, maybe: > > (arguments > `(#:tests? #f)) ; no test suite > > > +(home-page "http://pwgen.sourceforge.net/";) > > +(synopsis "Password generator") > > +(description "Pwgen generates passwords which can be easily > memorized by a > > +human.") > > +(license license:gpl1))) > > According to debian/copyright, included in the upstream tarball, the > license is gpl2. > > Can you send an updated patch? > > Thanks! >Mark > From ed063e7f1f16398cd06088a4085c15ea5dbfed08 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Wed, 19 Aug 2015 15:33:04 -0700 Subject: [PATCH] gnu: Add pwgen. * gnu/packages/password-utils.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/password-utils.scm | 43 + 2 files changed, 44 insertions(+) create mode 100644 gnu/packages/password-utils.scm diff --git a/gnu-system.am b/gnu-system.am index 147abfc..aca0144 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -239,6 +239,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/ots.scm\ gnu/packages/package-management.scm \ gnu/packages/parallel.scm \ + gnu/packages/password-utils.scm \ gnu/packages/patchutils.scm \ gnu/packages/pciutils.scm \ gnu/packages/pc
[PATCH] gnu: Add pwgen.
Suggestions for a more appropriate module or module name? I will hopefully be adding pass (http://www.passwordstore.org/) in a subsequent patch. -Steve From 54acc1b8327291b66120cc83e03b140c242393aa Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Tue, 18 Aug 2015 11:09:03 -0700 Subject: [PATCH] gnu: Add pwgen. * gnu/packages/password-utils.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/password-utils.scm | 43 + 2 files changed, 44 insertions(+) create mode 100644 gnu/packages/password-utils.scm diff --git a/gnu-system.am b/gnu-system.am index 9f46f7b..6a086dc 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -239,6 +239,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/ots.scm\ gnu/packages/package-management.scm \ gnu/packages/parallel.scm \ + gnu/packages/password-utils.scm \ gnu/packages/patchutils.scm \ gnu/packages/pciutils.scm \ gnu/packages/pcre.scm\ diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm new file mode 100644 index 000..e13495f --- /dev/null +++ b/gnu/packages/password-utils.scm @@ -0,0 +1,43 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 Steve Sprang +;;; +;;; This file is part of 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 (gnu packages password-utils) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module (guix packages)) + +(define-public pwgen + (package +(name "pwgen") +(version "2.07") +(source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/pwgen/pwgen-" + version ".tar.gz")) + (sha256 +(base32 "0mhmw700kkh238fzivcwnwi94bj9f3h36yfh3k3j2v19b0zmjx7b" +(build-system gnu-build-system) +(arguments + `(#:tests? #f)) +(home-page "http://pwgen.sourceforge.net/";) +(synopsis "Password generator") +(description "Pwgen generates passwords which can be easily memorized by a +human.") +(license license:gpl1))) -- 2.4.3
Re: [PATCH] gnu: Add figlet.
Thanks for the feedback! Here's my 2nd attempt. -Steve On Sat, Aug 15, 2015 at 10:07 PM, Ricardo Wurmus wrote: > Hi Steve, > > thank you for your first Guix package! It looks great! I do have a > couple of cosmetic comments, though. > > > From 1abd103363bb12e7b8aa5f5ad1329c94b0af48e8 Mon Sep 17 00:00:00 2001 > > From: Steve Sprang > > Date: Sat, 15 Aug 2015 20:08:38 -0700 > > Subject: [PATCH] gnu: Add figlet. > > > * gnu/packages/figlet.scm: New file. > > * gnu-system.am (GNU_SYSTEM_MODULES): Add it. > > Looks good. I just wonder if figlet could not be added to some existing > module instead of creating a new one. Maybe “fontutils.scm”? > > > +(version "2.2.5") > > +(source > > + (origin > > + (method url-fetch) > > + (uri (string-append > > + "ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-"; > version ".tar.gz")) > > This line is a bit long. How about this instead: > >(uri (string-append "ftp://ftp.figlet.org/pub/figlet/program"; >"/unix/figlet-" version ".tar.gz")) > > > + (sha256 (base32 > > + > "0za1ax15x7myjl8jz271ybly8ln9kb9zhm1gf6rdlxzhs07w925z" > > I think it would look better like this: > >(sha256 > (base32 "0za1ax15x7myjl8jz271ybly8ln9kb9zhm1gf6rdlxzhs07w925z")) > > > +(build-system gnu-build-system) > > +(arguments > > + `(#:phases > > + (alist-replace > > +'configure > > +(lambda* (#:key outputs #:allow-other-keys) > > + (let ((out (assoc-ref outputs "out"))) > > +(substitute* "Makefile" > > + (("/usr/local") out > > +%standard-phases))) > > I suggest using ‘(modify-phases ...)’ instead, as adding or removing > phases later on does not alter the indentation of other phases. > > However, in this case ‘/usr/local’ doesn’t have to be patched away at > all. You could just pass a make-flag to set ‘prefix’ to ‘(assoc-ref > outputs "out")’. > > > +(synopsis "Program for making large letters out of ordinary text") > > +(description "FIGlet is a program for making large letters out of > ordinary text.") > > This line is too long. You can automatically format it in Emacs with > ‘M-q’. Maybe the description could be a little longer to explain that > what figlet generates is some sort of ASCII art letters, because this > description could be misunderstood as operating on fonts. Or maybe it’s > just me being dense ;) > > > +(home-page "http://www.figlet.org/";) > > +(license bsd-3))) > > Looking at the sources it looks like not all files are under the BSD-3 > license. ‘inflate.c’, for example, is released under expat/X11; > ‘getopt.c’ is public domain software — I’m not sure if this warrants > using a list for the license field. Maybe someone else could weigh in > on this. > > ~~ Ricardo > > From 4e95678b96845418ef5d11a9b1c40f9beaaf85be Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sun, 16 Aug 2015 20:43:07 -0700 Subject: [PATCH] gnu: Add figlet. * gnu/packages/figlet.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/figlet.scm | 47 +++ 2 files changed, 48 insertions(+) create mode 100644 gnu/packages/figlet.scm diff --git a/gnu-system.am b/gnu-system.am index 9f46f7b..bd053b7 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -96,6 +96,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/enlightenment.scm \ gnu/packages/fcitx.scm \ gnu/packages/feh.scm \ + gnu/packages/figlet.scm \ gnu/packages/file.scm\ gnu/packages/firmware.scm \ gnu/packages/fish.scm\ diff --git a/gnu/packages/figlet.scm b/gnu/packages/figlet.scm new file mode 100644 index 000..f12c0c2 --- /dev/null +++ b/gnu/packages/figlet.scm @@ -0,0 +1,47 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 Steve Sprang +;;; +;;; This file is part of 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.
[PATCH] gnu: Add figlet.
My first Guix package! Feedback appreciated. -Steve From 1abd103363bb12e7b8aa5f5ad1329c94b0af48e8 Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sat, 15 Aug 2015 20:08:38 -0700 Subject: [PATCH] gnu: Add figlet. * gnu/packages/figlet.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. --- gnu-system.am | 1 + gnu/packages/figlet.scm | 49 + 2 files changed, 50 insertions(+) create mode 100644 gnu/packages/figlet.scm diff --git a/gnu-system.am b/gnu-system.am index 9f46f7b..bd053b7 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -96,6 +96,7 @@ GNU_SYSTEM_MODULES =\ gnu/packages/enlightenment.scm \ gnu/packages/fcitx.scm \ gnu/packages/feh.scm \ + gnu/packages/figlet.scm \ gnu/packages/file.scm\ gnu/packages/firmware.scm \ gnu/packages/fish.scm\ diff --git a/gnu/packages/figlet.scm b/gnu/packages/figlet.scm new file mode 100644 index 000..7872711 --- /dev/null +++ b/gnu/packages/figlet.scm @@ -0,0 +1,49 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 Steve Sprang +;;; +;;; This file is part of 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 (gnu packages figlet) + #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu)) + +(define-public figlet + (package +(name "figlet") +(version "2.2.5") +(source + (origin + (method url-fetch) + (uri (string-append + "ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-"; version ".tar.gz")) + (sha256 (base32 +"0za1ax15x7myjl8jz271ybly8ln9kb9zhm1gf6rdlxzhs07w925z" +(build-system gnu-build-system) +(arguments + `(#:phases + (alist-replace +'configure +(lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) +(substitute* "Makefile" + (("/usr/local") out +%standard-phases))) +(synopsis "Program for making large letters out of ordinary text") +(description "FIGlet is a program for making large letters out of ordinary text.") +(home-page "http://www.figlet.org/";) +(license bsd-3))) -- 2.4.3
[PATCH] doc: Fix minor typos
Correct some minor typos I noticed when reading the docs. -Steve >From 574a7441f0d34b438544611812c026a32e4cbe4c Mon Sep 17 00:00:00 2001 From: Steve Sprang Date: Sun, 2 Aug 2015 13:24:38 -0700 Subject: [PATCH] doc: Fix minor typos * doc/guix.texi (Invoking guix-daemon, Application Setup, The Store): Fix typos --- doc/guix.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 24b2039..bcf07a6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -861,7 +861,7 @@ Disable automatic file ``deduplication'' in the store. By default, files added to the store are automatically ``deduplicated'': if a newly added file is identical to another one found in the store, the daemon makes the new file a hard link to the other file. This can -noticeably reduce disk usage, at the expense of slightly increasde +noticeably reduce disk usage, at the expense of slightly increased input/output load at the end of a build process. This option disables this optimization. @@ -942,7 +942,7 @@ limited to a few UTF-8 locales. @subsection X11 Fonts -The majority of graphical applications uses Fontconfig to locate and +The majority of graphical applications use Fontconfig to locate and load fonts and perform X11-client-side rendering. Guix's @code{fontconfig} package looks for fonts in @file{$HOME/.guix-profile} by default. Thus, to allow graphical applications installed with Guix @@ -2541,7 +2541,7 @@ with @code{build-expression->derivation} (@pxref{Derivations, Conceptually, the @dfn{store} is where derivations that have been successfully built are stored---by default, under @file{/gnu/store}. Sub-directories in the store are referred to as @dfn{store paths}. The -store has an associated database that contains information such has the +store has an associated database that contains information such as the store paths referred to by each store path, and the list of @emph{valid} store paths---paths that result from a successful build. -- 2.5.0