Skip to content

Commit

Permalink
Add zchunk integration
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Dieter <[email protected]>
  • Loading branch information
jdieter authored and dmach committed Nov 26, 2018
1 parent 80810f0 commit 7e4ba3d
Show file tree
Hide file tree
Showing 42 changed files with 1,005 additions and 113 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ find_package(LZMA REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Zchunk REQUIRED)

# Add include dirs

Expand Down
55 changes: 55 additions & 0 deletions cmake/Modules/FindZchunk.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# - Try to find zchunk library
#
# This will define:
# ZCK_FOUND - system has zchunk library
# ZCK_LIBRARIES - Link these to use zchunk library
#
# Mostly copied from FindGLIB2.cmake
#
# Copyright (c) 2006 Andreas Schneider <[email protected]>
# Copyright (c) 2006 Philippe Bernery <[email protected]>
# Copyright (c) 2007 Daniel Gollub <[email protected]>
# Copyright (c) 2007 Alban Browaeys <[email protected]>
# Copyright (c) 2008 Michael Bell <[email protected]>
# Copyright (c) 2008-2009 Bjoern Ricks <[email protected]>
# Copyright (c) 2018 Jonathan Dieter <[email protected]>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


IF (ZCK_LIBRARIES)
# in cache already
SET(ZCK_FOUND TRUE)
ELSE (ZCK_LIBRARIES)

INCLUDE(FindPkgConfig)

## Glib
IF ( ZCK_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "REQUIRED" )
ELSE ( ZCK_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "" )
ENDIF ( ZCK_FIND_REQUIRED )

IF ( ZCK_MIN_VERSION )
PKG_SEARCH_MODULE( ZCK ${_pkgconfig_REQUIRED} zck>=${ZCK_MIN_VERSION} )
ELSE ( ZCK_MIN_VERSION )
PKG_SEARCH_MODULE( ZCK ${_pkgconfig_REQUIRED} zck )
ENDIF ( ZCK_MIN_VERSION )

IF (ZCK_FOUND)
IF (NOT ZCK_FIND_QUIETLY)
MESSAGE (STATUS "Found zchunk: ${ZCK_LIBDIR}/lib${ZCK_LIBRARIES} (found version \"${ZCK_VERSION}\")")
ENDIF (NOT ZCK_FIND_QUIETLY)
ELSE (ZCK_FOUND)
IF (ZCK_FIND_REQUIRED)
MESSAGE (SEND_ERROR "Could not find zchunk")
ENDIF (ZCK_FIND_REQUIRED)
ENDIF (ZCK_FOUND)

MARK_AS_ADVANCED(ZCK_LIBRARIES)

ENDIF (ZCK_LIBRARIES)
14 changes: 13 additions & 1 deletion doc/createrepo_c.8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH CREATEREPO_C "2017-02-23" "" ""
.TH CREATEREPO_C "2018-06-13" "" ""
.SH NAME
createrepo_c \- Create rpm-md format (xml-rpm-metadata) repository
.
Expand Down Expand Up @@ -126,6 +126,18 @@ Number of workers to spawn to read rpms.
.SS \-\-xz
.sp
Use xz for repodata compression.
.SS \-\-zck
.sp
Generate zchunk files as well as the standard repodata.
.SS \-\-zck\-primary\-dict ZCK_PRIMARY_DICT
.sp
Compression dictionary to use for zchunk primary file
.SS \-\-zck\-filelists\-dict ZCK_FILELISTS_DICT
.sp
Compression dictionary to use for zchunk filelists file
.SS \-\-zck\-other\-dict ZCK_OTHER_DICT
.sp
Compression dictionary to use for zchunk other file
.SS \-\-compress\-type COMPRESSION_TYPE
.sp
Which compression type to use.
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ TARGET_LINK_LIBRARIES(libcreaterepo_c ${OPENSSL_LIBRARIES})
TARGET_LINK_LIBRARIES(libcreaterepo_c ${RPMDB_LIBRARY})
TARGET_LINK_LIBRARIES(libcreaterepo_c ${SQLITE3_LIBRARIES})
TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZLIB_LIBRARY})
TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZCK_LIBRARIES})
IF (DRPM_LIBRARY)
TARGET_LINK_LIBRARIES(libcreaterepo_c ${DRPM_LIBRARY})
ENDIF (DRPM_LIBRARY)
Expand Down
8 changes: 8 additions & 0 deletions src/cmd_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ static GOptionEntry cmd_entries[] =
"Number of workers to spawn to read rpms.", NULL },
{ "xz", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.xz_compression),
"Use xz for repodata compression.", NULL },
{ "zck", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.zck_compression),
"Generate zchunk files as well as the standard repodata.", NULL },
{ "zck-primary-dict", 0, 0, G_OPTION_ARG_FILENAME, &(_cmd_options.zck_primary_dict),
"Compression dictionary to use for zchunk primary file", "ZCK_PRIMARY_DICT" },
{ "zck-filelists-dict", 0, 0, G_OPTION_ARG_FILENAME, &(_cmd_options.zck_filelists_dict),
"Compression dictionary to use for zchunk filelists file", "ZCK_FILELISTS_DICT" },
{ "zck-other-dict", 0, 0, G_OPTION_ARG_FILENAME, &(_cmd_options.zck_other_dict),
"Compression dictionary to use for zchunk other file", "ZCK_OTHER_DICT" },
{ "compress-type", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.compress_type),
"Which compression type to use.", "COMPRESSION_TYPE" },
{ "general-compress-type", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.general_compress_type),
Expand Down
4 changes: 4 additions & 0 deletions src/cmd_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ struct CmdOptions {
char *read_pkgs_list; /*!< output the paths to pkgs actually read */
gint workers; /*!< number of threads to spawn */
gboolean xz_compression; /*!< use xz for repodata compression */
gboolean zck_compression; /*!< generate zchunk files */
char *zck_primary_dict; /*!< dictionary for zchunk primary file */
char *zck_filelists_dict; /*!< dictionary for zchunk filelists file */
char *zck_other_dict; /*!< dictionary for zchunk other file */
gboolean keep_all_metadata; /*!< keep groupfile and updateinfo from source
repo during update */
gboolean ignore_lock; /*!< Ignore existing .repodata/ - remove it,
Expand Down
Loading

0 comments on commit 7e4ba3d

Please sign in to comment.