File 03_dir_issues.patch of Package cvs-syncmail

#! /bin/sh /usr/share/dpatch/dpatch-run
## 03_dir_issues.dpatch by  <csacca@thecsl.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Correction on issues with directories

@DPATCH@

Index: syncmail-2.3/syncmail
===================================================================
--- syncmail-2.3.orig/syncmail
+++ syncmail-2.3/syncmail
@@ -304,27 +304,35 @@ def load_change_info(prefix=None):
         entries_fn = os.path.join("CVS", "Entries")
     entries_log_fn = entries_fn + ".Log"
     mapping = {}
-    f = open(entries_fn)
-    while 1:
-        line = f.readline()
-        if not line:
-            break
-##        if line.strip() == "D":
-##            continue
-        # we could recurse down subdirs, except the Entries.Log files
-        # we need haven't been written to the subdirs yet, so it
-        # doesn't do us any good
-##        if line[0] == "D":
-##            name = line.split("/")[1]
-##            dirname = namekey(prefix, name)
-##            if os.path.isdir(dirname):
-##                m = load_change_info(dirname)
-##                mapping.update(m)
-        if line[0] == "/":
-            # normal file
-            get_entry(prefix, mapping, line, entries_fn)
-        # else: bogus Entries line
-    f.close()
+    try:
+        f = open(entries_fn)
+    except IOError:
+        try:
+            f = open(os.path.join("../", entries_fn))
+        except IOError:
+            f = None
+    if (f != None):
+        while 1:
+            line = f.readline()
+            if not line:
+                break
+##            if line.strip() == "D":
+##                continue
+            # we could recurse down subdirs, except the Entries.Log files
+            # we need haven't been written to the subdirs yet, so it
+            # doesn't do us any good
+##            if line[0] == "D":
+##                name = line.split("/")[1]
+##                dirname = namekey(prefix, name)
+##                if os.path.isdir(dirname):
+##                    m = load_change_info(dirname)
+##                    mapping.update(m)
+            if line[0] == "/":
+                # normal file
+                get_entry(prefix, mapping, line, entries_fn)
+            # else: bogus Entries line
+        f.close()
+
     if os.path.isfile(entries_log_fn):
         f = open(entries_log_fn)
         while 1:
@@ -364,6 +372,10 @@ def load_branch_name():
 
 # scan args for options
 def main():
+    # fix so that %{sVv} works sanely
+    for i in range(len(sys.argv)):
+      sys.argv[i] = re.sub('- ', ' - ', sys.argv[i])
+
     # XXX Should really move all the options to an object, just to
     # avoid threading so many positional args through everything.
     try:
openSUSE Build Service is sponsored by