コード例 #1
0
def _checker_check_dups(self, project, opts):
    url = makeurl(opts.apiurl, ['request'], "states=new,review&project=%s&view=collection" % project)
    f = http_GET(url)
    root = ET.parse(f).getroot()
    rqs = {}
    for rq in root.findall('request'):
        id = rq.attrib['id']
        for a in rq.findall('action'):
            source = a.find('source')
            target = a.find('target')
            type = a.attrib['type']
            assert target != None
            if target.attrib['project'] != project:
                continue
            # print(id)
            # ET.dump(target)
            if 'package' not in target.attrib:
                continue
            package = target.attrib['package']
            if type + package in rqs:
                [oldid, oldsource] = rqs[type + package]
                if oldid > id:
                    s = oldid
                    oldid = id
                    id = s
                assert oldid < id
                if source != None and oldsource != None:
                    if (source.attrib['project'] == oldsource.attrib['project'] and
                       source.attrib['package'] == oldsource.attrib['package']):
                        change_request_state(opts.apiurl, str(oldid), 'superseded',
                                     'superseded by %s' % id, id)
                        continue
                print("DUPS found:", id, oldid)
            rqs[type + package] = [id, source]
コード例 #2
0
    def accept_other_new(self):
        changed = False

        if self.api.cdelreq_review:
            rqlist = self.find_virtually_accepted_requests(self.api.project)
            for req in rqlist:
                if self.virtual_accept_request_has_no_binary(self.api.project, req['packages'][0]):
                    # Accepting delreq-review review
                    self.api.do_change_review_state(req['id'], 'accepted',
                                                    by_group=self.api.cdelreq_review,
                                                    message='Virtually accepted delete {}'.format(req['packages'][0]))

        rqlist = self.find_new_requests(self.api.project)
        if self.api.cnonfree:
            rqlist += self.find_new_requests(self.api.cnonfree)

        for req in rqlist:
            oldspecs = self.api.get_filelist_for_package(pkgname=req['packages'][0], project=self.api.project, extension='spec')
            print('Accepting request %d: %s' % (req['id'], ','.join(req['packages'])))
            if req['type'] == 'delete':
                # Remove devel project/package tag before accepting the request
                self.remove_obsoleted_develtag(self.api.project, req['packages'][0])
            change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to %s' % self.api.project)
            # Check if all .spec files of the package we just accepted has a package container to build
            self.create_new_links(self.api.project, req['packages'][0], oldspecs)
            changed = True

        return changed
コード例 #3
0
    def accept_other_new(self):
        changed = False
        for req in self.find_new_requests('openSUSE:{}'.format(self.api.opensuse)):
            print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages']))
            change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to factory')
            changed = True

        return changed
コード例 #4
0
    def perform(self, project, force=False):
        """Accept the staging project for review and submit to Factory /
        openSUSE 13.2 ...

        Then disable the build to disabled
        :param project: staging project we are working with

        """

        status = self.api.check_project_status(project)

        if not status:
            print('The project "{}" is not yet acceptable.'.format(project))
            if not force:
                return False

        meta = self.api.get_prj_pseudometa(project)
        requests = []
        packages = []
        for req in meta['requests']:
            self.api.rm_from_prj(project,
                                 request_id=req['id'],
                                 msg='ready to accept')
            requests.append(req['id'])
            packages.append(req['package'])
            msg = 'Accepting staging review for {}'.format(req['package'])
            print(msg)

            oldspecs = self.api.get_filelist_for_package(
                pkgname=req['package'],
                project=self.api.project,
                extension='spec')
            change_request_state(self.api.apiurl,
                                 str(req['id']),
                                 'accepted',
                                 message='Accept to %s' % self.api.project)
            self.create_new_links(self.api.project, req['package'], oldspecs)

        # A single comment should be enough to notify everybody, since
        # they are already mentioned in the comments created by
        # select/unselect
        pkg_list = ", ".join(packages)
        cmmt = 'Project "{}" accepted.' \
               ' The following packages have been submitted to {}: {}.'.format(project,
                                                                               self.api.project,
                                                                               pkg_list)
        self.comment.add_comment(project_name=project, comment=cmmt)

        # XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here.
        self.comment.delete_from(project_name=project)

        self.api.build_switch_prj(project, 'disable')
        if self.api.item_exists(project + ':DVD'):
            self.api.build_switch_prj(project + ':DVD', 'disable')

        return True
コード例 #5
0
    def reqRevoke(self, reqid, msg=''):
        """ This method is called to revoke a request
            Success: return None
            Failed:  return string of error message
        """

        try:
            core.change_request_state(self.apiurl, reqid, 'revoked', message=msg, supersed=None)
        except Exception, e:
            return str(e)
コード例 #6
0
ファイル: obs.py プロジェクト: dbnicholson/merge-our-misc
 def submitMergeRequest(self, upstreamDistro, msg):
   reqs = osccore.get_request_list(self.distro.config('obs', 'url'),
       self.distro.obsProject(self.dist, self.component), self.obsName,
       req_type='submit', req_state=['new', 'review'])
   user = self.distro.obsUser
   oldreqs = [ i for i in reqs if i.state.who == user ]
   result = osccore.create_submit_request(self.distro.config('obs', 'url'), self.distro.obsProject(self.dist, self.component), self.obsName, upstreamDistro, self.obsName, msg)
   for req in oldreqs:
     osccore.change_request_state(self.distro.config('obs', 'url'), req.reqid,
         'superseded', 'superseded by %s' % result, result)
   return result
コード例 #7
0
    def perform(self, project, force=False):
        """Accept the staging project for review and submit to Factory /
        openSUSE 13.2 ...

        Then disable the build to disabled
        :param project: staging project we are working with

        """

        status = self.api.check_project_status(project)

        if not status:
            print('The project "{}" is not yet acceptable.'.format(project))
            if not force:
                return False

        meta = self.api.get_prj_pseudometa(project)
        requests = []
        packages = []
        for req in meta['requests']:
            self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept')
            requests.append(req['id'])
            packages.append(req['package'])
            msg = 'Accepting staging review for {}'.format(req['package'])
            print(msg)

            oldspecs = self.api.get_filelist_for_package(pkgname=req['package'],
                                                         project=self.api.project,
                                                         extension='spec')
            change_request_state(self.api.apiurl,
                                 str(req['id']),
                                 'accepted',
                                 message='Accept to %s' % self.api.project)
            self.create_new_links(self.api.project, req['package'], oldspecs)

        # A single comment should be enough to notify everybody, since
        # they are already mentioned in the comments created by
        # select/unselect
        pkg_list = ", ".join(packages)
        cmmt = 'Project "{}" accepted.' \
               ' The following packages have been submitted to {}: {}.'.format(project,
                                                                               self.api.project,
                                                                               pkg_list)
        self.comment.add_comment(project_name=project, comment=cmmt)

        # XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here.
        self.comment.delete_from(project_name=project)

        self.api.build_switch_prj(project, 'disable')
        if self.api.item_exists(project + ':DVD'):
            self.api.build_switch_prj(project + ':DVD', 'disable')

        return True
コード例 #8
0
    def perform(self, project, force=False):
        """Accept the staging project for review and submit to Factory /
        openSUSE 13.2 ...

        Then disable the build to disabled
        :param project: staging project we are working with

        """

        status = self.api.check_project_status(project)

        if not status:
            print('The project "{}" is not yet acceptable.'.format(project))
            if not force:
                return False

        meta = self.api.get_prj_pseudometa(project)
        packages = []
        for req in meta['requests']:
            self.api.rm_from_prj(project,
                                 request_id=req['id'],
                                 msg='ready to accept')
            packages.append(req['package'])
            msg = 'Accepting staging review for {}'.format(req['package'])

            oldspecs = self.api.get_filelist_for_package(
                pkgname=req['package'],
                project=self.api.project,
                extension='spec')
            if 'type' in req and req[
                    'type'] == 'delete' and self.api.cdelreq_review:
                msg += ' and started handling of virtual accept process'
                print(msg)
                # Virtually accept the delete request
                self.virtually_accept_delete(req['id'], req['package'])
            else:
                print(msg)
                change_request_state(self.api.apiurl,
                                     str(req['id']),
                                     'accepted',
                                     message='Accept to %s' % self.api.project,
                                     force=force)
                self.create_new_links(self.api.project, req['package'],
                                      oldspecs)

        self.api.accept_status_comment(project, packages)
        self.api.staging_deactivate(project)
        ConfigCommand(self.api).perform([project], 'todo')

        return True
コード例 #9
0
    def accept_other_new(self):
        changed = False
        rqlist = self.find_new_requests(self.api.project)
        if self.api.cnonfree:
            rqlist += self.find_new_requests(self.api.cnonfree)

        for req in rqlist:
            oldspecs = self.api.get_filelist_for_package(pkgname=req['packages'][0], project=self.api.project, extension='spec')
            print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages']))
            change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to %s' % self.api.project)
            # Check if all .spec files of the package we just accepted has a package container to build
            self.create_new_links(self.api.project, req['packages'][0], oldspecs)
            changed = True

        return changed
コード例 #10
0
    def accept_other_new(self):
        changed = False
        rqlist = self.find_new_requests(self.api.project)
        if self.api.cnonfree:
            rqlist += self.find_new_requests(self.api.cnonfree)

        for req in rqlist:
            oldspecs = self.api.get_filelist_for_package(pkgname=req['packages'][0], project=self.api.project, extension='spec')
            print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages']))
            change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to %s' % self.api.project)
            # Check if all .spec files of the package we just accepted has a package container to build
            self.create_new_links(self.api.project, req['packages'][0], oldspecs)
            changed = True

        return changed
コード例 #11
0
    def perform(self, project, force=False):
        """Accept the staging project for review and submit to Factory /
        openSUSE 13.2 ...

        Then disable the build to disabled
        :param project: staging project we are working with

        """

        status = self.api.check_project_status(project)

        if not status:
            print('The project "{}" is not yet acceptable.'.format(project))
            if not force:
                return False

        meta = self.api.get_prj_pseudometa(project)
        packages = []
        for req in meta['requests']:
            self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept')
            packages.append(req['package'])
            msg = 'Accepting staging review for {}'.format(req['package'])

            oldspecs = self.api.get_filelist_for_package(pkgname=req['package'],
                                                         project=self.api.project,
                                                         extension='spec')
            if 'type' in req and req['type'] == 'delete' and self.api.cdelreq_review:
                msg += ' and started handling of virtual accept process'
                print(msg)
                # Virtually accept the delete request
                self.virtually_accept_delete(req['id'], req['package'])
            else:
                print(msg)
                change_request_state(self.api.apiurl,
                                     str(req['id']),
                                     'accepted',
                                     message='Accept to %s' % self.api.project,
                                     force=force)
                self.create_new_links(self.api.project, req['package'], oldspecs)

        self.api.accept_status_comment(project, packages)
        self.api.staging_deactivate(project)
        ConfigCommand(self.api).perform([project], 'todo')

        return True
コード例 #12
0
 def submitMergeRequest(self, upstreamDistro, msg):
     reqs = osccore.get_request_list(self.distro.config('obs', 'url'),
                                     self.distro.obsProject(
                                         self.dist, self.component),
                                     self.obsName,
                                     req_type='submit',
                                     req_state=['new', 'review'])
     user = self.distro.obsUser
     oldreqs = [i for i in reqs if i.state.who == user]
     result = osccore.create_submit_request(
         self.distro.config('obs', 'url'),
         self.distro.obsProject(self.dist, self.component), self.obsName,
         upstreamDistro, self.obsName, msg)
     for req in oldreqs:
         osccore.change_request_state(self.distro.config('obs', 'url'),
                                      req.reqid, 'superseded',
                                      'superseded by %s' % result, result)
     return result
コード例 #13
0
    def perform(self, project):
        """
        Accept the staging LETTER for review and submit to factory
        Then disable the build to disabled
        :param project: staging project we are working with
        """

        status = self.api.check_project_status(project)

        if not status:
            print('The project "{}" is not yet acceptable.'.format(project))
            return False

        meta = self.api.get_prj_pseudometa(project)
        requests = []
        packages = []
        for req in meta['requests']:
            self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept')
            requests.append(req['id'])
            packages.append(req['package'])
            msg = 'Accepting staging review for {}'.format(req['package'])
            print(msg)

        for req in requests:
            change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory')

        # A single comment should be enough to notify everybody, since they are
        # already mentioned in the comments created by select/unselect
        pkg_list = ", ".join(packages)
        cmmt = 'Project "{}" accepted. The following packages have been submitted to factory: {}.'.format(project, pkg_list)
        self.comment.add_comment(project_name=project, comment=cmmt)

        # XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here.
        self.comment.delete_from(project_name=project)

        self.api.build_switch_prj(project, 'disable')
        if self.api.project_exists(project + ':DVD'):
            self.api.build_switch_prj(project + ':DVD', 'disable')

        return True
コード例 #14
0
def _checker_check_dups(self, project, opts):
    url = makeurl(opts.apiurl, ['request'],
                  "states=new,review&project=%s&view=collection" % project)
    f = http_GET(url)
    root = ET.parse(f).getroot()
    rqs = {}
    for rq in root.findall('request'):
        id = rq.attrib['id']
        for a in rq.findall('action'):
            source = a.find('source')
            target = a.find('target')
            type = a.attrib['type']
            assert target != None
            if target.attrib['project'] != project:
                continue
            # print(id)
            # ET.dump(target)
            if 'package' not in target.attrib:
                continue
            package = target.attrib['package']
            if type + package in rqs:
                [oldid, oldsource] = rqs[type + package]
                if oldid > id:
                    s = oldid
                    oldid = id
                    id = s
                assert oldid < id
                if source != None and oldsource != None:
                    if (source.attrib['project'] == oldsource.attrib['project']
                            and source.attrib['package']
                            == oldsource.attrib['package']):
                        change_request_state(opts.apiurl, str(oldid),
                                             'superseded',
                                             'superseded by %s' % id, id)
                        continue
                print("DUPS found:", id, oldid)
            rqs[type + package] = [id, source]
コード例 #15
0
    def accept_all(self, projects, force=False, cleanup=True):
        accept_all_green = len(projects) == 0
        if accept_all_green:
            print('Accepting all acceptable projects')
            if force:
                print('ERROR: Not compatible with force option')
                return False

        self.requests = { 'delete': [], 'submit': [] }
        staging_packages = {}

        if accept_all_green:
            projects = self.api.get_staging_projects()

        for prj in projects:
            project = self.api.prj_from_letter(prj)

            status = self.api.project_status(project)
            if status.get('state') != 'acceptable':
                if accept_all_green:
                    continue
                if not force:
                    print('The project "{}" is not yet acceptable.'.format(project))
                    return False

            staging_packages[project] = []
            for request in status.findall('staged_requests/request'):
                self.requests[request.get('type')].append(request.get('package'))
                staging_packages[project].append(request.get('package'))

        other_new = self.find_new_requests(self.api.project)
        for req in other_new:
            self.requests[req['type']].append(req['package'])

        print('delete links to packages pending deletion...')
        self.delete_linked()

        # we have checked ourselves and accepting one staging project creates a race
        # for the other staging projects to appear building again
        opts = { 'force': '1' }

        print('triggering staging accepts...')
        for project in staging_packages.keys():
            u = self.api.makeurl(['staging', self.api.project, 'staging_projects', project, 'accept'], opts)
            http_POST(u)

        for req in other_new:
            print(f"Accepting request {req['id']}: {req['package']}")
            change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to %s' % self.api.project)

        for project in sorted(staging_packages.keys()):
            print(f'waiting for staging project {project} to be accepted')

            while True:
                status = self.api.project_status(project, reload=True)
                if status.get('state') == 'empty':
                    break
                print('{} requests still staged - waiting'.format(status.find('staged_requests').get('count')))
                time.sleep(1)

            self.api.accept_status_comment(project, staging_packages[project])
            if self.api.is_adi_project(project):
                self.api.delete_empty_adi_project(project)
                continue

            self.api.staging_deactivate(project)

            self.reset_rebuild_data(project)

            if cleanup:
                self.cleanup(project)

        for package in self.requests['submit']:
            self.fix_linking_packages(package)

        if self.api.project.startswith('openSUSE:'):
            self.update_factory_version()
            if self.api.crebuild and self.api.item_exists(self.api.crebuild):
                self.sync_buildfailures()

        return True