Merge ppa-dev-tools:add_repository_module into ppa-dev-tools:main
Status: | Merged |
---|---|
Merge reported by: | Bryce Harrington |
Merged at revision: | af638afc38955ecbd6d408add476d52dbd26a445 |
Proposed branch: | ppa-dev-tools:add_repository_module |
Merge into: | ppa-dev-tools:main |
Diff against target: |
186 lines (+174/-0) 2 files modified
ppa/repository.py (+119/-0) tests/test_repository.py (+55/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Athos Ribeiro (community) | Approve | ||
Canonical Server | Pending | ||
Canonical Server Reporter | Pending | ||
Review via email: mp+438168@code.staging.launchpad.net |
Description of the change
This introduces the first class for the soon-to-come rdepends feature. The Repository class is going to be responsible for creating and maintaining a 'lazy local mirror' of the Ubuntu apt repository, downloading information only as needed and caching it for performance.
For now, though, this only implements the bare bones, able to read an already-existing mirror and using it to generate the corresponding sub-objects - Suites. A suite represents what we sometimes term "release pockets", and are present in the directory structure as directory names like 'kinetic-backports' and 'feisty-updates'. A stub of the Suite class is included in this branch but only to give the Repository something to manage; a future branch will move Suite to its own module and flesh it out further. For purposes of this review you can mostly ignore Suite; I haven't made docs or tests for it, intentionally.
The test cases exercise most of the functionality, using temporary directories instead of a proper mirror. However, the module itself includes a built-in smoke test that can be run on a real mirror. (For development purposes, I've generated one using `apt-mirror`; you're welcome to do the same but beware it takes hours to create even the most minimal mirror.)
The class name 'Repository' I wonder if should be renamed, to avoid confusion with a git repository, which is probably what people would assume it referred to. Review advice/opinion welcome here.
---
The tests can be invoked via:
$ python-3 ./tests/
---
The module's smoketest can be invoked as well, via:
$ python-3 -m ppa.repository
However, the smoke test expects to run against an apt mirror. Below are the directions on the way I set this up for myself:
$ sudo apt-get install apt-mirror
Modify /etc/apt/
wish to mirror. For this validation test we'll only enable the devel
version's release and proposed pockets for the main component:
## /etc/apt/
set nthreads 20
set _tilde 0
deb http://
deb http://
deb-src http://
deb-src http://
clean http://
Make sure you have ample space to store everything, at least 25 GiB;
several times that if you want to pull anything more than what's
configured above.
Next, run the sync operation manually:
$ sudo /usr/bin/apt-mirror
Unfortunately, this takes a long time to run and consumes a lot of bandwidth. The bare minimum needed to test this specific branch, though, is just the directory structure, which you could create by hand:
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
/var/spool/
There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.
Thanks, Bryce!
This looks great. I really like how you covered the new parser with all those test cases :)
I added a few inline comments and questions below.