import os
import re
import logging
+import glob
from distutils.version import LooseVersion
from pb_base.app import PbApplicationError
from pb_base.app import PbApplication
-__version__ = LooseVersion('0.3.0')
+__version__ = LooseVersion('0.4.0')
appname = os.path.basename(sys.argv[0])
log = logging.getLogger(appname)
'Invalid Package name %r in %r (%d) found.', mypkg,
filename, line_nr)
continue
+ valid = None
if isjustname(my_cpv):
- self.check_package(my_cpv, my_slot, None, None, my_operator)
+ valid = self.check_package(my_cpv, my_slot, None, None, my_operator)
else:
splitted = pkgsplit(my_cpv)
if self.verbose > 2:
log.debug("Splitted CPV: %r", splitted)
- self.check_package(
+ valid = self.check_package(
splitted[0], my_slot, splitted[1],
splitted[2], my_operator)
+ if valid:
+ log.info("Atom %r in %r (%d) seems to be valid.", mypkg,
+ filename, line_nr)
+ else:
+ log.warning("Atom %r in %r (%d) seems to be invalid.", mypkg,
+ filename, line_nr)
# -------------------------------------------------------------------------
def check_package(self, package, slot, version, release, operator):
"Checking package %r, slot %r, version %r, release: %r, operator %r ...",
package, slot, version, release, operator)
+ pkg_dirs_glob = os.path.join(self.pkg_dir, package + '-[0-9]*')
+ pkg_dirs = glob.glob(pkg_dirs_glob)
+ if not pkg_dirs:
+ log.info("Package %r seems not to be installed.", package)
+ return False
+
+ return True
+
# =============================================================================
if __name__ == "__main__":