From patchwork Sun Sep 30 00:01:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [bitbake-devel, 1/2, v2] utils.py: Check for duplicate dependency entries Date: Sun, 30 Sep 2012 00:01:44 -0000 From: Mark Hatle X-Patchwork-Id: 37477 Message-Id: <1348963305-26122-1-git-send-email-mark.hatle@windriver.com> To: explode_dep_versions is not able to have duplicate entries. Previously duplicate entries ended up with the last item being the one returned to the caller. We now detect a collision. We do allow an empty item to have a comparison added to it, or a duplicate with the same comparison without error. When a collision is detected a ValueError exception is thrown. Allowed: foo foo (= 1.12) foo Invalid: foo (= 1.12) foo (= 1.13) Signed-off-by: Mark Hatle --- lib/bb/utils.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 82dab6b..d032ab2 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -157,9 +157,12 @@ def explode_dep_versions(s): elif inversion and i.endswith(')'): inversion = False lastver = lastver + " " + (i[:-1] or "") + if lastdep in r and r[lastdep] and r[lastdep] != lastver: + raise ValueError("Error, item %s appeared in dependency string '%s' multiple times with different values. explode_dep_versions cannot cope with this." % (lastdep, s)) r[lastdep] = lastver elif not inversion: - r[i] = None + if not (i in r and r[i]): + r[i] = None lastdep = i lastver = "" elif inversion: