Commits

Michał Górny committed 0e6129a

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

Comments (0)

Files changed (2)

lib/flaggie/cli.py

 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:

lib/flaggie/packagefile.py

 
 		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),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.