Re: yum-merge-conf Fedora9+10

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

 



Frank Murphy wrote:
> Not being a programmer or script-writer,
> what would I need to change to get
> yum-merge-conf fire up meld
> (https://admin.fedoraproject.org/pkgdb/packages/name/meld)
> 
> if it comes across the *rpmnew situation.

Perhaps something like the attached patch will get you started?  I
don't use the merge-conf plugin and the patch is totally untested, so
it might contain glaring typos and/or other problems.  It shouldn't
eat your children, but I won't guarantee that.

If you want to test it and point out the bugs, I can submit it to the
upstream yum-utils project.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In my life, I have prayed but one prayer: oh Lord, make my enemies
ridiculous. And God granted it.
    -- Voltaire

From ef401d679ef94972a7ec209eee37804106a4b87b Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@xxxxxxxxx>
Date: Sat, 6 Dec 2008 14:43:10 -0500
Subject: [PATCH] merge-conf: allow meld in addition to vimdiff

---
 plugins/merge-conf/merge-conf.py |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/plugins/merge-conf/merge-conf.py b/plugins/merge-conf/merge-conf.py
index e9ef8f2..989ed48 100644
--- a/plugins/merge-conf/merge-conf.py
+++ b/plugins/merge-conf/merge-conf.py
@@ -43,12 +43,12 @@ def posttrans_hook(conduit):
         return
     if conf.assumeyes:
         return    
-        
-    has_vimdiff = False
+
+    has_bin = {"meld": False, "vimdiff": False}
     for d in os.getenv("PATH", "").split(":"):
-        if os.path.exists(os.path.join(d, "vimdiff")):
-            has_vimdiff = True
-            break
+        for bin in ["meld", "vimdiff"]:
+            if os.path.exists(os.path.join(d, bin)):
+                has_bin[bin] = True
     ts = conduit.getTsInfo()
     for tsmem in ts.getMembers():
         rpmdb = conduit.getRpmDB()
@@ -72,11 +72,11 @@ def posttrans_hook(conduit):
             for file, mode, flags in filetuple:
                 if flags & RPMFILE_CONFIG:
                     if flags & RPMFILE_NOREPLACE:
-                        mergeConfFiles(tsmem.po.name, file, True, conduit, has_vimdiff)
+                        mergeConfFiles(tsmem.po.name, file, True, conduit, has_bin)
                     else:
-                        mergeConfFiles(tsmem.po.name, file, False, conduit, has_vimdiff)
+                        mergeConfFiles(tsmem.po.name, file, False, conduit, has_bin)
 
-def mergeConfFiles(pkg, file, noreplace, conduit, has_vimdiff):
+def mergeConfFiles(pkg, file, noreplace, conduit, has_bin):
     if noreplace:
         local_file = file
         pkg_file = "%s.rpmnew" % file
@@ -113,8 +113,10 @@ def mergeConfFiles(pkg, file, noreplace, conduit, has_vimdiff):
             print " - install the package's version (i)"
         else:
             print " - keep your version (n)"
-        if has_vimdiff:
+        if has_bin["vimdiff"]:
             print " - merge interactively with vim (v)"
+        if has_bin["meld"]:
+            print " - merge interactively with meld (m)"
         print " - background this process and examine manually (z)"
         sys.stdout.write("Your answer ? ")
         answer = sys.stdin.readline().strip()
@@ -140,9 +142,12 @@ def mergeConfFiles(pkg, file, noreplace, conduit, has_vimdiff):
             os.system(os.getenv("SHELL", "bash"))
         elif answer == "q":
             print "Choosing RPM's default action."
-        elif answer == "v" and has_vimdiff:
+        elif answer == "v" and has_bin["vimdiff"]:
             os.system("""vimdiff '%s' '%s'""" % (final_file, other_file))
             break
+        elif answer == "m" and has_bin["meld"]:
+            os.system("""meld '%s' '%s'""" % (final_file, other_file))
+            break
         else:
             print "Unknown answer, please try again"
 
-- 
1.6.0.4

Attachment: pgpPql4BMXvmX.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux