FS#58186 - Add rmlint like step to makepkg and/or namcap
Attached to Project:
Pacman
Opened by Anadon Aeroheart (anadon) - Tuesday, 10 April 2018, 12:25 GMT
Last edited by Allan McRae (Allan) - Tuesday, 19 June 2018, 10:47 GMT
Opened by Anadon Aeroheart (anadon) - Tuesday, 10 April 2018, 12:25 GMT
Last edited by Allan McRae (Allan) - Tuesday, 19 June 2018, 10:47 GMT
|
Details
rmlint can save space by deduplicating files, and catch some
problems with empty directories and files which should
probably be done in all packaging anyways. It'd be nice if
it was integrated more into the build system.
|
This task depends upon
Closed by Allan McRae (Allan)
Tuesday, 19 June 2018, 10:47 GMT
Reason for closing: Won't implement
Additional comments about closing: Can be implemented as libmakepkg extension.
Tuesday, 19 June 2018, 10:47 GMT
Reason for closing: Won't implement
Additional comments about closing: Can be implemented as libmakepkg extension.
As for duplicate files, this seems like something which should be fixed upstream, not in packaging. Notice how we do not even enable emptydirs by default, because some packages create those deliberately, e.g. subdirectories of /etc which are owned by some UID which corresponds to a daemon user.
This *definitely* will not be enabled-by-default. It could cause "interesting" things to happen with e.g. files that have their abspath consulted for whatever reason.
Since current versions of makepkg are implemented as a library, it is easy to extend it (this is partly why it was refactored this way). Would you be interested in trying to implement a new tidy_install() dropin by creating a new file in /usr/share/makepkg/tidy/, which implements rmlint deduplication? This could be installed separately from makepkg, but if Allan likes it enough could be merged into the main codebase.
libmakepkg is pretty simple, we source /usr/share/makepkg/*.sh and each of those files, e.g. /usr/share/makepkg/tidy.sh, might itself source the corresponding /usr/share/makepkg/tidy/*.sh
So we can add files tidy/*.sh which define new functions and add their names to the arrays "tidy_remove" and "tidy_modify", then each element of both those arrays is run as a function in tidy_install() (from tidy.sh itself) when makepkg's core invokes it in between run_package (which runs the package() function from the PKGBUILD) and create_package (which writes metadata then tar's everything up).
Similar logic is used to make lint_{package,pkgbuild}.sh extensible (and lint_config.sh in one of my pending patchsets).
Also see https://aur.archlinux.org/packages/makepkg-optimize/ which does some similar work.