SubconsciousCompute / meta-package-manager

A meta package manager for interfacing with multiple distro/platform specific package managers.
GNU Affero General Public License v3.0
3 stars 2 forks source link

Breaking change in `Package` API #65

Open dilawar opened 1 day ago

dilawar commented 1 day ago

This is breaking change. The following code doesn't work anymore.


   --> shepherd-communication\src\push_notification\mod.rs:300:47

    |

300 |         let result = &package_manager.install(mpm::Package::new(package_name, version));

    |                                               ^^^^^^^^^^^^^^^^^               ------- an argument of type `std::string::String` is missing

Originally posted by @dilawar in 14967c9

ss141309 commented 1 day ago

I had introduced package_manager field in the Package struct. Try doing something like: let result = &package_manager.install(mpm::Package::new(package_name, &package_manager.pkg_manager_name(), version));

dilawar commented 1 day ago

That's all fine @ss141309 . I am trying to understand why added this extra field in Package? I missed the reason if it was in previous MRs. I also missed the api change.

Why does Package need to know the PackageManager?

ss141309 commented 1 day ago

In the latest commit related to backing up to and restoring from a TOML/JSON file, we need the package manager's name to determine the source for installing each package.

dilawar commented 1 day ago

I see. Though I am still confused!

You have a list of packages that you are storing to a json. You want to write the name of package manager along with this list. This is fine. But why individual package needs to keep the name of manager? e.g. { pkg-manager: choco, list_of_packages: [p1, p2...]} vs [ { name: p2, pkg_manager: choco, ..], { name: p2, pkg_manager: choco}, .. ] (not correct json).

The name of package manager can be written by a function like PacakgeManager::save_packages(packages: Vec<Package>)? Still confused why individual package needs to know the name of the package manager!

ss141309 commented 1 day ago

Including the package manager's name for each package now also enables us to list installed and outdated packages across all package managers with a single command, such as mpm list --all