From Fedora Project Wiki
Depcheck process
What do we want from depcheck?
- Subsets of packages, which can be installed.
- Sets of 'uninstallable' packages, ideally with logs ;-)
- Ideally, we want to be able to do all the checks 'virtually' just using pkgdb & yum api (i.e. without performing an actual package installation)
Simple process
Data
- All_packages = dictionary of all packages in pending. Contains information about 'installability' (i.e. whether the package is at least in one installable subset)
- Runs = List of all packages 'installable' in that run
Data structures than can be imagined like this:
- All_packages = {package_name: {OK: None, was_first = False}, ...}
- Where OK is boolean indicating, whether the package
- None - package was not yet a part of any run
- True - was installed in some installable subset
- False - package had problems with installation
- Also for the OK, the update-path is None -> False -> True (i.e. None can change to both True or False, False can change to True, True can not be changed)
- was_first is a helper, to track whether the package was ever "at the start" of the installable subset creation. This is important for deciding when to end the depcheck process.
- Where OK is boolean indicating, whether the package
- Runs = [[package_name, ...], ...]
- Stores the installable subset of the respective run
Algorithm
- Filter packages from all_packages (let's call the output from this filter undecided)
- Take packages which have OK set to None or False
- Remove packages which have the was_first mutex set to True
- If undecided is empty:
- End Depcheck
- Pick random package from undecided
- Set the was_first mutex to True
- For each package in undecided (starting with the randomly selected package):
- Try to install the package
- If installation passed:
- update the all_packages[package]['OK'] to True
- If installation failed:
- update the all_packages[package]['OK'] to False (if previous state was True, than it is not updated)
Example
Let's have 'pending' packages A..F with these dependencies:
- A requires B
- A requires C
- A conflicts with D
- D requires C
- E has no dependencies at all
- F requires XYZ which is not present in any repo