[elbe-devel] [PATCH 2/2] elbexml: parse options from urls, and merge them properly

Olivier Dion dion at linutronix.de
Wed Jul 22 16:18:41 CEST 2020


On Wed, 22 Jul 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> the new noauth logic conflicts with [arch=armhf] options in
> urls.
>
> Fix that, by parsing them, and adding them to the generated options.
> This is probably going to be reverted for v12.6, because there
> is a new implementation on its way.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
>  elbepack/elbexml.py | 32 +++++++++++++++++++++++++-------
>  1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index bcfd2054a..ceeb2d36a 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -158,35 +158,53 @@ class ElbeXML(object):
>          if not self.prj.has("mirror") and not self.prj.has("mirror/cdrom"):
>              return "# no mirrors configured"
>  
> -        options = []
> +        global_options = []
> +        primary_options = []
>          if self.prj.has("noauth"):
> -            options.append("trusted=yes")
> +            global_options.append("trusted=yes")
>  
>          if hostsysroot:
>              arch = self.text("project/buildimage/sdkarch", key="sdkarch")
>          else:
>              arch = self.text("project/buildimage/arch", key="arch")
>  
> -        options.append("arch=%s" % arch)
> +        primary_options.append("arch=%s" % arch)
>  
>          mirror = []
>          if self.prj.has("mirror/primary_host"):
>              pmirror = self.get_primary_mirror(None, hostsysroot=hostsysroot)
>              mirror.append("deb [%s] %s %s main" %
> -                          (' '.join(options), pmirror, self.prj.text("suite")))
> +                          (' '.join(global_options+primary_options), pmirror, self.prj.text("suite")))
>  
>              if build_sources:
>                  mirror.append("deb-src [%s] %s %s main" %
> -                              (' '.join(options), pmirror, self.prj.text("suite")))
> +                              (' '.join(global_options+primary_options), pmirror, self.prj.text("suite")))
>  
>              if self.prj.has("mirror/url-list") and not hostsysroot:
>                  for url in self.prj.node("mirror/url-list"):
> +
>                      if url.has("binary"):
> +                        binurl = url.text("binary").strip()
> +                        m = re.match(r'\[(.*)\] (.*)', binurl)
> +
> +                        local_options = []
> +                        if m:
> +                            local_options.append(m.group(1))
> +                            binurl = m.group(2)
> +
>                          mirror.append("deb [%s] %s" %
> -                                      (' '.join(options), url.text("binary").strip()))
> +                                      (' '.join(global_options+local_options), binurl))
>                      if url.has("source"):
> +                        srcurl = url.text("source").strip()
> +                        m = re.match(r'\[(.*)\] (.*)', srcurl)
> +
> +                        local_options = []
> +                        if m:
> +                            local_options.append(m.group(2))

This should be m.group(1)

> +                            srcurl = m.group(2)
> +
>                          mirror.append("deb-src [%s] %s" %
> -                                      (' '.join(options), url.text("source").strip()))
> +                                      (' '.join(global_options+local_options), srcurl))
>  
>          if self.prj.has("mirror/cdrom"):
>              mirror.append("deb copy:///cdrom/targetrepo %s main added" %
> -- 
> 2.20.1
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen


More information about the elbe-devel mailing list