[elbe-devel] [PATCH] Enable usage of APT sources without components
Torben Hohn
torben.hohn at linutronix.de
Wed Jun 16 09:51:10 CEST 2021
On Wed, Jun 09, 2021 at 11:26:13AM +0000, Braunwarth, Daniel wrote:
> According to the APT sources manual [1] it is valid to define a sources
> entry without any given component:
>
> deb [ option1=value1 option2=value2 ] uri suite [component1] [...]
>
> This is, for instance, how repositories hosted by mini-dinstall [2]
> must to be configured.
>
> For example a valid sources entry for a mini-dinstall repository would
> be:
>
> deb http://dummy.foo/bar buster/
>
> Without this patch, such a sources entry causes a IndexError.
>
> [1] https://manpages.debian.org/buster/apt/sources.list
> [2] https://manpages.debian.org/buster/mini-dinstall/mini-dinstall
>
> Signed-off-by: Daniel Braunwarth <daniel.braunwarth at kuka.com>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/elbexml.py | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index 610880ea2..3234af06b 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -280,7 +280,6 @@ class ElbeXML:
> lsplit = line.split(" ")
> url = lsplit[1]
> suite = lsplit[2]
> - section = lsplit[3]
> r = {}
>
> #
> @@ -294,10 +293,23 @@ class ElbeXML:
> else:
> r["url"] = "%s/dists/%s/" % (url, suite)
>
> - if line.startswith("deb "):
> - r["binstr"] = (section + "/binary-%s/Packages" % arch)
> - else:
> - r["srcstr"] = (section + "/source/Sources")
> + #
> + # Try to get sections.
> + # If no sections has been passed, this is also valid syntax but
> + # needs some special handling.
> + #
> + try:
> + section = lsplit[3]
> + if line.startswith("deb "):
> + r["binstr"] = (section + "/binary-%s/Packages" % arch)
> + else:
> + r["srcstr"] = (section + "/source/Sources")
> + except IndexError:
> + if line.startswith("deb "):
> + r["binstr"] = "Packages"
> + else:
> + r["srcstr"] = "Sources"
> +
> repos.append(r)
>
> if not self.prj:
> --
> 2.32.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