]> Frank Brehm's Git Trees - scripts/root-bin.git/commitdiff
Adding check, whether a file was changed, in cleanup-pkg-keywords
authorFrank Brehm <frank@brehm-online.com>
Tue, 7 Mar 2017 08:50:23 +0000 (09:50 +0100)
committerFrank Brehm <frank@brehm-online.com>
Tue, 7 Mar 2017 08:50:23 +0000 (09:50 +0100)
cleanup-pkg-keywords

index 0355237ca541638ae61b865fee8799c1b62391a9..80965476df5e5f275b9d16a58ae8a0796267d941 100755 (executable)
@@ -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: