Example #1
0
    def fetch_component(self):
        if self.spec.source.partOf:
            return

        diruri = util.parenturi(self.specuri.get_uri())
        parentdir = util.parenturi(diruri)
        url = util.join_path(parentdir, 'component.xml')
        progress = ctx.ui.Progress
        if pisi.uri.URI(url).is_remote_file():
            try:
                pisi.fetcher.fetch_url(url, self.pkg_work_dir(), progress)
            except pisi.fetcher.FetchError:
                ctx.ui.warning(_("Cannot find component.xml in remote "
                                 "directory, Source is now part of "
                                 "unknown component"))
                self.spec.source.partOf = 'unknown'
                return
            path = util.join_path(self.pkg_work_dir(), 'component.xml')
        else:
            if not os.path.exists(url):
                ctx.ui.warning(_("Cannot find component.xml in upper "
                                 "directory, Source is now part of "
                                 "unknown component"))
                self.spec.source.partOf = 'unknown'
                return
            path = url
        comp = component.CompatComponent()
        comp.read(path)
        self.spec.source.partOf = comp.name
Example #2
0
    def fetch_component(self):
        if self.spec.source.partOf:
            return

        diruri = util.parenturi(self.specuri.get_uri())
        parentdir = util.parenturi(diruri)
        url = util.join_path(parentdir, 'component.xml')
        progress = ctx.ui.Progress
        if pisi.uri.URI(url).is_remote_file():
            try:
                pisi.fetcher.fetch_url(url, self.pkg_work_dir(), progress)
            except pisi.fetcher.FetchError:
                ctx.ui.warning(
                    _("Cannot find component.xml in remote "
                      "directory, Source is now part of "
                      "unknown component"))
                self.spec.source.partOf = 'unknown'
                return
            path = util.join_path(self.pkg_work_dir(), 'component.xml')
        else:
            if not os.path.exists(url):
                ctx.ui.warning(
                    _("Cannot find component.xml in upper "
                      "directory, Source is now part of "
                      "unknown component"))
                self.spec.source.partOf = 'unknown'
                return
            path = url
        comp = component.CompatComponent()
        comp.read(path)
        self.spec.source.partOf = comp.name
Example #3
0
 def fetch_component(self):
     if not self.spec.source.partOf:
         ctx.ui.warning(_('PartOf tag not defined, looking for component'))
         diruri = parenturi(self.specuri.get_uri())
         parentdir = parenturi(diruri)
         url = util.join_path(parentdir, 'component.xml')
         progress = ctx.ui.Progress
         if URI(url).is_remote_file():
             fetch_url(url, self.pkg_work_dir(), progress)
             path = util.join_path(self.pkg_work_dir(), 'component.xml')
         else:
             if not os.path.exists(url):
                 raise Exception(_('Cannot find component.xml in upper directory'))
             path = url
         comp = component.Component()
         comp.read(path)
         ctx.ui.info(_('Source is part of %s component') % comp.name)
         self.spec.source.partOf = comp.name
Example #4
0
 def fetch_component(self):
     if not self.spec.source.partOf:
         ctx.ui.warning(_('PartOf tag not defined, looking for component'))
         diruri = parenturi(self.specuri.get_uri())
         parentdir = parenturi(diruri)
         url = util.join_path(parentdir, 'component.xml')
         progress = ctx.ui.Progress
         if URI(url).is_remote_file():
             fetch_url(url, self.pkg_work_dir(), progress)
             path = util.join_path(self.pkg_work_dir(), 'component.xml')
         else:
             if not os.path.exists(url):
                 raise Exception(
                     _('Cannot find component.xml in upper directory'))
             path = url
         comp = component.Component()
         comp.read(path)
         ctx.ui.info(_('Source is part of %s component') % comp.name)
         self.spec.source.partOf = comp.name
         self.spec.override_tags()