[PATCH] import: texlive: Check if Subversion is installed.

  • Open
  • quality assurance status badge
Details
4 participants
  • Liliana Marie Prikler
  • Xinglu Chen
  • yarl baudig
  • zimoun
Owner
unassigned
Submitted by
Xinglu Chen
Severity
normal
X
X
Xinglu Chen wrote on 22 Dec 2021 10:01
(address . guix-patches@gnu.org)
132d0f25d38be2a34abec3c43e4d685cdd0abe65.1640163645.git.public@yoctocell.xyz
Exit with a friendlier error message instead of throwing throwing a “failed with
signal 11” error if ‘svn’ isn’t in the user’s PATH.

$ guix import texlive getmap
command "svn" "export" "--non-interactive" "--trust-server-cert" "-r" "59745" "svn://www.tug.org/texlive/tags/texlive-2021.3/Master/texmf-dist/doc/latex/getmap/" "/tmp/guix-directory.YgfGgo/doc/latex/getmap/" failed with signal 11

* doc/guix.texi (Invoking guix import): Mention that Subversion has be
installed.
* guix/import/texlive.scm (tlpdb->package): Check if ‘svn’ is found in PATH,
if not exit with an error message.
---
doc/guix.texi | 4 +++-
guix/import/texlive.scm | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)

Toggle diff (51 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 333cb4117a..1ece51de81 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12020,7 +12020,9 @@
Information about the package is obtained from the TeX Live package
database, a plain text file that is included in the @code{texlive-bin}
package. The source code is downloaded from possibly multiple locations
-in the SVN repository of the Tex Live project.
+in the SVN repository of the Tex Live project. This means that the
+@code{subversion} package has to be installed in order for the importer
+to work.
The command command below imports metadata for the @code{fontspec}
TeX package:
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index bdef9f58b0..e3b870efa0 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -37,6 +38,8 @@ (define-module (guix import texlive)
#:use-module (guix utils)
#:use-module (guix upstream)
#:use-module (guix packages)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
#:use-module (guix build-system texlive)
#:export (texlive->guix-package
texlive-recursive-import))
@@ -204,6 +207,10 @@ (define (files->directories files)
equal?)))
(define (tlpdb->package name package-database)
+ ;; Check if 'svn' is available.
+ (unless (search-path (string-split (getenv "PATH") #\:) "svn")
+ (leave (G_ "the 'svn' program has to be in your PATH~%")))
+
(and-let* ((data (assoc-ref package-database name))
(dirs (files->directories
(map (lambda (dir)

base-commit: 87e5502d406bfb44b61f7577b241602e02a3498e
--
2.33.1
L
L
Liliana Marie Prikler wrote on 22 Dec 2021 12:50
62f7af317db40e543c8e329ccf86849cda08eca4.camel@ist.tugraz.at
Am Mittwoch, dem 22.12.2021 um 10:01 +0100 schrieb Xinglu Chen:
Toggle quote (11 lines)
> Exit with a friendlier error message instead of throwing throwing a
> “failed with
> signal 11” error if ‘svn’ isn’t in the user’s PATH.
>
>   $ guix import texlive getmap
>   command "svn" "export" "--non-interactive" "--trust-server-cert" "-
> r" "59745"
> "svn://
> www.tug.org/texlive/tags/texlive-2021.3/Master/texmf-dist/doc/latex/getmap/
> " "/tmp/guix-directory.YgfGgo/doc/latex/getmap/" failed with signal
> 11
Shouldn't we use a guix-built svn here (as in svn-fetch)?
X
X
Xinglu Chen wrote on 22 Dec 2021 14:42
87a6gswyb4.fsf@yoctocell.xyz
Am Mittwoch, der 22. Dezember 2021, um 12:50 +01, schrieb Liliana Marie Prikler:

Toggle quote (14 lines)
> Am Mittwoch, dem 22.12.2021 um 10:01 +0100 schrieb Xinglu Chen:
>> Exit with a friendlier error message instead of throwing throwing a
>> “failed with
>> signal 11” error if ‘svn’ isn’t in the user’s PATH.
>>
>>   $ guix import texlive getmap
>>   command "svn" "export" "--non-interactive" "--trust-server-cert" "-
>> r" "59745"
>> "svn://
>> www.tug.org/texlive/tags/texlive-2021.3/Master/texmf-dist/doc/latex/getmap/
>> " "/tmp/guix-directory.YgfGgo/doc/latex/getmap/" failed with signal
>> 11
> Shouldn't we use a guix-built svn here (as in svn-fetch)?

Which ‘svn-fetch’ are you referring to (there are two AFAICS)? The
Texlive importer uses ‘download-multi-svn-to-store’, which itself uses
‘svn-fetch’ from (guix build svn), but it requires the ‘svn’ program to
be in PATH.

There is another ‘svn-fetch’ procedure, in (guix svn-download), but that
one returns a fixed-output derivation, so it can only be used if we
already know the hash (which we don’t, that’s why we are fetching the
SVN repo).

Importers that fetch a Git repo don’t need ‘git’ to be in PATH since
they use the Guile-Git bindings to libgit2. But we don’t have Guile
bindings to SVN (or Hg, CVS, Bzr), so the program has to be installed on
the host system.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmHDK08VHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5uoMP+QGGE28xe784P/6eUHFfhb+rg9Dp
kdutC/jMFXcO3b9tWC89TrFRVKmYYXbu/FrqB5yWA4sxrWMMzHzNMvLE7+GiTvWc
1sfBB1nTlrAwZN+BP9DYuw5dlrD/6lEnLtvNxt6RTuCuS8pQfiHi2jl3zjsLaorH
T8YTbqhYo1w1ty2itbKbYApqS3ypkqP6r0moYZlWq2n5rkp+JNoIS44/l+DiwWKI
KXDXdOIKSFs2ZzHEqBlsavzSRh3j5IgS0gUkLRobUuSHwBaZhj9DLPcMqhc3wyXz
yi4yc4D9qzToJOL4Zeh8mwXu9PQagFN5gZKR48ASyLoIgB4SM9zHmBEAvuSeQpbo
4//akF2esmsjSugIi0zeMjUxGTiN0qDSwy6vLyZPp3WJQEUW9OEgCO11TEJ7p/t9
vhMxY3sSh3fBj6oHbJ+acEBLz7wh1gSC7pQj1y5XvhY0w9ZxqWKsWWcMzB9MbXaZ
voUUT2+S+mAQRlogfKt7GvMFUEy5SdGZ/rl68EzylIuOYPMD6UfdX+ElAMZS6qz+
emx2JrljCMfte/UpKiZum1+CKYOsUTuLNrmhS4D5XapkZEi0YSGDY0Mjwa4/hEkd
WQ3RMzmutykVKIxeOSg6/HX3A7dhfGlNQdoD2sDC7dzOOj+5A6/0c/KjlqnsdxDj
YTECt4obZk0WX2pd
=s3cu
-----END PGP SIGNATURE-----

Z
Z
zimoun wrote on 22 Dec 2021 15:23
Re: [bug#52731] [PATCH] import: texlive: Check if Subversion is installed.
867dbwsop1.fsf@gmail.com
Hi,

Your patch is an improvement considering this old discussion [1].



On Wed, 22 Dec 2021 at 14:42, Xinglu Chen <public@yoctocell.xyz> wrote:

Toggle quote (10 lines)
> Which ‘svn-fetch’ are you referring to (there are two AFAICS)? The
> Texlive importer uses ‘download-multi-svn-to-store’, which itself uses
> ‘svn-fetch’ from (guix build svn), but it requires the ‘svn’ program to
> be in PATH.
>
> There is another ‘svn-fetch’ procedure, in (guix svn-download), but that
> one returns a fixed-output derivation, so it can only be used if we
> already know the hash (which we don’t, that’s why we are fetching the
> SVN repo).

The one in (guix svn-download) uses under the hood (guix build svn), if
I read correctly:

Toggle snippet (11 lines)
#~(begin
(use-modules (guix build svn))
(svn-fetch '#$(svn-reference-url ref)
'#$(svn-reference-revision ref)
#$output
#:svn-command (string-append #+svn "/bin/svn")
#:recursive? #$(svn-reference-recursive? ref)
#:user-name #$(svn-reference-user-name ref)
#:password #$(svn-reference-password ref)))))

Anyway. :-)

Toggle quote (5 lines)
> Importers that fetch a Git repo don’t need ‘git’ to be in PATH since
> they use the Guile-Git bindings to libgit2. But we don’t have Guile
> bindings to SVN (or Hg, CVS, Bzr), so the program has to be installed on
> the host system.

I think it is not related how the call is done, here (invoke “svn”
“export” …) and not (libsvn-export …).

In the snippet above, #+svn is transparently picked from the current
subversion package. Maybe the bit

Toggle snippet (6 lines)
(define (subversion-package)
"Return the default Subversion package."
(let ((distro (resolve-interface '(gnu packages version-control))))
(module-ref distro 'subversion)))

could go to ’(guix build svn)’, used overthere instead of “#:key
(svn-command "svn")”; and maybe exported if needed.

WDYT?




Cheers,
simon
X
X
Xinglu Chen wrote on 22 Dec 2021 16:21
8735mkwtpu.fsf@yoctocell.xyz
Hi,

zimoun schrieb am Mittwoch der 22. Dezember 2021 um 15:23 +01:

Toggle quote (6 lines)
> Hi,
>
> Your patch is an improvement considering this old discussion [1].
>
> 1: <https://issues.guix.gnu.org/issue/28303#5>

Oh, looks like this has been a problem for a while, and I suspect that
it was the root cause of [1] too.


Toggle quote (37 lines)
> On Wed, 22 Dec 2021 at 14:42, Xinglu Chen <public@yoctocell.xyz> wrote:
>
>> Which ‘svn-fetch’ are you referring to (there are two AFAICS)? The
>> Texlive importer uses ‘download-multi-svn-to-store’, which itself uses
>> ‘svn-fetch’ from (guix build svn), but it requires the ‘svn’ program to
>> be in PATH.
>>
>> There is another ‘svn-fetch’ procedure, in (guix svn-download), but that
>> one returns a fixed-output derivation, so it can only be used if we
>> already know the hash (which we don’t, that’s why we are fetching the
>> SVN repo).
>
> The one in (guix svn-download) uses under the hood (guix build svn), if
> I read correctly:
>
> --8<---------------cut here---------------start------------->8---
> #~(begin
> (use-modules (guix build svn))
> (svn-fetch '#$(svn-reference-url ref)
> '#$(svn-reference-revision ref)
> #$output
> #:svn-command (string-append #+svn "/bin/svn")
> #:recursive? #$(svn-reference-recursive? ref)
> #:user-name #$(svn-reference-user-name ref)
> #:password #$(svn-reference-password ref)))))
> --8<---------------cut here---------------end--------------->8---
>
> Anyway. :-)
>
>> Importers that fetch a Git repo don’t need ‘git’ to be in PATH since
>> they use the Guile-Git bindings to libgit2. But we don’t have Guile
>> bindings to SVN (or Hg, CVS, Bzr), so the program has to be installed on
>> the host system.
>
> I think it is not related how the call is done, here (invoke “svn”
> “export” …) and not (libsvn-export …).

My point was that because we don’t have Guile bindings to any VCS except
Git, the user needs to have the corresponding VCS program installed in
order for the importer to fetch the repo.

Toggle quote (15 lines)
> In the snippet above, #+svn is transparently picked from the current
> subversion package. Maybe the bit
>
> --8<---------------cut here---------------start------------->8---
> (define (subversion-package)
> "Return the default Subversion package."
> (let ((distro (resolve-interface '(gnu packages version-control))))
> (module-ref distro 'subversion)))
> --8<---------------cut here---------------end--------------->8---
>
> could go to ’(guix build svn)’, used overthere instead of “#:key
> (svn-command "svn")”; and maybe exported if needed.
>
> WDYT?

Sure, that sounds like a nice refactoring. It seems to apply to the
other VCSs too. :-)
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmHDQo0VHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5HwwP/1JgpWR8n7GobMWGMbUzkNyMCloQ
Nz9iqIPLfkBqoM6ck8ptnJSGIAL0xmUpQ7r+eneUFDxRdqpNQL6us+841UuvG5ro
+81xEM6YzPu78E3LWnZSWBQrg4ZOlPWumye4iVD3gr1I2hSFnp04NY4YCr66AOo7
eabvPLXNk0LtMVLnpIfm4ty9wOIv8xcISzLbKkKVoU7Ci+RMT2Ig2Lt9WQifqZs6
4zSqSNqgtm9fFLZJqPLQSTGJHJ6kGmsQsthMvXzFlZm6/Yz27Borlrp+SpXyHHn/
z5FGd350opXweYE3WZ8iMecSuoLNHFpy2rDgWf4VfXOZRTx9X8xFLc19zxkv7IaU
vcIiiXAR0DmJuiCJ+bXBcblvE+3bgTZROp2uZafnWC89ptTxBTIu38wVIPzpNbvT
/zKiTjsuEnt5m2xAPxDiGesoG67KVrp40UvIRnNHTdKtSc4j6/Z17jKLRWZ1r4sT
oP4UBfnbZZFbELE1+LUX4heYhqllfFQLm2SXNWvSImxLJN8h78qaJq/KBGIxP/iG
s09OrXbsmAPuiGCcHzIms0AxCnUQPyNL6utoWV/niNPl4YFHl11RwYu4imC0LYC7
8umw2Ww3XuQcSLNZZqtLs1gacBxpgcZICYIxaiVYtFLUMvKjZoS0wPl8UKzrwsDO
C6kClh/2lYQ3QHXr
=VQQF
-----END PGP SIGNATURE-----

Y
Y
yarl baudig wrote on 17 Nov 2022 14:10
(no subject)
(address . 52731@debbugs.gnu.org)
ea-mime-637632a9-350-b5b49e0@www.mailo.com
May I raise back this issue as I lost some time understanding why I couldn't "guix import texlive ...". All I needed was subversion installed. Can this be at least documented in the manual please?
?