| 1 | //! Contains types and bindings for fetching and installing packages from the |
| 2 | //! cache. |
| 3 | |
| 4 | #[cxx::bridge] |
| 5 | pub(crate) mod raw { |
| 6 | unsafe extern "C++" { |
| 7 | include!("rust-apt/apt-pkg-c/pkgmanager.h"); |
| 8 | |
| 9 | type PackageManager; |
| 10 | type ProblemResolver; |
| 11 | |
| 12 | type PkgCacheFile = crate::cache::raw::PkgCacheFile; |
| 13 | type PkgIterator = crate::cache::raw::PkgIterator; |
| 14 | type PkgRecords = crate::records::raw::PkgRecords; |
| 15 | type PkgDepCache = crate::depcache::raw::PkgDepCache; |
| 16 | type AcqTextStatus = crate::acquire::raw::AcqTextStatus; |
| 17 | |
| 18 | type InstallProgress<'a> = crate::progress::InstallProgress<'a>; |
| 19 | type OperationProgress<'a> = crate::progress::OperationProgress<'a>; |
| 20 | |
| 21 | /// # Safety |
| 22 | /// |
| 23 | /// The returned UniquePtr cannot outlive the cache. |
| 24 | unsafe fn create_pkgmanager(depcache: &PkgDepCache) -> UniquePtr<PackageManager>; |
| 25 | |
| 26 | pub fn get_archives( |
| 27 | self: &PackageManager, |
| 28 | cache: &PkgCacheFile, |
| 29 | records: &PkgRecords, |
| 30 | progress: Pin<&mut AcqTextStatus>, |
| 31 | ) -> Result<()>; |
| 32 | |
| 33 | pub fn do_install(self: &PackageManager, progress: Pin<&mut InstallProgress>) |
| 34 | -> Result<()>; |
| 35 | |
| 36 | /// # Safety |
| 37 | /// |
| 38 | /// The returned UniquePtr cannot outlive the cache. |
| 39 | unsafe fn create_problem_resolver(depcache: &PkgDepCache) -> UniquePtr<ProblemResolver>; |
| 40 | |
| 41 | pub fn protect(self: &ProblemResolver, pkg: &PkgIterator); |
| 42 | |
| 43 | fn resolve( |
| 44 | self: &ProblemResolver, |
| 45 | fix_broken: bool, |
| 46 | op_progress: Pin<&mut OperationProgress>, |
| 47 | ) -> Result<()>; |
| 48 | } |
| 49 | } |