Commit graph

213 commits

Author SHA1 Message Date
Till Wegmueller
a948f87e6f
Add legacy repository support and SHA-1 signature handling
- Introduced fallback for legacy `pkg5.repository` configuration in INI format alongside the existing `pkg6.repository` JSON format.
- Enabled SHA-1 signature computation for compatibility with legacy catalog signatures.
- Added methods to save update logs in legacy format and enhance catalog compatibility.
- Updated dependencies to include `sha1` for hashing.
2025-12-09 12:12:57 +01:00
Till Wegmueller
c4910bb434
Refactor error handling in repository module to include structured error variants with detailed context.
- Replaced string-based `FileReadError`, `FileWriteError`, and `DirectoryCreateError` with structured error types using `PathBuf` and `source`.
- Updated all affected methods in `rest_backend`, `file_backend`, and tests to use the new structured error variants.
- Improved error messages for clarity and debugging by embedding file paths and sources directly into error data.
2025-12-08 23:13:27 +01:00
Till Wegmueller
ee02bf3cf0
Simplify config loading by replacing match with unwrap_or_else for improved readability. 2025-12-08 22:49:35 +01:00
Till Wegmueller
81bc7b8574
Refactor catalog handling by replacing get_legacy_catalog with get_catalog_file_path for improved clarity and consistency.
- Removed now-redundant catalog path resolution logic in `repo.rs`.
- Updated `file_backend` with a unified method for fetching catalog file paths, addressing invalid path prefixes.
- Adjusted HTTP handler to use the updated method.
2025-12-08 22:45:39 +01:00
Till Wegmueller
55decc16ff
Simplify CatalogPart::load by removing manual JSON parsing fallbacks and introducing test coverage for sample catalogs. 2025-12-08 22:39:28 +01:00
Till Wegmueller
84b2c50ed6
Remove deprecated Catalog v0 support and refactor legacy catalog handling.
- Removed `get_catalog` handler and associated Catalog v0 route.
- Updated `get_legacy_catalog` to accept `filename` for enhanced flexibility.
- Adjusted integration tests to validate changes and focus on Catalog v1 support.
- Refactored `SupportedOperation` definitions to exclude Catalog v0.
2025-12-08 22:10:11 +01:00
Till Wegmueller
048dddf487
Refactor get_versions response with structured VersionsResponse model.
- Added `Operation` enum and `SupportedOperation` struct to encapsulate supported operations and versions.
- Updated response generation to dynamically include the `pkg6depotd` version and supported operations.
- Enhanced integration tests to validate version string format changes.
2025-12-08 21:41:02 +01:00
Till Wegmueller
0b3a974ca6
Add REST API v1 endpoints and legacy catalog handling for pkg6depotd
- Expanded repository structure by introducing methods for fetching legacy catalogs, catalog file paths, and repository info.
- Added new REST API v1 endpoints for catalog, manifest, file, and publisher handling.
- Implemented `publisher` handler module with `get_publisher_v0` and `get_publisher_v1` methods to retrieve publisher details in pkg5 format.
- Updated `integration_tests` to validate new endpoints and ensure compatibility with legacy and modern catalog/manifest handling.
- Removed unused dependency `walkdir` and refactored test cases for clarity and efficiency.
2025-12-08 21:36:37 +01:00
Till Wegmueller
cd15e21420
Add repository handling and foundational HTTP routes for pkg6depotd
- Implemented `DepotRepo` for repository access, including methods for catalog path, file path, and manifest retrieval.
- Introduced foundational HTTP routes for catalog, manifest, file, and package info retrieval.
- Added integration tests to validate repository setup and basic server functionality.
- Modularized HTTP handlers for better maintainability and extended them with new implementations like `info` and `manifest` handling.
- Refactored `main` function to simplify initialization and leverage reusable `run` logic in a new `lib.rs`.
- Updated `Cargo.toml` and `Cargo.lock` to include new dependencies: `walkdir` and updated testing utilities.
2025-12-08 20:50:20 +01:00
Till Wegmueller
f2a3bc4d7c
Introduce foundational structure for pkg6depotd
- Added initial implementation of the `pkg6depotd` server with modular components for CLI parsing, configuration management, HTTP handling, repository access, and daemonization.
- Implemented basic server startup logic with a default router and placeholder handlers.
- Integrated telemetry initialization and configuration fallback mechanism for ease of development.
- Updated `Cargo.toml` and `Cargo.lock` to include dependencies necessary for server functionality.
2025-12-08 20:11:05 +01:00
Till Wegmueller
340e58ca09
Add comprehensive documentation for IPS search index design and implementation
- Documented indexer workflow, consistency mechanisms, and file layout for client-side and server-side indexing.
- Detailed fast incremental updates and full rebuild criteria with corresponding file modifications.
- Specified encoding formats, invariants, and validation rules for on-disk index files.
- Enhanced developer documentation for maintaining and troubleshooting the search index.
- Updated VCS configuration to remove unused submodule mapping.
2025-12-08 20:10:30 +01:00
Till Wegmueller
6be608164d
Add detailed documentation for Redb-based IPS Search Index schema and encoding plans
- Introduced a series of planning documents detailing the Redb-based IPS index design, schema specification, and encoding strategies.
- Added a high-level overview of the core search index schema and the use of Redb MVCC transactions for consistency and performance improvements.
- Documented simplified schema definitions avoiding optional elements, focusing on compact encodings.
- Defined transitions to postcard-encoded binary formats, aligning with Rust’s serde for standardized serialization.
- Outlined migration strategies, invariants, error handling, and testing plans for index adoption.
- Enhanced documentation with structured explanations for developers to implement, extend, and migrate seamlessly to the new index model.
2025-12-08 20:10:04 +01:00
Till Wegmueller
33dd228df7
Update VCS mappings to include oi-userland 2025-09-02 16:05:53 +02:00
Till Wegmueller
1198a6a934
Remove Submodule
Signed-off-by: Till Wegmueller <toasterson@gmail.com>
2025-08-31 10:44:35 +02:00
Till Wegmueller
23815a2aab
Expand ManifestBuilder with new helper methods for setting attributes, licenses, links, and dependencies.
- Added `add_set`, `add_license`, `add_link`, and `add_depend` methods for streamlined manifest construction.
- Updated documentation with new examples showcasing the extended `ManifestBuilder` API.
- Enhanced test coverage to validate the new helper methods.
2025-08-31 00:17:15 +02:00
Till Wegmueller
d78cd9f659
Refactor depend module
- Simplified `split_dir_base` signature by removing unnecessary lifetime annotation.
- Refactored `compute_python_runpaths` to eliminate mutable variable and streamline `insert_default_runpath`.
2025-08-30 23:26:17 +02:00
Till Wegmueller
29ef35f350
Add api module for forge/pkgdev high-level integration
- Introduced `api.rs` to provide a stable, struct-first API surface for building, linting, resolving, and publishing IPS packages.
- Encapsulated existing functionality for better abstraction and usability in external integrations.
- Enhanced `libips` with a high-level repository and transaction interface.
- Added support for dependency generation, manifest transformations, and linting via configurable rulesets.
- Updated documentation with integration flow examples and usage guidelines.
2025-08-30 22:25:45 +02:00
Till Wegmueller
a156a3f863
Remove pkg6dev module and related code
- Deleted `pkg6dev` crate, including all related files (`src`, `Cargo.toml`, `Cargo.lock`, and `README.md`).
- Removed error handling, CLI logic, and publishing functionality from the project.
- Migrated relevant high-level APIs to `libips`, ensuring consistency with existing modules.
- Updated `libips` with a new `api` module to encapsulate `forge/pkgdev` integration logic.
- Simplified repository structure to exclude now-unused components and dependencies.
2025-08-30 21:59:52 +02:00
Till Wegmueller
77f02fdfbd
Add depend module for file-level dependency generation
- Introduced `depend.rs` to handle dependency generation for ELF files, scripts, Python modules, and SMF manifests.
- Implemented file classification and analysis logic with configurable bypass rules and runpath handling.
- Added utility functions to resolve file dependencies into manifest actions using a provided repository.
- Updated `Cargo.toml` with `goblin` dependency for ELF processing.
- Enhanced codebase with default runpath insertion, dynamic token expansion, and Python module import detection.
- Included `pkgdepend` documentation for dependency resolution overview.
2025-08-30 18:35:41 +02:00
Till Wegmueller
7cffa6c4e6
Add transformer module for manifest transformation logic
- Introduced `transformer.rs` with a structured approach for parsing and applying transformation rules.
- Added support for operations like `add`, `default`, `delete`, `drop`, `edit`, `emit`, and `set` on attributes, files, directories, and other targets.
- Implemented regex-based matching for patterns and backreference handling in transformations.
- Enhanced manifest modification functionality, including attribute/facet operations and deferred action emission.
- Added comprehensive unit tests to validate transformation rules and their applications.
2025-08-28 23:50:59 +02:00
Till Wegmueller
88e06b488d
Refactor catalog processing to merge parts by version
- Introduced `process_publisher_merged` to consolidate catalog parts per `stem@version` before processing.
- Replaced part-wise processing with merged version logic for efficiency and improved determinism.
- Added `process_catalog_part` dead code annotation and cleaned up outdated logic.
- Enhanced handling of merged actions and signature deduplication across catalog parts.
- Improved logging for import and obsolete package metrics.
2025-08-27 00:05:36 +02:00
Till Wegmueller
6ed8bb5b5b
Improve dependency constraint extraction and branch locking logic
- Updated `extract_constraint` to derive constraints from both optional properties and dependency FMRI version strings.
- Ensured child dependencies inherit parent's branch when not explicitly constrained, mirroring solver behavior.
2025-08-26 21:51:05 +02:00
Till Wegmueller
d77e61f90f
Add solver advice system for user-focused installation guidance
- Introduced a new `advice` module in the solver to provide user-oriented guidance for resolving dependency issues.
- Added structured failure details to `SolverError` for improved diagnosis and advice generation.
- Updated `pkg6` to display actionable advice when dependency resolution fails, including catalog refresh, publisher verification, and incorporation constraints.
- Enhanced CLI tools with a dangling dependency scan to identify and output unresolved stems.
- Improved modularity and caching mechanisms for catalog and manifest handling to support the advice system.
- Refined error messages and logging for better user feedback during installation errors.
2025-08-26 21:09:06 +02:00
Till Wegmueller
8bdc6d6641
Enhance pkgtree with advisor and error analysis modes
- Added advisor mode to analyze package installability with recursive dependency checks.
- Introduced solver error file analysis to diagnose and suggest fixes for specific install issues.
- Updated CLI options to support advisor and solver error analysis functionalities.
- Improved dependency processing logic to filter by applicable dependency types.
- Added support for configurable recursion depth and dependency limits in advisor mode.
- Enhanced graph mode logic to prioritize error analysis and provide better logging for failure cases.
- Included new helper functions for version parsing, dependency constraint extraction, and caching.
- Added tests for version parsing and dependency handling.
2025-08-26 14:53:31 +02:00
Till Wegmueller
c8a6c8c781
Introduce pkgtree: CLI tool for analyzing IPS package dependency trees
- Added `pkgtree` with functionalities to analyze dependency trees and detect cycles in IPS package images.
- Implemented CLI options for filtering by publisher, package substring, and output format (Tree/JSON).
- Integrated cycle detection and suggestions for resolving dependency cycles.
- Added testing support for cycle detection.
- Updated workspace dependencies and added `pkgtree` to the workspace configuration.
2025-08-26 12:38:36 +02:00
Till Wegmueller
9ac8f98b38
Refactor solver and manifest handling
- Replaced `CatalogProvider` with database-backed solution, improving manifest retrieval logic.
- Added fallback and LZ4 decoding support for catalog-stored manifests.
- Enhanced incorporation lock handling with direct database queries.
- Updated sample install script to use `debug` logging for better traceability.
2025-08-21 23:52:11 +02:00
Till Wegmueller
e4bd9a748a
Refactor ImageCatalog and apply manifest logic
- Added support for obsoleted package database with separate handling in `ImageCatalog`.
- Enhanced apply manifest functionality with progress callback support and processing statistics.
- Introduced LZ4 compression for manifest storage in `ImageCatalog`.
- Removed debugging eprintln statements, replaced with structured logging.
- Updated `pkg6` image creation and installation logic to improve user feedback and error handling.
- Updated database initialization and build processes to handle new obsoleted logic.
2025-08-19 22:43:50 +02:00
Till Wegmueller
77147999b3
Add incorporation lock support and update dependencies across the project
- Implemented incorporation lock functionality for packages, including pre-checks, addition, and retrieval methods.
- Enhanced package installation logic to handle incorporation constraints.
- Updated dependency versions in `Cargo.toml` and `Cargo.lock`, aligning with latest compatible releases.
- Introduced new tests to verify incorporation lock behavior, including scenarios with and without locks.
- Refactored code for improved readability and added error handling improvements.
- Fixed minor typos and inconsistencies in comments and log messages.
2025-08-19 14:30:55 +02:00
Till Wegmueller
39124f9df4
Refactor imports and remove unused ActionOrder implementation
- Cleaned up imports across multiple modules for better organization and removed unused dependencies.
- Eliminated `ActionOrder` implementation from `executors` as it's no longer being utilized.
- Simplified error handling in `get_dependencies` using `unwrap_or_else`.
- Optimized test setups with consistent use of `tempdir` helper function.
2025-08-19 11:10:36 +02:00
Till Wegmueller
a2645749b1
Add action executors, action plans, and sample install script
- Implemented `executors` module for applying manifests with support for directories, files, and links.
- Added `action_plan` module to merge and execute install plans from manifests.
- Introduced `run_sample_install.sh` script for testing installations, including dry-run and real execution.
- Enhanced `pkg6` install logic to resolve and apply action plans.
- Improved manifest management with `save_manifest` and repository-based fetching.
2025-08-19 11:06:48 +02:00
Till Wegmueller
d483e2a995
implement manifest fetching and fix CI errors 2025-08-13 23:23:45 +02:00
Till Wegmueller
abf294f38c
remove legacy resolver. 2025-08-13 22:20:21 +02:00
Till Wegmueller
28a18c088a
implement dependency solver based on resolvo 2025-08-13 22:09:19 +02:00
Till Wegmueller
287b692920
fixup catalog locations and import. Add end2end test for that. (ignored by default) 2025-08-13 19:09:22 +02:00
Till Wegmueller
f2922dab11
Fix catalog import logic 2025-08-05 00:44:29 +02:00
Till Wegmueller
92cce0f767
Add debugging utilities and improved package listing
- Add support for debugging database tables with `--stats`, `--dump-all`, and `--dump-table` options.
- Introduce CLI command `DebugDb` for inspecting catalog, obsoleted, and installed tables.
- Enhance `List` command to include an `--all` flag for listing all available packages.
- Update logging for database operations and package queries.
- Add methods to dump and analyze table contents in `InstalledPackages` and `ImageCatalog`.
2025-08-05 00:20:57 +02:00
Till Wegmueller
0ec1c1928a
Update Image and Catalog functionalities with improved catalog handling and new refresh logic
- Introduced `Image::refresh_catalogs` to support refreshing catalogs selectively or fully for specified publishers.
- Enhanced `CatalogManager::load` to handle missing fields gracefully, including fallback mechanisms for `packages`.
- Added detailed logging and error diagnostics for catalog parsing and directory operations.
- Improved publisher-specific directory management, including cleaning and recreating directories during full refresh.
- Updated tests to verify correct behavior for catalog directory clearing and new catalog handling logic.
2025-08-04 23:45:41 +02:00
Till Wegmueller
f31d2e11af
Add support for partial image creation and improve logging
- Introduced the `ImageType` enum to support both `Full` and `Partial` image types during creation.
- Updated `Image::create_image` to accept `ImageType` as a parameter.
- Enhanced logging with detailed debug statements for catalog building, image queries, and package processing.
- Refactored CLI to include a new `--type` option for specifying image type during image creation.
- Simplified path determination logic in `pkg6` with a new `determine_image_path` helper function.
- Removed unused imports and unnecessary file checks for cleaner code.
2025-08-04 23:01:04 +02:00
Till Wegmueller
e27cd35d8d
Add ImageCatalog and InstalledPackages modules for package management
- Introduced `ImageCatalog` for handling catalog-related operations, including initialization, building from publishers, querying, and manifest management.
- Added `InstalledPackages` for managing installed package operations, such as adding, removing, querying, and retrieving manifests.
- Defined database schemas and error types to support both modules.
- Refactored table handling, ensuring consistent transaction scoping with `redb`.
2025-08-04 22:01:38 +02:00
Till Wegmueller
e33ccbe6ec
Remove unused ReadableTable import from libips::image module 2025-08-03 16:34:49 +02:00
Till Wegmueller
45521d0c73
Update RestBackend documentation example for download_catalog changes
- Include `ReadableRepository` and `WritableRepository` imports in the example.
- Update the `download_catalog` method to reflect the new optional parameter.
2025-08-03 14:36:36 +02:00
Till Wegmueller
2777f153c9
Introduce progress reporting infrastructure and error management refinements
- Add `ProgressReporter` trait with `start`, `update`, and `finish` methods for customizable progress tracking during operations.
- Implement `ProgressInfo` struct for detailed progress state reporting, including operation, progress, and context information.
- Create a no-op implementation `NoopProgressReporter` for cases where progress reporting is not needed.
- Enhance `pkg6` with structured error handling using `Pkg6Error` and new diagnostic variants for I/O, JSON, FMRI, and logging errors.
- Update `Image` functionality to leverage progress reporting during catalog downloads and include robust publisher management.
- Introduce `TestProgressReporter` for unit tests to validate progress reporting integration.
2025-08-03 14:28:36 +02:00
Till Wegmueller
f7f017f7b9
Add tests for Image functionality and refactor image handling logic
- Implement unit tests to cover `Image` creation, metadata management, saving/loading, and error handling.
- Add separate constructors for `Full` and `Partial` image types (`new_full`, `new_partial`).
- Introduce robust path handling methods (`metadata_dir`, `image_json_path`) for consistent metadata structure.
- Enhance error diagnostics with `InvalidPath` variant in `ImageError`.
- Update `Cargo.toml` for test module inclusion.
2025-08-02 22:12:37 +02:00
Till Wegmueller
f60abfdbd1
Add pub.p5i file implementation for backward compatibility
- Create `pub.p5i` files during publisher addition and transaction commits to maintain compatibility with older IPS versions.
- Introduce `create_pub_p5i_file` method in `FileBackend` for generating structured `pub.p5i` JSON files.
- Update `add_publisher` and `Transaction::commit` methods to handle `pub.p5i` creation logic.
- Add tests to verify `pub.p5i` file generation in various scenarios.
2025-08-02 13:18:18 +02:00
Till Wegmueller
dfe8ac1305
Add support for backward compatibility with legacy repository files
- Introduced creation of `pub.p5i` files for publishers to maintain compatibility with older repository formats.
- Implemented saving repository configuration in legacy INI format (`pkg5.repository`).
- Updated tests to validate the generation and structure of legacy files.
- Added new dependencies (`rust-ini`) and updated `Cargo.toml` and `Cargo.lock` accordingly.
2025-08-02 13:17:49 +02:00
Till Wegmueller
fc00304038
Remove redundant file checks and update test assertions for publisher-specific file paths
- Eliminate obsolete assertions for the root `file` directory as it is no longer created.
- Update tests to validate file paths in `publisher`-specific directories, aligning with the updated repository structure.
- Simplify `create_directories` by removing unnecessary `file` directory creation.
2025-07-31 00:29:53 +02:00
Till Wegmueller
99dd0fe87c
Refactor repository structure to use publisher-specific directories
- Introduce publisher-specific hierarchy (`publisher/<publisher_name>`) for catalog, package, and file storage.
- Replace hardcoded paths with helper methods (`construct_catalog_path`, `construct_package_dir`, `construct_file_path_with_publisher`) for consistent path generation.
- Remove outdated tests and simplify redundant assertions in repository tests.
- Update `CatalogManager` and file handling logic to leverage publisher-specific paths.
- Enhance debug logs to include publisher context where applicable.
2025-07-31 00:18:21 +02:00
Till Wegmueller
845ffec13b
Switch to CBOR for metadata serialization and simplify key management
- Replace `bincode` serialization with `CBOR` for obsoleted package metadata to improve interoperability and error messaging.
- Simplify key handling by directly using FMRI strings as keys, removing the need for intermediate serialization steps.
- Update deserialization, error handling, and logging to align with `CBOR` serialization.
- Add `serde_cbor` as a dependency, updating `Cargo.toml` and `Cargo.lock` accordingly.
- Refactor `ObsoletedPackageKey` to include conversion between FMRI strings and data components.
2025-07-29 23:14:47 +02:00
Till Wegmueller
a5f1b7d815
Refactor obsoleted.rs to optimize database schema and enhance error handling
- Replace `FMRI_TO_HASH_TABLE` and `HASH_TO_METADATA_TABLE` with a unified `FMRI_TO_METADATA_TABLE` for direct FMRI-to-metadata mapping, reducing complexity and eliminating intermediate hash lookups.
- Implement robust error handling and logging in database transactions, serialization, and deserialization procedures.
- Introduce on-the-fly manifest generation for entries with `NULL_HASH`, streamlining workflows for minimal manifest creation.
- Update indexing, querying, and removal logic to align with the new table and error handling improvements.
- Streamline `list_obsoleted_packages` by introducing index-based fetching with structured fallbacks to filesystem methods.
2025-07-29 21:24:32 +02:00
Till Wegmueller
5b4b719b42
Introduce cleanup functionality for obsoleted packages with TTL support
- Add methods to find and clean up obsoleted packages older than a specified TTL (`find_obsoleted_packages_older_than_ttl` and `cleanup_obsoleted_packages_older_than_ttl`) in `libips`.
- Implement a new `CleanupObsoleted` command in `pkg6repo` to handle cleanup operations.
- Update workspace `Cargo.toml` files with unified attributes for better consistency.
- Adjust dependencies (`libips` version patterns, `thiserror` updates) and enhance metadata management for obsoleted packages.
- Enhance repository operations by adding batch processing and robust logging during cleanup.
2025-07-29 19:08:18 +02:00