* [gentoo-commits] proj/portage:master commit in: /, lib/portage/
@ 2020-08-07 3:29 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2020-08-07 3:29 UTC (permalink / raw
To: gentoo-commits
commit: 0dffa633987a49c1a1d7e95edfe6afeb6269d1e5
Author: Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 7 00:03:31 2020 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug 7 02:53:11 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0dffa633
lib/*: exempt two core files from ungrouped-imports check
* These will take some time to refactor/address if at all possible.
* Turn on ungrouped-imports check for entire repo
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/portage/__init__.py | 1 +
lib/portage/checksum.py | 15 ++++++++-------
pylintrc | 1 +
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index 73bb1ed0d..916c93510 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -1,5 +1,6 @@
# Copyright 1998-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+# pylint: disable=ungrouped-imports
VERSION = "HEAD"
diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py
index d4a75c058..b5dae9672 100644
--- a/lib/portage/checksum.py
+++ b/lib/portage/checksum.py
@@ -1,20 +1,21 @@
# checksum.py -- core Portage functionality
# Copyright 1998-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+# pylint: disable=ungrouped-imports
-import portage
-from portage.const import PRELINK_BINARY, HASHING_BLOCKSIZE
-from portage.localization import _
-from portage import os
-from portage import _encodings
-from portage import _unicode_decode, _unicode_encode
import errno
import functools
import hashlib
+import portage
import stat
import subprocess
import tempfile
+from portage import _encodings, _unicode_decode, _unicode_encode
+from portage import os
+from portage.const import HASHING_BLOCKSIZE, PRELINK_BINARY
+from portage.localization import _
+
# Summary of all available hashes and their implementations,
# most preferred first. Please keep this in sync with logic below.
@@ -32,7 +33,7 @@ import tempfile
# SHA3_512: hashlib (3.6+), pysha3, pycrypto
-#dict of all available hash functions
+# Dict of all available hash functions
hashfunc_map = {}
hashorigin_map = {}
diff --git a/pylintrc b/pylintrc
index 9b0975329..f2aadf14f 100644
--- a/pylintrc
+++ b/pylintrc
@@ -28,6 +28,7 @@ enable=
trailing-newlines,
trailing-whitespace,
unexpected-line-ending-format,
+ ungrouped-imports,
unnecessary-semicolon,
unused-import,
useless-import-alias,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/
@ 2023-01-02 5:25 Sam James
0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-01-02 5:25 UTC (permalink / raw
To: gentoo-commits
commit: 0e56f99b34939bf38dcfc0f9edf43a51f6ccf3fe
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 2 04:52:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 2 05:25:51 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e56f99b
news: simplify isRelevant() check
Hopefully a bit easier to follow now. I'm also not convinced
it was right before, as the previous required every restriction.checkRestriction(...)
to be true, while the original code only required *one* to be true per
restriction.
Thanks to kurly for noticing a recent news item wasn't showing up.
Fixes: 9e24d0143450628f334cdb62e579efafd1bfd2ba
Fixes: 1ffaa70544f34e93df24c0a175105a900bf272bf
Signed-off-by: Sam James <sam <AT> gentoo.org>
NEWS | 2 ++
lib/portage/news.py | 15 ++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 773df02b0..cabd52035 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Features:
* TODO
Bug fixes:
+* news: Fix matching profile paths with Display-If-Profile in some cases.
+
* checksum: Rewrite Whirlpool implementation as a C extension to substantially improve
performance (bug #885909).
diff --git a/lib/portage/news.py b/lib/portage/news.py
index 14401814d..f81debe97 100644
--- a/lib/portage/news.py
+++ b/lib/portage/news.py
@@ -279,11 +279,16 @@ class NewsItem:
kwargs = {"vardb": vardb, "config": config, "profile": profile}
- all_match = all(
- restriction.checkRestriction(**kwargs)
- for values in self.restrictions.values()
- for restriction in values
- )
+ all_match = True
+ for values in self.restrictions.values():
+ matches = [restriction.checkRestriction(**kwargs) for restriction in values]
+ any_match = any(matches)
+
+ # If, for a single restriction, we didn't match anything, then we obviously
+ # didn't match everything, so just bail out.
+ if not any_match:
+ all_match = False
+ break
return all_match
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/
@ 2023-06-16 2:27 John Helmert III
0 siblings, 0 replies; 4+ messages in thread
From: John Helmert III @ 2023-06-16 2:27 UTC (permalink / raw
To: gentoo-commits
commit: 63691996a5c2bcebf93c27ee8548c7520f9517d7
Author: John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 16 02:26:50 2023 +0000
Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Fri Jun 16 02:26:50 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=63691996
lib/portage/glsa: raise GlsaFormatException on invalid range types
Bug: https://bugs.gentoo.org/905660
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
NEWS | 3 +++
lib/portage/glsa.py | 14 ++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 6982e1d5f..f3afbc366 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Bug fixes:
* Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount
directories (bug #485100, bug #890812).
+* glsa-check: appropriately handle more error cases with invalid GLSAs
+ (bug #905660)
+
portage-3.0.48.1 (2023-06-06)
----------------
diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
index 3b82c0de1..648159ad8 100644
--- a/lib/portage/glsa.py
+++ b/lib/portage/glsa.py
@@ -268,7 +268,13 @@ def makeAtom(pkgname, versionNode):
@rtype: String
@return: the portage atom
"""
- op = opMapping[versionNode.getAttribute("range")]
+ rangetype = versionNode.getAttribute("range")
+ if rangetype in opMapping:
+ op = opMapping[rangetype]
+ else:
+ raise GlsaFormatException(
+ _(f"Invalid range found for '{pkgname}': {rangetype}")
+ )
version = getText(versionNode, format="strip")
rValue = f"{op}{pkgname}-{version}"
try:
@@ -292,7 +298,11 @@ def makeVersion(versionNode):
@rtype: String
@return: the version string
"""
- op = opMapping[versionNode.getAttribute("range")]
+ rangetype = versionNode.getAttribute("range")
+ if rangetype in opMapping:
+ op = opMapping[rangetype]
+ else:
+ raise GlsaFormatException(_(f"Invalid range found: {rangetype}"))
version = getText(versionNode, format="strip")
rValue = f"{op}{version}"
try:
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/
@ 2024-11-01 23:42 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2024-11-01 23:42 UTC (permalink / raw
To: gentoo-commits
commit: 5eaf9f2e491ae9c6f54d77c821b46b2cb5af3f35
Author: Etienne Buira <etienne.buira <AT> free <DOT> fr>
AuthorDate: Fri Nov 1 23:33:30 2024 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 1 23:33:30 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5eaf9f2e
gpkg: do not consider symlinks targets for size estimation
Symlinks size is already accounted for, so there is no need to account
for the pointed to file.
Moreover, previous code failed to handle permission error when using
ROOT= and having absolute symlinks pointing to running root.
Signed-off-by: Etienne Buira <etienne.buira <AT> free.fr>
Bug: https://bugs.gentoo.org/942512
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
NEWS | 2 ++
lib/portage/gpkg.py | 24 ++++++++----------------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/NEWS b/NEWS
index 5c1cea5c27..8847f02098 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Bug fixes:
* binarytree: Fix _inject_repo_revisions to ignore remote packages for which
source repostories are missing, triggering KeyError (PR #1391).
+* gpkg: do not consider symlinks targets for size estimation (bug #942512).
+
portage-3.0.66.1 (2024-09-18)
--------------
diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 06e2283ce1..5f392e95e8 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -1960,14 +1960,10 @@ class gpkg:
image_max_link_length = max(image_max_link_length, path_link_length)
- try:
- file_size = os.path.getsize(f)
- except FileNotFoundError:
- # Ignore file not found if symlink to non-existing file
- if os.path.islink(f):
- continue
- else:
- raise
+ if stat.S_ISLNK(file_stat.st_mode):
+ continue
+
+ file_size = os.path.getsize(f)
image_total_size += file_size
image_max_file_size = max(image_max_file_size, file_size)
@@ -2055,14 +2051,10 @@ class gpkg:
image_max_link_length = max(image_max_link_length, path_link_length)
if os.path.isfile(path):
- try:
- file_size = os.path.getsize(path)
- except FileNotFoundError:
- # Ignore file not found if symlink to non-existing file
- if os.path.islink(path):
- continue
- else:
- raise
+ if stat.S_ISLNK(file_stat.st_mode):
+ continue
+
+ file_size = os.path.getsize(path)
image_total_size += file_size
if file_size > image_max_file_size:
image_max_file_size = file_size
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-01 23:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-07 3:29 [gentoo-commits] proj/portage:master commit in: /, lib/portage/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2023-01-02 5:25 Sam James
2023-06-16 2:27 John Helmert III
2024-11-01 23:42 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox