History log of /haikuporter/HaikuPorter/Policy.py
Revision Date Author Comments
# f197120d 18-Sep-2023 jurgenwigg <53076001+jurgenwigg@users.noreply.github.com>

Import statements sorted with isort and fixed MockBuilder.py (#266)

* Fixed missing closing bracket in the MockBuilder.py

* Import statements sorted with isort


# 2f5df641 20-Jul-2021 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Policy: improve needed library check.

* Also checks for versioned libraries, as these satisfy the
binary requirements.
* Fixes policy warnings for packages that don't provided
non-versioned shared libraries (e.g. krb5)


# eee899ad 11-Aug-2020 François Revol <revol@free.fr>

Policy: check if a package provides itself (#209)

This is a common mistake, like when the package name is different
than the provided command, it just happened to me again on hteditor.


# 8d5c14b6 31-Jan-2020 Michael Lotz <mmlr@mlotz.ch>

python3: Finish python3 change. python2 breaking

* Based on mmlr's 2017 work to use Python3 with
changes and adjustments for the current codebase


# 269954fb 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Make some constructs more idiomatic.

* Change 'not x in y' to 'x not in y'.
* Use 'is' to compare None singleton.
* Use 'instanceof(x, y)' instead of 'type(x) == y'.
* Replace map builtin with list comprehension.
* Rename self argument to cls for static method.


# 04a81d33 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Add missing raw string prefix to regex patterns.


# 9836ce60 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Whitespace and line length cleanup.


# 94ba1a7b 14-Nov-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

Allow packages to provides servers.

Because, why not?


# 458e05ac 15-Jul-2017 Jerome Duval <jerome.duval@gmail.com>

Policy: split RPATH, support relative rpaths.

* also checks whether a library is in the same directory or a 'lib' subdirectory.


# 281fb71f 03-Jul-2017 Jerome Duval <jerome.duval@gmail.com>

Policy: skip _APP_ dependencies.


# 8af88871 09-Feb-2017 Jerome Duval <jerome.duval@gmail.com>

Policy: checks files in apps/.

* also checks files in subdirs of apps/ and lib/.


# 39f25c77 12-Dec-2016 Jérôme Duval <jerome.duval@gmail.com>

Policy: check RPATH when searching libs in the package.


# 68e3958c 23-Oct-2016 Jérôme Duval <jerome.duval@gmail.com>

Implement local builders.

* provide info(), warn() to be used instead of print. By default outputs to stdout.
For builders, outputs to files.
* replace most calls to check_call by check_output, and log with info(). Also outputs
the outputs an eventual CalledProcessError output attribute.
* add option --local-builders to be used with --build-master: indicates how many
local builders to use instead of remote builders. If paramiko isn't available,
defaults to 1, otherwise 0.
* rename Builder to RemoteBuilder.
* remove changes of current directory: this doesn't work in a
multithreaded environnement. Policy.py is the most affected as it
expected to run in the packaging directory.


# 71a83f90 18-Dec-2016 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Use Unicode strings for warn() & sysExit().


# a47d11d6 21-Aug-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix policy error for libraries with uppercase name

The package requires are always converted to lowercase, but it was
compared with an uppercase name in the policy checks, leading to an
erroneous warning (or error in strict mode).


# 759c4ffc 30-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

Policy: Also make devel provides lowercase before checking it.

This applies the logic from 54619e to devel provides.


# 54619e94 14-Aug-2015 Augustin Cavalier <waddlesplash@gmail.com>

Policy: Make provides lowercase before checking it.


# 0a425188 04-Aug-2015 Augustin Cavalier <waddlesplash@gmail.com>

Policy: Ignore missing REQUIREs for syslibs.


# 66b58482 02-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

Remove local check_output, we're now using Python 2.7.


# 5950e18e 26-Dec-2014 Kacper Kasper <kacperkasper@gmail.com>

Fix false POLICY ERROR when readelf returned a library with an
absolute path


# 797d2b92 21-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup imports.


# f2c282bc 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: fix use of reserved keywords.

* Apparently, we were using reserved keywords as variable names, which
didn't seem to cause any problems, but could have done so in future
versions of Python.


# 476dbcbe 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: use properties where it seems fit.

* Trying to be somewhat more Pythonic.


# fc1d58c6 29-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Revert to tab spacing for Pe's sake.


# a5f922e3 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Try again with whitespace.


# 558fbdb0 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Second attempt to fix whitespace. Options are different on OS X.


# 429ec015 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Convert tabs to spaces.


# a397e6ff 26-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Shutup policy warning for cross-builds.

* Only show a warning about Haiku-libraries not being found in
/boot/system/lib/ when we are actually building on Haiku.


# 2d1dd34f 05-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Adjust to renamed SYS:PACKAGE attribute


# c4c8633b 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

/boot/common has been removed

Mostly the changes are straight-forward (don't look in /boot/common,
adjust paths). A notable change concerns the resolution of port
dependencies: We no longer simply include all /boot/system packages in
the chroot, but only those that have to be pulled in according to the
dependency resolution. This may break some recipes that don't declare
all the things they actually require for building, but have worked
previously due to those dependencies living in /boot/system.


# 0682f553 01-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Print summary for policy violations when done.


# a0a3c42b 09-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: support secondary architecture library checks


# d1084df9 07-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: ignore bin/<arch> for secondary architecture


# 99a61dae 19-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Unifiy the Options and GlobalConfig somewhat

* Module GlobalConfig is replaced with new module Configuration. The
global variable globalConfiguration is gone. Instead Configuration
provides getter methods.
* For several of the (newer) command line options there are now optional
configuration file entries. If given the command line values override
the configuration file values. Configuration also provides getter
methods for these options, which should be used instead of
getOption().


# 9ee2ba93 13-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add option '--command-package' to specify the package command


# 35f5dd1f 18-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix incorrect post-install directory path


# 1b885d81 17-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: add checks for post-install scripts


# 95fd6a8b 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add license header (MIT)

* additionally: uppercase copyright notices and separate them from the
top by a single line


# c37a0f81 15-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Detect misplaced lib*.a/la files


# b932259b 13-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: allow "non-packaged" as writable directory


# b66d9615 11-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: warn, when a used library couldn't be found


# 6ec702a5 10-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Also use provides of sibling packages for library checks

When verifying whether a needed library is also referred to by the
requires, we need to consider the sibling packages of the checked
package as possible providers of the library as well.


# d06edb91 09-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: check existence of devel:lib* provides


# d6f2b2f9 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Get rid of _has{Provides,Requires}Entry()

Introduce _normalizeResolvableName() instead. By using it explicitly
we also make sure that the resolvable name printed in a warning is
correct.


# d425e689 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Handle global writable/user settings directories


# 647ad9a8 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Follow renaming of global-settings-files attribute


# 7fa526b9 04-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Handle policy violations more intelligently

* Get rid of _severeViolation(). Now all violations are just warnings
in non-strict mode.
* Even in strict mode, just don't bail out when encountering the first
violation. Perform all checks first.


# 62fd2a19 04-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Remove setPort()

The port wasn't used yet and the method was invoked from the wrong
place (Port.__init__()) anyway.


# 90c602cf 29-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Fix dictionary access with potentially missing key


# 386a70ba 29-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Squash TODO about policy-checking source packages


# b4eb113a 28-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Check declared user settings files


# 8b03beef 28-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Check global settings files


# 1663e675 27-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Don't check source packages

Their directory layout is invalid ATM, as it consists of a source/ top
level directory and the recipe file also at the top level. Both should
probably end up in develop/source instead.


# 7bde22ab 27-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Fix _severeViolation() invocation


# efb16a16 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Fix _checkLibraryDependencies() dir iteration


# 34ce99a4 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: make sure bin/ exists before getting a listing


# e26d960d 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Implement checking for required libraries

Determine which libraries are needed by executables/libraries in bin/
respectively lib/ and check whether the respective requires are
declared. Doesn't account for transitive requires (yet). Though maybe
that isn't even desirable.


# 5a01fb18 25-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginning of packaging policy checking

* Add class Policy which contains the checks. Currently only a few.
* Add command line option -S/--strict-policy to enable strict policy
checking. Instead of printing warnings, the packaging will be
aborted.


# 797d2b925aa61ce548f35f9d3b255356c83f5936 21-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup imports.


# f2c282bc7e38769260bced0980765e02723e9d14 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: fix use of reserved keywords.

* Apparently, we were using reserved keywords as variable names, which
didn't seem to cause any problems, but could have done so in future
versions of Python.


# 476dbcbe3fe6d63d35a2ac5db1b789f2434e04a4 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: use properties where it seems fit.

* Trying to be somewhat more Pythonic.


# fc1d58c6abe57c99c11ec02b27be40844fb53572 29-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Revert to tab spacing for Pe's sake.


# a5f922e3fded4460be5a3c717862e7e588772487 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Try again with whitespace.


# 558fbdb04ff6cb063a4afba7f15b6f1bd0343af2 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Second attempt to fix whitespace. Options are different on OS X.


# 429ec015d0c47da50e302537ed33bc3f80d035a8 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Convert tabs to spaces.


# a397e6ff77a3501c87fa8b6ecf5494fdf1f7d309 26-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Shutup policy warning for cross-builds.

* Only show a warning about Haiku-libraries not being found in
/boot/system/lib/ when we are actually building on Haiku.


# 2d1dd34f9c84104e35359b22dacc005b39fb4aac 05-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Adjust to renamed SYS:PACKAGE attribute


# c4c8633bbdf41a3e81391183a4325444f08ed02d 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

/boot/common has been removed

Mostly the changes are straight-forward (don't look in /boot/common,
adjust paths). A notable change concerns the resolution of port
dependencies: We no longer simply include all /boot/system packages in
the chroot, but only those that have to be pulled in according to the
dependency resolution. This may break some recipes that don't declare
all the things they actually require for building, but have worked
previously due to those dependencies living in /boot/system.


# 0682f553df3d035e2b9fbcd537d1bb489b805150 01-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Print summary for policy violations when done.


# a0a3c42bdf46f9a103e310f4cfbc22cfd0d2efd9 09-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: support secondary architecture library checks


# d1084df94c1f8a513c91c4620d24e8014390f2b4 07-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: ignore bin/<arch> for secondary architecture


# 99a61dae85929042affb1fe60e038aa4149261d5 19-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Unifiy the Options and GlobalConfig somewhat

* Module GlobalConfig is replaced with new module Configuration. The
global variable globalConfiguration is gone. Instead Configuration
provides getter methods.
* For several of the (newer) command line options there are now optional
configuration file entries. If given the command line values override
the configuration file values. Configuration also provides getter
methods for these options, which should be used instead of
getOption().


# 9ee2ba93f86249973bfd1003a17da3bb4f7232cc 13-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add option '--command-package' to specify the package command


# 35f5dd1f657bf0be20bfac98dcd50a04529fa5c0 18-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix incorrect post-install directory path


# 1b885d817ad9100e5b8abcce31389265f8cc271c 17-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: add checks for post-install scripts


# 95fd6a8bd4d47186696c722b6717b2b073e799a1 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add license header (MIT)

* additionally: uppercase copyright notices and separate them from the
top by a single line


# c37a0f8134e9dd817adfbf204496e66beaa3cc46 15-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Detect misplaced lib*.a/la files


# b932259baed857a1dcd08bc094768047d0c56924 13-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: allow "non-packaged" as writable directory


# b66d9615ee5ae15c9ec1f26daf07115cc4607848 11-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: warn, when a used library couldn't be found


# 6ec702a54be0d0e4164481bac7c3e1e09efc90f0 10-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Also use provides of sibling packages for library checks

When verifying whether a needed library is also referred to by the
requires, we need to consider the sibling packages of the checked
package as possible providers of the library as well.


# d06edb914c710104c3aefc72a9f402f9f729241c 09-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: check existence of devel:lib* provides


# d6f2b2f9fc87fb95195e18ca5b2465f25cf4cbe7 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Get rid of _has{Provides,Requires}Entry()

Introduce _normalizeResolvableName() instead. By using it explicitly
we also make sure that the resolvable name printed in a warning is
correct.


# d425e689049fbb9be85619442cdfc06a5a8264c8 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Handle global writable/user settings directories


# 647ad9a8e88194c72037e3c32d7ef9678329c53c 08-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Follow renaming of global-settings-files attribute


# 7fa526b985a74859ecdb452af49030bc7e3b1ee2 04-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Handle policy violations more intelligently

* Get rid of _severeViolation(). Now all violations are just warnings
in non-strict mode.
* Even in strict mode, just don't bail out when encountering the first
violation. Perform all checks first.


# 62fd2a19857d55a44c98939899f8b0ee83c6b84f 04-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Remove setPort()

The port wasn't used yet and the method was invoked from the wrong
place (Port.__init__()) anyway.


# 90c602cf6a46d9ef3f1e01e04b0b5617b16bd1f1 29-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Fix dictionary access with potentially missing key


# 386a70bafd96913716f95d53e48654ba47343695 29-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Squash TODO about policy-checking source packages


# b4eb113ac642ca950e77973a72ff7eb2dbdcf1f4 28-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Check declared user settings files


# 8b03beeff3083cec880a690782a394371531b1d0 28-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Check global settings files


# 1663e67532f827b61182a3043e886bf0add9bfaa 27-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Don't check source packages

Their directory layout is invalid ATM, as it consists of a source/ top
level directory and the recipe file also at the top level. Both should
probably end up in develop/source instead.


# 7bde22ab51a5cada526c3ea6c697dc8e76ec0a14 27-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Fix _severeViolation() invocation


# efb16a16df7adfd5a8025637da18d9b613b456c5 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Fix _checkLibraryDependencies() dir iteration


# 34ce99a45b43cad848bc6b0c55280c7530f49a47 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: make sure bin/ exists before getting a listing


# e26d960d2837e059179266992904876f1639c3da 26-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Policy: Implement checking for required libraries

Determine which libraries are needed by executables/libraries in bin/
respectively lib/ and check whether the respective requires are
declared. Doesn't account for transitive requires (yet). Though maybe
that isn't even desirable.


# 5a01fb18cf3173725fea0f26497863bdfb3846de 25-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginning of packaging policy checking

* Add class Policy which contains the checks. Currently only a few.
* Add command line option -S/--strict-policy to enable strict policy
checking. Instead of printing warnings, the packaging will be
aborted.