From dda59136c5e104c5f13163f52509b2d0bb159494 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 7 Mar 2017 09:50:23 +0100 Subject: [PATCH] Adding check, whether a file was changed, in cleanup-pkg-keywords --- cleanup-pkg-keywords | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cleanup-pkg-keywords b/cleanup-pkg-keywords index 0355237..8096547 100755 --- a/cleanup-pkg-keywords +++ b/cleanup-pkg-keywords @@ -190,6 +190,7 @@ class CleanupPkgKeywordsApp(PbApplication): print('') print('---------------------------------------------------') log.info("Performing %r ...", filename) + file_changed = False new_lines = [] @@ -207,6 +208,7 @@ class CleanupPkgKeywordsApp(PbApplication): 'Invalid line %r in %r (%d) found.', line.rstrip(), filename, line_nr) new_lines.append('# ' + line.strip()) + file_changed = True continue mypkg = match.group(1) if self.verbose: @@ -216,6 +218,7 @@ class CleanupPkgKeywordsApp(PbApplication): 'Invalid atom %r in %r (%d) found.', mypkg, filename, line_nr) new_lines.append('# ' + line.strip()) + file_changed = True continue log.debug("Checking atom %r in %r (%d) ...", mypkg, filename, line_nr) @@ -230,6 +233,7 @@ class CleanupPkgKeywordsApp(PbApplication): 'Invalid Package name %r in %r (%d) found.', mypkg, filename, line_nr) new_lines.append('# ' + line.strip()) + file_changed = True continue valid = None if isjustname(my_cpv): @@ -248,10 +252,15 @@ class CleanupPkgKeywordsApp(PbApplication): else: log.warning("Atom %r in %r (%d) seems to be invalid.", mypkg, filename, line_nr) + file_changed = True new_lines.append('# ' + line.strip()) print('') print('----------') + if not file_changed: + log.info("No changes on %r.", filename) + return + log.info("Rewriting %r ...", filename) if self.simulate: if self.verbose: -- 2.39.5