def setupVars(self): # expects to be run from the Builder folder self.BUILDER_TOP_DIR = os.path.abspath('..') import brand_version vi = brand_version.VersionInfo(self.BUILDER_TOP_DIR, log.info) vi.parseVersionInfo( os.path.join(self.BUILDER_TOP_DIR, 'Builder/version_info.txt')) self.version = '%s.%s.%s' % (vi.get('major'), vi.get('minor'), vi.get('patch')) if self.copr_repo: self.MOCK_COPR_REPO_FILENAME = '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:barryascott:%s.repo' % ( self.copr_repo, ) if self.opt_mock_target is None: self.opt_mock_target = 'fedora-%d-%s' % (self.fedoraVersion(), platform.machine()) log.info('Defaulting --mock-target=%s' % (self.opt_mock_target, )) if self.copr_repo: self.COPR_REPO_URL = 'https://copr-be.cloud.fedoraproject.org/results/barryascott/%s/%s' % ( self.copr_repo, self.opt_mock_target) if self.copr_repo_other: self.COPR_REPO_OTHER_URL = 'https://copr-be.cloud.fedoraproject.org/results/barryascott/%s/%s' % ( self.copr_repo_other, self.opt_mock_target) if self.opt_release == 'auto': all_packages = package_list_repo.listRepo(self.COPR_REPO_URL) all_other_packages = package_list_repo.listRepo( self.COPR_REPO_OTHER_URL) package_ver = 0 other_package_ver = 0 if self.KITNAME in all_packages: ver, rel, build_time = all_packages[self.KITNAME] if ver == self.version: package_ver = int(rel.split('.')[0]) log.info('Release %d found in %s' % (package_ver, self.copr_repo)) if self.KITNAME in all_other_packages: ver, rel, build_time = all_other_packages[self.KITNAME] if ver == self.version: other_package_ver = int(rel.split('.')[0]) log.info('Release %d found in %s' % (package_ver, self.copr_repo_other)) self.opt_release = 1 + max(package_ver, other_package_ver) log.info('Release set to %d' % (self.opt_release, ))
def setupVars( self ): # expects to be run from the Builder folder self.BUILDER_TOP_DIR = os.path.abspath( '..' ) vi = self.readVersionInfo() self.version = '%s.%s.%s' % (vi.get( 'major' ), vi.get( 'minor' ), vi.get( 'patch' )) self.MOCK_COPR_REPO_FILENAME = '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:barryascott:%s.repo' % (self.copr_repo,) if self.opt_mock_target is None: self.opt_mock_target = 'fedora-%d-%s' % (self.fedoraVersion(), platform.machine()) log.info( 'Defaulting --mock-target=%s' % (self.opt_mock_target,) ) self.COPR_REPO_URL = 'https://copr-be.cloud.fedoraproject.org/results/barryascott/%s/%s' % (self.copr_repo, self.opt_mock_target) if self.opt_release == 'auto': all_packages = package_list_repo.listRepo( self.COPR_REPO_URL ) if self.KITNAME in all_packages: ver, rel, build_time = all_packages[ self.KITNAME ] if ver == self.version: self.opt_release = 1 + int( rel.split('.')[0] ) if self.opt_release == 'auto': self.opt_release = 1 log.info( 'Release set to %d' % (self.opt_release,) )
def listCopr( self ): all_packages = package_list_repo.listRepo( self.COPR_REPO_URL ) print( 'Packages for %s %s' % (self.copr_repo, self.opt_mock_target) ) now = time.time() for name in sorted( all_packages.keys() ): ver, rel, build_time = all_packages[ name ] build_age = self.formatTimeDelta( now - build_time ) build_time_str = time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime( build_time ) ) print( ' %30s: %-8s %-8s %s - %s' % (name, ver, rel, build_time_str, build_age ) )