Skip to content
Browse files

FL-482: corrected merge_utils patch, required for categories merge

  • Loading branch information...
1 parent 552a6ff commit 3f6def8a58b77e70d721129d1e1a45227c9edb8e @angryvincent angryvincent committed
Showing with 17 additions and 14 deletions.
  1. +17 −14 funtoo/scripts/merge_utils.py
View
31 funtoo/scripts/merge_utils.py
@@ -306,32 +306,31 @@ def __init__(self,srctree,select="all",skip=None,replace=False,merge=None,catego
def run(self,desttree):
desttree.logTree(self.srctree)
# Figure out what categories to process:
- catpath = os.path.join(self.srctree.root,"profiles/categories")
+ src_cat_path = os.path.join(self.srctree.root, "profiles/categories")
+ dest_cat_path = os.path.join(desttree.root, "profiles/categories")
if self.categories != None:
# categories specified in __init__:
- a = self.categories
+ src_cat_set = set(self.categories)
else:
- a = []
- if os.path.exists(catpath):
+ src_cat_set = set()
+ if os.path.exists(src_cat_path):
# categories defined in profile:
- f = open(os.path.join(self.srctree.root,"profiles/categories"),"r")
- for cat in f.readlines():
- cat = cat.strip()
- if cat not in a:
- a.append(cat)
- f.close()
+ with open(src_cat_path, "r") as f:
+ src_cat_set.update(f.read().splitlines())
# auto-detect additional categories:
cats = os.listdir(self.srctree.root)
for cat in cats:
# All categories have a "-" in them and are directories:
if os.path.isdir(os.path.join(self.srctree.root,cat)):
- if (cat.find("-") != -1) or cat == "virtuals":
- if cat not in a:
- a.append(cat)
+ if "-" in cat or cat == "virtuals":
+ src_cat_set.add(cat)
+
+ with open(dest_cat_path, "r") as f:
+ dest_cat_set = set(f.read().splitlines())
# Our main loop:
print "# Merging in ebuilds from %s" % self.srctree.root
- for cat in a:
+ for cat in src_cat_set:
catdir = os.path.join(self.srctree.root,cat)
if not os.path.isdir(catdir):
# not a valid category in source overlay, so skip it
@@ -349,6 +348,7 @@ def run(self,desttree):
if type(self.skip) == types.ListType and catpkg in self.skip:
# we have a list of pkgs to skip, and this catpkg is on the list, so skip:
continue
+ dest_cat_set.add(cat)
tcatdir = os.path.join(desttree.root,cat)
tpkgdir = os.path.join(tcatdir,pkg)
copy = False
@@ -394,6 +394,9 @@ def run(self,desttree):
cpv = "/".join(tpkgdir.split("/")[-2:])
mergeLog.write("%s\n" % cpv)
+ with open(dest_cat_path, "w") as f:
+ f.write("\n".join(sorted(dest_cat_set)))
+
class ProfileDepFix(MergeStep):
def run(self,tree):

0 comments on commit 3f6def8

Please sign in to comment.
Something went wrong with that request. Please try again.