[yum-cvs] yum cli.py,1.176,1.177 shell.py,1.12,1.13
Seth Vidal
skvidal at login.linux.duke.edu
Mon Mar 28 03:21:17 UTC 2005
Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv29342
Modified Files:
cli.py shell.py
Log Message:
config exclude implemented
when you exit a ts run w/o actually finishing the transaction, don't reset
the tsInfo class
clean up the help output in the shell.
Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- cli.py 27 Mar 2005 11:51:37 -0000 1.176
+++ cli.py 28 Mar 2005 03:21:14 -0000 1.177
@@ -586,9 +586,7 @@
if self._promptWanted():
if not self.userconfirm():
self.log(0, 'Exiting on user Command')
- return
-
-
+ return 1
self.log(2, 'Downloading Packages:')
problems = self.downloadPkgs(downloadpkgs)
@@ -604,7 +602,7 @@
# Check GPG signatures
if self.gpgsigcheck(downloadpkgs) != 0:
- return
+ return 1
self.log(2, 'Running Transaction Test')
tsConf = {}
@@ -654,7 +652,8 @@
# close things
self.log(1, self.postTransactionOutput())
-
+ return 0
+
def gpgsigcheck(self, pkgs):
'''Perform GPG signature verification on the given packages, installing
keys if possible
Index: shell.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/shell.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- shell.py 28 Mar 2005 00:08:23 -0000 1.12
+++ shell.py 28 Mar 2005 03:21:14 -0000 1.13
@@ -16,6 +16,8 @@
import sys
import os.path
import cmd
+import string
+
from yum import Errors
from yum.constants import *
@@ -37,6 +39,11 @@
self.resultmsgs = ['Leaving Shell']
if (len(base.extcmds)) > 0:
self.file = base.extcmds[0]
+ self.commandlist = ['clean', 'repo', 'exit', 'groupinfo',
+ 'groupinstall', 'grouplist', 'groupremove', 'groupupdate',
+ 'info', 'install', 'list', 'localinstall', 'repository',
+ 'makecache', 'provides', 'quit', 'remove', 'run', 'search',
+ 'transaction', 'ts', 'update', 'config']
def script(self):
try:
@@ -54,6 +61,10 @@
if len(line) > 0 and line.strip()[0] == '#':
pass
else:
+ (cmd, args, line) = self.parseline(line)
+ if cmd not in self.commandlist:
+ self.do_help('')
+ return False
self.base.cmdstring = line
self.base.cmdstring = self.base.cmdstring.replace('\n', '')
self.base.cmds = self.base.cmdstring.split()
@@ -69,11 +80,10 @@
def do_help(self, arg):
msg = """
- commands: check-update, clean, disablerepo, enablerepo,
- exit, groupinfo, groupinstall, grouplist,
+ commands: clean, config, exit, groupinfo, groupinstall, grouplist,
groupremove, groupupdate, info, install, list,
- listrepos, localinstall, makecache, provides, quit,
- remove, run, search, transaction, update
+ localinstall, makecache, provides, quit, remove,
+ repo, run, search, transaction, update
"""
if arg in ['transaction', 'ts']:
msg = """
@@ -83,7 +93,7 @@
solve: run the dependency solver on the transaction
run: run the transaction
"""
- elif arg in ['repos', 'repositories']:
+ elif arg in ['repo', 'repository']:
msg = """
repos arg [option]
list: lists repositories and their status
@@ -91,7 +101,15 @@
disable: disable repositories. option = repository id
"""
- self.base.log(1, msg)
+ elif arg == 'config':
+ msg = """
+ config arg [value]
+ args: debuglevel, errorlevel, obsoletes, gpgcheck, assumeyes, exclude
+ If no value is given it prints the current value.
+ If value is given it sets that value.
+ """
+
+ self.base.log(0, msg)
def do_EOF(self, line):
self.resultmsgs = ['Leaving Shell']
@@ -132,7 +150,7 @@
def do_config(self, line):
(cmd, args, line) = self.parseline(line)
- # ints
+ # logs
if cmd in ['debuglevel', 'errorlevel']:
opts = args.split()
if not opts:
@@ -142,7 +160,7 @@
try:
val = int(val)
except ValueError, e:
- self.base.errorlog('Value %s for %s cannot be made to an int' % (val, cmd))
+ self.base.errorlog(0, 'Value %s for %s cannot be made to an int' % (val, cmd))
return
self.base.conf.setConfigOption(cmd, val)
if cmd == 'debuglevel':
@@ -157,27 +175,48 @@
else:
value = opts[0]
if value.lower() not in BOOLEAN_STATES:
- self.base.errorlog('Value %s for %s is not a Boolean' % (value, cmd))
+ self.base.errorlog(0, 'Value %s for %s is not a Boolean' % (value, cmd))
return False
value = BOOLEAN_STATES[value.lower()]
self.base.conf.setConfigOption(cmd, value)
if cmd == 'obsoletes':
if hasattr(self.base, 'up'): # reset the updates
del self.base.up
+
+ elif cmd in ['exclude']:
+ opts = args.split()
+ if not opts:
+ msg = '%s: ' % cmd
+ msg = msg + string.join(self.base.conf.getConfigOption(cmd))
+ self.base.log(2, msg)
+ return False
+ else:
+ self.base.conf.setConfigOption(cmd, opts)
+ if hasattr(self.base, 'pkgSack'): # kill the pkgSack
+ del self.base.pkgSack
+ self.base.repos._selectSackType()
+ if hasattr(self.base, 'up'): # reset the updates
+ del self.base.up
+ # reset the transaction set, we have to or we shall surely die!
+ self.base.closeRpmDB()
+ self.base.doTsSetup()
+ self.base.doRpmDBSetup()
+ else:
+ self.do_help('config')
-
-
- def do_repositories(self, line):
+ def do_repository(self, line):
self.do_repos(line)
- def do_repos(self, line):
+ def do_repo(self, line):
(cmd, args, line) = self.parseline(line)
if cmd in ['list', None]:
+ if self.base.repos.repos.values():
+ self.base.log(2, '%-20.20s %-40.40s status' % ('repo id', 'repo name'))
for repo in self.base.repos.repos.values():
if repo in self.base.repos.listEnabled():
- self.base.log('%-20.20s %-40.40s enabled' % (repo, repo.name))
+ self.base.log(2, '%-20.20s %-40.40s enabled' % (repo, repo.name))
else:
- self.base.log('%-20.20s %-40.40s disabled' % (repo, repo.name))
+ self.base.log(2, '%-20.20s %-40.40s disabled' % (repo, repo.name))
elif cmd == 'enable':
repos = args.split()
@@ -224,7 +263,7 @@
def do_run(self, line):
if len(self.base.tsInfo) > 0:
try:
- self.base.doTransaction()
+ returnval = self.base.doTransaction()
except Errors.YumBaseError, e:
self.base.errorlog(0, '%s' % e)
except KeyboardInterrupt, e:
@@ -233,8 +272,11 @@
if e.errno == 32:
self.base.errorlog(0, '\n\nExiting on Broken Pipe')
else:
- self.base.log(2, 'Finished Transaction')
- self.base.closeRpmDB()
- self.base.doTsSetup()
- self.base.doRpmDBSetup()
+ if returnval != 0:
+ self.base.log(0, 'Transaction did not run.')
+ else:
+ self.base.log(2, 'Finished Transaction')
+ self.base.closeRpmDB()
+ self.base.doTsSetup()
+ self.base.doRpmDBSetup()
More information about the Yum-cvs-commits
mailing list