[yum-cvs] yum-utils/plugins/protect-packages protect-packages.py, 1.1, 1.2

Tim Lauridsen timlau at linux.duke.edu
Fri Jun 22 16:01:25 UTC 2007


Update of /home/groups/yum/cvs/yum-utils/plugins/protect-packages
In directory login1.linux.duke.edu:/tmp/cvs-serv11597/plugins/protect-packages

Modified Files:
	protect-packages.py 
Log Message:
added cleanup patch to protect-packages plugin  by Matthew Miller

Index: protect-packages.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/protect-packages/protect-packages.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- protect-packages.py	21 Jun 2007 15:35:43 -0000	1.1
+++ protect-packages.py	22 Jun 2007 16:01:23 -0000	1.2
@@ -44,38 +44,44 @@
 plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
 
 def config_hook(conduit):
-  parser = conduit.getOptParser()
-  parser.add_option("", "--override-protection", dest='override', 
-                    action="append", default=[], metavar='[package]',
-                    help="remove package from the list of protected packages")
+    parser = conduit.getOptParser()
+    parser.add_option("", "--override-protection", dest='override', 
+                      action="append", default=[], metavar='[package]',
+                      help="remove package from the list of protected packages")
 
 def postresolve_hook(conduit):
-  protectedpkgs = ['yum']
-  protectedlist = []
-  opts, args = conduit.getCmdLine()
-
-  confdir = conduit.confString('main','confdir','/etc/sysconfig')
-
-  if os.access(confdir + "/protected-packages", os.R_OK) : 
-     protectedlist.append(confdir + "/protected-packages")
-
-  if os.access(confdir + "/protected-packages.d", os.R_OK):
-     protectedlist.extend(glob.glob(confdir + "/protected-packages.d/*.list"))
-
-  if protectedlist:
-     for f in protectedlist:
-       for line in open(f).readlines():            
-           line = string.strip(line)
-           if (line and line[0] != "#" and line not in opts.override  
-                    and line not in protectedpkgs):
-              protectedpkgs.append(line)
-       open(f).close()
-
-  for tsmem in conduit.getTsInfo().getMembers():
-    if tsmem.name in protectedpkgs and tsmem.ts_state == 'e':
-      raise PluginYumExit("This transaction would cause %s to be removed. "
-           "This package is vital for the basic operation of your system. "
-           "If you really want to remove it, edit the list of protected "
-           "packages in the file %s or in the directory %s."
-           %(tsmem.name, confdir + "/protected-packages",
-             confdir + "/protected-packages.d"))
+    protectedpkgs = ['yum']
+    protectedlist = []
+    opts, args = conduit.getCmdLine()
+
+    confdir = conduit.confString('main','confdir','/etc/sysconfig')
+
+    if os.access(confdir + "/protected-packages", os.R_OK) : 
+        protectedlist.append(confdir + "/protected-packages")
+
+    if os.access(confdir + "/protected-packages.d", os.R_OK):
+        protectedlist.extend(glob.glob(confdir + "/protected-packages.d/*.list"))
+
+    if protectedlist:
+        for f in protectedlist:
+            for line in open(f).readlines():            
+                line = string.strip(line)
+                if (line and line[0] != "#" and line not in opts.override  
+                                            and line not in protectedpkgs):
+                    protectedpkgs.append(line)
+
+    for tsmem in conduit.getTsInfo().getMembers():
+        if tsmem.name in protectedpkgs and tsmem.ts_state == 'e':
+            raise PluginYumExit("This transaction would cause %s to be removed."
+                " This package is vital for the basic operation of your system."
+                " If you really want to remove it, edit the list of protected"
+                " packages in the file %s or in the directory %s or use the"
+                " --override-protection command-line option."
+                %(tsmem.name, confdir + "/protected-packages",
+                 confdir + "/protected-packages.d"))
+
+
+
+
+
+




More information about the Yum-cvs-commits mailing list