[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.47-17-ga7f2df4

Andreas Beckmann debian at abeckmann.de
Sat Nov 3 00:08:36 UTC 2012


The following commit has been merged in the piatti branch:
commit 2cc578b5b108437d6f007c22437d5a87541c7a4f
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Nov 2 18:11:24 2012 +0100

    p: report more details about modified files
    
    report all file attributes from reference and current file
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index c82adee..4dfb605 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ piuparts (0.48) UNRELEASED; urgency=low
   [ Andreas Beckmann ]
   * piuparts.py:
     - Ignore *.dpkg-* conffile backups found in --scriptsdir directories.
+    - Report attributes (for reference and current file) in case of file
+      modification.
   * piuparts-master.py:
     - Enable recycling before initializing the real package db.
   * piuparts-slave.py:
diff --git a/piuparts.py b/piuparts.py
index 28a36b5..25db4d7 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1783,6 +1783,32 @@ def objects_are_different(pair1, pair2):
         return m1.st_size != m2.st_size # or m1.st_mtime != m2.st_mtime
     return False
 
+def format_object_attributes(pair):
+    (st, target) = pair
+    ft = ""
+    if stat.S_ISDIR(st.st_mode):
+        ft += "d"
+    if stat.S_ISCHR(st.st_mode):
+        ft += "c"
+    if stat.S_ISBLK(st.st_mode):
+        ft += "b"
+    if stat.S_ISREG(st.st_mode):
+        ft += "-"
+    if stat.S_ISFIFO(st.st_mode):
+        ft += "p"
+    if stat.S_ISLNK(st.st_mode):
+        ft += "l"
+    if stat.S_ISSOCK(st.st_mode):
+        ft += "s"
+    res = "(%d, %d, %s %o, %d, %s)" % (
+            st.st_uid,
+            st.st_gid,
+            ft,
+            st.st_mode,
+            st.st_size,
+            target)
+    return res
+
 
 def diff_meta_data(tree1, tree2):
     """Compare two dir trees and return list of new files (only in 'tree2'),
@@ -1812,6 +1838,8 @@ def diff_meta_data(tree1, tree2):
     for name in tree1.keys()[:]:
         if name in tree2:
             if objects_are_different(tree1[name], tree2[name]):
+                logging.debug("Modified(uid, gid, mode, size, target): %s %s != %s" % \
+                        (name, format_object_attributes(tree1[name]), format_object_attributes(tree2[name])))
                 modified.append((name, tree1[name]))
             del tree1[name]
             del tree2[name]

-- 
piuparts git repository



More information about the Piuparts-commits mailing list