This PR implements a tentative API for software management. It is still a WIP, but it serves as an indication of the direction we are following.
The entry point to the API is the SoftwareManager class, which offers an API to initialize the software stack, query for "resolvables" (packages and products), etc.
Potentially, it supports multiple backends. Support for libzypp is implemented as any other backend.
Classes like Package or Product should be backend-agnostic (not implemented yet).
It implements a rich query API (see SoftwareSearch), although it is far from being finished.
An example
require "y2packager/software_manager"
require "y2packager/libzypp_backend"
manager = Y2Packager::SoftwareManager.new
manager.probe # Initialize the software stack
query = manager.search.with(kind: :product)
query.each do |product|
puts product.name
end
# you can extend the query later
query.with(name: "SLES")
query.first&.name #=> "SLES"
Pending
[ ] PackageSearch:
[ ] Load all the attributes, including custom ones. See the existing Y2Packager::Resolvable class.
[ ] Allow searching for multiple states.
[ ] Offer a better way to define conditions (?)
[ ] Ad-hoc installation of packages/products
[ ] Implement the SoftwareProposal class and the corresponding SoftwareManager#commit method.
Coverage increased (+0.01%) to 41.23% when pulling 6af7e8b8b5d165619df2a4d9749b06f06be38dd7 on packager-ng-model into 25a8bb990c4b9e81d2af2c4a699288dd95f90900 on master.
This PR implements a tentative API for software management. It is still a WIP, but it serves as an indication of the direction we are following.
SoftwareManager
class, which offers an API to initialize the software stack, query for "resolvables" (packages and products), etc.Package
orProduct
should be backend-agnostic (not implemented yet).SoftwareSearch
), although it is far from being finished.An example
Pending
SoftwareProposal
class and the correspondingSoftwareManager#commit
method.