From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from eggs.gnu.org ([2001:470:142:3::10]:58404)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1jSl7W-00071E-Ts
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:31:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1jSl7O-0001xY-OH
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:31:10 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:51515)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1jSl7O-0001vp-A0
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:31:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1jSl7O-0007Un-6s
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:31:02 -0400
Subject: [bug#40815] gnu: Add metamath
Resent-Message-ID: <handler.40815.B.158792221025720@debbugs.gnu.org>
Received: from eggs.gnu.org ([2001:470:142:3::10]:58288)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <kuba@kadziolka.net>) id 1jSl6F-0006m2-OQ
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:29:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1)
 (envelope-from <kuba@kadziolka.net>) id 1jSl6E-0007nU-NF
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:29:51 -0400
Received: from pat.zlotemysli.pl ([37.59.186.212]:51512)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <kuba@kadziolka.net>) id 1jSl6E-0007dg-3I
 for guix-patches@gnu.org; Sun, 26 Apr 2020 13:29:50 -0400
Date: Sun, 26 Apr 2020 19:29:45 +0200
From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= <kuba@kadziolka.net>
Message-ID: <20200426172945.7ez6i2fl3pjcoexd@gravity>
References: <3JR2ES0G0DYM2.3NI13ZSG185CK@wilsonb.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature"; boundary="mvry24ynlhbmxf7s"
Content-Disposition: inline
In-Reply-To: <3JR2ES0G0DYM2.3NI13ZSG185CK@wilsonb.com>
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+kyle=kyleam.com@gnu.org>
To: "B. Wilson" <elaexuotee@wilsonb.com>
Cc: 40815@debbugs.gnu.org


--mvry24ynlhbmxf7s
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Apr 24, 2020 at 08:48:30PM +0900, B. Wilson wrote:
> This is my first packaging attempt, so careful critiques are very
> welcome.

Welcome to Guix, then!

> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index 73ee161e81..c70557ef8f 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -38,6 +38,7 @@
>  ;;; Copyright =C2=A9 2020 R Veera Kumar <vkor@vkten.in>
>  ;;; Copyright =C2=A9 2020 Vincent Legoll <vincent.legoll@gmail.com>
>  ;;; Copyright =C2=A9 2020 Nicol=C3=B2 Balzarotti <nicolo@nixo.xyz>
> +;;; Copyright =C2=A9 2020 B. Wilson <elaexuotee@wilsonb.com>

Huh, we usually don't abbreviate first names. It's fine if you prefer it
this way, though. (BTW, the LaTeX on your website is broken.)

> +(define-public metamath
> +  (package
> +    (name "metamath")
> +    (version "0.182")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri "http://us2.metamath.org/downloads/metamath-program.zip")

This looks like an unversioned URL. That's not ideal, since when
upstream will release a new version, it will break the hash below. I
looked around on their website and couldn't find a versioned URL, but I
also couldn't find the one you're using. We could fetch from GitHub
instead...

> The package definition itself is pretty bog standard, apart from how
> the "doc" output is supplied. Upstream provides the official
> documentation as a pdf offered separately from the source. I decided
> to include this as an input and manually copy it over. Upstream does
> also have a repo with the TeX sources. Would it be better to typset it
> directly instead?

AFAIK, building from source is preferred. grep for texlive-union to see
how it can be done without pulling in gigabytes of dependencies.

The no-versioned-URL problem also applies to the documentation, and
this would let you solve two problems at once ;)

> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'install 'install-doc
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (mkdir-p (string-append (assoc-ref outputs "doc") "/share/d=
oc"))
> +             (copy-file (assoc-ref inputs "book")
> +                        (string-append (assoc-ref outputs "doc")
> +                                       "/share/doc/metamath.pdf")))))))

Let me cite an excerpt from your build log: ;)

## WARNING: phase `install-doc' returned `#<unspecified>'.  Return values o=
ther than #t
## are deprecated.  Please migrate this package so that its phase
## procedures report errors by raising an exception, and otherwise
## always return #t.

Also, consider binding the path to the /share/doc directory in a variable:
(let ((docdir (string-append ...)))
  (mkdir-p docdir)
  (copy-file (assoc-ref inputs "book")
             (string-append docdir "/metamath.pdf"))
  #t)

> Also, regarding my `install-doc' phase, is the way I copy over the
> /gnu/store/<hash>-metamath.pdf file reasonable? Unfortunately,
> `install-file' doesn't allow renaming the destination, so I had to
> mimic its effect. Is there a better, or more idiomatic way to do this
> kind of thing?

Nothing comes to mind as far as other alternatives for mkdir-p +
copy-file go.

> diff --git a/gnu/packages/patches/metamath-remove-missing-file-refs.patch=
 b/gnu/packages/patches/metamath-remove-missing-file-refs.patch
> new file mode 100644
> index 0000000000..bc4748de98
> --- /dev/null
> +++ b/gnu/packages/patches/metamath-remove-missing-file-refs.patch

Make sure to add this new file to gnu/local.mk!

> @@ -0,0 +1,17 @@
> +--- metamath.orig/Makefile.am	2020-01-27 20:43:55.650195602 +0900
> ++++ metamath/Makefile.am	2020-01-27 20:44:18.876578014 +0900
> +@@ -36,14 +36,6 @@
> + 	mmwtex.c \
> + 	$(noinst_HEADERS)
> +=20
> +-dist_pkgdata_DATA =3D \
> +-	big-unifier.mm \
> +-	demo0.mm \
> +-	miu.mm \
> +-	peano.mm \
> +-	ql.mm \
> +-	set.mm
> +-
> +=20
> + EXTRA_DIST =3D \
> + 	LICENSE.TXT \

I suppose your not including the databases is intentional, but the
reasoning behind that seems not entirely clear to me - wouldn't the
program be more useful when packaged with its database?

Regards,
Jakub K=C4=85dzio=C5=82ka

--mvry24ynlhbmxf7s
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl6lxQUACgkQ4xWnWEYT
FWTWrQ//YvS+LnMl9qyPMprweSuHNuo3ZitJ4qSwETrk3k7lXaRwW/vtL5+NTZKv
0H/gRNA23yEyfZ9spUNWQPS4Q52vYNtOg24yQFvYjPXUBVHSUzlHSVaQSXwbnIz5
RNY+B5orPum+plPbXxPSopuxXew1QmzSU5mqMxVbl445zlGEAv7j40TyIbnTWT0F
X14mYtu/RPll2EBhxmIu+xXXr963zGsgV8RU+7sb7DzuK0DKFesZW95wZdSu+eIE
Jv6vHxs9Xai33rFbEmz7j3zDKpUL9jTCju2xmvkP1Jl9yUPgKIpmwaPoIz1kiB01
qPTZIYXpekO5FOgaZkBsRS3pxtBLhWARDoEriyZ6LywXtlnLYS0PBqgf1fP386//
Aj8ueSvBR9G5d0JW/4ggtoAPrAUDg9ndhDSs5LGnROIWSKv52HwslBNzc5BA+7Ky
uHxbZG5EVbC7uvDSUtBJ3YAbgydJYCng3OF90UUnpgVKKXF6hTmF+N3jrFHPtiUf
XK0gKETUS2wi6PtX6nWeT5GPSTuGPF0i/MYF6QjdJPnpGkKLezNmMirnvarQNxiu
OH1T+vcbzGJ4xZXPAuKZ4hu4Uq3NNZGYugOT5Mvk5CzdPmAd/AS/jw75lAwUZFYf
+YXHSV8XYZDNfmA376KjikFgvuZCfHoQoYLFj/rQaN5mFS82PPQ=
=q6hC
-----END PGP SIGNATURE-----

--mvry24ynlhbmxf7s--