Merge ~nteodosio/software-properties:deb822-apt-add into software-properties:ubuntu/master

Proposed by Nathan Teodosio
Status: Merged
Merge reported by: Nick Rosbrook
Merged at revision: 6f27c851e18b31d8da07a048ca2bebdf0b95afad
Proposed branch: ~nteodosio/software-properties:deb822-apt-add
Merge into: software-properties:ubuntu/master
Diff against target: 22 lines (+2/-2)
1 file modified
add-apt-repository (+2/-2)
Reviewer Review Type Date Requested Status
Nick Rosbrook Approve
Review via email: mp+464417@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nick Rosbrook (enr0n) wrote :

I have two thoughts on this.

First is that I am not positive that by enabling deb822=True, we won't introduce regressions in other parts of the code that are not deb822-aware yet. For that reason, it *might* be safer to re-init sources list with deb822=True in show_list() instead of using self.sourceslist. On the other hand, @juliank did a lot of work on python-apt since I first started writing deb822 support for things, so my concern might be unnecessary.

Second is that current output is a bit awkward with deb822 sources. For example, if I have the default Ubuntu sources on Noble, then I get:

$ add-apt-repository --list
deb http://us.archive.ubuntu.com/ubuntu/ noble noble-updates noble-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu noble-security main restricted universe multiverse

which kind of look like classic .list entries, but are invalid because they specify multiple suites. The same would happen if we had a deb822 source with Types: deb deb-src, or multiple URIs.

If the desire here *is* to list out deb822 sources as classic .list entries, then we need logic to do handle what I described above. Otherwise, I would just leave the print(s), and add a newline between deb822 sources.

review: Needs Fixing
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

> First is that I am not positive that by enabling deb822=True, we won't introduce regressions in other parts of the code that are not deb822-aware yet.

Sorry, I should have mentioned that I tested the other parts (and test_add_apt_repository.py also succeeded), but if I missed the multiple suites output in --list then that does puts the quality of my tests in doubt.

I went with your suggestions now, please have another look.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

Thanks, I think the conservative approach is good here. I think there is still some future work to be done in the future, e.g. the "merge" logic in show_list() doesn't work for deb822 sources. I don't consider that a blocker for this though, because I think it's better to at least have a semi-functional --list.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/add-apt-repository b/add-apt-repository
2index 985cae9..8dc338f 100755
3--- a/add-apt-repository
4+++ b/add-apt-repository
5@@ -362,7 +362,7 @@ class AddAptRepository(object):
6
7 def show_list(self):
8 merged = {}
9- for s in self.sourceslist:
10+ for s in SourcesList(deb822=True):
11 if s.invalid or s.disabled:
12 continue
13 if not self.enable_source and s.type == self.source_type:
14@@ -375,7 +375,7 @@ class AddAptRepository(object):
15 merged[k] = s
16
17 for s in merged.values():
18- print(s)
19+ print(s, '\n')
20
21 def main(self, args=sys.argv[1:]):
22 self.parse_args(args)

Subscribers

People subscribed via source and target branches