From c289eba9defacf550768c3cc5e64f17d72c7e6bc Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 6 Oct 2023 11:07:00 +0300 Subject: [PATCH] Move internal OpenPGP parser into a subdirectory This will let us split it out of the main rpm repository with minimal effects to the outside. Make sure the name implies its status too. Ie, first we declared it's trash, and now we're swiping it under the carpet. --- CMakeLists.txt | 3 --- rpmio/CMakeLists.txt | 13 +++--------- rpmio/rpmpgp_legacy/CMakeLists.txt | 21 ++++++++++++++++++++ rpmio/{ => rpmpgp_legacy}/digest_libgcrypt.c | 0 rpmio/{ => rpmpgp_legacy}/digest_openssl.c | 0 rpmio/{ => rpmpgp_legacy}/rpmpgp_internal.c | 0 rpmio/{ => rpmpgp_legacy}/rpmpgp_internal.h | 0 7 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 rpmio/rpmpgp_legacy/CMakeLists.txt rename rpmio/{ => rpmpgp_legacy}/digest_libgcrypt.c (100%) rename rpmio/{ => rpmpgp_legacy}/digest_openssl.c (100%) rename rpmio/{ => rpmpgp_legacy}/rpmpgp_internal.c (100%) rename rpmio/{ => rpmpgp_legacy}/rpmpgp_internal.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 980d6596cc..f95c1456c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,9 +19,6 @@ option(ENABLE_NDB "Enable ndb rpmdb support" ON) option(ENABLE_BDB_RO "Enable read-only Berkeley DB rpmdb support (EXPERIMENTAL)" OFF) option(ENABLE_TESTSUITE "Enable test-suite" ON) -option(WITH_INTERNAL_OPENPGP "Use internal OpenPGP parse (DEPRECATED)" OFF) -option(WITH_OPENSSL "Use openssl (instead of libgcrypt) for internal crypto" OFF) - option(WITH_CAP "Build with capability support" ON) option(WITH_ACL "Build with ACL support" ON) option(WITH_ARCHIVE "Build with libarchive support" ON) diff --git a/rpmio/CMakeLists.txt b/rpmio/CMakeLists.txt index 1bfa7d83c7..a74991641d 100644 --- a/rpmio/CMakeLists.txt +++ b/rpmio/CMakeLists.txt @@ -10,17 +10,10 @@ target_sources(librpmio PRIVATE target_compile_definitions(librpmio PRIVATE RPM_CONFIGDIR="${RPM_CONFIGDIR}") target_include_directories(librpmio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +add_subdirectory(rpmpgp_legacy) + if (WITH_INTERNAL_OPENPGP) - target_sources(librpmio PRIVATE rpmpgp_internal.h rpmpgp_internal.c) - if (WITH_OPENSSL) - find_package(OpenSSL 1.0.2 REQUIRED) - target_sources(librpmio PRIVATE digest_openssl.c) - target_link_libraries(librpmio PRIVATE OpenSSL::Crypto) - else() - pkg_check_modules(LIBGCRYPT REQUIRED IMPORTED_TARGET libgcrypt) - target_sources(librpmio PRIVATE digest_libgcrypt.c) - target_link_libraries(librpmio PRIVATE PkgConfig::LIBGCRYPT) - endif() + target_link_libraries(librpmio PRIVATE rpmpgp_legacy) else() pkg_check_modules(RPMSEQUOIA REQUIRED IMPORTED_TARGET rpm-sequoia>=1.4.0) target_sources(librpmio PRIVATE rpmpgp_sequoia.c) diff --git a/rpmio/rpmpgp_legacy/CMakeLists.txt b/rpmio/rpmpgp_legacy/CMakeLists.txt new file mode 100644 index 0000000000..d467d56820 --- /dev/null +++ b/rpmio/rpmpgp_legacy/CMakeLists.txt @@ -0,0 +1,21 @@ +# At least for now, this is can't be built as a standalone project. Ie, +# it can only be built as a part of rpm build tree. +add_library(rpmpgp_legacy OBJECT) + +option(WITH_INTERNAL_OPENPGP "Use internal OpenPGP parser (DEPRECATED)" OFF) +option(WITH_OPENSSL "Use openssl (instead of libgcrypt) for internal crypto" OFF) + +target_sources(rpmpgp_legacy PRIVATE + rpmpgp_internal.h rpmpgp_internal.c +) +target_include_directories(rpmpgp_legacy PRIVATE ..) +if (WITH_OPENSSL) + find_package(OpenSSL 1.0.2 REQUIRED) + target_sources(rpmpgp_legacy PRIVATE digest_openssl.c) + target_link_libraries(rpmpgp_legacy PRIVATE OpenSSL::Crypto) +else() + pkg_check_modules(LIBGCRYPT REQUIRED IMPORTED_TARGET libgcrypt) + target_sources(rpmpgp_legacy PRIVATE digest_libgcrypt.c) + target_link_libraries(rpmpgp_legacy PRIVATE PkgConfig::LIBGCRYPT) +endif() + diff --git a/rpmio/digest_libgcrypt.c b/rpmio/rpmpgp_legacy/digest_libgcrypt.c similarity index 100% rename from rpmio/digest_libgcrypt.c rename to rpmio/rpmpgp_legacy/digest_libgcrypt.c diff --git a/rpmio/digest_openssl.c b/rpmio/rpmpgp_legacy/digest_openssl.c similarity index 100% rename from rpmio/digest_openssl.c rename to rpmio/rpmpgp_legacy/digest_openssl.c diff --git a/rpmio/rpmpgp_internal.c b/rpmio/rpmpgp_legacy/rpmpgp_internal.c similarity index 100% rename from rpmio/rpmpgp_internal.c rename to rpmio/rpmpgp_legacy/rpmpgp_internal.c diff --git a/rpmio/rpmpgp_internal.h b/rpmio/rpmpgp_legacy/rpmpgp_internal.h similarity index 100% rename from rpmio/rpmpgp_internal.h rename to rpmio/rpmpgp_legacy/rpmpgp_internal.h