new changes to script by stahnma

This commit is contained in:
Mike McGrath 2008-06-15 12:30:29 -05:00
parent 7eb6a7d684
commit 8f5ec7e704
6 changed files with 147 additions and 73 deletions

View file

@ -23,17 +23,6 @@ import tempfile
from urllib import FancyURLopener
class AccountsURLopener(FancyURLopener):
"""Subclass of urllib.FancyURLopener to allow passing http basic auth info"""
def __init__(self, username, password):
FancyURLopener.__init__(self)
self.username = username
self.password = password
def prompt_user_passwd(self, host, realm):
return (self.username, self.password)
class PackageOwners:
"""interface to Fedora package owners list (and Fedora Extras owners/owners.list file)"""
@ -219,8 +208,8 @@ class PackageOwners:
if count != 0:
time.sleep(self.retrysecs)
try:
opener = AccountsURLopener(self.username, self.password)
f = opener.open(url)
opener = FancyURLopener()
f = opener.open(url, data='user_name=%s&password=%s&login=Login' % (self.username, self.password))
rc = 0
if 'www-authenticate' in f.headers:
rc = 1
@ -245,7 +234,11 @@ class PackageOwners:
def _downloadfrompkgdb(self):
fasdump = self._getlinesfromurl('https://admin.fedoraproject.org/accounts/dump-group.cgi')
# Construct an URL that makes FancyURLopener use authentication
# with the first request and not just in return to 401.
fas2authurl = 'https://admin.fedoraproject.org/accounts/group/dump/'
fasdump = self._getlinesfromurl(fas2authurl)
self.usermap = {}
for line in fasdump:
fields = line.split(',')

View file

@ -0,0 +1,35 @@
#!/bin/bash
DATE=`date +%Y%m%d`
YUM_CONF_LOC=/etc/yum.repos.d/yum.epel.conf
OUTPUT_DIR=$HOME
RC_REPORT_CFG=/etc/rc-report-epel.cfg
process_deps()
{
release=$1
arch=$2
testing=$3
mail=$4
[ -z $4 ] && mail="no" || mail="yes"
[ $arch = "ppc" ] && arch_label=ppc64 || arch_label=$arch
command="/usr/local/bin/rc-modified -d mdcache -n -c $YUM_CONF_LOC -a $arch_label -r rhel-$release-$arch -r fedora-epel-$release-$arch"
[ $release -eq 5 ] && command="$command -r rhel-$release-$arch-vt "
[ "$testing" = "testing" ] && command="$command -r fedora-epel-testing-$release-$arch "
OUTFILE=$OUTPUT_DIR/epel${release}${arch}-$DATE.txt
$command > $OUTFILE
[ "$4" = "yes" ] && /usr/local/bin/rc-report.py $OUTFILE -k epel -c $RC_REPORT_CFG -w testing -m summary -m owner
}
# process_deps RHEL_RELEASE ARCH INCLUDE_TESTING? MAIL?
# RHEL 5
process_deps 5 i386 testing yes
process_deps 5 x86_64 testing yes
process_deps 5 ppc testing yes
# RHEL 4
process_deps 4 i386 testing yes
process_deps 4 x86_64 testing yes
process_deps 4 ppc testing yes

View file

@ -50,13 +50,15 @@ def parseArgs():
parser.add_option("-r", "--repoid", default=[], action='append',
help="specify repo ids to query, can be specified multiple times (default is all enabled)")
parser.add_option("-t", "--tempcache", default=False, action="store_true",
help="Use a temp dir for storing/accessing yum-cache")
help="use a temp dir for storing/accessing yum-cache")
parser.add_option("-d", "--cachedir", default='',
help="specify a custom directory for storing/accessing yum-cache")
parser.add_option("-q", "--quiet", default=0, action="store_true",
help="quiet (no output to stderr)")
parser.add_option("-n", "--newest", default=0, action="store_true",
help="check only the newest packages in the repos")
parser.add_option("", "--nomultilibhack", default=False, action="store_true",
help="disable multi-lib hack")
(opts, args) = parser.parse_args()
return (opts, args)
@ -72,7 +74,9 @@ class RepoClosure(yum.YumBase):
if hasattr(self.repos, 'sqlite'):
self.repos.sqlite = False
self.repos._selectSackType()
self.guessMultiLibProbs = True
def evrTupletoVer(self,tuple):
"""convert and evr tuple to a version string, return None if nothing
to convert"""
@ -100,10 +104,42 @@ class RepoClosure(yum.YumBase):
except TypeError:
self.repos.populateSack(which=[repo.id], with='filelists')
def isnewest(self, pkg):
newest = pkg.pkgtup in self.newestpkgtuplist
if not self.guessMultiLibProbs:
return newest
# Multi-lib hack:
#
# This is supposed to catch corner-cases, such as:
# Base-arch pkg was updated, but a corresponding compat-arch pkg
# is not included in the repo, because e.g. it was repackaged
# and no longer is pulled in by the multi-lib resolver.
# Assume, that if it the old compat-arch pkg is in the repo,
# there is no upgrade path from biarch installs to single-arch
# (the one pkg upgrades two installed pkgs with different arch)
(n,a,e,v,r) = pkg.pkgtup
if newest or a=='noarch':
return newest # the trivial case
for provpkg in self.pkgSack.returnNewestByName(n):
prov_a = provpkg.pkgtup[1]
if prov_a=='noarch' or prov_a==a:
(prov_e, prov_v, prov_r) = provpkg.pkgtup[2:]
vercmp = rpmUtils.miscutils.compareEVR( (prov_e,prov_v,prov_r), (e,v,r) )
if vercmp>0: # provpkg is newer
return False
# No noarch/same-arch pkg is newer, but a basearch pkg may be newer
# and therefore be the only one in newestpkgtuplist.
return True
def getBrokenDeps(self, newest=False):
unresolved = {}
resolved = {}
newpkgtuplist = []
self.newestpkgtuplist = []
if newest:
if yum.__version__ >= '2.9': # TODO: check
pkgs = self.pkgSack.returnNewestByName()
@ -111,7 +147,7 @@ class RepoClosure(yum.YumBase):
pkgs = []
for l in self.pkgSack.returnNewestByName():
pkgs.extend(l)
newestpkgtuplist = ListPackageSack(pkgs).simplePkgList()
self.newestpkgtuplist = ListPackageSack(pkgs).simplePkgList()
pkgs = self.pkgSack.returnNewestByNameArch()
else:
@ -142,19 +178,6 @@ class RepoClosure(yum.YumBase):
except AttributeError:
pass
def isnotnewest(pkg):
# Handle noarch<->arch switches in package updates, so any
# old nevra returned by returnNewestByNameArch() are skipped.
# TODO: There must be a more elegant/convenient way.
if (pkg.pkgtup[1] == 'noarch'):
if (pkg.pkgtup not in newestpkgtuplist):
return True
else:
for p in self.pkgSack.returnNewestByName(pkg.pkgtup[0]):
if (p.pkgtup[1] == 'noarch') and (p.pkgtup in newestpkgtuplist):
return True
return False
for (req, flags, (reqe, reqv, reqr)) in pkg.returnPrco('requires'):
if req.startswith('rpmlib'): continue # ignore rpmlib deps
@ -167,7 +190,7 @@ class RepoClosure(yum.YumBase):
pass
if len(resolve_sack) < 1:
if newest and isnotnewest(pkg):
if newest and not self.isnewest(pkg):
break
if not unresolved.has_key(pkg):
unresolved[pkg] = []
@ -181,7 +204,7 @@ class RepoClosure(yum.YumBase):
if newest and not kernelprovides and not req.startswith('kernel'): # we allow old kernels
resolved_by_newest = False
for po in resolve_sack:# look through and make sure all our answers are newest-only
for po in resolve_sack:# look through and make sure any of our answers are newest-only
# 2nd stage handling of obsoletes. Only keep providers,
# which are not obsolete. If no provider is left, the
@ -202,7 +225,7 @@ class RepoClosure(yum.YumBase):
if resolved_by_newest:
resolved[(req,flags,ver)] = 1
else:
if newest and isnotnewest(pkg):
if newest and not self.isnewest(pkg):
break
if not unresolved.has_key(pkg):
unresolved[pkg] = []
@ -217,6 +240,7 @@ class RepoClosure(yum.YumBase):
def main():
(opts, cruft) = parseArgs()
my = RepoClosure(arch = opts.arch, config = opts.config)
my.guessMultiLibProbs = not opts.nomultilibhack
if opts.repoid:
for repo in my.repos.repos.values():

View file

@ -1,7 +1,7 @@
[FAS]
project = Fedora EPEL
#user = foo
#passwd = secret
user = fedorasy
passwd = BdSkfjD8dbFF3
[Mail]
from = Fedora Extras repoclosure <buildsys@fedoraproject.org>

View file

@ -334,7 +334,7 @@ for toaddr,(new,body) in reports.iteritems():
mailtext += giveNeedsignMsg()
mailtext += giveTestingMsg()
mailtext += body
if domail and ('owners' in opts.mail) and toaddr!='UNKNOWN OWNER':
if domail and ('owner' in opts.mail) and toaddr!='UNKNOWN OWNER':
subject = Mail['subject'] + ' - %s' % datetime.date.today()
mail( srv, Mail['from'], toaddr, Mail['replyto'], subject, mailtext )

View file

@ -11,87 +11,109 @@ retries=20
### EL5 ###
[centos-5-i386]
name=CentOS 5 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/5/os/i386/
[rhel-5-i386]
name=RHEL5
baseurl=http://infrastructure.fedoraproject.org/rhel/RHEL5-$basearch/Server
enabled=0
[centos-updates-5-i386]
name=CentOS Updates 5 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/5/updates/i386/
[rhel-5-i386-vt]
name=RHEL5
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-i386-server-vt-5/
enabled=0
[centos-5-x86_64]
name=CentOS 5 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/5/os/x86_64/
[rhel-5-x86_64]
name=RHEL 5 - x86_64
baseurl=http://infrastructure.fedoraproject.org/rhel/RHEL5-$basearch/Server
enabled=0
[centos-updates-5-x86_64]
name=CentOS Updates 5 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/5/updates/x86_64/
[rhel-5-x86_64-vt]
name=RHEL5
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-x86_64-server-vt-5/
enabled=0
[rhel-5-ppc]
name=RHEL 5 ppc
baseurl=http://infrastructure.fedoraproject.org/rhel/RHEL5-$basearch/Server
[rhel-5-ppc-vt]
name=RHEL5
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-ppc-server-vt-5/
enabled=0
[fedora-epel-5-i386]
name=Fedora EPEL 5 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/5/i386/
baseurl=file:///pub/epel/5/i386/
enabled=0
[fedora-epel-testing-5-i386]
name=Fedora EPEL Test Updates 5 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/testing/5/i386/
baseurl=file:///pub/epel/testing/5/i386/
enabled=0
[fedora-epel-5-x86_64]
name=Fedora EPEL 5 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/5/x86_64/
baseurl=file:///pub/epel/5/x86_64/
enabled=0
[fedora-epel-testing-5-x86_64]
name=Fedora EPEL Test Updates 5 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/testing/5/x86_64/
baseurl=file:///pub/epel/testing/5/x86_64/
enabled=0
[fedora-epel-5-ppc]
name=Fedora EPEL 5 - ppc
baseurl=file:///pub/epel/5/ppc/
enabled=0
[fedora-epel-testing-5-ppc]
name=Fedora EPEL Test Updates 5 - ppc
baseurl=file:///pub/epel/testing/5/ppc/
enabled=0
### EL4 ###
[centos-4-i386]
name=CentOS 4 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/4/os/i386/
[rhel-4-i386]
name=RHEL 4 - i386
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-i386-as-4/
enabled=0
[centos-updates-4-i386]
name=CentOS Updates 4 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/4/updates/i386/
[rhel-4-x86_64]
name=RHEL 4 - x86_64
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-x86_64-as-4/
enabled=0
[centos-4-x86_64]
name=CentOS 4 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/4/os/x86_64/
[rhel-4-ppc]
name=RHEL 4 - ppc
baseurl=http://infrastructure.fedoraproject.org/rhel/rhel-ppc-as-4/
enabled=0
[centos-updates-4-x86_64]
name=CentOS Updates 4 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/centos/4/updates/x86_64/
enabled=0
[fedora-epel-4-i386]
name=Fedora EPEL 4 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/4/i386/
baseurl=file:///pub/epel/4/i386/
enabled=0
[fedora-epel-testing-4-i386]
name=Fedora EPEL Test Updates 4 - i386
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/testing/4/i386/
baseurl=file:///pub/epel/testing/4/i386/
enabled=0
[fedora-epel-4-x86_64]
name=Fedora EPEL 4 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/4/x86_64/
baseurl=file:///pub/epel/4/x86_64/
enabled=0
[fedora-epel-testing-4-x86_64]
name=Fedora EPEL Test Updates 4 - x86_64
baseurl=http://wftp.tu-chemnitz.de/pub/linux/fedora-epel/testing/4/x86_64/
baseurl=file:///pub/epel/testing/4/x86_64/
enabled=0
[fedora-epel-4-ppc]
name=Fedora EPEL 4 - ppc
baseurl=file:///pub/epel/4/ppc/
enabled=0
[fedora-epel-testing-4-ppc]
name=Fedora EPEL Test Updates 4 - ppc
baseurl=file:///pub/epel/testing/4/ppc/
enabled=0