sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.65k stars 98 forks source link

Package manager borked #843

Closed mhosken closed 2 years ago

mhosken commented 4 years ago

Inserting the line: print("In("..lfs.currentdir()..") git pull") appropriately in core/packagemanager.lua and then run with sile -e 'installPackage("fontproof");os.exit()' gives the output: In(/usr/local/share/sile/packagemanager/fontproof) git pull.

Please fix this so that we can actually use this sile. I have no idea what you think you want it to do, so I have to leave this to you.

simoncozens commented 4 years ago

That's what I would expect it to do - it changes to where it has previously cloned the fontproof repo and does a pull and checkout so that you have the latest version.

Is this happening on first installation of the package? If so then there's something wrong with the way it detects whether or not the package is already installed, and it's thinking it should do an upgrade.

alerque commented 4 years ago

I have yet to use or even look seriously at the 'package manager', but I think it is borked. A user space app should never try (and normally shouldn't be able to) write files under /usr/local/ anything. The only conceivable places it should be using are $HOME, $PWD, or a location relative to the file being processed.

simoncozens commented 4 years ago

OK, fair point. Perhaps we should add $HOME/.sile to the default load path and install modules there.

mhosken commented 4 years ago

In addition. If you check out a repo against a tag rather than a branch, you can't then do a git pull against a git repo in a detached head state. That's what caused the error message and failure more than the location:

$ sudo sile -e 'installPackage("fontproof");os.exit()'
This is SILE v0.10.3.r20-g151ff73-dirty
Loading catalogue from https://raw.githubusercontent.com/sile-typesetter/sile-packages/master/packages.lua
Writing 697 bytes to /usr/local/share/sile/packagemanager/catalogue.lua
Package catalogue reloaded
In(/usr/local/share/sile/packagemanager/fontproof) git pull
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

! Error updating repository for package fontproof: nil at   <nowhere>
mhosken commented 4 years ago

This is a side related topic. I'm not sure if a package manager is allowed to add files into the subtree of another package as in fontproof adding files into /usr/share/sile/packages (and classes). If the package can do that, then there is no problem, otherwise we need some kind of mechanism for registering locally installed packages in other directories.

simoncozens commented 4 years ago

@mhosken: Can you try changing the "git pull" for a "git fetch"?