]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - rediff-patches.py
Fallback to /tmp.
[packages/rpm-build-tools.git] / rediff-patches.py
index 2fb1986ce03be9292d6771b8e875a0e156e49805..d09c9ee93be8a4aac21e01088491f6acf1e118ee 100755 (executable)
@@ -66,12 +66,14 @@ def unpack(spec, appsourcedir, builddir):
 
 def patch_comment_get(patch):
     patch_comment = ""
+    patch_got = False
     with open(patch, 'rt') as f:
         for line in f:
             if line.startswith('diff ') or line.startswith('--- '):
+                patch_got = True
                 break
             patch_comment += line
-    return patch_comment
+    return patch_comment if patch_got else ""
 
 def diff(diffdir_org, diffdir, builddir, patch_comment, output):
     diffdir_org = os.path.basename(diffdir_org)
@@ -126,7 +128,10 @@ def main():
     specfile = args.spec
     appsourcedir = os.path.dirname(os.path.abspath(specfile))
 
-    tempdir = tempfile.TemporaryDirectory(dir="/dev/shm")
+    try:
+        tempdir = tempfile.TemporaryDirectory(dir="/dev/shm")
+    except FileNotFoundError as e:
+        tempdir = tempfile.TemporaryDirectory(dir="/tmp")
     topdir = tempdir.name
     builddir = os.path.join(topdir, 'BUILD')
 
This page took 0.026068 seconds and 4 git commands to generate.