]> TLD Linux GIT Repositories - packages/rpm-build-tools.git/commitdiff
- merged PLD changes
authorMarcin Krol <hawk@tld-linux.org>
Fri, 19 Mar 2021 19:42:49 +0000 (20:42 +0100)
committerMarcin Krol <hawk@tld-linux.org>
Fri, 19 Mar 2021 19:42:49 +0000 (20:42 +0100)
rediff-patches.py
relup.sh
rpm-build-tools.spec

index 42897f41f792d92fd757cb908f00b10740bf9a96..d09c9ee93be8a4aac21e01088491f6acf1e118ee 100755 (executable)
@@ -64,11 +64,25 @@ def unpack(spec, appsourcedir, builddir):
                 logging.debug(line)
 
 
-def diff(diffdir_org, diffdir, builddir, output):
+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 if patch_got else ""
+
+def diff(diffdir_org, diffdir, builddir, patch_comment, output):
     diffdir_org = os.path.basename(diffdir_org)
     diffdir = os.path.basename(diffdir)
 
     with open(output, 'wt') as f:
+        if patch_comment:
+            f.write(patch_comment)
+            f.flush()
         cmd = [ 'diff', '-urNp', '-x', '*.orig', diffdir_org, diffdir ]
         logging.debug("running %s" % repr(cmd))
         try:
@@ -114,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')
 
@@ -157,7 +174,12 @@ def main():
         unpack(tempspec.name, appsourcedir, builddir)
         tempspec.close()
 
-        diff(appbuilddir + ".org", appbuilddir, builddir, os.path.join(topdir, os.path.join(appsourcedir, patch_name + ".rediff")))
+        patch_comment = patch_comment_get(patch_name)
+        diff(appbuilddir + ".org",
+             appbuilddir,
+             builddir,
+             patch_comment,
+             os.path.join(topdir, os.path.join(appsourcedir, patch_name + ".rediff")))
 
         diffstat(os.path.join(topdir, os.path.join(appsourcedir, patch_name)))
         diffstat(os.path.join(topdir, os.path.join(appsourcedir, patch_name + ".rediff")))
index 8267436e1efc2c5cc295941189c01a0176365044..573919793d970b6f736a360cd0b33db7190a8464 100755 (executable)
--- a/relup.sh
+++ b/relup.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # script to run after "release bump" style change.
 # takes Release from spec and creates commit with message
 # groups similiar commits together.
@@ -208,8 +208,9 @@ for pkg in "$@"; do
 
        # commit the changes
        msg=""
-       [ -n "$message" ] && msg="$msg- $message$n"
-       msg="$msg- release ${rel%%%*} (by relup.sh)"
+       [ -n "$message" ] && msg="${msg}$message$n$n"
+       msg="${msg}Release ${rel%%%*} (by relup.sh)"
+
        echo git commit -m "$msg" $spec
        if [ "$test" != 1 ]; then
                cd $pkgdir
index 6b4485c449a2b64c88a8802f8db79f471446e13e..9360f6ab56f96a22298f33ba64a4a4fdc169d489 100644 (file)
@@ -6,7 +6,7 @@ Summary(ru.UTF-8):      Скрипты и утилиты, необходимые дл
 Summary(uk.UTF-8):     Скрипти та утиліти, необхідні для побудови пакетів
 Name:          rpm-build-tools
 Version:       4.9
-Release:       12
+Release:       13
 License:       GPL
 Group:         Applications/File
 Source0:       builder.sh