The APT-RPM Lua interface is constantly being improved. This time, the following functions were added:
- pkgid() and verid()
- Return a unique integer identifying a package or a version.
- verpkg()
- Returns the parent package of some given version.
- verdeplist()
- Returns a list of dependencies for a given package, including complete information about it.
These new functions were introduced to give support for something which is frequently asked by APT-RPM users: the ability to discover which installed packages are not required by any other installed package.
Here is a script using these functions to list these packages. This script will be called list-nodeps, and will be available in the contrib/ directory of the next APT-RPM release.
-- Collect dependencies from installed packages deplist = {} verlist = {} for i, pkg in ipairs(pkglist()) do ver = pkgvercur(pkg) if ver then table.insert(verlist, ver) for i, dep in ipairs(verdeplist(ver)) do for i, depver in ipairs(dep.verlist) do deplist[verid(depver)] = true end end end end -- Now list all versions which are not dependencies for i, ver in ipairs(verlist) do if not deplist[verid(ver)] then name = pkgname(verpkg(ver)) if name ~= "gpg-pubkey" then -- Print package name and version without epoch -- (rpm -e friendly ;-). print(name.."-"..string.gsub(verstr(ver), "^%d+:", "")) end end end
More information about the introduced functions is available in https://moin.conectiva.com.br/AptRpm/Scripting