Skip to content

Conversation

maisim
Copy link
Contributor

@maisim maisim commented Sep 25, 2025

facts: add deb822 format support for APT sources

Add support for parsing deb822 format (.sources) files alongside
traditional .list format APT source files.

Features:
- Parse deb822 stanzas with Types/URIs/Suites/Components fields
- Map deb822 specific fields (Architectures, Signed-By) to legacy options
- Maintain backwards compatibility with existing parse_apt_repo output
- Support multiple types/URIs/suites combinations per stanza

This is part 2/3 of modernizing APT source management.

Follow #1460

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

@maisim maisim force-pushed the pr2-add-deb822-support branch from 88643c6 to 7bc7ec1 Compare October 14, 2025 15:30
- Add GpgFactBase, GpgKey, GpgKeys, GpgSecretKeys, and GpgKeyrings facts
- Add gpg.key and gpg.dearmor operations for managing GPG keys
- Support for keyserver fetching, local files, URLs, and key removal
- Comprehensive test coverage for all GPG operations and facts
- Add GpgFactBase, GpgKey, GpgKeys, GpgSecretKeys, and GpgKeyrings facts
- Add gpg.key and gpg.dearmor operations for managing GPG keys
- Support for keyserver fetching, local files, URLs, and key removal
- Comprehensive test coverage for all GPG operations and facts
- Add AptRepo and AptSourcesFile dataclasses for type-safe repository handling
- Support both legacy .list and modern .sources deb822 formats
- Maintain backward compatibility with dict-like access patterns
- Add comprehensive parsing for deb822 multi-value fields
- Expand deb822 entries to individual repository configurations
- Add test coverage for deb822 sources and components with numbers
- Update existing tests to handle new file-marker based parsing
- Break down complex key() function into smaller, focused helper functions
- Add _install_key_from_src() for file/URL installation
- Add _install_key_from_keyserver() for keyserver installation
- Add _remove_key_from_keyrings() for multi-keyring removal
- Add _remove_key_from_keyring() for single keyring removal
- Add _remove_keyring_file() for complete keyring removal
- Add validation helper functions for parameters
- Improve code readability and maintainability
- Follow Docker operations pattern for function organization
- Maintain 100% backward compatibility with existing API
# Conflicts:
#	src/pyinfra/operations/gpg.py
@maisim maisim force-pushed the pr2-add-deb822-support branch from 7bc7ec1 to 154dd2e Compare October 16, 2025 09:05
GPG key IDs contain hexadecimal values that trigger false positives
in typos (e.g., 'BA' in '1E9377A2BA9EF27F' is flagged as misspelled).
These are valid hex values, not typos.
@maisim maisim changed the title Pr2 add deb822 support Pr2/3 add deb822 support Oct 16, 2025
@maisim maisim mentioned this pull request Oct 16, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant