Skip to content

many: initial read-only deb822 sources support - #275

Merged
mvo5 merged 6 commits into
masterfrom
deb822-2
Sep 6, 2026
Merged

many: initial read-only deb822 sources support#275
mvo5 merged 6 commits into
masterfrom
deb822-2

Conversation

@mvo5

@mvo5 mvo5 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

This PR adds some tweaks/work for the deb822 sources reading work in #274 and #150 and start with read-only support.


rsources: use libapt GetListOfFilesInDir instead of reimplmenting

Lets use apts GetListOfFilesInDir() instead of our own version
of it. Also add the beginging of tests around this which we will
need for the deb822 reading (gtest based).

Thanks to tzh476 and aybanda, who inspired this via PR#274 and
PR#150.


rsources: add a read-only version of deb822 parsing

To read apt's deb822 source records we now use libapt's pkgTagFile
and parse into our own SourceRecords. However we start with read
only support for now to keep the diff smaller.

Thanks to tzh476 and aybanda for the work on this in PR #274 and
PR #150. The test fixtures are taken from tzh476's tests in PR #274.

Co-authored-by: Stephen Smith tzh476@users.noreply.github.com


gtk: fix grayed out list view entries


gtk: add hint in rgrepositorywin.cc that deb822 is not
editable

To avoid confusion this adds a hint in the repostiory dialog that
deb822 files are not editable yet. It also shows for one-line
sources what file they belong to.

@tzh476

tzh476 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

One review note on the deb822 URI path.

Skipping SetURI() for multi-value URIs is right, but SetURI() does three things and only one is multi-value-specific:

S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
if (URI[URI.size() - 1] != '/') URI += '/';

sources.list(5) documents $(ARCH) inside the deb822 section, so a user can write it in a .sources file. Since rgrepositorywin.cc:473 displays URI directly, the same repository shows the expanded value from a .list and the literal $(ARCH) from a .sources.

Suggested, keeping the multi-value semantics:

auto parts = FindMultiValue(Sec, "URIs");
for (auto &p : parts) {
   p = SubstVar(p, "$(ARCH)", _config->Find("APT::Architecture"));
   p = SubstVar(p, "$(VERSION)", _config->Find("APT::DistroVersion"));
}
rec.URI = APT::String::Join(parts, " ");

I left trailing-slash normalisation out: apt gives "suite must end with a slash" its own exact-path meaning, and I am not sure adding it here is correct.

Caveat on how I checked this: I reproduced both code paths in Python from the C++. I could not build or run the test suite (libapt is Debian-only, this is macOS), so I have not seen synaptic read a .sources file.

@mvo5
mvo5 force-pushed the deb822-2 branch 3 times, most recently from 4b48ca6 to 3505e04 Compare September 6, 2026 08:05
mvo5 and others added 6 commits September 6, 2026 10:14
$(VERSION) came from apt-rpm's APT::DistroVersion, which Debian apt
never sets or expands. Debian's build explicitly conflicts with librpm-dev,
so nothing has used it in years; apt only knows $(ARCH) here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Lets use apts GetListOfFilesInDir() instead of our own version
of it. Also add the beginging of tests around this which we will
need for the deb822 reading (gtest based).

Thanks to tzh476 and aybanda, who inspired this via PR#274 and
PR#150.
To read apt's deb822 source records we now use libapt's pkgTagFile
and parse into our own SourceRecords. However we start with read
only support for now to keep the diff smaller.

Thanks to tzh476 and aybanda for the work on this in PR #274 and
PR #150. The test fixtures are taken from tzh476's tests in PR #274.

Co-authored-by: Stephen Smith <tzh476@users.noreply.github.com>
To avoid confusion this adds a hint in the repostiory dialog that
deb822 files are not editable yet. It also shows for one-line
sources what file they belong to.
Now that we use meson it is probably better to provide
some basic instructions as its not as well-known as
autotools.
@mvo5
mvo5 merged commit 9f4fecd into master Sep 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants