Commit graph

12 commits

Author SHA1 Message Date
Rohan McGovern
97a28fb7b1 Ensure directories appear first in listings [RHELDST-21890]
Directories are generally expected to be listed first in directory
indexes. That was already working for yum and file repos, but wasn't the
case for kickstart repos due to their combination of different types of
content.

This commit applies a consistent sorting so that directories will always
come first, and entries will otherwise be sorted by name, for all repo
types.
2024-01-12 08:48:42 +10:00
Rohan McGovern
eac74ec1e4 Further reduce memory usage on large yum repos [RHELDST-20453]
The Fetcher type was designed to return a 'str'.
That wasn't a good idea because it implies that every fetched file must
be loaded into memory completely. On certain large yum repos,
decompressed primary XML can be hundreds of MB, and it's not appropriate
to require loading that all into memory at once.

Make it support a file-like object (stream of bytes). Since the SAX
XML parser supports reading from a stream, this makes it possible to
avoid loading everything into memory at once.

A test of repo-autoindex CLI against
/content/dist/rhel/server/7/7Server/x86_64/os showed major
improvement:

- before: ~1200MiB
- after:    ~80MiB

Note that achieving the full improvement requires any downstream users
of the library (e.g. exodus-gw) to update their Fetcher implementation
as well, to stop returning a 'str'.
2023-09-21 11:05:21 +10:00
Caleigh Runge-Hottman
6a58f13963 Add support for AppStream kickstart repos [RHELDST-14528]
AppStream kickstart repos were missing from the initial collection
of repos used to test the kickstart repo index functionality. AppStream
repos uniquely do not contain "checksums" sections in their treeinfo
files. So, when attempting to run repo-autoindex against an AppStream
kickstart repo, "KeyError: 'checksums'" was raised.

Now, when encountering an AppStream kickstart repo, repo-autoindex
does not attempt to parse the "checksums" section.
2023-04-06 10:17:21 -04:00
Caleigh Runge-Hottman
b284ddbd9f Generate kickstart repo index [RHELDST-14528]
Due to the presence of a "repodata/repomd.xml" path in a kickstart
repo, repo-autoindex previously interpreted kickstart repos as yum
repos. As such, a kickstart repo's index would solely consist of two
directories: "Packages" and "repodata".

While a kickstart repo does contain a yum repo, kickstart repos also
contain two additional repo entry points: treeinfo and extra_files.json.
Each entry point references additional files that should be included
in a kickstart repo's index. These files were previously ignored.

Now, when repo-autoindex encounters a kickstart repo, repo-autoindex
produces a repo index that reflects the content referenced in all
three repo entry points (repomd.xml, treeinfo, extra_files.json).
2023-03-31 17:53:57 -04:00
Rohan McGovern
293f5887b7 Implement error handling
Ultimately, all errors are propagated in some way, but it's important to
differentiate between "the content was invalid" vs "failed to fetch the
content".
2022-08-09 08:51:06 +10:00
Rohan McGovern
90b746caee Add PULP_MANIFEST support 2022-08-08 13:45:50 +10:00
Rohan McGovern
f258eee451 Raise coverage to 100% 2022-08-03 10:53:55 +10:00
Rohan McGovern
52ec5f195b Add a test running entire command 2022-08-02 16:45:24 +10:00
Rohan McGovern
c4fd70e240 Add a test for text elision 2022-08-02 16:41:46 +10:00
Rohan McGovern
fbd3cb37ec Add a test which renders a yum repo 2022-07-07 14:04:18 +10:00
Rohan McGovern
787ba01a0e Rearrange sources to keep API separate, add a real test 2022-07-07 13:20:43 +10:00
Rohan McGovern
05c6bd14be Add some basic tests & CI setup 2022-06-29 15:52:00 +10:00