[yum-commits] 2 commits - yum-complete-transaction.py
skvidal at osuosl.org
skvidal at osuosl.org
Mon Nov 16 16:43:04 UTC 2009
yum-complete-transaction.py | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
New commits:
commit ce8cf5dea810f68cd09941dfc486c63bb25ea0f0
Merge: c5fae0a... a65347c...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon Nov 16 11:42:43 2009 -0500
Merge branch 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum-utils
* 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum-utils:
remove basearch plugin from spec, it is obsoleted by recent version of yum, truncated changelog to last 2 years
updated ChangeLog
bumped yum-utils version to 1.1.24
Fix pylint errors:
silence pylint runtime error noise
Fix UnicodeDecodeError with UTF-8 changelog names.
Change update => notice, as that's what we are counting
Add summary-updateinfo command
Move running kernel check to it's own function
Add bash completion for repo-graph, repo-rss, repoclosure and repoquery.
commit c5fae0afe3f88a66757a432657d765c343e7bd4d
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon Nov 16 11:35:27 2009 -0500
add some checking to yum-complete-transaction - make sure that the transaction we are going to run
to complete the unfinished transaction is not different in size than what we were going to run.
Helps keep us out of mistakenly removing everything
diff --git a/yum-complete-transaction.py b/yum-complete-transaction.py
index 7c544c2..ba41a51 100755
--- a/yum-complete-transaction.py
+++ b/yum-complete-transaction.py
@@ -117,15 +117,22 @@ class YumCompleteTransaction(YumUtilBase):
self.addCmdOptions()
self.main()
- def clean_up_ts_files(self, timestamp, path):
+ def clean_up_ts_files(self, timestamp, path, disable=False):
# clean up the transactions
tsdone = '%s/transaction-done.%s' % (path, timestamp)
tsall = '%s/transaction-all.%s' % (path, timestamp)
+ results = []
for f in [tsall, tsdone]:
if os.path.exists(f):
- os.unlink(f)
-
+ if disable:
+ disable_f = f + '.disabled'
+ os.rename(f, disable_f)
+ results.append(disable_f)
+ else:
+ os.unlink(f)
+ return results
+
def addCmdOptions(self):
self.optparser_grp.add_option("--cleanup-only", default=False,
action="store_true", dest="cleanup",
@@ -153,7 +160,14 @@ class YumCompleteTransaction(YumUtilBase):
# take the most recent one
# populate the ts
# run it
- times = find_unfinished_transactions(self.conf.persistdir)
+
+ times = []
+ for thistime in find_unfinished_transactions(self.conf.persistdir):
+ if thistime.endswith('disabled'):
+ continue
+ # XXX maybe a check here for transactions that are just too old to try and complete?
+ times.append(thistime)
+
if not times:
print "No unfinished transactions left."
sys.exit()
@@ -166,9 +180,10 @@ class YumCompleteTransaction(YumUtilBase):
self.clean_up_ts_files(timestamp, self.conf.persistdir)
sys.exit()
- print "There are %d outstanding transactions to complete. Finishing the most recent one" % len(times)
timestamp = times[-1]
+ print "There are %d outstanding transactions to complete. Finishing the most recent one" % len(times)
+
remaining = find_ts_remaining(timestamp, yumlibpath=self.conf.persistdir)
print "The remaining transaction had %d elements left to run" % len(remaining)
for (action, pkgspec) in remaining:
@@ -184,8 +199,20 @@ class YumCompleteTransaction(YumUtilBase):
self.remove(po=pkg)
-
+ current_count = len(self.tsInfo)
self.buildTransaction(unfinished_transactions_check=False)
+ if current_count != len(self.tsInfo):
+ print '\n\nTransaction size changed - this means we are not doing the\n' \
+ 'same transaction as we were before. Aborting and disabling\n' \
+ 'this transaction.'
+
+ print '\nYou could try running: package-cleanup --problems\n' \
+ ' package-cleanup --dupes\n' \
+ ' rpm -Va --nofiles --nodigest'
+ filelist = self.clean_up_ts_files(timestamp, self.conf.persistdir, disable=True)
+ print '\nTransaction files renamed to:\n %s' % '\n '.join(filelist)
+ sys.exit()
+
if len(self.tsInfo) < 1:
print 'Nothing in the unfinished transaction to cleanup.'
print "Cleaning up completed transaction file"
More information about the Yum-commits
mailing list