Example #1
0
 def get_tagged(self, item, conf_dict):
     """
     This function constructs the download build URL for each rpm and
     creates a list of all the rpms in each build. This rpms list is then
     passed on to threads along with download_rpms().
     """
     if item is None:
         builds = brew.listTagged(self.brew_tag,
                                  latest=True,
                                  type=None,
                                  inherit=True)
     else:
         builds = brew.listTagged(self.brew_tag,
                                  latest=True,
                                  package=item,
                                  type=None,
                                  inherit=True)
     for build in builds:
         buildpath = pathinfo.build(build)
         arches_noarch = (self.brew_arch, "noarch")
         for arches in arches_noarch:
             rpms = brew.listRPMs(build['id'], arches=arches)
             rpms_list = []
             for rpm in rpms:
                 rpmpath = pathinfo.rpm(rpm)
                 rpmurl = os.path.join(buildpath, rpmpath)
                 rpms_list.append(rpmurl)
                 self.download_rpms(rpmurl)
                 logger.log.info("Downloading %s" % rpmurl)
Example #2
0
    def candidates(self):
        """ Get a list list of update candidates.

        This method is a generator that returns a list of koji builds that
        could potentially be pushed as updates.
        """
        if not self.username:
            raise BodhiClientException('You must specify a username')
        data = self.send_request('candidate_tags')
        koji = self.get_koji_session(login=False)
        for tag in data['tags']:
            for build in koji.listTagged(tag, latest=True):
                if build['owner_name'] == self.username:
                    yield build
Example #3
0
    def candidates(self):
        """ Get a list list of update candidates.

        This method is a generator that returns a list of koji builds that
        could potentially be pushed as updates.
        """
        if not self.username:
            raise BodhiClientException('You must specify a username')
        data = self.send_request('candidate_tags')
        koji = self.get_koji_session(login=False)
        for tag in data['tags']:
            for build in koji.listTagged(tag, latest=True):
                if build['owner_name'] == self.username:
                    yield build
Example #4
0
 def get_tagged(self, item, conf_dict):
     """
     This function constructs the download build URL for each rpm and
     creates a list of all the rpms in each build. This rpms list is then
     passed on to threads along with download_rpms().
     """
     if item is None:
         builds = brew.listTagged(self.brew_tag, latest=True, type=None,
                                  inherit=True)
     else:
         builds = brew.listTagged(self.brew_tag, latest=True, package=item,
                                  type=None, inherit=True)
     for build in builds:
         buildpath = pathinfo.build(build)
         arches_noarch = (self.brew_arch, "noarch")
         for arches in arches_noarch:
             rpms = brew.listRPMs(build['id'], arches=arches)
             rpms_list = []
             for rpm in rpms:
                 rpmpath = pathinfo.rpm(rpm)
                 rpmurl = os.path.join(buildpath, rpmpath)
                 rpms_list.append(rpmurl)
                 self.download_rpms(rpmurl)
                 logger.log.info("Downloading %s" % rpmurl)
Example #5
0
    def candidates(self):
        """ Get a list list of update candidates.

        This method is a generator that returns a list of koji builds that
        could potentially be pushed as updates.
        """
        self.init_username()
        builds = []
        data = self.get_releases()
        koji = self.get_koji_session()
        for release in data['releases']:
            try:
                for build in koji.listTagged(release['candidate_tag'], latest=True):
                    if build['owner_name'] == self.username:
                        builds.append(build)
            except Exception:
                log.exception('Unable to query candidate builds for %s' % release)
        return builds
Example #6
0
    def candidates(self):
        """ Get a list list of update candidates.

        This method is a generator that returns a list of koji builds that
        could potentially be pushed as updates.
        """
        if not self.username:
            raise BodhiClientException('You must specify a username')
        builds = []
        data = self.get_releases()
        koji = self.get_koji_session(login=False)
        for release in data['releases']:
            try:
                for build in koji.listTagged(release['candidate_tag'], latest=True):
                    if build['owner_name'] == self.username:
                        builds.append(build)
            except:
                log.exception('Unable to query candidate builds for %s' % release)
        return builds
Example #7
0
    def candidates(self):
        """
        Get a list list of update candidates.

        Returns:
            list: A list of koji builds (dictionaries returned by koji.listTagged()) that are tagged
            as candidate builds and are owned by the current user.
        """
        self.init_username()
        builds = []
        data = self.get_releases()
        koji = self.get_koji_session()
        for release in data['releases']:
            try:
                for build in koji.listTagged(release['candidate_tag'], latest=True):
                    if build['owner_name'] == self.username:
                        builds.append(build)
            except Exception:
                log.exception('Unable to query candidate builds for %s' % release)
        return builds
Example #8
0
                    provided')
required.add_argument('--location', help='Absolute path of download \
                        to directory', required=True)
args = parser.parse_args()

tag = args.koji_tag
pkg = args.pkg
arch = args.arch

download_dir = args.location
if not os.path.exists(download_dir):
    os.makedirs(download_dir)

# Lists the latest build for the koji tag and package name provided as
# arguments
builds = koji.listTagged(tag, latest=True, package=pkg, type=None,
inherit=True)

for build in builds:
    buildpath = pathinfo.build(build)

    # Lists latest RPMs
    rpms = koji.listRPMs(build['id'], arches=arch)

    for rpm in rpms:
        rpmpath = pathinfo.rpm(rpm)
        rpmurl = os.path.join(buildpath, rpmpath)
        print rpmurl
        rpmname = os.path.join(download_dir,rpmurl.split('/')[-1])

        # Download latest RPMs
        u = urllib2.urlopen(rpmurl)
Example #9
0
                    provided')
required.add_argument('--location', help='Absolute path of download \
                        to directory', required=True)
args = parser.parse_args()

tag = args.brew_tag
pkg = args.pkg
arch = args.arch

download_dir = args.location
if not os.path.exists(download_dir):
    os.makedirs(download_dir)

# Lists the latest build for the brew tag and package name provided as
# arguments
builds = brew.listTagged(tag, latest=True, package=pkg, type=None,
inherit=True)

for build in builds:
    buildpath = pathinfo.build(build)

    # Lists latest RPMs
    rpms = brew.listRPMs(build['id'], arches=arch)

    for rpm in rpms:
        rpmpath = pathinfo.rpm(rpm)
        rpmurl = os.path.join(buildpath, rpmpath)
        rpmname = os.path.join(download_dir,rpmurl.split('/')[-1])

        # Download latest RPMs
        u = urllib2.urlopen(rpmurl)
        f = open(rpmname, 'wb')