[PATCH] gnu: Add hashcash.

DoneSubmitted by Jakub Kądziołka.
Details
2 participants
  • Jakub Kądziołka
  • Mathieu Othacehe
Owner
unassigned
Severity
normal
J
J
Jakub Kądziołka wrote on 1 Jun 02:40 +0200
(address . guix-patches@gnu.org)
20200601004015.21684-1-kuba@kadziolka.net
* gnu/packages/networking.scm (hashcash): New variable.---
Is the license field here alright? Here's what the LICENSE file has tosay:
Toggle quote (22 lines)> This software can be distributed and used under any of the following> licenses:> > CPL> public domain> BSD (3 clause -- no advertising clause)> LGPL (2.1)> GPL (2)> > in rough order of author preference.> > The CPL is probably unique to this package, and is described here:> http://www.cypherspace.org/CPL/; if you can't be bothered to figure it> out feel free to use one of the other licenses. Earlier versions> where distributed just under CPL. CPL allows you to re-license under> a license of your choice, I just include other specific licenses to> save people having to read, understand and feel confident in the> validity of the CPL.> > NOTE: on systems without a POSIX getopt this package will be linked> with the included getopt.c which is distributed under GPL 2.
gnu/packages/networking.scm | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
Toggle diff (64 lines)diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scmindex fd29370841..169aa4ed8e 100644--- a/gnu/packages/networking.scm+++ b/gnu/packages/networking.scm@@ -38,6 +38,7 @@ ;;; Copyright © 2019 Diego N. Barbato <dnbarbato@posteo.de> ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; ;;; This file is part of GNU Guix. ;;;@@ -3189,3 +3190,48 @@ CDP. The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver Link-Layer notifications to adjacent network devices. @code{lldpd} is an implementation of LLDP. It also supports some proprietary protocols.") (license license:isc)))++(define-public hashcash+ (package+ (name "hashcash")+ (version "1.22")+ (source+ (origin+ (method url-fetch)+ (uri (string-append "http://www.hashcash.org/source/hashcash-"+ version ".tgz"))+ (sha256+ (base32+ "15kqaimwb2y8wvzpn73021bvay9mz1gqqfc40gk4hj6f84nz34h1"))))+ (build-system gnu-build-system)+ (arguments+ `(#:make-flags '("CC=gcc")+ #:phases+ (modify-phases %standard-phases+ (delete 'configure)+ ;; No tests available.+ (delete 'check)+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((outdir (assoc-ref outputs "out"))+ (bindir (string-append outdir "/bin"))+ (mandir (string-append outdir "/share/man/man1"))+ (docdir (string-append outdir "/share/doc/hashcash-" ,version)))+ ;; make install assumes /usr and doesn't provide a way to override it+ (install-file "hashcash" bindir)+ (install-file "hashcash.1" mandir)+ (install-file "README" docdir)+ (install-file "LICENSE" docdir)+ (install-file "CHANGELOG" docdir)+ #t))))))+ (home-page "https://www.hashcash.org/")+ (synopsis "Denial-of-service countermeasure")+ (description "Hashcash is a proof-of-work algorithm, which has been used+as a denial-of-service countermeasure technique in a number of systems.++A hashcash stamp constitutes a proof-of-work which takes a parametrizable+amount of work to compute for the sender. The recipient can verify received+hashcash stamps efficiently.++This package contains a command-line tool for computing and verifying hashcash+stamps.")+ (license license:public-domain)))-- 2.26.2
M
M
Mathieu Othacehe wrote on 2 Jun 14:12 +0200
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . 41637@debbugs.gnu.org)
87o8q1wtt6.fsf@gnu.org
Hello Jakub,
Toggle quote (2 lines)> + `(#:make-flags '("CC=gcc")
It would be better to use "cc-for-target" here. You can check ifcross-compilation works by running something like:
Toggle snippet (3 lines)guix build --target=aarch64-linux-gnu hashcash
Thanks,
Mathieu
J
J
Jakub Kądziołka wrote on 2 Jun 15:25 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 41637@debbugs.gnu.org)
20200602132555.pkqo4cubxwfnbjbk@gravity
On Tue, Jun 02, 2020 at 02:12:05PM +0200, Mathieu Othacehe wrote:
Toggle quote (12 lines)> > Hello Jakub,> > > + `(#:make-flags '("CC=gcc")> > It would be better to use "cc-for-target" here. You can check if> cross-compilation works by running something like:> > --8<---------------cut here---------------start------------->8---> guix build --target=aarch64-linux-gnu hashcash> --8<---------------cut here---------------end--------------->8---
Thanks! I had no idea this affects cross-compilation... I have changedthat line to be
`(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
instead. Does the rest of the patch look alright?
Regards,Jakub Kądziołka
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl7WU2MACgkQ4xWnWEYTFWTsOhAAmCMta6S3Lot+T7Wz371TowpFv3dgQN+aqiTAHusojO7qDmew4VtHUERYRP7GztYB2ay+OYREpg/T38mvfY7JB3yzHicro6LlLvm4oW4aH8zdDVo5WMwGmlOCI90puwFhydVHg7D1ctUcm8dkFqRErDiQTXaqVu+/xh0ocecIYoqlTIuMKy2FJI3DjhBMXGgb6DxljK58nYGANKqLwTSXddcOaeQ6q3NaueZlQMERZKESjTk4TeD41ltuYYRic2Pt5eXkKZMxtP+RsoLlBECb16y+2EufdlegI/HMxyHrlsCcpWn8nAMQlZIwpEumKBcxUI9fCESp65lAO2+43+qVdZy62u/giWirwbilqxa/JVZZe3dTuGA+kIMD3Ilqa7iwfVECDqbz8PeBB9awM6HinzQLIYXWq8Www9DfdDN6aC6skeiJtwfsRC1D2KH8rRxMei7bF+71LSoLkS1UDS2MgiiT9zg+2ZH1XJM8X8oM5XdmmMNud+RmDgo4C45qfukBKwKDWIj8HelQPTdg8EWE0DPo/lqyoBFnuS1gVJL42mzwVbsNj2N8+c+xfYl/crN1TGbHwGteN06Wmfh+SGNRF8QuxfzKiTYsWYO11zBeEcXING/CTJxQkAk5nEI30gYDGvQqVi5VSQG6WgGcY9Rdtt0GH8/ctXX1WMAcQ/8341U==PtMc-----END PGP SIGNATURE-----

M
M
Mathieu Othacehe wrote on 3 Jun 08:55 +0200
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . 41637@debbugs.gnu.org)
87blm07i50.fsf@gnu.org
Hey Jakub,
Thanks for fixing the cross-compilation, a full review this time :)
Toggle quote (11 lines)> + (let* ((outdir (assoc-ref outputs "out"))> + (bindir (string-append outdir "/bin"))> + (mandir (string-append outdir "/share/man/man1"))> + (docdir (string-append outdir "/share/doc/hashcash-" ,version)))> + ;; make install assumes /usr and doesn't provide a way to override it> + (install-file "hashcash" bindir)> + (install-file "hashcash.1" mandir)> + (install-file "README" docdir)> + (install-file "LICENSE" docdir)> + (install-file "CHANGELOG" docdir)
I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH andDOC_INSTALL_PATH instead.
Toggle quote (6 lines)> + #t))))))> + (home-page "https://www.hashcash.org/")> + (synopsis "Denial-of-service countermeasure")> + (description "Hashcash is a proof-of-work algorithm, which has been used> +as a denial-of-service countermeasure technique in a number of systems.
You can remove "in a number of systems".
Toggle quote (8 lines)> +A hashcash stamp constitutes a proof-of-work which takes a parametrizable> +amount of work to compute for the sender. The recipient can verify received> +hashcash stamps efficiently.> +> +This package contains a command-line tool for computing and verifying hashcash> +stamps.")> + (license license:public-domain)))
I'm also concerned by this line in the Makefile:
Toggle snippet (4 lines)# request static link of -lcrypto onlyLIBCRYPTO=/usr/lib/libcrypto.a
We should maybe add "openssl" to the inputs and fix this variable(that's what Nix does).
Thanks,
Mathieu
J
J
Jakub Kądziołka wrote on 3 Jun 14:18 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 41637@debbugs.gnu.org)
20200603121806.hynak7rp3o5jnhsy@gravity
On Wed, Jun 03, 2020 at 08:55:39AM +0200, Mathieu Othacehe wrote:
Toggle quote (19 lines)> > Hey Jakub,> > Thanks for fixing the cross-compilation, a full review this time :)> > > + (let* ((outdir (assoc-ref outputs "out"))> > + (bindir (string-append outdir "/bin"))> > + (mandir (string-append outdir "/share/man/man1"))> > + (docdir (string-append outdir "/share/doc/hashcash-" ,version)))> > + ;; make install assumes /usr and doesn't provide a way to override it> > + (install-file "hashcash" bindir)> > + (install-file "hashcash.1" mandir)> > + (install-file "README" docdir)> > + (install-file "LICENSE" docdir)> > + (install-file "CHANGELOG" docdir)> > I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and> DOC_INSTALL_PATH instead.
Unfortunately, the variables are defined with `=` instead of `?=`, sothe Makefile always overwrites them. We would also want to skipinstalling the `sha1' tool like Debian does, since `sha1sum' is alreadya thing.
Toggle quote (26 lines)> > + #t))))))> > + (home-page "https://www.hashcash.org/")> > + (synopsis "Denial-of-service countermeasure")> > + (description "Hashcash is a proof-of-work algorithm, which has been used> > +as a denial-of-service countermeasure technique in a number of systems.> > You can remove "in a number of systems".> > > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable> > +amount of work to compute for the sender. The recipient can verify received> > +hashcash stamps efficiently.> > +> > +This package contains a command-line tool for computing and verifying hashcash> > +stamps.")> > + (license license:public-domain)))> > I'm also concerned by this line in the Makefile:> > --8<---------------cut here---------------start------------->8---> # request static link of -lcrypto only> LIBCRYPTO=/usr/lib/libcrypto.a> --8<---------------cut here---------------end--------------->8---> > We should maybe add "openssl" to the inputs and fix this variable> (that's what Nix does).
From what I've read, openssl is not used by default, but only when atarget like `gnu-openssl' is used. I'll make a build with openssl andbenchmark which is faster...
Regards,Jakub Kądziołka
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl7XlP0ACgkQ4xWnWEYTFWQCZg/+PUimgJlbpmBcHhDvathlTwEunBpjwxGERnYMq2U3oHOTAEALYFUs3pB/iUtjbVS46dPUXaf1fe47WLn4yC2JucbBQz9h/jb3c4pHUUXhOgeld/H/q1+VpzrPVV4si6X3BoqCBLFdUK2dqknSzkGemVcERol+w3G2iODCcoYB8MoeVMgHn+V4m4f3phwZZmPRCTtYIjwSUvPbX/2F5hp7Qdw1NHhZv4cWZOfsNTcGdHSC+yL3uc6t2cSvrATFr8zr4M9lfnqyoVw9tWK9F78sw9nZyI6ZK5bEYfG7hunpwyKGPV36DzorI1xWeZk/TAswp5KvDHu9v3KFguh0oMrrKAfyelZhln961JalYwiQdOigBRsqn0FcLkpsFoD+8u2+MHg5yqbQJVEj3flP5RgJ7o0Qv9poofIJVN38gk8BDX23/VPYivBTg0dNgwSJz54A7iMGsmtuyttVNlpNXNSRqE7NhaJGeT/W1F0isKocC4+1bDJN1Ay3WJh96fl4jDzWTaZ7HAvh9E78oXBXT2f/XhAoHgOA8Z3N+SkvibUkgAnnVd28c2LSGdbtfW3BWOCpwZimErifh/IwpMDEe6cj3kE86GPTO5UzdoJRAmYiNIvQGilsfl3aWZGLsT7lJmcm+Od8h2FlS2EH5az7r4/s76ffYJty5GZJWQwW3ZcFreU==j2k2-----END PGP SIGNATURE-----

M
M
Mathieu Othacehe wrote on 3 Jun 14:30 +0200
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . 41637@debbugs.gnu.org)
87zh9k5o21.fsf@gnu.org
Toggle quote (8 lines)>> I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and>> DOC_INSTALL_PATH instead.>> Unfortunately, the variables are defined with `=` instead of `?=`, so> the Makefile always overwrites them. We would also want to skip> installing the `sha1' tool like Debian does, since `sha1sum' is already> a thing.
Not if they are passed on the command line, see:https://www.gnu.org/software/make/manual/html_node/Overriding.html
Mathieu
J
J
Jakub Kądziołka wrote on 6 Jun 16:39 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 41637@debbugs.gnu.org)
20200606143928.humyr6gzzwcb4ool@gravity
On Wed, Jun 03, 2020 at 08:55:39AM +0200, Mathieu Othacehe wrote:
Toggle quote (27 lines)> > Hey Jakub,> > Thanks for fixing the cross-compilation, a full review this time :)> > > + (let* ((outdir (assoc-ref outputs "out"))> > + (bindir (string-append outdir "/bin"))> > + (mandir (string-append outdir "/share/man/man1"))> > + (docdir (string-append outdir "/share/doc/hashcash-" ,version)))> > + ;; make install assumes /usr and doesn't provide a way to override it> > + (install-file "hashcash" bindir)> > + (install-file "hashcash.1" mandir)> > + (install-file "README" docdir)> > + (install-file "LICENSE" docdir)> > + (install-file "CHANGELOG" docdir)> > I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and> DOC_INSTALL_PATH instead.> > > + #t))))))> > + (home-page "https://www.hashcash.org/")> > + (synopsis "Denial-of-service countermeasure")> > + (description "Hashcash is a proof-of-work algorithm, which has been used> > +as a denial-of-service countermeasure technique in a number of systems.> > You can remove "in a number of systems".
Note that systems means things like e-mail or bitcoin, rather than Guixor Debian.
Toggle quote (18 lines)> > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable> > +amount of work to compute for the sender. The recipient can verify received> > +hashcash stamps efficiently.> > +> > +This package contains a command-line tool for computing and verifying hashcash> > +stamps.")> > + (license license:public-domain)))> > I'm also concerned by this line in the Makefile:> > --8<---------------cut here---------------start------------->8---> # request static link of -lcrypto only> LIBCRYPTO=/usr/lib/libcrypto.a> --8<---------------cut here---------------end--------------->8---> > We should maybe add "openssl" to the inputs and fix this variable> (that's what Nix does).
Firstly, the benchmarking code seems to be broken in Hashcash 1.22.Downgrading to 1.21 and running hashcash -sv, I found that OpenSSLis slower than another minting backend, and is not used by default.I believe it would be better to not include OpenSSL in the package.That's what Debian does, anyway.
I therefore propose only the following changes:
Toggle diff (16 lines)diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scmindex b38e75eb7f..ecd72eee26 100644--- a/gnu/packages/networking.scm+++ b/gnu/packages/networking.scm@@ -3217,7 +3217,7 @@ an implementation of LLDP. It also supports some proprietary protocols.") (bindir (string-append outdir "/bin")) (mandir (string-append outdir "/share/man/man1")) (docdir (string-append outdir "/share/doc/hashcash-" ,version)))- ;; make install assumes /usr and doesn't provide a way to override it+ ;; Install manually, as we don't need the `sha1' binary (install-file "hashcash" bindir) (install-file "hashcash.1" mandir) (install-file "README" docdir)
Regards,Jakub Kądziołka
From de679e91b17b3a04a5f07446d0b121ed8f5890ed Mon Sep 17 00:00:00 2001From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= <kuba@kadziolka.net>Date: Mon, 1 Jun 2020 02:37:03 +0200Subject: [PATCH v2] gnu: Add hashcash.
* gnu/packages/networking.scm (hashcash): New variable.--- gnu/packages/networking.scm | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
Toggle diff (64 lines)diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scmindex fd29370841..d7de5b1956 100644--- a/gnu/packages/networking.scm+++ b/gnu/packages/networking.scm@@ -38,6 +38,7 @@ ;;; Copyright © 2019 Diego N. Barbato <dnbarbato@posteo.de> ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; ;;; This file is part of GNU Guix. ;;;@@ -3189,3 +3190,49 @@ CDP. The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver Link-Layer notifications to adjacent network devices. @code{lldpd} is an implementation of LLDP. It also supports some proprietary protocols.") (license license:isc)))++(define-public hashcash+ (package+ (name "hashcash")+ (version "1.22")+ (source+ (origin+ (method url-fetch)+ (uri (string-append "http://www.hashcash.org/source/hashcash-"+ version ".tgz"))+ (sha256+ (base32+ "15kqaimwb2y8wvzpn73021bvay9mz1gqqfc40gk4hj6f84nz34h1"))))+ (build-system gnu-build-system)+ (arguments+ `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))+ #:phases+ (modify-phases %standard-phases+ (delete 'configure)+ ;; No tests available.+ (delete 'check)+ (replace 'install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((outdir (assoc-ref outputs "out"))+ (bindir (string-append outdir "/bin"))+ (mandir (string-append outdir "/share/man/man1"))+ (docdir (string-append outdir "/share/doc/hashcash-" ,version)))+ ;; Install manually, as we don't need the `sha1' binary+ (install-file "hashcash" bindir)+ (install-file "hashcash.1" mandir)+ (install-file "README" docdir)+ (install-file "LICENSE" docdir)+ (install-file "CHANGELOG" docdir)+ #t))))))+ (home-page "https://www.hashcash.org/")+ (synopsis "Denial-of-service countermeasure")+ (description "Hashcash is a proof-of-work algorithm, which has been used+as a denial-of-service countermeasure technique in a number of systems.++A hashcash stamp constitutes a proof-of-work which takes a parametrizable+amount of work to compute for the sender. The recipient can verify received+hashcash stamps efficiently.++This package contains a command-line tool for computing and verifying hashcash+stamps.")+ (license license:public-domain)))-- 2.26.2
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl7bqp8ACgkQ4xWnWEYTFWQ/Og/9H1XzRMTCfoJCcZMoiispj9cRNW0A+YLiXGLdx4vAexGLQnhK6PYT3Aq8GzxOTt1w6P3+HlI0XPnX54UfspsbIHQr3cN4gpa+zhIWb8w1fYPGlOZIwQvRrY1pmYmBLncLkMpKjUhtUNxCoh1kQUOLjoLZ61w4mY4qvShvxRCVVLLEi3nddTZvNrFF8T0MlHR50wzrHABiaSOdnQyfQq+zmSCUnB595RN/Prq1oC9IXkpjS0ASGt0jo4lOddu2YouLft2oZmyuDBzo1fBJ0dDCqZN1Ud0QxLcJL3E3XQnvqm0gJ/7c62OpMe6Ls5X8z4Sg6OQ/WO2m0L5eay8tdna7c/tZtNDUz6aGDiyBGcqkSD96uCsW25iwSjzy/tJ6H9k017NWjc4PwFTsHrCEFUmKIwJf05F0RgbwsgNE/PrIlfGg46m4CNAeVX9HAkvvxeM6L96Qotk77GsmZAOV+8GZ7vE0nqdEWOy+KBjkjaQC+XLmLuKbHIn5RHx647/4LDr8YBCHTE4dqui054o3GJk+xsmZqxOhEpKiU/ZyQuZoOZqfbgM1rYxHe+2HOUltn7K0AnnhF3xSg4ewwuBw3jy+O18NFBMjzLFEq72s55QMKl2c7u/VR+E1S23XIGpSj9HkomBHUlwwuFgVxAI+DE4AEw1ST46fxKwYs965BP70Hws==aV+d-----END PGP SIGNATURE-----

J
J
Jakub Kądziołka wrote on 20 Jun 23:29 +0200
Done: [PATCH] gnu: Add hashcash.
(address . 41637-done@debbugs.gnu.org)
20200620212901.pjakg7cggxoevq3h@gravity
Pushed to master as commit ef6d3b643689953b71fe103e8c6f520b54996f11, closing.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl7uf5wACgkQ4xWnWEYTFWQCxw/+I2gXjjNvPoFUgVSBU6iEDcFZcTYpCYqrvlirJl7KEVBfzjRAqTXCRgobMj1heqdFWvIHa/i3W9PsSrV6NUlszYZsFYaIDisOrJ6UAojiDCnuRjY4ocvXUdViRhOZG9ZrDEhECg7GGd+AkbSfB8ojnNj/yQE1k+/jfp0RCMQ8jlPeWHVQ8CwYlrLfDsIeVS74svFxAozeBmDJbX/gbnNVchGAAyyTTfQJRuAi2wSbx/S+C77K0aYFCLqWcVRpI8v9oBcESJh7MYivmdrgRRX66WuXB3ReVGMD7og9Z3JqBppPhkYQ2vkxAcmuGlMX3bOtOzpQAg4UFKpi951D6n0j7grqPw2g0OD+KuZMvb979m5Q/M2Eguw6tsuo7X5qBrzu7oXQBcTICSleyTiadpEZsrdF9Ss7C9nEGq/BFvu+l9LTwd1DvuA0nickoNUMD28ZRSF7rUvw1vAxAdKPttFZkLT80XlnZezPMhDY1IeH2HYgxU48Fxl7lS34d4da53OSYhykTXNyy4g0ODMIL7jzCChSa5jnIy+XPqITBmadvMlBVBXYRwxFstbV2nj2qb0+YHnJP4EpiKhV2DgFzsyJUnIqGUzC+7AzoLpiBfjBBD9gAsmRxujdlKs/fL8iyXlwNrBRaZAtMnNrGib2Fc2u3t7eeQTn42gc8xo8D3yys4s==VJL0-----END PGP SIGNATURE-----

Closed
?