mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-04 14:43:38 +02:00
- convert tabs to spaces...
This commit is contained in:
24
osc/build.py
24
osc/build.py
@@ -63,7 +63,7 @@ class Buildinfo:
|
||||
|
||||
root = tree.getroot()
|
||||
|
||||
self.apiurl = apiurl
|
||||
self.apiurl = apiurl
|
||||
|
||||
if root.find('error') != None:
|
||||
sys.stderr.write('buildinfo is broken... it says:\n')
|
||||
@@ -632,18 +632,18 @@ def main(opts, argv):
|
||||
print 'Skipping verification of package signatures'
|
||||
else:
|
||||
print 'Verifying integrity of cached packages'
|
||||
t = config['api_host_options'][apiurl]['trusted_prj']
|
||||
for prj in bi.prjkeys:
|
||||
if not prj in t:
|
||||
print "\nYou are trying to use packages from project '%s'." % prj
|
||||
print "Note that malicious packages can compromise your system."
|
||||
t = config['api_host_options'][apiurl]['trusted_prj']
|
||||
for prj in bi.prjkeys:
|
||||
if not prj in t:
|
||||
print "\nYou are trying to use packages from project '%s'." % prj
|
||||
print "Note that malicious packages can compromise your system."
|
||||
# saving back to config file is complicated
|
||||
# r = raw_input("Would you like to trust '%s' (a)lways, (t)emorarily or (N)ever? " % prj)
|
||||
# if r == 'a':
|
||||
# config['api_host_options'][apiurl]['trusted_prj'] += prj
|
||||
# elif r != 't':
|
||||
# print "Well, good good bye then :-)"
|
||||
# sys.exit(1)
|
||||
# r = raw_input("Would you like to trust '%s' (a)lways, (t)emorarily or (N)ever? " % prj)
|
||||
# if r == 'a':
|
||||
# config['api_host_options'][apiurl]['trusted_prj'] += prj
|
||||
# elif r != 't':
|
||||
# print "Well, good good bye then :-)"
|
||||
# sys.exit(1)
|
||||
|
||||
verify_pacs([ i.fullfilename for i in bi.deps ], bi.keys)
|
||||
elif bi.pacsuffix == 'deb':
|
||||
|
@@ -394,9 +394,9 @@ class Osc(cmdln.Cmdln):
|
||||
query += "&name=" + args[0]
|
||||
url = makeurl(apiurl, ['source', project], query=query)
|
||||
f = http_POST(url)
|
||||
for p in meta_get_packagelist(apiurl, project):
|
||||
if p.startswith("_patchinfo:"):
|
||||
patchinfo = p
|
||||
for p in meta_get_packagelist(apiurl, project):
|
||||
if p.startswith("_patchinfo:"):
|
||||
patchinfo = p
|
||||
|
||||
if not os.path.exists(project_dir + "/" + patchinfo):
|
||||
checkout_package(apiurl, project, patchinfo, prj_dir=project_dir)
|
||||
@@ -738,38 +738,38 @@ class Osc(cmdln.Cmdln):
|
||||
# loop via all packages for checking their state
|
||||
for p in meta_get_packagelist(apiurl, project):
|
||||
if p.startswith("_patchinfo:"):
|
||||
pi.append(p)
|
||||
pi.append(p)
|
||||
else:
|
||||
# get _link info from server, who knows about the local state ...
|
||||
u = makeurl(apiurl, ['source', project, p])
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
linkinfo = root.find('linkinfo')
|
||||
if linkinfo == None:
|
||||
print "Package ", p, " is not a source link."
|
||||
sys.exit("This is currently not supported.")
|
||||
if linkinfo.get('error'):
|
||||
print "Package ", p, " is a broken source link."
|
||||
sys.exit("Please fix this first")
|
||||
t = linkinfo.get('project')
|
||||
if t:
|
||||
if len(root.findall('entry')) > 1: # This is not really correct, but should work mostly
|
||||
# Real fix is to ask the api if sources are modificated
|
||||
# but there is no such call yet.
|
||||
targetprojects.append(t)
|
||||
pac.append(p)
|
||||
print "Submitting package ", p
|
||||
else:
|
||||
print " Skipping package ", p
|
||||
else:
|
||||
print "Skipping package ", p, " since it is a source link pointing inside to the project."
|
||||
# get _link info from server, who knows about the local state ...
|
||||
u = makeurl(apiurl, ['source', project, p])
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
linkinfo = root.find('linkinfo')
|
||||
if linkinfo == None:
|
||||
print "Package ", p, " is not a source link."
|
||||
sys.exit("This is currently not supported.")
|
||||
if linkinfo.get('error'):
|
||||
print "Package ", p, " is a broken source link."
|
||||
sys.exit("Please fix this first")
|
||||
t = linkinfo.get('project')
|
||||
if t:
|
||||
if len(root.findall('entry')) > 1: # This is not really correct, but should work mostly
|
||||
# Real fix is to ask the api if sources are modificated
|
||||
# but there is no such call yet.
|
||||
targetprojects.append(t)
|
||||
pac.append(p)
|
||||
print "Submitting package ", p
|
||||
else:
|
||||
print " Skipping package ", p
|
||||
else:
|
||||
print "Skipping package ", p, " since it is a source link pointing inside to the project."
|
||||
|
||||
if not opts.yes:
|
||||
if pi:
|
||||
print "Submitting patchinfo ", ', '.join(pi), " to ", ', '.join(targetprojects)
|
||||
print "Submitting patchinfo ", ', '.join(pi), " to ", ', '.join(targetprojects)
|
||||
print "\nEverything fine? Can we create the requests ? [y/n]"
|
||||
if sys.stdin.read(1) != "y":
|
||||
sys.exit("Aborted...")
|
||||
sys.exit("Aborted...")
|
||||
|
||||
# loop via all packages to do the action
|
||||
for p in pac:
|
||||
|
@@ -627,10 +627,10 @@ def get_config(override_conffile = None,
|
||||
if not 'sslcertck' in api_host_options[apiurl]:
|
||||
api_host_options[apiurl]['sslcertck'] = True
|
||||
|
||||
if cp.has_option(url, 'trusted_prj'):
|
||||
api_host_options[apiurl]['trusted_prj'] = cp.get(url, key).split(' ')
|
||||
else:
|
||||
api_host_options[apiurl]['trusted_prj'] = []
|
||||
if cp.has_option(url, 'trusted_prj'):
|
||||
api_host_options[apiurl]['trusted_prj'] = cp.get(url, key).split(' ')
|
||||
else:
|
||||
api_host_options[apiurl]['trusted_prj'] = []
|
||||
|
||||
# add the auth data we collected to the config dict
|
||||
config['api_host_options'] = api_host_options
|
||||
|
42
osc/fetch.py
42
osc/fetch.py
@@ -26,7 +26,7 @@ def join_url(self, base_url, rel_url):
|
||||
|
||||
class Fetcher:
|
||||
def __init__(self, cachedir = '/tmp', api_host_options = {}, urllist = [], http_debug = False,
|
||||
cookiejar = None, offline = False, enable_cpio = False):
|
||||
cookiejar = None, offline = False, enable_cpio = False):
|
||||
|
||||
__version__ = '0.1'
|
||||
__user_agent__ = 'osbuild/%s' % __version__
|
||||
@@ -38,13 +38,13 @@ class Fetcher:
|
||||
self.progress_obj = None
|
||||
|
||||
|
||||
self.nopac = False
|
||||
self.nopac = False
|
||||
self.cachedir = cachedir
|
||||
self.urllist = urllist
|
||||
self.http_debug = http_debug
|
||||
self.offline = offline
|
||||
self.cpio = {}
|
||||
self.enable_cpio = enable_cpio
|
||||
self.enable_cpio = enable_cpio
|
||||
|
||||
passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
for host in api_host_options.keys():
|
||||
@@ -65,9 +65,9 @@ class Fetcher:
|
||||
|
||||
#log(0, '%s: %s' % (errobj.url, str(errobj.exception)))
|
||||
#log(0, 'Trying other mirror.')
|
||||
if not self.nopac:
|
||||
print 'Trying openSUSE Build Service server for %s (%s), since it is not on %s.' \
|
||||
% (self.curpac, self.curpac.project, errobj.url.split('/')[2])
|
||||
if not self.nopac:
|
||||
print 'Trying openSUSE Build Service server for %s (%s), since it is not on %s.' \
|
||||
% (self.curpac, self.curpac.project, errobj.url.split('/')[2])
|
||||
raise errobj.exception
|
||||
|
||||
|
||||
@@ -201,16 +201,16 @@ class Fetcher:
|
||||
os.unlink(tmpfile)
|
||||
|
||||
self.nopac = True
|
||||
prjs = buildinfo.projects.keys()
|
||||
prjs = buildinfo.projects.keys()
|
||||
for i in prjs:
|
||||
dest = "%s/%s" % (self.cachedir, i)
|
||||
if not os.path.exists(dest):
|
||||
os.makedirs(dest, mode=0755)
|
||||
dest += '/_pubkey'
|
||||
os.makedirs(dest, mode=0755)
|
||||
dest += '/_pubkey'
|
||||
|
||||
if os.path.exists(dest):
|
||||
buildinfo.keys.append(dest)
|
||||
buildinfo.prjkeys.append(i)
|
||||
buildinfo.prjkeys.append(i)
|
||||
else:
|
||||
url = "%s/source/%s/_pubkey" % (buildinfo.apiurl, i)
|
||||
try:
|
||||
@@ -224,16 +224,16 @@ class Fetcher:
|
||||
os.unlink(dest)
|
||||
sys.exit(0)
|
||||
except URLGrabError, e:
|
||||
if self.http_debug:
|
||||
print "can't fetch key for %s: %s" %(i, e.strerror)
|
||||
print "url: %s" % url
|
||||
else:
|
||||
print "%s doesn't have a gpg key" % i
|
||||
if self.http_debug:
|
||||
print "can't fetch key for %s: %s" %(i, e.strerror)
|
||||
print "url: %s" % url
|
||||
else:
|
||||
print "%s doesn't have a gpg key" % i
|
||||
|
||||
l = i.rsplit(':', 1)
|
||||
# try key from parent project
|
||||
l = i.rsplit(':', 1)
|
||||
# try key from parent project
|
||||
if len(l) > 1 and l[1] and not l[0] in buildinfo.projects:
|
||||
prjs.append(l[0])
|
||||
prjs.append(l[0])
|
||||
|
||||
self.nopac = False
|
||||
|
||||
@@ -318,7 +318,7 @@ def verify_pacs(pac_list, key_list):
|
||||
return
|
||||
|
||||
if not key_list:
|
||||
print "no keys"
|
||||
print "no keys"
|
||||
sys.exit(1)
|
||||
return
|
||||
|
||||
@@ -328,7 +328,7 @@ def verify_pacs(pac_list, key_list):
|
||||
failed = False
|
||||
checker = checker.Checker()
|
||||
try:
|
||||
checker.readkeys(key_list)
|
||||
checker.readkeys(key_list)
|
||||
for pkg in pac_list:
|
||||
try:
|
||||
checker.check(pkg)
|
||||
@@ -336,7 +336,7 @@ def verify_pacs(pac_list, key_list):
|
||||
failed = True
|
||||
print pkg, ':', e
|
||||
except Exception, e:
|
||||
print str(e)
|
||||
print str(e)
|
||||
checker.cleanup()
|
||||
sys.exit(1)
|
||||
|
||||
|
@@ -66,7 +66,7 @@ class TrustedCertStore:
|
||||
# connection will be aborted later if it needs to
|
||||
def verify_cb(ctx, ok, store):
|
||||
if not ctx.verrs:
|
||||
ctx.verrs = ValidationErrors()
|
||||
ctx.verrs = ValidationErrors()
|
||||
|
||||
try:
|
||||
if not ok:
|
||||
|
Reference in New Issue
Block a user