public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/
Date: Mon, 26 Dec 2022 17:28:04 +0000 (UTC)	[thread overview]
Message-ID: <1672075645.4cce9a19dcbe670a676af89c2362f90411c5c796.arthurzam@gentoo> (raw)

commit:     4cce9a19dcbe670a676af89c2362f90411c5c796
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Mon Dec 26 04:24:06 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 26 17:27:25 2022 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=4cce9a19

Ignore both empty and non-existant repos.conf files.

Whilst this should probably matter, all reporting pathways I know of
involve "don't yell at the user" this it's probably not optimal
to have pathways that "yell at the user".

Closes: https://github.com/pkgcore/pkgcore/issues/365
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/387
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/ebuild/portage_conf.py | 8 ++++++--
 tests/ebuild/test_portage_conf.py  | 7 +------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/pkgcore/ebuild/portage_conf.py b/src/pkgcore/ebuild/portage_conf.py
index d2865c0bb..907a1a2dd 100644
--- a/src/pkgcore/ebuild/portage_conf.py
+++ b/src/pkgcore/ebuild/portage_conf.py
@@ -357,8 +357,10 @@ class PortageConfig(DictMixin):
             hidden=False,
             backup=False,
         ):
+            had_repo_conf = False
             try:
                 with open(fp) as f:
+                    had_repo_conf = True
                     defaults, repo_confs = parser.parse_file(f)
             except PermissionError as e:
                 raise base_errors.PermissionDenied(fp, write=False) from e
@@ -375,8 +377,10 @@ class PortageConfig(DictMixin):
                 )
             main_defaults.update(defaults)
 
-            if not repo_confs:
-                logger.warning(f"repos.conf: parsing {fp!r}: file is empty")
+            if not had_repo_conf and not repo_confs:
+                logger.warning(
+                    "repos.conf: not found, but should exist for modern support"
+                )
 
             for name, repo_conf in repo_confs.items():
                 if name in repos:

diff --git a/tests/ebuild/test_portage_conf.py b/tests/ebuild/test_portage_conf.py
index 395373b85..edb3d89b6 100644
--- a/tests/ebuild/test_portage_conf.py
+++ b/tests/ebuild/test_portage_conf.py
@@ -5,12 +5,12 @@ import stat
 import textwrap
 
 import pytest
+from snakeoil.osutils import pjoin
 
 from pkgcore import const
 from pkgcore import exceptions as base_errors
 from pkgcore.config import errors as config_errors
 from pkgcore.ebuild.portage_conf import PortageConfig
-from snakeoil.osutils import pjoin
 
 load_make_conf = PortageConfig.load_make_conf
 load_repos_conf = PortageConfig.load_repos_conf
@@ -78,11 +78,6 @@ class TestReposConf:
         with pytest.raises(base_errors.PermissionDenied):
             load_repos_conf(path)
 
-    def test_blank_file(self, tmp_path, caplog):
-        (path := tmp_path / "file").touch()
-        load_repos_conf(path)
-        assert "file is empty" in caplog.text
-
     def test_garbage_file(self, tmp_path):
         (path := tmp_path / "file").write_bytes(binascii.b2a_hex(os.urandom(10)))
         with pytest.raises(config_errors.ConfigurationError):


             reply	other threads:[~2022-12-26 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-26 17:28 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-28  5:27 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/ Arthur Zamarin
2023-10-23 17:35 Arthur Zamarin
2023-08-29 17:37 Arthur Zamarin
2023-02-02 19:58 Arthur Zamarin
2023-01-17 20:50 Arthur Zamarin
2023-01-02 20:03 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin

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=1672075645.4cce9a19dcbe670a676af89c2362f90411c5c796.arthurzam@gentoo \
    --to=arthurzam@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