Lua2pack: Generate distribution packages from Luarocks
This script allows to generate RPM spec files from Luarocks.
To install lua2pack from the Python Package Index, simply:
$ python3 -mpip install lua2packYou can also check your distro of choice if they provide packages.
Lets suppose you want to package luarock named path. First of all, you can download rockspec file and fetch source
$ luarocks download --rockspec path
$ lua2pack fetch --rockspec 'glob://./*.rockspec'
Cloning into 'lua-path'...
remote: Enumerating objects: 288, done.
remote: Total 288 (delta 0), reused 0 (delta 0), pack-reused 288 (from 1)
Receiving objects: 100% (288/288), 33.78 KiB | 6.76 MiB/s, done.
Resolving deltas: 100% (155/155), done.
Note: switching to '35f8e6b0e8f9a735ecc5b4834147fad83e42851d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
Packed: /tmp/tmp9utki30_/path-1.1.0-1.src.rock
Successfully packed /tmp/tmp9utki30_/path-1.1.0-1.rockspec in /tmp/tmp9utki30_
Done. You may now enter directory
path-1.1.0-1/lua-path
and type 'luarocks make' to build.
Successfully unpacked /tmp/tmp9utki30_/path-1.1.0-1.src.rock in /tmp/tmp9utki30_
Successfully created /extra/home/suse/Desktop/path-1.1.0-1.tar.gzAs a next step you may want to generate a package recipe for your distribution. For RPM-based distributions you want to generate a spec file (named 'lua-path.spec'):
$ lua2pack generate --rockspec 'glob://./*.rockspec' --template 'generic.spec'The source tarball and the package recipe is all you need to generate the RPM (or DEB) file. This final step may depend on which distribution you use. For building source rpm file the complete recipe is:
$ rpmbuild -bs "-D_sourcedir $PWD" lua-path.spec
...Depending on the module, you may have to adapt the resulting spec file slightly. To get further help about lua2pack usage, issue the following command:
$ lua2pack --helpYou can test lua2pack from your git checkout by executing the lua2pack module.
Edit setup.py file changing the version number. From the lua2pack directory, install the lua2pack module locally.
$ pip install -e .Now you can run your hackish lua2pack version. It is usually located in $HOME/.local/bin/lua2pack
$ lua2packFork the repository on Github to start making your changes to the master branch (or branch off of it). Don't forget to write a test for fixed issues or implemented features whenever appropriate. You can invoke the testsuite from the repository root directory via tox:
$ toxYou can also run pytest directly:
$ pytestIt assumes you have the test dependencies installed (available on PYTHONPATH) on your system.
| copyright: |
|
|---|---|
| license: | Apache-2.0, see LICENSE for more details. |