Archive experimental OpenSpec changes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Handle AUR packages with fallback and upgrade
|
||||
|
||||
The system SHALL first attempt to install packages via pacman, then fall back
|
||||
to AUR for packages not found in repos, and upgrade AUR packages to
|
||||
latest versions.
|
||||
|
||||
#### Scenario: Try pacman first
|
||||
- **WHEN** package is in pacman repositories
|
||||
- **THEN** install via pacman -Syu
|
||||
|
||||
#### Scenario: Fall back to AUR
|
||||
- **WHEN** package is not in pacman repositories but is in AUR
|
||||
- **THEN** batch query AUR via info endpoint (multiple packages in single request)
|
||||
- **AND** build and install with makepkg -si
|
||||
|
||||
#### Scenario: Upgrade AUR packages
|
||||
- **WHEN** AUR package is already installed but outdated
|
||||
- **THEN** rebuild and reinstall with makepkg to get latest version
|
||||
|
||||
#### Scenario: Report error for missing packages
|
||||
- **WHEN** package is not in pacman repositories or AUR
|
||||
- **THEN** print error to stderr with package name
|
||||
- **AND** exit with code 1
|
||||
|
||||
#### Scenario: AUR build failure
|
||||
- **WHEN** makepkg fails to build package
|
||||
- **THEN** print makepkg error to stderr
|
||||
- **AND** exit with code 1
|
||||
@@ -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
|
||||
@@ -0,0 +1,23 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can merge multiple input sources
|
||||
|
||||
The system SHALL combine package lists from all inputs using an additive
|
||||
strategy without conflict resolution.
|
||||
|
||||
#### Scenario: Additive merging of all inputs
|
||||
- **WHEN** stdin and multiple state files provide package lists
|
||||
- **THEN** system shall include all packages from all inputs in the final state
|
||||
|
||||
#### Scenario: Input priority is last-writer-wins per file
|
||||
- **WHEN** multiple state files contain the same package name
|
||||
- **THEN** the package from the last provided file in command-line order takes
|
||||
precedence
|
||||
|
||||
#### Scenario: Missing packages from stdin are added
|
||||
- **WHEN** stdin contains packages not in state files
|
||||
- **THEN** those packages shall be added to the final state
|
||||
|
||||
#### Scenario: Duplicate packages are deduplicated
|
||||
- **WHEN** the same package appears in multiple inputs
|
||||
- **THEN** it shall be included once in the final state (map deduplication)
|
||||
@@ -0,0 +1,30 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Generate consistent output format
|
||||
|
||||
The system SHALL produce console output suitable for logging and scripting.
|
||||
|
||||
#### Scenario: Successful sync with changes
|
||||
- **WHEN** sync completes with packages installed or removed
|
||||
- **THEN** print to stdout: `Installed X packages, removed Y packages`
|
||||
- **AND** exit with code 0
|
||||
|
||||
#### Scenario: No changes needed
|
||||
- **WHEN** all packages already match declared state
|
||||
- **THEN** print to stdout: `Installed 0 packages, removed 0 packages`
|
||||
- **AND** exit with code 0
|
||||
|
||||
#### Scenario: Error during sync
|
||||
- **WHEN** pacman or makepkg operation fails
|
||||
- **THEN** print error to stderr with details
|
||||
- **AND** exit with code 1
|
||||
|
||||
#### Scenario: Validation failure
|
||||
- **WHEN** package validation fails (package not in pacman or AUR)
|
||||
- **THEN** print error to stderr with package name
|
||||
- **AND** exit with code 1
|
||||
|
||||
#### Scenario: Empty state input
|
||||
- **WHEN** no packages provided from stdin or state files
|
||||
- **THEN** print error to stderr: `empty state input`
|
||||
- **AND** exit with code 1
|
||||
@@ -0,0 +1,29 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can mark non-state packages as non-explicit
|
||||
|
||||
The system SHALL mark all packages not declared in the state as non-explicit
|
||||
(dependencies) before syncing, so they can be safely removed later.
|
||||
|
||||
#### Scenario: Mark packages as non-explicit
|
||||
- **WHEN** packages are declared in state
|
||||
- **THEN** system shall mark those packages as explicitly installed via pacman -D --explicit
|
||||
- **AND** mark all other installed packages as non-explicit
|
||||
|
||||
### Requirement: Can clean up orphaned packages
|
||||
|
||||
After syncing, the system SHALL remove packages that are no longer required
|
||||
(as dependencies of removed packages).
|
||||
|
||||
#### Scenario: Orphan cleanup after sync
|
||||
- **WHEN** sync operation completes successfully
|
||||
- **THEN** system shall run pacman -Rns to remove unneeded dependencies
|
||||
- **AND** report the number of packages removed
|
||||
|
||||
#### Scenario: Orphan cleanup respects explicitly installed
|
||||
- **WHEN** a package not in state is marked as explicitly installed by user
|
||||
- **THEN** system shall NOT remove it during orphan cleanup
|
||||
|
||||
#### Scenario: No orphans to clean
|
||||
- **WHEN** there are no orphaned packages to remove
|
||||
- **THEN** system shall report "No packages to remove" in output
|
||||
@@ -0,0 +1,22 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Query pacman package database via libalpm
|
||||
|
||||
The system SHALL use libalpm for fast local queries against the pacman
|
||||
package database.
|
||||
|
||||
#### Scenario: Query installed packages
|
||||
- **WHEN** needing list of currently installed packages
|
||||
- **THEN** query via libalpm alpm_list_get(ALPM_LIST_PACKAGES)
|
||||
|
||||
#### Scenario: Query available packages
|
||||
- **WHEN** validating package exists in pacman repos
|
||||
- **THEN** query via libalpm alpm_db_get_pkg()
|
||||
|
||||
#### Scenario: Check database last sync time
|
||||
- **WHEN** checking if database needs refresh
|
||||
- **THEN** check /var/lib/pacman/db.lock timestamp
|
||||
|
||||
#### Scenario: Query foreign packages
|
||||
- **WHEN** checking if package is AUR-installed
|
||||
- **THEN** query via libalpm alpm_db_get_pkg(ALPM_DB_TYPE_LOCAL)
|
||||
@@ -0,0 +1,25 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can sync system with declared package state
|
||||
|
||||
The system SHALL execute pacman operations to install and upgrade all declared packages.
|
||||
|
||||
#### Scenario: Full system upgrade with all packages
|
||||
- **WHEN** system has declared package list
|
||||
- **THEN** system shall run pacman -Syu with all declared package names
|
||||
|
||||
#### Scenario: No partial upgrades
|
||||
- **WHEN** running pacman commands
|
||||
- **THEN** system shall use -S --needed flag (sync with skip if up-to-date) ensuring declared packages are present
|
||||
|
||||
#### Scenario: Package availability check
|
||||
- **WHEN** a package from input is not in pacman repositories
|
||||
- **THEN** system shall report the error and include package name
|
||||
|
||||
#### Scenario: Pacman execution capture
|
||||
- **WHEN** pacman commands execute
|
||||
- **THEN** system shall capture both stdout and stderr for error reporting
|
||||
|
||||
#### Scenario: Exit code propagation
|
||||
- **WHEN** pacman commands execute
|
||||
- **THEN** system shall exit with code equal to pacman's exit code for success/failure detection
|
||||
@@ -0,0 +1,21 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can load package states from state files
|
||||
|
||||
The system SHALL load package lists from state files specified via --state flag.
|
||||
|
||||
#### Scenario: Single state file loading
|
||||
- **WHEN** a state file is provided via --state flag
|
||||
- **THEN** system shall read package names from the file content
|
||||
|
||||
#### Scenario: Multiple state file loading
|
||||
- **WHEN** multiple --state flags are provided
|
||||
- **THEN** system shall load package names from each file
|
||||
|
||||
#### Scenario: State file format is text list
|
||||
- **WHEN** loading from state files
|
||||
- **THEN** system shall parse whitespace-delimited package names
|
||||
|
||||
#### Scenario: File path validation
|
||||
- **WHEN** a state file path points to a non-existent file
|
||||
- **THEN** system shall report a file read error
|
||||
@@ -0,0 +1,28 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Validate package names exist in pacman or AUR
|
||||
|
||||
The system SHALL validate that all declared packages exist in pacman
|
||||
repositories or AUR before attempting to sync.
|
||||
|
||||
#### Scenario: Empty state detection
|
||||
- **WHEN** no package names are found in stdin or state files
|
||||
- **THEN** print error to stderr: `empty state input`
|
||||
- **AND** exit with code 1
|
||||
|
||||
#### Scenario: Validate package in pacman repos
|
||||
- **WHEN** package exists in pacman repositories
|
||||
- **THEN** validation passes
|
||||
|
||||
#### Scenario: Validate package in AUR
|
||||
- **WHEN** package not in pacman repos but exists in AUR
|
||||
- **THEN** validation passes
|
||||
|
||||
#### Scenario: Package not found
|
||||
- **WHEN** package not in pacman repos or AUR
|
||||
- **THEN** print error to stderr with package name
|
||||
- **AND** exit with code 1
|
||||
|
||||
#### Scenario: Database freshness check
|
||||
- **WHEN** pacman database last sync was more than 1 day ago
|
||||
- **THEN** run pacman -Syy to refresh before validation
|
||||
@@ -0,0 +1,17 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can read package lists from stdin
|
||||
|
||||
The system SHALL accept package names from standard input, where each line represents a package name.
|
||||
|
||||
#### Scenario: Packages from stdin are read correctly
|
||||
- **WHEN** package names are passed via stdin separated by whitespace, tabs, or newlines
|
||||
- **THEN** system shall parse each unique package name from the input stream
|
||||
|
||||
#### Scenario: Empty stdin input is handled
|
||||
- **WHEN** stdin contains no package names
|
||||
- **THEN** system shall skip stdin input processing
|
||||
|
||||
#### Scenario: Whitespace normalization
|
||||
- **WHEN** packages are separated by multiple spaces, tabs, or newlines
|
||||
- **THEN** each package name shall have leading/trailing whitespace trimmed
|
||||
@@ -0,0 +1,23 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Can resolve transitive dependencies automatically
|
||||
|
||||
The system SHALL automatically determine and install all transitive dependencies
|
||||
for declared packages, so users only need to specify direct packages.
|
||||
|
||||
#### Scenario: Transitive dependencies are resolved
|
||||
- **WHEN** a package with dependencies is declared in state
|
||||
- **THEN** system shall identify all transitive dependencies via pacman
|
||||
- **AND** include them in the installation operation
|
||||
|
||||
#### Scenario: Dependency resolution includes AUR dependencies
|
||||
- **WHEN** a package's transitive dependencies include AUR packages
|
||||
- **THEN** system shall resolve those AUR dependencies via makepkg
|
||||
|
||||
#### Scenario: Shared dependencies are deduplicated
|
||||
- **WHEN** multiple declared packages share dependencies
|
||||
- **THEN** system shall install each shared dependency only once
|
||||
|
||||
#### Scenario: Missing dependency handling
|
||||
- **WHEN** a declared package has a dependency not available in pacman or AUR
|
||||
- **THEN** system shall report error for the missing dependency
|
||||
Reference in New Issue
Block a user