Commits

Michał Górny committed 1dbae1a

Remove envfiles on '-' action.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=372069

Comments (0)

Files changed (1)

lib/flaggie/packagefile.py

 
 		PackageFileSet.write(*((self,) + args))
 
+class PackageEnvFileSet(PackageFileSet):
+	def write(self, *args):
+		if not self._files:
+			return
+
+		for f in self.files:
+			for e in f:
+				if e.modified:
+					rlist = [fl for fl in e if fl.modifier == '-']
+					for fl in rlist:
+						e.remove(fl)
+
+		PackageFileSet.write(*((self,) + args))
+
 class PackageFiles(object):
 	def __init__(self, basedir, dbapi, mkconf = None):
 		p = lambda x: os.path.join(basedir, x)
 			'use': PackageFileSet(p('package.use')),
 			'kw': PackageKeywordsFileSet(pkw, dbapi),
 			'lic': PackageFileSet(p('package.license')),
-			'env': PackageFileSet(p('package.env'))
+			'env': PackageEnvFileSet(p('package.env'))
 		}
 
 		if mkconf: