Re: [PATCH 1/1] Correct makeupdates script to work with deleted files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Thu, 1 Oct 2009, Joel Granados Moreno wrote:

This patch avoids a traceback when trying to copy a deleted file.

* scripts/makeupdates (doGitDiff): used 'git diff --name-status tag' to get
the list of changed files.
(pruneFile, isysChanged):  Adjust for file name parsing.  We should stop
looking for the '|' character and we should analyze the first character
which contains the status of the file with respect to tag.  For now we
only skip the deleted files.
---
scripts/makeupdates |   24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/scripts/makeupdates b/scripts/makeupdates
index 37555ba..8cb252c 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -84,7 +84,7 @@ def getArchiveTagOffset(configure, spec, offset):
        return tag

def doGitDiff(tag, args=[]):
-    proc = subprocess.Popen(['git', 'diff', '--stat', tag] + args,
+    proc = subprocess.Popen(['git', 'diff', '--name-status', tag] + args,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE).communicate()

@@ -105,11 +105,16 @@ def copyUpdatedFiles(tag, updates, cwd):

    lines = doGitDiff(tag)
    for line in lines:
-        if line.find(' | ') == -1:
+        fields = line.split()
+
+        if len(fields) < 2:
            continue

-        fields = line.split()
-        file = fields[0]
+        status = fields[0]
+        file = fields[1]
+
+        if status == "D":
+            continue

        if file.endswith('.spec.in') or (file.find('Makefile') != -1) or \
           file.endswith('.c') or file.endswith('.h') or \
@@ -150,11 +155,16 @@ def isysChanged(tag):
    lines = doGitDiff(tag, ['isys'])

    for line in lines:
-        if line.find(' | ') == -1:
+        fields = line.split()
+
+        if len(fields) < 2:
            continue

-        fields = line.split()
-        file = fields[0]
+        status = fields[0]
+        file = fields[1]
+
+        if status == "D":
+            continue

        if file.startswith('Makefile') or file.endswith('.h') or \
           file.endswith('.c'):


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkrFEMQACgkQ5hsjjIy1Vkk1FgCdHff2UGBF3o50hlglovWBMm9u
xkwAoLqqVrzr+dmbPzUAj2jt1rIW0UYv
=rEMH
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux