[Patchew-devel] [PATCH] patchew-importer: number import invocation in the logs

Paolo Bonzini posted 1 patch 5 years, 2 months ago
scripts/patchew-importer | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
[Patchew-devel] [PATCH] patchew-importer: number import invocation in the logs
Posted by Paolo Bonzini 5 years, 2 months ago
When importing a large number of messages it can be useful to know how the process
is progressing.  Offlineimap numbers the message it imports, but the subsequent
import phase does not.  Add a number to the import, which can be correlated with
the logs that were printed during the offlineimap phase.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/patchew-importer | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/patchew-importer b/scripts/patchew-importer
index d9de74f..d70fc20 100755
--- a/scripts/patchew-importer
+++ b/scripts/patchew-importer
@@ -77,29 +77,32 @@ imported()
 
 import()
 {
-    echo import $@
-    if ! timeout -k 600 600 $PATCHEW_CLI import $@; then
-        cp $@ $BAD_MESSAGES_DIR
+    echo $1 import $2
+    if ! timeout -k 600 600 $PATCHEW_CLI import $2; then
+        cp $2 $BAD_MESSAGES_DIR
         echo "(bad message saved in $BAD_MESSAGES_DIR)"
     fi
     if test "$IMAP_DELETE_AFTER_IMPORT" = y; then
         rm -f $f
         echo "Deleted $f"
     fi
-    touch $IMPORTED_DIR/$(hashstr $@)
+    touch $IMPORTED_DIR/$(hashstr $2)
 }
 
 offlineimap_import()
 {
+    local n
     if ! timeout -k 2000 1800 offlineimap -c $offlineimap_rc; then
         sleep 300
         return
     fi
+    n=1
     find "$maildir" -type f | while read f; do
         if imported "$f"; then
             return
         fi
-        import "$f" || true
+        import $n "$f" || true
+        let n=n+1
     done
 }
 
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel