[elbe-devel] [PATCH v2 2/4] cdroms: Add class SrcMananager
Torben Hohn
torben.hohn at linutronix.de
Fri May 8 09:10:30 CEST 2020
On Mon, May 04, 2020 at 01:42:01PM -0400, Olivier Dion wrote:
> The source manager manage a dictionary of packages with their versions and
> components.
Hmmm... i dont quite understand the purpose if this.
This basically is functionality, that reprepro also has.
You can just add some dsc file to a component...
Why do we need to save this information before we actually create
the repository ?
Also, the name is misleading :)
This object does not manage anything, its basically just a
Dict[ Tuple[str,str], Set[str]] with an added set of forbidden names.
Note that you have implemented Dict[str, Dict[str, List[str]]]
but thats just a superset of the above type ;)
>
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
> elbepack/cdroms.py | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
> index 669c3c78..ed8730fc 100644
> --- a/elbepack/cdroms.py
> +++ b/elbepack/cdroms.py
> @@ -25,6 +25,31 @@ from elbepack.isooptions import get_iso_options
>
> CDROM_SIZE = 640 * 1000 * 1000
>
> +class SrcManager(object):
> +
> + def __init__(self):
> + self.pkgs = {}
> + self.forbid = set()
> +
> + def __iter__(self):
> + for pkg in self.pkgs:
> + for version in self.pkgs[pkg]:
> + for component in self.pkgs[pkg][version]:
> + yield (pkg, version, component)
> +
> + def add_pkg(self, name, version, component):
> + if name in self.forbid:
> + return
> + if name in self.pkgs:
> + if version not in self.pkgs[name]:
> + self.pkgs[name][version] = [component]
> + else:
> + self.pkgs[name][version].append(component)
> + else:
> + self.pkgs[name] = {version: [component]}
> +
> + def forbid_pkg(self, name):
> + self.forbid.add(name)
>
> def mk_source_cdrom(rfs, arch, codename, init_codename, target,
> cdrom_size=CDROM_SIZE, xml=None):
> --
> 2.26.2
>
>
> _______________________________________________
> 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