1. Michał Górny
  2. flaggie

Commits

Michał Górny  committed 0e6129a

Refuse to proceed when both package.{accept_,}keywords files exist.

  • Participants
  • Parent commits 8e3babf
  • Branches master

Comments (0)

Files changed (2)

File lib/flaggie/cli.py

View file
 from flaggie.cache import Caches
 from flaggie.cleanup import DropIneffective, DropUnmatchedPkgs, \
 		DropUnmatchedFlags, SortEntries, SortFlags
-from flaggie.packagefile import PackageFiles
+from flaggie.packagefile import PackageFiles, PackageFileConflict
 
 def parse_actions(args, dbapi, settings, quiet = False, strict = False, \
 		cleanupact = [], dataout = sys.stdout, output = sys.stderr):
 		main([argv[0], '--help'])
 		return 0
 
-	pfiles = PackageFiles(os.path.join( \
-		porttree.settings['PORTAGE_CONFIGROOT'], USER_CONFIG_PATH), porttree)
+	try:
+		pfiles = PackageFiles(os.path.join( \
+			porttree.settings['PORTAGE_CONFIGROOT'], USER_CONFIG_PATH), porttree)
+	except PackageFileConflict as e:
+		output.write('%s\n' % e)
+		return 1
 
 	for actset in act:
 		try:

File lib/flaggie/packagefile.py

View file
 
 		PackageFileSet.write(*((self,) + args))
 
+class PackageFileConflict(Exception):
+	pass
+
 class PackageFiles(object):
 	def __init__(self, basedir, dbapi):
 		p = lambda x: os.path.join(basedir, x)
+
+		if os.path.exists(p('package.keywords')) \
+				and os.path.exists(p('package.accept_keywords')):
+			raise PackageFileConflict('''Both package.accept_keywords and package.keywords files exist. Please
+remove one of them or merge them. Refusing to proceed.''')
+
 		self.files = {
 			'use': PackageFileSet(p('package.use')),
 			'kw': PackageKeywordsFileSet(p('package.keywords'), dbapi),