lvjr / texfindpkg

Query or install TeX packages and their dependencies
https://ctan.org/pkg/texfindpkg
5 stars 0 forks source link

Installation problem and sudo prefix #2

Closed quark67 closed 1 year ago

quark67 commented 1 year ago

I have installed findpkg with TeX Live Utility (Mac GUI for tlmgr).

Result: In the Terminal, kpsewhich findpkg.lua outputs: /usr/local/texlive/2023/texmf-dist/tex/latex/findpkg/findpkg.lua.

So the installation seems correct.

But texlua findpkg.lua install array.sty in the Terminal output: Script file findpkg.lua not found.

As a average user, my working directory is /Users/my_user_name.

As I know nothing about the texlua command, I have tested texlua -help and discovered that it is a alias of luatex (because the answer begins with Usage: luatex ...).

So if I understand correctly, I must use cd command to go in /usr/local/texlive/2023/texmf-dist/tex/latex/findpkg/, and THEN use the command texlua findpkg.lua install array.sty?

I'm wrong or can I not use your command when I'm on my default working directory?

When I try this in Terminal (or use the cd command to go in the LaTeX installation, then the command texlua findpkg.lua install array.sty): texlua /usr/local/texlive/2023/texmf-dist/tex/latex/findpkg/findpkg.lua install array.sty

I obtain:

[findpkg] you are using texlive
[findpkg] finding dependencies for array.sty
[findpkg] installing package tools
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2023/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.

(effectively, when I install a new package with TeX Live Utility, a prompt ask for my admin password. By the way, what is the behaviour of your tool when we ask for a package already installed?).

By the way, if I understand correctly the purpose of your package, it is a great idea. Perhaps you can add an option like where, so with texlua findpkg.lua where \command (or {environment}) your tool display the name of the package which contains this command or environment without install it. Moreover, with an option like doc you can directly call texdoc to display the documentation of the package which contains this command or environment.

But please, can you make your tool working on user lever working directory?

And if you have the time, a more detailed documentation is welcome (for the moment, explain that your tool only work in the findpkg directory, which is on /usr/local/texlive/2023/texmf-dist/tex/latex/ after being installed with TeX Live Utility, and that we need prefix the command with sudo if I understand correctly). Thanks.

lvjr commented 1 year ago

By comparing l3build package on CTAN and on TeX Live, I think it is actually due to TeX Live incorrectly installed findpkg:

  1. The package files need to be put under scripts folder instead of tex/latex folder.
  2. TeX Live need to create a binary file findpkg which is equivalent to texlua findpkg.lua.

If TeX Live correctly installs findpkg, you could simply run findpkg install array.sty in any directory.

I wrote to Karl Berry before but got no response until now. Could you help to report this problem on TeX Live mailing list?

After this problem is solved, I can fix sudo problem on Linux and MacOS.

quark67 commented 1 year ago

Is it really a bug in TeX Live? For example, I see in the script folder of my LaTeX installation, the folder arara which contains:

/arara/
       arara.jar
       arara.sh
       rules/

And in CTAN (https://www.ctan.org/tex-archive/support/arara):

image

while for your package, the CTAN shows (https://www.ctan.org/tex-archive/support/findpkg):

image

So, doesn't the solution be to add your files findpkg.lua and findpkg.json (probably not findpkg.json.gz) be in a "scripts" folder when you send it to the CTAN ?

The package attachfile2 uses another method in CTAN.

It has also a folder in scripts folder for a pdfatfi.pl file in my LaTeX installation from TeX Live.

But on CTAN, we see (https://www.ctan.org/tex-archive/macros/latex/contrib/attachfile2):

image

There isn't a directory for a scripts folder.

But there is a .dtx file, which contains the lines:

image

So the package attachfile2 install files correctly without an explicit scripts folder in CTAN.

Hope this will help you. It's it doesn't I will write to the texlive mailing list, as suggested.

lvjr commented 1 year ago

Thank you. I think the most important thing is to upload a findpkg.tds.zip file next time (see here), because both arara and attachfile2 have it but findpkg doesn't have it.

I will do it in next release to see if this is the correct way to go.

quark67 commented 1 year ago

I have also seen this: https://ctan.org/help/upload-pkg

image

As you see in the highlight, the TDS structure is additional, not a remplacement.

And in your link (https://www.ctan.org/TDS-guidelines) we read: Some authors like to package their materials in a .zip file that is ready to unzip into a user's TEX tree. It's for the manual installation, not the installation provided by tlmgr (Tex Live manager) or TeX Live Utility.

So I think that the solution about the installation with TeX Live is to provide a .zip with the README.md in the root, and a /scripts folder which contains your two files (findpkg.lua and findpkg.json). I'm not sure about the later, perhaps you need to ask CTAN if you need to provide findpkg.json or findpkg.json.gz. The file installed by TeX Live need to be findpkg.json but at the https://www.ctan.org/tex-archive/support/findpkg page, do they need a findpkg.json or a findpkg.json.gz file?

As we can see in the first part of the picture in this answer (you don't provide a very large package, but you need in installation in the scripts folder), it's probably what you need to do.

Thanks for your valuable work.

lvjr commented 1 year ago

I got a reply from Karl Berry with several useful advices several minutes ago. And he suggested me to compress findpkg.json as findpkg.json.gz in my first upload to CTAN because the json file is too large .

lvjr commented 1 year ago

I have renamed findpkg to TeXFindPkg and added query action. The new release has reached TeX Live. Now you can simply run

texfindpkg query \fakeverb
texfindpkg install {frame}

Now TeXFindPkg will add sudo prefix when calling tlmgr on Linux and MacOS.