extras-repoclosure RepoSupport.py,NONE,1.1
Michael Schwendt (mschwendt)
fedora-extras-commits at redhat.com
Sun Jul 16 13:35:45 UTC 2006
- Previous message (by thread): rpms/perl-Module-ScanDeps/devel .cvsignore, 1.4, 1.5 perl-Module-ScanDeps.spec, 1.4, 1.5 sources, 1.4, 1.5
- Next message (by thread): rpms/qt4/FC-5 .cvsignore,1.4,1.5 qt4.spec,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mschwendt
Update of /cvs/fedora/extras-repoclosure
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11757
Added Files:
RepoSupport.py
Log Message:
create separate module for this reusable code
--- NEW FILE RepoSupport.py ---
#!/usr/bin/python
# -*- mode: Python; indent-tabs-mode: nil; -*-
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import os, tempfile
class RepoSupport:
"""helper functions and constants for yum/repomd usage"""
def __init__(self):
# List of distribution release names in repository.
self.allreleases = [ '3', '4', '5', 'development' ]
# Architecture directory names per distribution release in repository.
self.archs = { '3' : ['i386','x86_64'],
'4' : ['i386','x86_64','ppc'],
'5' : ['i386','x86_64','ppc'],
'development' : ['i386','x86_64','ppc']
}
self.repos = { '3' : ['fedora-core','fedora-core-updates','fedora-extras'],
'4' : ['fedora-core','fedora-core-updates','fedora-extras'],
'5' : ['fedora-core','fedora-core-updates','fedora-extras'],
'development' : ['fedora-core','fedora-extras']
}
self.reponames = { 'fedora-core' : 'Fedora Core',
'fedora-core-updates' : 'Fedora Core Released Updates',
'fedora-extras' : 'Fedora Extras'
}
# (%s, %s) = (release, arch)
self.baseurls = { 'fedora-core' : 'http://download.fedora.redhat.com/pub/fedora/linux/core/%s/%s/os/',
'fedora-core-updates' : 'http://download.fedora.redhat.com/pub/fedora/linux/core/updates/%s/%s/',
'fedora-extras' : 'file:///srv/rpmbuild/extras/tree/extras/%s/%s/'
}
# TODO: use rpmUtils?
self.targetarchs = { 'i386' : 'i686',
'x86_64' : 'x86_64',
'ppc' : 'ppc'
}
def AllReleases(self):
"""return list of all distribution release names"""
return self.allreleases
def ReleaseArchsDict(self):
"""return map with list of releases per architecture"""
return self.relarchs
def GenerateConfig(self, releases, cachedir=''):
"""return temporary yum.conf with repository definitions for the
specified releases"""
try:
(fd, conffile) = tempfile.mkstemp()
except:
conffile = tempfile.mktemp()
fd = os.open(conffile,os.O_RDWR|os.O_CREAT)
confheader = """[main]
cachedir=%s
debuglevel=2
logfile=/dev/null
pkgpolicy=newest
distroverpkg=fedora-release
reposdir=/dev/null
exactarch=1
obsoletes=1
retries=20
""" % (cachedir)
os.write(fd,confheader)
for release in releases:
for repo in self.repos[release]:
for arch in self.archs[release]:
reposection = """[%s-%s-%s]
name=%s %s - %s
baseurl=%s
enabled=0
""" % (repo, release, arch,
self.reponames[repo], release, arch,
self.baseurls[repo] % (release,arch))
os.write(fd,reposection)
os.close(fd)
return conffile
def GenerateRepoIds(self, release):
"""return list of all repository ids for the specified release"""
repoids = []
for arch in self.archs[release]:
for r in self.repos[release]:
repoid = '%s-%s-%s' % (r,release,arch)
repoids.append(repoid)
return repoids
- Previous message (by thread): rpms/perl-Module-ScanDeps/devel .cvsignore, 1.4, 1.5 perl-Module-ScanDeps.spec, 1.4, 1.5 sources, 1.4, 1.5
- Next message (by thread): rpms/qt4/FC-5 .cvsignore,1.4,1.5 qt4.spec,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list