diff options
authorPaul Barker <>2014-11-15 16:00:44 +0000
committerPaul Barker <>2014-11-15 16:00:44 +0000
commit127b371319974b0c585969c234f85b2d5c860e34 (patch)
parent335fb1de6768d51811a4c90dfa122dc9a5161717 (diff)
opkg-show-deps: Add comments to explain code
There was some confusion discussed on the mailing list about what the various loops in this script were doing. Comments are added to explain the behaviour, hopefully preventing any confusion in the future. Thanks to Pavel Zubarev for bringing this up and helping me to clarify what the current code is doing. Signed-off-by: Paul Barker <>
1 files changed, 9 insertions, 0 deletions
diff --git a/opkg-show-deps b/opkg-show-deps
index 93465f3..3c3be6a 100755
--- a/opkg-show-deps
+++ b/opkg-show-deps
@@ -53,23 +53,32 @@ for i in list(packages.packages.keys()):
def find_package(name):
+ # Return all providers of the named package
if name in provider_hash:
return provider_hash[name]
return None
def process_dep(dep):
+ # Add a provider of the given dependency to the list of required packages
+ # unless a provider is already present in this list.
dep = re.sub("\s*\(.*\)", "", dep)
dep = re.sub("\*$", "", dep)
newpkgs = find_package(dep)
if newpkgs:
+ # Loop over all providers of the dependency and return early if any
+ # provider is already in the list of required pacakges - we only need
+ # one provider of this dependency.
for newpkg in newpkgs:
if newpkg.package in required:
+ # Select the first provider, add it to the required packages list and
+ # process its dependencies
sys.stderr.write("unsatisfied dependency of %s on '%s'\n" % (pkg.package, dep))
def recurse(pkg):
+ # Add a package to the required list and process its dependencies
required[pkg.package] = 1
if pkg.depends:
deps = split_list(pkg.depends)