[pacman-dev] Utility functions for PKGBUILDs
I have noticed that the PKGBUILD's for the AUR packages that I maintain contain a lot of duplicate code. For example, license installation: install -D -m644 COPYING \ "$pkgname/usr/share/licenses/$pkgname/COPYING" appears frequently. It would be useful to have a utility function instead: # pkg-license <license file> function pkg-license() { install -D -m644 "$1" "$pkgdir/usr/share/licenses/$pkgname/$(basename $1)" } That would appear in package() as: pkg-license COPYING Other candidates are Python 2 shebang rewriting (pkg-py2rewrite), installing documentation (pkg-doc), Python setup.py calls (pkg-pyinst/pkg-py3inst), and patches (pkg-patch). Many other distros contain such functions. From what I've seen, the functions can help make packages more concise and less error prone. I will be taking a university course in open source software development over the summer. We need to pick a project to work on during the course. Would adding utility functions to makepkg/PKGBUILDs be acceptable to Arch? -Aaron DeVore
On 08.06.2012 09:31, Aaron DeVore wrote:
I will be taking a university course in open source software development over the summer. We need to pick a project to work on during the course. Would adding utility functions to makepkg/PKGBUILDs be acceptable to Arch?
I think that doesn't really fit into pacman since pacman tries to be distro agnostic so it would make more sense to put it in some kind of library. Sadly, putting it in a per distro library will make sharing pkgbuilds harder. With those functions it would also be less obvious what a pkgbuild is doing and you can't run each step of the pkgbuild in a shell any more (which is quite handy when trying to debug build problems). If you want to do something that has great chance of being pulled in, take a look at the pacman roadmap [1]. Also join #archlinux-pacman before starting to work on something to check if other people might already have partial patches ready. [1]: https://wiki.archlinux.org/index.php/Pacman_Roadmap -- Florian Pritz
On 08/06/12 17:31, Aaron DeVore wrote:
Many other distros contain such functions. From what I've seen, the functions can help make packages more concise and less error prone.
I will be taking a university course in open source software development over the summer. We need to pick a project to work on during the course. Would adding utility functions to makepkg/PKGBUILDs be acceptable to Arch?
So... I am all for reducing duplication of code, but have been quite wary of implementing this (there are _OLD_ bug reports about this in the tracker). The advantage of the PKGBUILD system is that you do not have to learn a language to implement a package. If you can build a package, you can easily create a PKGBUILD for it. Adding a library would not stop this (you can still build with the full commands), but it would lead to PKGBUILDs that required more than some basic bash knowledge to read. I think that disadvantage outweighs any advantage from adding a library to makepkg. Now I never like to send a potential contributor away. So have a look at the bug tracker and wiki as see if there is something else you would be interested in and let us know. I am sure we can help you get going on it. Allan
participants (3)
-
Aaron DeVore
-
Allan McRae
-
Florian Pritz