[elbe-devel] [PATCH 2/4] elbexml: Handle mirror's options

Torben Hohn torben.hohn at linutronix.de
Wed Jul 15 13:07:39 CEST 2020


On Tue, Jun 30, 2020 at 12:05:17PM -0400, Olivier Dion wrote:
> This also remove the global 'noauth'.  It should be passed as a
> <option> tag instead for individual mirror.

You remove noauth, and dont remove it from dbsfed.xsd
This also breaks the current support for 

<binary> [arch=amd64] http://LOCALMACHINE/custom/xxx_amd64_qtrepo jessie main </binary>

which is used by some projects.

We can break old features, but i want a deprecation phase, in which the
proprocessor supports this.


we also need these option on <binary> tags.


when multiarch is used, we get problems, when a repo does not contain
armhf packages, and is not marked with [arch=amd64] 


i am still puzzled, whether its no easier, to just

add <primary_options>arch=amd64 trusted=yes</primary_options>

and just parse the url, so that we can a trusted=yes when no auth is
used.





> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  elbepack/elbexml.py | 53 +++++++++++++++++++++++++++++++--------------
>  1 file changed, 37 insertions(+), 16 deletions(-)
> 
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index 6496e442..2a9e6fff 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -149,39 +149,60 @@ class ElbeXML(object):
>  
>      # XXX: maybe add cdrom path param ?
>      def create_apt_sources_list(self, build_sources=False, initvm=True):
> +
>          if self.prj is None:
>              return "# No Project"
>  
>          if not self.prj.has("mirror") and not self.prj.has("mirror/cdrom"):
> -            return "# no mirrors configured"
> +            return "# No mirrors configured"
>  
> -        noauth = ""
> -        if self.prj.has("noauth"):
> -            noauth = "[trusted=yes] "
> +        mirrors = []
>  
> -        mirror = ""
>          if self.prj.has("mirror/primary_host"):
> -            mirror += "deb " + noauth + self.get_primary_mirror(None)
> -            mirror += " " + self.prj.text("suite") + " main\n"
> +
> +            if self.prj.has("mirror/options"):
> +                poptions = "[ %s ]" % ' '.join([opt.et.text.strip(' \t\n')
> +                                                for opt
> +                                                in self.prj.all("mirror/options/option")])
> +            else:
> +                poptions = ""
> +
> +            pmirror = self.get_primary_mirror(None)
> +            suite   = self.prj.text("suite")
> +
> +            mirrors.append("deb %s %s %s main" %
> +                           (poptions, pmirror, suite))
>  
>              if build_sources:
> -                mirror += "deb-src " + noauth + self.get_primary_mirror(None)
> -                mirror += " " + self.prj.text("suite") + " main\n"
> +                mirrors.append("deb-src %s %s %s main" %
> +                               (poptions, pmirror, suite))
>  
>              if self.prj.has("mirror/url-list"):
> +
>                  for url in self.prj.node("mirror/url-list"):
> +
> +                    if url.has("options"):
> +                        options = "[ %s ]" % ' '.join([opt.et.text.strip(' \t\n')
> +                                                       for opt
> +                                                       in url.all("options/option")])
> +                    else:
> +                        options = ""
> +
>                      if url.has("binary"):
> -                        mirror += "deb " + noauth + \
> -                                   url.text("binary").strip() + "\n"
> +                        bin_url = url.text("binary").strip()
> +                        mirrors.append("deb %s %s" %
> +                                       (options, bin_url))
> +
>                      if url.has("source"):
> -                        mirror += "deb-src " + noauth + \
> -                            url.text("source").strip() + "\n"
> +                        src_url = url.text("source").strip()
> +                        mirrors.append("deb-src %s %s" %
> +                                       (options, src_url))
>  
>          if self.prj.has("mirror/cdrom"):
> -            mirror += "deb copy:///cdrom/targetrepo %s main added\n" % (
> -                self.prj.text("suite"))
> +            mirrors.append("deb copy:///cdrom/targetrepo %s main added" %
> +                           self.prj.text("suite"))
>  
> -        return replace_localmachine(mirror, initvm)
> +        return replace_localmachine('\n'.join(mirrors), initvm)
>  
>      @staticmethod
>      def validate_repo(r):
> -- 
> 2.27.0
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner


More information about the elbe-devel mailing list