Siosm/siosm-selinux — pull request #15 by fishilico (2014-04-24 19:04:20+00:00)
Title: Add "compare_base.py" to help package maintenance

Hello,

A few months ago I've written a small Python script which checks for updates for every base packages that need to be recompiled with SELinux support ("the -selinux packages"). Now that I've cleaned up the code and tested it today, this script is in a kind of alpha state : it is working quite well on my system but it needs to be tested and reviewed, just to be sure there is no obvious bug lying around before pushing to ``master``...

I've written this script with the focus of keeping things simple and intuitive. So ``compare_base.py`` doesn't take any command line parameter, reads package information from ``base_pkglist.txt`` (new file written in a config-like language, with a documentation header) and downloads with ``yaourt -G`` the base packages into a ``base-noselinux/`` directory.

**From a maintainer point of view**, the major difference is that ``base_pkglist.txt`` needs to be updated after each update, because the PKGBUILDs of the -selinux packages don't include the ``pkgrel`` field of the base package. This would be quite simple, but as it is easy to forget I've added a check in the script which verify that the ``pkgver`` value is the same between ``PKGBUILD`` and ``base_pkglist.txt``. An other way of keeping track of the "base ``pkgrel`` value" could be adding a variable in ``PKGBUILD``, but I don't like this idea much.

Here are some ideas that weren't implemented but might be added in a future version of this script, if an elegant implementation is found:
* Automatically patch the downloaded PKGBUILDs to replace ``${pkgname}`` with ``${pkgname/-selinux}``, change the description text... so that the diff with the PKGBUILD of the -selinux packages is smaller.
* Print a link to the history of the base package (e.g. https://projects.archlinux.org/svntogit/packages.git/log/trunk/PKGBUILD?h=packages/systemd) when a needed update is detected, but without add too much output (maybe with an optional parameter?)

Finally, here are minor choices I've made:
* The script is compatible with both Python 2 and Python 3.
* I've put a MIT license because I don't like publishing source code with no license, but I can change to something else or remove it if this causes issues.

Nicolas