diff options
author | Michal Toman <mtoman@redhat.com> | 2011-03-23 11:19:01 +0100 |
---|---|---|
committer | Michal Toman <mtoman@redhat.com> | 2011-03-23 11:19:01 +0100 |
commit | dc42378d86f3cc7416c3c9eca3dd331f3f8e59da (patch) | |
tree | 684d9443cf787becdf4e103edf3aa68202690040 | |
parent | 7de7895acbd189a0be5212583d78dacecd6984db (diff) | |
download | abrt-dc42378d86f3cc7416c3c9eca3dd331f3f8e59da.tar.gz abrt-dc42378d86f3cc7416c3c9eca3dd331f3f8e59da.tar.xz abrt-dc42378d86f3cc7416c3c9eca3dd331f3f8e59da.zip |
retrace server: make reposync pluginable
-rwxr-xr-x | src/retrace/abrt-retrace-reposync | 87 | ||||
-rwxr-xr-x | src/retrace/abrt-retrace-reposync.py | 115 | ||||
-rw-r--r-- | src/retrace/plugins/__init__.py | 24 | ||||
-rw-r--r-- | src/retrace/plugins/fedora.py | 29 | ||||
-rw-r--r-- | src/retrace/retrace-local.repo | 143 | ||||
-rw-r--r-- | src/retrace/retrace.py | 25 | ||||
-rw-r--r-- | src/retrace/retrace.repo | 192 | ||||
-rwxr-xr-x | src/retrace/worker.py | 36 |
8 files changed, 203 insertions, 448 deletions
diff --git a/src/retrace/abrt-retrace-reposync b/src/retrace/abrt-retrace-reposync deleted file mode 100755 index 64291100..00000000 --- a/src/retrace/abrt-retrace-reposync +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -if [ $3 ] && [ ! $4 ] \ - && [ $1 = "fedora" ] \ - && ( [ $3 = "i386" ] || [ $3 = "i686" ] || [ $3 = "x86_64" ] ) -then - LOG="/var/log/abrt-retrace/$1-$2-$3.log" - LOCK="/var/lock/subsys/abrt-retrace-$1-$2-$3" - REPODIR="/var/cache/abrt-retrace/" - - REPODIR_CUSTOM=`cat "/etc/abrt/retrace.conf" | grep "^ *RepoDir *= *" | sed "s/^ *RepoDir *= *//"` - if [ -d $REPODIR_CUSTOM ] || mkdir -p $REPODIR_CUSTOM > /dev/null 2>&1 - then - REPODIR="$REPODIR_CUSTOM" - fi - - date >> "$LOG" - - if [ -f "$LOCK" ] - then - echo "The repository synchronization is running at the moment." >> "$LOG" - exit 2 - fi - - if ! touch "$LOCK" - then - echo "Unable to set lock." - exit 3 - fi - - cd "$REPODIR" - - if [ $3 = "i686" ] - then - REPOARCH="i386" - else - REPOARCH=$3 - fi - - # F15 pushes updates directly to fedora repo - if [ $1 = "fedora" ] && [ $2 = "15" ] - then - reposync -a $3 \ - --repoid="$1-$2-$REPOARCH" \ - --repoid="$1-$2-$REPOARCH-debuginfo" \ - | grep "Downloading" \ - | sed -e "s/^\[\([^:]*\).*\] Downloading /\1 /" \ - | sed -e "s/Packages\///" \ - >> "$LOG" - - createrepo "$1-$2-$REPOARCH" > /dev/null - createrepo "$1-$2-$REPOARCH-debuginfo" > /dev/null - else - reposync -a $3 \ - --repoid="$1-$2-$REPOARCH-updates" \ - --repoid="$1-$2-$REPOARCH-updates-debuginfo" \ - | grep "Downloading" \ - | sed -e "s/^\[\([^:]*\).*\] Downloading /\1 /" \ - | sed -e "s/Packages\///" \ - >> "$LOG" - - createrepo "$1-$2-$REPOARCH-updates" > /dev/null - createrepo "$1-$2-$REPOARCH-updates-debuginfo" > /dev/null - fi - - reposync -a $3 \ - --repoid="$1-$2-$REPOARCH-updates-testing" \ - --repoid="$1-$2-$REPOARCH-updates-testing-debuginfo" \ - | grep "Downloading" \ - | sed -e "s/^\[\([^:]*\).*\] Downloading /\1 /" \ - | sed -e "s/Packages\///" \ - >> "$LOG" - - createrepo "$1-$2-$REPOARCH-updates-testing" > /dev/null - createrepo "$1-$2-$REPOARCH-updates-testing-debuginfo" > /dev/null - - rm -f "$LOCK" -else - echo "Usage: $0 distribution version architecture" - echo - echo "where" - echo "distributuon = [fedora]" - echo "version = release version" - echo "architecture = [i386|i686|x86_64]" - - exit 1 -fi diff --git a/src/retrace/abrt-retrace-reposync.py b/src/retrace/abrt-retrace-reposync.py new file mode 100755 index 00000000..3f87d831 --- /dev/null +++ b/src/retrace/abrt-retrace-reposync.py @@ -0,0 +1,115 @@ +#!/usr/bin/python + +import argparse +import os +import pwd +import sys +from retrace import * + +TARGET_USER = "abrt" + +if __name__ == "__main__": + # parse arguments + argparser = argparse.ArgumentParser(description="Retrace Server repository downloader") + argparser.add_argument("distribution", type=str, help="Distribution name") + argparser.add_argument("version", type=str, help="Release version") + argparser.add_argument("architecture", type=str, help="CPU architecture") + args = argparser.parse_args() + + distribution = args.distribution + version = args.version + arch = args.architecture + + if arch == "i686": + arch = "i386" + + # drop privilegies if possible + try: + pw = pwd.getpwnam(TARGET_USER) + os.setgid(pw.pw_gid) + os.setuid(pw.pw_uid) + print "Privilegies set to '%s'." % TARGET_USER + except KeyError: + print "User '%s' does not exist. Running with default privilegies." % TARGET_USER + except OSError: + print "Unable to switch UID or GID. Running with default privilegies." + + # load plugin + plugin = None + for iplugin in PLUGINS: + if iplugin.distribution == distribution: + plugin = iplugin + break + + if not plugin: + print "Unknown distribution: '%s'" % distribution + sys.exit(1) + + lockfile = "/tmp/abrt-retrace-lock-%s-%s-%s" % (distribution, version, arch) + + if os.path.isfile(lockfile): + print "Another process with repository download is running." + sys.exit(2) + + # set lock + if not lock(lockfile): + print "Unable to set lock." + sys.exit(3) + + null = open("/dev/null", "w") + + targetdir = "%s/%s-%s-%s" % (CONFIG["RepoDir"], distribution, version, arch) + + # run rsync + for repo in plugin.repos: + retcode = -1 + for mirror in repo: + repourl = mirror.replace("$ARCH", arch).replace("$VER", version) + + print "Running rsync on '%s'..." % repourl, + sys.stdout.flush() + + if repourl.startswith("rsync://"): + files = [repourl] + else: + files = [] + try: + for package in os.listdir(repourl): + files.append("%s/%s" % (repourl, package)) + except Exception as ex: + print "Error: %s. Trying another mirror..." % ex + continue + + pipe = Popen(["rsync", "-t"] + files + [targetdir], stdout=null, stderr=null) + pipe.wait() + retcode = pipe.returncode + + if retcode == 0: + print "OK" + break + + print "Error. Trying another mirror..." + + if retcode != 0: + print "No more mirrors to try." + + # run createrepo + print "Running createrepo on '%s'..." % targetdir, + sys.stdout.flush() + + pipe = Popen(["createrepo", targetdir], stdout=null, stderr=null) + pipe.wait() + + null.close() + + if pipe.returncode != 0: + print "Failed" + unlock(lockfile) + sys.exit(4) + + print "OK" + + # remove lock + if not unlock(lockfile): + print "Unable to remove lock." + sys.exit(5) diff --git a/src/retrace/plugins/__init__.py b/src/retrace/plugins/__init__.py new file mode 100644 index 00000000..5c041b0c --- /dev/null +++ b/src/retrace/plugins/__init__.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import os + +PLUGIN_DIR = "/usr/share/abrt-retrace/plugins" +PLUGINS = [] + +try: + files = os.listdir(PLUGIN_DIR) +except Exception as ex: + print "Unable to list directory '%s': %s" % (PLUGIN_DIR, ex) + raise ImportError, ex + +for filename in files: + if not filename.startswith("_") and filename.endswith(".py"): + pluginname = filename.replace(".py", "") + try: + this = __import__("%s.%s" % (__name__, pluginname)) + except: + continue + + plugin = this.__getattribute__(pluginname) + if plugin.__dict__.has_key("distribution") and plugin.__dict__.has_key("repos"): + PLUGINS.append(plugin) diff --git a/src/retrace/plugins/fedora.py b/src/retrace/plugins/fedora.py new file mode 100644 index 00000000..d4b43fc7 --- /dev/null +++ b/src/retrace/plugins/fedora.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import re + +distribution = "fedora" +abrtparser = re.compile("^Fedora release ([0-9]+) \(([^\)]+)\)$") +guessparser = re.compile("\.fc([0-9]+)") +repos = [ + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/releases/$VER/Everything/$ARCH/os/Packages/*", + "rsync://ftp.sh.cvut.cz/fedora/linux/development/$VER/Everything/$ARCH/os/Packages/*", + ], + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/releases/$VER/Everything/$ARCH/debug/*", + "rsync://ftp.sh.cvut.cz/fedora/linux/development/$VER/Everything/$ARCH/debug/*", + ], + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/updates/$VER/$ARCH/*", + ], + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/updates/$VER/$ARCH/debug/*", + ], + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/updates/testing/$VER/$ARCH/*", + ], + [ + "rsync://ftp.sh.cvut.cz/fedora/linux/updates/testing/$VER/$ARCH/debug/*", + ], +] diff --git a/src/retrace/retrace-local.repo b/src/retrace/retrace-local.repo deleted file mode 100644 index 39f63c1c..00000000 --- a/src/retrace/retrace-local.repo +++ /dev/null @@ -1,143 +0,0 @@ -[retrace-fedora-14-i386] -name=Fedora 14 - i386 -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386/ -enabled=0 - -[retrace-fedora-14-i386-debuginfo] -name=Fedora 14 - i386 - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386-debuginfo/ -enabled=0 - -[retrace-fedora-14-i386-updates] -name=Fedora 14 - i386 - Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386-updates/ -enabled=0 - -[retrace-fedora-14-i386-updates-debuginfo] -name=Fedora 14 - i386 - Updates - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386-updates-debuginfo/ -enabled=0 - -[retrace-fedora-14-i386-updates-testing] -name=Fedora 14 - i386 - Test Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386-updates-testing/ -enabled=0 - -[retrace-fedora-14-i386-updates-testing-debuginfo] -name=Fedora 14 - i386 - Test Updates Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-i386-updates-testing-debuginfo/ -enabled=0 - -[retrace-fedora-14-x86_64] -name=Fedora 14 - x86_64 -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64/ -enabled=0 - -[retrace-fedora-14-x86_64-debuginfo] -name=Fedora 14 - x86_64 - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64-debuginfo/ -enabled=0 - -[retrace-fedora-14-x86_64-updates] -name=Fedora 14 - x86_64 - Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64-updates/ -enabled=0 - -[retrace-fedora-14-x86_64-updates-debuginfo] -name=Fedora 14 - x86_64 - Updates - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64-updates-debuginfo/ -enabled=0 - -[retrace-fedora-14-x86_64-updates-testing] -name=Fedora 14 - x86_64 - Test Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64-updates-testing/ -enabled=0 - -[retrace-fedora-14-x86_64-updates-testing-debuginfo] -name=Fedora 14 - x86_64 - Test Updates Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64-updates-testing-debuginfo/ -enabled=0 - -[retrace-fedora-15-i386] -name=Fedora 15 - i386 -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386/ -enabled=0 - -[retrace-fedora-15-i386-debuginfo] -name=Fedora 15 - i386 - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386-debuginfo/ -enabled=0 - -[retrace-fedora-15-i386-updates] -name=Fedora 15 - i386 - Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386-updates/ -enabled=0 - -[retrace-fedora-15-i386-updates-debuginfo] -name=Fedora 15 - i386 - Updates - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386-updates-debuginfo/ -enabled=0 - -[retrace-fedora-15-i386-updates-testing] -name=Fedora 15 - i386 - Test Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386-updates-testing/ -enabled=0 - -[retrace-fedora-15-i386-updates-testing-debuginfo] -name=Fedora 15 - i386 - Test Updates Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-i386-updates-testing-debuginfo/ -enabled=0 - -[retrace-fedora-15-x86_64] -name=Fedora 15 - x86_64 -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64/ -enabled=0 - -[retrace-fedora-15-x86_64-debuginfo] -name=Fedora 15 - x86_64 - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64-debuginfo/ -enabled=0 - -[retrace-fedora-15-x86_64-updates] -name=Fedora 15 - x86_64 - Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64-updates/ -enabled=0 - -[retrace-fedora-15-x86_64-updates-debuginfo] -name=Fedora 15 - x86_64 - Updates - Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64-updates-debuginfo/ -enabled=0 - -[retrace-fedora-15-x86_64-updates-testing] -name=Fedora 15 - x86_64 - Test Updates -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64-updates-testing/ -enabled=0 - -[retrace-fedora-15-x86_64-updates-testing-debuginfo] -name=Fedora 15 - x86_64 - Test Updates Debug -failovermethod=priority -baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64-updates-testing-debuginfo/ -enabled=0 diff --git a/src/retrace/retrace.py b/src/retrace/retrace.py index f3933fb3..33488bba 100644 --- a/src/retrace/retrace.py +++ b/src/retrace/retrace.py @@ -5,6 +5,7 @@ import re import ConfigParser import random import sqlite3 +from plugins import * from webob import Request from subprocess import * @@ -65,6 +66,24 @@ CONFIG = { "DBFile": "stats.db", } +def lock(lockfile): + try: + if not os.path.isfile(lockfile): + open(lockfile, "w").close() + except: + return False + + return True + +def unlock(lockfile): + try: + if os.path.getsize(lockfile) == 0: + os.unlink(lockfile) + except: + return False + + return True + def read_config(): parser = ConfigParser.ConfigParser() parser.read(CONFIG_FILE) @@ -132,10 +151,10 @@ def guess_arch(coredump_path): return None def guess_release(package): - for distro in GUESS_RELEASE_PARSERS.keys(): - match = GUESS_RELEASE_PARSERS[distro].search(package) + for plugin in PLUGINS: + match = plugin.guessparser.search(package) if match: - return distro, match.group(1) + return plugin.distribution, match.group(1) return None, None diff --git a/src/retrace/retrace.repo b/src/retrace/retrace.repo index df826cec..ccc224be 100644 --- a/src/retrace/retrace.repo +++ b/src/retrace/retrace.repo @@ -1,199 +1,23 @@ -[fedora-14-i386] +[retrace-fedora-14-i386] name=Fedora 14 - i386 failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-14&arch=i386 +baseurl=file:///var/cache/abrt-retrace/fedora-14-i386/ enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 -[fedora-14-i386-debuginfo] -name=Fedora 14 - i386 - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-14&arch=i386 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-14-i386-updates] -name=Fedora 14 - i386 - Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f14&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-14-i386-updates-debuginfo] -name=Fedora 14 - i386 - Updates - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f14&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-14-i386-updates-testing] -name=Fedora 14 - i386 - Test Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f14&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-14-i386-updates-testing-debuginfo] -name=Fedora 14 - i386 - Test Updates Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f14&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-14-x86_64] +[retrace-fedora-14-x86_64] name=Fedora 14 - x86_64 failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-14&arch=x86_64 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-14-x86_64-debuginfo] -name=Fedora 14 - x86_64 - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-14&arch=x86_64 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-14-x86_64-updates] -name=Fedora 14 - x86_64 - Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f14&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-14-x86_64-updates-debuginfo] -name=Fedora 14 - x86_64 - Updates - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f14&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-14-x86_64-updates-testing] -name=Fedora 14 - x86_64 - Test Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f14&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-14-x86_64-updates-testing-debuginfo] -name=Fedora 14 - x86_64 - Test Updates Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f14&arch=x86_64 +baseurl=file:///var/cache/abrt-retrace/fedora-14-x86_64/ enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 -[fedora-15-i386] +[retrace-fedora-15-i386] name=Fedora 15 - i386 failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-15&arch=i386 +baseurl=file:///var/cache/abrt-retrace/fedora-15-i386/ enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 -[fedora-15-i386-debuginfo] -name=Fedora 15 - i386 - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-15&arch=i386 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-15-i386-updates] -name=Fedora 15 - i386 - Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f15&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-15-i386-updates-debuginfo] -name=Fedora 15 - i386 - Updates - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f15&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-15-i386-updates-testing] -name=Fedora 15 - i386 - Test Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f15&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-15-i386-updates-testing-debuginfo] -name=Fedora 15 - i386 - Test Updates Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f15&arch=i386 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 - -[fedora-15-x86_64] +[retrace-fedora-15-x86_64] name=Fedora 15 - x86_64 failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-15&arch=x86_64 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-15-x86_64-debuginfo] -name=Fedora 15 - x86_64 - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-15&arch=x86_64 -enabled=0 -metadata_expire=6h -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-15-x86_64-updates] -name=Fedora 15 - x86_64 - Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f15&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-15-x86_64-updates-debuginfo] -name=Fedora 15 - x86_64 - Updates - Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f15&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-15-x86_64-updates-testing] -name=Fedora 15 - x86_64 - Test Updates -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f15&arch=x86_64 -enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 - -[fedora-15-x86_64-updates-testing-debuginfo] -name=Fedora 15 - x86_64 - Test Updates Debug -failovermethod=priority -mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f15&arch=x86_64 +baseurl=file:///var/cache/abrt-retrace/fedora-15-x86_64/ enabled=0 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 diff --git a/src/retrace/worker.py b/src/retrace/worker.py index 48ef8402..4eed5236 100755 --- a/src/retrace/worker.py +++ b/src/retrace/worker.py @@ -89,11 +89,11 @@ if __name__ == "__main__": release_file.close() version = distribution = None - for distro in RELEASE_PARSERS.keys(): - match = RELEASE_PARSERS[distro].match(release) + for plugin in PLUGINS: + match = plugin.abrtparser.match(release) if match: version = match.group(1) - distribution = distro + distribution = plugin.distribution break if not version or not distribution: @@ -171,36 +171,10 @@ if __name__ == "__main__": mockcfg.write("\n") mockcfg.write("#repos\n") mockcfg.write("\n") - mockcfg.write("[fedora]\n") - mockcfg.write("name=fedora\n") + mockcfg.write("[%s]\n" % distribution) + mockcfg.write("name=%s\n" % distribution) mockcfg.write("baseurl=file://%s/%s-%s-%s/\n" % (CONFIG["RepoDir"], distribution, version, arch)) mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") - mockcfg.write("[fedora-debuginfo]\n") - mockcfg.write("name=fedora-debuginfo\n") - mockcfg.write("baseurl=file://%s/%s-%s-%s-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch)) - mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") - mockcfg.write("[updates]\n") - mockcfg.write("name=updates\n") - mockcfg.write("baseurl=file://%s/%s-%s-%s-updates/\n" % (CONFIG["RepoDir"], distribution, version, arch)) - mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") - mockcfg.write("[updates-debuginfo]\n") - mockcfg.write("name=updates-debuginfo\n") - mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch)) - mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") - mockcfg.write("[updates-testing]\n") - mockcfg.write("name=updates-testing\n") - mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing/\n" % (CONFIG["RepoDir"], distribution, version, arch)) - mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") - mockcfg.write("[updates-testing-debuginfo]\n") - mockcfg.write("name=updates-testing-debuginfo\n") - mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch)) - mockcfg.write("failovermethod=priority\n") - mockcfg.write("\n") mockcfg.write("\"\"\"\n") mockcfg.close() except Exception as ex: |