solus-packages/common/Scripts/helpers.fish
Rune Morling 32b4caeafd
helpers.*sh: Add reindex-localrepo convenience function
**Summary**
We have no convenient way to re-index our local repo.

Since it is quite a long command, why not add a convenience function to
do it correctly that is maintained by Solus Staff?

This commit does just that for all helper scripts.

Signed-off-by: Rune Morling <ermo@serpentos.com>
2024-01-20 18:56:19 +01:00

40 lines
1.2 KiB
Fish

#!/usr/bin/env fish
function __solus_package_dir
realpath (dirname (readlink (status -f)))/../..
end
function __solus_toplevel
git rev-parse --show-toplevel
end
function gotosoluspkgs -d "Go to the root of the Solus packages repository"
cd (__solus_package_dir)
end
function goroot -d "Go to the root of the current Git repository"
cd (__solus_toplevel)
end
function gotopkg -a package -d "Go to a package directory"
cd (__solus_toplevel)/packages/*/$package
end
function reindex-localrepo -d "Re-index the local repo and update eopkg's cache"
sudo eopkg index --skip-signing /var/lib/solbuild/local/ --output /var/lib/solbuild/local/eopkg-index.xml && \
sudo eopkg update-repo
end
function whatprovides -a library -d "Show packages that provide a certain library"
path basename (path dirname (grep $library (__solus_toplevel)/packages/*/*/abi_libs))
end
function whatuses -a library -d "Show packages that use a certain library"
path basename (path dirname (grep $library (__solus_toplevel)/packages/*/*/abi_used_libs))
end
complete -c gotosoluspkgs -f
complete -c goroot -f
complete -c gotopkg -f
complete -c gotopkg -a "(path basename (__solus_toplevel)/packages/*/*)"
complete -c whatprovides -f
complete -c whatuses -f