Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement OpenPGP using librpm API #275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ OPTION (ENABLE_TESTS "Build test?" ON)
OPTION (ENABLE_DOCS "Build docs?" ON)
OPTION (WITH_ZCHUNK "Build with zchunk support" ON)
OPTION (ENABLE_PYTHON "Build Python bindings" ON)
OPTION (USE_GPGME "Use GpgMe (instead of rpm library) for OpenPGP key support" ON)

INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET (VERSION "${LIBREPO_MAJOR}.${LIBREPO_MINOR}.${LIBREPO_PATCH}")
Expand Down Expand Up @@ -32,8 +33,12 @@ PKG_CHECK_MODULES(GLIB2 glib-2.0>=2.66 gio-2.0 REQUIRED)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
PKG_CHECK_MODULES(LIBXML2 libxml-2.0 REQUIRED)
FIND_PACKAGE(CURL 7.52.0 REQUIRED)
FIND_PACKAGE(Gpgme REQUIRED)

IF (USE_GPGME)
FIND_PACKAGE(Gpgme REQUIRED)
ELSE (USE_GPGME)
PKG_CHECK_MODULES(RPM REQUIRED rpm>=4.18.0)
jan-kolarik marked this conversation as resolved.
Show resolved Hide resolved
ENDIF (USE_GPGME)

IF (WITH_ZCHUNK)
PKG_CHECK_MODULES(ZCHUNKLIB zck>=0.9.11 REQUIRED)
Expand Down
14 changes: 13 additions & 1 deletion librepo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
%bcond_without zchunk
%endif

%if 0%{?fedora} >= 39
%bcond_with use_gpgme
%else
%bcond_without use_gpgme
%endif

%global dnf_conflict 2.8.8

Name: librepo
Expand All @@ -24,7 +30,11 @@ BuildRequires: gcc
BuildRequires: check-devel
BuildRequires: doxygen
BuildRequires: pkgconfig(glib-2.0) >= 2.66
%if %{with use_gpgme}
BuildRequires: gpgme-devel
%else
BuildRequires: pkgconfig(rpm) >= 4.18.0
%endif
BuildRequires: libattr-devel
BuildRequires: libcurl-devel >= %{libcurl_version}
BuildRequires: pkgconfig(libxml-2.0)
Expand Down Expand Up @@ -66,7 +76,9 @@ Python 3 bindings for the librepo library.
%autosetup -p1

%build
%cmake %{!?with_zchunk:-DWITH_ZCHUNK=OFF}
%cmake \
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
-DUSE_GPGME=%{?with_use_gpgme:ON}%{!?with_use_gpgme:OFF}
%cmake_build

%check
Expand Down
20 changes: 16 additions & 4 deletions librepo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET (librepo_SRCS
LIST(APPEND librepo_SRCS
checksum.c
downloader.c
downloadtarget.c
Expand All @@ -20,7 +20,13 @@ SET (librepo_SRCS
xmlparser.c
yum.c)

SET(librepo_HEADERS
IF(USE_GPGME)
LIST(APPEND librepo_SRCS gpg_gpgme.c)
ELSE(USE_GPGME)
LIST(APPEND librepo_SRCS gpg_rpm.c)
ENDIF(USE_GPGME)

LIST(APPEND librepo_HEADERS
checksum.h
fastestmirror.h
gpg.h
Expand All @@ -44,10 +50,11 @@ SET(librepo_HEADERS
downloader.h
downloadtarget.h)

SET(librepo_internal_HEADERS
LIST(APPEND librepo_internal_HEADERS
downloader_internal.h
downloadtarget_internal.h
fastestmirror_internal.h
gpg_internal.h
handle_internal.h
repoconf_internal.h
result_internal.h
Expand All @@ -60,9 +67,14 @@ TARGET_LINK_LIBRARIES(librepo
${LIBXML2_LIBRARIES}
${CURL_LIBRARY}
${LIBCRYPTO_LIBRARIES}
${GPGME_VANILLA_LIBRARIES}
${GLIB2_LIBRARIES}
)
IF (USE_GPGME)
TARGET_LINK_LIBRARIES(librepo ${GPGME_VANILLA_LIBRARIES})
ELSE(USE_GPGME)
TARGET_LINK_LIBRARIES(librepo ${RPM_LIBRARIES})
ENDIF (USE_GPGME)

IF (WITH_ZCHUNK)
TARGET_LINK_LIBRARIES(librepo ${ZCHUNKLIB_LIBRARIES})
ENDIF (WITH_ZCHUNK)
Expand Down
Loading
Loading