Add dry-run flag and implement AUR support
This commit is contained in:
@@ -77,7 +77,7 @@ package list, with all packages at their latest available versions.
|
||||
|
||||
**AUR Integration**
|
||||
- First attempt: Try pacman -Syu for all packages (includes AUR auto-install if enabled)
|
||||
- For packages not found in pacman repos: Check AUR via Jguer/aur library
|
||||
- For packages not found in pacman repos: Batch query AUR via info endpoint (single HTTP request for multiple packages)
|
||||
- If package in AUR: Build and install with makepkg (no AUR helpers)
|
||||
- AUR packages should also upgrade to latest version (no partial updates)
|
||||
- Clone AUR git repo to temp directory
|
||||
@@ -110,10 +110,12 @@ package list, with all packages at their latest available versions.
|
||||
- Multiple --state flags allowed, all additive
|
||||
- Stdin input via standard input stream
|
||||
- No interactive prompts - fully automated
|
||||
- `--dry-run`: Simulate sync without making changes, print what would be installed/removed
|
||||
|
||||
**Output Format**
|
||||
- Success: Print to stdout: `Installed X packages, removed Y packages`
|
||||
- No changes: Print `Installed 0 packages, removed 0 packages`
|
||||
- Dry-run: Print `Installed X packages, removed Y packages` with `Would install: ...` and `Would remove: ...` lines
|
||||
- Errors: Print error message to stderr
|
||||
- Exit codes: 0 for success, 1 for errors
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ list, ensuring all packages are at the latest version.
|
||||
- Machine-readable output (install/remove counts, exit codes)
|
||||
- No conflict resolution for missing packages (append-only)
|
||||
- Print error to stderr for empty state input and exit with code 1
|
||||
- Dry-run mode: simulate sync without making changes, show what would be installed/removed
|
||||
|
||||
## Capabilities
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ latest versions.
|
||||
|
||||
#### Scenario: Fall back to AUR
|
||||
- **WHEN** package is not in pacman repositories but is in AUR
|
||||
- **THEN** query AUR via Jguer/aur library
|
||||
- **THEN** batch query AUR via info endpoint (multiple packages in single request)
|
||||
- **AND** build and install with makepkg -si
|
||||
|
||||
#### Scenario: Upgrade AUR packages
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# Dry-Run Mode
|
||||
|
||||
## Summary
|
||||
|
||||
Add `--dry-run` flag to simulate the sync operation without making any changes
|
||||
to the system. Shows what packages would be installed and what would be removed.
|
||||
|
||||
## Motivation
|
||||
|
||||
Users want to preview the effects of a sync operation before committing changes.
|
||||
This is useful for:
|
||||
- Verifying the intended changes are correct
|
||||
- Avoiding unintended package installations
|
||||
- Understanding what orphan cleanup will remove
|
||||
|
||||
## Interface
|
||||
|
||||
```
|
||||
declpac --dry-run --state packages.txt
|
||||
```
|
||||
|
||||
## Behavior
|
||||
|
||||
1. Read state files and stdin (same as normal mode)
|
||||
2. Validate packages exist (same as normal mode)
|
||||
3. Query current installed packages via `pacman -Qq`
|
||||
4. Compare declared packages to current state
|
||||
5. Identify packages that would be installed (not currently installed)
|
||||
6. Identify orphans that would be removed via `pacman -Qdtq`
|
||||
7. Output results with "Would install:" and "Would remove:" sections
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
Installed 3 packages, removed 2 packages
|
||||
Would install: vim, git, docker
|
||||
Would remove: python2, perl-xml-parser
|
||||
```
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- Actual package operations (no pacman -Syu, no pacman -Rns execution)
|
||||
- Package version comparison
|
||||
- Detailed dependency analysis
|
||||
|
||||
## Trade-offs
|
||||
|
||||
- Doesn't predict transitive dependencies that pacman might install
|
||||
- Orphan list may change after packages are installed
|
||||
@@ -93,3 +93,12 @@
|
||||
- [x] 10.9 Test AUR fallback with makepkg for AUR package
|
||||
- [x] 10.10 Test error handling for missing packages
|
||||
- [x] 10.11 Generate final binary
|
||||
|
||||
## 11. Dry-Run Mode
|
||||
|
||||
- [x] 11.1 Add --dry-run flag to CLI argument parsing
|
||||
- [x] 11.2 Implement DryRun function to query current state
|
||||
- [x] 11.3 Compare declared packages to current installations
|
||||
- [x] 11.4 Identify packages to install (not currently installed)
|
||||
- [x] 11.5 Identify orphans to remove via pacman -Qdtq
|
||||
- [x] 11.6 Output "Would install:" and "Would remove:" sections
|
||||
|
||||
Reference in New Issue
Block a user