Conversation
- Add bfc_oci.h header with OCI data structures and function declarations - Add bfc_oci.c implementation with OCI manifest, config, and layer support - Add oci_example.c demonstrating OCI functionality - Add OCI_SUPPORT.md documentation - Update CMakeLists.txt to include OCI support option - Add examples/CMakeLists.txt for building examples This enables BFC to be used as a storage backend for OCI-compliant container images, making it suitable for integration with container runtimes and registries.
- Add comprehensive OCI image manifest and config support - Implement bfc_extract_to_oci function for extracting BFC containers to OCI format - Add dynamic architecture and OS detection for cross-platform compatibility - Create OCI example with proper CMakeLists.txt integration - Update examples/README.md with OCI example documentation - Add proper error handling and memory management - Support for multiple architectures: x86_64, ARM64, RISC-V, PowerPC - Support for multiple OS: Linux, Windows, macOS, BSD variants This enables BFC to be used as an OCI image storage format while maintaining compatibility with existing BFC functionality.
|
Pls fix the formatting convention by using https://github.com/zombocoder/bfc/actions/runs/17733184741/job/50389034816 |
- Fix code formatting according to project standards - Apply consistent indentation and spacing - Sort includes alphabetically - Ensure all C/C++ files follow clang-format conventions This addresses the formatting issues reported in CI/CD pipeline.
Done. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive OCI (Open Container Initiative) Image Specs support to BFC, enabling it to serve as a storage backend for OCI-compliant container images. The implementation provides data structures, API functions, and utilities for managing OCI manifests, configs, layers, and indexes within BFC containers.
- Introduces OCI data structures and API functions for container image management
- Adds build system integration with conditional OCI support
- Provides example demonstrating OCI functionality with cross-platform architecture detection
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/CMakeLists.txt | Adds conditional compilation and installation of OCI support |
| src/bfc_oci.c | Core OCI functionality implementation with manifest, layer, and extraction operations |
| include/bfc_oci.h | OCI data structures and function declarations |
| examples/oci_example.c | Cross-platform example demonstrating OCI functionality |
| examples/README.md | Documentation for the new OCI example |
| examples/CMakeLists.txt | Build configuration for OCI example |
| cmd_extract.c | Command-line extraction utility (unrelated to OCI) |
| PR_DESCRIPTION.md | Comprehensive PR documentation |
| OCI_SUPPORT.md | API reference and usage documentation |
| CMakeLists.txt | Adds BFC_WITH_OCI build option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Pls also add some tests |
- Move src/bfc_oci.c to src/lib/bfc_oci.c for better organization - Update src/lib/CMakeLists.txt to use correct path (bfc_oci.c instead of ../bfc_oci.c) - Add BFC_WITH_OCI compile definition for targets - Create comprehensive test suite in tests/unit/test_oci.c - Tests for validation functions (manifest, config) - Tests for creation functions (from manifest, from index) - Tests for retrieval and extraction functions - NULL pointer validation tests - Memory management tests - Update test infrastructure to include OCI tests - All changes applied from updated_changes.patch
|
@zombocoder Pls review now, made the changes that were described. |
Overview
This PR adds comprehensive OCI (Open Container Initiative) Image Specs support to BFC (Binary File Container), enabling it to be used as a storage backend for OCI-compliant container images.
Motivation
BFC is currently a general-purpose binary file container format. Adding OCI support would make it suitable for:
Changes
New Files
include/bfc_oci.h- OCI data structures and function declarationsbfc_oci_manifest_t- OCI image manifest structurebfc_oci_config_t- OCI image config structurebfc_oci_layer_t- OCI layer structurebfc_oci_index_t- OCI image index structuresrc/bfc_oci.c- OCI functionality implementationbfc_create_from_oci_manifest()- Create BFC from OCI manifestbfc_create_from_oci_index()- Create BFC from OCI indexbfc_add_oci_layer()- Add OCI layer to BFCbfc_extract_to_oci()- Extract BFC to OCI formatbfc_get_oci_manifest()- Get OCI manifest from BFCbfc_get_oci_config()- Get OCI config from BFCbfc_list_oci_layers()- List OCI layers in BFCexamples/oci_example.c- Example demonstrating OCI functionalityOCI_SUPPORT.md- Comprehensive documentationexamples/CMakeLists.txt- Build configuration for examplesModified Files
CMakeLists.txt- Added OCI support optionBFC_WITH_OCIoption (default: ON)src/lib/CMakeLists.txt- Updated to include OCI supportbfc_oci.cFeatures
OCI Manifest Support
OCI Config Support
OCI Layer Support
OCI Index Support
Utility Functions
API Design
The API follows BFC's existing patterns:
BFC_E_*error codesFILE*handlesBackward Compatibility
BFC_WITH_OCIoption)Testing
Documentation
OCI_SUPPORT.mdFuture Enhancements
Use Cases
Benefits
Dependencies
License
All new code is licensed under the Apache License 2.0, same as the main BFC project.
Checklist
Conclusion
This PR adds comprehensive OCI Image Specs support to BFC, making it a suitable storage backend for OCI-compliant container images. The implementation is well-documented, tested, and maintains backward compatibility while providing powerful new functionality for container image management.