当前位置: 首页>>代码示例>>Python>>正文


Python Release.select方法代码示例

本文整理汇总了Python中bodhi.model.Release.select方法的典型用法代码示例。如果您正苦于以下问题:Python Release.select方法的具体用法?Python Release.select怎么用?Python Release.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bodhi.model.Release的用法示例。


在下文中一共展示了Release.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clean_repo

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
def clean_repo():
    """
    Clean up our mashed_dir, removing all referenced repositories
    """
    log.info("Starting clean_repo job")
    liverepos = []
    repos = config.get('mashed_dir')
    mash_locks = set()
    for release in Release.select():
        lock = join(repos, 'MASHING-%s' % release.id_prefix)
        mash_locks.add(lock)
        if exists(lock):
            log.info("Mash in progress.  Aborting clean_repo job")
            return
    for release in [rel.name.lower() for rel in Release.select()]:
        # TODO: keep the 2 most recent repos!
        for repo in [release + '-updates', release + '-updates-testing']:
            liverepos.append(dirname(realpath(join(repos, repo))))
    for repo in [join(repos, repo) for repo in os.listdir(repos)]:
        if 'repodata' in repo: # skip our repodata caches
            continue
        if not islink(repo) and isdir(repo):
            fullpath = realpath(repo)
            if fullpath not in liverepos:
                log.info("Removing %s" % fullpath)
                subprocess.call(['rm', '-fr', fullpath])

        # Bail out if a push started in the middle of this job
        for lock in mash_locks:
            if exists(lock):
                log.warning('Mash lock detected!  Stopping clean_repo job.')
                return

    log.info("clean_repo complete!")
开发者ID:ralphbean,项目名称:bodhi,代码行数:36,代码来源:jobs.py

示例2: index

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
    def index(self, release=None):
        # /updates/metrics?tg_format=json API
        if request_format() == "json":
            json = {}
            query = release and [Release.byName(release)] or Release.select()
            for release in query:
                json[release.name] = release.metrics
            return json

        try:
            if not release:
                rel = Release.select()[0]
                release = rel.name
            else:
                rel = Release.byName(release)
        except SQLObjectNotFound:
            flash("Unknown Release")
            raise redirect("/metrics")
        widgets = MetricData().get_widgets(release)
        if not widgets:
            return dict(metrics=[], title="Metrics currently unavailable")
        return dict(
            metrics=[widgets[name.__name__] for name in metrics if name.__name__ in widgets],
            title="%s Update Metrics" % rel.long_name,
        )
开发者ID:ralphbean,项目名称:bodhi,代码行数:27,代码来源:metrics.py

示例3: save_db

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
def save_db():
    ## Save each release and it's metrics
    releases = []
    for release in Release.select():
        rel = {}
        for attr in ('name', 'long_name', 'id_prefix', 'dist_tag',
                     'locked', 'metrics'):
            rel[attr] = getattr(release, attr)
        releases.append(rel)

    updates = []
    all_updates = PackageUpdate.select()
    progress = ProgressBar(maxValue=all_updates.count())

    for update in all_updates:
        data = {}
        data['title'] = update.title
        data['builds'] = [(build.package.name, build.nvr) for build in update.builds]
        data['date_submitted'] = update.date_submitted
        data['date_pushed'] = update.date_pushed
        data['date_modified'] = update.date_modified
        data['release'] = [update.release.name, update.release.long_name,
                           update.release.id_prefix, update.release.dist_tag]
        data['submitter'] = update.submitter
        data['update_id'] = hasattr(update, 'update_id') and update.update_id or update.updateid
        data['type'] = update.type
        data['karma'] = update.karma
        data['cves'] = [cve.cve_id for cve in update.cves]
        data['bugs'] = []
        for bug in update.bugs:
            data['bugs'].append([bug.bz_id, bug.title, bug.security])
            if hasattr(bug, 'parent'):
                data['bugs'][-1].append(bug.parent)
            else:
                data['bugs'][-1].append(False)
        data['status'] = update.status
        data['pushed'] = update.pushed
        data['notes'] = update.notes
        data['request'] = update.request
        data['comments'] = [(c.timestamp, c.author, c.text, c.karma, c.anonymous) for c in update.comments]
        if hasattr(update, 'approved'):
            data['approved'] = update.approved
        else:
            data['approved'] = None

        updates.append(data)
        progress()

    # Save all buildroot overrides
    overrides = []
    for override in BuildRootOverride.select():
        try:
            overrides.append(override.__json__())
        except:
            print("Removing stray override: %s" % override)
            override.destroySelf()

    dump = file('bodhi-pickledb-%s' % time.strftime("%y%m%d.%H%M"), 'w')
    pickle.dump({'updates': updates, 'releases': releases, 'overrides': overrides}, dump)
    dump.close()
开发者ID:bitlord,项目名称:bodhi,代码行数:62,代码来源:pickledb.py

示例4: get_widgets

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
    def get_widgets(self, release):
        """ Return the metrics for a specified release.

        If our metric widgets are more than a day old, recreate them with
        fresh metrics from our database.
        """
        if self.age and get_age_in_days(self.age) < 1:
            return self.widgets[release]

        log.debug("Generating some fresh metric widgets...")
        freshwidgets = {}
        for rel in Release.select():
            if not rel.metrics:
                log.warning("No metrics found for %s" % rel.name)
                return
            self.init_metrics(rel)
            if not freshwidgets.has_key(rel.name):
                freshwidgets[rel.name] = {}
            for metric in self.metrics:
                widget = metric.get_widget(rel.metrics[metric.__class__.__name__])
                if widget:
                    freshwidgets[rel.name][metric.__class__.__name__] = widget

        self.widgets = freshwidgets
        self.age = datetime.utcnow()
        return self.widgets[release]
开发者ID:ralphbean,项目名称:bodhi,代码行数:28,代码来源:metrics.py

示例5: refresh

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
    def refresh(self):
        """ Refresh all of the metrics for all releases.

        For each release, initialize our metrics objects, and feed them every
        update for that release.  Do the necessary calculations, and then save
        our metrics to the database in the Release.metrics PickleCol.
        """
        log.info("Doing a hard refresh of our metrics data")
        metrics = {}
        updates = {}  # {release: [updates,]}
        all_updates = list(PackageUpdate.select())
        releases = list(Release.select())
        for release in releases:
            updates[release.name] = []
        for update in all_updates:
            updates[update.release.name].append(update)
        for release in releases:
            log.debug("Calculating metrics for %s" % release.name)
            self.init_metrics(release)
            for update in updates[release.name]:
                for metric in self.metrics:
                    metric.update(update)
            for metric in self.metrics:
                metric.done()
                metrics[metric.__class__.__name__] = metric.get_data()
            release.metrics = metrics
        hub.commit()
        del all_updates
        del releases
        log.info("Metrics generation complete!")
开发者ID:ralphbean,项目名称:bodhi,代码行数:32,代码来源:metrics.py

示例6: get_security_updates

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def get_security_updates(self, release):
     release = Release.select(Release.q.long_name==release)[0]
     return PackageUpdate.select(
             AND(PackageUpdate.q.releaseID == release.id,
                 PackageUpdate.q.type == 'security',
                 PackageUpdate.q.status == 'testing',
                 PackageUpdate.q.request == None))
开发者ID:ralphbean,项目名称:bodhi,代码行数:9,代码来源:masher.py

示例7: _get_epel_release

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def _get_epel_release(self):
     rel = Release.select(Release.q.name=='EL5')
     if rel.count():
         rel = rel[0]
     else:
         rel = Release(name='EL5', long_name='Fedora EPEL 5', id_prefix='FEDORA-EPEL',
                       dist_tag='dist-5E-epel')
     return rel
开发者ID:network-box,项目名称:bodhi,代码行数:10,代码来源:test_model.py

示例8: get_security_updates

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def get_security_updates(self, release):
     release = Release.select(Release.q.long_name == release)[0]
     updates = PackageUpdate.select(
         AND(PackageUpdate.q.releaseID == release.id,
             PackageUpdate.q.type == 'security',
             PackageUpdate.q.status == 'testing',
             PackageUpdate.q.request == None))
     updates = self.sort_by_days_in_testing(updates)
     return updates
开发者ID:docent-net,项目名称:bodhi,代码行数:11,代码来源:masher.py

示例9: save_db

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
def save_db():
    ## Save each release and it's metrics
    releases = []
    for release in Release.select():
        rel = {}
        for attr in ("name", "long_name", "id_prefix", "dist_tag", "locked", "metrics"):
            rel[attr] = getattr(release, attr)
        releases.append(rel)

    updates = []
    all_updates = PackageUpdate.select()
    progress = ProgressBar(maxValue=all_updates.count())

    for update in all_updates:
        data = {}
        data["title"] = update.title
        data["builds"] = [(build.package.name, build.nvr) for build in update.builds]
        data["date_submitted"] = update.date_submitted
        data["date_pushed"] = update.date_pushed
        data["date_modified"] = update.date_modified
        data["release"] = [
            update.release.name,
            update.release.long_name,
            update.release.id_prefix,
            update.release.dist_tag,
        ]
        data["submitter"] = update.submitter
        data["update_id"] = hasattr(update, "update_id") and update.update_id or update.updateid
        data["type"] = update.type
        data["karma"] = update.karma
        data["cves"] = [cve.cve_id for cve in update.cves]
        data["bugs"] = []
        for bug in update.bugs:
            data["bugs"].append([bug.bz_id, bug.title, bug.security])
            if hasattr(bug, "parent"):
                data["bugs"][-1].append(bug.parent)
            else:
                data["bugs"][-1].append(False)
        data["status"] = update.status
        data["pushed"] = update.pushed
        data["notes"] = update.notes
        data["request"] = update.request
        data["comments"] = [(c.timestamp, c.author, c.text, c.karma, c.anonymous) for c in update.comments]
        if hasattr(update, "approved"):
            data["approved"] = update.approved
        else:
            data["approved"] = None

        updates.append(data)
        progress()

    dump = file("bodhi-pickledb-%s" % time.strftime("%y%m%d.%H%M"), "w")
    pickle.dump({"updates": updates, "releases": releases}, dump)
    dump.close()
开发者ID:ralphbean,项目名称:bodhi,代码行数:56,代码来源:pickledb.py

示例10: get_unapproved_critpath_updates

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def get_unapproved_critpath_updates(self, release):
     release = Release.select(Release.q.long_name==release)[0]
     updates = []
     for update in PackageUpdate.select(
             AND(PackageUpdate.q.releaseID == release.id,
                 PackageUpdate.q.status != 'stable',
                 PackageUpdate.q.status != 'obsolete',
                 PackageUpdate.q.request == None),
             orderBy=PackageUpdate.q.date_submitted).reversed():
         if update.critpath and not update.critpath_approved:
             updates.append(update)
     return updates
开发者ID:ralphbean,项目名称:bodhi,代码行数:14,代码来源:masher.py

示例11: get_unapproved_critpath_updates

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def get_unapproved_critpath_updates(self, release):
     release = Release.select(Release.q.long_name == release)[0]
     updates = []
     for update in PackageUpdate.select(
             AND(PackageUpdate.q.releaseID == release.id,
                 PackageUpdate.q.status == 'testing',
                 PackageUpdate.q.request == None),
             orderBy=PackageUpdate.q.date_submitted).reversed():
         if update.critpath and not update.critpath_approved:
             updates.append(update)
     updates = self.sort_by_days_in_testing(updates)
     return updates
开发者ID:docent-net,项目名称:bodhi,代码行数:14,代码来源:masher.py

示例12: send_digest_mail

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
    def send_digest_mail(self):
        """
        Send digest mail to mailing lists
        """
        for prefix, content in self.testing_digest.items():
            log.debug("Sending digest for updates-testing %s" % prefix)
            maildata = u""
            try:
                security_updates = self.get_security_updates(prefix)
                if security_updates:
                    maildata += u"The following %s Security updates need testing:\n Age  URL\n" % prefix
                    for update in security_updates:
                        maildata += u" %3i  %s%s\n" % (
                            update.days_in_testing,
                            config.get("base_address"),
                            url(update.get_url()),
                        )
                    maildata += "\n\n"

                critpath_updates = self.get_unapproved_critpath_updates(prefix)
                if critpath_updates:
                    maildata += u"The following %s Critical Path updates have yet to be approved:\n Age URL\n" % prefix
                    for update in self.get_unapproved_critpath_updates(prefix):
                        maildata += u" %3i  %s%s\n" % (
                            update.days_in_testing,
                            config.get("base_address"),
                            url(update.get_url()),
                        )
                    maildata += "\n\n"
            except Exception, e:
                log.exception(e)

            maildata += u"The following builds have been pushed to %s updates-testing\n\n" % prefix
            # get a list af all nvr's
            updlist = content.keys()
            # sort the list
            updlist.sort()
            # Add the list of builds to the mail
            for pkg in updlist:
                maildata += u"    %s\n" % pkg
            # Add some space between the short list and the Details"
            maildata += u"\nDetails about builds:\n\n"
            # Add the detail of each build
            for nvr in updlist:
                maildata += u"\n" + self.testing_digest[prefix][nvr]
            release = Release.select(Release.q.long_name == prefix)[0]
            mail.send_mail(
                config.get("bodhi_email"),
                config.get("%s_test_announce_list" % release.id_prefix.lower().replace("-", "_")),
                "%s updates-testing report" % prefix,
                maildata,
            )
开发者ID:kmcdowell85,项目名称:bodhi,代码行数:54,代码来源:masher.py

示例13: _fetch_candidate_builds

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def _fetch_candidate_builds(self, pkg):
     """ Return all candidate builds for a given package """
     matches = {}
     koji = get_session()
     koji.multicall = True
     for tag in [r.candidate_tag for r in Release.select()]:
         koji.listTagged(tag, package=pkg)
     results = koji.multiCall()
     for result in results:
         for entries in result:
             for entry in entries:
                 matches[entry['nvr']] = entry['completion_time']
     return [build[0] for build in
             sorted(matches.items(), key=itemgetter(1), reverse=True)]
开发者ID:bitlord,项目名称:bodhi,代码行数:16,代码来源:new.py

示例14: masher

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
 def masher(self):
     """ Display the current status of the Masher """
     if config.get('masher'):
         data = self._masher_request('/admin/masher')
         if not data:
             data = {'masher_str': 'Unable to contact the masher', 'tags': []}
         return dict(masher_str=data['masher_str'], tags=data['tags'])
     else:
         from bodhi.masher import masher
         tags = []
         for release in Release.select():
             tags.append(release.stable_tag)
             tags.append(release.testing_tag)
         return dict(masher_str=str(masher), tags=tags)
开发者ID:bitlord,项目名称:bodhi,代码行数:16,代码来源:admin.py

示例15: clean_stable_builds

# 需要导入模块: from bodhi.model import Release [as 别名]
# 或者: from bodhi.model.Release import select [as 别名]
def clean_stable_builds(untag=False):
    koji = get_session()
    for release in Release.select():
        latest_stable_builds = koji.listTagged(release.stable_tag, latest=True)
        latest_stable_nvrs = [build['nvr'] for build in latest_stable_builds]
        print "Fetched %d latest stable builds tagged with %s" % (
                len(latest_stable_builds), release.stable_tag)
        stable_builds = koji.listTagged(release.stable_tag)
        stable_nvrs = [build['nvr'] for build in stable_builds]
        print "Fetched %d stable builds tagged with %s" % (
                len(stable_builds), release.stable_tag)
        for latest_build in latest_stable_builds:
            for build in stable_builds:
                if build['nvr'] == latest_build['nvr']:
                    continue
                compare_builds(latest_build, build, untag, release.stable_tag)
开发者ID:bitlord,项目名称:bodhi,代码行数:18,代码来源:clean-stable.py


注:本文中的bodhi.model.Release.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。