Skip to content

Commit

Permalink
merge yum-2_1 branch to become HEAD
Browse files Browse the repository at this point in the history
begin to 'correct' how cvs is done so it matches the rest of the world
  • Loading branch information
Seth Vidal committed Oct 8, 2003
1 parent f2eb703 commit c3186fa
Show file tree
Hide file tree
Showing 31 changed files with 2,440 additions and 1,598 deletions.
1,075 changes: 717 additions & 358 deletions ChangeLog

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,34 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

SUBDIRS = bin etc docs
SUBDIRS = bin etc docs po

MODULES = $(srcdir)/pullheaders.pyc \
$(srcdir)/config.pyc \
$(srcdir)/nevral.pyc \
$(srcdir)/logger.pyc \
$(srcdir)/yumlock.pyc \
$(srcdir)/yummain.pyc \
$(srcdir)/i18n.pyc \
$(srcdir)/pkgaction.pyc \
$(srcdir)/serverStuff.pyc \
$(srcdir)/serverStuff.pyc \
$(srcdir)/archwork.pyc \
$(srcdir)/callback.pyc \
$(srcdir)/clientStuff.pyc \
$(srcdir)/depchecktree.pyc \
$(srcdir)/iutil.pyc \
$(srcdir)/lilocfg.pyc \
$(srcdir)/lilo.pyc \
$(srcdir)/grubcfg.pyc \
$(srcdir)/checkbootloader.pyc \
$(srcdir)/bootloadercfg.pyc \
$(srcdir)/up2datetheft.pyc \
$(srcdir)/translate.pyc \
$(srcdir)/urlgrabber.pyc

$(srcdir)/keepalive.pyc \
$(srcdir)/urlgrabber.pyc \
$(srcdir)/progress_meter.pyc \
$(srcdir)/yumcomps.pyc \
$(srcdir)/failover.pyc \
$(srcdir)/comps.pyc \
$(srcdir)/rpmUtils.pyc

.SUFFIXES: .py .pyc
.py.pyc:
Expand Down Expand Up @@ -131,7 +135,7 @@ daily:
$(MAKE) dailyfiles
day=`/bin/date +%Y%m%d`; \
distdir=$(PACKAGE); \
tarname=$$distdir-1.0-$$day ;\
tarname=$$distdir-$$day ;\
cd .disttmp; \
perl -pi -e "s/\#DATE\#/$$day/g" $$distdir/yum-daily.spec; \
echo $$day; \
Expand Down Expand Up @@ -176,7 +180,6 @@ distfiles:
$(srcdir)/configure.in \
$(srcdir)/configure \
$(srcdir)/yum.spec \
$(srcdir)/yum-7.x.spec \
$(srcdir)/install-sh \
$(srcdir)/mkinstalldirs \
$(top_srcdir)/.disttmp/$$distdir
Expand Down
13 changes: 11 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ yum-arch is run in one of two ways:
yum-arch <top level of archive>


For a complete explanation of yum visit:

http:https://www.dulug.duke.edu/yum/

Theory of operation/use:Yum works by providing the headers of all the rpm packages in any system
repository. These headers are stored on the webserver in a subdir of the
top level of the repository. The client downloads all of the headers of
the packages it doesn't have installed or of packages that have been updated.
It uses the headers to determine the dependencies it will need using rpm's internal
dependency calculation. Once it knows what rpms it will need it downloads them and
performs the transaction.

Multiple repositories - explanation of how it came out/why.

Explanation of why not apt-rpm
Expand Down
6 changes: 5 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
see http:https://www.dulug.duke.edu/yum/yum-todo.html
see http:https://linux.duke.edu/yum/yum-todo.ptml

click on the Todo list link.


11 changes: 3 additions & 8 deletions archwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@
# Copyright 2002 Duke University

import os
import rpm
import re
try:
import rpm404
rpm = rpm404
except ImportError, e:
import rpm
rpm404 = rpm


def getArch():
arch = os.uname()[4]
Expand Down Expand Up @@ -65,6 +59,7 @@ def bestarch(archlist):
currentarch = betterarch(currentarch, arch)
return currentarch


def compatArchList():
archdict = {}
archdict['i386']=['i386','i486','i586','i686','athlon','noarch']
Expand All @@ -82,7 +77,7 @@ def compatArchList():
else:
archlist = [myarch, 'noarch']
return archlist

def availablearchs(nevral, name):
archlist = compatArchList()
finalarchs = []
Expand Down
30 changes: 23 additions & 7 deletions bin/yum
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import sys
import os
sys.path.insert(1,'/usr/share/yum')
import yummain
from i18n import _
import yumlock

uid = os.geteuid()
Expand All @@ -32,13 +33,28 @@ if uid == 0:
pass
else:
fd = open(lockfile, 'r')
oldpid = fd.readline()
if not os.path.exists('/proc/' + oldpid):
try: oldpid = int(fd.readline())
except ValueError:
# bogus data in the pid file. Throw away.
os.unlink(lockfile)
yumlock.lock(lockfile, mypid, 0644)
else:
print 'Existing lock %s. Aborting.' % lockfile
sys.exit(1)
try: os.kill(oldpid, 0)
except OSError, e:
import errno
if e[0] == errno.ESRCH:
# The pid doesn't exist
os.unlink(lockfile)
else:
# Whoa. What the heck happened?
print _('Unable to check if PID %s is active') % oldpid
sys.exit(1)
else:
# Another copy seems to be running.
msg = _('Existing lock %s: another copy is running. Aborting.')
print msg % lockfile
sys.exit(1)
# lock again.
yumlock.lock(lockfile, mypid, 0644)

try:
yummain.main(sys.argv[1:])
Expand All @@ -47,12 +63,12 @@ except SystemExit, e:
yumlock.unlock(lockfile)
sys.exit(e)
except KeyboardInterrupt, e:
print 'Exiting on User Cancel'
print _('Exiting on User Cancel')
if uid == 0:
yumlock.unlock(lockfile)
sys.exit(1)
except IOError, (errno, strerror):
print 'IOError - # %s - %s' % (errno, strerror)
print _('IOError - # %s - %s') % (errno, strerror)
if uid == 0:
yumlock.unlock(lockfile)
sys.exit(1)
Expand Down
2 changes: 0 additions & 2 deletions bootloadercfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import os,sys
import iutil
#from translate import _, N_, cat
#from up2date import log

class Error:
# base class for client errors
Expand Down
107 changes: 66 additions & 41 deletions callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,75 @@
# Copyright 2002 Duke University


try:
import rpm404
rpm = rpm404
except ImportError, e:
import rpm
rpm404 = rpm


import rpm
import os
import sys

callbackfilehandles = {}
def install_callback(what, bytes, total, h, user):
if what == rpm.RPMCALLBACK_TRANS_PROGRESS:
pass
elif what == rpm.RPMCALLBACK_TRANS_STOP:
pass
from i18n import _

elif what == rpm.RPMCALLBACK_TRANS_START:
pass
elif what == rpm.RPMCALLBACK_INST_OPEN_FILE:
if h != None:
pkg, rpmloc = h
fd = os.open(rpmloc, os.O_RDONLY)
callbackfilehandles[h]=fd
return fd
else:
print "No header - huh?"
class RPMInstallCallback:
def __init__(self):
self.callbackfilehandles = {}
self.total_actions = 0
self.total_installed = 0
self.installed_pkg_names = []
self.total_removed = 0
def callback(self, what, bytes, total, h, user):
if what == rpm.RPMCALLBACK_TRANS_START:
if bytes == 6:
self.total_actions = total

elif what == rpm.RPMCALLBACK_TRANS_PROGRESS:
pass

elif what == rpm.RPMCALLBACK_TRANS_STOP:
pass

elif what == rpm.RPMCALLBACK_INST_OPEN_FILE:
hdr = None
if h != None:
hdr, rpmloc = h
handle = '%s:%s.%s-%s-%s' % (hdr[rpm.RPMTAG_EPOCH],
hdr[rpm.RPMTAG_NAME], hdr[rpm.RPMTAG_VERSION],
hdr[rpm.RPMTAG_RELEASE], hdr[rpm.RPMTAG_ARCH])
fd = os.open(rpmloc, os.O_RDONLY)
self.callbackfilehandles[handle]=fd
self.total_installed += 1
self.installed_pkg_names.append(hdr[rpm.RPMTAG_NAME])
return fd
else:
print _("No header - huh?")

elif what == rpm.RPMCALLBACK_INST_CLOSE_FILE:
os.close(callbackfilehandles[h])
fd = 0
elif what == rpm.RPMCALLBACK_INST_CLOSE_FILE:
hdr = None
if h != None:
hdr, rpmloc = h
handle = '%s:%s.%s-%s-%s' % (hdr[rpm.RPMTAG_EPOCH],
hdr[rpm.RPMTAG_NAME], hdr[rpm.RPMTAG_VERSION],
hdr[rpm.RPMTAG_RELEASE], hdr[rpm.RPMTAG_ARCH])
os.close(self.callbackfilehandles[handle])
fd = 0

elif what == rpm.RPMCALLBACK_INST_PROGRESS:
if h != None:
pkg, rpmloc = h
if total == 0:
percent=0
else:
percent = (bytes*100L)/total
if conf.debuglevel >=2:
sys.stdout.write("\r%s %d %% done" % (pkg[rpm.RPMTAG_NAME], percent))
if bytes == total:
print " "



elif what == rpm.RPMCALLBACK_INST_PROGRESS:
if h != None:
pkg, rpmloc = h
if total == 0:
percent = 0
else:
percent = (bytes*100L)/total
if conf.debuglevel >= 2:
sys.stdout.write("\r%s %d %% done %d/%d" % (pkg[rpm.RPMTAG_NAME],
percent, self.total_installed + self.total_removed, self.total_actions))
if bytes == total:
print " "
elif what == rpm.RPMCALLBACK_UNINST_START:
pass
elif what == rpm.RPMCALLBACK_UNINST_STOP:
self.total_removed += 1
if conf.debuglevel >= 2:
if h not in self.installed_pkg_names:
print 'Erasing: %s %d/%d' % (h, self.total_removed +
self.total_installed, self.total_actions)
else:
print 'Completing update for %s - %d/%d' % (h, self.total_removed +
self.total_installed, self.total_actions)
5 changes: 3 additions & 2 deletions checkbootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import os,sys
import string
from i18n import _


grubConfigFile = "/boot/grub/grub.conf"
Expand Down Expand Up @@ -161,6 +162,6 @@ def whichBootLoader(instRoot = "/"):
if __name__ == "__main__":
bootloader = whichBootLoader()
if bootloader:
print "Found %s." % (bootloader)
print _("Found %s.") % (bootloader)
else:
print "Unable to determine boot loader."
print _("Unable to determine boot loader.")

0 comments on commit c3186fa

Please sign in to comment.