Esempio n. 1
0
def package_in_group(pkg, group):
    excluded = ['grub-zfs', 'plymouth-theme-antergos']

    if pkg in excluded:
        return False

    pkg_obj = get_pkg_object(pkg)

    if pkg_obj:
        return group in pkg_obj.groups

    return False
Esempio n. 2
0
def package_in_group(pkg, group):
    excluded = ['grub-zfs', 'plymouth-theme-antergos']

    if pkg in excluded:
        return False

    pkg_obj = get_pkg_object(pkg)

    if pkg_obj:
        return group in pkg_obj.groups

    return False
Esempio n. 3
0
def package_is(pkg, what):
    excluded = ['grub-zfs', 'plymouth-theme-antergos']

    if pkg in excluded:
        return False

    pkg_obj = get_pkg_object(pkg)
    what = 'is_{}'.format(what)

    if pkg_obj and what in pkg_obj.all_attribs:
        return getattr(pkg_obj, what)

    return False
Esempio n. 4
0
def package_is(pkg, what):
    excluded = ['grub-zfs', 'plymouth-theme-antergos']

    if pkg in excluded:
        return False

    pkg_obj = get_pkg_object(pkg)
    what = 'is_{}'.format(what)

    if pkg_obj and what in pkg_obj.all_attribs:
        return getattr(pkg_obj, what)

    return False
Esempio n. 5
0
def iso_release_job():
    saved_status = False
    if not status.idle and 'Idle' not in status.current_status:
        saved_status = status.current_status

    status.idle = False
    status.current_status = 'Starting ISO Release Job...'
    iso_names = ['antergos-x86_64', 'antergos-minimal-x86_64']
    version = iso_obj = None

    for name in iso_names:
        try:
            pkg_obj = get_pkg_object(name=name)
            iso_obj = ISOUtility(pkg_obj=pkg_obj)

            iso_obj.prep_release()
            iso_obj.sign_with_gnupg()
            iso_obj.do_release()

            pkg_obj.iso_url = iso_obj.mirror_url
            pkg_obj.iso_md5 = iso_obj.md5

            if version is None:
                version = iso_obj.version

            status.iso_pkgs.add(pkg_obj.name)

        except Exception as err:
            logger.error(err)

    if version and db and iso_obj:
        shutil.move(iso_obj.md5sums_path, RELEASE_DIR)
        # We will use the repo monitor class to check propagation of the new files
        # before deleting the old files.
        db.set(status.iso_release_check_key, version)

    if saved_status and not status.idle:
        status.current_status = saved_status
    else:
        status.idle = True
        status.current_status = 'Idle.'
Esempio n. 6
0
def iso_release_job():
    saved_status = False
    if not status.idle and 'Idle' not in status.current_status:
        saved_status = status.current_status

    status.idle = False
    status.current_status = 'Starting ISO Release Job...'
    iso_names = ['antergos-x86_64', 'antergos-minimal-x86_64']
    version = iso_obj = None

    for name in iso_names:
        try:
            pkg_obj = get_pkg_object(name=name)
            iso_obj = ISOUtility(pkg_obj=pkg_obj)

            iso_obj.prep_release()
            iso_obj.sign_with_gnupg()
            iso_obj.do_release()

            pkg_obj.iso_url = iso_obj.mirror_url
            pkg_obj.iso_md5 = iso_obj.md5

            if version is None:
                version = iso_obj.version

            status.iso_pkgs.add(pkg_obj.name)

        except Exception as err:
            logger.error(err)

    if version and db and iso_obj:
        shutil.move(iso_obj.md5sums_path, RELEASE_DIR)
        # We will use the repo monitor class to check propagation of the new files
        # before deleting the old files.
        db.set(status.iso_release_check_key, version)

    if saved_status and not status.idle:
        status.current_status = saved_status
    else:
        status.idle = True
        status.current_status = 'Idle.'
Esempio n. 7
0
    def process_changes(self):
        tpl = 'Webhook triggered by <strong>{0}.</strong> Packages added to the build queue: {1}'

        if self.repo == "antergos-packages":
            logger.debug("Build hook triggered. Updating build queue.")
            has_pkgs = False
            no_dups = []

            for changed in self.changes:
                if not changed:
                    continue

                for item in changed:
                    if item and (self.is_gitlab or self.is_numix
                                 or self.is_cnchi):
                        pak = item
                    elif item and item.endswith('PKGBUILD'):
                        pak, pkb = item.rsplit('/', 1)
                        pak = pak.rsplit('/', 1)[-1]
                    else:
                        pak = None

                    if pak and 'antergos-iso' != pak:
                        logger.info('Adding %s to the build queue.' % pak)
                        no_dups.append(pak)
                        status.all_packages.add(pak)
                        has_pkgs = True

            if has_pkgs:
                if self.is_monitor or self.is_numix:
                    # Allow github time to make the pushed commits available via their API
                    gevent.sleep(15)

                the_pkgs = list(set(no_dups))
                last_pkg = the_pkgs[-1]
                html = []
                if len(the_pkgs) > 1:
                    html.append('<ul class="hook-pkg-list">')
                for p in the_pkgs:
                    if p:
                        pkg_link = '<a href="/package/{0}">{0}</a>'.format(p)

                        if len(the_pkgs) > 1:
                            item = '<li>{0}</li>'.format(pkg_link)
                        else:
                            item = '<strong>{0}</strong>'.format(pkg_link)
                        html.append(item)

                    if p == last_pkg and len(the_pkgs) > 1:
                        html.append('</ul>')

                if self.is_gitlab:
                    source = 'Gitlab'
                    tltype = 2
                elif self.is_monitor or self.is_numix:
                    source = 'Repo Monitor'
                    tltype = 1
                else:
                    source = 'Github'
                    tltype = 1

                trans_obj = get_trans_object(packages=the_pkgs)
                initiated_by = 'RepoMonitor' if (
                    self.is_monitor or self.is_numix) else 'Github'
                trans_obj.initiated_by = initiated_by
                trans_obj.sync_pkgbuilds_only = self.sync_pkgbuilds_only
                trans_obj.gh_sha_before = self.payload['before']
                trans_obj.gh_sha_after = self.payload['after']

                the_pkgs_str = ''.join(html)
                tl_event = get_timeline_object(msg=tpl.format(
                    source, the_pkgs_str),
                                               tl_type=tltype,
                                               packages=the_pkgs,
                                               tnum=trans_obj.tnum)

                p_objs = [
                    get_pkg_object(name=p, fetch_pkgbuild=True)
                    for p in the_pkgs
                ]

                for p_obj in p_objs:
                    p_obj.tl_events.append(tl_event.event_id)

                status.transaction_queue.append(trans_obj.tnum)
                queue.enqueue_call(builder.handle_hook, timeout=84600)

            if not self.result:
                self.result = json.dumps({'msg': 'OK!'})
Esempio n. 8
0
    def process_changes(self):
        tpl = 'Webhook triggered by <strong>{0}.</strong> Packages added to the build queue: {1}'

        if self.repo == "antergos-packages":
            logger.debug("Build hook triggered. Updating build queue.")
            has_pkgs = False
            no_dups = []

            for changed in self.changes:
                if not changed:
                    continue

                for item in changed:
                    if item and (self.is_gitlab or self.is_numix or self.is_cnchi):
                        pak = item
                    elif item and item.endswith('PKGBUILD'):
                        pak, pkb = item.rsplit('/', 1)
                        pak = pak.rsplit('/', 1)[-1]
                    else:
                        pak = None

                    if pak and 'antergos-iso' != pak:
                        logger.info('Adding %s to the build queue.' % pak)
                        no_dups.append(pak)
                        status.all_packages.add(pak)
                        has_pkgs = True

            if has_pkgs:
                if self.is_monitor or self.is_numix:
                    # Allow github time to make the pushed commits available via their API
                    gevent.sleep(15)

                the_pkgs = list(set(no_dups))
                last_pkg = the_pkgs[-1]
                html = []
                if len(the_pkgs) > 1:
                    html.append('<ul class="hook-pkg-list">')
                for p in the_pkgs:
                    if p:
                        pkg_link = '<a href="/package/{0}">{0}</a>'.format(p)

                        if len(the_pkgs) > 1:
                            item = '<li>{0}</li>'.format(pkg_link)
                        else:
                            item = '<strong>{0}</strong>'.format(pkg_link)
                        html.append(item)

                    if p == last_pkg and len(the_pkgs) > 1:
                        html.append('</ul>')

                if self.is_gitlab:
                    source = 'Gitlab'
                    tltype = 2
                elif self.is_monitor or self.is_numix:
                    source = 'Repo Monitor'
                    tltype = 1
                else:
                    source = 'Github'
                    tltype = 1

                trans_obj = get_trans_object(packages=the_pkgs)
                initiated_by = 'RepoMonitor' if (self.is_monitor or self.is_numix) else 'Github'
                trans_obj.initiated_by = initiated_by
                trans_obj.sync_pkgbuilds_only = self.sync_pkgbuilds_only
                trans_obj.gh_sha_before = self.payload['before']
                trans_obj.gh_sha_after = self.payload['after']

                the_pkgs_str = ''.join(html)
                tl_event = get_timeline_object(msg=tpl.format(source, the_pkgs_str),
                                               tl_type=tltype,
                                               packages=the_pkgs,
                                               tnum=trans_obj.tnum)

                p_objs = [get_pkg_object(name=p, fetch_pkgbuild=True) for p in the_pkgs]

                for p_obj in p_objs:
                    p_obj.tl_events.append(tl_event.event_id)

                status.transaction_queue.append(trans_obj.tnum)
                queue.enqueue_call(builder.handle_hook, timeout=84600)

            if not self.result:
                self.result = json.dumps({'msg': 'OK!'})