2011-07-18 10:02:12 +02:00
|
|
|
#!/usr/bin/python
|
2011-07-15 07:32:04 +02:00
|
|
|
#
|
|
|
|
# Entropy Server QA executable hook.
|
|
|
|
# This file doesn't strictly need to be a shell script, but just an executable
|
|
|
|
# file (r-xr-xr-x) and (mandatory) owned by root:root.
|
|
|
|
# Please rename this file by stripping the .example part
|
|
|
|
#
|
|
|
|
# It is used by Entropy Server QA routines to perform package metadata
|
|
|
|
# validation.
|
|
|
|
# Metadata is export in environmental variables form, and include:
|
|
|
|
#
|
|
|
|
# REPOSITORY_ID = repository identifier
|
|
|
|
# PKG_ID = package identifier
|
|
|
|
# PKG_ATOM = package atom
|
|
|
|
# PKG_NAME = package name
|
|
|
|
# PKG_VERSION = package version
|
|
|
|
# PKG_TAG = package version tag
|
|
|
|
# PKG_DESCRIPTION = package description
|
|
|
|
# PKG_CATEGORY = package category
|
|
|
|
# PKG_CHOST = package CHOST
|
|
|
|
# PKG_CFLAGS = package CFLAGS
|
|
|
|
# PKG_CXXFLAGS = package CXXFLAGS
|
|
|
|
# PKG_HOMEPAGE = package homepage
|
|
|
|
# PKG_LICENSE = package license
|
|
|
|
# PKG_BRANCH = package license
|
|
|
|
# PKG_DOWNLOAD = package relative download URL
|
|
|
|
# PKG_MD5 = package file md5 hash
|
|
|
|
# PKG_SLOT = package slot
|
|
|
|
# PKG_ETPAPI = package Entropy API
|
|
|
|
# PKG_DATE = package creation date (in unix time)
|
|
|
|
# PKG_SIZE = package size, in bytes
|
|
|
|
# PKG_REVISION = package entropy revision
|
|
|
|
# PKG_DEPS = list (\n separated) of package dependencies and conflicts
|
|
|
|
# PKG_NEEDED_LIBS = list (\n separated) of SONAMES required by package,
|
|
|
|
# including ELF class, so each item will look like this:
|
|
|
|
# <soname>|<elfclass>
|
|
|
|
# PKG_PROVIDED_LIBS = list (\n separated) of SONAMES provided by package,
|
|
|
|
# note: elf class and path are also provided,
|
|
|
|
# so each item will look like this:
|
|
|
|
# <soname>|<path of soname>|<elfclass>
|
|
|
|
# PKG_CONTENT = list (\n separated) of package files and dirs owned by package
|
|
|
|
#
|
|
|
|
# The executable must return 0 for success, 1 for warning, 2 for critical error
|
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import entropy.dep
|
2011-07-15 07:32:04 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
def check_unwanted_deps():
|
|
|
|
"""
|
|
|
|
Check against forbidden dependencies, those we consider meta packages,
|
|
|
|
placeholders just to keep Gentoo compatibility, which, if listed as dep in,
|
|
|
|
would cause the whole world to be pulled in.
|
|
|
|
"""
|
|
|
|
pkg_deps = os.getenv("PKG_DEPS")
|
|
|
|
if pkg_deps is None:
|
|
|
|
return 0
|
|
|
|
pkg_atom = os.getenv("PKG_ATOM")
|
2011-07-15 07:32:04 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
unwanted_deps = ["app-admin/packagekit", "app-text/poppler",
|
|
|
|
"kde-base/kde-l10n", "net-dns/avahi", "net-p2p/transmission"]
|
2011-08-19 16:13:13 +02:00
|
|
|
warning_deps = ["media-libs/libjpeg-turbo", "media-libs/jpeg",
|
|
|
|
"dev-lang/gnat-gcc"]
|
2011-07-18 10:02:12 +02:00
|
|
|
func_rc = 0
|
2011-08-19 16:13:13 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
pkg_deps = set([entropy.dep.dep_getkey(x) for x in pkg_deps.split()])
|
|
|
|
for unwanted_dep in unwanted_deps:
|
|
|
|
if unwanted_dep in pkg_deps:
|
|
|
|
sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n")
|
|
|
|
sys.stderr.write("%s contains forbidden dependency against %s\n" % (
|
|
|
|
pkg_atom, unwanted_dep))
|
|
|
|
sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n")
|
2011-08-19 16:13:13 +02:00
|
|
|
func_rc = 2
|
|
|
|
|
|
|
|
for warning_dep in warning_deps:
|
|
|
|
if warning_dep in pkg_deps:
|
|
|
|
sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n")
|
|
|
|
sys.stderr.write("%s contains a weirdo dependency against %s\n" % (
|
|
|
|
pkg_atom, warning_dep))
|
|
|
|
sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n")
|
2011-07-18 10:02:12 +02:00
|
|
|
func_rc = 1
|
2011-08-19 16:13:13 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
return func_rc
|
2011-07-15 07:32:04 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
if __name__ == "__main__":
|
2011-07-15 07:32:04 +02:00
|
|
|
|
2011-07-18 10:02:12 +02:00
|
|
|
exit_st = check_unwanted_deps()
|
|
|
|
if exit_st != 0:
|
|
|
|
raise SystemExit(exit_st)
|
|
|
|
raise SystemExit(0)
|