Integrate dyalpm for local/sync package queries
This commit is contained in:
@@ -9,7 +9,7 @@ In dry-run mode, the system SHALL compute what WOULD happen without executing an
|
||||
|
||||
#### Scenario: Dry-run lists packages to remove
|
||||
- **WHEN** dry-run is enabled and orphan packages exist
|
||||
- **THEN** the system SHALL NOT calculate or populate `Result.ToRemove` - orphan detection is skipped entirely in dry-run mode
|
||||
- **THEN** the system SHALL populate `Result.ToRemove` with the list of orphan packages and `Result.Removed` with the count
|
||||
|
||||
#### Scenario: Dry-run skips pacman sync
|
||||
- **WHEN** dry-run is enabled
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
## 1. Setup
|
||||
|
||||
- [ ] 1.1 Add `github.com/Jguer/dyalpm` to go.mod
|
||||
- [ ] 1.2 Run `go mod tidy` to fetch dependencies
|
||||
- [x] 1.1 Add `github.com/Jguer/dyalpm` to go.mod
|
||||
- [x] 1.2 Run `go mod tidy` to fetch dependencies
|
||||
|
||||
## 2. Core Refactoring
|
||||
|
||||
- [ ] 2.1 Update `PackageInfo` struct to add `Installed bool` field
|
||||
- [ ] 2.2 Create `Pac` struct with `alpm.Handle` instead of just aurCache
|
||||
- [ ] 2.3 Implement `NewPac()` that initializes alpm handle and local/sync DBs
|
||||
- [x] 2.1 Update `PackageInfo` struct to add `Installed bool` field
|
||||
- [x] 2.2 Create `Pac` struct with `alpm.Handle` instead of just aurCache
|
||||
- [x] 2.3 Implement `NewPac()` that initializes alpm handle and local/sync DBs
|
||||
|
||||
## 3. Package Resolution Algorithm
|
||||
|
||||
- [ ] 3.1 Implement `buildLocalPkgMap()` - iterate localDB.PkgCache() to create lookup map
|
||||
- [ ] 3.2 Implement `checkSyncDBs()` - iterate each sync DB's PkgCache() to find packages
|
||||
- [ ] 3.3 Implement `resolvePackages()` - unified algorithm:
|
||||
- [x] 3.1 Implement `buildLocalPkgMap()` - iterate localDB.PkgCache() to create lookup map
|
||||
- [x] 3.2 Implement `checkSyncDBs()` - iterate each sync DB's PkgCache() to find packages
|
||||
- [x] 3.3 Implement `resolvePackages()` - unified algorithm:
|
||||
- Step 1: Check local DB for all packages (batch)
|
||||
- Step 2: Check sync DBs for remaining packages (batch per repo)
|
||||
- Step 3: Batch query AUR for remaining packages
|
||||
@@ -22,24 +22,24 @@
|
||||
|
||||
## 4. Sync and DryRun Integration
|
||||
|
||||
- [ ] 4.1 Refactor `Sync()` function to use new resolution algorithm
|
||||
- [ ] 4.2 Refactor `DryRun()` function to use new resolution algorithm
|
||||
- [ ] 4.3 Preserve AUR batched HTTP calls (existing `fetchAURInfo`)
|
||||
- [ ] 4.4 Preserve orphan cleanup logic (`CleanupOrphans()`)
|
||||
- [x] 4.1 Refactor `Sync()` function to use new resolution algorithm
|
||||
- [x] 4.2 Refactor `DryRun()` function to use new resolution algorithm
|
||||
- [x] 4.3 Preserve AUR batched HTTP calls (existing `fetchAURInfo`)
|
||||
- [x] 4.4 Preserve orphan cleanup logic (`CleanupOrphans()`)
|
||||
|
||||
## 5. Marking Operations
|
||||
|
||||
- [ ] 5.1 Keep `MarkExplicit()` for marking state packages
|
||||
- [ ] 5.2 After sync, run `pacman -D --asdeps` on ALL installed packages (simplifies tracking)
|
||||
- [ ] 5.3 After deps marking, run `pacman -D --asexplicit` on collected state packages (overrides deps)
|
||||
- [ ] 5.4 Skip marking operations in dry-run mode
|
||||
- [x] 5.1 Keep `MarkExplicit()` for marking state packages
|
||||
- [x] 5.2 After sync, run `pacman -D --asdeps` on ALL installed packages (simplifies tracking)
|
||||
- [x] 5.3 After deps marking, run `pacman -D --asexplicit` on collected state packages (overrides deps)
|
||||
- [x] 5.4 Skip marking operations in dry-run mode
|
||||
|
||||
## 6. Cleanup and Output
|
||||
|
||||
- [ ] 6.1 Remove subprocess-based `ValidatePackage()` implementation
|
||||
- [ ] 6.2 Remove subprocess-based `GetInstalledPackages()` implementation
|
||||
- [ ] 6.3 Update output summary to show installed/removed counts
|
||||
- [ ] 6.4 In dry-run mode, populate `ToInstall` and `ToRemove` lists
|
||||
- [x] 6.1 Remove subprocess-based `ValidatePackage()` implementation
|
||||
- [x] 6.2 Remove subprocess-based `GetInstalledPackages()` implementation
|
||||
- [x] 6.3 Update output summary to show installed/removed counts
|
||||
- [x] 6.4 In dry-run mode, populate `ToInstall` and `ToRemove` lists
|
||||
|
||||
## 7. Testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user