build: Cosmetic change
Yes, I don't like big "if" blocks.
This commit is contained in:
+30
-28
@@ -434,34 +434,36 @@ class Builder:
|
|||||||
pisi.file.File.download(uri, transferdir)
|
pisi.file.File.download(uri, transferdir)
|
||||||
|
|
||||||
def fetch_component(self):
|
def fetch_component(self):
|
||||||
if not self.spec.source.partOf:
|
if self.spec.source.partOf:
|
||||||
ctx.ui.info(_('PartOf tag not defined, looking for component'))
|
return
|
||||||
diruri = util.parenturi(self.specuri.get_uri())
|
|
||||||
parentdir = util.parenturi(diruri)
|
ctx.ui.info(_('PartOf tag not defined, looking for component'))
|
||||||
url = util.join_path(parentdir, 'component.xml')
|
diruri = util.parenturi(self.specuri.get_uri())
|
||||||
progress = ctx.ui.Progress
|
parentdir = util.parenturi(diruri)
|
||||||
if pisi.uri.URI(url).is_remote_file():
|
url = util.join_path(parentdir, 'component.xml')
|
||||||
try:
|
progress = ctx.ui.Progress
|
||||||
pisi.fetcher.fetch_url(url, self.pkg_work_dir(), progress)
|
if pisi.uri.URI(url).is_remote_file():
|
||||||
except pisi.fetcher.FetchError:
|
try:
|
||||||
ctx.ui.warning(_("Cannot find component.xml in remote "
|
pisi.fetcher.fetch_url(url, self.pkg_work_dir(), progress)
|
||||||
"directory, Source is now part of "
|
except pisi.fetcher.FetchError:
|
||||||
"unknown component"))
|
ctx.ui.warning(_("Cannot find component.xml in remote "
|
||||||
self.spec.source.partOf = 'unknown'
|
"directory, Source is now part of "
|
||||||
return
|
"unknown component"))
|
||||||
path = util.join_path(self.pkg_work_dir(), 'component.xml')
|
self.spec.source.partOf = 'unknown'
|
||||||
else:
|
return
|
||||||
if not os.path.exists(url):
|
path = util.join_path(self.pkg_work_dir(), 'component.xml')
|
||||||
ctx.ui.warning(_("Cannot find component.xml in upper "
|
else:
|
||||||
"directory, Source is now part of "
|
if not os.path.exists(url):
|
||||||
"unknown component"))
|
ctx.ui.warning(_("Cannot find component.xml in upper "
|
||||||
self.spec.source.partOf = 'unknown'
|
"directory, Source is now part of "
|
||||||
return
|
"unknown component"))
|
||||||
path = url
|
self.spec.source.partOf = 'unknown'
|
||||||
comp = component.CompatComponent()
|
return
|
||||||
comp.read(path)
|
path = url
|
||||||
ctx.ui.info(_('Source is part of %s component') % comp.name)
|
comp = component.CompatComponent()
|
||||||
self.spec.source.partOf = comp.name
|
comp.read(path)
|
||||||
|
ctx.ui.info(_('Source is part of %s component') % comp.name)
|
||||||
|
self.spec.source.partOf = comp.name
|
||||||
|
|
||||||
def fetch_source_archives(self):
|
def fetch_source_archives(self):
|
||||||
self.sourceArchives.fetch()
|
self.sourceArchives.fetch()
|
||||||
|
|||||||
Reference in New Issue
Block a user