Skip to content

Commit 3c827bc

Browse files
committed
feat: implement .SRCINFO parsing for AUR packages
- feat: add parse_srcinfo_deps() to extract dependency arrays from .SRCINFO - feat: add parse_srcinfo_conflicts() to extract conflicts with version extraction - feat: add parse_srcinfo() to parse full .SRCINFO into SrcinfoData struct - feat: add fetch_srcinfo() async function to fetch .SRCINFO from AUR (requires aur feature) - feat: handle architecture-specific dependencies (depends_x86_64, etc.) - feat: handle split packages by using first pkgname found - feat: filter .so virtual packages automatically - feat: deduplicate dependencies and conflicts - feat: add comprehensive unit tests (11 tests) covering all parsing functions - feat: add examples/srcinfo_example.rs demonstrating all .SRCINFO parsing features - feat: export srcinfo functions from deps module - docs: update DEPENDENCIES_MODULE_PHASE.md to mark Task 2.1.3 as complete
1 parent 3062015 commit 3c827bc

File tree

4 files changed

+981
-23
lines changed

4 files changed

+981
-23
lines changed

dev/DEPENDENCIES_MODULE_PHASE.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This document provides a detailed structured plan for implementing the Dependenc
1313
| **Estimated Effort** | 30-40 hours |
1414
| **Complexity** | High (system command execution, complex data structures) |
1515
| **Dependencies** | `types` module, optional `aur` module for AUR package resolution |
16-
| **Status** | ⏳ In Progress - Task 2.1.1 Complete ✅ |
16+
| **Status** | ⏳ In Progress - Tasks 2.1.1, 2.1.2, 2.1.3 Complete ✅ |
1717

1818
## Current Progress
1919

@@ -25,11 +25,25 @@ This document provides a detailed structured plan for implementing the Dependenc
2525
- Example file demonstrating usage
2626
- Feature flag and exports configured
2727

28+
- **Task 2.1.2: Port Dependency Spec Parsing** - Complete
29+
- Created `src/deps/parse.rs` with parsing functions
30+
- Ported `parse_dep_spec()`, `parse_pacman_si_deps()`, `parse_pacman_si_conflicts()`
31+
- Removed i18n dependency, using English-only labels
32+
- Handles multi-line dependencies and deduplication
33+
- Comprehensive unit tests
34+
35+
- **Task 2.1.3: Port .SRCINFO Parsing** - Complete
36+
- Created `src/deps/srcinfo.rs` with parsing functions
37+
- Ported `parse_srcinfo_deps()`, `parse_srcinfo_conflicts()`, `parse_srcinfo()`
38+
- Implemented `fetch_srcinfo()` async function with reqwest (requires `aur` feature)
39+
- Handles architecture-specific dependencies, split packages, .so filtering
40+
- Comprehensive unit tests (11 tests)
41+
- Example file `examples/srcinfo_example.rs` demonstrating all features
42+
2843
### ⏳ In Progress
29-
- **Task 2.1.2: Port Dependency Spec Parsing** - Next up
44+
- **Task 2.1.4: Port PKGBUILD Parsing** - Next up
3045

3146
### 📋 Planned
32-
- Remaining Phase 2.1 tasks (SRCINFO, PKGBUILD parsing)
3347
- Phase 2.2-2.6 (Version utils, Query, Resolution, Integration, Testing)
3448

3549
---
@@ -437,13 +451,14 @@ impl Default for ResolverConfig {
437451
- [x] Deduplicate dependencies in `parse_pacman_si_deps()` and `parse_pacman_si_conflicts()` (return unique list)
438452

439453
#### Task 2.1.3: Port .SRCINFO Parsing
440-
- [ ] Create `src/deps/srcinfo.rs`
441-
- [ ] Port `parse_srcinfo_deps()` function
442-
- [ ] Port `parse_srcinfo_conflicts()` function
443-
- [ ] Add new `parse_srcinfo()` function returning `SrcinfoData`
444-
- [ ] Add async `fetch_srcinfo()` using reqwest (not curl)
445-
- [ ] Add unit tests with sample .SRCINFO content
446-
- [ ] Handle edge cases (split packages, architecture-specific deps)
454+
- [x] Create `src/deps/srcinfo.rs`
455+
- [x] Port `parse_srcinfo_deps()` function
456+
- [x] Port `parse_srcinfo_conflicts()` function
457+
- [x] Add new `parse_srcinfo()` function returning `SrcinfoData`
458+
- [x] Add async `fetch_srcinfo()` using reqwest (not curl)
459+
- [x] Add unit tests with sample .SRCINFO content
460+
- [x] Handle edge cases (split packages, architecture-specific deps)
461+
- [x] Add example file `examples/srcinfo_example.rs` demonstrating all features
447462

448463
#### Task 2.1.4: Port PKGBUILD Parsing
449464
- [ ] Create `src/deps/pkgbuild.rs`
@@ -600,7 +615,7 @@ tokio = { version = "1", features = ["rt", "time", "process"], optional = true }
600615
| DependencySource type coupling | Create standalone type | ✅ Resolved (Task 2.1.1) |
601616
| PackageItem type coupling | Create simplified PackageRef | ✅ Resolved (Task 2.1.1) |
602617
| ReverseRootSummary type coupling | Create standalone type | ✅ Resolved (Task 2.1.1) |
603-
| i18n dependency in parse.rs | Remove, use English-only labels | ⏳ Pending (Task 2.1.2) |
618+
| i18n dependency in parse.rs | Remove, use English-only labels | ✅ Resolved (Task 2.1.2) |
604619
| PKGBUILD cache access | Accept optional callback | ⏳ Pending (Task 2.4.1) |
605620
| Sandbox parse functions | Include in deps module | ⏳ Pending (Task 2.1.4) |
606621
| Index module coupling | Accept parameters instead | ⏳ Pending (Task 2.3.1) |
@@ -623,32 +638,32 @@ tokio = { version = "1", features = ["rt", "time", "process"], optional = true }
623638
## Acceptance Criteria
624639

625640
### Functionality
626-
- [ ] Can parse dependency specifications with version constraints
627-
- [ ] Can parse .SRCINFO files and extract all dependency types
641+
- [x] Can parse dependency specifications with version constraints - ✅ Task 2.1.2
642+
- [x] Can parse .SRCINFO files and extract all dependency types - ✅ Task 2.1.3
628643
- [ ] Can parse PKGBUILD files and extract dependency arrays
629644
- [ ] Can query installed packages from pacman database
630645
- [ ] Can resolve dependencies for a list of packages
631646
- [ ] Can analyze reverse dependencies for removal operations
632647
- [ ] Graceful degradation when pacman is unavailable
633-
- [ ] Works without i18n (English-only output)
648+
- [x] Works without i18n (English-only output) - ✅ Task 2.1.2
634649

635650
### Code Quality
636-
- [x] All functions have rustdoc comments (What/Inputs/Output/Details) - ✅ Task 2.1.1
651+
- [x] All functions have rustdoc comments (What/Inputs/Output/Details) - ✅ Tasks 2.1.1, 2.1.2, 2.1.3
637652
- [ ] Cyclomatic complexity < 25 for all functions
638-
- [x] cargo fmt produces no changes - ✅ Task 2.1.1
639-
- [x] cargo clippy produces no warnings - ✅ Task 2.1.1
640-
- [x] All tests pass (cargo test -- --test-threads=1) - ✅ Task 2.1.1
653+
- [x] cargo fmt produces no changes - ✅ Tasks 2.1.1, 2.1.2, 2.1.3
654+
- [x] cargo clippy produces no warnings - ✅ Tasks 2.1.1, 2.1.2, 2.1.3
655+
- [x] All tests pass (cargo test -- --test-threads=1) - ✅ Tasks 2.1.1, 2.1.2, 2.1.3
641656

642657
### Testing
643-
- [ ] Unit tests for all parsing functions
658+
- [x] Unit tests for all parsing functions - ✅ Tasks 2.1.2, 2.1.3
644659
- [ ] Unit tests for version comparison
645660
- [ ] Integration tests with mock commands
646-
- [ ] Example program demonstrating usage
661+
- [x] Example program demonstrating usage - ✅ Tasks 2.1.1, 2.1.3
647662

648663
### Documentation
649-
- [x] Module-level documentation with examples - ✅ Task 2.1.1 (types module)
664+
- [x] Module-level documentation with examples - ✅ Tasks 2.1.1, 2.1.2, 2.1.3
650665
- [ ] README updated with deps module usage
651-
- [x] Feature flags documented - ✅ Task 2.1.1 (deps feature added)
666+
- [x] Feature flags documented - ✅ Tasks 2.1.1, 2.1.3 (deps feature, conditional aur feature)
652667

653668
---
654669

0 commit comments

Comments
 (0)