Skip to content

Commit 1eb0f06

Browse files
committed
Revert "repo_objs.RepoConfig: use non-deprecated immutable.Simple"
This reverts commit d5298b7. This is the the core of pkgcore#472 albeit it also hid another issue CI didn't surface. It's a refactoring, not bug fixes, thus reverted and will be re-introduced at a later date in a corrected form. Signed-off-by: Brian Harring <ferringb@gmail.com>
1 parent efcf4a1 commit 1eb0f06

1 file changed

Lines changed: 37 additions & 23 deletions

File tree

src/pkgcore/ebuild/repo_objs.py

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def profiles(self):
688688
return frozenset(chain.from_iterable(self._profiles_instances))
689689

690690

691-
class RepoConfig(syncable.tree, immutable.Simple):
691+
class RepoConfig(syncable.tree, klass.ImmutableInstance):
692692
"""Configuration data for an ebuild repository."""
693693

694694
layout_offset = "metadata/layout.conf"
@@ -716,10 +716,10 @@ def __init__(
716716
self, location, config_name=None, syncer=None, profiles_base="profiles"
717717
):
718718
super().__init__(syncer)
719-
self.config_name = config_name
720-
self.external = config_name is None
721-
self.location = location
722-
self.profiles_base = pjoin(location, profiles_base)
719+
object.__setattr__(self, "config_name", config_name)
720+
object.__setattr__(self, "external", (config_name is None))
721+
object.__setattr__(self, "location", location)
722+
object.__setattr__(self, "profiles_base", pjoin(location, profiles_base))
723723

724724
try:
725725
self._parse_config()
@@ -729,7 +729,6 @@ def __init__(
729729
if not self.eapi.supported:
730730
raise repo_errors.UnsupportedRepo(self)
731731

732-
@immutable.Simple.__allow_mutation_wrapper__
733732
def _parse_config(self):
734733
"""Load data from the repo's metadata/layout.conf file."""
735734
path = pjoin(self.location, self.layout_offset)
@@ -741,7 +740,8 @@ def _parse_config(self):
741740
ignore_errors=True,
742741
)
743742

744-
self.repo_name = data.get("repo-name", None)
743+
sf = object.__setattr__
744+
sf(self, "repo_name", data.get("repo-name", None))
745745

746746
hashes = data.get("manifest-hashes", "").lower().split()
747747
if hashes:
@@ -767,7 +767,7 @@ def _parse_config(self):
767767
"required_hashes": required_hashes,
768768
}
769769

770-
self.manifests = _immutable_attr_dict(d)
770+
sf(self, "manifests", _immutable_attr_dict(d))
771771
masters = data.get("masters")
772772
_missing_masters = False
773773
if masters is None:
@@ -781,37 +781,51 @@ def _parse_config(self):
781781
masters = ()
782782
else:
783783
masters = tuple(unique_stable(masters.split()))
784-
self._missing_masters = _missing_masters
785-
self.masters = masters
784+
sf(self, "_missing_masters", _missing_masters)
785+
sf(self, "masters", masters)
786786
aliases = data.get("aliases", "").split() + [
787787
self.config_name,
788788
self.repo_name,
789789
self.pms_repo_name,
790790
self.location,
791791
]
792-
self.aliases = tuple(filter(None, unique_stable(aliases)))
793-
self.eapis_deprecated = (
792+
sf(self, "aliases", tuple(filter(None, unique_stable(aliases))))
793+
sf(
794+
self,
795+
"eapis_deprecated",
794796
tuple(unique_stable(data.get("eapis-deprecated", "").split())),
795797
)
796-
self.eapis_banned = (
798+
sf(
799+
self,
800+
"eapis_banned",
797801
tuple(unique_stable(data.get("eapis-banned", "").split())),
798802
)
799-
self.eapis_testing = (
803+
sf(
804+
self,
805+
"eapis_testing",
800806
tuple(unique_stable(data.get("eapis-testing", "").split())),
801807
)
802-
self.profile_eapis_deprecated = (
808+
sf(
809+
self,
810+
"profile_eapis_deprecated",
803811
tuple(unique_stable(data.get("profile-eapis-deprecated", "").split())),
804812
)
805-
self.profile_eapis_banned = (
813+
sf(
814+
self,
815+
"profile_eapis_banned",
806816
tuple(unique_stable(data.get("profile-eapis-banned", "").split())),
807817
)
808-
self.properties_allowed = (
818+
sf(
819+
self,
820+
"properties_allowed",
809821
tuple(unique_stable(data.get("properties-allowed", "").split())),
810822
)
811-
self.restrict_allowed = (
823+
sf(
824+
self,
825+
"restrict_allowed",
812826
tuple(unique_stable(data.get("restrict-allowed", "").split())),
813827
)
814-
self.sign_commits = data.get("sign-commits", "false".lower() == "true")
828+
sf(self, "sign_commits", data.get("sign-commits", "false").lower() == "true")
815829

816830
v = set(data.get("cache-formats", "md5-dict").lower().split())
817831
if not v:
@@ -822,7 +836,7 @@ def _parse_config(self):
822836
if not v:
823837
logger.warning("unknown cache format: falling back to md5-dict format")
824838
v = ["md5-dict"]
825-
self.cache_format = list(v)[0]
839+
sf(self, "cache_format", list(v)[0])
826840

827841
profile_formats = set(data.get("profile-formats", "pms").lower().split())
828842
if not profile_formats:
@@ -842,7 +856,7 @@ def _parse_config(self):
842856
)
843857
profile_formats.difference_update(unknown)
844858
profile_formats.add("pms")
845-
self.profile_formats = profile_formats
859+
sf(self, "profile_formats", profile_formats)
846860

847861
@klass.jit_attr
848862
def known_arches(self):
@@ -1069,8 +1083,8 @@ class SquashfsRepoConfig(RepoConfig):
10691083

10701084
def __init__(self, sqfs_file, location, *args, **kwargs):
10711085
sqfs_path = pjoin(location, sqfs_file)
1072-
self._sqfs = sqfs_path
1073-
self.location = location
1086+
object.__setattr__(self, "_sqfs", sqfs_path)
1087+
object.__setattr__(self, "location", location)
10741088
# if squashfs archive exists in the repo, try to mount it over itself
10751089
if os.path.exists(self._sqfs):
10761090
try:

0 commit comments

Comments
 (0)