I've a .spec, building luarocks
https://pastebin.com/6DA94Ump
reading,
PackagingDrafts/Lua : Rocks
https://fedoraproject.org/wiki/PackagingDrafts/Lua#Rocks
per the tentative stmt there,
"Upstream Lua developers increasingly use LuaRocks to distribute their modules. We
are exploring providing better integration with LuaRocks in the future -- both in
generating spec files from .rockspec specifications, and in shipping a luarocks package
that can pick up existing RPM-installed Lua packages, but for the time being, you can use
upstream rockspec specifications to guide your packaging work."
my spec's currently configured to install the pkg as an rpm, & 4 rocks to be
installed _by_ the just-installed 'luarocks'
atm,
(1) install works.
(2) remove works.
(3) reinstall fails, running scriptlets out of expected order
TL;DR:
'reinstall' != 'remove' + 'install
I'm trying to fix the reinstall stage.
The spec contain a '%post' scriplet for rock installation
...
%post
for r in %{rocks_list}
do
echo "##!! Installing rock: ${r}"
luarocks install --force-fast ${r} CFLAGS="%{_CFLAGS}"
done
...
and '%preun' for rock removal
...
%preun
for r in %{rocks_list}
do
if [[ $( luarocks list --porcelain ${r} | cut -f1 ) == ${r} ]]
then
echo "##!! Removing rock: ${r}"
luarocks remove --force-fast --deps-mode=none ${r}
fi
done
...
checking stages,
@ (1), install
prior to install
tree /usr/lib/luarocks/ -L 3
/usr/lib/luarocks/
└── rocks-5.1
└── manifest
on install
dnf install compat-luarocks
...
Transaction Summary
...
##!! Installing rock: luasocket
Installing
https://luarocks.org/luasocket-3.0rc1-2.src.rock
luasocket 3.0rc1-2 is now installed in /usr (license: MIT)
...
##!! Installing rock: luasec
Warning: falling back to wget - install luasec to get native HTTPS support
Installing
https://luarocks.org/luasec-0.9-1.src.rock
luasec 0.9-1 is now installed in /usr (license: MIT)
...
##!! Installing rock: lua-resty-lrucache
Installing
https://luarocks.org/lua-resty-lrucache-0.09-2.src.rock
lua-resty-lrucache 0.09-2 is now installed in /usr (license: 2bsd)
...
##!! Installing rock: lua-resty-core
Installing
https://luarocks.org/lua-resty-core-0.1.17-4.src.rock
lua-resty-core 0.1.17-4 is now installed in /usr (license: BSD)
Installed:
compat-luarocks-v3.3.1-1.fc32.x86_64
Complete!
verifying
luarocks --version
/usr/bin/luarocks 3.3.1
LuaRocks main command-line interface
luarocks list --porcelain
lua-resty-core 0.1.17-4 installed /usr/lib/luarocks/rocks-5.1
lua-resty-lrucache 0.09-2 installed /usr/lib/luarocks/rocks-5.1
luasec 0.9-1 installed /usr/lib/luarocks/rocks-5.1
luasocket 3.0rc1-2 installed /usr/lib/luarocks/rocks-5.1
tree /usr/lib/luarocks/ -L 3
/usr/lib/luarocks/
└── rocks-5.1
├── lua-resty-core
│ └── 0.1.17-4
├── lua-resty-lrucache
│ └── 0.09-2
├── luasec
│ └── 0.9-1
├── luasocket
│ └── 3.0rc1-2
└── manifest
@ (2), remove
on remove
dnf remove compat-luarocks
...
##!! Removing rock: luasocket
Removing luasocket 3.0rc1-2...
Removal successful.
...
##!! Removing rock: luasec
Removing luasec 0.9-1...
Removal successful.
...
##!! Removing rock: lua-resty-lrucache
Removing lua-resty-lrucache 0.09-2...
Removal successful.
...
##!! Removing rock: lua-resty-core
Removing lua-resty-core 0.1.17-4...
Removal successful.
Removed:
compat-luarocks-v3.3.1-1.fc32.x86_64
Complete!
verifying
luarocks --version
/usr/bin/luarocks: No such file or directory
tree /usr/lib/luarocks/ -L 3
/usr/lib/luarocks/
└── rocks-5.1
└── manifest
@ (3), reinstall
1st, install
dnf install compat-luarocks
(... as above, in (1) ...)
tree /usr/lib/luarocks/ -L 3
/usr/lib/luarocks/
└── rocks-5.1
├── lua-resty-core
│ └── 0.1.17-4
├── lua-resty-lrucache
│ └── 0.09-2
├── luasec
│ └── 0.9-1
├── luasocket
│ └── 3.0rc1-2
└── manifest
now **reinstall**
dnf reinstall compat-luarocks
correctly starts the transaction, installing all the rocks, as in the 'install'
stage,
...
Running transaction
Preparing :
1/1
Reinstalling : compat-luarocks-v3.3.1-1.fc32.x86_64
1/2
Running scriptlet: compat-luarocks-v3.3.1-1.fc32.x86_64
1/2
##!! Installing rock: luasocket
Installing
https://luarocks.org/luasocket-3.0rc1-2.src.rock
luasocket 3.0rc1-2 is now installed in /usr (license: MIT)
##!! Installing rock: luasec
Installing
https://luarocks.org/luasec-0.9-1.src.rock
luasec 0.9-1 is now installed in /usr (license: MIT)
##!! Installing rock: lua-resty-lrucache
Installing
https://luarocks.org/lua-resty-lrucache-0.09-2.src.rock
lua-resty-lrucache 0.09-2 is now installed in /usr (license: 2bsd)
##!! Installing rock: lua-resty-core
Installing
https://luarocks.org/lua-resty-core-0.1.17-4.src.rock
lua-resty-core 0.1.17-4 is now installed in /usr (license: BSD)
but then *immmediately* continues to REMOVE the rocks,
Running scriptlet: compat-luarocks-v3.3.1-1.fc32.x86_64
2/2
##!! Removing rock: luasocket
Removing luasocket 3.0rc1-2...
Removal successful.
Missing dependencies for luasec 0.9-1:
luasocket (not installed)
##!! Removing rock: luasec
Removing luasec 0.9-1...
Removal successful.
##!! Removing rock: lua-resty-lrucache
Removing lua-resty-lrucache 0.09-2...
Removal successful.
Missing dependencies for lua-resty-core 0.1.17-4:
lua-resty-lrucache (not installed)
##!! Removing rock: lua-resty-core
Removing lua-resty-core 0.1.17-4...
Removal successful.
Cleanup : compat-luarocks-v3.3.1-1.fc32.x86_64
2/2
Running scriptlet: compat-luarocks-v3.3.1-1.fc32.x86_64
2/2
Verifying : compat-luarocks-v3.3.1-1.fc32.x86_64
1/2
Verifying : compat-luarocks-v3.3.1-1.fc32.x86_64
2/2
Reinstalled:
compat-luarocks-v3.3.1-1.fc32.x86_64
Complete!
leaving me with the *package* installed
rpm -qa | grep -i luarocks
compat-luarocks-v3.3.1-1.fc32.x86_64
luarocks --version
/usr/bin/luarocks 3.3.1
LuaRocks main command-line interface
but the rocks themselves UNinstalled/missing,
tree /usr/lib/luarocks/ -L 3
/usr/lib/luarocks/
└── rocks-5.1
└── manifest
luarocks list --porcelain
(empty)
It's clear that, in this^ example
reinstall != remove + install
In the same vein as
restart == (typically) stop + start
, shouldn't it?
If not, what's causing the %preun removal to exec AFTER the %post install?
And, how do I prevent that?