public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/
Date: Sat, 19 Jan 2013 02:27:15 +0000 (UTC)	[thread overview]
Message-ID: <1358562346.f8960360ebca8ae85b91e24047afc21f6eda33bb.zmedico@gentoo> (raw)

commit:     f8960360ebca8ae85b91e24047afc21f6eda33bb
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed May 20 21:46:46 2009 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jan 19 02:25:46 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f8960360

Change behaviour of getMinUpgrade

This allows to differentiate between situations where
the system is unaffected and unexistance of an upgrade path.

Previously, the glsa-check would treat GLSAs that had no
upgrade path (such as mask glsas) as not affecting the system.

svn path=/trunk/gentoolkit/; revision=647

http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=ef38a394c5c2f5901173a53914705730850f9b3f

---
 bin/glsa-check      |   10 ++++++++++
 pym/portage/glsa.py |   15 ++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/bin/glsa-check b/bin/glsa-check
old mode 100755
new mode 100644
index 0e2b7a3..969ad84
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -207,6 +207,11 @@ if mode in ["dump", "fix", "inject", "pretend"]:
 		elif mode == "fix":
 			sys.stdout.write("fixing "+myid+"\n")
 			mergelist = myglsa.getMergeList(least_change=least_change)
+			if mergelist == None:
+				sys.stdout.write(">>> no vulnerable packages installed\n")
+			elif mergelist == []:
+				sys.stdout.write(">>> cannot fix GLSA, no unaffected packages available\n")
+				sys.exit(2)
 			for pkg in mergelist:
 				sys.stdout.write(">>> merging "+pkg+"\n")
 				# using emerge for the actual merging as it contains the dependency
@@ -225,6 +230,11 @@ if mode in ["dump", "fix", "inject", "pretend"]:
 		elif mode == "pretend":
 			sys.stdout.write("Checking GLSA "+myid+"\n")
 			mergelist = myglsa.getMergeList(least_change=least_change)
+			if mergelist == None:
+				sys.stdout.write(">>> no vulnerable packages installed\n")
+			elif mergelist == []:
+				sys.stdout.write(">>> cannot fix GLSA, no unaffected packages available\n")
+				sys.exit(2)
 			if mergelist:
 				sys.stdout.write("The following updates will be performed for this GLSA:\n")
 				for pkg in mergelist:

diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py
index 514dcc0..76eae2b 100644
--- a/pym/portage/glsa.py
+++ b/pym/portage/glsa.py
@@ -342,8 +342,9 @@ def getMinUpgrade(vulnerableList, unaffectedList, portdbapi, vardbapi, minimize=
 	I{vulnerableList} and returns string describing
 	the lowest version for the package that matches an atom in 
 	I{unaffectedList} and is greater than the currently installed
-	version or None if the system is not affected. Both
-	I{vulnerableList} and I{unaffectedList} should have the
+	version. It will return an empty list if the system is affected,
+	and no upgrade is possible or None if the system is not affected.
+	Both I{vulnerableList} and I{unaffectedList} should have the
 	same base package.
 	
 	@type	vulnerableList: List of Strings
@@ -361,7 +362,7 @@ def getMinUpgrade(vulnerableList, unaffectedList, portdbapi, vardbapi, minimize=
 	@return:	the lowest unaffected version that is greater than
 				the installed version.
 	"""
-	rValue = None
+	rValue = ""
 	v_installed = reduce(operator.add, [match(v, vardbapi) for v in vulnerableList], [])
 	u_installed = reduce(operator.add, [match(u, vardbapi) for u in unaffectedList], [])
 
@@ -371,14 +372,14 @@ def getMinUpgrade(vulnerableList, unaffectedList, portdbapi, vardbapi, minimize=
 			install_unaffected = False
 
 	if install_unaffected:
-		return rValue
-	
+		return None
+
 	for u in unaffectedList:
 		mylist = match(u, portdbapi, match_type="match-all")
 		for c in mylist:
 			i = best(v_installed)
 			if vercmp(c.version, i.version) > 0 \
-					and (rValue == None \
+					and (rValue == "" \
 						or not match("="+rValue, portdbapi) \
 						or (minimize ^ (vercmp(c.version, rValue.version) > 0)) \
 							and match("="+c, portdbapi)) \
@@ -646,7 +647,7 @@ class Glsa:
 					for v in path["vul_atoms"]:
 						rValue = rValue \
 							or (len(match(v, self.vardbapi)) > 0 \
-								and getMinUpgrade(path["vul_atoms"], path["unaff_atoms"], \
+								and None != getMinUpgrade(path["vul_atoms"], path["unaff_atoms"], \
 										self.portdbapi, self.vardbapi))
 		return rValue
 	


             reply	other threads:[~2013-01-19  2:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19  2:27 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-17 17:43 [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ Zac Medico
2013-11-29 23:24 Mike Frysinger
2013-06-25  7:48 Zac Medico
2013-06-23 22:57 Zac Medico
2013-06-23 22:40 Zac Medico
2013-02-11  9:39 Zac Medico
2013-01-19  5:16 Zac Medico
2013-01-19  5:00 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  1:53 Zac Medico
2012-10-18  0:05 Zac Medico
2012-03-17 16:44 Zac Medico
2012-03-11  1:40 Mike Frysinger
2011-12-08  7:26 Zac Medico
2011-06-17 22:35 Zac Medico
2011-06-04  1:39 Zac Medico
2011-02-20  0:00 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358562346.f8960360ebca8ae85b91e24047afc21f6eda33bb.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox