Skip to content
Snippets Groups Projects
Unverified Commit 94fa7643 authored by Jakob Blomer's avatar Jakob Blomer Committed by GitHub
Browse files

Merge pull request #3008 from cvmfs/libcvmfs-util

Add minimal cvmfs_util library
parents 4b23b0dd 10b49b0d
Branches
Tags
No related merge requests found
Showing
with 179 additions and 69 deletions
...@@ -120,9 +120,11 @@ generate_package_map() { ...@@ -120,9 +120,11 @@ generate_package_map() {
local ducc="$8" local ducc="$8"
local fuse3="$9" local fuse3="$9"
local gateway="${10}" local gateway="${10}"
local libs="${11}"
cat > pkgmap.${platform} << EOF cat > pkgmap.${platform} << EOF
[$platform] [$platform]
libs=$libs
client=$client client=$client
server=$server server=$server
devel=$devel devel=$devel
......
...@@ -99,7 +99,8 @@ if [ ! -z $CVMFS_CI_PLATFORM_LABEL ]; then ...@@ -99,7 +99,8 @@ if [ ! -z $CVMFS_CI_PLATFORM_LABEL ]; then
"$(basename $(find . -name 'cvmfs-shrinkwrap*.deb'))"\ "$(basename $(find . -name 'cvmfs-shrinkwrap*.deb'))"\
"" \ "" \
"$(basename $(find . -name 'cvmfs-fuse3*.deb'))" \ "$(basename $(find . -name 'cvmfs-fuse3*.deb'))" \
"$(basename $(find . -name 'cvmfs-gateway*.deb'))" "$(basename $(find . -name 'cvmfs-gateway*.deb'))" \
"$(basename $(find . -name 'cvmfs-libs*.deb'))"
fi fi
# clean up the source tree # clean up the source tree
......
...@@ -86,5 +86,6 @@ if [ ! -z $CVMFS_CI_PLATFORM_LABEL ]; then ...@@ -86,5 +86,6 @@ if [ ! -z $CVMFS_CI_PLATFORM_LABEL ]; then
"$(basename $(find . -regex '.*cvmfs-shrinkwrap-[0-9].*\.rpm'))" \ "$(basename $(find . -regex '.*cvmfs-shrinkwrap-[0-9].*\.rpm'))" \
"$(basename $(find . -regex '.*cvmfs-ducc-[0-9].*\.rpm'))" \ "$(basename $(find . -regex '.*cvmfs-ducc-[0-9].*\.rpm'))" \
"$(basename $(find . -regex '.*cvmfs-fuse3-[0-9].*\.rpm'))" \ "$(basename $(find . -regex '.*cvmfs-fuse3-[0-9].*\.rpm'))" \
"$(basename $(find . -regex '.*cvmfs-gateway-[0-9].*\.rpm'))" "$(basename $(find . -regex '.*cvmfs-gateway-[0-9].*\.rpm'))" \
"$(basename $(find . -regex '.*cvmfs-libs-[0-9].*\.rpm'))"
fi fi
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# This file is part of the CernVM File System # This file is part of the CernVM File System
# #
include (util/CMakeLists.txt)
# /usr/bin/cvmfs2 # /usr/bin/cvmfs2
set (CVMFS2_BINARY_SOURCES set (CVMFS2_BINARY_SOURCES
fuse_main.cc fuse_main.cc
...@@ -278,7 +280,6 @@ set (CVMFS_PUBLISH_SOURCES ...@@ -278,7 +280,6 @@ set (CVMFS_PUBLISH_SOURCES
util/exception.cc util/exception.cc
util/namespace.cc util/namespace.cc
util/posix.cc util/posix.cc
util/string.cc
whitelist.cc whitelist.cc
) )
...@@ -360,7 +361,6 @@ set (LIBCVMFS_SERVER_SOURCES ...@@ -360,7 +361,6 @@ set (LIBCVMFS_SERVER_SOURCES
util/mmap_file.cc util/mmap_file.cc
util/posix.cc util/posix.cc
util/raii_temp_dir.cc util/raii_temp_dir.cc
util/string.cc
whitelist.cc whitelist.cc
xattr.cc xattr.cc
) )
...@@ -474,7 +474,6 @@ set (CVMFS_SWISSKNIFE_SOURCES ...@@ -474,7 +474,6 @@ set (CVMFS_SWISSKNIFE_SOURCES
util/file_backed_buffer.cc util/file_backed_buffer.cc
util/mmap_file.cc util/mmap_file.cc
util/posix.cc util/posix.cc
util/string.cc
util/raii_temp_dir.cc util/raii_temp_dir.cc
util_concurrency.cc util_concurrency.cc
whitelist.cc whitelist.cc
...@@ -489,7 +488,6 @@ set (CVMFS_SIGN_SOURCES ...@@ -489,7 +488,6 @@ set (CVMFS_SIGN_SOURCES
signature.cc signature.cc
util/exception.cc util/exception.cc
util/posix.cc util/posix.cc
util/string.cc
) )
set (CVMFS_SUID_HELPER_SOURCES set (CVMFS_SUID_HELPER_SOURCES
...@@ -643,7 +641,6 @@ if(BUILD_RECEIVER) ...@@ -643,7 +641,6 @@ if(BUILD_RECEIVER)
util/file_backed_buffer.cc util/file_backed_buffer.cc
util/mmap_file.cc util/mmap_file.cc
util/posix.cc util/posix.cc
util/string.cc
util/raii_temp_dir.cc util/raii_temp_dir.cc
util_concurrency.cc util_concurrency.cc
uuid.cc uuid.cc
...@@ -652,7 +649,8 @@ if(BUILD_RECEIVER) ...@@ -652,7 +649,8 @@ if(BUILD_RECEIVER)
) )
add_executable(cvmfs_receiver ${CVMFS_RECEIVER_SOURCES}) add_executable(cvmfs_receiver ${CVMFS_RECEIVER_SOURCES})
target_link_libraries(cvmfs_receiver ${CURL_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS} target_link_libraries(cvmfs_receiver cvmfs_util
${CURL_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS}
${SHA3_LIBRARIES} ${SQLITE3_LIBRARY} ${VJSON_LIBRARIES} ${SHA3_LIBRARIES} ${SQLITE3_LIBRARY} ${VJSON_LIBRARIES}
${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} ${ZLIB_LIBRARIES}
${RT_LIBRARY} ${LibArchive_LIBRARY} pthread dl) ${RT_LIBRARY} ${LibArchive_LIBRARY} pthread dl)
...@@ -662,7 +660,7 @@ if(BUILD_RECEIVER) ...@@ -662,7 +660,7 @@ if(BUILD_RECEIVER)
if(BUILD_RECEIVER_DEBUG) if(BUILD_RECEIVER_DEBUG)
add_executable(cvmfs_receiver_debug ${CVMFS_RECEIVER_SOURCES}) add_executable(cvmfs_receiver_debug ${CVMFS_RECEIVER_SOURCES})
target_link_libraries(cvmfs_receiver_debug target_link_libraries(cvmfs_receiver_debug cvmfs_util_debug
${CURL_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS} ${CURL_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS}
${SHA3_LIBRARIES} ${SQLITE3_LIBRARY} ${VJSON_LIBRARIES} ${SHA3_LIBRARIES} ${SQLITE3_LIBRARY} ${VJSON_LIBRARIES}
${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} ${ZLIB_LIBRARIES}
...@@ -985,13 +983,15 @@ if (BUILD_SERVER) ...@@ -985,13 +983,15 @@ if (BUILD_SERVER)
set_target_properties (cvmfs_signing_helper PROPERTIES set_target_properties (cvmfs_signing_helper PROPERTIES
COMPILE_FLAGS "${CVMFS_PUBLISH_CFLAGS}") COMPILE_FLAGS "${CVMFS_PUBLISH_CFLAGS}")
target_link_libraries (cvmfs_signing_helper target_link_libraries (cvmfs_signing_helper
cvmfs_util
${SHA3_LIBRARIES} ${SHA3_LIBRARIES}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
pthread dl) pthread dl)
# link the stuff (*_LIBRARIES are dynamic link libraries) # link the stuff (*_LIBRARIES are dynamic link libraries)
set (LIBCVMFS_SERVER_LINK_LIBRARIES "") set (LIBCVMFS_SERVER_LINK_LIBRARIES "")
list(APPEND LIBCVMFS_SERVER_LINK_LIBRARIES ${CURL_LIBRARIES} list(APPEND LIBCVMFS_SERVER_LINK_LIBRARIES
${CURL_LIBRARIES}
${CARES_LIBRARIES} ${CARES_LDFLAGS} ${CARES_LIBRARIES} ${CARES_LDFLAGS}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${SQLITE3_LIBRARY} ${SQLITE3_LIBRARY}
...@@ -1002,18 +1002,18 @@ if (BUILD_SERVER) ...@@ -1002,18 +1002,18 @@ if (BUILD_SERVER)
${LibArchive_LIBRARY} ${LibArchive_LIBRARY}
${RT_LIBRARY} ${RT_LIBRARY}
pthread dl) pthread dl)
target_link_libraries (cvmfs_swissknife target_link_libraries (cvmfs_swissknife cvmfs_util
${SQLITE3_LIBRARY} ${CURL_LIBRARIES} ${SQLITE3_LIBRARY} ${CURL_LIBRARIES}
${CARES_LIBRARIES} ${CARES_LDFLAGS} ${ZLIB_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS} ${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES} ${RT_LIBRARY} ${VJSON_LIBRARIES} ${OPENSSL_LIBRARIES} ${RT_LIBRARY} ${VJSON_LIBRARIES}
${SHA3_LIBRARIES} ${CAP_LIBRARIES} ${LibArchive_LIBRARY} ${SHA3_LIBRARIES} ${CAP_LIBRARIES} ${LibArchive_LIBRARY}
pthread dl) pthread dl)
target_link_libraries (cvmfs_server ${LIBCVMFS_SERVER_LIBS} ${LIBCVMFS_SERVER_LINK_LIBRARIES}) target_link_libraries (cvmfs_server cvmfs_util ${LIBCVMFS_SERVER_LIBS} ${LIBCVMFS_SERVER_LINK_LIBRARIES})
target_link_libraries (cvmfs_publish cvmfs_server) target_link_libraries (cvmfs_publish cvmfs_util cvmfs_server)
if (BUILD_SERVER_DEBUG) if (BUILD_SERVER_DEBUG)
add_executable (cvmfs_swissknife_debug ${CVMFS_SWISSKNIFE_SOURCES}) add_executable (cvmfs_swissknife_debug ${CVMFS_SWISSKNIFE_SOURCES})
set_target_properties (cvmfs_swissknife_debug PROPERTIES COMPILE_FLAGS "${CVMFS_SWISSKNIFE_CFLAGS} -DDEBUGMSG -g -O0" LINK_FLAGS "${CVMFS_SWISSKNIFE_DEBUG_LD_FLAGS}") set_target_properties (cvmfs_swissknife_debug PROPERTIES COMPILE_FLAGS "${CVMFS_SWISSKNIFE_CFLAGS} -DDEBUGMSG -g -O0" LINK_FLAGS "${CVMFS_SWISSKNIFE_DEBUG_LD_FLAGS}")
target_link_libraries (cvmfs_swissknife_debug target_link_libraries (cvmfs_swissknife_debug cvmfs_util_debug
${SQLITE3_LIBRARY} ${CURL_LIBRARIES} ${SQLITE3_LIBRARY} ${CURL_LIBRARIES}
${CARES_LIBRARIES} ${CARES_LDFLAGS} ${ZLIB_LIBRARIES} ${CARES_LIBRARIES} ${CARES_LDFLAGS} ${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES} ${RT_LIBRARY} ${VJSON_LIBRARIES} ${OPENSSL_LIBRARIES} ${RT_LIBRARY} ${VJSON_LIBRARIES}
...@@ -1024,13 +1024,14 @@ if (BUILD_SERVER) ...@@ -1024,13 +1024,14 @@ if (BUILD_SERVER)
set_target_properties (cvmfs_server_debug PROPERTIES set_target_properties (cvmfs_server_debug PROPERTIES
VERSION ${CernVM-FS_VERSION_STRING} VERSION ${CernVM-FS_VERSION_STRING}
COMPILE_FLAGS "${LIBCVMFS_SERVER_CFLAGS} -DDEBUGMSG -g -O0") COMPILE_FLAGS "${LIBCVMFS_SERVER_CFLAGS} -DDEBUGMSG -g -O0")
target_link_libraries (cvmfs_server_debug ${LIBCVMFS_SERVER_LIBS} ${LIBCVMFS_SERVER_LINK_LIBRARIES}) target_link_libraries (cvmfs_server_debug cvmfs_util_debug
${LIBCVMFS_SERVER_LIBS} ${LIBCVMFS_SERVER_LINK_LIBRARIES})
add_executable (cvmfs_publish_debug ${CVMFS_PUBLISH_SOURCES}) add_executable (cvmfs_publish_debug ${CVMFS_PUBLISH_SOURCES})
set_target_properties (cvmfs_publish_debug set_target_properties (cvmfs_publish_debug
PROPERTIES COMPILE_FLAGS "${CVMFS_PUBLISH_CFLAGS} -DDEBUGMSG -g -O0" PROPERTIES COMPILE_FLAGS "${CVMFS_PUBLISH_CFLAGS} -DDEBUGMSG -g -O0"
LINK_FLAGS "${CVMFS_PUBLISH_LD_FLAGS}") LINK_FLAGS "${CVMFS_PUBLISH_LD_FLAGS}")
target_link_libraries (cvmfs_publish_debug cvmfs_server_debug) target_link_libraries (cvmfs_publish_debug cvmfs_util_debug cvmfs_server_debug)
endif (BUILD_SERVER_DEBUG) endif (BUILD_SERVER_DEBUG)
endif (BUILD_SERVER) endif (BUILD_SERVER)
......
...@@ -29,7 +29,7 @@ int CmdCommit::Main(const Options &options) { ...@@ -29,7 +29,7 @@ int CmdCommit::Main(const Options &options) {
if (!options.plain_args().empty()) { if (!options.plain_args().empty()) {
std::vector<std::string> tokens = std::vector<std::string> tokens =
SplitString(options.plain_args()[0].value_str, '/', 2); SplitStringBounded(2, options.plain_args()[0].value_str, '/');
fqrn = tokens[0]; fqrn = tokens[0];
} }
......
...@@ -29,7 +29,7 @@ int CmdTransaction::Main(const Options &options) { ...@@ -29,7 +29,7 @@ int CmdTransaction::Main(const Options &options) {
std::string lease_path; std::string lease_path;
if (!options.plain_args().empty()) { if (!options.plain_args().empty()) {
std::vector<std::string> tokens = std::vector<std::string> tokens =
SplitString(options.plain_args()[0].value_str, '/', 2); SplitStringBounded(2, options.plain_args()[0].value_str, '/');
fqrn = tokens[0]; fqrn = tokens[0];
if (tokens.size() == 2) if (tokens.size() == 2)
lease_path = MakeCanonicalPath(tokens[1]); lease_path = MakeCanonicalPath(tokens[1]);
......
...@@ -57,7 +57,7 @@ bool SpecTree::IsMatching(std::string path) { ...@@ -57,7 +57,7 @@ bool SpecTree::IsMatching(std::string path) {
if (path.length() > 0 && path.at(path.length()-1) == '/') { if (path.length() > 0 && path.at(path.length()-1) == '/') {
path.erase(path.length()-1); path.erase(path.length()-1);
} }
std::vector<std::string> path_parts = SplitString(path, '/', 256); std::vector<std::string> path_parts = SplitString(path, '/');
for (std::vector<std::string>::const_iterator part_it = path_parts.begin()+1; for (std::vector<std::string>::const_iterator part_it = path_parts.begin()+1;
part_it != path_parts.end(); part_it != path_parts.end();
part_it++) { part_it++) {
...@@ -147,9 +147,8 @@ void SpecTree::Parse(FILE *spec_file) { ...@@ -147,9 +147,8 @@ void SpecTree::Parse(FILE *spec_file) {
} }
char passthrough_mode = '_'; char passthrough_mode = '_';
if (inclusion_mode == '!') passthrough_mode = '-'; if (inclusion_mode == '!') passthrough_mode = '-';
// TODO(steuber): max_chunks?
// Split remaining path into its parts // Split remaining path into its parts
std::vector<std::string> path_parts = SplitString(line, '/', 256); std::vector<std::string> path_parts = SplitString(line, '/');
cur_node = node_cache.top()->node; cur_node = node_cache.top()->node;
// Store second last mode to check whether it is NOT passthrough! // Store second last mode to check whether it is NOT passthrough!
char past_1_mode = node_cache.top()->node->mode; char past_1_mode = node_cache.top()->node->mode;
...@@ -206,7 +205,7 @@ int SpecTree::ListDir(const char *dir, ...@@ -206,7 +205,7 @@ int SpecTree::ListDir(const char *dir,
if (path.length() > 0 && path.at(path.length()-1) == '/') { if (path.length() > 0 && path.at(path.length()-1) == '/') {
path.erase(path.length()-1); path.erase(path.length()-1);
} }
std::vector<std::string> path_parts = SplitString(path, '/', 256); std::vector<std::string> path_parts = SplitString(path, '/');
for (std::vector<std::string>::const_iterator part_it = path_parts.begin()+1; for (std::vector<std::string>::const_iterator part_it = path_parts.begin()+1;
part_it != path_parts.end(); part_it != path_parts.end();
part_it++) { part_it++) {
......
...@@ -325,7 +325,7 @@ void SyncItem::CheckGraft() { ...@@ -325,7 +325,7 @@ void SyncItem::CheckGraft() {
if (!trimmed_line.size()) {continue;} if (!trimmed_line.size()) {continue;}
if (trimmed_line[0] == '#') {continue;} if (trimmed_line[0] == '#') {continue;}
std::vector<std::string> info = SplitString(trimmed_line, '=', 2); std::vector<std::string> info = SplitStringBounded(2, trimmed_line, '=');
if (info.size() != 2) { if (info.size() != 2) {
LogCvmfs(kLogFsTraversal, kLogWarning, "Invalid line in graft file: %s", LogCvmfs(kLogFsTraversal, kLogWarning, "Invalid line in graft file: %s",
......
if (BUILD_CVMFS OR BUILD_SERVER OR BUILD_RECEIVER OR
BUILD_SHRINKWRAP OR BUILD_PRELOADER OR BUILD_UNITTESTS)
set (LIBCVMFS_UTIL_SOURCES
util/string.cc
)
set (LIBCVMFS_UTIL_CFLAGS "${CMAKE_CXX_FLAGS} \
-D_FILE_OFFSET_BITS=64 \
-DCVMFS_LIBRARY \
-DCVMFS_RAISE_EXCEPTIONS \
-fexceptions")
set (LIBCVMFS_UTIL_LINK_LIBRARIES "")
list (APPEND LIBCVMFS_UTIL_LINK_LIBRARIES
${RT_LIBRARY}
pthread
dl)
add_library(cvmfs_util SHARED ${LIBCVMFS_UTIL_SOURCES})
set_target_properties (cvmfs_util PROPERTIES
VERSION ${CernVM-FS_VERSION_STRING}
COMPILE_FLAGS "${LIBCVMFS_UTIL_CFLAGS}")
target_link_libraries (cvmfs_util ${LIBCVMFS_UTIL_LINK_LIBRARIES})
install (TARGETS cvmfs_util LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if (BUILD_SERVER_DEBUG OR BUILD_RECEIVER_DEBUG OR BUILD_UNITTESTS_DEBUG)
add_library(cvmfs_util_debug SHARED ${LIBCVMFS_UTIL_SOURCES})
set_target_properties (cvmfs_util_debug PROPERTIES
VERSION ${CernVM-FS_VERSION_STRING}
COMPILE_FLAGS "${LIBCVMFS_UTIL_CFLAGS} -DDEBUGMSG -g -O0")
target_link_libraries (cvmfs_util_debug ${LIBCVMFS_UTIL_LINK_LIBRARIES})
install (TARGETS cvmfs_util_debug LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif () # debug binaries
endif () # components that need libcvmfs-util
/**
* This file is part of the CernVM File System.
*/
#ifndef CVMFS_UTIL_EXPORT_H_
#define CVMFS_UTIL_EXPORT_H_
#ifdef CVMFS_LIBRARY
#define CVMFS_EXPORT __attribute__((visibility("default")))
#else
#define CVMFS_EXPORT
#endif
#endif // CVMFS_UTIL_EXPORT_H_
...@@ -285,8 +285,13 @@ bool HasSuffix(const std::string &str, const std::string &suffix, ...@@ -285,8 +285,13 @@ bool HasSuffix(const std::string &str, const std::string &suffix,
: std::equal(suffix.rbegin(), suffix.rend(), str.rbegin()); : std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
} }
vector<string> SplitString(const string &str, const char delim, vector<string> SplitString(const string &str, char delim) {
const unsigned max_chunks) { return SplitStringBounded(0, str, delim);
}
vector<string> SplitStringBounded(
unsigned max_chunks, const string &str, char delim)
{
vector<string> result; vector<string> result;
// edge case... one chunk is always the whole string // edge case... one chunk is always the whole string
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "util/export.h"
const int kTrimNone = 0; const int kTrimNone = 0;
const int kTrimLeading = 1 << 0; const int kTrimLeading = 1 << 0;
const int kTrimTrailing = 1 << 1; const int kTrimTrailing = 1 << 1;
...@@ -22,54 +24,62 @@ const int kTrimAll = kTrimLeading | kTrimTrailing; ...@@ -22,54 +24,62 @@ const int kTrimAll = kTrimLeading | kTrimTrailing;
namespace CVMFS_NAMESPACE_GUARD { namespace CVMFS_NAMESPACE_GUARD {
#endif #endif
std::string StringifyBool(const bool value); CVMFS_EXPORT std::string StringifyBool(const bool value);
std::string StringifyInt(const int64_t value); CVMFS_EXPORT std::string StringifyInt(const int64_t value);
std::string StringifyUint(const uint64_t value); CVMFS_EXPORT std::string StringifyUint(const uint64_t value);
std::string StringifyByteAsHex(const unsigned char value); CVMFS_EXPORT std::string StringifyByteAsHex(const unsigned char value);
std::string StringifyDouble(const double value); CVMFS_EXPORT std::string StringifyDouble(const double value);
std::string StringifyTime(const time_t seconds, const bool utc); CVMFS_EXPORT std::string StringifyTime(const time_t seconds, const bool utc);
std::string StringifyTimeval(const timeval value); CVMFS_EXPORT std::string StringifyTimeval(const timeval value);
std::string RfcTimestamp(); CVMFS_EXPORT std::string RfcTimestamp();
std::string IsoTimestamp(); CVMFS_EXPORT std::string IsoTimestamp();
std::string WhitelistTimestamp(time_t when); CVMFS_EXPORT std::string WhitelistTimestamp(time_t when);
time_t IsoTimestamp2UtcTime(const std::string &iso8601); CVMFS_EXPORT time_t IsoTimestamp2UtcTime(const std::string &iso8601);
int64_t String2Int64(const std::string &value); CVMFS_EXPORT int64_t String2Int64(const std::string &value);
uint64_t String2Uint64(const std::string &value); CVMFS_EXPORT uint64_t String2Uint64(const std::string &value);
bool String2Uint64Parse(const std::string &value, uint64_t *result); CVMFS_EXPORT bool String2Uint64Parse(const std::string &value,
uint64_t *result);
void String2Uint64Pair(const std::string &value, uint64_t *a, uint64_t *b); CVMFS_EXPORT void String2Uint64Pair(const std::string &value,
bool HasPrefix(const std::string &str, const std::string &prefix, uint64_t *a, uint64_t *b);
CVMFS_EXPORT bool HasPrefix(const std::string &str, const std::string &prefix,
const bool ignore_case); const bool ignore_case);
bool HasSuffix(const std::string &str, const std::string &suffix, CVMFS_EXPORT bool HasSuffix(const std::string &str, const std::string &suffix,
const bool ignore_case); const bool ignore_case);
std::vector<std::string> SplitString(const std::string &str, const char delim, CVMFS_EXPORT std::vector<std::string> SplitStringBounded(
const unsigned max_chunks = 0); unsigned max_chunks, const std::string &str, char delim);
std::string JoinStrings(const std::vector<std::string> &strings, CVMFS_EXPORT std::vector<std::string> SplitString(const std::string &str,
char delim);
CVMFS_EXPORT std::string JoinStrings(const std::vector<std::string> &strings,
const std::string &joint); const std::string &joint);
void ParseKeyvalMem(const unsigned char *buffer, const unsigned buffer_size, CVMFS_EXPORT void ParseKeyvalMem(const unsigned char *buffer,
const unsigned buffer_size,
std::map<char, std::string> *content); std::map<char, std::string> *content);
bool ParseKeyvalPath(const std::string &filename, CVMFS_EXPORT bool ParseKeyvalPath(const std::string &filename,
std::map<char, std::string> *content); std::map<char, std::string> *content);
std::string GetLineMem(const char *text, const int text_size); CVMFS_EXPORT std::string GetLineMem(const char *text, const int text_size);
bool GetLineFile(FILE *f, std::string *line); CVMFS_EXPORT bool GetLineFile(FILE *f, std::string *line);
bool GetLineFd(const int fd, std::string *line); CVMFS_EXPORT bool GetLineFd(const int fd, std::string *line);
std::string Trim(const std::string &raw, bool trim_newline = false); CVMFS_EXPORT std::string Trim(const std::string &raw,
std::string TrimString(const std::string& path, bool trim_newline = false);
CVMFS_EXPORT std::string TrimString(const std::string& path,
const std::string& toTrim, const std::string& toTrim,
const int trimMode = kTrimAll); const int trimMode = kTrimAll);
std::string ToUpper(const std::string &mixed_case); CVMFS_EXPORT std::string ToUpper(const std::string &mixed_case);
std::string ReplaceAll(const std::string &haystack, const std::string &needle, CVMFS_EXPORT std::string ReplaceAll(const std::string &haystack,
const std::string &needle,
const std::string &replace_by); const std::string &replace_by);
std::string Tail(const std::string &source, unsigned num_lines); CVMFS_EXPORT std::string Tail(const std::string &source, unsigned num_lines);
std::string Base64(const std::string &data);
std::string Base64Url(const std::string &data);
bool Debase64(const std::string &data, std::string *decoded);
std::string GetGMTimestamp(const std::string &format = "%Y-%m-%d %H:%M:%S");
CVMFS_EXPORT std::string Base64(const std::string &data);
CVMFS_EXPORT std::string Base64Url(const std::string &data);
CVMFS_EXPORT bool Debase64(const std::string &data, std::string *decoded);
CVMFS_EXPORT std::string GetGMTimestamp(
const std::string &format = "%Y-%m-%d %H:%M:%S");
#ifdef CVMFS_NAMESPACE_GUARD #ifdef CVMFS_NAMESPACE_GUARD
} // namespace CVMFS_NAMESPACE_GUARD } // namespace CVMFS_NAMESPACE_GUARD
......
...@@ -18,10 +18,19 @@ Homepage: http://cernvm.cern.ch ...@@ -18,10 +18,19 @@ Homepage: http://cernvm.cern.ch
Description: CernVM File System Description: CernVM File System
HTTP File System for Distributing Software to CernVM. HTTP File System for Distributing Software to CernVM.
Package: cvmfs-libs
Architecture: i386 amd64 armhf arm64
#Pre-Depends: ${misc:Pre-Depends} (preparation for multiarch support)
Depends: ${misc:Depends}
#Multi-Arch: same (preparation for multiarch support)
Homepage: http://cernvm.cern.ch
Description: CernVM-FS common libraries
Common utility libraries for CernVM-FS packages.
Package: cvmfs-server Package: cvmfs-server
Architecture: i386 amd64 armhf arm64 Architecture: i386 amd64 armhf arm64
#Pre-Depends: ${misc:Pre-Depends} (preparation for multiarch support) #Pre-Depends: ${misc:Pre-Depends} (preparation for multiarch support)
Depends: psmisc, curl, attr, openssl, libcap2, libcap2-bin, lsof, rsync, jq, usbutils, sqlite3, ${misc:Depends} Depends: psmisc, curl, attr, openssl, libcap2, libcap2-bin, lsof, rsync, jq, usbutils, sqlite3, cvmfs-libs (= ${binary:Version}), ${misc:Depends}
Recommends: apache2 Recommends: apache2
Conflicts: cvmfs-server (<< 2.1) Conflicts: cvmfs-server (<< 2.1)
#Multi-Arch: same (preparation for multiarch support) #Multi-Arch: same (preparation for multiarch support)
......
usr/lib/libcvmfs_util.so.@CVMFS_VERSION@
usr/lib/libcvmfs_util.so
usr/lib/libcvmfs_util_debug.so.@CVMFS_VERSION@
usr/lib/libcvmfs_util_debug.so
...@@ -45,7 +45,7 @@ clean: ...@@ -45,7 +45,7 @@ clean:
debian/%.install: debian/%.install.in debian/%.install: debian/%.install.in
sed "s/@CVMFS_VERSION@/$(shell dpkg-parsechangelog | sed -n -e 's/^Version: \([0-9]\.[0-9][0-9]\.[0-9][0-9]*\).*/\1/p')/g" $< > $@ sed "s/@CVMFS_VERSION@/$(shell dpkg-parsechangelog | sed -n -e 's/^Version: \([0-9]\.[0-9][0-9]\.[0-9][0-9]*\).*/\1/p')/g" $< > $@
install: build debian/cvmfs.install debian/cvmfs-server.install debian/cvmfs-unittests.install debian/cvmfs-fuse3.install debian/cvmfs-gateway.install install: build debian/cvmfs-libs.install debian/cvmfs.install debian/cvmfs-server.install debian/cvmfs-unittests.install debian/cvmfs-fuse3.install debian/cvmfs-gateway.install
dh_testdir dh_testdir
dh_testroot dh_testroot
dh_prep dh_prep
......
...@@ -191,6 +191,11 @@ HTTP File System for Distributing Software to CernVM. ...@@ -191,6 +191,11 @@ HTTP File System for Distributing Software to CernVM.
See http://cernvm.cern.ch See http://cernvm.cern.ch
Copyright (c) CERN Copyright (c) CERN
%package libs
Summary: CernVM-FS common libraries
%description libs
Common utility libraries for CernVM-FS packages
%if 0%{?build_fuse3} %if 0%{?build_fuse3}
%package fuse3 %package fuse3
Summary: additional libraries to enable libfuse3 support Summary: additional libraries to enable libfuse3 support
...@@ -251,6 +256,7 @@ Requires: jq ...@@ -251,6 +256,7 @@ Requires: jq
Requires(post): /usr/sbin/semanage Requires(post): /usr/sbin/semanage
Requires(postun): /usr/sbin/semanage Requires(postun): /usr/sbin/semanage
%endif %endif
Requires: cvmfs-libs = %{version}
Conflicts: cvmfs-server < 2.1 Conflicts: cvmfs-server < 2.1
...@@ -488,6 +494,9 @@ if [ -d /var/run/cvmfs ]; then ...@@ -488,6 +494,9 @@ if [ -d /var/run/cvmfs ]; then
fi fi
: :
%post libs
/sbin/ldconfig
%if 0%{?build_fuse3} %if 0%{?build_fuse3}
%post fuse3 %post fuse3
/sbin/ldconfig /sbin/ldconfig
...@@ -564,6 +573,9 @@ fi ...@@ -564,6 +573,9 @@ fi
%endif %endif
/sbin/ldconfig /sbin/ldconfig
%postun libs
/sbin/ldconfig
%if 0%{?build_gateway} %if 0%{?build_gateway}
%postun gateway %postun gateway
systemctl daemon-reload systemctl daemon-reload
...@@ -607,6 +619,14 @@ systemctl daemon-reload ...@@ -607,6 +619,14 @@ systemctl daemon-reload
%config(noreplace) %{_sysconfdir}/bash_completion.d/cvmfs %config(noreplace) %{_sysconfdir}/bash_completion.d/cvmfs
%doc COPYING AUTHORS README.md ChangeLog %doc COPYING AUTHORS README.md ChangeLog
%files libs
%defattr(-,root,root)
%{_libdir}/libcvmfs_util.so
%{_libdir}/libcvmfs_util.so.%{version}
%{_libdir}/libcvmfs_util_debug.so
%{_libdir}/libcvmfs_util_debug.so.%{version}
%doc COPYING AUTHORS README.md ChangeLog
%if 0%{?build_fuse3} %if 0%{?build_fuse3}
%files fuse3 %files fuse3
%defattr(-,root,root) %defattr(-,root,root)
......
...@@ -10,6 +10,7 @@ install_from_repo epel-release ...@@ -10,6 +10,7 @@ install_from_repo epel-release
# install CernVM-FS RPM packages # install CernVM-FS RPM packages
echo "installing RPM packages... " echo "installing RPM packages... "
install_rpm "$CONFIG_PACKAGES" install_rpm "$CONFIG_PACKAGES"
install_rpm $LIBS_PACKAGE
install_rpm $CLIENT_PACKAGE install_rpm $CLIENT_PACKAGE
install_rpm $UNITTEST_PACKAGE install_rpm $UNITTEST_PACKAGE
......
...@@ -10,6 +10,7 @@ install_from_repo epel-release ...@@ -10,6 +10,7 @@ install_from_repo epel-release
# install CernVM-FS RPM packages # install CernVM-FS RPM packages
echo "installing RPM packages... " echo "installing RPM packages... "
install_rpm "$CONFIG_PACKAGES" install_rpm "$CONFIG_PACKAGES"
install_rpm $LIBS_PACKAGE
install_rpm $CLIENT_PACKAGE install_rpm $CLIENT_PACKAGE
install_rpm $UNITTEST_PACKAGE install_rpm $UNITTEST_PACKAGE
install_rpm $FUSE3_PACKAGE install_rpm $FUSE3_PACKAGE
......
...@@ -10,6 +10,7 @@ install_from_repo epel-release ...@@ -10,6 +10,7 @@ install_from_repo epel-release
# install CernVM-FS RPM packages # install CernVM-FS RPM packages
echo "installing RPM packages... " echo "installing RPM packages... "
install_rpm "$CONFIG_PACKAGES" install_rpm "$CONFIG_PACKAGES"
install_rpm $LIBS_PACKAGE
install_rpm $CLIENT_PACKAGE install_rpm $CLIENT_PACKAGE
install_rpm $UNITTEST_PACKAGE install_rpm $UNITTEST_PACKAGE
......
...@@ -10,6 +10,7 @@ install_from_repo epel-release ...@@ -10,6 +10,7 @@ install_from_repo epel-release
# install CernVM-FS RPM packages # install CernVM-FS RPM packages
echo "installing RPM packages... " echo "installing RPM packages... "
install_rpm "$CONFIG_PACKAGES" install_rpm "$CONFIG_PACKAGES"
install_rpm $LIBS_PACKAGE
install_rpm $CLIENT_PACKAGE install_rpm $CLIENT_PACKAGE
install_rpm $UNITTEST_PACKAGE install_rpm $UNITTEST_PACKAGE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment