← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~pelpsi/launchpad-buildd:deb822-support into launchpad-buildd:master

 


Diff comments:

> diff --git a/lpbuildd/target/apt.py b/lpbuildd/target/apt.py
> index 3f9ddca..d99e041 100644
> --- a/lpbuildd/target/apt.py
> +++ b/lpbuildd/target/apt.py
> @@ -28,12 +89,28 @@ class OverrideSourcesList(Operation):
>  
>      def run(self):
>          logger.info("Overriding sources.list in build-%s", self.args.build_id)
> -        with self.backend.open(
> -            "/etc/apt/sources.list", mode="w+"
> -        ) as sources_list:
> -            for archive in self.args.archives:
> -                print(archive, file=sources_list)
> -            os.fchmod(sources_list.fileno(), 0o644)
> +        if os.path.exists("/etc/apt/sources.list.d"):

.sources files are always supported, right ?

> +            with self.backend.open(
> +                "/etc/apt/sources.list.d/ubuntu.sources", mode="w+"

Yep, it makes sense. I think we should also remove sources.list if exists.

> +            ) as sources_list:
> +                for archive in self.args.archives:
> +                    source = prepare_source(archive)
> +                    for key, value in source.items():
> +                        if isinstance(value, str):
> +                            sources_list.write("{}: {}\n".format(key, value))
> +                        else:
> +                            sources_list.write(
> +                                "{}: {}\n".format(key, ' '.join(value))
> +                            )
> +                    sources_list.write("\n")
> +                os.fchmod(sources_list.fileno(), 0o644)
> +        else:
> +            with self.backend.open(
> +                "/etc/apt/sources.list", mode="w+"
> +            ) as sources_list:
> +                for archive in self.args.archives:
> +                    print(archive, file=sources_list)
> +                os.fchmod(sources_list.fileno(), 0o644)
>          with self.backend.open(
>              "/etc/apt/apt.conf.d/99retries", mode="w+"
>          ) as apt_retries_conf:


-- 
https://code.launchpad.net/~pelpsi/launchpad-buildd/+git/launchpad-buildd/+merge/473136
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad-buildd:deb822-support into launchpad-buildd:master.



References