コード例 #1
0
ファイル: test_model.py プロジェクト: kushal124/bodhi
    def test_update_bugs(self):
        update = self.get_update()

        # try just adding bugs
        bugs = ['1234']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1
        assert update.bugs[0].bz_id == 1234

        # try just removing
        bugs = []
        update.update_bugs(bugs)
        assert len(update.bugs) == 0
        try:
            Bugzilla.byBz_id(1234)
            assert False, "Stray bugzilla!"
        except SQLObjectNotFound:
            pass

        # Test new duplicate bugs
        bugs = ['1234', '1234']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1

        # Try adding a new bug, and removing the rest
        bugs = ['4321']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1
        assert update.bugs[0].bz_id == 4321
        try:
            Bugzilla.byBz_id(1234)
            assert False, "Stray bugzilla!"
        except SQLObjectNotFound:
            pass
コード例 #2
0
ファイル: search.py プロジェクト: docent-net/bodhi
    def default(self, search, *args, **kw):
        results = set()
        search = search.strip()

        # Search name-version-release
        map(results.add, PackageUpdate.select(
            LIKE(PackageUpdate.q.title, '%%%s%%' % search),
                 orderBy=PackageUpdate.q.date_submitted))

        # Search bug numbers
        try:
            map(lambda bug: map(results.add, bug.updates),
                Bugzilla.select(Bugzilla.q.bz_id==int(search)))
        except ValueError: # can't convert search search to integer
            pass

        # Search CVEs
        if search.startswith('CVE') or search.startswith('CAN'):
            # Search bug titles for CVE, since that is how we track them now
            map(lambda bug: map(results.add, bug.updates),
                Bugzilla.select(LIKE(Bugzilla.q.title, '%%%s%%' % search)))

            # We still have some CVE objects lying around, so search them too
            map(lambda cve: map(results.add, cve.updates),
                CVE.select(CVE.q.cve_id==search))

        # If there is only 1 result, then jump right to it
        num_items = len(results)
        if len(results) == 1:
            raise redirect(results.pop().get_url())

        return dict(updates=list(results), num_items=num_items,
                    title="%d Results Found" % num_items)
コード例 #3
0
ファイル: test_model.py プロジェクト: network-box/bodhi
    def test_update_bugs(self):
        update = self.get_update()

        # try just adding bugs
        bugs = ['1234']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1
        assert update.bugs[0].bz_id == 1234

        # try just removing
        bugs = []
        update.update_bugs(bugs)
        assert len(update.bugs) == 0
        try:
            Bugzilla.byBz_id(1234)
            assert False, "Stray bugzilla!"
        except SQLObjectNotFound:
            pass

        # Test new duplicate bugs
        bugs = ['1234', '1234']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1

        # Try adding a new bug, and removing the rest
        bugs = ['4321']
        update.update_bugs(bugs)
        assert len(update.bugs) == 1
        assert update.bugs[0].bz_id == 4321
        try:
            Bugzilla.byBz_id(1234)
            assert False, "Stray bugzilla!"
        except SQLObjectNotFound:
            pass
コード例 #4
0
ファイル: test_client.py プロジェクト: ralphbean/bodhi
    def test_file_input(self):
        bodhi = self.__get_bodhi_client()
        opts = self.__get_opts()

        out = file(opts.input_file, 'w')
        out.write('''[%s]
type=enhancement
request=testing
bugs=123,456
notes=bar
autokarma=True
stable_karma=10
unstable_karma=-10
close_bugs=True
''' % self.build)
        out.close()

        updates = bodhi.parse_file(input_file=opts.input_file)
        for update_args in updates:
            bodhi.save(**update_args)

        update = PackageUpdate.byTitle(self.build)
        assert update.type == 'enhancement'
        assert update.request == 'testing'
        assert update.notes == 'bar', repr(update.notes)
        for bug in (123, 456):
            bz = Bugzilla.byBz_id(bug)
            assert bz in update.bugs

        os.unlink(opts.input_file)
コード例 #5
0
    def test_file_input(self):
        bodhi = self.__get_bodhi_client()
        opts = self.__get_opts()

        out = file(opts.input_file, 'w')
        out.write('''[%s]
type=enhancement
request=testing
bugs=123,456
notes=bar
autokarma=True
stable_karma=10
unstable_karma=-10
close_bugs=True
''' % self.build)
        out.close()

        updates = bodhi.parse_file(input_file=opts.input_file)
        for update_args in updates:
            bodhi.save(**update_args)

        update = PackageUpdate.byTitle(self.build)
        assert update.type == 'enhancement'
        assert update.request == 'testing'
        assert update.notes == 'bar', repr(update.notes)
        for bug in (123, 456):
            bz = Bugzilla.byBz_id(bug)
            assert bz in update.bugs

        os.unlink(opts.input_file)
コード例 #6
0
ファイル: test_client.py プロジェクト: ralphbean/bodhi
 def test_new_update(self):
     bodhi = self.__get_bodhi_client()
     opts = self.__get_opts()
     self.__save_update(self.build, opts, bodhi)
     update = PackageUpdate.byTitle(self.build)
     assert update and update.title == self.build
     assert update.release.name == opts.release.upper()
     assert update.type == opts.type_
     assert update.notes == opts.notes
     for bug in opts.bugs.split(','):
         bz = Bugzilla.byBz_id(int(bug))
         assert bz in update.bugs
コード例 #7
0
 def test_new_update(self):
     bodhi = self.__get_bodhi_client()
     opts = self.__get_opts()
     self.__save_update(self.build, opts, bodhi)
     update = PackageUpdate.byTitle(self.build)
     assert update and update.title == self.build
     assert update.release.name == opts.release.upper()
     assert update.type == opts.type_
     assert update.notes == opts.notes
     for bug in opts.bugs.split(','):
         bz = Bugzilla.byBz_id(int(bug))
         assert bz in update.bugs
コード例 #8
0
def clean_tables():
    from bodhi.model import (Release, Package, PackageBuild, PackageUpdate,
                             Comment, CVE, Bugzilla, BuildRootOverride)
    from bodhi.identity.tables import (Visit, VisitIdentity, Group, User,
                                       Permission)

    print "Cleaning out tables"
    Release.dropTable(ifExists=True, cascade=True)
    Package.dropTable(ifExists=True, cascade=True)
    PackageBuild.dropTable(ifExists=True, cascade=True)
    PackageUpdate.dropTable(ifExists=True, cascade=True)
    Comment.dropTable(ifExists=True, cascade=True)
    CVE.dropTable(ifExists=True, cascade=True)
    Bugzilla.dropTable(ifExists=True, cascade=True)
    BuildRootOverride.dropTable(ifExists=True, cascade=True)

    Visit.dropTable(ifExists=True, cascade=True)
    VisitIdentity.dropTable(ifExists=True, cascade=True)
    Group.dropTable(ifExists=True, cascade=True)
    User.dropTable(ifExists=True, cascade=True)
    Permission.dropTable(ifExists=True, cascade=True)

    hub.commit()

    Release.createTable(ifNotExists=True)
    Package.createTable(ifNotExists=True)
    PackageBuild.createTable(ifNotExists=True)
    PackageUpdate.createTable(ifNotExists=True)
    Comment.createTable(ifNotExists=True)
    CVE.createTable(ifNotExists=True)
    Bugzilla.createTable(ifNotExists=True)
    BuildRootOverride.createTable(ifNotExists=True)

    Visit.createTable(ifNotExists=True)
    VisitIdentity.createTable(ifNotExists=True)
    Group.createTable(ifNotExists=True)
    User.createTable(ifNotExists=True)
    Permission.createTable(ifNotExists=True)
コード例 #9
0
ファイル: jobs.py プロジェクト: ralphbean/bodhi
def fix_bug_titles():
    """
    Go through all bugs with invalid titles and see if we can re-fetch them.
    If bugzilla is down, then bodhi simply replaces the title with
    'Unable to fetch bug title' or 'Invalid bug number'.  So lets occasionally
    see if we can re-fetch those bugs.
    """
    from bodhi.model import Bugzilla
    from sqlobject.sqlbuilder import OR
    log.debug("Running fix_bug_titles job")
    for bug in Bugzilla.select(
                 OR(Bugzilla.q.title == 'Invalid bug number',
                    Bugzilla.q.title == 'Unable to fetch bug title')):
        bug.fetch_details()
コード例 #10
0
def fix_bug_titles():
    """
    Go through all bugs with invalid titles and see if we can re-fetch them.
    If bugzilla is down, then bodhi simply replaces the title with
    'Unable to fetch bug title' or 'Invalid bug number'.  So lets occasionally
    see if we can re-fetch those bugs.
    """
    from bodhi.model import Bugzilla
    from sqlobject.sqlbuilder import OR
    log.debug("Running fix_bug_titles job")
    for bug in Bugzilla.select(
            OR(Bugzilla.q.title == 'Invalid bug number',
               Bugzilla.q.title == 'Unable to fetch bug title')):
        bug.fetch_details()
コード例 #11
0
ファイル: search.py プロジェクト: tyll/bodhi
    def default(self, search, *args, **kw):
        results = set()
        search = search.strip()

        # Search name-version-release
        map(
            results.add,
            PackageUpdate.select(LIKE(PackageUpdate.q.title,
                                      '%%%s%%' % search),
                                 orderBy=PackageUpdate.q.date_submitted))

        # Search bug numbers
        try:
            map(lambda bug: map(results.add, bug.updates),
                Bugzilla.select(Bugzilla.q.bz_id == int(search)))
        except ValueError:  # can't convert search search to integer
            pass

        # Search CVEs
        if search.startswith('CVE') or search.startswith('CAN'):
            # Search bug titles for CVE, since that is how we track them now
            map(lambda bug: map(results.add, bug.updates),
                Bugzilla.select(LIKE(Bugzilla.q.title, '%%%s%%' % search)))

            # We still have some CVE objects lying around, so search them too
            map(lambda cve: map(results.add, cve.updates),
                CVE.select(CVE.q.cve_id == search))

        # If there is only 1 result, then jump right to it
        num_items = len(results)
        if len(results) == 1:
            raise redirect(results.pop().get_url())

        return dict(updates=list(results),
                    num_items=num_items,
                    title="%d Results Found" % num_items)
コード例 #12
0
ファイル: test_metadata.py プロジェクト: ralphbean/bodhi
    def test_extended_metadata_updating(self):
        # grab the name of a build in updates-testing, and create it in our db
        koji = get_session()
        builds = koji.listTagged('dist-f13-updates-testing', latest=True)

        # Create all of the necessary database entries
        release = Release(name='F13',
                          long_name='Fedora 13',
                          id_prefix='FEDORA',
                          dist_tag='dist-f13')
        package = Package(name=builds[0]['package_name'])
        update = PackageUpdate(title=builds[0]['nvr'],
                               release=release,
                               submitter=builds[0]['owner_name'],
                               status='testing',
                               notes='foobar',
                               type='bugfix')
        build = PackageBuild(nvr=builds[0]['nvr'], package=package)
        update.addPackageBuild(build)

        bug = Bugzilla(bz_id=1)
        bug.title = u'test bug'
        update.addBugzilla(bug)
        cve = CVE(cve_id="CVE-2007-0000")
        update.addCVE(cve)
        update.assign_id()

        ## Initialize our temporary repo
        temprepo = join(tempfile.mkdtemp('bodhi'), 'f7-updates-testing')
        print "Inserting updateinfo into temprepo: %s" % temprepo
        mkmetadatadir(join(temprepo, 'i386'))
        repodata = join(temprepo, 'i386', 'repodata')
        assert exists(join(repodata, 'repomd.xml'))

        ## Generate the XML
        md = ExtendedMetadata(temprepo)

        ## Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        updateinfo = join(repodata, 'updateinfo.xml.gz')
        assert exists(updateinfo)

        ## Read an verify the updateinfo.xml.gz
        uinfo = UpdateMetadata()
        uinfo.add(updateinfo)
        notice = uinfo.get_notice(('mutt', '1.5.14', '1.fc13'))
        assert not notice
        notice = uinfo.get_notice(get_nvr(update.title))
        assert notice
        assert notice['status'] == update.status
        assert notice['updated'] == update.date_modified
        assert notice['from'] == str(config.get('bodhi_email'))
        assert notice['description'] == update.notes
        assert notice['issued'] != None
        assert notice['update_id'] == update.updateid
        cve = notice['references'][0]
        assert cve['type'] == 'cve'
        assert cve['href'] == update.cves[0].get_url()
        assert cve['id'] == update.cves[0].cve_id
        bug = notice['references'][1]
        assert bug['href'] == update.bugs[0].get_url()
        assert bug['id'] == '1'
        assert bug['type'] == 'bugzilla'
        assert bug['title'] == 'test bug'

        # FC6's yum update metadata parser doesn't know about some stuff
        from yum import __version__
        if __version__ >= '3.0.6':
            assert notice['title'] == update.title
            assert notice['release'] == update.release.long_name
            assert cve['title'] == None

        ## Test out updateinfo.xml updating via our ExtendedMetadata
        md = ExtendedMetadata(temprepo, updateinfo)
        md.insert_updateinfo()
        updateinfo = join(repodata, 'updateinfo.xml.gz')
        assert exists(updateinfo)

        ## Read an verify the updateinfo.xml.gz
        uinfo = UpdateMetadata()
        uinfo.add(updateinfo)
        notice = uinfo.get_notice(('mutt', '1.5.14', '1.fc13'))
        assert not notice
        notice = uinfo.get_notice(get_nvr(update.title))
        assert notice
        assert notice['status'] == update.status
        assert notice['updated'] == update.date_modified
        assert notice['from'] == str(config.get('bodhi_email'))
        assert notice['description'] == update.notes
        assert notice['issued'] != None
        assert notice['update_id'] == update.updateid
        cve = notice['references'][0]
        assert cve['type'] == 'cve'
        assert cve['href'] == update.cves[0].get_url()
        assert cve['id'] == update.cves[0].cve_id
        bug = notice['references'][1]
        assert bug['href'] == update.bugs[0].get_url()
        assert bug['id'] == '1'
        assert bug['type'] == 'bugzilla'
        assert bug['title'] == 'test bug', bug

        # FC6's yum update metadata parser doesn't know about some stuff
        from yum import __version__
        if __version__ >= '3.0.6':
            assert notice['title'] == update.title
            assert notice['release'] == update.release.long_name
            assert cve['title'] == None

        ## Clean up
        shutil.rmtree(temprepo)
コード例 #13
0
ファイル: test_model.py プロジェクト: kushal124/bodhi
 def get_bug(self):
     return Bugzilla(bz_id=1)
コード例 #14
0
ファイル: pickledb.py プロジェクト: bitlord/bodhi
def load_db():
    print "\nLoading pickled database %s" % sys.argv[2]
    db = file(sys.argv[2], 'r')
    data = pickle.load(db)

    # Load up all of the overrides
    for override in data.get('overrides', []):
        try:
            BuildRootOverride.byBuild(override['build'])
        except SQLObjectNotFound:
            BuildRootOverride(**override)

    # Legacy format was just a list of update dictionaries
    # Now we'll pull things out into an organized dictionary:
    # {'updates': [], 'releases': []}
    if isinstance(data, dict):
        for release in data['releases']:
            try:
                Release.byName(release['name'])
            except SQLObjectNotFound:
                Release(**release)
        data = data['updates']

    progress = ProgressBar(maxValue=len(data))

    for u in data:
        try:
            release = Release.byName(u['release'][0])
        except SQLObjectNotFound:
            release = Release(name=u['release'][0], long_name=u['release'][1],
                              id_prefix=u['release'][2], dist_tag=u['release'][3])

        ## Backwards compatbility
        request = u['request']
        if u['request'] == 'move':
            request = 'stable'
        elif u['request'] == 'push':
            request = 'testing'
        elif u['request'] == 'unpush':
            request = 'obsolete'
        if u['approved'] in (True, False):
            u['approved'] = None
        if 'update_id' in u:
            u['updateid'] = u['update_id']
        if not 'date_modified' in u:
            u['date_modified'] = None

        try:
            update = PackageUpdate.byTitle(u['title'])
        except SQLObjectNotFound:
            update = PackageUpdate(title=u['title'],
                                   date_submitted=u['date_submitted'],
                                   date_pushed=u['date_pushed'],
                                   date_modified=u['date_modified'],
                                   release=release,
                                   submitter=u['submitter'],
                                   updateid=u['updateid'],
                                   type=u['type'],
                                   status=u['status'],
                                   pushed=u['pushed'],
                                   notes=u['notes'],
                                   karma=u['karma'],
                                   request=request,
                                   approved=u['approved'])

        ## Create Package and PackageBuild objects
        for pkg, nvr in u['builds']:
            try:
                package = Package.byName(pkg)
            except SQLObjectNotFound:
                package = Package(name=pkg)
            try:
                build = PackageBuild.byNvr(nvr)
            except SQLObjectNotFound:
                build = PackageBuild(nvr=nvr, package=package)
            update.addPackageBuild(build)

        ## Create all Bugzilla objects for this update
        for bug_num, bug_title, security, parent in u['bugs']:
            try:
                bug = Bugzilla.byBz_id(bug_num)
            except SQLObjectNotFound:
                bug = Bugzilla(bz_id=bug_num, security=security, parent=parent)
                bug.title = bug_title
            update.addBugzilla(bug)

        ## Create all CVE objects for this update
        for cve_id in u['cves']:
            try:
                cve = CVE.byCve_id(cve_id)
            except SQLObjectNotFound:
                cve = CVE(cve_id=cve_id)
            update.addCVE(cve)
        for timestamp, author, text, karma, anonymous in u['comments']:
            comment = Comment(timestamp=timestamp, author=author, text=text,
                              karma=karma, update=update, anonymous=anonymous)

        progress()
コード例 #15
0
ファイル: pickledb.py プロジェクト: ralphbean/bodhi
def load_db():
    print "\nLoading pickled database %s" % sys.argv[2]
    db = file(sys.argv[2], "r")
    data = pickle.load(db)

    # Legacy format was just a list of update dictionaries
    # Now we'll pull things out into an organized dictionary:
    # {'updates': [], 'releases': []}
    if isinstance(data, dict):
        for release in data["releases"]:
            try:
                Release.byName(release["name"])
            except SQLObjectNotFound:
                Release(**release)
        data = data["updates"]

    progress = ProgressBar(maxValue=len(data))

    for u in data:
        try:
            release = Release.byName(u["release"][0])
        except SQLObjectNotFound:
            release = Release(
                name=u["release"][0], long_name=u["release"][1], id_prefix=u["release"][2], dist_tag=u["release"][3]
            )

        ## Backwards compatbility
        request = u["request"]
        if u["request"] == "move":
            request = "stable"
        elif u["request"] == "push":
            request = "testing"
        elif u["request"] == "unpush":
            request = "obsolete"
        if u["approved"] in (True, False):
            u["approved"] = None
        if u.has_key("update_id"):
            u["updateid"] = u["update_id"]
        if not u.has_key("date_modified"):
            u["date_modified"] = None

        try:
            update = PackageUpdate.byTitle(u["title"])
        except SQLObjectNotFound:
            update = PackageUpdate(
                title=u["title"],
                date_submitted=u["date_submitted"],
                date_pushed=u["date_pushed"],
                date_modified=u["date_modified"],
                release=release,
                submitter=u["submitter"],
                updateid=u["updateid"],
                type=u["type"],
                status=u["status"],
                pushed=u["pushed"],
                notes=u["notes"],
                karma=u["karma"],
                request=request,
                approved=u["approved"],
            )

        ## Create Package and PackageBuild objects
        for pkg, nvr in u["builds"]:
            try:
                package = Package.byName(pkg)
            except SQLObjectNotFound:
                package = Package(name=pkg)
            try:
                build = PackageBuild.byNvr(nvr)
            except SQLObjectNotFound:
                build = PackageBuild(nvr=nvr, package=package)
            update.addPackageBuild(build)

        ## Create all Bugzilla objects for this update
        for bug_num, bug_title, security, parent in u["bugs"]:
            try:
                bug = Bugzilla.byBz_id(bug_num)
            except SQLObjectNotFound:
                bug = Bugzilla(bz_id=bug_num, security=security, parent=parent)
                bug.title = bug_title
            update.addBugzilla(bug)

        ## Create all CVE objects for this update
        for cve_id in u["cves"]:
            try:
                cve = CVE.byCve_id(cve_id)
            except SQLObjectNotFound:
                cve = CVE(cve_id=cve_id)
            update.addCVE(cve)
        for timestamp, author, text, karma, anonymous in u["comments"]:
            comment = Comment(
                timestamp=timestamp, author=author, text=text, karma=karma, update=update, anonymous=anonymous
            )

        progress()
コード例 #16
0
ファイル: test_metadata.py プロジェクト: bitlord/bodhi
    def test_extended_metadata_updating(self):
        # grab the name of a build in updates-testing, and create it in our db
        koji = get_session()
        builds = koji.listTagged('dist-f13-updates-testing', latest=True)

        # Create all of the necessary database entries
        release = Release(name='F13', long_name='Fedora 13', id_prefix='FEDORA',
                          dist_tag='dist-f13')
        package = Package(name=builds[0]['package_name'])
        update = PackageUpdate(title=builds[0]['nvr'],
                               release=release,
                               submitter=builds[0]['owner_name'],
                               status='testing',
                               notes='foobar',
                               type='bugfix')
        build = PackageBuild(nvr=builds[0]['nvr'], package=package)
        update.addPackageBuild(build)

        bug = Bugzilla(bz_id=1)
        bug.title = u'test bug'
        update.addBugzilla(bug)
        cve = CVE(cve_id="CVE-2007-0000")
        update.addCVE(cve)
        update.assign_id()

        ## Initialize our temporary repo
        temprepo = join(tempfile.mkdtemp('bodhi'), 'f7-updates-testing')
        print "Inserting updateinfo into temprepo: %s" % temprepo
        mkmetadatadir(join(temprepo, 'i386'))
        repodata = join(temprepo, 'i386', 'repodata')
        assert exists(join(repodata, 'repomd.xml'))

        ## Generate the XML
        md = ExtendedMetadata(temprepo)

        ## Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        updateinfo = self.__verify_updateinfo(repodata)

        ## Read an verify the updateinfo.xml.gz
        uinfo = UpdateMetadata()
        uinfo.add(updateinfo)
        notice = uinfo.get_notice(('mutt', '1.5.14', '1.fc13'))
        assert not notice
        notice = uinfo.get_notice(get_nvr(update.title))
        assert notice
        assert notice['status'] == update.status
        assert notice['updated'] == update.date_modified
        assert notice['from'] == str(config.get('bodhi_email'))
        assert notice['description'] == update.notes
        assert notice['issued'] is not None
        assert notice['update_id'] == update.updateid
        cve = notice['references'][0]
        assert cve['type'] == 'cve'
        assert cve['href'] == update.cves[0].get_url()
        assert cve['id'] == update.cves[0].cve_id
        bug = notice['references'][1]
        assert bug['href'] == update.bugs[0].get_url()
        assert bug['id'] == '1'
        assert bug['type'] == 'bugzilla'
        assert bug['title'] == 'test bug'

        # FC6's yum update metadata parser doesn't know about some stuff
        from yum import __version__
        if __version__ >= '3.0.6':
            assert notice['title'] == update.title
            assert notice['release'] == update.release.long_name
            assert cve['title'] is None

        ## Test out updateinfo.xml updating via our ExtendedMetadata
        md = ExtendedMetadata(temprepo, updateinfo)
        md.insert_updateinfo()
        updateinfo = self.__verify_updateinfo(repodata)

        ## Read an verify the updateinfo.xml.gz
        uinfo = UpdateMetadata()
        uinfo.add(updateinfo)
        notice = uinfo.get_notice(('mutt', '1.5.14', '1.fc13'))
        assert not notice
        notice = uinfo.get_notice(get_nvr(update.title))
        assert notice
        assert notice['status'] == update.status
        assert notice['updated'] == update.date_modified
        assert notice['from'] == str(config.get('bodhi_email'))
        assert notice['description'] == update.notes
        assert notice['issued'] is not None
        assert notice['update_id'] == update.updateid
        cve = notice['references'][0]
        assert cve['type'] == 'cve'
        assert cve['href'] == update.cves[0].get_url()
        assert cve['id'] == update.cves[0].cve_id
        bug = notice['references'][1]
        assert bug['href'] == update.bugs[0].get_url()
        assert bug['id'] == '1'
        assert bug['type'] == 'bugzilla'
        assert bug['title'] == 'test bug', bug

        # FC6's yum update metadata parser doesn't know about some stuff
        from yum import __version__
        if __version__ >= '3.0.6':
            assert notice['title'] == update.title
            assert notice['release'] == update.release.long_name
            assert cve['title'] is None

        ## Clean up
        shutil.rmtree(temprepo)
コード例 #17
0
ファイル: test_model.py プロジェクト: kushal124/bodhi
 def test_creation(self):
     bug = Bugzilla(bz_id=1)
コード例 #18
0
ファイル: test_model.py プロジェクト: kushal124/bodhi
 def test_security_bug(self):
     bug = Bugzilla(bz_id=237533)
     assert bug
     if config.get('bodhi_password'):
         assert bug.title == 'CVE-2007-2165: proftpd auth bypass vulnerability'
コード例 #19
0
ファイル: pickledb.py プロジェクト: ralphbean/bodhi
def load_db():
    print "\nLoading pickled database %s" % sys.argv[2]
    db = file(sys.argv[2], 'r')
    data = pickle.load(db)

    # Legacy format was just a list of update dictionaries
    # Now we'll pull things out into an organized dictionary:
    # {'updates': [], 'releases': []}
    if isinstance(data, dict):
        for release in data['releases']:
            try:
                Release.byName(release['name'])
            except SQLObjectNotFound:
                Release(**release)
        data = data['updates']

    progress = ProgressBar(maxValue=len(data))

    for u in data:
        try:
            release = Release.byName(u['release'][0])
        except SQLObjectNotFound:
            release = Release(name=u['release'][0],
                              long_name=u['release'][1],
                              id_prefix=u['release'][2],
                              dist_tag=u['release'][3])

        ## Backwards compatbility
        request = u['request']
        if u['request'] == 'move':
            request = 'stable'
        elif u['request'] == 'push':
            request = 'testing'
        elif u['request'] == 'unpush':
            request = 'obsolete'
        if u['approved'] in (True, False):
            u['approved'] = None
        if u.has_key('update_id'):
            u['updateid'] = u['update_id']
        if not u.has_key('date_modified'):
            u['date_modified'] = None

        try:
            update = PackageUpdate.byTitle(u['title'])
        except SQLObjectNotFound:
            update = PackageUpdate(title=u['title'],
                                   date_submitted=u['date_submitted'],
                                   date_pushed=u['date_pushed'],
                                   date_modified=u['date_modified'],
                                   release=release,
                                   submitter=u['submitter'],
                                   updateid=u['updateid'],
                                   type=u['type'],
                                   status=u['status'],
                                   pushed=u['pushed'],
                                   notes=u['notes'],
                                   karma=u['karma'],
                                   request=request,
                                   approved=u['approved'])

        ## Create Package and PackageBuild objects
        for pkg, nvr in u['builds']:
            try:
                package = Package.byName(pkg)
            except SQLObjectNotFound:
                package = Package(name=pkg)
            try:
                build = PackageBuild.byNvr(nvr)
            except SQLObjectNotFound:
                build = PackageBuild(nvr=nvr, package=package)
            update.addPackageBuild(build)

        ## Create all Bugzilla objects for this update
        for bug_num, bug_title, security, parent in u['bugs']:
            try:
                bug = Bugzilla.byBz_id(bug_num)
            except SQLObjectNotFound:
                bug = Bugzilla(bz_id=bug_num, security=security, parent=parent)
                bug.title = bug_title
            update.addBugzilla(bug)

        ## Create all CVE objects for this update
        for cve_id in u['cves']:
            try:
                cve = CVE.byCve_id(cve_id)
            except SQLObjectNotFound:
                cve = CVE(cve_id=cve_id)
            update.addCVE(cve)
        for timestamp, author, text, karma, anonymous in u['comments']:
            comment = Comment(timestamp=timestamp,
                              author=author,
                              text=text,
                              karma=karma,
                              update=update,
                              anonymous=anonymous)

        progress()