From dae2a97eefd17ff1a28a3c227f1e4b0dc20aca25 Mon Sep 17 00:00:00 2001 From: Agustin Henze Date: Thu, 13 Oct 2022 15:56:02 +0200 Subject: [PATCH] Add SkipContents on publish-update endpoint The options was publish quite long ago on https://github.com/aptly-dev/aptly/pull/347. It allows publishing + updating a specific repository without generating the whole content usually used by apt-file. If you have a big repository with a few thousands of packages, it can improve by 50x the publishing. --- aptly_api/parts/publish.py | 3 +++ aptly_api/tests/test_publish.py | 1 + 2 files changed, 4 insertions(+) diff --git a/aptly_api/parts/publish.py b/aptly_api/parts/publish.py index b2a4866..1ffcee0 100644 --- a/aptly_api/parts/publish.py +++ b/aptly_api/parts/publish.py @@ -132,6 +132,7 @@ def update(self, *, prefix: str, distribution: str, sign_skip: bool = False, sign_batch: bool = True, sign_gpgkey: Optional[str] = None, sign_keyring: Optional[str] = None, sign_secret_keyring: Optional[str] = None, sign_passphrase: Optional[str] = None, sign_passphrase_file: Optional[str] = None, + skip_contents: Optional[bool] = False, skip_cleanup: Optional[bool] = False) -> PublishEndpoint: """ Example: @@ -157,6 +158,8 @@ def update(self, *, prefix: str, distribution: str, body["ForceOverwrite"] = True if skip_cleanup: body["SkipCleanup"] = True + if skip_contents: + body["SkipContents"] = True sign_dict = {} # type: Dict[str, Union[bool,str]] if sign_skip: diff --git a/aptly_api/tests/test_publish.py b/aptly_api/tests/test_publish.py index f536a43..b26f782 100644 --- a/aptly_api/tests/test_publish.py +++ b/aptly_api/tests/test_publish.py @@ -292,6 +292,7 @@ def test_update_snapshot_default_key(self, *, rmock: requests_mock.Mocker) -> No sign_passphrase="123456", sign_keyring="/etc/gpg-managed-keyring/pubring.pub", sign_secret_keyring="/etc/gpg-managed-keyring/secring.gpg", + skip_contents=True, skip_cleanup=True ), PublishEndpoint(