aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Meier <maekke@gentoo.org>2014-01-12 18:16:04 +0100
committerMarkus Meier <maekke@gentoo.org>2014-01-12 18:16:04 +0100
commit5c08767575176538df707728d08b88a45aaafade (patch)
treec4fb31bbd81d5e4c11681bfc7d352a3ceae2023b /scripts
parentdrop obsolete cinepaint configure argument (diff)
downloadmaekke-5c08767575176538df707728d08b88a45aaafade.tar.gz
maekke-5c08767575176538df707728d08b88a45aaafade.tar.bz2
maekke-5c08767575176538df707728d08b88a45aaafade.zip
add scripts to detect missing subslot operator deps
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore2
-rwxr-xr-xscripts/check-subslot-deps.py81
-rwxr-xr-xscripts/subslotted-packages.sh16
3 files changed, 99 insertions, 0 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
new file mode 100644
index 0000000..06bb02a
--- /dev/null
+++ b/scripts/.gitignore
@@ -0,0 +1,2 @@
+subslotted-packages.txt
+missing-subslot.txt
diff --git a/scripts/check-subslot-deps.py b/scripts/check-subslot-deps.py
new file mode 100755
index 0000000..01ec212
--- /dev/null
+++ b/scripts/check-subslot-deps.py
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+from portage.dbapi.porttree import portdbapi
+from portage.versions import catpkgsplit
+import io
+import re
+
+class CheckSubSlot:
+ def __init__(self):
+ self.dbapi = portdbapi()
+ self.subslottedCp = []
+ with open("subslotted-packages.txt", "r") as f:
+ for line in f:
+ self.subslottedCp.append(line[:-1])
+
+ def checkPackage(self, cpv):
+ deps = self._getDepend(cpv)
+ missingSubSlotDep = []
+ for dep in deps:
+ cp = self._getCP(dep)
+ if cp in self.subslottedCp and not self._isSubSlotDep(dep):
+ missingSubSlotDep.append(cp)
+ if len(missingSubSlotDep) > 0:
+ missingSubSlotDep = set(missingSubSlotDep)
+ print("%s: %s" % (cpv, " ".join(missingSubSlotDep)))
+
+ def _getDepend(self, cpv):
+ deps = self.dbapi.aux_get(cpv, ["DEPEND", "RDEPEND"])
+ deps = deps[0] + " " + deps[1]
+ result = []
+ for dep in deps.split():
+ if self._isValidAtom(dep):
+ result.append(dep)
+ return set(result)
+
+ def _isValidAtom(self, pkg):
+ result = False
+ try:
+ if pkg[0] == "!":
+ result = False
+ elif pkg.find("/") > 0:
+ result = True
+ except:
+ result = False
+ return result
+
+ def _getCP(self, pkg):
+ # drop ><= from the beginning
+ if pkg[0] in (">", "<", "="):
+ pkg = pkg[1:]
+ if pkg[0] == "=":
+ pkg = pkg[1:]
+
+ dotPos = pkg.find(":")
+ bracketPos = pkg.find("[")
+ if dotPos > 0:
+ pkg = pkg[0:dotPos]
+ elif bracketPos > 0:
+ pkg = pkg[0:bracketPos]
+ res = catpkgsplit(pkg)
+ if res:
+ return res[0] + "/" + res[1]
+ return pkg
+
+ def _isSubSlotDep(self, pkg):
+ m = re.search(":[0-9]*?=", pkg)
+ return m is not None
+
+ def getPackages(self, categories=None):
+ return self.dbapi.cp_all(categories=categories)
+
+ def getPackageVersions(self, cp):
+ return self.dbapi.cp_list(cp)
+
+c = CheckSubSlot()
+pkgs = c.getPackages()
+for pkg in pkgs:
+ cpvs = c.getPackageVersions(pkg)
+ for cpv in cpvs:
+ c.checkPackage(cpv)
+
diff --git a/scripts/subslotted-packages.sh b/scripts/subslotted-packages.sh
new file mode 100755
index 0000000..c34ced2
--- /dev/null
+++ b/scripts/subslotted-packages.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# find packages with subslots
+
+PORTDIR="${HOME}/cvs/gentoo-x86"
+
+pushd "${PORTDIR}" > /dev/null
+
+for pkg in $(find . -mindepth 2 -maxdepth 2 -type d | sort) ; do
+ pushd ${pkg} > /dev/null
+ if [[ -n $(find . -name '*.ebuild') ]] ; then
+ [[ -n $(egrep "SLOT=\"?[0-9]*\/" *.ebuild) ]] && echo ${pkg/\.\//}
+ fi
+ popd > /dev/null # ${pkg}
+done
+
+popd > /dev/null # ${PORTDIR}