self.pacs_missing = [ i for i in self.pacs_available if i not in self.pacs_have ]
def wc_check(self):
- global store
dirty_files = []
req_storefiles = Project.REQ_STOREFILES
if conf.config['do_package_tracking']:
return dirty_files
def wc_repair(self, apiurl=None):
- global store
if not os.path.exists(os.path.join(self.dir, store, '_apiurl')) or apiurl:
if apiurl is None:
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
Returns an ``xml.etree.cElementTree`` object representing the
parsed contents of the project's ``.osc/_packages`` XML file.
"""
- global store
+
packages_file = os.path.join(self.absdir, store, '_packages')
if os.path.isfile(packages_file) and os.path.getsize(packages_file):
@staticmethod
def init_project(apiurl, dir, project, package_tracking=True, getPackageList=True, progress_obj=None, wc_check=True):
- global store
if not os.path.exists(dir):
# use makedirs (checkout_no_colon config option might be enabled)
'_size_limit', '_commit_msg')
def __init__(self, workingdir, progress_obj=None, size_limit=None, wc_check=True):
- global store
self.dir = workingdir
self.absdir = os.path.abspath(self.dir)
return i
def get_status(self, excluded=False, *exclude_states):
- global store
todo = self.todo
if not todo:
todo = self.filenamelist + self.to_be_added + \
@staticmethod
def init_package(apiurl, project, package, dir, size_limit=None, meta=False, progress_obj=None):
- global store
if not os.path.exists(dir):
os.mkdir(dir)
def is_project_dir(d):
- global store
-
return os.path.exists(os.path.join(d, store, '_project')) and not \
os.path.exists(os.path.join(d, store, '_package'))
def is_package_dir(d):
- global store
-
return os.path.exists(os.path.join(d, store, '_project')) and \
os.path.exists(os.path.join(d, store, '_package'))
"""Parse a disturl, returns tuple (apiurl, project, source, repository,
revision), else raises an oscerr.WrongArgs exception
"""
-
- global DISTURL_RE
-
m = DISTURL_RE.match(disturl)
if not m:
raise oscerr.WrongArgs("`%s' does not look like disturl" % disturl)
"""Parse a build log url, returns a tuple (apiurl, project, package,
repository, arch), else raises oscerr.WrongArgs exception"""
- global BUILDLOGURL_RE
-
m = BUILDLOGURL_RE.match(buildlogurl)
if not m:
raise oscerr.WrongArgs('\'%s\' does not look like url with a build log' % buildlogurl)
def read_filemeta(dir):
- global store
msg = '\'%s\' is not a valid working copy.' % dir
filesmeta = os.path.join(dir, store, '_files')
return r
def store_readlist(dir, name):
- global store
r = []
if os.path.exists(os.path.join(dir, store, name)):
return store_readlist(dir, '_to_be_deleted')
def read_sizelimit(dir):
- global store
r = None
fname = os.path.join(dir, store, '_size_limit')
def check_store_version(dir):
- global store
versionfile = os.path.join(dir, store, '_osclib_version')
try:
create_new=True,
apiurl=None):
- global metatypes
-
if not apiurl:
apiurl = conf.config['apiurl']
url = make_meta_url(metatype, path_args, apiurl)
return data
def make_meta_url(metatype, path_args=None, apiurl=None, force=False, remove_linking_repositories=False):
- global metatypes
-
if not apiurl:
apiurl = conf.config['apiurl']
if metatype not in metatypes.keys():
change_is_required=False,
apiurl=None):
- global metatypes
-
if not apiurl:
apiurl = conf.config['apiurl']
if not data:
def download(url, filename, progress_obj = None, mtime = None):
import tempfile, shutil
- global BUFSIZE
o = None
try:
#if not os.path.exists(file):
#return None
- global BUFSIZE
-
try:
import hashlib
md5 = hashlib
if not buf: break
s.update(buf)
return s.hexdigest()
- f.close()
+ # f.close()
def binary(s):
import difflib
- global store
-
if not oldfilename:
oldfilename = filename
return r
-def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[], arch=[], oldstate=None):
+def show_results_meta(apiurl=None, prj=None, package=None, lastbuild=None, repository=[], arch=[], oldstate=None):
query = {}
if package:
query['package'] = package
return f.readlines()
-def get_package_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], oldstate=None):
+def get_package_results(apiurl=None, prj=None, package=None, lastbuild=None, repository=[], arch=[], oldstate=None):
""" return a package results as a list of dicts """
r = []
"""apply selected format on each dict in results and return it as a list of strings"""
return [format % r for r in results]
-def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], verbose=False, wait=False, printJoin=None):
+def get_results(apiurl=None, prj=None, package=None, lastbuild=None, repository=[], arch=[], verbose=False, wait=False, printJoin=None):
r = []
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
oldstate = None
def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=None, name_filter=None, arch=None, repo=None, vertical=None, show_excluded=None):
#print '----------------------------------------'
- global buildstatus_symbols
r = []
def store_read_project(dir):
- global store
-
try:
p = open(os.path.join(dir, store, '_project')).readlines()[0].strip()
except IOError:
def store_read_package(dir):
- global store
-
try:
p = open(os.path.join(dir, store, '_package')).readlines()[0].strip()
except IOError:
return p
def store_read_apiurl(dir, defaulturl=True):
- global store
-
fname = os.path.join(dir, store, '_apiurl')
try:
url = open(fname).readlines()[0].strip()
return apiurl
def store_write_string(dir, file, string, subdir=''):
- global store
-
if subdir and not os.path.isdir(os.path.join(dir, store, subdir)):
os.mkdir(os.path.join(dir, store, subdir))
fname = os.path.join(dir, store, subdir, file)
store_write_string(dir, '_apiurl', apiurl + '\n')
def store_unlink_file(dir, file):
- global store
-
try: os.unlink(os.path.join(dir, store, file))
except: pass
def store_read_file(dir, file):
- global store
-
try:
content = open(os.path.join(dir, store, file)).read()
return content
return None
def store_write_initial_packages(dir, project, subelements):
- global store
-
fname = os.path.join(dir, store, '_packages')
root = ET.Element('project', name=project)
for elem in subelements:
"""
prj_dir, pac_dir = getPrjPacPaths(pathname)
if is_project_dir(prj_dir):
- global store
+
if not os.path.exists(pac_dir+store):
prj = prj_obj or Project(prj_dir, False)
Package.init_package(prj.apiurl, prj.name, pac_dir, pac_dir)