diff --git a/libzypp/.gitignore b/libzypp/.gitignore deleted file mode 100644 index b81adcd..0000000 --- a/libzypp/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -build -*.orig -*.rej -*.swp -#* -.#* -*# -.*project -.externalToolBuilders -.settings -*flymake.h.gch diff --git a/libzypp/CMakeLists.txt b/libzypp/CMakeLists.txt deleted file mode 100644 index 47786d4..0000000 --- a/libzypp/CMakeLists.txt +++ /dev/null @@ -1,258 +0,0 @@ -PROJECT(LIBZYPP) -SET( PACKAGE "libzypp" ) -# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked -SET( CMAKE_MODULE_PATH ${LIBZYPP_SOURCE_DIR}/cmake/modules ) -cmake_minimum_required(VERSION 2.6) - -OPTION (ENABLE_BUILD_DOCS "Build documentation by default?" OFF) -OPTION (ENABLE_BUILD_TRANS "Build translation files by default?" OFF) -OPTION (ENABLE_BUILD_TESTS "Build and run test suite by default?" OFF) - -OPTION (DISABLE_LIBPROXY "Build without libproxy support even if package is installed?" OFF) -OPTION (DISABLE_AUTODOCS "Do not require doxygen being installed (required to build autodocs)?" OFF) - -#-------------------------------------------------------------------------------- -SET (have_system x) - -IF (DEBIAN) - MESSAGE (STATUS "Building for Debian") - SET (ENABLE_BUILD_DOCS ON) - SET (ENABLE_BUILD_TRANS ON) - SET (ENABLE_BUILD_TESTS ON) - SET (have_system ${have_system}x) -ENDIF (DEBIAN) - -IF (${have_system} STREQUAL x) - MESSAGE (STATUS "Building for SUSE") -ENDIF (${have_system} STREQUAL x) - -IF (${have_system} STRGREATER xx) - MESSAGE (FATAL_ERROR "Can only build for one system type.") -ENDIF (${have_system} STRGREATER xx) -#-------------------------------------------------------------------------------- - -# allow name libraries by name mixed with full -# paths -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - -INCLUDE(ZyppCommon) -INCLUDE( ${LIBZYPP_SOURCE_DIR}/VERSION.cmake ) - -MATH( EXPR LIBZYPP_CURRENT "${LIBZYPP_MAJOR} * 100 + ${LIBZYPP_MINOR}" ) -MATH( EXPR LIBZYPP_AGE "${LIBZYPP_MINOR} - ${LIBZYPP_COMPATMINOR}" ) -# Libtool wanted current:patch:age -# But cmake is not libtool, it wants the verbatim suffix to libzypp.so -MATH( EXPR LIBZYPP_SO_FIRST "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" ) -SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" ) - -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) -CHECK_C_COMPILER_FLAG("-Werror=format-security" CC_FORMAT_SECURITY) -CHECK_CXX_COMPILER_FLAG("-Werror=format-security" CXX_FORMAT_SECURITY) - -SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed -std=c++11" ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -fPIC -g -rdynamic -Wall -Wl,-as-needed" ) - -set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" ) -set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" ) - -IF(${CC_FORMAT_SECURITY}) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security") -ENDIF(${CC_FORMAT_SECURITY}) - -IF(${CXX_FORMAT_SECURITY}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security") -ENDIF(${CXX_FORMAT_SECURITY}) - -INCLUDE(CheckFunctionExists) -CHECK_FUNCTION_EXISTS(pipe2 PIPE2_FOUND) -IF(${PIPE2_FOUND}) - ADD_DEFINITIONS(-DHAVE_PIPE2) -ENDIF(${PIPE2_FOUND}) - -ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 ) -ADD_DEFINITIONS( -DVERSION="${VERSION}" ) -SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" ) -SET( LIBZYPP_SOVERSION_INFO "${LIBZYPP_SO_FIRST}" ) - -GENERATE_PACKAGING(${PACKAGE} ${VERSION}) - -INCLUDE(CPack) - -MACRO(ADD_TESTS) - FOREACH( loop_var ${ARGV} ) - SET_SOURCE_FILES_PROPERTIES( ${loop_var}_test.cc COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN -DBOOST_AUTO_TEST_MAIN=\"\" " ) - ADD_EXECUTABLE( ${loop_var}_test ${loop_var}_test.cc ) - TARGET_LINK_LIBRARIES( ${loop_var}_test zypp ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} zypp_test_utils) - ADD_TEST( ${loop_var}_test ${CMAKE_CURRENT_BINARY_DIR}/${loop_var}_test --catch_system_errors=no) - ENDFOREACH( loop_var ) -ENDMACRO(ADD_TESTS) - -#################################################################### -# prefer packages using the same install prefix as we do -SET(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX} usr/localX /usr/local /usr) - -FIND_PACKAGE(Rpm REQUIRED) -IF ( NOT RPM_FOUND) - MESSAGE( FATAL_ERROR " rpm-devel not found" ) -ELSE ( NOT RPM_FOUND) - INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR}) - # fix includes not relative to rpm - INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR}/rpm) - if ( RPM_SUSPECT_VERSION STREQUAL "5.x" ) - MESSAGE( STATUS "rpm found: enable rpm-4 compat interface." ) - ADD_DEFINITIONS(-D_RPM_5) - elseif ( RPM_SUSPECT_VERSION STREQUAL "4.x" ) - MESSAGE( STATUS "rpm found: use rpm-4.x interface." ) - ADD_DEFINITIONS(-D_RPM_4_X) - elseif ( RPM_SUSPECT_VERSION STREQUAL "4.4" ) - MESSAGE( STATUS "rpm found: enable rpm-4.4 legacy interface." ) - ADD_DEFINITIONS(-D_RPM_4_4) - endif ( RPM_SUSPECT_VERSION STREQUAL "5.x" ) -ENDIF( NOT RPM_FOUND) - -FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options thread unit_test_framework) -IF (Boost_FOUND) - MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}") - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) - LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) -ENDIF(Boost_FOUND) - -FIND_PACKAGE(Gettext REQUIRED) -IF (GETTEXT_FOUND) - MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}") - INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR}) -ELSE (GETTEXT_FOUND) - MESSAGE( FATAL_ERROR "Gettext not found" ) -ENDIF (GETTEXT_FOUND) - -FIND_PACKAGE(CURL REQUIRED) -IF ( NOT CURL_FOUND) - MESSAGE( FATAL_ERROR " curl not found" ) -ELSE ( NOT CURL_FOUND) - INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) -ENDIF( NOT CURL_FOUND) - -FIND_PACKAGE(LibXml2 REQUIRED) -IF ( NOT LIBXML2_FOUND) - MESSAGE( FATAL_ERROR " libxml not found" ) -ELSE ( NOT LIBXML2_FOUND) - INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) -ENDIF( NOT LIBXML2_FOUND) - -FIND_PACKAGE(ZLIB REQUIRED) -IF ( NOT ZLIB_FOUND) - MESSAGE( FATAL_ERROR " zlib not found" ) -ELSE ( NOT ZLIB_FOUND) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) -ENDIF( NOT ZLIB_FOUND) - -#SET(LibSolv_USE_STATIC_LIBS ON) -FIND_PACKAGE(LibSolv REQUIRED ext) -IF ( NOT LibSolv_FOUND ) - MESSAGE( FATAL_ERROR " libsolv not found" ) -ELSE() - INCLUDE_DIRECTORIES( ${LibSolv_INCLUDE_DIRS} ) -ENDIF() - -# libsolv uses expat and has open references to it: -FIND_PACKAGE(EXPAT REQUIRED) - -FIND_PACKAGE(OpenSSL REQUIRED) - -FIND_PACKAGE(Udev) -IF ( NOT UDEV_FOUND ) - FIND_PACKAGE(Hal) - IF ( NOT HAL_FOUND ) - MESSAGE(WARNING "No udev or HAL. CD device detection will be poor") - ELSE ( NOT HAL_FOUND ) - ADD_DEFINITIONS(-DHAVE_HAL) - INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}) - INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal) - # HAL requires working dbus - FIND_PACKAGE(Dbus REQUIRED) - IF(DBUS_FOUND) - INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR}) - INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR}) - ENDIF(DBUS_FOUND) - ENDIF ( NOT HAL_FOUND ) -ELSE ( NOT UDEV_FOUND ) - ADD_DEFINITIONS(-DHAVE_UDEV) -ENDIF ( NOT UDEV_FOUND ) - -IF( DISABLE_LIBPROXY ) - MESSAGE( STATUS "libproxy support disabled" ) -ELSE( DISABLE_LIBPROXY ) - FIND_PACKAGE(libproxy) - IF ( NOT LIBPROXY_FOUND ) - MESSAGE( STATUS "libproxy not found" ) - ELSE ( NOT LIBPROXY_FOUND ) - INCLUDE_DIRECTORIES( ${LIBPROXY_INCLUDE_DIR} ) - ADD_DEFINITIONS(-D_WITH_LIBPROXY_SUPPORT_) - ENDIF( NOT LIBPROXY_FOUND ) -ENDIF( DISABLE_LIBPROXY ) - -FIND_PROGRAM( DOXYGEN doxygen ) -IF ( NOT DOXYGEN ) - IF ( DISABLE_AUTODOCS ) - MESSAGE( STATUS "doxygen is not available. Can't build the documentation." ) - ELSE ( DISABLE_AUTODOCS ) - MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation!" ) - ENDIF ( DISABLE_AUTODOCS ) -ELSE ( NOT DOXYGEN ) - MESSAGE( STATUS "doxygen found: ${DOXYGEN}" ) -ENDIF ( NOT DOXYGEN ) - -MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}") -MESSAGE(STATUS "version: ${VERSION}") - -MESSAGE(STATUS "Writing pkg-config file...") -CONFIGURE_FILE(${LIBZYPP_SOURCE_DIR}/libzypp.pc.cmake ${LIBZYPP_BINARY_DIR}/libzypp.pc @ONLY) -INSTALL( FILES ${LIBZYPP_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) - -MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules") -INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ) -INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ) - -#################################################################### -# config templates -# (don't forget to mention them in the .spec file) -#################################################################### - -MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp") -INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp ) - -#install systemCheck -MESSAGE(STATUS "systemCheck will be installed in ${SYSCONFDIR}/zypp") -INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/systemCheck DESTINATION ${SYSCONFDIR}/zypp ) - -# logrotate config file -INSTALL( FILES ${LIBZYPP_SOURCE_DIR}/zypp-history.lr DESTINATION ${SYSCONFDIR}/logrotate.d ) - -#################################################################### -# SUBDIRECTORIES # -#################################################################### - -ADD_SUBDIRECTORY( zypp ) -# do not build devel by default -ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL ) -ADD_SUBDIRECTORY( tools ) -ADD_SUBDIRECTORY( examples ) -ADD_SUBDIRECTORY( doc ) -ADD_SUBDIRECTORY( vendor ) - -IF ( ENABLE_BUILD_TRANS ) - ADD_SUBDIRECTORY( po ) -ELSE ( ENABLE_BUILD_TRANS ) - ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL ) -ENDIF ( ENABLE_BUILD_TRANS ) - -IF ( ENABLE_BUILD_TESTS ) - ADD_SUBDIRECTORY( tests ) -ELSE ( ENABLE_BUILD_TESTS ) - ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL ) -ENDIF ( ENABLE_BUILD_TESTS ) -INCLUDE(CTest) -ENABLE_TESTING() diff --git a/libzypp/COPYING b/libzypp/COPYING deleted file mode 100644 index 9cfa7ad..0000000 --- a/libzypp/COPYING +++ /dev/null @@ -1,21 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -Copyright (C) 2000-2002 Ximian, Inc. -Copyright (C) 2005 SUSE Linux Products GmbH - -ZYpp is licensed under the GNU General Public License version 2 -or later. The text of the GNU General Public License can be viewed at -http://www.gnu.org/licenses/gpl.html - -As a special exception, you have permission to link this program -with the following libraries and distribute executables, as long as you -follow the requirements of the GNU GPL in regard to all of the -software in the executable aside from the following libraries: -- OpenSSL (http://www.openssl.org) \ No newline at end of file diff --git a/libzypp/Makefile.cvs b/libzypp/Makefile.cvs deleted file mode 100644 index 3dfffe4..0000000 --- a/libzypp/Makefile.cvs +++ /dev/null @@ -1,30 +0,0 @@ -# Generic Makefile.cvs for CMake-based projects: -# -# Create a subdirecory build/ and call cmake from there with /usr prefix. -# -# Intentionally using /usr rather than the default /usr/local since this is for -# internal use, and we are the distribution makers: /usr/local is off limits -# for us. -# -# Author: Stefan Hundhammer - -BUILD_SUBDIR = build -HERE_FROM_BUILD_SUBDIR = .. -PREFIX = /usr -CMAKE = /usr/bin/cmake - -all: cmake - - -cmake: create-build-subdir create-toplevel-makefile - ( cd $(BUILD_SUBDIR) && $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(HERE_FROM_BUILD_SUBDIR) ) - - -create-build-subdir: - test -d $(BUILD_SUBDIR) || mkdir $(BUILD_SUBDIR) - - -create-toplevel-makefile: - echo 'all:' >Makefile - echo -e '\t$$(MAKE) $$(MAKEFLAGS) -C $(BUILD_SUBDIR)' >>Makefile - diff --git a/libzypp/TODO b/libzypp/TODO deleted file mode 100644 index c4378d6..0000000 --- a/libzypp/TODO +++ /dev/null @@ -1,9 +0,0 @@ - -API Cleanups: -============= - -Source.h -- remove const from return types: - ie: const Pathname providePackage( Package::constPtr package ); -- pass by reference - resolvables(zypp::Resolvable::Kind kind) const; diff --git a/libzypp/VERSION.cmake b/libzypp/VERSION.cmake deleted file mode 100644 index 3820e38..0000000 --- a/libzypp/VERSION.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# ================================================== -# Versioning -# ========== -# -# MAJOR Major number for this branch. -# -# MINOR The most recent interface number this -# library implements. -# -# COMPATMINOR The latest binary compatible minor number -# this library implements. -# -# PATCH The implementation number of the current interface. -# -# -# - The package VERSION will be MAJOR.MINOR.PATCH. -# -# - Libtool's -version-info will be derived from MAJOR, MINOR, PATCH -# and COMPATMINOR (see configure.ac). -# -# - Changing MAJOR always breaks binary compatibility. -# -# - Changing MINOR doesn't break binary compatibility by default. -# Only if COMPATMINOR is changed as well. -# -# -# 1) After branching from TRUNK increment TRUNKs MAJOR and -# start with version `MAJOR.0.0' and also set COMPATMINOR to 0. -# -# 2) Update the version information only immediately before a public release -# of your software. More frequent updates are unnecessary, and only guarantee -# that the current interface number gets larger faster. -# -# 3) If the library source code has changed at all since the last update, -# then increment PATCH. -# -# 4) If any interfaces have been added, removed, or changed since the last -# update, increment MINOR, and set PATCH to 0. -# -# 5) If any interfaces have been added since the last public release, then -# leave COMPATMINOR unchanged. (binary compatible change) -# -# 6) If any interfaces have been removed since the last public release, then -# set COMPATMINOR to MINOR. (binary incompatible change) -# ================================================== - -#======= -# - MOST IMPORTANT: -# - Before you submitt to git: -# - Remember the new version in 'LAST RELEASED:' -# - State the new version in the changes file by adding a line -# "- version MAJOR.MINOR.PATCH (COMPATMINOR)" -# - Commit changes and version files together in a separate -# commit using -m 'changes MAJOR.MINOR.PATCH (COMPATMINOR)' -# - Tag the above commit with 'MAJOR.MINOR.PATCH' using -# -m "tagging MAJOR.MINOR.PATCH". -# -# - Consider calling ./mkChangelog to assist you. -# See './mkChangelog -h' for help. -# -SET(LIBZYPP_MAJOR "14") -SET(LIBZYPP_COMPATMINOR "30") -SET(LIBZYPP_MINOR "35") -SET(LIBZYPP_PATCH "0") -# -# LAST RELEASED: 14.35.0 (30) -# (The number in parenthesis is LIBZYPP_COMPATMINOR) -#======= diff --git a/libzypp/cmake/modules/FindDbus.cmake b/libzypp/cmake/modules/FindDbus.cmake deleted file mode 100644 index d79cd9a..0000000 --- a/libzypp/cmake/modules/FindDbus.cmake +++ /dev/null @@ -1,37 +0,0 @@ - -if(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR) - # Already in cache, be silent - set(DBUS_FIND_QUIETLY TRUE) -endif(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR) - -set(DBUS_LIBRARY) -set(DBUS_INCLUDE_DIR) -set(DBUS_ARCH_INCLUDE_DIR) - -FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h - /usr/include - /usr/include/dbus-1.0 - /usr/local/include -) - -FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h - /usr/lib/include - /usr/lib/dbus-1.0/include - /usr/lib64/include - /usr/lib64/dbus-1.0/include -) - -FIND_LIBRARY(DBUS_LIBRARY NAMES dbus-1 dbus - PATHS - /usr/lib - /usr/local/lib -) - -if(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR) - MESSAGE( STATUS "dbus found: includes in ${DBUS_INCLUDE_DIR}, library in ${DBUS_LIBRARY}") - set(DBUS_FOUND TRUE) -else(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR) - MESSAGE( STATUS "dbus not found") -endif(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR) - -MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_LIBRARY DBUS_ARCH_INCLUDE_DIR) \ No newline at end of file diff --git a/libzypp/cmake/modules/FindGettext.cmake b/libzypp/cmake/modules/FindGettext.cmake deleted file mode 100644 index a6bf9d1..0000000 --- a/libzypp/cmake/modules/FindGettext.cmake +++ /dev/null @@ -1,134 +0,0 @@ -# - Find GNU gettext tools -# This module looks for the GNU gettext tools. This module defines the -# following values: -# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool. -# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool. -# GETTEXT_FOUND: True if gettext has been found. -# -# Additionally it provides the following macros: -# GETTEXT_CREATE_TRANSLATIONS ( _moBasename [ALL] file1 ... fileN ) -# This will create a target "translations" which will convert the -# given input po files into the binary output mo file. If the -# ALL option is used, the translations will also be created when -# building the default target. - -FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) - -FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) - -# -# Macro to be called if .po files are shipped as tar ball. -# -# _translation_set_basename: Serves two purposes; a) the stem of the -# default tarball %{_translation_set_basename}-po.tar.bz2 unless its over -# riden by -DUSE_TRANSLATION_SET; b) the basename of the .gmo files. -# -# We expect a po-file tarball to unpack the .po file to the current -# directory! -# -MACRO( GETTEXT_CREATE_TARBALL_TRANSLATIONS _translation_set_basename ) - - IF( NOT USE_TRANSLATION_SET ) - SET( USE_TRANSLATION_SET ${_translation_set_basename} ) - ENDIF( NOT USE_TRANSLATION_SET ) - - SET( TRANSLATION_SET "${USE_TRANSLATION_SET}-po.tar.bz2" ) - MESSAGE( STATUS "Translation set: ${TRANSLATION_SET}" ) - - # For those not familiar with 'sed': the tarball might list './' and './*.po'. - # We process just the '*.po' lines and strip off any leading './'. - EXECUTE_PROCESS( - COMMAND tar tfj ${CMAKE_CURRENT_SOURCE_DIR}/${TRANSLATION_SET} - COMMAND sed -n "/\\.po$/s%.*/%%p" - COMMAND awk "{printf $1\";\"}" - OUTPUT_VARIABLE TRANSLATION_SET_CONTENT - ) - MESSAGE( STATUS "Translations: ${TRANSLATION_SET_CONTENT}" ) - - # Create 'LANG.po's from po.tar.bz2 - ADD_CUSTOM_COMMAND( - OUTPUT ${TRANSLATION_SET_CONTENT} - COMMAND tar xfj ${CMAKE_CURRENT_SOURCE_DIR}/${TRANSLATION_SET} - COMMAND sed -i '/^msgid/s/do not forbid installation of %s/remove lock to allow installation of %s/' *.po - COMMAND sed -i '/^msgid/s/do not keep %s installed/remove lock to allow removal of %s/' *.po - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${TRANSLATION_SET} - ) - - # LANG.po ->msgfmt-> LANG.gmo - SET( _gmoFiles ) - FOREACH( _currentPoFile ${TRANSLATION_SET_CONTENT} ) - - GET_FILENAME_COMPONENT( _lang ${_currentPoFile} NAME_WE ) - SET( _gmoFile "${_lang}.gmo" ) - SET( _gmoFiles ${_gmoFiles} ${_gmoFile} ) - - ADD_CUSTOM_COMMAND( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_currentPoFile} - DEPENDS ${_currentPoFile} - ) - - INSTALL( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${_gmoFile} - DESTINATION share/locale/${_lang}/LC_MESSAGES - RENAME ${_translation_set_basename}.mo - ) - - # the docs claim it can handle a list, but - SET_DIRECTORY_PROPERTIES( PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES ${_currentPoFile} - ADDITIONAL_MAKE_CLEAN_FILES ${_gmoFile} - ) - - ENDFOREACH( _currentPoFile ) - - # build all .gmo files - ADD_CUSTOM_TARGET( - translations ALL - DEPENDS ${_gmoFiles} - ) - -ENDMACRO( GETTEXT_CREATE_TARBALL_TRANSLATIONS ) - -# -# Macro to be called if .po files are part of the source tree. -# -MACRO(GETTEXT_CREATE_TRANSLATIONS _moBasename _firstPoFile) - - SET(_gmoFiles) - - SET(_addToAll) - IF(${_firstPoFile} STREQUAL "ALL") - SET(_addToAll "ALL") - SET(_firstPoFile) - ENDIF(${_firstPoFile} STREQUAL "ALL") - - FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) - GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) - GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) - GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - ADD_CUSTOM_COMMAND( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} - DEPENDS ${_absFile} - ) - - INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_moBasename}.mo) - SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) - - ENDFOREACH (_currentPoFile ) - - ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) - -ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) - -IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND TRUE) -ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND FALSE) - IF (GetText_REQUIRED) - MESSAGE(FATAL_ERROR "GetText not found") - ENDIF (GetText_REQUIRED) -ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) diff --git a/libzypp/cmake/modules/FindHal.cmake b/libzypp/cmake/modules/FindHal.cmake deleted file mode 100644 index 58c149a..0000000 --- a/libzypp/cmake/modules/FindHal.cmake +++ /dev/null @@ -1,35 +0,0 @@ - -if(HAL_INCLUDE_DIR AND HAL_LIBRARY AND HAL_STORAGE_LIBRARY) - # Already in cache, be silent - set(HAL_FIND_QUIETLY TRUE) -endif(HAL_INCLUDE_DIR AND HAL_LIBRARY AND HAL_STORAGE_LIBRARY) - -set(HAL_LIBRARY) -set(HAL_INCLUDE_DIR) -set(HAL_STORAGE_LIBRARY) - -FIND_PATH(HAL_INCLUDE_DIR hal/libhal.h - /usr/include - /usr/local/include -) - -FIND_LIBRARY(HAL_LIBRARY NAMES hal - PATHS - /usr/lib - /usr/local/lib -) - -FIND_LIBRARY(HAL_STORAGE_LIBRARY NAMES hal-storage - PATHS - /usr/lib - /usr/local/lib -) - -if(HAL_INCLUDE_DIR AND HAL_LIBRARY AND HAL_STORAGE_LIBRARY) - MESSAGE( STATUS "hal found: includes in ${HAL_INCLUDE_DIR}, library in ${HAL_LIBRARY}") - set(HAL_FOUND TRUE) -else(HAL_INCLUDE_DIR AND HAL_LIBRARY AND HAL_STORAGE_LIBRARY) - MESSAGE( STATUS "hal not found") -endif(HAL_INCLUDE_DIR AND HAL_LIBRARY AND HAL_STORAGE_LIBRARY) - -MARK_AS_ADVANCED(HAL_INCLUDE_DIR HAL_LIBRARY HAL_STORAGE_LIBRARY) diff --git a/libzypp/cmake/modules/FindOpenSSL.cmake b/libzypp/cmake/modules/FindOpenSSL.cmake deleted file mode 100644 index dd967d1..0000000 --- a/libzypp/cmake/modules/FindOpenSSL.cmake +++ /dev/null @@ -1,100 +0,0 @@ -# - Try to find the OpenSSL encryption library -# Once done this will define -# -# OPENSSL_FOUND - system has the OpenSSL library -# OPENSSL_INCLUDE_DIR - the OpenSSL include directory -# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL - -if (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - - # in cache already - SET(OPENSSL_FOUND TRUE) - -else (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - - FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h - /usr/include/ - /usr/local/include/ - $ENV{ProgramFiles}/OpenSSL/include/ - $ENV{SystemDrive}/OpenSSL/include/ - ) - - if(WIN32 AND MSVC) - # /MD and /MDd are the standard values - if somone wants to use - # others, the libnames have to change here too - # see http://www.openssl.org/support/faq.html#PROG2 for their meaning - - FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd - PATHS - $ENV{ProgramFiles}/OpenSSL/lib/VC/ - $ENV{SystemDrive}/OpenSSL/lib/VC/ - ) - FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD - PATHS - $ENV{ProgramFiles}/OpenSSL/lib/VC/ - $ENV{SystemDrive}/OpenSSL/lib/VC/ - ) - FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd - PATHS - $ENV{ProgramFiles}/OpenSSL/lib/VC/ - $ENV{SystemDrive}/OpenSSL/lib/VC/ - ) - FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD - PATHS - $ENV{ProgramFiles}/OpenSSL/lib/VC/ - $ENV{SystemDrive}/OpenSSL/lib/VC/ - ) - - IF(MSVC_IDE) - IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) - ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - MESSAGE(FATAL_ERROR "Could not find the debug and release version of openssl") - ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - ELSE(MSVC_IDE) - STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) - IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) - ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE}) - ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - ENDIF(MSVC_IDE) - MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE LIB_EAY_DEBUG LIB_EAY_RELEASE) - else(WIN32 AND MSVC) - - FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD libeay32 libeay32MD - PATHS - /usr/lib - /usr/local/lib - ) - FIND_LIBRARY(CRYPTO_LIBRARIES crypto - PATHS - /usr/lib - /usr/local/lib - ) - - endif(WIN32 AND MSVC) - - if (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - set(OPENSSL_FOUND TRUE) - endif (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - - if (CRYPTO_LIBRARIES) - set(CRYPTO_FOUND TRUE) - message(STATUS "Found libcrypto: ${CRYPTO_LIBRARIES}") - endif (CRYPTO_LIBRARIES) - - if (OPENSSL_FOUND) - if (NOT OpenSSL_FIND_QUIETLY) - message(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}") - endif (NOT OpenSSL_FIND_QUIETLY) - else (OPENSSL_FOUND) - if (OpenSSL_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find OpenSSL") - endif (OpenSSL_FIND_REQUIRED) - endif (OPENSSL_FOUND) - - MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) - -endif (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - diff --git a/libzypp/cmake/modules/FindRpm.cmake b/libzypp/cmake/modules/FindRpm.cmake deleted file mode 100644 index 29696e3..0000000 --- a/libzypp/cmake/modules/FindRpm.cmake +++ /dev/null @@ -1,50 +0,0 @@ - -if(RPM_INCLUDE_DIR AND RPM_LIBRARY) - # Already in cache, be silent - set(RPM_FIND_QUIETLY TRUE) -endif(RPM_INCLUDE_DIR AND RPM_LIBRARY) - -set(RPM_LIBRARY) -set(RPM_INCLUDE_DIR) - -FIND_PATH(RPM_INCLUDE_DIR rpm/rpmdb.h - /usr/include - /usr/local/include -) - -set(RPM_SUSPECT_VERSION "RPM_SUSPECT_VERSION-NOTFOUND" ) -if ( RPM_INCLUDE_DIR ) - FIND_PATH(RPM_SUSPECT_VERSION rpm/rpm4compat.h - ${RPM_INCLUDE_DIR} - NO_DEFAULT_PATH - ) - if ( RPM_SUSPECT_VERSION ) - set(RPM_SUSPECT_VERSION "5.x" ) - else ( RPM_SUSPECT_VERSION ) - FIND_PATH(RPM_SUSPECT_VERSION rpm/rpmlegacy.h - ${RPM_INCLUDE_DIR} - NO_DEFAULT_PATH - ) - if ( RPM_SUSPECT_VERSION ) - set(RPM_SUSPECT_VERSION "4.x" ) - else ( RPM_SUSPECT_VERSION ) - set(RPM_SUSPECT_VERSION "4.4" ) - endif ( RPM_SUSPECT_VERSION ) - endif ( RPM_SUSPECT_VERSION ) -endif ( RPM_INCLUDE_DIR ) - - -FIND_LIBRARY(RPM_LIBRARY NAMES rpm - PATHS - /usr/lib - /usr/local/lib -) - -if(RPM_INCLUDE_DIR AND RPM_LIBRARY) - MESSAGE( STATUS "rpm found: includes in ${RPM_INCLUDE_DIR}, library in ${RPM_LIBRARY} (suspect ${RPM_SUSPECT_VERSION})") - set(RPM_FOUND TRUE) -else(RPM_INCLUDE_DIR AND RPM_LIBRARY) - MESSAGE( STATUS "rpm not found") -endif(RPM_INCLUDE_DIR AND RPM_LIBRARY) - -MARK_AS_ADVANCED(RPM_INCLUDE_DIR RPM_LIBRARY) \ No newline at end of file diff --git a/libzypp/cmake/modules/FindUdev.cmake b/libzypp/cmake/modules/FindUdev.cmake deleted file mode 100644 index afc2854..0000000 --- a/libzypp/cmake/modules/FindUdev.cmake +++ /dev/null @@ -1,23 +0,0 @@ - -SET( UDEV_LIBRARY ) -SET( UDEV_INCLUDE_DIR ) - -FIND_PATH( UDEV_INCLUDE_DIR libudev.h - /usr/include - /usr/local/include -) - -FIND_LIBRARY( UDEV_LIBRARY NAMES udev - PATHS - /usr/lib - /usr/local/lib -) - -# check if udev is usable for us -INCLUDE (CheckSymbolExists) -SET(CMAKE_REQUIRED_LIBRARIES udev) -CHECK_SYMBOL_EXISTS(udev_enumerate_new libudev.h USABLE_UDEV) -SET(CMAKE_REQUIRED_LIBRARIES "") - -FIND_PACKAGE_HANDLE_STANDARD_ARGS( Udev DEFAULT_MSG UDEV_LIBRARY UDEV_INCLUDE_DIR USABLE_UDEV) -MARK_AS_ADVANCED( UDEV_LIBRARY UDEV_INCLUDE_DIR ) diff --git a/libzypp/cmake/modules/FindZsync.cmake b/libzypp/cmake/modules/FindZsync.cmake deleted file mode 100644 index abb3896..0000000 --- a/libzypp/cmake/modules/FindZsync.cmake +++ /dev/null @@ -1,34 +0,0 @@ - -if(ZSYNC_INCLUDE_DIR AND ZSYNC_LIBRARY) - # Already in cache, be silent - set(ZSYNC_FIND_QUIETLY TRUE) -endif(ZSYNC_INCLUDE_DIR AND ZSYNC_LIBRARY) - -set(ZSYNC_LIBRARY) -set(ZSYNC_INCLUDE_DIR) - -FIND_PATH(ZSYNC_INCLUDE_DIR zsync.h - /usr/include - /usr/local/include -) - -FIND_LIBRARY(ZSYNC_LIBRARY NAMES zsync - PATHS - /usr/lib - /usr/local/lib -) - -FIND_LIBRARY(RCKSUM_LIBRARY NAMES rcksum - PATHS - /usr/lib - /usr/local/lib -) - -if(ZSYNC_INCLUDE_DIR AND ZSYNC_LIBRARY AND RCKSUM_LIBRARY) - MESSAGE( STATUS "zsync found: includes in ${ZSYNC_INCLUDE_DIR}, library in ${ZSYNC_LIBRARY}") - set(ZSYNC_FOUND TRUE) -else(ZSYNC_INCLUDE_DIR AND ZSYNC_LIBRARY) - MESSAGE( STATUS "zsync not found") -endif(ZSYNC_INCLUDE_DIR AND ZSYNC_LIBRARY AND RCKSUM_LIBRARY) - -MARK_AS_ADVANCED(ZSYNC_INCLUDE_DIR ZSYNC_LIBRARY RCKSUM_LIBRARY) \ No newline at end of file diff --git a/libzypp/cmake/modules/FindZypp.cmake b/libzypp/cmake/modules/FindZypp.cmake deleted file mode 100644 index 4091c4f..0000000 --- a/libzypp/cmake/modules/FindZypp.cmake +++ /dev/null @@ -1,51 +0,0 @@ - -IF (DEFINED ZYPP_PREFIX) - MESSAGE(STATUS "ZYpp library prefix set to ${ZYPP_PREFIX}") -ELSE (DEFINED ZYPP_PREFIX) - MESSAGE(STATUS "ZYpp path not set. Looking for it.") -ENDIF (DEFINED ZYPP_PREFIX) - -if(ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY) - # Already in cache, be silent - SET(ZYPP_FIND_QUIETLY TRUE) -endif(ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY) - -set(ZYPP_LIBRARY) -set(ZYPP_INCLUDE_DIR) - -IF (DEFINED ZYPP_PREFIX) - MESSAGE( STATUS "Looking in ${ZYPP_PREFIX}") - FIND_PATH(ZYPP_INCLUDE_DIR zypp/ZYpp.h - ${ZYPP_PREFIX}/include - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH - ) - FIND_LIBRARY(ZYPP_LIBRARY NAMES zypp - PATHS - ${ZYPP_PREFIX}/lib - ${ZYPP_PREFIX}/lib64 - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH - ) -ELSE (DEFINED ZYPP_PREFIX) - FIND_PATH(ZYPP_INCLUDE_DIR zypp/ZYpp.h - /usr/include - /usr/local/include - ) - FIND_LIBRARY(ZYPP_LIBRARY NAMES zypp - PATHS - /usr/lib - /usr/local/lib - ) -ENDIF (DEFINED ZYPP_PREFIX) - -if(ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY) - MESSAGE( STATUS "ZYpp found: includes in ${ZYPP_INCLUDE_DIR}, library in ${ZYPP_LIBRARY}") - set(ZYPP_FOUND TRUE) -else(ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY) - MESSAGE( FATAL "ZYpp not found") -endif(ZYPP_INCLUDE_DIR AND ZYPP_LIBRARY) - -MARK_AS_ADVANCED(ZYPP_INCLUDE_DIR ZYPP_LIBRARY) diff --git a/libzypp/cmake/modules/Findlibproxy.cmake b/libzypp/cmake/modules/Findlibproxy.cmake deleted file mode 100644 index a5303df..0000000 --- a/libzypp/cmake/modules/Findlibproxy.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# The "real" libproxy provides its own Findlibproxy.cmake but saner, simpler -# alternatives like the PacRunner replacement which *just* queries PacRunner -# directly will only provide a .pc file. So use pkg-config to find it... - -INCLUDE ( FindPkgConfig ) - -PKG_SEARCH_MODULE( LIBPROXY libproxy-1.0 ) diff --git a/libzypp/cmake/modules/ZyppCommon.cmake b/libzypp/cmake/modules/ZyppCommon.cmake deleted file mode 100644 index 8b3ec77..0000000 --- a/libzypp/cmake/modules/ZyppCommon.cmake +++ /dev/null @@ -1,146 +0,0 @@ -# Library -IF ( DEFINED LIB ) - SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" ) -ELSE ( DEFINED LIB ) - IF (CMAKE_SIZEOF_VOID_P MATCHES "8") - SET( LIB_SUFFIX "64" ) - ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8") - SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ) -ENDIF ( DEFINED LIB ) -MESSAGE(STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}" ) -# Headers -IF (DEFINED INCLUDE) - SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE}") -else (DEFINED INCLUDE) - SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include") -ENDIF (DEFINED INCLUDE) -MESSAGE (STATUS "Header files will be installed in ${INCLUDE_INSTALL_DIR}") - -# system configuration dir (etc) -IF( NOT DEFINED SYSCONFDIR ) - IF ( ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" ) - # if installing in usr, set sysconfg to etc - SET( SYSCONFDIR /etc ) - ELSE ( ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" ) - SET ( SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" ) - ENDIF ( ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" ) -ENDIF( NOT DEFINED SYSCONFDIR ) -MESSAGE(STATUS "Config files will be installed in ${SYSCONFDIR}" ) - -# usr INSTALL_PREFIX - -IF( DEFINED CMAKE_INSTALL_PREFIX ) - SET( INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} ) -ELSE( DEFINED CMAKE_INSTALL_PREFIX ) - SET( INSTALL_PREFIX /usr ) -ENDIF( DEFINED CMAKE_INSTALL_PREFIX ) - -# system configuration dir (etc) -IF( NOT DEFINED MANDIR ) - SET( MANDIR ${INSTALL_PREFIX}/share/man ) -ENDIF( NOT DEFINED MANDIR ) -MESSAGE( "** Manual files will be installed in ${MANDIR}" ) - -#################################################################### -# CONFIGURATION # -#################################################################### - -IF( NOT DEFINED DOC_INSTALL_DIR ) - SET( DOC_INSTALL_DIR - "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PACKAGE}" - CACHE PATH "The install dir for documentation (default prefix/share/doc/packages/${PACKAGE})" - FORCE - ) -ENDIF( NOT DEFINED DOC_INSTALL_DIR ) - -#################################################################### -# INCLUDES # -#################################################################### - -#SET (CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} SYSTEM ) - - -#################################################################### -# RPM SPEC # -#################################################################### - -MACRO(SPECFILE) - MESSAGE(STATUS "Writing spec file...") - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.cmake ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY) - MESSAGE(STATUS "I hate you rpm-lint...!!!") - IF (EXISTS ${CMAKE_SOURCE_DIR}/package/${PACKAGE}-rpmlint.cmake) - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/${PACKAGE}-rpmlint.cmake ${CMAKE_BINARY_DIR}/package/${PACKAGE}-rpmlintrc @ONLY) - ENDIF (EXISTS ${CMAKE_SOURCE_DIR}/package/${PACKAGE}-rpmlint.cmake) -ENDMACRO(SPECFILE) - -MACRO(PKGCONFGFILE) - MESSAGE(STATUS "Writing pkg-config file...") - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY) - INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) -ENDMACRO(PKGCONFGFILE) - -#################################################################### -# INSTALL # -#################################################################### - -MACRO(GENERATE_PACKAGING PACKAGE VERSION) - - # The following components are regex's to match anywhere (unless anchored) - # in absolute path + filename to find files or directories to be excluded - # from source tarball. - SET (CPACK_SOURCE_IGNORE_FILES - # hidden files - "/\\\\..+$" - # temporary files - "\\\\.swp$" - # backup files - "~$" - # others - "\\\\.#" - "/#" - "/build/" - "/_build/" - # used before - "/CVS/" - "\\\\.o$" - "\\\\.lo$" - "\\\\.la$" - "Makefile\\\\.in$" - ) - - #SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Novell's package management core engine.") - SET(CPACK_PACKAGE_VENDOR "Novell Inc.") - #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") - #SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") - #SET(CPACK_PACKAGE_VERSION_MAJOR ${version_major}) - #SET(CPACK_PACKAGE_VERSION_MINOR ${version_minor}) - #SET(CPACK_PACKAGE_VERSION_PATCH ${version_patch}) - SET( CPACK_GENERATOR "TBZ2") - SET( CPACK_SOURCE_GENERATOR "TBZ2") - SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" ) - INCLUDE(CPack) - - SPECFILE() - - ADD_CUSTOM_TARGET( svncheck - COMMAND cd ${CMAKE_SOURCE_DIR} && LC_ALL=C git status | grep -q "nothing to commit .working directory clean." - ) - - SET( AUTOBUILD_COMMAND - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/package/*.tar.bz2 - COMMAND ${CMAKE_MAKE_PROGRAM} package_source - COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package - COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/${PACKAGE}.changes" "${CMAKE_BINARY_DIR}/package/${PACKAGE}.changes" - ) - - ADD_CUSTOM_TARGET( srcpackage_local - ${AUTOBUILD_COMMAND} - ) - - ADD_CUSTOM_TARGET( srcpackage - COMMAND ${CMAKE_MAKE_PROGRAM} svncheck - ${AUTOBUILD_COMMAND} - ) -ENDMACRO(GENERATE_PACKAGING) diff --git a/libzypp/devel/CMakeLists.txt b/libzypp/devel/CMakeLists.txt deleted file mode 100644 index 3f9d5db..0000000 --- a/libzypp/devel/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${LIBZYPP_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) - -CONFIGURE_FILE(${LIBZYPP_SOURCE_DIR}/devel/genclass.in ${LIBZYPP_BINARY_DIR}/devel/genclass @ONLY) - -ADD_SUBDIRECTORY(devel.dmacvicar) -ADD_SUBDIRECTORY(devel.ma) diff --git a/libzypp/devel/devel.dmacvicar/CMakeLists.txt b/libzypp/devel/devel.dmacvicar/CMakeLists.txt deleted file mode 100644 index 88607e6..0000000 --- a/libzypp/devel/devel.dmacvicar/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -ADD_DEFINITIONS(-DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}) - -ADD_EXECUTABLE(rpmbuilder rpmbuilder.cc) -TARGET_LINK_LIBRARIES(rpmbuilder zypp ) - -ADD_EXECUTABLE(testbed testbed.cc) -TARGET_LINK_LIBRARIES(testbed zypp ) - -ADD_EXECUTABLE(getfile getfile.cc) -TARGET_LINK_LIBRARIES(getfile zypp ) - -FIND_PACKAGE(Zsync) -IF(ZSYNC_FOUND) - ADD_EXECUTABLE(zsync zsync.cc) - TARGET_LINK_LIBRARIES(zsync ${ZSYNC_LIBRARY} ${RCKSUM_LIBRARY}) - TARGET_LINK_LIBRARIES(zsync zypp ) -# TARGET_LINK_LIBRARIES(zsync zypp2 ) -ENDIF(ZSYNC_FOUND) diff --git a/libzypp/devel/devel.dmacvicar/CURLM_tp.cc b/libzypp/devel/devel.dmacvicar/CURLM_tp.cc deleted file mode 100644 index 5b1b32c..0000000 --- a/libzypp/devel/devel.dmacvicar/CURLM_tp.cc +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include - -extern "C" { -#include -} -#include -#include -#include "zypp/base/Exception.h" -#include "zypp/base/Logger.h" -#include "zypp/Pathname.h" -#include "zypp/ExternalProgram.cc" -//#include - -using namespace zypp; -using namespace std; - -size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp) -{ - MIL << "got data : " << size*nmemb << " bytes" << endl; - return size*nmemb; -} - -int socket_callback(CURL *easy, curl_socket_t s, int what, void *userp, void *socketp) -{ - MIL << "socket : " << s << " : " << what << endl; - return 0; -} - -struct Range -{ - Range( off_t f, off_t t) - : from(t), to(t) - {} - - off_t from; - off_t to; -}; - -int main() -{ - FILE *f = fopen("piece", "w" ); - curl_global_init(CURL_GLOBAL_ALL); - CURLM *curlm; - curlm = curl_multi_init(); - //curl_multi_setopt( curlm, CURLMOPT_PIPELINING, 1); - curl_multi_setopt( curlm, CURLMOPT_SOCKETFUNCTION, socket_callback); - -// 0-1000 -// 1001-2000 -// 2001-3000 -// -// 3000-4000 -// 4001-5000 - - int i=1; - for ( ; i < 10; i++ ) { - CURL *curl; - curl = curl_easy_init(); - CURLcode success; - // http://download.opensuse.org/distribution/10.2/repo/oss/suse/setup/descr/packages - if ( (success = curl_easy_setopt(curl, CURLOPT_URL, "http://ftp5.gwdg.de/pub/opensuse/distribution/10.2/repo/oss/suse/setup/descr/packages")) != CURLE_OK) - ZYPP_THROW(Exception("url")); - - if ( (success = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data)) != CURLE_OK) - ZYPP_THROW(Exception("write data")); - //curl_easy_setopt(curl, CURLOPT_WRITEDATA, f); - stringstream rs; - int k=1; - for(; k<2; k++) { - rs << ( k!=1 ? "," : "") << (i*k)*1000 << "-" << ((i*k)*1000 + 1000); - } - MIL << "range: " << rs.str() << endl; - if ( (success = curl_easy_setopt(curl, CURLOPT_RANGE, rs.str().c_str())) != CURLE_OK) - ZYPP_THROW(Exception("write data")); - - CURLMcode code; - if ( (code = curl_multi_add_handle( curlm, curl)) != CURLM_OK) - ZYPP_THROW(Exception("write data")); - - } - int still_running = 0; - /* we start some action by calling perform right away */ - while(CURLM_CALL_MULTI_PERFORM == - curl_multi_perform(curlm, &still_running)); - - while(still_running) { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - /* get file descriptors from the transfers */ - curl_multi_fdset(curlm, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls, *and* you make sure that maxfd is bigger than -1 so - that the call to select() below makes sense! */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - still_running = 0; - ERR << "select() returns error, this is badness" << endl; - break; - case 0: - default: - /* timeout or readable/writable sockets */ - while(CURLM_CALL_MULTI_PERFORM == - curl_multi_perform(curlm, &still_running)); - break; - } - } - - int c=999; - CURLMsg *m; - while ( m = curl_multi_info_read( curlm, &c) ) - { - MIL<< m->msg << " : " << curl_easy_strerror(m->data.result) << endl; - } - Pathname root("/home/duncan/suse/metadata-diff"); - - - curl_multi_cleanup(curlm); - //curl_easy_cleanup(http_handle); - - return 0; -} \ No newline at end of file diff --git a/libzypp/devel/devel.dmacvicar/README b/libzypp/devel/devel.dmacvicar/README deleted file mode 100644 index a6dc00d..0000000 --- a/libzypp/devel/devel.dmacvicar/README +++ /dev/null @@ -1,33 +0,0 @@ -Running 'make' in this directory will create - -- cachedsource - Reads the database (from zypp.db) and creates all resolvables - in memory. - Used to time read and create - -- cachestore - Inserts capabilities (from external text file) into database. - Used to time insert. - -- mediaaccess - N/A - -- scansource - Downloads and parses a repository. To test repository integrity. - -- susetags-downloader - Used to download metadata from a 'susetags' source - See http://en.opensuse.org/Libzypp/Metadata/YaST - - run as "susetags-downloader " - -- tagsparser - Parses 'susetags' metadata and writes it into database. - -- yum-downloader - Used to download metadata from a 'rpm-md' source - See http://en.opensuse.org/Standards/Rpm_Metadata - - run as "yum-downloader " - - diff --git a/libzypp/devel/devel.dmacvicar/ScanSource.cc b/libzypp/devel/devel.dmacvicar/ScanSource.cc deleted file mode 100644 index 0ec1f14..0000000 --- a/libzypp/devel/devel.dmacvicar/ScanSource.cc +++ /dev/null @@ -1,193 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace zypp; - -static bool verbose = false; -static bool debug_flag = false; - -#define LOG (debug_flag ? USR : cout) - -struct KeyRingReceiver : public callback::ReceiveReport -{ - KeyRingReceiver() - { - connect(); - } - - virtual bool askUserToAcceptUnsignedFile( const std::string & file ) - { - LOG << "===[UnsignedFile " << file << "]" << endl; - return true; - } - virtual bool askUserToAcceptUnknownKey( const std::string &file, - const std::string &id ) - { - LOG << "===[UnknownKey " << id << "]" << endl; - return true; - } - virtual bool askUserToTrustKey( const PublicKey &key) - { - LOG << "===[TrustKey" << key << "]" << endl; - return true; - } - virtual bool askUserToImportKey( const PublicKey &key) - { - LOG << "===[ImportKey " << key << "]" << endl; - return true; - } - virtual bool askUserToAcceptVerificationFailed( const std::string &file, - const PublicKey &key ) - { - LOG << "===[VerificationFailed " << file << " " << key << "]" << endl; - return true; - } -}; - -struct ResStoreStats : public pool::PoolStats -{ - void operator()( const ResObject::constPtr & obj ) - { - if ( isKind( obj ) ) - { - LOG << obj << endl; - } - pool::PoolStats::operator()( obj ); - } -}; - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - //zypp::base::LogControl::instance().logfile( "" ); - INT << "===[START]==========================================" << endl; - --argc; - ++argv; - - if ( ! argc ) - { - LOG << "Usage: ScanSource [options] url [[options] url...]" << endl; - LOG << " Display summary of Sources found at 'url'. " << endl; - LOG << " " << endl; - LOG << " " << endl; - LOG << " options:" << endl; - LOG << " +/-l enable/disable detailed listing of Source content" << endl; - LOG << " +/-d enable/disable debug output" << endl; - return 0; - } - - KeyRingReceiver accept; - - for ( ; argc; --argc, ++argv ) - { - if ( *argv == string("+l") ) - { - verbose = true; - continue; - } - if ( *argv == string("-l") ) - { - verbose = false; - continue; - } - if ( *argv == string("+d") ) - { - zypp::base::LogControl::instance().logfile( "-" ); - debug_flag = true; - continue; - } - if ( *argv == string("-d") ) - { - zypp::base::LogControl::instance().logfile( "" ); - debug_flag = false; - continue; - } - - LOG << "====================================================" << endl; - LOG << "===Search Source at Url(" << *argv << ")..." << endl; - Source_Ref src; - try - { - debug::Measure m( "Create" ); - Url url(*argv); - try - { - src = SourceFactory().createFrom( url, "/", Date::now().asSeconds() ); - } - catch ( const source::SourceUnknownTypeException & ) - { - src = SourceFactory().createFrom( "Plaindir", url, "/", Date::now().asSeconds(), "", false, true ); - } - m.elapsed(); - //LOG << m.asString() << endl; - } - catch ( const Exception & except_r ) - { - LOG << "***Failed: " << except_r << endl; - continue; - } - LOG << "type: " << src.type() << endl; - LOG << "numberOfMedia: " << src.numberOfMedia() << endl; - LOG << "alias: " << src.alias() << endl; - LOG << "vendor: " << src.vendor() << endl; - LOG << "unique_id: " << src.unique_id() << endl; - LOG << "baseSource: " << src.baseSource() << endl; - LOG << "autorefresh: " << src.autorefresh() << endl; - LOG << "publicKeys: " << src.publicKeys() << endl; - - LOG << "===Parse content..." << endl; - try - { - debug::Measure m( "Parse" ); - src.resolvables(); - m.elapsed(); - //LOG << m.asString() << endl; - } - catch ( const Exception & except_r ) - { - LOG << "***Failed: " << except_r << endl; - continue; - } - LOG << for_each( src.resolvables().begin(), src.resolvables().end(), - ResStoreStats() ) << endl; - if ( verbose ) - { - dumpRange( LOG, src.resolvables().begin(), src.resolvables().end() ) << endl; - } -#define TestKind Product - - for (ResStore::const_iterator it = src.resolvables().begin(); it != src.resolvables().end(); ++it) - { - if ( isKind(*it) ) - { - zypp::TestKind::constPtr res = asKind( *it ); - cout << res->name() << " | " << res->edition() << std::endl; - cout << res->distributionName() << " | " << res->distributionEdition() << std::endl; - } - } - - //SourceManager::sourceManager()->addSource( src ); - //SourceManager::sourceManager()->store( "/", true ); - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc b/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc deleted file mode 100644 index 38f8c84..0000000 --- a/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc +++ /dev/null @@ -1,139 +0,0 @@ -#include "zypp/ZYpp.h" -#include "zypp/ZYppFactory.h" -#include "zypp/base/Logger.h" -#include "zypp/base/LogControl.h" -#include "zypp/CapFactory.h" -#include "zypp/data/ResolvableDataConsumer.h" -#include "zypp/base/Measure.h" -#include "zypp/detail/ResObjectFactory.h" -#include "zypp/parser/yum/RepoParser.h" -#include "zypp/repo/memory/PackageImpl.h" - - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "yumparsertest" - -using namespace std; -using namespace zypp; -using namespace zypp::parser::yum; -using zypp::debug::Measure; -using namespace zypp::repo::memory; - -bool progress_function(ProgressData::value_type p) -{ - cout << "Parsing YUM source [" << p << "%]" << endl; -// cout << "\rParsing YUM source [" << p << "%]" << flush; - return true; -} - -class ResolvableConsumer : public data::ResolvableDataConsumer -{ - public: - - typedef detail::ResImplTraits::Ptr PkgImplPtr; - typedef detail::ResImplTraits::Ptr SrcPkgImplPtr; - - ResolvableConsumer() - { - - } - - void collectDeps( Dependencies &deps, const data::Dependencies &data_deps) - { - CapFactory factory; - for ( data::Dependencies::const_iterator i = data_deps.begin(); i != data_deps.end(); ++i ) - { - data::DependencyList list(i->second); - zypp::Dep deptype(i->first); - for ( data::DependencyList::const_iterator it = list.begin(); it != list.end(); ++it ) - { - deps[deptype].insert(factory.fromImpl(*it)); - } - } - } - - virtual ~ResolvableConsumer() - { - - } - - virtual void consumePackage( const data::RecordId &repository_id, data::Package_Ptr ptr ) - { - PkgImplPtr impl = PkgImplPtr( new PackageImpl(ptr) ); - Dependencies deps; - collectDeps( deps, ptr->deps ); - - Package::Ptr pkg = detail::makeResolvableFromImpl( NVRAD( ptr->name, ptr->edition, ptr->arch, deps), impl ); - _store.insert(pkg); - } - virtual void consumeProduct( const data::RecordId &repository_id, data::Product_Ptr ) - { - } - virtual void consumePatch( const data::RecordId &repository_id, data::Patch_Ptr ) - { - } - virtual void consumeMessage( const data::RecordId &repository_id, data::Message_Ptr ) - { - - } - - virtual void consumeScript( const data::RecordId &repository_id, data::Script_Ptr ) - { - - } - - virtual void consumeChangelog( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & ) - { - - } - - virtual void consumeFilelist( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & ) - {} - - - virtual void consumeSourcePackage(const zypp::data::RecordId&, zypp::data::SrcPackage_Ptr) - {} - - virtual void consumePackageAtom(const zypp::data::RecordId&, const zypp::data::PackageAtom_Ptr&) - {} - - virtual void consumePattern(const zypp::data::RecordId&, zypp::data::Pattern_Ptr) - {} - - //virtual void consumeSourcePackage( const data::SrcPackage_Ptr ) = 0; - ResStore _store; -}; - - -int main(int argc, char **argv) -{ - base::LogControl::instance().logfile("yumparsertest.log"); - - if (argc < 2) - { - cout << "usage: yumparsertest path/to/yumsourcedir" << endl << endl; - return 1; - } - - try - { - ZYpp::Ptr z = getZYpp(); - - MIL << "creating PrimaryFileParser" << endl; - Measure parse_primary_timer("primary.xml.gz parsing"); - ResolvableConsumer store; - parser::yum::RepoParser parser( 0, store, &progress_function); - parser.parse(argv[1]); - parse_primary_timer.stop(); - - cout << endl; - } - catch ( const Exception &e ) - { - cout << "Oops! " << e.msg() << std::endl; - } - - return 0; -} - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/devel/devel.dmacvicar/getfile.cc b/libzypp/devel/devel.dmacvicar/getfile.cc deleted file mode 100644 index 364abd3..0000000 --- a/libzypp/devel/devel.dmacvicar/getfile.cc +++ /dev/null @@ -1,115 +0,0 @@ -#include - -#include -#include - -#include -#include -#include - -#include "zypp/Product.h" -#include "zypp/Package.h" -#include "zypp/Fetcher.h" -#include "zypp/TmpPath.h" -#include "zypp/ProgressData.h" - -#include "zypp/sat/Pool.h" - -#include "zypp/ZYppCallbacks.h" - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using zypp::media::MediaChangeReport; -using zypp::media::DownloadProgressReport; - - -bool result_cb( const ResObject::Ptr &r ) -{ - cout << r << endl; -} - -struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport - { - virtual MediaChangeReport::Action - requestMedia(zypp::Url & url, - unsigned mediumNr, - const std::string & label, - MediaChangeReport::Error error, - const std::string & description, - const std::vector & devices, - unsigned int & index) - { - cout << label << " " < -{ - - virtual void start( const Url &/*file*/, Pathname /*localfile*/ ) - { - } - - virtual bool progress(int value, const Url &file, - double dbps_avg, - double dbps_current) - { - cout << file << " " << value << "% speed:" << dbps_current << " avg:" << dbps_avg << endl; - return true; - } - - virtual Action problem( const Url &/*file*/ - , Error /*error*/ - , const std::string &description ) - { - cout << "PROBLEM: " << description << endl; - return ABORT; - } - - virtual void finish( - const Url &/*file*/ - , Error /*error*/ - , const std::string &reason - ) - { - cout << "finish:" << endl; - cout << reason << endl; - } -}; - -int main(int argc, char **argv) -{ - try - { - ZYpp::Ptr z = getZYpp(); - - MediaChangeReportReceiver change_report; - DownloadProgressReportReceiver progress_report; - change_report.connect(); - progress_report.connect(); - - MediaSetAccess access(Url("http://download.opensuse.org/update/11.1/rpm/x86_64")); - OnMediaLocation loc; - loc.setLocation("java-1_5_0-sun-1.5.0_update17-1.1.x86_64.rpm"); - //loc.setOptional(true); - - Fetcher fetcher; - fetcher.enqueue(loc); - fetcher.start("./", access); - - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - cout << e.msg() << endl; - cout << e.historyAsString(); - } - - return 0; -} - - - diff --git a/libzypp/devel/devel.dmacvicar/multiple-download.cc b/libzypp/devel/devel.dmacvicar/multiple-download.cc deleted file mode 100644 index dd13dc6..0000000 --- a/libzypp/devel/devel.dmacvicar/multiple-download.cc +++ /dev/null @@ -1,89 +0,0 @@ -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include "zypp/Product.h" -#include "zypp/Package.h" - -#include "zypp/TmpPath.h" - -#include "zypp/sat/Pool.h" - -#include "zypp/PoolQuery.h" - -using namespace std; -using namespace zypp; -using namespace zypp::repo; - -bool result_cb( const ResObject::Ptr &r ) -{ - cout << r << endl; -} - -boost::mutex io_mutex; - -struct Counter -{ - Counter(int id) : id(id) { } - void operator()() - { - for (int i = 0; i < 10; ++i) - { - //boost::mutex::scoped_lock lock(io_mutex); - std::cout << id << ": " << i << std::endl; - if ( i == 4 ) - { - boost::thread thrd2(Counter(3)); - } - } - } - int id; -}; - -int main(int argc, char **argv) -{ - try - { - ZYpp::Ptr z = getZYpp(); - - boost::thread thrd1(Counter(1)); - boost::thread thrd2(Counter(2)); - thrd1.join(); - thrd2.join(); - return 0; - - //z->initializeTarget("/"); - //z->target()->load(); - -// sat::Pool::instance().addRepoSolv("./foo.solv"); - -// for ( ResPool::const_iterator it = z->pool().begin(); it != z->pool().end(); ++it ) -// { -// ResObject::constPtr res = it->resolvable(); -// if ( res->name() == "kde4-kcolorchooser") -// { -// cout << res << endl; -// cout << res->summary() << " | " << res->size() << endl; -// } -// } - - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - cout << e.msg() << endl; - } - - return 0; -} - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/filelists.xml b/libzypp/devel/devel.dmacvicar/repodata/filelists.xml deleted file mode 100644 index ec8b307..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/filelists.xml +++ /dev/null @@ -1,2903 +0,0 @@ - - - - - /usr/lib/opera - /usr/lib/opera/8.54-20060330.6 - /usr/lib/opera/plugins - /usr/share/doc/packages/opera - /usr/share/icons/opera.xpm - /usr/share/opera - /usr/share/opera/images - /usr/share/opera/ini - /usr/share/opera/java - /usr/share/opera/locale - /usr/share/opera/locale/en - /usr/share/opera/skin - /usr/share/opera/styles - /usr/share/opera/styles/user - /usr/share/pixmaps/opera.xpm - /etc/opera6rc - /etc/opera6rc.fixed - /etc/profile.d/opera.sh - /usr/bin/opera - /usr/lib/opera/8.54-20060330.6/missingsyms.so - /usr/lib/opera/8.54-20060330.6/opera - /usr/lib/opera/8.54-20060330.6/spellcheck.so - /usr/lib/opera/8.54-20060330.6/works - /usr/lib/opera/plugins/libnpp.so - /usr/lib/opera/plugins/operamotifwrapper-3 - /usr/lib/opera/plugins/operaplugincleaner - /usr/share/applications/opera.desktop - /usr/share/doc/packages/opera/LICENSE - /usr/share/icons/opera.xpm/opera.xpm - /usr/share/man/man1/opera.1.gz - /usr/share/opera/chartables.bin - /usr/share/opera/html40_entities.dtd - /usr/share/opera/images/blank.gif - /usr/share/opera/images/drive.gif - /usr/share/opera/images/file.gif - /usr/share/opera/images/folder.gif - /usr/share/opera/images/link.gif - /usr/share/opera/images/opera.xpm - /usr/share/opera/images/opera_16x16.png - /usr/share/opera/images/opera_22x22.png - /usr/share/opera/images/opera_32x32.png - /usr/share/opera/images/opera_48x48.png - /usr/share/opera/images/operabanner.png - /usr/share/opera/ini/dialog.ini - /usr/share/opera/ini/fastforward.ini - /usr/share/opera/ini/filehandler.ini - /usr/share/opera/ini/pluginpath.ini - /usr/share/opera/ini/spellcheck.ini - /usr/share/opera/ini/standard_keyboard.ini - /usr/share/opera/ini/standard_menu.ini - /usr/share/opera/ini/standard_mouse.ini - /usr/share/opera/ini/standard_toolbar.ini - /usr/share/opera/ini/unix_keyboard.ini - /usr/share/opera/java/opera.jar - /usr/share/opera/java/opera.policy - /usr/share/opera/jsconsole.html - /usr/share/opera/lngcode.txt - /usr/share/opera/locale/british_english.lng - /usr/share/opera/locale/bulgarian.lng - /usr/share/opera/locale/catala.lng - /usr/share/opera/locale/cesky.lng - /usr/share/opera/locale/dansk.lng - /usr/share/opera/locale/deutsch.lng - /usr/share/opera/locale/en/default.adr - /usr/share/opera/locale/en/license.txt - /usr/share/opera/locale/en/lngcode.txt - /usr/share/opera/locale/en/search.ini - /usr/share/opera/locale/english.lng - /usr/share/opera/locale/espanol.lng - /usr/share/opera/locale/espanol_castellano.lng - /usr/share/opera/locale/finnish.lng - /usr/share/opera/locale/francais.lng - /usr/share/opera/locale/italiano.lng - /usr/share/opera/locale/japanese.lng - /usr/share/opera/locale/nederlands.lng - /usr/share/opera/locale/norsk_bokmal.lng - /usr/share/opera/locale/norsk_nynorsk.lng - /usr/share/opera/locale/polski.lng - /usr/share/opera/locale/portugues_do_brasil.lng - /usr/share/opera/locale/russian.lng - /usr/share/opera/locale/svenska.lng - /usr/share/opera/opera.reg - /usr/share/opera/opera6.adr - /usr/share/opera/search.ini - /usr/share/opera/skin/standard_skin.zip - /usr/share/opera/skin/windows_skin.zip - /usr/share/opera/styles/OPF.css - /usr/share/opera/styles/about.css - /usr/share/opera/styles/cache.css - /usr/share/opera/styles/certinfo.css - /usr/share/opera/styles/csr.css - /usr/share/opera/styles/dir.css - /usr/share/opera/styles/drives.css - /usr/share/opera/styles/email.css - /usr/share/opera/styles/history.css - /usr/share/opera/styles/im.css - /usr/share/opera/styles/info.css - /usr/share/opera/styles/mime.css - /usr/share/opera/styles/mimehead.css - /usr/share/opera/styles/opf.css - /usr/share/opera/styles/plugins.css - /usr/share/opera/styles/user/accessibility.css - /usr/share/opera/styles/user/contrastbw.css - /usr/share/opera/styles/user/contrastwb.css - /usr/share/opera/styles/user/debugwithoutline.css - /usr/share/opera/styles/user/disabletables.css - /usr/share/opera/styles/user/hidecertainsizes.css - /usr/share/opera/styles/user/hidenonlinkimages.css - /usr/share/opera/styles/user/imageandlinkonly.css - /usr/share/opera/styles/user/nostalgia.css - /usr/share/opera/styles/user/showstructure.css - /usr/share/opera/styles/user/textonly.css - /usr/share/opera/styles/user/userstyle.ini - /usr/share/opera/styles/wml.css - /usr/share/opera/svg-mo.dat - /usr/share/opera/svg-mobd.dat - /usr/share/opera/svg-sa.dat - /usr/share/opera/svg-sabd.dat - /usr/share/opera/svg-se.dat - /usr/share/opera/svg-sebd.dat - /usr/share/pixmaps/opera.png - /usr/share/pixmaps/opera.xpm/opera.xpm - - - - - - - - - - - - - - - british_english.lng.bz2 - bulgarian.lng.bz2 - catala.lng.bz2 - cesky.lng.bz2 - dansk.lng.bz2 - deutsch.lng.bz2 - espanol.lng.bz2 - espanol_castellano.lng.bz2 - filehandler.ini - finnish.lng.bz2 - francais.lng.bz2 - italiano.lng.bz2 - japanese.lng.bz2 - nederlands.lng.bz2 - norsk_bokmal.lng.bz2 - norsk_nynorsk.lng.bz2 - opera-8.54-20060330.1-static-qt.sparc-en.tar.bz2 - opera-8.54-20060330.3-shared-qt.ppc-en.tar.bz2 - opera-8.54-20060330.6-shared-qt.i386-en.tar.bz2 - opera.reg - opera.spec - polski.lng.bz2 - portugues_do_brasil.lng.bz2 - russian.lng.bz2 - search.ini.gz - svenska.lng.bz2 - - - - - - - - - - - - - - - /usr/lib/opera - /usr/lib/opera/8.54-20060330.6 - /usr/lib/opera/plugins - /usr/share/doc/packages/opera - /usr/share/icons/opera.xpm - /usr/share/opera - /usr/share/opera/images - /usr/share/opera/ini - /usr/share/opera/java - /usr/share/opera/locale - /usr/share/opera/locale/en - /usr/share/opera/skin - /usr/share/opera/styles - /usr/share/opera/styles/user - /usr/share/pixmaps/opera.xpm - /etc/opera6rc - /etc/opera6rc.fixed - /etc/profile.d/opera.sh - /usr/bin/opera - /usr/lib/opera/8.54-20060330.6/missingsyms.so - /usr/lib/opera/8.54-20060330.6/opera - /usr/lib/opera/8.54-20060330.6/spellcheck.so - /usr/lib/opera/8.54-20060330.6/works - /usr/lib/opera/plugins/libnpp.so - /usr/lib/opera/plugins/operamotifwrapper-3 - /usr/lib/opera/plugins/operaplugincleaner - /usr/share/applications/opera.desktop - /usr/share/doc/packages/opera/LICENSE - /usr/share/icons/opera.xpm/opera.xpm - /usr/share/man/man1/opera.1.gz - /usr/share/opera/chartables.bin - /usr/share/opera/html40_entities.dtd - /usr/share/opera/images/blank.gif - /usr/share/opera/images/drive.gif - /usr/share/opera/images/file.gif - /usr/share/opera/images/folder.gif - /usr/share/opera/images/link.gif - /usr/share/opera/images/opera.xpm - /usr/share/opera/images/opera_16x16.png - /usr/share/opera/images/opera_22x22.png - /usr/share/opera/images/opera_32x32.png - /usr/share/opera/images/opera_48x48.png - /usr/share/opera/images/operabanner.png - /usr/share/opera/ini/dialog.ini - /usr/share/opera/ini/fastforward.ini - /usr/share/opera/ini/filehandler.ini - /usr/share/opera/ini/pluginpath.ini - /usr/share/opera/ini/spellcheck.ini - /usr/share/opera/ini/standard_keyboard.ini - /usr/share/opera/ini/standard_menu.ini - /usr/share/opera/ini/standard_mouse.ini - /usr/share/opera/ini/standard_toolbar.ini - /usr/share/opera/ini/unix_keyboard.ini - /usr/share/opera/java/opera.jar - /usr/share/opera/java/opera.policy - /usr/share/opera/jsconsole.html - /usr/share/opera/lngcode.txt - /usr/share/opera/locale/british_english.lng - /usr/share/opera/locale/bulgarian.lng - /usr/share/opera/locale/catala.lng - /usr/share/opera/locale/cesky.lng - /usr/share/opera/locale/dansk.lng - /usr/share/opera/locale/deutsch.lng - /usr/share/opera/locale/en/default.adr - /usr/share/opera/locale/en/license.txt - /usr/share/opera/locale/en/lngcode.txt - /usr/share/opera/locale/en/search.ini - /usr/share/opera/locale/english.lng - /usr/share/opera/locale/espanol.lng - /usr/share/opera/locale/espanol_castellano.lng - /usr/share/opera/locale/finnish.lng - /usr/share/opera/locale/francais.lng - /usr/share/opera/locale/italiano.lng - /usr/share/opera/locale/japanese.lng - /usr/share/opera/locale/nederlands.lng - /usr/share/opera/locale/norsk_bokmal.lng - /usr/share/opera/locale/norsk_nynorsk.lng - /usr/share/opera/locale/polski.lng - /usr/share/opera/locale/portugues_do_brasil.lng - /usr/share/opera/locale/russian.lng - /usr/share/opera/locale/svenska.lng - /usr/share/opera/opera.reg - /usr/share/opera/opera6.adr - /usr/share/opera/search.ini - /usr/share/opera/skin/standard_skin.zip - /usr/share/opera/skin/windows_skin.zip - /usr/share/opera/styles/OPF.css - /usr/share/opera/styles/about.css - /usr/share/opera/styles/cache.css - /usr/share/opera/styles/certinfo.css - /usr/share/opera/styles/csr.css - /usr/share/opera/styles/dir.css - /usr/share/opera/styles/drives.css - /usr/share/opera/styles/email.css - /usr/share/opera/styles/history.css - /usr/share/opera/styles/im.css - /usr/share/opera/styles/info.css - /usr/share/opera/styles/mime.css - /usr/share/opera/styles/mimehead.css - /usr/share/opera/styles/opf.css - /usr/share/opera/styles/plugins.css - /usr/share/opera/styles/user/accessibility.css - /usr/share/opera/styles/user/contrastbw.css - /usr/share/opera/styles/user/contrastwb.css - /usr/share/opera/styles/user/debugwithoutline.css - /usr/share/opera/styles/user/disabletables.css - /usr/share/opera/styles/user/hidecertainsizes.css - /usr/share/opera/styles/user/hidenonlinkimages.css - /usr/share/opera/styles/user/imageandlinkonly.css - /usr/share/opera/styles/user/nostalgia.css - /usr/share/opera/styles/user/showstructure.css - /usr/share/opera/styles/user/textonly.css - /usr/share/opera/styles/user/userstyle.ini - /usr/share/opera/styles/wml.css - /usr/share/opera/svg-mo.dat - /usr/share/opera/svg-mobd.dat - /usr/share/opera/svg-sa.dat - /usr/share/opera/svg-sabd.dat - /usr/share/opera/svg-se.dat - /usr/share/opera/svg-sebd.dat - /usr/share/pixmaps/opera.png - /usr/share/pixmaps/opera.xpm/opera.xpm - - - - - - - - - - - - - - /usr/lib/pdns - /usr/share/doc/packages/pdns - /usr/share/doc/packages/pdns/html - /usr/share/doc/packages/pdns/html/stylesheet-images - /etc/init.d/pdns - /etc/pdns.conf - /usr/bin/pdns_control - /usr/bin/zone2ldap - /usr/bin/zone2sql - /usr/lib/pdns/libgeobackend.la - /usr/lib/pdns/libgeobackend.so - /usr/lib/pdns/libgeobackend.so.0 - /usr/lib/pdns/libgeobackend.so.0.0.0 - /usr/lib/pdns/libgmysqlbackend.la - /usr/lib/pdns/libgmysqlbackend.so - /usr/lib/pdns/libgmysqlbackend.so.0 - /usr/lib/pdns/libgmysqlbackend.so.0.0.0 - /usr/lib/pdns/libldapbackend.la - /usr/lib/pdns/libldapbackend.so - /usr/lib/pdns/libldapbackend.so.0 - /usr/lib/pdns/libldapbackend.so.0.0.0 - /usr/lib/pdns/libpdnsbackend.la - /usr/lib/pdns/libpdnsbackend.so - /usr/lib/pdns/libpdnsbackend.so.0 - /usr/lib/pdns/libpdnsbackend.so.0.0.0 - /usr/lib/pdns/libpipebackend.la - /usr/lib/pdns/libpipebackend.so - /usr/lib/pdns/libpipebackend.so.0 - /usr/lib/pdns/libpipebackend.so.0.0.0 - /usr/sbin/pdns_recursor - /usr/sbin/pdns_server - /usr/sbin/rcpdns - /usr/share/doc/packages/pdns/ChangeLog - /usr/share/doc/packages/pdns/HACKING - /usr/share/doc/packages/pdns/INSTALL - /usr/share/doc/packages/pdns/README - /usr/share/doc/packages/pdns/TODO - /usr/share/doc/packages/pdns/html/HTML.manifest - /usr/share/doc/packages/pdns/html/about.html - /usr/share/doc/packages/pdns/html/all-settings.html - /usr/share/doc/packages/pdns/html/analysis.html - /usr/share/doc/packages/pdns/html/backend-configuration-details.html - /usr/share/doc/packages/pdns/html/backend-error-reporting.html - /usr/share/doc/packages/pdns/html/backend-writers-guide.html - /usr/share/doc/packages/pdns/html/backends-detail.html - /usr/share/doc/packages/pdns/html/bindbackend.html - /usr/share/doc/packages/pdns/html/book1.html - /usr/share/doc/packages/pdns/html/built-in-recursor.html - /usr/share/doc/packages/pdns/html/changelog.html - /usr/share/doc/packages/pdns/html/compiling-powerdns.html - /usr/share/doc/packages/pdns/html/configuring-db-connection.html - /usr/share/doc/packages/pdns/html/considerations.html - /usr/share/doc/packages/pdns/html/db2.html - /usr/share/doc/packages/pdns/html/dns-to-query.html - /usr/share/doc/packages/pdns/html/docbook.css - /usr/share/doc/packages/pdns/html/fancy-records.html - /usr/share/doc/packages/pdns/html/faq.html - /usr/share/doc/packages/pdns/html/generic-mypgsql-backends.html - /usr/share/doc/packages/pdns/html/gsqlite.html - /usr/share/doc/packages/pdns/html/guardian.html - /usr/share/doc/packages/pdns/html/index.html - /usr/share/doc/packages/pdns/html/init-d-commands.html - /usr/share/doc/packages/pdns/html/installing-on-unix.html - /usr/share/doc/packages/pdns/html/ldap.html - /usr/share/doc/packages/pdns/html/license.html - /usr/share/doc/packages/pdns/html/master-backends.html - /usr/share/doc/packages/pdns/html/master.html - /usr/share/doc/packages/pdns/html/metrics.html - /usr/share/doc/packages/pdns/html/migration.html - /usr/share/doc/packages/pdns/html/modules.html - /usr/share/doc/packages/pdns/html/monitoring.html - /usr/share/doc/packages/pdns/html/mysqlbackend.html - /usr/share/doc/packages/pdns/html/nptl.html - /usr/share/doc/packages/pdns/html/odbc.html - /usr/share/doc/packages/pdns/html/on-windows.html - /usr/share/doc/packages/pdns/html/oracle.html - /usr/share/doc/packages/pdns/html/pdns-devel-faq.html - /usr/share/doc/packages/pdns/html/pdns-internals.html - /usr/share/doc/packages/pdns/html/pdns-on-unix.html - /usr/share/doc/packages/pdns/html/pdns-users-faq.html - /usr/share/doc/packages/pdns/html/pdnsbackend.html - /usr/share/doc/packages/pdns/html/performance-settings.html - /usr/share/doc/packages/pdns/html/performance.html - /usr/share/doc/packages/pdns/html/pipebackend-dynamic-resolution.html - /usr/share/doc/packages/pdns/html/powerdns-company-faq.html - /usr/share/doc/packages/pdns/html/powerdns.html - /usr/share/doc/packages/pdns/html/querycache.html - /usr/share/doc/packages/pdns/html/randombackend.html - /usr/share/doc/packages/pdns/html/recursion.html - /usr/share/doc/packages/pdns/html/replication.html - /usr/share/doc/packages/pdns/html/running-on-windows.html - /usr/share/doc/packages/pdns/html/rw-backends.html - /usr/share/doc/packages/pdns/html/security-policy.html - /usr/share/doc/packages/pdns/html/security.html - /usr/share/doc/packages/pdns/html/slave.html - /usr/share/doc/packages/pdns/html/stylesheet-images/caution.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/home.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/important.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/next.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/note.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/prev.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/tip.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-blank.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-minus.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-plus.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/up.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/warning.gif - /usr/share/doc/packages/pdns/html/syslog.html - /usr/share/doc/packages/pdns/html/testing.html - /usr/share/doc/packages/pdns/html/thanks-to.html - /usr/share/doc/packages/pdns/html/types.html - /usr/share/doc/packages/pdns/html/virtual.html - /usr/share/doc/packages/pdns/html/windows.html - /usr/share/doc/packages/pdns/html/x2460.html - /usr/share/doc/packages/pdns/html/x2472.html - /usr/share/doc/packages/pdns/html/xdbbackend.html - /usr/share/man/man8/pdns_control.8.gz - /usr/share/man/man8/pdns_server.8.gz - /usr/share/man/man8/zone2sql.8.gz - - - - - - - - - - - - - - pdns-2.9.19-CVE-2006-2069.patch - pdns-2.9.19-fix.patch - pdns-2.9.19.tar.bz2 - pdns.spec - rcpdns - - - - - - - - - - - - - - /usr/lib64/pdns - /usr/share/doc/packages/pdns - /usr/share/doc/packages/pdns/html - /usr/share/doc/packages/pdns/html/stylesheet-images - /etc/init.d/pdns - /etc/pdns.conf - /usr/bin/pdns_control - /usr/bin/zone2ldap - /usr/bin/zone2sql - /usr/lib64/pdns/libgeobackend.la - /usr/lib64/pdns/libgeobackend.so - /usr/lib64/pdns/libgeobackend.so.0 - /usr/lib64/pdns/libgeobackend.so.0.0.0 - /usr/lib64/pdns/libgmysqlbackend.la - /usr/lib64/pdns/libgmysqlbackend.so - /usr/lib64/pdns/libgmysqlbackend.so.0 - /usr/lib64/pdns/libgmysqlbackend.so.0.0.0 - /usr/lib64/pdns/libldapbackend.la - /usr/lib64/pdns/libldapbackend.so - /usr/lib64/pdns/libldapbackend.so.0 - /usr/lib64/pdns/libldapbackend.so.0.0.0 - /usr/lib64/pdns/libpdnsbackend.la - /usr/lib64/pdns/libpdnsbackend.so - /usr/lib64/pdns/libpdnsbackend.so.0 - /usr/lib64/pdns/libpdnsbackend.so.0.0.0 - /usr/lib64/pdns/libpipebackend.la - /usr/lib64/pdns/libpipebackend.so - /usr/lib64/pdns/libpipebackend.so.0 - /usr/lib64/pdns/libpipebackend.so.0.0.0 - /usr/sbin/pdns_recursor - /usr/sbin/pdns_server - /usr/sbin/rcpdns - /usr/share/doc/packages/pdns/ChangeLog - /usr/share/doc/packages/pdns/HACKING - /usr/share/doc/packages/pdns/INSTALL - /usr/share/doc/packages/pdns/README - /usr/share/doc/packages/pdns/TODO - /usr/share/doc/packages/pdns/html/HTML.manifest - /usr/share/doc/packages/pdns/html/about.html - /usr/share/doc/packages/pdns/html/all-settings.html - /usr/share/doc/packages/pdns/html/analysis.html - /usr/share/doc/packages/pdns/html/backend-configuration-details.html - /usr/share/doc/packages/pdns/html/backend-error-reporting.html - /usr/share/doc/packages/pdns/html/backend-writers-guide.html - /usr/share/doc/packages/pdns/html/backends-detail.html - /usr/share/doc/packages/pdns/html/bindbackend.html - /usr/share/doc/packages/pdns/html/book1.html - /usr/share/doc/packages/pdns/html/built-in-recursor.html - /usr/share/doc/packages/pdns/html/changelog.html - /usr/share/doc/packages/pdns/html/compiling-powerdns.html - /usr/share/doc/packages/pdns/html/configuring-db-connection.html - /usr/share/doc/packages/pdns/html/considerations.html - /usr/share/doc/packages/pdns/html/db2.html - /usr/share/doc/packages/pdns/html/dns-to-query.html - /usr/share/doc/packages/pdns/html/docbook.css - /usr/share/doc/packages/pdns/html/fancy-records.html - /usr/share/doc/packages/pdns/html/faq.html - /usr/share/doc/packages/pdns/html/generic-mypgsql-backends.html - /usr/share/doc/packages/pdns/html/gsqlite.html - /usr/share/doc/packages/pdns/html/guardian.html - /usr/share/doc/packages/pdns/html/index.html - /usr/share/doc/packages/pdns/html/init-d-commands.html - /usr/share/doc/packages/pdns/html/installing-on-unix.html - /usr/share/doc/packages/pdns/html/ldap.html - /usr/share/doc/packages/pdns/html/license.html - /usr/share/doc/packages/pdns/html/master-backends.html - /usr/share/doc/packages/pdns/html/master.html - /usr/share/doc/packages/pdns/html/metrics.html - /usr/share/doc/packages/pdns/html/migration.html - /usr/share/doc/packages/pdns/html/modules.html - /usr/share/doc/packages/pdns/html/monitoring.html - /usr/share/doc/packages/pdns/html/mysqlbackend.html - /usr/share/doc/packages/pdns/html/nptl.html - /usr/share/doc/packages/pdns/html/odbc.html - /usr/share/doc/packages/pdns/html/on-windows.html - /usr/share/doc/packages/pdns/html/oracle.html - /usr/share/doc/packages/pdns/html/pdns-devel-faq.html - /usr/share/doc/packages/pdns/html/pdns-internals.html - /usr/share/doc/packages/pdns/html/pdns-on-unix.html - /usr/share/doc/packages/pdns/html/pdns-users-faq.html - /usr/share/doc/packages/pdns/html/pdnsbackend.html - /usr/share/doc/packages/pdns/html/performance-settings.html - /usr/share/doc/packages/pdns/html/performance.html - /usr/share/doc/packages/pdns/html/pipebackend-dynamic-resolution.html - /usr/share/doc/packages/pdns/html/powerdns-company-faq.html - /usr/share/doc/packages/pdns/html/powerdns.html - /usr/share/doc/packages/pdns/html/querycache.html - /usr/share/doc/packages/pdns/html/randombackend.html - /usr/share/doc/packages/pdns/html/recursion.html - /usr/share/doc/packages/pdns/html/replication.html - /usr/share/doc/packages/pdns/html/running-on-windows.html - /usr/share/doc/packages/pdns/html/rw-backends.html - /usr/share/doc/packages/pdns/html/security-policy.html - /usr/share/doc/packages/pdns/html/security.html - /usr/share/doc/packages/pdns/html/slave.html - /usr/share/doc/packages/pdns/html/stylesheet-images/caution.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/home.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/important.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/next.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/note.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/prev.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/tip.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-blank.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-minus.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/toc-plus.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/up.gif - /usr/share/doc/packages/pdns/html/stylesheet-images/warning.gif - /usr/share/doc/packages/pdns/html/syslog.html - /usr/share/doc/packages/pdns/html/testing.html - /usr/share/doc/packages/pdns/html/thanks-to.html - /usr/share/doc/packages/pdns/html/types.html - /usr/share/doc/packages/pdns/html/virtual.html - /usr/share/doc/packages/pdns/html/windows.html - /usr/share/doc/packages/pdns/html/x2460.html - /usr/share/doc/packages/pdns/html/x2472.html - /usr/share/doc/packages/pdns/html/xdbbackend.html - /usr/share/man/man8/pdns_control.8.gz - /usr/share/man/man8/pdns_server.8.gz - /usr/share/man/man8/zone2sql.8.gz - - - - - - - - - - - - - /etc/dovecot - /usr/lib/dovecot - /usr/lib/dovecot/modules - /usr/lib/dovecot/modules/imap - /usr/lib/dovecot/modules/lda - /usr/lib/dovecot/modules/pop3 - /usr/share/doc/packages/dovecot - /var/run/dovecot - /var/run/dovecot/login - /etc/dovecot/dovecot-ldap.conf - /etc/dovecot/dovecot-sql.conf - /etc/dovecot/dovecot.conf - /etc/init.d/dovecot - /etc/pam.d/dovecot - /usr/lib/dovecot/checkpassword-reply - /usr/lib/dovecot/deliver - /usr/lib/dovecot/dict - /usr/lib/dovecot/dovecot-auth - /usr/lib/dovecot/gdbhelper - /usr/lib/dovecot/imap - /usr/lib/dovecot/imap-login - /usr/lib/dovecot/modules/imap/lib01_convert_plugin.so - /usr/lib/dovecot/modules/imap/lib01_quota_plugin.so - /usr/lib/dovecot/modules/imap/lib01_zlib_plugin.so - /usr/lib/dovecot/modules/imap/lib02_imap_quota_plugin.so - /usr/lib/dovecot/modules/imap/lib02_trash_plugin.so - /usr/lib/dovecot/modules/lda/lib01_convert_plugin.so - /usr/lib/dovecot/modules/lda/lib01_quota_plugin.so - /usr/lib/dovecot/modules/lda/lib02_trash_plugin.so - /usr/lib/dovecot/modules/lib01_convert_plugin.so - /usr/lib/dovecot/modules/lib01_quota_plugin.so - /usr/lib/dovecot/modules/lib02_trash_plugin.so - /usr/lib/dovecot/modules/pop3/lib01_convert_plugin.so - /usr/lib/dovecot/pop3 - /usr/lib/dovecot/pop3-login - /usr/lib/dovecot/rawlog - /usr/lib/dovecot/ssl-build-param - /usr/sbin/dovecot - /usr/sbin/dovecotpw - /usr/sbin/rcdovecot - /usr/share/doc/packages/dovecot/ABOUT-NLS - /usr/share/doc/packages/dovecot/AUTHORS - /usr/share/doc/packages/dovecot/AUTHORS.sieve - /usr/share/doc/packages/dovecot/COPYING - /usr/share/doc/packages/dovecot/COPYING.LGPL - /usr/share/doc/packages/dovecot/COPYING.MIT - /usr/share/doc/packages/dovecot/COPYING.sieve - /usr/share/doc/packages/dovecot/ChangeLog.gz - /usr/share/doc/packages/dovecot/ChangeLog.lda - /usr/share/doc/packages/dovecot/NEWS - /usr/share/doc/packages/dovecot/NEWS.sieve - /usr/share/doc/packages/dovecot/README - /usr/share/doc/packages/dovecot/README.SuSE - /usr/share/doc/packages/dovecot/README.sieve - /usr/share/doc/packages/dovecot/TODO - /usr/share/doc/packages/dovecot/USE-WIKI-INSTEAD - /usr/share/doc/packages/dovecot/auth-protocol.txt - /usr/share/doc/packages/dovecot/auth.txt - /usr/share/doc/packages/dovecot/configuration.txt - /usr/share/doc/packages/dovecot/design.txt - /usr/share/doc/packages/dovecot/dovecot-openssl.cnf - /usr/share/doc/packages/dovecot/index.txt - /usr/share/doc/packages/dovecot/mail-storages.txt - /usr/share/doc/packages/dovecot/mkcert.sh - /usr/share/doc/packages/dovecot/multiaccess.txt - /usr/share/doc/packages/dovecot/nfs.txt - /usr/share/doc/packages/dovecot/securecoding.txt - /usr/share/doc/packages/dovecot/variables.txt - - - - - - - - - - - - - /etc/dovecot - /usr/lib/dovecot - /usr/lib/dovecot/modules - /usr/lib/dovecot/modules/imap - /usr/lib/dovecot/modules/lda - /usr/lib/dovecot/modules/pop3 - /usr/share/doc/packages/dovecot - /var/run/dovecot - /var/run/dovecot/login - /etc/dovecot/dovecot-ldap.conf - /etc/dovecot/dovecot-sql.conf - /etc/dovecot/dovecot.conf - /etc/init.d/dovecot - /etc/pam.d/dovecot - /usr/lib/dovecot/checkpassword-reply - /usr/lib/dovecot/deliver - /usr/lib/dovecot/dict - /usr/lib/dovecot/dovecot-auth - /usr/lib/dovecot/gdbhelper - /usr/lib/dovecot/imap - /usr/lib/dovecot/imap-login - /usr/lib/dovecot/modules/imap/lib01_convert_plugin.so - /usr/lib/dovecot/modules/imap/lib01_quota_plugin.so - /usr/lib/dovecot/modules/imap/lib01_zlib_plugin.so - /usr/lib/dovecot/modules/imap/lib02_imap_quota_plugin.so - /usr/lib/dovecot/modules/imap/lib02_trash_plugin.so - /usr/lib/dovecot/modules/lda/lib01_convert_plugin.so - /usr/lib/dovecot/modules/lda/lib01_quota_plugin.so - /usr/lib/dovecot/modules/lda/lib02_trash_plugin.so - /usr/lib/dovecot/modules/lib01_convert_plugin.so - /usr/lib/dovecot/modules/lib01_quota_plugin.so - /usr/lib/dovecot/modules/lib02_trash_plugin.so - /usr/lib/dovecot/modules/pop3/lib01_convert_plugin.so - /usr/lib/dovecot/pop3 - /usr/lib/dovecot/pop3-login - /usr/lib/dovecot/rawlog - /usr/lib/dovecot/ssl-build-param - /usr/sbin/dovecot - /usr/sbin/dovecotpw - /usr/sbin/rcdovecot - /usr/share/doc/packages/dovecot/ABOUT-NLS - /usr/share/doc/packages/dovecot/AUTHORS - /usr/share/doc/packages/dovecot/AUTHORS.sieve - /usr/share/doc/packages/dovecot/COPYING - /usr/share/doc/packages/dovecot/COPYING.LGPL - /usr/share/doc/packages/dovecot/COPYING.MIT - /usr/share/doc/packages/dovecot/COPYING.sieve - /usr/share/doc/packages/dovecot/ChangeLog.gz - /usr/share/doc/packages/dovecot/ChangeLog.lda - /usr/share/doc/packages/dovecot/NEWS - /usr/share/doc/packages/dovecot/NEWS.sieve - /usr/share/doc/packages/dovecot/README - /usr/share/doc/packages/dovecot/README.SuSE - /usr/share/doc/packages/dovecot/README.sieve - /usr/share/doc/packages/dovecot/TODO - /usr/share/doc/packages/dovecot/USE-WIKI-INSTEAD - /usr/share/doc/packages/dovecot/auth-protocol.txt - /usr/share/doc/packages/dovecot/auth.txt - /usr/share/doc/packages/dovecot/configuration.txt - /usr/share/doc/packages/dovecot/design.txt - /usr/share/doc/packages/dovecot/dovecot-openssl.cnf - /usr/share/doc/packages/dovecot/index.txt - /usr/share/doc/packages/dovecot/mail-storages.txt - /usr/share/doc/packages/dovecot/mkcert.sh - /usr/share/doc/packages/dovecot/multiaccess.txt - /usr/share/doc/packages/dovecot/nfs.txt - /usr/share/doc/packages/dovecot/securecoding.txt - /usr/share/doc/packages/dovecot/variables.txt - - - - - - - - - - - - - dovecot-1.0.beta1_pie.patch - dovecot-1.0.beta3.tar.bz2 - dovecot-1.0.beta3_indexfixes.patch - dovecot-1.0.beta7_directory-traversal.patch - dovecot-lda.tar.bz2 - dovecot.README.SuSE - dovecot.init - dovecot.pam - dovecot.spec - - - - - - - - - - - - - /etc/dovecot - /usr/lib64/dovecot - /usr/lib64/dovecot/modules - /usr/lib64/dovecot/modules/imap - /usr/lib64/dovecot/modules/lda - /usr/lib64/dovecot/modules/pop3 - /usr/share/doc/packages/dovecot - /var/run/dovecot - /var/run/dovecot/login - /etc/dovecot/dovecot-ldap.conf - /etc/dovecot/dovecot-sql.conf - /etc/dovecot/dovecot.conf - /etc/init.d/dovecot - /etc/pam.d/dovecot - /usr/lib64/dovecot/checkpassword-reply - /usr/lib64/dovecot/deliver - /usr/lib64/dovecot/dict - /usr/lib64/dovecot/dovecot-auth - /usr/lib64/dovecot/gdbhelper - /usr/lib64/dovecot/imap - /usr/lib64/dovecot/imap-login - /usr/lib64/dovecot/modules/imap/lib01_convert_plugin.so - /usr/lib64/dovecot/modules/imap/lib01_quota_plugin.so - /usr/lib64/dovecot/modules/imap/lib01_zlib_plugin.so - /usr/lib64/dovecot/modules/imap/lib02_imap_quota_plugin.so - /usr/lib64/dovecot/modules/imap/lib02_trash_plugin.so - /usr/lib64/dovecot/modules/lda/lib01_convert_plugin.so - /usr/lib64/dovecot/modules/lda/lib01_quota_plugin.so - /usr/lib64/dovecot/modules/lda/lib02_trash_plugin.so - /usr/lib64/dovecot/modules/lib01_convert_plugin.so - /usr/lib64/dovecot/modules/lib01_quota_plugin.so - /usr/lib64/dovecot/modules/lib02_trash_plugin.so - /usr/lib64/dovecot/modules/pop3/lib01_convert_plugin.so - /usr/lib64/dovecot/pop3 - /usr/lib64/dovecot/pop3-login - /usr/lib64/dovecot/rawlog - /usr/lib64/dovecot/ssl-build-param - /usr/sbin/dovecot - /usr/sbin/dovecotpw - /usr/sbin/rcdovecot - /usr/share/doc/packages/dovecot/ABOUT-NLS - /usr/share/doc/packages/dovecot/AUTHORS - /usr/share/doc/packages/dovecot/AUTHORS.sieve - /usr/share/doc/packages/dovecot/COPYING - /usr/share/doc/packages/dovecot/COPYING.LGPL - /usr/share/doc/packages/dovecot/COPYING.MIT - /usr/share/doc/packages/dovecot/COPYING.sieve - /usr/share/doc/packages/dovecot/ChangeLog.gz - /usr/share/doc/packages/dovecot/ChangeLog.lda - /usr/share/doc/packages/dovecot/NEWS - /usr/share/doc/packages/dovecot/NEWS.sieve - /usr/share/doc/packages/dovecot/README - /usr/share/doc/packages/dovecot/README.SuSE - /usr/share/doc/packages/dovecot/README.sieve - /usr/share/doc/packages/dovecot/TODO - /usr/share/doc/packages/dovecot/USE-WIKI-INSTEAD - /usr/share/doc/packages/dovecot/auth-protocol.txt - /usr/share/doc/packages/dovecot/auth.txt - /usr/share/doc/packages/dovecot/configuration.txt - /usr/share/doc/packages/dovecot/design.txt - /usr/share/doc/packages/dovecot/dovecot-openssl.cnf - /usr/share/doc/packages/dovecot/index.txt - /usr/share/doc/packages/dovecot/mail-storages.txt - /usr/share/doc/packages/dovecot/mkcert.sh - /usr/share/doc/packages/dovecot/multiaccess.txt - /usr/share/doc/packages/dovecot/nfs.txt - /usr/share/doc/packages/dovecot/securecoding.txt - /usr/share/doc/packages/dovecot/variables.txt - - - - - - - - - - - - /etc/avahi - /etc/avahi/services - /etc/dbus-1 - /etc/dbus-1/system.d - /usr/lib/python2.4/site-packages/avahi - /usr/share/avahi - /usr/share/avahi/interfaces - /usr/share/avahi/introspection - /usr/share/doc/packages/avahi - /var/run/avahi-daemon - /etc/avahi/avahi-daemon.conf - /etc/avahi/avahi-dnsconfd.action - /etc/avahi/services/ssh.service - /etc/dbus-1/system.d/avahi-dbus.conf - /etc/init.d/avahi-daemon - /etc/init.d/avahi-dnsconfd - /usr/bin/avahi-bookmarks - /usr/bin/avahi-browse - /usr/bin/avahi-browse-domains - /usr/bin/avahi-publish - /usr/bin/avahi-publish-address - /usr/bin/avahi-publish-service - /usr/bin/avahi-resolve - /usr/bin/avahi-resolve-address - /usr/bin/avahi-resolve-host-name - /usr/lib/libavahi-client.so.3 - /usr/lib/libavahi-client.so.3.1.0 - /usr/lib/libavahi-common.so.3 - /usr/lib/libavahi-common.so.3.2.0 - /usr/lib/libavahi-core.so.3 - /usr/lib/libavahi-core.so.3.0.3 - /usr/lib/python2.4/site-packages/avahi/ServiceTypeDatabase.py - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.py - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.pyc - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.pyo - /usr/lib/python2.4/site-packages/avahi/__init__.py - /usr/lib/python2.4/site-packages/avahi/__init__.pyc - /usr/lib/python2.4/site-packages/avahi/__init__.pyo - /usr/sbin/avahi-daemon - /usr/sbin/avahi-dnsconfd - /usr/share/avahi/avahi-service.dtd - /usr/share/avahi/interfaces/avahi-discover.glade - /usr/share/avahi/introspection/AddressResolver.introspect - /usr/share/avahi/introspection/DomainBrowser.introspect - /usr/share/avahi/introspection/EntryGroup.introspect - /usr/share/avahi/introspection/HostNameResolver.introspect - /usr/share/avahi/introspection/RecordBrowser.introspect - /usr/share/avahi/introspection/Server.introspect - /usr/share/avahi/introspection/ServiceBrowser.introspect - /usr/share/avahi/introspection/ServiceResolver.introspect - /usr/share/avahi/introspection/ServiceTypeBrowser.introspect - /usr/share/avahi/service-types - /usr/share/avahi/service-types.db - /usr/share/doc/packages/avahi/API-CHANGES-0.6 - /usr/share/doc/packages/avahi/AUTHORS - /usr/share/doc/packages/avahi/COMPAT-LAYERS - /usr/share/doc/packages/avahi/DBUS-API - /usr/share/doc/packages/avahi/HACKING - /usr/share/doc/packages/avahi/INSTALL - /usr/share/doc/packages/avahi/LICENSE - /usr/share/doc/packages/avahi/MALLOC - /usr/share/doc/packages/avahi/NEWS - /usr/share/doc/packages/avahi/README - /usr/share/doc/packages/avahi/TODO - /usr/share/doc/packages/avahi/avahi-poll.dia - /usr/share/doc/packages/avahi/overview.dia - /usr/share/doc/packages/avahi/server-states.dia - /usr/share/man/man1/avahi-bookmarks.1.gz - /usr/share/man/man1/avahi-browse-domains.1.gz - /usr/share/man/man1/avahi-browse.1.gz - /usr/share/man/man1/avahi-discover.1.gz - /usr/share/man/man1/avahi-publish-address.1.gz - /usr/share/man/man1/avahi-publish-service.1.gz - /usr/share/man/man1/avahi-publish.1.gz - /usr/share/man/man1/avahi-resolve-address.1.gz - /usr/share/man/man1/avahi-resolve-host-name.1.gz - /usr/share/man/man1/avahi-resolve.1.gz - /usr/share/man/man5/avahi-daemon.conf.5.gz - /usr/share/man/man5/avahi.service.5.gz - /usr/share/man/man8/avahi-daemon.8.gz - /usr/share/man/man8/avahi-dnsconfd.8.gz - /usr/share/man/man8/avahi-dnsconfd.action.8.gz - - - - - - - - - - - - /etc/avahi - /etc/avahi/services - /etc/dbus-1 - /etc/dbus-1/system.d - /usr/lib/python2.4/site-packages/avahi - /usr/share/avahi - /usr/share/avahi/interfaces - /usr/share/avahi/introspection - /usr/share/doc/packages/avahi - /var/run/avahi-daemon - /etc/avahi/avahi-daemon.conf - /etc/avahi/avahi-dnsconfd.action - /etc/avahi/services/ssh.service - /etc/dbus-1/system.d/avahi-dbus.conf - /etc/init.d/avahi-daemon - /etc/init.d/avahi-dnsconfd - /usr/bin/avahi-bookmarks - /usr/bin/avahi-browse - /usr/bin/avahi-browse-domains - /usr/bin/avahi-publish - /usr/bin/avahi-publish-address - /usr/bin/avahi-publish-service - /usr/bin/avahi-resolve - /usr/bin/avahi-resolve-address - /usr/bin/avahi-resolve-host-name - /usr/lib/libavahi-client.so.3 - /usr/lib/libavahi-client.so.3.1.0 - /usr/lib/libavahi-common.so.3 - /usr/lib/libavahi-common.so.3.2.0 - /usr/lib/libavahi-core.so.3 - /usr/lib/libavahi-core.so.3.0.3 - /usr/lib/python2.4/site-packages/avahi/ServiceTypeDatabase.py - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.py - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.pyc - /usr/lib/python2.4/site-packages/avahi/SimpleGladeApp.pyo - /usr/lib/python2.4/site-packages/avahi/__init__.py - /usr/lib/python2.4/site-packages/avahi/__init__.pyc - /usr/lib/python2.4/site-packages/avahi/__init__.pyo - /usr/sbin/avahi-daemon - /usr/sbin/avahi-dnsconfd - /usr/share/avahi/avahi-service.dtd - /usr/share/avahi/interfaces/avahi-discover.glade - /usr/share/avahi/introspection/AddressResolver.introspect - /usr/share/avahi/introspection/DomainBrowser.introspect - /usr/share/avahi/introspection/EntryGroup.introspect - /usr/share/avahi/introspection/HostNameResolver.introspect - /usr/share/avahi/introspection/RecordBrowser.introspect - /usr/share/avahi/introspection/Server.introspect - /usr/share/avahi/introspection/ServiceBrowser.introspect - /usr/share/avahi/introspection/ServiceResolver.introspect - /usr/share/avahi/introspection/ServiceTypeBrowser.introspect - /usr/share/avahi/service-types - /usr/share/avahi/service-types.db - /usr/share/doc/packages/avahi/API-CHANGES-0.6 - /usr/share/doc/packages/avahi/AUTHORS - /usr/share/doc/packages/avahi/COMPAT-LAYERS - /usr/share/doc/packages/avahi/DBUS-API - /usr/share/doc/packages/avahi/HACKING - /usr/share/doc/packages/avahi/INSTALL - /usr/share/doc/packages/avahi/LICENSE - /usr/share/doc/packages/avahi/MALLOC - /usr/share/doc/packages/avahi/NEWS - /usr/share/doc/packages/avahi/README - /usr/share/doc/packages/avahi/TODO - /usr/share/doc/packages/avahi/avahi-poll.dia - /usr/share/doc/packages/avahi/overview.dia - /usr/share/doc/packages/avahi/server-states.dia - /usr/share/man/man1/avahi-bookmarks.1.gz - /usr/share/man/man1/avahi-browse-domains.1.gz - /usr/share/man/man1/avahi-browse.1.gz - /usr/share/man/man1/avahi-discover.1.gz - /usr/share/man/man1/avahi-publish-address.1.gz - /usr/share/man/man1/avahi-publish-service.1.gz - /usr/share/man/man1/avahi-publish.1.gz - /usr/share/man/man1/avahi-resolve-address.1.gz - /usr/share/man/man1/avahi-resolve-host-name.1.gz - /usr/share/man/man1/avahi-resolve.1.gz - /usr/share/man/man5/avahi-daemon.conf.5.gz - /usr/share/man/man5/avahi.service.5.gz - /usr/share/man/man8/avahi-daemon.8.gz - /usr/share/man/man8/avahi-dnsconfd.8.gz - /usr/share/man/man8/avahi-dnsconfd.action.8.gz - - - - - - - - - - - - avahi-0.6.5.tar.bz2 - avahi-biarch.patch - avahi-compat-error-return.patch - avahi-compat-txt-buffer-size.patch - avahi-gacdir.patch - avahi-init-sleep.patch - avahi-utf8-CVE-2006-2288.patch - avahi.spec - avahi_record_to_string-CVE-2006-2289.patch - - - - - - - - - - - - /etc/avahi - /etc/avahi/services - /etc/dbus-1 - /etc/dbus-1/system.d - /usr/lib64/python2.4/site-packages/avahi - /usr/share/avahi - /usr/share/avahi/interfaces - /usr/share/avahi/introspection - /usr/share/doc/packages/avahi - /var/run/avahi-daemon - /etc/avahi/avahi-daemon.conf - /etc/avahi/avahi-dnsconfd.action - /etc/avahi/services/ssh.service - /etc/dbus-1/system.d/avahi-dbus.conf - /etc/init.d/avahi-daemon - /etc/init.d/avahi-dnsconfd - /usr/bin/avahi-bookmarks - /usr/bin/avahi-browse - /usr/bin/avahi-browse-domains - /usr/bin/avahi-publish - /usr/bin/avahi-publish-address - /usr/bin/avahi-publish-service - /usr/bin/avahi-resolve - /usr/bin/avahi-resolve-address - /usr/bin/avahi-resolve-host-name - /usr/lib64/libavahi-client.so.3 - /usr/lib64/libavahi-client.so.3.1.0 - /usr/lib64/libavahi-common.so.3 - /usr/lib64/libavahi-common.so.3.2.0 - /usr/lib64/libavahi-core.so.3 - /usr/lib64/libavahi-core.so.3.0.3 - /usr/lib64/python2.4/site-packages/avahi/ServiceTypeDatabase.py - /usr/lib64/python2.4/site-packages/avahi/SimpleGladeApp.py - /usr/lib64/python2.4/site-packages/avahi/SimpleGladeApp.pyc - /usr/lib64/python2.4/site-packages/avahi/SimpleGladeApp.pyo - /usr/lib64/python2.4/site-packages/avahi/__init__.py - /usr/lib64/python2.4/site-packages/avahi/__init__.pyc - /usr/lib64/python2.4/site-packages/avahi/__init__.pyo - /usr/sbin/avahi-daemon - /usr/sbin/avahi-dnsconfd - /usr/share/avahi/avahi-service.dtd - /usr/share/avahi/interfaces/avahi-discover.glade - /usr/share/avahi/introspection/AddressResolver.introspect - /usr/share/avahi/introspection/DomainBrowser.introspect - /usr/share/avahi/introspection/EntryGroup.introspect - /usr/share/avahi/introspection/HostNameResolver.introspect - /usr/share/avahi/introspection/RecordBrowser.introspect - /usr/share/avahi/introspection/Server.introspect - /usr/share/avahi/introspection/ServiceBrowser.introspect - /usr/share/avahi/introspection/ServiceResolver.introspect - /usr/share/avahi/introspection/ServiceTypeBrowser.introspect - /usr/share/avahi/service-types - /usr/share/avahi/service-types.db - /usr/share/doc/packages/avahi/API-CHANGES-0.6 - /usr/share/doc/packages/avahi/AUTHORS - /usr/share/doc/packages/avahi/COMPAT-LAYERS - /usr/share/doc/packages/avahi/DBUS-API - /usr/share/doc/packages/avahi/HACKING - /usr/share/doc/packages/avahi/INSTALL - /usr/share/doc/packages/avahi/LICENSE - /usr/share/doc/packages/avahi/MALLOC - /usr/share/doc/packages/avahi/NEWS - /usr/share/doc/packages/avahi/README - /usr/share/doc/packages/avahi/TODO - /usr/share/doc/packages/avahi/avahi-poll.dia - /usr/share/doc/packages/avahi/overview.dia - /usr/share/doc/packages/avahi/server-states.dia - /usr/share/man/man1/avahi-bookmarks.1.gz - /usr/share/man/man1/avahi-browse-domains.1.gz - /usr/share/man/man1/avahi-browse.1.gz - /usr/share/man/man1/avahi-discover.1.gz - /usr/share/man/man1/avahi-publish-address.1.gz - /usr/share/man/man1/avahi-publish-service.1.gz - /usr/share/man/man1/avahi-publish.1.gz - /usr/share/man/man1/avahi-resolve-address.1.gz - /usr/share/man/man1/avahi-resolve-host-name.1.gz - /usr/share/man/man1/avahi-resolve.1.gz - /usr/share/man/man5/avahi-daemon.conf.5.gz - /usr/share/man/man5/avahi.service.5.gz - /usr/share/man/man8/avahi-daemon.8.gz - /usr/share/man/man8/avahi-dnsconfd.8.gz - /usr/share/man/man8/avahi-dnsconfd.action.8.gz - - - - - - - - - - - /etc/apache2/conf.d - /usr/lib/nagios/cgi - /usr/share/nagios - /usr/share/nagios/contexthelp - /usr/share/nagios/docs - /usr/share/nagios/docs/images - /usr/share/nagios/images - /usr/share/nagios/images/logos - /usr/share/nagios/media - /usr/share/nagios/ssi - /usr/share/nagios/stylesheets - /etc/apache2/conf.d/nagios.conf - /usr/lib/nagios/cgi/avail.cgi - /usr/lib/nagios/cgi/cmd.cgi - /usr/lib/nagios/cgi/config.cgi - /usr/lib/nagios/cgi/convertcfg - /usr/lib/nagios/cgi/daemonchk.cgi - /usr/lib/nagios/cgi/extinfo.cgi - /usr/lib/nagios/cgi/histogram.cgi - /usr/lib/nagios/cgi/history.cgi - /usr/lib/nagios/cgi/mini_epn - /usr/lib/nagios/cgi/notifications.cgi - /usr/lib/nagios/cgi/outages.cgi - /usr/lib/nagios/cgi/sap_log.cgi - /usr/lib/nagios/cgi/sap_view_log.cgi - /usr/lib/nagios/cgi/showlog.cgi - /usr/lib/nagios/cgi/status.cgi - /usr/lib/nagios/cgi/statusmap.cgi - /usr/lib/nagios/cgi/statuswml.cgi - /usr/lib/nagios/cgi/statuswrl.cgi - /usr/lib/nagios/cgi/summary.cgi - /usr/lib/nagios/cgi/tac.cgi - /usr/lib/nagios/cgi/traceroute.cgi - /usr/lib/nagios/cgi/trends.cgi - /usr/share/nagios/contexthelp/A1.html - /usr/share/nagios/contexthelp/A2.html - /usr/share/nagios/contexthelp/A3.html - /usr/share/nagios/contexthelp/A4.html - /usr/share/nagios/contexthelp/A5.html - /usr/share/nagios/contexthelp/A6.html - /usr/share/nagios/contexthelp/A7.html - /usr/share/nagios/contexthelp/B1.html - /usr/share/nagios/contexthelp/C1.html - /usr/share/nagios/contexthelp/D1.html - /usr/share/nagios/contexthelp/E1.html - /usr/share/nagios/contexthelp/F1.html - /usr/share/nagios/contexthelp/G1.html - /usr/share/nagios/contexthelp/G2.html - /usr/share/nagios/contexthelp/G3.html - /usr/share/nagios/contexthelp/G4.html - /usr/share/nagios/contexthelp/G5.html - /usr/share/nagios/contexthelp/G6.html - /usr/share/nagios/contexthelp/H1.html - /usr/share/nagios/contexthelp/H2.html - /usr/share/nagios/contexthelp/H3.html - /usr/share/nagios/contexthelp/H4.html - /usr/share/nagios/contexthelp/H5.html - /usr/share/nagios/contexthelp/H6.html - /usr/share/nagios/contexthelp/H7.html - /usr/share/nagios/contexthelp/H8.html - /usr/share/nagios/contexthelp/I1.html - /usr/share/nagios/contexthelp/I2.html - /usr/share/nagios/contexthelp/I3.html - /usr/share/nagios/contexthelp/I4.html - /usr/share/nagios/contexthelp/I5.html - /usr/share/nagios/contexthelp/I6.html - /usr/share/nagios/contexthelp/I7.html - /usr/share/nagios/contexthelp/I8.html - /usr/share/nagios/contexthelp/J1.html - /usr/share/nagios/contexthelp/K1.html - /usr/share/nagios/contexthelp/L1.html - /usr/share/nagios/contexthelp/L10.html - /usr/share/nagios/contexthelp/L11.html - /usr/share/nagios/contexthelp/L12.html - /usr/share/nagios/contexthelp/L13.html - /usr/share/nagios/contexthelp/L2.html - /usr/share/nagios/contexthelp/L3.html - /usr/share/nagios/contexthelp/L4.html - /usr/share/nagios/contexthelp/L5.html - /usr/share/nagios/contexthelp/L6.html - /usr/share/nagios/contexthelp/L7.html - /usr/share/nagios/contexthelp/L8.html - /usr/share/nagios/contexthelp/L9.html - /usr/share/nagios/contexthelp/M1.html - /usr/share/nagios/contexthelp/M2.html - /usr/share/nagios/contexthelp/M3.html - /usr/share/nagios/contexthelp/M4.html - /usr/share/nagios/contexthelp/M5.html - /usr/share/nagios/contexthelp/M6.html - /usr/share/nagios/contexthelp/N1.html - /usr/share/nagios/contexthelp/N2.html - /usr/share/nagios/contexthelp/N3.html - /usr/share/nagios/contexthelp/N4.html - /usr/share/nagios/contexthelp/N5.html - /usr/share/nagios/contexthelp/N6.html - /usr/share/nagios/contexthelp/N7.html - /usr/share/nagios/docs/about.html - /usr/share/nagios/docs/addons.html - /usr/share/nagios/docs/beginners.html - /usr/share/nagios/docs/cgiauth.html - /usr/share/nagios/docs/cgiincludes.html - /usr/share/nagios/docs/cgis.html - /usr/share/nagios/docs/checkscheduling.html - /usr/share/nagios/docs/clusters.html - /usr/share/nagios/docs/commandfile.html - /usr/share/nagios/docs/config.html - /usr/share/nagios/docs/configcgi.html - /usr/share/nagios/docs/configextinfo.html - /usr/share/nagios/docs/configmain.html - /usr/share/nagios/docs/configobject.html - /usr/share/nagios/docs/dependencies.html - /usr/share/nagios/docs/distributed.html - /usr/share/nagios/docs/downtime.html - /usr/share/nagios/docs/embeddedperl.html - /usr/share/nagios/docs/escalations.html - /usr/share/nagios/docs/eventhandlers.html - /usr/share/nagios/docs/extcommands.html - /usr/share/nagios/docs/faqs.html - /usr/share/nagios/docs/flapping.html - /usr/share/nagios/docs/freshness.html - /usr/share/nagios/docs/funstuff.html - /usr/share/nagios/docs/images/activepassive.png - /usr/share/nagios/docs/images/cgi-avail-a.png - /usr/share/nagios/docs/images/cgi-avail-b.png - /usr/share/nagios/docs/images/cgi-cmd.png - /usr/share/nagios/docs/images/cgi-config.png - /usr/share/nagios/docs/images/cgi-extinfo-a.png - /usr/share/nagios/docs/images/cgi-extinfo-b.png - /usr/share/nagios/docs/images/cgi-extinfo-c.png - /usr/share/nagios/docs/images/cgi-extinfo-d.png - /usr/share/nagios/docs/images/cgi-histogram.png - /usr/share/nagios/docs/images/cgi-history.png - /usr/share/nagios/docs/images/cgi-notifications.png - /usr/share/nagios/docs/images/cgi-outages.png - /usr/share/nagios/docs/images/cgi-showlog.png - /usr/share/nagios/docs/images/cgi-status-a.png - /usr/share/nagios/docs/images/cgi-status-b.png - /usr/share/nagios/docs/images/cgi-status-c.png - /usr/share/nagios/docs/images/cgi-status-d.png - /usr/share/nagios/docs/images/cgi-statusmap.png - /usr/share/nagios/docs/images/cgi-statuswml.png - /usr/share/nagios/docs/images/cgi-statuswrl.png - /usr/share/nagios/docs/images/cgi-summary.png - /usr/share/nagios/docs/images/cgi-tac.png - /usr/share/nagios/docs/images/cgi-trends.png - /usr/share/nagios/docs/images/checktiming.png - /usr/share/nagios/docs/images/distributed.png - /usr/share/nagios/docs/images/host-dependencies.png - /usr/share/nagios/docs/images/indirecthostcheck.png - /usr/share/nagios/docs/images/indirectsvccheck.png - /usr/share/nagios/docs/images/indirectsvccheck2.png - /usr/share/nagios/docs/images/interleaved1.png - /usr/share/nagios/docs/images/interleaved2.png - /usr/share/nagios/docs/images/interleaved3.png - /usr/share/nagios/docs/images/logofullsize.png - /usr/share/nagios/docs/images/network-heirarchy.png - /usr/share/nagios/docs/images/network-outage1.png - /usr/share/nagios/docs/images/network-outage2.png - /usr/share/nagios/docs/images/noninterleaved1.png - /usr/share/nagios/docs/images/noninterleaved2.png - /usr/share/nagios/docs/images/physical-network.png - /usr/share/nagios/docs/images/plugintheory.png - /usr/share/nagios/docs/images/redudancy.png - /usr/share/nagios/docs/images/redundancy.png - /usr/share/nagios/docs/images/service-dependencies.png - /usr/share/nagios/docs/images/statetransitions.png - /usr/share/nagios/docs/images/statetransitions2.png - /usr/share/nagios/docs/index.html - /usr/share/nagios/docs/indirectchecks.html - /usr/share/nagios/docs/installing.html - /usr/share/nagios/docs/installweb.html - /usr/share/nagios/docs/int-portsentry.html - /usr/share/nagios/docs/int-snmptrap.html - /usr/share/nagios/docs/int-tcpwrappers.html - /usr/share/nagios/docs/macros.html - /usr/share/nagios/docs/networkoutages.html - /usr/share/nagios/docs/networkreachability.html - /usr/share/nagios/docs/notifications.html - /usr/share/nagios/docs/parallelization.html - /usr/share/nagios/docs/passivechecks.html - /usr/share/nagios/docs/perfdata.html - /usr/share/nagios/docs/plugins.html - /usr/share/nagios/docs/plugins_sap.html - /usr/share/nagios/docs/plugintheory.html - /usr/share/nagios/docs/redundancy.html - /usr/share/nagios/docs/robots.txt - /usr/share/nagios/docs/security.html - /usr/share/nagios/docs/stalking.html - /usr/share/nagios/docs/starting.html - /usr/share/nagios/docs/statetypes.html - /usr/share/nagios/docs/stoprestart.html - /usr/share/nagios/docs/templaterecursion.html - /usr/share/nagios/docs/templatetricks.html - /usr/share/nagios/docs/timeperiods.html - /usr/share/nagios/docs/toc.html - /usr/share/nagios/docs/tuning.html - /usr/share/nagios/docs/verifyconfig.html - /usr/share/nagios/docs/volatileservices.html - /usr/share/nagios/docs/whatsnew.html - /usr/share/nagios/docs/xdata-db.html - /usr/share/nagios/docs/xeddefault.html - /usr/share/nagios/docs/xedtemplate.html - /usr/share/nagios/docs/xoddefault.html - /usr/share/nagios/docs/xodtemplate.html - /usr/share/nagios/docs/xpddefault.html - /usr/share/nagios/docs/xpdfile.html - /usr/share/nagios/images/ack.gif - /usr/share/nagios/images/command.png - /usr/share/nagios/images/comment.gif - /usr/share/nagios/images/contexthelp1.gif - /usr/share/nagios/images/contexthelp2.gif - /usr/share/nagios/images/critical.png - /usr/share/nagios/images/delay.gif - /usr/share/nagios/images/delete.gif - /usr/share/nagios/images/disabled.gif - /usr/share/nagios/images/down.gif - /usr/share/nagios/images/downtime.gif - /usr/share/nagios/images/empty.gif - /usr/share/nagios/images/enabled.gif - /usr/share/nagios/images/extinfo.gif - /usr/share/nagios/images/flapping.gif - /usr/share/nagios/images/greendot.gif - /usr/share/nagios/images/histogram.png - /usr/share/nagios/images/history.gif - /usr/share/nagios/images/hostevent.gif - /usr/share/nagios/images/info.png - /usr/share/nagios/images/left.gif - /usr/share/nagios/images/logofullsize.jpg - /usr/share/nagios/images/logos/nagios.gd2 - /usr/share/nagios/images/logos/nagios.gif - /usr/share/nagios/images/logos/nagiosvrml.png - /usr/share/nagios/images/logos/unknown.gd2 - /usr/share/nagios/images/logos/unknown.gif - /usr/share/nagios/images/logrotate.png - /usr/share/nagios/images/ndisabled.gif - /usr/share/nagios/images/noack.gif - /usr/share/nagios/images/notes.gif - /usr/share/nagios/images/notify.gif - /usr/share/nagios/images/orangedot.gif - /usr/share/nagios/images/passiveonly.gif - /usr/share/nagios/images/recovery.png - /usr/share/nagios/images/redudancy.png - /usr/share/nagios/images/redundancy.png - /usr/share/nagios/images/restart.gif - /usr/share/nagios/images/right.gif - /usr/share/nagios/images/sbconfig.png - /usr/share/nagios/images/sbgeneral.png - /usr/share/nagios/images/sblogo.jpg - /usr/share/nagios/images/sbmonitor.png - /usr/share/nagios/images/sbreport.png - /usr/share/nagios/images/serviceevent.gif - /usr/share/nagios/images/start.gif - /usr/share/nagios/images/status.gif - /usr/share/nagios/images/status2.gif - /usr/share/nagios/images/status3.gif - /usr/share/nagios/images/status4.gif - /usr/share/nagios/images/stop.gif - /usr/share/nagios/images/tacdisabled.jpg - /usr/share/nagios/images/tacdisabled.png - /usr/share/nagios/images/tacenabled.jpg - /usr/share/nagios/images/tacenabled.png - /usr/share/nagios/images/thermcrit.png - /usr/share/nagios/images/thermok.png - /usr/share/nagios/images/thermwarn.png - /usr/share/nagios/images/trends.gif - /usr/share/nagios/images/trendshost.png - /usr/share/nagios/images/trendssvc.png - /usr/share/nagios/images/unknown.png - /usr/share/nagios/images/up.gif - /usr/share/nagios/images/warning.png - /usr/share/nagios/images/weblogo1.png - /usr/share/nagios/images/zoom1.gif - /usr/share/nagios/images/zoom2.gif - /usr/share/nagios/index.html - /usr/share/nagios/main.html - /usr/share/nagios/media/critical.wav - /usr/share/nagios/media/hostdown.wav - /usr/share/nagios/media/warning.wav - /usr/share/nagios/robots.txt - /usr/share/nagios/side.html - /usr/share/nagios/stylesheets/avail.css - /usr/share/nagios/stylesheets/checksanity.css - /usr/share/nagios/stylesheets/cmd.css - /usr/share/nagios/stylesheets/config.css - /usr/share/nagios/stylesheets/extinfo.css - /usr/share/nagios/stylesheets/histogram.css - /usr/share/nagios/stylesheets/history.css - /usr/share/nagios/stylesheets/ministatus.css - /usr/share/nagios/stylesheets/notifications.css - /usr/share/nagios/stylesheets/outages.css - /usr/share/nagios/stylesheets/showlog.css - /usr/share/nagios/stylesheets/status.css - /usr/share/nagios/stylesheets/statusmap.css - /usr/share/nagios/stylesheets/summary.css - /usr/share/nagios/stylesheets/tac.css - /usr/share/nagios/stylesheets/trends.css - - - - - - - - - - - content_length.patch - logrotate - nagios-1.3.tar.bz2 - nagios-httpd.conf - nagios-perl58.dif - nagios.spec - rcnagios - sapmoni.dif - size.patch - - - - - - - - - - - /etc/apache2/conf.d - /usr/lib/nagios/cgi - /usr/share/nagios - /usr/share/nagios/contexthelp - /usr/share/nagios/docs - /usr/share/nagios/docs/images - /usr/share/nagios/images - /usr/share/nagios/images/logos - /usr/share/nagios/media - /usr/share/nagios/ssi - /usr/share/nagios/stylesheets - /etc/apache2/conf.d/nagios.conf - /usr/lib/nagios/cgi/avail.cgi - /usr/lib/nagios/cgi/cmd.cgi - /usr/lib/nagios/cgi/config.cgi - /usr/lib/nagios/cgi/convertcfg - /usr/lib/nagios/cgi/daemonchk.cgi - /usr/lib/nagios/cgi/extinfo.cgi - /usr/lib/nagios/cgi/histogram.cgi - /usr/lib/nagios/cgi/history.cgi - /usr/lib/nagios/cgi/mini_epn - /usr/lib/nagios/cgi/notifications.cgi - /usr/lib/nagios/cgi/outages.cgi - /usr/lib/nagios/cgi/sap_log.cgi - /usr/lib/nagios/cgi/sap_view_log.cgi - /usr/lib/nagios/cgi/showlog.cgi - /usr/lib/nagios/cgi/status.cgi - /usr/lib/nagios/cgi/statusmap.cgi - /usr/lib/nagios/cgi/statuswml.cgi - /usr/lib/nagios/cgi/statuswrl.cgi - /usr/lib/nagios/cgi/summary.cgi - /usr/lib/nagios/cgi/tac.cgi - /usr/lib/nagios/cgi/traceroute.cgi - /usr/lib/nagios/cgi/trends.cgi - /usr/share/nagios/contexthelp/A1.html - /usr/share/nagios/contexthelp/A2.html - /usr/share/nagios/contexthelp/A3.html - /usr/share/nagios/contexthelp/A4.html - /usr/share/nagios/contexthelp/A5.html - /usr/share/nagios/contexthelp/A6.html - /usr/share/nagios/contexthelp/A7.html - /usr/share/nagios/contexthelp/B1.html - /usr/share/nagios/contexthelp/C1.html - /usr/share/nagios/contexthelp/D1.html - /usr/share/nagios/contexthelp/E1.html - /usr/share/nagios/contexthelp/F1.html - /usr/share/nagios/contexthelp/G1.html - /usr/share/nagios/contexthelp/G2.html - /usr/share/nagios/contexthelp/G3.html - /usr/share/nagios/contexthelp/G4.html - /usr/share/nagios/contexthelp/G5.html - /usr/share/nagios/contexthelp/G6.html - /usr/share/nagios/contexthelp/H1.html - /usr/share/nagios/contexthelp/H2.html - /usr/share/nagios/contexthelp/H3.html - /usr/share/nagios/contexthelp/H4.html - /usr/share/nagios/contexthelp/H5.html - /usr/share/nagios/contexthelp/H6.html - /usr/share/nagios/contexthelp/H7.html - /usr/share/nagios/contexthelp/H8.html - /usr/share/nagios/contexthelp/I1.html - /usr/share/nagios/contexthelp/I2.html - /usr/share/nagios/contexthelp/I3.html - /usr/share/nagios/contexthelp/I4.html - /usr/share/nagios/contexthelp/I5.html - /usr/share/nagios/contexthelp/I6.html - /usr/share/nagios/contexthelp/I7.html - /usr/share/nagios/contexthelp/I8.html - /usr/share/nagios/contexthelp/J1.html - /usr/share/nagios/contexthelp/K1.html - /usr/share/nagios/contexthelp/L1.html - /usr/share/nagios/contexthelp/L10.html - /usr/share/nagios/contexthelp/L11.html - /usr/share/nagios/contexthelp/L12.html - /usr/share/nagios/contexthelp/L13.html - /usr/share/nagios/contexthelp/L2.html - /usr/share/nagios/contexthelp/L3.html - /usr/share/nagios/contexthelp/L4.html - /usr/share/nagios/contexthelp/L5.html - /usr/share/nagios/contexthelp/L6.html - /usr/share/nagios/contexthelp/L7.html - /usr/share/nagios/contexthelp/L8.html - /usr/share/nagios/contexthelp/L9.html - /usr/share/nagios/contexthelp/M1.html - /usr/share/nagios/contexthelp/M2.html - /usr/share/nagios/contexthelp/M3.html - /usr/share/nagios/contexthelp/M4.html - /usr/share/nagios/contexthelp/M5.html - /usr/share/nagios/contexthelp/M6.html - /usr/share/nagios/contexthelp/N1.html - /usr/share/nagios/contexthelp/N2.html - /usr/share/nagios/contexthelp/N3.html - /usr/share/nagios/contexthelp/N4.html - /usr/share/nagios/contexthelp/N5.html - /usr/share/nagios/contexthelp/N6.html - /usr/share/nagios/contexthelp/N7.html - /usr/share/nagios/docs/about.html - /usr/share/nagios/docs/addons.html - /usr/share/nagios/docs/beginners.html - /usr/share/nagios/docs/cgiauth.html - /usr/share/nagios/docs/cgiincludes.html - /usr/share/nagios/docs/cgis.html - /usr/share/nagios/docs/checkscheduling.html - /usr/share/nagios/docs/clusters.html - /usr/share/nagios/docs/commandfile.html - /usr/share/nagios/docs/config.html - /usr/share/nagios/docs/configcgi.html - /usr/share/nagios/docs/configextinfo.html - /usr/share/nagios/docs/configmain.html - /usr/share/nagios/docs/configobject.html - /usr/share/nagios/docs/dependencies.html - /usr/share/nagios/docs/distributed.html - /usr/share/nagios/docs/downtime.html - /usr/share/nagios/docs/embeddedperl.html - /usr/share/nagios/docs/escalations.html - /usr/share/nagios/docs/eventhandlers.html - /usr/share/nagios/docs/extcommands.html - /usr/share/nagios/docs/faqs.html - /usr/share/nagios/docs/flapping.html - /usr/share/nagios/docs/freshness.html - /usr/share/nagios/docs/funstuff.html - /usr/share/nagios/docs/images/activepassive.png - /usr/share/nagios/docs/images/cgi-avail-a.png - /usr/share/nagios/docs/images/cgi-avail-b.png - /usr/share/nagios/docs/images/cgi-cmd.png - /usr/share/nagios/docs/images/cgi-config.png - /usr/share/nagios/docs/images/cgi-extinfo-a.png - /usr/share/nagios/docs/images/cgi-extinfo-b.png - /usr/share/nagios/docs/images/cgi-extinfo-c.png - /usr/share/nagios/docs/images/cgi-extinfo-d.png - /usr/share/nagios/docs/images/cgi-histogram.png - /usr/share/nagios/docs/images/cgi-history.png - /usr/share/nagios/docs/images/cgi-notifications.png - /usr/share/nagios/docs/images/cgi-outages.png - /usr/share/nagios/docs/images/cgi-showlog.png - /usr/share/nagios/docs/images/cgi-status-a.png - /usr/share/nagios/docs/images/cgi-status-b.png - /usr/share/nagios/docs/images/cgi-status-c.png - /usr/share/nagios/docs/images/cgi-status-d.png - /usr/share/nagios/docs/images/cgi-statusmap.png - /usr/share/nagios/docs/images/cgi-statuswml.png - /usr/share/nagios/docs/images/cgi-statuswrl.png - /usr/share/nagios/docs/images/cgi-summary.png - /usr/share/nagios/docs/images/cgi-tac.png - /usr/share/nagios/docs/images/cgi-trends.png - /usr/share/nagios/docs/images/checktiming.png - /usr/share/nagios/docs/images/distributed.png - /usr/share/nagios/docs/images/host-dependencies.png - /usr/share/nagios/docs/images/indirecthostcheck.png - /usr/share/nagios/docs/images/indirectsvccheck.png - /usr/share/nagios/docs/images/indirectsvccheck2.png - /usr/share/nagios/docs/images/interleaved1.png - /usr/share/nagios/docs/images/interleaved2.png - /usr/share/nagios/docs/images/interleaved3.png - /usr/share/nagios/docs/images/logofullsize.png - /usr/share/nagios/docs/images/network-heirarchy.png - /usr/share/nagios/docs/images/network-outage1.png - /usr/share/nagios/docs/images/network-outage2.png - /usr/share/nagios/docs/images/noninterleaved1.png - /usr/share/nagios/docs/images/noninterleaved2.png - /usr/share/nagios/docs/images/physical-network.png - /usr/share/nagios/docs/images/plugintheory.png - /usr/share/nagios/docs/images/redudancy.png - /usr/share/nagios/docs/images/redundancy.png - /usr/share/nagios/docs/images/service-dependencies.png - /usr/share/nagios/docs/images/statetransitions.png - /usr/share/nagios/docs/images/statetransitions2.png - /usr/share/nagios/docs/index.html - /usr/share/nagios/docs/indirectchecks.html - /usr/share/nagios/docs/installing.html - /usr/share/nagios/docs/installweb.html - /usr/share/nagios/docs/int-portsentry.html - /usr/share/nagios/docs/int-snmptrap.html - /usr/share/nagios/docs/int-tcpwrappers.html - /usr/share/nagios/docs/macros.html - /usr/share/nagios/docs/networkoutages.html - /usr/share/nagios/docs/networkreachability.html - /usr/share/nagios/docs/notifications.html - /usr/share/nagios/docs/parallelization.html - /usr/share/nagios/docs/passivechecks.html - /usr/share/nagios/docs/perfdata.html - /usr/share/nagios/docs/plugins.html - /usr/share/nagios/docs/plugins_sap.html - /usr/share/nagios/docs/plugintheory.html - /usr/share/nagios/docs/redundancy.html - /usr/share/nagios/docs/robots.txt - /usr/share/nagios/docs/security.html - /usr/share/nagios/docs/stalking.html - /usr/share/nagios/docs/starting.html - /usr/share/nagios/docs/statetypes.html - /usr/share/nagios/docs/stoprestart.html - /usr/share/nagios/docs/templaterecursion.html - /usr/share/nagios/docs/templatetricks.html - /usr/share/nagios/docs/timeperiods.html - /usr/share/nagios/docs/toc.html - /usr/share/nagios/docs/tuning.html - /usr/share/nagios/docs/verifyconfig.html - /usr/share/nagios/docs/volatileservices.html - /usr/share/nagios/docs/whatsnew.html - /usr/share/nagios/docs/xdata-db.html - /usr/share/nagios/docs/xeddefault.html - /usr/share/nagios/docs/xedtemplate.html - /usr/share/nagios/docs/xoddefault.html - /usr/share/nagios/docs/xodtemplate.html - /usr/share/nagios/docs/xpddefault.html - /usr/share/nagios/docs/xpdfile.html - /usr/share/nagios/images/ack.gif - /usr/share/nagios/images/command.png - /usr/share/nagios/images/comment.gif - /usr/share/nagios/images/contexthelp1.gif - /usr/share/nagios/images/contexthelp2.gif - /usr/share/nagios/images/critical.png - /usr/share/nagios/images/delay.gif - /usr/share/nagios/images/delete.gif - /usr/share/nagios/images/disabled.gif - /usr/share/nagios/images/down.gif - /usr/share/nagios/images/downtime.gif - /usr/share/nagios/images/empty.gif - /usr/share/nagios/images/enabled.gif - /usr/share/nagios/images/extinfo.gif - /usr/share/nagios/images/flapping.gif - /usr/share/nagios/images/greendot.gif - /usr/share/nagios/images/histogram.png - /usr/share/nagios/images/history.gif - /usr/share/nagios/images/hostevent.gif - /usr/share/nagios/images/info.png - /usr/share/nagios/images/left.gif - /usr/share/nagios/images/logofullsize.jpg - /usr/share/nagios/images/logos/nagios.gd2 - /usr/share/nagios/images/logos/nagios.gif - /usr/share/nagios/images/logos/nagiosvrml.png - /usr/share/nagios/images/logos/unknown.gd2 - /usr/share/nagios/images/logos/unknown.gif - /usr/share/nagios/images/logrotate.png - /usr/share/nagios/images/ndisabled.gif - /usr/share/nagios/images/noack.gif - /usr/share/nagios/images/notes.gif - /usr/share/nagios/images/notify.gif - /usr/share/nagios/images/orangedot.gif - /usr/share/nagios/images/passiveonly.gif - /usr/share/nagios/images/recovery.png - /usr/share/nagios/images/redudancy.png - /usr/share/nagios/images/redundancy.png - /usr/share/nagios/images/restart.gif - /usr/share/nagios/images/right.gif - /usr/share/nagios/images/sbconfig.png - /usr/share/nagios/images/sbgeneral.png - /usr/share/nagios/images/sblogo.jpg - /usr/share/nagios/images/sbmonitor.png - /usr/share/nagios/images/sbreport.png - /usr/share/nagios/images/serviceevent.gif - /usr/share/nagios/images/start.gif - /usr/share/nagios/images/status.gif - /usr/share/nagios/images/status2.gif - /usr/share/nagios/images/status3.gif - /usr/share/nagios/images/status4.gif - /usr/share/nagios/images/stop.gif - /usr/share/nagios/images/tacdisabled.jpg - /usr/share/nagios/images/tacdisabled.png - /usr/share/nagios/images/tacenabled.jpg - /usr/share/nagios/images/tacenabled.png - /usr/share/nagios/images/thermcrit.png - /usr/share/nagios/images/thermok.png - /usr/share/nagios/images/thermwarn.png - /usr/share/nagios/images/trends.gif - /usr/share/nagios/images/trendshost.png - /usr/share/nagios/images/trendssvc.png - /usr/share/nagios/images/unknown.png - /usr/share/nagios/images/up.gif - /usr/share/nagios/images/warning.png - /usr/share/nagios/images/weblogo1.png - /usr/share/nagios/images/zoom1.gif - /usr/share/nagios/images/zoom2.gif - /usr/share/nagios/index.html - /usr/share/nagios/main.html - /usr/share/nagios/media/critical.wav - /usr/share/nagios/media/hostdown.wav - /usr/share/nagios/media/warning.wav - /usr/share/nagios/robots.txt - /usr/share/nagios/side.html - /usr/share/nagios/stylesheets/avail.css - /usr/share/nagios/stylesheets/checksanity.css - /usr/share/nagios/stylesheets/cmd.css - /usr/share/nagios/stylesheets/config.css - /usr/share/nagios/stylesheets/extinfo.css - /usr/share/nagios/stylesheets/histogram.css - /usr/share/nagios/stylesheets/history.css - /usr/share/nagios/stylesheets/ministatus.css - /usr/share/nagios/stylesheets/notifications.css - /usr/share/nagios/stylesheets/outages.css - /usr/share/nagios/stylesheets/showlog.css - /usr/share/nagios/stylesheets/status.css - /usr/share/nagios/stylesheets/statusmap.css - /usr/share/nagios/stylesheets/summary.css - /usr/share/nagios/stylesheets/tac.css - /usr/share/nagios/stylesheets/trends.css - - - - - - - - - - /usr/share/doc/packages/dhcdbd - /var/lib/named - /etc/dbus-1/system.d/dhcdbd.conf - /usr/sbin/dhcdbd - /usr/share/doc/packages/dhcdbd/LICENSE - /usr/share/doc/packages/dhcdbd/README - /usr/share/doc/packages/dhcdbd/dbus_service.h - /usr/share/doc/packages/dhcdbd/dhcdbd.h - /usr/share/doc/packages/dhcdbd/dhcp_options.h - - - - - - - - - - /usr/share/doc/packages/dhcdbd - /var/lib/named - /etc/dbus-1/system.d/dhcdbd.conf - /usr/sbin/dhcdbd - /usr/share/doc/packages/dhcdbd/LICENSE - /usr/share/doc/packages/dhcdbd/README - /usr/share/doc/packages/dhcdbd/dbus_service.h - /usr/share/doc/packages/dhcdbd/dhcdbd.h - /usr/share/doc/packages/dhcdbd/dhcp_options.h - - - - - - - - - - dhcdbd-1.12.tar.gz - dhcdbd-1.14-bug-fixes.patch - dhcdbd-dbus-reconnect-thoenig-02.patch - dhcdbd-lease-dir-rml-1.10-1.patch - dhcdbd-less-verbose-logging-rml.patch - dhcdbd-no-nr_open-rml.patch - dhcdbd-remove-named-user-rml.patch - dhcdbd-set-hostname.patch - dhcdbd.spec - - - - - - - - - - /usr/share/doc/packages/dhcdbd - /var/lib/named - /etc/dbus-1/system.d/dhcdbd.conf - /usr/sbin/dhcdbd - /usr/share/doc/packages/dhcdbd/LICENSE - /usr/share/doc/packages/dhcdbd/README - /usr/share/doc/packages/dhcdbd/dbus_service.h - /usr/share/doc/packages/dhcdbd/dhcdbd.h - /usr/share/doc/packages/dhcdbd/dhcp_options.h - - - - - - - - - /etc/openldap - /etc/openldap/schema - /usr/lib/openldap - /usr/lib/openldap/modules - /usr/share/doc/packages/openldap2 - /usr/share/doc/packages/openldap2/admin-guide - /usr/share/doc/packages/openldap2/drafts - /usr/share/doc/packages/openldap2/install - /usr/share/openldap - /usr/share/openldap/ucdata - /var/lib/ldap - /var/lib/slurpd - /var/run/slapd - /etc/init.d/ldap - /etc/init.d/slurpd - /etc/openldap/schema/README - /etc/openldap/schema/corba.schema - /etc/openldap/schema/core.ldif - /etc/openldap/schema/core.schema - /etc/openldap/schema/cosine.schema - /etc/openldap/schema/dyngroup.schema - /etc/openldap/schema/inetorgperson.schema - /etc/openldap/schema/java.schema - /etc/openldap/schema/misc.schema - /etc/openldap/schema/nis.schema - /etc/openldap/schema/openldap.ldif - /etc/openldap/schema/openldap.schema - /etc/openldap/schema/ppolicy.schema - /etc/openldap/schema/rfc2307bis.schema - /etc/openldap/schema/yast.schema - /etc/openldap/slapd.conf - /etc/openldap/slapd.conf.default - /usr/lib/openldap/slapd - /usr/lib/openldap/slurpd - /usr/lib/sasl2/slapd.conf - /usr/sbin/openldap-2.2-slapcat - /usr/sbin/rcldap - /usr/sbin/rcslurpd - /usr/sbin/slapacl - /usr/sbin/slapadd - /usr/sbin/slapauth - /usr/sbin/slapcat - /usr/sbin/slapdn - /usr/sbin/slapindex - /usr/sbin/slappasswd - /usr/sbin/slaptest - /usr/share/doc/packages/openldap2/ANNOUNCEMENT - /usr/share/doc/packages/openldap2/COPYRIGHT - /usr/share/doc/packages/openldap2/INSTALL - /usr/share/doc/packages/openldap2/LICENSE - /usr/share/doc/packages/openldap2/README - /usr/share/doc/packages/openldap2/README.update - /usr/share/doc/packages/openldap2/admin-guide/autoconf.html - /usr/share/doc/packages/openldap2/admin-guide/config.html - /usr/share/doc/packages/openldap2/admin-guide/config_dit.gif - /usr/share/doc/packages/openldap2/admin-guide/config_local.gif - /usr/share/doc/packages/openldap2/admin-guide/config_ref.gif - /usr/share/doc/packages/openldap2/admin-guide/config_repl.gif - /usr/share/doc/packages/openldap2/admin-guide/copyright.html - /usr/share/doc/packages/openldap2/admin-guide/dbtools.html - /usr/share/doc/packages/openldap2/admin-guide/index.html - /usr/share/doc/packages/openldap2/admin-guide/install.html - /usr/share/doc/packages/openldap2/admin-guide/intro.html - /usr/share/doc/packages/openldap2/admin-guide/intro_dctree.gif - /usr/share/doc/packages/openldap2/admin-guide/intro_tree.gif - /usr/share/doc/packages/openldap2/admin-guide/license.html - /usr/share/doc/packages/openldap2/admin-guide/preface.html - /usr/share/doc/packages/openldap2/admin-guide/proxycache.html - /usr/share/doc/packages/openldap2/admin-guide/quickstart.html - /usr/share/doc/packages/openldap2/admin-guide/referrals.html - /usr/share/doc/packages/openldap2/admin-guide/replication.html - /usr/share/doc/packages/openldap2/admin-guide/runningslapd.html - /usr/share/doc/packages/openldap2/admin-guide/sasl.html - /usr/share/doc/packages/openldap2/admin-guide/schema.html - /usr/share/doc/packages/openldap2/admin-guide/security.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconf2.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconfig.html - /usr/share/doc/packages/openldap2/admin-guide/syncrepl.html - /usr/share/doc/packages/openldap2/admin-guide/tls.html - /usr/share/doc/packages/openldap2/drafts/README - /usr/share/doc/packages/openldap2/drafts/draft-behera-ldap-password-policy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-chu-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-authmeth-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-bcp64-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-dn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-filter-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-models-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-protocol-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-roadmap-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-strprep-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-syntaxes-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-url-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-user-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-acl-model-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-dupent-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-vlv-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-locate-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-joslin-config-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-lachman-laser-ldap-mail-routing-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-bac-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-binary-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-transfer-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-chaining-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-distproc-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-subordinate-scope-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-weltman-ldapv3-proxy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-adlist-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-assert-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-authzid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-cosine-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-dontusecopy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-incr.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-noop-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-readentry-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-t-f-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-turn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-uuid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-x509-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldup-sync-xx.txt - /usr/share/doc/packages/openldap2/install/configure - /usr/share/man/man5/slapd-bdb.5.gz - /usr/share/man/man5/slapd-hdb.5.gz - /usr/share/man/man5/slapd-ldap.5.gz - /usr/share/man/man5/slapd-ldbm.5.gz - /usr/share/man/man5/slapd-ldif.5.gz - /usr/share/man/man5/slapd-monitor.5.gz - /usr/share/man/man5/slapd-relay.5.gz - /usr/share/man/man5/slapd.access.5.gz - /usr/share/man/man5/slapd.conf.5.gz - /usr/share/man/man5/slapd.plugin.5.gz - /usr/share/man/man5/slapd.replog.5.gz - /usr/share/man/man5/slapo-accesslog.5.gz - /usr/share/man/man5/slapo-auditlog.5.gz - /usr/share/man/man5/slapo-chain.5.gz - /usr/share/man/man5/slapo-dynlist.5.gz - /usr/share/man/man5/slapo-lastmod.5.gz - /usr/share/man/man5/slapo-pcache.5.gz - /usr/share/man/man5/slapo-ppolicy.5.gz - /usr/share/man/man5/slapo-refint.5.gz - /usr/share/man/man5/slapo-retcode.5.gz - /usr/share/man/man5/slapo-rwm.5.gz - /usr/share/man/man5/slapo-syncprov.5.gz - /usr/share/man/man5/slapo-translucent.5.gz - /usr/share/man/man5/slapo-unique.5.gz - /usr/share/man/man5/slapo-valsort.5.gz - /usr/share/man/man8/slapacl.8.gz - /usr/share/man/man8/slapadd.8.gz - /usr/share/man/man8/slapauth.8.gz - /usr/share/man/man8/slapcat.8.gz - /usr/share/man/man8/slapd.8.gz - /usr/share/man/man8/slapdn.8.gz - /usr/share/man/man8/slapindex.8.gz - /usr/share/man/man8/slappasswd.8.gz - /usr/share/man/man8/slaptest.8.gz - /usr/share/man/man8/slurpd.8.gz - /usr/share/openldap/ucdata/case.dat - /usr/share/openldap/ucdata/cmbcl.dat - /usr/share/openldap/ucdata/comp.dat - /usr/share/openldap/ucdata/ctype.dat - /usr/share/openldap/ucdata/decomp.dat - /usr/share/openldap/ucdata/kdecomp.dat - /usr/share/openldap/ucdata/num.dat - /usr/share/update-messages/en/openldap2.1 - /var/adm/fillup-templates/sysconfig.openldap - /var/lib/ldap/DB_CONFIG - /var/lib/ldap/DB_CONFIG.example - - - - - - - - - /etc/openldap - /etc/openldap/schema - /usr/lib/openldap - /usr/lib/openldap/modules - /usr/share/doc/packages/openldap2 - /usr/share/doc/packages/openldap2/admin-guide - /usr/share/doc/packages/openldap2/drafts - /usr/share/doc/packages/openldap2/install - /usr/share/openldap - /usr/share/openldap/ucdata - /var/lib/ldap - /var/lib/slurpd - /var/run/slapd - /etc/init.d/ldap - /etc/init.d/slurpd - /etc/openldap/schema/README - /etc/openldap/schema/corba.schema - /etc/openldap/schema/core.ldif - /etc/openldap/schema/core.schema - /etc/openldap/schema/cosine.schema - /etc/openldap/schema/dyngroup.schema - /etc/openldap/schema/inetorgperson.schema - /etc/openldap/schema/java.schema - /etc/openldap/schema/misc.schema - /etc/openldap/schema/nis.schema - /etc/openldap/schema/openldap.ldif - /etc/openldap/schema/openldap.schema - /etc/openldap/schema/ppolicy.schema - /etc/openldap/schema/rfc2307bis.schema - /etc/openldap/schema/yast.schema - /etc/openldap/slapd.conf - /etc/openldap/slapd.conf.default - /usr/lib/openldap/slapd - /usr/lib/openldap/slurpd - /usr/lib/sasl2/slapd.conf - /usr/sbin/openldap-2.2-slapcat - /usr/sbin/rcldap - /usr/sbin/rcslurpd - /usr/sbin/slapacl - /usr/sbin/slapadd - /usr/sbin/slapauth - /usr/sbin/slapcat - /usr/sbin/slapdn - /usr/sbin/slapindex - /usr/sbin/slappasswd - /usr/sbin/slaptest - /usr/share/doc/packages/openldap2/ANNOUNCEMENT - /usr/share/doc/packages/openldap2/COPYRIGHT - /usr/share/doc/packages/openldap2/INSTALL - /usr/share/doc/packages/openldap2/LICENSE - /usr/share/doc/packages/openldap2/README - /usr/share/doc/packages/openldap2/README.update - /usr/share/doc/packages/openldap2/admin-guide/autoconf.html - /usr/share/doc/packages/openldap2/admin-guide/config.html - /usr/share/doc/packages/openldap2/admin-guide/config_dit.gif - /usr/share/doc/packages/openldap2/admin-guide/config_local.gif - /usr/share/doc/packages/openldap2/admin-guide/config_ref.gif - /usr/share/doc/packages/openldap2/admin-guide/config_repl.gif - /usr/share/doc/packages/openldap2/admin-guide/copyright.html - /usr/share/doc/packages/openldap2/admin-guide/dbtools.html - /usr/share/doc/packages/openldap2/admin-guide/index.html - /usr/share/doc/packages/openldap2/admin-guide/install.html - /usr/share/doc/packages/openldap2/admin-guide/intro.html - /usr/share/doc/packages/openldap2/admin-guide/intro_dctree.gif - /usr/share/doc/packages/openldap2/admin-guide/intro_tree.gif - /usr/share/doc/packages/openldap2/admin-guide/license.html - /usr/share/doc/packages/openldap2/admin-guide/preface.html - /usr/share/doc/packages/openldap2/admin-guide/proxycache.html - /usr/share/doc/packages/openldap2/admin-guide/quickstart.html - /usr/share/doc/packages/openldap2/admin-guide/referrals.html - /usr/share/doc/packages/openldap2/admin-guide/replication.html - /usr/share/doc/packages/openldap2/admin-guide/runningslapd.html - /usr/share/doc/packages/openldap2/admin-guide/sasl.html - /usr/share/doc/packages/openldap2/admin-guide/schema.html - /usr/share/doc/packages/openldap2/admin-guide/security.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconf2.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconfig.html - /usr/share/doc/packages/openldap2/admin-guide/syncrepl.html - /usr/share/doc/packages/openldap2/admin-guide/tls.html - /usr/share/doc/packages/openldap2/drafts/README - /usr/share/doc/packages/openldap2/drafts/draft-behera-ldap-password-policy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-chu-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-authmeth-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-bcp64-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-dn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-filter-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-models-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-protocol-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-roadmap-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-strprep-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-syntaxes-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-url-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-user-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-acl-model-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-dupent-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-vlv-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-locate-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-joslin-config-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-lachman-laser-ldap-mail-routing-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-bac-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-binary-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-transfer-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-chaining-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-distproc-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-subordinate-scope-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-weltman-ldapv3-proxy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-adlist-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-assert-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-authzid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-cosine-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-dontusecopy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-incr.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-noop-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-readentry-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-t-f-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-turn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-uuid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-x509-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldup-sync-xx.txt - /usr/share/doc/packages/openldap2/install/configure - /usr/share/man/man5/slapd-bdb.5.gz - /usr/share/man/man5/slapd-hdb.5.gz - /usr/share/man/man5/slapd-ldap.5.gz - /usr/share/man/man5/slapd-ldbm.5.gz - /usr/share/man/man5/slapd-ldif.5.gz - /usr/share/man/man5/slapd-monitor.5.gz - /usr/share/man/man5/slapd-relay.5.gz - /usr/share/man/man5/slapd.access.5.gz - /usr/share/man/man5/slapd.conf.5.gz - /usr/share/man/man5/slapd.plugin.5.gz - /usr/share/man/man5/slapd.replog.5.gz - /usr/share/man/man5/slapo-accesslog.5.gz - /usr/share/man/man5/slapo-auditlog.5.gz - /usr/share/man/man5/slapo-chain.5.gz - /usr/share/man/man5/slapo-dynlist.5.gz - /usr/share/man/man5/slapo-lastmod.5.gz - /usr/share/man/man5/slapo-pcache.5.gz - /usr/share/man/man5/slapo-ppolicy.5.gz - /usr/share/man/man5/slapo-refint.5.gz - /usr/share/man/man5/slapo-retcode.5.gz - /usr/share/man/man5/slapo-rwm.5.gz - /usr/share/man/man5/slapo-syncprov.5.gz - /usr/share/man/man5/slapo-translucent.5.gz - /usr/share/man/man5/slapo-unique.5.gz - /usr/share/man/man5/slapo-valsort.5.gz - /usr/share/man/man8/slapacl.8.gz - /usr/share/man/man8/slapadd.8.gz - /usr/share/man/man8/slapauth.8.gz - /usr/share/man/man8/slapcat.8.gz - /usr/share/man/man8/slapd.8.gz - /usr/share/man/man8/slapdn.8.gz - /usr/share/man/man8/slapindex.8.gz - /usr/share/man/man8/slappasswd.8.gz - /usr/share/man/man8/slaptest.8.gz - /usr/share/man/man8/slurpd.8.gz - /usr/share/openldap/ucdata/case.dat - /usr/share/openldap/ucdata/cmbcl.dat - /usr/share/openldap/ucdata/comp.dat - /usr/share/openldap/ucdata/ctype.dat - /usr/share/openldap/ucdata/decomp.dat - /usr/share/openldap/ucdata/kdecomp.dat - /usr/share/openldap/ucdata/num.dat - /usr/share/update-messages/en/openldap2.1 - /var/adm/fillup-templates/sysconfig.openldap - /var/lib/ldap/DB_CONFIG - /var/lib/ldap/DB_CONFIG.example - - - - - - - - - DB_CONFIG - README.update - addonschema.tar.gz - bconfig-errlog.dif - ldap_conf.dif - ldapi_url.dif - libldap-gethostbyname_r.dif - libldap-manpages.dif - libldap-referral.dif - libldap_ads-sasl-gssapi.dif - openldap-2.2.24.dif - openldap-2.2.24.tar.bz2 - openldap-2.3.19.dif - openldap-2.3.19.tar.bz2 - openldap-admin-guide.tar.bz2 - openldap-ntlm.diff - openldap-rc.tgz - openldap2.spec - pie-compile.dif - sasl-slapd.conf - secpatch.dif - slapd-epollerr.dif - slapd-readcontrols.dif - slapd_conf.dif - - - - - - - - - /etc/openldap - /etc/openldap/schema - /usr/lib/openldap - /usr/lib/openldap/modules - /usr/share/doc/packages/openldap2 - /usr/share/doc/packages/openldap2/admin-guide - /usr/share/doc/packages/openldap2/drafts - /usr/share/doc/packages/openldap2/install - /usr/share/openldap - /usr/share/openldap/ucdata - /var/lib/ldap - /var/lib/slurpd - /var/run/slapd - /etc/init.d/ldap - /etc/init.d/slurpd - /etc/openldap/schema/README - /etc/openldap/schema/corba.schema - /etc/openldap/schema/core.ldif - /etc/openldap/schema/core.schema - /etc/openldap/schema/cosine.schema - /etc/openldap/schema/dyngroup.schema - /etc/openldap/schema/inetorgperson.schema - /etc/openldap/schema/java.schema - /etc/openldap/schema/misc.schema - /etc/openldap/schema/nis.schema - /etc/openldap/schema/openldap.ldif - /etc/openldap/schema/openldap.schema - /etc/openldap/schema/ppolicy.schema - /etc/openldap/schema/rfc2307bis.schema - /etc/openldap/schema/yast.schema - /etc/openldap/slapd.conf - /etc/openldap/slapd.conf.default - /usr/lib/openldap/slapd - /usr/lib/openldap/slurpd - /usr/lib64/sasl2/slapd.conf - /usr/sbin/openldap-2.2-slapcat - /usr/sbin/rcldap - /usr/sbin/rcslurpd - /usr/sbin/slapacl - /usr/sbin/slapadd - /usr/sbin/slapauth - /usr/sbin/slapcat - /usr/sbin/slapdn - /usr/sbin/slapindex - /usr/sbin/slappasswd - /usr/sbin/slaptest - /usr/share/doc/packages/openldap2/ANNOUNCEMENT - /usr/share/doc/packages/openldap2/COPYRIGHT - /usr/share/doc/packages/openldap2/INSTALL - /usr/share/doc/packages/openldap2/LICENSE - /usr/share/doc/packages/openldap2/README - /usr/share/doc/packages/openldap2/README.update - /usr/share/doc/packages/openldap2/admin-guide/autoconf.html - /usr/share/doc/packages/openldap2/admin-guide/config.html - /usr/share/doc/packages/openldap2/admin-guide/config_dit.gif - /usr/share/doc/packages/openldap2/admin-guide/config_local.gif - /usr/share/doc/packages/openldap2/admin-guide/config_ref.gif - /usr/share/doc/packages/openldap2/admin-guide/config_repl.gif - /usr/share/doc/packages/openldap2/admin-guide/copyright.html - /usr/share/doc/packages/openldap2/admin-guide/dbtools.html - /usr/share/doc/packages/openldap2/admin-guide/index.html - /usr/share/doc/packages/openldap2/admin-guide/install.html - /usr/share/doc/packages/openldap2/admin-guide/intro.html - /usr/share/doc/packages/openldap2/admin-guide/intro_dctree.gif - /usr/share/doc/packages/openldap2/admin-guide/intro_tree.gif - /usr/share/doc/packages/openldap2/admin-guide/license.html - /usr/share/doc/packages/openldap2/admin-guide/preface.html - /usr/share/doc/packages/openldap2/admin-guide/proxycache.html - /usr/share/doc/packages/openldap2/admin-guide/quickstart.html - /usr/share/doc/packages/openldap2/admin-guide/referrals.html - /usr/share/doc/packages/openldap2/admin-guide/replication.html - /usr/share/doc/packages/openldap2/admin-guide/runningslapd.html - /usr/share/doc/packages/openldap2/admin-guide/sasl.html - /usr/share/doc/packages/openldap2/admin-guide/schema.html - /usr/share/doc/packages/openldap2/admin-guide/security.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconf2.html - /usr/share/doc/packages/openldap2/admin-guide/slapdconfig.html - /usr/share/doc/packages/openldap2/admin-guide/syncrepl.html - /usr/share/doc/packages/openldap2/admin-guide/tls.html - /usr/share/doc/packages/openldap2/drafts/README - /usr/share/doc/packages/openldap2/drafts/draft-behera-ldap-password-policy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-chu-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-authmeth-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-bcp64-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-dn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-filter-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-models-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-protocol-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-roadmap-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-strprep-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-syntaxes-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-url-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapbis-user-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-acl-model-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-dupent-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-ldapv3-vlv-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-ietf-ldapext-locate-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-joslin-config-schema-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-lachman-laser-ldap-mail-routing-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-acm-bac-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-admin-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-binary-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-legg-ldap-transfer-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-chaining-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-csn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-distproc-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-sermersheim-ldap-subordinate-scope-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-weltman-ldapv3-proxy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-adlist-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-assert-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-authzid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-cosine-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-dontusecopy-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-incr.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-noop-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-readentry-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-t-f-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-turn-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-uuid-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldap-x509-xx.txt - /usr/share/doc/packages/openldap2/drafts/draft-zeilenga-ldup-sync-xx.txt - /usr/share/doc/packages/openldap2/install/configure - /usr/share/man/man5/slapd-bdb.5.gz - /usr/share/man/man5/slapd-hdb.5.gz - /usr/share/man/man5/slapd-ldap.5.gz - /usr/share/man/man5/slapd-ldbm.5.gz - /usr/share/man/man5/slapd-ldif.5.gz - /usr/share/man/man5/slapd-monitor.5.gz - /usr/share/man/man5/slapd-relay.5.gz - /usr/share/man/man5/slapd.access.5.gz - /usr/share/man/man5/slapd.conf.5.gz - /usr/share/man/man5/slapd.plugin.5.gz - /usr/share/man/man5/slapd.replog.5.gz - /usr/share/man/man5/slapo-accesslog.5.gz - /usr/share/man/man5/slapo-auditlog.5.gz - /usr/share/man/man5/slapo-chain.5.gz - /usr/share/man/man5/slapo-dynlist.5.gz - /usr/share/man/man5/slapo-lastmod.5.gz - /usr/share/man/man5/slapo-pcache.5.gz - /usr/share/man/man5/slapo-ppolicy.5.gz - /usr/share/man/man5/slapo-refint.5.gz - /usr/share/man/man5/slapo-retcode.5.gz - /usr/share/man/man5/slapo-rwm.5.gz - /usr/share/man/man5/slapo-syncprov.5.gz - /usr/share/man/man5/slapo-translucent.5.gz - /usr/share/man/man5/slapo-unique.5.gz - /usr/share/man/man5/slapo-valsort.5.gz - /usr/share/man/man8/slapacl.8.gz - /usr/share/man/man8/slapadd.8.gz - /usr/share/man/man8/slapauth.8.gz - /usr/share/man/man8/slapcat.8.gz - /usr/share/man/man8/slapd.8.gz - /usr/share/man/man8/slapdn.8.gz - /usr/share/man/man8/slapindex.8.gz - /usr/share/man/man8/slappasswd.8.gz - /usr/share/man/man8/slaptest.8.gz - /usr/share/man/man8/slurpd.8.gz - /usr/share/openldap/ucdata/case.dat - /usr/share/openldap/ucdata/cmbcl.dat - /usr/share/openldap/ucdata/comp.dat - /usr/share/openldap/ucdata/ctype.dat - /usr/share/openldap/ucdata/decomp.dat - /usr/share/openldap/ucdata/kdecomp.dat - /usr/share/openldap/ucdata/num.dat - /usr/share/update-messages/en/openldap2.1 - /var/adm/fillup-templates/sysconfig.openldap - /var/lib/ldap/DB_CONFIG - /var/lib/ldap/DB_CONFIG.example - - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - /etc/dhclient.conf - /sbin/dhclient - /sbin/dhclient-script - /usr/share/man/man5/dhclient.conf.5.gz - /usr/share/man/man5/dhclient.leases.5.gz - /usr/share/man/man8/dhclient-script.8.gz - /usr/share/man/man8/dhclient.8.gz - /var/lib/dhcp/dhclient.leases - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - /etc/dhclient.conf - /sbin/dhclient - /sbin/dhclient-script - /usr/share/man/man5/dhclient.conf.5.gz - /usr/share/man/man5/dhclient.leases.5.gz - /usr/share/man/man8/dhclient-script.8.gz - /usr/share/man/man8/dhclient.8.gz - /var/lib/dhcp/dhclient.leases - - - - - - - DDNS-howto.txt - clearip - dhclient.c.dif - dhcp-3.0.1rc14-tmpfile.dif - dhcp-3.0.2-extended_option_environment.patch - dhcp-3.0.3-dhclient-nis-01-thoenig.patch - dhcp-3.0.3-dhclient-script-dhcdbd.patch - dhcp-3.0.3-ldap-patch.gz - dhcp-3.0.3-man.dif - dhcp-3.0.3.tar.bz2 - dhcp-3.0.3b1-pie.dif - dhcp-3.0.3b1.dif - dhcp-3.0b2pl18.paranoia.dif - dhcp-3.0b2pl24.resolv.conf.dif - dhcp-3.0rc10.dif - dhcp-3.0rc10.filedes.dif - dhcp-send-hostname-rml.patch - dhcp.LIESMICH - dhcp.README - dhcp.README.upgrade - dhcp.spec - dhcpsync - dhcpsync.8 - dnscompr.py - examples.tar.gz - leases.awk - leasestate - listlease - makefile.diff - rc.dhcpd - rc.dhcrelay - reset-ip - sysconfig.dhcpd - sysconfig.dhcrelay - sysconfig.syslog-dhcpd - test.c.dif - - - - - - - /usr/share/doc/packages/dhcp - /usr/share/doc/packages/dhcp/doc - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP - /var/lib/dhcp - /usr/bin/omshell - /usr/share/doc/packages/dhcp/LICENSE - /usr/share/doc/packages/dhcp/README - /usr/share/doc/packages/dhcp/RELNOTES - /usr/share/doc/packages/dhcp/doc/IANA-arp-parameters - /usr/share/doc/packages/dhcp/doc/api+protocol - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-authentication-14.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-dhcp-dns-12.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-failover-07.txt - /usr/share/doc/packages/dhcp/doc/draft-ietf-dhc-ldap-schema-01.txt - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient-script.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.8 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.conf.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhclient.leases.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-eval.5 - /usr/share/doc/packages/dhcp/doc/ja_JP.eucJP/dhcp-options.5 - /usr/share/doc/packages/dhcp/doc/rfc1542.txt - /usr/share/doc/packages/dhcp/doc/rfc2131.txt - /usr/share/doc/packages/dhcp/doc/rfc2132.txt - /usr/share/doc/packages/dhcp/doc/rfc2485.txt - /usr/share/doc/packages/dhcp/doc/rfc2489.txt - /usr/share/doc/packages/dhcp/doc/rfc951.txt - /usr/share/man/man1/omshell.1.gz - /usr/share/man/man5/dhcp-eval.5.gz - - - - - - - /etc/dhclient.conf - /sbin/dhclient - /sbin/dhclient-script - /usr/share/man/man5/dhclient.conf.5.gz - /usr/share/man/man5/dhclient.leases.5.gz - /usr/share/man/man8/dhclient-script.8.gz - /usr/share/man/man8/dhclient.8.gz - /var/lib/dhcp/dhclient.leases - - - - - - /usr/share/doc/packages/libextractor - /usr/bin/extract - /usr/lib/libextractor.so.1 - /usr/lib/libextractor.so.1.1.0 - /usr/share/doc/packages/libextractor/AUTHORS - /usr/share/doc/packages/libextractor/COPYING - /usr/share/doc/packages/libextractor/NEWS - /usr/share/doc/packages/libextractor/README - /usr/share/doc/packages/libextractor/TODO - /usr/share/locale/de/LC_MESSAGES/libextractor.mo - /usr/share/locale/ga/LC_MESSAGES/libextractor.mo - /usr/share/locale/ro/LC_MESSAGES/libextractor.mo - /usr/share/locale/rw/LC_MESSAGES/libextractor.mo - /usr/share/man/man1/extract.1.gz - - - - - - /usr/share/doc/packages/libextractor - /usr/bin/extract - /usr/lib/libextractor.so.1 - /usr/lib/libextractor.so.1.1.0 - /usr/share/doc/packages/libextractor/AUTHORS - /usr/share/doc/packages/libextractor/COPYING - /usr/share/doc/packages/libextractor/NEWS - /usr/share/doc/packages/libextractor/README - /usr/share/doc/packages/libextractor/TODO - /usr/share/locale/de/LC_MESSAGES/libextractor.mo - /usr/share/locale/ga/LC_MESSAGES/libextractor.mo - /usr/share/locale/ro/LC_MESSAGES/libextractor.mo - /usr/share/locale/rw/LC_MESSAGES/libextractor.mo - /usr/share/man/man1/extract.1.gz - - - - - - heap-overflow-asfextractor.patch - heap-overflow-qtextractor.patch - libextractor-0.5.10.tar.gz - libextractor.spec - - - - - - /usr/share/doc/packages/libextractor - /usr/bin/extract - /usr/lib64/libextractor.so.1 - /usr/lib64/libextractor.so.1.1.0 - /usr/share/doc/packages/libextractor/AUTHORS - /usr/share/doc/packages/libextractor/COPYING - /usr/share/doc/packages/libextractor/NEWS - /usr/share/doc/packages/libextractor/README - /usr/share/doc/packages/libextractor/TODO - /usr/share/locale/de/LC_MESSAGES/libextractor.mo - /usr/share/locale/ga/LC_MESSAGES/libextractor.mo - /usr/share/locale/ro/LC_MESSAGES/libextractor.mo - /usr/share/locale/rw/LC_MESSAGES/libextractor.mo - /usr/share/man/man1/extract.1.gz - - - - - /etc/ivman - /usr/share/doc/packages/ivman - /etc/ivman/IvmConfigActions.xml - /etc/ivman/IvmConfigBase.xml - /etc/ivman/IvmConfigConditions.xml - /etc/ivman/IvmConfigProperties.xml - /usr/bin/halmount - /usr/bin/halmount.py - /usr/bin/ivman - /usr/bin/ivman-launch - /usr/share/doc/packages/ivman/AUTHORS - /usr/share/doc/packages/ivman/ChangeLog - /usr/share/doc/packages/ivman/README - /usr/share/doc/packages/ivman/TODO - /usr/share/locale/fr/LC_MESSAGES/ivman.mo - /usr/share/man/man5/IvmConfigActions.xml.5.gz - /usr/share/man/man5/IvmConfigBase.xml.5.gz - /usr/share/man/man5/IvmConfigConditions.xml.5.gz - /usr/share/man/man5/IvmConfigProperties.xml.5.gz - /usr/share/man/man8/ivman-launch.8.gz - /usr/share/man/man8/ivman.8.gz - - - - - /etc/ivman - /usr/share/doc/packages/ivman - /etc/ivman/IvmConfigActions.xml - /etc/ivman/IvmConfigBase.xml - /etc/ivman/IvmConfigConditions.xml - /etc/ivman/IvmConfigProperties.xml - /usr/bin/halmount - /usr/bin/halmount.py - /usr/bin/ivman - /usr/bin/ivman-launch - /usr/share/doc/packages/ivman/AUTHORS - /usr/share/doc/packages/ivman/ChangeLog - /usr/share/doc/packages/ivman/README - /usr/share/doc/packages/ivman/TODO - /usr/share/locale/fr/LC_MESSAGES/ivman.mo - /usr/share/man/man5/IvmConfigActions.xml.5.gz - /usr/share/man/man5/IvmConfigBase.xml.5.gz - /usr/share/man/man5/IvmConfigConditions.xml.5.gz - /usr/share/man/man5/IvmConfigProperties.xml.5.gz - /usr/share/man/man8/ivman-launch.8.gz - /usr/share/man/man8/ivman.8.gz - - - - - halmount.py - ivman-0.6.9-config.patch - ivman-0.6.9-makeuserconfigs.patch - ivman-0.6.9.tar.bz2 - ivman.spec - - - - - /etc/ivman - /usr/share/doc/packages/ivman - /etc/ivman/IvmConfigActions.xml - /etc/ivman/IvmConfigBase.xml - /etc/ivman/IvmConfigConditions.xml - /etc/ivman/IvmConfigProperties.xml - /usr/bin/halmount - /usr/bin/halmount.py - /usr/bin/ivman - /usr/bin/ivman-launch - /usr/share/doc/packages/ivman/AUTHORS - /usr/share/doc/packages/ivman/ChangeLog - /usr/share/doc/packages/ivman/README - /usr/share/doc/packages/ivman/TODO - /usr/share/locale/fr/LC_MESSAGES/ivman.mo - /usr/share/man/man5/IvmConfigActions.xml.5.gz - /usr/share/man/man5/IvmConfigBase.xml.5.gz - /usr/share/man/man5/IvmConfigConditions.xml.5.gz - /usr/share/man/man5/IvmConfigProperties.xml.5.gz - /usr/share/man/man8/ivman-launch.8.gz - /usr/share/man/man8/ivman.8.gz - - - - /sbin/cryptsetup - /sbin/cryptsetup.sh - /sbin/hashalot - /usr/sbin/dmconvert - /usr/share/locale/de/LC_MESSAGES/cryptsetup.mo - /usr/share/locale/de/LC_MESSAGES/dmconvert.mo - /usr/share/man/man1/hashalot.1.gz - /usr/share/man/man8/cryptsetup.8.gz - - - - /sbin/cryptsetup - /sbin/cryptsetup.sh - /sbin/hashalot - /usr/sbin/dmconvert - /usr/share/locale/de/LC_MESSAGES/cryptsetup.mo - /usr/share/locale/de/LC_MESSAGES/dmconvert.mo - /usr/share/man/man1/hashalot.1.gz - /usr/share/man/man8/cryptsetup.8.gz - - - - cryptsetup-0.1-dmi.exists.patch - cryptsetup-0.1-retval.patch - cryptsetup-0.1-static.patch - cryptsetup-0.1-timeout.patch - cryptsetup-0.1.tar.bz2 - cryptsetup.8 - cryptsetup.sh - dmconvert-0.2-uninitialized.patch - dmconvert-0.2.tar.bz2 - hashalot-0.3.tar.bz2 - util-linux-crypto.spec - - - - /sbin/cryptsetup - /sbin/cryptsetup.sh - /sbin/hashalot - /usr/sbin/dmconvert - /usr/share/locale/de/LC_MESSAGES/cryptsetup.mo - /usr/share/locale/de/LC_MESSAGES/dmconvert.mo - /usr/share/man/man1/hashalot.1.gz - /usr/share/man/man8/cryptsetup.8.gz - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/other.xml b/libzypp/devel/devel.dmacvicar/repodata/other.xml deleted file mode 100644 index d696a20..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/other.xml +++ /dev/null @@ -1,10481 +0,0 @@ - - - - -- fix #168288 - VUL-0: opera code exec via stylesheet (update to 8.54) -- security update to 8.52 (#151788) -- converted neededforbuild to BuildRequires -- really use buildroot -- add buildroot + norootforbuild -- VUL-0: opera command line url shell command injection (#134905) -- update to 8.51 -- fix version number, really 8.50 :) -- update to 8.05, fixing security issue #117980 -- go back to the stable version 8.02, register the version - using the key kindly provided by Opera -- update to 8.10 Preview -- update to 8.01, fixing several security issues (#91179 and others) -- major update to 8.0, all platforms -- don't allow tricking the user into running arbitrary commands - (#49218) -- fix Netscape plugins (#46010) -- x86 and ppc versions switched to dynamically linked against Qt (#43526) -- fix local file detection vulnerability (#43923) -- fix address bar spoofing vulnerability (#42279) -- Remove OpenMotif1 and OpenMotif2 plugins [Bug #43311] -- updated to 7.54 -- update to 7.53 (#42279) -- update to 7.52 -- security bugfix update (#41628) -- updated to 7.50 (all archs) -- threw away the now unused patch -- updated to 7.23 for all archs -- updated the language files -- got rid of the motifwrapper hack -- Remove broken requires. -- Use the operamotifwrapper plugin from opera 7.20b as this - is linked against the current libXm.so.3. -- install desktop file from kappfinder -- Update ix86 and ppc to 7.11. -- Update sparc to 6.12 beta. -- Add most of the available language files. -- comment out kde2 stuff -- update -> 6.03 for i386 & compatibles -- removed gnome1 support -- Use %ix86 macro -- added german help module (Bug #16341) -- patch install script to recognize hammer architecture. -- update -> 6.01 (secfix) -- added German localization from http://www.blauwal.at/opera - (bug #16341) -- update -> 6.0 final (x86 only) -- update -> 6.0 (x86 only) -- build using kde2-compat -- will need port to kde3 (icon pathes only) -- initial package, x86/sparc/ppc only - - - - - - - - - - - - - - -- fix #168288 - VUL-0: opera code exec via stylesheet (update to 8.54) -- security update to 8.52 (#151788) -- converted neededforbuild to BuildRequires -- really use buildroot -- add buildroot + norootforbuild -- VUL-0: opera command line url shell command injection (#134905) -- update to 8.51 -- fix version number, really 8.50 :) -- update to 8.05, fixing security issue #117980 -- go back to the stable version 8.02, register the version - using the key kindly provided by Opera -- update to 8.10 Preview -- update to 8.01, fixing several security issues (#91179 and others) -- major update to 8.0, all platforms -- don't allow tricking the user into running arbitrary commands - (#49218) -- fix Netscape plugins (#46010) -- x86 and ppc versions switched to dynamically linked against Qt (#43526) -- fix local file detection vulnerability (#43923) -- fix address bar spoofing vulnerability (#42279) -- Remove OpenMotif1 and OpenMotif2 plugins [Bug #43311] -- updated to 7.54 -- update to 7.53 (#42279) -- update to 7.52 -- security bugfix update (#41628) -- updated to 7.50 (all archs) -- threw away the now unused patch -- updated to 7.23 for all archs -- updated the language files -- got rid of the motifwrapper hack -- Remove broken requires. -- Use the operamotifwrapper plugin from opera 7.20b as this - is linked against the current libXm.so.3. -- install desktop file from kappfinder -- Update ix86 and ppc to 7.11. -- Update sparc to 6.12 beta. -- Add most of the available language files. -- comment out kde2 stuff -- update -> 6.03 for i386 & compatibles -- removed gnome1 support -- Use %ix86 macro -- added german help module (Bug #16341) -- patch install script to recognize hammer architecture. -- update -> 6.01 (secfix) -- added German localization from http://www.blauwal.at/opera - (bug #16341) -- update -> 6.0 final (x86 only) -- update -> 6.0 (x86 only) -- build using kde2-compat -- will need port to kde3 (icon pathes only) -- initial package, x86/sparc/ppc only - - - - - - - - - - - - - - -- fix #168288 - VUL-0: opera code exec via stylesheet (update to 8.54) -- security update to 8.52 (#151788) -- converted neededforbuild to BuildRequires -- really use buildroot -- add buildroot + norootforbuild -- VUL-0: opera command line url shell command injection (#134905) -- update to 8.51 -- fix version number, really 8.50 :) -- update to 8.05, fixing security issue #117980 -- go back to the stable version 8.02, register the version - using the key kindly provided by Opera -- update to 8.10 Preview -- update to 8.01, fixing several security issues (#91179 and others) -- major update to 8.0, all platforms -- don't allow tricking the user into running arbitrary commands - (#49218) -- fix Netscape plugins (#46010) -- x86 and ppc versions switched to dynamically linked against Qt (#43526) -- fix local file detection vulnerability (#43923) -- fix address bar spoofing vulnerability (#42279) -- Remove OpenMotif1 and OpenMotif2 plugins [Bug #43311] -- updated to 7.54 -- update to 7.53 (#42279) -- update to 7.52 -- security bugfix update (#41628) -- updated to 7.50 (all archs) -- threw away the now unused patch -- updated to 7.23 for all archs -- updated the language files -- got rid of the motifwrapper hack -- Remove broken requires. -- Use the operamotifwrapper plugin from opera 7.20b as this - is linked against the current libXm.so.3. -- install desktop file from kappfinder -- Update ix86 and ppc to 7.11. -- Update sparc to 6.12 beta. -- Add most of the available language files. -- comment out kde2 stuff -- update -> 6.03 for i386 & compatibles -- removed gnome1 support -- Use %ix86 macro -- added german help module (Bug #16341) -- patch install script to recognize hammer architecture. -- update -> 6.01 (secfix) -- added German localization from http://www.blauwal.at/opera - (bug #16341) -- update -> 6.0 final (x86 only) -- update -> 6.0 (x86 only) -- build using kde2-compat -- will need port to kde3 (icon pathes only) -- initial package, x86/sparc/ppc only - - - - - - - - - - - - - -- fixed crash on malformed packets CVE-2006-2069 [#170542] -- converted neededforbuild to BuildRequires -- updated to 2.9.19 -- fixed init scripts -- used patches from http://www.linuxnetworks.de/pdnsldap/index.html -- fixed to compile on x86_64 with gcc4 -- installed html documentation [#71738] -- new package - - - - - - - - - - - - - -- fixed crash on malformed packets CVE-2006-2069 [#170542] -- converted neededforbuild to BuildRequires -- updated to 2.9.19 -- fixed init scripts -- used patches from http://www.linuxnetworks.de/pdnsldap/index.html -- fixed to compile on x86_64 with gcc4 -- installed html documentation [#71738] -- new package - - - - - - - - - - - - - -- fixed crash on malformed packets CVE-2006-2069 [#170542] -- converted neededforbuild to BuildRequires -- updated to 2.9.19 -- fixed init scripts -- used patches from http://www.linuxnetworks.de/pdnsldap/index.html -- fixed to compile on x86_64 with gcc4 -- installed html documentation [#71738] -- new package - - - - - - - - - - - - -- added dovecot-1.0.beta7_directory-traversal.patch: - Fix Mailbox names list disclosure with mboxes - (#175188, CVE-2006-2414) -- added dovecot-1.0.beta3_indexfixes.patch - * added index sync fixes - * added fix for ldap urls - * let dovecot not send header for mails we didnt announce with - EXISTS - * allow empty protocol line so you can use dovecot for pipe only -- removed dovecot-1.0.beta2-sqlite_signedness.patch - applied upstream -- replaced all occurences of /usr/libexec with %{_libdir} -- update to version 1.0.beta3 - * Dotlock code changed to timeout faster in some situations when - the lock file is old. - + Added support for loading SQL drivers dynamically (see INSTALL file - for how to build them) - + Keywords are stored to dboxes, and other dbox improvements. - + dict-sql could actually work now, making quota-in-sql-database - possibly working now (not fully tested) - + Added mail storage conversion plugin to convert automatically from - one mailbox format to another while user logs in. Doesn't preserve - UIDVALIDITY/UIDs though. - + Added plugin { .. } section to dovecot.conf for passing parameters - to plugins (see dovecot-example.conf). - + Added ssl-build-param binary which is used to generate - ssl-parameters.dat. Main dovecot binary doesn't anymore link to - SSL libraries, and this also makes the process title be clearer - about why the process is eating all the CPU. - o Fix building without OpenSSL - o Fixed memory leak in MySQL driver - o Fixes to checkpassword - o Broken Content-Length header could have broken mbox opening - o Fixed potential hangs after APPEND command - o Fixed potential crashes in dovecot-auth and imap/pop3-login - o zlib plugin now links with -lz so it could actually work - o kqueue fixes by Vaclav Haisman -- update dovecot-lda with latest fixes to compile against b3 -- converted neededforbuild to BuildRequires -- update to 1.0.beta2. this is a bugfix release. - + Added SQLite support. Patch by Jakob Hirsch. - + Added auth_debug_passwords setting. If it's not enabled, - hide all password strings from logs. - + Added mail_cache_min_mail_count and mbox_min_index_size - settings which can be used to make Dovecot do less disk writes - in small mailboxes where they don't benefit that much. - + Added --build-ssl-parameters parameter to dovecot binary -- SSL parameters were being regenerated every 10 minutes, - although not with all systems. -- Fixed dovecot-auth crashing at startup. Happened only with some - specific compilers. -- base_dir was supposed to be set world-readable, - not world-writable -- disabled epoll for now. - Jakob Hirsch is working on a patch for this. -- sqlite3 support enabled - + dovecot-1.0.beta2-sqlite_signedness.patch - fix a signedness warning -- apply fix for dovecot-lda that allows using default_mail_env -- includes dovecot-lda changelog -- added dovecot-1.0.beta1_sslparam-regeneration.patch - fix timer for regeneration of ssl params -- added dovecot-1.0beta1_pie.patch -- compile with -fstack-protector -- Update to version package for 1.0.beta1 - this is a complete rewrite see - /usr/share/doc/packages/dovecot/ChangeLog.gz for all changes -- added dovecot-cvs_inotify.patch - fixes a small include for inotify support -- added LDAP_DEPRECATED to CFLAGS -- Compile with -fpie/-pie -- Update to 0.99.14 including: - o Message address fields are now parsed differently, fixing some - issues with spaces. Affects only clients which use FETCH ENVELOPE - command. - o Message MIME parser was somewhat broken with missing MIME boundaries - o mbox: Don't allow X-UID headers in mails to override the UIDs we - would otherwise set. Too large values can break some clients and - cause other trouble. - o passwd-file userdb wasn't working - o PAM crashed with 64bit systems - o non-SSL inetd startup wasn't working - o If UID FETCH notices and skips an expunged message, don't return - a NO reply. It's not needed and only makes clients give error - messages. -- Update to 0.99.13 including: - o GNUTLS support hasn't been working for a while, so it's not even - tried to be used anymore unless explicitly wanted. - o Added CRAM-MD5 authentication mechanism. - o Added SMD5 and LDAP-MD5 password schemes and changed MD5 - scheme to use LDAP-MD5 if the password isn't in MD5crypt format. - o Workaround for some POP3 client bugs: if message doesn't - contain the "end of headers" empty line, add it automatically. - o vpopmail supports now all password schemes, most importantly - MD5crypt works now without support from libc's crypt() - o SQL and LDAP authentication was broken - o SEARCH UNKEYWORD wasn't working -- Update to 0.99.12.1 including: - o Fix memory leaks in LDAP, MySQL and PGSQL userdb/passdb - o Fix hanging when parsing mails that have over 4096 bytes in one - line (SMTP servers normally don't allow over 1000 bytes so it - shouldn't be much of a problem) - o FETCH BODYSTRUCTURE sometimes gave a wrong reply - (eg. with FETCH (BODYSTRUCTURE RFC822.SIZE) if it wasn't cached) - o Never return more than one INBOX in LIST even if there are such - files. They don't work anyway and it just confuses clients. - o mbox: Don't allow creating INBOX directory by creating/renaming - mailboxes under it. They just wouldn't work. - o POP3: Don't return PLAIN in SASL list. We don't support initial SASL - responses, so it only breaks with most clients that try to use it. - o IMAP and POP3 login processes may have sent each line in two IP - packets, one with the data and another with CR+LF. Some clients - didn't work because of this. -- Use common-* PAM config files -- Switch heimdal-* to kerberos-devel-packages in #nfb as pr. requst - of Mr. Carsten Höger -- Update to dovecot-0.99.11 which mainly is a bugfix release with: - o 127.* and ::1 IP addresses are treated as secured with - disable_plaintext_auth = yes - o auth_debug setting for extra authentication debugging - o Some documentation and error message updates - o Create PID file in /var/run/dovecot/master.pid - o home setting is now optional in static userdb - o Added mail setting to static userdb - o After APPENDing to selected mailbox Dovecot didn't always notice the - new mail immediately which broke some clients - o THREAD and SORT commands crashed with some mails - o If APPENDed mail ended with CR character, Dovecot aborted the saving - o Output streams sometimes sent data duplicated and lost part of it. - This could have caused various strange problems, but looks like in - practise it rarely caused real problems. -- Don't create unused directories [#44362] -- Update to dovecot-0.99.10.9 with the following item since .6: - o MySQL compiling got broken in last release - o More PostgreSQL reconnection fixing - o LDAP support compiles now with Solaris LDAP library - o IMAP BODY and BODYSTRUCTURE replies were wrong for MIME parts which - didn't contain Content-Type header. - o MySQL and PostgreSQL auth didn't reconnect if connection was lost - to SQL server - o Linking fixes for dovecot-auth with some systems - o Last fix for disconnecting client when downloading mail longer than - 30 seconds actually made it never disconnect client. Now it works - properly: disconnect when client hasn't read _any_ data for 30 - seconds. - o Added outlook-pop3-no-nuls workaround to fix Outlook hang in - mails with NULs. - o Config file lines can now contain quoted strings ("value ") - o If client didn't finish downloading a single mail in 30 seconds, - Dovecot closed the connection. This was supposed to work so that - if client hasn't read data at all in 30 seconds, it's disconnected. - o Maildir: LIST now doesn't skip symlinks -- Update to dovecot-0.99.10.6 which is a bugfix release -- Update to dovecot-0.99.10.5 which main feature is mysql support -- Adjust the modules path to a more suitable place, and work the - configuration a bit. -- Initial package of dovecot-0.99.10.4. Thanks to darix for hints. - - - - - - - - - - - - -- added dovecot-1.0.beta7_directory-traversal.patch: - Fix Mailbox names list disclosure with mboxes - (#175188, CVE-2006-2414) -- added dovecot-1.0.beta3_indexfixes.patch - * added index sync fixes - * added fix for ldap urls - * let dovecot not send header for mails we didnt announce with - EXISTS - * allow empty protocol line so you can use dovecot for pipe only -- removed dovecot-1.0.beta2-sqlite_signedness.patch - applied upstream -- replaced all occurences of /usr/libexec with %{_libdir} -- update to version 1.0.beta3 - * Dotlock code changed to timeout faster in some situations when - the lock file is old. - + Added support for loading SQL drivers dynamically (see INSTALL file - for how to build them) - + Keywords are stored to dboxes, and other dbox improvements. - + dict-sql could actually work now, making quota-in-sql-database - possibly working now (not fully tested) - + Added mail storage conversion plugin to convert automatically from - one mailbox format to another while user logs in. Doesn't preserve - UIDVALIDITY/UIDs though. - + Added plugin { .. } section to dovecot.conf for passing parameters - to plugins (see dovecot-example.conf). - + Added ssl-build-param binary which is used to generate - ssl-parameters.dat. Main dovecot binary doesn't anymore link to - SSL libraries, and this also makes the process title be clearer - about why the process is eating all the CPU. - o Fix building without OpenSSL - o Fixed memory leak in MySQL driver - o Fixes to checkpassword - o Broken Content-Length header could have broken mbox opening - o Fixed potential hangs after APPEND command - o Fixed potential crashes in dovecot-auth and imap/pop3-login - o zlib plugin now links with -lz so it could actually work - o kqueue fixes by Vaclav Haisman -- update dovecot-lda with latest fixes to compile against b3 -- converted neededforbuild to BuildRequires -- update to 1.0.beta2. this is a bugfix release. - + Added SQLite support. Patch by Jakob Hirsch. - + Added auth_debug_passwords setting. If it's not enabled, - hide all password strings from logs. - + Added mail_cache_min_mail_count and mbox_min_index_size - settings which can be used to make Dovecot do less disk writes - in small mailboxes where they don't benefit that much. - + Added --build-ssl-parameters parameter to dovecot binary -- SSL parameters were being regenerated every 10 minutes, - although not with all systems. -- Fixed dovecot-auth crashing at startup. Happened only with some - specific compilers. -- base_dir was supposed to be set world-readable, - not world-writable -- disabled epoll for now. - Jakob Hirsch is working on a patch for this. -- sqlite3 support enabled - + dovecot-1.0.beta2-sqlite_signedness.patch - fix a signedness warning -- apply fix for dovecot-lda that allows using default_mail_env -- includes dovecot-lda changelog -- added dovecot-1.0.beta1_sslparam-regeneration.patch - fix timer for regeneration of ssl params -- added dovecot-1.0beta1_pie.patch -- compile with -fstack-protector -- Update to version package for 1.0.beta1 - this is a complete rewrite see - /usr/share/doc/packages/dovecot/ChangeLog.gz for all changes -- added dovecot-cvs_inotify.patch - fixes a small include for inotify support -- added LDAP_DEPRECATED to CFLAGS -- Compile with -fpie/-pie -- Update to 0.99.14 including: - o Message address fields are now parsed differently, fixing some - issues with spaces. Affects only clients which use FETCH ENVELOPE - command. - o Message MIME parser was somewhat broken with missing MIME boundaries - o mbox: Don't allow X-UID headers in mails to override the UIDs we - would otherwise set. Too large values can break some clients and - cause other trouble. - o passwd-file userdb wasn't working - o PAM crashed with 64bit systems - o non-SSL inetd startup wasn't working - o If UID FETCH notices and skips an expunged message, don't return - a NO reply. It's not needed and only makes clients give error - messages. -- Update to 0.99.13 including: - o GNUTLS support hasn't been working for a while, so it's not even - tried to be used anymore unless explicitly wanted. - o Added CRAM-MD5 authentication mechanism. - o Added SMD5 and LDAP-MD5 password schemes and changed MD5 - scheme to use LDAP-MD5 if the password isn't in MD5crypt format. - o Workaround for some POP3 client bugs: if message doesn't - contain the "end of headers" empty line, add it automatically. - o vpopmail supports now all password schemes, most importantly - MD5crypt works now without support from libc's crypt() - o SQL and LDAP authentication was broken - o SEARCH UNKEYWORD wasn't working -- Update to 0.99.12.1 including: - o Fix memory leaks in LDAP, MySQL and PGSQL userdb/passdb - o Fix hanging when parsing mails that have over 4096 bytes in one - line (SMTP servers normally don't allow over 1000 bytes so it - shouldn't be much of a problem) - o FETCH BODYSTRUCTURE sometimes gave a wrong reply - (eg. with FETCH (BODYSTRUCTURE RFC822.SIZE) if it wasn't cached) - o Never return more than one INBOX in LIST even if there are such - files. They don't work anyway and it just confuses clients. - o mbox: Don't allow creating INBOX directory by creating/renaming - mailboxes under it. They just wouldn't work. - o POP3: Don't return PLAIN in SASL list. We don't support initial SASL - responses, so it only breaks with most clients that try to use it. - o IMAP and POP3 login processes may have sent each line in two IP - packets, one with the data and another with CR+LF. Some clients - didn't work because of this. -- Use common-* PAM config files -- Switch heimdal-* to kerberos-devel-packages in #nfb as pr. requst - of Mr. Carsten Höger -- Update to dovecot-0.99.11 which mainly is a bugfix release with: - o 127.* and ::1 IP addresses are treated as secured with - disable_plaintext_auth = yes - o auth_debug setting for extra authentication debugging - o Some documentation and error message updates - o Create PID file in /var/run/dovecot/master.pid - o home setting is now optional in static userdb - o Added mail setting to static userdb - o After APPENDing to selected mailbox Dovecot didn't always notice the - new mail immediately which broke some clients - o THREAD and SORT commands crashed with some mails - o If APPENDed mail ended with CR character, Dovecot aborted the saving - o Output streams sometimes sent data duplicated and lost part of it. - This could have caused various strange problems, but looks like in - practise it rarely caused real problems. -- Don't create unused directories [#44362] -- Update to dovecot-0.99.10.9 with the following item since .6: - o MySQL compiling got broken in last release - o More PostgreSQL reconnection fixing - o LDAP support compiles now with Solaris LDAP library - o IMAP BODY and BODYSTRUCTURE replies were wrong for MIME parts which - didn't contain Content-Type header. - o MySQL and PostgreSQL auth didn't reconnect if connection was lost - to SQL server - o Linking fixes for dovecot-auth with some systems - o Last fix for disconnecting client when downloading mail longer than - 30 seconds actually made it never disconnect client. Now it works - properly: disconnect when client hasn't read _any_ data for 30 - seconds. - o Added outlook-pop3-no-nuls workaround to fix Outlook hang in - mails with NULs. - o Config file lines can now contain quoted strings ("value ") - o If client didn't finish downloading a single mail in 30 seconds, - Dovecot closed the connection. This was supposed to work so that - if client hasn't read data at all in 30 seconds, it's disconnected. - o Maildir: LIST now doesn't skip symlinks -- Update to dovecot-0.99.10.6 which is a bugfix release -- Update to dovecot-0.99.10.5 which main feature is mysql support -- Adjust the modules path to a more suitable place, and work the - configuration a bit. -- Initial package of dovecot-0.99.10.4. Thanks to darix for hints. - - - - - - - - - - - - -- added dovecot-1.0.beta7_directory-traversal.patch: - Fix Mailbox names list disclosure with mboxes - (#175188, CVE-2006-2414) -- added dovecot-1.0.beta3_indexfixes.patch - * added index sync fixes - * added fix for ldap urls - * let dovecot not send header for mails we didnt announce with - EXISTS - * allow empty protocol line so you can use dovecot for pipe only -- removed dovecot-1.0.beta2-sqlite_signedness.patch - applied upstream -- replaced all occurences of /usr/libexec with %{_libdir} -- update to version 1.0.beta3 - * Dotlock code changed to timeout faster in some situations when - the lock file is old. - + Added support for loading SQL drivers dynamically (see INSTALL file - for how to build them) - + Keywords are stored to dboxes, and other dbox improvements. - + dict-sql could actually work now, making quota-in-sql-database - possibly working now (not fully tested) - + Added mail storage conversion plugin to convert automatically from - one mailbox format to another while user logs in. Doesn't preserve - UIDVALIDITY/UIDs though. - + Added plugin { .. } section to dovecot.conf for passing parameters - to plugins (see dovecot-example.conf). - + Added ssl-build-param binary which is used to generate - ssl-parameters.dat. Main dovecot binary doesn't anymore link to - SSL libraries, and this also makes the process title be clearer - about why the process is eating all the CPU. - o Fix building without OpenSSL - o Fixed memory leak in MySQL driver - o Fixes to checkpassword - o Broken Content-Length header could have broken mbox opening - o Fixed potential hangs after APPEND command - o Fixed potential crashes in dovecot-auth and imap/pop3-login - o zlib plugin now links with -lz so it could actually work - o kqueue fixes by Vaclav Haisman -- update dovecot-lda with latest fixes to compile against b3 -- converted neededforbuild to BuildRequires -- update to 1.0.beta2. this is a bugfix release. - + Added SQLite support. Patch by Jakob Hirsch. - + Added auth_debug_passwords setting. If it's not enabled, - hide all password strings from logs. - + Added mail_cache_min_mail_count and mbox_min_index_size - settings which can be used to make Dovecot do less disk writes - in small mailboxes where they don't benefit that much. - + Added --build-ssl-parameters parameter to dovecot binary -- SSL parameters were being regenerated every 10 minutes, - although not with all systems. -- Fixed dovecot-auth crashing at startup. Happened only with some - specific compilers. -- base_dir was supposed to be set world-readable, - not world-writable -- disabled epoll for now. - Jakob Hirsch is working on a patch for this. -- sqlite3 support enabled - + dovecot-1.0.beta2-sqlite_signedness.patch - fix a signedness warning -- apply fix for dovecot-lda that allows using default_mail_env -- includes dovecot-lda changelog -- added dovecot-1.0.beta1_sslparam-regeneration.patch - fix timer for regeneration of ssl params -- added dovecot-1.0beta1_pie.patch -- compile with -fstack-protector -- Update to version package for 1.0.beta1 - this is a complete rewrite see - /usr/share/doc/packages/dovecot/ChangeLog.gz for all changes -- added dovecot-cvs_inotify.patch - fixes a small include for inotify support -- added LDAP_DEPRECATED to CFLAGS -- Compile with -fpie/-pie -- Update to 0.99.14 including: - o Message address fields are now parsed differently, fixing some - issues with spaces. Affects only clients which use FETCH ENVELOPE - command. - o Message MIME parser was somewhat broken with missing MIME boundaries - o mbox: Don't allow X-UID headers in mails to override the UIDs we - would otherwise set. Too large values can break some clients and - cause other trouble. - o passwd-file userdb wasn't working - o PAM crashed with 64bit systems - o non-SSL inetd startup wasn't working - o If UID FETCH notices and skips an expunged message, don't return - a NO reply. It's not needed and only makes clients give error - messages. -- Update to 0.99.13 including: - o GNUTLS support hasn't been working for a while, so it's not even - tried to be used anymore unless explicitly wanted. - o Added CRAM-MD5 authentication mechanism. - o Added SMD5 and LDAP-MD5 password schemes and changed MD5 - scheme to use LDAP-MD5 if the password isn't in MD5crypt format. - o Workaround for some POP3 client bugs: if message doesn't - contain the "end of headers" empty line, add it automatically. - o vpopmail supports now all password schemes, most importantly - MD5crypt works now without support from libc's crypt() - o SQL and LDAP authentication was broken - o SEARCH UNKEYWORD wasn't working -- Update to 0.99.12.1 including: - o Fix memory leaks in LDAP, MySQL and PGSQL userdb/passdb - o Fix hanging when parsing mails that have over 4096 bytes in one - line (SMTP servers normally don't allow over 1000 bytes so it - shouldn't be much of a problem) - o FETCH BODYSTRUCTURE sometimes gave a wrong reply - (eg. with FETCH (BODYSTRUCTURE RFC822.SIZE) if it wasn't cached) - o Never return more than one INBOX in LIST even if there are such - files. They don't work anyway and it just confuses clients. - o mbox: Don't allow creating INBOX directory by creating/renaming - mailboxes under it. They just wouldn't work. - o POP3: Don't return PLAIN in SASL list. We don't support initial SASL - responses, so it only breaks with most clients that try to use it. - o IMAP and POP3 login processes may have sent each line in two IP - packets, one with the data and another with CR+LF. Some clients - didn't work because of this. -- Use common-* PAM config files -- Switch heimdal-* to kerberos-devel-packages in #nfb as pr. requst - of Mr. Carsten Höger -- Update to dovecot-0.99.11 which mainly is a bugfix release with: - o 127.* and ::1 IP addresses are treated as secured with - disable_plaintext_auth = yes - o auth_debug setting for extra authentication debugging - o Some documentation and error message updates - o Create PID file in /var/run/dovecot/master.pid - o home setting is now optional in static userdb - o Added mail setting to static userdb - o After APPENDing to selected mailbox Dovecot didn't always notice the - new mail immediately which broke some clients - o THREAD and SORT commands crashed with some mails - o If APPENDed mail ended with CR character, Dovecot aborted the saving - o Output streams sometimes sent data duplicated and lost part of it. - This could have caused various strange problems, but looks like in - practise it rarely caused real problems. -- Don't create unused directories [#44362] -- Update to dovecot-0.99.10.9 with the following item since .6: - o MySQL compiling got broken in last release - o More PostgreSQL reconnection fixing - o LDAP support compiles now with Solaris LDAP library - o IMAP BODY and BODYSTRUCTURE replies were wrong for MIME parts which - didn't contain Content-Type header. - o MySQL and PostgreSQL auth didn't reconnect if connection was lost - to SQL server - o Linking fixes for dovecot-auth with some systems - o Last fix for disconnecting client when downloading mail longer than - 30 seconds actually made it never disconnect client. Now it works - properly: disconnect when client hasn't read _any_ data for 30 - seconds. - o Added outlook-pop3-no-nuls workaround to fix Outlook hang in - mails with NULs. - o Config file lines can now contain quoted strings ("value ") - o If client didn't finish downloading a single mail in 30 seconds, - Dovecot closed the connection. This was supposed to work so that - if client hasn't read data at all in 30 seconds, it's disconnected. - o Maildir: LIST now doesn't skip symlinks -- Update to dovecot-0.99.10.6 which is a bugfix release -- Update to dovecot-0.99.10.5 which main feature is mysql support -- Adjust the modules path to a more suitable place, and work the - configuration a bit. -- Initial package of dovecot-0.99.10.4. Thanks to darix for hints. - - - - - - - - - - - - -- added dovecot-1.0.beta7_directory-traversal.patch: - Fix Mailbox names list disclosure with mboxes - (#175188, CVE-2006-2414) -- added dovecot-1.0.beta3_indexfixes.patch - * added index sync fixes - * added fix for ldap urls - * let dovecot not send header for mails we didnt announce with - EXISTS - * allow empty protocol line so you can use dovecot for pipe only -- removed dovecot-1.0.beta2-sqlite_signedness.patch - applied upstream -- replaced all occurences of /usr/libexec with %{_libdir} -- update to version 1.0.beta3 - * Dotlock code changed to timeout faster in some situations when - the lock file is old. - + Added support for loading SQL drivers dynamically (see INSTALL file - for how to build them) - + Keywords are stored to dboxes, and other dbox improvements. - + dict-sql could actually work now, making quota-in-sql-database - possibly working now (not fully tested) - + Added mail storage conversion plugin to convert automatically from - one mailbox format to another while user logs in. Doesn't preserve - UIDVALIDITY/UIDs though. - + Added plugin { .. } section to dovecot.conf for passing parameters - to plugins (see dovecot-example.conf). - + Added ssl-build-param binary which is used to generate - ssl-parameters.dat. Main dovecot binary doesn't anymore link to - SSL libraries, and this also makes the process title be clearer - about why the process is eating all the CPU. - o Fix building without OpenSSL - o Fixed memory leak in MySQL driver - o Fixes to checkpassword - o Broken Content-Length header could have broken mbox opening - o Fixed potential hangs after APPEND command - o Fixed potential crashes in dovecot-auth and imap/pop3-login - o zlib plugin now links with -lz so it could actually work - o kqueue fixes by Vaclav Haisman -- update dovecot-lda with latest fixes to compile against b3 -- converted neededforbuild to BuildRequires -- update to 1.0.beta2. this is a bugfix release. - + Added SQLite support. Patch by Jakob Hirsch. - + Added auth_debug_passwords setting. If it's not enabled, - hide all password strings from logs. - + Added mail_cache_min_mail_count and mbox_min_index_size - settings which can be used to make Dovecot do less disk writes - in small mailboxes where they don't benefit that much. - + Added --build-ssl-parameters parameter to dovecot binary -- SSL parameters were being regenerated every 10 minutes, - although not with all systems. -- Fixed dovecot-auth crashing at startup. Happened only with some - specific compilers. -- base_dir was supposed to be set world-readable, - not world-writable -- disabled epoll for now. - Jakob Hirsch is working on a patch for this. -- sqlite3 support enabled - + dovecot-1.0.beta2-sqlite_signedness.patch - fix a signedness warning -- apply fix for dovecot-lda that allows using default_mail_env -- includes dovecot-lda changelog -- added dovecot-1.0.beta1_sslparam-regeneration.patch - fix timer for regeneration of ssl params -- added dovecot-1.0beta1_pie.patch -- compile with -fstack-protector -- Update to version package for 1.0.beta1 - this is a complete rewrite see - /usr/share/doc/packages/dovecot/ChangeLog.gz for all changes -- added dovecot-cvs_inotify.patch - fixes a small include for inotify support -- added LDAP_DEPRECATED to CFLAGS -- Compile with -fpie/-pie -- Update to 0.99.14 including: - o Message address fields are now parsed differently, fixing some - issues with spaces. Affects only clients which use FETCH ENVELOPE - command. - o Message MIME parser was somewhat broken with missing MIME boundaries - o mbox: Don't allow X-UID headers in mails to override the UIDs we - would otherwise set. Too large values can break some clients and - cause other trouble. - o passwd-file userdb wasn't working - o PAM crashed with 64bit systems - o non-SSL inetd startup wasn't working - o If UID FETCH notices and skips an expunged message, don't return - a NO reply. It's not needed and only makes clients give error - messages. -- Update to 0.99.13 including: - o GNUTLS support hasn't been working for a while, so it's not even - tried to be used anymore unless explicitly wanted. - o Added CRAM-MD5 authentication mechanism. - o Added SMD5 and LDAP-MD5 password schemes and changed MD5 - scheme to use LDAP-MD5 if the password isn't in MD5crypt format. - o Workaround for some POP3 client bugs: if message doesn't - contain the "end of headers" empty line, add it automatically. - o vpopmail supports now all password schemes, most importantly - MD5crypt works now without support from libc's crypt() - o SQL and LDAP authentication was broken - o SEARCH UNKEYWORD wasn't working -- Update to 0.99.12.1 including: - o Fix memory leaks in LDAP, MySQL and PGSQL userdb/passdb - o Fix hanging when parsing mails that have over 4096 bytes in one - line (SMTP servers normally don't allow over 1000 bytes so it - shouldn't be much of a problem) - o FETCH BODYSTRUCTURE sometimes gave a wrong reply - (eg. with FETCH (BODYSTRUCTURE RFC822.SIZE) if it wasn't cached) - o Never return more than one INBOX in LIST even if there are such - files. They don't work anyway and it just confuses clients. - o mbox: Don't allow creating INBOX directory by creating/renaming - mailboxes under it. They just wouldn't work. - o POP3: Don't return PLAIN in SASL list. We don't support initial SASL - responses, so it only breaks with most clients that try to use it. - o IMAP and POP3 login processes may have sent each line in two IP - packets, one with the data and another with CR+LF. Some clients - didn't work because of this. -- Use common-* PAM config files -- Switch heimdal-* to kerberos-devel-packages in #nfb as pr. requst - of Mr. Carsten Höger -- Update to dovecot-0.99.11 which mainly is a bugfix release with: - o 127.* and ::1 IP addresses are treated as secured with - disable_plaintext_auth = yes - o auth_debug setting for extra authentication debugging - o Some documentation and error message updates - o Create PID file in /var/run/dovecot/master.pid - o home setting is now optional in static userdb - o Added mail setting to static userdb - o After APPENDing to selected mailbox Dovecot didn't always notice the - new mail immediately which broke some clients - o THREAD and SORT commands crashed with some mails - o If APPENDed mail ended with CR character, Dovecot aborted the saving - o Output streams sometimes sent data duplicated and lost part of it. - This could have caused various strange problems, but looks like in - practise it rarely caused real problems. -- Don't create unused directories [#44362] -- Update to dovecot-0.99.10.9 with the following item since .6: - o MySQL compiling got broken in last release - o More PostgreSQL reconnection fixing - o LDAP support compiles now with Solaris LDAP library - o IMAP BODY and BODYSTRUCTURE replies were wrong for MIME parts which - didn't contain Content-Type header. - o MySQL and PostgreSQL auth didn't reconnect if connection was lost - to SQL server - o Linking fixes for dovecot-auth with some systems - o Last fix for disconnecting client when downloading mail longer than - 30 seconds actually made it never disconnect client. Now it works - properly: disconnect when client hasn't read _any_ data for 30 - seconds. - o Added outlook-pop3-no-nuls workaround to fix Outlook hang in - mails with NULs. - o Config file lines can now contain quoted strings ("value ") - o If client didn't finish downloading a single mail in 30 seconds, - Dovecot closed the connection. This was supposed to work so that - if client hasn't read data at all in 30 seconds, it's disconnected. - o Maildir: LIST now doesn't skip symlinks -- Update to dovecot-0.99.10.6 which is a bugfix release -- Update to dovecot-0.99.10.5 which main feature is mysql support -- Adjust the modules path to a more suitable place, and work the - configuration a bit. -- Initial package of dovecot-0.99.10.4. Thanks to darix for hints. - - - - - - - - - - - -- Fixed invalid UTF-8 hostname DoS (#137781). -- Fixed buffer overflow in avahi_record_to_string() (#137781#c7). -- Replaced Obsoletes by Conflicts for mDNSResponder* (#149676). -- Fix compat layer ABI inconsistencies with mDNSResponder (part of - [#149676]) -- Wait for daemon initialization in the init script (#150902). -- Use Provides and Obsoletes instead of Conflicts to allow seamless - replacement. -- Call %insserv_cleanup in %postun. -- Provide libdns_sd.so RPM symbol, as mDNSResponder does. -- Reduced BuildRequires. -- Fixed circular dependency between avahi and avahi-glib - (avahi-discover moved to avahi-glib). -- converted neededforbuild to BuildRequires -- Updated to version 0.6.5. -- Enable howl compatibility layer as separate packages. -- Updated to version 0.6.4. -- fix build with dbus-1 0.60 -- added libxml2-python to nfb -- Move libdns_sd.so to avahi-compat-mDNSResponder from - avahi-compat-mDNSResponder-devel (fix up requires/provides) -- Provide dns_sd.h compatibility symlink. -- Enable mDNSResponder compatibility layer as separate packages. -- Call aclocal to compile in PLUS. -- Enabled qt4 bindings. -- Fixed file ownership. -- Disabled parallel build - mono fails often. -- Bi-arch fix. -- Build as user. -- Enabled parallel build. -- Updated to version 0.6.1. -- Moved all devel files and Requires to devel subpackage. -- use gnome2-devel-packages in nfb and cleanup nfb -- fix build of sharp part on x86_64 -- removed restart_on_update in postinstall - (only needed in postuninstall) -- Initial check in - - - - - - - - - - - -- Fixed invalid UTF-8 hostname DoS (#137781). -- Fixed buffer overflow in avahi_record_to_string() (#137781#c7). -- Replaced Obsoletes by Conflicts for mDNSResponder* (#149676). -- Fix compat layer ABI inconsistencies with mDNSResponder (part of - [#149676]) -- Wait for daemon initialization in the init script (#150902). -- Use Provides and Obsoletes instead of Conflicts to allow seamless - replacement. -- Call %insserv_cleanup in %postun. -- Provide libdns_sd.so RPM symbol, as mDNSResponder does. -- Reduced BuildRequires. -- Fixed circular dependency between avahi and avahi-glib - (avahi-discover moved to avahi-glib). -- converted neededforbuild to BuildRequires -- Updated to version 0.6.5. -- Enable howl compatibility layer as separate packages. -- Updated to version 0.6.4. -- fix build with dbus-1 0.60 -- added libxml2-python to nfb -- Move libdns_sd.so to avahi-compat-mDNSResponder from - avahi-compat-mDNSResponder-devel (fix up requires/provides) -- Provide dns_sd.h compatibility symlink. -- Enable mDNSResponder compatibility layer as separate packages. -- Call aclocal to compile in PLUS. -- Enabled qt4 bindings. -- Fixed file ownership. -- Disabled parallel build - mono fails often. -- Bi-arch fix. -- Build as user. -- Enabled parallel build. -- Updated to version 0.6.1. -- Moved all devel files and Requires to devel subpackage. -- use gnome2-devel-packages in nfb and cleanup nfb -- fix build of sharp part on x86_64 -- removed restart_on_update in postinstall - (only needed in postuninstall) -- Initial check in - - - - - - - - - - - -- Fixed invalid UTF-8 hostname DoS (#137781). -- Fixed buffer overflow in avahi_record_to_string() (#137781#c7). -- Replaced Obsoletes by Conflicts for mDNSResponder* (#149676). -- Fix compat layer ABI inconsistencies with mDNSResponder (part of - [#149676]) -- Wait for daemon initialization in the init script (#150902). -- Use Provides and Obsoletes instead of Conflicts to allow seamless - replacement. -- Call %insserv_cleanup in %postun. -- Provide libdns_sd.so RPM symbol, as mDNSResponder does. -- Reduced BuildRequires. -- Fixed circular dependency between avahi and avahi-glib - (avahi-discover moved to avahi-glib). -- converted neededforbuild to BuildRequires -- Updated to version 0.6.5. -- Enable howl compatibility layer as separate packages. -- Updated to version 0.6.4. -- fix build with dbus-1 0.60 -- added libxml2-python to nfb -- Move libdns_sd.so to avahi-compat-mDNSResponder from - avahi-compat-mDNSResponder-devel (fix up requires/provides) -- Provide dns_sd.h compatibility symlink. -- Enable mDNSResponder compatibility layer as separate packages. -- Call aclocal to compile in PLUS. -- Enabled qt4 bindings. -- Fixed file ownership. -- Disabled parallel build - mono fails often. -- Bi-arch fix. -- Build as user. -- Enabled parallel build. -- Updated to version 0.6.1. -- Moved all devel files and Requires to devel subpackage. -- use gnome2-devel-packages in nfb and cleanup nfb -- fix build of sharp part on x86_64 -- removed restart_on_update in postinstall - (only needed in postuninstall) -- Initial check in - - - - - - - - - - - -- Fixed invalid UTF-8 hostname DoS (#137781). -- Fixed buffer overflow in avahi_record_to_string() (#137781#c7). -- Replaced Obsoletes by Conflicts for mDNSResponder* (#149676). -- Fix compat layer ABI inconsistencies with mDNSResponder (part of - [#149676]) -- Wait for daemon initialization in the init script (#150902). -- Use Provides and Obsoletes instead of Conflicts to allow seamless - replacement. -- Call %insserv_cleanup in %postun. -- Provide libdns_sd.so RPM symbol, as mDNSResponder does. -- Reduced BuildRequires. -- Fixed circular dependency between avahi and avahi-glib - (avahi-discover moved to avahi-glib). -- converted neededforbuild to BuildRequires -- Updated to version 0.6.5. -- Enable howl compatibility layer as separate packages. -- Updated to version 0.6.4. -- fix build with dbus-1 0.60 -- added libxml2-python to nfb -- Move libdns_sd.so to avahi-compat-mDNSResponder from - avahi-compat-mDNSResponder-devel (fix up requires/provides) -- Provide dns_sd.h compatibility symlink. -- Enable mDNSResponder compatibility layer as separate packages. -- Call aclocal to compile in PLUS. -- Enabled qt4 bindings. -- Fixed file ownership. -- Disabled parallel build - mono fails often. -- Bi-arch fix. -- Build as user. -- Enabled parallel build. -- Updated to version 0.6.1. -- Moved all devel files and Requires to devel subpackage. -- use gnome2-devel-packages in nfb and cleanup nfb -- fix build of sharp part on x86_64 -- removed restart_on_update in postinstall - (only needed in postuninstall) -- Initial check in - - - - - - - - - - -- fixed possible buffer overflow in CGI scripts (#140494) - (CVE-2006-2162) -- converted neededforbuild to BuildRequires -- fixed off-by-one overflow (#141124) -- update to stable version 1.3 -- fixed autobuild warnings about printf format -- fixed compiler errors about usage of uninitialized vars -- Compile with GCC4. -- removed apache1 traces -- fix compiler-warnings -- update to nagios 1.2 -- /usr/lib/nagios and /usr/lib/nagios/plugins are owned - by root (#31100) -- add apache2 config-files, require http_daemon - and need apache2-devel-packages for build (#30157) -- remove traceroute-lbl from neededforbuild - traceroute from net-tools is used anyway -- added activation meta-data to sysconfig (#28830) -- change cmdgrp from nogroup to www (the group apache now runs - under) [#21782] -- implement try-restart correctly -- use stop/restart macros -- Fix chown invocation. -- added bugfixes -- Make sure plugin directory exist -- Add nagios libdir to filelist -- update to bugfix release 1.1 - * File descriptor leak in file-based performance routines - * Timestamp fix for PostgreSQL 7.3 - * Minor bug fixes to cmd and history CGIs - * Minor documentation fixes -- added sysconfig-metadata (#22607) -- adopted sapmoni.dif for gcc 3.3 -- update to 1.0 final - * Minor bug fixes in CGIs - * Minor doc updates - * Bug fix for flex host downtime - * Embedded perl bug fixe for arguments with spaces - * Host escalation logic fix -- running pre-flight configuration check always when - starting nagios (#20916) -- added logrotate definitions for logfiles -- fixed embedded perl (#20916) (thanks to mls) -- update to 1.0b6 - * Added wildcards and multiple hosts/hostgroups to host dependency - and service dependency definitions - * Added wildcard support for members directive in hostgroup - definitions - * Minor bug fixes and cleanups in CGIs - * Minor cleanups in the core - * New version of snprintf() included that supports %f - * Notification interval for escalations now defaults to - non-escalated value -- update to 1.0b5 - * Fixed memory leak related to processing of passive checks - * Memory leak fixes in the CGIs - * Minor interface changes to the status and TAC CGIs - * Bug fix in the notification CGI - * Added minimalistic sample object config file (minimal.cfg) -- added PreReq (Bug #17938 #17939) -- updated sapmoni patch to provide documentation -- made it work with threaded perl-5.8 -- added patch to be able to use nagios-plugins-sap -- fix neededforbuild -- update to 1.0b4 - * Address field in host definitions is now optional in - template-based config format. Defaults to host name if not - specified. - * Fixed memory leak when processing passive checks - * Added illegal_macro_output_chars variable to main config file - to allow for stripping dangerous shell characters from plugin - output -- removed -devel subpackage and moved the file to main-package -- update to 1.0b3 - * Bug fixes in template-based object code - * Bug fix in tac CGI for counting host and service states - properly - * Default is now to check for external commands as often as - possible - * Ping syntax for WAP interface moved to CGI config file - * Command file user/group defaults to Nagios user/group unless - overridden with configure script options - * Sample template-based object config file fixes -- update to 1.0b2 - * Fixed bug with escaping strings for DB support - (MySQL & PostgreSQL) - * Several bug fixes in template-based object code - * Multiple hostgroups supported in host and service escalations - * Wildcard support in service, service escalation, and host - escalation definitions -- install config-file templates -- initial version of Nagios (the successor of NetSaint) - - - - - - - - - - -- fixed possible buffer overflow in CGI scripts (#140494) - (CVE-2006-2162) -- converted neededforbuild to BuildRequires -- fixed off-by-one overflow (#141124) -- update to stable version 1.3 -- fixed autobuild warnings about printf format -- fixed compiler errors about usage of uninitialized vars -- Compile with GCC4. -- removed apache1 traces -- fix compiler-warnings -- update to nagios 1.2 -- /usr/lib/nagios and /usr/lib/nagios/plugins are owned - by root (#31100) -- add apache2 config-files, require http_daemon - and need apache2-devel-packages for build (#30157) -- remove traceroute-lbl from neededforbuild - traceroute from net-tools is used anyway -- added activation meta-data to sysconfig (#28830) -- change cmdgrp from nogroup to www (the group apache now runs - under) [#21782] -- implement try-restart correctly -- use stop/restart macros -- Fix chown invocation. -- added bugfixes -- Make sure plugin directory exist -- Add nagios libdir to filelist -- update to bugfix release 1.1 - * File descriptor leak in file-based performance routines - * Timestamp fix for PostgreSQL 7.3 - * Minor bug fixes to cmd and history CGIs - * Minor documentation fixes -- added sysconfig-metadata (#22607) -- adopted sapmoni.dif for gcc 3.3 -- update to 1.0 final - * Minor bug fixes in CGIs - * Minor doc updates - * Bug fix for flex host downtime - * Embedded perl bug fixe for arguments with spaces - * Host escalation logic fix -- running pre-flight configuration check always when - starting nagios (#20916) -- added logrotate definitions for logfiles -- fixed embedded perl (#20916) (thanks to mls) -- update to 1.0b6 - * Added wildcards and multiple hosts/hostgroups to host dependency - and service dependency definitions - * Added wildcard support for members directive in hostgroup - definitions - * Minor bug fixes and cleanups in CGIs - * Minor cleanups in the core - * New version of snprintf() included that supports %f - * Notification interval for escalations now defaults to - non-escalated value -- update to 1.0b5 - * Fixed memory leak related to processing of passive checks - * Memory leak fixes in the CGIs - * Minor interface changes to the status and TAC CGIs - * Bug fix in the notification CGI - * Added minimalistic sample object config file (minimal.cfg) -- added PreReq (Bug #17938 #17939) -- updated sapmoni patch to provide documentation -- made it work with threaded perl-5.8 -- added patch to be able to use nagios-plugins-sap -- fix neededforbuild -- update to 1.0b4 - * Address field in host definitions is now optional in - template-based config format. Defaults to host name if not - specified. - * Fixed memory leak when processing passive checks - * Added illegal_macro_output_chars variable to main config file - to allow for stripping dangerous shell characters from plugin - output -- removed -devel subpackage and moved the file to main-package -- update to 1.0b3 - * Bug fixes in template-based object code - * Bug fix in tac CGI for counting host and service states - properly - * Default is now to check for external commands as often as - possible - * Ping syntax for WAP interface moved to CGI config file - * Command file user/group defaults to Nagios user/group unless - overridden with configure script options - * Sample template-based object config file fixes -- update to 1.0b2 - * Fixed bug with escaping strings for DB support - (MySQL & PostgreSQL) - * Several bug fixes in template-based object code - * Multiple hostgroups supported in host and service escalations - * Wildcard support in service, service escalation, and host - escalation definitions -- install config-file templates -- initial version of Nagios (the successor of NetSaint) - - - - - - - - - - -- fixed possible buffer overflow in CGI scripts (#140494) - (CVE-2006-2162) -- converted neededforbuild to BuildRequires -- fixed off-by-one overflow (#141124) -- update to stable version 1.3 -- fixed autobuild warnings about printf format -- fixed compiler errors about usage of uninitialized vars -- Compile with GCC4. -- removed apache1 traces -- fix compiler-warnings -- update to nagios 1.2 -- /usr/lib/nagios and /usr/lib/nagios/plugins are owned - by root (#31100) -- add apache2 config-files, require http_daemon - and need apache2-devel-packages for build (#30157) -- remove traceroute-lbl from neededforbuild - traceroute from net-tools is used anyway -- added activation meta-data to sysconfig (#28830) -- change cmdgrp from nogroup to www (the group apache now runs - under) [#21782] -- implement try-restart correctly -- use stop/restart macros -- Fix chown invocation. -- added bugfixes -- Make sure plugin directory exist -- Add nagios libdir to filelist -- update to bugfix release 1.1 - * File descriptor leak in file-based performance routines - * Timestamp fix for PostgreSQL 7.3 - * Minor bug fixes to cmd and history CGIs - * Minor documentation fixes -- added sysconfig-metadata (#22607) -- adopted sapmoni.dif for gcc 3.3 -- update to 1.0 final - * Minor bug fixes in CGIs - * Minor doc updates - * Bug fix for flex host downtime - * Embedded perl bug fixe for arguments with spaces - * Host escalation logic fix -- running pre-flight configuration check always when - starting nagios (#20916) -- added logrotate definitions for logfiles -- fixed embedded perl (#20916) (thanks to mls) -- update to 1.0b6 - * Added wildcards and multiple hosts/hostgroups to host dependency - and service dependency definitions - * Added wildcard support for members directive in hostgroup - definitions - * Minor bug fixes and cleanups in CGIs - * Minor cleanups in the core - * New version of snprintf() included that supports %f - * Notification interval for escalations now defaults to - non-escalated value -- update to 1.0b5 - * Fixed memory leak related to processing of passive checks - * Memory leak fixes in the CGIs - * Minor interface changes to the status and TAC CGIs - * Bug fix in the notification CGI - * Added minimalistic sample object config file (minimal.cfg) -- added PreReq (Bug #17938 #17939) -- updated sapmoni patch to provide documentation -- made it work with threaded perl-5.8 -- added patch to be able to use nagios-plugins-sap -- fix neededforbuild -- update to 1.0b4 - * Address field in host definitions is now optional in - template-based config format. Defaults to host name if not - specified. - * Fixed memory leak when processing passive checks - * Added illegal_macro_output_chars variable to main config file - to allow for stripping dangerous shell characters from plugin - output -- removed -devel subpackage and moved the file to main-package -- update to 1.0b3 - * Bug fixes in template-based object code - * Bug fix in tac CGI for counting host and service states - properly - * Default is now to check for external commands as often as - possible - * Ping syntax for WAP interface moved to CGI config file - * Command file user/group defaults to Nagios user/group unless - overridden with configure script options - * Sample template-based object config file fixes -- update to 1.0b2 - * Fixed bug with escaping strings for DB support - (MySQL & PostgreSQL) - * Several bug fixes in template-based object code - * Multiple hostgroups supported in host and service escalations - * Wildcard support in service, service escalation, and host - escalation definitions -- install config-file templates -- initial version of Nagios (the successor of NetSaint) - - - - - - - - - -- Fix 64-bit build (use pkg-config like we should) -- Ask dhclient to set the hostname as required by the sysconfig - option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532) -- Fix possible memory corruption -- Log debugging spew less readily (Novell bug #161138) -- Survive DBUS restarts (Novell bug #150042) -- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call - to getdtablesize() to fix build on beta and remove use of - NR_OPEN. -- converted neededforbuild to BuildRequires -- 1.12 (bug fixes only) -- Remove named user from dhcdbd.conf -- Use correct lease directory (fix bug #139606) -- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf -- Update to 1.11 (fixes build against DBUS 0.60) -- Remove dhcdbd service file and do not create named user or - group (#136872) -- create named user and group (since referenced in config) - fixing (#136872) -- Upgrade to 1.10 (includes our two patches). -- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to - dhclient in order to minimize noise. -- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of - hand-coded daemonizing code. Also ensures that stdout and stderr - are redirected to /dev/null, not /dev/console. -- Update to dhcdbd 1.9 -- changed requires (#104373) -- Remove init script for rml, no longer needed -- Change requires for rml -- created package taken from FC -- first steps to adapt init script - - - - - - - - - -- Fix 64-bit build (use pkg-config like we should) -- Ask dhclient to set the hostname as required by the sysconfig - option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532) -- Fix possible memory corruption -- Log debugging spew less readily (Novell bug #161138) -- Survive DBUS restarts (Novell bug #150042) -- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call - to getdtablesize() to fix build on beta and remove use of - NR_OPEN. -- converted neededforbuild to BuildRequires -- 1.12 (bug fixes only) -- Remove named user from dhcdbd.conf -- Use correct lease directory (fix bug #139606) -- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf -- Update to 1.11 (fixes build against DBUS 0.60) -- Remove dhcdbd service file and do not create named user or - group (#136872) -- create named user and group (since referenced in config) - fixing (#136872) -- Upgrade to 1.10 (includes our two patches). -- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to - dhclient in order to minimize noise. -- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of - hand-coded daemonizing code. Also ensures that stdout and stderr - are redirected to /dev/null, not /dev/console. -- Update to dhcdbd 1.9 -- changed requires (#104373) -- Remove init script for rml, no longer needed -- Change requires for rml -- created package taken from FC -- first steps to adapt init script - - - - - - - - - -- Fix 64-bit build (use pkg-config like we should) -- Ask dhclient to set the hostname as required by the sysconfig - option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532) -- Fix possible memory corruption -- Log debugging spew less readily (Novell bug #161138) -- Survive DBUS restarts (Novell bug #150042) -- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call - to getdtablesize() to fix build on beta and remove use of - NR_OPEN. -- converted neededforbuild to BuildRequires -- 1.12 (bug fixes only) -- Remove named user from dhcdbd.conf -- Use correct lease directory (fix bug #139606) -- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf -- Update to 1.11 (fixes build against DBUS 0.60) -- Remove dhcdbd service file and do not create named user or - group (#136872) -- create named user and group (since referenced in config) - fixing (#136872) -- Upgrade to 1.10 (includes our two patches). -- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to - dhclient in order to minimize noise. -- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of - hand-coded daemonizing code. Also ensures that stdout and stderr - are redirected to /dev/null, not /dev/console. -- Update to dhcdbd 1.9 -- changed requires (#104373) -- Remove init script for rml, no longer needed -- Change requires for rml -- created package taken from FC -- first steps to adapt init script - - - - - - - - - -- Fix 64-bit build (use pkg-config like we should) -- Ask dhclient to set the hostname as required by the sysconfig - option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532) -- Fix possible memory corruption -- Log debugging spew less readily (Novell bug #161138) -- Survive DBUS restarts (Novell bug #150042) -- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call - to getdtablesize() to fix build on beta and remove use of - NR_OPEN. -- converted neededforbuild to BuildRequires -- 1.12 (bug fixes only) -- Remove named user from dhcdbd.conf -- Use correct lease directory (fix bug #139606) -- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf -- Update to 1.11 (fixes build against DBUS 0.60) -- Remove dhcdbd service file and do not create named user or - group (#136872) -- create named user and group (since referenced in config) - fixing (#136872) -- Upgrade to 1.10 (includes our two patches). -- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to - dhclient in order to minimize noise. -- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of - hand-coded daemonizing code. Also ensures that stdout and stderr - are redirected to /dev/null, not /dev/console. -- Update to dhcdbd 1.9 -- changed requires (#104373) -- Remove init script for rml, no longer needed -- Change requires for rml -- created package taken from FC -- first steps to adapt init script - - - - - - - - -- Really apply the patch for Bug#160566 -- slapd could crash while processing queries with pre-/postread - controls (Bug#173877, ITS#4532) -- Backported fix from CVS for occasional crashes in referral - chasing code (as used in e.g. back-meta/back-ldap). - (Bug: #160566, ITS: #4448) -- openldap2 must obsolete -back-monitor and -back-ldap to have them - removed during update (Bug: #157576) -- Add "external" to the list of supported SASL mechanisms - (Bug: #151771) -- Error out when conversion from old configfile to config database - fails (Bug: #135484,#135490 ITS: #4407) -- Don't ignore non-read/write epoll events (Bug: #149993, - ITS: #4395) -- Added update message to /usr/share/update-messages/en/ and enable - it, when update did not succeed. -- OPENLDAP_CHOWN_DIRS honors databases defined in include files - (Bug: #135473) -- Fixed version numbers in README.update -- Fixed GSSAPI binds against Active Directory (Bug: #149390) -- Cleaned up update procedure -- man-pages updates and fixes (Fate: #6365) -- Updated to 2.3.19 (Bug #144371) -- converted neededforbuild to BuildRequires -- Updated Admin Guide to latest version -- build slapcat from openldap-2.2.24 and install it to - /usr/sbin/openldap-2.2-slapcat to be able to migrate from - OpenLDAP 2.2. -- removed slapd-backbdb-dbupgrade which is no longer needed -- attempt to dump/reload bdb databases in %{post} -- Update notes in README.update -- New sysconfig variable OPENLDAP_KRB5_KEYTAB -- Cleanup in default configuration and init scripts -- Updated to 2.3.17 -- Remove OPENLDAP_RUN_DB_RECOVER from sysconfig file in %post - slapd does now automatically recover the database if needed -- Removed unneeded README.SuSE -- Small adjustments to the default DB_CONFIG file -- Updated to 2.3.16 -- Fixed filelist (slapd-hdb man-page was missing) -- Fixed build on x86_64 -- Merged -back-ldap and -back-monitor subpackages into the main - package and don't build them as dynamic modules anymore. -- updated to OpenLDAP 2.3.13 -- updated to OpenLDAP 2.3.12 -- updated to OpenLDAP 2.3.11 -- removed the "LDAP_DEPRECATED" workaround -- Add "LDAP_DEPRECATED" to ldap.h for now -- updated to OpenLDAP 2.3.7 -- allow start_tls while chasing referrals (Bug #94355, ITS #3791) -- devel-subpackage requires openldap2-client of the same version - (Bugzilla: #93579) -- build with -fPIE (not -fpie) to avoid GOT overflow on s390* -- build the server packages with -fpie/-pie -- updated to 2.2.27 -- libldap-gethostbyname_r.dif: Use gethostbyname_r instead of - gethostbyname in libldap. Should fix host lookups through - nss_ldap (Bugzilla: #76173) -- Updated to 2.2.26 -- made /%{_libdir}]/sasl2/slapd.conf %config(noreplace) -- Added /%{_libdir}]/sasl2/slapd.conf to avoid warnings about - unconfigured OTP mechanism (Bugzilla: #80588) -- added minimal timeout to startproc in init-script to let it - report the "failed" status correctly in case of misconfiguration - (Bugzilla: #76393) -- crl-check.dif: Implements CRL checking on client and server side -- use different base ports for differnt values of BUILD_INCARNATION - (/.buildenv) to allow parallel runs of the test-suite on a single - machine -- force yielding-select test to yes (test occasionally hangs QEMU) -- disable test suite on ARM (hangs QEMU) -- updated to 2.2.24 -- enabled back-hdb -- syncrepl.dif: merged latest syncrepl fixes (Bugzilla: #65928) -- libldap-reinit-fdset.dif: Re-init fd_sets when select is - interupted (Bugzilla #50076, ITS: #3524) -- checkproc_before_recover.dif: Check if slapd is stopped before - running db_recover from the init script. (Bugzilla: #50962) -- Cleanup back-bdb databases in %post, db-4.3 changed the - transaction log format again. -- cosmetic fixes in init script -- updated to 2.2.23 -- cleaned up #neededforbuild -- package should also build on older SuSE Linux releases now -- increased killproc timeout in init-script (Bugzilla: #47227) -- updated to 2.2.20 -- Removed unneeded dependencies -- don't install *.la files -- updated to 2.2.18 -- use kerberos-devel-packages in neededforbuild -- re-arranged specfile to sequence (header (package/descr)* rest) - so the checking parser is not confused ... -- Added pre_checkin.sh to generate a separate openldap2-client - spec-file from which the openldap2-client and openldap2-devel - subpackages are built. Should reduce build time for libldap as - the test-suite is only executed in openldap2.spec. -- libldap-result.dif: ldapsearch was hanging in select() when - retrieving results from eDirectory through a StartTLS protected - connection (Bugzilla #44942) -- added ntlm support -- updated to 2.2.16 -- Updated ACLs in slapd_conf.dif to disable default read access - to the "userPKCS12" Attribute -- rc-check-conn.diff: When starting slapd wait until is accepts - connections, or 10 seconds at maximum (Bugzilla #41354) -- Backported -o slp={on|off} feature from OpenLDAP Head and added - new sysconfig variable (OPENLDAP_REGISTER_SLP) to be able - to switch SLP registration on and off. (Bugzilla #39865) -- removed unneeded README.update -- updated to 2.2.11 -- remove SLES8 update specific stuff -- Bugzilla #39652: Updated slapd_conf.dif to contain basic access - control -- Bugzilla #39468: Added missing items to yast.schema -- fixed strict-aliasing compiler warnings (strict-aliasing.dif) -- build with several jobs if available -- ldapi_url.dif: Fixed paths for LDAPI-socket, pid-file and - args-file (Bugzilla #38790) -- ldbm_modrdn.dif: Fixed back-ldbm modrdn indexing bug (ITS #3059, - Bugzilla #38915) -- modify_check_duplicates.dif: check for duplicate attribute - values in modify requests (ITS #3066/#3097, Bugzilla #38607) -- updated and renamed yast2userconfig.schema to yast.schema as it - contains more that only user configuration now -- syncrepl.dif: addtional fixes for syncrepl (ITS #3055, #3056) -- test_syncrepl_timeout: increased sleep timeout in syncrepl - testsuite -- added "TLS_REQCERT allow" to /etc/openldap/ldap.conf, to make - START_TLS work without access to the CA Certificate. - (Bugzilla: #37393) -- fixed filelist -- check-build.sh (build on kernel >= 2.6.4 hosts only) -- yast2user.schema / slapd.conf fixed (#37076) -- don't check for TLS-options is init-script anymore (#33560) -- fixed various typos in README.update -- fixed build of openldap-2.1-slapcat (using correct db41 include - files, build backends as on sles8) -- attempt to update bdb database and reindex ldbm database in %{post} -- Update notes in README.update -- better default configuration (including default DB_CONFIG file) -- misc updates for the YaST schema -- fixed crasher in syncrepl-code (syncrepl.dif) -- Fix type mismatch. -- updated to 2.2.6 -- build a openldap-2.1-slapcat from 2.1.25 sources to be able to - migrate from SLES8 and SL 9.0 -- added check-build.sh (build on 2.6 hosts only) -- updated to 2.2.5 -- adjusted rfc2307bis.schema to support UTF-8 values in most - attributes -- enabled proxycache-overlay (wiht fix to work with back-ldbm) -- updated to 2.2.4 -- updated Admin Guide to most recent version -- add %defattr -- fix build as user -- updated to 2.1.25 -- small fixes for the YaST user schema -- enabled SLP-support -- Remove unused des from neededforbuild -- Bugzilla #29859: fixed typo in sysconfig metadata, - usage of OPENLDAP_LDAPS_INTERFACES in init script -- added /usr/lib/sasl2/slapd.conf permissions handling -- added sysconfig variable OPENLDAP_SLAPD_PARAMS="" - to support additional slapd start parameters -- added sysconfig variable OPENLDAP_START_LDAPI=NO/yes - for ldapi:/// (LDAP over IPC) URLs -- added activation metadata to sysconfig template (Bugzilla #28911) -- removed lint from specfile -- added %stop_on_removal and %restart_on_update calls -- bdb_addcnt.dif fixes a possible endless loop in id2entry() -- addonschema.tar.gz: some extra Schema files (YaST, RFC2307bis) -- removed fillup_only and call fillup_and_insserv correctly -- new Options in sysconfig.openldap: OPENLDAP_LDAP_INTERFACES, - OPENLDAP_LDAPS_INTERFACES and OPENLDAP_RUN_DB_RECOVER -- updated to 2.1.22 -- updated Admin Guide to most recent version -- build librewrite with -fPIC -- updated to 2.1.21 -- fixed requires lines -- don't link back-ldap against librewrite.a, it's already linked - into slapd (package should build on non-i386 Archs again) -- fixed dynamic build of back-ldap -- new subpackage back-ldap -- updated to version 2.1.20 -- enabled dynamic backend modules -- new subpackages back-perl, back-meta and back-monitor -- remove unpacked files from BuildRoot -- updated to version 2.1.19 -- fixed requires for devel-package ... -- fixed neededforbuild -- Enable IPv6 again -- added /etc/openldap to filelist -- switch default backend to ldbm -- fixed requires for devel package (cyrus-sasl2-devel) -- liblber.dif: Fixes two bugs in liblber by which remote attackers - could crash the LDAP server (Bugzilla #22469, OpenLDAP ITS #2275 - and #2280) -- build using sasl2 -- updated to version 2.1.12 -- added metadata to sysconfig template (Bug: #22666) -- updated to version 2.1.8 -- added additional fix of 64bit archs -- added secpatch.dif to fix setuid issues in libldap -- fix for Bugzilla ID #18981, chown to OPENLDAP_USER didn't work - with multiple database backend directories -- removed damoenstart_ipv6.diff and disabled IPv6 support due to - massive problems with nss_ldap -- ldap_user.dif: slapd is now run a the user/group ldap (Bugzilla - ID#17697) -- updated to version 2.1.4, which fixes tons of bugs -- added damoenstart_ipv6.diff (slapd was not starting when - configured to listen on IPv4 and IPv6 interfaces, as done by the - start script) -- added README.SuSE with some hints about the bdb-backend -- updated filelist to include only the man pages of the backends, - that were built -- removed termcap and readline from neededforbuild -- enabled {CRYPT} passwords -- update filelist (added new manpages) -- patches for 64 bit architectures -- update to 2.1.3 -- fix openldap2-devel requires -- switched back from cyrus-sasl2 to cyrus-sasl -- updated to OpenLDAP 2.1.2 -- added the OpenLDAP Administration Guide -- enabled additional backends (ldap, meta, monitor) -- hack build/ltconfig to build shared libs on ppc64 -- created /etc/sysconfig/openldap and OPENLDAP_START_LDAPS variable - to enable ldap over ssl support -- Fix for Bugzilla ID#14569 (added cyrus-sasl-devel openssl-devel - to the "Requires" Section of the -devel subpackage) -- updated to the latest STABLE release (2.0.23) which fixes some - nasty bugs see ITS #1562,#1582,#1577,#1578 -- updated to the latest release (which fixes a index corruption - bug) -- cleanup in neededforbuild -- small fixes for the init-scripts -- updated to the latest stable release (2.0.21) -- removed periods and colons from startup/shutdown messages -- updated to v2.0.20 (which fixes a security hole in ACL - processing) -- converted archive to bzip2 -- makes use of %{_libdir} now -- set CFLAGS to -O0 for archs ia64, s390(x) and alpha otherwise - the test suite fails on these archs -- changed slapd.conf to store the database under /var/lib/ldap - (this patch was missing in the last versions by accident) -- update to v2.0.19 -- eliminated START_LDAP, START_SLURPD variables in rc.config -- created separate init script for slurpd -- moved init scripts from dif to separate source tgz -- update to v2.0.18 -- update to v2.0.17 - added a sleep to the restart section - moved some manpages to the client package -- update to v2.0.15 -- backported the full bugfix from openldap-2.0.14 -- Bugfix for slurpd millionth second bug (ITS#1323) -- moved ldapfilter.conf ldaptemplates.conf ldapsearchprefs.conf - to openldap2-client package -- update to version 2.0.12 -- bugfix: init script was not LSB compliant, Bugzilla ID#9072 -- fixed for autoconf again -- update to 2.0.11 -- removed autoconf in specfile, because it doesn't work -- update to version 2.0.10 (minor fixes) -- update to version 2.0.9 -- removed kerberos support -- added aci support -- added kerberos support -- moved section 5 and 8 manpages to the server part of package -- Move *.so links into -devel package -- -devel requires -client -- split up into openldap2-client and -devel -- changed neededforbuild <cyrus-sasl> to <cyrus-sasl cyrus-sasl-devel> -- added readline/readline-devel to neededforbuild (split from bash) -- bugfix: slapd.conf rename /var/lib/openldap-ldbm to - /var/lib/ldap - init script: use $remote_fs -- use script name in %post -- bugfix from Andreas Jaeger: - workaround for glibc2.2, detach -- hacked configure for apparently broken pthread -- fixed spec -- made configs %config(noreplace) (Bug 4112) -- fixed neededforbuild -- adopted new init scheme -- fixed neededforbuild -- added buildroot -- long package name -- new version, 2.0.7 -- first package of openldap2 (v2.0.6) - - - - - - - - -- Really apply the patch for Bug#160566 -- slapd could crash while processing queries with pre-/postread - controls (Bug#173877, ITS#4532) -- Backported fix from CVS for occasional crashes in referral - chasing code (as used in e.g. back-meta/back-ldap). - (Bug: #160566, ITS: #4448) -- openldap2 must obsolete -back-monitor and -back-ldap to have them - removed during update (Bug: #157576) -- Add "external" to the list of supported SASL mechanisms - (Bug: #151771) -- Error out when conversion from old configfile to config database - fails (Bug: #135484,#135490 ITS: #4407) -- Don't ignore non-read/write epoll events (Bug: #149993, - ITS: #4395) -- Added update message to /usr/share/update-messages/en/ and enable - it, when update did not succeed. -- OPENLDAP_CHOWN_DIRS honors databases defined in include files - (Bug: #135473) -- Fixed version numbers in README.update -- Fixed GSSAPI binds against Active Directory (Bug: #149390) -- Cleaned up update procedure -- man-pages updates and fixes (Fate: #6365) -- Updated to 2.3.19 (Bug #144371) -- converted neededforbuild to BuildRequires -- Updated Admin Guide to latest version -- build slapcat from openldap-2.2.24 and install it to - /usr/sbin/openldap-2.2-slapcat to be able to migrate from - OpenLDAP 2.2. -- removed slapd-backbdb-dbupgrade which is no longer needed -- attempt to dump/reload bdb databases in %{post} -- Update notes in README.update -- New sysconfig variable OPENLDAP_KRB5_KEYTAB -- Cleanup in default configuration and init scripts -- Updated to 2.3.17 -- Remove OPENLDAP_RUN_DB_RECOVER from sysconfig file in %post - slapd does now automatically recover the database if needed -- Removed unneeded README.SuSE -- Small adjustments to the default DB_CONFIG file -- Updated to 2.3.16 -- Fixed filelist (slapd-hdb man-page was missing) -- Fixed build on x86_64 -- Merged -back-ldap and -back-monitor subpackages into the main - package and don't build them as dynamic modules anymore. -- updated to OpenLDAP 2.3.13 -- updated to OpenLDAP 2.3.12 -- updated to OpenLDAP 2.3.11 -- removed the "LDAP_DEPRECATED" workaround -- Add "LDAP_DEPRECATED" to ldap.h for now -- updated to OpenLDAP 2.3.7 -- allow start_tls while chasing referrals (Bug #94355, ITS #3791) -- devel-subpackage requires openldap2-client of the same version - (Bugzilla: #93579) -- build with -fPIE (not -fpie) to avoid GOT overflow on s390* -- build the server packages with -fpie/-pie -- updated to 2.2.27 -- libldap-gethostbyname_r.dif: Use gethostbyname_r instead of - gethostbyname in libldap. Should fix host lookups through - nss_ldap (Bugzilla: #76173) -- Updated to 2.2.26 -- made /%{_libdir}]/sasl2/slapd.conf %config(noreplace) -- Added /%{_libdir}]/sasl2/slapd.conf to avoid warnings about - unconfigured OTP mechanism (Bugzilla: #80588) -- added minimal timeout to startproc in init-script to let it - report the "failed" status correctly in case of misconfiguration - (Bugzilla: #76393) -- crl-check.dif: Implements CRL checking on client and server side -- use different base ports for differnt values of BUILD_INCARNATION - (/.buildenv) to allow parallel runs of the test-suite on a single - machine -- force yielding-select test to yes (test occasionally hangs QEMU) -- disable test suite on ARM (hangs QEMU) -- updated to 2.2.24 -- enabled back-hdb -- syncrepl.dif: merged latest syncrepl fixes (Bugzilla: #65928) -- libldap-reinit-fdset.dif: Re-init fd_sets when select is - interupted (Bugzilla #50076, ITS: #3524) -- checkproc_before_recover.dif: Check if slapd is stopped before - running db_recover from the init script. (Bugzilla: #50962) -- Cleanup back-bdb databases in %post, db-4.3 changed the - transaction log format again. -- cosmetic fixes in init script -- updated to 2.2.23 -- cleaned up #neededforbuild -- package should also build on older SuSE Linux releases now -- increased killproc timeout in init-script (Bugzilla: #47227) -- updated to 2.2.20 -- Removed unneeded dependencies -- don't install *.la files -- updated to 2.2.18 -- use kerberos-devel-packages in neededforbuild -- re-arranged specfile to sequence (header (package/descr)* rest) - so the checking parser is not confused ... -- Added pre_checkin.sh to generate a separate openldap2-client - spec-file from which the openldap2-client and openldap2-devel - subpackages are built. Should reduce build time for libldap as - the test-suite is only executed in openldap2.spec. -- libldap-result.dif: ldapsearch was hanging in select() when - retrieving results from eDirectory through a StartTLS protected - connection (Bugzilla #44942) -- added ntlm support -- updated to 2.2.16 -- Updated ACLs in slapd_conf.dif to disable default read access - to the "userPKCS12" Attribute -- rc-check-conn.diff: When starting slapd wait until is accepts - connections, or 10 seconds at maximum (Bugzilla #41354) -- Backported -o slp={on|off} feature from OpenLDAP Head and added - new sysconfig variable (OPENLDAP_REGISTER_SLP) to be able - to switch SLP registration on and off. (Bugzilla #39865) -- removed unneeded README.update -- updated to 2.2.11 -- remove SLES8 update specific stuff -- Bugzilla #39652: Updated slapd_conf.dif to contain basic access - control -- Bugzilla #39468: Added missing items to yast.schema -- fixed strict-aliasing compiler warnings (strict-aliasing.dif) -- build with several jobs if available -- ldapi_url.dif: Fixed paths for LDAPI-socket, pid-file and - args-file (Bugzilla #38790) -- ldbm_modrdn.dif: Fixed back-ldbm modrdn indexing bug (ITS #3059, - Bugzilla #38915) -- modify_check_duplicates.dif: check for duplicate attribute - values in modify requests (ITS #3066/#3097, Bugzilla #38607) -- updated and renamed yast2userconfig.schema to yast.schema as it - contains more that only user configuration now -- syncrepl.dif: addtional fixes for syncrepl (ITS #3055, #3056) -- test_syncrepl_timeout: increased sleep timeout in syncrepl - testsuite -- added "TLS_REQCERT allow" to /etc/openldap/ldap.conf, to make - START_TLS work without access to the CA Certificate. - (Bugzilla: #37393) -- fixed filelist -- check-build.sh (build on kernel >= 2.6.4 hosts only) -- yast2user.schema / slapd.conf fixed (#37076) -- don't check for TLS-options is init-script anymore (#33560) -- fixed various typos in README.update -- fixed build of openldap-2.1-slapcat (using correct db41 include - files, build backends as on sles8) -- attempt to update bdb database and reindex ldbm database in %{post} -- Update notes in README.update -- better default configuration (including default DB_CONFIG file) -- misc updates for the YaST schema -- fixed crasher in syncrepl-code (syncrepl.dif) -- Fix type mismatch. -- updated to 2.2.6 -- build a openldap-2.1-slapcat from 2.1.25 sources to be able to - migrate from SLES8 and SL 9.0 -- added check-build.sh (build on 2.6 hosts only) -- updated to 2.2.5 -- adjusted rfc2307bis.schema to support UTF-8 values in most - attributes -- enabled proxycache-overlay (wiht fix to work with back-ldbm) -- updated to 2.2.4 -- updated Admin Guide to most recent version -- add %defattr -- fix build as user -- updated to 2.1.25 -- small fixes for the YaST user schema -- enabled SLP-support -- Remove unused des from neededforbuild -- Bugzilla #29859: fixed typo in sysconfig metadata, - usage of OPENLDAP_LDAPS_INTERFACES in init script -- added /usr/lib/sasl2/slapd.conf permissions handling -- added sysconfig variable OPENLDAP_SLAPD_PARAMS="" - to support additional slapd start parameters -- added sysconfig variable OPENLDAP_START_LDAPI=NO/yes - for ldapi:/// (LDAP over IPC) URLs -- added activation metadata to sysconfig template (Bugzilla #28911) -- removed lint from specfile -- added %stop_on_removal and %restart_on_update calls -- bdb_addcnt.dif fixes a possible endless loop in id2entry() -- addonschema.tar.gz: some extra Schema files (YaST, RFC2307bis) -- removed fillup_only and call fillup_and_insserv correctly -- new Options in sysconfig.openldap: OPENLDAP_LDAP_INTERFACES, - OPENLDAP_LDAPS_INTERFACES and OPENLDAP_RUN_DB_RECOVER -- updated to 2.1.22 -- updated Admin Guide to most recent version -- build librewrite with -fPIC -- updated to 2.1.21 -- fixed requires lines -- don't link back-ldap against librewrite.a, it's already linked - into slapd (package should build on non-i386 Archs again) -- fixed dynamic build of back-ldap -- new subpackage back-ldap -- updated to version 2.1.20 -- enabled dynamic backend modules -- new subpackages back-perl, back-meta and back-monitor -- remove unpacked files from BuildRoot -- updated to version 2.1.19 -- fixed requires for devel-package ... -- fixed neededforbuild -- Enable IPv6 again -- added /etc/openldap to filelist -- switch default backend to ldbm -- fixed requires for devel package (cyrus-sasl2-devel) -- liblber.dif: Fixes two bugs in liblber by which remote attackers - could crash the LDAP server (Bugzilla #22469, OpenLDAP ITS #2275 - and #2280) -- build using sasl2 -- updated to version 2.1.12 -- added metadata to sysconfig template (Bug: #22666) -- updated to version 2.1.8 -- added additional fix of 64bit archs -- added secpatch.dif to fix setuid issues in libldap -- fix for Bugzilla ID #18981, chown to OPENLDAP_USER didn't work - with multiple database backend directories -- removed damoenstart_ipv6.diff and disabled IPv6 support due to - massive problems with nss_ldap -- ldap_user.dif: slapd is now run a the user/group ldap (Bugzilla - ID#17697) -- updated to version 2.1.4, which fixes tons of bugs -- added damoenstart_ipv6.diff (slapd was not starting when - configured to listen on IPv4 and IPv6 interfaces, as done by the - start script) -- added README.SuSE with some hints about the bdb-backend -- updated filelist to include only the man pages of the backends, - that were built -- removed termcap and readline from neededforbuild -- enabled {CRYPT} passwords -- update filelist (added new manpages) -- patches for 64 bit architectures -- update to 2.1.3 -- fix openldap2-devel requires -- switched back from cyrus-sasl2 to cyrus-sasl -- updated to OpenLDAP 2.1.2 -- added the OpenLDAP Administration Guide -- enabled additional backends (ldap, meta, monitor) -- hack build/ltconfig to build shared libs on ppc64 -- created /etc/sysconfig/openldap and OPENLDAP_START_LDAPS variable - to enable ldap over ssl support -- Fix for Bugzilla ID#14569 (added cyrus-sasl-devel openssl-devel - to the "Requires" Section of the -devel subpackage) -- updated to the latest STABLE release (2.0.23) which fixes some - nasty bugs see ITS #1562,#1582,#1577,#1578 -- updated to the latest release (which fixes a index corruption - bug) -- cleanup in neededforbuild -- small fixes for the init-scripts -- updated to the latest stable release (2.0.21) -- removed periods and colons from startup/shutdown messages -- updated to v2.0.20 (which fixes a security hole in ACL - processing) -- converted archive to bzip2 -- makes use of %{_libdir} now -- set CFLAGS to -O0 for archs ia64, s390(x) and alpha otherwise - the test suite fails on these archs -- changed slapd.conf to store the database under /var/lib/ldap - (this patch was missing in the last versions by accident) -- update to v2.0.19 -- eliminated START_LDAP, START_SLURPD variables in rc.config -- created separate init script for slurpd -- moved init scripts from dif to separate source tgz -- update to v2.0.18 -- update to v2.0.17 - added a sleep to the restart section - moved some manpages to the client package -- update to v2.0.15 -- backported the full bugfix from openldap-2.0.14 -- Bugfix for slurpd millionth second bug (ITS#1323) -- moved ldapfilter.conf ldaptemplates.conf ldapsearchprefs.conf - to openldap2-client package -- update to version 2.0.12 -- bugfix: init script was not LSB compliant, Bugzilla ID#9072 -- fixed for autoconf again -- update to 2.0.11 -- removed autoconf in specfile, because it doesn't work -- update to version 2.0.10 (minor fixes) -- update to version 2.0.9 -- removed kerberos support -- added aci support -- added kerberos support -- moved section 5 and 8 manpages to the server part of package -- Move *.so links into -devel package -- -devel requires -client -- split up into openldap2-client and -devel -- changed neededforbuild <cyrus-sasl> to <cyrus-sasl cyrus-sasl-devel> -- added readline/readline-devel to neededforbuild (split from bash) -- bugfix: slapd.conf rename /var/lib/openldap-ldbm to - /var/lib/ldap - init script: use $remote_fs -- use script name in %post -- bugfix from Andreas Jaeger: - workaround for glibc2.2, detach -- hacked configure for apparently broken pthread -- fixed spec -- made configs %config(noreplace) (Bug 4112) -- fixed neededforbuild -- adopted new init scheme -- fixed neededforbuild -- added buildroot -- long package name -- new version, 2.0.7 -- first package of openldap2 (v2.0.6) - - - - - - - - -- Really apply the patch for Bug#160566 -- slapd could crash while processing queries with pre-/postread - controls (Bug#173877, ITS#4532) -- Backported fix from CVS for occasional crashes in referral - chasing code (as used in e.g. back-meta/back-ldap). - (Bug: #160566, ITS: #4448) -- openldap2 must obsolete -back-monitor and -back-ldap to have them - removed during update (Bug: #157576) -- Add "external" to the list of supported SASL mechanisms - (Bug: #151771) -- Error out when conversion from old configfile to config database - fails (Bug: #135484,#135490 ITS: #4407) -- Don't ignore non-read/write epoll events (Bug: #149993, - ITS: #4395) -- Added update message to /usr/share/update-messages/en/ and enable - it, when update did not succeed. -- OPENLDAP_CHOWN_DIRS honors databases defined in include files - (Bug: #135473) -- Fixed version numbers in README.update -- Fixed GSSAPI binds against Active Directory (Bug: #149390) -- Cleaned up update procedure -- man-pages updates and fixes (Fate: #6365) -- Updated to 2.3.19 (Bug #144371) -- converted neededforbuild to BuildRequires -- Updated Admin Guide to latest version -- build slapcat from openldap-2.2.24 and install it to - /usr/sbin/openldap-2.2-slapcat to be able to migrate from - OpenLDAP 2.2. -- removed slapd-backbdb-dbupgrade which is no longer needed -- attempt to dump/reload bdb databases in %{post} -- Update notes in README.update -- New sysconfig variable OPENLDAP_KRB5_KEYTAB -- Cleanup in default configuration and init scripts -- Updated to 2.3.17 -- Remove OPENLDAP_RUN_DB_RECOVER from sysconfig file in %post - slapd does now automatically recover the database if needed -- Removed unneeded README.SuSE -- Small adjustments to the default DB_CONFIG file -- Updated to 2.3.16 -- Fixed filelist (slapd-hdb man-page was missing) -- Fixed build on x86_64 -- Merged -back-ldap and -back-monitor subpackages into the main - package and don't build them as dynamic modules anymore. -- updated to OpenLDAP 2.3.13 -- updated to OpenLDAP 2.3.12 -- updated to OpenLDAP 2.3.11 -- removed the "LDAP_DEPRECATED" workaround -- Add "LDAP_DEPRECATED" to ldap.h for now -- updated to OpenLDAP 2.3.7 -- allow start_tls while chasing referrals (Bug #94355, ITS #3791) -- devel-subpackage requires openldap2-client of the same version - (Bugzilla: #93579) -- build with -fPIE (not -fpie) to avoid GOT overflow on s390* -- build the server packages with -fpie/-pie -- updated to 2.2.27 -- libldap-gethostbyname_r.dif: Use gethostbyname_r instead of - gethostbyname in libldap. Should fix host lookups through - nss_ldap (Bugzilla: #76173) -- Updated to 2.2.26 -- made /%{_libdir}]/sasl2/slapd.conf %config(noreplace) -- Added /%{_libdir}]/sasl2/slapd.conf to avoid warnings about - unconfigured OTP mechanism (Bugzilla: #80588) -- added minimal timeout to startproc in init-script to let it - report the "failed" status correctly in case of misconfiguration - (Bugzilla: #76393) -- crl-check.dif: Implements CRL checking on client and server side -- use different base ports for differnt values of BUILD_INCARNATION - (/.buildenv) to allow parallel runs of the test-suite on a single - machine -- force yielding-select test to yes (test occasionally hangs QEMU) -- disable test suite on ARM (hangs QEMU) -- updated to 2.2.24 -- enabled back-hdb -- syncrepl.dif: merged latest syncrepl fixes (Bugzilla: #65928) -- libldap-reinit-fdset.dif: Re-init fd_sets when select is - interupted (Bugzilla #50076, ITS: #3524) -- checkproc_before_recover.dif: Check if slapd is stopped before - running db_recover from the init script. (Bugzilla: #50962) -- Cleanup back-bdb databases in %post, db-4.3 changed the - transaction log format again. -- cosmetic fixes in init script -- updated to 2.2.23 -- cleaned up #neededforbuild -- package should also build on older SuSE Linux releases now -- increased killproc timeout in init-script (Bugzilla: #47227) -- updated to 2.2.20 -- Removed unneeded dependencies -- don't install *.la files -- updated to 2.2.18 -- use kerberos-devel-packages in neededforbuild -- re-arranged specfile to sequence (header (package/descr)* rest) - so the checking parser is not confused ... -- Added pre_checkin.sh to generate a separate openldap2-client - spec-file from which the openldap2-client and openldap2-devel - subpackages are built. Should reduce build time for libldap as - the test-suite is only executed in openldap2.spec. -- libldap-result.dif: ldapsearch was hanging in select() when - retrieving results from eDirectory through a StartTLS protected - connection (Bugzilla #44942) -- added ntlm support -- updated to 2.2.16 -- Updated ACLs in slapd_conf.dif to disable default read access - to the "userPKCS12" Attribute -- rc-check-conn.diff: When starting slapd wait until is accepts - connections, or 10 seconds at maximum (Bugzilla #41354) -- Backported -o slp={on|off} feature from OpenLDAP Head and added - new sysconfig variable (OPENLDAP_REGISTER_SLP) to be able - to switch SLP registration on and off. (Bugzilla #39865) -- removed unneeded README.update -- updated to 2.2.11 -- remove SLES8 update specific stuff -- Bugzilla #39652: Updated slapd_conf.dif to contain basic access - control -- Bugzilla #39468: Added missing items to yast.schema -- fixed strict-aliasing compiler warnings (strict-aliasing.dif) -- build with several jobs if available -- ldapi_url.dif: Fixed paths for LDAPI-socket, pid-file and - args-file (Bugzilla #38790) -- ldbm_modrdn.dif: Fixed back-ldbm modrdn indexing bug (ITS #3059, - Bugzilla #38915) -- modify_check_duplicates.dif: check for duplicate attribute - values in modify requests (ITS #3066/#3097, Bugzilla #38607) -- updated and renamed yast2userconfig.schema to yast.schema as it - contains more that only user configuration now -- syncrepl.dif: addtional fixes for syncrepl (ITS #3055, #3056) -- test_syncrepl_timeout: increased sleep timeout in syncrepl - testsuite -- added "TLS_REQCERT allow" to /etc/openldap/ldap.conf, to make - START_TLS work without access to the CA Certificate. - (Bugzilla: #37393) -- fixed filelist -- check-build.sh (build on kernel >= 2.6.4 hosts only) -- yast2user.schema / slapd.conf fixed (#37076) -- don't check for TLS-options is init-script anymore (#33560) -- fixed various typos in README.update -- fixed build of openldap-2.1-slapcat (using correct db41 include - files, build backends as on sles8) -- attempt to update bdb database and reindex ldbm database in %{post} -- Update notes in README.update -- better default configuration (including default DB_CONFIG file) -- misc updates for the YaST schema -- fixed crasher in syncrepl-code (syncrepl.dif) -- Fix type mismatch. -- updated to 2.2.6 -- build a openldap-2.1-slapcat from 2.1.25 sources to be able to - migrate from SLES8 and SL 9.0 -- added check-build.sh (build on 2.6 hosts only) -- updated to 2.2.5 -- adjusted rfc2307bis.schema to support UTF-8 values in most - attributes -- enabled proxycache-overlay (wiht fix to work with back-ldbm) -- updated to 2.2.4 -- updated Admin Guide to most recent version -- add %defattr -- fix build as user -- updated to 2.1.25 -- small fixes for the YaST user schema -- enabled SLP-support -- Remove unused des from neededforbuild -- Bugzilla #29859: fixed typo in sysconfig metadata, - usage of OPENLDAP_LDAPS_INTERFACES in init script -- added /usr/lib/sasl2/slapd.conf permissions handling -- added sysconfig variable OPENLDAP_SLAPD_PARAMS="" - to support additional slapd start parameters -- added sysconfig variable OPENLDAP_START_LDAPI=NO/yes - for ldapi:/// (LDAP over IPC) URLs -- added activation metadata to sysconfig template (Bugzilla #28911) -- removed lint from specfile -- added %stop_on_removal and %restart_on_update calls -- bdb_addcnt.dif fixes a possible endless loop in id2entry() -- addonschema.tar.gz: some extra Schema files (YaST, RFC2307bis) -- removed fillup_only and call fillup_and_insserv correctly -- new Options in sysconfig.openldap: OPENLDAP_LDAP_INTERFACES, - OPENLDAP_LDAPS_INTERFACES and OPENLDAP_RUN_DB_RECOVER -- updated to 2.1.22 -- updated Admin Guide to most recent version -- build librewrite with -fPIC -- updated to 2.1.21 -- fixed requires lines -- don't link back-ldap against librewrite.a, it's already linked - into slapd (package should build on non-i386 Archs again) -- fixed dynamic build of back-ldap -- new subpackage back-ldap -- updated to version 2.1.20 -- enabled dynamic backend modules -- new subpackages back-perl, back-meta and back-monitor -- remove unpacked files from BuildRoot -- updated to version 2.1.19 -- fixed requires for devel-package ... -- fixed neededforbuild -- Enable IPv6 again -- added /etc/openldap to filelist -- switch default backend to ldbm -- fixed requires for devel package (cyrus-sasl2-devel) -- liblber.dif: Fixes two bugs in liblber by which remote attackers - could crash the LDAP server (Bugzilla #22469, OpenLDAP ITS #2275 - and #2280) -- build using sasl2 -- updated to version 2.1.12 -- added metadata to sysconfig template (Bug: #22666) -- updated to version 2.1.8 -- added additional fix of 64bit archs -- added secpatch.dif to fix setuid issues in libldap -- fix for Bugzilla ID #18981, chown to OPENLDAP_USER didn't work - with multiple database backend directories -- removed damoenstart_ipv6.diff and disabled IPv6 support due to - massive problems with nss_ldap -- ldap_user.dif: slapd is now run a the user/group ldap (Bugzilla - ID#17697) -- updated to version 2.1.4, which fixes tons of bugs -- added damoenstart_ipv6.diff (slapd was not starting when - configured to listen on IPv4 and IPv6 interfaces, as done by the - start script) -- added README.SuSE with some hints about the bdb-backend -- updated filelist to include only the man pages of the backends, - that were built -- removed termcap and readline from neededforbuild -- enabled {CRYPT} passwords -- update filelist (added new manpages) -- patches for 64 bit architectures -- update to 2.1.3 -- fix openldap2-devel requires -- switched back from cyrus-sasl2 to cyrus-sasl -- updated to OpenLDAP 2.1.2 -- added the OpenLDAP Administration Guide -- enabled additional backends (ldap, meta, monitor) -- hack build/ltconfig to build shared libs on ppc64 -- created /etc/sysconfig/openldap and OPENLDAP_START_LDAPS variable - to enable ldap over ssl support -- Fix for Bugzilla ID#14569 (added cyrus-sasl-devel openssl-devel - to the "Requires" Section of the -devel subpackage) -- updated to the latest STABLE release (2.0.23) which fixes some - nasty bugs see ITS #1562,#1582,#1577,#1578 -- updated to the latest release (which fixes a index corruption - bug) -- cleanup in neededforbuild -- small fixes for the init-scripts -- updated to the latest stable release (2.0.21) -- removed periods and colons from startup/shutdown messages -- updated to v2.0.20 (which fixes a security hole in ACL - processing) -- converted archive to bzip2 -- makes use of %{_libdir} now -- set CFLAGS to -O0 for archs ia64, s390(x) and alpha otherwise - the test suite fails on these archs -- changed slapd.conf to store the database under /var/lib/ldap - (this patch was missing in the last versions by accident) -- update to v2.0.19 -- eliminated START_LDAP, START_SLURPD variables in rc.config -- created separate init script for slurpd -- moved init scripts from dif to separate source tgz -- update to v2.0.18 -- update to v2.0.17 - added a sleep to the restart section - moved some manpages to the client package -- update to v2.0.15 -- backported the full bugfix from openldap-2.0.14 -- Bugfix for slurpd millionth second bug (ITS#1323) -- moved ldapfilter.conf ldaptemplates.conf ldapsearchprefs.conf - to openldap2-client package -- update to version 2.0.12 -- bugfix: init script was not LSB compliant, Bugzilla ID#9072 -- fixed for autoconf again -- update to 2.0.11 -- removed autoconf in specfile, because it doesn't work -- update to version 2.0.10 (minor fixes) -- update to version 2.0.9 -- removed kerberos support -- added aci support -- added kerberos support -- moved section 5 and 8 manpages to the server part of package -- Move *.so links into -devel package -- -devel requires -client -- split up into openldap2-client and -devel -- changed neededforbuild <cyrus-sasl> to <cyrus-sasl cyrus-sasl-devel> -- added readline/readline-devel to neededforbuild (split from bash) -- bugfix: slapd.conf rename /var/lib/openldap-ldbm to - /var/lib/ldap - init script: use $remote_fs -- use script name in %post -- bugfix from Andreas Jaeger: - workaround for glibc2.2, detach -- hacked configure for apparently broken pthread -- fixed spec -- made configs %config(noreplace) (Bug 4112) -- fixed neededforbuild -- adopted new init scheme -- fixed neededforbuild -- added buildroot -- long package name -- new version, 2.0.7 -- first package of openldap2 (v2.0.6) - - - - - - - - -- Really apply the patch for Bug#160566 -- slapd could crash while processing queries with pre-/postread - controls (Bug#173877, ITS#4532) -- Backported fix from CVS for occasional crashes in referral - chasing code (as used in e.g. back-meta/back-ldap). - (Bug: #160566, ITS: #4448) -- openldap2 must obsolete -back-monitor and -back-ldap to have them - removed during update (Bug: #157576) -- Add "external" to the list of supported SASL mechanisms - (Bug: #151771) -- Error out when conversion from old configfile to config database - fails (Bug: #135484,#135490 ITS: #4407) -- Don't ignore non-read/write epoll events (Bug: #149993, - ITS: #4395) -- Added update message to /usr/share/update-messages/en/ and enable - it, when update did not succeed. -- OPENLDAP_CHOWN_DIRS honors databases defined in include files - (Bug: #135473) -- Fixed version numbers in README.update -- Fixed GSSAPI binds against Active Directory (Bug: #149390) -- Cleaned up update procedure -- man-pages updates and fixes (Fate: #6365) -- Updated to 2.3.19 (Bug #144371) -- converted neededforbuild to BuildRequires -- Updated Admin Guide to latest version -- build slapcat from openldap-2.2.24 and install it to - /usr/sbin/openldap-2.2-slapcat to be able to migrate from - OpenLDAP 2.2. -- removed slapd-backbdb-dbupgrade which is no longer needed -- attempt to dump/reload bdb databases in %{post} -- Update notes in README.update -- New sysconfig variable OPENLDAP_KRB5_KEYTAB -- Cleanup in default configuration and init scripts -- Updated to 2.3.17 -- Remove OPENLDAP_RUN_DB_RECOVER from sysconfig file in %post - slapd does now automatically recover the database if needed -- Removed unneeded README.SuSE -- Small adjustments to the default DB_CONFIG file -- Updated to 2.3.16 -- Fixed filelist (slapd-hdb man-page was missing) -- Fixed build on x86_64 -- Merged -back-ldap and -back-monitor subpackages into the main - package and don't build them as dynamic modules anymore. -- updated to OpenLDAP 2.3.13 -- updated to OpenLDAP 2.3.12 -- updated to OpenLDAP 2.3.11 -- removed the "LDAP_DEPRECATED" workaround -- Add "LDAP_DEPRECATED" to ldap.h for now -- updated to OpenLDAP 2.3.7 -- allow start_tls while chasing referrals (Bug #94355, ITS #3791) -- devel-subpackage requires openldap2-client of the same version - (Bugzilla: #93579) -- build with -fPIE (not -fpie) to avoid GOT overflow on s390* -- build the server packages with -fpie/-pie -- updated to 2.2.27 -- libldap-gethostbyname_r.dif: Use gethostbyname_r instead of - gethostbyname in libldap. Should fix host lookups through - nss_ldap (Bugzilla: #76173) -- Updated to 2.2.26 -- made /%{_libdir}]/sasl2/slapd.conf %config(noreplace) -- Added /%{_libdir}]/sasl2/slapd.conf to avoid warnings about - unconfigured OTP mechanism (Bugzilla: #80588) -- added minimal timeout to startproc in init-script to let it - report the "failed" status correctly in case of misconfiguration - (Bugzilla: #76393) -- crl-check.dif: Implements CRL checking on client and server side -- use different base ports for differnt values of BUILD_INCARNATION - (/.buildenv) to allow parallel runs of the test-suite on a single - machine -- force yielding-select test to yes (test occasionally hangs QEMU) -- disable test suite on ARM (hangs QEMU) -- updated to 2.2.24 -- enabled back-hdb -- syncrepl.dif: merged latest syncrepl fixes (Bugzilla: #65928) -- libldap-reinit-fdset.dif: Re-init fd_sets when select is - interupted (Bugzilla #50076, ITS: #3524) -- checkproc_before_recover.dif: Check if slapd is stopped before - running db_recover from the init script. (Bugzilla: #50962) -- Cleanup back-bdb databases in %post, db-4.3 changed the - transaction log format again. -- cosmetic fixes in init script -- updated to 2.2.23 -- cleaned up #neededforbuild -- package should also build on older SuSE Linux releases now -- increased killproc timeout in init-script (Bugzilla: #47227) -- updated to 2.2.20 -- Removed unneeded dependencies -- don't install *.la files -- updated to 2.2.18 -- use kerberos-devel-packages in neededforbuild -- re-arranged specfile to sequence (header (package/descr)* rest) - so the checking parser is not confused ... -- Added pre_checkin.sh to generate a separate openldap2-client - spec-file from which the openldap2-client and openldap2-devel - subpackages are built. Should reduce build time for libldap as - the test-suite is only executed in openldap2.spec. -- libldap-result.dif: ldapsearch was hanging in select() when - retrieving results from eDirectory through a StartTLS protected - connection (Bugzilla #44942) -- added ntlm support -- updated to 2.2.16 -- Updated ACLs in slapd_conf.dif to disable default read access - to the "userPKCS12" Attribute -- rc-check-conn.diff: When starting slapd wait until is accepts - connections, or 10 seconds at maximum (Bugzilla #41354) -- Backported -o slp={on|off} feature from OpenLDAP Head and added - new sysconfig variable (OPENLDAP_REGISTER_SLP) to be able - to switch SLP registration on and off. (Bugzilla #39865) -- removed unneeded README.update -- updated to 2.2.11 -- remove SLES8 update specific stuff -- Bugzilla #39652: Updated slapd_conf.dif to contain basic access - control -- Bugzilla #39468: Added missing items to yast.schema -- fixed strict-aliasing compiler warnings (strict-aliasing.dif) -- build with several jobs if available -- ldapi_url.dif: Fixed paths for LDAPI-socket, pid-file and - args-file (Bugzilla #38790) -- ldbm_modrdn.dif: Fixed back-ldbm modrdn indexing bug (ITS #3059, - Bugzilla #38915) -- modify_check_duplicates.dif: check for duplicate attribute - values in modify requests (ITS #3066/#3097, Bugzilla #38607) -- updated and renamed yast2userconfig.schema to yast.schema as it - contains more that only user configuration now -- syncrepl.dif: addtional fixes for syncrepl (ITS #3055, #3056) -- test_syncrepl_timeout: increased sleep timeout in syncrepl - testsuite -- added "TLS_REQCERT allow" to /etc/openldap/ldap.conf, to make - START_TLS work without access to the CA Certificate. - (Bugzilla: #37393) -- fixed filelist -- check-build.sh (build on kernel >= 2.6.4 hosts only) -- yast2user.schema / slapd.conf fixed (#37076) -- don't check for TLS-options is init-script anymore (#33560) -- fixed various typos in README.update -- fixed build of openldap-2.1-slapcat (using correct db41 include - files, build backends as on sles8) -- attempt to update bdb database and reindex ldbm database in %{post} -- Update notes in README.update -- better default configuration (including default DB_CONFIG file) -- misc updates for the YaST schema -- fixed crasher in syncrepl-code (syncrepl.dif) -- Fix type mismatch. -- updated to 2.2.6 -- build a openldap-2.1-slapcat from 2.1.25 sources to be able to - migrate from SLES8 and SL 9.0 -- added check-build.sh (build on 2.6 hosts only) -- updated to 2.2.5 -- adjusted rfc2307bis.schema to support UTF-8 values in most - attributes -- enabled proxycache-overlay (wiht fix to work with back-ldbm) -- updated to 2.2.4 -- updated Admin Guide to most recent version -- add %defattr -- fix build as user -- updated to 2.1.25 -- small fixes for the YaST user schema -- enabled SLP-support -- Remove unused des from neededforbuild -- Bugzilla #29859: fixed typo in sysconfig metadata, - usage of OPENLDAP_LDAPS_INTERFACES in init script -- added /usr/lib/sasl2/slapd.conf permissions handling -- added sysconfig variable OPENLDAP_SLAPD_PARAMS="" - to support additional slapd start parameters -- added sysconfig variable OPENLDAP_START_LDAPI=NO/yes - for ldapi:/// (LDAP over IPC) URLs -- added activation metadata to sysconfig template (Bugzilla #28911) -- removed lint from specfile -- added %stop_on_removal and %restart_on_update calls -- bdb_addcnt.dif fixes a possible endless loop in id2entry() -- addonschema.tar.gz: some extra Schema files (YaST, RFC2307bis) -- removed fillup_only and call fillup_and_insserv correctly -- new Options in sysconfig.openldap: OPENLDAP_LDAP_INTERFACES, - OPENLDAP_LDAPS_INTERFACES and OPENLDAP_RUN_DB_RECOVER -- updated to 2.1.22 -- updated Admin Guide to most recent version -- build librewrite with -fPIC -- updated to 2.1.21 -- fixed requires lines -- don't link back-ldap against librewrite.a, it's already linked - into slapd (package should build on non-i386 Archs again) -- fixed dynamic build of back-ldap -- new subpackage back-ldap -- updated to version 2.1.20 -- enabled dynamic backend modules -- new subpackages back-perl, back-meta and back-monitor -- remove unpacked files from BuildRoot -- updated to version 2.1.19 -- fixed requires for devel-package ... -- fixed neededforbuild -- Enable IPv6 again -- added /etc/openldap to filelist -- switch default backend to ldbm -- fixed requires for devel package (cyrus-sasl2-devel) -- liblber.dif: Fixes two bugs in liblber by which remote attackers - could crash the LDAP server (Bugzilla #22469, OpenLDAP ITS #2275 - and #2280) -- build using sasl2 -- updated to version 2.1.12 -- added metadata to sysconfig template (Bug: #22666) -- updated to version 2.1.8 -- added additional fix of 64bit archs -- added secpatch.dif to fix setuid issues in libldap -- fix for Bugzilla ID #18981, chown to OPENLDAP_USER didn't work - with multiple database backend directories -- removed damoenstart_ipv6.diff and disabled IPv6 support due to - massive problems with nss_ldap -- ldap_user.dif: slapd is now run a the user/group ldap (Bugzilla - ID#17697) -- updated to version 2.1.4, which fixes tons of bugs -- added damoenstart_ipv6.diff (slapd was not starting when - configured to listen on IPv4 and IPv6 interfaces, as done by the - start script) -- added README.SuSE with some hints about the bdb-backend -- updated filelist to include only the man pages of the backends, - that were built -- removed termcap and readline from neededforbuild -- enabled {CRYPT} passwords -- update filelist (added new manpages) -- patches for 64 bit architectures -- update to 2.1.3 -- fix openldap2-devel requires -- switched back from cyrus-sasl2 to cyrus-sasl -- updated to OpenLDAP 2.1.2 -- added the OpenLDAP Administration Guide -- enabled additional backends (ldap, meta, monitor) -- hack build/ltconfig to build shared libs on ppc64 -- created /etc/sysconfig/openldap and OPENLDAP_START_LDAPS variable - to enable ldap over ssl support -- Fix for Bugzilla ID#14569 (added cyrus-sasl-devel openssl-devel - to the "Requires" Section of the -devel subpackage) -- updated to the latest STABLE release (2.0.23) which fixes some - nasty bugs see ITS #1562,#1582,#1577,#1578 -- updated to the latest release (which fixes a index corruption - bug) -- cleanup in neededforbuild -- small fixes for the init-scripts -- updated to the latest stable release (2.0.21) -- removed periods and colons from startup/shutdown messages -- updated to v2.0.20 (which fixes a security hole in ACL - processing) -- converted archive to bzip2 -- makes use of %{_libdir} now -- set CFLAGS to -O0 for archs ia64, s390(x) and alpha otherwise - the test suite fails on these archs -- changed slapd.conf to store the database under /var/lib/ldap - (this patch was missing in the last versions by accident) -- update to v2.0.19 -- eliminated START_LDAP, START_SLURPD variables in rc.config -- created separate init script for slurpd -- moved init scripts from dif to separate source tgz -- update to v2.0.18 -- update to v2.0.17 - added a sleep to the restart section - moved some manpages to the client package -- update to v2.0.15 -- backported the full bugfix from openldap-2.0.14 -- Bugfix for slurpd millionth second bug (ITS#1323) -- moved ldapfilter.conf ldaptemplates.conf ldapsearchprefs.conf - to openldap2-client package -- update to version 2.0.12 -- bugfix: init script was not LSB compliant, Bugzilla ID#9072 -- fixed for autoconf again -- update to 2.0.11 -- removed autoconf in specfile, because it doesn't work -- update to version 2.0.10 (minor fixes) -- update to version 2.0.9 -- removed kerberos support -- added aci support -- added kerberos support -- moved section 5 and 8 manpages to the server part of package -- Move *.so links into -devel package -- -devel requires -client -- split up into openldap2-client and -devel -- changed neededforbuild <cyrus-sasl> to <cyrus-sasl cyrus-sasl-devel> -- added readline/readline-devel to neededforbuild (split from bash) -- bugfix: slapd.conf rename /var/lib/openldap-ldbm to - /var/lib/ldap - init script: use $remote_fs -- use script name in %post -- bugfix from Andreas Jaeger: - workaround for glibc2.2, detach -- hacked configure for apparently broken pthread -- fixed spec -- made configs %config(noreplace) (Bug 4112) -- fixed neededforbuild -- adopted new init scheme -- fixed neededforbuild -- added buildroot -- long package name -- new version, 2.0.7 -- first package of openldap2 (v2.0.6) - - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - - -- Add "-H" flag for setting hostname (Novell major bug #139532) -- fix two further include paths in dhcpctl.3 and omapi.3 -- package the static libdst.a library [#158271] -- fix the include path in dhcpctl.3 and omapi.3 [#158271] -- converted neededforbuild to BuildRequires -- dereference links when copying stuff into the chroot jail [#145169] -- dropped dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch. Correct - solution is being implemented in NetworkManager -- replaced 'nis-domain-servers' by 'nis-servers' in - dhcp-3.0.3-dhclient-nis-01-thoenig.patch (follow-up #134160) -- add 'nis-domain' and 'nis-domain-servers' to 'request' - dhclient.conf (dhcp-3.0.3-dhclient-nis-01-thoenig.patch). If - the DHCP reply contains information about NIS, NM will set those. - (#134160) -- extended /sbin/dhclient-script to set domain name and host name. - This will only happen if the relevant options in - /etc/sysconfig/network/dhcp are set. - (dhcp-3.0.3-dhclient-nm_active-01-thoenig.patch) (#134160) -- compile with -fsigned-char on ppc/ppc64, avoiding the - dhclient.conf parse error "expecting a statement" [#134590] -- define LDAP_DEPRECATED in CFLAGS -- update to 3.0.3 - * A bug was fixed in BOOTPREQUEST handling code wherein stale - references to host records would be left behind on leases that - were not allocated to the client currently booting (eg in the - case where the host was denied booting). - * The dhcpd.conf.5 manpage was updated to be more clear in - regards to multiple host declarations (thanks to Vincent - McIntyre). 'Interim' style dynamic updates were also - retouched. - * dhclient.conf documentation for interface {} was updated to - reflect recent discussion on the dhcp-hackers mailing list. -- update ldap patch, patches merged upstream -- compile with LPF instead of bsd sockets. Provide optional binary - compiled with bsd sockets. -- README: describe how to serve option 119 (searchlist), add dns - compression tool -- build with pie/PIE depending on architecture. -- Add -DEXTENDED_NEW_OPTION_INFO to CFLAGS for rml -- Add support for dhcdbd, patches from RH via rml -- build with pie/fpie -- Don't use kernel types in user space -- update to 3.0.3b1 release. Changes since 3.0.2: - * A bug was fixed where a server might load balance a DHCP REQUEST to its - peer after already choosing not to load balance the preceeding DISCOVER. - The peer cannot allocate the originating server's lease. - * In the case where a secondary server lost its stable storage while the - primary was still in communications-interrupted, and came back online, - the lease databases would not be fully transferred to the secondary. - This was due to the secondary errantly sending an extra UPDREQ message - when the primary made its state transition to PARTNER-DOWN known. - * The package will now compile cleanly in gcc 3.3 and 3.4. As a side effect, - lease structures will be 9 bytes smaller on all platforms. Thanks to - Jason Vas Dias at Redhat. - * Interface discovery code in DISCOVER_UNCONFIGURED mode is now - properly restricted to only detecting broadcast interfaces. Thanks - to a patch from Jason Vas Dias at RedHat. - * decode_udp_ip_header was changed so that the IP address was copied out - to a variable, rather than referenced by a pointer. This enforces 4-byte - alignment of the 32-bit IP address value. Thanks to a patch from Dr. - Peter Poeml. - * An incorrect log message was corrected thanks to a patch from - Dr. Peter Poeml. - * A bug in DDNS was repaired, where if the server's first DDNS action was - a DDNS removal rather than a DDNS update, the resolver library's - retransmit timer and retry timer was set to the default, implying a - 15 second timeout interval. Which is a little excessive in a synchronous, - single-threaded system. In all cases, ISC DHCP should now hold fast to - a 1-second timeout, trying only once. - * The siaddr field was being improperly set to the server-identifier when - responding to DHCP messages. RFC2131 clarified the siaddr field as - meaning the 'next server in the bootstrap process', eg a tftp server. - The siaddr field is now left zeroed unless next-server is configured. - * mockup_lease() could have returned in an error condition (or in the - condition where no fixed-address was found matching the shared - network) with stale references to a host record. This is probably not - a memory leak since host records generally never die anyway. - * A bug was repaired where failover servers would let stale client identifiers - persist on leases that were reallocated to new clients not sending an id. - * Binding scopes ("set var = value;") are now removed from leases allocated - by failover peers if the lease had expired. This should help reduce the - number of stale binding scopes on leases. - * A small memory leak was closed involving client identifiers larger than - 7 bytes, and failover. - * Configuring a subnet in dhcpd.conf with a subnet mask of 32 bits might - cause an internal function to overflow heap. Thanks to Jason Vas Dias - at Redhat. - * Some inconsistencies in treating numbers that the lexer parsed as 'NUMBER' - or 'NUMBER_OR_NAME' was repaired. Hexadecimal parsing is affected, and - should work better. - * In several cases, parse warnings were being issued before the lexical - token had been advanced to the token whose value was causing an error... - causing parse warnings to claim the problem is on the wrong token. - * Host declarations matching on client identifier for dynamic leases will - no longer match fixed-address host declarations (this is now identical - to behaviour for host records matching on hardware address). -- print error if binary DHCPD_BINARY is not found [#76392] -- remove patches incorporated upstreams -- update ssh forced command example in dhcpsync man page -- update to 3.0.2 release. Changes since 3.0.2rc3: - * A previously undocumented configuration directive, - 'local-address', was documented in the dhcpd.conf manpage. -- Bug #49433: try to reconnect to ldap server if it was down; - ignore SIGPIPE while ldap_unbind called on closed handle. - = new patch file: dhcp-3.0.2-ldap-reconnect.mt.dif.gz -- update to 3.0.2rc3. Changes since rc2: - * Two variables introduced in 3.0.2b1 were used without being - initialized in the case where neither the FILE nor SNAME fields - were available for overloading. This was repaired. - * A heretofore believed to be impossible corner case of the - option overloading implementation turned out to be possible - ("Unable to sort overloaded options after 10 tries."). The - implementation was reworked to consider the case of an option - so large it would require more than three chunks to fit. - * Many other instances of variables being used without being - initialized were repaired. - * An uninitialized variable in omapi_io_destroy() led to the - discovery that this function may result in orphaned pointers - (and hence, a memory leak). -- refresh the unaligned.patch -- update to 3.0.2rc2. Changes since 3.0.1: - * allocate_lease() was rewritten to repair a bug in which the server would - try to allocate an ABANDONED lease when FREE leases were available. - * Some dhcp-eval.5 manpage formatting was repaired. - * A bug was fixed in the server's 'option overloading' implementation, - where options loaded into the 'file' and 'sname' packet fields were - not aligned precisely as rfc2131 dictates. - * The FreeBSD client script was changed to support the case where a domain - name was not provided by the server. - * A memory leak in 'omshell' per each command line parsed was - repaired, thanks to a patch from Jarkko Torppa. - * Log functions writing to stderr were adjusted to use the STDERR_FILENO - system definition rather than '2'. This is a no-op for 90% of platforms. - * One call to trace_write_packet_iov() counted the number of io vectors - incorrectly, causing inconsistent tracefiles. This was fixed. - * Some expression parse failure memory leaks were closed. - * A host byte order problem in tracefiles was repaired. - * Pools configured in DHCPD for failover possessing permission lists that - previously were assumed to not include dyanmic bootp clients are now - a little more pessimistic. The result is, dhcpd will nag you about just - about most pools that possess a 'allow' statement with no 'deny' that - would definitely match a dynamic bootp client. - * The 'ddns-update-style' configuration warning bit now insists that - the configuration be globally scoped. - * Two memory leaks in dhclient were closed thanks to a patch from Felix - Farkas. - * Some minor but excellently pedantic documentation errors were fixed - thanks to a patch from Thomas Klausner. - * Bugs in operator precedence in executable statements have been repaired - once again. More legal syntaxes should be parsed legally. - * Failing to initialize a tracefile for any reason if a tracefile was - specified is now a fatal error. Thanks to a patch from Albert Herranz. - * Corrected a bug in which the number of leases transferred as calculated - by the failover primary and sent to peers in POOLRESP responses may be - incorrect. This value is not believed to be used by other failover - implementations, excepting perhaps as logged information. - * Corrected a bug in which 'dhcp_failover_send_poolresp()' was in fact - sending POOLREQ messages instead of POOLRESP mesasges. This message - was essentially ignored since failover secondaries effectively do not - respond to POOLREQ messages. - * Type definitions for various bitwidths of integers in the sunos5-5 - build of ISC DHCP have been fixed. It should compile and run more - easily when built in 64-bit for this platform. - * "allow known-clients;" is now a legal syntax, to avoid confusion. - * If one dhcp server chooses to 'load balance' a request to its failover - peer, it first checks to see if it believes said peer has a free - lease to allocate before ignoring the DISCOVER. - * log() was logging a work buffer, rather than the value returned by - executing the statements configured by the user. In some cases, - the work buffer and the intended results were the same. In some other - cases, they were not. This was fixed thanks to a patch from Gunnar - Fjone and directconnect.no. - * Compiler warnings for some string type conversions was fixed, thanks - to Andreas Gustafsson. - * The netbsd build environments were simplified to one, in which --Wconversion is not used, thanks to Andreas Gustafsson. - * How randomness in the backoff-cutoff dhclient configuration variable - is implemented was better documented in the manpage, and the behaviour - of dhclient in REQUEST timeout handling was changed to match that of - DISCOVER timeout handling. - * Omapi was hardened against clients that pass in null values, thanks - to a patch from Mark Jason Dominus. - * A bug was fixed in dhclient that kept it from doing client-side - ddns updates. Thanks to a patch from Andreas Gustafsson, which - underwent some modification after review by Jason Vas Dias. - * Failover implementations disconnected due to the network between - them (rather than one of the two shutting down) will now try to - re-establish the failover connection every 5 seconds, rather than - to simply try once and give up until one of them is restarted. - Thanks to a patch from Ulf Ekberg from Infoblox, and field testing - by Greger V. Teigre which led to an enhancement to it. - * A problem that kept DHCP Failover secondaries from tearing down - ddns records was repaired. Thanks to a patch from Ulf Ekberg from - Infoblox. - * 64bit pointer sizes are detected properly on FreeBSD now. - * A bug was repaired where the DHCP server would leave stale references - to host records on leases it once thought about offering to certain - clients. The result would be to apply host and 'known' scopes to the - wrong clients (possibly denying booting). NOTE: The 'mis-host' patch - that was being circulated as a workaround is not the way this bug was - fixed. If you were a victim of this bug in 3.0.1, you are cautioned - to proceed carefully and see if it fixes your problem. - * A bug was repaired in the server's DHCPINFORM handling, where it - tried to divine the client's address from the source packet and - would get it wrong. Thanks to Anshuman Singh Rawat. - * A log message was introduced to help illuminate the case where the - server was unable to find a lease to assign to any BOOTP client. - Thanks to Daniel Baker. - * A minor dhcpd.conf.5 manpage error was fixed. -- update ldap patch (11/8/2004 version) -- fixed file list for devel package -- sysconfig.dhcpd, sysconfig.dhcrelay: give examples how to use - configuration names instead of interface names -- update to 3.0.1 - * The global variable 'cur_time' was centralized and is now - uniformly of a type #defined in system-dependent headers. It - had previously been defined in one of many places as a 32-bit - value, and this causes mayhem on 64-bit big endian systems. It - probably wasn't too healthy on little endian systems either. - * A printf format string error introduced in rc14 was repaired. - * AIX system-dependent header file was altered to only define - NO_SNPRINTF if the condition used to #ifdef in vsnprintf in - AIX' header files is false. - * The Alpha/OSF system-dependent header file was altered to - define NO_SNPRINTF on OS revisions older than 4.0G. - * omapip/test.c had string.h added to its includes. -- drop obsolete dhcp-curtimetype.patch -- cope with missing files during chroot setup (e.g., if no - resolv.conf exists) [#40728] -- remove duplicated option "-cf" from usage output -- add notes about the used raw socket API to README -- update to 3.0.1rc14 -- remove obsolete patches and adapt dhcp-3.0.1rc13-tmpfile.dif -- dhcpsync: use try-restart (so the server isn't started if it has - been stopped) -- remove notify messages that are sent to root -- check if dhcpd was active at boot time before update and - restore runlevel links if needed [#41215], and PreRequires for - that -- security fixes [#41975]: -- fix buffer overflow in the DHCP server that can be exploited by - the client by specifying multiple 'hostnames' to execute - arbitrary code or at least crash the server. VU#317350 -- add patch to use vsnprintf() instead of vsprintf() calls. - VU#654390 -- fix sysconfig comment and DHCPD_RUN_AS default [#40174] -- improve security of the chroot jail setup by creating a dedicated - user id for the server, and move the leases database into a - subdirectory (/var/lib/dhcp/db). With the exception of that - subdirectory the chroot jail is now owned by root. [#40174] Use - mkstemp to create temporary files. [#40267] -- don't use startproc to start dhcpd, because startproc waits a - fixed time (100 msec) until it decides whether the service is - running or not. Now that dhcpd might have to contact an LDAP - server first to read its configuration, starting up can take - longer than that, and the init script would falsely report - "success" even when the server cannot start up due to broken - configuration or non-existant interfaces. Increasing the - startproc timeout (-t) is not a real alternative because, because - it would imply a fixed dely to the init script, and it might - still be too short. [#40350] -- convert configuration names in DHCPD_INTERFACE / - DHCRELAY_INTERFACES into interface names [#39718] -- fix service restart for the case where the binary has been - switched for backward compatibility during updating. -- do not change DHCPD_BINARY for backward compatibility if updating - from 9.0. This and the last change complete the fix for [#38422] - and take care of updates from 8.1-9.1 with and without YOU - updates. -- additionally package the dhcpd binary that uses the Linux packet - filter API. New option DHCPD_BINARY in sysconfig.dhcpd. [#38422] -- when updating from a previous package using LPF API, retain the - old behaviour. Fix init script so that 'stop' works also after a - switch of DHCPD_BINARY. -- updated to dhcp-3.0.1rc13-ldap-patch also obsolating the - patches: dhcp-ldap-fix01.dif, dhcpd-conf-to-ldap.pl.dif -- added dhcp-3.0.1rc13-ldap.mt.dif, providing diverse fixes - and basic failover support for server/ldap.c -- added dhcpd-conf-to-ldap.mt.dif providing failover support - to dhcpd.conf convert script -- applied dhcp-3.0.1rc12-ldap-patch adding support to store - dhcp configuration in ldap (incl. draft ldap schema). - further patches: -- dhcp-ldap-fix01.dif: fixes for server/ldap.c (debuging - output, support for block statements, ...) -- dhcpd-conf-to-ldap.pl.dif: fixes for convert script -- the genDDNSkey script has been moved to the bind-utils package -- update the DDNS-howto.txt -- package leases.awk (dhcpd.leases analyzer) (courtesy of Jeff Wilson) -- update to 3.0.1rc13 -- Fixed a bug in omapi lease lookup function, to form the - hardware address for the hash lookup correctly -- The 'ping timeout' debugs from rc12 were removed to -DDEBUG - only -- Fixed a case where leases read from the leases database do not - properly over-ride previously read leases. -- Fixed a bug where dhcrelay was sending relayed responses back - to the broadcast address, but with the source's unicast mac - address. Should now conform to rfc2131 section 4.1. -- Fixed a crash bug in dhclient where dhcpd servers that do not - provide renewal times results in an FPE. As a side effect, - dhclient can now properly handle 0xFFFFFFFF (-1) expiry times - supplied by servers. -- dhcpctl.3 manpage was tweaked. -- the files CHANGES and COPYRIGHT have vanished, package LICENSE - instead -- build as user -- if starting dhcpd in chroot jail, and a pid file is present in - the jail, and the pid file does not contain a pid of a running - dhcpd process, but that of another _running_ process, remove - that pid file. [#32603] -- fix typo in dhcp.LIESMICH -- DDNS-howto.txt: adjust changed path -- DDNS-howto.txt: instead of the shell variables (they were copy - and paste'd from a script), use a real example (makes it easier) -- add a comment in sysconfig.dhcpd that entire directories may be - included -- dhcpsync: if run from the commandline, do not use an identity - that ssh-agent may hold, but use $KEY instead -- dhcpsync.8: add a note about a know limitation -- fix wrong ServiceRestart tags in sysconfig/dhcrelay [#32062] -- fixed data type mismatch in libomapi, only harmful on 64-bit - BE systems (ppc64, s390x, bug #32123) -- update to 3.0.1rc12 -- a failover bug relating to identifying peers by name length - instead of by name was fixed -- declaring failover configs within shared-network statements - should no longer result in error -- a problem with lease expiry times in failover configurations - was fixed -- reverse dns PTR record updates with values containing spaces - are now permitted -- problems with long option processing fixed -- fixes to minires so that updates of KEY records will work -- memory leak in configuration parsing closed -- non-broadcast or point-to-point interfaces are now ignored -- options not yet known by the dhcpd or dhclient now appear as - e.g. "unknown-144" rather than "#144" in the leases file, to - avoid the hash marks -- dhclient no longer uses shell commands to kill another instance - of itself, it sends the signal directly. -- the -nw command line option to dhclient now works -- dhcp-3.0.1rc10-dhcrelay-limit-hopcount.dif included upstreams -- added contrib/ms2isc (converts Microsoft DHCP server configuration) -- mark dhclient's lease database %config(noreplace) -- Really fix [#29405], server should not provide and obsolete dhcp. -- don't provide/require dhcp-base. Require dhcp instead [#29405] -- add Config: syslog-ng to sysconfig.syslog-dhcpd -- use -Wall -Wno-unused -- add -fno-strict-aliasing, due to warnings about code where - dereferencing type-punned pointers will break strict aliasing -- add activation metadata to sysconfig template [#28864, [#28865], - [#28950] -- rc.dhcpd, rc.dhcrelay: implement try-restart correctly -- cleaned up the root mail, and the READMEs [#27214], [#26266] -- send the root mail only on update [#27214] -- have no default value in /etc/sysconfig/dhcpd:DHCPD_INTERFACE -- in client's %post, send a mail only when rc.config is encountered -- clean buildroot, but not in chroot buildsystem -- the SuSE string is now replaced by UnitedLinux where appropriate -- rename the "dhcp-base" package to "dhcp", so there is a binary - package matching the name of the source package [#17668] -- use the lately added macros only on newer distributions -- new macros for stop/restart of services on rpm update/removal -- when copying include files into the chroot jail, create - subdirectories as needed, thus retaining the path to the files -- don't explicitely strip binaries since RPM handles it, and may - keep the stripped information somewhere -- add some notes to DDNS-howto.txt, kindly provided by Andrew Beames -- fix typo in genDDNSKey.sh -- Implement try-restart correctly in init-script -- update to 3.0.1rc11, relevant fixes are -- Potential buffer overflows in minires repaired. -- A correction of boolean parsing syntax validation - some illegal syntaxes - that worked before are now detected and produce errs, some legal syntaxes - that errored before will now work properly. -- Some search-and-replace errors that caused some options to change their - names was repaired. -- Shu-min Chang of the Intel corporation has contributed a perl script and - module that converts the MS NT4 DHCP configuration to a ISC DHCP3 - configuration file. -- Applied the remainder of the dhcpctl memory leak patch provided by Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- Missing non-optional failover peer configurations will now result in a soft - error rather than a null dereference. -- use BSD sockets instead of LPF (makes iptables filtering of - packages possible for server and relay. It doesn't work on the - client, though, so that one requires seperate compilation.) See - Message-Id: <5.1.0.14.0.20030408175011.00b9c7c0@pop.itd.nrl.navy.mil> -- rcdhcpd, rcdcrelay: do not write the startup log to a world - writable directory [#25241] -- don't try to copy libraries into the chroot jail that do not - exist (any longer) [#24533] -- remove the %ghost filelist entries for pid files and chroot jail - contents [#20030]. Clean up the libraries from the jail when the - server is stopped. -- dhcrelay: add patch from Florian Lohoff (slightly modified), - that makes the maximal hop count of forwarded packages - configurable (-c maxcount), sets the default to 4, and rejects - packages with a hop count higher than maxcount (CAN-2003-0039, - http://www.kb.cert.org/vuls/id/149953). Add a variable to - /etc/sysconfig/dhcrelay to pass such additional options. -- Added sysconfig metadata [#22631] [#22632] [#22696] -- Added security patch from ISC -- update to 3.0.1rc10. relevant fixes: -- A Linux-specific Token Ring detection problem was fixed. -- Hashes removed from as-yet-unknown agent options, having those - options appear in reality before we know about them will no - longer produce self-corrupting lease databases. -- dhclient will use the proper port numbers now when using the -g - option. -- A order-of-operations bug with 2 match clauses in 1 class - statement is fixed thanks to a patch from Andrew Matheson. -- A fix to the dhcp ack process which makes certain group options - will be included in the first DHCPOFFER message was made thanks - to a patch from Ling Gou. -- A few memory leaks were repaired thanks to patches from Bill - Squier at ReefEdge, Inc. (groo@reefedge.com). -- A fix for shared-networks that sometimes give clients options - for the wrong subnets (in particular, 'option routers') was - applied, thanks to Ted Lemon for the patch. -- Omshell's handling of dotted octets as values was changed such - that dots one after the other produce zero values in the - integer string. -- due to the upstream fixes: drop the reactivate-tr-support.dif and - format.dif -- retrofitted the (server) package to work for old distributions - down to 7.2 -- Fix unaligned access. -- update DDNS-howto.txt for BIND9 -- add genDDNSKey.sh to create a key for BIND8/9 -- add comments about DDNS to the dhcpd.conf [#18419], and - directives to disable DDNS by default -- change defaults in the sample configuration -- fix permissions of man pages -- re-add token ring support that got lost ("tr0:unknown hardware - address type 800"). With 2.4 kernel, ARPHRD_IEEE802 (6) has been - renamed to ARPHRD_IEEE802_TR (800). Known bug in 3.0.1rc9. -- move PreReq tag to the subpackages, where it is actually needed - [#17822, #17821] -- dhcp-client: add missing Requires on /usr/bin/host -- Fix requires of dhcp-devel subpackage -- add some helpful scripts, courtesy of Kevin C. Miller -- use PreReq -- add a sysconfig.syslog-dhcpd template to make syslogd open an - additional socket (inside the chroot dir of dhcpd) -- fix typo in %post, introduced with last change -- add Version: tags to the subpackages to satisfy the build system, - because dhcp has no main package [#16318] -- run in chroot and as user nobody per default -- fix wrong pathnames in mail to root [#15601] -- install example dhcpd.conf [#9122] -- improve example configuration files [#12563] -- init scripts: update INIT INFO, using the new tags from - /etc/init.d/skeleton -- dhclient-script: -- source the right sysconfig files (/etc/sysconfig/network/) - [#15871] -- use KEEP_SEARCHLIST option (thanks Sumit Bose) -- improve the indentation -- add documentation about configuration for dynamical DNS updates -- fix last change (rediff dhcp-3.0.1rc9.format.dif) -- update to 3.0.1rc9 -- fixes a format string vulnerability in the server that could - lead to a remote root compromise - (see http://www.cert.org/advisories/CA-2002-12.html) -- fixes a memory leak in the client and some other minor bugs -- fix some printf arguments in server/omapi.c -- fix small typo (x390x -> s390x) -- changed Makefile.conf to be able to add LIBDIR -- added LIBDIR to make install to put libs into the correct path -- use -DPTRSIZE_64BIT on x86_64 -- update to 3.0.1rc8. Most significant changes are (see RELNOTES): -- Don't allow a lease that's in the EXPIRED, RELEASED or RESET - state to be renewed. -- Implement lease stealing for cases where the primary has fewer - leases than the secondary, as called for by the standard. -- Fix a bug where if an option universe contained no options, the - DHCP server could dump core (Walter Steiner). -- Fix a bug in the handling of encapsulated options. -- Fix an uninitialized memory bug in the DHCP client. -- use -DPTRSIZE_64BIT on x390x and ppc64, too -- create /etc/resolv.conf with a file mask of 644, regardless of - the umask [Bug #15915]. Patch by Joerg Mayer. -- the scripts dir is now called CLIENTBINDIR in the Makefiles, and - correctly set to /sbin --> drop 2 hunks from dhcp-3.0rc10.dif -- Fix handling of initscript links and START_* variable [Bug #13755] -- drop the sysconfig/network/dhcp template. It's in the syconfig - package now. -- strip /sbin/dhclient -- rename dhcp subpackage to dhcp-base, add dhcp-server subpackage -- rename dhclient to dhcp-client and dhcrelay to dhcp-relay -- remove Conflicts tag dhclient <-> dhcpcd -- use %defattr(-, root, root) for all subpackages -- update copyright info (GmbH --> AG) -- update sysconfig.dhclient (.dhcp-dhclient now), and let it be - filled up into /etc/sysconfig/network/config -- add /sbin/dhclient, accidentally deleted from filelist lately -- remove START_DHCPD on update -- use fillup_only where no initscript is handled -- use %_lib and %_libdir -- update rc.dhcpd to use %_libdir when setting up chroot dir -- dhcpsync: name of slave can be given as argument; update man page -- rc.dhcpd: no longer source rc.config -- don't try insserv on dhclient init script -- it's dropped -- tell fillup to use "dhcpd" instead of the package name (dhcp) -- update to 3.0.1rc6 -- Fix the off-by-one error in the MAC-address checking code for - DHCPRELEASE that was added in 3.0.1rc5. -- Fix a bug where client-specific information was not being - discarded from the lease when it expired or was released, - resulting in problems if the lease was reallocated to a - different client. -- merge pools if possible -- workaround for some Lexmark printers that send a double-NUL- - terminated host-name option, which would break DNS updates. -- no longer log fallback_discard messages -- dhcp-3.0.1rc5-release.dif obsolete hereby -- drop dhclient init script (obsoleted by /sbin/if*-dhcp) -- update to 3.0.1rc5 -- Fix a bug that would cause the DHCP server to spin if asked to - parse a certain kind of incorrect statement. -- Fix a related bug that would prevent an error from being - reported in the same case. -- Additional documentation. -- Make sure that the hardware address matches the lease when - processing a DHCPRELEASE message. -- add dhcp-3.0.1rc5-release.dif that corrects an error by one in - the code that finds a lease that is being RELEASEd -- use ddns-update-style interim instead of ad-hoc when testing -- make sure that dhcpd is started after xntpd (failover needs - correct system time) -- drop version 2 of dhcpd and dhcrelay -- removed START_ variables, moved rc.config.d -> sysconfig -- update to 3.0.1rc4 -- add dhcpsync and dhcpync.8 (script to sync DHCP failover config.) -- update rc.dhclient script from the one used in the dhcpcd package -- client: don't check if a device is there; terminate anyway -- small addition to the examples; update README.upgrade -- update to 3.0.1rc2 -- add a README.upgrade -- update to 3.0.1rc1 -- remove our #undef use_LPF patch for 2.0pl5; it seems to cause - problems (stopping responding) with more than one network card -- mark /etc/dhclient.conf with noreplace tag -- fix stupid bug in rc.dhcpd where rc.config is sourced too late -- fix #9962 where "exit 1" instead of "return" in dhclient-script - would confuse dhclient (which then DECLINEd the lease) -- make sure that files are really copied to the chroot dir -- add libnss_dns6.so.2 as ghost to the file list to remove it - from the chroot dir when uninstalling the package -- rc.dhcpd: remove empty pid files to avoid warnings by - checkproc/killproc (dhcpd sometimes leaves them if it does not - want to start due to wrong syntax) -- rc.dhcpd: to save time, source rc.config only when necessary -- add dhcpd.conf examples -- update to 3.0rc12 (fixes some failover state transitions; other - failover fixes; always returns a subnet selection option if one - is sent) -- change dhclient-script to ignore lines that are commented out - when grepping for variables and eval-ing them -- add filedes.dif that gives scripts executed from dhclient-script - their own filedescriptors (patch by Brian Somers - <brian@Awfulhak.org>) -- correct typo in rc.dhcpd -- update to 3.0rc10 -- change default in rc.config.d.dhcrelay -- add /usr/sbin/svtest, /usr/bin/omshell, and omshell man pages -- new variable in rc.dhcpd.config: $DHCPD_CONF_INCLUDE_FILES, for - dhcpd.conf include files to be copied to $chroot/etc/ -- update to 3.0rc7 (failover and OMAPI fixes, see RELNOTES) -- on 64 bit archs, define -DPTRSIZE_64BIT -- fix missing include -- if resolv.conf does not exist, touch it; so that there is a file - to back up and restore later and the temporary resolv.conf would - not persist after stopping the client [#8078] -- use the modify_resolvconf tool to cleanup old backup files before - starting the daemon, because it does it intelligently [#8077] -- don't provide empty /etc/rc.config.d/dhcpd.rc.config because that - inhibits the correct removal of variables from rc.config -- mention correct version numbers in mail to root (now using - version macro) -- fix a typo and a nonsense comment in rc.config.d.dhcpd -- update to 3.0rc4 (bugfixes) -- add empty dir /var/lib/dhcp/dev and documentation about how to - ensure that logging from the chroot jail works [#6906] -- update to 3.0rc2pl1: fixes bugs in the failover implementation - and a memory smash that happens when fixed-address leases are - used -- Read dhcp client script hooks if they exist, rather than only if - they're executable. -- new file: 3.0b1 lease conversion script -- Init scripts: get try-restart ("restart when running") right -- client: -- dhclient-script is now correctly installed to /sbin (thus, - don't mv dhclient-script from /etc/ to /sbin/, thereby - overwriting it with the one from v2) -- move rcdhclient conveniency link to /sbin/ (same as in dhcpcd) -- update info header for resolv.conf acc. to guidelines -- server: -- don't run in chroot environment and as nobody by default -- add missing %postun for subpackages to rearrange runlevel - links after deinstalling -- update to 3.0b2pl24 -- don't use rc_status -u in init scripts (option was dropped) -- always run test of dhcpd -- update to 3.0b2pl18 - * trim chroot/non-root patch and the other security patches into - dhcp-3.0b2pl18.paranoia.dif - * build stable version of server (2.0pl5) and include the binary - as well as the man pages with '-2' suffix (same for dhcrelay) -- split off subpackages: dhcrelay, dhcp-devel -- reworked all init scripts - * adhere to LSB and use new rc.status functions - * rc.dhcpd: at start, copy conf file and libs to chroot dir - * rc.dhcpd: add syntax check - * rc.dhcrelay: make interface configurable - * rc.dhclient: improve resolv.conf handling -- dhclient: catch TERM to restore resolv.conf before quitting -- create /etc/rc.config.d/dhcrelay.rc.config -- create /etc/rc.config.d/dhclient.rc.config -- clean up Provides/Conflicts -- rework SuSE-fillup templates (and rename them) -- mark libraries for chroot dir as %ghost -- when ABUILD_RUN_TEST_SUITES is true, start dhcpd for a simple - test -- add dhcpd-thomas.diff from <thomas@suse.de> - * query for the real UID and not for the effective UID - * drop supplementary GID's - * avoid potential buffer overflow -- copy dhcpd.conf instead of moving it -- add $syslog to Required-Start in server init script -- fix Required-Start in client init script -- bzipped sources -- dhcpd.conf will no longer be installed in /etc/ but placed in the - docdir, since it is a nonfunctional example file -- test for etc/SuSE-release in %post -- fix removal of variables from rc.config which failed sometimes -- update {README,LIESMICH}.SuSE -- added paranoia patch by Ari Edelkind to allow dhcpd run chrooted - in /var/lib/dhcp and as nobody/nogroup. Both is optional. -- moved dhcpd.conf to /var/lib/dhcp/etc/. The file will also be - moved by %post -- moved rc.config options to rc.config.d/dhcpd.rc.config - (existing variables are moved there by %post) -- added some syntax checking via undocumented -t switch, and write - log file during startup -- renamed start script from dhcp to dhcpd -- removed /var/run/dhcpd.pid from the package -- tag some %configs with (noreplace) -- use BuildRoot -- added "Provides: dhcp2"+"Conflicts: dhcp3" in anticipation of v3 -- added {README,LIESMICH}.SuSE and the paranoia patch to the docs -- format string security bugs in syslog(3) calls fixed. -- in runlevel 2, start only the client, not the server/relay -- tell insserv to start after $named -- improved comments -- package dhclient requires net-tools, not net_tool -- removed superfluous Provides dhclient in package dhclient -- Update to dhcp-2.0pl5.tar.gz -- This includes a security fix that applies to the DHCP client *only* -- adapted spec file to use /etc/init.d for the scripts instead of - /sbin/init.d and let insserv create the links -- extracted source files from diff and placed them separately -- included paranoia (non-root/chroot) patch by ari edelkind. This - needs testing, and possibly an adapted start script -- Fix argument type of dhcp_option_ev_name. -- Set DEBUG, not COPTS. -- updated to dhcp-2.0pl3 -- Fix handling of abandoned leases with BOOTP. -- Properly handle default lease timeout. -- make dchpd quiet -- changed test for availability of device in rcdhlient: - now using ifconfig, so automatically loading of modules - will be triggered (Bug 3415) -- patched dhclient.c do to a possible root exploit bug - (patch from Pavel Kankovsky <peak@argo.troja.mff.cuni.cz>) - Still to be improved, waiting for Ted Lemon to rework it. -- reworked rcdhclient once again. -- update to dhcp-2.0.pl2 -- dhclient: hostname will only be set, if there is a - DHCLIENT_SET_HOSTNAME=yes (default =no) - in /etc/rc.config. (fixes bug 2807 and 3146) -- update to dhcp-2.0.pl1 -- moved /var/state/dhcp to /var/lib/dhcp -- moved manpages to %{_mandir} -- changed rcdhclient: DHCLIENT is obsolete now. It will be started - if it finds any IFCONFIG_x=dhcpclient -- Treat Linux 2.3 as linux-2.2 configuration. -- added "Provides: dhcp_client" and "Conflicts: dhcpcd" to - dhclient section in spec file -- added "Provides: dhcp_server" to dhcp section -- corrected typo in rc.config variables -- added Group Tag and version macro to spec file -- changed Summary: to "ISC DHCP client" -- moved man pages to /usr/share/man -- now set hostname in dhclient-script [BUG#1262] -- reduced waiting time to 1 second -- wait 5 seconds after dhclient start to acquire an IP adress so the - following scripts have a working network setup -- changes from Josh for @home cablenet -- added changes by Lenz Grimmer to use - ifconfig $NETDEV 0.0.0.0 up - for device setup -- applied patch of Bernhard Bender <Bernhard.Bender@elsa.de> - to use the correct interface. -- added client latency time and rc.config entry -- fixed requirements for sub packages -- ran old prepare_spec on spec file to switch to new prepare_spec. -- changed comment for rc.config -- fix from werner@suse.de for /sbin/init.d/dhclient -- added new dhclient-script from werner -- new version 2.0 -- apply fix from Michael Hasenstein -- fixed man5-path -- new version 2.0b1pl16 (stable beta) -- leases are now stored in /var/state/dhcp/ (thanks to Ted Lemmon) -- correct paths in manpages -- PID files as %ghost in filelist -- new version 2.0b1pl13 -- added /usr/sbin/rcdhcp - /usr/sbin/rcdhcrelay - /usr/sbin/rcdhclient -- new init scripts for SuSE Linux 6.0 -- minor changes for new rpm -- new version 2.0b1pl6 (stable beta) -- now with dhcp client and dhcp relay agent -- added init scripts for relay agent and client -- changed from $NETDEV_0 to $DHCPD_INTERFACE -- new version 1.0pl2 fixes two potential input buffer overrun problems - that were missed in Patchlevel 1 -- new security patch 1.0pl1 included - changed /sbin/init.d/dhcp to run on $NETDEV_0 -- new version 1.0.0 this is not beta any more! -- switched to dhcp.spec instead of Makefile.Linux -- Upddate to Version 5 beta 16 and made entry for rc.config and - /sbin/init.d for startup/shutdown - There is no dhcp client in this package anymore. -- build the package for the first time - - - - - -- Fix heap overflow in the asf plugin (CVE-2006-2458) [# 176280]. -- Fix heap overflow in the qt plugin (CVE-2006-2458) [# 176280]. -- Update to version 0.5.10: - Fix buffer overflows of the pdf plugin (xpdf derived code). -- converted neededforbuild to BuildRequires -- Update to version 0.5.9. -- Update to version 0.5.8. -- Update to version 0.5.7. -- basicio-ns-fix.diff: Remove extra qualification. -- add norootforbuild -- Add libvorbis libvorbis-devel libogg-devel to neededforbuild. -- Update to version 0.5.2. -- Update to version 0.5.0: - * xpdf related security fixes. -- Apply libextractor-destdir.diff; for now, do not try to build the - Python extension. -- Update to version 0.4.0: - * Improve MP3 support (ID3 tags) - * PDF fixes. - * Better UTF-8 support. -- Update to version 0.3.9. -- Update to version 0.3.8. -- remove extra version line in devel subpackage -- New package: version 0.3.4. - - - - - -- Fix heap overflow in the asf plugin (CVE-2006-2458) [# 176280]. -- Fix heap overflow in the qt plugin (CVE-2006-2458) [# 176280]. -- Update to version 0.5.10: - Fix buffer overflows of the pdf plugin (xpdf derived code). -- converted neededforbuild to BuildRequires -- Update to version 0.5.9. -- Update to version 0.5.8. -- Update to version 0.5.7. -- basicio-ns-fix.diff: Remove extra qualification. -- add norootforbuild -- Add libvorbis libvorbis-devel libogg-devel to neededforbuild. -- Update to version 0.5.2. -- Update to version 0.5.0: - * xpdf related security fixes. -- Apply libextractor-destdir.diff; for now, do not try to build the - Python extension. -- Update to version 0.4.0: - * Improve MP3 support (ID3 tags) - * PDF fixes. - * Better UTF-8 support. -- Update to version 0.3.9. -- Update to version 0.3.8. -- remove extra version line in devel subpackage -- New package: version 0.3.4. - - - - - -- Fix heap overflow in the asf plugin (CVE-2006-2458) [# 176280]. -- Fix heap overflow in the qt plugin (CVE-2006-2458) [# 176280]. -- Update to version 0.5.10: - Fix buffer overflows of the pdf plugin (xpdf derived code). -- converted neededforbuild to BuildRequires -- Update to version 0.5.9. -- Update to version 0.5.8. -- Update to version 0.5.7. -- basicio-ns-fix.diff: Remove extra qualification. -- add norootforbuild -- Add libvorbis libvorbis-devel libogg-devel to neededforbuild. -- Update to version 0.5.2. -- Update to version 0.5.0: - * xpdf related security fixes. -- Apply libextractor-destdir.diff; for now, do not try to build the - Python extension. -- Update to version 0.4.0: - * Improve MP3 support (ID3 tags) - * PDF fixes. - * Better UTF-8 support. -- Update to version 0.3.9. -- Update to version 0.3.8. -- remove extra version line in devel subpackage -- New package: version 0.3.4. - - - - - -- Fix heap overflow in the asf plugin (CVE-2006-2458) [# 176280]. -- Fix heap overflow in the qt plugin (CVE-2006-2458) [# 176280]. -- Update to version 0.5.10: - Fix buffer overflows of the pdf plugin (xpdf derived code). -- converted neededforbuild to BuildRequires -- Update to version 0.5.9. -- Update to version 0.5.8. -- Update to version 0.5.7. -- basicio-ns-fix.diff: Remove extra qualification. -- add norootforbuild -- Add libvorbis libvorbis-devel libogg-devel to neededforbuild. -- Update to version 0.5.2. -- Update to version 0.5.0: - * xpdf related security fixes. -- Apply libextractor-destdir.diff; for now, do not try to build the - Python extension. -- Update to version 0.4.0: - * Improve MP3 support (ID3 tags) - * PDF fixes. - * Better UTF-8 support. -- Update to version 0.3.9. -- Update to version 0.3.8. -- remove extra version line in devel subpackage -- New package: version 0.3.4. - - - - -- make the default userconfigs the same as the system configs so - ivman started as user uses halmount too. [#173524] -- halmount.py: - * don't use obsolete volume.policy.desired_mount_point (#158266) - * quote unicode characters/catch exception if python doesn't like - the string (#158266) -- halmount.py: - * let hal choose the mountpoint if it says mountpoint - invalid (#146306) - * catch dbus errors upon connect to avoid ugly message if hal is - not running/not ready yet -- install symlink halmount -> halmount.py to match config file -- specfile cleanup -- Initial package, version 0.6.9 - - - - -- make the default userconfigs the same as the system configs so - ivman started as user uses halmount too. [#173524] -- halmount.py: - * don't use obsolete volume.policy.desired_mount_point (#158266) - * quote unicode characters/catch exception if python doesn't like - the string (#158266) -- halmount.py: - * let hal choose the mountpoint if it says mountpoint - invalid (#146306) - * catch dbus errors upon connect to avoid ugly message if hal is - not running/not ready yet -- install symlink halmount -> halmount.py to match config file -- specfile cleanup -- Initial package, version 0.6.9 - - - - -- make the default userconfigs the same as the system configs so - ivman started as user uses halmount too. [#173524] -- halmount.py: - * don't use obsolete volume.policy.desired_mount_point (#158266) - * quote unicode characters/catch exception if python doesn't like - the string (#158266) -- halmount.py: - * let hal choose the mountpoint if it says mountpoint - invalid (#146306) - * catch dbus errors upon connect to avoid ugly message if hal is - not running/not ready yet -- install symlink halmount -> halmount.py to match config file -- specfile cleanup -- Initial package, version 0.6.9 - - - - -- make the default userconfigs the same as the system configs so - ivman started as user uses halmount too. [#173524] -- halmount.py: - * don't use obsolete volume.policy.desired_mount_point (#158266) - * quote unicode characters/catch exception if python doesn't like - the string (#158266) -- halmount.py: - * let hal choose the mountpoint if it says mountpoint - invalid (#146306) - * catch dbus errors upon connect to avoid ugly message if hal is - not running/not ready yet -- install symlink halmount -> halmount.py to match config file -- specfile cleanup -- Initial package, version 0.6.9 - - - -- Fix cryptsetup to work when the device does not exist yet - [#175931] -- converted neededforbuild to BuildRequires -- Remove symlinks to hashalot we don't want -- Fix uninitialized var in dmconvert. Add - * dmconvert-0.2-uninitialized.patch -- Fix return value in cryptsetup. Add - * cryptsetup-0.1-retval.patch -- Link cryptsetup static so it can be in /sbin and you can get - /usr over nfs or even crypted -- New package, Version 2.12q - - - -- Fix cryptsetup to work when the device does not exist yet - [#175931] -- converted neededforbuild to BuildRequires -- Remove symlinks to hashalot we don't want -- Fix uninitialized var in dmconvert. Add - * dmconvert-0.2-uninitialized.patch -- Fix return value in cryptsetup. Add - * cryptsetup-0.1-retval.patch -- Link cryptsetup static so it can be in /sbin and you can get - /usr over nfs or even crypted -- New package, Version 2.12q - - - -- Fix cryptsetup to work when the device does not exist yet - [#175931] -- converted neededforbuild to BuildRequires -- Remove symlinks to hashalot we don't want -- Fix uninitialized var in dmconvert. Add - * dmconvert-0.2-uninitialized.patch -- Fix return value in cryptsetup. Add - * cryptsetup-0.1-retval.patch -- Link cryptsetup static so it can be in /sbin and you can get - /usr over nfs or even crypted -- New package, Version 2.12q - - - -- Fix cryptsetup to work when the device does not exist yet - [#175931] -- converted neededforbuild to BuildRequires -- Remove symlinks to hashalot we don't want -- Fix uninitialized var in dmconvert. Add - * dmconvert-0.2-uninitialized.patch -- Fix return value in cryptsetup. Add - * cryptsetup-0.1-retval.patch -- Link cryptsetup static so it can be in /sbin and you can get - /usr over nfs or even crypted -- New package, Version 2.12q - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-avahi-1399.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-avahi-1399.xml deleted file mode 100644 index 577123d..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-avahi-1399.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - avahi - buffer overflow in avahi - Pufferüberlauf in avahi - A local exploitable buffer overflow has been found in -avahi. The impact is low since avahi is running in a chroot -environment. - - Ein lokal ausnutzbarer Pufferüberlauf wurde in avahi -gefunden Da avahi in einer chroot-Umgebung läuft,ist das -Risiko eines Angriffes gering. - - - - - - security - - - avahi - i586 - - 0591487b293027292fb55d3fd3402e5dd2cb4184 - - - avahi - ppc - - 4af6068aa9c160924eba7014a5885c2767b51fb0 - - - avahi - x86_64 - - a46d02c6fcf43387c9424c35933f9c0476d35a4b - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcdbd-1315.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-dhcdbd-1315.xml deleted file mode 100644 index 608066a..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcdbd-1315.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - dhcdbd - bugfix for dhcdbd (DHCLIENT_HOSTNAME_OPTION) - bugfix für dhcdbd (DHCLIENT_HOSTNAME_OPTION) - Support DHCLIENT_HOSTNAME_OPTION, the ability to send the -hostname to the DHCP server, in NetworkManager. - - Die Unterstützung für DHCLIENT_HOSTNAME_OPTION wurde -hinzugefügt, um den Hostnamen auch von NetworkManager aus -an den DHCP server senden zu können. - - - - - - recommended - - - dhcdbd - i586 - - 23b988b5b6e50d7cfda50dda22508c5f1dd07307 - - - dhcdbd - ppc - - da37d6c81230024f202fbb92107ab88ade872bd3 - - - dhcdbd - x86_64 - - bca8cb431261bf677ea69c848c1d54a34b16189a - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1316.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1316.xml deleted file mode 100644 index 0884b92..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1316.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - dhcp - bugfix for dhcp (DHCLIENT_HOSTNAME_OPTION) - bugfix für dhcp (DHCLIENT_HOSTNAME_OPTION) - Support DHCLIENT_HOSTNAME_OPTION, the ability to send the -hostname to the DHCP server, in NetworkManager. - - Die Unterstützung für DHCLIENT_HOSTNAME_OPTION wurde -hinzugefügt, um den Hostnamen auch von NetworkManager aus -an den DHCP server senden zu können. - - - - - - recommended - - - dhcp - i586 - - 7ba58f2b9498981c5f20d25f9675a6592317b694 - - - dhcp - ppc - - 739feea694870b250262a846af418e4c3d887ecd - - - dhcp - x86_64 - - 7042e04a0b649bcc0a2100ddde62e8fb1ce82927 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1424.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1424.xml deleted file mode 100644 index 95ab0c4..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-dhcp-1424.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - dhcp - bugfix for dhcp (DHCLIENT_HOSTNAME_OPTION) - bugfix für dhcp (DHCLIENT_HOSTNAME_OPTION) - Support DHCLIENT_HOSTNAME_OPTION, the ability to send the -hostname to the DHCP server, in NetworkManager. - - Die Unterstützung für DHCLIENT_HOSTNAME_OPTION wurde -hinzugefügt, um den Hostnamen auch von NetworkManager aus -an den DHCP server senden zu können. - - - - - - - recommended - - - dhcp - i586 - - 22a69d9e4b792e588b4542659fa4ac329fd9e5a8 - - - dhcp - ppc - - f6ba046b24618a07a8b0cc1477e039a8150c0ab1 - - - dhcp - x86_64 - - 5b8842037e72ca22fa32df2516962822e4c6a313 - - - dhcp-client - i586 - - f9e69cf37731c8b7323c34d46d20b444d551c765 - - - dhcp-client - ppc - - 729e9b2704cab26322040c44f0315280c9db0eab - - - dhcp-client - x86_64 - - a45eeef08edd16af1b70ca359d1032cf01e28de3 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-dovecot-1398.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-dovecot-1398.xml deleted file mode 100644 index 30b04ef..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-dovecot-1398.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - dovecot - dovecot security update - dovecot Sicherheitsupdate - Users could potentially find out mailbox names of other -users (CVE-2006-2414). - - Benutzer konnten unter Umständen die Mailboxnamen anderer -Benutzer herausfinden (CVE-2006-2414). - - - - - - security - - - dovecot - i586 - - 4d7988178018b1d5af490ac899d1cdfd2419ff52 - - - dovecot - ppc - - 1c550fddb834bce56275ba603276b27296e03cf7 - - - dovecot - x86_64 - - 57cd740de9f629fae4c0f6b665634ccfd40845fc - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-ivman-1423.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-ivman-1423.xml deleted file mode 100644 index f506e72..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-ivman-1423.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - ivman - Fix user configuration - Fix User Konfiguration - Change user configuration files to use halmount - - Ändern der User Konfiguration um halmount zu benutzen - - - - - - recommended - - - ivman - i586 - - a144f4f4e4dd6a949f7b0ca7c79c3bb8a2e56851 - - - ivman - ppc - - 140b8a8de66f5f1ba8d8160f2ee2054e6fd7e138 - - - ivman - x86_64 - - 4430628c022d87831285e2c8b42c26638b182987 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-libextractor-1426.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-libextractor-1426.xml deleted file mode 100644 index b647e3c..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-libextractor-1426.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - libextractor - Fix Heap Overflows - Fehlerbehebung für Heap-Overflows - Fix heap overflow in the asf plugin (CVE-2006-2458) [# -176280]. Fix heap overflow in the qt plugin (CVE-2006-2458) -[# 176280]. - - Heap-Overflow im asf- und qt-Plugin behoben -(CVE-2006-2458) [# 176280]. - - - - - - security - - - libextractor - i586 - - 1cd7ea460f5e4210df54699831f528287bb918f8 - - - libextractor - ppc - - 06a9e560a069498df7bbb3a8978b4a6dc9e03164 - - - libextractor - x86_64 - - 39753714ea4afc56bb957742bc74e31126beb474 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-nagios-www-1311.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-nagios-www-1311.xml deleted file mode 100644 index 0414003..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-nagios-www-1311.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - nagios-www - An integer overflow has been fixed. - Ein Integer-Überlauf wurde behoben. - An Integer-Overflow exists within the handling of HTTP -headers by CGIs. This could lead to arbitrary code -execution by remote attackers on behalf of the Nagios CGI -scripts. CVE-2006-2162 has been assigned to this issue. - - Ein Integer-Überlauf im Handhaben von HTTP-Headern in den -Nagios-CGI Skripten kann dazu führen, dass entfernte -Angreifer beliebige Befehle ausführen können. CVE-2006-2162 -wurde diesem Problem zugewiesen. - - - - - - security - - - nagios-www - i586 - - 52f27233cfb8fc172c9660f1c6b5dadebdede30e - - - nagios-www - x86_64 - - 3bfcce7e5a0d0daf60bc1a89eb2d8e0a4efe6b8a - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-openldap2-1323.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-openldap2-1323.xml deleted file mode 100644 index 53a1bc6..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-openldap2-1323.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - openldap2 - Bugfix for the OpenLDAP Server - Bugfix für den OpenLDAP Server - Fixes a problem that could crash the OpenLDAP server daemon -while processing Operations with Pre/PostRead LDAP-Controls. - - Behebt einen Fehler bei der Verarbeitung von Operationen -mit Pre/PostRead LDAP-Controls, der zum Absturz des -OpenLDAP Servers führt. - - - - - - recommended - - - openldap2 - i586 - - a6a40ca62165ceddc09181a9c6d11243b544dbc3 - - - openldap2 - ppc - - 2fe6c9ec6a1f7e52edc54154f70421ce9aeb5f96 - - - openldap2 - x86_64 - - 3bb100100080c39f059b055ff2f8e96135f5e721 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-opera-1313.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-opera-1313.xml deleted file mode 100644 index 7647f4b..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-opera-1313.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - opera - Code execution via stylesheet attributes in Opera. - Code execution via stylesheet attributes in Opera. - Integer signedness error in Opera before 8.54 allows remote -attackers to execute arbitrary code via long values in a -stylesheet attribute, which pass a length check. -(CVE-2006-1834) - - Ein Integer Vorzeichenproblem in Opera vor 8.54 erlaubt -entfernten Angreifern Programmcode auszuführen in dem sehr -lange Werte in stylesheet Attributen verwendet werden, die -einen anderen Längencheck überstehen. (CVE-2006-1834) - - - - - - security - - - opera - i586 - - d401b0253012e812a395ddb043f5b0ab02eff59e - - - opera - x86_64 - - c67d4bea93ba82482aaff57cae548fb0da1e8f9d - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-pdns-1314.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-pdns-1314.xml deleted file mode 100644 index ef7777d..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-pdns-1314.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - pdns - pdns security update - pdns Sicherheitsupdate - Remote attackers could crash the pdns server by sending -malformed packets (CVE-2006-2069). - - Durch Senden von Fehlerhaften Paketen konnte der pdns -server von entfernten Angreifern zum Absturz gebracht -werden (CVE-2006-2069). - - - - - - security - - - pdns - i586 - - 47aa34762bfe1b236dc8f97ddbc6c71e1ae1184b - - - pdns - x86_64 - - cc316a1be4793728b58aa0d4f8d74cc334bf1cd9 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patch-util-linux-crypto-1425.xml b/libzypp/devel/devel.dmacvicar/repodata/patch-util-linux-crypto-1425.xml deleted file mode 100644 index 3774019..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patch-util-linux-crypto-1425.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - util-linux-crypto - util-linux-crypto bugfi - util-linux-crypto bugfix - Fix cryptsetup to work with no yet existing device maps. - - Fehlerbehebung für cryptsetup um mit noch nicht -exisitierenden device maps umgehen zu können. - - - - - - recommended - - - util-linux-crypto - i586 - - 5f64cb2a850f614871e7ce39e5927f2f16b138c7 - - - util-linux-crypto - ppc - - e63397586ea3e175876cc4dd476e847eea0e0f2e - - - util-linux-crypto - x86_64 - - 8b428d265f0998310d65412f56babd53d4bced53 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/patches.xml b/libzypp/devel/devel.dmacvicar/repodata/patches.xml deleted file mode 100644 index ed324f2..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/patches.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 393b281520cdbf9a5d0d5c8895914fb50d6fa0d1 - - - - 63d7c7b0cffdf4260b4f89871efb7ce453bc7013 - - - - 9918bf4f5570934b1f719e3ac317f220356ca383 - - - - 8861b210749d672304aadae7b0c41621794d4f3b - - - - 2f69d65a2e22aa9ed236e5ead1db7f3bab4090f2 - - - - d873de1db8c957c39cca93e828b69f3a1e0f3b70 - - - - 3d9171d6a9e6352ba77f735250757dca0b5c236a - - - - e2664d7837b76981a86cb55ba242d163967e2ed2 - - - - c3664684e735e36c928a4433aad7754181a018af - - - - d38edb46ea3f67e32942f3d9d6aae54e30aab210 - - - - e0fbe295ccb485009a7a67d3cfadca7bb3c7f269 - - - - 574d75c7a19043fad974a9834bba46f74f542294 - - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/primary.xml.gz b/libzypp/devel/devel.dmacvicar/repodata/primary.xml.gz deleted file mode 100644 index 22832ef..0000000 Binary files a/libzypp/devel/devel.dmacvicar/repodata/primary.xml.gz and /dev/null differ diff --git a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml b/libzypp/devel/devel.dmacvicar/repodata/repomd.xml deleted file mode 100644 index 62881ae..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 7ae86874a55ad530365bc628d70895aa3326bfb2 - 1148377817 - d94fea237ec937d9e0a7173192655f9c3a8feff7 - - - - b217f997b92c1864f9fd0182f7b1add1c86bcf2d - 1148377817 - 9796a2d1ca2bd7bbe9393d74c1a2dcde2aa89807 - - - - a8257f48edbc6ec56aa9490acacaeecaafae1f2d - 1148377817 - a8257f48edbc6ec56aa9490acacaeecaafae1f2d - - - - 88eb9c75f5e7d9ee2db9faee5ec4e83026f3bd24 - 1148377817 - 76c223d9c262a46054b550246d70fc5cb1519aa8 - - diff --git a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.asc b/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.asc deleted file mode 100644 index 2dd0b25..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.0.7 (GNU/Linux) - -iD8DBQBEctraqE7a6JyACsoRAnwVAJ99UlSJksx6iYWr/GmkFMlvd1pidQCg -gR4qP2Y3BBL6YYF7lQY4C9swhSs= -=Tnl5 ------END PGP SIGNATURE----- diff --git a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.key b/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.key deleted file mode 100644 index 91c316f..0000000 --- a/libzypp/devel/devel.dmacvicar/repodata/repomd.xml.key +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.0 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/devel/devel.dmacvicar/rpmbuilder.cc b/libzypp/devel/devel.dmacvicar/rpmbuilder.cc deleted file mode 100644 index c9b4edf..0000000 --- a/libzypp/devel/devel.dmacvicar/rpmbuilder.cc +++ /dev/null @@ -1,160 +0,0 @@ -#include - -#include -#include - -#include -#include -#include - -#include "zypp/Product.h" -#include "zypp/Package.h" - -#include "zypp/TmpPath.h" -#include "zypp/ExternalProgram.h" -#include "zypp/ProgressData.h" -#include "zypp/repo/yum/Downloader.h" - -#include "zypp/sat/Pool.h" - -#include "zypp/PoolQuery.h" - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using namespace zypp::filesystem; - -class RpmBuilder -{ -public: - RpmBuilder() - { - Pathname top = _tmptop.path(); - Pathname rcpath = _tmprc.path(); - - assert_dir(top / "build" ); - assert_dir(top / "rpms" ); - - /* create a rpm configuration file and - setup the macros file */ - std::ofstream rcfile(rcpath.c_str()); - if (!rcfile) - ZYPP_THROW (Exception( "Can't open " + rcpath.asString() ) ); - - rcfile << "macrofiles: " << _tmpmacros.path() << endl; - rcfile.close(); - } - - Pathname rpmsDir() const - { - return _tmptop.path() / "rpms"; - } - - void createRpmMetadata() const - { - const char* argv[] = - { - "createrepo", - rpmsDir().c_str(), - NULL - }; - ExternalProgram prog(argv,ExternalProgram::Normal_Stderr, false, -1, true); - string line; - int count; - for(line = prog.receiveLine(), count=0; !line.empty(); line = prog.receiveLine(), count++ ) - { - cout << line; - } - prog.close(); - - } - - void buildSpec( const Pathname &spec ) - { - Pathname basedir = spec.dirname(); - Pathname rcpath = _tmprc.path(); - Pathname macrospath = _tmpmacros.path(); - - std::ofstream macrosfile(macrospath.c_str()); - if (!macrosfile) - ZYPP_THROW (Exception( "Can't open " + macrospath.asString() ) ); - - macrosfile << "%topdir " << _tmptop.path() << endl; - macrosfile << "%_builddir %{topdir}/build" << endl; - macrosfile << "%_rpmdir %{topdir}/rpms" << endl; - macrosfile << "%_srcrpmdir %{topdir}/rpms" << endl; - macrosfile << "%_sourcedir " << basedir << endl; - macrosfile << "%_specdir " << basedir << endl; - - macrosfile.close(); - - const char* argv[] = - { - "rpmbuild", - "--rcfile", - rcpath.c_str(), - "-bb", - //"--clean", - "--buildroot", - _tmpbuildroot.path().c_str(), - spec.c_str(), - NULL - }; - ExternalProgram prog(argv,ExternalProgram::Normal_Stderr, false, -1, true); - string line; - int count; - for(line = prog.receiveLine(), count=0; !line.empty(); line = prog.receiveLine(), count++ ) - { - cout << line; - } - prog.close(); - - } - -private: - TmpDir _tmptop; - TmpFile _tmprc; - TmpFile _tmpmacros; - TmpDir _tmpbuildroot; -}; - -int main(int argc, char **argv) -{ - try - { - ZYpp::Ptr z = getZYpp(); - - //z->initializeTarget("/"); - //z->target()->load(); - - //sat::Pool::instance().addRepoSolv("./foo.solv"); - -// for ( ResPool::const_iterator it = z->pool().begin(); it != z->pool().end(); ++it ) -// { -// ResObject::constPtr res = it->resolvable(); -// if ( res->name() == "kde4-kcolorchooser") -// { -// cout << res << endl; -// cout << res->summary() << " | " << res->size() << endl; -// } -// } - - //query.execute("kde", &result_cb); - - RpmBuilder builder; - builder.buildSpec("/space/git/hwenable/spec/testdriver.spec"); - builder.createRpmMetadata(); - - - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - cout << e.msg() << endl; - } - - return 0; -} - - - diff --git a/libzypp/devel/devel.dmacvicar/testbed.cc b/libzypp/devel/devel.dmacvicar/testbed.cc deleted file mode 100644 index f0ebf04..0000000 --- a/libzypp/devel/devel.dmacvicar/testbed.cc +++ /dev/null @@ -1,81 +0,0 @@ -#include - -#include -#include - -#include -#include -#include - -#include "zypp/Product.h" -#include "zypp/Package.h" -#include "zypp/Fetcher.h" -#include "zypp/TmpPath.h" -#include "zypp/ProgressData.h" - -#include "zypp/sat/Pool.h" - -#include "zypp/ZYppCallbacks.h" - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using zypp::media::MediaChangeReport; - - -bool result_cb( const ResObject::Ptr &r ) -{ - cout << r << endl; -} - -struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport - { - virtual MediaChangeReport::Action - requestMedia(zypp::Url & url, - unsigned mediumNr, - const std::string & label, - MediaChangeReport::Error error, - const std::string & description, - const std::vector & devices, - unsigned int & index) - { - cout << std::endl; - MIL << "media problem, url: " << url.asString() << std::endl; - return MediaChangeReport::IGNORE; - } - }; - - -int main(int argc, char **argv) -{ - try - { - ZYpp::Ptr z = getZYpp(); - - MediaChangeReportReceiver report; - report.connect(); - - - Fetcher fetcher; - MediaSetAccess access(Url("http://ftp.kernel.org/pub")); - filesystem::TmpDir tmp; - - OnMediaLocation loc; - loc.setLocation("/README2"); - loc.setOptional(true); - - fetcher.enqueue(loc); - fetcher.start(tmp.path(), access); - - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - cout << e.msg() << endl; - } - - return 0; -} - - - diff --git a/libzypp/devel/devel.dmacvicar/zsync.cc b/libzypp/devel/devel.dmacvicar/zsync.cc deleted file mode 100644 index cd151d1..0000000 --- a/libzypp/devel/devel.dmacvicar/zsync.cc +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include - -extern "C" { -#include -} -#include "zypp/base/Exception.h" -#include "zypp/base/Logger.h" -#include "zypp/Pathname.h" -#include "zypp/ExternalProgram.cc" -//#include - -using namespace zypp; -using namespace std; - -void read_seed_file(struct zsync_state* z, const Pathname &path ) -{ - if (zsync_hint_decompress(z) && path.basename().size() > 3 && path.extension() == ".gz" ) - { - FILE* f; - { - // ugh - char* cmd = (char *) malloc(6 + strlen(path.c_str())*2); - - if (!cmd) return; - - const char *fname = path.c_str(); - strcpy(cmd,"zcat "); - { - int i,j; - for (i=0,j=5; fname[i]; i++) - { - if (!isalnum(fname[i])) cmd[j++] = '\\'; - cmd[j++] = fname[i]; - } - cmd[j] = 0; - } - - //if (!no_progress) fprintf(stderr,"reading seed %s: ",cmd); - MIL << "Reading seed " << cmd << endl; - f = popen(cmd,"r"); - free(cmd); - } - - if (!f) - { - //perror("popen"); fprintf(stderr,"not using seed file %s\n",fname); - ZYPP_THROW(Exception("not using seed file")); - } - else - { - // 0 no progress - zsync_submit_source_file(z, f, 0); - if (pclose(f) != 0) - { - ZYPP_THROW(Exception("pclose")); - perror("close"); - } - } - } - else - { - FILE* f = fopen(path.c_str(),"r"); - MIL << "Reading seed " << path << endl; - if (!f) { - //perror("open"); fprintf(stderr,"not using seed file %s\n",fname); - ZYPP_THROW(Exception("open: " + path.asString())); - } - else - { - // 0 no progress - zsync_submit_source_file(z, f, 0); - if (fclose(f) != 0) - { - perror("close"); - } - } - } - { - long long done,total; - zsync_progress(z, &done, &total); - MIL << "Read " << path << ". Target " << (100.0f * done)/total << " complete" << endl; - } -} - -void figure_ranges(struct zsync_state* zs) -{ - //struct zsync_receiver* zr; - int num_ranges; - // it seems type is 1 for gz, 0 normal - off_t *ranges = zsync_needed_byte_ranges(zs, &num_ranges, 0); - int i=0; - - MIL << "Need to get " << num_ranges << " ranges" << endl; - - while ( i < 2*num_ranges ) - { - int from = ranges[i]; - MIL << "From: " << ranges[i] << " To: " << ranges[i+1] << endl; - i += 2; - } - - free(ranges); -} - -int main() -{ - Pathname root("/home/duncan/suse/metadata-diff"); - struct zsync_state* zs; - - FILE *f = fopen( (root+"/3/packages.zsync").c_str(), "r" ); - - if ((zs = zsync_begin(f)) == NULL) - { - exit(1); - } - - if (fclose(f) != 0) - { - perror("fclose"); exit(2); - } - - read_seed_file( zs, root + "1/packages" ); - figure_ranges(zs); - - zsync_end(zs); - return 0; -} \ No newline at end of file diff --git a/libzypp/devel/devel.dmacvicar/zypp-lock.cc b/libzypp/devel/devel.dmacvicar/zypp-lock.cc deleted file mode 100644 index 8a8d6d5..0000000 --- a/libzypp/devel/devel.dmacvicar/zypp-lock.cc +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include - -#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp -#include "boost/filesystem/fstream.hpp" // ditto - -#include - -#include -#include -#include -#include -#include -/////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -using namespace zypp::detail; - -using namespace std; -using namespace zypp; -using namespace zypp::parser::yum; -using namespace zypp::source::yum; - - - -//using namespace DbXml; - -int main() -{ - try - { - ZYpp::Ptr z = getZYpp(); - //while(1); - } - catch (...) - { - MIL << "sorry" << std::endl; - } -} - - diff --git a/libzypp/devel/devel.ma/AOUT.cc b/libzypp/devel/devel.ma/AOUT.cc deleted file mode 100644 index b56ad18..0000000 --- a/libzypp/devel/devel.ma/AOUT.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include "zypp/base/Logger.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Function.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/ProgressData.h" - -#include "zypp/base/Random.h" - -#include - -using std::endl; -using namespace zypp; - - -void action( int i_r ) -{ - unsigned sec = base::random( 3 ); - sleep( sec ); - MIL << "Action " << i_r << " (" << sec << ")" << endl; -} - - -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - for ( unsigned i = 0; i < 5; ++i ) - { - new boost::thread( bind( action, i ) ); - } - - INT << "===[END]============================================" << endl << endl; - return ( 0 ); -} diff --git a/libzypp/devel/devel.ma/Basic.cc b/libzypp/devel/devel.ma/Basic.cc deleted file mode 100644 index 4002b7e..0000000 --- a/libzypp/devel/devel.ma/Basic.cc +++ /dev/null @@ -1,284 +0,0 @@ -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "zypp/media/MediaManager.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/Fetcher.h" - -static const Pathname sysRoot( "/" ); - -using namespace std; -using namespace zypp; -using namespace zypp::ui; - - -#include - - struct DownloadProgressReceive : public callback::ReceiveReport - { - DownloadProgressReceive() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - ACCESS_DENIED, // user authent. failed while accessing restricted file - ERROR // other error - }; -#endif - virtual void start( const Url & file, Pathname localfile ) - { - USR << "DP +++ " << file << endl; - lp = 0; - } - - virtual bool progress(int value, const Url &file, double dbps_avg = -1, double dbps_current = -1) - { - if ( abs(value-lp) >= 20 || value == 100 && lp != 100 ) - { - USR << "DP " << file << " " << value << "%" << endl; - lp = value; - } - return true; - - } - - virtual Action problem( const Url &file , Error error , const std::string &description ) - { - USR << "DP !!! " << file << " (" << error << ")" << endl; - return ABORT; - - } - - virtual void finish( const Url &file , Error error , const std::string &reason ) - { - USR << "DP --- " << file << " (" << error << ")" << endl; - } - - int lp; - }; - - //////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////// - - struct DownloadResolvableReceive : public callback::ReceiveReport - { - DownloadResolvableReceive() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE, // ignore this resolvable but continue - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // the downloaded file is invalid - }; -#endif - virtual void start( Resolvable::constPtr resolvable_ptr, const Url &url ) - { - USR << "+++ " << resolvable_ptr << endl; - } - - - // Dowmload delta rpm: - // - path below url reported on start() - // - expected download size (0 if unknown) - // - download is interruptable - // - problems are just informal - virtual void startDeltaDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual bool progressDeltaDownload( int /*value*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - return true; - } - - virtual void problemDeltaDownload( const std::string &/*description*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void finishDeltaDownload() - { - USR << __PRETTY_FUNCTION__ << endl; - } - - // Apply delta rpm: - // - local path of downloaded delta - // - aplpy is not interruptable - // - problems are just informal - virtual void startDeltaApply( const Pathname & /*filename*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void progressDeltaApply( int /*value*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void problemDeltaApply( const std::string &/*description*/ ) - { - USR << __PRETTY_FUNCTION__ << endl; - } - - virtual void finishDeltaApply() - { - USR << __PRETTY_FUNCTION__ << endl; - } - - // return false if the download should be aborted right now - virtual bool progress(int value, Resolvable::constPtr resolvable_ptr) - { - if ( 1 || abs(value-lp) >= 20 || value == 100 && lp != 100 ) - { - USR << resolvable_ptr << " " << value << "%" << endl; - lp = value; - } - return true; - } - - virtual Action problem( Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*description*/ ) - { - USR << "!!! " << resolvable_ptr << " (" << error << ")" << endl; - return ABORT; - } - - virtual void finish(Resolvable::constPtr resolvable_ptr , Error error , const std::string &/*reason*/ ) - { - USR << "--- " << resolvable_ptr << " (" << error << ")" << endl; - } - - int lp; - }; - - -bool queryInstalledEditionHelper( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) -{ - if ( ed_r == Edition::noedition ) - return true; - if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") ) - return true; - if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") ) - return true; - - return false; -} - -ManagedFile repoProvidePackage( const PoolItem & pi ) -{ - ResPool _pool( getZYpp()->pool() ); - repo::RepoMediaAccess _access; - - // Redirect PackageProvider queries for installed editions - // (in case of patch/delta rpm processing) to rpmDb. - repo::PackageProviderPolicy packageProviderPolicy; - packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper ); - - Package::constPtr p = asKind( pi.resolvable() ); - - // Build a repository list for repos - // contributing to the pool - repo::DeltaCandidates deltas;//( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(), _pool.knownRepositoriesEnd() ) ); - - repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy ); - - return pkgProvider.providePackage(); -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - --argc; - ++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - ::unsetenv( "ZYPP_CONF" ); - ZConfig::instance(); - - DownloadProgressReceive _dpr; - DownloadResolvableReceive _drr; - - TestSetup::LoadSystemAt( sysRoot ); - /////////////////////////////////////////////////////////////////// - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - /////////////////////////////////////////////////////////////////// - dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ) << endl; - USR << "pool: " << pool << endl; - - if ( 0 ) { - PoolItem pi( getPi( "CDT", "amarok", Edition(), Arch_empty ) ); - SEC << pi << endl; - ManagedFile f( repoProvidePackage( pi ) ); - SEC << f << endl; - } - { - Url url("cd:///?devices=/dev/sr0"); - Pathname path(url.getPathName()); - url.setPathName ("/"); - MediaSetAccess access(url); - Pathname local = access.provideFile(path); - SEC << local << endl; - } - if ( 0 ) { - Url url("http://download.opensuse.org/debug/distribution/11.4/repo/oss/content.asc"); - url.setPathName ("/"); - MediaSetAccess access(url); - - zypp::Fetcher fch; - fch.reset(); - fch.setOptions(zypp::Fetcher::AutoAddIndexes); - - // path - add "/" to the beginning if it's missing there - std::string media_path("/debug/distribution/11.4/repo/oss/content.ascx"); - zypp::OnMediaLocation mloc(media_path, 1); - mloc.setOptional(true); - - zypp::filesystem::TmpDir tmpdir( zypp::filesystem::TmpDir::defaultLocation() ); - fch.addIndex(mloc); - fch.start(tmpdir.path(), access); - } - - - -// f.resetDispose(); -// ExternalProgram("find /tmp/var") >> DBG; -// DBG << endl; - - INT << "===[END]============================================" << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} diff --git a/libzypp/devel/devel.ma/CMakeLists.txt b/libzypp/devel/devel.ma/CMakeLists.txt deleted file mode 100644 index de9776c..0000000 --- a/libzypp/devel/devel.ma/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -## ############################################################ - -#ADD_SUBDIRECTORY( doc ) - -## ############################################################ - -SET(THREAD_LIBRARY boost_thread) - -## ############################################################ - -ADD_CUSTOM_TARGET( ma_test ALL - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ma_test - COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ma_test ${CMAKE_CURRENT_BINARY_DIR}/ma_test -) - -## ############################################################ - -FILE( GLOB ALLCC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" ) -STRING( REPLACE ".cc" ";" APLLPROG ${ALLCC} ) -FOREACH( loop_var ${APLLPROG} ) - ADD_EXECUTABLE( ${loop_var} - ${loop_var}.cc - ) - TARGET_LINK_LIBRARIES( ${loop_var} - boost_signals - zypp - ${THREAD_LIBRARY} - ) -ENDFOREACH( loop_var ) - -## ############################################################ diff --git a/libzypp/devel/devel.ma/CleandepsOnRemove.cc b/libzypp/devel/devel.ma/CleandepsOnRemove.cc deleted file mode 100644 index 7a378e6..0000000 --- a/libzypp/devel/devel.ma/CleandepsOnRemove.cc +++ /dev/null @@ -1,141 +0,0 @@ -#include "Tools.h" - -#include -#include -#include - -#include "zypp/sat/WhatObsoletes.h" -#include "zypp/ExternalProgram.h" - -/////////////////////////////////////////////////////////////////// - -//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" ); -//static const Pathname sysRoot( "/tmp/ToolScanRepos" ); -static const Pathname sysRoot( "/" ); - -/////////////////////////////////////////////////////////////////// - -bool solve() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - //getZYpp()->resolver()->setOnlyRequires( true ); - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "resolve " << rres << endl; - return true; -} - -bool upgrade() -{ - bool rres = false; - { - //zypp::base::LogControl::TmpLineWriter shutUp; - Measure x( "Upgrade" ); - rres = getZYpp()->resolver()->doUpgrade(); - } - if ( ! rres ) - { - Measure x( "Upgrade Error" ); - ERR << "upgrade " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "upgrade " << rres << endl; - return true; -} - -namespace zypp -{ - namespace target - { - void writeUpgradeTestcase(); - } -} - -std::ostream & operator<<( std::ostream & str, const sat::Solvable::SplitIdent & obj ) -{ - str << "{" << obj.ident() << "}{" << obj.kind() << "}{" << obj.name () << "}" << endl; - return str; -} - -namespace zypp { -std::ostream & dumpOn( std::ostream & str, const Url & obj ) -{ - str << "{" << obj.getHost() << "}{" << obj.getPort() << "}"; - return str; -} -} - -int main( int argc, char * argv[] ) -try { - --argc,++argv; - zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - /////////////////////////////////////////////////////////////////// - if ( sysRoot == "/" ) - ::unsetenv( "ZYPP_CONF" ); - ResPool pool( ResPool::instance() ); - sat::Pool satpool( sat::Pool::instance() ); - /////////////////////////////////////////////////////////////////// - dumpRange( WAR << "satpool.multiversion " , satpool.multiversionBegin(), satpool.multiversionEnd() ) << endl; - TestSetup::LoadSystemAt( sysRoot, Arch_i586 ); - /////////////////////////////////////////////////////////////////// - - char * fix[] = { - "test" - }; - argv = fix; - argc = arraySize(fix); - for ( ; argc; --argc,++argv ) - { - ui::Selectable::Ptr p( getSel( *argv ) ); - if ( p ) - USR << p->setToDelete() << endl; - else - ERR << p << endl; - } - - std::set todel; - { - getZYpp()->resolver()->setCleandepsOnRemove( false ); - SEC << "=== Solve noclean:" << endl; - solve(); - std::copy( make_filter_begin(pool), - make_filter_end(pool), - std::inserter( todel, todel.begin() ) ); - WAR << todel << endl; - } - { - getZYpp()->resolver()->setCleandepsOnRemove( true ); - SEC << "=== Solve clean:" << endl; - solve(); - SEC << "========================================================" << endl; - for_( it, make_filter_begin(pool), make_filter_end(pool) ) - { - ( todel.find( *it ) == todel.end() ? INT : USR ) << *it << endl; - } - SEC << "========================================================" << endl; - } - - - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); -} -catch (...) -{} - diff --git a/libzypp/devel/devel.ma/CommitCb.cc b/libzypp/devel/devel.ma/CommitCb.cc deleted file mode 100644 index a0990ba..0000000 --- a/libzypp/devel/devel.ma/CommitCb.cc +++ /dev/null @@ -1,164 +0,0 @@ -#include "Tools.h" -#include - -#include -#include -#include - -struct IRR : public zypp::callback::ReceiveReport -{ - IRR() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; - - // the level of RPM pushing - /** \deprecated We fortunately no longer do 3 attempts. */ - enum RpmLevel { - RPM, - RPM_NODEPS, - RPM_NODEPS_FORCE - }; -#endif - - virtual void reportbegin() - { SEC << endl; } - virtual void reportend() - { SEC << endl; } - - virtual void start(Resolvable::constPtr /*resolvable*/) - { INT << endl; } - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { - static int i = 4; - if ( --i <= 0 ) - { - INT << "return abort" << endl; - return false; - } - return true; - } - - virtual Action problem(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*description*/, RpmLevel /*level*/) - { - INT << "return abort" << endl; - return ABORT; - } - - virtual void finish(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*reason*/, RpmLevel /*level*/) - { INT << endl; } -}; - -struct RRR : public zypp::callback::ReceiveReport -{ - RRR() - { connect(); } -#if 0 - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; -#endif - - virtual void reportbegin() - { SEC << endl; } - virtual void reportend() - { SEC << endl; } - - virtual void start( Resolvable::constPtr /*resolvable*/ ) - { INT << endl; } - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { INT << endl; return true; } - - virtual Action problem( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*description*/ ) - { INT << endl; return ABORT; } - - virtual void finish( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*reason*/ ) - { INT << endl; } -}; - -bool solve() -{ - static unsigned run = 0; - USR << "Solve " << run++ << endl; - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - return true; -} - -bool install() -{ - ZYppCommitPolicy pol; -//pol.dryRun(true); - pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) ); - SEC << "START commit..." << endl; - SEC << getZYpp()->commit( pol ) << endl; - return true; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - IRR _irr; - RRR _rrr; - Pathname mroot( "/tmp/ToolScanRepos" ); - TestSetup test( mroot, Arch_i586 ); - test.loadTarget(); - test.loadRepos(); - - ResPool pool( test.pool() ); - ui::Selectable::Ptr sel; - - getSel( "rpm" )->setToInstall(); - vdumpPoolStats( USR << "Selected:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; - - if ( solve() ) - { - vdumpPoolStats( USR << "Solved:"<< endl, - make_filter_begin(pool), - make_filter_end(pool) ) << endl; - - install(); - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/libzypp/devel/devel.ma/DumpSolv.cc b/libzypp/devel/devel.ma/DumpSolv.cc deleted file mode 100644 index ad93024..0000000 --- a/libzypp/devel/devel.ma/DumpSolv.cc +++ /dev/null @@ -1,289 +0,0 @@ -#include "Tools.h" - -#include -#include - - -static std::string appname( __FILE__ ); -static TestSetup test; - -/////////////////////////////////////////////////////////////////// - -#define OUT USR -#define HEADL SEC << "===> " - -inline std::ostream & errmessage( const std::string & msg_r = std::string() ) -{ - cerr << "*** "; - if ( ! msg_r.empty() ) - cerr << msg_r << endl; - return cerr; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl; - errmessage( msg_r ); - cerr << endl; - } - cerr << "Usage: " << appname << " TESTCASE" << endl; - cerr << " Load and process testcase." << endl; - return exit_r; -} - -/////////////////////////////////////////////////////////////////// - -bool upgrade() -{ - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->doUpgrade(); - } - if ( ! rres ) - { - ERR << "upgrade " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "upgrade " << rres << endl; - return true; -} - -bool solve() -{ - static unsigned run = 0; - USR << "Solve " << run++ << endl; - bool rres = false; - { - zypp::base::LogControl::TmpLineWriter shutUp; - rres = getZYpp()->resolver()->resolvePool(); - } - if ( ! rres ) - { - ERR << "resolve " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - - return true; -} - -/////////////////////////////////////////////////////////////////// - -/** -*/ -struct ArgList -{ - typedef std::vector::const_iterator const_iterator; - - ArgList() - {} - - ArgList( const std::string & line_r ) - { str::splitEscaped( line_r, std::back_inserter(_argv) ); } - - const_iterator begin() const { const_iterator ret =_argv.begin(); for ( unsigned i = _carg; i; --i ) ++ret; return ret; } - const_iterator end() const { return _argv.end(); } - - void clear() { _argv.clear(); _carg = 0; } - bool empty() const { return _argv.size() == _carg; } - unsigned size() const { return _argv.size() - _carg; } - - std::string & operator[]( int idx ) { return _argv[_carg+idx]; } - const std::string & operator[]( int idx ) const { return _argv[_carg+idx]; } - - std::string at( int idx ) const { return _carg+idx < _argv.size() ? _argv[_carg+idx] : std::string(); } - - unsigned carg() const { return _carg; } - void poparg( int cnt = 1 ) { _carg = arange( _carg + cnt ); } - - public: - std::vector & get() { return _argv; } - const std::vector & get() const { return _argv; } - private: - unsigned arange( int idx ) const { return idx < 0 ? 0 : std::min( unsigned(idx), _argv.size() ); } - private: - DefaultIntegral _carg; - std::vector _argv; -}; - -std::ostream & operator<<( std::ostream & str, const ArgList & obj ) -{ - for_( it, 0U, obj.get().size() ) - { - str << ( it == obj.carg() ? " | " : " " ) << obj.get()[it]; - } - return str; -} - -/////////////////////////////////////////////////////////////////// -#define DELGATE(N,F) if ( argv.at(0) == #N ) { argv.poparg(); F( argv ); return; } -/////////////////////////////////////////////////////////////////// - -void exitCmd( ArgList & argv ) -{ - HEADL << argv << endl; - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::TmpLineWriter shutUp; - ::exit( 0 ); -} - -/////////////////////////////////////////////////////////////////// - -void helpCmd( ArgList & argv ) -{ - HEADL << argv << endl; - OUT << "list repos - list repos in pool" << endl; - OUT << "list NAME... - list solvables named or providing NAME" << endl; - OUT << "help - this" << endl; - OUT << "exit - exit" << endl; -} - -/////////////////////////////////////////////////////////////////// - -void listReposCmd( ArgList & argv ) -{ - HEADL << "list repos" << endl; - - sat::Pool satpool( test.satpool() ); - for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - OUT << *it << endl; - } -} - -void listIdent( IdString ident_r ) -{ - HEADL << "list " << ident_r << endl; - - ui::Selectable::Ptr sel( ui::Selectable::get( ident_r ) ); - if ( sel ) - { - OUT << sel->ident() - << " I" << sel->installedSize() - << " A" << sel->availableSize() - << " " << sel->status() - << endl; - for_( it, sel->installedBegin(), sel->installedEnd() ) - { - OUT << "i " << *it << endl; - } - PoolItem cand( sel->candidateObj() ); - for_( it, sel->availableBegin(), sel->availableEnd() ) - { - OUT << (*it == cand ? "* " : " ") << *it << endl; - } - } - - { - sat::WhatProvides q( (Capability( ident_r.id() )) ); - bool head = true; - for_( it, q.begin(), q.end() ) - { - if ( it->ident() != ident_r ) - { - if ( head ) - { - OUT << "provided by:" << endl; - head = false; - } - OUT << " " << PoolItem( *it ) << endl; - } - } - } -} - - -void listCmd( ArgList & argv ) -{ - DELGATE( repos, listReposCmd ); - - for_( it, argv.begin(), argv.end() ) - { - listIdent( IdString(*it) ); - } -} - -/////////////////////////////////////////////////////////////////// - -void gocmd( ArgList & argv ) -{ - if ( argv.empty() ) - { - helpCmd( argv ); - return; - } - - switch ( argv[0][0] ) - { - case 'e': - DELGATE( exit, exitCmd ); - break; - - case 'h': - DELGATE( help, helpCmd ); - break; - - case 'l': - DELGATE( list, listCmd ); - break; - } - // no command fall back to list - listCmd( argv ); -} - -void goprompt() -{ - std::cin.tie( &std::cout ); - - do { - ArgList argv; - std::cout << "Hallo : "; - str::splitEscaped( iostr::getline( std::cin ), std::back_inserter(argv.get()) ); - gocmd( argv ); - } while ( true ); - -} - -/////////////////////////////////////////////////////////////////// - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc; - ++argv; - /////////////////////////////////////////////////////////////////// - - if ( !argc ) - return usage(); - - Pathname mtest( *argv ); - --argc; - ++argv; - - if ( ! PathInfo( mtest / "solver-test.xml" ).isFile() ) - { - return usage( "No testcase at " + mtest.asString() ); - } - - /////////////////////////////////////////////////////////////////// - - test.loadTestcaseRepos( mtest ); // <<< repos -#define GOCMD(c) { ArgList argv( #c ); gocmd( argv ); } - GOCMD( tgt ); - GOCMD( iscsitarget ); - goprompt(); - - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::TmpLineWriter shutUp; - return 0; -} diff --git a/libzypp/devel/devel.ma/Ex.cc b/libzypp/devel/devel.ma/Ex.cc deleted file mode 100644 index 915644c..0000000 --- a/libzypp/devel/devel.ma/Ex.cc +++ /dev/null @@ -1,166 +0,0 @@ -#include "Tools.h" - -#include -#include -#include -#include -#include - -#include "zypp/ZYppFactory.h" -#include "zypp/ResPoolProxy.h" - -#include "zypp/ZYppCallbacks.h" -#include "zypp/NVRAD.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/Package.h" -#include "zypp/Pattern.h" -#include "zypp/Language.h" -#include "zypp/Digest.h" -#include "zypp/PackageKeyword.h" - - -#include "zypp/parser/TagParser.h" -#include "zypp/parser/susetags/PackagesFileReader.h" -#include "zypp/parser/susetags/PackagesLangFileReader.h" -#include "zypp/parser/susetags/PatternFileReader.h" -#include "zypp/parser/susetags/ContentFileReader.h" -#include "zypp/parser/susetags/RepoIndex.h" -#include "zypp/parser/susetags/RepoParser.h" -#include "zypp/cache/CacheStore.h" -#include "zypp/RepoManager.h" -#include "zypp/RepoInfo.h" - -#include "zypp/ui/PatchContents.h" -#include "zypp/ResPoolProxy.h" - -using namespace std; -using namespace zypp; -using namespace zypp::functor; -using namespace zypp::ui; -using zypp::parser::TagParser; - -/////////////////////////////////////////////////////////////////// - -static const Pathname sysRoot( "/Local/GTEST" ); - -/////////////////////////////////////////////////////////////////// - -struct Xprint -{ - bool operator()( const PoolItem & obj_r ) - { -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); -// handle( asKind( obj_r ) ); - return true; - } - - void handle( const Package_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Patch_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Pattern_constPtr & p ) - { - if ( !p ) - return; - } - - void handle( const Product_constPtr & p ) - { - if ( !p ) - return; - } -}; - -/////////////////////////////////////////////////////////////////// -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - //zypp::base::LogControl::instance().logfile( "log.restrict" ); - INT << "===[START]==========================================" << endl; - - setenv( "ZYPP_CONF", (sysRoot/"zypp.conf").c_str(), 1 ); - - RepoManager repoManager( makeRepoManager( sysRoot ) ); - RepoInfoList repos = repoManager.knownRepositories(); - SEC << "knownRepositories " << repos << endl; - - if ( repos.empty() ) - { - RepoInfo nrepo; - nrepo - .setAlias( "factorytest" ) - .setName( "Test Repo for factory." ) - .setEnabled( true ) - .setAutorefresh( false ) - .addBaseUrl( Url("http://dist.suse.de/install/stable-x86/") ); - - repoManager.addRepository( nrepo ); - repos = repoManager.knownRepositories(); - } - - for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it ) - { - RepoInfo & nrepo( *it ); - if ( ! nrepo.enabled() ) - continue; - - SEC << "refreshMetadata" << endl; - repoManager.refreshMetadata( nrepo ); - - if ( ! repoManager.isCached( nrepo ) || 0 ) - { - if ( repoManager.isCached( nrepo ) ) - { - SEC << "cleanCache" << endl; - repoManager.cleanCache( nrepo ); - } - SEC << "refreshMetadata" << endl; - repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced ); - SEC << "buildCache" << endl; - repoManager.buildCache( nrepo ); - } - - SEC << nrepo << endl; - Repository nrep( repoManager.createFromCache( nrepo ) ); - const zypp::ResStore & store( nrep.resolvables() ); - dumpPoolStats( SEC << "Store: " << endl, - store.begin(), store.end() ) << endl; - getZYpp()->addResolvables( store ); - } - - ResPool pool( getZYpp()->pool() ); - vdumpPoolStats( USR << "Initial pool:" << endl, - pool.begin(), - pool.end() ) << endl; - - if ( 0 ) - { - { - //zypp::base::LogControl::TmpLineWriter shutUp; - getZYpp()->initTarget( sysRoot ); - } - MIL << "Added target: " << pool << endl; - } - - std::for_each( pool.begin(), pool.end(), Xprint() ); - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} diff --git a/libzypp/devel/devel.ma/ExPure.cc b/libzypp/devel/devel.ma/ExPure.cc deleted file mode 100644 index 6b353a8..0000000 --- a/libzypp/devel/devel.ma/ExPure.cc +++ /dev/null @@ -1,189 +0,0 @@ -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace zypp; -using namespace zypp::parser::yum; - -#include "zypp/parser/yum/YUMParser.h" - -/////////////////////////////////////////////////////////////////// - -template - void ti( const _Cl & c ) - { - SEC << __PRETTY_FUNCTION__ << endl; - } -/////////////////////////////////////////////////////////////////// - -template - bool consume( const typename _Parser::value_type & node_r ) - { - //DBG << node_r << endl; - return true; - } - -template - void parseXmlFile( const Pathname & file_r, - function consume_r - = consume<_Parser> ) - { - Measure x( " zparse "+file_r.asString() ); - ifgzstream istr( file_r.asString().c_str() ); - if ( ! istr ) - { - ZYPP_THROW( Exception( "Bad stream" ) ); - } - - for( _Parser parser( istr, "" ); ! parser.atEnd(); ++parser ) - { - if ( consume_r && ! consume_r( *parser ) ) - { - DBG << "abort parseXmlFile " << file_r << endl; - return; - } - } - } - -bool consumeRepomd( const YUMRepomdParser::value_type & node_r ) -{ - DBG << node_r << endl; - return true; -} - -void zparse( const Pathname & repodata_r ) -{ - Measure x( "ZPARSE" ); - parseXmlFile ( repodata_r / "repomd.xml", consumeRepomd ); - parseXmlFile ( repodata_r / "primary.xml" ); - parseXmlFile ( repodata_r / "other.xml" ); - parseXmlFile( repodata_r / "filelists.xml" ); - //parseXmlFile ( repodata_r / "patches.xml" ); -} - -/////////////////////////////////////////////////////////////////// - -/** - * processNode: - * @reader: the xmlReader - * - * Dump information about the current node - */ -template -static void -processNode(xmlTextReaderPtr reader, const _ParserValueType & stp ) { - const xmlChar *name, *value; - - name = xmlTextReaderConstName(reader); - if (name == NULL) - name = BAD_CAST "--"; - - value = xmlTextReaderConstValue(reader); - string t; - if ( value ) - { - t = (const char *)value; - } - return; - printf("%d %d %s %d %d", - xmlTextReaderDepth(reader), - xmlTextReaderNodeType(reader), - name, - xmlTextReaderIsEmptyElement(reader), - xmlTextReaderHasValue(reader)); - if (value == NULL) - printf("\n"); - else { - if (xmlStrlen(value) > 40) - printf(" %.40s...\n", value); - else - printf(" %s\n", value); - } -} - - -/** - * streamFile: - * @filename: the file name to parse - * - * Parse and print information about an XML file. - */ -template -static void -streamFile(const char *filename) { - Measure x( string(" lparse ")+filename ); - xmlTextReaderPtr reader; - int ret; - - typename _Parser::value_type stp; - - reader = xmlReaderForFile(filename, NULL, 0); - if (reader != NULL) { - ret = xmlTextReaderRead(reader); - while (ret == 1) { - stp = new typename _Parser::value_type::element_type; - processNode(reader, stp); - ret = xmlTextReaderRead(reader); - } - xmlFreeTextReader(reader); - if (ret != 0) { - ZYPP_THROW( Exception( string("Failed to parse ") + filename ) ); - } - } else { - ZYPP_THROW( Exception( string("Unable to open ") + filename ) ); - } -} - -void lparse( const Pathname & repodata_r ) -{ - Measure x( "LPARSE" ); - /* - * this initialize the library and check potential ABI mismatches - * between the version it was compiled for and the actual shared - * library used. - */ - LIBXML_TEST_VERSION - - streamFile ( (repodata_r / "repomd.xml").asString().c_str() ); - streamFile ( (repodata_r / "primary.xml").asString().c_str() ); - streamFile ( (repodata_r / "other.xml").asString().c_str() ); - streamFile( (repodata_r / "filelists.xml").asString().c_str() ); - //streamFile ( (repodata_r / "patches.xml").asString().c_str() ); - - /* - * Cleanup function for the XML library. - */ - xmlCleanupParser(); - - /* - * this is to debug memory for regression tests - */ - xmlMemoryDump(); -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - Pathname repodata( "/Local/PATCHES/repodata" ); - repodata = "/Local/FACTORY/repodata"; - lparse( repodata ); - zparse( repodata ); - - INT << "===[END]============================================" << endl << endl; - return 0; -} - diff --git a/libzypp/devel/devel.ma/ExplicitMap.h b/libzypp/devel/devel.ma/ExplicitMap.h deleted file mode 100644 index 4265f36..0000000 --- a/libzypp/devel/devel.ma/ExplicitMap.h +++ /dev/null @@ -1,252 +0,0 @@ -/*---------------------------------------------------------------------\ - | ____ _ __ __ ___ | - | |__ / \ / / . \ . \ | - | / / \ V /| _/ _/ | - | / /__ | | | | | | | - | /_____||_| |_| |_| | - | | - \---------------------------------------------------------------------*/ -/** \file zypp/ExplicitMap.h - * -*/ -#ifndef ZYPP_EXPLICITMAP_H -#define ZYPP_EXPLICITMAP_H - -#include -#include - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap<_Key, _Tp> - // - /** A simple lookup map using default value for not existing entries. - * - * A std::map providing operator[] const only. Nor existing - * entries are mapped to a default value. Entries are maipulated vis - * methods \ref set and \ref unset. Helper classes \ref TmpSet, - * \ref TmpUnset and \ref TmpSetDefault are provided to temporarily - * change and automaticlly restore values. - */ - template - class ExplicitMap - { - public: - typedef typename boost::call_traits<_Tp>::value_type value_type; - typedef typename boost::call_traits<_Tp>::reference reference; - typedef typename boost::call_traits<_Tp>::const_reference const_reference; - typedef typename boost::call_traits<_Tp>::param_type param_type; - - private: - typedef typename std::map<_Key,value_type> map_type; - typedef typename map_type::iterator iterator; - - public: - typedef typename map_type::key_type key_type; - typedef typename map_type::size_type size_type; - typedef typename map_type::const_iterator const_iterator; - - public: - ExplicitMap() - {} - - explicit - ExplicitMap( param_type mapDefault_r ) - : _mapDefault( mapDefault_r ) - {} - - template - ExplicitMap( _InputIterator first_r, _InputIterator last_r ) - : _map( first_r, last_r ) - {} - - template - ExplicitMap( _InputIterator first_r, _InputIterator last_r, - param_type mapDefault_r ) - : _map( first_r, last_r ) - , _mapDefault( mapDefault_r ) - {} - - public: - size_type size() const - { return _map.size(); } - - bool empty() const - { return _map.empty(); } - - const_iterator begin() const - { return _map.begin(); } - - const_iterator end() const - { return _map.end(); } - - const_iterator find( const key_type & key_r ) const - { return _map.find( key_r ); } - - bool has( const key_type & key_r ) const - { return _map.find( key_r ) != end(); } - - const_reference get( const key_type & key_r ) const - { - const_iterator it = _map.find( key_r ); - return( it == _map.end() ? _mapDefault : it->second ); - } - - const_reference getDefault() const - { return _mapDefault; } - - const_reference operator[]( const key_type & key_r ) const - { return get( key_r ); } - - public: - void clear() - { _map.clear(); } - - void set( const key_type & key_r, param_type value_r ) - { _map[key_r] = value_r; } - - template - void set( _InputIterator first_r, _InputIterator last_r ) - { _map.insert( first_r, last_r ); } - - void unset( const key_type & key_r ) - { _map.erase( key_r ); } - - void setDefault( param_type value_r ) - { _mapDefault = value_r; } - - public: - class TmpSet; - class TmpUnset; - class TmpSetDefault; - - //private: - value_type _mapDefault; - map_type _map; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSet - // - /** Temporarily set a value. */ - template - class ExplicitMap<_Key, _Tp>::TmpSet - { - public: - TmpSet( ExplicitMap & map_r, const key_type & key_r, param_type value_r ) - : _map( map_r ) - , _key( key_r ) - { - const_iterator it = _map.find( _key ); - if ( it == _map.end() ) - { - _wasDefault = true; - } - else - { - _wasDefault = false; - _value = it->second; - } - _map.set( _key, value_r ); - } - - ~TmpSet() - { - if ( _wasDefault ) - { - _map.unset( _key ); - } - else - { - _map.set( _key, _value ); - } - } - - private: - ExplicitMap & _map; - key_type _key; - param_type _value; - bool _wasDefault; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpUnset - // - /** Temporarily unset a value. */ - template - class ExplicitMap<_Key, _Tp>::TmpUnset - { - public: - TmpUnset( ExplicitMap & map_r, const key_type & key_r ) - : _map( map_r ) - , _key( key_r ) - { - const_iterator it = _map.find( _key ); - if ( it == _map.end() ) - { - _wasDefault = true; - } - else - { - _wasDefault = false; - _value = it->second; - _map.unset( _key ); - } - } - - ~TmpUnset() - { - if ( ! _wasDefault ) - { - _map.set( _key, _value ); - } - } - - private: - ExplicitMap & _map; - key_type _key; - param_type _value; - bool _wasDefault; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSetDefault - // - /** Temporarily change the default value. */ - template - class ExplicitMap<_Key, _Tp>::TmpSetDefault - { - public: - TmpSetDefault( ExplicitMap & map_r, param_type value_r ) - : _map( map_r ) - , _value( _map.getDefault() ) - { - _map.setDefault( value_r ); - } - - ~TmpSetDefault() - { - _map.setDefault( _value ); - } - - private: - ExplicitMap & _map; - param_type _value; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_EXPLICITMAP_H diff --git a/libzypp/devel/devel.ma/FakePool.cc b/libzypp/devel/devel.ma/FakePool.cc deleted file mode 100644 index 3b0c10b..0000000 --- a/libzypp/devel/devel.ma/FakePool.cc +++ /dev/null @@ -1,84 +0,0 @@ -#include "Tools.h" -#include "Tools.h" - -#include - -#include -#include -#include -#include -#include -#include -#include "zypp/ResPoolProxy.h" - -using namespace std; -using namespace zypp; -using namespace zypp::ui; - -bool chst( Selectable::Ptr & sel, Status status ) -{ - DBG << "+++ " << sel << endl; - Status ostatus( sel->status() ); - bool res = sel->set_status( status ); - (res?MIL:WAR) << ostatus << " -> " << status << " ==>(" << res << ") " << sel->status() << endl; - DBG << "--- " << sel << endl; - return res; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - - const char *const lines[] = { - "@ package", - "@ installed", - "- foo 1 1 i686", - "@ available", - "- foo 2 1 i686", - "@ fin" - }; - - debug::addPool( lines, lines+(sizeof(lines)/sizeof(const char *const)) ); - - ResPool pool( getZYpp()->pool() ); - ResPoolProxy uipool( getZYpp()->poolProxy() ); - - USR << pool << endl; - USR << uipool << endl; - - //for_each( pool.begin(), pool.end(), Print() ); - - Selectable::Ptr sel( *uipool.byKindBegin() ); - -/* enum Status - { - S_Protected, // Keep this unmodified ( have installedObj && S_Protected ) - S_Taboo, // Keep this unmodified ( have no installedObj && S_Taboo) - // requested by user: - S_Del, // delete installedObj ( clears S_Protected if set ) - S_Update, // install candidateObj ( have installedObj, clears S_Protected if set ) - S_Install, // install candidateObj ( have no installedObj, clears S_Taboo if set ) - // not requested by user: - S_AutoDel, // delete installedObj - S_AutoUpdate, // install candidateObj ( have installedObj ) - S_AutoInstall, // install candidateObj ( have no installedObj ) - // no modification: - S_KeepInstalled, // no modification ( have installedObj && !S_Protected, clears S_Protected if set ) - S_NoInst, // no modification ( have no installedObj && !S_Taboo, clears S_Taboo if set ) - }; -*/ - MIL << sel << endl; - chst( sel, ui::S_Update ); - chst( sel, ui::S_Install ); - chst( sel, ui::S_Protected ); - chst( sel, ui::S_KeepInstalled ); - - INT << "===[END]============================================" << endl - << endl; - return 0; -} diff --git a/libzypp/devel/devel.ma/FakePool.h b/libzypp/devel/devel.ma/FakePool.h deleted file mode 100644 index 30c2c57..0000000 --- a/libzypp/devel/devel.ma/FakePool.h +++ /dev/null @@ -1,257 +0,0 @@ -#if 0 -#define FakePool_h - -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Algorithm.h" -#include "zypp/base/Function.h" -#include "zypp/base/Functional.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/ZYppFactory.h" -#include "zypp/ResPool.h" -#include "zypp/ResPoolProxy.h" -#include "zypp/CapFactory.h" - -#include "zypp/Atom.h" -#include "zypp/Package.h" -#include "zypp/SrcPackage.h" -#include "zypp/Selection.h" -#include "zypp/Pattern.h" -#include "zypp/Product.h" -#include "zypp/Patch.h" -#include "zypp/Script.h" -#include "zypp/Message.h" -#include "zypp/Language.h" -#include "zypp/VendorAttr.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace debug - { ///////////////////////////////////////////////////////////////// - - /** - * \code - * const char * data[] = { - * "@ product" - * ,"@ installed" - * ,"- prodold 1 1 x86_64" - * ,"@ available" - * ,"- prodnew 1 1 x86_64" - * ,"@ obsoletes" - * ,"prodold" - * ,"@ fin" - * }; - * DataCollect dataCollect; - * for_each( data, data + ( sizeof(data) / sizeof(const char *) ), - * function( ref( dataCollect ) ) ); - * \endcode - */ - class DataCollect - { - public: - DataCollect( bool verbose_r = true ) - : _definst( false ) - , _defkind( ResKind::package ) - , _defdep( Dep::PROVIDES ) - , _defdepref( _defkind ) - , _verbose( verbose_r ) - { - VendorAttr::disableAutoProtect(); - } - - bool operator()( const std::string & line_r ) - { - parseLine( str::trim( line_r ) ); - return true; - } - - const ResStore & installed() const - { return _installed; } - - const ResStore & available() const - { return _available; } - - template - void collect( _Iterator begin_r, _Iterator end_r ) - { - for_each( begin_r, end_r, - function( ref(*this) ) ); - } - - private: - struct Data - { - Data( bool inst_r, Resolvable::Kind kind_r, const std::vector & words_r ) - : _inst( inst_r ) - , _kind( kind_r ) - , _data( words_r[1], Edition( words_r[2], words_r[3] ), Arch( words_r[4] ) ) - {} - - bool _inst; - Resolvable::Kind _kind; - NVRAD _data; - }; - - private: - void parseLine( const std::string & line_r ) - { - if ( line_r.empty() || line_r[0] == '#' ) - return; - - std::vector words; - str::split( line_r, std::back_inserter( words ) ); - if ( words.empty() ) - return; - - if ( words[0] == "@" ) - { - if ( words.size() < 2 ) - throw line_r; - if ( words[1] == "installed" ) - _definst = true; - else if ( words[1] == "available" ) - _definst = false; - else if ( words[1] == "fin" ) - finalize(); - else - { - try - { - _defdep = Dep( words[1] ); - if ( words.size() > 2 ) - _defdepref = Resolvable::Kind( words[2] ); - } - catch ( ... ) - { - _defkind = _defdepref = Resolvable::Kind( words[1] ); - } - return; - } - } - else if ( words[0] == "-" ) - { - if ( words.size() == 5 ) - { - finalize(); - _d.reset( new Data( _definst, _defkind, words ) ); - } - else - { - throw words; - } - } - else - { - _d->_data[_defdep].insert( CapFactory().parse( _defdepref, line_r ) ); - } - } - - void finalize() - { - if ( _d ) - { - ResObject::Ptr p; - if ( _d->_kind == ResKind::package ) - p = make(); - else if ( _d->_kind == ResKind::srcpackage ) - p = make(); - else if ( _d->_kind == ResTraits::kind ) - p = make(); - else if ( _d->_kind == ResKind::pattern ) - p = make(); - else if ( _d->_kind == ResKind::product ) - p = make(); - else if ( _d->_kind == ResKind::patch ) - p = make(); - else if ( _d->_kind == ResTraits - - diff --git a/libzypp/tests/parser/yum/data/patches-1.xml b/libzypp/tests/parser/yum/data/patches-1.xml deleted file mode 100644 index 42de48f..0000000 --- a/libzypp/tests/parser/yum/data/patches-1.xml +++ /dev/null @@ -1,763 +0,0 @@ - - - - 6b72b4f3617d0d51af28399c0f5e0af401440245 - - - - b02ba598d8ed5f8a31859d3b34e72e1ddecbe894 - - - - 321ee41de68be4e83dfb74559c14300a59b85ccf - - - - ec9e8a3f3ce2588cecd84ab95ec910d41db5d74b - - - - d803372cd5d844ee01ab6fb3d1b4332391fa1206 - - - - c2de5dd35ec2dcccc118d9d7f539e768dfd5ec50 - - - - 7fb791963114836621873280c7edd58887b91784 - - - - 28f0c33aa4a34830a4b7b8a795db609bfd3d7531 - - - - 98c2d98fe33439563047eef97c6db065c8361bbe - - - - f449fabf0a7bedfc9f561ea5d04e160c521a5186 - - - - e1dd5a93ce9bb796348557d7d8e16ef54fb8d90d - - - - a73445a3630084c867d63868d9d064625a84ea6d - - - - 792bad7440845613b608c771c2d948607e02759d - - - - de603b359e148a7666b5b695b76602c4689ff193 - - - - 6dff2c1367613b7eae36db090233bfbf31a92920 - - - - 3266d24fa2fb7aeb4ba303ccd77fbe8b27f75ad0 - - - - 394bec89d3f5f976a9f7ae074a0e4c0d5582139a - - - - 6630055daac876bcb0a6ebf36f63d28341b1ff6e - - - - d3de77e29165bdbce88310a6ce9f97f3a5368377 - - - - 905a98399c20efb91592d2767ec187823c7b154d - - - - 5314e6c2d4e21a38dd2ea05ee0495d7dd27f0931 - - - - 329b6083dfe59ddb7d50cb9e92686eb7ecc48d6d - - - - b5ec61bcf901f4270fc3ba6a18926c20102c94c9 - - - - c38d7746f8aca8d40347879bfba5d977ca8fc03f - - - - c1dca99b03a2b012c141a64c8fcc494d957baed2 - - - - f239f615760d15515bd4f0316cc99e40d25a6117 - - - - f30517b5083e9bc007adf9cc974a36fc7bba3f0b - - - - 24769a5bbd9e57cd59806b186088d5f0dffa5e30 - - - - 6c2aa38c513f7eeda2b38555182b8200c08f6468 - - - - c0b54062cb5b16cbb18d383beb721c60b2a36f72 - - - - 640a5b7ca790a3becc9c26d8434adfac560a14c5 - - - - 94c690e13540511db05ee397e9ab5fc9905b086b - - - - fb1786ca30124e82b24e57b694a58da9f920e6b3 - - - - bb6aea44ad2e2ddb0f50842b15f791b7c0a0b346 - - - - d9ba43f21238b71a7b8cfb6d9256e404cffb7cc0 - - - - 42e904686825e904752238b85085771ee51965c7 - - - - cd88e95ae02706069fe6f3031178bf26e9e06d3a - - - - ab7741ef2411c11a7ec941fc8736feebfca73398 - - - - 2f8c1cd5d147c89b06c0898d4392f1196098236f - - - - a26f9f36ed0a0f6a45cb5369234ff44d6c535310 - - - - 61a24339218f1fd480085fe0e3f754baa8820cb3 - - - - c37bf9a8ff3810e2c9a674bd9aadfed24f8c2ab2 - - - - 2cdfac93ac338ccf87abe8049f13bb415428a279 - - - - 9adf70721a91e7666c40c45c1c2270bd673d2ac4 - - - - d0a21646dc9d1c244e7e35888a0fb52aaeb1b5e2 - - - - 8daf1728afb47779fd28e0021ea6ff55f18f1149 - - - - a515c1a96ac1b55f50852cfda93a49004ce4c79a - - - - a3f5b8927b7f1f47f347e7ee3ab821995dca00b7 - - - - 4fdf8c67eaa488edbe668ead3d995caa38a1936b - - - - 5209e7b0a7f89ec7c225de065d4cbc4fbefcbddb - - - - 669837ce13f07df59ac79ce6201c176342ed27c4 - - - - a41806bf5d57c36825ad832be3d0f13d1695d70a - - - - bdbbba1841bebd9822458f3a3fb1c88141e78281 - - - - 1b84ea4aa922b21a7039330c0fdbf2775dd13444 - - - - c7266496955cee3242ae100ffd731ce4323d6b89 - - - - 883f737c6ecedd05670bad4784a37e2c67a8c5da - - - - 538c771158fa860793ed285990641b1ed04330b5 - - - - 32ae23cb16bff2f8e6ec4ba168e6a75d541efc8c - - - - cea742686fabc65af02a9dd7bea89b39cbdb62c1 - - - - 8f021c3fec51df6155c44276b87260bbf074c0a2 - - - - 73e3b82edf6537e759d3c7fe103654baad9155cf - - - - 9b83d8d408138a521c7926be0c569047eb5d866a - - - - 837cb40fa331f256281577e8ca81fe73b9c27e2a - - - - 050a31137f1ff1ca986c27addaf894deaa10b6ad - - - - cd51f150dda049a82acca2ef4b0524465947ddc2 - - - - ec3095ea0c8b996b49061d79f7afb780ab4ea84b - - - - c53aeb36ef68f4f1b6e6ac0f38df63c22f22359d - - - - 31c74fc5d4ba42bf3301fa95b806caa978659127 - - - - 7cbcd6c1064568aeb0e523d2587336e742e44fcb - - - - 4f331f6ea3e5c5a90f66a871162114ca94f92f76 - - - - b5a4c65f2356613b4de6ad1bc2dd0582e77b0ee6 - - - - 18e4e361c7688a57f7b7963c359fee4f58d29b08 - - - - f812f28e10039b5bfd249e3902b905e92a7eb769 - - - - 90c4516d8073322a05f4235dbe1f7c4770c6e4e0 - - - - 7d9f7a7fdd96843f5d962aef984cc0c5c2534f30 - - - - fffd63b332907c46b926499e27b6ec0ad9025ddb - - - - b0bbd764da5ec2651bf030e7051d045341ddbdd7 - - - - 5e2c95f36ceb9c7d94c4a2df8ec60aaf36dde810 - - - - 11a15f477e35a5e4879a8883074c13e6ab321141 - - - - c71c5d298bf5b11fcc0c0865b1302a7ba9970c0c - - - - fb916bb899aa6d2b1ae8d211ee84ceb0a66f1fd8 - - - - 558c89fe1d04efa2d7c5988be9344376f2eacace - - - - 18473edb5c4b6853aea94db3883bcfe496b5b6ee - - - - 4c3d0446ffd36ce86b40da43135913a18349ef44 - - - - 188b82cfb54dd61f0fe0e5beea054d5a9591e0a5 - - - - 85a08c9bc4eebac24854a9eb7da257a3fe8f5b6d - - - - e711370f446cf3538fbaf64c9faaf0eadaedb580 - - - - 16921f0179c7c3dcb504b9ffb82abd32e84086ac - - - - 147a7b5f084395bd427c273ba8f25f312cc87193 - - - - afd07ae38e0585e615022a7df3cd469c2c99fdbb - - - - 5b9d9747bffc3368ea2f7c8c7b3ff8e0cc4605f7 - - - - 1b1c1fdb9ad132cd6504c8b437cfe519bc9c0dfa - - - - 2af5b888f4f4c9b9be8b9bc2aaae02efd436b924 - - - - 664ef6d8c867824f20b15a9af4d2957fd79897bd - - - - ad29afc8f5dd7ca1f4faa4a2aaed644c80d844b6 - - - - 8cc33adb78b9fccccc7f2fc03d5df13f8a79eae5 - - - - ccece044c2ba608c8233d70a4aa68c466c1862f1 - - - - 339f1a841955652ccaccd9c9e936c21abe85a2f2 - - - - 3ef0e4f08055c2f458c0efa5dfdd4d7aee384122 - - - - 67602c57de3f98ffd2c7434b6952f79481feceb8 - - - - 4da7e1958d56142f48d99b9ab1b16425aeb0cd96 - - - - 940c331de3e40be9f570e012b8ca9bbab6d594d2 - - - - da26f814db1c2f04cd8fc27495aecdbd66f73daf - - - - 299f0dff3447555cea60a63fdf97e81e1bd56096 - - - - a7a501a1465dfcb3e125d14c1a67efd2638be166 - - - - 10b87459f9209a43097bebd31f9ec8cff4354c11 - - - - 8d0d0b963c5fa85c92d5a9b5c86c88063b2faf8e - - - - 5f43e01206494f0d0cbab846bfbb157285e22efc - - - - 5e86626239c4798708e7d2432708cf98d6a001d2 - - - - 5af58df93d8f36428726d0cf55fc5bb6a18a8bfd - - - - 924e7f989e3d6f159e717e2d76b21de572ce7ec2 - - - - 93a54883e5b9170839fc81a72c534f76e7987c19 - - - - 64a57f29d835e46f7f00e939d4b505cb546d0654 - - - - 88ee8256ac3875e2b087ab9723bb13f071f9de73 - - - - 115f31bcb61f37f264daa4b0ef8220816be05de7 - - - - c5a5fd01f5266d3f30fe33b5fc1679b35af3d4d4 - - - - b6654a37408c21d66e60cf7a78a1cddb991b797a - - - - fd76c123487f884cf10b161c87afe5b7bc9f05f8 - - - - d3533c47354977c9f821eb4e579c43ea919d4488 - - - - 06f48c215e805213e339fa581670fb35e2151786 - - - - b5217b10a1a3e513085665d994dded954a72e884 - - - - e2d31e95095a1c7dd242c577f3a394a39d7e75be - - - - b6f7e30d0d8f3e699e8593a178b5fd63c865ad0e - - - - 7ebc8745836d63bdfee712bca5c71ba328877047 - - - - 4eb206f1dba689554bc3e113fd87ad2a4fcdbf78 - - - - 505cc81dc924efb58154806700b1d261cc33fbb9 - - - - 3d960c76d7dd38393c631c63212f0a8c4f08ad98 - - - - b31ced09fece6d2f9fad37653acfda9eb9e7ba2b - - - - 26a5b6e1a3c77afa7fd77171bcbef2d78f7df11f - - - - 420d992e8b4436cc7ebc0609183ba040db340dc5 - - - - bf0b411e4eb5494a27ebef8d5b9cd923da4fe2c8 - - - - 19126ca4e55852b98ffa69c6c3fcff12743af49c - - - - 0bbcdeab9294272a677f9b4a7b57e13701244010 - - - - df03ccdfcb0f188ac3072c5086ab86b425a66f8e - - - - 8ffefa033ac19a70938a7af71854184d6b902e45 - - - - df121b6b7cc82715a4544f491a0104b50a28eb20 - - - - f34eb5a2f4399578c78e6dca5dd165077787c806 - - - - da442e32fe4401897261051bf817e1a029e804c3 - - - - ff002a87486fbd2c68b445e58b6ac0d307e8dbad - - - - fd8198e09f073515c67cf90a879ff57bfde0cfa9 - - - - 2453275e874a7d65c9f21cc50885f50202d617bf - - - - fad24b42e3d7d8c35e410017ca85dd375f2b7f1d - - - - e74c7b27498161c9ba056869ba1813658f4ef4e0 - - - - 36f9b9e6ff739fe7d82a58b59fcb74be6581a752 - - - - c1e569e948b46ddcd33369c9479e6ad92fb8c7ec - - - - 3dd423deeb41c58b11f54184d59367d152d78f24 - - - - 678cae267889c434cbdd81654066244270a341b6 - - - - 9539aa93b99854e21cc69248bd82249f75a6f6e0 - - - - fedf719a3be03d6c93fc04f78b50ce7be1465606 - - - - b95d82b3c1e22c1ce2ec2ea96ffb9ba94e1a2adb - - - - be5018a378fbce22ad2f1f94266f251dfb0fecc2 - - - - 93496c003d8a1565e88fa37bc28b62b685b86223 - - - - 40b9fd23e3eb4141d8b28794c40aeebdee7dcc1d - - - - 7d6301a829eda6ff7ab006302c38943693defd44 - - - - c338bfb439e94dc27774a76d860285577b9ade19 - - - - eb0c412124838a4ff2ff884642a88fac1578da8f - - - - 95ce884347ae5fb4f8b030f9e302f75dec58cefd - - - - 91dba1fffdd033eb289fec17dd2a288658dbb586 - - - - 069398c5d7b94dc32c6102243b478584a76b84bb - - - - 2c534ad1e2a36b668f7d22f37b5e0457f5892359 - - - - bce7d390d3db0bdedf63304a9b739645e7c10eb8 - - - - 5d0fa6b2d1a729ed86d6bdc54bb3eeabb1bfea38 - - - - c1e7abcd4dc9ffda6f97dc8c98e68d36f0fa51e5 - - - - ff9e274c83ef488d9eed486c7eae9f2952d4c29e - - - - 2dd405d9651c0f9b87412b07488d4b03796390e9 - - - - f4b8a55a8b737a513c4531487888ff231126cce9 - - - - 5413228a54cf99ce20ad08e6917605f7a9ceeabe - - - - a17b3f3406caf33fb9160d2464b0945bc2b0a8ad - - - - 2ec2f7e3abf84e60ce2a2e3935e3373242f97d27 - - - - b83c95c8f2337d42ea1b8b1e606ca83c8acc17b8 - - - - 89d9e49eb0c49803ab2bd5d51570f8e688f93196 - - - - 9501fa94de1e6e9a896cc2e29d66424e17d429e4 - - - - 882e3dad4edfc0e2e923d4fc49c78341acea368d - - - - 03671597239a76a8716da20528d4a71d24e44825 - - - - f6a3e069f70f9250d7ae0c5f7497999714552ddc - - - - a7a9803370986ec4de2913c416db11a0c207d8a1 - - - - 4b3f9bbb0f413a4b70392219f501ad782e5c647a - - - - 7f65de9106151c59e1b91eab1c195e5765445894 - - - - 1c801d3a719e843a50f43faceff0bd2bf77f3e82 - - - - 06cd8e287e5cc94bf936726e9a8540283ad42af5 - - - - 555d3279e2485cae5feb3a7c57b0ee0f16ae8ba6 - - - - cd767b5b8690e08ec5b1f231641cd6a4a7d1dec4 - - - - 24e57eaa5bc4c6080577f7555b9b28ba30c298e6 - - - - 262095e2c3ad96a3c892c0e06baad6c995ac52b9 - - - - beba36db67a885e7a43a2b8d0f5b6a1e394fad39 - - - - 079e72f31dcd4e20a786501b6670d581480cb249 - - - - b7bf854b78d3ba9488e4a9c46bf48d6e7501ead5 - - - - 8dd539e1cb8196a3bde56ec0e5d9717bf74d3696 - - - - f96cebcb74f4e9067976240f8da5dff3dbc954e3 - - - - 5d11f1e0772a8eae3d0276c2fc0c36fd024ff969 - - - diff --git a/libzypp/tests/parser/yum/data/patches-1.xml.solution b/libzypp/tests/parser/yum/data/patches-1.xml.solution deleted file mode 100644 index 6df7288..0000000 --- a/libzypp/tests/parser/yum/data/patches-1.xml.solution +++ /dev/null @@ -1,760 +0,0 @@ -fetchmsttfonts.sh-2333 -sha -6b72b4f3617d0d51af28399c0f5e0af401440245 -repodata/patch-fetchmsttfonts.sh-2333.xml -glabels-2348 -sha -b02ba598d8ed5f8a31859d3b34e72e1ddecbe894 -repodata/patch-glabels-2348.xml -openssl-2349 -sha -321ee41de68be4e83dfb74559c14300a59b85ccf -repodata/patch-openssl-2349.xml -gv-2350 -sha -ec9e8a3f3ce2588cecd84ab95ec910d41db5d74b -repodata/patch-gv-2350.xml -tar-2351 -sha -d803372cd5d844ee01ab6fb3d1b4332391fa1206 -repodata/patch-tar-2351.xml -flash-player-2359 -sha -c2de5dd35ec2dcccc118d9d7f539e768dfd5ec50 -repodata/patch-flash-player-2359.xml -lineak_kde-2361 -sha -7fb791963114836621873280c7edd58887b91784 -repodata/patch-lineak_kde-2361.xml -evince-2362 -sha -28f0c33aa4a34830a4b7b8a795db609bfd3d7531 -repodata/patch-evince-2362.xml -capi4hylafax-2366 -sha -98c2d98fe33439563047eef97c6db065c8361bbe -repodata/patch-capi4hylafax-2366.xml -resmgr-2371 -sha -f449fabf0a7bedfc9f561ea5d04e160c521a5186 -repodata/patch-resmgr-2371.xml -release-notes-2374 -sha -e1dd5a93ce9bb796348557d7d8e16ef54fb8d90d -repodata/patch-release-notes-2374.xml -privoxy-2375 -sha -a73445a3630084c867d63868d9d064625a84ea6d -repodata/patch-privoxy-2375.xml -kdeaddons3-konqueror-2383 -sha -792bad7440845613b608c771c2d948607e02759d -repodata/patch-kdeaddons3-konqueror-2383.xml -krusader-2386 -sha -de603b359e148a7666b5b695b76602c4689ff193 -repodata/patch-krusader-2386.xml -gdm-2387 -sha -6dff2c1367613b7eae36db090233bfbf31a92920 -repodata/patch-gdm-2387.xml -gpg-2388 -sha -3266d24fa2fb7aeb4ba303ccd77fbe8b27f75ad0 -repodata/patch-gpg-2388.xml -clamav-2391 -sha -394bec89d3f5f976a9f7ae074a0e4c0d5582139a -repodata/patch-clamav-2391.xml -mono-core-2392 -sha -6630055daac876bcb0a6ebf36f63d28341b1ff6e -repodata/patch-mono-core-2392.xml -sysstat-2401 -sha -d3de77e29165bdbce88310a6ce9f97f3a5368377 -repodata/patch-sysstat-2401.xml -xorg-x11-server-2403 -sha -905a98399c20efb91592d2767ec187823c7b154d -repodata/patch-xorg-x11-server-2403.xml -dazuko-2404 -sha -5314e6c2d4e21a38dd2ea05ee0495d7dd27f0931 -repodata/patch-dazuko-2404.xml -cups-2406 -sha -329b6083dfe59ddb7d50cb9e92686eb7ecc48d6d -repodata/patch-cups-2406.xml -squirrelmail-2409 -sha -b5ec61bcf901f4270fc3ba6a18926c20102c94c9 -repodata/patch-squirrelmail-2409.xml -wxGTK-2411 -sha -c38d7746f8aca8d40347879bfba5d977ca8fc03f -repodata/patch-wxGTK-2411.xml -ImageMagick-2413 -sha -c1dca99b03a2b012c141a64c8fcc494d957baed2 -repodata/patch-ImageMagick-2413.xml -squirrelmail-2417 -sha -f239f615760d15515bd4f0316cc99e40d25a6117 -repodata/patch-squirrelmail-2417.xml -MozillaFirefox-2418 -sha -f30517b5083e9bc007adf9cc974a36fc7bba3f0b -repodata/patch-MozillaFirefox-2418.xml -liboil-2419 -sha -24769a5bbd9e57cd59806b186088d5f0dffa5e30 -repodata/patch-liboil-2419.xml -MozillaThunderbird-2421 -sha -6c2aa38c513f7eeda2b38555182b8200c08f6468 -repodata/patch-MozillaThunderbird-2421.xml -pm-utils-2422 -sha -c0b54062cb5b16cbb18d383beb721c60b2a36f72 -repodata/patch-pm-utils-2422.xml -sysvinit-2424 -sha -640a5b7ca790a3becc9c26d8434adfac560a14c5 -repodata/patch-sysvinit-2424.xml -java-1_4_2-sun-2425 -sha -94c690e13540511db05ee397e9ab5fc9905b086b -repodata/patch-java-1_4_2-sun-2425.xml -java-1_5_0-sun-2427 -sha -fb1786ca30124e82b24e57b694a58da9f920e6b3 -repodata/patch-java-1_5_0-sun-2427.xml -cups-2430 -sha -bb6aea44ad2e2ddb0f50842b15f791b7c0a0b346 -repodata/patch-cups-2430.xml -w3m-2433 -sha -d9ba43f21238b71a7b8cfb6d9256e404cffb7cc0 -repodata/patch-w3m-2433.xml -unison-2436 -sha -42e904686825e904752238b85085771ee51965c7 -repodata/patch-unison-2436.xml -lvm2-2438 -sha -cd88e95ae02706069fe6f3031178bf26e9e06d3a -repodata/patch-lvm2-2438.xml -yast2-sudo-2441 -sha -ab7741ef2411c11a7ec941fc8736feebfca73398 -repodata/patch-yast2-sudo-2441.xml -krb5-2442 -sha -2f8c1cd5d147c89b06c0898d4392f1196098236f -repodata/patch-krb5-2442.xml -xorg-x11-server-2444 -sha -a26f9f36ed0a0f6a45cb5369234ff44d6c535310 -repodata/patch-xorg-x11-server-2444.xml -sax2-2445 -sha -61a24339218f1fd480085fe0e3f754baa8820cb3 -repodata/patch-sax2-2445.xml -python-2446 -sha -c37bf9a8ff3810e2c9a674bd9aadfed24f8c2ab2 -repodata/patch-python-2446.xml -cacti-2447 -sha -2cdfac93ac338ccf87abe8049f13bb415428a279 -repodata/patch-cacti-2447.xml -kdelibs3-2448 -sha -9adf70721a91e7666c40c45c1c2270bd673d2ac4 -repodata/patch-kdelibs3-2448.xml -kdeutils3-extra-2450 -sha -d0a21646dc9d1c244e7e35888a0fb52aaeb1b5e2 -repodata/patch-kdeutils3-extra-2450.xml -jarnal-2451 -sha -8daf1728afb47779fd28e0021ea6ff55f18f1149 -repodata/patch-jarnal-2451.xml -kdelibs3-2452 -sha -a515c1a96ac1b55f50852cfda93a49004ce4c79a -repodata/patch-kdelibs3-2452.xml -xorg-x11-server-2453 -sha -a3f5b8927b7f1f47f347e7ee3ab821995dca00b7 -repodata/patch-xorg-x11-server-2453.xml -cyrus-imapd-2454 -sha -4fdf8c67eaa488edbe668ead3d995caa38a1936b -repodata/patch-cyrus-imapd-2454.xml -opera-2456 -sha -5209e7b0a7f89ec7c225de065d4cbc4fbefcbddb -repodata/patch-opera-2456.xml -mediawiki-2457 -sha -669837ce13f07df59ac79ce6201c176342ed27c4 -repodata/patch-mediawiki-2457.xml -compiz-2458 -sha -a41806bf5d57c36825ad832be3d0f13d1695d70a -repodata/patch-compiz-2458.xml -libzypp-2460 -sha -bdbbba1841bebd9822458f3a3fb1c88141e78281 -repodata/patch-libzypp-2460.xml -bzip2-2465 -sha -1b84ea4aa922b21a7039330c0fdbf2775dd13444 -repodata/patch-bzip2-2465.xml -autoyast2-2466 -sha -c7266496955cee3242ae100ffd731ce4323d6b89 -repodata/patch-autoyast2-2466.xml -squid-2467 -sha -883f737c6ecedd05670bad4784a37e2c67a8c5da -repodata/patch-squid-2467.xml -totem-2468 -sha -538c771158fa860793ed285990641b1ed04330b5 -repodata/patch-totem-2468.xml -java-1_4_2-sun-demo-2469 -sha -32ae23cb16bff2f8e6ec4ba168e6a75d541efc8c -repodata/patch-java-1_4_2-sun-demo-2469.xml -ulogd-2470 -sha -cea742686fabc65af02a9dd7bea89b39cbdb62c1 -repodata/patch-ulogd-2470.xml -xpdf-tools-2472 -sha -8f021c3fec51df6155c44276b87260bbf074c0a2 -repodata/patch-xpdf-tools-2472.xml -xpdf-2473 -sha -73e3b82edf6537e759d3c7fe103654baad9155cf -repodata/patch-xpdf-2473.xml -neon-2476 -sha -9b83d8d408138a521c7926be0c569047eb5d866a -repodata/patch-neon-2476.xml -libzypp-2477 -sha -837cb40fa331f256281577e8ca81fe73b9c27e2a -repodata/patch-libzypp-2477.xml -gtk2-2479 -sha -050a31137f1ff1ca986c27addaf894deaa10b6ad -repodata/patch-gtk2-2479.xml -nss_ldap-2480 -sha -cd51f150dda049a82acca2ef4b0524465947ddc2 -repodata/patch-nss_ldap-2480.xml -cups-2481 -sha -ec3095ea0c8b996b49061d79f7afb780ab4ea84b -repodata/patch-cups-2481.xml -bluez-utils-2482 -sha -c53aeb36ef68f4f1b6e6ac0f38df63c22f22359d -repodata/patch-bluez-utils-2482.xml -xine-lib-2487 -sha -31c74fc5d4ba42bf3301fa95b806caa978659127 -repodata/patch-xine-lib-2487.xml -kdegraphics3-2489 -sha -7cbcd6c1064568aeb0e523d2587336e742e44fcb -repodata/patch-kdegraphics3-2489.xml -xorg-x11-Xvnc-2491 -sha -4f331f6ea3e5c5a90f66a871162114ca94f92f76 -repodata/patch-xorg-x11-Xvnc-2491.xml -bluez-utils-2492 -sha -b5a4c65f2356613b4de6ad1bc2dd0582e77b0ee6 -repodata/patch-bluez-utils-2492.xml -koffice-2495 -sha -18e4e361c7688a57f7b7963c359fee4f58d29b08 -repodata/patch-koffice-2495.xml -gtk2-2499 -sha -f812f28e10039b5bfd249e3902b905e92a7eb769 -repodata/patch-gtk2-2499.xml -hal-2500 -sha -90c4516d8073322a05f4235dbe1f7c4770c6e4e0 -repodata/patch-hal-2500.xml -libsoup-2503 -sha -7d9f7a7fdd96843f5d962aef984cc0c5c2534f30 -repodata/patch-libsoup-2503.xml -squid-2504 -sha -fffd63b332907c46b926499e27b6ec0ad9025ddb -repodata/patch-squid-2504.xml -acroread-2506 -sha -b0bbd764da5ec2651bf030e7051d045341ddbdd7 -repodata/patch-acroread-2506.xml -flash-player-2509 -sha -5e2c95f36ceb9c7d94c4a2df8ec60aaf36dde810 -repodata/patch-flash-player-2509.xml -compat-g77-2510 -sha -11a15f477e35a5e4879a8883074c13e6ab321141 -repodata/patch-compat-g77-2510.xml -libgtop-2512 -sha -c71c5d298bf5b11fcc0c0865b1302a7ba9970c0c -repodata/patch-libgtop-2512.xml -zypper-2513 -sha -fb916bb899aa6d2b1ae8d211ee84ceb0a66f1fd8 -repodata/patch-zypper-2513.xml -smb4k-2514 -sha -558c89fe1d04efa2d7c5988be9344376f2eacace -repodata/patch-smb4k-2514.xml -amarok-2516 -sha -18473edb5c4b6853aea94db3883bcfe496b5b6ee -repodata/patch-amarok-2516.xml -yast2-trans-de-2518 -sha -4c3d0446ffd36ce86b40da43135913a18349ef44 -repodata/patch-yast2-trans-de-2518.xml -compiz-2519 -sha -188b82cfb54dd61f0fe0e5beea054d5a9591e0a5 -repodata/patch-compiz-2519.xml -fetchmail-2520 -sha -85a08c9bc4eebac24854a9eb7da257a3fe8f5b6d -repodata/patch-fetchmail-2520.xml -spamassassin-2523 -sha -e711370f446cf3538fbaf64c9faaf0eadaedb580 -repodata/patch-spamassassin-2523.xml -libzypp-2524 -sha -16921f0179c7c3dcb504b9ffb82abd32e84086ac -repodata/patch-libzypp-2524.xml -yast2-printer-2525 -sha -147a7b5f084395bd427c273ba8f25f312cc87193 -repodata/patch-yast2-printer-2525.xml -powersave-2526 -sha -afd07ae38e0585e615022a7df3cd469c2c99fdbb -repodata/patch-powersave-2526.xml -cups-2527 -sha -5b9d9747bffc3368ea2f7c8c7b3ff8e0cc4605f7 -repodata/patch-cups-2527.xml -bind-2529 -sha -1b1c1fdb9ad132cd6504c8b437cfe519bc9c0dfa -repodata/patch-bind-2529.xml -libzypp-2533 -sha -2af5b888f4f4c9b9be8b9bc2aaae02efd436b924 -repodata/patch-libzypp-2533.xml -chmlib-2536 -sha -664ef6d8c867824f20b15a9af4d2957fd79897bd -repodata/patch-chmlib-2536.xml -kchmviewer-2539 -sha -ad29afc8f5dd7ca1f4faa4a2aaed644c80d844b6 -repodata/patch-kchmviewer-2539.xml -rrdtool-2540 -sha -8cc33adb78b9fccccc7f2fc03d5df13f8a79eae5 -repodata/patch-rrdtool-2540.xml -yast2-sound-2541 -sha -ccece044c2ba608c8233d70a4aa68c466c1862f1 -repodata/patch-yast2-sound-2541.xml -fetchmail-2542 -sha -339f1a841955652ccaccd9c9e936c21abe85a2f2 -repodata/patch-fetchmail-2542.xml -kdenetwork3-InstantMessenger-2547 -sha -3ef0e4f08055c2f458c0efa5dfdd4d7aee384122 -repodata/patch-kdenetwork3-InstantMessenger-2547.xml -openssl-2548 -sha -67602c57de3f98ffd2c7434b6952f79481feceb8 -repodata/patch-openssl-2548.xml -autofs-2549 -sha -4da7e1958d56142f48d99b9ab1b16425aeb0cd96 -repodata/patch-autofs-2549.xml -qemu-2550 -sha -940c331de3e40be9f570e012b8ca9bbab6d594d2 -repodata/patch-qemu-2550.xml -cross-avr-binutils-2551 -sha -da26f814db1c2f04cd8fc27495aecdbd66f73daf -repodata/patch-cross-avr-binutils-2551.xml -digikam-2552 -sha -299f0dff3447555cea60a63fdf97e81e1bd56096 -repodata/patch-digikam-2552.xml -samba-2555 -sha -a7a501a1465dfcb3e125d14c1a67efd2638be166 -repodata/patch-samba-2555.xml -fetchmail-2563 -sha -10b87459f9209a43097bebd31f9ec8cff4354c11 -repodata/patch-fetchmail-2563.xml -kdegraphics3-pdf-2565 -sha -8d0d0b963c5fa85c92d5a9b5c86c88063b2faf8e -repodata/patch-kdegraphics3-pdf-2565.xml -koffice-wordprocessing-2577 -sha -5f43e01206494f0d0cbab846bfbb157285e22efc -repodata/patch-koffice-wordprocessing-2577.xml -samba-2584 -sha -5e86626239c4798708e7d2432708cf98d6a001d2 -repodata/patch-samba-2584.xml -ImageMagick-2585 -sha -5af58df93d8f36428726d0cf55fc5bb6a18a8bfd -repodata/patch-ImageMagick-2585.xml -poppler-2590 -sha -924e7f989e3d6f159e717e2d76b21de572ce7ec2 -repodata/patch-poppler-2590.xml -NetworkManager-kde-2591 -sha -93a54883e5b9170839fc81a72c534f76e7987c19 -repodata/patch-NetworkManager-kde-2591.xml -GraphicsMagick-2593 -sha -64a57f29d835e46f7f00e939d4b505cb546d0654 -repodata/patch-GraphicsMagick-2593.xml -chmlib-2595 -sha -88ee8256ac3875e2b087ab9723bb13f071f9de73 -repodata/patch-chmlib-2595.xml -gpdf-2596 -sha -115f31bcb61f37f264daa4b0ef8220816be05de7 -repodata/patch-gpdf-2596.xml -kdenetwork3-InstantMessenger-2599 -sha -c5a5fd01f5266d3f30fe33b5fc1679b35af3d4d4 -repodata/patch-kdenetwork3-InstantMessenger-2599.xml -kdebase3-2600 -sha -b6654a37408c21d66e60cf7a78a1cddb991b797a -repodata/patch-kdebase3-2600.xml -pam-2601 -sha -fd76c123487f884cf10b161c87afe5b7bc9f05f8 -repodata/patch-pam-2601.xml -fetchmail-2602 -sha -d3533c47354977c9f821eb4e579c43ea919d4488 -repodata/patch-fetchmail-2602.xml -novfs-kmp-bigsmp-2630 -sha -06f48c215e805213e339fa581670fb35e2151786 -repodata/patch-novfs-kmp-bigsmp-2630.xml -clamav-2632 -sha -b5217b10a1a3e513085665d994dded954a72e884 -repodata/patch-clamav-2632.xml -timezone-2634 -sha -e2d31e95095a1c7dd242c577f3a394a39d7e75be -repodata/patch-timezone-2634.xml -gwenview-2637 -sha -b6f7e30d0d8f3e699e8593a178b5fd63c865ad0e -repodata/patch-gwenview-2637.xml -wireshark-2638 -sha -7ebc8745836d63bdfee712bca5c71ba328877047 -repodata/patch-wireshark-2638.xml -hal-resmgr-2639 -sha -4eb206f1dba689554bc3e113fd87ad2a4fcdbf78 -repodata/patch-hal-resmgr-2639.xml -klamav-2640 -sha -505cc81dc924efb58154806700b1d261cc33fbb9 -repodata/patch-klamav-2640.xml -ekiga-2641 -sha -3d960c76d7dd38393c631c63212f0a8c4f08ad98 -repodata/patch-ekiga-2641.xml -libwpd-2642 -sha -b31ced09fece6d2f9fad37653acfda9eb9e7ba2b -repodata/patch-libwpd-2642.xml -rubygems-2644 -sha -26a5b6e1a3c77afa7fd77171bcbef2d78f7df11f -repodata/patch-rubygems-2644.xml -MozillaFirefox-2647 -sha -420d992e8b4436cc7ebc0609183ba040db340dc5 -repodata/patch-MozillaFirefox-2647.xml -koffice-wordprocessing-2648 -sha -bf0b411e4eb5494a27ebef8d5b9cd923da4fe2c8 -repodata/patch-koffice-wordprocessing-2648.xml -agfa-fonts-2650 -sha -19126ca4e55852b98ffa69c6c3fcff12743af49c -repodata/patch-agfa-fonts-2650.xml -OpenOffice_org-2652 -sha -0bbcdeab9294272a677f9b4a7b57e13701244010 -repodata/patch-OpenOffice_org-2652.xml -gdm-2653 -sha -df03ccdfcb0f188ac3072c5086ab86b425a66f8e -repodata/patch-gdm-2653.xml -ruby-2655 -sha -8ffefa033ac19a70938a7af71854184d6b902e45 -repodata/patch-ruby-2655.xml -sylpheed-claws-2685 -sha -df121b6b7cc82715a4544f491a0104b50a28eb20 -repodata/patch-sylpheed-claws-2685.xml -php5-2687 -sha -f34eb5a2f4399578c78e6dca5dd165077787c806 -repodata/patch-php5-2687.xml -klamav-2688 -sha -da442e32fe4401897261051bf817e1a029e804c3 -repodata/patch-klamav-2688.xml -clamav-2690 -sha -ff002a87486fbd2c68b445e58b6ac0d307e8dbad -repodata/patch-clamav-2690.xml -seamonkey-2691 -sha -fd8198e09f073515c67cf90a879ff57bfde0cfa9 -repodata/patch-seamonkey-2691.xml -gnokii-2689 -sha -2453275e874a7d65c9f21cc50885f50202d617bf -repodata/patch-gnokii-2689.xml -doxygen-2694 -sha -fad24b42e3d7d8c35e410017ca85dd375f2b7f1d -repodata/patch-doxygen-2694.xml -enlightenment-2695 -sha -e74c7b27498161c9ba056869ba1813658f4ef4e0 -repodata/patch-enlightenment-2695.xml -gnome-terminal-2696 -sha -36f9b9e6ff739fe7d82a58b59fcb74be6581a752 -repodata/patch-gnome-terminal-2696.xml -kpowersave-2698 -sha -c1e569e948b46ddcd33369c9479e6ad92fb8c7ec -repodata/patch-kpowersave-2698.xml -clamav-2700 -sha -3dd423deeb41c58b11f54184d59367d152d78f24 -repodata/patch-clamav-2700.xml -autofs-2703 -sha -678cae267889c434cbdd81654066244270a341b6 -repodata/patch-autofs-2703.xml -ivtv-kmp-bigsmp-2704 -sha -9539aa93b99854e21cc69248bd82249f75a6f6e0 -repodata/patch-ivtv-kmp-bigsmp-2704.xml -kernel-2705 -sha -fedf719a3be03d6c93fc04f78b50ce7be1465606 -repodata/patch-kernel-2705.xml -yast2-printer-2706 -sha -b95d82b3c1e22c1ce2ec2ea96ffb9ba94e1a2adb -repodata/patch-yast2-printer-2706.xml -MozillaThunderbird-2734 -sha -be5018a378fbce22ad2f1f94266f251dfb0fecc2 -repodata/patch-MozillaThunderbird-2734.xml -gstreamer010-plugins-base-2737 -sha -93496c003d8a1565e88fa37bc28b62b685b86223 -repodata/patch-gstreamer010-plugins-base-2737.xml -gstreamer010-plugins-base-2805 -sha -40b9fd23e3eb4141d8b28794c40aeebdee7dcc1d -repodata/patch-gstreamer010-plugins-base-2805.xml -evolution-2824 -sha -7d6301a829eda6ff7ab006302c38943693defd44 -repodata/patch-evolution-2824.xml -avahi-2982 -sha -c338bfb439e94dc27774a76d860285577b9ade19 -repodata/patch-avahi-2982.xml -syslog-ng-2984 -sha -eb0c412124838a4ff2ff884642a88fac1578da8f -repodata/patch-syslog-ng-2984.xml -tomcat5-2985 -sha -95ce884347ae5fb4f8b030f9e302f75dec58cefd -repodata/patch-tomcat5-2985.xml -xine-lib-2989 -sha -91dba1fffdd033eb289fec17dd2a288658dbb586 -repodata/patch-xine-lib-2989.xml -xorg-x11-libs-3070 -sha -069398c5d7b94dc32c6102243b478584a76b84bb -repodata/patch-xorg-x11-libs-3070.xml -rekall-2991 -sha -2c534ad1e2a36b668f7d22f37b5e0457f5892359 -repodata/patch-rekall-2991.xml -gpg-2995 -sha -bce7d390d3db0bdedf63304a9b739645e7c10eb8 -repodata/patch-gpg-2995.xml -gstreamer010-plugins-base-2992 -sha -5d0fa6b2d1a729ed86d6bdc54bb3eeabb1bfea38 -repodata/patch-gstreamer010-plugins-base-2992.xml -unrar-2996 -sha -c1e7abcd4dc9ffda6f97dc8c98e68d36f0fa51e5 -repodata/patch-unrar-2996.xml -ktorrent-2998 -sha -ff9e274c83ef488d9eed486c7eae9f2952d4c29e -repodata/patch-ktorrent-2998.xml -ekiga-3023 -sha -2dd405d9651c0f9b87412b07488d4b03796390e9 -repodata/patch-ekiga-3023.xml -krb5-apps-servers-3021 -sha -f4b8a55a8b737a513c4531487888ff231126cce9 -repodata/patch-krb5-apps-servers-3021.xml -pam_ssh-3024 -sha -5413228a54cf99ce20ad08e6917605f7a9ceeabe -repodata/patch-pam_ssh-3024.xml -TeXmacs-3030 -sha -a17b3f3406caf33fb9160d2464b0945bc2b0a8ad -repodata/patch-TeXmacs-3030.xml -perl-Bootloader-3029 -sha -2ec2f7e3abf84e60ce2a2e3935e3373242f97d27 -repodata/patch-perl-Bootloader-3029.xml -kernel-3032 -sha -b83c95c8f2337d42ea1b8b1e606ca83c8acc17b8 -repodata/patch-kernel-3032.xml -NetworkManager-3031 -sha -89d9e49eb0c49803ab2bd5d51570f8e688f93196 -repodata/patch-NetworkManager-3031.xml -file-3033 -sha -9501fa94de1e6e9a896cc2e29d66424e17d429e4 -repodata/patch-file-3033.xml -squid-3036 -sha -882e3dad4edfc0e2e923d4fc49c78341acea368d -repodata/patch-squid-3036.xml -libwpd-3038 -sha -03671597239a76a8716da20528d4a71d24e44825 -repodata/patch-libwpd-3038.xml -opensuse-updater-3037 -sha -f6a3e069f70f9250d7ae0c5f7497999714552ddc -repodata/patch-opensuse-updater-3037.xml -krb5-3045 -sha -a7a9803370986ec4de2913c416db11a0c207d8a1 -repodata/patch-krb5-3045.xml -qt3-3048 -sha -4b3f9bbb0f413a4b70392219f501ad782e5c647a -repodata/patch-qt3-3048.xml -gwenview-3055 -sha -7f65de9106151c59e1b91eab1c195e5765445894 -repodata/patch-gwenview-3055.xml -libqt4-3056 -sha -1c801d3a719e843a50f43faceff0bd2bf77f3e82 -repodata/patch-libqt4-3056.xml -ktorrent-3057 -sha -06cd8e287e5cc94bf936726e9a8540283ad42af5 -repodata/patch-ktorrent-3057.xml -kdelibs3-3058 -sha -555d3279e2485cae5feb3a7c57b0ee0f16ae8ba6 -repodata/patch-kdelibs3-3058.xml -inkscape-3062 -sha -cd767b5b8690e08ec5b1f231641cd6a4a7d1dec4 -repodata/patch-inkscape-3062.xml -perl-Bootloader-3059 -sha -24e57eaa5bc4c6080577f7555b9b28ba30c298e6 -repodata/patch-perl-Bootloader-3059.xml -scpm-3064 -sha -262095e2c3ad96a3c892c0e06baad6c995ac52b9 -repodata/patch-scpm-3064.xml -mediawiki-3065 -sha -beba36db67a885e7a43a2b8d0f5b6a1e394fad39 -repodata/patch-mediawiki-3065.xml -freetype2-3066 -sha -079e72f31dcd4e20a786501b6670d581480cb249 -repodata/patch-freetype2-3066.xml -xorg-x11-libX11-3069 -sha -b7bf854b78d3ba9488e4a9c46bf48d6e7501ead5 -repodata/patch-xorg-x11-libX11-3069.xml -xorg-x11-server-3071 -sha -8dd539e1cb8196a3bde56ec0e5d9717bf74d3696 -repodata/patch-xorg-x11-server-3071.xml -xmms-3073 -sha -f96cebcb74f4e9067976240f8da5dff3dbc954e3 -repodata/patch-xmms-3073.xml -spamassassin-3077 -sha -5d11f1e0772a8eae3d0276c2fc0c36fd024ff969 -repodata/patch-spamassassin-3077.xml diff --git a/libzypp/tests/parser/yum/data/patches.xsl b/libzypp/tests/parser/yum/data/patches.xsl deleted file mode 100644 index 10b4cc2..0000000 --- a/libzypp/tests/parser/yum/data/patches.xsl +++ /dev/null @@ -1,13 +0,0 @@ - - - - - -
-
-
-
-
-
-
diff --git a/libzypp/tests/parser/yum/data/repomd-1.xml b/libzypp/tests/parser/yum/data/repomd-1.xml deleted file mode 100644 index 26b7231..0000000 --- a/libzypp/tests/parser/yum/data/repomd-1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 63d86413540fbb2647e5b5de556d4e4b53f032d9 - 1176225512 - 63d86413540fbb2647e5b5de556d4e4b53f032d9 - - - - f76cb1f9f1963edc614848944b99e2664eba4b4a - 1176225558 - f9cf4f4520ebe75e4bd66c1572521b414dfea564 - - - - fd1ea55f143820333b702cda4f97b286daf65171 - 1176225549 - 3bfb8413a4698b86f632bb914f6dc8a4e3ac9660 - - - - 689fecabbb0907f51f5bb7211048e091c6f2bc84 - 1176225550 - ce38366eaded03cb8b3fdc64bb31ea5304e9901c - - diff --git a/libzypp/tests/parser/yum/data/repomd-1.xml.solution b/libzypp/tests/parser/yum/data/repomd-1.xml.solution deleted file mode 100644 index fbd5911..0000000 --- a/libzypp/tests/parser/yum/data/repomd-1.xml.solution +++ /dev/null @@ -1,17 +0,0 @@ -patches -sha1 -63d86413540fbb2647e5b5de556d4e4b53f032d9 -repodata/patches.xml -other -sha1 -f76cb1f9f1963edc614848944b99e2664eba4b4a -repodata/other.xml.gz -primary -sha1 -fd1ea55f143820333b702cda4f97b286daf65171 -repodata/primary.xml.gz -filelists -sha1 -689fecabbb0907f51f5bb7211048e091c6f2bc84 -repodata/filelists.xml.gz - diff --git a/libzypp/tests/repo/CMakeLists.txt b/libzypp/tests/repo/CMakeLists.txt deleted file mode 100644 index 53a3615..0000000 --- a/libzypp/tests/repo/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -ADD_SUBDIRECTORY( yum ) -ADD_SUBDIRECTORY( susetags ) - -# to find the KeyRingTest receiver -INCLUDE_DIRECTORIES( ${LIBZYPP_SOURCE_DIR}/tests/zypp ) - -ADD_TESTS(RepoVariables ExtendedMetadata PluginServices MirrorList DUdata) diff --git a/libzypp/tests/repo/DUdata_test.cc b/libzypp/tests/repo/DUdata_test.cc deleted file mode 100644 index 27c56f1..0000000 --- a/libzypp/tests/repo/DUdata_test.cc +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/RepoManager.h" -#include "zypp/ResPool.h" -#include "zypp/sat/Pool.h" -#include "zypp/PoolQuery.h" - -#include "KeyRingTestReceiver.h" -#include "TestSetup.h" - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using namespace zypp::filesystem; - -#define TEST_DIR TESTS_SRC_DIR "/repo/susetags/data/dudata" - -PoolItem piFind( const std::string & name_r, const std::string & ver_r, bool installed_r = false ) -{ - PoolQuery q; - q.addDependency( sat::SolvAttr::name, name_r, Rel::EQ, Edition(ver_r) ); - q.setStatusFilterFlags( installed_r ? PoolQuery::INSTALLED_ONLY : PoolQuery::UNINSTALLED_ONLY ); - if ( q.size() != 1 ) - ZYPP_THROW(Exception(q.size()?"Ambiguous!":"Missing!")); - return PoolItem( *q.begin() ); -} - -typedef std::pair ByteSet; -namespace std -{ - inline std::ostream & operator<<( std::ostream & str, const ByteSet & obj ) - { return str << "<" << obj.first << "," << obj.second << ">"; } -} - -inline ByteSet mkByteSet( const DiskUsageCounter::MountPointSet & mps_r ) -{ return ByteSet( mps_r.begin()->commitDiff(), (++mps_r.begin())->commitDiff() ); } - -inline ByteSet mkByteSet( int grow_r , int norm_r ) -{ return ByteSet( ByteCount( grow_r, ByteCount::K ), ByteCount( norm_r, ByteCount::K ) ); } - -inline ByteSet getSize( const DiskUsageCounter & duc_r, const PoolItem & pi_r ) -{ return mkByteSet( duc_r.disk_usage( pi_r ) ); } - -inline ByteSet getSize( const DiskUsageCounter & duc_r, const ResPool & pool_r ) -{ return mkByteSet( duc_r.disk_usage( pool_r ) ); } - -inline void XLOG( const DiskUsageCounter & duc_r, const ResPool & pool_r ) -{ - for( const auto & pi : pool_r ) - { - USR << pi << endl; - } - WAR << duc_r.disk_usage( pool_r ) << endl; -} - -BOOST_AUTO_TEST_CASE(dudata) -{ - //KeyRingTestReceiver rec; - // rec.answerAcceptUnknownKey(true); - //rec.answerAcceptUnsignedFile(true); - // rec.answerImportKey(true); - - Pathname repodir( TEST_DIR ); - TestSetup test( Arch_x86_64 ); - test.loadTargetRepo( repodir/"system" ); - test.loadRepo( repodir/"repo", "repo" ); - - ResPool pool( ResPool::instance() ); - PoolItem ins( piFind( "dutest", "1.0", true ) ); - PoolItem up1( piFind( "dutest", "1.0" ) ); - PoolItem up2( piFind( "dutest", "2.0" ) ); - PoolItem up3( piFind( "dutest", "3.0" ) ); - - DiskUsageCounter duc( { DiskUsageCounter::MountPoint( "/grow", DiskUsageCounter::MountPoint::Hint_growonly ), - DiskUsageCounter::MountPoint( "/norm" ) } ); - //XLOG( duc, pool ); - - BOOST_CHECK_EQUAL( getSize( duc, ins ), mkByteSet( 5, 5 ) ); - BOOST_CHECK_EQUAL( getSize( duc, up1 ), mkByteSet( 15, 15 ) ); - BOOST_CHECK_EQUAL( getSize( duc, up2 ), mkByteSet( 45, 45 ) ); - BOOST_CHECK_EQUAL( getSize( duc, up3 ), mkByteSet( 0, 0 ) ); - - // delete installed size 5 g n - ins.status().setTransact( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( getSize( duc, pool ), mkByteSet( 0, -5 ) ); - ins.status().setTransact( false, ResStatus::USER ); - - // install known DU size 15 g n - up1.status().setTransact( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( getSize( duc, pool ), mkByteSet( 15, 15 ) ); // (multi)install (old stays) - ins.status().setTransact( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( getSize( duc, pool ), mkByteSet( 15, 10 ) ); // update (old goes) - ins.status().setTransact( false, ResStatus::USER ); - up1.status().setTransact( false, ResStatus::USER ); - - // install unknown DU size 0/installed g n - up3.status().setTransact( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( getSize( duc, pool ), mkByteSet( 5, 0 ) ); // (multi)install (n could be 5 too, but satsolver does not know about multinstall) - ins.status().setTransact( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( getSize( duc, pool ), mkByteSet( 5, 0 ) ); // update (old goes) - ins.status().setTransact( false, ResStatus::USER ); - up3.status().setTransact( false, ResStatus::USER ); -} diff --git a/libzypp/tests/repo/ExtendedMetadata_test.cc b/libzypp/tests/repo/ExtendedMetadata_test.cc deleted file mode 100644 index 64d4de1..0000000 --- a/libzypp/tests/repo/ExtendedMetadata_test.cc +++ /dev/null @@ -1,143 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/Package.h" -#include "zypp/RepoManager.h" -#include "zypp/sat/Pool.h" -#include "KeyRingTestReceiver.h" - -#include "TestSetup.h" - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using namespace zypp::filesystem; - -#define TEST_DIR TESTS_SRC_DIR "/repo/yum/data/extensions" - -BOOST_AUTO_TEST_CASE(extended_metadata) -{ - KeyRingTestReceiver rec; - //rec.answerAcceptUnknownKey(true); - rec.answerAcceptUnsignedFile(true); - - -// rec.answerImportKey(true); - Pathname repodir(TEST_DIR ); - - sat::Pool pool(sat::Pool::instance()); - - TestSetup test( Arch_x86_64 ); - test.loadRepo(repodir.absolutename().asDirUrl(), "updates"); - - Repository repo = pool.reposFind("updates"); - - BOOST_CHECK_EQUAL( repo.generatedTimestamp(), Date(1227279057) ); - BOOST_CHECK_EQUAL( repo.suggestedExpirationTimestamp(), Date(1227279057 + 3600) ); - - // check that the attributes of product compatibility are ok - int count = 0; - vector cpeids; - vector labels; - - for_( it, - repo.compatibleWithProductBegin(), - repo.compatibleWithProductEnd() ) - { - cpeids.push_back(it.cpeId()); - labels.push_back(it.label()); - count++; - } - - // there were 2 compatible products - BOOST_CHECK_EQUAL( count, 2 ); - BOOST_CHECK_EQUAL( cpeids[0], "cpe:/o:opensuse" ); - BOOST_CHECK_EQUAL( cpeids[1], "cpe:/o:sle" ); - - BOOST_CHECK_EQUAL( labels[0], "openSUSE 11.0" ); - BOOST_CHECK_EQUAL( labels[1], "SLE 11.0" ); - - cpeids.clear(); - labels.clear(); - count = 0; - - for_( it, - repo.updatesProductBegin(), - repo.updatesProductEnd() ) - { - cpeids.push_back(it.cpeId()); - labels.push_back(it.label()); - count++; - } - - // the repo updates one product - BOOST_CHECK_EQUAL( count, 1 ); - BOOST_CHECK_EQUAL( cpeids[0], "cpe:/o:sle" ); - BOOST_CHECK_EQUAL( labels[0], "SLE 11.0" ); - - // because this product updates something, it _is_ an update repo - BOOST_CHECK( repo.isUpdateRepo() ); - - BOOST_CHECK( repo.providesUpdatesFor(CpeId("cpe:/o:sle")) ); - BOOST_CHECK( ! repo.providesUpdatesFor(CpeId("cpe:/o:windows")) ); - // reuse to count solvables - count = 0; - - /** - * Now check for the extended metadata of the packages - */ - for_( it, repo.solvablesBegin(), repo.solvablesEnd() ) - { - sat::Solvable s = *it; - MIL << s << endl; - MIL << s.kind() << endl; - if ( s.ident() == "wt" ) - { - count++; - Package::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - BOOST_CHECK(p->maybeUnsupported() ); - BOOST_CHECK_EQUAL(p->vendorSupport(), VendorSupportUnknown ); - - } - else if ( s.ident() == "foobar" ) - { - count++; - Package::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - BOOST_CHECK_EQUAL(p->vendorSupport(), VendorSupportUnsupported ); - BOOST_CHECK(p->maybeUnsupported() ); - } - else if ( s.ident() == "foofoo" ) - { - count++; - Package::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - // if it is level 3 support it cant be unsupported - BOOST_CHECK_EQUAL(p->vendorSupport(), VendorSupportLevel3 ); - BOOST_CHECK(! p->maybeUnsupported() ); - - } - else - { - BOOST_FAIL(str::form("Repo has package not contemplated in test: %s", s.ident().c_str()).c_str()); - } - - } - - // check that we actually found all testeable - // resolvables - BOOST_CHECK_EQUAL(count, 3); - -} diff --git a/libzypp/tests/repo/MirrorList_test.cc b/libzypp/tests/repo/MirrorList_test.cc deleted file mode 100644 index 40c38a6..0000000 --- a/libzypp/tests/repo/MirrorList_test.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include - -#include "WebServer.h" - -#include "zypp/repo/RepoMirrorList.cc" - -using namespace std; -using namespace zypp; -using namespace zypp::repo; - -BOOST_AUTO_TEST_CASE(get_mirrorlist) -{ - WebServer web((Pathname(TESTS_SRC_DIR) + "/data/Mirrorlist/remote-site").c_str(), 10001); - web.start(); - - Url weburl1 (web.url()); - Url weburl2 (web.url()); - - weburl1.setPathName("/metalink.xml"); - weburl2.setPathName("/mirrors.txt"); - - RepoMirrorList rml1 (weburl1); - RepoMirrorList rml2 (weburl2); - - BOOST_CHECK(rml1.getUrls().begin()->asString() == "http://ftp-stud.hs-esslingen.de/pub/fedora/linux/updates/13/x86_64/"); - BOOST_CHECK(rml2.getUrls().begin()->asString() == "http://ftp-stud.hs-esslingen.de/pub/fedora/linux/updates/13/x86_64/"); - - BOOST_CHECK(rml1.getUrls().size() == 4); - BOOST_CHECK(rml2.getUrls().size() == 4); - - web.stop(); -} diff --git a/libzypp/tests/repo/PluginServices_test.cc b/libzypp/tests/repo/PluginServices_test.cc deleted file mode 100644 index d999c7c..0000000 --- a/libzypp/tests/repo/PluginServices_test.cc +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "zypp/ZYppFactory.h" -#include "zypp/Url.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/ZConfig.h" -#include "zypp/repo/PluginServices.h" -#include "zypp/ServiceInfo.h" - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; -using namespace zypp::repo; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/yum/data") - -class ServiceCollector -{ -public: - typedef std::set ServiceSet; - - ServiceCollector( ServiceSet & services_r ) - : _services( services_r ) - {} - - bool operator()( const ServiceInfo & service_r ) const - { - _services.insert( service_r ); - return true; - } - -private: - ServiceSet & _services; -}; - - -BOOST_AUTO_TEST_CASE(plugin_services) -{ - ServiceCollector::ServiceSet services; - - PluginServices local("/space/tmp/services", ServiceCollector(services)); -} - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/repo/RepoVariables_test.cc b/libzypp/tests/repo/RepoVariables_test.cc deleted file mode 100644 index 0eb0c78..0000000 --- a/libzypp/tests/repo/RepoVariables_test.cc +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "zypp/ZYppFactory.h" -#include "zypp/Url.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/ZConfig.h" -#include "zypp/repo/RepoVariables.h" - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; -using namespace zypp::repo; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/yum/data") - -BOOST_AUTO_TEST_CASE(replace_text) -{ - /* check RepoVariablesStringReplacer */ - ZConfig::instance().setSystemArchitecture(Arch("i686")); - - RepoVariablesStringReplacer replacer1; - BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar"), - "http://foo/i686/bar"); - - /* check RepoVariablesUrlReplacer */ - RepoVariablesUrlReplacer replacer2; - - BOOST_CHECK_EQUAL(replacer2(Url("ftp://user:secret@site.org/$arch/")).asCompleteString(), - "ftp://user:secret@site.org/i686/"); - - BOOST_CHECK_EQUAL(replacer2(Url("http://user:my$arch@site.org/$basearch/")).asCompleteString(), - "http://user:my$arch@site.org/i386/"); - - BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/?arch=$arch")).asCompleteString(), - "http://site.org/update/?arch=i686"); - - // now we initialize the target - filesystem::TmpDir tmp; - - ZYpp::Ptr z = getZYpp(); - - // create the products.d directory - assert_dir(tmp.path() / "/etc/products.d" ); - BOOST_CHECK( copy( Pathname(TESTS_SRC_DIR) / "/zypp/data/Target/product.prod", tmp.path() / "/etc/products.d/product.prod") == 0 ); - // make it the base product - BOOST_CHECK( symlink(tmp.path() / "/etc/products.d/product.prod", tmp.path() / "/etc/products.d/baseproduct" ) == 0 ); - - z->initializeTarget( tmp.path() ); - // target activated, there should be replacement of - // $distver - BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/$releasever/?arch=$arch")).asCompleteString(), - "http://site.org/update/10/?arch=i686"); - -} - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/repo/susetags/CMakeLists.txt b/libzypp/tests/repo/susetags/CMakeLists.txt deleted file mode 100644 index 4993c4e..0000000 --- a/libzypp/tests/repo/susetags/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -ADD_TESTS(Downloader) \ No newline at end of file diff --git a/libzypp/tests/repo/susetags/Downloader_test.cc b/libzypp/tests/repo/susetags/Downloader_test.cc deleted file mode 100644 index 70fec59..0000000 --- a/libzypp/tests/repo/susetags/Downloader_test.cc +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/Url.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/repo/susetags/Downloader.h" - -#include "tests/zypp/KeyRingTestReceiver.h" - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; -using namespace zypp::repo; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/susetags/data") - -BOOST_AUTO_TEST_CASE(susetags_download) -{ - KeyRingTestReceiver keyring_callbacks; - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - - Pathname p = DATADIR + "/stable-x86-subset"; - MediaSetAccess media(p.asDirUrl()); - RepoInfo repoinfo; - repoinfo.setAlias("testrepo"); - repoinfo.setPath("/"); - susetags::Downloader downloader(repoinfo); - filesystem::TmpDir tmp; - - Pathname localdir(tmp.path()); - - downloader.download(media,localdir); - - MIL << "All files downloaded" << endl; - - const char* files[] = - { - "/suse", - "/suse/setup", - "/suse/setup/descr", - "/suse/setup/descr/kde-10.3-71.noarch.pat", - "/suse/setup/descr/packages", - "/suse/setup/descr/packages.DU", - "/suse/setup/descr/packages.en", -// "/suse/setup/descr/packages.es", - "/suse/setup/descr/patterns", - "/content", - "/gpg-pubkey-7e2e3b05-44748aba.asc", - "/media.1", -// "/media.1/products.asc", -// "/media.1/products.key", - "/media.1/media", -// "/media.1/products", -// "/media.1/info.txt", -// "/media.1/license.zip", - "/gpg-pubkey-a1912208-446a0899.asc", - "/gpg-pubkey-307e3d54-44201d5d.asc", - "/gpg-pubkey-9c800aca-40d8063e.asc", - "/content.asc", - "/content.key", - "/gpg-pubkey-3d25d3d9-36e12d04.asc", - "/gpg-pubkey-0dfb3188-41ed929b.asc", - NULL - }; - - int i=0; - while ( files[i] != NULL ) - { - BOOST_CHECK_MESSAGE( PathInfo(localdir + files[i] ).isExist(), string(files[i]).c_str() ); - i++; - } - -} - -BOOST_AUTO_TEST_CASE(susetags_gz_download) -{ - KeyRingTestReceiver keyring_callbacks; - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - - Pathname p = DATADIR + "/stable-x86-subset-gz"; - MediaSetAccess media(p.asDirUrl()); - RepoInfo repoinfo; - repoinfo.setAlias("testrepo"); - repoinfo.setPath("/"); - susetags::Downloader downloader(repoinfo); - filesystem::TmpDir tmp; - - Pathname localdir(tmp.path()); - - downloader.download(media,localdir); - - const char* files[] = - { - "/suse", - "/suse/setup", - "/suse/setup/descr", - "/suse/setup/descr/kde-10.3-71.noarch.pat.gz", - "/suse/setup/descr/packages.gz", - "/suse/setup/descr/packages.DU.gz", - "/suse/setup/descr/packages.en.gz", -// "/suse/setup/descr/packages.es", - "/suse/setup/descr/patterns.gz", - "/content", - "/gpg-pubkey-7e2e3b05-44748aba.asc", - "/media.1", -// "/media.1/products.asc", -// "/media.1/products.key", - "/media.1/media", -// "/media.1/products", -// "/media.1/info.txt", -// "/license.tar.gz", -// "/control.xml", -// "/installation.xml", - "/gpg-pubkey-a1912208-446a0899.asc", - "/gpg-pubkey-307e3d54-44201d5d.asc", - "/gpg-pubkey-9c800aca-40d8063e.asc", - "/content.asc", - "/content.key", - "/gpg-pubkey-3d25d3d9-36e12d04.asc", - "/gpg-pubkey-0dfb3188-41ed929b.asc", - NULL - }; - - int i=0; - while ( files[i] != NULL ) - { - BOOST_CHECK_MESSAGE( PathInfo(localdir + files[i] ).isExist(), string(files[i]).c_str() ); - i++; - } - -} - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/build b/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/build deleted file mode 100644 index 3e09a19..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/build +++ /dev/null @@ -1 +0,0 @@ -openSUSE-11.1-Beta5-DVD-i586-Build0128 diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/directory.yast b/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/directory.yast deleted file mode 100644 index d1b27df..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -build -info.txt -media -products -products.asc -products.key diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/media b/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/media deleted file mode 100644 index 42af4f5..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/media +++ /dev/null @@ -1,3 +0,0 @@ -openSUSE -20081112071348 -1 diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/products b/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/products deleted file mode 100644 index bf73ab9..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/media.1/products +++ /dev/null @@ -1 +0,0 @@ -/ openSUSE 11.1-0 diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/SHA1SUMS b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/SHA1SUMS deleted file mode 100644 index 308e7d9..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/SHA1SUMS +++ /dev/null @@ -1,2 +0,0 @@ -33bbc20526153c35d11ce0b1c3d6b7be151b92d9 content -bfc5ac3540529a9a898c3c444096f9bcbb5db780 directory.yast diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content deleted file mode 100644 index cc17cac..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content +++ /dev/null @@ -1,19 +0,0 @@ -CONTENTSTYLE 11 -BASEARCHS i586 -DATADIR suse -DESCRDIR suse/setup/descr -DISTRIBUTION openSUSE -FLAVOR dvd -LABEL openSUSE 11.1 -LINGUAS cs da de en en_GB en_US es fi fr hu it ja nb nl pl pt pt_BR ru sv zh zh_CN zh_TW -NAME openSUSE -REFERENCES openSUSE-release = 11.1 -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/11.0.42/release-notes-openSUSE.rpm -REPO_LOCATION http://download.opensuse.org/factory/repo/oss/ -SUMMARY openSUSE -VENDOR openSUSE -VERSION 11.1 -META SHA1 3d0cdf34257cc2c54929bf5414969142cad1d421 packages -META SHA1 2d68731ab2f3c86b81f7672798f871cf96b2d0fc packages.DU -META SHA1 07c36c760ed0c58b58d6d8fcfdd2717df02c4256 packages.en -HASH SHA1 875e73cf2ee139203208c860fbfd7fa5cb291c7e license.tar.gz \ No newline at end of file diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.asc b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.asc deleted file mode 100644 index 3df9e35..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkktcUUACgkQm+zCtd2wN1ZrDgCdFYz7dG8ui0ueFLOIHYxFgunL -VEYAnjzykFqwVAmYhF/QNbfriOqN5z1B -=4Jf7 ------END PGP SIGNATURE----- diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.key b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.key deleted file mode 100644 index 5c27af8..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/content.key +++ /dev/null @@ -1,439 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBDsj/RYRBACQD/DCxkMgmEjBNYh53AfsV+zcMaz4nDmeEElANfHrVzVGx33N -Siiqs33RIjV35Gd8OH1iSnbA7ef0gWELgVSToK2ydv/3X5Cbcb1MOWYQKJE1dQz7 -fw7Ic9nP7NieM18YMsOYEmCvyL4sLZviQIlb3caP+OpI/GAoNINY8m9yowCgxgx1 -L+jnJznXyKy7v5WgwMyrE2cD/38Nvp62Rq1/IqhUDc3SDUp5+xPddwOZ/E7P9F73 -0Gb2ec2fhAm9QZyVvFvLa+SJq2/LvY+vITZSRI0HTBZf4Yrzd6eHu/cDp0m0o/BS -McuoaHmKeHYcyIa2w8LMREpchgdlY/LnHR83Yipc3iegBRUvoTtwUYMqpswwi+6i -50nhA/9MC5cPOZbPpqbaDbSz0NtAVM2gcvgiBx4VKCh/AhkZ+abzogeHn6uT2eaP -3Fnk4YOa0FEbO+YHg3Lu45tZV3pBQUZoY07r5niT0Sb6dAKO/j/omEt4q44OO3ba -fanEvFurtgpkszoD20yheQLhv7CVdS8IUfQ2R+r0eQjxtAfJWLQmRHVuY2FuIE1h -Yy1WaWNhciBQcmV0dCA8ZHVuY2FuQHB1Yy5jbD6IVwQTEQIAFwULBwoDBAMVAwID -FgIBAheABQJIkdYDAAoJEM0etqlmfkLR6EgAn2/KapnsJrHLcwD3XxHc3KJzosii -AJ9K468Njg7GOzlIP1lfHhIRNB8yjohXBBMRAgAXBQI7I/0WBQsHCgMEAxUDAgMW -AgECF4AACgkQzR62qWZ+QtGplQCcDxIiwPV5CSENHsaR6R1da2VtbVYAnR4C1zKU -A5MZ/cB7OC0/++Va0uPmtCdEdW5jYW4gTWFjLVZpY2FyIFByZXR0IDxkdW5jYW5A -a2RlLm9yZz6IXgQTEQIAHgUCQkG9ngIbIwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAK -CRDNHrapZn5C0f+oAJ9B08kix2phsvE79ZFUIbFsjtm3QgCeNPFdMcNJ2FlrDC1o -l2arF81JBDq0LUR1bmNhbiBNYWMtVmljYXIgUHJldHQgPGR1bmNhbkBtYWMtdmlj -YXIuY29tPoheBBMRAgAeBQJCQb14AhsjBgsJCAcDAgMVAgMDFgIBAh4BAheAAAoJ -EM0etqlmfkLRSwYAnjnoAUut+98JScgZ3RUeELfccgs2AJ49zu0stW/6dfKHUG6v -KxbevTRtBLQqRHVuY2FuIE1hYy1WaWNhciBQcmV0dCA8ZG1hY3ZpY2FyQHN1c2Uu -ZGU+iGAEExECACAFAkiR1d4CGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDN -HrapZn5C0aUTAJ97XpoPCkZh6tKwWJLPSd71rTUu3QCdEIH0RIEn8Hd1EvOvrJUi -xYNg1Tq0LER1bmNhbiBNYWMtVmljYXIgUHJldHQgPGRtYWN2aWNhckBnbWFpbC5j -b20+iGMEExECACMCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCSJHWAwIZAQAK -CRDNHrapZn5C0Q32AJ0eHwMEmyJrW703lxiU8OdlzlBLawCfQoFccGWKTrQXjem9 -q7rjZ8BJltm5AQ0EOyP9LxAEAJ2V7CaBeNwDBrOXHAbH3p2y2tRmnIwQNtdvsCf7 -aEQm7Pcc7OXaM4fk52OD8eHEEmn3XLJpt48DFXgnT3UWdEbieahJtntvapvZ49jE -y1TChI200vxWyuUpMSri1Fx7IGchSxrLBY01gyrF/48vHLtCm8vvm+oD5DtxbdAY -8MkTAAMFBACUp+tTe06sjzrORkgsc1CAG7IeD5Rng2d1HIPgmP/lmUuwsyZVGYg1 -qiBQA5oqeRXLhfzFdJmIHHfJzAVXMte5mhH9Tp3z4RITo7KbvMQZ0jQRlkB0MfYe -Qgcuuq4gUhxvHMxffyJSploMqPkxiV68c9UdlSGIKGraOgSmUnbhWYhGBBgRAgAG -BQI7I/0vAAoJEM0etqlmfkLRbgUAnjGNmh+7esr1UeqNVmKKSpnMWcNFAJ94i40t -/KUd6iH0TeEIc5Lc7taHwZkBogQ7JSbVEQQA4xR5LOB2ZWSHN1I1kKyAktnSm2wV -sW0SCpoq1w9JjmbDgnZpDKSIMuAVjNh53DeQbT/9XsofpyMBx5xSoM6isQCGNwI1 -sxA1Syj2yWdsXUHHhGyq8d2a8sLeCnchxvQ3gDGJoYm/AVWfRoNM8kw+vx6l5gNE -FDnzh0CiwQKVU1cAoP/heoi+DpQV9cSpYNe8hzW3QBbDBACDh/9awQp3NrCI8oxX -YIWuTsQAsDib66HQDi4w8US/7kVp4zqyoTN+gPk8knOS7z6WqpxmHD0DDZu4VE4U -aC1Oa2H/63VFePcvwEUGQwHWThX+JnmJNHO9+XO0003KsH+0Yt4FRn64bJkRcL1P -ScjYZFif/R6TpNRGQmC4JfH+EgP7BCPQkVoi0vvDx39NqT81WZAWc0zGTSFJVypb -TyfYUrG59T9DxwH5NYWMXIdEAEFp+/OheT/AwU+22PfxY9k7rvUkXg4PoStV9yv0 -vEKVGd2g7kDwU77c068iNJO8LEYqF5fnSO8ieU67ZglKZSe0EU2hL6WEZ9TLh6Kz -PHsaq8S0MUZyYW5jaXNjYSBRdWludGFuYSBOYXJhbmpvIDxmcmFuY2lzY2FAaG90 -cG9wLmNvbT6IYAQQEQIAGAUCOyUm1QgLAwkIBwIBCgIZAQUbAwAAAAASCRBnGpo8 -nSL6HQdlR1BHAAEBtLcAoOOto28BA1l20JI6ewbDqZ9e4TSIAKDE4ysvUE+aUj7w -kdr4ODvQxSiSXIhGBBARAgAGBQI7JUWHAAoJEM0etqlmfkLRk+gAmwVtmmKob6sh -PFJjk6STXkjWvx65AKCa9f2BjS0dJjieCpucWfEaaxh7+7kCDQQ7JSbVEAgA9kJX -twh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xk -hkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58 -yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4 -DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/ -POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlL -IhkmuquiXsNV6TILOwACAggA3d73TIqNfiKwTEcXx7OW8KlE8UGx7hiK1+IBakLM -FkB54oVj6aLQyBsH/rrgVs9V/UYhygjyDhNK0715Og7B9bP+YhNPswix7KBj0mOA -1O1mEIK6rpkgT9AqhARcwSUlDf4gg+Dz+pX485a5nw85xGJ+9ygySlzOXNE+GCW7 -PTRQUpqvKs2PTAIsZZLcuY789xl/PxDE4EsRvYoevAk2nLqvru3820LM4ynKwKqz -0QICTLVcE7swa6ck6f53pbzhvEk0dM99MirtJMWkj7qYvwQwoP6U40cAE+k5pHTZ -tboXmycyvC+mysvJrKmVTLrHMZ0v4Tth2eudUbwsrMkRYYhUBBgRAgAMBQI7JSbV -BRsMAAAAABIJEGcamjydIvodB2VHUEcAAQF5ZgCg9T9QjbJA+h+uPT22O0x2BSIK -4LMAoJZimOZ4Tk3USFLE4uXDd+whyKG+mQGiBDslNloRBADEn8TIB8BJTMKJzQHm -sFBk/DYaoH4ERgqiRhyt7+ssd/5rOdbFQOD3QO47esBvP524bM3nkAiMIqmbWsRq -B2XExLuNtfRHTj8zHm2y3Jtogh+e5FxgHP75+lThgoTYcGbflYHaRIMv/vYBDkSg -tHAQ09F/d6GuYptTuKudN9H67wCg/96X+Ac+Kpot+VPb1mA2p/zaiBcEAKHEgFrX -59lrUulJah5CAXaXP2buPQ1Fiday+MGoCIUYBpW5cs6mThixIZzqwbB149/8sV4v -rBd5nQ8vWdddgyvtS9bWkn/C5ERbLrW8bCarph/m01NZsG45yYHeA/P6M/K8lDnO -jp8LJgKmho1kfzLpfh/JrcymxaVR4y/LojLPA/0f5k3urRkyEAimp4p05/aLyW0Y -LuFdh+MAfoL6VeOt1u1LZ2OsqQmTsYI7MPrHUX6zioh/k5OW0pEVHmiYBZtzoX28 -fYOAnJym2Cw0dTPE1gJVXG9ZGaqq2+HWmB8/XuYw9qHmUL2p3Dga7E4Oo49ja5qs -57Ni5Ffo3/wHDGfNErQpTWljaGFlbCBNYWMtVmljYXIgUHJldHQgPG1pbWFjdmlj -QHB1Yy5jbD6IYAQQEQIAGAUCOyU2WggLAwkIBwIBCgIZAQUbAwAAAAASCRBtSv26 -VLUDggdlR1BHAAEBphMAnimtyySasb0oNoRdfPiUEuBe4uZkAKDGXjDyVlUlppVO -NYpgBo8B6D+DcohGBBARAgAGBQI7JUcfAAoJEM0etqlmfkLRZEAAn2zEtLL/5Pdb -VXF1eaaCtAkfpvRLAJ98sHeXEMN3npwp9c/qt4MCNxvfc7kCDQQ7JTZaEAgA9kJX -twh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xk -hkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58 -yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4 -DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/ -POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlL -IhkmuquiXsNV6TILOwACAgf+Os+ycvrsYeE4gApXVFdty6c49JWi/x4QJ/kr9NsQ -GVu2FYByKttWcMokPWWxKNNOR6ryz3Ie2MpiF8aGIqJImpwoG53B7RtGnml9U/yD -z2yW8DUcdvthgi6J4Gzb5gDvWwlj/S1XlWk/Q+C6bAorpoQLYjsObf0NnADzIDdN -4Uy5ESNixHWZ7GqSw6IEKOb+qDoixGWrEq37dDDML95dRjFL8XX8K0dhzO1qKSUu -h+ACtltLUgSzyhWp1vSgLC1XAFRVert5RF47l53DqPX3hVlH/AOCwSa+XEAbtpCr -gXMtImsgs9fLOOipasQggli7voJ8XE1N2DRHUBeNTY3YGIhUBBgRAgAMBQI7JTZa -BRsMAAAAABIJEG1K/bpUtQOCB2VHUEcAAQFpOgCg5hPPL3haLptW/G8AgAyiYzV9 -Vs4AoKietcZ1/NBAS7QDvK0GUEgSsgAUmQGiBDslQEkRBADgDXtg08dhjHQpv9Si -svzvROcsr6QRFOLWf95GWh7c6SI7Pj5mTClUaJXBRjLuvOR0L7w8l5nVJ/4kzSjl -e1ad04eDzP3sB4rNK18l7GAwc0ijV0mp/Kl9F4iibco3cCIMsjysWgUmlk+dYYWQ -ubQA/EgTs7kFQo9QRxzojqnSywCg/5CZ5TJ19gNS8knyu819v6ZSkV8D/01Fem2W -ZejqsmNBNiY1JoWxnTofi3AjMv6j/+NjyBuU9ozIhUicx4y+Ro05eKUZ+VAIecVb -VhEqH9VUriX48TDrNxu4OGJh62q58s0u/tqIX5OrvrpmdOC1UTdcc2CM88vssTt8 -oxauZeM7YAkY9rApXUniyfnJ3fdd3FlCIbvaA/9XXrlBjG/3HQSPfknbqLlCvEcl -elRmm6LAX8fuf/JFgj0ctRMAJKB6HOE7/pvl3yRMMITwmd9lB/s2u+fqcwV1bDqf -nyV8h3KFpTCGM1qKT+EaaT/8JhFJifYDjBEnUe9mYG7dUlt+Ff9Fj6ZRJQs9vszz -QcsJDzNpys+j/KJutbQtRHVuY2FuIE1hYy1WaWNhciBHYXLtbiA8ZHVuY2FuQG1h -Yy12aWNhci5jb20+iGAEEBECABgFAjslQEkICwMJCAcCAQoCGQEFGwMAAAAAEgkQ -wSqJHVebm9QHZUdQRwABAeHRAJsGKaYQp44NzYEjS9dsEAT4sYKzDgCgw4c7kDar -ZL/qKqFvHbvsPS6fRteIRgQQEQIABgUCOyVG9QAKCRDNHrapZn5C0WO7AKCBUULk -55fR/yavkYgUhL9AX0rShgCfQ0jjVarVQNc/cj5ilTdKqSkeJ8q5Ag0EOyVAShAI -APZCV7cIfwgXcqK61qlC8wXo+VMROU+28W65Szgg2gGnVqMU6Y9AVfPQB8bLQ6mU -rfdMZIZJ+AyDvWXpF9Sh01D49Vlf3HZSTz09jdvOmeFXklnN/biudE/F/Ha8g8VH -MGHOfMlm/xX5u/2RXscBqtNbno2gpXI61Brwv0YAWCvl9Ij9WE5J280gtJ3kkQc2 -azNsOA1FHQ98iLMcfFstjvbzySPAQ/ClWxiNjrtVjLhdONM0/XwXV0OjHRhs3jMh -LLUq/zzhsSlAGBGNfISnCnLWhsQDGcgHKXrKlQzZlp+r0ApQmwJG0wg9ZqRdQZ+c -fL2JSyIZJrqrol7DVekyCzsAAgIH/3NYWNGw9Wa8B6Ow6NyS2WSBrx33ZxInDgOb -Ze72mO/GSyxxZqxPiqTFTpajTD+HWKQuvSfMGZdD1kJZTrNEI/MNLwVBhrgxLX2q -rmq1aJgWa5aRcv05wHuIUrw2g220oZ09gUhXuF3U/oDUCAX36d16CaPCMJV1TRUo -c2L1WoLP2BjzIkAgKrqUGvIFNsvtXe3cNU5dSQzF0spExuCz1Wy67/T4fzLSJpiW -adl/eN67cp83ega5fyYy9NpISmeiFcV25UJqbQM0ktilZzDhx+evmYd6PHP7i8Oq -gC1oHajEohfo9kmyO/AXJ/v08svnSJVO0G/9qQeuFp3JVeBHsN6IVAQYEQIADAUC -OyVASgUbDAAAAAASCRDBKokdV5ub1AdlR1BHAAEBRRIAnjhaS/m/eYLw2g79GuLD -/1x12Xj9AKCW04cRwUxoIirwdJxLNRT2GoLAdpkBogRDRPbUEQQAqD1L0hdAtxso -Pdwc34z6EM3yBuynB/l9TzHe8LGhePAed7dle6ceDBsOVgsEcukvm5M/OjrN2HMX -sJtGu/1nvxtEJs5sjjg/n/i+bO0q9KzNX5hVRmUSop9TF9LO2KV+NK0h6LjUmF11 -9r7vqO7ib5MyPP8n9eimnOG9Zz940+cAoLlehpdXlpDkvQ38AVLiHcCzm843A/9g -faz7LjeJoW40wJz8c/HzCiNq/uvFLxJInFSHiimrhKfSVnXn0eWH79pKGoKmQtxf -eedEo2cNq/1psdEYQAOJrJLjF8CGraN/TSvfqF6oElW8kwgG/EhID5cOtH/zHLZS -L3kaU5kmki9+7Y/lBB6jlEj6EZNFTV0zC9Ka1qblcQP/QGIietl/9Aldw5LHnCr6 -94VnQ91mYaJ4kSJ2IZHqJByRT9FdFpFqRw9fm6zYBxNIoI525Ey1n1WA4aaUXHCo -zIgeAsZcDaK3jnNrkbztnAM6OXdMwnSQ30zYtSG7Kbn965Z2BWfmNnYaz/NuRTL3 -EtHS9mU1XDlz8A1VSUQwdJe0L1dpbGwncyBHVyBjcnlwdG8gdGVzdCBrZXkgPHdz -dGVwaGVuc29uQHN1c2UuZGU+iGAEExECACAFAkNE9tQCGwMGCwkIBwMCBBUCCAME -FgIDAQIeAQIXgAAKCRB30Gza79cROIiZAJ91uP31qZIGX6YrfXbtb8yk2kvsugCc -C1z685uRfQg01++wHwkj7L2Dh2K5Ag0EQ0T24BAIAL3jlSmKpyjHgvZmRM6WDxY8 -MTHtKknVQKsT7wDpJ82yaQx5tDvbiH/BfyEGQvh6vwjkJPc6MDJKxyAbPd2tEkl+ -KVde+F47IcQ6GMQ4lH/100w3nON2uNtDNyt44t8ko/zMiIDq9c7tcwljfdJxSMoQ -WwFKlsIhDuLR7SPeqTJKOkb5jGW9ILAuRETE3eYl37xDwuN+7TcrlaJHmZmQD2dk -CyaJrN67dbEboxeL2XgzkWV8K4VFxrbHKKTYINwt/QLMNnhUu8Gnm5VHUG7R+os9 -6Hw/qs9jzXNsHJ2OaumnmU8gdFEkoRuz7EAEyw4RcJHgz6qfIOaCPiZrz4KsgGMA -AwUIAKSw54P61phChKmlBBubIBtn6knu0PLUlw/zso1xr845LqwnvoDlIlqlHzxL -WERgVxrxPFamBr3kGVY6ojcSeperSvMeBisTMQuITBRU6EFqAYRMNScucLzmPCqK -ki5wxEY1xaqk0LAxJ8hYzBgZeCtl1ozmDAZkqpGgycnbb7p6oB9MlC7t6LsWO8JN -2SqLwxprbeIuDK7YZmF6vVtrTNS7rV4ezwoSX+A1SKP9MUoIbzELySBCwD6CCKfI -eFdO7Iz3bxoPp+J0gIcOuyixwkf0xKoE1Cx+cPNwKKcG68g5wSgVxYes8dwK2btP -WDNfcVuSdY7uLq3kBuo25cuVZp+ISAQYEQIACQUCQ0T24AIbDAAKCRB30Gza79cR -OKjbAJ9rKEjBV92RKyeFMMJNqYO3b2JWdACVGFhCjk3wHOZB6MfwfK1dMQ7vdJkB -ogQ57vSBEQQAk/GN+ftr7+DBlSoixDDpfRnUk+jApGEt8hCnrnjVnPs/9Cr33+CX -LQbILOO7Y5oiPbJdHh45t4E0fKyLVzDerCRFB1swz/mNDxT26DLysdBV5fwNHTPh -xa67goAZVrehQPqJEckkIpYriOaYcKpF3n5fQIZMEfMaHEElQhcXML8AoJVXDkJY -h7vI8EUB8ZURNLZMEECNA/sH0MCnb4Q6ZcRyeZ3+1PHP8hP73b6TepRdLZhaylwV -F/iu7uIn62ZUL4//NTOCDY7V63qg4iba/fUbOsWtEnGaiE7mQuAlsSWvRspwRA9/ -g9rdVf3/JdLJrLmKBTheyG+PSJE3W7cAE4ZWafGxIRCwXhmj3TQnJn2euqylHRub -EQP/aL53NZK0kBdvrKgff6O8Of6tqoss8Dkk55I7QVFSp+My1Dn+mngQKFejTAgt -yo/WmR3wPjQ9HoT2lRiYI2lTRYT4uMdHuwVC3b4DqAKmoy375FERwHkrMVyKBJsl -v8QtbAWw5A1CAUseaHo+91wmYJ4/4p6YUahqbG/tZyhbxfq0KFN1U0UgUGFja2Fn -ZSBTaWduaW5nIEtleSA8YnVpbGRAc3VzZS5kZT6IYgQTEQIAIgUCQNgGPgIbAwUJ -Dm3fvQQLBwMCAxUCAwMWAgECHgECF4AACgkQqE7a6JyACsqQnwCfUbmemUle0FuK -U4EyMUPgAT6dLCMAn3xvWwjZ6xEz5YDp/nRhJAFnoCi/iEYEEBECAAYFAjpwXlIA -CgkQnkDjEAAKq6TczgCgi+ddhWb7+FWcfeE6WwPZccqAHowAnjjtRyGwHLQHr5OT -FAYTXi2Wv6jNiQEVAwUQOnBgb3ey5gA9JdPZAQE1pwf/QJ+b34lFBNVUJ7fk/xGJ -JREt7V12iSafaRzGuH8xWvIz1bb+VARxnnt16FDQ1cDNjoEhCEmcW83Vxp6iJXE9 -PE8wVA/Yue/bon5JS7J69+UiQ2eq2pudfwljp52lYVM53jgPYEz0q/v3091nlZ8C -YkAkN9JDS1lV1gEzJ7J0+POngDpU+lDQT2EC6VKaxeWK8pNt6UFDwICRDQxKnlOo -iDvTrdWT7QdJZ4sPv8Qotdw9+tKNbWQ2DqdIRxyTdw9xDfAtcj6mXeQr7852Lwem -1gSKVnEYHZ9g1FTJqVOutY8KhpUc9RfOCRv8XuIxrs4KSbfSF0s8qIRCQelxufg9 -AbkCDQQ57vSSEAgAhJHQTejMX+Vr6g1pHDEcusJ63fQ2CfFFE5iE9okH9O7UVCiS -fb9CV38dmeHdPCEEjDUWquFYEnvj3WICMtH249t1Ymuf4Du3yRKQ9oXdn/qTJzlr -x9qzjiG3mH7ocwHOgUIwCrZoEdBEVE2n0zPVm+hddwjWWTWXw6pxQz+i9dsN89xe -xRV5M9O0bNwCLaNWX2GXeLAkqTK/9EuZy6x2yLxi6du9YYUAXkZpqBhCjtiUXpRo -FCdglMznbcAyCk9C2wqb2j/D1Z2BeSBaGCSFkR6pRLebnE17LWcu72Iy+r0z+Jec -bPiyDpDZj4apn7IC81aNFGi7fNITsHODbwwjiwADBgf/YPvVdzkc8OC7ztacEWCa -nwylKvxCdKzTDA+DfES6WUYShyiVJvZzRy25LJ5WcK20kzOS6Qv1OrIXiz/pdGy1 -aKtJZrAnFEsofpmOj8VoqyyFgp/yAGQBp12+mXek7SCZRhuqalDfEMRiWEJ6J5dL -kyShyRDWyPbFh0HXE7QTHN+IKKxxQqNQXL6Z3NSxS61p+5n6BseiDUI39xxkKTFw -FrkgUIc5Gs2Or2lhaWvGwSfoCmwbsklszZt6xbU+R0SjFqTvjPWx6eHfqbmNC9WM -DdTjGrXDDKXFp2aYlokfN6It9vsbVlGNlOwHt/JjGoPMxW6Xqj0FLA7/VewgCdXW -64hMBBgRAgAMBQJA2AZ6BQkObd/oAAoJEKhO2uicgArKZ6YAn0W2MMU94qvvZfz4 -DU1DU2TpaH9qAJ9uctHhotN+9Y2qfZDlerqu9bFLjpkBogRGI2ZOEQQAoyDrTWj8 -7ypQt9m/EeUw0QdPxUNLbDLbeXS8LqtmWJRG09WCxdddL2RJeSEAKuZXbw+zHUf+ -n6nV03cQXmM2Y3iBGGx84N6zfzf/jJHBuFvCCtR+ngwGy9OR5UNbnk6dJo4KBi2C -rdYoEHvIebgOoBBO3b9LRtDScdsORrNhqZsAoIkYrrNnr9ttT2uuSKUdYLGLlyzh -BACidQb45vgXxyYq6qB+4j6uR5QAcJ/rPbFJn+m4wpH2q/8kgLC9FVIRzQiKB1BG -XdopgNmQNJEwcQfgSF/xzEWc8T2RMGCPENFGLE1W/4J0LfplmmbNf9rXlkdMJ1Kf -njuTKTgDvUIxSU3SM9BnoLH0jjwqOeQlLZLa97SVCn2d4AP/ZmXvm9RL4tf1LPpJ -ZxEUSkdo41l8cLjzelIryW31yGY7lVDXJQIRKrLc6X51idy4T8Y9Myb4afzJ6kk2 -iOg0G69H/ib8D/uZP+IG56pvscTqHMoYlU+OczjwMlGLhuLdJvvRu1ceiwvbTLpG -3Xx2kcpuNsgtrNOBltorCn7WtWW0LFpZcHAgVGVzdCBLZXkgUGFpciA8enlwcC1k -ZXZlbEBvcGVuc3VzZS5vcmc+iGAEExECACAFAkYjZk4CGyMGCwkIBwMCBBUCCAME -FgIDAQIeAQIXgAAKCRCb7MK13bA3VklQAJ45EdpWqIW9kOFp8WpnR2Fkn/FCygCe -I432bBatL5oD7Dv2B2ikyTebAC+5AQ0ERiNmURAEALaAeUxk/SuzQr+Q+XUMO41R -54J8adzRk7QIcIq2KYQVmhdm3t1CVUy21BVteHjJ61VvTyo/xzVS4ULtAugml7V8 -uS2oSJbPphZUisG4j++HBZTWHI+vbcwp2hSoBJUDx3DDnN9RII8kmHFCMrONtTMS -PvrLoFvsh6+QciLC+r33AAMFBACC0sJi7Q/j8JLnrO9wzz8liDNzANHsTu0JmXhc -J26YmWLmUNxojxq23mVah1ge9nYVvPuboEfQlUErCxwucBzCEBVPEbIi9OoGXSGi -TYAK+2o4bVMmz9Fj1aV5M5uflQfAoXvZtGdLdrSvGNClWqQXK92A4MfPRfVQNMp8 -uqt1oohJBBgRAgAJBQJGI2ZRAhsMAAoJEJvswrXdsDdWqbgAn1Efg2qKNzdX8cQ2 -twN7eDpAH6UIAJ9VBL6UKfv+A580mxL8My3qHpN3c5kBogRGP7wCEQQA9nMS2PNz -9htYeU5JCmEGEy6KYFkIe/+x+VCtHH+toCx+0ehewcFuBKpi7JvHhhPJCDqG+cAk -FOqcaQTL/tVGKDtW6IbceC9iVGOcnCYquLtQjckbnIkd8oLLnjEZHpZENoaTbir5 -n4nDnKGs71N7WTOiEyY1f7UL2E0ERqsBH8MAoLNDmN6u3kfDcFnpGo9t7fE1e4Yz -BADUukDII7KeQnS4JV9NqHoghvNqBCiwzlqGdmow/vp2s0iH5SRNA2mdFtukF3sI -eyEc06JlffHyVeop0DWp5ZOf0zbgG9XpV3WmBbjW52dMqDmkycf5m/PL5ut1K/BU -8inXDfnWrvMs7jZSYII+cgXDYPv/GTgJtWZAzJYPbgIYAwP9EUo17v2DZn5XjxcS -CgQgCRSXp8+HUFGXm+XLib9tHgqpyp+QhWBVOmGIN7GGhLWXrpbQ18Hkb3hsHtvB -P76S1Gu6fmmavl8LYyOlOluVar5AiiFLEKsFVkR4p9f+AwASea51Psj3i1zR+o6z -EPowxvEYniPdf+J/oAl9Z28GUP60K1pZcHAgdGVzdGNhc2Uga2V5IDx6eXBwLWRl -dmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRj+8AgIbAwYLCQgHAwIEFQIIAwQW -AgMBAh4BAheAAAoJEL1h2JvZiCG+0yUAn03uDMK5jpVg8Vld8mehOAfcUKtGAKCF -r7OKGFc22kM3JUrR2ouZMbhp/LkCDQRGP7wMEAgA+E9dSjxOws5KoBjGjT/sjUM3 -1A23f0mhEOVnHuat1b5lQaWDkcclo0vEDHPYHvFsXswLI8kyrF5fru3v0JjCrKT8 -z4ZFSsgerOQ/BYUdT3aO2wIuMcfjSzrvQ7rlPo6lJMh2JbfEBds1/fDjnAiLkHNo -Y5Ndnb3xyplIg6FJ37kD8b2KxQFp3rIFCTKmaO03eS8uCI3zCUJUOwNfOgRlPGz1 -qFdUKlCJ1ZDRjVy5oJXpf5vjE1dOZ0+vtSggagkVJbh6g2gohRzlDhVVr7Yq5jyW -f+uye/DSaRe4bs175EK2mrV8h5wMocIsE2S6to2mzI0IBoVfEMineKp4kgS/owAD -BggAnx+BRqq7PaRgVEZko2SpRwFHZxrpdDNirsiYb/GQZAKVLT3DIWSXKOdKRaZK -o3x+398VzEVQz+RaY2kbeu2m23s6fw4LPPuvdTrQERA1mwM2qzTUdxWwfX1Hm4dS -douFu7XwXKCsChViQr6l9hxk81ctZN9757hglcAvyomfwuqXOA6lMAljaGTXfIZh -WnSYMdwjJcUk5ZbGiMjl6fHTCfhRbE5szjc2aRQvQw7aWlHhAoQqbY1sMuVpEBT3 -vhTi1B9QZxknEGMBpRPJfnBZBO4VvLcjsHMeLJNSf7QwnidcBPMHtS1zHSIg+boH -9yXo9f/fKPoUEx435MBqghliVYhJBBgRAgAJBQJGP7wMAhsMAAoJEL1h2JvZiCG+ -TvcAn3iNEaNVAivwlU9fwR/TTQdE8mMwAJsHUBROiGlUrY2w0WBJ0x0DhrFcvZkB -ogREdFC3EQQA2b71VLFFEozMkNn1LfFLuHhibj2zIRLUf7xe6cxf/LvQa+5IelgE -gWdNnTHjaKhcz01O87+j4j/d4ji8MtjEDTkgS5EvjLHEen80umS/NZja/g8IDhf6 -y2eLbnALAWPWd5YEcdJloZfl7p1T1x4ZEfR/UYoOMDq688AbGI43178AoLkNT0Ov -lEIC/Ek1ajWjZ5VWM81FA/99+iH7cKIB/7SqenVfxWD/1aSx17cBXntL3AoeRcHC -j9L2KPTSHwegkdoNKcmLBwVm4XjFl0VU5QmlFToWsnHfg16MipdxXMS+tTg9Bf33 -oNlBKh+59XLBldjAxpal7BebqynT2HAURuesp5Vl7N1uw87vSTfLJIVkp13bQRWt -wQQAqPggF0syyZxaxu5IPAGE/tJPpE0v1MncAK+e0Ei1HP25V0erHjXfkzOCsI+C -I9qTS/y6Wcs1aw0vQVjWR6t20JxET6316SuV1l9KrmZ/M4NSJhcMZiXbhyprcssT -Y4z0dUlBcw9RF6T3wmIES+pFODn5W4BqC9mKZoBzui0Pzhq0Mm9wZW5TVVNFIEJ1 -aWxkIFNlcnZpY2UgPGJ1aWxkc2VydmljZUBvcGVuc3VzZS5vcmc+iGQEExECACQF -AkR0ULcCGwMFCQPCZwAGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQOzARt2udZSP3 -sACZAeKbA5uOEXJK88jMo1xCgWF2Cl0AnAiwVvebe6KACMqn7IPeESAqW6+dmQGi -BD+dnTsRBACwnlz4AhctOLlVBAsq+RaU82nb5P3bD1YJJpsAce1Ckd2sBUOJD11N -UCqH8c7EctOquOZ5zTcWxHiWWbLyKQwUw2SUvnWa5SSbi8kI8q9MTPsPvhwtgMrQ -MLenMO+nsrxrSaG6XcD+ssfJNxC7NQVCQAj3pvvg9rKi3ygsM7CXHwCghgsqX6TO -r55HE90DbEsoq3b/jjsD/i8aIZ6urUgrpAkQslcakXdJLKgSdwjRUgVZgvYZb7kA -x1iPq0t/AhB3NJw3zW4AAKJohGg3xj5K4V8PJEZrSIpoRYlF43Kqlfu2p5ghWT89 -SP4YAlWPeTqf0+dTYUYz3b144k2ZFOdRuXIRxunoYNAUr9oMrxBXbJ/eY+0UQX3p -BACYzKizyY4JJgd0zFJmNkcdK9nzcm+btYFnYQo33w5GSE686UNr+9yiXt9tmPRv -NEbj3u+xoAX8B/5k3aZ5NbUhV64/VcKlUdRIxNlFCG7I9KgxeHWAYwi7yqOGXM3T -/v6o7GLdQEB0ChFqS7kUlqmwLV+C3QhlrFe/Cuk26i+Q6rQiRmVkb3JhIFByb2pl -Y3QgPGZlZG9yYUByZWRoYXQuY29tPokCHAQQAQIABgUCQCztZwAKCRDdE2MqcWVu -aC26D/0abz5VhIh2eOsTpI3vTlHJQpe3Cx5qyLJ5oFaUFbjVIU0L5Vt9dcrmXvzA -oa4czZxtPcbo7wWvENCA3tpcdB83zPqaD9VDEZrjoFzNLL8pK2Kl73/IcMkf/UHG -pcJCWoftag0Zq5AngZgH0Voe6YAreVPBYFSIaZhSCEaYEb8ejOwdAeYc7b01e/43 -TLfRmoeQMFoH/rZUqcLJXfHyi3KkCGZXWfwYkQiGsy5pMT7c4WzIwNZju7QaRJcN -cB9y1FHGnkaz6we4dkh79sqRvn82dxgXbLa1rR/m6g20m/uuOrhHle7gsMtmmQAm -aUTes54HDdlDe2JdL7dTqOhXX8mF3rf4j9BVv/Vz2y4EwBE7JVqPYHT7HDolQ80O -xEamJDuo3h5hgPxsmPZ2JZRLzZKeuq43xz8gJlcB4vpS6Q7j15FB5trQ6iKTIWzW -SqV5zBahG6qJ4RN1ubJzSzOgNIycJ0uFZZ5rnYIyowqTwmzGU8VZphrz3436lYlQ -4sDnluIlYB8mxZHZz2+k3E38PHgqobXa7Al/5kSQ4owTyfo7+IvxHkSbIA5yQpdW -mV8/QJpp7PlcvBlYyvwzXNgj6hGu1XOjSw4AxXtHgmQOya4Q+ktARfWL0wfP/ocd -vdkHajiRv9sp59C/Ir5/zmTmgQeEudous19MaMP43AKqj3Z2/IicBBABAgAGBQJB -3c/dAAoJEJhqQe8YjLfJfTcEAKQ6q/+LuNxz5X4nX0S+6s8pxshdUUTcFQnN013Z -dJ7HBJIt/GZSbyXm5dsWdmvne9vA2Gfo2glP4HtVvEBbmT9vCKC/V8aI1QF/aTcV -wdUaXzIj2rG9dl63LCLl/o9hBa3zPOL80kaSyjPGMuKBM/UzRAVFjVihd0G8gPso -pGSuiEYEEBECAAYFAj+e2OAACgkQKdW6JI31bQVRJQCgmeuid7gnSjUcyRHP7qD0 -pW47YXIAnRfJ5s7NWYj1Tk7I5+c2ZhXTCdByiEYEEBECAAYFAkBpvjQACgkQcdLU -aCBIxSjrhwCeMzGZSA+xfgL03obWLbZN6QtlnpoAnj4aA0MkT6/oqiJOEQp03uh7 -KMrciEYEEBECAAYFAkCo71wACgkQXanJZSIKP4/TKQCfUQmD5oobxJQKCoy/g9aH -ryQQq/QAnjK7ql0wBaO6Z45yggecwHAP5Wm2iEYEEBECAAYFAkEU8TsACgkQ3GVW -6BHmDogH4QCfY4tpxjMm9EYa98IWaPwaFW59OvkAoMynGza4cvZOTSrvFV9teWfv -5r7AiEYEEBECAAYFAkEU8U4ACgkQZGYqnQA+HZ26AwCfVW71WRotzZI74EKmcltt -Xve6WHgAnj8GrScGsOyLUbcGaiPNyu1NWdRGiEYEEBECAAYFAkEU8VoACgkQiEVN -9vr2r+PzUQCfSKSK0ZJ/cf+YdvrHyxcABg8pWZwAn1FnhKQ1AW90BLXkhGpNy7nN -O+ZaiEYEEBECAAYFAkEU8WUACgkQ0ptfRip0+Q2JBwCgksE9QoxWQwaRJApr+Qp/ -k4K8VnwAoKYlK6AvAdeiOKOHlM+eCQ7F3ZBniEYEEBECAAYFAkF6JkgACgkQUdrz -TXusf2wqsQCgiLp1BCmfVnOjDeis49xCIMPNmCcAoILl+XvzwO6Fp3JHCghndJ3S -CycbiEYEEBECAAYFAkG0c74ACgkQ+lAXgUiSypriPACdHwfmU390R8YWPg3f9uHz -WP+iCaIAoIOXgZDN2JimS8za9+IFjzz+xQ/SiEYEEBECAAYFAkHdz30ACgkQ9tuO -JwRFhLVkgwCgv/57BB269RcFh6fTucG1Q9kfVTgAn2z6rYMpbmodRUlbV1zifctG -IKBUiEYEEBECAAYFAkINVnAACgkQhfn5/UKaxrY0NwCg3QZqs09BvyYFmLssuEhH -0fN1h9MAoNjfBazVPxZRLZSZpPPZmF/AUCv+iEYEEBECAAYFAkJA1zIACgkQ/RiB -B2NcQIpPRACfUSPNfj8tJLky/QT0c425M/4a6QsAn1wARHuu4Ns0AkQJ7qA3uHc6 -19dGiEYEEBECAAYFAkJdM08ACgkQaajtSerafFlzwQCgtKtlxNPhH4TUj+qOg/7G -ul9fLIAAnj5Xz8m83GclDmhmpPNXkTWuetugiEYEEBECAAYFAkLWjJ8ACgkQbGUs -+HTfTWsOUgCgik2nqZNx7DbYYHB001sOVTMzIRwAn2vL3TUQmdELn+0yizufL0AN -HL3tiEYEEBECAAYFAkRf5AoACgkQi9gubzC5S1zlxQCfehVXfZ7C4VoEoEkorx5i -+oWP4u4AnjF1CdHeHnUEtn+ar1Q4HKkuDU1biEYEEBECAAYFAkTkVbwACgkQ5aYV -37hLgJBEPgCgg3qHa3Au96/Ycj45/t5pjSN4/f4Ani3cFmiDRiOU7wZxe9zPaqpD -6KdmiEYEEBECAAYFAkU5xIMACgkQZ/MxGm4PtJQBdgCfZunvqtB1/ff6wgWRWqtV -sMlenDAAn2shRndxeHiGuxgu+4N8jxwsDNG3iEYEERECAAYFAkKy80MACgkQQk6z -7JKZxYfXfgCguWu/c5bkOADFOrH6pXP7H3U16MsAoIEki0PHq1W2W/Y45o1KKIBS -BHvWiQIcBBIBAgAGBQJBkP08AAoJEAvXRWEqdVnVuG8P/i3IKnskOMtyBrgyoad3 -OFLxIyg9c7m5YhVpOutZU5V91ngpk35T/WcxSx1AdIDeFiZSDK69RU6cke+J38Qp -GqfImdqSRxY417AF1AbkB+csf/V9wdHVZh1PbrA0ZGxaRxQ6EAErLWzS9FVR/d2N -jEtTaGfQWU7HIeHER1JUZha9C77sEdjOjVpbEpXZD5L3iB5hpvKVx84ouuNXUelS -tCsgU401Qbl9/VZYKka0GeQKrzMTDXfiXtISFqA8BsSE5DcKOjMZUx8n0kreNqVg -RtC+PKOBOTrKoypelcbYs2VQtuztaCtOhn48HpSP9N+or6vovIBfoPsmA0pPQ1l5 -n4pfN6gAYmSi/U/EG3uLQ5xBsejH4PQtQwRKvwXRJrR3r/U5r5ZMVKiUGSNy9oT9 -ZRicjf/J7vUni8c1l6YRv48bD3yBSpZcJC6aEV9V1A9jPpPatBLI5+EtDPtr+Wuh -5tEe8T9t6rXUWpf0KGxSV4diLQwaInPsu7qAW7RWQbaMwCfoc4EqwCvIHnmhC+S1 -dTQVjaUYJE4vc5cTZo0wVu1h/fg4QMdZygK1R6c55H+efsm9izybCYGHCNIDIeK6 -+Nm3X/lab8NFCTbdsURvXXXrWaNu1Gif8kuLz1y1RR4RVdW2PU41qO01OBIGiNGG -hPJgar3O4i3raVT0CRQACPUkiEYEEhECAAYFAj/eLnYACgkQ9jVtZM9GVc8gkQCZ -AXjWVuzO56JGARz87PRMEaejp7oAn1CUrc36G5aWEeFa313zajqV9n7miEYEEhEC -AAYFAkCpRCcACgkQXtn1Qb6VBHJYNACdGpDwlw+sCf2Ec4/yK13Dg+615iMAoIXO -Nz0rmpgXItEREAdyWMHbBI3FiEYEEhECAAYFAkH2jfUACgkQgrin/Ace1CYzyACf -Vf+0d1sd3KwuK4irlH/0weW7rjAAn2b9E1JyreDk4kgkmWZlqD4BCxPqiEYEEhEC -AAYFAkH2nJYACgkQZL0IoGaeD6MiPgCgxGB9CzWLPpF7EefUB72pPklteR8An2N+ -TGjV7MPx3TP31t0k6ijE/2hTiEYEEhECAAYFAkZe+BQACgkQ4J/vJdlkhKw/FQCe -OJNnc1uReGQ+lDRK/fbMWsyNSQgAn3I4/JN0LCH9ilfpr2987DYi+HC0iQEcBBMB -AgAGBQI/zfjJAAoJEAuerLG7SymnPF0H/RU5rv/kuCVmqv2slTODZYzLunWyPBXj -siB4UJlHDyJm43SvTNPv4Ta9YzqGthKszbLgCTvo47oWXnRZPlCtahtSIPEd0o86 -b1LJLV481utkTDNozSOqc+1/vcsSGNXh3tE+butBZ1bS7VREsGcC5MVuJh8wpC8p -l9L/4L5bkhRM+hgjfUhCZBhngOPBQGEzKoKBeu91Y/dAfbmianYmBHOH8DEbCCNP -2Sll680YK6j2s/YrE63inczqdp3VDMhjUiUR4CLoGn3/fb6XRwT0reUNbBlziD34 -6+gIMA1dr2e7PHolBrbNAvTAI50+S6hR4CkZ9rx+n0rQNP20FO7VvneJAhwEEwEC -AAYFAkF3mZEACgkQX8tdKqjwLvW7kg//ZtVHiG99LPPoQWniUfH3sN0njOICebzE -psAjig6GZh7cr6pj7AeaXlOSOVPQFGZSC+xwbiVjWGIZjNuCjcen94EMRswbYKSG -f+qQwS7eNMeXTrQIV3CQGk7sYoTV+6CJ5MNMYUCTuBJLSvjuMkUMcDuLadKioRkF -jb979v4F3bQGWEPZsdKLOCZyX2cNjVtCcDBlkhzYNy85PwzdiA5YdnoACxcfe8qz -6BpOC7kZiLN3yV5xXkU+uexQGBJY564+B57y+exBRvEYwKEIQwiq50qJN3NNdhN3 -1HFdURzAV+KIzFXu43+SvtxR9F2OdfvPPHrN/Qpu4Ni1CBvypkG5XIkwd7xM3iw/ -6fh4/BFzYYIFqUADPFzkYKy6U4lls9BNL/Yk0JgEkLbrEayNW6QbM1j/j2wctUrb -aEe6Imncp8VN8DHSjE2tOe1iHIj6G+9rywDXx4kb9hwqcOfpKL/0AoRzle6aTr7K -nCpxBMXCIfQyLKEcJ9wiO3LCwBafJ7fmLJFUnRb4L7ZPg5gMejl0fquMtVKR+CyS -LnhEqDwbrtIR5VOJuZlUFzr77HBL/T7rbxiU3mHONAI8T7dxs2fDv1+ktKeQtlLV -v6DgOc2AaqbvgPO1LEtOdq9fN5aaoAi1EGBDVkIMdWDXdVYY8PnP7GXow2X3G+oM -Ddl8+NpN3g+JAhwEEwECAAYFAkKfCxwACgkQ2MIKCVokV8/xBQ/+MBAGiuwATgRa -lqxdV/PLCDHTaRKAqNf1kMhCMZ99ubECMPzXgI1QQa44AiTNmUUd4RNrBS3gzMjX -nx4oPe6JjXCkP1grnBLMple2NTkaWU0Q/VQkbDxYvZaiPZuz9JTrilU3Z6L8+e6A -zHVAs+EdIeYNxqeTfLUbFj+59AN9eJs7Ud7+uMWGeeDpiZUTcRXm2wdBRzfZi82q -bSLREsIAAvOHr7uB5YarjQOh6lFTT2Jo0GAE3fzVlcSAzS0yV1hD3qtIQH6x7uXr -KTAcTDYQoDJnPIOZSYiz0xbuoAuWISicGXVvlaJ03C5+qgQ9oHRbzALC9SvxPXZe -OC63bjMC7YLXQRzZ+l4wkSjl+d2FfE6koAAC1vTzVx8febJ6eXbNB7mA3sO8gBRG -j7oVzpqY2IAI+UqzyBuKVp7XElOKePK14mw3Dr0Ps/0MC63grWq6kLlAreGZzrS/ -dD/4L1ZgxibFbQXmaElQ+2n7AgNCV7YeESafEPCVV82yScPxC1WlpVBUjqcmn4gc -GBAQ62TBTg/2JL5Z7axiygv7KwDRiAb7lXtBRFidF3dCYOyA696K6CKXioXZwYA3 -XIZXat2A5SfvH6NKVPzcultvqMWtvYceIx9OfiDiTCrInXnixOSn9cJXRk7SeAOo -Q/PHczcYWeAz8kAkUzCYMLQwtusUkkKIRgQTEQIABgUCP52dtgAKCRAhkYDN20Km -DkeUAKCKdRvqJlZLav7J8aZs+VHh45UmIwCgka/3mvy+0u2U8QdfHH9U2H2ndceI -RgQTEQIABgUCQA2AagAKCRAqHoQY2VDGRzkxAJ4kR3qK5sz/RW34GRwgtpvqA3tm -AQCfVz6ZbFeDgGtSzE+Hii7P2EGIz7CIRgQTEQIABgUCQC9h1gAKCRAYtrIyAv9x -slhhAKCoaqimGJyUZZy3CmA5w9VeEQ/F8QCaAk5+ZnpWWitw9Px1srYz7Ps/knyI -RgQTEQIABgUCQDe6OwAKCRAtu3a/rdTJM4p0AJ9ZetvNX6woPsu8P/vxOXW4h97g -KgCffLe5NAJrQJEX/XqVyBz61UaKCRCIRgQTEQIABgUCQGhQ0QAKCRB81sDYi0Fb -qWAeAJ9Box2B5/C/YTc8CqNbB03JYPMxDACgvth6MSFftyxQFSoFGe9A7exsyNKI -RgQTEQIABgUCQGhS7gAKCRD2zzZt3CnlVIvzAJ0XTvHD9bKgre6hdyDFIuxuSef/ -+gCfYOUsVkbwUqb3qA6hpbsl+jQHuvCIRgQTEQIABgUCQLD91gAKCRCzECrSTehe -+AiSAJwJDLftzrq7Y7cOS8uNabiJkbFFUgCfTSM2QN4PN98bvII397o9TaWonxuI -RgQTEQIABgUCQieafAAKCRAOLabAN5HGCsDbAKCrV2bphe81jwW3UIqWK30aPI2E -QwCdEDxoHAQbFwQlriUUKEXbngBd8UOIRgQTEQIABgUCRiZ+5QAKCRBYiMxKKtdp -1k3XAJ95ZF9U+TW2jE9C6eg0cMXwc857FQCfZsUXM0YBMDemoV6MsUHLv7EllquI -SQQTEQIACQUCQDqQOQIHAAAKCRDoDiJ7pAPsoBavAJwLUNAOOGHWauZJn06IhAW3 -A8uGkwCfbU2LiJwyQ/y3nBhpAehsp8yiZBmIWwQTEQIAGwUCP52dOwYLCQgHAwID -FQIDAxYCAQIeAQIXgAAKCRC0QmnQTypv0tjwAJ0U5YaKyE6YWm/qMQB7W8WRfQVc -gwCfVjlWmVBudyFliAFzhr94/3Jq95aIYwQTEQIAGwUCP52dOwYLCQgHAwIDFQID -AxYCAQIeAQIXgAASCRC0QmnQTypv0gdlR1BHAAEB2PAAnRTlhorITphab+oxAHtb -xZF9BVyDAJ9WOVaZUG53IWWIAXOGv3j/cmr3lrkBDQQ/nZ08EAQAugOfLWJbKwMA -9vg2mJU594TZU0HRJkx/fqYhx0YxWWRpzplrEyvcDXuYcWi1Hwh0tD86T4fR5GV6 -joWiWClzD+Hwhhb6gcSdeSGlGLlZAvWYtFSHWiv+3LaI9w8Vtczl99Bh2WiMDNDD -Gw0RQg6ZaftldLSe4j1pffpFGQ8SuisAAwUEAKVxqLT7fC5xQ6oclcZ+PhoDlePQ -1BiTS7tuGM07bFF4nNvY91LL7S31pooz3XbGSWP8jxzSv1Fw35YhSmWGOBOEXluq -MbVQGJJ5m8fqJOjC0imbfeWgr/T7zLrJeiljDxvX+6TyawyWQngF6v1Hq6FRV0O0 -bOp9Npt5zqCbDGs/iE4EGBECAAYFAj+dnTwAEgkQtEJp0E8qb9IHZUdQRwABAf/+ -AJwNVicN6A0I7EOfWx50PDHD7SHw5wCfUJkeh/XlCrGdPASe/AXZB44jl2eZAaIE -PI92jxEEAKJ6P7KohUrZdFsywojJa3hs3SuHzt8/7oFymnTAA2zCHZkGslM0EtbX -NgCoc/40+0CoXAKFzhCwktsbZJ6QcGr6nUK+tpEFO+Ku9Gmg23Pfl8AhAVtHEVuR -qsp1aJKYx4U2wWtC0ZCC7I/slr3YlssoEnepUSZ4VkJhpFOCc6fzAKC8Kup8ioE9 -Lqh5DbyVz8dYAhUjSwQAit9wtAWBHa60q+ca0IPEqSBfB29rIhNio4PEsUB941XE -Lm3O8EUOR7fBgwZkbAeXWqgXfYK582QF9Y/Q3finGzDJa+48cZ+Dn7sGphMQSfRY -3Pd9870U1z+xXtCLjcrYsh49X7lGpqE9Cc4UsIYyLag0bmhS3gyjFS3llJHi1hYD -/2NdApt8WSKs24Y6Yo0fmCb4mj+Mbe9KAL+UlrZ+bWIZth1S5AiDeNEKz5mmr863 -4DzJEOAVUpbUoHJ4j2Icl1jSWlA5vSB6/ZPG2KOMYP7GqT6Ci68lAbwSMS3N8iF/ -PcVV+04PQFqFZRNGUrk7QdFLriZlgqR5zB01n6QDbRtgtCpNYW5kcmFrZSBMaW51 -eCA8bWFuZHJha2VAbWFuZHJha2Vzb2Z0LmNvbT6JARwEEAECAAYFAkNushsACgkQ -Dvn2xlC5DUFX3AgAiIMe+xIZU+NLNQIjjgHsP4ontwXpEWaSapL0ufxeGasTUK2B -S6lFVcZPuqWahnNjd4ETzwNdGmZIb/hP4Sh5hLDmFHDH5q9wIirHfNqQJu4hnal/ -oP8pHQ4jDzdmdyziFxM7KaSNZypzCfEXaOeALOPRsprNOwmxuq4dq8iWOKrzKTHs -Edl4uCdDRTyVGyAKjTpWr/jVxhSvP4BoswsY4KO6eAmVTHIlMfJISz78ix1aM3zd -RTrqTj6TmFy3j4hKMIdYrINceF+jJDqJQSs4hx2REA2K1wHRiiZG7+lj7rM+wja2 -2sjYjwaA42WhZUkHcw5/GQlZlEg5yMoyq8jXs4hGBBARAgAGBQI8j5RCAAoJEJqo -0NAiRYqYW9sAoLCeIkHima6e7Hk/35RlZXH81Tj0AJ4rNYxH+CA+xvKz0GYxdckY -rzRnlYhGBBARAgAGBQI8kC0kAAoJEOJa9W6W3C+pkdcAniNAo/Qpuah4sQfIqL/d -mFKvzhXZAJ90c1rXhV6rSFHajGkr2KgNYdG4VYhGBBARAgAGBQI8nNcvAAoJECAU -9duuEnAVWFEAoJoKKSoJgr3oEKv1wPbcX7i3gTDpAKCUlqsEaP+amU9SFChF1g73 -TXSsIYhGBBARAgAGBQI8nNsnAAoJEJae79OXFtsKLUwAn3wAcZqdsX0I4UpAKAzk -q93K1HBZAJ9ZTiPgafzF9I5VYOJKBgMsUN+zmIhGBBARAgAGBQI8vjYnAAoJEHW+ -ByMT/qxgqSYAoITEy7R5+JTvvAjCuHO6yyEusIDhAKCDLRcjz6goybLK8H8QIQo3 -OMe1K4hGBBARAgAGBQI/Y9fLAAoJEAVAMnUSMMYzzJYAoLXZWuB15ZVp8qRqI8aa -t8oi8wbUAJ0YC2yLCrcbTca1C0jvy9r4KngsPIhGBBARAgAGBQJDvnH/AAoJEA8N -e4Mg5YjtqMwAnRGeLWZ/eS/9/o/ZjroQ5lVGeRFCAKCG4Hj7OH3biZaVzjlDVI+E -4EDzD4hGBBARAgAGBQJFzhU3AAoJEH01OEiAPLwG+RsAoKJBsiV0UShGnUwkrMAF -HNNbfSuDAKCWwkUdkoOCiMiwEQhDVK79m+0J9YhGBBIRAgAGBQI+QhwIAAoJECnD -EYFcQZb7shAAn0N+13uI9Yz/eulVapC19Y4t1TZ6AJ9ALexUd9yS2uE8OGyC5LM2 -ZMrS6YhGBBIRAgAGBQI+XRnvAAoJEBNgAYE58Lv0CkwAnivxzsbIAHULbwfHzSKh -XeBGcxkYAJ9rgUz4zi0WCDj5THOEQ94cfz5864hGBBIRAgAGBQI/lQ/oAAoJELvy -kpzxcFXQYDsAnj2ytgNhBYkT6TAa8PUzkhA774xrAJwMBoo9OaAQdSXhn4xH/Ztx -gvjLrohGBBIRAgAGBQJBCi59AAoJEADbq9xz7cVYZ24AnjbATK28ycxYvncouVlW -siqDx3hkAJ93q0OKgOT4L9VICOLOG43d63oFO4hGBBMRAgAGBQI/cXBPAAoJEBZP -bR00jinYLGQAnjGvSjirxs6LU5nyUuTGTKwRaFo+AKCF52bhSRqjF0nGROaoeQzN -tOPDaIhGBBMRAgAGBQI/cXBdAAoJEMwRmq0kUM+nJPsAn2nqCe+By4ZD4AMElTBe -Vd1w9URbAJ9SpnOVuSQnjM2cQP1t3kdrCo6hcYhGBBMRAgAGBQI/11d9AAoJEERZ -Nfh40Bn1wxMAnR5QfCFXtMiYT4qH5Okh7qaWgPhOAKClfahvQOUvnFhSDz2v6dtv -gnrL+4hGBBMRAgAGBQI/11iIAAoJEN1oTXomdSYkLSEAn3Smemn0SUvsjR3guxXL -M82ThGFxAJsFChZAmUlAAn2jfeHxTissX8g4uIhFBBMRAgAGBQI/5TrUAAoJEIvY -Lm8wuUtcBJoAnRmyU6Ax7JMJoaj6dLL9xORhegv4AJUfFwwkkN65V1ITnfDzFa09 -SOyMiEYEExECAAYFAkMOC7cACgkQmcxCmjBUBteCHQCfQsYSND7bV2YbPt+r8G8d -bnnjWIcAn3c07wKyoEU/CxBWcbOfMwZ6uwJFiFcEExECABcFAjyPdo8FCwcKAwQD -FQMCAxYCAQIXgAAKCRDniYrgcHcf8x86AJ443ovF4CsXJAtEC7XzedooURgKzgCf -VMrsPXfSqeXJXxKS04ygK0OmJaeIXwQTEQIAFwUCPI92jwULBwoDBAMVAwIDFgIB -AheAABIJEOeJiuBwdx/zB2VHUEcAAQEfOgCeON6LxeArFyQLRAu183naKFEYCs4A -n1TK7D130qnlyV8SktOMoCtDpiWniF0EExECAB0CF4AFAkSzgi4GCwkIBwMCBBUC -CAMEFgIDAQIeAQAKCRDniYrgcHcf84iAAJ49Ck2WUvfoxWSlmmMpnM1vym0HHACf -RCGDo/90haN7tYe82t+HwTjUH9i0Jk1hbmRyaXZhIExpbnV4IDxtYW5kcml2YUBt -YW5kcml2YS5jb20+iGAEExECACACGyMCHgECF4AFAkSzgjYGCwkIBwMCBBUCCAME -FgIDAQAKCRDniYrgcHcf8wyaAKCto5VYq0f6E2j38kmHHIHtt3kDPACfcBMF10vD -WHonOjbuIcJYgB8FNfW5AQ0EPI92khAEAO0Z8ZajF6sP96BhmeAw/SPn9WXt0aya -o37JA8a+Lo74exNqTEa7pF8/sb+hHcigH9y7VeZtMlhz+dzq9Xndb1sq05zjlCMX -Cyd6Z0ssUxRHpwgAs9cFsn8kBI5elbdJDJG/rt0IC+hRTP/YdR+x8gzm81vbk7e8 -ff8XAbc7dtOLAAMFBACFt8q5+0x1X5NPvwqkq6UKOR9YJmATCt87pRZ1XCQlk9Vy -MyjC7ArSJQpwEC2KB6O9dQXs0Pm3AAVvjbXoMQKuCKyV3C8ubcDeHHsT/uA1aLLp -LhjGX1bsvIuV22KmR4FO6Vg1N2g95PbeEPhzvAro4xofEbt8i50ifDpo61nv/ohG -BBgRAgAGBQI8j3aSAAoJEOeJiuBwdx/zKfYAn1D3J8iqWuAwExEf3ygyBbQP1oVM -AKCxXARykgrcQ1Ng56HO0o8Z25kHgZkBogRHllszEQQA1PJdiHJEs4HVEtXZ9FjD -O8FyuLHqBbBx0MP9LpxwkAsacgzJ50ylfOqeSk20dRQ3XmmZWNMglfiBrIiMS8rl -HSZ/L7gOYAOWZFK/Pfx7VmnmVZe+yRyEMb4Q0QVgjjuEDba2WFrxm75fN8Jf8zn3 -SxLPCBhJbdC4H6IckwNan68AoPx2nLQw7HF7D5aOSXpP/t0R1Xg9A/99K4gqX6Sy -Tpoa2i4NRG1rBNJjfSELJflgz3aGKGwe+s+nh93t/OtfFsz/y0xuFrlW8KUkqpl8 -n3VaV8VsxEn0/KtAfAhqR3/0mv0/y3pqIZkZy75H/7QH8RZgzJtYznsCSBPUt+Yw -DRh1SXMZn0TaT1gu7h56o6KZ7Jg5C5DBHQQAumHKQznDCWfbCW7fyTWQWqE+QpbY -DA5UjedLdr/yeXpvKjC6gkjReVCcnSxZ3jx0x8uoFY1m6nAtJ3BczqjNcuuOFKew -aCkgK9YUU5ejMPUt1H2WWdGpdybVrfMtHhSFt0D+usNQC9Cztm2TAbjr4W+tw17+ -Yh6K3MZNMiBW28m0Qm9wZW5TVVNFOkZhY3RvcnkgT0JTIFByb2plY3QgPG9wZW5T -VVNFOkZhY3RvcnlAYnVpbGQub3BlbnN1c2Uub3JnPohGBBMRAgAGBQJHllszAAoJ -EDswEbdrnWUjs98AoJz1m0p8jkb+DrpXulIxeH2CL7KSAKCK898YwOH0chE7AEi5 -2jaoYiY6oohmBBMRAgAmBQJHllszAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwEC -HgECF4AACgkQHHIcJFa0F3rwbACgjnknJ5R9n1lQSRh0zlSdzOMgagwAmwXjZD7l -qNOQDkNzNXSxNYZDd+hvmQGiBEeWW0IRBACKYbOW1tQdRc43WijD01BiO1ko6QiF -SR/JgYjg97fCTUFNBpuB4PwAXvPzVXnurdpMNeuAADuvBkCggvf/PhQ/tf1nd89M -xuki2a5mh3LACR4xolr3ADThw+a2HxEuZMmElqOHuXKEFHBzSSOtEaDh4tkETTIQ -U0CDKpeAgRR63wCgx+M+4xZH2HuPGuEtI5oqhfLMgacD/R6KlLjnNHsLaNOSE7ZG -hZXzzMLo6gMnJxQiIHjmz3UY6I/i1Kp9KMlg2C/YTVKDtAZY5uTqdL1Dwcr2W8// -Qy3NoXWnfoXCeBCq1Q9HkfySqGHlLiIatuxgoLe1P07FhM+XLXZZq1iidsLpJS6j -p76d1rCjMF9J1nFuj54r5BhQA/9JhpBautBvPg05JZtAMkv6cBkIOWohaJpDz5qw -9HeZZPg7ex+uLcd3svZNMwppoc/Aiw28W1n8sYWcV9FiikSsTT4Amt7DGzBtHDJN -HoOZAlt8qC4qzxEpJtBZFjPmqbmpKNICmo5Vtk+HoI92NYDcrr8+jKnrIm7GFfWV -3qU4arRCc2VjdXJpdHk6cHJpdmFjeSBPQlMgUHJvamVjdCA8c2VjdXJpdHk6cHJp -dmFjeUBidWlsZC5vcGVuc3VzZS5vcmc+iEYEExECAAYFAkeWW0IACgkQOzARt2ud -ZSPU0wCgrEAM1bo9oS/OmPaFP6KgvRCbHkcAniN7gjcHPUwgkE9kTrWBDHSO1ljg -iGYEExECACYFAkeWW0ICGwMFCQQesAAGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAK -CRAADEtt49vTzVkAAJ93KK7XuMaLCqZnkd3rqnX1Y1b/xQCgk7xnntv+732TCrZH -k/oVP1VewlU= -=zobT ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/directory.yast b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/directory.yast deleted file mode 100644 index b2c1c89..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/directory.yast +++ /dev/null @@ -1,2 +0,0 @@ -media.1/ -suse/ diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/license.tar.gz b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/license.tar.gz deleted file mode 100644 index 5d513d1..0000000 Binary files a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/license.tar.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/i586/SHA1SUMS b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/i586/SHA1SUMS deleted file mode 100644 index 8b8b046..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/i586/SHA1SUMS +++ /dev/null @@ -1 +0,0 @@ -c8db67006900a7758dda69efee189c5eb39d206c dnsmasq-2.46-1.i586.rpm diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/SHA1SUMS b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/SHA1SUMS deleted file mode 100644 index b5fa0b4..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/SHA1SUMS +++ /dev/null @@ -1,4 +0,0 @@ -965ba5faeea815d41ba308ffd193b78505b26c1c directory.yast -3d0cdf34257cc2c54929bf5414969142cad1d421 packages -2d68731ab2f3c86b81f7672798f871cf96b2d0fc packages.DU -07c36c760ed0c58b58d6d8fcfdd2717df02c4256 packages.en diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/directory.yast b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/directory.yast deleted file mode 100644 index 09276e7..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/directory.yast +++ /dev/null @@ -1,4 +0,0 @@ -directory.yast -packages -packages.DU -packages.en diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages deleted file mode 100644 index d313420..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages +++ /dev/null @@ -1,63 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -=Pkg: dnsmasq 2.46 1 i586 -+Req: -/usr/sbin/useradd -fillup -coreutils -grep -diffutils -insserv -sed -/bin/mkdir -/bin/sh -/bin/sh -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -/bin/sh -libc.so.6 -libc.so.6(GLIBC_2.0) -libc.so.6(GLIBC_2.1) -libc.so.6(GLIBC_2.2) -libc.so.6(GLIBC_2.3) -libc.so.6(GLIBC_2.3.4) -libc.so.6(GLIBC_2.4) -rpmlib(PayloadIsLzma) <= 4.4.2-1 --Req: -+Prq: -/usr/sbin/useradd -fillup -coreutils -grep -diffutils -insserv -sed -/bin/mkdir -/bin/sh -/bin/sh -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsLzma) <= 4.4.2-1 --Prq: -+Prv: -dns_daemon -dnsmasq = 2.46-1 -/etc/dnsmasq.conf -/etc/init.d/dnsmasq -/etc/slp.reg.d -/etc/slp.reg.d/dnsmasq.reg -/etc/sysconfig/SuSEfirewall2.d/services/dnsmasq-dhcp -/etc/sysconfig/SuSEfirewall2.d/services/dnsmasq-dns -/usr/sbin/dnsmasq -/usr/sbin/rcdnsmasq --Prv: -=Grp: Productivity/Networking/DNS/Servers -=Lic: GPL v2 or later -=Src: dnsmasq 2.46 1 src -=Tim: 1226926770 -=Loc: 1 dnsmasq-2.46-1.i586.rpm -=Siz: 290023 826308 diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.DU b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.DU deleted file mode 100644 index 054d150..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.DU +++ /dev/null @@ -1,58 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -=Pkg: dnsmasq 2.46 1 i586 -+Dir: -/ 0 840 0 61 -etc/ 19 6 1 4 -etc/init.d/ 3 0 1 0 -etc/slp.reg.d/ 1 0 1 0 -etc/sysconfig/ 0 2 0 2 -etc/sysconfig/SuSEfirewall2.d/ 0 2 0 2 -etc/sysconfig/SuSEfirewall2.d/services/ 2 0 2 0 -usr/ 0 815 0 56 -usr/sbin/ 149 0 1 0 -usr/share/ 0 666 0 55 -usr/share/doc/ 0 476 0 42 -usr/share/doc/packages/ 0 476 0 42 -usr/share/doc/packages/dnsmasq/ 188 288 7 35 -usr/share/doc/packages/dnsmasq/contrib/ 0 288 0 35 -usr/share/doc/packages/dnsmasq/contrib/Solaris10/ 4 0 2 0 -usr/share/doc/packages/dnsmasq/contrib/Suse/ 10 0 5 0 -usr/share/doc/packages/dnsmasq/contrib/dns-loc/ 17 0 2 0 -usr/share/doc/packages/dnsmasq/contrib/dnslist/ 29 0 3 0 -usr/share/doc/packages/dnsmasq/contrib/dnsmasq_MacOSX/ 4 0 3 0 -usr/share/doc/packages/dnsmasq/contrib/dynamic-dnsmasq/ 8 0 1 0 -usr/share/doc/packages/dnsmasq/contrib/openvpn/ 7 0 3 0 -usr/share/doc/packages/dnsmasq/contrib/port-forward/ 4 0 2 0 -usr/share/doc/packages/dnsmasq/contrib/slackware-dnsmasq/ 6 0 5 0 -usr/share/doc/packages/dnsmasq/contrib/try-all-ns/ 4 0 2 0 -usr/share/doc/packages/dnsmasq/contrib/webmin/ 174 0 2 0 -usr/share/doc/packages/dnsmasq/contrib/wrt/ 21 0 5 0 -usr/share/locale/ 0 128 0 10 -usr/share/locale/de/ 0 3 0 1 -usr/share/locale/de/LC_MESSAGES/ 3 0 1 0 -usr/share/locale/es/ 0 23 0 1 -usr/share/locale/es/LC_MESSAGES/ 23 0 1 0 -usr/share/locale/fi/ 0 1 0 1 -usr/share/locale/fi/LC_MESSAGES/ 1 0 1 0 -usr/share/locale/fr/ 0 24 0 1 -usr/share/locale/fr/LC_MESSAGES/ 24 0 1 0 -usr/share/locale/id/ 0 14 0 1 -usr/share/locale/id/LC_MESSAGES/ 14 0 1 0 -usr/share/locale/it/ 0 1 0 1 -usr/share/locale/it/LC_MESSAGES/ 1 0 1 0 -usr/share/locale/nb/ 0 14 0 1 -usr/share/locale/nb/LC_MESSAGES/ 14 0 1 0 -usr/share/locale/pl/ 0 32 0 1 -usr/share/locale/pl/LC_MESSAGES/ 32 0 1 0 -usr/share/locale/pt_BR/ 0 1 0 1 -usr/share/locale/pt_BR/LC_MESSAGES/ 1 0 1 0 -usr/share/locale/ro/ 0 15 0 1 -usr/share/locale/ro/LC_MESSAGES/ 15 0 1 0 -usr/share/man/ 0 62 0 3 -usr/share/man/es/ 0 21 0 1 -usr/share/man/es/man8/ 21 0 1 0 -usr/share/man/fr/ 0 22 0 1 -usr/share/man/fr/man8/ 22 0 1 0 -usr/share/man/man8/ 19 0 1 0 --Dir: diff --git a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.en b/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.en deleted file mode 100644 index 0c7748f..0000000 --- a/libzypp/tests/repo/susetags/data/addon_in_subdir/updates/suse/setup/descr/packages.en +++ /dev/null @@ -1,20 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -=Pkg: dnsmasq 2.46 1 i586 -=Sum: Lightweight, Easy-to-Configure DNS Forwarder and DHCP Server -+Des: -Dnsmasq is a lightweight, easy-to-configure DNS forwarder and DHCP -server. It is designed to provide DNS and, optionally, DHCP, to a small -network. It can serve the names of local machines that are not in the -global DNS. The DHCP server integrates with the DNS server and allows -machines with DHCP-allocated addresses to appear in DNS with names -configured either in each host or in a central configuration file. -Dnsmasq supports static and dynamic DHCP leases and BOOTP for network -booting of diskless machines. - - - -Authors: --------- - simon@thekelleys.org.uk --Des: diff --git a/libzypp/tests/repo/susetags/data/dudata/repo/content b/libzypp/tests/repo/susetags/data/dudata/repo/content deleted file mode 100644 index f76a96e..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/repo/content +++ /dev/null @@ -1,2 +0,0 @@ -META SHA1 b75eeb1b3d231ccb6322c91417050520f992949c packages -META SHA1 cb96552f7a57eb21f3279310c1c339e6b22924d8 packages.DU diff --git a/libzypp/tests/repo/susetags/data/dudata/repo/media.1/media b/libzypp/tests/repo/susetags/data/dudata/repo/media.1/media deleted file mode 100644 index d5aa1ef..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/repo/media.1/media +++ /dev/null @@ -1,3 +0,0 @@ -SUSE Linux Products GmbH -20070705102239 -1 diff --git a/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages b/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages deleted file mode 100644 index 0dce8f4..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages +++ /dev/null @@ -1,8 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -=Pkg: dutest 1.0 1 x86_64 -##---------------------------------------- -=Pkg: dutest 2.0 1 x86_64 -##---------------------------------------- -=Pkg: dutest 3.0 1 x86_64 -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages.DU b/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages.DU deleted file mode 100644 index 0cfa08e..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/repo/suse/setup/descr/packages.DU +++ /dev/null @@ -1,16 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -## / localK subK localF subF -##---------------------------------------- -=Pkg: dutest 1.0 1 x86_64 -+Dir: -/norm 15 0 1 0 -/grow 15 0 1 0 --Dir: -##---------------------------------------- -=Pkg: dutest 2.0 1 x86_64 -+Dir: -/norm 45 0 1 0 -/grow 45 0 1 0 --Dir: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/dudata/system/content b/libzypp/tests/repo/susetags/data/dudata/system/content deleted file mode 100644 index 07033bc..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/system/content +++ /dev/null @@ -1,2 +0,0 @@ -META SHA1 95a347a40f621834a870e10b8914c9442c2dc355 packages -META SHA1 7d11955486b049be5f601b82acc18bfc73c22f39 packages.DU diff --git a/libzypp/tests/repo/susetags/data/dudata/system/media.1/media b/libzypp/tests/repo/susetags/data/dudata/system/media.1/media deleted file mode 100644 index d5aa1ef..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/system/media.1/media +++ /dev/null @@ -1,3 +0,0 @@ -SUSE Linux Products GmbH -20070705102239 -1 diff --git a/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages b/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages deleted file mode 100644 index 350dc7f..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages +++ /dev/null @@ -1,4 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -=Pkg: dutest 1.0 1 x86_64 -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages.DU b/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages.DU deleted file mode 100644 index c86c52e..0000000 --- a/libzypp/tests/repo/susetags/data/dudata/system/suse/setup/descr/packages.DU +++ /dev/null @@ -1,10 +0,0 @@ -=Ver: 2.0 -##---------------------------------------- -## / localK subK localF subF -##---------------------------------------- -=Pkg: dutest 1.0 1 x86_64 -+Dir: -/norm 5 0 1 0 -/grow 5 0 1 0 --Dir: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/shared_attributes/content b/libzypp/tests/repo/susetags/data/shared_attributes/content deleted file mode 100644 index 75955ab..0000000 --- a/libzypp/tests/repo/susetags/data/shared_attributes/content +++ /dev/null @@ -1,30 +0,0 @@ -PRODUCT openSUSE-factory -VERSION 10.3 -DISTPRODUCT SuSE-Linux-STABLE-X86 -DISTVERSION 10.2.42-factory -VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/FACTORY/release-notes.rpm -ARCH.x86_64 x86_64 i686 i586 i486 i386 noarch -ARCH.i686 i686 i586 i486 i386 noarch -ARCH.i586 i586 i486 i386 noarch -ARCH.i486 i486 i386 noarch -ARCH.i386 i386 noarch -DEFAULTBASE i586 -REQUIRES openSUSE-release = 10.3 pattern:basesystem -PROVIDES product:openSUSE = 10.2.42 -OBSOLETES product:SUSE_LINUX product:openSUSE <= 10.2 -LINGUAS cs da de en en_GB es fi fr hu it ja km nl nb pl pt_BR zh_CN zh_TW -SHORTLABEL FACTORY -LABEL openSUSE FACTORY 10.3 -LABEL.de openSUSE FACTORY 10.3 -EXTRAURLS http://download.opensuse.org/distribution/10.2/repo/oss/ -OPTIONALURLS http://download.opensuse.org/distribution/10.2/repo/non-oss/ http://download.opensuse.org/distribution/10.2/repo/debug/ -DESCRDIR suse/setup/descr -DATADIR suse -FLAGS update -LANGUAGE en_US -META SHA1 cec02abacb62fce2964a787d516879822691be6e packages -META SHA1 2664997a3bae2679cf1395a81d54a7dd4532c276 packages.DU -META SHA1 1c539c3fe4a8ec5fbe96ce3b559fc952124f9acd packages.en - - diff --git a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages b/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages deleted file mode 100644 index 231681b..0000000 --- a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages +++ /dev/null @@ -1,32 +0,0 @@ -##---------------------------------------- -=Pkg: foo 1.0 1 i586 -=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269 -+Req: -bar > 1.0 --Req: -=Grp: Bar -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: foo 1.0 1 src -=Tim: 1183399094 -=Loc: 1 foo-1.0-1.i586.rpm -=Siz: 16356019 38850584 -+Aut: -Foo Bar --Aut: -##---------------------------------------- -=Pkg: foo 1.0 1 x86_64 -=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269 -+Req: -bar > 1.0 --Req: -=Grp: Bar -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: foo 1.0 1 src -=Tim: 1183399094 -=Loc: 1 foo-1.0-1.x86_64.rpm -=Siz: 16356019 38850584 -+Aut: -Foo Bar --Aut: -=Shr: foo 1.0 1 i586 - diff --git a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU b/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU deleted file mode 100644 index f8a911b..0000000 --- a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU +++ /dev/null @@ -1,7 +0,0 @@ -##---------------------------------------- -=Pkg: foo 1.0 1 i586 -+Dir: -/ 0 39444 0 3068 -usr/share/ 11 0 1 0 --Dir: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en b/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en deleted file mode 100644 index 5021a00..0000000 --- a/libzypp/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en +++ /dev/null @@ -1,7 +0,0 @@ -##---------------------------------------- -=Pkg: foo 1.0 1 i586 -=Sum: Foo program -+Des: -This is the description --Des: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content deleted file mode 100644 index 9bca45d..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content +++ /dev/null @@ -1,42 +0,0 @@ -PRODUCT openSUSE-factory -VERSION 10.3 -DISTPRODUCT SuSE-Linux-STABLE-X86 -DISTVERSION 10.2.42-factory -VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/FACTORY/release-notes.rpm -ARCH.x86_64 x86_64 i686 i586 i486 i386 noarch -ARCH.i686 i686 i586 i486 i386 noarch -ARCH.i586 i586 i486 i386 noarch -ARCH.i486 i486 i386 noarch -ARCH.i386 i386 noarch -DEFAULTBASE i586 -REQUIRES openSUSE-release = 10.3 pattern:basesystem -PROVIDES product:openSUSE = 10.2.42 -OBSOLETES product:SUSE_LINUX product:openSUSE <= 10.2 -LINGUAS cs da de en en_GB es fi fr hu it ja km nl nb pl pt_BR zh_CN zh_TW -SHORTLABEL FACTORY -LABEL openSUSE FACTORY 10.3 -LABEL.de openSUSE FACTORY 10.3 -EXTRAURLS http://download.opensuse.org/distribution/10.2/repo/oss/ -OPTIONALURLS http://download.opensuse.org/distribution/10.2/repo/non-oss/ http://download.opensuse.org/distribution/10.2/repo/debug/ -DESCRDIR suse/setup/descr -DATADIR suse -FLAGS update -LANGUAGE en_US -META SHA1 3b3a4b0f085dd3605b61cdec06783b6b2a1f1d61 kde-10.3-71.noarch.pat.gz -META SHA1 2c351e103b347ef2984cb2aa638accfeadfaef58 packages.DU.gz -META SHA1 208a6f8e1c96e9ba2ea7c74c05113c11c7378823 packages.en.gz -META SHA1 59d65b8575ba1edde1813fef2e9949ae85f4d4c1 packages.es.gz -META SHA1 061c361edf6157bc4273872055822e9d1766b8c4 packages.gz -META SHA1 8ae8446949182a9908c7d07b7bc58fb718cf3a92 patterns.gz -KEY SHA1 c0354069c10819674da8706822e1d4bd0c1797e9 gpg-pubkey-0dfb3188-41ed929b.asc -KEY SHA1 2e38e503c436c5d002bdc31755c82188044d9d21 gpg-pubkey-307e3d54-44201d5d.asc -KEY SHA1 7025932e6866932f489421990075f3ed312023ea gpg-pubkey-3d25d3d9-36e12d04.asc -KEY SHA1 fd6146cac8c1473c5b52548936de773d5bbd5610 gpg-pubkey-7e2e3b05-44748aba.asc -KEY SHA1 cd7adceba1fe5d7ba27b5749718743192d82f802 gpg-pubkey-9c800aca-40d8063e.asc -KEY SHA1 7535d79e31ef7b4232e5593bb49d9142978b2e95 gpg-pubkey-a1912208-446a0899.asc -HASH SHA1 875e73cf2ee139203208c860fbfd7fa5cb291c7e license.tar.gz -HASH SHA1 4aa8ded6302e6ec85690a51af6044dffe9b21923 control.xml -HASH SHA1 82f1f17ce74f0cd3fca4813c178196b317fc952d installation.xml -HASH SHA1 68d9b548d61e31e82e8834690e884afa27751287 media.1/info.txt - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.asc deleted file mode 100644 index 63684d6..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.asc and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.key b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.key deleted file mode 100644 index 661d0e2..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/content.key +++ /dev/null @@ -1,135 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2 - -mQGiBDt3zUARBACCnzYUCVO/35iVN0T6J2Qb4GfDzrq8ZOqCamjD9tSylJ+UI4Co -YBks0HWnWty231Aoil6q76LRqE4bcEiJ/xuwinLFNC/S24B1cR98aq5tUEEbPJ44 -MBdY3LVbB4HCCMZH56nivx4thaTiCkVnyHpGkfKStk3lUkAVk2NR/C3uVwCgnp1D -qWaTn46JxIsEQMU8dczkeyED/j/J6QqCRwYR8XmlAUfI5ozIsQ7LuA1nY/NJ9Nnh -w2Wkq0UBZCqP/Nbfmr5EOri6MOPD9tIFRAy4qBqkxvgy/zKfX9qJkqx3o+DVrL4y -CFZHI0aUwqXvEAT6GJyDPi45gnHOVE9XJRL6BL9ZfFmOd4ajH2AJ4yy/ZqbX0GjR -opRuA/0SN8OK1ERDAA5AgZj9L2ZU7zMVmiWE8/Q+qz9p2TEfkfO8NyvvzK1Rv0iU -p0WuJn9gorBr93Sc9XtX3lINZ1PJUQg7KQbpfeWHMa1pxUMnIFVjpYZMmVFFGWZw -0q+45T9uMr50cvMr4pYtnvat5tyKM0igPtezMqSY2aY7LyZMmrQbTWljaGFlbCBB -bmRyZXMgPG1hQHN1c2UuZGU+iFcEExECABcFAjt3zUAFCwcKAwQDFQMCAxYCAQIX -gAAKCRA/uJ46J8aw5H+tAJ4ktFPz9sQGuec1LaX0pIB3oZVAvQCeP+jNfv9ZbVHI -Uz8bw8JBgwAe2w+IRgQQEQIABgUCO3fOdgAKCRDHUqoysN/3gB9xAKCLvhrIusLe -6wH0ByiA1ON3R5TNPACfY8W/eTeDSu9xNIlSCFMgDHw05cqIWgQTEQIAGgULBwoD -BAMVAwIDFgIBAheABQJIZg3kAhkBAAoJED+4njonxrDkE5oAni0UwlVNIaklPunu -iNb44D+AcgwRAJ47KCtevu20oesjoYkKhFNSLT14E4icBBMBAgAGBQI/xnvXAAoJ -EBlUT2RolefhXTwD/iXBc3oVl/jyeV2qoUB/cB1+quxpVSkjC/MnOjtmU7lXtNBj -dS7pZkMHyLDhT3VCTxvWTNM5sdS8hyQcSMATQ/axySFEy98tj5veZdMWcn9doyOP -OIpNhAv55iMsuvAP/cd26VYJDx4Amlv7BXlIw9prYZrePZrZVlSpXOnGQ9JoiQEh -BBABAgAMBQJCyOiqBQMAEnUAAAoJEJcQuJvKV618ALgH9igCYlbAeAAs+WTHoBgO -r4DFI7xREXf+AfPxraa/vLyH0cwDRej40aOnzEnwBSIC/DH+7Oy41aKunELyNtJ/ -DTkextRs2DzDhMGmYadHS8V1CPdLLA/q0rmtdGA6t2D2xhIdPXuO7+gHuaEydGTA -/KFmyE8XE0pDYHyhsrBeelSBPZS1dDcJx7vib1GQPHUydOI8PRKJbn+kxwjNqGzJ -m17sGJaxLPH8iWby8bEjmCFU31x+t+ia6sYSO7CsbwHL2mxuwfDE+f8QXiYFKDZB -t/pN0ky6iiBGoCyu/OrT7nqRmlmanRprotZ/2gW+pYGIQ1sHrcZQz/GMov7CWXGu -i4kBIgQQAQIADAUCQhcYbQUDABJ1AAAKCRCXELibyletfCOHB/92VkN0tLaC2nWJ -hOaMP2XGQbm8f09BphSdb8pxxMqnUH1W8YkCNjLvoRGN5exxb7cpfrymSqdjmSh1 -bVkREh4zzx5zd8Fhush5wqXq4PItV4Z+Es7kuZV/McG9mMoGqxI2WUyrZdXdOMFJ -O7ABEFtw7iCdzh9tVenX71U/2ePT/Ab8iWXcT5Xei4X1eQBtQ3c/2B6i9TDuH4Q0 -Cd8C89qyhzDaxrlX2dXfU/mwqIh/+6I4mwnAFBQ0RUtniXX4YARG5TuKYhDvfBod -vj6ACj518Kazlu8eOyUtZr+w1ntc22veQ8im7qpMqpMAqEYmpO7B6wYb/BOOxTBD -+pROcj3ziQEiBBABAgAMBQJCT68CBQMAEnUAAAoJEJcQuJvKV618IwIH/2pIkrl7 -OWSIoZADqVC7w6eXF17sV5TXLqJEPaHVuS6e+RnTbcRut7lPbx3wFVWQflFhn/fg -jkTUkTpcwbBrl199OA6k1yQPdYCJb1KuFP8aipWvlUjJcqUnHJS0ub7eSqWLeXcq -8cIufLMVNIcImU9yBoTVo4t7bezcO5LBC9l58B0uO11TwUlJ0pXAGUqznlAC7EuO -uLUnZr/6G+PzpWDEJN6QjBdRnn9qIflefkTXdsqUb2ByB5/SMJ3FgHkPZBx1Mqgm -IXvW05uQd4uyHJ0t9azvwxtgHgNH3y+FBkglP7yhRfBxwvMZbLJZft7xnXLMgdfH -M8Sj6pwmlSI9cnGJASIEEAECAAwFAkJiN0UFAwASdQAACgkQlxC4m8pXrXywowf/ -QzsKRLsWvMvNlYixCp2xF26ZKLpMUddmOxbqrJPCmITCkVO6fJjuegAwWBD9CEgg -2RfCZ4n2thwsbLWCRjYrwUzgbA0s4h0NE5mjsuOwQmKHjPXi0Fn3tx3teA7/GVPB -cqEGHnHVXx9guyGiwqugMRsYfYXEbDel68fo9Z7MraLwbTB2gSOJdEkCM0KtBNYd -ZUG7Q4m8qK8kBGjhBjCK0jgsaJK0FLRNlT5dGnwG1ggnnQEr9x6U2BwikfzaodDp -J80o3Z9PBr5OiDxXPb9kMgW9VwRpBBwvCi5ltAn8NtfIsPlQYwmb0FXyh7AXxlx0 -f2dS+IxMAd8POqhiABLJ0IkBIgQQAQIADAUCQmLeuwUDABJ1AAAKCRCXELibylet -fHGDB/9u0yi/Wk/mrFzrvwI4AOb92E7427Le3USIKUuWZSMqzAAVeNgCgKfy/NbY -gs6Kttb56+HnUJJ/C79YDh4qABe0hGiIgik+dUj/t2FBIz35cc2rS76hHXm1lWQC -0Si48AKPqhqzWCwzwt6aerQIg1IBkSmINKF6LrTIraYjh6UsDnLqLrlxnosXP4bT -byIKH2mTT3bboR8iaYyzxKV0ccydHE0jp0Dffx3x4wH5CKHrEJt1lhSKdDexM5yG -lAa+haUDKRulODNVljtx5m84vOgpwdg/JphLBJ24jGhHUS3PI3cXf+TV97J3YYQo -XITC9lRNqk3GZeWWyUu3r0XB/hp4iQEiBBABAgAMBQJCdVu9BQMAEnUAAAoJEJcQ -uJvKV618HHcIAKOHqHyRSw+4jg35JfVcLgrZn/3G4cDl35cAtZ5iz6ukEg8vpzH3 -rMfiFYV2WQNflQ2tIrD9ZwSjJVAXNEL1eX883HAL7HmHFCqaQTusZb7vpbzh18fU -Tjl4Nq3K9FqIIfJzJ8lPxGit6eL82OO/WUffjQAA9Ad+2yY/yWOyqUN4dqzxUWx4 -9F1Q2UDBGiu/QhcEhUlPf6B21I1nqsSkOMGtRiHf7RfrGDss2xRn+0PDrpRDcpmV -ZxJ4JpKQSDBKqbktlcdl95y9gI6llpJXFFQugxGwsC4qr6UYw4RloAdkpwz6aAlk -rfFgCZ5KhkLs4HQkdZLr+zq7zJh5njuBnJKJASIEEAECAAwFAkKHod8FAwASdQAA -CgkQlxC4m8pXrXxEdAf+Juexqg2/qC8vP+OnTuuDzTALHdSzt81Gq8a9jMHVs4rA -gAAEKbKzrRgnAjI7wyGSxU1kaPNh+RQB4qtZy4x7MlJtRfcfSlAWw7i3rqKQakpY -xUQEXLt/nK8kWxd2nC4gMW0105J+lBSMiCAw174/h36RjG//Cv17AhzGOckFE0n0 -7gZlW/+5YnjvFemP8lFnL5kb5BzPPiJy8J1VnqvXY95n3HxhkoiTSrXlS0MNNLgG -h27C+Kzl+p4X/T1esWoZe3pbq+qSb4xnglXOqzGJduQ0s585907ohm09m++e6NXK -hxxysu4cvcMv2Cc4ep9HglEY6sVrwY/0pMpBYdMLBIkBIgQQAQIADAUCQomcnAUD -ABJ1AAAKCRCXELibyletfDfnB/9ELbGLL7OIsOwCDidj1f/sabT/aFJ4LX15nm1B -mW0huKLRdJuzX7XZkcTx6SohTcTgFIfXxV1RLt/7wrW5TTRrYmDRyk0CR1EZlfgz -yLUaG+18ml7h97DZqSIaWnsqnryJB1QPyGO6yBUQTQ/KcGMyw2lzY2ovtl/UheIu -PT0v3v12kFxOo1xYeBn81YHQKPMWJhJ+iOmhjbj89W6RZ8swgSd9pczv0ptfUFIm -X5NbmIFxaiwWkRraUZYjdYYJGIainE9DpcMsSaSV7tq+mPl5NYVJPzW+llPPTqo6 -zIKxIByiVfH0zac/xecGyKe1RhBYJ34fdK+GcM8FYcWkpxOqiQEiBBABAgAMBQJC -m2c0BQMAEnUAAAoJEJcQuJvKV618OnMH/209R6nyz26CxVS4PtYYzMlOZ5VlOl/U -BEmRqmJeY/frgucejxX90qHUOy1dgBhJXQ05H5zHU7B0UHoha5KnSSyT2/p7owBu -AypZVvJB8PxxepPXUVfhiipR+7jWnYAsc6tjWn/+dE/ryO5iEWWAGDI0ZQ6dd/9C -sz4jDeffQusWB6g5ebfL6+SBHa5N2PCydGr047fG0KZm2jposMPsXbIuKh6LSTaL -QxGUyyJ+tTNfwstFYMlmawLMHtjb8F5r6FT7bywVlVHr7t2DctaoxULvlvogtCuE -7B9fG2EPg0sw6yK6P2zjGs+uv2qPO15vVWFLnQJ2eXrY1eNoUL/N+5KJASIEEAEC -AAwFAkKcuOMFAwASdQAACgkQlxC4m8pXrXw8Jgf/UKw9NzMIFXf1LfuKW3hH2dhd -OYyVnsYmuPy4HQTk0It579t0Mc8b4nrT4Bm5Id//SzxhKI0mGNxtLKXTiHOsTmEU -KLeBXRaw7snnq64vaYz5NU9LdW/GX1vt4QtiGaLvZq/INUwB2jobqqcMwfw9n295 -IEeKSuu0PcttZNfLGg06wBashAMl9h42ZakxlbYpbOPj0k/MdoB8EijdO3d2M4eV -DJKQNj7XiYE+yNmecEGkxaEJBma0xloA0iiGdPJHFlK3dHKKI93A/IU4KRhAE+iB -e+HlxOMyyGOk84+vWoT9IeQddYaxdlBm44TznYNN6en1lu2nqAA4s2XZEvw4rIkB -IgQQAQIADAUCQq/WegUDABJ1AAAKCRCXELibyletfNBuCACi6+OSvQrLBIeSmhIy -7Xgv2y/zfTKc1J++Nj2HFWC/X9pJCDHEyY5h0enHrePPoQzAlNY4Mz8sNzI2gc5V -+6B90XMJUCO4xz0wSlSTSMgX7sKO3zti6TaHi1dky89UDwOatrvxtRFeY957dInE -WDTyucTfDCIu7sQEHClXlTNTWXXs/MArjmtUfldCs6KWEvBiXec8YbAyC9gKZ3YV -ERrkMEJJYVWJiqp4jkCu7N7SUm2HS4GUIfacP+Qt+FJqHjkhYmGBJXfRSNcnOubb -S5gk1VJ7FKM7ZwQYDUZgouQUi6BiLoaJ3D0mHU+kxbg7PPhbT06u/MJh6v1B1Isa -2s/niQEiBBABAgAMBQJCtR/qBQMAEnUAAAoJEJcQuJvKV618R+oIAJj01Y/c/uq+ -4FqSfanoAGR5uqz3Ln+ijzycyMMQ8cY5fZpGaeeWzi3POlfnz35BsVXASWec9x7+ -bHVQY6Rn6DoQFRX5cQ6WwwRpsg8lAoL3uzN99Frj8rwGoLkTCJvRNZVbAaDmMHAa -+dAaq+ro1B22IGxvfR6N7EfjBHmeXfTHkSdszEBl9WnpsyziapSpkGFvcdzPWnBg -Dh70nybKseCDdcIdTRCmj5MIBn150nav/1SzX+oustuxoRxrjYZUFr8dOK52xHst -GgaSyNqKE8XJ8CCBvEI2x6pzIrle3vdBaXD9Yw3lOhNN0OZsqZWb/uQCW884tlDN -XhUExNhcHXqJASIEEAECAAwFAkK3GioFAwASdQAACgkQlxC4m8pXrXz+ugf+KMyj -rXp55VY5hSYZUoM1g+NW2ayOiT/pQNzOlVZt/fA64zwkmCGaRzEC6jB0rAi98b5o -mvgCEwXWqg6z9asSbOk6/kIStI8se4hxp0BQSXIB7sXyrpopugigET3yIwSOM7M6 -fez/WHJYF/8xOzA1VM5Fbs4M2V15hpjA0lwBRHgkxqBNaHl3FjhqO8SmcECCMART -IVamMKniOK8hOVH0NKbjj7Zbe21EFuyXsxa32ROCPIY4mspKNFXtT7ixXmLjMxj0 -P3yNUVBGkgjh86eP6QjT54V70nwVbjg6u7f5xeQoWHS+8dt4QhVOZDz3XSjKwgZq -NllQ5YCSu/AdHJfcM4kBIgQQAQIADAUCQszcBwUDABJ1AAAKCRCXELibyletfBsa -B/9HKXrv7HDwZ4LS4Sf/wrtlUZIEMmbojeF3G9QWBXp1D/SbSJHPTuXM9jsZcfTZ -VX+neDDB5FkaGtqLf3Wcm5AT06qTswKbCrg1XlFQ66YuyqgX3+Y2i4GloATDNlPS -Ho5g2YliIoZXxP6VzrmCHVDKBi/TWNxMaCgwPRtJvSRGUiitv/AJR4LCyz6T6QGJ -+WRPaHwviT2FX0aAjP3q3tZKaXNmGskNuX5WUUnThUuZWwFJ2eZcqF3Mr7ZTmf/v -QnwEoyEdULUNBWF15R5FD1EvK9ELQIEWOWBILv7Mt5ozNSqTYV78UpG5MiiM3DMh -QP3iaqLsVzHvCNxgDmPZ04mBiQEiBBABAgAMBQJC0XrQBQMAEnUAAAoJEJcQuJvK -V618EDYIAJgUg6kV4hU4Z8ML9Ka2GWazj34BmEMqkk6Jm6IRP2nVkHbe+/NN7vOZ -TA+ZHFJKy5zu144+o6PqR2W9ZkcbWplUz4bC4POXclEfbIywH/7coqUwa3RjvRrO -TmiYAZKV/Z7yngC3BLBIktlEvTZustX6LsqPrqLn6Wk8GI161HWYhwRCIXQ9Vs2e -BhSGPzHp/vEOJHdGMsXpxEakcCCnn2SBwYcrkV4AN+gOJhsoH55hD1/mXEK95zoc -S2uUaxxhn3jKEUFMOnCfcfuqZ52broV3OUczxozFloIGxxZv9xwBNHOMDfA0LI6Q -9YsL5uWDE1QKdwkIzqDC4mBzgOxp5C+IVwQTEQIAFwUCO3fNQAULBwoDBAMVAwID -FgIBAheAAAoJED+4njonxrDkf60AnRUchhESPbyQbSvy7sX1xunLHgRkAJ49jGt8 -9LQdh4lvqKfpj+RMqY1LI7Q0TWljaGFlbCBBbmRyZXMgKE1pY2hhZWwgQW5kcmVz -IHByaXZhdGUpIDxtYUBrbTEzLmRlPohgBBMRAgAgAhsjBgsJCAcDAgQVAggDBBYC -AwECHgECF4AFAkhmDeAACgkQP7ieOifGsOQDpwCdGxVwFjNt98OuylGNhhjm2GD0 -HUkAn19PVAoWFjmHhSadUJAehJVloqjbiGMEExECACMCGyMGCwkIBwMCBBUCCAME -FgIDAQIeAQIXgAUCSGYGFQIZAQAKCRA/uJ46J8aw5BvgAJ0Zo8czcPx39AUXGXIU -v+RzkBeujwCfYOXRCpThfRrd2FyuUAULu+/PNnu5Ag0EO3fNWhAIANoFOLBJ37Vr -9umFyQJk2jB1zHfh8p0wF/Tw1giR7LFgTTpgvy27JR1BTSqJkeW56sfeDfMkHcRF -SEsRl0SKHfpHLQANevwvygygx6OgeJrCdgJTkhWUdB7SgVC1yMSsWm0uYTPSOH+l -9PpICNH+tP1po0qoQsD387uY8XOwlLSAuFTOGGT0q7N1g/swF/5RwJhLtgj0viQR -/lzoZ9f5GB87Ih9ab8LgBj1XcddjtFe+Qr0pZ+0tT5Fqz9/muOzeW3z1nHvE/7di -LMorlevz1gD1JOPoFDaTmLsuWXdFP0aZoi/2Wx39HVD8Zpp8vN5M3Ta/11oXhoHG -AIuIQ3kFELcAAwUIALMbFRojYmYCl6TCZ23PB/+8fK2VjAu4vUzuvv78U17H26pO -G4mVbW7XXFBmN30viiqEVMdrm76odOe5VhF+lCB8irbvedL0al/C9vsAUGKRxJB0 -1Y/mXsDuPvxmiuGqcWrb8j3chBh129dCO+dR4MR1xfth23EnI/fncggAeXGT6+HD -oXfXTHoMolWKa9Fh3vRTZqFtBQTYPenr7lhUjPmM3cpswSTxkwIqC2pUmmDMekSu -IOCVIbe5w+f5OB8j2Bd3ZYgxsePcf20OWOXdLNucO1KPaM9zS7LxhmlzAOWcXj8E -EK9bAvdi1DXDgJA+AYmD6ol3uX+eoIDh3akYTTyIRgQYEQIABgUCO3fNWgAKCRA/ -uJ46J8aw5AtiAJkBhcP6w63v4r8niiOPjmgN6NbxxACeK/BBzQT+qgqQfHYEW0Sc -ixhE83U= -=Z5HF ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/control.xml b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/control.xml deleted file mode 100644 index 096763e..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/control.xml +++ /dev/null @@ -1,793 +0,0 @@ - - - - - - control - - - true - true - false - never - 95 - true - true - simple - false - true - true - true - true - false - true - false - - - - - /root/ - /root/inst-sys/ - - - - - - false - auto - - - http://download.opensuse.org/YaST/Repos/openSUSE_103_Servers.xml - - - - false - true - 7G - 40 - 5G - 20G - false - false - 15G - 25G - false - - - - false - laptop - ifplugd - - - - language - keyboard - timezone - users - networking - firewall - host - routing - proxy - runlevel - x11 - nis - ldap - printer - add-on - - - - - - - - - - - - installation,demo,autoinstallation - initial - initial - no - - hwinfo - keyboard - mouse - partitions - software - bootloader - timezone - language - runlevel - - - - - - partitions - software_simple - country_simple - - - - - - hwinfo - keyboard - mouse - partitions - software - bootloader - timezone - language - runlevel - - - - - - - - update - initial - normal - no - - update - packages - backup - language - - - - - - update - initial - initial - no - - hwinfo - media - - update - packages - backup - language - keyboard - - - - - - network - continue,normal - yes - - - lan - 20 - - - general - 5 - - - dsl - 30 - - - isdn - 40 - - - modem - 50 - - - remote - 60 - - - firewall - 10 - - - proxy - 70 - - - - - - - hardware - continue - yes - - x11 - printer - sound - tv - bluetooth - - - - - - - - - all - yes - yes - - - installation - initial - - - language - - no - yes - - yes - - true - - - - checkmedia - - - - license - - - - disks_activate - - - - system_analysis - - - - - productsources - yes - - - - add-on - yes - - - - timezone - - yes - - yes - - - - desktop - - - yes - - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - finish - no - - - - - - - - all - yes - yes - - - update - initial - - - language - - no - - yes - - true - - - - checkmedia - - - - license - - - - disks_activate - - - - system_analysis - - - - update_partition - - - upgrade_urls - - - - productsources - yes - - - - add-on - yes - - - yes - - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - finish - no - - - - - - all - - initial - - repair - - - - info - - - - repair - - - - - - - - all - yes - yes - - initial - - screen_shot - - - no - yes - - language - true - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - yes - - - - - - - - all - yes - yes - - initial - - demo - - - no - - language - true - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - - - - continue - update - - all - yes - yes - - - - - rpmcopy - no - no - - - yes - - - - - ask_net_test - no - - - - do_net_test - - - - addon_update_sources - - - - suse_register - - - - ask_online_update - - - - you - - - - restore_settings - - - suseconfig - no - no - - - - release_notes - - - congratulate - - - - - - - continue - installation - - yes - yes - all - - - - yes - - - - - root - no - - - - initialization - no - no - - - - netprobe - no - no - - - - rpmcopy - no - no - - - - hostname - - - - proposal - network - - - - fam - - - - ask_net_test - - - - do_net_test - - - - addon_update_sources - - - - suse_register - - - - ask_online_update - - - - you - - - - extrasources - - - - restore_settings - - - - auth - - - - user - - - suseconfig - no - no - - - - release_notes - - - - proposal - hardware - - - - save_hardware_status - - - congratulate - - - - - - - initial - - autoinstallation - - all - no - no - - - - - autoinit - all - true - - - - autosetup - - - - proposal - initial - no - yes - - - - prepdisk - - - - kickoff - - - - autoimage - - - - rpmcopy - - - - finish - - - - - - - - all - no - no - - continue - autoinstallation - - - - netprobe - - - - autopost - - - - rpmcopy - - - yes - - - - - autoconfigure - - - suseconfig - - - - - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-0dfb3188-41ed929b.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-0dfb3188-41ed929b.asc deleted file mode 100644 index 89fc35c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-0dfb3188-41ed929b.asc +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBEHtkpsRBACRHiXh3olS++6/Mp9N7ByGMmjaaE+Y8cJQLUPG1myrbW5aogIP -0WenayhGbbgOHNWgd5dQ8KQpYYFoQuUHjFYzj5MvgrdOENOvD7ZNJ6+EmbkNh5cV -zUYfNG9jdiGweZkyA1sh8DYS0JiUmQ4CzaBD/DotB/dCmDcyuNQFiw4qKwCglQah -ATyueBRsOiXl0NIs1uB6dkkD/1A2YmQ6te1q38a1J+a8os6bDlMZhVnkZdhJdw6x -eBwUb9XS0n7hyt/AKCcBnrDEUQJuhBMNgzctJvbuMv27yRMANAXZDQkp0ip/yHLJ -PhUdSNTTRHOL9bV3t+JuZ9xmuclprwyrrJYUkEESXNc0tkuczHBP2c/RqA3OxYHt -hrHLA/9Pqe2gEleeo8l26u/uFXs2dtwjh8EZmdhHoqGcOlpYR4DyAg2D+jYfh3RI -oPzIwRlHVUR1ii5h8iPi98BVuEvukwfbbQ1K22Jwzxt6w3ihCXBKWKbeC3ElIMfA -hVMchLFUbTAw+yodO/u3NHxKQ34+ginid9dVyxV5T0gpDEEHObQrT3BlbiBFbnRl -cnByaXNlIFNlcnZlciA8c3VwcG9ydEBub3ZlbGwuY29tPoheBBMRAgAeBQJB7ZKb -AhsDBgsJCAcDAgMVAgMDFgIBAh4BAheAAAoJEHPSXWMN+zGID4oAoJPTGZbZApW+ -tuU422mHYGwoqgjrAJ9fhzRhRbV3YsOxKUomNeuIfmWGXA== -=Qv5+ ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-307e3d54-44201d5d.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-307e3d54-44201d5d.asc deleted file mode 100644 index 2d21c1b..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-307e3d54-44201d5d.asc +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mIsERCAdXQEEAL7MrBTz+3SBWpCm2ae2yaDqV3ezQcs2JlvqidJVhsZqQe9/jkxi -KTEQW5+TXF/+BlQSiebunRI7oo3+9U8GyRCgs1sf+yRQWMLzZqRaarzRhw9w+Ihl -edtqYl6/U2JZCb8Adp6d7RzlRliJdJ/VtsfXj2ef7Dwu7elOVSsmaBdtAAYptChT -dVNFIFBhY2thZ2UgU2lnbmluZyBLZXkgPGJ1aWxkQHN1c2UuZGU+iLgEEwECACIF -AkQgHV0CGwMFCQQ9AoAECwcDAgMVAgMDFgIBAh4BAheAAAoJEOOlw2Awfj1UjUIE -AIf3SLlrfj2RsCDjyYThXen+A/WTYDPbY+NYmmVvFQilHNQY9ZrJ5cNohRQu6hA+ -Sccrf11Uy24tTHWSTzuG9VzFeeIAcIU02XHar0w3QbvTk6IqeG+OZlfOGJj1sdx4 -JKwpwk9mSdrq2ELhrkPZiVWS7RmRkPr2klwYgKGWbmOJ -=ZmDA ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-3d25d3d9-36e12d04.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-3d25d3d9-36e12d04.asc deleted file mode 100644 index 894a463..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-3d25d3d9-36e12d04.asc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQENAzbhLQQAAAEIAKAkXHe0lWRBXLpn38hMHy03F0I4Sszmoc8aaKJrhfhyMlOA -BqvklPLE2f9UrI4Xc860gH79ZREwAgPt0pi6+SleNFLNcNFAuuHMLQOOsaMFatbz -JR9i4m/lf6q929YROu5zB48rBAlcfTm+IBbijaEdnqpwGib45wE/Cfy6FAttBHQh -1Kp+r/jPbf1mYAvljUfHKuvbg8t2EIQz/5yGp+n5trn9pElfQO2cRBq8LFpf1l+U -P7EKjFmlOq+Gs/fF98/dP3DfniSd78LQPq5vp8RL8nr/o2i7jkAQ33m4f1wOBWd+ -cZovrKXYlXiR+Bf7m2hpZo+/sAzhd7LmAD0l09kABRG0JVN1U0UgU2VjdXJpdHkg -VGVhbSA8c2VjdXJpdHlAc3VzZS5kZT6JARUDBRA24S1H5Fiyh7HKPEUBAVcOB/9b -yHYji1/+4Xc2GhvXK0FSJN0MGgeXgW47yxDL7gmR4mNgjlIOUHZj0PEpVjWepOJ7 -tQS3L9oP6cpj1Fj/XxuLbkp5VCQ61hpt54coQAvYrnT9rtWEGN+xmwejT1WmYmDJ -xG+EGBXKr+XP69oIUl1E2JO3rXeklulgjqRKos4cdXKgyjWZ7CP9V9daRXDtje63 -Om8gwSdU/nCvhdRIWp/Vwbf7Ia8iZr9OJ5YuQl0DBG4qmGDDrvImgPAFkYFzwlqo -choXFQ9y0YVCV41DnR+GYhwl2qBd81T8aXhihEGPIgaw3g8gd8B5o6mPVgl+nJqI -BkEYGBusiag2pS6qwznZiQEVAwUQNuEtBHey5gA9JdPZAQFtOAf+KVh939b0J94u -v/kpg4xs1LthlhquhbHcKNoVTNspugiC3qMPyvSX4XcBr2PC0cVkS4Z9PY9iCfT+ -x9WM96g39dAF+le2CCx7XISk9XXJ4ApEy5g4AuK7NYgAJd39PPbERgWnxjxir9g0 -Ix30dS30bW39D+3NPU5Ho9TD/B7UDFvYT5AWHl3MGwo3a1RhTs6sfgL7yQ3U+mvq -MkTExZb5mfN1FeaYKMopoI4VpzNVeGxQWIz67VjJHVyUlF20ekOz4kWVgsxkc8G2 -saqZd6yv2EwqYTi8BDAduweP33KrQc4KDDommQNDOXxaKOeCoESIdM4p7Esdjq1o -L0oixF12CohGBBARAgAGBQI7HmHDAAoJEJ5A4xAACqukTlQAoI4QzP9yjPohY7OU -F7J3eKBTzp25AJ42BmtSd3pvm5ldmognWF3Trhp+GYkAlQMFEDe3O8IWkDf+zvyS -FQEBAfkD/3GG5UgJj18UhYmh1gfjIlDcPAeqMwSytEHDENmHC+vlZQ/p0mT9tPiW -tp34io54mwr+bLPN8l6B5GJNkbGvH6M+mO7R8Lj4nHL6pyAv3PQr83WyLHcaX7It -Klj371/4yzKV6qpz43SGRK4MacLo2rNZ/dNej7lwPCtzCcFYwqkiiEYEEBECAAYF -AjoaQqQACgkQx1KqMrDf94ArewCfWnTUDG5gNYkmHG4bYL8fQcizyA4An2eVo/n+ -3J2KRWSOhpAMsnMxtPbB -=Ay23 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-7e2e3b05-44748aba.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-7e2e3b05-44748aba.asc deleted file mode 100644 index a4be6b8..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-7e2e3b05-44748aba.asc +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBER0iroRBADfqUeJmPCXqPJFnf3CVKy40dL1F+gfvP+JHN7/uu4c9+oCYjI1 -uAE8iGTm/Twb/Zzbs4dt0iWjhNFXbRi42rMww4d/8QcPYZ21WSehh+fv8nCjt2sw -LeC87ar2SR8OTpJBK0fQlcd4e6H5GMntfI6SYEUOPd8m/eQ+4+1AxpUUpwCgswaF -13fePZGI//pDn5tGjbvmaP8D/R3qum/I+oDS8lbFeeDS10GkEkwTYec13gdfsq6I -yzIj7VBsC+rGfbipv+VGR61Q4d19pOHKLDekr9OG+3G4ZcYM4NQvQZR+QIlp3xWu -nBmYD1LRkHLVj+Z4DGQhjjOffkPSuacKPymMaZ/aRiLgTIAo97W2YPhutscXrLSG -2Y+BA/4jsyaDb7kbW4wc8RtPIcuFEheVqgBeRakP9Uj47kBMBEpPtI/mIdY5liKk -ztKnuQG6ROYLNV/PW0ZbE1uT64C710weh4cB3PnZLV5P10deDLBjHk8MJQGCTSDD -JYvhutUzQfshAU6j2kErGvKdZxWGezab34vFyMP2oLGqswPAJrRQTm92ZWxsIFBy -b3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20pIDxub3ZlbGwt -cHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6IZgQTEQIAJgUCRHSKugIbAwUJA8JnAAYL -CQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEBTCi8l+LjsFWEoAn13x+5ObqkW08gYF -YNDlcGPjQuGPAJ9kAQbVUvvh1u9mBgu91cQ9W/TkHYhGBBMRAgAGBQJEexD/AAoJ -EKhO2uicgArKFLwAn0B+g2mJ5n8LrBziTQ5SjnSPyDBXAJwJoYTta5Sfw/3vVGpU -fJAKVDoB9w== -=tJSz ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-9c800aca-40d8063e.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-9c800aca-40d8063e.asc deleted file mode 100644 index 67eedcf..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-9c800aca-40d8063e.asc +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-a1912208-446a0899.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-a1912208-446a0899.asc deleted file mode 100644 index 279397c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/gpg-pubkey-a1912208-446a0899.asc +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQILBERqCJkBEACdqhZWdAbUHLIumXMEgv+GFjr1ZzVHgynnFOzztU/8sxZNa9cm -YV4HZpVfjMr7fos3ArzyiPPt/336cf7w9p79/ZS4rHSNPDMlPCtXYvFxUbvU0/GY -q4jwcBsrJ0xaJ9CP5bWyAgVKOb7Y6k0ktaLjRR+tDfMsHA4H0ClMoRr6ATw8NL0e -VCfAHuzqCKvX1If8ng+wTivtAhKvz/WwQiELNELmPfc5tZHOw8NgP/r0Pze18Hn2 -dlAHu0WpC7uoR00vscsMIJiJJPcsxbL1F1eADKnk+wEy8Go+EJeJ5i0WoFbqD52q -Lv/C/oY6NVtVY0MBwtn+oQNSnQ4JBsB/Akdt53LAi0ZtNQxMyUW+76R8FCOmVCV8 -WGiF5CPRP0yvG80AMBjBjKjHb/v8ov5MnIyFimzAHS1gQcUNxTEYA/5eFwoYcGcK -weGq9FUjPTzLQAgvp7XmOzHpSAfJ7qysxFTepNsSZZhgizJyInrdQldr+GYcUNqB -krD9MWmFop975OxhCTEnNv/HcE79r8WD26HzDFYxTiTJbr0pU/ivBzo+rjq+YG2V -stJk+udVYmZTnC4LmXus8JiNuqBXbxNscwCBpcJ8YcfCV6uh+7E0XfXZsgVUFLp1 -NF+ylYRGTycOlWoZODrnJevZW7N9O3bWRx/G2P4bJD07LsDLe4i5hymf5QAGKbRQ -Tm92ZWxsIFByb3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20p -IDxub3ZlbGwtcHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6JAjMEEwECAB0FAkRqCJkG -CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRBHijLooZEiCKSFD/93vZHCAMLEfksU -KnvXl08bv1rfuamuyJnE3ANRE5RDyypriHMCnkVxazvQ2WI4W4UEjluL9+SzZwtV -ZvKVoAr31614nSyWwv2YnJTHfjMG+xRlkolZMnuIiB9PcCBo9+GPU0ABuzo4pEJW -NIRoSS1NFbAZBhtUnY0cN+trM5QObLl7xXTavLyGk//blkk57fov7GXsQJlZUig0 -l2yt5XNyGpLUnTMDumHh8b389quF+0+ZfdwOy7A768xjipAZiTvIujBrEv51wrxh -0HBT0VGA0MhD9t0B+Ce4BM9P/iVMO00naaOp6PqMfPPKxQQqer8qy1i6UWBx95SY -mKZBIvOm2d9PezDxkckCu61r6krx1iKnT1wdprCAkIYwALK118SpbxuyGW0bhRHc -wsc/akzWH72fS0Xu49mvL4k4A2U9asdeQid3dMgbtm5mSWof0yiU/G4YNn0yeXoY -oG1VbCAqQbFX1Rvd6GITJVqI+ekW/uMA9BP78dF8wBeG0+QmpQnSf+eOsxB/RT8o -Kb4hHY+29MUlg+i9ceVt7hoKr03J/uIG5TXFXRYLaI0iAFVlKfWxpqDfS2XA4+dD -VYt+5RDgBcnxDaTB4FE9GqcYScNfe7+NFtL0p0wOPftbmgZzGjucTmrD8mDUNdqA -xGK7vlk4GATSfOQlq7G6LXW6RYnInohGBBMRAgAGBQJEazMlAAoJEKhO2uicgArK -2vMAn0TbVDESEVKVuFZStrfIzOvJQrR9AJsH733Ju1kE99GFrdfCeGqpckmNhg== -=E+qN ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/installation.xml b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/installation.xml deleted file mode 100644 index f71e6b7..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/installation.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - control-ISSLE - - false - - - auto - - - true - - - - - - - - - - product - continue,normal - installation - - yast2-issleconfig - - - - - - - no - no - - normal - installation,normal - - - - sw_single - yes - yes - - - - issleconfig - yes - yes - - - - inst_release_notes - yes - yes - - - inst_congratulate - no - yes - - - - - - - - - no - no - - continue,normal - installation,normal,update - - hostname - root - ca_mgm - - - - yast2-issleconfig - - - - - suseconfig - - - - issleconfig - yes - yes - - - - - - - - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/license.tar.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/license.tar.gz deleted file mode 100644 index 5d513d1..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/license.tar.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/directory.yast b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/directory.yast deleted file mode 100644 index f4fb49c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -info.txt -license.zip -media -products -products.asc -products.key diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/info.txt b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/info.txt deleted file mode 100644 index d5d1a49..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/info.txt +++ /dev/null @@ -1,38 +0,0 @@ - - openSUSE FACTORY 10.3-factory - - Attention! You are accessing our BETA Distribution. If you install - any package, note that we can NOT GIVE ANY SUPPORT for your system - - no matter if you update from a previous system or do a complete - new installation. - - Use this BETA distribution at your own risk! We recommend it for - testing, porting and evaluation purposes but not for any critical - production systems. - - If you are curious and would like to help us to find the bugs, you're - very welcome. Please enter bug reports following the instructions - given at http://bugs.opensuse.org . - If you want to talk about this distribution with others, you can - discuss on the mailing list opensuse-factory@opensuse.org. - - Sources for development releases are not distributed via mirrors to - reduce the bandwidth and storage on these mirrors. - - You can always find the latest source at - http://download.opensuse.org/distribution/SL-OSS-factory/ - - In case you need the exact source of this development release you can - find it on: - http://www.novell.com/products/opensuse/source_code.html - - Alternatively, see - http://www.novell.com/products/opensuse/source_code.html or send e-mail - to sourcedvd@suse.de to request the source - for a specific release of openSUSE on DVD. Please note that we will - charge $15 or 15 Euros to cover our costs of distribution. - - Use this distribution at your own risk - and remember to have a - lot of fun! :) - - Your openSUSE Team. diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/media b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/media deleted file mode 100644 index d5aa1ef..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/media +++ /dev/null @@ -1,3 +0,0 @@ -SUSE Linux Products GmbH -20070705102239 -1 diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products deleted file mode 100644 index 5563ffd..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products +++ /dev/null @@ -1 +0,0 @@ -/ SuSE-Linux-STABLE-X86 10.3 diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.asc deleted file mode 100644 index c6f169d..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.0.7 (GNU/Linux) - -iD8DBQBGjNGIqE7a6JyACsoRAoWnAJkB1wTxOQngy5xvjTiUvwWp65wW5wCg -hCbA+jw64zZYCa7IM71hBBynFL4= -=nSHl ------END PGP SIGNATURE----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.key b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.key deleted file mode 100644 index 67eedcf..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/media.1/products.key +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/kde-10.3-71.noarch.pat.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/kde-10.3-71.noarch.pat.gz deleted file mode 100644 index 9664f1d..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/kde-10.3-71.noarch.pat.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.DU.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.DU.gz deleted file mode 100644 index c49020e..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.DU.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.en.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.en.gz deleted file mode 100644 index a321085..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.en.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.es.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.es.gz deleted file mode 100644 index 41ff621..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.es.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.gz deleted file mode 100644 index fb012ea..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/packages.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/patterns.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/patterns.gz deleted file mode 100644 index 62e0eb3..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset-gz/suse/setup/descr/patterns.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/content b/libzypp/tests/repo/susetags/data/stable-x86-subset/content deleted file mode 100644 index 215791f..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/content +++ /dev/null @@ -1,42 +0,0 @@ -PRODUCT openSUSE-factory -VERSION 10.3 -DISTPRODUCT SuSE-Linux-STABLE-X86 -DISTVERSION 10.2.42-factory -VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/FACTORY/release-notes.rpm -ARCH.x86_64 x86_64 i686 i586 i486 i386 noarch -ARCH.i686 i686 i586 i486 i386 noarch -ARCH.i586 i586 i486 i386 noarch -ARCH.i486 i486 i386 noarch -ARCH.i386 i386 noarch -DEFAULTBASE i586 -REQUIRES openSUSE-release = 10.3 pattern:basesystem -PROVIDES product:openSUSE = 10.2.42 -OBSOLETES product:SUSE_LINUX product:openSUSE <= 10.2 -LINGUAS cs da de en en_GB es fi fr hu it ja km nl nb pl pt_BR zh_CN zh_TW -SHORTLABEL FACTORY -LABEL openSUSE FACTORY 10.3 -LABEL.de openSUSE FACTORY 10.3 -EXTRAURLS http://download.opensuse.org/distribution/10.2/repo/oss/ -OPTIONALURLS http://download.opensuse.org/distribution/10.2/repo/non-oss/ http://download.opensuse.org/distribution/10.2/repo/debug/ -DESCRDIR suse/setup/descr -DATADIR suse -FLAGS update -LANGUAGE en_US -META SHA1 c37f4ba4225650844363711710c3824a58c901dd kde-10.3-71.noarch.pat -META SHA1 80f9bb1f9e95ebcebfd9b22f338f779e204cd50b packages -META SHA1 9c341d93124860f03b001681513ca07b4d0ca873 packages.DU -META SHA1 a48fa507afccbce76b549a07394e41d9813e6b01 packages.en -META SHA1 765900f5513ce6bf496d5006bdff45f805e61997 packages.es -META SHA1 d3c628ac67854629ff98432bebef6c00aad9bb98 patterns -KEY SHA1 c0354069c10819674da8706822e1d4bd0c1797e9 gpg-pubkey-0dfb3188-41ed929b.asc -KEY SHA1 2e38e503c436c5d002bdc31755c82188044d9d21 gpg-pubkey-307e3d54-44201d5d.asc -KEY SHA1 7025932e6866932f489421990075f3ed312023ea gpg-pubkey-3d25d3d9-36e12d04.asc -KEY SHA1 fd6146cac8c1473c5b52548936de773d5bbd5610 gpg-pubkey-7e2e3b05-44748aba.asc -KEY SHA1 cd7adceba1fe5d7ba27b5749718743192d82f802 gpg-pubkey-9c800aca-40d8063e.asc -KEY SHA1 7535d79e31ef7b4232e5593bb49d9142978b2e95 gpg-pubkey-a1912208-446a0899.asc -HASH SHA1 875e73cf2ee139203208c860fbfd7fa5cb291c7e license.tar.gz -HASH SHA1 4aa8ded6302e6ec85690a51af6044dffe9b21923 control.xml -HASH SHA1 82f1f17ce74f0cd3fca4813c178196b317fc952d installation.xml -HASH SHA1 68d9b548d61e31e82e8834690e884afa27751287 media.1/info.txt - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/content.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/content.asc deleted file mode 100644 index e02b8bb..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset/content.asc and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/content.key b/libzypp/tests/repo/susetags/data/stable-x86-subset/content.key deleted file mode 100644 index 661d0e2..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/content.key +++ /dev/null @@ -1,135 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2 - -mQGiBDt3zUARBACCnzYUCVO/35iVN0T6J2Qb4GfDzrq8ZOqCamjD9tSylJ+UI4Co -YBks0HWnWty231Aoil6q76LRqE4bcEiJ/xuwinLFNC/S24B1cR98aq5tUEEbPJ44 -MBdY3LVbB4HCCMZH56nivx4thaTiCkVnyHpGkfKStk3lUkAVk2NR/C3uVwCgnp1D -qWaTn46JxIsEQMU8dczkeyED/j/J6QqCRwYR8XmlAUfI5ozIsQ7LuA1nY/NJ9Nnh -w2Wkq0UBZCqP/Nbfmr5EOri6MOPD9tIFRAy4qBqkxvgy/zKfX9qJkqx3o+DVrL4y -CFZHI0aUwqXvEAT6GJyDPi45gnHOVE9XJRL6BL9ZfFmOd4ajH2AJ4yy/ZqbX0GjR -opRuA/0SN8OK1ERDAA5AgZj9L2ZU7zMVmiWE8/Q+qz9p2TEfkfO8NyvvzK1Rv0iU -p0WuJn9gorBr93Sc9XtX3lINZ1PJUQg7KQbpfeWHMa1pxUMnIFVjpYZMmVFFGWZw -0q+45T9uMr50cvMr4pYtnvat5tyKM0igPtezMqSY2aY7LyZMmrQbTWljaGFlbCBB -bmRyZXMgPG1hQHN1c2UuZGU+iFcEExECABcFAjt3zUAFCwcKAwQDFQMCAxYCAQIX -gAAKCRA/uJ46J8aw5H+tAJ4ktFPz9sQGuec1LaX0pIB3oZVAvQCeP+jNfv9ZbVHI -Uz8bw8JBgwAe2w+IRgQQEQIABgUCO3fOdgAKCRDHUqoysN/3gB9xAKCLvhrIusLe -6wH0ByiA1ON3R5TNPACfY8W/eTeDSu9xNIlSCFMgDHw05cqIWgQTEQIAGgULBwoD -BAMVAwIDFgIBAheABQJIZg3kAhkBAAoJED+4njonxrDkE5oAni0UwlVNIaklPunu -iNb44D+AcgwRAJ47KCtevu20oesjoYkKhFNSLT14E4icBBMBAgAGBQI/xnvXAAoJ -EBlUT2RolefhXTwD/iXBc3oVl/jyeV2qoUB/cB1+quxpVSkjC/MnOjtmU7lXtNBj -dS7pZkMHyLDhT3VCTxvWTNM5sdS8hyQcSMATQ/axySFEy98tj5veZdMWcn9doyOP -OIpNhAv55iMsuvAP/cd26VYJDx4Amlv7BXlIw9prYZrePZrZVlSpXOnGQ9JoiQEh -BBABAgAMBQJCyOiqBQMAEnUAAAoJEJcQuJvKV618ALgH9igCYlbAeAAs+WTHoBgO -r4DFI7xREXf+AfPxraa/vLyH0cwDRej40aOnzEnwBSIC/DH+7Oy41aKunELyNtJ/ -DTkextRs2DzDhMGmYadHS8V1CPdLLA/q0rmtdGA6t2D2xhIdPXuO7+gHuaEydGTA -/KFmyE8XE0pDYHyhsrBeelSBPZS1dDcJx7vib1GQPHUydOI8PRKJbn+kxwjNqGzJ -m17sGJaxLPH8iWby8bEjmCFU31x+t+ia6sYSO7CsbwHL2mxuwfDE+f8QXiYFKDZB -t/pN0ky6iiBGoCyu/OrT7nqRmlmanRprotZ/2gW+pYGIQ1sHrcZQz/GMov7CWXGu -i4kBIgQQAQIADAUCQhcYbQUDABJ1AAAKCRCXELibyletfCOHB/92VkN0tLaC2nWJ -hOaMP2XGQbm8f09BphSdb8pxxMqnUH1W8YkCNjLvoRGN5exxb7cpfrymSqdjmSh1 -bVkREh4zzx5zd8Fhush5wqXq4PItV4Z+Es7kuZV/McG9mMoGqxI2WUyrZdXdOMFJ -O7ABEFtw7iCdzh9tVenX71U/2ePT/Ab8iWXcT5Xei4X1eQBtQ3c/2B6i9TDuH4Q0 -Cd8C89qyhzDaxrlX2dXfU/mwqIh/+6I4mwnAFBQ0RUtniXX4YARG5TuKYhDvfBod -vj6ACj518Kazlu8eOyUtZr+w1ntc22veQ8im7qpMqpMAqEYmpO7B6wYb/BOOxTBD -+pROcj3ziQEiBBABAgAMBQJCT68CBQMAEnUAAAoJEJcQuJvKV618IwIH/2pIkrl7 -OWSIoZADqVC7w6eXF17sV5TXLqJEPaHVuS6e+RnTbcRut7lPbx3wFVWQflFhn/fg -jkTUkTpcwbBrl199OA6k1yQPdYCJb1KuFP8aipWvlUjJcqUnHJS0ub7eSqWLeXcq -8cIufLMVNIcImU9yBoTVo4t7bezcO5LBC9l58B0uO11TwUlJ0pXAGUqznlAC7EuO -uLUnZr/6G+PzpWDEJN6QjBdRnn9qIflefkTXdsqUb2ByB5/SMJ3FgHkPZBx1Mqgm -IXvW05uQd4uyHJ0t9azvwxtgHgNH3y+FBkglP7yhRfBxwvMZbLJZft7xnXLMgdfH -M8Sj6pwmlSI9cnGJASIEEAECAAwFAkJiN0UFAwASdQAACgkQlxC4m8pXrXywowf/ -QzsKRLsWvMvNlYixCp2xF26ZKLpMUddmOxbqrJPCmITCkVO6fJjuegAwWBD9CEgg -2RfCZ4n2thwsbLWCRjYrwUzgbA0s4h0NE5mjsuOwQmKHjPXi0Fn3tx3teA7/GVPB -cqEGHnHVXx9guyGiwqugMRsYfYXEbDel68fo9Z7MraLwbTB2gSOJdEkCM0KtBNYd -ZUG7Q4m8qK8kBGjhBjCK0jgsaJK0FLRNlT5dGnwG1ggnnQEr9x6U2BwikfzaodDp -J80o3Z9PBr5OiDxXPb9kMgW9VwRpBBwvCi5ltAn8NtfIsPlQYwmb0FXyh7AXxlx0 -f2dS+IxMAd8POqhiABLJ0IkBIgQQAQIADAUCQmLeuwUDABJ1AAAKCRCXELibylet -fHGDB/9u0yi/Wk/mrFzrvwI4AOb92E7427Le3USIKUuWZSMqzAAVeNgCgKfy/NbY -gs6Kttb56+HnUJJ/C79YDh4qABe0hGiIgik+dUj/t2FBIz35cc2rS76hHXm1lWQC -0Si48AKPqhqzWCwzwt6aerQIg1IBkSmINKF6LrTIraYjh6UsDnLqLrlxnosXP4bT -byIKH2mTT3bboR8iaYyzxKV0ccydHE0jp0Dffx3x4wH5CKHrEJt1lhSKdDexM5yG -lAa+haUDKRulODNVljtx5m84vOgpwdg/JphLBJ24jGhHUS3PI3cXf+TV97J3YYQo -XITC9lRNqk3GZeWWyUu3r0XB/hp4iQEiBBABAgAMBQJCdVu9BQMAEnUAAAoJEJcQ -uJvKV618HHcIAKOHqHyRSw+4jg35JfVcLgrZn/3G4cDl35cAtZ5iz6ukEg8vpzH3 -rMfiFYV2WQNflQ2tIrD9ZwSjJVAXNEL1eX883HAL7HmHFCqaQTusZb7vpbzh18fU -Tjl4Nq3K9FqIIfJzJ8lPxGit6eL82OO/WUffjQAA9Ad+2yY/yWOyqUN4dqzxUWx4 -9F1Q2UDBGiu/QhcEhUlPf6B21I1nqsSkOMGtRiHf7RfrGDss2xRn+0PDrpRDcpmV -ZxJ4JpKQSDBKqbktlcdl95y9gI6llpJXFFQugxGwsC4qr6UYw4RloAdkpwz6aAlk -rfFgCZ5KhkLs4HQkdZLr+zq7zJh5njuBnJKJASIEEAECAAwFAkKHod8FAwASdQAA -CgkQlxC4m8pXrXxEdAf+Juexqg2/qC8vP+OnTuuDzTALHdSzt81Gq8a9jMHVs4rA -gAAEKbKzrRgnAjI7wyGSxU1kaPNh+RQB4qtZy4x7MlJtRfcfSlAWw7i3rqKQakpY -xUQEXLt/nK8kWxd2nC4gMW0105J+lBSMiCAw174/h36RjG//Cv17AhzGOckFE0n0 -7gZlW/+5YnjvFemP8lFnL5kb5BzPPiJy8J1VnqvXY95n3HxhkoiTSrXlS0MNNLgG -h27C+Kzl+p4X/T1esWoZe3pbq+qSb4xnglXOqzGJduQ0s585907ohm09m++e6NXK -hxxysu4cvcMv2Cc4ep9HglEY6sVrwY/0pMpBYdMLBIkBIgQQAQIADAUCQomcnAUD -ABJ1AAAKCRCXELibyletfDfnB/9ELbGLL7OIsOwCDidj1f/sabT/aFJ4LX15nm1B -mW0huKLRdJuzX7XZkcTx6SohTcTgFIfXxV1RLt/7wrW5TTRrYmDRyk0CR1EZlfgz -yLUaG+18ml7h97DZqSIaWnsqnryJB1QPyGO6yBUQTQ/KcGMyw2lzY2ovtl/UheIu -PT0v3v12kFxOo1xYeBn81YHQKPMWJhJ+iOmhjbj89W6RZ8swgSd9pczv0ptfUFIm -X5NbmIFxaiwWkRraUZYjdYYJGIainE9DpcMsSaSV7tq+mPl5NYVJPzW+llPPTqo6 -zIKxIByiVfH0zac/xecGyKe1RhBYJ34fdK+GcM8FYcWkpxOqiQEiBBABAgAMBQJC -m2c0BQMAEnUAAAoJEJcQuJvKV618OnMH/209R6nyz26CxVS4PtYYzMlOZ5VlOl/U -BEmRqmJeY/frgucejxX90qHUOy1dgBhJXQ05H5zHU7B0UHoha5KnSSyT2/p7owBu -AypZVvJB8PxxepPXUVfhiipR+7jWnYAsc6tjWn/+dE/ryO5iEWWAGDI0ZQ6dd/9C -sz4jDeffQusWB6g5ebfL6+SBHa5N2PCydGr047fG0KZm2jposMPsXbIuKh6LSTaL -QxGUyyJ+tTNfwstFYMlmawLMHtjb8F5r6FT7bywVlVHr7t2DctaoxULvlvogtCuE -7B9fG2EPg0sw6yK6P2zjGs+uv2qPO15vVWFLnQJ2eXrY1eNoUL/N+5KJASIEEAEC -AAwFAkKcuOMFAwASdQAACgkQlxC4m8pXrXw8Jgf/UKw9NzMIFXf1LfuKW3hH2dhd -OYyVnsYmuPy4HQTk0It579t0Mc8b4nrT4Bm5Id//SzxhKI0mGNxtLKXTiHOsTmEU -KLeBXRaw7snnq64vaYz5NU9LdW/GX1vt4QtiGaLvZq/INUwB2jobqqcMwfw9n295 -IEeKSuu0PcttZNfLGg06wBashAMl9h42ZakxlbYpbOPj0k/MdoB8EijdO3d2M4eV -DJKQNj7XiYE+yNmecEGkxaEJBma0xloA0iiGdPJHFlK3dHKKI93A/IU4KRhAE+iB -e+HlxOMyyGOk84+vWoT9IeQddYaxdlBm44TznYNN6en1lu2nqAA4s2XZEvw4rIkB -IgQQAQIADAUCQq/WegUDABJ1AAAKCRCXELibyletfNBuCACi6+OSvQrLBIeSmhIy -7Xgv2y/zfTKc1J++Nj2HFWC/X9pJCDHEyY5h0enHrePPoQzAlNY4Mz8sNzI2gc5V -+6B90XMJUCO4xz0wSlSTSMgX7sKO3zti6TaHi1dky89UDwOatrvxtRFeY957dInE -WDTyucTfDCIu7sQEHClXlTNTWXXs/MArjmtUfldCs6KWEvBiXec8YbAyC9gKZ3YV -ERrkMEJJYVWJiqp4jkCu7N7SUm2HS4GUIfacP+Qt+FJqHjkhYmGBJXfRSNcnOubb -S5gk1VJ7FKM7ZwQYDUZgouQUi6BiLoaJ3D0mHU+kxbg7PPhbT06u/MJh6v1B1Isa -2s/niQEiBBABAgAMBQJCtR/qBQMAEnUAAAoJEJcQuJvKV618R+oIAJj01Y/c/uq+ -4FqSfanoAGR5uqz3Ln+ijzycyMMQ8cY5fZpGaeeWzi3POlfnz35BsVXASWec9x7+ -bHVQY6Rn6DoQFRX5cQ6WwwRpsg8lAoL3uzN99Frj8rwGoLkTCJvRNZVbAaDmMHAa -+dAaq+ro1B22IGxvfR6N7EfjBHmeXfTHkSdszEBl9WnpsyziapSpkGFvcdzPWnBg -Dh70nybKseCDdcIdTRCmj5MIBn150nav/1SzX+oustuxoRxrjYZUFr8dOK52xHst -GgaSyNqKE8XJ8CCBvEI2x6pzIrle3vdBaXD9Yw3lOhNN0OZsqZWb/uQCW884tlDN -XhUExNhcHXqJASIEEAECAAwFAkK3GioFAwASdQAACgkQlxC4m8pXrXz+ugf+KMyj -rXp55VY5hSYZUoM1g+NW2ayOiT/pQNzOlVZt/fA64zwkmCGaRzEC6jB0rAi98b5o -mvgCEwXWqg6z9asSbOk6/kIStI8se4hxp0BQSXIB7sXyrpopugigET3yIwSOM7M6 -fez/WHJYF/8xOzA1VM5Fbs4M2V15hpjA0lwBRHgkxqBNaHl3FjhqO8SmcECCMART -IVamMKniOK8hOVH0NKbjj7Zbe21EFuyXsxa32ROCPIY4mspKNFXtT7ixXmLjMxj0 -P3yNUVBGkgjh86eP6QjT54V70nwVbjg6u7f5xeQoWHS+8dt4QhVOZDz3XSjKwgZq -NllQ5YCSu/AdHJfcM4kBIgQQAQIADAUCQszcBwUDABJ1AAAKCRCXELibyletfBsa -B/9HKXrv7HDwZ4LS4Sf/wrtlUZIEMmbojeF3G9QWBXp1D/SbSJHPTuXM9jsZcfTZ -VX+neDDB5FkaGtqLf3Wcm5AT06qTswKbCrg1XlFQ66YuyqgX3+Y2i4GloATDNlPS -Ho5g2YliIoZXxP6VzrmCHVDKBi/TWNxMaCgwPRtJvSRGUiitv/AJR4LCyz6T6QGJ -+WRPaHwviT2FX0aAjP3q3tZKaXNmGskNuX5WUUnThUuZWwFJ2eZcqF3Mr7ZTmf/v -QnwEoyEdULUNBWF15R5FD1EvK9ELQIEWOWBILv7Mt5ozNSqTYV78UpG5MiiM3DMh -QP3iaqLsVzHvCNxgDmPZ04mBiQEiBBABAgAMBQJC0XrQBQMAEnUAAAoJEJcQuJvK -V618EDYIAJgUg6kV4hU4Z8ML9Ka2GWazj34BmEMqkk6Jm6IRP2nVkHbe+/NN7vOZ -TA+ZHFJKy5zu144+o6PqR2W9ZkcbWplUz4bC4POXclEfbIywH/7coqUwa3RjvRrO -TmiYAZKV/Z7yngC3BLBIktlEvTZustX6LsqPrqLn6Wk8GI161HWYhwRCIXQ9Vs2e -BhSGPzHp/vEOJHdGMsXpxEakcCCnn2SBwYcrkV4AN+gOJhsoH55hD1/mXEK95zoc -S2uUaxxhn3jKEUFMOnCfcfuqZ52broV3OUczxozFloIGxxZv9xwBNHOMDfA0LI6Q -9YsL5uWDE1QKdwkIzqDC4mBzgOxp5C+IVwQTEQIAFwUCO3fNQAULBwoDBAMVAwID -FgIBAheAAAoJED+4njonxrDkf60AnRUchhESPbyQbSvy7sX1xunLHgRkAJ49jGt8 -9LQdh4lvqKfpj+RMqY1LI7Q0TWljaGFlbCBBbmRyZXMgKE1pY2hhZWwgQW5kcmVz -IHByaXZhdGUpIDxtYUBrbTEzLmRlPohgBBMRAgAgAhsjBgsJCAcDAgQVAggDBBYC -AwECHgECF4AFAkhmDeAACgkQP7ieOifGsOQDpwCdGxVwFjNt98OuylGNhhjm2GD0 -HUkAn19PVAoWFjmHhSadUJAehJVloqjbiGMEExECACMCGyMGCwkIBwMCBBUCCAME -FgIDAQIeAQIXgAUCSGYGFQIZAQAKCRA/uJ46J8aw5BvgAJ0Zo8czcPx39AUXGXIU -v+RzkBeujwCfYOXRCpThfRrd2FyuUAULu+/PNnu5Ag0EO3fNWhAIANoFOLBJ37Vr -9umFyQJk2jB1zHfh8p0wF/Tw1giR7LFgTTpgvy27JR1BTSqJkeW56sfeDfMkHcRF -SEsRl0SKHfpHLQANevwvygygx6OgeJrCdgJTkhWUdB7SgVC1yMSsWm0uYTPSOH+l -9PpICNH+tP1po0qoQsD387uY8XOwlLSAuFTOGGT0q7N1g/swF/5RwJhLtgj0viQR -/lzoZ9f5GB87Ih9ab8LgBj1XcddjtFe+Qr0pZ+0tT5Fqz9/muOzeW3z1nHvE/7di -LMorlevz1gD1JOPoFDaTmLsuWXdFP0aZoi/2Wx39HVD8Zpp8vN5M3Ta/11oXhoHG -AIuIQ3kFELcAAwUIALMbFRojYmYCl6TCZ23PB/+8fK2VjAu4vUzuvv78U17H26pO -G4mVbW7XXFBmN30viiqEVMdrm76odOe5VhF+lCB8irbvedL0al/C9vsAUGKRxJB0 -1Y/mXsDuPvxmiuGqcWrb8j3chBh129dCO+dR4MR1xfth23EnI/fncggAeXGT6+HD -oXfXTHoMolWKa9Fh3vRTZqFtBQTYPenr7lhUjPmM3cpswSTxkwIqC2pUmmDMekSu -IOCVIbe5w+f5OB8j2Bd3ZYgxsePcf20OWOXdLNucO1KPaM9zS7LxhmlzAOWcXj8E -EK9bAvdi1DXDgJA+AYmD6ol3uX+eoIDh3akYTTyIRgQYEQIABgUCO3fNWgAKCRA/ -uJ46J8aw5AtiAJkBhcP6w63v4r8niiOPjmgN6NbxxACeK/BBzQT+qgqQfHYEW0Sc -ixhE83U= -=Z5HF ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/control.xml b/libzypp/tests/repo/susetags/data/stable-x86-subset/control.xml deleted file mode 100644 index 096763e..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/control.xml +++ /dev/null @@ -1,793 +0,0 @@ - - - - - - control - - - true - true - false - never - 95 - true - true - simple - false - true - true - true - true - false - true - false - - - - - /root/ - /root/inst-sys/ - - - - - - false - auto - - - http://download.opensuse.org/YaST/Repos/openSUSE_103_Servers.xml - - - - false - true - 7G - 40 - 5G - 20G - false - false - 15G - 25G - false - - - - false - laptop - ifplugd - - - - language - keyboard - timezone - users - networking - firewall - host - routing - proxy - runlevel - x11 - nis - ldap - printer - add-on - - - - - - - - - - - - installation,demo,autoinstallation - initial - initial - no - - hwinfo - keyboard - mouse - partitions - software - bootloader - timezone - language - runlevel - - - - - - partitions - software_simple - country_simple - - - - - - hwinfo - keyboard - mouse - partitions - software - bootloader - timezone - language - runlevel - - - - - - - - update - initial - normal - no - - update - packages - backup - language - - - - - - update - initial - initial - no - - hwinfo - media - - update - packages - backup - language - keyboard - - - - - - network - continue,normal - yes - - - lan - 20 - - - general - 5 - - - dsl - 30 - - - isdn - 40 - - - modem - 50 - - - remote - 60 - - - firewall - 10 - - - proxy - 70 - - - - - - - hardware - continue - yes - - x11 - printer - sound - tv - bluetooth - - - - - - - - - all - yes - yes - - - installation - initial - - - language - - no - yes - - yes - - true - - - - checkmedia - - - - license - - - - disks_activate - - - - system_analysis - - - - - productsources - yes - - - - add-on - yes - - - - timezone - - yes - - yes - - - - desktop - - - yes - - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - finish - no - - - - - - - - all - yes - yes - - - update - initial - - - language - - no - - yes - - true - - - - checkmedia - - - - license - - - - disks_activate - - - - system_analysis - - - - update_partition - - - upgrade_urls - - - - productsources - yes - - - - add-on - yes - - - yes - - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - finish - no - - - - - - all - - initial - - repair - - - - info - - - - repair - - - - - - - - all - yes - yes - - initial - - screen_shot - - - no - yes - - language - true - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - yes - - - - - - - - all - yes - yes - - initial - - demo - - - no - - language - true - - - - proposal - initial - - - - do_resize - false - i386,x86_64,ia64 - - - - prepdisk - - - - kickoff - - - - rpmcopy - no - no - - - - - - - continue - update - - all - yes - yes - - - - - rpmcopy - no - no - - - yes - - - - - ask_net_test - no - - - - do_net_test - - - - addon_update_sources - - - - suse_register - - - - ask_online_update - - - - you - - - - restore_settings - - - suseconfig - no - no - - - - release_notes - - - congratulate - - - - - - - continue - installation - - yes - yes - all - - - - yes - - - - - root - no - - - - initialization - no - no - - - - netprobe - no - no - - - - rpmcopy - no - no - - - - hostname - - - - proposal - network - - - - fam - - - - ask_net_test - - - - do_net_test - - - - addon_update_sources - - - - suse_register - - - - ask_online_update - - - - you - - - - extrasources - - - - restore_settings - - - - auth - - - - user - - - suseconfig - no - no - - - - release_notes - - - - proposal - hardware - - - - save_hardware_status - - - congratulate - - - - - - - initial - - autoinstallation - - all - no - no - - - - - autoinit - all - true - - - - autosetup - - - - proposal - initial - no - yes - - - - prepdisk - - - - kickoff - - - - autoimage - - - - rpmcopy - - - - finish - - - - - - - - all - no - no - - continue - autoinstallation - - - - netprobe - - - - autopost - - - - rpmcopy - - - yes - - - - - autoconfigure - - - suseconfig - - - - - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc deleted file mode 100644 index 89fc35c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-0dfb3188-41ed929b.asc +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBEHtkpsRBACRHiXh3olS++6/Mp9N7ByGMmjaaE+Y8cJQLUPG1myrbW5aogIP -0WenayhGbbgOHNWgd5dQ8KQpYYFoQuUHjFYzj5MvgrdOENOvD7ZNJ6+EmbkNh5cV -zUYfNG9jdiGweZkyA1sh8DYS0JiUmQ4CzaBD/DotB/dCmDcyuNQFiw4qKwCglQah -ATyueBRsOiXl0NIs1uB6dkkD/1A2YmQ6te1q38a1J+a8os6bDlMZhVnkZdhJdw6x -eBwUb9XS0n7hyt/AKCcBnrDEUQJuhBMNgzctJvbuMv27yRMANAXZDQkp0ip/yHLJ -PhUdSNTTRHOL9bV3t+JuZ9xmuclprwyrrJYUkEESXNc0tkuczHBP2c/RqA3OxYHt -hrHLA/9Pqe2gEleeo8l26u/uFXs2dtwjh8EZmdhHoqGcOlpYR4DyAg2D+jYfh3RI -oPzIwRlHVUR1ii5h8iPi98BVuEvukwfbbQ1K22Jwzxt6w3ihCXBKWKbeC3ElIMfA -hVMchLFUbTAw+yodO/u3NHxKQ34+ginid9dVyxV5T0gpDEEHObQrT3BlbiBFbnRl -cnByaXNlIFNlcnZlciA8c3VwcG9ydEBub3ZlbGwuY29tPoheBBMRAgAeBQJB7ZKb -AhsDBgsJCAcDAgMVAgMDFgIBAh4BAheAAAoJEHPSXWMN+zGID4oAoJPTGZbZApW+ -tuU422mHYGwoqgjrAJ9fhzRhRbV3YsOxKUomNeuIfmWGXA== -=Qv5+ ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc deleted file mode 100644 index 2d21c1b..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-307e3d54-44201d5d.asc +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mIsERCAdXQEEAL7MrBTz+3SBWpCm2ae2yaDqV3ezQcs2JlvqidJVhsZqQe9/jkxi -KTEQW5+TXF/+BlQSiebunRI7oo3+9U8GyRCgs1sf+yRQWMLzZqRaarzRhw9w+Ihl -edtqYl6/U2JZCb8Adp6d7RzlRliJdJ/VtsfXj2ef7Dwu7elOVSsmaBdtAAYptChT -dVNFIFBhY2thZ2UgU2lnbmluZyBLZXkgPGJ1aWxkQHN1c2UuZGU+iLgEEwECACIF -AkQgHV0CGwMFCQQ9AoAECwcDAgMVAgMDFgIBAh4BAheAAAoJEOOlw2Awfj1UjUIE -AIf3SLlrfj2RsCDjyYThXen+A/WTYDPbY+NYmmVvFQilHNQY9ZrJ5cNohRQu6hA+ -Sccrf11Uy24tTHWSTzuG9VzFeeIAcIU02XHar0w3QbvTk6IqeG+OZlfOGJj1sdx4 -JKwpwk9mSdrq2ELhrkPZiVWS7RmRkPr2klwYgKGWbmOJ -=ZmDA ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc deleted file mode 100644 index 894a463..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-3d25d3d9-36e12d04.asc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQENAzbhLQQAAAEIAKAkXHe0lWRBXLpn38hMHy03F0I4Sszmoc8aaKJrhfhyMlOA -BqvklPLE2f9UrI4Xc860gH79ZREwAgPt0pi6+SleNFLNcNFAuuHMLQOOsaMFatbz -JR9i4m/lf6q929YROu5zB48rBAlcfTm+IBbijaEdnqpwGib45wE/Cfy6FAttBHQh -1Kp+r/jPbf1mYAvljUfHKuvbg8t2EIQz/5yGp+n5trn9pElfQO2cRBq8LFpf1l+U -P7EKjFmlOq+Gs/fF98/dP3DfniSd78LQPq5vp8RL8nr/o2i7jkAQ33m4f1wOBWd+ -cZovrKXYlXiR+Bf7m2hpZo+/sAzhd7LmAD0l09kABRG0JVN1U0UgU2VjdXJpdHkg -VGVhbSA8c2VjdXJpdHlAc3VzZS5kZT6JARUDBRA24S1H5Fiyh7HKPEUBAVcOB/9b -yHYji1/+4Xc2GhvXK0FSJN0MGgeXgW47yxDL7gmR4mNgjlIOUHZj0PEpVjWepOJ7 -tQS3L9oP6cpj1Fj/XxuLbkp5VCQ61hpt54coQAvYrnT9rtWEGN+xmwejT1WmYmDJ -xG+EGBXKr+XP69oIUl1E2JO3rXeklulgjqRKos4cdXKgyjWZ7CP9V9daRXDtje63 -Om8gwSdU/nCvhdRIWp/Vwbf7Ia8iZr9OJ5YuQl0DBG4qmGDDrvImgPAFkYFzwlqo -choXFQ9y0YVCV41DnR+GYhwl2qBd81T8aXhihEGPIgaw3g8gd8B5o6mPVgl+nJqI -BkEYGBusiag2pS6qwznZiQEVAwUQNuEtBHey5gA9JdPZAQFtOAf+KVh939b0J94u -v/kpg4xs1LthlhquhbHcKNoVTNspugiC3qMPyvSX4XcBr2PC0cVkS4Z9PY9iCfT+ -x9WM96g39dAF+le2CCx7XISk9XXJ4ApEy5g4AuK7NYgAJd39PPbERgWnxjxir9g0 -Ix30dS30bW39D+3NPU5Ho9TD/B7UDFvYT5AWHl3MGwo3a1RhTs6sfgL7yQ3U+mvq -MkTExZb5mfN1FeaYKMopoI4VpzNVeGxQWIz67VjJHVyUlF20ekOz4kWVgsxkc8G2 -saqZd6yv2EwqYTi8BDAduweP33KrQc4KDDommQNDOXxaKOeCoESIdM4p7Esdjq1o -L0oixF12CohGBBARAgAGBQI7HmHDAAoJEJ5A4xAACqukTlQAoI4QzP9yjPohY7OU -F7J3eKBTzp25AJ42BmtSd3pvm5ldmognWF3Trhp+GYkAlQMFEDe3O8IWkDf+zvyS -FQEBAfkD/3GG5UgJj18UhYmh1gfjIlDcPAeqMwSytEHDENmHC+vlZQ/p0mT9tPiW -tp34io54mwr+bLPN8l6B5GJNkbGvH6M+mO7R8Lj4nHL6pyAv3PQr83WyLHcaX7It -Klj371/4yzKV6qpz43SGRK4MacLo2rNZ/dNej7lwPCtzCcFYwqkiiEYEEBECAAYF -AjoaQqQACgkQx1KqMrDf94ArewCfWnTUDG5gNYkmHG4bYL8fQcizyA4An2eVo/n+ -3J2KRWSOhpAMsnMxtPbB -=Ay23 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc deleted file mode 100644 index a4be6b8..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-7e2e3b05-44748aba.asc +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBER0iroRBADfqUeJmPCXqPJFnf3CVKy40dL1F+gfvP+JHN7/uu4c9+oCYjI1 -uAE8iGTm/Twb/Zzbs4dt0iWjhNFXbRi42rMww4d/8QcPYZ21WSehh+fv8nCjt2sw -LeC87ar2SR8OTpJBK0fQlcd4e6H5GMntfI6SYEUOPd8m/eQ+4+1AxpUUpwCgswaF -13fePZGI//pDn5tGjbvmaP8D/R3qum/I+oDS8lbFeeDS10GkEkwTYec13gdfsq6I -yzIj7VBsC+rGfbipv+VGR61Q4d19pOHKLDekr9OG+3G4ZcYM4NQvQZR+QIlp3xWu -nBmYD1LRkHLVj+Z4DGQhjjOffkPSuacKPymMaZ/aRiLgTIAo97W2YPhutscXrLSG -2Y+BA/4jsyaDb7kbW4wc8RtPIcuFEheVqgBeRakP9Uj47kBMBEpPtI/mIdY5liKk -ztKnuQG6ROYLNV/PW0ZbE1uT64C710weh4cB3PnZLV5P10deDLBjHk8MJQGCTSDD -JYvhutUzQfshAU6j2kErGvKdZxWGezab34vFyMP2oLGqswPAJrRQTm92ZWxsIFBy -b3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20pIDxub3ZlbGwt -cHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6IZgQTEQIAJgUCRHSKugIbAwUJA8JnAAYL -CQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEBTCi8l+LjsFWEoAn13x+5ObqkW08gYF -YNDlcGPjQuGPAJ9kAQbVUvvh1u9mBgu91cQ9W/TkHYhGBBMRAgAGBQJEexD/AAoJ -EKhO2uicgArKFLwAn0B+g2mJ5n8LrBziTQ5SjnSPyDBXAJwJoYTta5Sfw/3vVGpU -fJAKVDoB9w== -=tJSz ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc deleted file mode 100644 index 67eedcf..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-9c800aca-40d8063e.asc +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc deleted file mode 100644 index 279397c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/gpg-pubkey-a1912208-446a0899.asc +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQILBERqCJkBEACdqhZWdAbUHLIumXMEgv+GFjr1ZzVHgynnFOzztU/8sxZNa9cm -YV4HZpVfjMr7fos3ArzyiPPt/336cf7w9p79/ZS4rHSNPDMlPCtXYvFxUbvU0/GY -q4jwcBsrJ0xaJ9CP5bWyAgVKOb7Y6k0ktaLjRR+tDfMsHA4H0ClMoRr6ATw8NL0e -VCfAHuzqCKvX1If8ng+wTivtAhKvz/WwQiELNELmPfc5tZHOw8NgP/r0Pze18Hn2 -dlAHu0WpC7uoR00vscsMIJiJJPcsxbL1F1eADKnk+wEy8Go+EJeJ5i0WoFbqD52q -Lv/C/oY6NVtVY0MBwtn+oQNSnQ4JBsB/Akdt53LAi0ZtNQxMyUW+76R8FCOmVCV8 -WGiF5CPRP0yvG80AMBjBjKjHb/v8ov5MnIyFimzAHS1gQcUNxTEYA/5eFwoYcGcK -weGq9FUjPTzLQAgvp7XmOzHpSAfJ7qysxFTepNsSZZhgizJyInrdQldr+GYcUNqB -krD9MWmFop975OxhCTEnNv/HcE79r8WD26HzDFYxTiTJbr0pU/ivBzo+rjq+YG2V -stJk+udVYmZTnC4LmXus8JiNuqBXbxNscwCBpcJ8YcfCV6uh+7E0XfXZsgVUFLp1 -NF+ylYRGTycOlWoZODrnJevZW7N9O3bWRx/G2P4bJD07LsDLe4i5hymf5QAGKbRQ -Tm92ZWxsIFByb3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20p -IDxub3ZlbGwtcHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6JAjMEEwECAB0FAkRqCJkG -CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRBHijLooZEiCKSFD/93vZHCAMLEfksU -KnvXl08bv1rfuamuyJnE3ANRE5RDyypriHMCnkVxazvQ2WI4W4UEjluL9+SzZwtV -ZvKVoAr31614nSyWwv2YnJTHfjMG+xRlkolZMnuIiB9PcCBo9+GPU0ABuzo4pEJW -NIRoSS1NFbAZBhtUnY0cN+trM5QObLl7xXTavLyGk//blkk57fov7GXsQJlZUig0 -l2yt5XNyGpLUnTMDumHh8b389quF+0+ZfdwOy7A768xjipAZiTvIujBrEv51wrxh -0HBT0VGA0MhD9t0B+Ce4BM9P/iVMO00naaOp6PqMfPPKxQQqer8qy1i6UWBx95SY -mKZBIvOm2d9PezDxkckCu61r6krx1iKnT1wdprCAkIYwALK118SpbxuyGW0bhRHc -wsc/akzWH72fS0Xu49mvL4k4A2U9asdeQid3dMgbtm5mSWof0yiU/G4YNn0yeXoY -oG1VbCAqQbFX1Rvd6GITJVqI+ekW/uMA9BP78dF8wBeG0+QmpQnSf+eOsxB/RT8o -Kb4hHY+29MUlg+i9ceVt7hoKr03J/uIG5TXFXRYLaI0iAFVlKfWxpqDfS2XA4+dD -VYt+5RDgBcnxDaTB4FE9GqcYScNfe7+NFtL0p0wOPftbmgZzGjucTmrD8mDUNdqA -xGK7vlk4GATSfOQlq7G6LXW6RYnInohGBBMRAgAGBQJEazMlAAoJEKhO2uicgArK -2vMAn0TbVDESEVKVuFZStrfIzOvJQrR9AJsH733Ju1kE99GFrdfCeGqpckmNhg== -=E+qN ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/installation.xml b/libzypp/tests/repo/susetags/data/stable-x86-subset/installation.xml deleted file mode 100644 index f71e6b7..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/installation.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - control-ISSLE - - false - - - auto - - - true - - - - - - - - - - product - continue,normal - installation - - yast2-issleconfig - - - - - - - no - no - - normal - installation,normal - - - - sw_single - yes - yes - - - - issleconfig - yes - yes - - - - inst_release_notes - yes - yes - - - inst_congratulate - no - yes - - - - - - - - - no - no - - continue,normal - installation,normal,update - - hostname - root - ca_mgm - - - - yast2-issleconfig - - - - - suseconfig - - - - issleconfig - yes - yes - - - - - - - - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/license.tar.gz b/libzypp/tests/repo/susetags/data/stable-x86-subset/license.tar.gz deleted file mode 100644 index 5d513d1..0000000 Binary files a/libzypp/tests/repo/susetags/data/stable-x86-subset/license.tar.gz and /dev/null differ diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast deleted file mode 100644 index f4fb49c..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -info.txt -license.zip -media -products -products.asc -products.key diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/info.txt b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/info.txt deleted file mode 100644 index d5d1a49..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/info.txt +++ /dev/null @@ -1,38 +0,0 @@ - - openSUSE FACTORY 10.3-factory - - Attention! You are accessing our BETA Distribution. If you install - any package, note that we can NOT GIVE ANY SUPPORT for your system - - no matter if you update from a previous system or do a complete - new installation. - - Use this BETA distribution at your own risk! We recommend it for - testing, porting and evaluation purposes but not for any critical - production systems. - - If you are curious and would like to help us to find the bugs, you're - very welcome. Please enter bug reports following the instructions - given at http://bugs.opensuse.org . - If you want to talk about this distribution with others, you can - discuss on the mailing list opensuse-factory@opensuse.org. - - Sources for development releases are not distributed via mirrors to - reduce the bandwidth and storage on these mirrors. - - You can always find the latest source at - http://download.opensuse.org/distribution/SL-OSS-factory/ - - In case you need the exact source of this development release you can - find it on: - http://www.novell.com/products/opensuse/source_code.html - - Alternatively, see - http://www.novell.com/products/opensuse/source_code.html or send e-mail - to sourcedvd@suse.de to request the source - for a specific release of openSUSE on DVD. Please note that we will - charge $15 or 15 Euros to cover our costs of distribution. - - Use this distribution at your own risk - and remember to have a - lot of fun! :) - - Your openSUSE Team. diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/media b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/media deleted file mode 100644 index d5aa1ef..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/media +++ /dev/null @@ -1,3 +0,0 @@ -SUSE Linux Products GmbH -20070705102239 -1 diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products deleted file mode 100644 index 5563ffd..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products +++ /dev/null @@ -1 +0,0 @@ -/ SuSE-Linux-STABLE-X86 10.3 diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.asc b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.asc deleted file mode 100644 index c6f169d..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.0.7 (GNU/Linux) - -iD8DBQBGjNGIqE7a6JyACsoRAoWnAJkB1wTxOQngy5xvjTiUvwWp65wW5wCg -hCbA+jw64zZYCa7IM71hBBynFL4= -=nSHl ------END PGP SIGNATURE----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.key b/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.key deleted file mode 100644 index 67eedcf..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/media.1/products.key +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.4-svn0 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.noarch.pat b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.noarch.pat deleted file mode 100644 index f3ccf93..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/kde-10.3-71.noarch.pat +++ /dev/null @@ -1,178 +0,0 @@ -# openSUSE Patterns 10.3-71.i586 -- (c) 2007 SUSE LINUX Products GmbH -# generated on Wed Jul 4 17:31:46 UTC 2007 - -=Ver: 5.0 - -=Pat: kde 10.3 71 i586 - -=Cat.cs: Grafická rozhraní -=Cat.da: Grafiske miljøer -=Cat.de: Grafische Umgebungen -=Cat: Graphical Environments -=Cat.en_GB: Graphical Environments -=Cat.es: Entornos gráficos -=Cat.et: Graafilised keskkonnad -=Cat.fi: Graafinen ympäristö -=Cat.fr: Environnements graphiques -=Cat.hr: Grafičko okruženje -=Cat.hu: Grafikus környezet -=Cat.id: Lingkungan Grafis -=Cat.it: Ambienti grafici -=Cat.ja: グラフィック環境 -=Cat.km: បរិស្ថាន​ក្រាហ្វិក -=Cat.lt: Grafinės aplinkos -=Cat.nb: Grafisk miljø -=Cat.nl: Grafische omgevingen -=Cat.pl: Środowiska graficzne -=Cat.pt_BR: Ambientes Gráficos -=Cat.ru: Графическое окружение -=Cat.sk: Grafické prostredia -=Cat.sv: Grafiska miljöer -=Cat.uk: Графічні середовища -=Cat.zh_CN: 图形环境 -=Cat.zh_TW: 圖形環境 - -=Ico: kde - -=Sum: KDE Desktop Environment -=Sum.bg: KDE Работна среда -=Sum.cs: Prostředí KDE -=Sum.da: KDE skrivebordsmiljø -=Sum.de: KDE Desktop-Umgebung -=Sum.el: ΠΡριβάλλον ΕπιφάνΡιας ΕργασΗας KDE -=Sum.en_GB: KDE Desktop Environment -=Sum.es: Escritorio KDE -=Sum.et: KDE töölaua keskkond -=Sum.fi: KDE-työpöytäympäristö -=Sum.fr: Environnement de bureau KDE -=Sum.hu: KDE asztali környezet -=Sum.it: Ambiente Desktop KDE -=Sum.ja: KDE デスクトップ環境 -=Sum.km: បរិស្ថាន​ផ្ទៃតុ KDE -=Sum.ko: KDE 데스크탑 환경 -=Sum.lt: KDE darbalaukio aplinka -=Sum.nb: Skrivebordsmiljøet KDE -=Sum.nl: KDE Desktop Environment -=Sum.pl: Środowisko graficzne KDE -=Sum.pt_BR: KDE Ambiente de Desktop -=Sum.ru: Рабочая среда KDE -=Sum.sk: Prostredie KDE -=Sum.sl: Namizno okolje KDE -=Sum.sv: Skrivbordsmiljön KDE -=Sum.uk: Стільничне середовище KDE -=Sum.zh_CN: KDE 桌面环境 -=Sum.zh_TW: KDE 桌面環境 - -+Des.bg: -KDE е мощна свободна графична среда за работни станции с Линукс, комбинираща в себе си лекота на употреба, съвременна функционалност и изключителен графичен дизайн с техническото превъзходство операционната система Линукс. --Des.bg: -+Des.ca: -KDE és un potent entorn gràfic d'escriptori de programari lliure per a les estacions de treball de Linux. Combina la facilitat d'ús, la funcionalitat contemporània i un disseny gràfic excepcional amb la tecnologia del sistema operatiu Linux. --Des.ca: -+Des.cs: -KDE je svobodné grafické prostředí pro pracovní stanice. Snoubí v sobě uživatelskou přívětivost, moderní funkcionalitu a atraktivní vzhled s linuxovou technologií. --Des.cs: -+Des.da: -KDE er et stærkt grafisk skrivebordsmiljø til Linux-arbejdsstationer og er fri software. Det er både let at bruge, har mange funktioner og et flot grafisk design med teknologien fra Linux-operativsystemet. --Des.da: -+Des.de: -KDE ist eine leistungsstarke kostenlose grafische Desktop-Umgebung für Linux-Arbeitsstationen. Das Programm kombiniert Benutzerfreundlichkeit, moderne Funktionsweise und hervorragendes grafisches Design mit der Technologie des Linux-Betriebssystems. --Des.de: -+Des: -KDE is a powerful free software graphical desktop environment for Linux workstations. It combines ease of use, contemporary functionality, and outstanding graphical design with the technology of the Linux operating system. --Des: -+Des.en_GB: -KDE is a powerful free software graphical desktop environment for Linux workstations. It combines ease of use, contemporary functionality, and outstanding graphical design with the technology of the Linux operating system. --Des.en_GB: -+Des.es: -KDE es un potente programa escritorio gráfico gratuito para estaciones de trabajo Linux. Combina la facilidad de uso, funciones contemporáneas y un diseño gráfico insuperable con la tecnología del sistema operativo Linux. --Des.es: -+Des.fi: -KDE on vaikuttava vapaa työpöytäympäristö Linux-työasemille. Siinä yhdistyy helppokäyttöisyys, käytettävyys ja upea graafinen suunnittelu Linux-käyttöjärjestelmäteknologian kanssa. --Des.fi: -+Des.fr: -KDE est un environnement de bureau graphique gratuit et puissant pour les stations de travail Linux. Il allie simplicité d'utilisation, fonctionnalités modernes et conception graphique exceptionnelle grâce à la technologie du système d'exploitation Linux. --Des.fr: -+Des.hr: -KDE je moćno besplatano grafičko okruženje radne površine za Linux radne stanice. Kombinira lakoću korištenja, svakodnevnu funkcionalnost i izvrstan grafički dizajn zajedno s tehnologijom Linux operativnog sustava. --Des.hr: -+Des.hu: -A KDE egy nagyteljesítményű, ingyenes, grafikus, asztali környezet Linux munkaállomásokhoz. Az egyszerű használatot, a modern funkcionalitást, valamint a kiemelkedő grafikai kivitelt egyesíti a Linux operációs rendszer technológiai előnyeivel. --Des.hu: -+Des.id: -KDE merupakan lingkungan desktop grafis free software yang powerful untuk workstation Linux. Ia menggabungkan kemudahan, fungsionalitas kontemporer, dan desain grafis yang hebat dengan teknologi sistem operasi Linux. --Des.id: -+Des.it: -KDE rappresenta un efficiente ambiente desktop grafico software gratuito per le workstation Linux. Associa facilità d'uso, funzioni aggiornate e ambiente grafico accattivante alla tecnologia del sistema operativo Linux. --Des.it: -+Des.ja: -KDEは、Linuxワークステーション用の無料で強力なソフトウェアグラフィカルデスクトップ環境です。 使いやすさ、現代の機能性、そして優れたグラフィカルデザインをLinuxオペレーティングシステムの技術と統合します。 --Des.ja: -+Des.km: -KDE គឺ​ជា​បរិស្ថាន​ផ្ទៃតុ​ក្រាហ្វិក​ឥត​គិត​ថ្លៃ​សម្រាប់​ស្ថានីយ​ការងារ​របស់​លីនុច ។ វា​រួមបញ្ចូល​នូវ​ភាព​ងាយស្រួល​ក្នុងការ​ប្រើប្រាស់ និង​មុខងារ​ដែល​វិវត្ត​តាម​សម័យកាល​ជានិច្ច ជាមួយ​នឹង​បច្ចេកវិជ្ជា​រចនា​ក្រាហ្វិក​គំរូ​តាម​​ប្រព័ន្ធ​ប្រតិបត្តិការ​លីនុច ។ --Des.km: -+Des.lt: -KDE yra galinga nemokama grafinė darbalaukio aplinka Linux darbo stotims. Ji sujungia lengvą naudojimą, šiuolaikinį funkcionalumą ir puikų grafinį dizainą su Linux operacinės sistemos technologijomis. --Des.lt: -+Des.nb: -KDE er et effektivt og elegant grafisk skrivebordsmiljø for Linux-arbeidsstasjoner. KDE kombinerer brukervennlighet, avanserte funksjoner og lekker grafisk design med teknologien i Linux-operativsystemet. --Des.nb: -+Des.nl: -KDE is een krachtige, vrije grafische desktop environment voor Linux-computers. Het combineert eenvoudig gebruik, uitgebreide functionaliteit en een uitstekend grafisch design met de technologie van het Linux-besturingssysteem. --Des.nl: -+Des.pl: -KDE jest potężnym środowiskiem graficznym dla linuksowych stacji roboczych. Łączy łatwość obsługi, szerokie możliwości i atrakcyjny wygląd z technologiamisystemu operacyjnego Linux. --Des.pl: -+Des.pt: -O KDE é um ambiente de trabalho gráfico livre e potente, para estações de trabalho Linux. Este combina a facilidade de utilização, funcionalidade contemporânea, e design gráfico de grande destaque, com a tecnologia do sistema operativo Linux. --Des.pt: -+Des.pt_BR: -O KDE é um poderoso ambiente gráfico de área de trabalho de software gratuito para estações de trabalho Linux. Ele combina a facilidade de uso, a funcionalidade contemporânea e o excelente design gráfico à tecnologia do sistema operacional Linux. --Des.pt_BR: -+Des.ru: -KDE это мощная бесплатная графическая система для Linux рабочих станций. Она комбинирует легкость в использовании, современную функциональность, превосходный дизайн с технологиями оперативной системы Linux. --Des.ru: -+Des.sk: -KDE je výkonné grafické prostredie a slobodný softvér, pre linuxové pracovné stanice. Kombinuje jednoduchosž použitia, modernú funkcionalitu a výnimočný grafický dizajn spolu s technológiou operačného systému Linux. --Des.sk: -+Des.sv: -KDE är en kraftfull fri programvara för grafisk skrivbordsmiljö för Linux-arbetsstationer. Den kombinerar användarvänlighet, moderna funktioner och fantastisk grafisk formgivning med tekniken hos operativsystemet Linux. --Des.sv: -+Des.uk: -KDE - це потужне графічне середовище для робочих станцій Linux. Воно поєднує простоту використання, модерну функціональність та видатний графічний дизайн з операційною системою Linux. --Des.uk: -+Des.zh_CN: -KDE 是一个软件图形桌面环境,它用于 Linux 工作站,不但功能强大,而且还可以免费使用。 它将先进的功能、独特的图形设计与 Linux 操作系统的技术相结合,使用方便。 --Des.zh_CN: -+Des.zh_TW: -KDE 是針對 Linux 工作站所設計、功能強大的免費軟體圖形桌面環境。它將容易使用、現代化功能及傑出的圖形設計等結合到 Linux 作業系統之中。 --Des.zh_TW: - -+Rec: -kde_internet -multimedia -office -kde_utilities -imaging -games -non_oss -non_oss_java -xgl --Rec: - -+Req: -kde_basis --Req: - -=Vis: true - -=Ord: 1520 - -+Prc: -opensuse-quickstart_en --Prc: -+Psg: -kdeedu3 -kiosktool --Psg: - diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages deleted file mode 100644 index 8664af9..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages +++ /dev/null @@ -1,512 +0,0 @@ -##---------------------------------------- -=Pkg: kdelibs3 3.5.7 24 i586 -=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269 -+Req: -rpmlib(VersionedDependencies) <= 3.0.3-1 -qt3 >= 3.3.8 -openssl -hicolor-icon-theme -sudo -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -/bin/sh -/usr/bin/perl -libDCOP.so.4 -libHalf.so.4 -libICE.so.6 -libIlmImf.so.4 -libSM.so.6 -libX11.so.6 -libXau.so.6 -libXcursor.so.1 -libXext.so.6 -libXfixes.so.3 -libXft.so.2 -libXi.so.6 -libXinerama.so.1 -libXrandr.so.2 -libXrender.so.1 -libacl.so.1 -libacl.so.1(ACL_1.0) -libart_lgpl_2.so.2 -libasound.so.2 -libasound.so.2(ALSA_0.9) -libaspell.so.15 -libattr.so.1 -libattr.so.1(ATTR_1.0) -libbz2.so.1 -libc.so.6 -libc.so.6(GLIBC_2.0) -libc.so.6(GLIBC_2.1) -libc.so.6(GLIBC_2.1.2) -libc.so.6(GLIBC_2.1.3) -libc.so.6(GLIBC_2.2) -libc.so.6(GLIBC_2.3) -libc.so.6(GLIBC_2.3.4) -libc.so.6(GLIBC_2.4) -libcups.so.2 -libdl.so.2 -libdl.so.2(GLIBC_2.0) -libdl.so.2(GLIBC_2.1) -libdns_sd.so.1 -libexpat.so.1 -libfam.so.0 -libfontconfig.so.1 -libfreetype.so.6 -libgcc_s.so.1 -libgcc_s.so.1(GCC_3.0) -libgcc_s.so.1(GLIBC_2.0) -libgssapi_krb5.so.2 -libgssapi_krb5.so.2(gssapi_krb5_2_MIT) -libidn.so.11 -libjasper.so.1 -libjpeg.so.62 -libkabc.so.1 -libkabc_dir.so.1 -libkabc_file.so.1 -libkabc_ldapkio.so.1 -libkatepartinterfaces.so.0 -libkdecore.so.4 -libkdefakes.so.4 -libkdefx.so.4 -libkdeinit_cupsdconf.so -libkdeinit_dcopserver.so -libkdeinit_kaddprinterwizard.so -libkdeinit_kbuildsycoca.so -libkdeinit_kcmshell.so -libkdeinit_kconf_update.so -libkdeinit_kcookiejar.so -libkdeinit_kded.so -libkdeinit_kio_http_cache_cleaner.so -libkdeinit_kio_uiserver.so -libkdeinit_klauncher.so -libkdeinit_knotify.so -libkdemm.so.0 -libkdeprint.so.4 -libkdeprint_management.so.4 -libkdesu.so.4 -libkdeui.so.4 -libkhtml.so.4 -libkio.so.4 -libkjs.so.1 -libkmediaplayer.so.0 -libknewstuff.so.1 -libkntlm.so.0 -libkparts.so.2 -libkresources.so.1 -libkscript.so.0 -libkspell2.so.1 -libktexteditor.so.0 -libkutils.so.1 -libkwalletbackend.so.1 -libkwalletclient.so.1 -libm.so.6 -libm.so.6(GLIBC_2.0) -libnetworkstatus.so.0 -libpcre.so.0 -libpng12.so.0 -libpthread.so.0 -libpthread.so.0(GLIBC_2.0) -libpthread.so.0(GLIBC_2.2) -libqt-mt.so.3 -libresolv.so.2 -libresolv.so.2(GLIBC_2.0) -libresolv.so.2(GLIBC_2.2) -libstdc++.so.6 -libstdc++.so.6(CXXABI_1.3) -libstdc++.so.6(CXXABI_1.3.1) -libstdc++.so.6(GLIBCXX_3.4) -libstdc++.so.6(GLIBCXX_3.4.9) -libtiff.so.3 -libutil.so.1 -libvcard.so.0 -libxcb-xlib.so.0 -libxcb.so.1 -libxml2.so.2 -libxslt.so.1 -libz.so.1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Req: -+Prq: -rpmlib(VersionedDependencies) <= 3.0.3-1 -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Prq: -+Prv: -kups -keramik -kdelibs3-cups -kdelibs3-33addons -kdepim3-networkstatus -kdelibs3_base = 3.3 -cupsdconf.so -dcopserver.so -highcolor.so -highcontrast.so -kabc_dir.so -kabc_file.so -kabc_ldapkio.so -kabcformat_binary.so -kaddprinterwizard.so -kbuildsycoca.so -kbzip2filter.so -kcm_kresources.so -kcmshell.so -kconf_update.so -kcookiejar.so -kded.so -kded_kcookiejar.so -kded_kdeprintd.so -kded_kdetrayproxy.so -kded_kpasswdserver.so -kded_kssld.so -kded_kwalletd.so -kded_networkstatus.so -kded_proxyscout.so -kdeprint_cups.so -kdeprint_ext.so -kdeprint_lpdunix.so -kdeprint_lpr.so -kdeprint_rlpr.so -kdeprint_tool_escputil.so -kdewidgets.so -keramik.so -kfileaudiopreview.so -kgzipfilter.so -khtmlimagepart.so -kimg_dds.so -kimg_eps.so -kimg_exr.so -kimg_hdr.so -kimg_ico.so -kimg_jp2.so -kimg_pcx.so -kimg_psd.so -kimg_rgb.so -kimg_tga.so -kimg_tiff.so -kimg_xcf.so -kimg_xview.so -kio_file.so -kio_ftp.so -kio_ghelp.so -kio_help.so -kio_http.so -kio_http_cache_cleaner.so -kio_metainfo.so -kio_uiserver.so -kjavaappletviewer.so -klauncher.so -knotify.so -kspell_aspell.so -kspell_ispell.so -kstyle_highcontrast_config.so -kstyle_plastik_config.so -ktexteditor_docwordcompletion.so -ktexteditor_insertfile.so -ktexteditor_isearch.so -ktexteditor_kdatatool.so -kthemestyle.so -libDCOP.so.4 -libconnectionmanager.so.0 -libkabc.so.1 -libkabc_dir.so.1 -libkabc_file.so.1 -libkabc_ldapkio.so.1 -libkatepart.so -libkatepartinterfaces.so.0 -libkcertpart.so -libkdecore.so.4 -libkdefakes.so.4 -libkdefx.so.4 -libkdeinit_cupsdconf.so -libkdeinit_dcopserver.so -libkdeinit_kaddprinterwizard.so -libkdeinit_kbuildsycoca.so -libkdeinit_kcmshell.so -libkdeinit_kconf_update.so -libkdeinit_kcookiejar.so -libkdeinit_kded.so -libkdeinit_kio_http_cache_cleaner.so -libkdeinit_kio_uiserver.so -libkdeinit_klauncher.so -libkdeinit_knotify.so -libkdemm.so.0 -libkdeprint.so.4 -libkdeprint_management.so.4 -libkdeprint_management_module.so -libkdesasl.so.1 -libkdesu.so.4 -libkdeui.so.4 -libkdnssd.so.1 -libkhtml.so.4 -libkhtmlpart.so -libkimproxy.so.0 -libkio.so.4 -libkjava.so.1 -libkjs.so.1 -libkmdi.so.1 -libkmdi2.so.1 -libkmediaplayer.so.0 -libkmid.so.0 -libkmultipart.so -libknewstuff.so.1 -libkntlm.so.0 -libkparts.so.2 -libkresources.so.1 -libkscreensaver.so.4 -libkscript.so.0 -libkspell.so.4 -libkspell2.so.1 -libktexteditor.so.0 -libkunittest.so.1 -libkutils.so.1 -libkwalletbackend.so.1 -libkwalletclient.so.1 -libnetworkstatus.so.0 -libshellscript.so -libvcard.so.0 -light.so -plastik.so -kdelibs3 = 3.5.7-24 --Prv: -+Obs: -kde3-i18n -kups -keramik -kdelibs3-cups -kdelibs3-33addons -kdepim3-networkstatus --Obs: -+Rec: -ispell -ispell_dictionary -enscript --Rec: -=Grp: System/GUI/KDE -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: kdelibs3 3.5.7 24 src -=Tim: 1183399094 -=Loc: 1 kdelibs3-3.5.7-24.i586.rpm -=Siz: 16356019 38850584 -+Aut: -The KDE Team --Aut: -##---------------------------------------- -=Pkg: kdelibs3-arts 3.5.7 24 i586 -=Cks: SHA1 84d8c8e875395b8caaed90ae40bdfad3fe903eb7 -+Req: -arts >= 1.5.7 -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -libX11.so.6 -libartsflow.so.1 -libartsflow_idl.so.1 -libc.so.6 -libc.so.6(GLIBC_2.0) -libc.so.6(GLIBC_2.1.3) -libc.so.6(GLIBC_2.4) -libkdecore.so.4 -libkdeui.so.4 -libkio.so.4 -libkmedia2_idl.so.1 -libmcop.so.1 -libpthread.so.0 -libpthread.so.0(GLIBC_2.0) -libqt-mt.so.3 -libqtmcop.so.1 -libsoundserver_idl.so.1 -libstdc++.so.6 -libstdc++.so.6(CXXABI_1.3) -libstdc++.so.6(GLIBCXX_3.4) -libstdc++.so.6(GLIBCXX_3.4.9) -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Req: -+Prq: -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Prq: -+Prv: -kdelibs3:/opt/kde3/bin/artsmessage -libartskde.so.1 -kdelibs3-arts = 3.5.7-24 --Prv: -+Rec: -kdemultimedia3-arts --Rec: -=Grp: System/GUI/KDE -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: kdelibs3 3.5.7 24 src -=Tim: 1183399094 -=Loc: 1 kdelibs3-arts-3.5.7-24.i586.rpm -=Siz: 183999 393828 -+Aut: -The KDE Team --Aut: -##---------------------------------------- -=Pkg: kdelibs3-debuginfo 3.5.7 24 i586 -=Cks: SHA1 0f4c7798729fae70830fd03962dff8cdcadb7bdc -+Req: -kdelibs3 = 3.5.7-24 -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Req: -+Prq: -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Prq: -+Prv: -kdelibs3-debuginfo = 3.5.7-24 --Prv: -=Grp: Development/Debug -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: kdelibs3 3.5.7 24 src -=Tim: 1183399094 -=Loc: 1 kdelibs3-debuginfo-3.5.7-24.i586.rpm -=Siz: 44452218 139124954 -+Aut: -The KDE Team --Aut: -##---------------------------------------- -=Pkg: kdelibs3-devel 3.5.7 24 i586 -=Cks: SHA1 46cfb73e29561af9e5445f6c525821856d067e61 -+Req: -qt3-devel -libvorbis-devel -kdelibs3 = 3.5.7 -autoconf -automake -libxslt-devel -libxml2-devel -libart_lgpl-devel -libjpeg-devel -kdelibs3-doc -libtiff-devel -openssl-devel -unsermake -update-desktop-files -libdrm-devel -dbus-1-qt3-devel -libattr-devel -libacl-devel -avahi-compat-mDNSResponder-devel -libbz2-devel -kdelibs3-arts -fam-devel -pcre-devel -libidn-devel -arts-devel -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -/bin/bash -/bin/sh -/usr/bin/env -/usr/bin/perl -libc.so.6 -libc.so.6(GLIBC_2.0) -libc.so.6(GLIBC_2.1.3) -libc.so.6(GLIBC_2.4) -libkdecore.so.4 -libkio.so.4 -libkunittest.so.1 -libqt-mt.so.3 -libstdc++.so.6 -libstdc++.so.6(CXXABI_1.3) -libstdc++.so.6(GLIBCXX_3.4) -libstdc++.so.6(GLIBCXX_3.4.9) -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Req: -+Prq: -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Prq: -+Prv: -perl(Ast) -perl(Iter) -perl(kalyptusCxxToDcopIDL) -perl(kdocAstUtil) -perl(kdocParseDoc) -perl(kdocUtil) -kdelibs3-devel = 3.5.7-24 --Prv: -=Grp: System/GUI/KDE -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: kdelibs3 3.5.7 24 src -=Tim: 1183399094 -=Loc: 1 kdelibs3-devel-3.5.7-24.i586.rpm -=Siz: 1403143 6898685 -+Aut: -The KDE Team --Aut: -##---------------------------------------- -=Pkg: kdelibs3-doc 3.5.7 24 i586 -=Cks: SHA1 28714c6b0ab4dbed12039d511995d3085721ed4e -+Req: -sgml-skel -libxml2 -/usr/bin/sgml-register-catalog -/usr/bin/xmlcatalog -/usr/bin/edit-xml-catalog -sed -grep -awk -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -libbz2.so.1 -libc.so.6 -libc.so.6(GLIBC_2.0) -libc.so.6(GLIBC_2.1) -libc.so.6(GLIBC_2.4) -libkdecore.so.4 -libkio.so.4 -libqt-mt.so.3 -libstdc++.so.6 -libstdc++.so.6(CXXABI_1.3) -libstdc++.so.6(GLIBCXX_3.4) -libxml2.so.2 -libxslt.so.1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Req: -+Prq: -/usr/bin/sgml-register-catalog -/usr/bin/xmlcatalog -/usr/bin/edit-xml-catalog -sed -grep -awk -/bin/sh -/bin/sh -rpmlib(PayloadFilesHavePrefix) <= 4.0-1 -rpmlib(CompressedFileNames) <= 3.0.4-1 -rpmlib(PayloadIsBzip2) <= 3.0.5-1 --Prq: -+Prv: -kdelibs3:/opt/kde3/share/apps/ksgmltools2 -kdelibs3_doc -kdelibs3-doc = 3.5.7-24 --Prv: -=Grp: System/GUI/KDE -=Lic: BSD License and BSD-like, GNU General Public License (GPL) -=Src: kdelibs3 3.5.7 24 src -=Tim: 1183399094 -=Loc: 1 kdelibs3-doc-3.5.7-24.i586.rpm -=Siz: 918394 5908265 -+Aut: -The KDE Team --Aut: -##---------------------------------------- \ No newline at end of file diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU deleted file mode 100644 index 462fb94..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.DU +++ /dev/null @@ -1,498 +0,0 @@ -##---------------------------------------- -=Pkg: kdelibs3 3.5.7 24 i586 -+Dir: -/ 0 39444 0 3068 -etc/ 1 12 1 1 -etc/xdg/ 0 12 0 1 -etc/xdg/menus/ 12 0 1 0 -opt/ 0 39366 0 3054 -opt/kde3/ 0 39366 0 3054 -opt/kde3/bin/ 1104 0 51 0 -opt/kde3/lib/ 19666 5798 53 152 -opt/kde3/lib/kde3/ 4968 830 138 14 -opt/kde3/lib/kde3/plugins/ 0 830 0 14 -opt/kde3/lib/kde3/plugins/designer/ 108 0 2 0 -opt/kde3/lib/kde3/plugins/styles/ 722 0 12 0 -opt/kde3/share/ 0 12798 0 2798 -opt/kde3/share/applications/ 0 13 0 1 -opt/kde3/share/applications/kde/ 13 0 1 0 -opt/kde3/share/apps/ 0 3902 0 410 -opt/kde3/share/apps/LICENSES/ 57 0 5 0 -opt/kde3/share/apps/kabc/ 229 4 1 1 -opt/kde3/share/apps/kabc/formats/ 4 0 1 0 -opt/kde3/share/apps/katepart/ 11 2194 2 134 -opt/kde3/share/apps/katepart/scripts/ 16 10 5 2 -opt/kde3/share/apps/katepart/scripts/indent/ 10 0 2 0 -opt/kde3/share/apps/katepart/syntax/ 2168 0 127 0 -opt/kde3/share/apps/kcertpart/ 1 0 1 0 -opt/kde3/share/apps/kcm_componentchooser/ 38 0 2 0 -opt/kde3/share/apps/kconf_update/ 8 0 8 0 -opt/kde3/share/apps/kdeprint/ 194 299 13 99 -opt/kde3/share/apps/kdeprint/filters/ 156 0 20 0 -opt/kde3/share/apps/kdeprint/icons/ 0 91 0 55 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/ 0 91 0 55 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/ 0 20 0 20 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/actions/ 3 0 3 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/apps/ 17 0 17 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/ 0 32 0 19 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/actions/ 31 0 18 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/apps/ 1 0 1 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/ 0 26 0 12 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/actions/ 3 0 1 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/apps/ 23 0 11 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/48x48/ 0 6 0 2 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/48x48/apps/ 6 0 2 0 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/64x64/ 0 7 0 2 -opt/kde3/share/apps/kdeprint/icons/crystalsvg/64x64/apps/ 7 0 2 0 -opt/kde3/share/apps/kdeprint/pics/ 25 0 18 0 -opt/kde3/share/apps/kdeprint/plugins/ 25 0 5 0 -opt/kde3/share/apps/kdeprint/tools/ 2 0 1 0 -opt/kde3/share/apps/kdeui/ 0 93 0 26 -opt/kde3/share/apps/kdeui/about/ 45 0 23 0 -opt/kde3/share/apps/kdeui/pics/ 48 0 3 0 -opt/kde3/share/apps/kdewidgets/ 0 60 0 42 -opt/kde3/share/apps/kdewidgets/pics/ 60 0 42 0 -opt/kde3/share/apps/khtml/ 6 50 4 12 -opt/kde3/share/apps/khtml/css/ 9 0 2 0 -opt/kde3/share/apps/khtml/icons/ 0 41 0 10 -opt/kde3/share/apps/khtml/icons/crystalsvg/ 0 41 0 10 -opt/kde3/share/apps/khtml/icons/crystalsvg/128x128/ 0 14 0 1 -opt/kde3/share/apps/khtml/icons/crystalsvg/128x128/actions/ 14 0 1 0 -opt/kde3/share/apps/khtml/icons/crystalsvg/16x16/ 0 4 0 3 -opt/kde3/share/apps/khtml/icons/crystalsvg/16x16/actions/ 4 0 3 0 -opt/kde3/share/apps/khtml/icons/crystalsvg/22x22/ 0 4 0 2 -opt/kde3/share/apps/khtml/icons/crystalsvg/22x22/actions/ 4 0 2 0 -opt/kde3/share/apps/khtml/icons/crystalsvg/32x32/ 0 6 0 2 -opt/kde3/share/apps/khtml/icons/crystalsvg/32x32/actions/ 6 0 2 0 -opt/kde3/share/apps/khtml/icons/crystalsvg/48x48/ 0 5 0 1 -opt/kde3/share/apps/khtml/icons/crystalsvg/48x48/actions/ 5 0 1 0 -opt/kde3/share/apps/khtml/icons/crystalsvg/64x64/ 0 8 0 1 -opt/kde3/share/apps/khtml/icons/crystalsvg/64x64/actions/ 8 0 1 0 -opt/kde3/share/apps/kio_uiserver/ 0 1 0 1 -opt/kde3/share/apps/kio_uiserver/icons/ 0 1 0 1 -opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/ 0 1 0 1 -opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/16x16/ 0 1 0 1 -opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/16x16/apps/ 1 0 1 0 -opt/kde3/share/apps/kjava/ 156 2 3 1 -opt/kde3/share/apps/kjava/icons/ 0 2 0 1 -opt/kde3/share/apps/kjava/icons/crystalsvg/ 0 2 0 1 -opt/kde3/share/apps/kjava/icons/crystalsvg/16x16/ 0 2 0 1 -opt/kde3/share/apps/kjava/icons/crystalsvg/16x16/actions/ 2 0 1 0 -opt/kde3/share/apps/knewstuff/ 1 0 1 0 -opt/kde3/share/apps/knotify/ 119 0 1 0 -opt/kde3/share/apps/kssl/ 159 0 1 0 -opt/kde3/share/apps/kstyle/ 0 183 0 47 -opt/kde3/share/apps/kstyle/pixmaps/ 0 90 0 32 -opt/kde3/share/apps/kstyle/pixmaps/riscos/ 90 0 32 0 -opt/kde3/share/apps/kstyle/themes/ 93 0 15 0 -opt/kde3/share/apps/ktexteditor_docwordcompletion/ 1 0 1 0 -opt/kde3/share/apps/ktexteditor_insertfile/ 1 0 1 0 -opt/kde3/share/apps/ktexteditor_isearch/ 1 0 1 0 -opt/kde3/share/apps/ktexteditor_kdatatool/ 1 0 1 0 -opt/kde3/share/apps/proxyscout/ 33 0 1 0 -opt/kde3/share/autostart/ 7 0 1 0 -opt/kde3/share/config/ 202 18 10 6 -opt/kde3/share/config/colors/ 10 0 4 0 -opt/kde3/share/config/ui/ 8 0 2 0 -opt/kde3/share/emoticons/ 0 79 0 42 -opt/kde3/share/emoticons/Default/ 79 0 42 0 -opt/kde3/share/icons/ 0 6549 0 1906 -opt/kde3/share/icons/crystalsvg/ 8 6480 1 1898 -opt/kde3/share/icons/crystalsvg/128x128/ 0 1622 0 151 -opt/kde3/share/icons/crystalsvg/128x128/actions/ 27 0 3 0 -opt/kde3/share/icons/crystalsvg/128x128/apps/ 33 0 2 0 -opt/kde3/share/icons/crystalsvg/128x128/devices/ 269 0 22 0 -opt/kde3/share/icons/crystalsvg/128x128/filesystems/ 529 0 40 0 -opt/kde3/share/icons/crystalsvg/128x128/mimetypes/ 764 0 84 0 -opt/kde3/share/icons/crystalsvg/16x16/ 0 429 0 408 -opt/kde3/share/icons/crystalsvg/16x16/actions/ 248 0 228 0 -opt/kde3/share/icons/crystalsvg/16x16/apps/ 3 0 2 0 -opt/kde3/share/icons/crystalsvg/16x16/devices/ 47 0 47 0 -opt/kde3/share/icons/crystalsvg/16x16/filesystems/ 45 0 45 0 -opt/kde3/share/icons/crystalsvg/16x16/mimetypes/ 86 0 86 0 -opt/kde3/share/icons/crystalsvg/22x22/ 0 552 0 346 -opt/kde3/share/icons/crystalsvg/22x22/actions/ 316 0 211 0 -opt/kde3/share/icons/crystalsvg/22x22/apps/ 4 0 2 0 -opt/kde3/share/icons/crystalsvg/22x22/devices/ 41 0 23 0 -opt/kde3/share/icons/crystalsvg/22x22/filesystems/ 43 0 23 0 -opt/kde3/share/icons/crystalsvg/22x22/mimetypes/ 148 0 87 0 -opt/kde3/share/icons/crystalsvg/32x32/ 0 782 0 359 -opt/kde3/share/icons/crystalsvg/32x32/actions/ 347 0 181 0 -opt/kde3/share/icons/crystalsvg/32x32/apps/ 5 0 2 0 -opt/kde3/share/icons/crystalsvg/32x32/devices/ 119 0 47 0 -opt/kde3/share/icons/crystalsvg/32x32/filesystems/ 107 0 41 0 -opt/kde3/share/icons/crystalsvg/32x32/mimetypes/ 204 0 88 0 -opt/kde3/share/icons/crystalsvg/48x48/ 0 842 0 223 -opt/kde3/share/icons/crystalsvg/48x48/actions/ 148 0 39 0 -opt/kde3/share/icons/crystalsvg/48x48/apps/ 10 0 2 0 -opt/kde3/share/icons/crystalsvg/48x48/devices/ 185 0 47 0 -opt/kde3/share/icons/crystalsvg/48x48/filesystems/ 188 0 44 0 -opt/kde3/share/icons/crystalsvg/48x48/mimetypes/ 311 0 91 0 -opt/kde3/share/icons/crystalsvg/64x64/ 0 917 0 184 -opt/kde3/share/icons/crystalsvg/64x64/actions/ 21 0 5 0 -opt/kde3/share/icons/crystalsvg/64x64/apps/ 13 0 2 0 -opt/kde3/share/icons/crystalsvg/64x64/devices/ 258 0 47 0 -opt/kde3/share/icons/crystalsvg/64x64/filesystems/ 240 0 40 0 -opt/kde3/share/icons/crystalsvg/64x64/mimetypes/ 385 0 90 0 -opt/kde3/share/icons/crystalsvg/scalable/ 0 1336 0 227 -opt/kde3/share/icons/crystalsvg/scalable/actions/ 304 0 56 0 -opt/kde3/share/icons/crystalsvg/scalable/apps/ 7 0 1 0 -opt/kde3/share/icons/crystalsvg/scalable/devices/ 290 0 47 0 -opt/kde3/share/icons/crystalsvg/scalable/filesystems/ 212 0 44 0 -opt/kde3/share/icons/crystalsvg/scalable/mimetypes/ 523 0 79 0 -opt/kde3/share/icons/hicolor/ 0 61 0 7 -opt/kde3/share/icons/hicolor/128x128/ 0 24 0 1 -opt/kde3/share/icons/hicolor/128x128/apps/ 24 0 1 0 -opt/kde3/share/icons/hicolor/16x16/ 0 1 0 1 -opt/kde3/share/icons/hicolor/16x16/apps/ 1 0 1 0 -opt/kde3/share/icons/hicolor/22x22/ 0 2 0 1 -opt/kde3/share/icons/hicolor/22x22/apps/ 2 0 1 0 -opt/kde3/share/icons/hicolor/32x32/ 0 3 0 1 -opt/kde3/share/icons/hicolor/32x32/apps/ 3 0 1 0 -opt/kde3/share/icons/hicolor/48x48/ 0 5 0 1 -opt/kde3/share/icons/hicolor/48x48/apps/ 5 0 1 0 -opt/kde3/share/icons/hicolor/64x64/ 0 8 0 1 -opt/kde3/share/icons/hicolor/64x64/apps/ 8 0 1 0 -opt/kde3/share/icons/hicolor/scalable/ 0 18 0 1 -opt/kde3/share/icons/hicolor/scalable/apps/ 18 0 1 0 -opt/kde3/share/locale/ 259 0 1 0 -opt/kde3/share/mimelnk/ 42 1290 1 317 -opt/kde3/share/mimelnk/all/ 9 0 2 0 -opt/kde3/share/mimelnk/application/ 761 0 179 0 -opt/kde3/share/mimelnk/audio/ 101 0 27 0 -opt/kde3/share/mimelnk/image/ 144 0 38 0 -opt/kde3/share/mimelnk/inode/ 21 0 6 0 -opt/kde3/share/mimelnk/message/ 9 0 2 0 -opt/kde3/share/mimelnk/model/ 3 0 1 0 -opt/kde3/share/mimelnk/multipart/ 9 0 2 0 -opt/kde3/share/mimelnk/text/ 175 0 41 0 -opt/kde3/share/mimelnk/uri/ 12 0 6 0 -opt/kde3/share/mimelnk/video/ 46 0 13 0 -opt/kde3/share/services/ 226 80 62 12 -opt/kde3/share/services/kded/ 70 0 8 0 -opt/kde3/share/services/kresources/ 3 7 1 3 -opt/kde3/share/services/kresources/kabc/ 7 0 3 0 -opt/kde3/share/servicetypes/ 131 0 29 0 -usr/ 0 65 0 12 -usr/share/ 0 65 0 12 -usr/share/doc/ 0 57 0 6 -usr/share/doc/packages/ 0 57 0 6 -usr/share/doc/packages/kdelibs3/ 57 0 6 0 -usr/share/man/ 0 8 0 6 -usr/share/man/man1/ 4 0 3 0 -usr/share/man/man7/ 3 0 2 0 -usr/share/man/man8/ 1 0 1 0 --Dir: -##---------------------------------------- -=Pkg: kdelibs3-arts 3.5.7 24 i586 -+Dir: -/ 0 386 0 2 -opt/ 0 386 0 2 -opt/kde3/ 0 386 0 2 -opt/kde3/bin/ 11 0 1 0 -opt/kde3/lib/ 375 0 1 0 --Dir: -##---------------------------------------- -=Pkg: kdelibs3-debuginfo 3.5.7 24 i586 -+Dir: -/ 0 137630 0 3429 -usr/ 0 137630 0 3429 -usr/lib/ 0 106253 0 186 -usr/lib/debug/ 0 106253 0 186 -usr/lib/debug/opt/ 0 106253 0 186 -usr/lib/debug/opt/kde3/ 0 106253 0 186 -usr/lib/debug/opt/kde3/bin/ 8618 0 56 0 -usr/lib/debug/opt/kde3/lib/ 70633 27002 54 76 -usr/lib/debug/opt/kde3/lib/kde3/ 23702 3300 69 7 -usr/lib/debug/opt/kde3/lib/kde3/plugins/ 0 3300 0 7 -usr/lib/debug/opt/kde3/lib/kde3/plugins/designer/ 317 0 1 0 -usr/lib/debug/opt/kde3/lib/kde3/plugins/styles/ 2983 0 6 0 -usr/src/ 0 31377 0 3243 -usr/src/debug/ 0 31377 0 3243 -usr/src/debug/kdelibs-3.5.7/ 0 31377 0 3243 -usr/src/debug/kdelibs-3.5.7/arts/ 0 273 0 52 -usr/src/debug/kdelibs-3.5.7/arts/kde/ 235 0 45 0 -usr/src/debug/kdelibs-3.5.7/arts/knotify/ 35 0 6 0 -usr/src/debug/kdelibs-3.5.7/arts/message/ 3 0 1 0 -usr/src/debug/kdelibs-3.5.7/dcop/ 285 451 20 44 -usr/src/debug/kdelibs-3.5.7/dcop/KDE-ICE/ 359 0 31 0 -usr/src/debug/kdelibs-3.5.7/dcop/client/ 52 0 7 0 -usr/src/debug/kdelibs-3.5.7/dcop/dcopidl/ 3 0 1 0 -usr/src/debug/kdelibs-3.5.7/dcop/dcopidl2cpp/ 37 0 5 0 -usr/src/debug/kdelibs-3.5.7/dnssd/ 101 0 23 0 -usr/src/debug/kdelibs-3.5.7/interfaces/ 0 437 0 134 -usr/src/debug/kdelibs-3.5.7/interfaces/kimproxy/ 0 63 0 7 -usr/src/debug/kdelibs-3.5.7/interfaces/kimproxy/library/ 63 0 7 0 -usr/src/debug/kdelibs-3.5.7/interfaces/kio/ 2 0 1 0 -usr/src/debug/kdelibs-3.5.7/interfaces/kmediaplayer/ 33 10 8 3 -usr/src/debug/kdelibs-3.5.7/interfaces/kmediaplayer/kfileaudiopreview/ 10 0 3 0 -usr/src/debug/kdelibs-3.5.7/interfaces/kregexpeditor/ 5 0 1 0 -usr/src/debug/kdelibs-3.5.7/interfaces/kscript/ 28 9 6 3 -usr/src/debug/kdelibs-3.5.7/interfaces/kscript/sample/ 9 0 3 0 -usr/src/debug/kdelibs-3.5.7/interfaces/ktexteditor/ 287 0 105 0 -usr/src/debug/kdelibs-3.5.7/kab/ 217 0 9 0 -usr/src/debug/kdelibs-3.5.7/kabc/ 658 383 93 134 -usr/src/debug/kdelibs-3.5.7/kabc/formats/ 8 0 2 0 -usr/src/debug/kdelibs-3.5.7/kabc/plugins/ 0 124 0 21 -usr/src/debug/kdelibs-3.5.7/kabc/plugins/dir/ 25 0 7 0 -usr/src/debug/kdelibs-3.5.7/kabc/plugins/file/ 30 0 7 0 -usr/src/debug/kdelibs-3.5.7/kabc/plugins/ldapkio/ 69 0 7 0 -usr/src/debug/kdelibs-3.5.7/kabc/vcard/ 119 109 36 69 -usr/src/debug/kdelibs-3.5.7/kabc/vcard/include/ 76 33 36 33 -usr/src/debug/kdelibs-3.5.7/kabc/vcard/include/generated/ 33 0 33 0 -usr/src/debug/kdelibs-3.5.7/kabc/vcardparser/ 23 0 6 0 -usr/src/debug/kdelibs-3.5.7/kate/ 0 1740 0 108 -usr/src/debug/kdelibs-3.5.7/kate/interfaces/ 59 0 7 0 -usr/src/debug/kdelibs-3.5.7/kate/part/ 1592 0 89 0 -usr/src/debug/kdelibs-3.5.7/kate/plugins/ 0 89 0 12 -usr/src/debug/kdelibs-3.5.7/kate/plugins/insertfile/ 15 0 3 0 -usr/src/debug/kdelibs-3.5.7/kate/plugins/isearch/ 26 0 3 0 -usr/src/debug/kdelibs-3.5.7/kate/plugins/kdatatool/ 17 0 3 0 -usr/src/debug/kdelibs-3.5.7/kate/plugins/wordcompletion/ 31 0 3 0 -usr/src/debug/kdelibs-3.5.7/kcert/ 34 0 3 0 -usr/src/debug/kdelibs-3.5.7/kcmshell/ 22 0 6 0 -usr/src/debug/kdelibs-3.5.7/kconf_update/ 27 0 3 0 -usr/src/debug/kdelibs-3.5.7/kdecore/ 3210 768 259 50 -usr/src/debug/kdelibs-3.5.7/kdecore/kconfig_compiler/ 51 0 1 0 -usr/src/debug/kdelibs-3.5.7/kdecore/malloc/ 181 0 1 0 -usr/src/debug/kdelibs-3.5.7/kdecore/network/ 446 0 44 0 -usr/src/debug/kdelibs-3.5.7/kdecore/svgicons/ 90 0 4 0 -usr/src/debug/kdelibs-3.5.7/kded/ 218 0 32 0 -usr/src/debug/kdelibs-3.5.7/kdefx/ 337 0 14 0 -usr/src/debug/kdelibs-3.5.7/kdemm/ 78 0 21 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/ 729 1418 126 353 -usr/src/debug/kdelibs-3.5.7/kdeprint/cups/ 337 224 73 58 -usr/src/debug/kdelibs-3.5.7/kdeprint/cups/cupsdconf2/ 224 0 58 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/ext/ 14 0 7 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/lpdunix/ 24 0 7 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/lpr/ 141 0 35 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/management/ 621 0 154 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/rlpr/ 41 0 16 0 -usr/src/debug/kdelibs-3.5.7/kdeprint/tools/ 0 16 0 3 -usr/src/debug/kdelibs-3.5.7/kdeprint/tools/escputil/ 16 0 3 0 -usr/src/debug/kdelibs-3.5.7/kdesu/ 90 0 15 0 -usr/src/debug/kdelibs-3.5.7/kdeui/ 3964 22 362 7 -usr/src/debug/kdelibs-3.5.7/kdeui/kdetrayproxy/ 22 0 7 0 -usr/src/debug/kdelibs-3.5.7/kdewidgets/ 55 0 4 0 -usr/src/debug/kdelibs-3.5.7/kdoctools/ 56 0 8 0 -usr/src/debug/kdelibs-3.5.7/khtml/ 866 4750 44 283 -usr/src/debug/kdelibs-3.5.7/khtml/css/ 530 0 18 0 -usr/src/debug/kdelibs-3.5.7/khtml/dom/ 700 0 53 0 -usr/src/debug/kdelibs-3.5.7/khtml/ecma/ 827 0 48 0 -usr/src/debug/kdelibs-3.5.7/khtml/html/ 492 0 32 0 -usr/src/debug/kdelibs-3.5.7/khtml/java/ 174 0 21 0 -usr/src/debug/kdelibs-3.5.7/khtml/kmultipart/ 31 0 3 0 -usr/src/debug/kdelibs-3.5.7/khtml/misc/ 211 0 23 0 -usr/src/debug/kdelibs-3.5.7/khtml/rendering/ 1307 0 59 0 -usr/src/debug/kdelibs-3.5.7/khtml/xml/ 478 0 26 0 -usr/src/debug/kdelibs-3.5.7/kimgio/ 198 0 17 0 -usr/src/debug/kdelibs-3.5.7/kinit/ 182 0 18 0 -usr/src/debug/kdelibs-3.5.7/kio/ 0 4866 0 488 -usr/src/debug/kdelibs-3.5.7/kio/bookmarks/ 300 0 40 0 -usr/src/debug/kdelibs-3.5.7/kio/httpfilter/ 25 0 3 0 -usr/src/debug/kdelibs-3.5.7/kio/kfile/ 1289 0 124 0 -usr/src/debug/kdelibs-3.5.7/kio/kio/ 2424 0 201 0 -usr/src/debug/kdelibs-3.5.7/kio/kioexec/ 14 0 3 0 -usr/src/debug/kdelibs-3.5.7/kio/kpasswdserver/ 35 0 4 0 -usr/src/debug/kdelibs-3.5.7/kio/kssl/ 354 0 54 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/ 95 326 10 48 -usr/src/debug/kdelibs-3.5.7/kio/misc/kdesasl/ 14 0 2 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/kfile/ 18 0 2 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/kntlm/ 46 0 5 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/kpac/ 63 0 14 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/ksendbugmail/ 27 0 6 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/kssld/ 50 0 4 0 -usr/src/debug/kdelibs-3.5.7/kio/misc/kwalletd/ 108 0 15 0 -usr/src/debug/kdelibs-3.5.7/kio/tests/ 4 0 1 0 -usr/src/debug/kdelibs-3.5.7/kioslave/ 0 500 0 29 -usr/src/debug/kdelibs-3.5.7/kioslave/bzip2/ 8 0 2 0 -usr/src/debug/kdelibs-3.5.7/kioslave/file/ 61 0 3 0 -usr/src/debug/kdelibs-3.5.7/kioslave/ftp/ 94 0 2 0 -usr/src/debug/kdelibs-3.5.7/kioslave/gzip/ 13 0 2 0 -usr/src/debug/kdelibs-3.5.7/kioslave/http/ 204 115 6 12 -usr/src/debug/kdelibs-3.5.7/kioslave/http/kcookiejar/ 115 0 12 0 -usr/src/debug/kdelibs-3.5.7/kioslave/metainfo/ 5 0 2 0 -usr/src/debug/kdelibs-3.5.7/kjs/ 748 0 69 0 -usr/src/debug/kdelibs-3.5.7/kmdi/ 460 138 38 39 -usr/src/debug/kdelibs-3.5.7/kmdi/kmdi/ 116 0 17 0 -usr/src/debug/kdelibs-3.5.7/kmdi/res/ 22 0 22 0 -usr/src/debug/kdelibs-3.5.7/knewstuff/ 182 0 31 0 -usr/src/debug/kdelibs-3.5.7/kparts/ 317 0 37 0 -usr/src/debug/kdelibs-3.5.7/kresources/ 123 0 26 0 -usr/src/debug/kdelibs-3.5.7/kspell2/ 92 275 23 36 -usr/src/debug/kdelibs-3.5.7/kspell2/plugins/ 0 204 0 19 -usr/src/debug/kdelibs-3.5.7/kspell2/plugins/aspell/ 14 0 5 0 -usr/src/debug/kdelibs-3.5.7/kspell2/plugins/ispell/ 190 0 14 0 -usr/src/debug/kdelibs-3.5.7/kspell2/ui/ 71 0 17 0 -usr/src/debug/kdelibs-3.5.7/kstyles/ 0 1078 0 46 -usr/src/debug/kdelibs-3.5.7/kstyles/highcolor/ 69 0 4 0 -usr/src/debug/kdelibs-3.5.7/kstyles/highcontrast/ 60 9 3 3 -usr/src/debug/kdelibs-3.5.7/kstyles/highcontrast/config/ 9 0 3 0 -usr/src/debug/kdelibs-3.5.7/kstyles/keramik/ 436 0 13 0 -usr/src/debug/kdelibs-3.5.7/kstyles/kthemestyle/ 203 0 8 0 -usr/src/debug/kdelibs-3.5.7/kstyles/light/ 112 0 7 0 -usr/src/debug/kdelibs-3.5.7/kstyles/plastik/ 167 18 4 3 -usr/src/debug/kdelibs-3.5.7/kstyles/plastik/config/ 18 0 3 0 -usr/src/debug/kdelibs-3.5.7/kstyles/utils/ 0 4 0 1 -usr/src/debug/kdelibs-3.5.7/kstyles/utils/installtheme/ 4 0 1 0 -usr/src/debug/kdelibs-3.5.7/kunittest/ 61 0 7 0 -usr/src/debug/kdelibs-3.5.7/kutils/ 374 66 42 12 -usr/src/debug/kdelibs-3.5.7/kutils/ksettings/ 66 0 12 0 -usr/src/debug/kdelibs-3.5.7/kwallet/ 0 110 0 18 -usr/src/debug/kdelibs-3.5.7/kwallet/backend/ 68 0 13 0 -usr/src/debug/kdelibs-3.5.7/kwallet/client/ 42 0 5 0 -usr/src/debug/kdelibs-3.5.7/libkmid/ 250 0 32 0 -usr/src/debug/kdelibs-3.5.7/libkscreensaver/ 25 0 5 0 -usr/src/debug/kdelibs-3.5.7/libltdl/ 79 0 2 0 -usr/src/debug/kdelibs-3.5.7/networkstatus/ 63 0 20 0 -usr/src/debug/kdelibs-3.5.7/pics/ 1 0 1 0 --Dir: -##---------------------------------------- -=Pkg: kdelibs3-devel 3.5.7 24 i586 -+Dir: -/ 0 7141 0 791 -etc/ 0 5 0 1 -etc/opt/ 0 5 0 1 -etc/opt/kde3/ 5 0 1 0 -opt/ 0 7136 0 790 -opt/kde3/ 0 7136 0 790 -opt/kde3/bin/ 130 0 7 0 -opt/kde3/include/ 4111 1867 415 289 -opt/kde3/include/arts/ 59 0 10 0 -opt/kde3/include/dnssd/ 30 0 7 0 -opt/kde3/include/dom/ 420 0 29 0 -opt/kde3/include/kabc/ 202 0 43 0 -opt/kde3/include/kate/ 22 0 2 0 -opt/kde3/include/kdemm/ 26 0 7 0 -opt/kde3/include/kdeprint/ 63 8 14 3 -opt/kde3/include/kdeprint/lpr/ 8 0 3 0 -opt/kde3/include/kdesu/ 25 0 8 0 -opt/kde3/include/khexedit/ 26 0 5 0 -opt/kde3/include/kio/ 332 0 37 0 -opt/kde3/include/kjs/ 120 0 17 0 -opt/kde3/include/kmdi/ 16 0 4 0 -opt/kde3/include/kmediaplayer/ 11 0 3 0 -opt/kde3/include/knewstuff/ 47 0 10 0 -opt/kde3/include/kparts/ 125 0 14 0 -opt/kde3/include/kresources/ 43 0 9 0 -opt/kde3/include/ksettings/ 20 0 4 0 -opt/kde3/include/kspell2/ 32 0 10 0 -opt/kde3/include/ktexteditor/ 97 0 33 0 -opt/kde3/include/kunittest/ 43 0 3 0 -opt/kde3/include/libkmid/ 100 0 17 0 -opt/kde3/lib/ 84 0 43 0 -opt/kde3/share/ 0 944 0 36 -opt/kde3/share/apps/ 0 944 0 36 -opt/kde3/share/apps/dcopidlng/ 82 0 7 0 -opt/kde3/share/apps/kdelibs/ 0 862 0 29 -opt/kde3/share/apps/kdelibs/admin/ 862 0 29 0 --Dir: -##---------------------------------------- -=Pkg: kdelibs3-doc 3.5.7 24 i586 -+Dir: -/ 0 6378 0 1199 -etc/ 0 1 0 1 -etc/xml/ 1 0 1 0 -opt/ 0 6377 0 1198 -opt/kde3/ 0 6377 0 1198 -opt/kde3/bin/ 43 0 1 0 -opt/kde3/share/ 0 6334 0 1197 -opt/kde3/share/apps/ 0 6003 0 1145 -opt/kde3/share/apps/ksgmltools2/ 0 6003 0 1145 -opt/kde3/share/apps/ksgmltools2/customization/ 66 940 16 487 -opt/kde3/share/apps/ksgmltools2/customization/af/ 7 9 4 9 -opt/kde3/share/apps/ksgmltools2/customization/af/entities/ 9 0 9 0 -opt/kde3/share/apps/ksgmltools2/customization/bg/ 5 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/ca/ 11 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/ca/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/cs/ 7 1 3 1 -opt/kde3/share/apps/ksgmltools2/customization/cs/entities/ 1 0 1 0 -opt/kde3/share/apps/ksgmltools2/customization/da/ 11 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/da/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/de/ 11 19 4 14 -opt/kde3/share/apps/ksgmltools2/customization/de/entities/ 19 0 14 0 -opt/kde3/share/apps/ksgmltools2/customization/dtd/ 19 0 4 0 -opt/kde3/share/apps/ksgmltools2/customization/el/ 5 1 2 1 -opt/kde3/share/apps/ksgmltools2/customization/el/entities/ 1 0 1 0 -opt/kde3/share/apps/ksgmltools2/customization/en-GB/ 7 2 3 1 -opt/kde3/share/apps/ksgmltools2/customization/en-GB/entities/ 2 0 1 0 -opt/kde3/share/apps/ksgmltools2/customization/en/ 9 2 4 2 -opt/kde3/share/apps/ksgmltools2/customization/en/entities/ 2 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/entities/ 76 0 3 0 -opt/kde3/share/apps/ksgmltools2/customization/es/ 10 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/es/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/et/ 9 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/et/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/fi/ 7 4 4 4 -opt/kde3/share/apps/ksgmltools2/customization/fi/entities/ 4 0 4 0 -opt/kde3/share/apps/ksgmltools2/customization/fo/ 7 14 4 9 -opt/kde3/share/apps/ksgmltools2/customization/fo/entities/ 14 0 9 0 -opt/kde3/share/apps/ksgmltools2/customization/fr/ 51 15 4 13 -opt/kde3/share/apps/ksgmltools2/customization/fr/entities/ 15 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/he/ 8 17 4 12 -opt/kde3/share/apps/ksgmltools2/customization/he/entities/ 17 0 12 0 -opt/kde3/share/apps/ksgmltools2/customization/hu/ 7 6 3 5 -opt/kde3/share/apps/ksgmltools2/customization/hu/entities/ 6 0 5 0 -opt/kde3/share/apps/ksgmltools2/customization/id/ 6 4 3 3 -opt/kde3/share/apps/ksgmltools2/customization/id/entities/ 4 0 3 0 -opt/kde3/share/apps/ksgmltools2/customization/it/ 10 18 4 13 -opt/kde3/share/apps/ksgmltools2/customization/it/entities/ 18 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/ja/ 6 0 3 0 -opt/kde3/share/apps/ksgmltools2/customization/ko/ 6 7 3 7 -opt/kde3/share/apps/ksgmltools2/customization/ko/entities/ 7 0 7 0 -opt/kde3/share/apps/ksgmltools2/customization/lt/ 5 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/nl/ 23 16 4 13 -opt/kde3/share/apps/ksgmltools2/customization/nl/entities/ 16 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/nn/ 11 14 4 11 -opt/kde3/share/apps/ksgmltools2/customization/nn/entities/ 14 0 11 0 -opt/kde3/share/apps/ksgmltools2/customization/no/ 7 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/no/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/obsolete/ 36 0 5 0 -opt/kde3/share/apps/ksgmltools2/customization/pl/ 20 13 4 12 -opt/kde3/share/apps/ksgmltools2/customization/pl/entities/ 13 0 12 0 -opt/kde3/share/apps/ksgmltools2/customization/pt-BR/ 9 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/pt-BR/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/pt/ 12 13 5 12 -opt/kde3/share/apps/ksgmltools2/customization/pt/entities/ 13 0 12 0 -opt/kde3/share/apps/ksgmltools2/customization/ro/ 11 14 4 13 -opt/kde3/share/apps/ksgmltools2/customization/ro/entities/ 14 0 13 0 -opt/kde3/share/apps/ksgmltools2/customization/ru/ 9 15 4 11 -opt/kde3/share/apps/ksgmltools2/customization/ru/entities/ 15 0 11 0 -opt/kde3/share/apps/ksgmltools2/customization/sk/ 7 12 3 11 -opt/kde3/share/apps/ksgmltools2/customization/sk/entities/ 12 0 11 0 -opt/kde3/share/apps/ksgmltools2/customization/sl/ 8 12 4 11 -opt/kde3/share/apps/ksgmltools2/customization/sl/entities/ 12 0 11 0 -opt/kde3/share/apps/ksgmltools2/customization/sr/ 40 18 4 12 -opt/kde3/share/apps/ksgmltools2/customization/sr/entities/ 18 0 12 0 -opt/kde3/share/apps/ksgmltools2/customization/sv/ 7 13 4 12 -opt/kde3/share/apps/ksgmltools2/customization/sv/entities/ 13 0 12 0 -opt/kde3/share/apps/ksgmltools2/customization/tr/ 5 13 2 9 -opt/kde3/share/apps/ksgmltools2/customization/tr/entities/ 13 0 9 0 -opt/kde3/share/apps/ksgmltools2/customization/uk/ 9 0 4 0 -opt/kde3/share/apps/ksgmltools2/customization/wa/ 5 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/xh/ 5 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/xsl/ 28 0 28 0 -opt/kde3/share/apps/ksgmltools2/customization/xx/ 5 0 2 0 -opt/kde3/share/apps/ksgmltools2/customization/zh-CN/ 7 8 3 5 -opt/kde3/share/apps/ksgmltools2/customization/zh-CN/entities/ 8 0 5 0 -opt/kde3/share/apps/ksgmltools2/customization/zh-TW/ 7 5 3 5 -opt/kde3/share/apps/ksgmltools2/customization/zh-TW/entities/ 5 0 5 0 -opt/kde3/share/apps/ksgmltools2/docbook/ 1 4996 1 641 -opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.1.2/ 311 67 13 19 -opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.1.2/ent/ 67 0 19 0 -opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.2/ 321 0 11 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/ 31 4266 6 592 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/common/ 2232 0 60 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/html/ 1291 0 58 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/images/ 58 31 29 31 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/images/callouts/ 31 0 31 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/lib/ 70 0 4 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/manpages/ 43 0 7 0 -opt/kde3/share/apps/ksgmltools2/docbook/xsl/params/ 541 0 403 0 -opt/kde3/share/doc/ 0 331 0 52 -opt/kde3/share/doc/HTML/ 0 331 0 52 -opt/kde3/share/doc/HTML/en/ 0 331 0 52 -opt/kde3/share/doc/HTML/en/common/ 320 0 50 0 -opt/kde3/share/doc/HTML/en/kspell/ 11 0 2 0 --Dir: -##---------------------------------------- \ No newline at end of file diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en deleted file mode 100644 index d1ece01..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.en +++ /dev/null @@ -1,47 +0,0 @@ -##---------------------------------------- -=Pkg: kdelibs3 3.5.7 24 i586 -=Sum: KDE Base Libraries -+Des: - -

This package contains kdelibs, one of the basic packages of the K -Desktop Environment. It contains the necessary libraries for the KDE desktop. -

-This package is absolutely necessary for using KDE. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-arts 3.5.7 24 i586 -=Sum: KDE aRts support -+Des: - -

This package contains bindings and gui elements for using aRts sound daemon. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-debuginfo 3.5.7 24 i586 -=Sum: KDE Base Libraries -+Des: - -

This package contains kdelibs, one of the basic packages of the K -Desktop Environment. It contains the necessary libraries for the KDE desktop. -

-This package is absolutely necessary for using KDE. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-devel 3.5.7 24 i586 -=Sum: KDE Base Package: Build Environment -+Des: - -

This package contains all necessary include files and libraries needed to develop applications that require these. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-doc 3.5.7 24 i586 -=Sum: Documentation for KDE Base Libraries -+Des: - -

This package contains the core environment and templates for the KDE help system. -

--Des: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es deleted file mode 100644 index 570a4df..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/packages.es +++ /dev/null @@ -1,47 +0,0 @@ -##---------------------------------------- -=Pkg: kdelibs3 3.5.7 24 i586 -=Sum: KDE Base Libraries -+Des: - -

This package contains kdelibs, one of the basic packages of the K -Desktop Environment. It contains the necessary libraries for the KDE desktop. -

-This package is absolutely necessary for using KDE. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-arts 3.5.7 24 i586 -=Sum: KDE aRts support -+Des: - -

This package contains bindings and gui elements for using aRts sound daemon. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-debuginfo 3.5.7 24 i586 -=Sum: KDE Base Libraries -+Des: - -

This package contains kdelibs, one of the basic packages of the K -Desktop Environment. It contains the necessary libraries for the KDE desktop. -

-This package is absolutely necessary for using KDE. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-devel 3.5.7 24 i586 -=Sum: Paquete básico de KDE: entorno de desarrollo -+Des: - -

Este paquete contiene todas las librerías y archivos include necesarios para desarrollar aplicaciones que los requieran. -

--Des: -##---------------------------------------- -=Pkg: kdelibs3-doc 3.5.7 24 i586 -=Sum: Documentación para las bibliotecas básicas de KDE -+Des: - -

Este paquete contiene el entorno central y las plantillas para el sistema de ayuda de KDE. -

--Des: -##---------------------------------------- diff --git a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns b/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns deleted file mode 100644 index 43d428b..0000000 --- a/libzypp/tests/repo/susetags/data/stable-x86-subset/suse/setup/descr/patterns +++ /dev/null @@ -1,2 +0,0 @@ -kde-10.3-71.noarch.pat - diff --git a/libzypp/tests/repo/yum/CMakeLists.txt b/libzypp/tests/repo/yum/CMakeLists.txt deleted file mode 100644 index de237c0..0000000 --- a/libzypp/tests/repo/yum/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -ADD_TESTS(YUMDownloader) \ No newline at end of file diff --git a/libzypp/tests/repo/yum/YUMDownloader_test.cc b/libzypp/tests/repo/yum/YUMDownloader_test.cc deleted file mode 100644 index 32a4f0c..0000000 --- a/libzypp/tests/repo/yum/YUMDownloader_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/Url.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/repo/yum/Downloader.h" - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; -using namespace zypp::repo; - -#include "tests/zypp/KeyRingTestReceiver.h" - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/yum/data") - -BOOST_AUTO_TEST_CASE(yum_download) -{ - KeyRingTestReceiver keyring_callbacks; - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - - Pathname p = DATADIR + "/10.2-updates-subset"; - Url url(p.asDirUrl()); - MediaSetAccess media(url); - RepoInfo repoinfo; - repoinfo.setAlias("testrepo"); - repoinfo.setPath("/"); - yum::Downloader yum(repoinfo); - filesystem::TmpDir tmp; - - Pathname localdir(tmp.path()); - - yum.download(media, localdir); - - const char* files[] = - { -// "filelists.xml.gz", -// "other.xml.gz", - "patches.xml", - "patch-fetchmsttfonts.sh-2333.xml", - "patch-flash-player-2359.xml", - "patch-glabels-2348.xml", - "patch-gv-2350.xml", - "patch-openssl-2349.xml", - "patch-tar-2351.xml", - "primary.xml.gz", - "repomd.xml", - "repomd.xml.asc", - "repomd.xml.key", - NULL - }; - - int i=0; - while ( files[i] != NULL ) - { - BOOST_CHECK_MESSAGE( PathInfo(localdir + "/repodata/" + files[i] ).isExist(), (string("/repodata/") + files[i]).c_str() ); - i++; - } - -} - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/filelists.xml.gz b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/filelists.xml.gz deleted file mode 100644 index dad0a0e..0000000 Binary files a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/filelists.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/other.xml.gz b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/other.xml.gz deleted file mode 100644 index 5694694..0000000 Binary files a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/other.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-fetchmsttfonts.sh-2333.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-fetchmsttfonts.sh-2333.xml deleted file mode 100644 index 3f91cf4..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-fetchmsttfonts.sh-2333.xml +++ /dev/null @@ -1,295 +0,0 @@ - - - - fetchmsttfonts.sh - Download Microsoft(r) TrueType Core Fonts - Download Microsoft(r) TrueType Core Fonts - For legal reasons we can't include the Microsoft(r) -TrueType Core Fonts in our product. This patch downloads -these fonts and installs them on your system. Please note -that about 4 MByte data are downloaded therefore. License -for the fonts will be installed as -/usr/share/doc/corefonts/EULA.html. - - Aus rechtlichen Gründen können wir leider die TrueType Core -Fonts von Microsoft(r) auf unserem Produkt nicht -mitliefern. Dieser Patch lädt diese Fonts herunter und -installiert diese auf Ihrem System. Beachten Sie bitte, -dass dazu in etwa 4 MByte an Daten heruntergeladen werden. -Die Lizenz für die Fonts wird unter -/usr/share/doc/corefonts/EULA.html abgelegt. - - - - - - optional - -END-USER LICENSE AGREEMENT FOR -MICROSOFT SOFTWARE - -IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is -a legal agreement between you (either an individual or a single entity) and -Microsoft Corporation for the Microsoft software accompanying this EULA, which -includes computer software and may include associated media, printed materials, -and "on-line" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). -By exercising your rights to make and use copies of the SOFTWARE PRODUCT, you -agree to be bound by the terms of this EULA. If you do not agree to the terms -of this EULA, you may not use the SOFTWARE PRODUCT. - - -SOFTWARE PRODUCT LICENSE -The SOFTWARE PRODUCT is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. The -SOFTWARE PRODUCT is licensed, not sold. - - -1. GRANT OF LICENSE. This EULA grants you the following rights: - - * Installation and Use. You may install and use an unlimited number of copies - of the SOFTWARE PRODUCT. - * Reproduction and Distribution. You may reproduce and distribute an - unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy - shall be a true and complete copy, including all copyright and trademark - notices, and shall be accompanied by a copy of this EULA. Copies of the - SOFTWARE PRODUCT may not be distributed for profit either on a standalone - basis or included as part of your own product. - - -2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS. - - * Limitations on Reverse Engineering, Decompilation, and Disassembly. You may - not reverse engineer, decompile, or disassemble the SOFTWARE PRODUCT, - except and only to the extent that such activity is expressly permitted by - applicable law notwithstanding this limitation. - * Restrictions on Alteration. You may not rename, edit or create any - derivative works from the SOFTWARE PRODUCT, other than subsetting when - embedding them in documents. - * Software Transfer. You may permanently transfer all of your rights under - this EULA, provided the recipient agrees to the terms of this EULA. - * Termination. Without prejudice to any other rights, Microsoft may terminate - this EULA if you fail to comply with the terms and conditions of this EULA. - In such event, you must destroy all copies of the SOFTWARE PRODUCT and all - of its component parts. - - -3. COPYRIGHT. All title and copyrights in and to the SOFTWARE PRODUCT -(including but not limited to any images, text, and "applets" incorporated into -the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of -the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE -PRODUCT is protected by copyright laws and international treaty provisions. -Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted -material. - - -4. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation -are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the -Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) -of the Rights in Technical Data and Computer Software clause at DFARS -252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer -Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer -is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399. - - -LIMITED WARRANTY - -NO WARRANTIES. Microsoft expressly disclaims any warranty for the SOFTWARE -PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" -without warranty of any kind, either express or implied, including, without -limitation, the implied warranties or merchantability, fitness for a particular -purpose, or noninfringement. The entire risk arising out of use or performance -of the SOFTWARE PRODUCT remains with you. - -NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Microsoft or its -suppliers be liable for any damages whatsoever (including, without limitation, -damages for loss of business profits, business interruption, loss of business -information, or any other pecuniary loss) arising out of the use of or -inability to use this Microsoft product, even if Microsoft has been advised of -the possibility of such damages. Because some states/jurisdictions do not allow -the exclusion or limitation of liability for consequential or incidental -damages, the above limitation may not apply to you. - - -MISCELLANEOUS - -If you acquired this product in the United States, this EULA is governed by the -laws of the State of Washington. - -If this product was acquired outside the United States, then local laws may -apply. - -Should you have any questions concerning this EULA, or if you desire to contact -Microsoft for any reason, please contact the Microsoft subsidiary serving your -country, or write: Microsoft Sales Information Center/One Microsoft Way/ -Redmond, WA 98052-6399. - - - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-flash-player-2359.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-flash-player-2359.xml deleted file mode 100644 index 7330ec0..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-flash-player-2359.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - flash-player - flash-player: Security upgrade to 7.0.69 - flash-player: Security Upgrade auf Version 7.0.69 - This security update brings the Adobe Flash Player to -version 7.0.69. It fixes the following security problem: - -CVE-2006-5330: CRLF injection vulnerability in Adobe Flash -Player allows remote attackers to modify HTTP headers of -client requests and conduct HTTP Request Splitting attacks -via CRLF sequences in arguments to the ActionScript -functions (1) XML.addRequestHeader and (2) -XML.contentType. NOTE: the flexibility of the attack varies -depending on the type of web browser being used. - - Dieses Securityupgrade bringt den Adobe Flash Player auf -Version 7.0.69. Dieses Update behebt damit folgendes -Sicherheitsproblem: - -CVE-2006-5330: Ein CRLF Injectionsangriff in Adobe Flash -Player erlaubt entfernten Angreifern die HTTP Header von -Client Anfragen zu verändern und damit HTTP Request -Splitting Angriffe auszuführen. Dies geschieht durch -Einschleusen von CRLF Sequenzen in die ActionScript -Funktionen (1) XML.addRequestHeader und (2) -XML.contentType. Note: Die Flexibilität dieses Angriffs ist -abhängig vom benutzten Webbrowser. - - - - - - security - - - flash-player - i586 - - e0add7ff093ece07c6967f658073bfd74607fb64 - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-glabels-2348.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-glabels-2348.xml deleted file mode 100644 index 1b38be2..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-glabels-2348.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - glabels - If you installed glabels, you should update. - If you installed glabels, you should update. - If you cannot install glabels or experienced problem with -file types (MIME) or you cannot find glabels in the menu, -you should update. - - If you cannot install glabels or experienced problem with -file types (MIME) or you cannot find glabels in the menu, -you should update. - - - - - - recommended - - - glabels - i586 - - 34adf06a0c4873b9d53b4634beb8bee458b45767 - - - glabels - x86_64 - - 40f24dc53e8f800fc1383b0ac1b357a7134f8eea - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-gv-2350.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-gv-2350.xml deleted file mode 100644 index d96af97..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-gv-2350.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - gv - gv: Additional fix for previous security update - gv: Weiterer Fix für vorheriges Sicherheitsupdate - The previous "gv" update to fix a stack overflow did not -completely fix the problem spotted. An attacker could -still cause the handling to use up all system memory, or -open windows much wider than the X display and crash. Code -execution however was not possible. - - Das vorherige "gv" Update hat zwar den berichteten -Stacküberlauf behoben, es konnte aber immer noch eine -fehlerhaftes PS den Viewer zum Absturz bringen und/oder -den Systemspeicher aufbrauchen. Das Ausführen von Schadcode -war allerdings nicht mehr möglich. - - - - - - security - - - gv - i586 - - ef3e9360d99cd36ba269af1abd2e8ac963c8c838 - - - gv - ppc - - 508bdeacfb23a0a210a27e3ed164f58b5c5c4590 - - - gv - x86_64 - - d1ceecc9b2442fe298040690bf91ae224cc2bfd4 - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-openssl-2349.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-openssl-2349.xml deleted file mode 100644 index 74c74ce..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-openssl-2349.xml +++ /dev/null @@ -1,297 +0,0 @@ - - - - openssl - Security update for OpenSSL - Sicherheitsupdate für OpenSSL - A previous openssl update (CVE-2006-2940) introduced -another bug that can lead to a crash by providing a large -prime number. An uninitialized pointer is freed during -error handling. This bug allows remote attackers to crash -services that use openssl. - - Ein vorheriges Sicherheitsupdate von OpenSSL -(CVE-2006-2940) hat einen weiteren Fehler verursacht, der -von entfernten Angreifern ausgenutzt werden kann, um -Applikationen, die OpenSSL benutzen, zum Absturz zu bringen. - - - - - - - - - - - security - - - openssl - i586 - - a923a481bc975916121811645c9957303c90172c - - - openssl - ppc - - 3751ba88267a45f6bae72285bc3295f1550ad80e - - - openssl - x86_64 - - 0a6e313ab112570584d82725dbb1fb81862bfdf0 - - - openssl-32bit - x86_64 - - 485659fe4f32303bb951e557367564f920eb1740 - - - openssl-64bit - ppc - - 96d57cc3d4539e0355374526af16c0d4a4919ea6 - - - openssl-devel - i586 - - 9f6a44015ad97680e9f93d0edefa1d533940479c - - - openssl-devel - ppc - - aefc1215e506133131739f86a77eaef17e598dd6 - - - openssl-devel - x86_64 - - 72d8cd8e5273cc13d821e3179b49c1ca1225d471 - - - openssl-devel-32bit - x86_64 - - acbbb17d623d1a509f1811ab75297a6015d4ee8e - - - openssl-devel-64bit - ppc - - e9b398feb88d4fbe24a0a52f20e9d20feb5caf49 - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-tar-2351.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-tar-2351.xml deleted file mode 100644 index ad3fda4..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patch-tar-2351.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - tar - tar: Securityupdate to fix symlink traversal - tar: Sicherheitsupdate das behebt ein Symlinkproblem behebt - This security update fixes a directory traversal in tar, -where unpacked symlinks could be followed outside of the -directory where the tar file is unpacked. (CVE-2006-6097) - -This feature was made optional and needs to be enabled with -a commandline option. - - Dieses Sicherheitsupdate behebt ein Problem, wo beim -Entpacken eines TAR Archives dieses durch Symlinks aus dem -aktuellen Verzeichnis ausbrechen konnte. (CVE-2006-6097) - -Das alte obsolete Feature in GNU Tar wurde optional gemacht -und kann für alte TAR Archive mit einer -Kommandozeilenoption angeschaltet werden. - - - - - - security - - - tar - i586 - - 7842746e863cbad136ce916a9720ff5913a5bf66 - - - tar - ppc - - def753a1b7fe65e49653e22ae6d42b329306be53 - - - tar - x86_64 - - 8fe39477a30f01b18d6c1f2b76a61b96f07a8969 - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patches.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patches.xml deleted file mode 100644 index 6d66963..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/patches.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - 6b72b4f3617d0d51af28399c0f5e0af401440245 - - - - b02ba598d8ed5f8a31859d3b34e72e1ddecbe894 - - - - 321ee41de68be4e83dfb74559c14300a59b85ccf - - - - ec9e8a3f3ce2588cecd84ab95ec910d41db5d74b - - - - d803372cd5d844ee01ab6fb3d1b4332391fa1206 - - - - c2de5dd35ec2dcccc118d9d7f539e768dfd5ec50 - - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/primary.xml.gz b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/primary.xml.gz deleted file mode 100644 index d016c87..0000000 Binary files a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/primary.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml deleted file mode 100644 index 2c7e82c..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 23ed066c97c23c557121aaf9c57e5f3f429e4a23 - 1176468240 - 23ed066c97c23c557121aaf9c57e5f3f429e4a23 - - - - 7f83e2e248d8966d119471c58ef41e7a065c9e1a - 1176468292 - b2b013f0426018c6cc9dbb30a06fa2bab0aaeea8 - - - - 73588a1c655a58b2251146675ab64cce8cb45a26 - 1176468284 - 68e66f72b932235eeee5d5638d3cba2ec674c208 - - - - 8a7622d1200067c399e483c4ca19fb382ae1f24e - 1176468286 - 0bc279d4c287dfea715805e349744122f412e3a6 - - diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.asc b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.asc deleted file mode 100644 index db30fb6..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.9.22 (GNU/Linux) - -iD8DBQBGzqIbm+zCtd2wN1YRAslJAJ9eQ+6wpaKRVkr5nrQ4vij6ge0QpgCfRoT2 -clYiEftDMuaEpZeRaBQodyc= -=I83X ------END PGP SIGNATURE----- diff --git a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.key b/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.key deleted file mode 100644 index 8e52028..0000000 --- a/libzypp/tests/repo/yum/data/10.2-updates-subset/repodata/repomd.xml.key +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.6 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -=5nY9 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/filelists.xml.gz b/libzypp/tests/repo/yum/data/extensions/repodata/filelists.xml.gz deleted file mode 100644 index 537e052..0000000 Binary files a/libzypp/tests/repo/yum/data/extensions/repodata/filelists.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/other.xml.gz b/libzypp/tests/repo/yum/data/extensions/repodata/other.xml.gz deleted file mode 100644 index 0ceffee..0000000 Binary files a/libzypp/tests/repo/yum/data/extensions/repodata/other.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/primary.xml.gz b/libzypp/tests/repo/yum/data/extensions/repodata/primary.xml.gz deleted file mode 100644 index 8d34f01..0000000 Binary files a/libzypp/tests/repo/yum/data/extensions/repodata/primary.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml b/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml deleted file mode 100644 index eee1c85..0000000 --- a/libzypp/tests/repo/yum/data/extensions/repodata/repomd.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - obsrepository://build.suse.de/SUSE:openSUSE:11:standard - opensuse - i386 - other string - openSUSE 11.0 - SLE 11.0 - SLE 11.0 - - - - 603807e12e7418911fa9f158ef66b9c20f1df567 - 1215823452 - 34cde52910a161664291bd93e8a9cd24f751af6b - - - - 06660c856facf17822102d09d849d42fad79d28e - 1215823453 - fdabcfd9c056109ab25acf0644823bdec94b6cfd - - - - 2eccb910f933ee28fd5f5223e05eab6c5b08db67 - 1215823454 - c6bd3c6099de74d97ed045163235be10ffa8a85f - - - - - 359396be40992603aecf6e2832839111e09eb080 - 1227279057.0 - b17c055bef95bca397faffdf028cfa91dd1b24bc - - - - - e0b9149c1b7f48c952e9b3ea996669d8d0d9e1e8 - 1227279057.0 - b17c055bef95bca397faffdf028cfa91dd1b24bc - - diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/susedata.xml.gz b/libzypp/tests/repo/yum/data/extensions/repodata/susedata.xml.gz deleted file mode 100644 index 49754c0..0000000 Binary files a/libzypp/tests/repo/yum/data/extensions/repodata/susedata.xml.gz and /dev/null differ diff --git a/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz b/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz deleted file mode 100644 index d2f1474..0000000 Binary files a/libzypp/tests/repo/yum/data/extensions/repodata/suseinfo.xml.gz and /dev/null differ diff --git a/libzypp/tests/sat/CMakeLists.txt b/libzypp/tests/sat/CMakeLists.txt deleted file mode 100644 index 0ec7547..0000000 --- a/libzypp/tests/sat/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ - -# to find the KeyRingTest receiver -INCLUDE_DIRECTORIES( ${LIBZYPP_SOURCE_DIR}/tests/zypp ) - -ADD_TESTS( - IdString - LookupAttr - Pool - Queue - Map - Solvable - SolvParsing - WhatObsoletes - WhatProvides -) diff --git a/libzypp/tests/sat/IdString_test.cc b/libzypp/tests/sat/IdString_test.cc deleted file mode 100644 index 900ff91..0000000 --- a/libzypp/tests/sat/IdString_test.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include "TestSetup.h" -#include - -BOOST_AUTO_TEST_CASE(idstring) -{ - // id 0 ==> NULL - // id 1 ==> "" - // evaluates id in a boolean context - IdString a0( 0 ); - IdString a1( 1 ); - - BOOST_CHECK_EQUAL( a0.id(), 0 ); - BOOST_CHECK_EQUAL( a1.id(), 1 ); - - BOOST_CHECK( !a0 ); - BOOST_CHECK( a1 ); - - BOOST_CHECK( !(a0 == a1) ); - BOOST_CHECK( (a0 != a1) ); - BOOST_CHECK( (a0 < a1) ); - BOOST_CHECK( (a1 > a0) ); - BOOST_CHECK( !(a0 >= a1) ); - BOOST_CHECK( !(a1 <= a0) ); - - BOOST_CHECK_EQUAL( a0.compare( (const char *)0 ), 0 ); - BOOST_CHECK_EQUAL( a0.compare( "" ), -1 ); - BOOST_CHECK_EQUAL( a0.compare( a1 ), -1 ); - - BOOST_CHECK_EQUAL( a1.compare( (const char *)0 ), 1 ); - BOOST_CHECK_EQUAL( a1.compare( "" ), 0 ); - BOOST_CHECK_EQUAL( a1.compare( a0 ), 1 ); -} - -BOOST_AUTO_TEST_CASE(idstringtype) -{ - sat::SolvAttr a0( sat::SolvAttr::allAttr ); - sat::SolvAttr a1( sat::SolvAttr::noAttr ); - - BOOST_CHECK_EQUAL( a0.id(), 0 ); - BOOST_CHECK_EQUAL( a1.id(), 1 ); - - BOOST_CHECK( !a0 ); - BOOST_CHECK( !a1 ); // evaluates empty string (id 0/1) in a boolean context - - BOOST_CHECK( !(a0 == a1) ); - BOOST_CHECK( (a0 != a1) ); - BOOST_CHECK( (a0 < a1) ); - BOOST_CHECK( (a1 > a0) ); - BOOST_CHECK( !(a0 >= a1) ); - BOOST_CHECK( !(a1 <= a0) ); - - BOOST_CHECK_EQUAL( a0.compare( (const char *)0 ), 0 ); - BOOST_CHECK_EQUAL( a0.compare( "" ), -1 ); - BOOST_CHECK_EQUAL( a0.compare( a1 ), -1 ); - - BOOST_CHECK_EQUAL( a1.compare( (const char *)0 ), 1 ); - BOOST_CHECK_EQUAL( a1.compare( "" ), 0 ); - BOOST_CHECK_EQUAL( a1.compare( a0 ), 1 ); -} diff --git a/libzypp/tests/sat/LookupAttr_test.cc b/libzypp/tests/sat/LookupAttr_test.cc deleted file mode 100644 index 936307a..0000000 --- a/libzypp/tests/sat/LookupAttr_test.cc +++ /dev/null @@ -1,229 +0,0 @@ -#include "TestSetup.h" -#include -#include -#include - -static TestSetup test( Arch_x86_64 ); - -// Must be the first test! -BOOST_AUTO_TEST_CASE(bnc_435838) -{ - // empty @system to pool - test.satpool().systemRepo(); - BOOST_REQUIRE( test.satpool().findSystemRepo() ); - - // bnc_435838 crashes if iterating a just created repo. - sat::LookupAttr q( sat::SolvAttr::name ); - for_( it, q.begin(),q.end() ) - ; -} - -BOOST_AUTO_TEST_CASE(LookupAttr_init) -{ - //test.loadTarget(); // initialize and load target - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1" ); - test.loadRepo( TESTS_SRC_DIR "/data/obs_virtualbox_11_1" ); - test.loadRepo( TESTS_SRC_DIR "/data/11.0-update" ); -} - -BOOST_AUTO_TEST_CASE(LookupAttr_defaultconstructed) -{ - sat::LookupAttr q; - BOOST_CHECK( q.empty() ); - BOOST_CHECK( q.size() == 0 ); - BOOST_CHECK_EQUAL( q.begin(), q.end() ); -} - -BOOST_AUTO_TEST_CASE(LookupAttr_nonexistingattr) -{ - sat::LookupAttr q( sat::SolvAttr("nonexistingattr") ); - BOOST_CHECK( q.empty() ); - BOOST_CHECK( q.size() == 0 ); - BOOST_CHECK_EQUAL( q.begin(), q.end() ); -} - -BOOST_AUTO_TEST_CASE(LookupAttr_existingattr) -{ - sat::LookupAttr q( sat::SolvAttr::name ); - BOOST_CHECK( ! q.empty() ); - BOOST_CHECK( q.size() != 0 ); - BOOST_CHECK_NE( q.begin(), q.end() ); -} - -BOOST_AUTO_TEST_CASE(LookupAttr_existingattr_matcher) -{ - sat::LookupAttr q( sat::SolvAttr::name ); - - BOOST_CHECK_THROW( q.setStrMatcher( StrMatcher("[]ypper",Match::REGEX) ), MatchInvalidRegexException ); - BOOST_CHECK( ! q.strMatcher() ); - BOOST_CHECK_NO_THROW( q.setStrMatcher( StrMatcher("[zZ]ypper",Match::REGEX) ) ); - BOOST_CHECK( q.strMatcher() ); - - BOOST_CHECK_EQUAL( q.size(), 9 ); - for_(it,q.begin(),q.end()) - { cout << it << endl;} -} - -BOOST_AUTO_TEST_CASE(LookupAttr_iterate_solvables) -{ - // sat::SolvAttr::name query should visit each solvable once. - // So query size and containersize are to be equal if we query - // pool/repo/solvable. Quick check whether the iterators - // position info matches the result. - - sat::Pool satpool( test.satpool() ); - - { - // iterate all: - sat::LookupAttr q( sat::SolvAttr::name ); - BOOST_CHECK_EQUAL( q.size(), satpool.solvablesSize() ); - // quick test whether iterator positions actually matches the result: - for_( res, q.begin(), q.end() ) - { - BOOST_CHECK_EQUAL( res.inRepo(), res.inSolvable().repository() ); - BOOST_CHECK_EQUAL( res.inSolvAttr(), sat::SolvAttr::name ); - } - } - { - unsigned total = 0; - for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - // iterate one repo: - sat::LookupAttr q( sat::SolvAttr::name, *it ); - BOOST_CHECK_EQUAL( q.size(), it->solvablesSize() ); - total += q.size(); - // test result actually matches the repo: - for_( res, q.begin(), q.end() ) - { - BOOST_CHECK_EQUAL( res.inRepo(), *it ); - BOOST_CHECK_EQUAL( res.inRepo(), res.inSolvable().repository() ); - BOOST_CHECK_EQUAL( res.inSolvAttr(), sat::SolvAttr::name ); - } - } - BOOST_CHECK_EQUAL( total, satpool.solvablesSize() ); - } - { - unsigned total = 0; - for_( it, satpool.solvablesBegin(), satpool.solvablesEnd() ) - { - // iterate one solvable: - sat::LookupAttr q( sat::SolvAttr::name, *it ); - BOOST_CHECK_EQUAL( q.size(), 1 ); - total += q.size(); - // test result actually matches the solvable: - for_( res, q.begin(), q.end() ) - { - BOOST_CHECK_EQUAL( res.inSolvable(), *it ); - BOOST_CHECK_EQUAL( res.inRepo(), res.inSolvable().repository() ); - BOOST_CHECK_EQUAL( res.inSolvAttr(), sat::SolvAttr::name ); - } - } - BOOST_CHECK_EQUAL( total, satpool.solvablesSize() ); - } -} - -BOOST_AUTO_TEST_CASE(LookupAttr_itetate_all_attributes) -{ - sat::Pool satpool( test.satpool() ); - - // iterate all: - sat::LookupAttr all( sat::SolvAttr::allAttr ); - - { - unsigned total = 0; - for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - // iterate one repo: - sat::LookupAttr q( sat::SolvAttr::allAttr, *it ); - total += q.size(); - } - BOOST_CHECK_EQUAL( total, all.size() ); - } - { - unsigned total = 0; - for_( it, satpool.solvablesBegin(), satpool.solvablesEnd() ) - { - // iterate one solvable: - sat::LookupAttr q( sat::SolvAttr::allAttr, *it ); - total += q.size(); - } - BOOST_CHECK_EQUAL( total, all.size() ); - } -} - -BOOST_AUTO_TEST_CASE(LookupAttr_solvable_attribute_substructure) -{ - sat::LookupAttr q( sat::SolvAttr::updateReference ); - BOOST_CHECK_EQUAL( q.size(), 303 ); - - for_( res, q.begin(), q.end() ) - { - BOOST_CHECK( ! res.subEmpty() ); - BOOST_CHECK_EQUAL( res.subSize(), 4 ); - - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::allAttr ), res.subBegin() ); - BOOST_CHECK_EQUAL( res.subFind( "" ), res.subBegin() ); - - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReference ), res.subEnd() ); - BOOST_CHECK_EQUAL( res.subFind( "noval" ), res.subEnd() ); - - BOOST_CHECK_NE( res.subFind( sat::SolvAttr::updateReferenceType ), res.subEnd() ); - BOOST_CHECK_NE( res.subFind( sat::SolvAttr::updateReferenceHref ), res.subEnd() ); - BOOST_CHECK_NE( res.subFind( sat::SolvAttr::updateReferenceId ), res.subEnd() ); - BOOST_CHECK_NE( res.subFind( sat::SolvAttr::updateReferenceTitle ), res.subEnd() ); - - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReferenceType ), res.subFind( "type" ) ); - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReferenceHref ), res.subFind( "href" ) ); - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReferenceId ), res.subFind( "id" ) ); - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReferenceTitle ), res.subFind( "title" ) ); - - // repeatedly calling subBegin() is ok: - BOOST_CHECK_EQUAL( res.subFind( sat::SolvAttr::updateReferenceType ).subBegin(), res.subBegin() ); - } - - // search substructure id without parent-structure works for wellknown structures: - q = sat::LookupAttr( sat::SolvAttr::updateReferenceId ); - BOOST_CHECK_EQUAL( q.size(), 303 ); - - // search id in parent-structure: - q = sat::LookupAttr( sat::SolvAttr::updateReferenceId, sat::SolvAttr::updateReference ); - BOOST_CHECK_EQUAL( q.size(), 303 ); - - // search id in any parent-structure: - q = sat::LookupAttr( sat::SolvAttr::updateReferenceId, sat::SolvAttr::allAttr ); - BOOST_CHECK_EQUAL( q.size(), 303 ); - - // search any id in parent-structure: (4 ids per updateReference) - q = sat::LookupAttr( sat::SolvAttr::allAttr, sat::SolvAttr::updateReference ); - BOOST_CHECK_EQUAL( q.size(), 1212 ); - - // search any id in any parent-structure: - q = sat::LookupAttr( sat::SolvAttr::allAttr, sat::SolvAttr::allAttr ); - BOOST_CHECK_EQUAL( q.size(), 10473 ); -} - -BOOST_AUTO_TEST_CASE(LookupAttr_repoattr) -{ - sat::LookupAttr q( sat::SolvAttr::repositoryAddedFileProvides, sat::LookupAttr::REPO_ATTR ); - BOOST_CHECK( ! q.empty() ); - BOOST_CHECK_EQUAL( q.size(), 264 ); - - sat::LookupRepoAttr p( sat::SolvAttr::repositoryAddedFileProvides ); - BOOST_CHECK( ! p.empty() ); - BOOST_REQUIRE_EQUAL( p.size(), q.size() ); - - sat::LookupRepoAttr::iterator pit( p.begin() ); - for_( qit, q.begin(), q.end() ) - { - BOOST_CHECK_EQUAL( qit, pit ); - ++pit; - } -} - -#if 0 -BOOST_AUTO_TEST_CASE(LookupAttr_) -{ - base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "/tmp/YLOG" ) ); - MIL << "GO" << endl; -} -#endif diff --git a/libzypp/tests/sat/Map_test.cc b/libzypp/tests/sat/Map_test.cc deleted file mode 100644 index a6ec55b..0000000 --- a/libzypp/tests/sat/Map_test.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Easy.h" -#include "zypp/sat/Map.h" - - -#define BOOST_TEST_MODULE Map - -using std::endl; -using std::cout; -using namespace zypp; -using namespace boost::unit_test; - - -BOOST_AUTO_TEST_CASE(basic) -{ - sat::Map m; - BOOST_CHECK_EQUAL( m.empty(), true ); - BOOST_CHECK_EQUAL( m.size(), 0 ); - BOOST_CHECK_EQUAL( m.asString(), "" ); - BOOST_CHECK( m == sat::Map() ); - - m.grow( 8 ); - BOOST_CHECK_EQUAL( m.empty(), false ); - BOOST_CHECK_EQUAL( m.size(), 8 ); - BOOST_CHECK_EQUAL( m.asString(), "00000000" ); - BOOST_CHECK( m != sat::Map() ); - - m.grow( 9 ); - BOOST_CHECK_EQUAL( m.empty(), false ); - BOOST_CHECK_EQUAL( m.size(), 16 ); - BOOST_CHECK_EQUAL( m.asString(), "0000000000000000" ); - - m.grow( 0 ); // no shrink! - BOOST_CHECK_EQUAL( m.size(), 16 ); - - m.setAll(); - BOOST_CHECK_EQUAL( m.asString(), "1111111111111111" ); - - m.clear( 0 ); - m.assign( 3, false ); - BOOST_CHECK_EQUAL( m.asString(), "0110111111111111" ); - BOOST_CHECK_EQUAL( m.test( 0 ), false ); - BOOST_CHECK_EQUAL( m.test( 1 ), true ); - - // COW - m.clearAll(); - sat::Map n(m); - BOOST_CHECK_EQUAL( m.asString(), "0000000000000000" ); - BOOST_CHECK_EQUAL( n.asString(), "0000000000000000" ); - BOOST_CHECK_EQUAL( m, n ); - - m.set( 1 ); - BOOST_CHECK_EQUAL( m.asString(), "0100000000000000" ); - BOOST_CHECK_EQUAL( n.asString(), "0000000000000000" ); - BOOST_CHECK( m != n ); - - n.set( 1 ); - BOOST_CHECK_EQUAL( m.asString(), "0100000000000000" ); - BOOST_CHECK_EQUAL( n.asString(), "0100000000000000" ); - BOOST_CHECK( m == n ); - - - BOOST_CHECK_THROW( m.set( 99 ), std::out_of_range ); -} diff --git a/libzypp/tests/sat/Pool_test.cc b/libzypp/tests/sat/Pool_test.cc deleted file mode 100644 index 119c849..0000000 --- a/libzypp/tests/sat/Pool_test.cc +++ /dev/null @@ -1,93 +0,0 @@ -#include "TestSetup.h" -#include -#include - -static TestSetup test( Arch_x86_64 ); - -namespace zypp { namespace detail { - /** \relates RepositoryIterator Stream output */ - inline std::ostream & operator<<( std::ostream & str, const RepositoryIterator & obj ) - { - str << "RI["<< *obj <<"]"; - return str; - } -}} - -// Must be the first test! -BOOST_AUTO_TEST_CASE(findSystemRepo) -{ - // On the fly check that findSystemRepo does not - // cause loading the SystemRepo. check 2 times. - BOOST_REQUIRE( ! test.satpool().findSystemRepo() ); - BOOST_REQUIRE( ! test.satpool().findSystemRepo() ); -} - -void checkRepoIter() -{ - sat::Pool satpool( test.satpool() ); - sat::Pool::size_type count = satpool.reposSize(); - for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - cout << "- " << count << " " << *it << endl; - BOOST_CHECK( *it ); - --count; - } - BOOST_CHECK_EQUAL( count, 0 ); -} - - -BOOST_AUTO_TEST_CASE(repolist) -{ - // libzypp-11: underlying libsolv changed the pools repository - // pointer list. It may now contain emebeded NULLs which have - // to be skipped when iterating the repos. - // - sat::Pool satpool( test.satpool() ); - BOOST_CHECK( satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 0 ); - checkRepoIter(); - - // empty @system to pool - test.satpool().systemRepo(); - BOOST_REQUIRE( satpool.findSystemRepo() ); - BOOST_CHECK( !satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 1 ); - checkRepoIter(); - - test.loadRepo( TESTS_SRC_DIR "/data/obs_virtualbox_11_1" ); - BOOST_CHECK( !satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 2 ); - checkRepoIter(); - - test.loadRepo( TESTS_SRC_DIR "/data/11.0-update" ); - BOOST_CHECK( !satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 3 ); - checkRepoIter(); - - satpool.reposErase( ":obs_virtualbox_11_1" ); - BOOST_CHECK( !satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 2 ); - checkRepoIter(); - - satpool.reposErase( ":11.0-update" ); - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1" ); - BOOST_CHECK( !satpool.reposEmpty() ); - BOOST_CHECK_EQUAL( satpool.reposSize(), 2 ); - checkRepoIter(); - - - -/* for_( it, satpool.reposBegin(), satpool.reposEnd() ) - { - cout << "- " << *it << endl; - }*/ - //test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1" ); -} - -#if 0 -BOOST_AUTO_TEST_CASE(LookupAttr_) -{ - base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "/tmp/YLOG" ) ); - MIL << "GO" << endl; -} -#endif diff --git a/libzypp/tests/sat/Queue_test.cc b/libzypp/tests/sat/Queue_test.cc deleted file mode 100644 index 72025f1..0000000 --- a/libzypp/tests/sat/Queue_test.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Easy.h" -#include "zypp/sat/Queue.h" - - -#define BOOST_TEST_MODULE Queue - -using std::endl; -using std::cout; -using namespace zypp; -using namespace boost::unit_test; - - -BOOST_AUTO_TEST_CASE(basic) -{ - sat::Queue m; - BOOST_CHECK_EQUAL( m.empty(), true ); - BOOST_CHECK_EQUAL( m.size(), 0 ); - BOOST_CHECK_EQUAL( m.begin(), m.end() ); - BOOST_CHECK( m == sat::Queue() ); - BOOST_CHECK_EQUAL( m.first(), 0 ); - BOOST_CHECK_EQUAL( m.last(), 0 ); - - m.push( 13 ); - BOOST_CHECK_EQUAL( m.empty(), false ); - BOOST_CHECK_EQUAL( m.size(), 1 ); - BOOST_CHECK( m.begin() != m.end() ); - BOOST_CHECK_EQUAL( m.begin()+1, m.end() ); - - BOOST_CHECK_EQUAL( m.first(), 13 ); - BOOST_CHECK_EQUAL( m.last(), 13 ); - BOOST_CHECK_EQUAL( m.at(0), 13 ); - BOOST_CHECK_THROW( m.at(1), std::out_of_range ); - - BOOST_CHECK( m.contains(13) ); - BOOST_CHECK( !m.contains(14) ); - - BOOST_CHECK_EQUAL( m.find(13), m.begin() ); - BOOST_CHECK_EQUAL( m.find(14), m.end() ); - - m.pushUnique( 13 ); - BOOST_CHECK_EQUAL( m.size(), 1 ); - m.push( 13 ); - BOOST_CHECK_EQUAL( m.size(), 2 ); - m.remove( 13 ); - BOOST_CHECK_EQUAL( m.size(), 0 ); -} diff --git a/libzypp/tests/sat/SolvParsing_test.cc b/libzypp/tests/sat/SolvParsing_test.cc deleted file mode 100644 index 721de6f..0000000 --- a/libzypp/tests/sat/SolvParsing_test.cc +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/TmpPath.h" -#include "zypp/RepoManager.h" -#include "zypp/base/Easy.h" -#include "zypp/ZYppFactory.h" -#include "zypp/Package.h" -#include "zypp/sat/Solvable.h" - -// allows us to control signature -// callbacks -#include "KeyRingTestReceiver.h" - -#define BOOST_TEST_MODULE ResObject - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; - - -/* - * this test test that the attributes - * from the metadata are preserved into - * the final object - * - * so the test covers both libsolv-tools - * right insertion and parsing - * and libzypp ResObject and friends data - * extraction from solv files - */ - - -// init the solv -static void init_pool_yum() -{ - Pathname dir(TESTS_SRC_DIR); - dir += "/repo/yum/data/10.2-updates-subset"; - - ZYpp::Ptr z = getZYpp(); - ZConfig::instance().setSystemArchitecture(Arch("i586")); - - filesystem::TmpDir tmp; - RepoManagerOptions opts = RepoManagerOptions::makeTestSetup(tmp.path()); - RepoManager mgr(opts); - - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - - // disable sgnature checking - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - keyring_callbacks.answerAcceptVerFailed(true); - keyring_callbacks.answerAcceptUnknownKey(true); - - RepoInfo info; - info.setAlias("updates"); - info.addBaseUrl(dir.asUrl()); - mgr.buildCache(info); - mgr.loadFromCache(info); -} - -BOOST_AUTO_TEST_CASE(attributes) -{ - init_pool_yum(); - MIL << sat::Pool::instance(); - Repository r = sat::Pool::instance().reposFind("updates"); - - int c = 0; - - for ( Repository::SolvableIterator it = r.solvablesBegin(); - it != r.solvablesEnd(); - ++it ) - { - sat::Solvable s = *it; - //MIL << s.ident() << endl; - if ( s.ident() == "openssl-devel" ) - { - c++; - Package::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - - //solvable 5 (6): - //name: openssl-devel 0.9.8d-17.2 i586 - BOOST_CHECK_EQUAL(p->name(), "openssl-devel"); - //vendor: SUSE LINUX Products GmbH, Nuernberg, Germany - BOOST_CHECK_EQUAL(p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany"); - //solvable:checksum: 9f6a44015ad97680e9f93d0edefa1d533940479c - BOOST_CHECK_EQUAL(p->checksum(), CheckSum::sha1("9f6a44015ad97680e9f93d0edefa1d533940479c")); - //solvable:summary: - BOOST_CHECK_EQUAL(p->summary(), "Include Files and Libraries mandatory for Development."); - //solvable:description: This package contains all necessary include files and libraries needed - //to develop applications that require these. - BOOST_CHECK_EQUAL(p->description(), "This package contains all necessary include files and libraries needed\nto develop applications that require these."); - //solvable:authors: Mark J. Cox - //Ralf S. Engelschall - //Dr. Stephen - //Ben Laurie - //Bodo Moeller - //Ulf Moeller - //Holger Reif - //Paul C. Sutton - //solvable:packager: http://bugs.opensuse.org - //solvable:url: http://www.openssl.org/ - //solvable:buildtime: 1165493634 - //solvable:installsize: 3845 - BOOST_CHECK_EQUAL(p->installSize(), ByteCount(3937193)); - //solvable:downloadsize: 909 - BOOST_CHECK_EQUAL(p->downloadSize(), ByteCount(930588)); - //solvable:mediadir: rpm/i586 - //solvable:mediafile: openssl-devel-0.9.8d-17.2.i586.rpm - //solvable:license: BSD License and BSD-like, Other License(s), see package - //solvable:group: Development/Libraries/C and C++ - BOOST_CHECK_EQUAL(p->group(), "Development/Libraries/C and C++"); - //solvable:sourcearch: src - //solvable:sourceevr: (void) - //solvable:sourcename: openssl - //solvable:headerend: 34861 - - } - } - - // check that we actually found all testeable - // resolvables - BOOST_CHECK_EQUAL(c, 1); - - -} diff --git a/libzypp/tests/sat/Solvable_test.cc b/libzypp/tests/sat/Solvable_test.cc deleted file mode 100644 index f4685ed..0000000 --- a/libzypp/tests/sat/Solvable_test.cc +++ /dev/null @@ -1,212 +0,0 @@ -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Easy.h" -#include "zypp/Pattern.h" -#include "zypp/sat/Solvable.h" -#include "TestSetup.h" - - -#define BOOST_TEST_MODULE Solvable - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; - - -BOOST_AUTO_TEST_CASE(test_init) -{ - TestSetup test( Arch_x86_64 ); - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" ); - test.loadRepo( TESTS_SRC_DIR "/data/11.0-update", "update" ); -} - - -BOOST_AUTO_TEST_CASE(attributes) -{ - MIL << sat::Pool::instance(); - Repository r = sat::Pool::instance().reposFind("opensuse"); - - int c = 0; - - for ( Repository::SolvableIterator it = r.solvablesBegin(); - it != r.solvablesEnd(); - ++it ) - { - sat::Solvable s = *it; - //MIL << s.ident() << endl; - if ( s.ident() == "pattern:apparmor" ) - { - c++; - - // solvable 21795 (21796): - // name: pattern:apparmor 11.0-67 i586 - // vendor: SUSE LINUX Products GmbH, Nuernberg, Germany - // provides: - // pattern:apparmor = 11.0-67 - // requires: - // pattern:basesystem - // apparmor-parser - // audit - // apparmor-profiles - // recommends: - // yast2-apparmor - // apparmor-utils - // pattern:apparmor_opt - // solvable:category: Base Technologies - // solvable:icon: yast-software - // solvable:summary: Novell AppArmor - // solvable:description: Novell AppArmor is an application security framework that provides mandatory access control for programs. It protects from exploitation of software flaws and compromised systems. It offers an advanced tool set that automates the development of per-program application security without requiring additional knowledge. - // solvable:isvisible: 1 - // solvable:order: 1030 - Pattern::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - BOOST_CHECK_EQUAL(p->name(), "apparmor"); - BOOST_CHECK_EQUAL(p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany"); - BOOST_CHECK_EQUAL(p->category(), "Base Technologies"); - BOOST_CHECK_EQUAL(p->summary(), "Novell AppArmor"); - BOOST_CHECK_EQUAL(p->icon(), "pattern-apparmor"); - BOOST_CHECK_EQUAL(p->userVisible(), true); - BOOST_CHECK_EQUAL(p->isDefault(), false); - } - if ( s.ident() == "pattern:default" ) - { - c++; - Pattern::Ptr p = asKind(makeResObject(s)); - BOOST_CHECK(p); - BOOST_CHECK_EQUAL(p->userVisible(), false); - } - } - - // check that we actually found all testeable - // resolvables - BOOST_CHECK_EQUAL(c, 2); -} - -BOOST_AUTO_TEST_CASE(asStringTest) -{ - BOOST_CHECK_EQUAL( sat::Solvable(0).asString(), "noSolvable" ); - BOOST_CHECK_EQUAL( sat::Solvable(1).asString(), "systemSolvable" ); - BOOST_CHECK_EQUAL( sat::Solvable(2).asString(), "product:openSUSE-11.1.x86_64" ); - BOOST_CHECK_EQUAL( sat::Solvable(3693).asString(), "autoyast2-2.16.19-0.1.src" ); - BOOST_CHECK_EQUAL( sat::Solvable(19222).asString(), "noSolvable" ); -#if 0 - Repository r = sat::Pool::instance().reposFind("update"); - for_( it, r.solvablesBegin(), r.solvablesEnd() ) - { - BOOST_CHECK_EQUAL( (*it).asString(), str::numstring((*it).id()) ); - } -#endif -} - -BOOST_AUTO_TEST_CASE(SplitIdent) -{ - sat::Solvable::SplitIdent split; - BOOST_CHECK_EQUAL( split.ident(), IdString() ); - BOOST_CHECK_EQUAL( split.kind(), ResKind() ); - BOOST_CHECK_EQUAL( split.name(), IdString() ); - - // - kind defaults to package - // - package and srcpackage have NO namespaced ident. - - split = sat::Solvable::SplitIdent( "foo" ); - BOOST_CHECK_EQUAL( split.ident(), "foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "foo" ); - - split = sat::Solvable::SplitIdent( "nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( "package:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::pattern ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( "srcpackage:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); // !!! - BOOST_CHECK_EQUAL( split.kind(), ResKind::srcpackage ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - // now split from kind,name - // - kind spec in name wins! - - split = sat::Solvable::SplitIdent( ResKind::package, "nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::pattern, "nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::pattern ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::srcpackage, "nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::srcpackage ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::package, "package:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::pattern, "package:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::srcpackage, "package:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::package ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::package, "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::pattern ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::pattern, "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::pattern ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::srcpackage, "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "pattern:nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::pattern ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::package, "srcpackage:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::srcpackage ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::pattern, "srcpackage:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::srcpackage ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - - split = sat::Solvable::SplitIdent( ResKind::srcpackage, "srcpackage:nokind:foo" ); - BOOST_CHECK_EQUAL( split.ident(), "nokind:foo" ); - BOOST_CHECK_EQUAL( split.kind(), ResKind::srcpackage ); - BOOST_CHECK_EQUAL( split.name(), "nokind:foo" ); - -} - -BOOST_AUTO_TEST_CASE(duData) -{ - DiskUsageCounter ducounter( DiskUsageCounter::justRootPartition() ); - - sat::Solvable s = *sat::WhatProvides( Capability("glibc-devel.x86_64 == 2.8.90-2.3") ).begin(); - BOOST_CHECK_EQUAL( (*ducounter.disk_usage( s ).begin()).pkg_size, 30629 ); -} diff --git a/libzypp/tests/sat/WhatObsoletes_test.cc b/libzypp/tests/sat/WhatObsoletes_test.cc deleted file mode 100644 index f9dff54..0000000 --- a/libzypp/tests/sat/WhatObsoletes_test.cc +++ /dev/null @@ -1,35 +0,0 @@ -#include "TestSetup.h" -#include - -namespace zypp -{ - namespace sat - { - // Obsoletes may either match against provides, or names. - // Configuration depends on the behaviour of rpm. - extern bool obsoleteUsesProvides; - } -} - -BOOST_AUTO_TEST_CASE(WhatObsoletes) -{ - TestSetup test( Arch_x86_64 ); - test.loadTestcaseRepos( TESTS_SRC_DIR"/data/TCWhatObsoletes" ); - - sat::Solvable test1( 2 ); - BOOST_REQUIRE_EQUAL( test1.name(), "test1" ); - - { - sat::obsoleteUsesProvides = true; - sat::WhatObsoletes w( test1 ); - BOOST_REQUIRE( w.size() == 2 ); - // (3)goaway-1-1.i586(@System) - // (5)meetoo-1-1.i586(@System) - } - { - sat::obsoleteUsesProvides = false; - sat::WhatObsoletes w( test1 ); - BOOST_REQUIRE( w.size() == 1 ); - // (3)goaway-1-1.i586(@System) - } -} \ No newline at end of file diff --git a/libzypp/tests/sat/WhatProvides_test.cc b/libzypp/tests/sat/WhatProvides_test.cc deleted file mode 100644 index 090cfa5..0000000 --- a/libzypp/tests/sat/WhatProvides_test.cc +++ /dev/null @@ -1,62 +0,0 @@ -#include "TestSetup.h" - -BOOST_AUTO_TEST_CASE(WhatProvides) -{ - TestSetup test( Arch_x86_64 ); - test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" ); - - { - sat::WhatProvides q( Capability("zypper") ); - BOOST_CHECK( ! q.empty() ); - BOOST_CHECK( q.size() == 1 ); - } - - { - sat::WhatProvides q( Capability("zypper.x86_64 == 0.12.5-1.1") ); - BOOST_CHECK( ! q.empty() ); - BOOST_CHECK( q.size() == 1 ); - } - - { - sat::WhatProvides q( Capability("zypper.i586 == 0.12.5-1.1") ); - BOOST_CHECK( q.empty() ); - BOOST_CHECK( q.size() == 0 ); - } - - { - // sat::WhatProvides::const_iterator requires proper - // copyctor and assignment. If they break - sat::WhatProvides q; - BOOST_CHECK( q.begin() == q.begin() ); - BOOST_CHECK( q.begin() == q.end() ); - - q = sat::WhatProvides( Capability("zypper.x86_64 == 0.12.5-1.1") ); - // q no longer empty - BOOST_CHECK( q.begin() == q.begin() ); - BOOST_CHECK( q.begin() != q.end() ); - - sat::WhatProvides::const_iterator a; - BOOST_CHECK( a == q.end() ); - - sat::WhatProvides::const_iterator b( q.begin() ); - BOOST_CHECK( b == q.begin() ); - -// SEC << LABELED(q.begin()) << endl; -// SEC << LABELED(q.end()) << endl; -// SEC << LABELED(a) << endl; -// SEC << LABELED(b) << endl; - - { - a = q.begin(); - BOOST_CHECK( a == q.begin() ); -// SEC << LABELED(a) << endl; -// SEC << LABELED(b) << endl; - - a = b; - BOOST_CHECK( a == b ); -// SEC << LABELED(a) << endl; -// SEC << LABELED(b) << endl; - } - BOOST_CHECK( a == q.begin() ); - } -} diff --git a/libzypp/tests/zypp/Arch_test.cc b/libzypp/tests/zypp/Arch_test.cc deleted file mode 100644 index db6c738..0000000 --- a/libzypp/tests/zypp/Arch_test.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Arch.cc -// -// tests for Arch -// - -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/Arch.h" - -// Boost.Test -#include -#include - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using boost::test_tools::close_at_tolerance; - -using namespace std; -using namespace zypp; - -/****************************************************************** -** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -** -** DESCRIPTION : -*/ -BOOST_AUTO_TEST_CASE(arch_test) -{ - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - BOOST_REQUIRE( Arch() == Arch_noarch ); - BOOST_REQUIRE( Arch("") == Arch_empty ); - BOOST_REQUIRE( ! Arch_noarch.empty() ); - BOOST_REQUIRE( Arch_empty.empty() ); - BOOST_REQUIRE( Arch_noarch.isBuiltIn() ); - BOOST_REQUIRE( ! Arch_empty.isBuiltIn() ); - BOOST_REQUIRE( Arch_empty != Arch_noarch ); - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - BOOST_CHECK_EQUAL( Arch("i386"), Arch_i386 ); - BOOST_CHECK_EQUAL( Arch("i386").idStr(), "i386" ); - BOOST_CHECK_EQUAL( Arch("i386").asString(), "i386" ); - BOOST_REQUIRE( Arch_i386.isBuiltIn() ); - - BOOST_CHECK_EQUAL( Arch("FOO").idStr(), "FOO" ); - BOOST_CHECK_EQUAL( Arch("FOO").asString(), "FOO" ); - BOOST_REQUIRE( ! Arch("FOO").isBuiltIn() ); - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - BOOST_REQUIRE( Arch_noarch.compatibleWith( Arch_noarch ) ); - BOOST_REQUIRE( Arch_noarch.compatibleWith( Arch_i386 ) ); - BOOST_REQUIRE( Arch_noarch.compatibleWith( Arch_x86_64 ) ); - - BOOST_REQUIRE( ! Arch_i386.compatibleWith( Arch_noarch ) ); - BOOST_REQUIRE( Arch_i386.compatibleWith( Arch_i386 ) ); - BOOST_REQUIRE( Arch_i386.compatibleWith( Arch_x86_64 ) ); - - BOOST_REQUIRE( ! Arch_x86_64.compatibleWith( Arch_noarch ) ); - BOOST_REQUIRE( ! Arch_x86_64.compatibleWith( Arch_i386 ) ); - BOOST_REQUIRE( Arch_x86_64.compatibleWith( Arch_x86_64 ) ); - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - BOOST_CHECK_EQUAL( Arch::baseArch( Arch_x86_64 ), Arch_x86_64 ); - BOOST_CHECK_EQUAL( Arch::baseArch( Arch_i686 ), Arch_i386 ); - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - BOOST_REQUIRE( Arch_i386.compare( Arch_noarch ) > 0 ); - BOOST_REQUIRE( Arch_i386.compare( Arch_i386 ) == 0 ); - BOOST_REQUIRE( Arch_i386.compare( Arch_x86_64 ) < 0 ); -} diff --git a/libzypp/tests/zypp/CMakeLists.txt b/libzypp/tests/zypp/CMakeLists.txt deleted file mode 100644 index acafee6..0000000 --- a/libzypp/tests/zypp/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -ADD_SUBDIRECTORY(base) - -# set the vendor.d paths correctly for the tests -SET(VENDOR_D "${LIBZYPP_SOURCE_DIR}/tests/zypp/data/Vendor/vendors.d") -FILE(MAKE_DIRECTORY "${LIBZYPP_BINARY_DIR}/tests/zypp/data/Vendor") -CONFIGURE_FILE(${LIBZYPP_SOURCE_DIR}/tests/zypp/data/Vendor/zypp2.conf.cmake ${LIBZYPP_BINARY_DIR}/tests/zypp/data/Vendor/zypp2.conf @ONLY) - -ADD_TESTS( - Arch - Capabilities - CheckSum - ContentType - CpeId - Date - Dup - Digest - Deltarpm - Edition - Fetcher - FileChecker - Flags - InstanceId - KeyRing - Locks - MediaSetAccess - PathInfo - Pathname - PluginFrame - PoolQuery - ProgressData - PtrTypes - PublicKey - RWPtr - RepoInfo - RepoManager - RepoStatus - ResKind - ResStatus - Selectable - SetRelationMixin - StrMatcher - Target - Url - Vendor - Vendor2 -) - diff --git a/libzypp/tests/zypp/Capabilities_test.cc b/libzypp/tests/zypp/Capabilities_test.cc deleted file mode 100644 index 0434fa9..0000000 --- a/libzypp/tests/zypp/Capabilities_test.cc +++ /dev/null @@ -1,188 +0,0 @@ -// Capabilities.cc -// -// tests for Capabilities -// -#include -#include - -// Boost.Test -#include -#include - -#include "TestSetup.h" -#include "zypp/Arch.h" -#include "zypp/Capability.h" -#include "zypp/Capabilities.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using boost::test_tools::close_at_tolerance; - -using namespace std; -using namespace zypp; - -static TestSetup test( Arch_x86_64 ); - -BOOST_AUTO_TEST_CASE(capabilities_test) -{ - ////////////////////////////////////////////////////////////////////// - // Id 0 and 1 are nor equal, but share the same representation ""/NOCAP - ////////////////////////////////////////////////////////////////////// - - Capability c0( 0 ); // id 0 - Capability c1( 1 ); // id 1 - Capability cD; // default constructed empty - Capability cE( "" ); // empty - - BOOST_CHECK_EQUAL( c0.id(), 0 ); - BOOST_CHECK_EQUAL( c1.id(), 1 ); - BOOST_CHECK_EQUAL( Capability().id(), 1 ); // default constructed empty - BOOST_CHECK_EQUAL( Capability("").id(), 1 ); // empty - - BOOST_CHECK_EQUAL( c0.asString(), "" ); - BOOST_CHECK_EQUAL( c1.asString(), "" ); - - BOOST_CHECK_EQUAL( c0.empty(), true ); - BOOST_CHECK_EQUAL( c1.empty(), true ); - - BOOST_CHECK_EQUAL( c0.detail().kind(), CapDetail::NOCAP ); - BOOST_CHECK_EQUAL( c1.detail().kind(), CapDetail::NOCAP ); - - BOOST_CHECK_EQUAL( ( c0 == c1 ), false ); - BOOST_CHECK_EQUAL( Capability::matches( c0, c1 ), CapMatch::yes ); - - ////////////////////////////////////////////////////////////////////// - // skipping internal marker in Capabilities - ////////////////////////////////////////////////////////////////////// - - Capability r( "req" ); - Capability p( "prereq" ); - - sat::detail::IdType caps[10]; - caps[0] = r.id(); - caps[1] = sat::detail::solvablePrereqMarker; - caps[2] = p.id(); - caps[3] = 0; - - // Capabilities with and without prereq (skip marker in ++) - Capabilities c( caps ); - //cout << c << endl; - BOOST_CHECK_EQUAL( c.size(), 2 ); - Capabilities::const_iterator it( c.begin() ); - BOOST_CHECK_EQUAL( *it, r ); - BOOST_CHECK_EQUAL( it.tagged(), false ); - ++it; - BOOST_CHECK_EQUAL( *it, p ); - BOOST_CHECK_EQUAL( it.tagged(), true ); - - // Capabilities with prereq only (skip marker in ctor) - c = Capabilities( caps+1 ); - //cout << c << endl; - BOOST_CHECK_EQUAL( c.size(), 1 ); - it = c.begin(); - BOOST_CHECK_EQUAL( *it, p ); - BOOST_CHECK_EQUAL( it.tagged(), true ); - - - ////////////////////////////////////////////////////////////////////// - // - ////////////////////////////////////////////////////////////////////// - Capability n( "na.me" ); - Capability na( "na.me.i386" ); - Capability noe( "na.me == 1" ); - Capability naoe( "na.me.i386 == 1" ); - - BOOST_CHECK_EQUAL( n.detail().kind(), CapDetail::NAMED ); - BOOST_CHECK_EQUAL( na.detail().kind(), CapDetail::NAMED ); - BOOST_CHECK_EQUAL( noe.detail().kind(), CapDetail::VERSIONED ); - BOOST_CHECK_EQUAL( naoe.detail().kind(), CapDetail::VERSIONED ); - - BOOST_CHECK_EQUAL( n.detail().hasArch(), false ); - BOOST_CHECK_EQUAL( na.detail().hasArch(), true ); - BOOST_CHECK_EQUAL( noe.detail().hasArch(), false ); - BOOST_CHECK_EQUAL( naoe.detail().hasArch(), true ); - - BOOST_CHECK ( n.detail().arch().empty() ); - BOOST_CHECK_EQUAL( na.detail().arch(), Arch_i386.idStr() ); - BOOST_CHECK ( noe.detail().arch().empty() ); - BOOST_CHECK_EQUAL( naoe.detail().arch(), Arch_i386.idStr() ); - - BOOST_CHECK_EQUAL( Capability( "", "na.me", "", "" ), n ); - BOOST_CHECK_EQUAL( Capability( "i386", "na.me", "", "" ), na ); - BOOST_CHECK_EQUAL( Capability( "", "na.me", "==", "1" ), noe ); - BOOST_CHECK_EQUAL( Capability( "i386", "na.me", "==", "1" ), naoe ); - - // explicit arch - BOOST_CHECK_EQUAL( Capability( Arch_i386, "na.me" ), na ); - BOOST_CHECK_EQUAL( Capability( Arch_i386, "na.me == 1" ), naoe ); -} - -BOOST_AUTO_TEST_CASE(guessPackageSpec) -{ - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "" ), Capability( "", "", "", "" ) ); - - // Remember: 'name OP ver-rel': name may match provides - // 'name-ver-rel': name may match package names only - - // With no libzypp in the pool, no guess should succeed: - BOOST_REQUIRE( sat::WhatProvides(Capability("libzypp")).empty() ); - - // these must be guessed - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp-1-2" ), Capability( "", "libzypp-1-2", "", "" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp-1-2.i586" ), Capability( "i586", "libzypp-1-2", "", "" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp.i586-1-2" ), Capability( "", "libzypp.i586-1-2", "", "" ) ); - // these are unambiguous - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "patch:swmgmt=12" ), Capability( "", "swmgmt", "=", "12", ResKind::patch ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp=0:1.0.2-2" ), Capability( "", "libzypp", "=", "0:1.0.2-2" ) ); - - // now load some repo providing libzypp and see how the guessing changes: - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" ); - BOOST_REQUIRE( ! sat::WhatProvides(Capability("libzypp")).empty() ); - - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp-1-2" ), Capability( "", "libzypp", "=", "1-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp-1-2.i586" ), Capability( "i586", "libzypp", "=", "1-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp.i586-1-2" ), Capability( "i586", "libzypp", "=", "1-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp<=1.0.2-2" ), Capability( "", "libzypp", "<=", "1.0.2-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp<=1:1.0.2-2" ), Capability( "", "libzypp", "<=", "1:1.0.2-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp-0:1.0.2-2" ), Capability( "", "libzypp", "=", "0:1.0.2-2" ) ); - - // now with yast2-packagemanager which is just a provides. Guess must not lead to libzypp. - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "yast2-packagemanager-1-2" ), Capability( "", "yast2-packagemanager-1-2", "", "" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "yast2-packagemanager-1-2.i586" ), Capability( "i586", "yast2-packagemanager-1-2", "", "" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "yast2-packagemanager.i586-1-2" ), Capability( "", "yast2-packagemanager.i586-1-2","", "" ) ); - // these are unambiguous - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "yast2-packagemanager<=1.0.2-2" ), Capability( "", "yast2-packagemanager", "<=", "1.0.2-2" ) ); - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "yast2-packagemanager<=1:1.0.2-2" ), Capability( "", "yast2-packagemanager", "<=", "1:1.0.2-2" ) ); - - - // Double arch spec: the trailing one succeeds, the other one gets part of the name. - // As "libzypp.i586' is not in the pool, guessing fails. Result is a named cap. - BOOST_CHECK_EQUAL( Capability::guessPackageSpec( "libzypp.i586-1-2.ppc" ), - Capability( "ppc", "libzypp.i586-1-2", "", "" ) ); - - // Now check prepended kind specs. - - Capability cap( "package:libzypp=1-2" ); - BOOST_CHECK_EQUAL( cap, Capability( "", "libzypp", "=", "1-2", ResKind::package ) ); - BOOST_CHECK_EQUAL( cap, Capability( "", "package:libzypp", "=", "1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability( "", "package:libzypp", "=", "1-2", ResKind::pattern ) ); // known name prefix wins - // 'package:' is the default - BOOST_CHECK_EQUAL( cap, Capability( "libzypp=1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability( "", "libzypp", "=", "1-2" ) ); - - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "package:libzypp-1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "package:libzypp=1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "libzypp-1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "libzypp=1-2" ) ); - - - cap = Capability( "pattern:32bit=1-2" ); - BOOST_CHECK_EQUAL( cap, Capability( "", "32bit", "=", "1-2", ResKind::pattern ) ); - BOOST_CHECK_EQUAL( cap, Capability( "", "pattern:32bit", "=", "1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability( "", "pattern:32bit", "=", "1-2", ResKind::package ) ); // known name prefix wins - - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "pattern:32bit-1-2" ) ); - BOOST_CHECK_EQUAL( cap, Capability::guessPackageSpec( "pattern:32bit=1-2" ) ); -} - - diff --git a/libzypp/tests/zypp/CheckSum_test.cc b/libzypp/tests/zypp/CheckSum_test.cc deleted file mode 100644 index d875e61..0000000 --- a/libzypp/tests/zypp/CheckSum_test.cc +++ /dev/null @@ -1,25 +0,0 @@ - -#include -#include -#include - -// Boost.Test -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ZYpp.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; - - -// most frequently you implement test cases as a free functions -BOOST_AUTO_TEST_CASE(checksum_test) -{ - BOOST_CHECK_THROW( CheckSum( "sha1", "dsdsads" ), Exception ); // wrong size - BOOST_CHECK_THROW( CheckSum( "sha256", "dsdsads" ), Exception ); // wrong size - BOOST_CHECK_THROW( CheckSum( "md5", "dsdsads" ), Exception ); // wrong size -} diff --git a/libzypp/tests/zypp/ContentType_test.cc b/libzypp/tests/zypp/ContentType_test.cc deleted file mode 100644 index 6d7cbcb..0000000 --- a/libzypp/tests/zypp/ContentType_test.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include -#include "zypp/ContentType.h" - -using std::cout; -using std::endl; - -using zypp::ContentType; - -BOOST_AUTO_TEST_CASE(contenttype_default) -{ - ContentType v; - BOOST_CHECK( !v ); - BOOST_CHECK( v.empty() ); - BOOST_CHECK( v.emptyType() ); - BOOST_CHECK( v.emptySubtype() ); - - ContentType w( "/" ); - BOOST_CHECK_EQUAL( v == w, true ); - BOOST_CHECK_EQUAL( v != w, false ); - BOOST_CHECK_EQUAL( v < w, false ); - BOOST_CHECK_EQUAL( v <= w, true ); - BOOST_CHECK_EQUAL( v > w, false ); - BOOST_CHECK_EQUAL( v >= w, true ); - - BOOST_CHECK_EQUAL( v.asString(), "" ); -} - -BOOST_AUTO_TEST_CASE(contenttype_val) -{ - BOOST_CHECK_THROW( ContentType( " " ), std::invalid_argument ); - - BOOST_CHECK_THROW( ContentType( "//" ), std::invalid_argument ); - BOOST_CHECK_THROW( ContentType( "/ " ), std::invalid_argument ); - - BOOST_CHECK_THROW( ContentType( "/", "a" ), std::invalid_argument ); - BOOST_CHECK_THROW( ContentType( "a", "/" ), std::invalid_argument ); - - BOOST_CHECK_THROW( ContentType( " ", "a" ), std::invalid_argument ); - BOOST_CHECK_THROW( ContentType( "a", " " ), std::invalid_argument ); -} - -BOOST_AUTO_TEST_CASE(contenttype_cmp) -{ - std::set c( { - ContentType( "" ), - ContentType( "/" ), // == "" - ContentType( "a" ), - ContentType( "a/" ), // == "a" - ContentType( "/a" ), - ContentType( "" , "a" ), // == "/a" - ContentType( "a/b" ), - ContentType( "b/b" ), - ContentType( "b/c" ) - }); - - std::set::const_iterator i = c.begin(); - BOOST_CHECK_EQUAL( *(i++), ContentType() ); - BOOST_CHECK_EQUAL( *(i++), ContentType( "", "a" ) ); - BOOST_CHECK_EQUAL( *(i++), ContentType( "a", "" ) ); - BOOST_CHECK_EQUAL( *(i++), ContentType( "a", "b" ) ); - BOOST_CHECK_EQUAL( *(i++), ContentType( "b", "b" ) ); - BOOST_CHECK_EQUAL( *(i++), ContentType( "b", "c" ) ); - BOOST_CHECK( i == c.end() ); -} diff --git a/libzypp/tests/zypp/CpeId_test.cc b/libzypp/tests/zypp/CpeId_test.cc deleted file mode 100644 index 2322b49..0000000 --- a/libzypp/tests/zypp/CpeId_test.cc +++ /dev/null @@ -1,452 +0,0 @@ -#include -#include -#include "zypp/CpeId.h" - -using std::cout; -using std::endl; - -using zypp::SetCompare; -using zypp::SetRelation; -using zypp::CpeId; -typedef CpeId::Value Value; - -/////////////////////////////////////////////////////////////////// -/// Symmetric attribute compare if wildcards are involved! -/// The specs define any comarison with a wildcarded attribute as -/// target to return \c uncomparable: -/// \code -/// wildcardfree <=> wildcarded ==> uncomparable, -/// wildcarded <=> wildcardfree ==> superset or disjoint -/// \endcode -/// But a symmetric result is much more intuitive: -/// \code -/// wildcardfree <=> wildcarded ==> subset or disjoint -/// wildcarded <=> wildcardfree ==> superset or disjoint -/// \endcode -/////////////////////////////////////////////////////////////////// -#define WFN_STRICT_SPEC 0 - -#define defVALUE(N,S) \ - const std::string N##Str( S ); \ - Value N( N##Str ); - -defVALUE( wildcardfree, "STrv\\*al\\?" ); // '\?' quoted? -const std::string wildcardfreeUri( "STrv%2aal%3f" ); -const std::string wildcardfreeFs( "STrv\\*al\\?" ); - -defVALUE( wildcardfree2, "stRV\\*al\\\\\\?" ); // '\\\?' backslash, quoted? - -defVALUE( wildcarded, "strv\\*AL?" ); // '?' ? -const std::string wildcardedUri( "strv%2aAL%01" ); -const std::string wildcardedFs( "strv\\*AL?" ); - -defVALUE( wildcarded2, "strv\\*AL\\\\?" ); // '\\?' backslash, ? - - - -BOOST_AUTO_TEST_CASE(cpeid_value_ANY) -{ - for ( const auto & c : { Value(), Value(nullptr), Value("*"), Value::ANY } ) - { - BOOST_CHECK( c.isANY() ); - BOOST_CHECK( ! c.isNA() ); - BOOST_CHECK( c.isLogical() ); - BOOST_CHECK( ! c.isString() ); - BOOST_CHECK( c == Value::ANY ); - BOOST_CHECK( c == nullptr ); // ANY - BOOST_CHECK( c != Value::NA ); - BOOST_CHECK( c != wildcardfree ); - BOOST_CHECK( c != wildcarded ); - BOOST_CHECK( ! c.isWildcardfree() ); - BOOST_CHECK( ! c.isWildcarded() ); - BOOST_CHECK_EQUAL( c.asFs(), "*" ); - BOOST_CHECK_EQUAL( c.asUri(), "" ); - BOOST_CHECK_EQUAL( c.asWfn(), "*" ); - BOOST_CHECK_EQUAL( c.asString(), c.asWfn() ); - } -} - -BOOST_AUTO_TEST_CASE(cpeid_value_NA) -{ - for ( const auto & c : { Value(""), Value::NA } ) - { - BOOST_CHECK( ! c.isANY() ); - BOOST_CHECK( c.isNA() ); - BOOST_CHECK( c.isLogical() ); - BOOST_CHECK( ! c.isString() ); - BOOST_CHECK( c != Value::ANY ); - BOOST_CHECK( c == Value::NA ); - BOOST_CHECK( c == std::string() ); // NA - BOOST_CHECK( c == "" ); // NA - BOOST_CHECK( c != wildcardfree ); - BOOST_CHECK( c != wildcarded ); - BOOST_CHECK( ! c.isWildcardfree() ); - BOOST_CHECK( ! c.isWildcarded() ); - BOOST_CHECK_EQUAL( c.asFs(), "-" ); - BOOST_CHECK_EQUAL( c.asUri(), "-" ); - BOOST_CHECK_EQUAL( c.asWfn(), "" ); - BOOST_CHECK_EQUAL( c.asString(), c.asWfn() ); - } -} - -BOOST_AUTO_TEST_CASE(cpeid_value_string_wildcardfree) -{ - for ( const auto & c : { wildcardfree } ) - { - BOOST_CHECK( ! c.isANY() ); - BOOST_CHECK( ! c.isNA() ); - BOOST_CHECK( ! c.isLogical() ); - BOOST_CHECK( c.isString() ); - BOOST_CHECK( c != Value::ANY ); - BOOST_CHECK( c != Value::NA ); - BOOST_CHECK( c == wildcardfree ); - BOOST_CHECK( c == wildcardfreeStr ); - BOOST_CHECK( c == wildcardfreeStr.c_str() ); - BOOST_CHECK( c != wildcarded ); - BOOST_CHECK( c.isWildcardfree() ); - BOOST_CHECK( ! c.isWildcarded() ); - BOOST_CHECK_EQUAL( c.asFs(), wildcardfreeFs ); - BOOST_CHECK_EQUAL( c.asUri(), wildcardfreeUri ); - BOOST_CHECK_EQUAL( c.asWfn(), wildcardfreeStr ); - BOOST_CHECK_EQUAL( c.asString(), c.asWfn() ); - } - - BOOST_CHECK( wildcardfree2 == wildcardfree2 ); - BOOST_CHECK( wildcardfree2 != wildcardfree ); - BOOST_CHECK( wildcardfree2 != wildcarded ); - BOOST_CHECK( wildcardfree2.isWildcardfree() ); - BOOST_CHECK( ! wildcardfree2.isWildcarded() ); -} - -BOOST_AUTO_TEST_CASE(cpeid_value_string_wildcarded) -{ - for ( const auto & c : { wildcarded } ) - { - BOOST_CHECK( ! c.isANY() ); - BOOST_CHECK( ! c.isNA() ); - BOOST_CHECK( ! c.isLogical() ); - BOOST_CHECK( c.isString() ); - BOOST_CHECK( c != Value::ANY ); - BOOST_CHECK( c != Value::NA ); - BOOST_CHECK( c != wildcardfree ); -#if WFN_STRICT_SPEC - BOOST_CHECK( c != wildcarded ); // !!! According to the CPE Name Matching Specification Version 2.3 - // unquoted wildcard characters yield an undefined result (not ==). -#else - BOOST_CHECK( c == wildcarded ); -#endif - BOOST_CHECK( ! c.isWildcardfree() ); - BOOST_CHECK( c.isWildcarded() ); - BOOST_CHECK_EQUAL( c.asFs(), wildcardedFs ); - BOOST_CHECK_EQUAL( c.asUri(), wildcardedUri ); - BOOST_CHECK_EQUAL( c.asWfn(), wildcardedStr ); - BOOST_CHECK_EQUAL( c.asString(), c.asWfn() ); - } - -#if WFN_STRICT_SPEC - BOOST_CHECK( wildcarded2 != wildcarded2 ); // unquoted wildcard characters yield an undefined result (not ==). -#else - BOOST_CHECK( wildcarded2 == wildcarded2 ); -#endif - BOOST_CHECK( wildcarded2 != wildcardfree ); - BOOST_CHECK( wildcarded2 != wildcarded ); - BOOST_CHECK( ! wildcarded2.isWildcardfree() ); - BOOST_CHECK( wildcarded2.isWildcarded() ); - - -} - -BOOST_AUTO_TEST_CASE(cpeid_value_valid) -{ - static const char *const hdig = "0123456789abcdef"; - - for ( char ch = 0; ch < CHAR_MAX; ++ch ) - { - // cout << "==== " << unsigned(ch) << endl; - char qchstr[] = { '\\', ch, '\0' }; - std::string chstr( qchstr+1 ); - char pchstr[] = { '%', hdig[(unsigned char)(ch)/16], hdig[(unsigned char)(ch)%16], '\0' }; - - if ( ch == '\0' ) - { - BOOST_CHECK( Value( chstr ).isNA() ); - BOOST_CHECK_THROW( (Value( chstr, Value::fsFormat )), std::invalid_argument ); - BOOST_CHECK( Value( chstr, Value::uriFormat ).isANY() ); - } - else if ( ch <= ' ' || '~' < ch ) - { - BOOST_CHECK_THROW( (Value( chstr )), std::invalid_argument ); - BOOST_CHECK_THROW( (Value( chstr, Value::fsFormat )), std::invalid_argument ); - BOOST_CHECK_THROW( (Value( chstr, Value::uriFormat )), std::invalid_argument ); - } - else if ( ( '0' <= ch && ch <= '9' ) - || ( 'A' <= ch && ch <= 'Z' ) - || ( 'a' <= ch && ch <= 'z' ) - || ch == '_' ) - { - BOOST_CHECK( Value( chstr ).isString() ); - BOOST_CHECK( Value( chstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( chstr, Value::uriFormat ).isString() ); - - BOOST_CHECK_THROW( (Value( qchstr )), std::invalid_argument ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - else if ( ch == '*' ) - { - BOOST_CHECK( Value( chstr ).isANY() ); - BOOST_CHECK( Value( chstr, Value::fsFormat ).isANY() ); - BOOST_CHECK( Value( chstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( qchstr ).isString() ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - else if ( ch == '?' ) - { - BOOST_CHECK( Value( chstr ).isString() ); - BOOST_CHECK( Value( chstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( chstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( qchstr ).isString() ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - else if ( ch == '-' ) - { - BOOST_CHECK_THROW( (Value( chstr )), std::invalid_argument ); - BOOST_CHECK( Value( chstr, Value::fsFormat ).isNA() ); - BOOST_CHECK( Value( chstr, Value::uriFormat ).isNA() ); - - BOOST_CHECK_THROW( (Value( qchstr )), std::invalid_argument ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - else if ( ch == '\\' ) - { - BOOST_CHECK_THROW( (Value( chstr )), std::invalid_argument ); - BOOST_CHECK_THROW( (Value( chstr, Value::fsFormat )), std::invalid_argument ); - BOOST_CHECK( (Value( chstr, Value::uriFormat )).isString() ); - - BOOST_CHECK( Value( qchstr ).isString() ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - else - { - BOOST_CHECK_THROW( (Value( chstr )), std::invalid_argument ); - Value f( chstr, Value::fsFormat ); - BOOST_CHECK( f.isString() ); - Value u( chstr, Value::uriFormat ); - BOOST_CHECK( u.isString() ); - - BOOST_CHECK_EQUAL( f.asString(), u.asString() ); - if ( ch == '.' ) - { - BOOST_CHECK_EQUAL( f.asFs(), chstr ); - BOOST_CHECK_EQUAL( f.asUri(), chstr ); - } - else - { - BOOST_CHECK_EQUAL( f.asFs(), qchstr ); - BOOST_CHECK_EQUAL( f.asUri(), pchstr ); - } - - BOOST_CHECK( Value( qchstr ).isString() ); - BOOST_CHECK( Value( qchstr, Value::fsFormat ).isString() ); - BOOST_CHECK( Value( qchstr, Value::uriFormat ).isString() ); - - BOOST_CHECK( Value( pchstr, Value::uriFormat ).isString() ); - } - } - - BOOST_CHECK_THROW( Value( "\\!\\a\\-\\_\\.\\!" ), std::invalid_argument ); - BOOST_CHECK_EQUAL( Value( "\\!\\a\\-\\_\\.\\!", Value::fsFormat ).asFs(), "\\!a-_.\\!" ); -} - -BOOST_AUTO_TEST_CASE(cpeid_type_checks) -{ - for ( const auto & c : { Value::ANY, Value::NA, wildcardfree, wildcarded } ) - { - BOOST_CHECK_EQUAL( c.isANY(), c.type() == Value::Type::ANY ); - BOOST_CHECK_EQUAL( c.isNA(), c.type() == Value::Type::NA ); - BOOST_CHECK_EQUAL( c.isWildcardfree(), c.type() == Value::Type::wildcardfree ); - BOOST_CHECK_EQUAL( c.isWildcarded(), c.type() == Value::Type::wildcarded ); - BOOST_CHECK_EQUAL( c.isLogical(), c.isLogical( c.type() ) ); - BOOST_CHECK_EQUAL( c.isString(), c.isString( c.type() ) ); - BOOST_CHECK_EQUAL( c.isLogical(), ! c.isString() ); - } -} - -BOOST_AUTO_TEST_CASE(cpeid_compare) -{ - BOOST_CHECK( compare( Value::ANY, Value::ANY, SetCompare::equal ) ); - BOOST_CHECK( compare( Value::ANY, Value::NA, SetCompare::properSuperset ) ); - BOOST_CHECK( compare( Value::ANY, wildcardfree, SetCompare::properSuperset ) ); -#if WFN_STRICT_SPEC - BOOST_CHECK( compare( Value::ANY, wildcarded, SetCompare::uncomparable ) ); -#else - BOOST_CHECK( compare( Value::ANY, wildcarded, SetCompare::properSuperset ) ); -#endif - - BOOST_CHECK( compare( Value::NA, Value::ANY, SetCompare::properSubset ) ); - BOOST_CHECK( compare( Value::NA, Value::NA, SetCompare::equal ) ); - BOOST_CHECK( compare( Value::NA, wildcardfree, SetCompare::disjoint ) ); -#if WFN_STRICT_SPEC - BOOST_CHECK( compare( Value::NA, wildcarded, SetCompare::uncomparable ) ); -#else - BOOST_CHECK( compare( Value::NA, wildcarded, SetCompare::disjoint ) ); -#endif - - BOOST_CHECK( compare( wildcardfree, Value::ANY, SetCompare::properSubset ) ); - BOOST_CHECK( compare( wildcardfree, Value::NA, SetCompare::disjoint ) ); - //BOOST_CHECK( compare( wildcardfree, wildcardfree, _NeedsCloserLook, // equal or disjoint - BOOST_CHECK( compare( wildcardfree, wildcardfree, SetCompare::equal ) ); - BOOST_CHECK( compare( wildcardfree, wildcardfree2, SetCompare::disjoint ) ); -#if WFN_STRICT_SPEC - BOOST_CHECK( compare( wildcardfree, wildcarded, SetCompare::uncomparable ) ); -#else - //BOOST_CHECK( compare( wildcardfree, wildcarded, _NeedsCloserLook, // subset or disjoint - BOOST_CHECK( compare( wildcardfree, wildcarded, SetCompare::properSubset ) ); - BOOST_CHECK( compare( wildcardfree, wildcarded2, SetCompare::disjoint ) ); -#endif - - BOOST_CHECK( compare( wildcarded, Value::ANY, SetCompare::properSubset ) ); - BOOST_CHECK( compare( wildcarded, Value::NA, SetCompare::disjoint ) ); - //BOOST_CHECK( compare( wildcarded, wildcardfree, _NeedsCloserLook, // superset or disjoint - BOOST_CHECK( compare( wildcarded, wildcardfree, SetCompare::properSuperset ) ); - BOOST_CHECK( compare( wildcarded, wildcardfree2, SetCompare::disjoint ) ); -#if WFN_STRICT_SPEC - BOOST_CHECK( compare( wildcarded, wildcarded, SetCompare::uncomparable ) ); -#else - //BOOST_CHECK( compare( wildcarded, wildcarded, _NeedsCloserLook, // equal or uncomparable - BOOST_CHECK( compare( wildcarded, wildcarded, SetCompare::equal ) ); - BOOST_CHECK( compare( wildcarded, wildcarded2, SetCompare::uncomparable ) ); -#endif -} - - -BOOST_AUTO_TEST_CASE(cpeid_value_string_wildcard) -{ - for ( const auto & c : { Value( "a" ), Value( "\\*" ), Value( "\\?" ) } ) - { - BOOST_CHECK( c.isWildcardfree() ); - BOOST_CHECK( !c.isWildcarded() ); - } - - for ( const auto & c : { Value( "*\\*" ), Value( "\\**" ), Value( "?" ), Value( "??\\?" ), Value( "\\???" ) } ) - { - BOOST_CHECK( !c.isWildcardfree() ); - BOOST_CHECK( c.isWildcarded() ); - } -} - -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(cpeid_basics) -{ - BOOST_CHECK_THROW( CpeId( "malformed" ), std::invalid_argument ); - CpeId none( "malformed", CpeId::noThrow ); - BOOST_CHECK_EQUAL( CpeId::NoThrowType::lastMalformed, "malformed" ); - CpeId( "", CpeId::noThrow ); - BOOST_CHECK_EQUAL( CpeId::NoThrowType::lastMalformed, "" ); - - for ( const auto & c : { CpeId(), CpeId( nullptr ), CpeId( "" ), CpeId( std::string() ), CpeId( "cpe:2.3:" ), CpeId( "cpe:/" ) } ) - { - BOOST_CHECK( ! c ); // evaluate false in boolean context - BOOST_CHECK_EQUAL( c.asString(), c.asFs() ); - BOOST_CHECK_EQUAL( c.asFs(), "cpe:2.3:*:*:*:*:*:*:*:*:*:*:*" ); - BOOST_CHECK_EQUAL( c.asUri(), "cpe:/" ); - BOOST_CHECK_EQUAL( c.asWfn(), "wfn:[]" ); - BOOST_CHECK_EQUAL( c, none ); // matching!! - } - - for ( const auto & c : { CpeId( "cpe:/o:sle" ), CpeId( "cpe:/o:*" ) } ) - { - BOOST_CHECK( c ); // evaluate true in boolean context - BOOST_CHECK( ! c.asString().empty() );// empty string rep - BOOST_CHECK_EQUAL( c, c ); // matching!! - } -} - -void testStrconv( const std::string & fs, const std::string & uri, const std::string & wfn ) -{ - CpeId fromFS( fs ) ; - CpeId fromURI( uri ); - - BOOST_CHECK_EQUAL( fromFS, fromURI ); - - for ( const auto & c : { fromFS, fromURI } ) - { - BOOST_CHECK_EQUAL( c.asFs(), fs ); - BOOST_CHECK_EQUAL( c.asUri(), uri ); - BOOST_CHECK_EQUAL( c.asWfn(), wfn ); - } -} - -BOOST_AUTO_TEST_CASE(cpeid_strconv) -{ - // colon embedded in product value - testStrconv ( "cpe:2.3:a:opensuse:lib\\:zypp:14.16.0:beta:*:*:*:*:*:-", - "cpe:/a:opensuse:lib%3azypp:14.16.0:beta:~~~~~-", - "wfn:[part=\"a\",vendor=\"opensuse\",product=\"lib\\:zypp\",version=\"14\\.16\\.0\",update=\"beta\",other=NA]" ); - - testStrconv ( "cpe:2.3:a:hp:insight_diagnostics:7.4.0.1570:-:*:*:online:win2003:x64:*", - "cpe:/a:hp:insight_diagnostics:7.4.0.1570:-:~~online~win2003~x64~", - "wfn:[part=\"a\",vendor=\"hp\",product=\"insight_diagnostics\",version=\"7\\.4\\.0\\.1570\",update=NA,sw_edition=\"online\",target_sw=\"win2003\",target_hw=\"x64\"]" ); - - testStrconv ( "cpe:2.3:a:hp:openview_network_manager:7.51:*:*:*:*:linux:*:*", - "cpe:/a:hp:openview_network_manager:7.51::~~~linux~~", - "wfn:[part=\"a\",vendor=\"hp\",product=\"openview_network_manager\",version=\"7\\.51\",target_sw=\"linux\"]" ); - - testStrconv ( "cpe:2.3:a:foo\\\\bar:big\\$money_manager_2010:*:*:*:*:special:ipod_touch:80gb:*", - "cpe:/a:foo%5cbar:big%24money_manager_2010:::~~special~ipod_touch~80gb~", - "wfn:[part=\"a\",vendor=\"foo\\\\bar\",product=\"big\\$money_manager_2010\",sw_edition=\"special\",target_sw=\"ipod_touch\",target_hw=\"80gb\"]" ); - - BOOST_CHECK_THROW( (CpeId( "cpe:/x:" )), std::invalid_argument ); // illegal part 'x' - BOOST_CHECK_THROW( CpeId( "cpe:/a:foo%5cbar:big%24money_2010%07:::~~special~ipod_touch~80gb~" ), std::invalid_argument ); // illegal %07 - BOOST_CHECK_EQUAL( CpeId( "cpe:/a:foo~bar:big%7emoney_2010" ).asUri(), "cpe:/a:foo%7ebar:big%7emoney_2010" ); // unescaped ~ is ok but not preferred -} - -BOOST_AUTO_TEST_CASE(cpeid_matches) -{ - CpeId sle( "cpe:/o:sles" ); - CpeId win( "cpe:/o:windows" ); - CpeId any; - CpeId ons( "cpe:2.3:o:??????s" ); - CpeId oops( "cpe:2.3:o:?????s" ); - - BOOST_CHECK_EQUAL( compare( sle, win ), SetRelation::disjoint ); - - BOOST_CHECK_EQUAL( compare( sle, any ), SetRelation::subset ); - BOOST_CHECK_EQUAL( compare( win, any ), SetRelation::subset ); - - BOOST_CHECK_EQUAL( compare( any, sle ), SetRelation::superset ); - BOOST_CHECK_EQUAL( compare( any, win ), SetRelation::superset ); - -#if WFN_STRICT_SPEC - BOOST_CHECK_EQUAL( compare( sle, ons ), SetRelation::uncomparable ); - BOOST_CHECK_EQUAL( compare( win, ons ), SetRelation::uncomparable ); -#else - BOOST_CHECK_EQUAL( compare( sle, ons ), SetRelation::subset ); - BOOST_CHECK_EQUAL( compare( win, ons ), SetRelation::subset ); -#endif - - BOOST_CHECK_EQUAL( compare( ons, sle ), SetRelation::superset ); - BOOST_CHECK_EQUAL( compare( ons, win ), SetRelation::superset ); - - BOOST_CHECK_EQUAL( compare( oops, sle ), SetRelation::superset ); - BOOST_CHECK_EQUAL( compare( oops, win ), SetRelation::disjoint ); - -} diff --git a/libzypp/tests/zypp/Date_test.cc b/libzypp/tests/zypp/Date_test.cc deleted file mode 100644 index eff850c..0000000 --- a/libzypp/tests/zypp/Date_test.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "zypp/Date.h" - -#include - -BOOST_AUTO_TEST_CASE(date_test) -{ - std::string format = "%Y-%m-%d %H:%M:%S"; - std::string date = "2009-02-14 00:31:30"; - BOOST_CHECK_EQUAL(zypp::Date(date,format).form(format), date); -} diff --git a/libzypp/tests/zypp/Deltarpm_test.cc b/libzypp/tests/zypp/Deltarpm_test.cc deleted file mode 100644 index 77e1e67..0000000 --- a/libzypp/tests/zypp/Deltarpm_test.cc +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" -#include "zypp/RepoManager.h" -#include "zypp/sat/Pool.h" -#include "zypp/repo/DeltaCandidates.h" -#include "zypp/repo/PackageDelta.h" -#include "KeyRingTestReceiver.h" - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::repo; -using namespace zypp::filesystem; - -#define TEST_DIR TESTS_SRC_DIR "/zypp/data/Delta" - -BOOST_AUTO_TEST_CASE(delta) -{ - KeyRing::setDefaultAccept( KeyRing::ACCEPT_UNKNOWNKEY | KeyRing::ACCEPT_UNSIGNED_FILE ); - - TmpDir rootdir; - RepoManager rm( RepoManagerOptions::makeTestSetup( rootdir ) ); - - RepoInfo updates; - updates.setAlias("updates"); - updates.addBaseUrl( Pathname(TEST_DIR).asUrl() ); - - try - { - rm.buildCache(updates); - rm.loadFromCache(updates); - } - catch (const Exception & e) - { - BOOST_FAIL( string("Problem getting the data: ")+ e.msg()) ; - } - sat::Pool pool(sat::Pool::instance()); - - repo::DeltaCandidates dc(list(pool.reposBegin(),pool.reposEnd()), "libzypp"); - - std::list deltas = dc.deltaRpms(0); - for_ (it,deltas.begin(),deltas.end()) - { - BOOST_CHECK(it->name() == "libzypp"); - BOOST_CHECK(it->edition() == Edition("4.21.3-2")); - BOOST_CHECK(it->arch() == "i386"); - BOOST_CHECK(it->baseversion().edition().match(Edition("4.21.3-1")) - ||it->baseversion().edition().match(Edition("4.21.2-3"))); - - cout << it->name() << " - " << it->edition() << " - " << it->arch() - << " base: " << it->baseversion().edition() << endl; - - cout << (it->edition() == "4.21.3-2") << endl; // fine - cout << (it->edition() == Edition("4.21.3-2")) << endl; // fine - cout << (it->edition().match(Edition("4.21.3-2")) == 0) << endl; // match returns -1,0,1 - cout << (it->edition().match("4.21.3-2") == 0) << endl; // match returns -1,0,1 - } -} diff --git a/libzypp/tests/zypp/Digest_test.cc b/libzypp/tests/zypp/Digest_test.cc deleted file mode 100644 index 19e83c0..0000000 --- a/libzypp/tests/zypp/Digest_test.cc +++ /dev/null @@ -1,36 +0,0 @@ - -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/PathInfo.h" -#include "zypp/Digest.h" - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -/** - * Test case for - * static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096); - */ -BOOST_AUTO_TEST_CASE(digest) -{ - string data("I will test the checksum of this"); - stringstream str1(data); - stringstream str2(data); - stringstream str3(data); - - BOOST_CHECK_EQUAL( Digest::digest( "sha1", str1 ), "142df4277c326f3549520478c188cab6e3b5d042" ); - BOOST_CHECK_EQUAL( Digest::digest( "md5", str2 ), "f139a810b84d82d1f29fc53c5e59beae" ); - // FIXME i think it should throw - BOOST_CHECK_EQUAL( Digest::digest( "lalala", str3) , "" ); -} diff --git a/libzypp/tests/zypp/Dup_test.cc b/libzypp/tests/zypp/Dup_test.cc deleted file mode 100644 index 248a03d..0000000 --- a/libzypp/tests/zypp/Dup_test.cc +++ /dev/null @@ -1,63 +0,0 @@ -#include "TestSetup.h" -#include "zypp/ResPool.h" -#include "zypp/ResPoolProxy.h" -#include "zypp/pool/PoolStats.h" -#include "zypp/ui/Selectable.h" - -#define BOOST_TEST_MODULE Dup - -///////////////////////////////////////////////////////////////////////////// - -static TestSetup test; - -template -std::ostream & vdumpPoolStats( std::ostream & str, _Iterator begin_r, _Iterator end_r ) -{ - pool::PoolStats stats; - for_( it, begin_r, end_r ) - { - str << *it << endl; - stats( *it ); - } - return str << stats; -} - -bool upgrade() -{ - bool rres = false; - { - rres = getZYpp()->resolver()->doUpgrade(); - } - if ( ! rres ) - { - ERR << "upgrade " << rres << endl; - getZYpp()->resolver()->problems(); - return false; - } - MIL << "upgrade " << rres << endl; - vdumpPoolStats( USR << "Transacting:"<< endl, - make_filter_begin(test.pool()), - make_filter_end(test.pool()) ) << endl; - return true; -} - - -BOOST_AUTO_TEST_CASE(testcase_init) -{ - //zypp::base::LogControl::instance().logToStdErr(); - test.loadTestcaseRepos( TESTS_SRC_DIR"/data/TCdup" ); - dumpRange( USR, test.pool().knownRepositoriesBegin(), - test.pool().knownRepositoriesEnd() ) << endl; - USR << "pool: " << test.pool() << endl; - BOOST_REQUIRE( upgrade() ); -} -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(orphaned) -{ - ResPoolProxy proxy( test.poolProxy() ); - BOOST_CHECK_EQUAL( proxy.lookup( ResKind::package, "glibc" )->status(), ui::S_KeepInstalled ); - BOOST_CHECK_EQUAL( proxy.lookup( ResKind::package, "release-package" )->status(), ui::S_AutoUpdate ); - BOOST_CHECK_EQUAL( proxy.lookup( ResKind::package, "dropped_required" )->status(), ui::S_KeepInstalled ); - BOOST_CHECK_EQUAL( proxy.lookup( ResKind::package, "dropped" )->status(), ui::S_AutoDel ); -} diff --git a/libzypp/tests/zypp/Edition_test.cc b/libzypp/tests/zypp/Edition_test.cc deleted file mode 100644 index 09bca5b..0000000 --- a/libzypp/tests/zypp/Edition_test.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Edition.cc -// -// tests for Edition -// - -#include "zypp/base/Logger.h" -#include "zypp/Edition.h" - -#include - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; - -BOOST_AUTO_TEST_CASE(edition) -{ - Edition _ed1 ("1"); - Edition _ed2 ("1.1"); - Edition _ed3 ("1:1"); - Edition _ed4 ("2:1-1"); - - BOOST_CHECK_EQUAL(_ed2.version(), "1.1"); - BOOST_CHECK_EQUAL(_ed2.release(), ""); - BOOST_CHECK_EQUAL(_ed2.epoch(), 0U); - BOOST_CHECK_EQUAL(_ed4.epoch(), 2U); - - BOOST_CHECK_EQUAL(_ed1, Edition ("1", "")); - BOOST_CHECK_EQUAL(_ed2, Edition ("1.1", "")); - BOOST_CHECK_EQUAL(_ed2, Edition ("1_1", "")); // Edition strings may differ in separator (non alphanum) - BOOST_CHECK_EQUAL(_ed2, Edition ("0:1.1")); // epoch 0 is no epoch - BOOST_CHECK_EQUAL(_ed3, Edition ("1", "", "1")); - BOOST_CHECK_EQUAL(_ed3, Edition ("1", "", 1)); - BOOST_CHECK_EQUAL(_ed4, Edition ("1", "1", 2)); - - BOOST_CHECK_EQUAL( Edition::compare("1:1-1","2:1-1"), -1 ); - BOOST_CHECK_EQUAL( Edition::compare("2:1-1","2:1-1"), 0 ); - BOOST_CHECK_EQUAL( Edition::compare("3:1-1","2:1-1"), 1 ); -} diff --git a/libzypp/tests/zypp/Fetcher_test.cc b/libzypp/tests/zypp/Fetcher_test.cc deleted file mode 100644 index 48f4bd7..0000000 --- a/libzypp/tests/zypp/Fetcher_test.cc +++ /dev/null @@ -1,374 +0,0 @@ -#include "TestSetup.h" - -#include "zypp/MediaSetAccess.h" -#include "zypp/Fetcher.h" - -#include "WebServer.h" - -#define BOOST_TEST_MODULE fetcher_test - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Fetcher/remote-site") - -BOOST_AUTO_TEST_SUITE( fetcher_test ); - -BOOST_AUTO_TEST_CASE(fetcher_enqueuedir_noindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // Now test that without trusting it, it should throw - // do the test by trusting the SHA1SUMS file signature key - { - filesystem::TmpDir dest; - Fetcher fetcher; - fetcher.enqueueDir(OnMediaLocation("/complexdir"), true); - fetcher.start( dest.path(), media ); - fetcher.reset(); - - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() ); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueuedir_autoindex_untrustedkey) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key - { - filesystem::TmpDir dest; - - // add the key as untrusted, which is the same as not adding it and - // let autodiscovery to add it - - Fetcher fetcher; - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDir(OnMediaLocation("/complexdir"), true); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir2").isExist() ); - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() ); - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() ); - - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueuedir_autoindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key - { - filesystem::TmpDir dest; - - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir/subdir1/SHA1SUMS.key"), true); - Fetcher fetcher; - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDir(OnMediaLocation("/complexdir"), true); - fetcher.start( dest.path(), media ); - - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() ); - - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueue_digested_dir_autoindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key but with a broken file - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigestedDir(OnMediaLocation("/complexdir-broken"), true); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), FileCheckException); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueuebrokendir_noindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key but with a broken file - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true); - fetcher.enqueueDir(OnMediaLocation("/complexdir-broken"), true); - // this should not throw as we provided no indexes and the - // enqueue is not digested - fetcher.start( dest.path(), media ); - fetcher.reset(); - - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir2").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir2/subdir2-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir1/subdir1-file2.txt").isExist() ); - - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueuebrokendir_index) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key but with a broken file - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDir(OnMediaLocation("/complexdir-broken"), true); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - fetcher.reset(); - } -} - - -BOOST_AUTO_TEST_CASE(fetcher_enqueue_digesteddir_brokendir_with_index) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key but with a broken file - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigestedDir(OnMediaLocation("/complexdir-broken"), true); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueue_digested_broken_with_autoindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key but with a broken file - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigested(OnMediaLocation("/complexdir-broken/subdir1/subdir1-file1.txt")); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(fetcher_enqueue_digested_with_autoindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - // do the test by trusting the SHA1SUMS file signature key with a good file - // checksum in auto discovered index - { - filesystem::TmpDir dest; - Fetcher fetcher; - // add the key as trusted - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir/subdir1/SHA1SUMS.key"), true); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigested(OnMediaLocation("/complexdir/subdir1/subdir1-file1.txt")); - fetcher.start( dest.path(), media ); - fetcher.reset(); - } -} - - -BOOST_AUTO_TEST_CASE(fetcher_enqueuefile_noindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - { - filesystem::TmpDir dest; - Fetcher fetcher; - fetcher.enqueue(OnMediaLocation("/file-1.txt")); - fetcher.start( dest.path(), media ); - BOOST_CHECK( PathInfo(dest.path() + "/file-1.txt").isExist() ); - } - - //MIL << fetcher; -} - -BOOST_AUTO_TEST_CASE(fetcher_simple) -{ - MediaSetAccess media( (DATADIR).asUrl(), "/" ); - Fetcher fetcher; - - { - filesystem::TmpDir dest; - OnMediaLocation loc("/complexdir/subdir1/subdir1-file1.txt"); - loc.setChecksum(CheckSum::sha1("f1d2d2f924e986ac86fdf7b36c94bcdf32beec15")); - fetcher.enqueueDigested(loc); - fetcher.start(dest.path(), media); - fetcher.reset(); - // now we break the checksum and it should fail - loc.setChecksum(CheckSum::sha1("f1d2d2f924e986ac86fdf7b36c94bcdf32beec16")); - fetcher.enqueueDigested(loc); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - fetcher.reset(); - - } -} - -BOOST_AUTO_TEST_CASE(content_index) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - Fetcher fetcher; - - // test transfering one file by setting the index - { - filesystem::TmpDir dest; - OnMediaLocation loc("/contentindex/subdir1/subdir1-file1.txt"); - // trust the key manually - getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/contentindex/content.key"), true); - fetcher.addIndex(OnMediaLocation("/contentindex/content", 1)); - fetcher.enqueue(loc); - fetcher.start(dest.path(), media); - fetcher.reset(); - BOOST_CHECK( PathInfo(dest.path() + "/contentindex/subdir1/subdir1-file1.txt").isExist() ); - } - -} - -BOOST_AUTO_TEST_CASE(enqueue_broken_content_index) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - Fetcher fetcher; - filesystem::TmpDir dest; - { - OnMediaLocation loc("/contentindex-broken-digest/subdir1/subdir1-file1.txt",1); - // key was already imported as trusted - fetcher.addIndex(OnMediaLocation("/contentindex-broken-digest/content", 1)); - fetcher.enqueue(loc); - fetcher.start(dest.path(), media); - fetcher.reset(); - BOOST_CHECK( PathInfo(dest.path() + "/contentindex-broken-digest/subdir1/subdir1-file1.txt").isExist() ); - - // now retrieve a file that is modified, so the checksum has to fail - loc = OnMediaLocation("/contentindex-broken-digest/subdir1/subdir1-file2.txt",1); - fetcher.addIndex(OnMediaLocation("/contentindex-broken-digest/content", 1)); - fetcher.enqueue(loc); - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(enqueue_digested_images_file_content_autoindex) -{ - MediaSetAccess media( ( DATADIR + "/images-file").asUrl(), "/" ); - Fetcher fetcher; - filesystem::TmpDir dest; - { - OnMediaLocation loc("/images/images.xml",1); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigested(loc); - fetcher.start(dest.path(), media); - fetcher.reset(); - BOOST_CHECK( PathInfo(dest.path() + "/images/images.xml").isExist() ); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(enqueue_digested_images_file_content_autoindex_unsigned) -{ - MediaSetAccess media( ( DATADIR + "/images-file-unsigned").asUrl(), "/" ); - Fetcher fetcher; - filesystem::TmpDir dest; - { - OnMediaLocation loc("/images/images.xml",1); - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDigested(loc); - // it should throw because unsigned file throws - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), FileCheckException); - fetcher.reset(); - // the target file was NOT transferred - BOOST_CHECK( ! PathInfo(dest.path() + "/images/images.xml").isExist() ); - fetcher.reset(); - } -} - -BOOST_AUTO_TEST_CASE(enqueue_broken_content_noindex) -{ - MediaSetAccess media( ( DATADIR).asUrl(), "/" ); - Fetcher fetcher; - - { - filesystem::TmpDir dest; - OnMediaLocation loc("/contentindex-broken-digest/subdir1/subdir1-file1.txt",1); - // key was already imported as trusted - fetcher.enqueue(loc); - fetcher.start(dest.path(), media); - fetcher.reset(); - // now retrieve a file that is modified, so the checksum has to fail - loc = OnMediaLocation("/contentindex-broken-digest/subdir1/subdir1-file2.txt",1); - fetcher.enqueue(loc); - fetcher.start( dest.path(), media ); - fetcher.reset(); - BOOST_CHECK( PathInfo(dest.path() + "/contentindex-broken-digest/subdir1/subdir1-file2.txt").isExist() ); - - } -} - - -BOOST_AUTO_TEST_CASE(enqueuedir_http) -{ - WebServer web((Pathname(TESTS_SRC_DIR) + "/zypp/data/Fetcher/remote-site").c_str(), 10001); - web.start(); - - // at this point the key is already trusted - { - MediaSetAccess media( web.url(), "/" ); - Fetcher fetcher; - filesystem::TmpDir dest; - - // auto add the SHA1SUMS - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDir(OnMediaLocation("/complexdir"), true); - fetcher.start( dest.path(), media ); - - fetcher.reset(); - - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() ); - } - - // test broken tree - { - MediaSetAccess media( web.url(), "/" ); - Fetcher fetcher; - filesystem::TmpDir dest; - - // auto add the SHA1SUMS - fetcher.setOptions( Fetcher::AutoAddIndexes ); - fetcher.enqueueDir(OnMediaLocation("/complexdir-broken"), true); - // should throw because wrong checksum - BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), FileCheckException); - fetcher.reset(); - - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir2").isExist() ); - - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir-broken/subdir2/subdir2-file1.txt").isExist() ); - - // this one got transferred before the failure, so it is there - BOOST_CHECK( PathInfo(dest.path() + "/complexdir-broken/subdir1/subdir1-file1.txt").isExist() ); - BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir-broken/subdir1/subdir1-file2.txt").isExist() ); - - fetcher.reset(); - } - - web.stop(); -} - -BOOST_AUTO_TEST_SUITE_END(); - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/zypp/FileChecker_test.cc b/libzypp/tests/zypp/FileChecker_test.cc deleted file mode 100644 index dffd17b..0000000 --- a/libzypp/tests/zypp/FileChecker_test.cc +++ /dev/null @@ -1,90 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/KeyRing.h" -#include "zypp/PublicKey.h" -#include "zypp/TmpPath.h" - -#include "zypp/FileChecker.h" - -#include - -#include "KeyRingTestReceiver.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/FileChecker") - -BOOST_AUTO_TEST_CASE(keyring_test) -{ - Pathname file( Pathname(DATADIR) + "hello.txt" ); - Pathname file2( Pathname(DATADIR) + "hello2.txt" ); - Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" ); - Pathname signature( Pathname(DATADIR) + "hello.txt.asc" ); - - /** - * 1st scenario, the signature does - * match - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - SignatureFileChecker sigchecker( signature ); - sigchecker.addPublicKey(pubkey); - sigchecker(file); - } - - /** - * second scenario, the signature does not - * match, an exception has to be thrown - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - SignatureFileChecker sigchecker( signature ); - sigchecker.addPublicKey(pubkey); - - BOOST_CHECK_THROW( sigchecker(file2), zypp::Exception ); - - } - -} - -BOOST_AUTO_TEST_CASE(checksum_test) -{ - Pathname file( Pathname(DATADIR) + "hello.txt" ); - Pathname file2( Pathname(DATADIR) + "hello2.txt" ); - Pathname pubkey( Pathname(DATADIR) + "hello.txt.key" ); - Pathname signature( Pathname(DATADIR) + "hello.txt.asc" ); - - /** - * 1st scenario, checksum matches - */ - { - ChecksumFileChecker checker( CheckSum("sha1", "f2105202a0f017ab818b670d04982a89f55f090b") ); - checker(file); - } - - /** - * 1st scenario, checksum does not matches - */ - { - ChecksumFileChecker checker( CheckSum("sha1", "f2105202a0f017ab818b670d04982a89f55f090b") ); - BOOST_CHECK_THROW( checker(file2), zypp::FileCheckException ); - } -} - diff --git a/libzypp/tests/zypp/Flags_test.cc b/libzypp/tests/zypp/Flags_test.cc deleted file mode 100644 index 95dee3c..0000000 --- a/libzypp/tests/zypp/Flags_test.cc +++ /dev/null @@ -1,84 +0,0 @@ -// -// tests for Flags -// -#include -#include "zypp/base/Logger.h" -#include "zypp/base/Flags.h" -#include - -using boost::unit_test::test_case; -using std::cout; -using std::endl; -using namespace zypp; - -enum TBits -{ - T_0 = 0, - T_1 = 1 << 0, - T_2 = 1 << 1, - T_3 = T_2 | T_1, - T_4 = 1 << 2, - T_5 = T_4 | T_1, - T_8 = 1 << 3, -}; - -ZYPP_DECLARE_FLAGS( TFlags, TBits ); -ZYPP_DECLARE_OPERATORS_FOR_FLAGS( TFlags ); - -static const TFlags T_6( T_4 | T_2 ); -static const TFlags T_7( T_4 | T_2 | T_1 ); - -BOOST_AUTO_TEST_CASE(flags) -{ - TFlags t0; - BOOST_CHECK_EQUAL( t0, 0 ); - BOOST_CHECK_EQUAL( t0, T_0 ); - BOOST_CHECK_EQUAL( t0, TFlags(0) ); - BOOST_CHECK_EQUAL( ~t0, ~0 ); - BOOST_CHECK_EQUAL( ~~t0, 0 ); - BOOST_CHECK_EQUAL( ~t0, ~T_0 ); - BOOST_CHECK_EQUAL( ~~t0, T_0 ); - - TFlags t1( T_1 ); - BOOST_CHECK_EQUAL( t1, 1 ); - BOOST_CHECK_EQUAL( t1, T_1 ); - BOOST_CHECK_EQUAL( t1, TFlags(1) ); - - TFlags t; - // t = 1; // must not compile: assign from int_type - t = T_2; // = enum - BOOST_CHECK_EQUAL( t, T_2 ); - t = T_6; // = TFlags - BOOST_CHECK_EQUAL( t, T_6 ); - - // enum op enum - t = ~T_1; BOOST_CHECK_EQUAL( ~t, T_1 ); - t = T_1 & T_2; BOOST_CHECK_EQUAL( t, T_0 ); - t = T_1 | T_2; BOOST_CHECK_EQUAL( t, T_3 ); - t = T_1 ^ T_2; BOOST_CHECK_EQUAL( t, T_3 ); - - // enum op TFlags - t = T_2 & T_6; BOOST_CHECK_EQUAL( t, T_2 ); - t = T_2 | T_6; BOOST_CHECK_EQUAL( t, T_6 ); - t = T_2 ^ T_6; BOOST_CHECK_EQUAL( t, T_4 ); - - // TFlags op enum - t = ~T_7; BOOST_CHECK_EQUAL( ~t, T_7 ); - t = T_7 & T_2; BOOST_CHECK_EQUAL( t, T_2 ); - t = T_7 | T_2; BOOST_CHECK_EQUAL( t, T_7 ); - t = T_7 ^ T_2; BOOST_CHECK_EQUAL( t, T_5 ); - - // TFlags op enum - t = T_7 & T_6; BOOST_CHECK_EQUAL( t, T_6 ); - t = T_7 | T_6; BOOST_CHECK_EQUAL( t, T_7 ); - t = T_7 ^ T_7; BOOST_CHECK_EQUAL( t, T_0 ); - - - t = T_3; - BOOST_CHECK( t.testFlag( T_1 ) ); - BOOST_CHECK( t.testFlag( T_2 ) ); - BOOST_CHECK( t.testFlag( T_3 ) ); - t.unsetFlag( T_2 ); BOOST_CHECK( t.testFlag( T_1 ) ); - t.setFlag( T_1, false ); BOOST_CHECK( t.testFlag( T_0 ) ); - t.setFlag( T_3, true ); BOOST_CHECK( t.testFlag( T_3 ) ); -} diff --git a/libzypp/tests/zypp/InstanceId_test.cc b/libzypp/tests/zypp/InstanceId_test.cc deleted file mode 100644 index 248056b..0000000 --- a/libzypp/tests/zypp/InstanceId_test.cc +++ /dev/null @@ -1,43 +0,0 @@ -#include "TestSetup.h" -#include "zypp/InstanceId.h" - -#define BOOST_TEST_MODULE InstanceId - -///////////////////////////////////////////////////////////////////////////// -static TestSetup test( Arch_x86_64 ); - -BOOST_AUTO_TEST_CASE(pool_query_init) -{ - // Abuse;) vbox as System repo: - test.loadTargetRepo( TESTS_SRC_DIR "/data/obs_virtualbox_11_1" ); - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" ); - test.loadRepo( TESTS_SRC_DIR "/data/OBS_zypp_svn-11.1", "zyppsvn" ); -} - -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(default_constructed) -{ - InstanceId instanceId; - BOOST_CHECK_EQUAL( instanceId.getNamespace(), std::string() ); - - BOOST_CHECK_EQUAL( instanceId.isSystemId( "System" ), false ); - BOOST_CHECK_EQUAL( instanceId.isSystemId( "@System" ), true ); - - BOOST_CHECK_EQUAL( instanceId(""), PoolItem() ); - BOOST_CHECK_EQUAL( instanceId(PoolItem()), "" ); -} - -BOOST_AUTO_TEST_CASE(convert) -{ - InstanceId instanceId; - instanceId.setNamespace( "SUSE" ); - BOOST_CHECK_EQUAL( instanceId.getNamespace(), "SUSE" ); - - ResPool pool( ResPool::instance() ); - for_( it, pool.begin(), pool.end() ) - { - std::cout << instanceId(*it) << endl; - BOOST_CHECK_EQUAL( instanceId(instanceId(*it)), *it ); - } -} diff --git a/libzypp/tests/zypp/KeyRingTestReceiver.h b/libzypp/tests/zypp/KeyRingTestReceiver.h deleted file mode 100644 index 3595bdc..0000000 --- a/libzypp/tests/zypp/KeyRingTestReceiver.h +++ /dev/null @@ -1,142 +0,0 @@ - -#ifndef _ZYPP_KEYRING_TEST_RECEIVER_H -#define _ZYPP_KEYRING_TEST_RECEIVER_H - -#include "zypp/Callback.h" -#include "zypp/KeyRing.h" -#include "zypp/PublicKey.h" -#include "zypp/KeyContext.h" - -/** - * Keyring Callback Receiver with some features - * Allows to simulate and configure user answer - * Can record which callbacks were called - */ -struct KeyRingTestReceiver : public zypp::callback::ReceiveReport -{ - KeyRingTestReceiver() - { - reset(); - connect(); - } - - void reset() - { - _answer_accept_unknown_key = false; - _answer_accept_key = KeyRingReport::KEY_DONT_TRUST; - _answer_ver_failed = false; - _answer_accept_unsigned_file = false; - _asked_user_to_accept_unknown_key = false; - _asked_user_to_accept_key = false; - _asked_user_to_accept_ver_failed = false; - _asked_user_to_accept_unsigned_file = false; - } - - ~KeyRingTestReceiver() - { - disconnect(); - } - - void answerAcceptVerFailed( bool answer ) - { _answer_ver_failed = answer; } - - bool askedAcceptVerFailed() const - { return _asked_user_to_accept_ver_failed; } - - void answerAcceptUnknownKey( bool answer ) - { _answer_accept_unknown_key = answer; } - - bool askedAcceptUnknownKey() const - { return _asked_user_to_accept_unknown_key; } - - void answerAcceptKey( KeyRingReport::KeyTrust answer ) - { _answer_accept_key = answer; } - - bool askedAcceptKey() const - { return _asked_user_to_accept_key; } - - void answerAcceptUnsignedFile( bool answer ) - { _answer_accept_unsigned_file = answer; } - - bool askedAcceptUnsignedFile() const - { return _asked_user_to_accept_unsigned_file; } - - virtual bool askUserToAcceptUnsignedFile( const std::string &file, const zypp::KeyContext &keycontext ) - { - MIL << std::endl; - _asked_user_to_accept_unsigned_file = true; - return _answer_accept_unsigned_file; - } - - virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id, const zypp::KeyContext &keycontext ) - { - MIL << std::endl; - _asked_user_to_accept_unknown_key = true; - return _answer_accept_unknown_key; - } - - virtual KeyRingReport::KeyTrust askUserToAcceptKey( const zypp::PublicKey &key, const zypp::KeyContext &keycontext ) - { - MIL << std::endl; - _asked_user_to_accept_key = true; - return _answer_accept_key; - } - - virtual bool askUserToAcceptVerificationFailed( const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext ) - { - MIL << std::endl; - _asked_user_to_accept_ver_failed = true; - return _answer_ver_failed; - } - - // how to answer - bool _answer_accept_unknown_key; - KeyRingReport::KeyTrust _answer_accept_key; - bool _answer_ver_failed; - bool _answer_accept_unsigned_file; - - // we use this variables to check that the - // callbacks were called - bool _asked_user_to_accept_unknown_key; - bool _asked_user_to_accept_key; - bool _asked_user_to_accept_ver_failed; - bool _asked_user_to_accept_unsigned_file; -}; - -/** - * Keyring Signal Receiver with some features - * Allows to simulate and configure user answer - * Can record which callbacks were called - */ -struct KeyRingTestSignalReceiver : zypp::callback::ReceiveReport -{ - KeyRingTestSignalReceiver(/*RpmDb &rpmdb*/) - : _trusted_key_added_called(false) - { - MIL << "KeyRing signals enabled" << std::endl; - connect(); - } - - ~KeyRingTestSignalReceiver() - { - disconnect(); - } - - virtual void trustedKeyAdded( const zypp::PublicKey &key ) - { - MIL << "TEST: trusted key added to zypp Keyring. Synchronizing keys with fake rpm keyring" << std::endl; - _trusted_key_added_called = true; - //std::cout << "trusted key added to zypp Keyring. Synchronizing keys with rpm keyring" << std::endl; - //_rpmdb.importZyppKeyRingTrustedKeys(); - //_rpmdb.exportTrustedKeysInZyppKeyRing(); - } - - virtual void trustedKeyRemoved( const zypp::PublicKey &key ) - { - } - - bool _trusted_key_added_called; - -}; - -#endif diff --git a/libzypp/tests/zypp/KeyRing_test.cc b/libzypp/tests/zypp/KeyRing_test.cc deleted file mode 100644 index a29854c..0000000 --- a/libzypp/tests/zypp/KeyRing_test.cc +++ /dev/null @@ -1,211 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/KeyRing.h" -#include "zypp/PublicKey.h" -#include "zypp/TmpPath.h" - -#include - -#include "KeyRingTestReceiver.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/KeyRing") - -BOOST_AUTO_TEST_CASE(keyring_test) -{ - PublicKey key( Pathname(DATADIR) + "public.asc" ); - - /** - * scenario #1 - * import a not trusted key - * ask for accept, answer yes 'temporarily' - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 ); - BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 ); - - keyring.importKey( key, false ); - - BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 1 ); - BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 ); - - BOOST_CHECK_MESSAGE( keyring.isKeyKnown( key.id() ), "Imported untrusted key should be known"); - BOOST_CHECK_MESSAGE( ! keyring.isKeyTrusted( key.id() ), "Imported untrusted key should be untrusted"); - - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", DATADIR + "repomd.xml.asc"); - - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known"); - BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "The signature validates"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnsignedFile(), "It is a signed file, so dont ask the opposite"); - - BOOST_CHECK_MESSAGE( to_continue, "We did not import, but we trusted and signature validates."); - } - - /** - * scenario #1.1 - * import a not trusted key - * ask to accept, answer yes 'temporarily' - * vorrupt the file and check - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 ); - BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 ); - - keyring.importKey( key, false ); - - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - - // now we will recheck with a corrupted file - bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml.corrupted", "Blah Blah", DATADIR + "repomd.xml.asc"); - - // check wether the user got the right questions - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known"); - BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import"); - BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptVerFailed(), "The signature does not validates"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnsignedFile(), "It is a signed file, so dont ask the opposite"); - - BOOST_CHECK_MESSAGE( ! to_continue, "We did not continue with a corrupted file"); - } - - /** - * scenario #1.2 - * import a not trusted key - * ask for trust, answer yes - * ask for import, answer no - * check without signature - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - keyring.importKey( key, false ); - - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - // now we will recheck with a unsigned file - bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", Pathname() ); - - // check wether the user got the right questions - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptKey(), "No signature, no key to trust"); - BOOST_CHECK_MESSAGE( keyring_callbacks.askedAcceptUnsignedFile(), "Ask the user wether to accept an unsigned file"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "There is no signature to verify"); - - BOOST_CHECK_MESSAGE( ! to_continue, "We did not continue with a unsigned file"); - } - - /** scenario #2 - * empty keyring - * should ask for unknown key - * answer no - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - BOOST_CHECK_MESSAGE( ! keyring.isKeyKnown( key.id() ), "empty keyring has not known keys"); - - //keyring_callbacks.answerAcceptUnknownKey(true); - bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", DATADIR + "repomd.xml.asc"); - BOOST_CHECK_MESSAGE(keyring_callbacks.askedAcceptUnknownKey(), "Should ask to accept unknown key, empty keyring"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptKey(), "Unknown key cant be trusted"); - BOOST_CHECK_MESSAGE( ! to_continue, "We answered no to accept unknown key"); - } - - /** scenario #3 - * import trusted key - * should ask nothing - * should emit signal - */ - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 ); - BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 0 ); - - keyring.importKey( key, true ); - - BOOST_CHECK_EQUAL( receiver._trusted_key_added_called, true ); - - BOOST_CHECK_EQUAL( keyring.publicKeys().size(), (unsigned) 0 ); - BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), (unsigned) 1 ); - - BOOST_CHECK_MESSAGE( keyring.isKeyKnown( key.id() ), "Imported trusted key should be known"); - BOOST_CHECK_MESSAGE( keyring.isKeyTrusted( key.id() ), "Imported trusted key should be trusted"); - - bool to_continue = keyring.verifyFileSignatureWorkflow( DATADIR + "repomd.xml", "Blah Blah", DATADIR + "repomd.xml.asc"); - - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnknownKey(), "Should not ask for unknown key, it was known"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptKey(), "Verify Signature Workflow with only 1 untrusted key should ask user wether to trust and/or import"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptVerFailed(), "The signature validates"); - BOOST_CHECK_MESSAGE( ! keyring_callbacks.askedAcceptUnsignedFile(), "It is a signed file, so dont ask the opposite"); - - BOOST_CHECK_MESSAGE( to_continue, "We did not import, but we trusted and signature validates."); - } - //keyring.importKey( key, true ); - //BOOST_CHECK_EQUAL( receiver._trusted_key_added_called, true ); - //BOOST_CHECK_EQUAL( keyring.trustedPublicKeys().size(), 1 ); - - /* check signature id can be extracted */ - -} - -BOOST_AUTO_TEST_CASE(signature_test) -{ - PublicKey key( DATADIR + "public.asc" ); - - { - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - // base sandbox for playing - TmpDir tmp_dir; - KeyRing keyring( tmp_dir.path() ); - - BOOST_CHECK_EQUAL( keyring.readSignatureKeyId( DATADIR + "repomd.xml.asc" ), "BD61D89BD98821BE" ); - BOOST_CHECK_THROW( keyring.readSignatureKeyId(Pathname()), Exception ); - TmpFile tmp; - BOOST_CHECK_EQUAL( keyring.readSignatureKeyId(tmp.path()), "" ); - - keyring.importKey(key); - - BOOST_CHECK(keyring.verifyFileSignature( DATADIR + "repomd.xml", DATADIR + "repomd.xml.asc")); - BOOST_CHECK( ! keyring.verifyFileSignature( DATADIR + "repomd.xml.corrupted", DATADIR + "repomd.xml.asc")); - } -} - - diff --git a/libzypp/tests/zypp/Locks_test.cc b/libzypp/tests/zypp/Locks_test.cc deleted file mode 100644 index aac487b..0000000 --- a/libzypp/tests/zypp/Locks_test.cc +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include - -#include "zypp/PoolQuery.h" -#include "zypp/PoolQueryUtil.tcc" -#include "zypp/TmpPath.h" -#include "zypp/Locks.h" -#include "TestSetup.h" - -#define BOOST_TEST_MODULE Locks - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; - -bool isLocked( const sat::Solvable & solvable ) -{ - zypp::PoolItem pi( zypp::ResPool::instance().find( solvable ) ); - if( pi.status().isLocked() ) - return true; - return false; -} - -BOOST_AUTO_TEST_CASE(pool_query_init) -{ - TestSetup test( Arch_x86_64 ); - //test.loadTarget(); // initialize and load target - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" ); - test.loadRepo( TESTS_SRC_DIR "/data/OBS_zypp_svn-11.1", "@System" ); -} - - -///////////////////////////////////////////////////////////////////////////// -// 0xx basic queries -///////////////////////////////////////////////////////////////////////////// - -// default query + one search string -// q.addString("foo"); -// result: all resolvables having at least one attribute matching foo -BOOST_AUTO_TEST_CASE(locks_1) -{ - cout << "****001****" << endl; - PoolQuery q; - q.addString("zypper"); - Locks::instance().addLock(q); - for_(it,q.begin(),q.end()) - { - BOOST_CHECK(isLocked(*it)); - } - Locks::instance().removeLock(q); //clear before next test -} - -BOOST_AUTO_TEST_CASE(locks_save_load) -{ - cout << "****save/load****" << endl; - Pathname src(TESTS_SRC_DIR); - src += "zypp/data/Locks/locks"; - Locks::instance().readAndApply(src); - PoolQuery q; - q.addString("zypper"); - for_(it,q.begin(),q.end()) - { - BOOST_CHECK(isLocked(*it)); - } -#if 1 - filesystem::TmpFile testfile; - //Pathname testfile(TESTS_SRC_DIR); - // testfile += "/zypp/data/Locks/testlocks"; - Locks::instance().removeLock(q); - Locks::instance().save(testfile); - Locks::instance().readAndApply(testfile); - //now unlocked - for_(it,q.begin(),q.end()) - { - BOOST_CHECK(!isLocked(*it)); - } - BOOST_CHECK(Locks::instance().size()==0); -#endif -} - -BOOST_AUTO_TEST_CASE(locks_save_without_redundancy) -{ - cout << "****save without redundancy****" << endl; - PoolQuery q; - q.addString("zypper"); - Locks& locks = Locks::instance(); - locks.addLock(q); - locks.addLock(q); - locks.merge(); - BOOST_CHECK( locks.size()==1 ); - locks.addLock(q); - locks.merge(); - BOOST_CHECK( locks.size()==1 ); - locks.removeLock(q); - locks.merge(); - BOOST_CHECK( locks.size() == 0 ); -} - -BOOST_AUTO_TEST_CASE( locks_empty ) -{ - cout << "****test and clear empty locks****" << endl; - PoolQuery q; - q.addString("foo-bar-nonexist"); - Locks& locks = Locks::instance(); - locks.addLock(q); - locks.merge(); //only need merge list - BOOST_CHECK( locks.existEmpty() ); - locks.removeEmpty(); - BOOST_CHECK( locks.size() == 0 ); -} diff --git a/libzypp/tests/zypp/MediaSetAccess_test.cc b/libzypp/tests/zypp/MediaSetAccess_test.cc deleted file mode 100644 index 33dea03..0000000 --- a/libzypp/tests/zypp/MediaSetAccess_test.cc +++ /dev/null @@ -1,267 +0,0 @@ -#include -#include -#include -#include -#include - -#include "zypp/MediaSetAccess.h" -#include "zypp/Url.h" -#include "zypp/PathInfo.h" - -#include "WebServer.h" - -using std::cout; -using std::endl; -using std::string; -using namespace zypp; -using namespace boost::unit_test; -using namespace zypp::filesystem; - -class SimpleVerifier : public media::MediaVerifierBase -{ -public: - - SimpleVerifier( const std::string &id ) - { - _media_id = id; - } - - virtual bool isDesiredMedia(const media::MediaAccessRef &ref) - { - return ref->doesFileExist(Pathname("/x." + _media_id )); - } - -private: - std::string _media_id; -}; - -bool check_file_exists(const Pathname &path) -{ - FILE *file; - - if ((file = fopen(path.asString().c_str(), "r")) == NULL) return false; - - fclose(file); - return true; -} - -/* - * Check how MediaSetAccess::rewriteUrl() works. - */ -BOOST_AUTO_TEST_CASE(msa_url_rewrite) -{ - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/CD1.iso"), 1).asString(), - Url("iso:/?iso=/path/to/CD1.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/CD1.iso"), 2).asString(), - Url("iso:/?iso=/path/to/CD2.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/CD1.iso"), 13).asString(), - Url("iso:/?iso=/path/to/CD13.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/cd1.iso"), 2).asString(), - Url("iso:/?iso=/path/to/cd2.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/cd2.iso"), 1).asString(), - Url("iso:/?iso=/path/to/cd1.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("iso:/?iso=/path/to/dvd1.iso"), 2).asString(), - Url("iso:/?iso=/path/to/dvd2.iso").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("dir:/path/to/CD1"), 2).asString(), - Url("dir:/path/to/CD2").asString()); - - // trailing slash check - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("dir:/path/to/CD1/"), 2).asString(), - Url("dir:/path/to/CD2/").asString()); - - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("nfs://nfs-server/exported/path/to/dvd1"), 2).asString(), - Url("nfs://nfs-server/exported/path/to/dvd2").asString()); - - // single media check shouldn't this fail somehow?? - BOOST_CHECK_EQUAL( - MediaSetAccess::rewriteUrl(Url("http://ftp.opensuse.org/pub/opensuse/distribution/SL-OSS-factory/inst-source"), 2).asString(), - Url("http://ftp.opensuse.org/pub/opensuse/distribution/SL-OSS-factory/inst-source").asString()); -} - -#define DATADIR (Pathname(TESTS_SRC_DIR) / "/zypp/data/mediasetaccess") - -/* - * - * test data dir structure: - * - * . - * |-- src1 - * | |-- cd1 - * | | |-- dir - * | | | |-- file1 - * | | | |-- file2 - * | | | `-- subdir - * | | | `-- file - * | | `-- test.txt - * | |-- cd2 - * | | `-- test.txt - * | `-- cd3 - * | `-- test.txt - * `-- src2 - * `-- test.txt - * - */ - -/* - * Provide files from set without verifiers. - */ -BOOST_AUTO_TEST_CASE(msa_provide_files_set) -{ - Url url = (DATADIR + "/src1/cd1").asUrl(); - MediaSetAccess setaccess(url); - - Pathname file1 = setaccess.provideFile("/test.txt", 1); - BOOST_CHECK(check_file_exists(file1) == true); - - Pathname file2 = setaccess.provideFile("/test.txt", 2); - BOOST_CHECK(check_file_exists(file2) == true); - - Pathname file3 = setaccess.provideFile("/test.txt", 3); - BOOST_CHECK(check_file_exists(file3) == true); -} - -/* - * Provide files from set with verifiers. - */ -BOOST_AUTO_TEST_CASE(msa_provide_files_set_verified) -{ - Url url = (DATADIR + "/src1/cd1").asUrl(); - MediaSetAccess setaccess(url); - - setaccess.setVerifier(1, media::MediaVerifierRef(new SimpleVerifier("media1"))); - setaccess.setVerifier(2, media::MediaVerifierRef(new SimpleVerifier("media2"))); - setaccess.setVerifier(3, media::MediaVerifierRef(new SimpleVerifier("media3"))); - - // provide file from media1 - Pathname file1 = setaccess.provideFile("/test.txt", 1); - BOOST_CHECK(check_file_exists(file1) == true); - - // provide file from invalid media - BOOST_CHECK_THROW(setaccess.provideFile("/test.txt", 2), - media::MediaNotDesiredException); - - // provide file from media3 - Pathname file3 = setaccess.provideFile("/test.txt", 3); - BOOST_CHECK(check_file_exists(file3) == true); -} - -/* - * Provide file from single media with verifier. - */ -BOOST_AUTO_TEST_CASE(msa_provide_files_single) -{ - Url url = (DATADIR + "/src2").asUrl(); - MediaSetAccess setaccess(url); - setaccess.setVerifier(1, media::MediaVerifierRef(new SimpleVerifier("media"))); - - // provide file from media - Pathname file = setaccess.provideFile("/test.txt", 1); - BOOST_CHECK(check_file_exists(file) == true); - - // provide non-existent file - // (default answer from callback should be ABORT) - BOOST_CHECK_THROW(setaccess.provideFile("/imnothere", 2), - media::MediaFileNotFoundException); -} - -/* - * Provide directory from src/cd1. - */ -BOOST_AUTO_TEST_CASE(msa_provide_dir) -{ - Url url = (DATADIR + "/src1/cd1").asUrl(); - - MediaSetAccess setaccess(url); - - Pathname dir = setaccess.provideDir("/dir", false, 1); - - Pathname file1 = dir + "/file1"; - BOOST_CHECK(check_file_exists(file1) == true); - - Pathname file2 = dir + "/file2"; - BOOST_CHECK(check_file_exists(file2) == true); - - // provide non-existent dir - // (default answer from callback should be ABORT) - BOOST_CHECK_THROW(setaccess.provideDir("/imnothere", 2), - media::MediaFileNotFoundException); - - // This can't be properly tested with 'dir' schema, probably only curl - // schemas (http, ftp) where download is actually needed. - // Other schemas just get mounted onto a local dir and the whole subtree - // is automatically available that way. - // BOOST_CHECK(check_file_exists(dir + "/subdir/file") == false); - // BOOST_CHECK(check_file_exists(dir + "/subdir") == false); -} - - -/* - * Provide directory from src/cd1 (recursively). - */ -BOOST_AUTO_TEST_CASE(msa_provide_dirtree) -{ - Url url = (DATADIR + "/src1/cd1").asUrl(); - MediaSetAccess setaccess(url); - - Pathname dir = setaccess.provideDir("/dir", true, 1); - - Pathname file1 = dir + "/file1"; - BOOST_CHECK(check_file_exists(file1) == true); - - Pathname file2 = dir + "/file2"; - BOOST_CHECK(check_file_exists(file2) == true); - - Pathname file3 = dir + "/subdir/file"; - BOOST_CHECK(check_file_exists(file3) == true); -} - -/* - * file exists local - */ -BOOST_AUTO_TEST_CASE(msa_file_exist_local) -{ - Url url = (DATADIR + "/src1/cd1").asUrl(); - MediaSetAccess setaccess(url); - - BOOST_CHECK(setaccess.doesFileExist("/test.txt")); - BOOST_CHECK(!setaccess.doesFileExist("/testBADNAME.txt")); -} - -/* - * file exists remote - */ -BOOST_AUTO_TEST_CASE(msa_remote_tests) -{ - WebServer web( DATADIR / "/src1/cd1", 10002 ); - web.start(); - MediaSetAccess setaccess( web.url(), "/" ); - - BOOST_CHECK(!setaccess.doesFileExist("/testBADNAME.txt")); - BOOST_CHECK(setaccess.doesFileExist("/test.txt")); - - // check providing a file via http works - Pathname local = setaccess.provideFile("/test.txt"); - BOOST_CHECK(CheckSum::sha1(sha1sum(local)) == CheckSum::sha1("2616e23301d7fcf7ac3324142f8c748cd0b6692b")); - - // providing a file which does not exist should throw - BOOST_CHECK_THROW(setaccess.provideFile("/testBADNAME.txt"), media::MediaFileNotFoundException); - web.stop(); -} - - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/zypp/PathInfo_test.cc b/libzypp/tests/zypp/PathInfo_test.cc deleted file mode 100644 index 148c410..0000000 --- a/libzypp/tests/zypp/PathInfo_test.cc +++ /dev/null @@ -1,212 +0,0 @@ - -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/LogControl.h" -#include "zypp/base/Exception.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -/** - * Test case for - * bool is_checksum( const Pathname & file, const CheckSum &checksum ); - * std::string checksum( const Pathname & file, const std::string &algorithm ); - */ -BOOST_AUTO_TEST_CASE(pathinfo_checksum_test) -{ - const char *buffer = "I will test the checksum of this"; - TmpFile file; - ofstream str(file.path().asString().c_str(),ofstream::out); - - if (!str.good()) - ZYPP_THROW(Exception("cant open file")); - - str << buffer; - str.flush(); - str.close(); - - CheckSum file_sha1("sha1", "142df4277c326f3549520478c188cab6e3b5d042"); - CheckSum file_md5("md5", "f139a810b84d82d1f29fc53c5e59beae"); - - BOOST_CHECK_EQUAL( checksum( file.path(), "sha1"), "142df4277c326f3549520478c188cab6e3b5d042" ); - BOOST_CHECK_EQUAL( checksum( file.path(), "md5"), "f139a810b84d82d1f29fc53c5e59beae" ); - - BOOST_REQUIRE( is_checksum( file.path(), file_sha1 ) ); - BOOST_REQUIRE( is_checksum( file.path(), file_md5 ) ); -} - -BOOST_AUTO_TEST_CASE(pathinfo_is_exist_test) -{ - TmpDir dir; - Pathname subdir("text with spaces"); - // create a fake file - BOOST_CHECK_EQUAL( filesystem::mkdir(dir.path() + subdir), 0 ); - - Pathname filepath = (dir.path() + subdir+ "filename"); - ofstream str(filepath.asString().c_str(),ofstream::out); - str << "foo bar" << endl; - str.flush(); - str.close(); - - BOOST_CHECK( PathInfo(filepath).isExist() ); -} - -BOOST_AUTO_TEST_CASE(pathipathinfo_misc_test) -{ - TmpDir dir; - - PathInfo info(dir.path()); - BOOST_CHECK(info.isDir()); -} - -BOOST_AUTO_TEST_CASE(pathinfo_expandlink_test) -{ - TmpDir dir; - - // ---- not a link - - // create a file - Pathname file(dir / "file"); - ofstream str(file.asString().c_str(),ofstream::out); - str << "foo bar" << endl; - str.flush(); - str.close(); - - // expandlink should return the original Pathname if it does not point to a link - BOOST_CHECK_EQUAL( file, filesystem::expandlink(file) ); - - // ---- valid link - - // create a (relative!) link to that file - Pathname link1(dir / "link1"); - BOOST_CHECK_EQUAL( filesystem::symlink(file.basename(), link1), 0); - - // does the link expand to the file? - BOOST_CHECK_EQUAL( file, filesystem::expandlink(link1) ); - - // ---- broken link - - // create a link to a non-existent file - Pathname brokenlink(dir / "brokenlink"); - Pathname non_existent(dir / "non-existent"); - BOOST_CHECK_EQUAL( filesystem::symlink(non_existent, brokenlink), 0); - PathInfo info(brokenlink, PathInfo::LSTAT); - BOOST_CHECK(info.isLink()); - - // expandlink should return an empty Pathname for a broken link - BOOST_CHECK_EQUAL( Pathname(), filesystem::expandlink(brokenlink) ); - - // ---- cyclic link - - // make the 'non-existent' a link to 'brokenlink' :O) - BOOST_CHECK_EQUAL( filesystem::symlink(brokenlink, non_existent), 0); - // expandlink should return an empty Pathname for such a cyclic link - BOOST_CHECK_EQUAL( Pathname(), filesystem::expandlink(brokenlink) ); - BOOST_CHECK_EQUAL( Pathname(), filesystem::expandlink(non_existent) ); - - cout << brokenlink << " -> " << filesystem::expandlink(brokenlink) << endl; -} - -BOOST_AUTO_TEST_CASE(test_assert_dir_file) -{ - TmpDir root; - - Pathname rfile( root/"file" ); - BOOST_CHECK_EQUAL( filesystem::assert_file( rfile ), 0 ); - BOOST_CHECK( PathInfo(rfile).isFile() ); - - Pathname rdir ( root/"dir" ); - BOOST_CHECK_EQUAL( filesystem::assert_dir ( rdir ), 0 ); - BOOST_CHECK( PathInfo(rdir).isDir() ); - - // empty path - Pathname path; - BOOST_CHECK_EQUAL( filesystem::assert_file( path ), ENOENT ); - BOOST_CHECK_EQUAL( filesystem::assert_dir ( path ), ENOENT ); - - // for dirs: - // existing dir - path = rdir; - BOOST_CHECK_EQUAL( filesystem::assert_dir( path ), 0 ); - BOOST_CHECK( PathInfo(path).isDir() ); - // new dirs - path = rdir/"sub/subsub"; - BOOST_CHECK_EQUAL( filesystem::assert_dir( path ), 0 ); - BOOST_CHECK( PathInfo(path).isDir() ); - // file in path - path = rfile/"sub"; - BOOST_CHECK_EQUAL( filesystem::assert_dir( path ), ENOTDIR ); - BOOST_CHECK( !PathInfo(path).isDir() ); - // path is file - path = rfile; - BOOST_CHECK_EQUAL( filesystem::assert_dir( path ), EEXIST ); - BOOST_CHECK( !PathInfo(path).isDir() ); - - // for files: - // existing file - path = rfile; - BOOST_CHECK_EQUAL( filesystem::assert_file( path ), 0 ); - BOOST_CHECK( PathInfo(path).isFile() ); - // new file - path = rdir/"sub/file"; - BOOST_CHECK_EQUAL( filesystem::assert_file( path ), 0 ); - BOOST_CHECK( PathInfo(path).isFile() ); - // file in path - path = rfile/"sub/file"; - BOOST_CHECK_EQUAL( filesystem::assert_file( path ), ENOTDIR ); - BOOST_CHECK( ! PathInfo(path).isFile() ); - // path is dir - path = rdir; - BOOST_CHECK_EQUAL( filesystem::assert_file( path ), EEXIST ); - BOOST_CHECK( ! PathInfo(path).isFile() ); -} - -BOOST_AUTO_TEST_CASE(test_exchange) -{ - TmpDir root; - Pathname a; - Pathname b; - // paths must not be epmty: - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), EINVAL ); - a = root/"a/p"; - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), EINVAL ); - b = root/"b/p"; - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), 0 ); // ok if both don't exist - - // one path not existing: - filesystem::assert_file( a ); - BOOST_CHECK( PathInfo(a).isFile() ); - BOOST_CHECK( !PathInfo(b).isFile() ); - - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), 0 ); - BOOST_CHECK( !PathInfo(a).isFile() ); - BOOST_CHECK( PathInfo(b).isFile() ); - - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), 0 ); - BOOST_CHECK( PathInfo(a).isFile() ); - BOOST_CHECK( !PathInfo(b).isFile() ); - - // both paths exist: - filesystem::assert_dir( b ); - BOOST_CHECK( PathInfo(b).isDir() ); - - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), 0 ); - BOOST_CHECK( PathInfo(a).isDir() ); - BOOST_CHECK( PathInfo(b).isFile() ); - - BOOST_CHECK_EQUAL( filesystem::exchange( a, b ), 0 ); - BOOST_CHECK( PathInfo(a).isFile() ); - BOOST_CHECK( PathInfo(b).isDir() ); -} diff --git a/libzypp/tests/zypp/Pathname_test.cc b/libzypp/tests/zypp/Pathname_test.cc deleted file mode 100644 index c749b4e..0000000 --- a/libzypp/tests/zypp/Pathname_test.cc +++ /dev/null @@ -1,151 +0,0 @@ -#include -#include - -#include - -#include "zypp/base/LogTools.h" -#include "zypp/Pathname.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; - -BOOST_AUTO_TEST_CASE(pathname_default_ctor) -{ - Pathname p; - - BOOST_CHECK_EQUAL(p.empty(), true ); - BOOST_CHECK_EQUAL(p.absolute(), false ); - BOOST_CHECK_EQUAL(p.relative(), false ); - BOOST_CHECK_EQUAL(p.dirname(), "" ); - BOOST_CHECK_EQUAL(p.basename(), "" ); - BOOST_CHECK_EQUAL(p.extension(), "" ); - BOOST_CHECK_EQUAL(p.absolutename(), "" ); - BOOST_CHECK_EQUAL(p.relativename(), "" ); -} - -BOOST_AUTO_TEST_CASE(pathname_root) -{ - Pathname p("/"); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), true ); - BOOST_CHECK_EQUAL(p.relative(), false ); - BOOST_CHECK_EQUAL(p.dirname(), "/" ); - BOOST_CHECK_EQUAL(p.basename(), "/" ); - BOOST_CHECK_EQUAL(p.extension(), "" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/" ); - BOOST_CHECK_EQUAL(p.relativename(), "./" ); -} - -BOOST_AUTO_TEST_CASE(pathname_this) -{ - Pathname p("."); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), false ); - BOOST_CHECK_EQUAL(p.relative(), true ); - BOOST_CHECK_EQUAL(p.dirname(), "." ); - BOOST_CHECK_EQUAL(p.basename(), "." ); - BOOST_CHECK_EQUAL(p.extension(), "" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/" ); - BOOST_CHECK_EQUAL(p.relativename(), "." ); -} - -BOOST_AUTO_TEST_CASE(pathname_up) -{ - Pathname p(".."); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), false ); - BOOST_CHECK_EQUAL(p.relative(), true ); - BOOST_CHECK_EQUAL(p.dirname(), "." ); - BOOST_CHECK_EQUAL(p.basename(), ".." ); - BOOST_CHECK_EQUAL(p.extension(), "" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/" ); - BOOST_CHECK_EQUAL(p.relativename(), ".." ); -} - -BOOST_AUTO_TEST_CASE(pathname_abs) -{ - Pathname p("/foo/baa.ka"); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), true ); - BOOST_CHECK_EQUAL(p.relative(), false ); - BOOST_CHECK_EQUAL(p.dirname(), "/foo" ); - BOOST_CHECK_EQUAL(p.basename(), "baa.ka" ); - BOOST_CHECK_EQUAL(p.extension(), ".ka" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/foo/baa.ka" ); - BOOST_CHECK_EQUAL(p.relativename(), "./foo/baa.ka" ); -} - -BOOST_AUTO_TEST_CASE(pathname_rel) -{ - Pathname p("./foo/./../baa.ka"); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), false ); - BOOST_CHECK_EQUAL(p.relative(), true ); - BOOST_CHECK_EQUAL(p.dirname(), "." ); - BOOST_CHECK_EQUAL(p.basename(), "baa.ka" ); - BOOST_CHECK_EQUAL(p.extension(), ".ka" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/baa.ka" ); - BOOST_CHECK_EQUAL(p.relativename(), "./baa.ka" ); -} - -BOOST_AUTO_TEST_CASE(pathname_relup) -{ - Pathname p("./../foo/./../baa"); - - BOOST_CHECK_EQUAL(p.empty(), false ); - BOOST_CHECK_EQUAL(p.absolute(), false ); - BOOST_CHECK_EQUAL(p.relative(), true ); - BOOST_CHECK_EQUAL(p.dirname(), ".." ); - BOOST_CHECK_EQUAL(p.basename(), "baa" ); - BOOST_CHECK_EQUAL(p.extension(), "" ); - BOOST_CHECK_EQUAL(p.absolutename(), "/baa" ); - BOOST_CHECK_EQUAL(p.relativename(), "../baa" ); -} - -BOOST_AUTO_TEST_CASE(pathname_strval) -{ - BOOST_CHECK_EQUAL(Pathname("").asString(), "" ); - BOOST_CHECK_EQUAL(Pathname("/////./").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("./").asString(), "." ); - BOOST_CHECK_EQUAL(Pathname("/.").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("./..").asString(), "./.." ); // ? .. - BOOST_CHECK_EQUAL(Pathname("../").asString(), "./.." ); // ? .. - BOOST_CHECK_EQUAL(Pathname(".././..").asString(), "./../.." ); // ? ../.. - - - BOOST_CHECK_EQUAL(Pathname("//baa").asString(), "/baa" ); - BOOST_CHECK_EQUAL(Pathname("/./baa").asString(), "/baa" ); - BOOST_CHECK_EQUAL(Pathname("/baa/..").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/baa/../baa").asString(), "/baa" ); - BOOST_CHECK_EQUAL(Pathname("/./../foo/./../baa").asString(), "/baa" ); - - BOOST_CHECK_EQUAL(Pathname("/").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname(".").asString(), "." ); - BOOST_CHECK_EQUAL(Pathname("..").asString(), "./.." ); - BOOST_CHECK_EQUAL(Pathname("/.").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/..").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/./.").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/./..").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/../.").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/../..").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/././").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/./../").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/.././").asString(), "/" ); - BOOST_CHECK_EQUAL(Pathname("/../../").asString(), "/" ); - - BOOST_CHECK_EQUAL(Pathname("a\\b").asString(), "./a\\b" ); - BOOST_CHECK_EQUAL(Pathname("a/b").asString(), "./a/b" ); - BOOST_CHECK_EQUAL(Pathname("c:a\\b").asString(), "./c:a\\b" ); - BOOST_CHECK_EQUAL(Pathname("c:a/b").asString(), "./c:a/b" ); - BOOST_CHECK_EQUAL(Pathname("cc:a\\b").asString(), "./cc:a\\b" ); - BOOST_CHECK_EQUAL(Pathname("cc:a/b").asString(), "./cc:a/b" ); -} - diff --git a/libzypp/tests/zypp/PluginFrame_test.cc b/libzypp/tests/zypp/PluginFrame_test.cc deleted file mode 100644 index cac4f3b..0000000 --- a/libzypp/tests/zypp/PluginFrame_test.cc +++ /dev/null @@ -1,170 +0,0 @@ -#include -#include - -#include -#include - -#include "TestSetup.h" -#include "zypp/PluginScript.h" - -BOOST_AUTO_TEST_CASE(InitialSettings) -{ - PluginScript::defaultTimeout( 3 ); -} - -BOOST_AUTO_TEST_CASE(PluginFrameDefaultCtor) -{ - PluginFrame f; - BOOST_CHECK_EQUAL( f.empty(), true ); - BOOST_CHECK_EQUAL( bool(f), f.empty() ); - BOOST_CHECK_EQUAL( f.command().empty(), true ); - BOOST_CHECK_EQUAL( f.body().empty(), true ); - BOOST_CHECK_EQUAL( f.headerEmpty(), true ); - BOOST_CHECK_EQUAL( (f == f), true ); - BOOST_CHECK_EQUAL( (f != f), false ); -} - -BOOST_AUTO_TEST_CASE(PluginFrameCtorAssign) -{ - PluginFrame f( "command" ); - BOOST_CHECK_EQUAL( f.empty(), false ); - BOOST_CHECK_EQUAL( bool(f), f.empty() ); - BOOST_CHECK_EQUAL( f.command(), "command" ); - BOOST_CHECK_EQUAL( f.body().empty(), true ); - BOOST_CHECK_EQUAL( f.headerEmpty(), true ); - BOOST_CHECK_EQUAL( (f == f), true ); - BOOST_CHECK_EQUAL( (f != f), false ); - - PluginFrame g( "command", "body" ); - BOOST_CHECK_EQUAL( g.empty(), false ); - BOOST_CHECK_EQUAL( bool(g), g.empty() ); - BOOST_CHECK_EQUAL( g.command(), "command" ); - BOOST_CHECK_EQUAL( g.body(), "body"); - BOOST_CHECK_EQUAL( g.headerEmpty(), true ); - BOOST_CHECK_EQUAL( (f == g), false ); - BOOST_CHECK_EQUAL( (f != g), true ); - - PluginFrame h( g ); - BOOST_CHECK_EQUAL( (g == h), true ); - - h.addHeader( "" ); // empty KV in header is ok, if you like it - BOOST_CHECK_EQUAL( (g == h), false ); - - h.addHeader({ - { "a", "a1" }, - { "a", "a2" }, - { "b", "b1" }, - { "b", "b2" }, - { "c", "c1" }, - { "c", "c1" } - }); - BOOST_CHECK_EQUAL( h.headerSize(), 7 ); - - h.setHeader( "b", "b" ); // replaces existing 'b:" headers - BOOST_CHECK_EQUAL( h.headerSize(), 6 ); - - // now write and reparse from stream: - std::string data; - { - std::ostringstream datas; - h.writeTo( datas ); - datas.str().swap( data ); - } - std::istringstream datas( data ); - PluginFrame i( datas ); - BOOST_CHECK_EQUAL( (h == i), true ); -} - -void doParse( const std::string & str_r ) -{ - std::string data( str_r ); - data.push_back( '\0' ); - std::istringstream datas( data ); - PluginFrame i( datas ); -} - -BOOST_AUTO_TEST_CASE(PluginFrameExceptipn) -{ - BOOST_CHECK_THROW( PluginFrame( "c\nc" ), PluginFrameException ); - PluginFrame f; - BOOST_CHECK_THROW( f.addHeader( "c\nc" ), PluginFrameException ); - BOOST_CHECK_THROW( f.addHeader( "c:c" ), PluginFrameException ); - BOOST_CHECK_THROW( f.addHeader( "cc", "c\nc" ), PluginFrameException ); - - BOOST_CHECK_THROW( doParse( "c" ), PluginFrameException ); // no NL after command - BOOST_CHECK_THROW( doParse( "c\n" ), PluginFrameException ); // no NL after header - doParse( "c\n\n" ); // valid empy header and body - BOOST_CHECK_THROW( doParse( "c\nh:v\nbody" ), PluginFrameException ); // no NL after header - doParse( "c\nh:v\n\nbody" ); // valid - BOOST_CHECK_THROW( doParse( "c\nhv\n\nbody" ), PluginFrameException ); // no : in header -} - -BOOST_AUTO_TEST_CASE(PluginScriptTest) -{ - PluginScript scr; - BOOST_CHECK_EQUAL( scr.isOpen(), false ); - BOOST_CHECK_EQUAL( scr.getPid(), PluginScript::NotConnected ); - BOOST_CHECK_EQUAL( scr.script(), "" ); - - BOOST_CHECK_THROW( scr.open( "bla" ), PluginScriptException ); // script does not exist - BOOST_CHECK_EQUAL( scr.isOpen(), false ); // stay closed - BOOST_CHECK_EQUAL( scr.getPid(), PluginScript::NotConnected ); - BOOST_CHECK_EQUAL( scr.script(), "" ); - - scr.open( "/bin/cat" ); - BOOST_CHECK_EQUAL( scr.isOpen(), true ); - BOOST_CHECK_EQUAL( (scr.getPid() != PluginScript::NotConnected ), true ); - BOOST_CHECK_EQUAL( scr.script(), "/bin/cat" ); // set after successfull open - - BOOST_CHECK_THROW( scr.open( "/bin/ls" ), PluginScriptException ); // already open - BOOST_CHECK_EQUAL( scr.isOpen(), true ); // stay with "/bin/cat" - BOOST_CHECK_EQUAL( (scr.getPid() != PluginScript::NotConnected ), true ); - BOOST_CHECK_EQUAL( scr.script(), "/bin/cat" ); - - PluginFrame f; - scr.send( f ); - PluginFrame r( scr.receive() ); - BOOST_CHECK_EQUAL( f, r ); - - f.setCommand( "CMD" ); - f.addHeader( "a","value" ); - f.setBody( "foo" ); - scr.send( f ); - r = scr.receive(); - BOOST_CHECK_EQUAL( f, r ); - - scr.close(); - BOOST_CHECK_EQUAL( scr.isOpen(), false ); - BOOST_CHECK_EQUAL( scr.getPid(), PluginScript::NotConnected ); - BOOST_CHECK_EQUAL( scr.script(), "/bin/cat" ); // not reset by close, may be reused by open() - - scr.close(); // no exception on dupl. close. -} - -BOOST_AUTO_TEST_CASE(PluginScriptSend) -{ - PluginFrame f( "a" ); - f.setBody( std::string( 1020, '0' ) ); - - PluginScript scr( "/bin/cat" ); - BOOST_CHECK_THROW( scr.send( f ), PluginScriptNotConnected ); - - scr.open(); - BOOST_CHECK_THROW( do { scr.send( f ); } while ( true ), PluginScriptSendTimeout ); - - ::kill( scr.getPid(), SIGKILL); - BOOST_CHECK_THROW( scr.send( f ), PluginScriptDiedUnexpectedly ); -} - -BOOST_AUTO_TEST_CASE(PluginScriptReceive) -{ - PluginFrame f( "a" ); - f.setBody( std::string( 1020, '0' ) ); - - PluginScript scr( "/bin/cat" ); - scr.open(); - BOOST_CHECK_THROW( scr.receive(), PluginScriptReceiveTimeout ); - - ::kill( scr.getPid(), SIGKILL); - BOOST_CHECK_THROW( scr.receive(), PluginScriptDiedUnexpectedly ); -} diff --git a/libzypp/tests/zypp/PoolQuery_test.cc b/libzypp/tests/zypp/PoolQuery_test.cc deleted file mode 100644 index 1f9e3a3..0000000 --- a/libzypp/tests/zypp/PoolQuery_test.cc +++ /dev/null @@ -1,842 +0,0 @@ -#include "TestSetup.h" -#include "zypp/PoolQuery.h" -#include "zypp/PoolQueryUtil.tcc" - -#define BOOST_TEST_MODULE PoolQuery - -///////////////////////////////////////////////////////////////////////////// -static TestSetup test( Arch_x86_64 ); - -BOOST_AUTO_TEST_CASE(pool_query_init) -{ - // Abuse;) vbox as System repo: - test.loadTargetRepo( TESTS_SRC_DIR "/data/obs_virtualbox_11_1" ); - test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" ); - test.loadRepo( TESTS_SRC_DIR "/data/OBS_zypp_svn-11.1", "zyppsvn" ); - - dumpRange( USR, test.pool().knownRepositoriesBegin(), - test.pool().knownRepositoriesEnd() ); - USR << "pool: " << test.pool() << endl; -} -///////////////////////////////////////////////////////////////////////////// - -static std::ofstream devNull; -#define COUT devNull - -struct PrintAndCount -{ - PrintAndCount() : _count(0) {} - - bool operator()( const sat::Solvable & solvable ) - { - zypp::PoolItem pi( zypp::ResPool::instance().find( solvable ) ); - COUT << pi.resolvable() << endl; - ++_count; - return true; - } - - unsigned _count; -}; - -void dumpQ( std::ostream & str, const PoolQuery & q, bool verbose = true ) -{ - q.begin(); - str << q << endl; - unsigned nc = 0; - if ( 1 ) - { - for_( it, q.begin(), q.end() ) - { - ++nc; - if ( verbose ) - str << it << endl; - } - str << "--> MATCHES: " << nc << endl; - } -} - - -#if 0 -BOOST_AUTO_TEST_CASE(pool_query_experiment) -{ - cout << "****experiment****" << endl; - - PoolQuery q; - q.addString("zypper"); - q.addAttribute(sat::SolvAttr::name); - - // should list 1 selectable? - cout << "****selectables****" << endl; - for (PoolQuery::Selectable_iterator it = q.selectableBegin(); - it != q.selectableEnd(); ++it) - { - ui::Selectable::Ptr s = *it; - cout << s->kind() << ":" << s->name() << " hasinstalled: " << s->installedEmpty() << endl; - } - cout << "****solvables****" << endl; - PrintAndCount cb; - std::for_each(q.begin(), q.end(), cb); -} -#endif - -///////////////////////////////////////////////////////////////////////////// -// 0xx basic queries -///////////////////////////////////////////////////////////////////////////// - -// no conditions, default query -// result: all available resolvables -BOOST_AUTO_TEST_CASE(pool_query_000) -{ - cout << "****000****" << endl; - PoolQuery q; - cout << q.size() << endl; - BOOST_CHECK(q.size() == 3811); - - /* dumpsolv repo1.solv repo2.solv repo3.solv | \ - grep '^name:.*\(noarch\|x86_64\|i386\|i586\|i686\|src\)$' | wc -l */ -} - -// default query + one search string -// q.addString("foo"); -// result: all resolvables having at least one attribute matching foo -BOOST_AUTO_TEST_CASE(pool_query_001) -{ - cout << "****001****" << endl; - PoolQuery q; - q.addString("zypper"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11); -} - -// default query + one attribute + one string -// q.addAttribute(foo, bar); -// should be the same as -// q.addAttribute(foo); q.addString(bar); -// result: resolvables with foo containing bar -BOOST_AUTO_TEST_CASE(pool_query_002) -{ - cout << "****002****" << endl; - PoolQuery q; - q.addString("zypper"); - q.addAttribute(sat::SolvAttr::name); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5); - - cout << endl; - - PoolQuery q1; - q1.addAttribute(sat::SolvAttr::name, "zypper"); - - BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5); -} - -// kind filter -BOOST_AUTO_TEST_CASE(pool_query_003) -{ - cout << "****003****" << endl; - PoolQuery q; - q.addString("zypper"); - q.addAttribute(sat::SolvAttr::name); - q.addKind(ResKind::package); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 3); -} - -// match exact -BOOST_AUTO_TEST_CASE(pool_query_004) -{ - cout << "****004****" << endl; - PoolQuery q; - q.addString("vim"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchExact(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1); - - PoolQuery q1; - q1.addString("zypp"); - q1.addAttribute(sat::SolvAttr::name); - q1.setMatchExact(); - - std::for_each(q1.begin(), q1.end(), PrintAndCount()); - BOOST_CHECK(q1.empty()); -} - -// use globs -BOOST_AUTO_TEST_CASE(pool_query_005) -{ - cout << "****005.1****" << endl; - PoolQuery q; - q.addString("z?p*"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchGlob(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6); - - cout << "****005.2****" << endl; - - PoolQuery q1; - q1.addString("*zypp*"); - q1.addAttribute(sat::SolvAttr::name); - q1.setMatchGlob(); - - BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 26); - - cout << "****005.3****" << endl; - - // should be the same as above - PoolQuery q2; - q2.addString("zypp"); - q2.addAttribute(sat::SolvAttr::name); - - BOOST_CHECK(q2.size() == 26); -} - -// use regex -BOOST_AUTO_TEST_CASE(pool_query_006) -{ - cout << "****006.1***" << endl; - - // should be the same as 005 1 - PoolQuery q; - q.addString("^z.p.*"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchRegex(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6); - - cout << "****006.2***" << endl; - - PoolQuery q1; - q1.addString("zypper|smart"); - q1.addAttribute(sat::SolvAttr::name); - q1.setMatchRegex(); - - BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 8); - - cout << "****006.3***" << endl; - - // invalid regex - PoolQuery q2; - q2.addString("zypp\\"); - q2.setMatchRegex(); - BOOST_CHECK_THROW(q2.begin(), Exception); -} - - -// match whole words -BOOST_AUTO_TEST_CASE(pool_query_007) -{ - cout << "****007***" << endl; - - PoolQuery q; - q.addString("zypp"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchWord(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6); -} - -// match by installed status (basically by system vs. repo) -BOOST_AUTO_TEST_CASE(pool_query_050) -{ - cout << "****050****" << endl; - PoolQuery q; - q.addString("yasm"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchExact(); - q.setInstalledOnly(); - - BOOST_CHECK_EQUAL(std::for_each(q.begin(), q.end(), PrintAndCount())._count, 4); - - cout << endl; - - PoolQuery q1; - q1.addString("zypper"); - q1.addAttribute(sat::SolvAttr::name); - q1.setMatchExact(); - q1.setUninstalledOnly(); - BOOST_CHECK_EQUAL(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count, 5); -} - -///////////////////////////////////////////////////////////////////////////// -// 1xx multiple attribute queries -///////////////////////////////////////////////////////////////////////////// - - -BOOST_AUTO_TEST_CASE(pool_query_100) -{ - cout << "****100****" << endl; - PoolQuery q; - /* This string is found sometimes only in only in summary (e.g. pgcalc) - and sometimes only in description (e.g. bc, lftp). We don't have - any package with 'revers' only in package name, but let's ignore this. - I didn't find a string with the same characteristics giving fewer matches - :-/ */ - q.addString("revers"); - q.addAttribute(sat::SolvAttr::name); - q.addAttribute(sat::SolvAttr::summary); - q.addAttribute(sat::SolvAttr::description); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5); - - cout << endl; - - { - PoolQuery q1; - q1.addAttribute(sat::SolvAttr::name, "zypper"); - BOOST_CHECK_EQUAL(q1.size(),5); - - PoolQuery q2; - q2.addAttribute(sat::SolvAttr::summary,"samba"); - BOOST_CHECK_EQUAL(q2.size(),13); - - // now summary and name in one go: - q1.addAttribute(sat::SolvAttr::summary,"samba"); - BOOST_CHECK_EQUAL(q1.size(),18); - } -} - - -// multi attr (same value) substring matching (case sensitive and insensitive) -BOOST_AUTO_TEST_CASE(pool_query_101) -{ - cout << "****101****" << endl; - - PoolQuery q; - q.addString("RELAX"); - q.addAttribute(sat::SolvAttr::name); - q.addAttribute(sat::SolvAttr::summary); - q.addAttribute(sat::SolvAttr::description); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 7); - - cout << endl; - - PoolQuery q2; - q2.addString("RELAX"); - q2.addAttribute(sat::SolvAttr::name); - q2.addAttribute(sat::SolvAttr::summary); - q2.addAttribute(sat::SolvAttr::description); - q2.setCaseSensitive(); - - BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 4); -} - - -// multi attr (same value) glob matching (case sensitive and insensitive) -BOOST_AUTO_TEST_CASE(pool_query_102) -{ - cout << "****102****" << endl; - PoolQuery q; - q.addString("pack*"); - q.addAttribute(sat::SolvAttr::name); - q.addAttribute(sat::SolvAttr::summary); - q.setMatchGlob(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 23); -} - - -// multi attr (same value via addAttribute()) -BOOST_AUTO_TEST_CASE(pool_query_103) -{ - cout << "****103.1****" << endl; - PoolQuery q; - q.addAttribute(sat::SolvAttr::name, "rest"); - q.addAttribute(sat::SolvAttr::summary, "rest"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14); - - cout << "****103.2****" << endl; - - PoolQuery q1; - q1.addString("rest"); - q1.addAttribute(sat::SolvAttr::name); - q1.addAttribute(sat::SolvAttr::summary); - - BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 14); -// BOOST_CHECK(q1.size() == 42); - - cout << endl; -} - -// multiple attributes, different search strings (one string per attrbute) -BOOST_AUTO_TEST_CASE(pool_query_104) -{ - cout << "****104****" << endl; - PoolQuery q; - q.addAttribute(sat::SolvAttr::name, "zypper"); - q.addAttribute(sat::SolvAttr::summary, "package management"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8); -} - -// multiple attributes, different search strings (one string per attrbute), regex matching -BOOST_AUTO_TEST_CASE(pool_query_105) -{ - cout << "****105****" << endl; - PoolQuery q; - q.addAttribute(sat::SolvAttr::name, "zy..er"); - q.addAttribute(sat::SolvAttr::summary, "package management"); - q.setMatchRegex(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8); -} - -///////////////////////////////////////////////////////////////////////////// -// 3xx repo filter queries (addRepo(alias_str)) -///////////////////////////////////////////////////////////////////////////// - -// default query + one attribute(one string) + one repo -BOOST_AUTO_TEST_CASE(pool_query_300) -{ - cout << "****300****" << endl; - PoolQuery q; - q.addAttribute(sat::SolvAttr::name, "zypper"); - q.addRepo("zyppsvn"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4); -} - -// default query + one repo -BOOST_AUTO_TEST_CASE(pool_query_301) -{ - cout << "****301****" << endl; - PoolQuery q; - q.addRepo("zyppsvn"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 42); -} - -// multiple repos + one attribute -BOOST_AUTO_TEST_CASE(pool_query_302) -{ - cout << "****302****" << endl; - PoolQuery q; - q.addString("zypper"); - q.addAttribute(sat::SolvAttr::name); - q.addRepo("opensuse"); - q.addRepo("zyppsvn"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5); -} - -///////////////////////////////////////////////////////////////////////////// -// 4xx kind queries (addKind(ResKind)) -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(pool_query_400) -{ - cout << "****400****" << endl; - PoolQuery q; - q.addString("lamp_server"); - q.addAttribute(sat::SolvAttr::name); - q.addKind(ResKind::pattern); - q.setMatchExact(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1); -} - -// should find packages and patterns -BOOST_AUTO_TEST_CASE(pool_query_401) -{ - cout << "****401****" << endl; - PoolQuery q; - q.addString("mail*"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchGlob(); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4); -} - - -///////////////////////////////////////////////////////////////////////////// -// 5xx multiple string/attribute queries -///////////////////////////////////////////////////////////////////////////// - -// multiple strings for one attribute -BOOST_AUTO_TEST_CASE(pool_query_500) -{ - cout << "****500.1****" << endl; - PoolQuery q; - q.addString("zypper"); - q.addString("yast2-packager"); - q.addAttribute(sat::SolvAttr::name); - q.setMatchExact(); - // creates: ^(apt|zypper)$ - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6); - - cout << "****500.2****" << endl; - q.addString("*bzypp"); - q.setMatchGlob(); - // creates: ^(.*zy.p|yast.*package.*|.*bzypp)$ - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11); - - cout << "****500.3****" << endl; - PoolQuery q1; - q1.addString("^libsm[a-z]*[0-9]$"); - q1.addAttribute(sat::SolvAttr::name, "bzypp$"); - q1.addKind(ResKind::package); - q1.setMatchRegex(); - // creates: (^libsm[a-z]*[0-9]$|bzypp$) - BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5); - - cout << "****500.4****" << endl; - PoolQuery q2; - q2.addString("Thunder"); - q2.addAttribute(sat::SolvAttr::name, "sun"); - q2.addKind(ResKind::package); - q2.addRepo("opensuse"); - q2.setCaseSensitive(); - // creates: (sun|Thunder) - BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 3); - - cout << "****500.5****" << endl; - PoolQuery q3; - q3.addString("audio"); - q3.addAttribute(sat::SolvAttr::name, "zip"); - q3.addKind(ResKind::package); - q3.addRepo("opensuse"); - q3.setMatchWord(); - // creates: \b(zip|audio)\b - BOOST_CHECK(std::for_each(q3.begin(), q3.end(), PrintAndCount())._count == 3); -} - -// multiple strings, multiple attributes, same strings -BOOST_AUTO_TEST_CASE(pool_query_501) -{ - cout << "****501****" << endl; - PoolQuery q; - q.addString("Thunder"); - q.addString("storm"); - q.addAttribute(sat::SolvAttr::name); - q.addAttribute(sat::SolvAttr::description); - q.addKind(ResKind::package); - q.addRepo("opensuse"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14); -} - -// multiple strings, multiple attributes, same strings -BOOST_AUTO_TEST_CASE(pool_query_502) -{ - cout << "****502****" << endl; - PoolQuery q; - q.addString("weather"); - q.addAttribute(sat::SolvAttr::name, "thunder"); - q.addAttribute(sat::SolvAttr::description, "storm"); - q.addKind(ResKind::package); - q.addRepo("opensuse"); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 13); -} - -///////////////////////////////////////////////////////////////////////////// -// 6xx queries with edition -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(pool_query_X) -{ - cout << "****600.1****" << endl; - PoolQuery q; - q.addAttribute(sat::SolvAttr::name, "zypper"); - q.setMatchExact(); - q.setEdition(Edition("0.12.5"), Rel::GT); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4); - - cout << "****600.2****" << endl; - q.setEdition(Edition("0.12.5"), Rel::LT); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 0); - - cout << "****600.3****" << endl; - q.setEdition(Edition("0.12.5"), Rel::LE); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1); - - cout << "****600.4****" << endl; - q.setEdition(Edition("0.12.5-5"), Rel::LT); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1); -} - -//! \todo FIXME this segfaults currently - one addString() + (version or kind or installed status condition) -/* -BOOST_AUTO_TEST_CASE(pool_query_FIXME) -{ - cout << "****FIXME****" << endl; - PoolQuery q; - q.addString("zypper"); - q.setEdition(Edition("0.10.3-4"), Rel::GE); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 2); -} -*/ - -/* -BOOST_AUTO_TEST_CASE(pool_query_X) -{ - cout << "****X****" << endl; - PoolQuery q; - q.addString("pack*"); - q.addAttribute(sat::SolvAttr::name); - - BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 28); -} -*/ - - -BOOST_AUTO_TEST_CASE(pool_query_recovery) -{ - Pathname testfile(TESTS_SRC_DIR); - testfile += "/zypp/data/PoolQuery/savedqueries"; - cout << "****recovery****" << endl; - - std::vector queries; - std::insert_iterator > ii( queries,queries.begin()); - readPoolQueriesFromFile(testfile,ii); - BOOST_REQUIRE_MESSAGE(queries.size() == 2, "Bad count of read queries."); - - BOOST_CHECK_EQUAL(queries[0].size(), 8); - - PoolQuery q; - q.addString("ma*"); - q.addRepo("opensuse"); - q.addKind(ResKind::patch); - q.setMatchRegex(); - q.setRequireAll(); - q.setCaseSensitive(); - q.setUninstalledOnly(); - q.setEdition(Edition("0.8.3"),Rel::NE); - BOOST_CHECK(q == queries[1]); -} - -BOOST_AUTO_TEST_CASE(pool_query_serialize) -{ - PoolQuery q; - q.addString("ma"); - q.addAttribute(sat::SolvAttr::name); - q.addRepo("factory-nonoss"); - q.addRepo("zypp_svn"); - - PoolQuery q2; - q2.addAttribute(sat::SolvAttr::name,"ma"); - q2.addRepo("factory-nonoss"); - q2.addRepo("zypp_svn"); - - - // Pathname testfile(TESTS_SRC_DIR); - // testfile += "/zypp/data/PoolQuery/testqueries"; - filesystem::TmpFile testfile; - cout << "****serialize****" << endl; - std::vector queries; - queries.push_back(q); - queries.push_back(q2); - writePoolQueriesToFile(testfile,queries.begin(),queries.end()); - BOOST_REQUIRE_MESSAGE(queries.size()==2,"Bad count of added queries."); - - std::insert_iterator > ii( queries,queries.end()); - readPoolQueriesFromFile(testfile,ii); - BOOST_REQUIRE_MESSAGE(queries.size()==4,"Bad count of written/readed queries."); - BOOST_CHECK(queries[2] == queries[0]); - BOOST_CHECK(queries[3] == queries[1]); -} - -// test matching -BOOST_AUTO_TEST_CASE(pool_query_equal) -{ - cout << "****equal****" << endl; - std::vector v; - { - PoolQuery q; - v.push_back( q ); - } - { - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, "zypper" ); - q.setMatchExact(); - q.setCaseSensitive(true); - v.push_back( q ); - } - { - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, "libzypp" ); // different - q.setMatchExact(); - q.setCaseSensitive(true); - v.push_back( q ); - } - { - PoolQuery q; - q.addAttribute( sat::SolvAttr::vendor, "zypper" ); // different - q.setMatchExact(); - q.setCaseSensitive(true); - v.push_back( q ); - } - { - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, "zypper" ); - q.setMatchExact(); - q.setCaseSensitive(false); // different - v.push_back( q ); - } - { - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, "zypper" ); - q.setMatchSubstring(); // different - q.setCaseSensitive(true); - v.push_back( q ); - } - { - PoolQuery q; - q.addDependency( sat::SolvAttr::provides, "zypper" ); - v.push_back( q ); - } - { - PoolQuery q; - q.addDependency( sat::SolvAttr::provides, "zypper", Rel::GT, Edition("1.0") ); - v.push_back( q ); - } - { - PoolQuery q; - q.addDependency( sat::SolvAttr::provides, "zypper", Rel::GT, Edition("2.0") ); - v.push_back( q ); - } - - for (size_t li = 0; li < v.size(); ++li) - { - for (size_t ri = 0; ri < v.size(); ++ri) - { - COUT << li << " <> " << ri << endl; - bool equal( v[li] == v[ri] ); - bool nequal( v[li] != v[ri] ); - BOOST_CHECK_EQUAL( equal, li==ri ); - BOOST_CHECK_EQUAL( equal, !nequal ); - } - } -} - -///////////////////////////////////////////////////////////////////////////// -// Dependency Query -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(addDependency) -{ - { - cout << "****addDependency1****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - q.addString( "libzypp" ); - q.addDependency( sat::SolvAttr::provides, "FOO" ); // ! finds 'perl(CPAN::InfoObj)' 'foO' - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 13 ); - } - { - cout << "****addDependency2****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - q.addString( "libzypp" ); - q.addDependency( sat::SolvAttr::provides, "FOO", Rel::GT, Edition("5.0") ); - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 7 ); - } - { - cout << "****addDependency2a****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - q.addDependency( sat::SolvAttr::provides, "libzypp", Rel::GT, Edition("5.0") ); - q.addAttribute( sat::SolvAttr::arch, Arch_i586.asString() ); // OR with arch i585 - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 66 ); - } - { - cout << "****addDependency2b****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - // libzypp provides yast2-packagemanager... - q.addDependency( sat::SolvAttr::provides, "yast2-packagemanager", Rel::GT, Edition("5.0"), Arch_i586 ); // AND with arch i585 - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 2 ); - } - { - cout << "****addDependency2c****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - // but no package named yast2-packagemanager - q.addDependency( sat::SolvAttr::name, "yast2-packagemanager", Rel::GT, Edition("5.0"), Arch_i586 ); // AND with arch i585 - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 0 ); - } - { - cout << "****addDependency2d****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - // libzypp provides yast2-packagemanager... - q.addDependency( sat::SolvAttr::provides, "yast2-packagemanager", Arch_i586 ); // AND with arch i585 - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 2 ); - } - { - cout << "****addDependency2e****" << endl; - PoolQuery q; - q.setCaseSensitive( false ); - q.setMatchSubstring(); - // but no package named yast2-packagemanager - q.addDependency( sat::SolvAttr::name, "yast2-packagemanager", Arch_i586 ); // AND with arch i585 - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 0 ); - } - - { - cout << "****addDependency3****" << endl; - PoolQuery q; - // includes wine - q.addDependency( sat::SolvAttr::provides, "kernel" ); - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 12 ); - } - { - cout << "****addDependency4****" << endl; - PoolQuery q; - // no wine - q.addDependency( sat::SolvAttr::name, "kernel" ); - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 11 ); - } - { - cout << "****addDependency5****" << endl; - PoolQuery q; - // Capability always matches exact - q.addDependency( sat::SolvAttr::provides, Capability("kernel") ); - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 2 ); - } - { - cout << "****addDependency6****" << endl; - PoolQuery q; - // non dependecy + Capability matches solvable name! - q.addDependency( sat::SolvAttr::summary, Capability("kernel") ); - std::for_each(q.begin(), q.end(), PrintAndCount()); - //dumpQ( std::cout, q ); - BOOST_CHECK_EQUAL( q.size(), 0 ); // non dependecy - } -} - - diff --git a/libzypp/tests/zypp/ProgressData_test.cc b/libzypp/tests/zypp/ProgressData_test.cc deleted file mode 100644 index 02b06fd..0000000 --- a/libzypp/tests/zypp/ProgressData_test.cc +++ /dev/null @@ -1,60 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" - -#include - -#include "zypp/ProgressData.h" - -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; - -BOOST_AUTO_TEST_CASE(progressdata_test) -{ - { - ProgressData progress(100); - CombinedProgressData sub1rcv(progress, 80); - - ProgressData sub1progress(100); - sub1progress.sendTo(sub1rcv); - - // task 1 goes to 50% - sub1progress.set(50); - // which is 50% of 80% in task 1 - BOOST_CHECK_EQUAL( progress.val(), 40 ); - } - - { - ProgressData progress(40000); - CombinedProgressData sub2rcv(progress, 10000); - - ProgressData sub2progress(500); - sub2progress.sendTo(sub2rcv); - sub2progress.set(250); - - // which is 50% of 80% in task 1 - BOOST_CHECK_EQUAL( progress.val(), 5000 ); - } - - { - ProgressData progress(20000,60000); - CombinedProgressData sub2rcv(progress, 10000); - - ProgressData sub2progress(500); - sub2progress.sendTo(sub2rcv); - sub2progress.set(250); - - // which is 50% of 80% in task 1 - BOOST_CHECK_EQUAL( progress.val(), 25000 ); - } - -} - - diff --git a/libzypp/tests/zypp/PtrTypes_test.cc b/libzypp/tests/zypp/PtrTypes_test.cc deleted file mode 100644 index c2a93f6..0000000 --- a/libzypp/tests/zypp/PtrTypes_test.cc +++ /dev/null @@ -1,152 +0,0 @@ -#include - -#include - -#include "zypp/base/Logger.h" -#include -#include -#include - -#define BOOST_TEST_MODULE PtrTypes - -using std::endl; -using namespace zypp; -using namespace zypp::base; - - -#define TRACE_TAG DBG << this->numericId() << " " << __PRETTY_FUNCTION__ << endl - -/** Logs Ctor, CopyCtor, Assign and Dtor. */ -template - struct Trace : public ProvideNumericId<_Trace,unsigned> - { - Trace() { TRACE_TAG; } - Trace( const Trace & ) { TRACE_TAG; } - ~Trace() { TRACE_TAG; } - Trace & operator=( const Trace & ) { TRACE_TAG; return *this; } - }; - -/** Data class for shared_ptr */ -struct NonIntrusive : private Trace -{ - using Trace::numericId; -}; - -/** Data class for intrusive_ptr */ -struct Intrusive : public ReferenceCounted, - private Trace -{ - using Trace::numericId; -}; - -namespace zypp -{ - template<> - inline NonIntrusive * rwcowClone( const NonIntrusive * rhs ) - { return new NonIntrusive( *rhs ); } - - template<> - inline Intrusive * rwcowClone( const Intrusive * rhs ) - { return new Intrusive( *rhs ); } - -} - -/****************************************************************** -** -*/ -#define T_NULL assert( !ptr ); assert( ptr == nullptr ) -#define T_NOT_NULL assert( ptr ); assert( ptr != nullptr ) -#define T_UNIQUE assert( ptr.unique() ); assert( ptr.use_count() < 2 ) -#define T_NOT_UNIQUE assert( !ptr.unique() ); assert( ptr.use_count() >= 2 ) -// Also comapre with underlying shared ptr type. -#define T_EQ(a,b) assert( a == b ); assert( a == b.cgetPtr() ); assert( a.cgetPtr() == b ); assert( a.cgetPtr() == b.cgetPtr() ); -#define T_NE(a,b) assert( a != b ); assert( a != b.cgetPtr() ); assert( a.cgetPtr() != b ); assert( a.cgetPtr() != b.cgetPtr() ); - -template - void test() - { - MIL << __PRETTY_FUNCTION__ << std::endl; - // typedefs that should be provided: - typedef typename _RW::_Ptr _Ptr; - typedef typename _RW::_constPtr _constPtr; - typedef typename _Ptr::element_type _Ptr_element_type; - typedef typename _constPtr::element_type _constPtr_element_type; - // initial NULL - _RW ptr; - T_NULL; - T_UNIQUE; - T_EQ(ptr,ptr); - // assign - ptr = _RW( new _Ptr_element_type ); - T_NOT_NULL; - T_UNIQUE; - T_EQ(ptr,ptr); - { - // share - _RW ptr2( ptr ); - T_NOT_NULL; - T_NOT_UNIQUE; - T_EQ(ptr,ptr2); - // unshare - ptr2.reset(); - T_NOT_NULL; - T_UNIQUE; - T_NE(ptr,ptr2); - // different impl - ptr2.reset( new _Ptr_element_type ); - T_NE(ptr,ptr2); - } - // assign - ptr.reset( 0 ); - T_NULL; - T_UNIQUE; - // nullptr compatible - ptr.reset( nullptr ); - T_NULL; - T_UNIQUE; - ptr = nullptr; - T_NULL; - T_UNIQUE; - ptr = _RW( nullptr ); - T_NULL; - T_UNIQUE; - - - } - -template - void cowt() - { - test<_RW>(); - MIL << __PRETTY_FUNCTION__ << std::endl; - typedef typename _RW::_Ptr::element_type _Ptr_element_type; - // create - _RW ptr( new _Ptr_element_type ); - unsigned long ptrid = ptr->numericId(); - // share - _RW ptr2( ptr ); - // clone aon access - unsigned long ptrid2 = ptr2->numericId(); - assert( ptrid != ptrid2 ); - } - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -BOOST_AUTO_TEST_CASE(basic_test) -{ - MIL << "===[START]=====" << endl; - test > >(); - test > >(); - test > >(); - test > >(); - - cowt > >(); - cowt > >(); - cowt > >(); - cowt > >(); - - MIL << "===[DONE]=====" << endl; -} diff --git a/libzypp/tests/zypp/PublicKey_test.cc b/libzypp/tests/zypp/PublicKey_test.cc deleted file mode 100644 index 98c8b2d..0000000 --- a/libzypp/tests/zypp/PublicKey_test.cc +++ /dev/null @@ -1,55 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/PublicKey.h" -#include "zypp/TmpPath.h" -#include "zypp/Date.h" - -#include - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/PublicKey") - -BOOST_AUTO_TEST_CASE(publickey_test) -{ - // test for a empty key - zypp::PublicKey empty_key; - BOOST_REQUIRE( ! empty_key.isValid() ); - - BOOST_CHECK_THROW( zypp::PublicKey("nonexistant"), Exception ); - - zypp::PublicKey k2(DATADIR/"susekey.asc"); - BOOST_CHECK_EQUAL( k2.id(), "A84EDAE89C800ACA" ); - BOOST_CHECK_EQUAL( k2.name(), "SuSE Package Signing Key " ); - BOOST_CHECK_EQUAL( k2.fingerprint(), "79C179B2E1C820C1890F9994A84EDAE89C800ACA" ); - BOOST_CHECK_EQUAL( k2.gpgPubkeyVersion(), "9c800aca" ); - BOOST_CHECK_EQUAL( k2.gpgPubkeyRelease(), "40d8063e" ); - BOOST_CHECK_EQUAL( k2.created(), zypp::Date(1087899198) ); - BOOST_CHECK_EQUAL( k2.expires(), zypp::Date(1214043198) ); -//BOOST_CHECK_EQUAL( k2.daysToLive(), "" ); - BOOST_REQUIRE( k2.path() != Pathname() ); - BOOST_REQUIRE( k2 == k2 ); - - k2 = zypp::PublicKey(DATADIR/"multikey.asc"); - BOOST_CHECK_EQUAL( k2.id(), "27FA41BD8A7C64F9" ); - BOOST_CHECK_EQUAL( k2.name(), "Unsupported " ); - BOOST_CHECK_EQUAL( k2.fingerprint(), "D88811AF6B51852351DF538527FA41BD8A7C64F9" ); - BOOST_CHECK_EQUAL( k2.gpgPubkeyVersion(), "8a7c64f9" ); - BOOST_CHECK_EQUAL( k2.gpgPubkeyRelease(), "4be01af3" ); - BOOST_CHECK_EQUAL( k2.created(), zypp::Date(1272978163) ); - BOOST_CHECK_EQUAL( k2.expires(), zypp::Date(1399122163) ); - - k2 = zypp::PublicKey(DATADIR/"multikey2.asc"); - BOOST_CHECK_EQUAL( k2.hiddenKeys().size(), 8 ); -} - diff --git a/libzypp/tests/zypp/RWPtr_test.cc b/libzypp/tests/zypp/RWPtr_test.cc deleted file mode 100644 index 5953328..0000000 --- a/libzypp/tests/zypp/RWPtr_test.cc +++ /dev/null @@ -1,83 +0,0 @@ -#include - -#include -#include -#include - -#define BOOST_TEST_MODULE RWPtr_test - -struct Foo -{ - int _foo; - - Foo(int foo=0): _foo(foo) - { - std::cerr << "created Foo(" << _foo << ")" << std::endl; - } - ~Foo() - { - std::cerr << "destroy Foo(" << _foo << ")" << std::endl; - } -}; - -#define REF_TEST(ref,msg,exp,res) \ -do { \ - bool unique = exp; \ - std::cerr << msg << std::endl; \ - if( ref) { \ - std::cerr << "ref contains object" << std::endl; \ - } else { \ - std::cerr << "ref contains no object" << std::endl; \ - } \ - std::cerr << "ref counter is " << ref.use_count() << std::endl; \ - if( ref.unique()) { \ - std::cerr << "ref is unique" << std::endl; \ - if( unique) { \ - std::cerr << "EXPECTED" << std::endl; \ - } else { \ - std::cerr << "NOT EXPECTED" << std::endl; \ - res = 1; \ - } \ - } else { \ - std::cerr << "ref is shared" << std::endl; \ - if( !unique) { \ - std::cerr << "EXPECTED" << std::endl; \ - } else { \ - std::cerr << "NOT EXPECTED" << std::endl; \ - res = 1; \ - } \ - } \ - std::cerr << std::endl; \ -} while(0); - -BOOST_AUTO_TEST_CASE(basic_test) -{ - bool skip_reset = false; - int result = 0; - - typedef zypp::RW_pointer FooRef; - - FooRef ref; - REF_TEST(ref,"=== REF(nil)", true, result); - - ref.reset(new Foo(42)); - REF_TEST(ref,"=== REF(object)", true, result); - - { - FooRef ref2(ref); - REF_TEST(ref,"=== REF2(REF)", false, result); - } - - REF_TEST(ref,"=== REF(object), REF2 out of scope now", true, result); - - if( !skip_reset) - { - ref.reset(); - REF_TEST(ref,"=== REF(nil), reset()", true, result); - } - - std::cerr << "RESULT: " - << (result == 0 ? "PASSED" : "FAILED") - << std::endl; -} - diff --git a/libzypp/tests/zypp/RepoInfo_test.cc b/libzypp/tests/zypp/RepoInfo_test.cc deleted file mode 100644 index 232e238..0000000 --- a/libzypp/tests/zypp/RepoInfo_test.cc +++ /dev/null @@ -1,49 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" - -#include "zypp/RepoInfo.h" - -#include -#include -#include - -#include "KeyRingTestReceiver.h" - -#include "WebServer.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using namespace boost::unit_test::log; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; -using namespace zypp::repo; - -BOOST_AUTO_TEST_CASE(repoinfo_test) -{ - WebServer web((Pathname(TESTS_SRC_DIR) + "/data/Mirrorlist/remote-site").c_str(), 10001); - web.start(); - - Url weburl (web.url()); - weburl.setPathName("/metalink.xml"); - - RepoInfo ri; - - ri.setMirrorListUrl(weburl); - - BOOST_CHECK(ri.url().asString() == "http://ftp-stud.hs-esslingen.de/pub/fedora/linux/updates/13/x86_64/"); - - ostringstream ostr; - ri.dumpAsIniOn(ostr); - - BOOST_CHECK( ostr.str().find("baseurl=") == string::npos ); - - web.stop(); -} diff --git a/libzypp/tests/zypp/RepoManager_test.cc b/libzypp/tests/zypp/RepoManager_test.cc deleted file mode 100644 index 329aa46..0000000 --- a/libzypp/tests/zypp/RepoManager_test.cc +++ /dev/null @@ -1,285 +0,0 @@ - -#include -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Exception.h" -#include "zypp/KeyRing.h" -#include "zypp/PublicKey.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" -#include "zypp/ServiceInfo.h" - -#include "zypp/RepoManager.h" - -#include "TestSetup.h" - -#include - - -#include "KeyRingTestReceiver.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; -using namespace zypp::repo; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/RepoManager") - -#define REPODATADIR (Pathname(TESTS_SRC_DIR) + "/repo/susetags/data/addon_in_subdir") - -BOOST_AUTO_TEST_CASE(refresh_addon_in_subdir) -{ - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - - // disable sgnature checking - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - keyring_callbacks.answerAcceptVerFailed(true); - keyring_callbacks.answerAcceptUnknownKey(true); - - // make sure we can refresh an addon which is in a subpath in a media url - TestSetup test( Arch_x86_64 ); - RepoInfo info; - info.setBaseUrl( REPODATADIR.asDirUrl() ); - info.setPath("/updates"); - info.setType(RepoType::YAST2); - info.setAlias("boooh"); - - test.loadRepo(info); - - // take care we actually got the data - Repository r( test.satpool().reposFind( "boooh" ) ); - BOOST_REQUIRE( r ); - BOOST_CHECK_EQUAL( r.solvablesSize(), 2 ); - BOOST_CHECK_EQUAL( r.info().type(), repo::RepoType::YAST2 ); - BOOST_CHECK( r.info().hasLicense() ); -} - -BOOST_AUTO_TEST_CASE(pluginservices_test) -{ - TmpDir tmpCachePath; - RepoManagerOptions opts( RepoManagerOptions::makeTestSetup( tmpCachePath ) ) ; - - filesystem::assert_dir( opts.knownReposPath ); - filesystem::assert_dir( opts.pluginsPath / "services"); - - opts.pluginsPath = DATADIR + "/plugin-service-lib-1"; - BOOST_CHECK(PathInfo(opts.pluginsPath / "services/service").isExist()); - - { - RepoManager manager(opts); - BOOST_REQUIRE_EQUAL(1, manager.serviceSize()); - BOOST_CHECK(manager.repoEmpty()); - - ServiceInfo service(*manager.serviceBegin()); - BOOST_CHECK_EQUAL("service", service.alias()); - BOOST_CHECK_EQUAL( (DATADIR / "/plugin-service-lib-1/services/service").asFileUrl(), service.url().asString()); - - // now refresh the service - manager.refreshServices(); - BOOST_CHECK_EQUAL((unsigned) 2, manager.repoSize()); - //std::list infos; - //manager.getRepositoriesInService("test", - // insert_iterator >(infos,infos.begin())); - //BOOST_CHECK_EQUAL(infos.size(), 2); // 2 from new repoindex - } - - // Now simulate the service changed - opts.pluginsPath = DATADIR + "/plugin-service-lib-2"; - { - RepoManager manager(opts); - BOOST_REQUIRE_EQUAL(1, manager.serviceSize()); - - ServiceInfo service(*manager.serviceBegin()); - BOOST_CHECK_EQUAL("service", service.alias()); - BOOST_CHECK_EQUAL( (DATADIR / "/plugin-service-lib-2/services/service").asFileUrl(), service.url().asString()); - // now refresh the service - manager.refreshServices(); - BOOST_CHECK_EQUAL((unsigned) 1, manager.repoSize()); - } -} - -// regression test for services bug -// if you modify a service that you just -// added and saved, the service was not associated with its -// file internally -BOOST_AUTO_TEST_CASE(service_file_link_bug) -{ - TmpDir tmpCachePath; - RepoManagerOptions opts( RepoManagerOptions::makeTestSetup( tmpCachePath ) ) ; - - filesystem::mkdir( opts.knownReposPath ); - filesystem::mkdir( opts.knownServicesPath ); - RepoManager manager(opts); - - //test service - ServiceInfo service("test", DATADIR.asDirUrl() ); - service.setEnabled(true); - - manager.addService(service); - // now internally, service is associated with the file - // where it was saved - - // the following line reset the file association with the bug - manager.modifyService(service.alias(), service); - // and the following modifyService fails because there is no - // association - manager.modifyService(service.alias(), service); -} - -BOOST_AUTO_TEST_CASE(repomanager_test) -{ - TmpDir tmpCachePath; - RepoManagerOptions opts( RepoManagerOptions::makeTestSetup( tmpCachePath ) ) ; - opts.servicesTargetDistro = "sles-10-i586"; // usually determined by the Target - - filesystem::mkdir( opts.knownReposPath ); - filesystem::mkdir( opts.knownServicesPath ); - BOOST_CHECK_EQUAL( filesystem::copy_dir_content( DATADIR + "/repos.d", opts.knownReposPath ), 0 ); - - RepoManager manager(opts); - - list repos; - repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd()); - BOOST_CHECK_EQUAL(repos.size(), (unsigned) 4); - - // now add a .repo file with 2 repositories in it - manager.addRepositories( (DATADIR / "/proprietary.repo").asFileUrl() ); - - // check it was not overwriten the proprietary.repo file - BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); - - // now there should be 6 repos - repos.clear(); - repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd()); - BOOST_CHECK_EQUAL(repos.size(), (unsigned) 6); - - RepoInfo office_dup; - office_dup.setAlias("office"); - BOOST_CHECK_THROW(manager.addRepository(office_dup), RepoAlreadyExistsException); - - // delete the office repo inside the propietary_1.repo - RepoInfo office; - office.setAlias("office"); - manager.removeRepository(office); - // now there should be 5 repos - repos.clear(); - repos.insert(repos.end(), manager.repoBegin(), manager.repoEnd()); - BOOST_CHECK_EQUAL(repos.size(), (unsigned) 5); - // the file still contained one repo, so it should still exists - BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); - - // now delete the macromedia one - RepoInfo macromedia; - macromedia.setAlias("macromedia"); - manager.removeRepository(macromedia); - BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 4); - // the file should not exist anymore - BOOST_CHECK( ! PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); - - //test service - - Url urlS( DATADIR.asDirUrl() ); - - ServiceInfo service("test", urlS); - service.setEnabled(true); - - manager.addService(service); - manager.refreshServices(); - BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 7); // +3 from repoindex - - //simulate change of repoindex.xml - urlS = (DATADIR / "second").asDirUrl(); - - service.setUrl(urlS); - service.setEnabled(true); - - manager.modifyService(service.alias(), service); - manager.refreshServices(); - BOOST_CHECK_EQUAL(manager.repoSize(), (unsigned) 6); // -1 from new repoindex - - std::list infos; - manager.getRepositoriesInService("test", - insert_iterator >(infos,infos.begin())); - BOOST_CHECK_EQUAL(infos.size(), 2); // 2 from new repoindex - - - // let test cache creation - - RepoInfo repo; - repo.setAlias("foo"); - //BOOST_CHECK_MESSAGE(0, repourl.asString()); - repo.setBaseUrl( (Pathname(TESTS_SRC_DIR) / "/repo/yum/data/10.2-updates-subset").asDirUrl() ); - - KeyRingTestReceiver keyring_callbacks; - KeyRingTestSignalReceiver receiver; - - // disable sgnature checking - keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY); - keyring_callbacks.answerAcceptVerFailed(true); - keyring_callbacks.answerAcceptUnknownKey(true); - - // We have no metadata and cache yet - BOOST_CHECK_MESSAGE( !manager.isCached(repo), "Repo should not yet be cached" ); - - // This should download metadata and build the cache - manager.buildCache(repo); - - // Now we have metadata and cache - BOOST_CHECK_MESSAGE( manager.isCached(repo), "Repo should be cached now" ); - - // Metadata are up to date - RepoManager::RefreshCheckStatus ref_stat = manager.checkIfToRefreshMetadata(repo, *repo.baseUrlsBegin()); - SEC << endl << ref_stat << endl; - BOOST_CHECK_MESSAGE( ref_stat== RepoManager::REPO_UP_TO_DATE || ref_stat == RepoManager::REPO_CHECK_DELAYED, "Metadata should be up to date" ); - - // the solv file should exists now - Pathname base = (opts.repoCachePath / "solv" / repo.alias()); - Pathname solvfile = base / "solv"; - Pathname cookiefile = base / "cookie"; - BOOST_CHECK_MESSAGE( PathInfo(solvfile).isExist(), "Solv file is created after caching: " + solvfile.asString()); - BOOST_CHECK_MESSAGE( PathInfo(cookiefile).isExist(), "Cookie file is created after caching: " + cookiefile.asString()); - - MIL << "Repo already in cache, clean cache"<< endl; - manager.cleanCache(repo); - - BOOST_CHECK_MESSAGE( !manager.isCached(repo), - "Repo cache was just deleted, should not be cached now" ); - // now cache should build normally - manager.buildCache(repo); - - manager.loadFromCache(repo); - - if ( manager.isCached(repo ) ) - { - MIL << "Repo already in cache, clean cache"<< endl; - manager.cleanCache(repo); - } - MIL << "Parsing repository metadata..." << endl; - manager.buildCache(repo); - - - // now test that loading twice a repo updates - // it instead of duplicating the solv file - - -} - -BOOST_AUTO_TEST_CASE(repo_seting_test) -{ - RepoInfo repo; - repo.setAlias("foo"); - repo.setBaseUrl(string("http://test.org")); - BOOST_CHECK_MESSAGE( !repo.keepPackages(), "keepPackages must default to OFF"); -} - -//! \todo test this -//BOOST_AUTO_TEST_CASE(repo_dont_overwrite_external_settings_test) -//{ -//} diff --git a/libzypp/tests/zypp/RepoStatus_test.cc b/libzypp/tests/zypp/RepoStatus_test.cc deleted file mode 100644 index 85df6b2..0000000 --- a/libzypp/tests/zypp/RepoStatus_test.cc +++ /dev/null @@ -1,33 +0,0 @@ - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/TmpPath.h" -#include "zypp/RepoStatus.h" -#include "zypp/PathInfo.h" - -#include - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -BOOST_AUTO_TEST_CASE(repostatus_test) -{ - TmpFile tmpPath; - TmpFile tmpPath2; - RepoStatus status; - RepoStatus fstatus( tmpPath ); - RepoStatus fstatus2( tmpPath2 ); - BOOST_CHECK_EQUAL( status.empty(), true ); - BOOST_CHECK_EQUAL( (status&&status).empty(), true ); - - BOOST_CHECK_EQUAL( fstatus.empty(), false ); - BOOST_CHECK_EQUAL( (fstatus&&status).empty(), false ); - - BOOST_CHECK_EQUAL( (fstatus&&status), (status&&fstatus) ); - BOOST_CHECK_EQUAL( (fstatus&&fstatus2), (fstatus2&&fstatus) ); - -} diff --git a/libzypp/tests/zypp/ResKind_test.cc b/libzypp/tests/zypp/ResKind_test.cc deleted file mode 100644 index e90e506..0000000 --- a/libzypp/tests/zypp/ResKind_test.cc +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include "zypp/base/Logger.h" -#include "zypp/ResKind.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; - -BOOST_AUTO_TEST_CASE(reskind_test) -{ - // Default construced is empty "" - BOOST_CHECK_EQUAL( ResKind(), "" ); - // boolean context - BOOST_CHECK( ! ResKind() ); - BOOST_CHECK( ! ResKind(0) ); // id NULL - BOOST_CHECK( ! ResKind(1) ); // id "" - BOOST_CHECK( ! ResKind("") ); // "" - BOOST_CHECK( ResKind(2) ); - BOOST_CHECK( ResKind("FOO") ); - // Internal representation is lowercased - BOOST_CHECK_EQUAL( ResKind("FOO").asString(), "foo" ); - // Caseinsensitive comparison - BOOST_CHECK_EQUAL( ResKind("FOO"), ResKind("foo") ); - BOOST_CHECK_EQUAL( ResKind("FOO"), string("Foo") ); - BOOST_CHECK_EQUAL( ResKind("FOO"), "Foo" ); - BOOST_CHECK_EQUAL( ResKind("FOO"), string("foo") ); - BOOST_CHECK_EQUAL( ResKind("FOO"), "foo" ); - BOOST_CHECK_EQUAL( string("foo"), ResKind("FOO") ); - BOOST_CHECK_EQUAL( "foo", ResKind("FOO") ); - - BOOST_CHECK_EQUAL( ResKind::compare( "FOO", "foo" ), 0 ); - -} diff --git a/libzypp/tests/zypp/ResStatus_test.cc b/libzypp/tests/zypp/ResStatus_test.cc deleted file mode 100644 index 5b975e0..0000000 --- a/libzypp/tests/zypp/ResStatus_test.cc +++ /dev/null @@ -1,243 +0,0 @@ -#include "TestSetup.h" -#include "zypp/ResStatus.h" - -#define BOOST_TEST_MODULE ResStatus - -BOOST_AUTO_TEST_CASE(Default) -{ - { - ResStatus s; - BOOST_CHECK( s.isUninstalled() ); - BOOST_CHECK_EQUAL( s.isInstalled(), ! s.isUninstalled() ); - BOOST_CHECK_EQUAL( s.getTransactValue(), ResStatus::KEEP_STATE ); - BOOST_CHECK_EQUAL( s.getTransactByValue(), ResStatus::SOLVER ); - } - { - ResStatus s( true ); - BOOST_CHECK( s.isInstalled() ); - BOOST_CHECK_EQUAL( s.isInstalled(), ! s.isUninstalled() ); - BOOST_CHECK_EQUAL( s.getTransactValue(), ResStatus::KEEP_STATE ); - BOOST_CHECK_EQUAL( s.getTransactByValue(), ResStatus::SOLVER ); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// tools -//////////////////////////////////////////////////////////////////////////////// -template -inline const _Tp & max( const _Tp & lhs, const _Tp & rhs ) -{ return lhs < rhs ? rhs : lhs; } - -template -inline _Tp * begin( _Tp (& _array)[N] ) { return _array; } - -template -inline _Tp * end( _Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(_Tp)); } - -ResStatus::TransactByValue transactByValues[] = { - ResStatus::USER, ResStatus::APPL_HIGH, ResStatus::APPL_LOW, ResStatus::SOLVER -}; - -ResStatus::TransactValue transactValues[] = { - ResStatus::TRANSACT, ResStatus::KEEP_STATE, ResStatus::LOCKED -}; - -bool transactTo[] = { - true, false -}; - -// Status transition like setTransact, setLock, setSoftTransact -typedef bool (ResStatus::* Transition)( bool, ResStatus::TransactByValue ); - -// Result evaluation -typedef void (* Evaluate)( ResStatus::TransactValue, ResStatus::TransactByValue, /* fromState, fromBy */ - bool, ResStatus::TransactByValue, /* toState, toBy */ - bool, ResStatus ); /* done, result */ - -// build status and return whether the comination is supported. (e.g currently no LOCKED state below APPL_HIGH) -inline bool initStatus( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, ResStatus & from ) -{ - from = ResStatus(); - if ( fromState == ResStatus::KEEP_STATE ) - { - from.setSoftLock( fromBy ); - } - else - { - from.setTransactValue( fromState, fromBy ); - if ( fromState == ResStatus::LOCKED && ! from.isLocked() ) - return false; // no lock at this level (by now just USER APPL_HIGH) - } - return true; -} - -void testTable( Transition transition, Evaluate evaluate ) -{ - // Table: For each causer combination (fromBy -> toBy) invoke transition: - // - // bool ok = ResStatus(fromState,fromBy).transition( toState, toBy ) - // - // And evaluate the result. - // - for ( ResStatus::TransactByValue * toBy = begin( transactByValues ); toBy != end( transactByValues ); ++toBy ) - { - for ( ResStatus::TransactByValue * fromBy = begin( transactByValues ); fromBy != end( transactByValues ); ++fromBy ) - { - INT << "=== " << *fromBy << " ==> " << *toBy << " ===" << endl; - for ( ResStatus::TransactValue * fromState = begin( transactValues ); fromState != end( transactValues ); ++fromState ) - { - ResStatus from; - if ( ! initStatus( *fromState, *fromBy, from ) ) - { - //WAR << "Unsupported ResStatus(" << *fromState << "," << *fromBy << ")" << endl; - continue; // Unsupported ResStatus - } - for ( bool * toState = begin( transactTo ); toState != end( transactTo ); ++toState ) - { - ResStatus result( from ); - bool done = (result.*transition)( *toState, *toBy ); - if ( ! done ) - BOOST_CHECK_EQUAL( from, result ); // status stays unchaged on failure! - evaluate( *fromState, *fromBy, *toState, *toBy, done, result ); - } - } - } - } -} - -// BOOST_CHECK_EQUAL or BOOST_REQUIRE_EQUAL -#define X BOOST_CHECK_EQUAL - - -// Transition must succeeds always -#define CHECK_DONE_ALWAYS X( done, true ); if ( ! done ) return - -// Transition succeeds if same or higher TransactByValue -#define CHECK_DONE_IFCAUSER X( done, toBy >= fromBy ); if ( ! done ) return - -// Transition succeeds if a locker (APPL_HIGH or USER) -#define CHECK_DONE_ALWAYS_IFLOCKER X( done, toBy >= ResStatus::APPL_HIGH ); if ( ! done ) return - -// Transition succeeds if a locker (APPL_HIGH or USER) and same or higher TransactByValue -#define CHECK_DONE_IFCAUSER_ISLOCKER X( done, toBy >= max(fromBy,ResStatus::APPL_HIGH) ); if ( ! done ) return - - -// Expected target state after transistion -#define CHECK_STATE(NEW) X( result.getTransactValue(), ResStatus::NEW ) - - -// Transition result: Remember the causer (i.e. may downgrade superior causer of previous state) -#define CHECK_CAUSER_SET X( result.getTransactByValue(), toBy ) - -// Transition result: Remember a superior causer -#define CHECK_CAUSER_RAISED X( result.getTransactByValue(), max(fromBy,toBy) ) - -// Transition result: Causer stays the same -#define CHECK_CAUSER_STAYS X( result.getTransactByValue(), fromBy ) - -// Transition result: Causer reset to least (SOLVER) level. -#define CHECK_CAUSER_TO_SOLVER X( result.getTransactByValue(), ResStatus::SOLVER ) - - -//////////////////////////////////////////////////////////////////////////////// -// test cases (see BOOST_AUTO_TEST_CASE(transition)) -//////////////////////////////////////////////////////////////////////////////// -// All tests below should define 3 checks, abbrev. by defines -// -// CHECK_DONE_*: When does the tranaction succeed? (return if not) -// CHECK_STATE( NEXT ): The state the transition leads to (if successfull) -// CHECK_CAUSER_*: Changes to the remembered causer (if successfull) -// - -#define DOCHECK( FROMSTATE, TOSTATE, C_DONE, C_STATE, C_CAUSER ) \ - if ( ResStatus::FROMSTATE == fromState && TOSTATE == toState ) { C_DONE; CHECK_STATE( C_STATE ); C_CAUSER; } - -void evaluateSetTransact( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, - bool toState, ResStatus::TransactByValue toBy, - bool done, ResStatus result ) -{ - ResStatus from; - initStatus( fromState, fromBy, from ); - MIL << from << " =setTransact("<\t" << done << ":" << result << endl; - - DOCHECK( TRANSACT, true, CHECK_DONE_ALWAYS, TRANSACT, CHECK_CAUSER_RAISED ); - DOCHECK( TRANSACT, false, CHECK_DONE_IFCAUSER, KEEP_STATE, CHECK_CAUSER_RAISED ); // from transact into softlock - DOCHECK( KEEP_STATE, true, CHECK_DONE_ALWAYS, TRANSACT, CHECK_CAUSER_SET ); - DOCHECK( KEEP_STATE, false, CHECK_DONE_ALWAYS, KEEP_STATE, CHECK_CAUSER_STAYS ); // keep is not raised to softlock - DOCHECK( LOCKED, true, CHECK_DONE_IFCAUSER, TRANSACT, CHECK_CAUSER_SET ); - DOCHECK( LOCKED, false, CHECK_DONE_ALWAYS, LOCKED, CHECK_CAUSER_STAYS ); -} - -void evaluateSetSoftTransact( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, - bool toState, ResStatus::TransactByValue toBy, - bool done, ResStatus result ) -{ - ResStatus from; - initStatus( fromState, fromBy, from ); - MIL << from << " =setSoftTransact("<\t" << done << ":" << result << endl; - - DOCHECK( TRANSACT, true, CHECK_DONE_ALWAYS, TRANSACT, CHECK_CAUSER_RAISED ); - DOCHECK( TRANSACT, false, CHECK_DONE_IFCAUSER, KEEP_STATE, CHECK_CAUSER_RAISED ); // from transact into softlock - DOCHECK( KEEP_STATE, true, CHECK_DONE_IFCAUSER, TRANSACT, CHECK_CAUSER_SET ); // leaving KEEP requires sup. causer - DOCHECK( KEEP_STATE, false, CHECK_DONE_ALWAYS, KEEP_STATE, CHECK_CAUSER_STAYS ); // keep is not raised to softlock - DOCHECK( LOCKED, true, CHECK_DONE_IFCAUSER, TRANSACT, CHECK_CAUSER_SET ); - DOCHECK( LOCKED, false, CHECK_DONE_ALWAYS, LOCKED, CHECK_CAUSER_STAYS ); -} - -// Check whether failures are ok and whether success lead to the correct state -void evaluateSetLock( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, - bool toState, ResStatus::TransactByValue toBy, - bool done, ResStatus result ) -{ - ResStatus from; - initStatus( fromState, fromBy, from ); - MIL << from << " =setLock("<\t" << done << ":" << result << endl; - - DOCHECK( TRANSACT, true, CHECK_DONE_IFCAUSER_ISLOCKER, LOCKED, CHECK_CAUSER_SET ); // transact is 'not locked' - DOCHECK( TRANSACT, false, CHECK_DONE_ALWAYS, TRANSACT, CHECK_CAUSER_STAYS ); - DOCHECK( KEEP_STATE, true, CHECK_DONE_ALWAYS_IFLOCKER, LOCKED, CHECK_CAUSER_SET ); - DOCHECK( KEEP_STATE, false, CHECK_DONE_ALWAYS, KEEP_STATE, CHECK_CAUSER_STAYS ); - DOCHECK( LOCKED, true, CHECK_DONE_ALWAYS, LOCKED, CHECK_CAUSER_RAISED ); - DOCHECK( LOCKED, false, CHECK_DONE_IFCAUSER, KEEP_STATE, CHECK_CAUSER_TO_SOLVER ); -} - -BOOST_AUTO_TEST_CASE(transition) -{ - //base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "-" ) ); - MIL << endl; - testTable( &ResStatus::setTransact, &evaluateSetTransact ); - testTable( &ResStatus::setSoftTransact, &evaluateSetSoftTransact ); - testTable( &ResStatus::setLock, &evaluateSetLock ); -} - - -bool WhilePoolItemSameStateIsPrivate( ResStatus ostatus, ResStatus nstatus ) -{ - if ( nstatus == ostatus ) - return true; - // some bits changed... - if ( nstatus.getTransactValue() != ostatus.getTransactValue() - && ( ! nstatus.isBySolver() // ignore solver state changes - // removing a user lock also goes to bySolver - || ostatus.getTransactValue() == ResStatus::LOCKED ) ) - return false; - if ( nstatus.isLicenceConfirmed() != ostatus.isLicenceConfirmed() ) - return false; - return true; -} - -BOOST_AUTO_TEST_CASE(savestate) -{ - ResStatus ostatus; - ResStatus nstatus; - - BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), true ); - nstatus.setLock( true, ResStatus::USER ); - BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), false ); - ostatus = nstatus; - nstatus.setLock( false, ResStatus::USER ); - BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), false ); -} - - - diff --git a/libzypp/tests/zypp/Resolvable_test.cc b/libzypp/tests/zypp/Resolvable_test.cc deleted file mode 100644 index cc65f7f..0000000 --- a/libzypp/tests/zypp/Resolvable_test.cc +++ /dev/null @@ -1,39 +0,0 @@ - -#include -#include -#include - -// Boost.Test -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ZYpp.h" -#include "zypp/Pattern.h" - -#include "TestSetup.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; - - -BOOST_AUTO_TEST_CASE(resolvable_test) -{ - TestSetup test( Arch_x86_64 ); - // test.loadTarget(); // initialize and load target - test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" ); - - int pattern_count = 0; - for_( pitem, test.pool().begin(), test.pool().end() ) - { - if ( isKind(pitem->resolvable()) ) - { - //BOOST_CHECK( ! asKind(pitem->resolvable())->contents().empty() ); - MIL << asKind(pitem->resolvable()) << endl; - pattern_count++; - } - } - BOOST_CHECK(pattern_count > 0); -} diff --git a/libzypp/tests/zypp/Selectable_test.cc b/libzypp/tests/zypp/Selectable_test.cc deleted file mode 100644 index abd03a8..0000000 --- a/libzypp/tests/zypp/Selectable_test.cc +++ /dev/null @@ -1,331 +0,0 @@ -#include "TestSetup.h" -#include "zypp/ResPool.h" -#include "zypp/ui/Selectable.h" - -#define BOOST_TEST_MODULE Selectable - -///////////////////////////////////////////////////////////////////////////// - -static TestSetup test; - -BOOST_AUTO_TEST_CASE(testcase_init) -{ -// zypp::base::LogControl::instance().logToStdErr(); - test.loadTestcaseRepos( TESTS_SRC_DIR"/data/TCSelectable" ); - -// dumpRange( USR, test.pool().knownRepositoriesBegin(), -// test.pool().knownRepositoriesEnd() ) << endl; -// USR << "pool: " << test.pool() << endl; -} -///////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(candiadate) -{ - ResPoolProxy poolProxy( test.poolProxy() ); - ui::Selectable::Ptr s( poolProxy.lookup( ResKind::package, "candidate" ) ); - // (I 1) { - // I__s_(8)candidate-1-1.i586(@System)(openSUSE) - // } (A 6) { - // U__s_(2)candidate-4-1.x86_64(RepoHIGH)(unkown) - // U__s_(3)candidate-4-1.i586(RepoHIGH)(unkown) <- (update) candidate if allowVendorChange - // U__s_(6)candidate-0-1.x86_64(RepoMID)(SUSE) - // U__s_(7)candidate-0-1.i586(RepoMID)(SUSE) <- candidate (highest prio matching arch and vendor) - // U__s_(4)candidate-2-1.x86_64(RepoLOW)(openSUSE) - // U__s_(5)candidate-2-1.i586(RepoLOW)(openSUSE) - // } - if ( ZConfig::instance().solver_allowVendorChange() ) - { - BOOST_CHECK_EQUAL( s->candidateObj()->repoInfo().alias(), "RepoHIGH" ); - BOOST_CHECK_EQUAL( s->candidateObj()->edition(), Edition("4-1") ); - BOOST_CHECK_EQUAL( s->candidateObj()->arch(), Arch_i586 ); - // updateCandidate: - BOOST_CHECK_EQUAL( s->updateCandidateObj(), s->candidateObj() ); - } - else - { - BOOST_CHECK_EQUAL( s->candidateObj()->repoInfo().alias(), "RepoMID" ); - BOOST_CHECK_EQUAL( s->candidateObj()->edition(), Edition("0-1") ); - BOOST_CHECK_EQUAL( s->candidateObj()->arch(), Arch_i586 ); - // no updateCandidate due to low version - BOOST_CHECK_EQUAL( s->updateCandidateObj(), PoolItem() ); - } -} - -BOOST_AUTO_TEST_CASE(candiadatenoarch) -{ - ResPoolProxy poolProxy( test.poolProxy() ); - ui::Selectable::Ptr s( poolProxy.lookup( ResKind::package, "candidatenoarch" ) ); -/*[package]candidatenoarch: S_KeepInstalled - (I 1) { - I__s_(17)candidatenoarch-1-1.i586(@System) -} (A 8) { - C U__s_(4)candidatenoarch-5-1.noarch(RepoHIGH) <- candidate (arch/noarch change) - U__s_(5)candidatenoarch-4-1.x86_64(RepoHIGH) - U__s_(6)candidatenoarch-4-1.i586(RepoHIGH) - U__s_(7)candidatenoarch-4-1.noarch(RepoHIGH) - U__s_(12)candidatenoarch-0-2.noarch(RepoMID) - U__s_(13)candidatenoarch-0-1.x86_64(RepoMID) - U__s_(14)candidatenoarch-0-1.i586(RepoMID) - U__s_(15)candidatenoarch-0-1.noarch(RepoMID) -} */ - BOOST_CHECK_EQUAL( s->candidateObj()->repoInfo().alias(), "RepoHIGH" ); - BOOST_CHECK_EQUAL( s->candidateObj()->edition(), Edition("5-1") ); - BOOST_CHECK_EQUAL( s->candidateObj()->arch(), Arch_noarch ); - // no updateCandidate due to low version - BOOST_CHECK_EQUAL( s->updateCandidateObj(), s->candidateObj() ); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// Status change tests -// -///////////////////////////////////////////////////////////////////////////// - -// build ResStatus and return whether the comination is supported. (e.g currently no LOCKED state below APPL_HIGH) -inline bool initStatus( ResStatus::TransactValue fromState, ResStatus::TransactByValue fromBy, ResStatus & from ) -{ - from = ResStatus(); - if ( fromState == ResStatus::KEEP_STATE ) - { - from.setSoftLock( fromBy ); - } - else - { - from.setTransactValue( fromState, fromBy ); - if ( fromState == ResStatus::LOCKED && ! from.isLocked() ) - return false; // no lock at this level (by now just USER APPL_HIGH) - } - return true; -} - -///////////////////////////////////////////////////////////////////////////// -// status verification helper -///////////////////////////////////////////////////////////////////////////// -// enum TransactValue -// { -// KEEP_STATE = bit::RangeValue::value, -// LOCKED = bit::RangeValue::value, // locked, must not transact -// TRANSACT = bit::RangeValue::value // transact according to state -// }; - -template -inline bool _all( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r ) -{ - for_( it, begin_r, end_r ) - { - if ( it->status().getTransactValue() != val_r ) - return false; - } - return true; -} - -template -inline bool _none( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r ) -{ - for_( it, begin_r, end_r ) - { - if ( it->status().getTransactValue() == val_r ) - return false; - } - return true; -} - -template -inline bool _atLeastOne( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r ) -{ return ! _none( begin_r, end_r, val_r ); } - -inline bool _allBySolver( ui::Selectable::Ptr sel ) -{ - for_( it, sel->installedBegin(), sel->installedEnd() ) - { - if ( it->status().transacts() && ! it->status().isBySolver() ) - return false; - } - for_( it, sel->availableBegin(), sel->availableEnd() ) - { - if ( it->status().transacts() && ! it->status().isBySolver() ) - return false; - } - return true; -} - -inline bool _allInstalled( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _all( sel->installedBegin(), sel->installedEnd(), val_r ); } -inline bool _noneInstalled( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _none( sel->installedBegin(), sel->installedEnd(), val_r ); } -inline bool _atLeastOneInstalled( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _atLeastOne( sel->installedBegin(), sel->installedEnd(), val_r ); } - -inline bool _allAvailable( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _all( sel->availableBegin(), sel->availableEnd(), val_r ); } -inline bool _noneAvailable( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _none( sel->availableBegin(), sel->availableEnd(), val_r ); } -inline bool _atLeastOneAvailable( ui::Selectable::Ptr sel, ResStatus::TransactValue val_r ) { return _atLeastOne( sel->availableBegin(), sel->availableEnd(), val_r ); } - -inline bool _haveInstalled( ui::Selectable::Ptr sel ) { return ! sel->installedEmpty(); } -inline bool _haveAvailable( ui::Selectable::Ptr sel ) { return ! sel->availableEmpty(); } - -inline bool _noInstalled( ui::Selectable::Ptr sel ) { return sel->installedEmpty(); } -inline bool _noAvailable( ui::Selectable::Ptr sel ) { return sel->availableEmpty(); } - -#define allInstalled(V) _allInstalled(sel,ResStatus::V) -#define noneInstalled(V) _noneInstalled(sel,ResStatus::V) -#define atLeastOneInstalled(V) _atLeastOneInstalled(sel,ResStatus::V) - -#define allAvailable(V) _allAvailable(sel,ResStatus::V) -#define noneAvailable(V) _noneAvailable(sel,ResStatus::V) -#define atLeastOneAvailable(V) _atLeastOneAvailable(sel,ResStatus::V) - -#define haveInstalled _haveInstalled(sel) -#define haveAvailable _haveAvailable(sel) -#define noInstalled _noInstalled(sel) -#define noAvailable _noAvailable(sel) - -#define allBySolver _allBySolver(sel) - -// Verify Selectable::status computes the right value. -// -// S_Protected, // Keep this unmodified ( have installedObj && S_Protected ) -// S_Taboo, // Keep this unmodified ( have no installedObj && S_Taboo) -// // requested by user: -// S_Del, // delete installedObj ( clears S_Protected if set ) -// S_Update, // install candidateObj ( have installedObj, clears S_Protected if set ) -// S_Install, // install candidateObj ( have no installedObj, clears S_Taboo if set ) -// // not requested by user: -// S_AutoDel, // delete installedObj -// S_AutoUpdate, // install candidateObj ( have installedObj ) -// S_AutoInstall, // install candidateObj ( have no installedObj ) -// // no modification: -// S_KeepInstalled, // no modification ( have installedObj && !S_Protected, clears S_Protected if set ) -// S_NoInst, // no modification ( have no installedObj && !S_Taboo, clears S_Taboo if set ) -void verifyState( ui::Selectable::Ptr sel ) -{ - ui::Status status( sel->status() ); - SEC << dump(sel) << endl; - switch ( status ) - { - case ui::S_Update: - case ui::S_AutoUpdate: - BOOST_CHECK( haveInstalled ); - BOOST_CHECK( atLeastOneAvailable(TRANSACT) ); - BOOST_CHECK_EQUAL( allBySolver, status==ui::S_AutoUpdate ); - break; - - case ui::S_Del: - case ui::S_AutoDel: - BOOST_CHECK( haveInstalled ); - BOOST_CHECK( noneAvailable(TRANSACT) ); // else would be UPDATE - BOOST_CHECK( atLeastOneInstalled(TRANSACT) ); - BOOST_CHECK_EQUAL( allBySolver, status==ui::S_AutoDel ); - break; - - case ui::S_Protected: - BOOST_CHECK( haveInstalled ); - BOOST_CHECK( noneAvailable(TRANSACT) ); // else would be UPDATE - BOOST_CHECK( noneInstalled(TRANSACT) ); // else would be DEL - BOOST_CHECK( allInstalled(LOCKED) ); // implies noneInstalled(TRANSACT) - break; - - case ui::S_KeepInstalled: - BOOST_CHECK( haveInstalled ); - BOOST_CHECK( noneAvailable(TRANSACT) ); // else would be UPDATE - BOOST_CHECK( noneInstalled(TRANSACT) ); // else would be DEL - BOOST_CHECK( ! allInstalled(LOCKED) ); // else would be PROTECTED - break; - - - case ui::S_Install: - case ui::S_AutoInstall: - BOOST_CHECK( noInstalled ); - BOOST_CHECK( atLeastOneAvailable(TRANSACT) ); - BOOST_CHECK_EQUAL( allBySolver, status==ui::S_AutoInstall ); - break; - - case ui::S_Taboo: - BOOST_CHECK( noInstalled ); - BOOST_CHECK( noneAvailable(TRANSACT) ); // else would be INSTALL - BOOST_CHECK( allAvailable(LOCKED) ); // implies noneAvailable(TRANSACT) - break; - - - case ui::S_NoInst: - BOOST_CHECK( noInstalled ); - BOOST_CHECK( noneAvailable(TRANSACT) ); // else would be INSTALL - BOOST_CHECK( ! allAvailable(LOCKED) ); // else would be TABOO - break; - } -} - -// Create all ResStatus combinations over a Selectables PoolItems -struct StatusCombination -{ - StatusCombination() - {} - StatusCombination( ui::Selectable::Ptr sel_r ) - { - _items.insert( _items.end(), sel_r->installedBegin(), sel_r->installedEnd() ); - _items.insert( _items.end(), sel_r->availableBegin(), sel_r->availableEnd() ); - } - bool next() - { - for (auto i : _items) - { - switch ( i.status().getTransactValue() ) - { - case ResStatus::KEEP_STATE: - i.status().setTransactValue( ResStatus::LOCKED, ResStatus::USER ); - return true; - break; - case ResStatus::LOCKED: - i.status().setTransactValue( ResStatus::TRANSACT, ResStatus::USER ); - return true; - break; - case ResStatus::TRANSACT: - i.status().setTransactValue( ResStatus::KEEP_STATE, ResStatus::USER ); - break; - } - } - return false; // back at the beginning - } - - std::vector _items; -}; - -// Create all ResStatus combinations over the Selectables PoolItems and verify the result. -void testStatusTable( ui::Selectable::Ptr sel ) -{ - StatusCombination comb( sel ); - do { - verifyState( sel ); - } while ( comb.next() ); -} - -BOOST_AUTO_TEST_CASE(status_change) -{ - // this verifies the Selectables computes ui::Status - ResPoolProxy poolProxy( test.poolProxy() ); - poolProxy.saveState(); - { - ui::Selectable::Ptr sel( poolProxy.lookup( ResKind::package, "installed_only" ) ); - BOOST_REQUIRE( !sel->installedEmpty() ); - BOOST_REQUIRE( sel->availableEmpty() ); - BOOST_CHECK_EQUAL( sel->status(), ui::S_KeepInstalled ); - testStatusTable( sel ); - } - { - ui::Selectable::Ptr sel( poolProxy.lookup( ResKind::package, "installed_and_available" ) ); - BOOST_REQUIRE( !sel->installedEmpty() ); - BOOST_REQUIRE( !sel->availableEmpty() ); - BOOST_CHECK_EQUAL( sel->status(), ui::S_KeepInstalled ); - testStatusTable( sel ); - } - { - ui::Selectable::Ptr sel( poolProxy.lookup( ResKind::package, "available_only" ) ); - BOOST_REQUIRE( sel->installedEmpty() ); - BOOST_REQUIRE( !sel->availableEmpty() ); - BOOST_CHECK_EQUAL( sel->status(), ui::S_NoInst ); - testStatusTable( sel ); - } - - // TODO: Test the pickStatus computation (w./w.o. multiinstall) - // TODO: Test status/pickStatus transactions (w./w.o. multiinstall) -} - -///////////////////////////////////////////////////////////////////////////// - diff --git a/libzypp/tests/zypp/SetRelationMixin_test.cc b/libzypp/tests/zypp/SetRelationMixin_test.cc deleted file mode 100644 index e3195f1..0000000 --- a/libzypp/tests/zypp/SetRelationMixin_test.cc +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include "zypp/base/SetRelationMixin.h" - -using zypp::SetCompare; -using zypp::SetRelation; - -BOOST_AUTO_TEST_CASE(set_compare) -{ - BOOST_CHECK( SetCompare::uncomparable == SetCompare::uncomparable ); - BOOST_CHECK( SetCompare::uncomparable != SetCompare::equal ); - BOOST_CHECK( SetCompare::uncomparable != SetCompare::properSubset ); - BOOST_CHECK( SetCompare::uncomparable != SetCompare::properSuperset ); - BOOST_CHECK( SetCompare::uncomparable != SetCompare::disjoint ); - - BOOST_CHECK( SetCompare::equal != SetCompare::uncomparable ); - BOOST_CHECK( SetCompare::equal == SetCompare::equal ); - BOOST_CHECK( SetCompare::equal != SetCompare::properSubset ); - BOOST_CHECK( SetCompare::equal != SetCompare::properSuperset ); - BOOST_CHECK( SetCompare::equal != SetCompare::disjoint ); - - BOOST_CHECK( SetCompare::properSubset != SetCompare::uncomparable ); - BOOST_CHECK( SetCompare::properSubset != SetCompare::equal ); - BOOST_CHECK( SetCompare::properSubset == SetCompare::properSubset ); - BOOST_CHECK( SetCompare::properSubset != SetCompare::properSuperset ); - BOOST_CHECK( SetCompare::properSubset != SetCompare::disjoint ); - - BOOST_CHECK( SetCompare::properSuperset != SetCompare::uncomparable ); - BOOST_CHECK( SetCompare::properSuperset != SetCompare::equal ); - BOOST_CHECK( SetCompare::properSuperset != SetCompare::properSubset ); - BOOST_CHECK( SetCompare::properSuperset == SetCompare::properSuperset ); - BOOST_CHECK( SetCompare::properSuperset != SetCompare::disjoint ); - - BOOST_CHECK( SetCompare::disjoint != SetCompare::uncomparable ); - BOOST_CHECK( SetCompare::disjoint != SetCompare::equal ); - BOOST_CHECK( SetCompare::disjoint != SetCompare::properSubset ); - BOOST_CHECK( SetCompare::disjoint != SetCompare::properSuperset ); - BOOST_CHECK( SetCompare::disjoint == SetCompare::disjoint ); -} - -BOOST_AUTO_TEST_CASE(set_relation) -{ - BOOST_CHECK( SetRelation::uncomparable == SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::equal ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::subset ); - BOOST_CHECK( SetRelation::uncomparable != SetRelation::superset ); - - BOOST_CHECK( SetRelation::equal != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::equal == SetRelation::equal ); - BOOST_CHECK( SetRelation::equal != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::equal != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::equal != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::equal != SetRelation::subset ); - BOOST_CHECK( SetRelation::equal != SetRelation::superset ); - - BOOST_CHECK( SetRelation::properSubset != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::properSubset != SetRelation::equal ); - BOOST_CHECK( SetRelation::properSubset == SetRelation::properSubset ); - BOOST_CHECK( SetRelation::properSubset != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::properSubset != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::properSubset != SetRelation::subset ); - BOOST_CHECK( SetRelation::properSubset != SetRelation::superset ); - - BOOST_CHECK( SetRelation::properSuperset != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::properSuperset != SetRelation::equal ); - BOOST_CHECK( SetRelation::properSuperset != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::properSuperset == SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::properSuperset != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::properSuperset != SetRelation::subset ); - BOOST_CHECK( SetRelation::properSuperset != SetRelation::superset ); - - BOOST_CHECK( SetRelation::disjoint != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::disjoint != SetRelation::equal ); - BOOST_CHECK( SetRelation::disjoint != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::disjoint != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::disjoint == SetRelation::disjoint ); - BOOST_CHECK( SetRelation::disjoint != SetRelation::subset ); - BOOST_CHECK( SetRelation::disjoint != SetRelation::superset ); - - BOOST_CHECK( SetRelation::subset != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::subset != SetRelation::equal ); - BOOST_CHECK( SetRelation::subset != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::subset != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::subset != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::subset == SetRelation::subset ); - BOOST_CHECK( SetRelation::subset != SetRelation::superset ); - - BOOST_CHECK( SetRelation::superset != SetRelation::uncomparable ); - BOOST_CHECK( SetRelation::superset != SetRelation::equal ); - BOOST_CHECK( SetRelation::superset != SetRelation::properSubset ); - BOOST_CHECK( SetRelation::superset != SetRelation::properSuperset ); - BOOST_CHECK( SetRelation::superset != SetRelation::disjoint ); - BOOST_CHECK( SetRelation::superset != SetRelation::subset ); - BOOST_CHECK( SetRelation::superset == SetRelation::superset ); -} - -BOOST_AUTO_TEST_CASE(set_relation_comapre) -{ - BOOST_CHECK( SetRelation::uncomparable == SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::uncomparable != SetCompare::equal ); - BOOST_CHECK( SetRelation::uncomparable != SetCompare::properSubset ); - BOOST_CHECK( SetRelation::uncomparable != SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::uncomparable != SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::equal != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::equal == SetCompare::equal ); - BOOST_CHECK( SetRelation::equal != SetCompare::properSubset ); - BOOST_CHECK( SetRelation::equal != SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::equal != SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::properSubset != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::properSubset != SetCompare::equal ); - BOOST_CHECK( SetRelation::properSubset == SetCompare::properSubset ); - BOOST_CHECK( SetRelation::properSubset != SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::properSubset != SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::properSuperset != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::properSuperset != SetCompare::equal ); - BOOST_CHECK( SetRelation::properSuperset != SetCompare::properSubset ); - BOOST_CHECK( SetRelation::properSuperset == SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::properSuperset != SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::disjoint != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::disjoint != SetCompare::equal ); - BOOST_CHECK( SetRelation::disjoint != SetCompare::properSubset ); - BOOST_CHECK( SetRelation::disjoint != SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::disjoint == SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::subset != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::subset == SetCompare::equal ); - BOOST_CHECK( SetRelation::subset == SetCompare::properSubset ); - BOOST_CHECK( SetRelation::subset != SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::subset != SetCompare::disjoint ); - - BOOST_CHECK( SetRelation::superset != SetCompare::uncomparable ); - BOOST_CHECK( SetRelation::superset == SetCompare::equal ); - BOOST_CHECK( SetRelation::superset != SetCompare::properSubset ); - BOOST_CHECK( SetRelation::superset == SetCompare::properSuperset ); - BOOST_CHECK( SetRelation::superset != SetCompare::disjoint ); -} diff --git a/libzypp/tests/zypp/Signature_test.cc b/libzypp/tests/zypp/Signature_test.cc deleted file mode 100644 index 1fe0fc7..0000000 --- a/libzypp/tests/zypp/Signature_test.cc +++ /dev/null @@ -1,30 +0,0 @@ - -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/Signature.h" - -#include - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; - -using namespace std; -using namespace zypp; - - -void signature_test() -{ -} - -test_suite* -init_unit_test_suite( int, char* [] ) -{ - test_suite* test= BOOST_TEST_SUITE( "SignaureTest" ); - test->add( BOOST_TEST_CASE( &signature_test ), 0 /* expected zero error */ ); - return test; -} - diff --git a/libzypp/tests/zypp/StrMatcher_test.cc b/libzypp/tests/zypp/StrMatcher_test.cc deleted file mode 100644 index ec2e157..0000000 --- a/libzypp/tests/zypp/StrMatcher_test.cc +++ /dev/null @@ -1,158 +0,0 @@ -#include "TestSetup.h" -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : Matcher -// -/////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(Match_default) -{ - Match m; - BOOST_CHECK( !m ); // eval in boolean context - BOOST_CHECK_EQUAL( m, Match::NOTHING ); - BOOST_CHECK_EQUAL( m.get(), 0 ); - - // set the mode part - BOOST_CHECK_EQUAL( m |= Match::STRING, Match::STRING ); - - m.setModeSubstring(); - BOOST_CHECK_EQUAL( m, Match::SUBSTRING ); - - m.setMode( Match::GLOB ); - BOOST_CHECK_EQUAL( m, Match::GLOB ); - - BOOST_CHECK_EQUAL( m = Match::REGEX, Match::REGEX ); - - BOOST_CHECK( m.isModeRegex() ); - m |= Match::NOCASE | Match::FILES; - BOOST_CHECK_EQUAL( m, Match::REGEX | Match::NOCASE | Match::FILES ); - - BOOST_CHECK( m.testAnyOf( Match::SUBSTRING | Match::NOCASE | Match::FILES ) ); - BOOST_CHECK( !m.test( Match::SUBSTRING | Match::NOCASE | Match::FILES ) ); - BOOST_CHECK( m.test( Match::REGEX | Match::NOCASE | Match::FILES ) ); - BOOST_CHECK( m.test( Match::NOCASE | Match::FILES ) ); - BOOST_CHECK( m != (Match::NOCASE | Match::FILES) ); - BOOST_CHECK_EQUAL( m.flags(),Match::NOCASE | Match::FILES ); - - m -= Match::NOCASE; // remove flags - BOOST_CHECK( m.test( Match::REGEX | Match::FILES ) ); - m -= Match::REGEX; - BOOST_CHECK_EQUAL( m, Match::FILES ); -} - -BOOST_AUTO_TEST_CASE(Match_operator) -{ - // Test whether implicit conversions from enum Match::Mode to - // Matcher work. There must be no difference in using mode and flag - // constants. These tests usually fail at compiletime, if some operator - // overload is missing. - // - // E.G.: - // inline Match operator|( const Match & lhs, const Match & rhs ) - // this does not cover (REGEX|SUBSTRING), because if both arguments - // are enum Mode the compiler might want to use operator|(int,int) - // instead. - - Match m( Match::GLOB ); - m = Match::GLOB; - - m |= Match::GLOB; - m = Match::SUBSTRING | Match::GLOB; - - m -= Match::GLOB; - m = Match::SUBSTRING - Match::GLOB; -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : StrMatcher -// -/////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_CASE(StrMatcher_defaultconstructed) -{ - StrMatcher m; - BOOST_CHECK_EQUAL( m.flags(), Match::NOTHING ); - BOOST_CHECK( !m ); // eval in boolean context - BOOST_CHECK( m.searchstring().empty() ); - BOOST_CHECK_EQUAL( m.flags(), Match() ); - // matches nothing: - BOOST_CHECK( !m( "" ) ); - BOOST_CHECK( !m( " " ) ); - BOOST_CHECK( !m( "a" ) ); - BOOST_CHECK( !m( "default" ) ); - - m.setSearchstring( "fau" ); - BOOST_CHECK( m ); // eval in boolean context -} - -BOOST_AUTO_TEST_CASE(StrMatcher_OTHER) -{ - StrMatcher m( "fau", Match::OTHER ); - BOOST_CHECK_THROW( m.compile(), MatchUnknownModeException ); -} - -BOOST_AUTO_TEST_CASE(StrMatcher_STRING) -{ - StrMatcher m( "fau" ); - BOOST_CHECK_EQUAL( m.flags(), Match::STRING ); - BOOST_CHECK( !m( "" ) ); - BOOST_CHECK( !m( "a" ) ); - BOOST_CHECK( m( "fau" ) ); - BOOST_CHECK( !m( "default" ) ); -} - -BOOST_AUTO_TEST_CASE(StrMatcher_STRINGSTART) -{ - StrMatcher m( "fau", Match::STRINGSTART ); - BOOST_CHECK( !m( "" ) ); - BOOST_CHECK( !m( "a" ) ); - BOOST_CHECK( m( "fau" ) ); - BOOST_CHECK( m( "fault" ) ); - BOOST_CHECK( !m( "default" ) ); -} - -BOOST_AUTO_TEST_CASE(StrMatcher_STRINGEND) -{ - StrMatcher m( "fau", Match::STRINGEND ); - BOOST_CHECK( !m( "" ) ); - BOOST_CHECK( !m( "a" ) ); - BOOST_CHECK( m( "fau" ) ); - BOOST_CHECK( m( "defau" ) ); - BOOST_CHECK( !m( "default" ) ); -} - -BOOST_AUTO_TEST_CASE(StrMatcher_REGEX) -{ - StrMatcher m( "fau" ); - - BOOST_CHECK( !m.isCompiled() ); - BOOST_CHECK_NO_THROW( m.compile() ); - - m.setSearchstring( "wa[" ); - BOOST_CHECK( !m.isCompiled() ); - m.setFlags( Match::REGEX ); - BOOST_CHECK( !m.isCompiled() ); - BOOST_CHECK_THROW( m.compile(), MatchInvalidRegexException ); - BOOST_CHECK( !m.isCompiled() ); - - m.setSearchstring( "wa[a]" ); - BOOST_CHECK_NO_THROW( m.compile() ); - BOOST_CHECK( m.isCompiled() ); - - BOOST_CHECK( !m( "was" ) ); - BOOST_CHECK( !m( "qwasq" ) ); - BOOST_CHECK( m( "qwaaq" ) ); -} - -#if 0 -BOOST_AUTO_TEST_CASE(StrMatcher_) -{ - base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "/tmp/YLOG" ) ); - MIL << "GO" << endl; -} -#endif diff --git a/libzypp/tests/zypp/Target_test.cc b/libzypp/tests/zypp/Target_test.cc deleted file mode 100644 index cfb6ecd..0000000 --- a/libzypp/tests/zypp/Target_test.cc +++ /dev/null @@ -1,49 +0,0 @@ - -#include -#include -#include - -// Boost.Test -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ZYpp.h" -#include "zypp/ZYppFactory.h" -#include "zypp/TmpPath.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; -using namespace zypp::filesystem; - -BOOST_AUTO_TEST_CASE(target_test) -{ - - filesystem::TmpDir tmp; - - ZYpp::Ptr z = getZYpp(); - - // create the products.d directory - assert_dir(tmp.path() / "/etc/products.d" ); - BOOST_CHECK( copy( Pathname(TESTS_SRC_DIR) / "/zypp/data/Target/product.prod", tmp.path() / "/etc/products.d/product.prod") == 0 ); - - // make it the base product - BOOST_CHECK( symlink(tmp.path() / "/etc/products.d/product.prod", tmp.path() / "/etc/products.d/baseproduct" ) == 0 ); - - z->initializeTarget( tmp.path() ); - - BOOST_CHECK( ! z->target()->anonymousUniqueId().empty() ); - BOOST_CHECK( PathInfo( tmp.path() / "/var/lib/zypp/AnonymousUniqueId").isExist() ); - BOOST_CHECK( PathInfo( tmp.path() / "/var/lib/zypp/AnonymousUniqueId").size() > 0 ); - - // now check the base product - BOOST_CHECK_EQUAL( z->target()->targetDistribution(), "sle-10-i586"); - BOOST_CHECK_EQUAL( z->target()->targetDistributionRelease(), "special_edition"); - BOOST_CHECK_EQUAL( z->target()->distributionVersion(), "10"); - - Target::DistributionLabel dlabel( z->target()->distributionLabel() ); - BOOST_CHECK_EQUAL( dlabel.summary, "A cool distribution" ); - BOOST_CHECK_EQUAL( dlabel.shortName, "" ); -} diff --git a/libzypp/tests/zypp/Url_test.cc b/libzypp/tests/zypp/Url_test.cc deleted file mode 100644 index 60d8e49..0000000 --- a/libzypp/tests/zypp/Url_test.cc +++ /dev/null @@ -1,289 +0,0 @@ -/* -** Check if the url by scheme repository works, e.g. -** if there are some initialization order problems -** (ViewOption) causing asString to format its string -** differently than configured. -*/ - -#include "zypp/base/Exception.h" -#include "zypp/base/String.h" - -#include "zypp/Url.h" -#include -#include -#include - -// Boost.Test -#include - -using boost::unit_test::test_case; -using namespace zypp; - -void testUrlAuthority( const Url & url_r, - const std::string & host_r, const std::string & port_r = std::string(), - const std::string & user_r = std::string(), const std::string & pass_r = std::string() ) -{ - BOOST_CHECK_EQUAL( url_r.getUsername(), user_r ); - BOOST_CHECK_EQUAL( url_r.getPassword(), pass_r ); - BOOST_CHECK_EQUAL( url_r.getHost(), host_r ); - BOOST_CHECK_EQUAL( url_r.getPort(), port_r ); -} - - -BOOST_AUTO_TEST_CASE(test_ipv6_url) -{ - std::string str; - zypp::Url url; - - str = "http://[2001:DB8:0:F102::1]/64/sles11/RC1/CD1?device=eth0"; - url = Url( str ); - BOOST_CHECK_EQUAL( str,url.asString() ); - testUrlAuthority( url, "[2001:DB8:0:F102::1]", "", "", "" ); - - // bnc# - str = "http://[2001:DB8:0:F102::1]:8080/64/sles11/RC1/CD1?device=eth0"; - url = Url( str ); - testUrlAuthority( url, "[2001:DB8:0:F102::1]", "8080", "", "" ); - - - str = "http://user:pass@[2001:DB8:0:F102::1]:8080/64/sles11/RC1/CD1?device=eth0"; - url = Url( str ); - testUrlAuthority( url, "[2001:DB8:0:F102::1]", "8080", "user", "pass" ); -} - -BOOST_AUTO_TEST_CASE(test_url1) -{ - std::string str, one, two; - zypp::Url url; - - - // asString & asCompleteString should not print "mailto://" - str = "mailto:feedback@example.com?subject=hello"; - url = str; - BOOST_CHECK_EQUAL( str, url.asString() ); - BOOST_CHECK_EQUAL( str, url.asCompleteString() ); - - // asString & asCompleteString should add empty authority - // "dvd://...", except we request to avoid it. - str = "dvd:/srv/ftp"; - one = "dvd:///srv/ftp"; - two = "dvd:///srv/ftp"; - url = str; - - BOOST_CHECK_EQUAL( one, url.asString() ); - BOOST_CHECK_EQUAL( two, url.asCompleteString() ); - BOOST_CHECK_EQUAL( str, url.asString(zypp::url::ViewOptions() - - zypp::url::ViewOption::EMPTY_AUTHORITY)); - - // asString shouldn't print the password, asCompleteString should - // further, the "//" at the begin of the path should become "/%2F" - str = "ftp://user:pass@localhost//srv/ftp"; - one = "ftp://user@localhost/%2Fsrv/ftp"; - two = "ftp://user:pass@localhost/%2Fsrv/ftp"; - url = str; - - BOOST_CHECK_EQUAL( one, url.asString() ); - BOOST_CHECK_EQUAL( two, url.asCompleteString() ); - - // asString shouldn't print the password, asCompleteString should. - // further, the "//" at the begin of the path should be keept. - str = "http://user:pass@localhost//srv/ftp"; - one = "http://user@localhost//srv/ftp"; - two = str; - url = str; - - BOOST_CHECK_EQUAL( one, url.asString() ); - BOOST_CHECK_EQUAL( two, url.asCompleteString() ); - - // absolute path defaults to 'file://' - str = "/some/local/path"; - BOOST_CHECK_EQUAL( zypp::Url(str).asString(), "file://"+str ); - - str = "file:./srv/ftp"; - BOOST_CHECK_EQUAL( zypp::Url(str).asString(), str ); - - str = "ftp://foo//srv/ftp"; - BOOST_CHECK_EQUAL( zypp::Url(str).asString(), "ftp://foo/%2Fsrv/ftp" ); - - str = "FTP://user@local%68ost/%2f/srv/ftp"; - BOOST_CHECK_EQUAL( zypp::Url(str).asString(), "ftp://user@localhost/%2f/srv/ftp" ); - - str = "http://[::1]/foo/bar"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString() ); - - str = "http://:@just-localhost.example.net:8080/"; - BOOST_CHECK_EQUAL( zypp::Url(str).asString(), "http://just-localhost.example.net:8080/" ); - - str = "mailto:feedback@example.com?subject=hello"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString() ); - - str = "nfs://nfs-server/foo/bar/trala"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString() ); - - str = "ldap://example.net/dc=example,dc=net?cn,sn?sub?(cn=*)#x"; - BOOST_CHECK_THROW( zypp::Url(str).asString(), url::UrlNotAllowedException ); - - str = "ldap://example.net/dc=example,dc=net?cn,sn?sub?(cn=*)"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString() ); - - // parseable but invalid, since no host avaliable - str = "ldap:///dc=foo,dc=bar"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString()); - BOOST_CHECK( !zypp::Url(str).isValid()); - - // throws: host is mandatory - str = "ftp:///foo/bar"; - BOOST_CHECK_THROW(zypp::Url(str).asString(), url::UrlNotAllowedException ); - - // throws: host is mandatory - str = "http:///%2f/srv/ftp"; - BOOST_CHECK_THROW(zypp::Url(str).asString(), url::UrlNotAllowedException ); - - // OK, host allowed in file-url - str = "file://localhost/some/path"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString()); - - // throws: host not allowed - str = "cd://localhost/some/path"; - BOOST_CHECK_THROW(zypp::Url(str).asString(), url::UrlNotAllowedException ); - - // throws: no path (email) - str = "mailto:"; - BOOST_CHECK_THROW(zypp::Url(str).asString(), url::UrlNotAllowedException ); - - // throws: no path - str = "cd:"; - BOOST_CHECK_THROW(zypp::Url(str).asString(), url::UrlNotAllowedException ); - - // OK, valid (no host, path is there) - str = "cd:///some/path"; - BOOST_CHECK_EQUAL( str, zypp::Url(str).asString()); - BOOST_CHECK( zypp::Url(str).isValid()); -} - -BOOST_AUTO_TEST_CASE(test_url2) -{ - zypp::Url url("http://user:pass@localhost:/path/to;version=1.1?arg=val#frag"); - - BOOST_CHECK_EQUAL( url.asString(), - "http://user@localhost/path/to?arg=val#frag" ); - - BOOST_CHECK_EQUAL( url.asString(zypp::url::ViewOptions() + - zypp::url::ViewOptions::WITH_PASSWORD), - "http://user:pass@localhost/path/to?arg=val#frag"); - - BOOST_CHECK_EQUAL( url.asString(zypp::url::ViewOptions() + - zypp::url::ViewOptions::WITH_PATH_PARAMS), - "http://user@localhost/path/to;version=1.1?arg=val#frag"); - - BOOST_CHECK_EQUAL( url.asCompleteString(), - "http://user:pass@localhost/path/to;version=1.1?arg=val#frag"); -} - -BOOST_AUTO_TEST_CASE(test_url3) -{ - zypp::Url url("http://localhost/path/to#frag"); - std::string key; - std::string val; - - // will be encoded as "hoho=ha%20ha" - key = "hoho"; - val = "ha ha"; - url.setQueryParam(key, val); - BOOST_CHECK_EQUAL( url.asString(), - "http://localhost/path/to?hoho=ha%20ha#frag"); - - // will be encoded as "foo%3Dbar%26key=foo%26bar%3Dvalue" - key = "foo=bar&key"; - val = "foo&bar=value"; - url.setQueryParam(key, val); - BOOST_CHECK_EQUAL( url.asString(), - "http://localhost/path/to?foo%3Dbar%26key=foo%26bar%3Dvalue&hoho=ha%20ha#frag"); - - // will be encoded as "foo%25bar=is%25de%25ad" - key = "foo%bar"; - val = "is%de%ad"; - url.setQueryParam(key, val); - BOOST_CHECK_EQUAL( url.asString(), - "http://localhost/path/to?foo%25bar=is%25de%25ad&foo%3Dbar%26key=foo%26bar%3Dvalue&hoho=ha%20ha#frag"); - - // get encoded query parameters and compare with results: - zypp::url::ParamVec params( url.getQueryStringVec()); - const char * const result[] = { - "foo%25bar=is%25de%25ad", - "foo%3Dbar%26key=foo%26bar%3Dvalue", - "hoho=ha%20ha" - }; - BOOST_CHECK( params.size() == (sizeof(result)/sizeof(result[0]))); - for( size_t i=0; ifirst) - { - BOOST_CHECK_EQUAL( m->second, "cn,sn"); - } - else - if("filter" == m->first) - { - BOOST_CHECK_EQUAL( m->second, "(cn=*)"); - } - else - if("scope" == m->first) - { - BOOST_CHECK_EQUAL( m->second, "sub"); - } - else - { - BOOST_FAIL("Unexpected LDAP query parameter name in the map!"); - } - } - - url.setQueryParam("attrs", "cn,sn,uid"); - url.setQueryParam("filter", "(|(sn=foo)(cn=bar))"); - - BOOST_CHECK_EQUAL(url.getQueryParam("attrs"), "cn,sn,uid"); - BOOST_CHECK_EQUAL(url.getQueryParam("filter"), "(|(sn=foo)(cn=bar))"); - - } - catch(const zypp::url::UrlException &e) - { - ZYPP_CAUGHT(e); - } -} - -BOOST_AUTO_TEST_CASE(plugin_querystring_args) -{ - // url querysting options without value must be possible - // e.g. for plugin schema - Url u( "plugin:script?loptv=lvalue&v=optv&lopt=&o" ); - url::ParamMap pm( u.getQueryStringMap() ); - BOOST_CHECK_EQUAL( pm.size(), 4 ); - BOOST_CHECK_EQUAL( pm["loptv"], "lvalue" ); - BOOST_CHECK_EQUAL( pm["v"], "optv" ); - BOOST_CHECK_EQUAL( pm["lopt"], "" ); - BOOST_CHECK_EQUAL( pm["o"], "" ); -} - -// vim: set ts=2 sts=2 sw=2 ai et: diff --git a/libzypp/tests/zypp/Vendor2_test.cc b/libzypp/tests/zypp/Vendor2_test.cc deleted file mode 100644 index 8d62368..0000000 --- a/libzypp/tests/zypp/Vendor2_test.cc +++ /dev/null @@ -1,44 +0,0 @@ - -#include -#include -#include - -// Boost.Test -#include - -#include "zypp/base/LogControl.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/ZYpp.h" -#include "zypp/VendorAttr.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; - -namespace zypp -{ - void reconfigureZConfig( const Pathname & ); -} - -#define DATADIR (Pathname(TESTS_BUILD_DIR) + "/zypp/data/Vendor") - - -BOOST_AUTO_TEST_CASE(vendor2_test) -{ - reconfigureZConfig( DATADIR / "zypp2.conf" ); - - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia_new_new", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "opensuse") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "nvidia") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("ati_new", "ati") ); -} - diff --git a/libzypp/tests/zypp/Vendor_test.cc b/libzypp/tests/zypp/Vendor_test.cc deleted file mode 100644 index 870a7b7..0000000 --- a/libzypp/tests/zypp/Vendor_test.cc +++ /dev/null @@ -1,46 +0,0 @@ - -#include -#include -#include - -// Boost.Test -#include - -#include "zypp/base/LogControl.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/ZYpp.h" -#include "zypp/VendorAttr.h" - -using boost::unit_test::test_case; -using namespace std; -using namespace zypp; - -namespace zypp -{ - void reconfigureZConfig( const Pathname & ); -} - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Vendor") - -BOOST_AUTO_TEST_CASE(vendor_test1) -{ - reconfigureZConfig( DATADIR / "zypp1.conf" ); - // No vendor definition files has been read. So only suse,opensuse vendors are - // equivalent - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") ); - - // but "opensuse build service" gets its own class: - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse build service", "suse") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse build service", "opensuse") ); - // bnc#812608: All opensuse projects get their own class - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse-education", "suse") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse-education", "opensuse") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse-education", "opensuse build service") ); -} - diff --git a/libzypp/tests/zypp/base/CMakeLists.txt b/libzypp/tests/zypp/base/CMakeLists.txt deleted file mode 100644 index 10aa5e0..0000000 --- a/libzypp/tests/zypp/base/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -ADD_TESTS(Glob ) -ADD_TESTS(Sysconfig ) -ADD_TESTS(String ) -ADD_TESTS( InterProcessMutex InterProcessMutex2 ) diff --git a/libzypp/tests/zypp/base/Glob_test.cc b/libzypp/tests/zypp/base/Glob_test.cc deleted file mode 100644 index f0d338d..0000000 --- a/libzypp/tests/zypp/base/Glob_test.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include "TestSetup.h" -#include "zypp/Pathname.h" -#include "zypp/Glob.h" - -#define BOOST_TEST_MODULE Glob - -static Pathname TEST_ROOT( TESTS_SRC_DIR"/zypp/base/Glob_test.dat" ); - -using filesystem::Glob; - -BOOST_AUTO_TEST_CASE(Glob_default) -{ - // enable loging for the scope of this block: - // base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "-" ) ); - Glob q; - BOOST_CHECK( q.empty() ); - BOOST_CHECK( q.size() == 0 ); - BOOST_CHECK_EQUAL( q.begin(), q.end() ); - BOOST_CHECK( q.defaultFlags() == Glob::Flags() ); - - q.add( TEST_ROOT/"file" ); - BOOST_CHECK( ! q.empty() ); - BOOST_CHECK( q.size() == 1 ); - BOOST_CHECK_NE( q.begin(), q.end() ); - BOOST_CHECK_EQUAL( *q.begin(), TEST_ROOT/"file" ); - - q.reset( Glob::_BRACE ); - BOOST_CHECK( q.empty() ); - BOOST_CHECK( q.size() == 0 ); - BOOST_CHECK_EQUAL( q.begin(), q.end() ); - BOOST_CHECK( q.defaultFlags() == Glob::_BRACE ); - - q.add( TEST_ROOT/"file*" ); - BOOST_CHECK( q.size() == 3 ); - - q.add( TEST_ROOT/"*{.xml,.xml.gz}" ); - BOOST_CHECK( q.size() == 5 ); - - q.clear(); // no flags reset: Glob::_BRACE active - BOOST_CHECK( q.size() == 0 ); - - q.add( TEST_ROOT/"*{.xml,.xml.gz}" ); - BOOST_CHECK( q.size() == 2 ); - - q.reset(); // flags reset: Glob::_BRACE off - BOOST_CHECK( q.size() == 0 ); - - q.add( TEST_ROOT/"*{.xml,.xml.gz}" ); - BOOST_CHECK( q.size() == 0 ); -} - -BOOST_AUTO_TEST_CASE(Glob_static) -{ - std::set q; - Glob::collect( TEST_ROOT/"*{.xml,.xml.gz}", Glob::_BRACE, std::inserter( q, q.begin() ) ); - BOOST_REQUIRE( q.size() == 2 ); - BOOST_CHECK_EQUAL( *q.begin(), TEST_ROOT/"file.xml" ); - BOOST_CHECK_EQUAL( *++q.begin(), TEST_ROOT/"file.xml.gz" ); -} diff --git a/libzypp/tests/zypp/base/Glob_test.dat/file b/libzypp/tests/zypp/base/Glob_test.dat/file deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tests/zypp/base/Glob_test.dat/file.xml b/libzypp/tests/zypp/base/Glob_test.dat/file.xml deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tests/zypp/base/Glob_test.dat/file.xml.gz b/libzypp/tests/zypp/base/Glob_test.dat/file.xml.gz deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tests/zypp/base/InterProcessMutex2_test.cc b/libzypp/tests/zypp/base/InterProcessMutex2_test.cc deleted file mode 100644 index 3646bc5..0000000 --- a/libzypp/tests/zypp/base/InterProcessMutex2_test.cc +++ /dev/null @@ -1,65 +0,0 @@ - -#include - -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" - -#include "zypp/base/Sysconfig.h" -#include "zypp/base/InterProcessMutex.h" - - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using namespace boost::unit_test; - -using namespace std; -using namespace zypp; -using namespace zypp::base; - - -BOOST_AUTO_TEST_CASE(Abort) -{ - int r = 0; - { - MIL << "ready to fork" << endl; - - r = fork(); - - if ( r < 0 ) - { - BOOST_ERROR("Can't fork process"); - return; - } - else if ( r == 0 ) - { - MIL << "child, PID: " << getpid() << endl; - // child - sleep(3); - BOOST_REQUIRE_THROW( InterProcessMutex( InterProcessMutex::Options(InterProcessMutex::Reader,"testcase", 0)), ZYppLockedException); - //InterProcessMutex mutex2("testcase"); - } - else - { - MIL << "parent: " << getpid() << endl; - InterProcessMutex mutex( InterProcessMutex::Options(InterProcessMutex::Writer, "testcase")); - // parent - sleep(6); - wait(NULL); - MIL << "first lock will go out of scope" << endl; - - } - } -} - - - diff --git a/libzypp/tests/zypp/base/InterProcessMutex_test.cc b/libzypp/tests/zypp/base/InterProcessMutex_test.cc deleted file mode 100644 index 7916c57..0000000 --- a/libzypp/tests/zypp/base/InterProcessMutex_test.cc +++ /dev/null @@ -1,60 +0,0 @@ - -#include - -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" - -#include "zypp/base/Sysconfig.h" -#include "zypp/base/InterProcessMutex.h" - - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using namespace boost::unit_test; - -using namespace std; -using namespace zypp; -using namespace zypp::base; - -BOOST_AUTO_TEST_CASE(WaitForTheOther) -{ - int r = 0; - { - MIL << "ready to fork" << endl; - - r = fork(); - - if ( r < 0 ) - { - BOOST_ERROR("Can't fork process"); - return; - } - else if ( r == 0 ) - { - MIL << "child, PID: " << getpid() << endl; - sleep(3); - InterProcessMutex mutex2(InterProcessMutex::Options(InterProcessMutex::Reader,"testcase")); - } - else - { - MIL << "parent: " << getpid() << endl; - InterProcessMutex mutex(InterProcessMutex::Options(InterProcessMutex::Writer,"testcase")); - // parent - sleep(6); - } - } -} - - - - diff --git a/libzypp/tests/zypp/base/String_test.cc b/libzypp/tests/zypp/base/String_test.cc deleted file mode 100644 index 152a229..0000000 --- a/libzypp/tests/zypp/base/String_test.cc +++ /dev/null @@ -1,348 +0,0 @@ -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using namespace boost::unit_test; - -using namespace std; -using namespace zypp; -using namespace zypp::str; - -BOOST_AUTO_TEST_CASE(gsubTest) -{ - string olds = "olds"; - string news = "new string"; - - BOOST_CHECK_EQUAL(gsub("test olds string",olds,news), "test new string string"); - BOOST_CHECK_EQUAL(gsub("no string",olds,news),"no string"); - BOOST_CHECK_EQUAL(gsub("oldsolds",olds,news),"new stringnew string"); -} - -BOOST_AUTO_TEST_CASE(replaceAllTest) -{ - string olds = "olds"; - string news = "new string"; - string tests; - - tests = "test olds string"; - replaceAll(tests,olds,news); - BOOST_CHECK_EQUAL(tests, "test new string string"); - - tests = "no string"; - replaceAll(tests,olds,news); - BOOST_CHECK_EQUAL(tests, "no string"); - - tests = "oldsolds"; - replaceAll(tests,olds,news); - BOOST_CHECK_EQUAL(tests, "new stringnew string"); -} - -BOOST_AUTO_TEST_CASE(testsplitEscaped) -{ - string s( "simple non-escaped string" ); - vector v; - - splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 3 ); - BOOST_CHECK_EQUAL( v[0], "simple" ); - BOOST_CHECK_EQUAL( v[1], "non-escaped" ); - BOOST_CHECK_EQUAL( v[2], "string" ); - - v.clear(); - s = string( "\"escaped sentence \"" ); - splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 1 ); - BOOST_CHECK_EQUAL( v[0], "escaped sentence " ); - - v.clear(); - s = string( "\"escaped \\\\sent\\\"ence \\\\\"" ); - splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 1 ); - BOOST_CHECK_EQUAL( v[0], "escaped \\sent\"ence \\" ); - - v.clear(); - s = string( "escaped sentence\\ with\\ space" ); - splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 2 ); - BOOST_CHECK_EQUAL( v[0], "escaped" ); - BOOST_CHECK_EQUAL( v[1], "sentence with space" ); - - // split - join - v.clear(); - s = "some line \"\" foo\\ a foo\\\\ b"; - str::splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 6 ); - BOOST_CHECK_EQUAL( v[0], "some" ); - BOOST_CHECK_EQUAL( v[1], "line" ); - BOOST_CHECK_EQUAL( v[2], "" ); - BOOST_CHECK_EQUAL( v[3], "foo a" ); - BOOST_CHECK_EQUAL( v[4], "foo\\" ); - BOOST_CHECK_EQUAL( v[5], "b" ); - BOOST_CHECK_EQUAL( s, str::joinEscaped( v.begin(), v.end() ) ); - - // split - join using alternate sepchar - s = str::joinEscaped( v.begin(), v.end(), 'o' ); - v.clear(); - str::splitEscaped( s, std::back_inserter(v), "o" ); - BOOST_CHECK_EQUAL( v.size(), 6 ); - BOOST_CHECK_EQUAL( v[0], "some" ); - BOOST_CHECK_EQUAL( v[1], "line" ); - BOOST_CHECK_EQUAL( v[2], "" ); - BOOST_CHECK_EQUAL( v[3], "foo a" ); - BOOST_CHECK_EQUAL( v[4], "foo\\" ); - BOOST_CHECK_EQUAL( v[5], "b" ); - BOOST_CHECK_EQUAL( s, str::joinEscaped( v.begin(), v.end(), 'o' ) ); -} - -BOOST_AUTO_TEST_CASE(bnc_909772) -{ - // While \-escaping processes single-quote, double-quote, backslash and sepchar[ ] - // deescaping failed to process the quotes correctly. - std::string s; - std::vector v; - - v.clear(); - v.push_back(""); - v.push_back("'\" \\"); - v.push_back("\\'\\\"\\ \\\\"); - s = str::joinEscaped( v.begin(), v.end() ); - BOOST_CHECK_EQUAL( s, "\"\"" " " "\\'\\\"\\ \\\\" " " "\\\\\\'\\\\\\\"\\\\\\ \\\\\\\\" ); - - s += " "; - s += "'" "\\\\\" \\ \\\\" "'\\ single"; // single quote: all literal, no ' inside - - s += " "; - s += "\"" "\\'\\\" \\ \\\\" "\"\\ double";// double quote: all literal except \\ \" - - v.clear(); - splitEscaped( s, std::back_inserter(v) ); - BOOST_CHECK_EQUAL( v.size(), 5 ); - BOOST_CHECK_EQUAL( v[0], "" ); - BOOST_CHECK_EQUAL( v[1], "'\" \\" ); - BOOST_CHECK_EQUAL( v[2], "\\'\\\"\\ \\\\" ); - BOOST_CHECK_EQUAL( v[3], "\\\\\" \\ \\\\ single" ); - BOOST_CHECK_EQUAL( v[4], "\\'\" \\ \\ double" ); -} - -BOOST_AUTO_TEST_CASE(testsplitEscapedWithEmpty) -{ - string s( "simple:non-escaped:string" ); - vector v; - - BOOST_CHECK_EQUAL(splitFieldsEscaped(s, std::back_inserter(v)), 3); - BOOST_CHECK_EQUAL(v.size(), 3); - - v.clear(); - s = "non-escaped:with::spaces:"; - BOOST_CHECK_EQUAL(splitFieldsEscaped(s, std::back_inserter(v)), 5); - BOOST_CHECK_EQUAL(v.size(), 5); - - v.clear(); - s = "::"; - BOOST_CHECK_EQUAL(splitFieldsEscaped(s, std::back_inserter(v)), 3); - BOOST_CHECK_EQUAL(v.size(), 3); - - v.clear(); - s = ":escaped::with\\:spaces"; - BOOST_CHECK_EQUAL(splitFieldsEscaped(s, std::back_inserter(v)), 4); - BOOST_CHECK_EQUAL(v.size(), 4); -} - -BOOST_AUTO_TEST_CASE(test_escape) -{ - string badass = "bad|ass\\|worse"; - string escaped = str::escape(badass, '|'); - - BOOST_CHECK_EQUAL( escaped, "bad\\|ass\\\\\\|worse" ); -} - -BOOST_AUTO_TEST_CASE(conversions) -{ - BOOST_CHECK_EQUAL(str::numstring(42), "42"); - BOOST_CHECK_EQUAL(str::numstring(42, 6), " 42"); - BOOST_CHECK_EQUAL(str::numstring(42, -6), "42 "); - - BOOST_CHECK_EQUAL(str::hexstring(42), "0x0000002a"); - BOOST_CHECK_EQUAL(str::hexstring(42, 6), "0x002a"); - BOOST_CHECK_EQUAL(str::hexstring(42, -6), "0x2a "); - - BOOST_CHECK_EQUAL(str::octstring(42), "00052"); - BOOST_CHECK_EQUAL(str::octstring(42, 6), "000052"); - BOOST_CHECK_EQUAL(str::octstring(42, -6), "052 "); - - BOOST_CHECK_EQUAL(str::strtonum("42"), 42); - - BOOST_CHECK_EQUAL(str::toLower("This IS A TeST"), "this is a test"); - BOOST_CHECK_EQUAL(str::toUpper("This IS A TeST"), "THIS IS A TEST"); - BOOST_CHECK_EQUAL(str::compareCI("TeST", "test"), 0); - - BOOST_CHECK_EQUAL(str::compareCI("TeST", "test"), 0); - BOOST_CHECK_EQUAL(str::compareCI("TeST", "test"), 0); -} - -BOOST_AUTO_TEST_CASE(conversions_to_bool) -{ - // true iff true-string {1,on,yes,true} - BOOST_CHECK_EQUAL( str::strToTrue("1"), true ); - BOOST_CHECK_EQUAL( str::strToTrue("42"), true ); - BOOST_CHECK_EQUAL( str::strToTrue("ON"), true ); - BOOST_CHECK_EQUAL( str::strToTrue("YES"), true ); - BOOST_CHECK_EQUAL( str::strToTrue("TRUE"), true ); - BOOST_CHECK_EQUAL( str::strToTrue("0"), false ); - BOOST_CHECK_EQUAL( str::strToTrue("OFF"), false ); - BOOST_CHECK_EQUAL( str::strToTrue("NO"), false ); - BOOST_CHECK_EQUAL( str::strToTrue("FALSE"), false ); - BOOST_CHECK_EQUAL( str::strToTrue(""), false ); - BOOST_CHECK_EQUAL( str::strToTrue("foo"), false ); - - // false iff false-string {0,off,no,false} - BOOST_CHECK_EQUAL( str::strToFalse("1"), true ); - BOOST_CHECK_EQUAL( str::strToFalse("42"), true ); - BOOST_CHECK_EQUAL( str::strToFalse("ON"), true ); - BOOST_CHECK_EQUAL( str::strToFalse("YES"), true ); - BOOST_CHECK_EQUAL( str::strToFalse("TRUE"), true ); - BOOST_CHECK_EQUAL( str::strToFalse("0"), false ); - BOOST_CHECK_EQUAL( str::strToFalse("OFF"), false ); - BOOST_CHECK_EQUAL( str::strToFalse("NO"), false ); - BOOST_CHECK_EQUAL( str::strToFalse("FALSE"), false ); - BOOST_CHECK_EQUAL( str::strToFalse(""), true ); - BOOST_CHECK_EQUAL( str::strToFalse("foo"), true ); - - // true iff true-string - BOOST_CHECK_EQUAL( str::strToBool("TRUE", false), true ); - BOOST_CHECK_EQUAL( str::strToBool("FALSE", false), false ); - BOOST_CHECK_EQUAL( str::strToBool("", false), false ); - BOOST_CHECK_EQUAL( str::strToBool("foo", false), false ); - - // false iff false-string - BOOST_CHECK_EQUAL( str::strToBool("TRUE", true), true ); - BOOST_CHECK_EQUAL( str::strToBool("FALSE", true), false ); - BOOST_CHECK_EQUAL( str::strToBool("", true), true ); - BOOST_CHECK_EQUAL( str::strToBool("foo", true), true ); - - // true/false iff true/false-string, else unchanged - bool ret; - ret = true; BOOST_CHECK_EQUAL( str::strToBoolNodefault("TRUE", ret), true ); - ret = true; BOOST_CHECK_EQUAL( str::strToBoolNodefault("FALSE", ret), false ); - ret = true; BOOST_CHECK_EQUAL( str::strToBoolNodefault("", ret), true ); - ret = true; BOOST_CHECK_EQUAL( str::strToBoolNodefault("foo", ret), true ); - - ret = false; BOOST_CHECK_EQUAL( str::strToBoolNodefault("TRUE", ret), true ); - ret = false; BOOST_CHECK_EQUAL( str::strToBoolNodefault("FALSE", ret), false ); - ret = false; BOOST_CHECK_EQUAL( str::strToBoolNodefault("", ret), false ); - ret = false; BOOST_CHECK_EQUAL( str::strToBoolNodefault("foo", ret), false ); -} - -BOOST_AUTO_TEST_CASE(operations) -{ - BOOST_CHECK_EQUAL(str::ltrim(" \t f \t ffo \t "), "f \t ffo \t "); - BOOST_CHECK_EQUAL(str::rtrim(" \t f \t ffo \t "), " \t f \t ffo"); - BOOST_CHECK_EQUAL(str::trim(" \t f \t ffo \t "), "f \t ffo"); - - // strip first - { - string tostrip(" Oh! la la "); - string word( str::stripFirstWord(tostrip, true) ); // ltrim first - BOOST_CHECK_EQUAL(word, "Oh!"); - BOOST_CHECK_EQUAL(tostrip, "la la "); - } - { - string tostrip(" Oh! la la "); - string word( str::stripFirstWord(tostrip, false) ); // no ltrim first - BOOST_CHECK_EQUAL(word, ""); - BOOST_CHECK_EQUAL(tostrip, "Oh! la la "); - } - - // strip last - { - string tostrip(" Oh! la la "); - string word( str::stripLastWord(tostrip, true) ); // rtrim first - BOOST_CHECK_EQUAL(word, "la"); - BOOST_CHECK_EQUAL(tostrip, " Oh! la"); - } - { - string tostrip(" Oh! la la "); - string word( str::stripLastWord(tostrip, false) ); // no rtrim first - BOOST_CHECK_EQUAL(word, ""); - BOOST_CHECK_EQUAL(tostrip, " Oh! la la"); - } -} - -BOOST_AUTO_TEST_CASE(prefix_suffix) -{ - BOOST_CHECK( str::hasPrefix("abcXabcYabc", "abcX") ); - BOOST_CHECK( str::hasSuffix("abcXabcYabc", "Yabc") ); - - BOOST_CHECK_EQUAL( str::stripPrefix("abcXabcYabc", "abcX"), "abcYabc" ); - BOOST_CHECK_EQUAL( str::stripSuffix("abcXabcYabc", "Yabc"), "abcXabc" ); - - BOOST_CHECK( ! str::hasPrefix("abcXabcYabc", "ac") ); - BOOST_CHECK( ! str::hasSuffix("abcXabcYabc", "ac") ); - - BOOST_CHECK_EQUAL( str::stripPrefix("abcXabcYabc", "ac"), "abcXabcYabc" ); - BOOST_CHECK_EQUAL( str::stripSuffix("abcXabcYabc", "ac"), "abcXabcYabc" ); - - BOOST_CHECK( str::startsWith("abcXabcYabc", "abc") ); - BOOST_CHECK( str::endsWith("abcXabcYabc", "abc") ); - - BOOST_CHECK( str::contains("abcXabcYabc", "XabcY") ); - BOOST_CHECK( ! str::contains("abcXabcYabc", "xabcy") ); - BOOST_CHECK( str::containsCI("abcXabcYabc", "xabcy") ); - - BOOST_CHECK_EQUAL( str::commonPrefix("", ""), 0 ); - BOOST_CHECK_EQUAL( str::commonPrefix("a", ""), 0 ); - BOOST_CHECK_EQUAL( str::commonPrefix("", "b"), 0 ); - BOOST_CHECK_EQUAL( str::commonPrefix("a", "b"), 0 ); - BOOST_CHECK_EQUAL( str::commonPrefix("c", "c"), 1 ); - BOOST_CHECK_EQUAL( str::commonPrefix("ca", "cb"), 1 ); -} - -BOOST_AUTO_TEST_CASE(hexencode_hexdecode) -{ - std::string o; - o.reserve( 256 ); - for ( unsigned i = 1; i < 256; ++i ) - o += i; - - std::string e( str::hexencode( o ) ); - // encoded contains nothing but [%a-zA-Z0-9] - for ( unsigned i = 0; i < 255; ++i ) - { - char ch = e[i]; - BOOST_CHECK( ch == '%' - || ( 'a' <= ch && ch <= 'z' ) - || ( 'A' <= ch && ch <= 'Z' ) - || ( '0' <= ch && ch <= '9' ) ); - } - - std::string d( str::hexdecode( e ) ); - // decoded equals original - BOOST_CHECK( o == d ); - - // Test %XX is decoded for hexdigits only - const char *const dig = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - for ( const char * d1 = dig; *d1; ++d1 ) - for ( const char * d2 = dig; *d2; ++d2 ) - { - std::string eu( "%" ); - eu += *d1; eu += *d2; - std::string el( str::toLower(eu) ); - - std::string u( str::hexdecode( eu ) ); - std::string l( str::hexdecode( el ) ); - - if ( *d1 <= 'F' && *d2 <= 'F' ) - { - BOOST_CHECK_EQUAL( u, l ); // no matter if upper or lower case hexdigit - BOOST_CHECK_EQUAL( u.size(), 1 ); // size 1 == decoded - } - else - { - BOOST_CHECK_EQUAL( u, eu ); // no hexdigits remain unchanged - BOOST_CHECK_EQUAL( l, el ); - } - } -} diff --git a/libzypp/tests/zypp/base/Sysconfig_test.cc b/libzypp/tests/zypp/base/Sysconfig_test.cc deleted file mode 100644 index dfbd98f..0000000 --- a/libzypp/tests/zypp/base/Sysconfig_test.cc +++ /dev/null @@ -1,76 +0,0 @@ - -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" -#include "zypp/ExternalProgram.h" - -#include "zypp/base/Sysconfig.h" - -using boost::unit_test::test_suite; -using boost::unit_test::test_case; -using namespace boost::unit_test; - -using namespace std; -using namespace zypp; - -#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/base/data/Sysconfig") - -BOOST_AUTO_TEST_CASE(Sysconfig) -{ - Pathname file = DATADIR / "proxy"; - map values = zypp::base::sysconfig::read(file); - BOOST_CHECK_EQUAL( values.size(), 6 ); - BOOST_CHECK_EQUAL( values["PROXY_ENABLED"], "no"); - BOOST_CHECK_EQUAL( values["GOPHER_PROXY"], ""); - BOOST_CHECK_EQUAL( values["NO_PROXY"], "localhost, 127.0.0.1"); -} - -BOOST_AUTO_TEST_CASE(SysconfigWrite) -{ - Pathname file = DATADIR / "proxy"; - filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( file ) ); - filesystem::copy( file, tmpf.path() ); - - BOOST_REQUIRE_THROW( zypp::base::sysconfig::writeStringVal( "/tmp/wrzlprmpf", "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ), - zypp::Exception ); - BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "PROXY_ENABLED", "yes", "# fifi\n fofo\n" ) ); - BOOST_CHECK( !zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW1","12" ) ); - BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW2","13", "# fifi\n# fofo" ) ); - BOOST_CHECK( zypp::base::sysconfig::writeStringVal( tmpf.path(), "NEW3","13\"str\"", "fifi\nffofo" ) ); - - std::ostringstream s; - ExternalProgram( "diff -u " + file.asString() + " " + tmpf.path().asString() + " | tail -n +3" ) >> s; - BOOST_CHECK_EQUAL( s.str(), - "@@ -8,7 +8,7 @@\n" - " # This setting allows to turn the proxy on and off while\n" - " # preserving the particular proxy setup.\n" - " #\n" - "-PROXY_ENABLED=\"no\"\n" - "+PROXY_ENABLED=\"yes\"\n" - " \n" - " ## Type:\tstring\n" - " ## Default:\t\"\"\n" - "@@ -49,3 +49,11 @@\n" - " # Example: NO_PROXY=\"www.me.de, do.main, localhost\"\n" - " #\n" - " NO_PROXY=\"localhost, 127.0.0.1\"\n" - "+\n" - "+# fifi\n" - "+# fofo\n" - "+NEW2=\"13\"\n" - "+\n" - "+# fifi\n" - "+# ffofo\n" - "+NEW3=\"13\\\"str\\\"\"\n" - ); -} - diff --git a/libzypp/tests/zypp/base/data/Sysconfig/proxy b/libzypp/tests/zypp/base/data/Sysconfig/proxy deleted file mode 100644 index f3a6b9c..0000000 --- a/libzypp/tests/zypp/base/data/Sysconfig/proxy +++ /dev/null @@ -1,51 +0,0 @@ -## Path: Network/Proxy -## Description: -## Type: yesno -## Default: no -## Config: kde,profiles -# -# Enable a generation of the proxy settings to the profile. -# This setting allows to turn the proxy on and off while -# preserving the particular proxy setup. -# -PROXY_ENABLED="no" - -## Type: string -## Default: "" -# -# Some programs (e.g. lynx, arena and wget) support proxies, if set in -# the environment. SuSEconfig can add these environment variables to -# /etc/SuSEconfig/* (sourced by /etc/profile etc.) - -# See http://portal.suse.com/sdb/en/1998/01/lynx_proxy.html for more details. -# Example: HTTP_PROXY="http://proxy.provider.de:3128/" -HTTP_PROXY="" - -## Type: string -## Default: "" -# -# Some programs (e.g. lynx, arena and wget) support proxies, if set in -# the environment. SuSEconfig can add these environment variables to -# /etc/SuSEconfig/* (sourced by /etc/profile etc.) - -# this setting is for https connections -HTTPS_PROXY="" - -## Type: string -## Default: "" -# -# Example: FTP_PROXY="http://proxy.provider.de:3128/" -# -FTP_PROXY="" - -## Type: string -## Default: "" -# -# Example: GOPHER_PROXY="http://proxy.provider.de:3128/" -# -GOPHER_PROXY="" - -## Type: string(localhost) -## Default: localhost -# -# Example: NO_PROXY="www.me.de, do.main, localhost" -# -NO_PROXY="localhost, 127.0.0.1" diff --git a/libzypp/tests/zypp/data/Delta/repodata/deltainfo.xml b/libzypp/tests/zypp/data/Delta/repodata/deltainfo.xml deleted file mode 100644 index 2909d1b..0000000 --- a/libzypp/tests/zypp/data/Delta/repodata/deltainfo.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - DRPMS/libzypp-4.21.3-1_4.21.3-2.i386.drpm - libzypp-4.21.3-1-d3571f98b048b1a870e40241bb46c67ab4 - 22452 - 8f05394695dee9399c204614e21e5f6848990ab7 - - - DRPMS/libzypp-4.21.2-3_4.21.3-2.i386.drpm - libzypp-4.21.2-3-e82691677eee1e83b4812572c5c9ce8eb - 110362 - 326658fee45c0baec1e70231046dbaf560f941ce - - - - diff --git a/libzypp/tests/zypp/data/Delta/repodata/primary.xml.gz b/libzypp/tests/zypp/data/Delta/repodata/primary.xml.gz deleted file mode 100644 index b41606a..0000000 Binary files a/libzypp/tests/zypp/data/Delta/repodata/primary.xml.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml b/libzypp/tests/zypp/data/Delta/repodata/repomd.xml deleted file mode 100644 index 264628d..0000000 --- a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - d41033826a12ce44a1b33eff2e7905785e0999da - 1211014822 - 319b2951aad2417c8961442ba692d4700962043b - - - - 4f8f83525b232db93a761ed1be79515956b574cf - 1211014822 - 70eb95f379e0db1c9815f0a1cb2269d93e408015 - - - - 28a6aae0cd873e1df286d4a07fc7e54263fec79d - 1211014821 - 5ad445e403218ef4a6585dbfc37ccf31d5a10096 - - - - 553f609c610b0cf51b54efc4c5c618537707ac8d - 1211014821 - 8c840e0b03ad8c2ed0d4ddf57f9a6b5cea3ac412 - - - - 596018d6e767808ac6bf4e89cc0ea1ea7a1916a8 - 1211279868 - 596018d6e767808ac6bf4e89cc0ea1ea7a1916a8 - - diff --git a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.asc b/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.asc deleted file mode 100644 index 4533fce..0000000 --- a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.asc +++ /dev/null @@ -1,43 +0,0 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - - - - - - d41033826a12ce44a1b33eff2e7905785e0999da - 1211014822 - 319b2951aad2417c8961442ba692d4700962043b - - - - 4f8f83525b232db93a761ed1be79515956b574cf - 1211014822 - 70eb95f379e0db1c9815f0a1cb2269d93e408015 - - - - 28a6aae0cd873e1df286d4a07fc7e54263fec79d - 1211014821 - 5ad445e403218ef4a6585dbfc37ccf31d5a10096 - - - - 553f609c610b0cf51b54efc4c5c618537707ac8d - 1211014821 - 8c840e0b03ad8c2ed0d4ddf57f9a6b5cea3ac412 - - - - 596018d6e767808ac6bf4e89cc0ea1ea7a1916a8 - 1211279868 - 596018d6e767808ac6bf4e89cc0ea1ea7a1916a8 - - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEARECAAYFAkgy4a8ACgkQ1iFKyE0tq/K1UgCgkm7T8QgC27qE9labaumrHo8o -o/gAoMX7sCbj6CkSTL8a+9eQf+BD0eDV -=mZtk ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.key b/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.key deleted file mode 100644 index 66bd5ed..0000000 --- a/libzypp/tests/zypp/data/Delta/repodata/repomd.xml.key +++ /dev/null @@ -1,43 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEfNOC4RBADigjtTYiTyHJ1Ld9Eiul005PyBoIk0oG30mbsrlx+ETir90aB+ -9FwqfiYBbug0eAuIvF8Cpg2scEqtL8yLQHaeNzVz89iAQvPa1UdCUkn6MLMGLm4F -R9aaOsVA4yrtUDyoouz8eu/WzZfiwi23auEuBcebb19HPZ38YLLNQP39RwCgzWRr -pfJLYd/W2TYoAg/zpIh6VsMEAMzVoHQWd/BULoqmXORVvssB4u3apXiL4pThCvGk -7PlicRTIptJnYUUnXbOBm8kcRmW10Bh/Iahxr7GAjxwADwdXAV/1W9xnj/2uZY09 -EwIrTrVGkEnBM+qciroAwwrR3232f+W/2nKoC+VHfoTdWoYfhh365IpWRlgRhWDc -fJbNBACuHoGS8yve/hOjyOR6oeqt/vYdTPZZWhCaLME6g41yG19+hosw3a2jjgtK -eP3pNXUQeSJ4fMzanZcgH2XNNPCljphIogjETLpR11jjoCtQy+N0jNZM27EMCd2g -LMyW0UFOCqh7hqS0wHbbIkeja2VETsNJhcZEUE/MISdB534LQLQkSm9zZWYgUmVp -ZGluZ2VyIDxqcmVpZGluZ2VyQHN1c2UuY3o+iGYEExECACYFAkfNOC4CGyMFCQlm -AYAGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDWIUrITS2r8kSdAJ9aAv5D1Vk1 -aAXQtjG8Kbt5OBZcMQCfRvyOql8UUoV30nx3tmfXMWyyYSK5Ag0ER804gBAIAJMI -aFDKVAnCbm0hm+MjolK3gobEFFr2QZNCu4DvYZikUz3P1Uqc4EjhTgPWCgd2mN4w -Odzi1n2mz+PF80i+xl92gN6e2Br5mufsXfDf58smrQZ71E6IuG/XJC9Y+obfgIFp -ngTjYomal7wywFqBBZq3mIN8xM+9VkUIsUhvDWvbj++/JO9++uIl67gjx8zhGJhd -0rWEKsNcbi2cVLizs6Lf+GatTr61pS1AzRU+sxsEr9pgIAN0cvxqRTH54i08Ulf3 -Z+m1+jTJ6vTB206QChyybAL9hp9tckhkWAHcS4paK8lEyz37UExTIVkQNaDxdDad -zYpE3gVRkniLuKhCk28AAwUH+wdPJIMxIIlPMUtATLgHqeLnCA57tDra6Canp466 -KpJ/aW2GfNYUs0OgivX41oPBBCGd6oDuZwREtj0cq9LlG5YCEbgbsC1DEOncja9/ -XFoTdbp6Slvlc+aw54OUzj6rNSaOSJpigN6YVUnZCoS00vTH/NubOpC+bpl1f5lL -8YlR2NfS2XL4CFlLBuUQiHv0zzKOj1180oyfzrzjon/pxC3jakj3+t9bJaXbiD09 -zKJRFzFv+9mLqma5zFkWUZdWRR+N7CtYl7LIT3TdbIvlJu3N5cyHgGBkiOykXu7W -RFdFqdZ7+6aykKUUMbwp+mAVfjJVVm9U473+5X7492SlxfKITwQYEQIADwUCR804 -gAIbDAUJCWYBgAAKCRDWIUrITS2r8mVYAKC0gRLVYbuz9NTtT7u5kaXcFXyXCQCg -lOfxwAGsuxmSvTOl+hKc69QIf1eZAQ0ER/INNgEIAPFj1RzNpcDF0w8Ryc/+KIx/ -/xqWqE6Kv6DoUu9g3VGmj4lLrwEwbInbJcffOrlZkrZazB24gfORRyyllj0UfW09 -U7qtOzdewmTRDPuYyXcvtL6ATIpjeEapRdDyL2DKLmnpJ7DxFm07ttzgDJp+cmqw -1XlFB2gt4Sirb3NRSubtX7ZZmaffiIHh9yr31lkpOxIKXMrW5MLhezQ57K779LfY -58Iq6EUjeGU5XQPLe7lsoBanq1MojdFsRmBx8TT2wjzpMLa1lDMvQgGCW4fajY58 -J03coxYWXu6dp6N5x+15IIETcWtcIRIhy5Y7qV/AGOX5fFG4YEDnmUIiQ5CpIPEA -EQEAAbQkSm9zZWYgUmVpZGluZ2VyIDxqcmVpZGluZ2VyQHN1c2UuY3o+iQE2BBMB -AgAgBQJH8g02AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQrMbwWCOvAEFw -dAgA1BvA6/q6rsk0uVsue3sgJunCdQnF9zY2i8FRuOfLwEoOuX3P82TUCrKYT7jq -NfiWYbtl9+sp4+5TBxY9M5nBgqckMJoze0vrufq8uBLzrsabIYRPjFYpznxjhIeo -FDA8PcScOYR51K7YhqAk1rU0M9SmeNCh8O6mgI546QZLVHC7w+2SDtsWWoRhn3/k -WlHBmaU0XYLtyuRIG3uuUjigUU5F9Gz1sj8X/r4WAO4Id9FGruORlGDlW4yK5vVt -OHE1/vEnpPodJEI4kWisPoJh+/1q4u/zGBtGL724dPmBuqQ3mLwbXiahCaZiGv+p -SRTL0aukStJZdNaArDg/PTNxFg== -=ahjB ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Delta/repodata/updateinfo.xml.gz b/libzypp/tests/zypp/data/Delta/repodata/updateinfo.xml.gz deleted file mode 100644 index 28061e0..0000000 Binary files a/libzypp/tests/zypp/data/Delta/repodata/updateinfo.xml.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/directory.yast deleted file mode 100644 index 9be1c91..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/directory.yast +++ /dev/null @@ -1,2 +0,0 @@ -subdir1/ -subdir2/ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS deleted file mode 100644 index e93f782..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS +++ /dev/null @@ -1,2 +0,0 @@ -f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 subdir1-file1.txt -e242ed3bffccdf271b7fbaf34ed72d089537b42f subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.asc deleted file mode 100644 index ac94d40..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaaxUACgkQm+zCtd2wN1ZLgACfcqpLHAavAr8cIjenaR3pJHpo -WoMAmwdbZQX2b9Yw6mY1aGbarwsEon6I -=/0VZ ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/directory.yast deleted file mode 100644 index 36efc80..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir1-file1.txt -subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file1.txt deleted file mode 100644 index 257cc56..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file2.txt deleted file mode 100644 index 5716ca5..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir1/subdir1-file2.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS deleted file mode 100644 index c688c0b..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS +++ /dev/null @@ -1 +0,0 @@ -f572d396fae9206628714fb2ce00f72e94f2258f subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.asc deleted file mode 100644 index 42445ee..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaayAACgkQm+zCtd2wN1Z3GwCfUjf9mRdFrB5UvOHAW/DoEzWL -mpEAnRmkzRLTY3hXiZ+95XCYG1csiMmF -=X6am ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/directory.yast deleted file mode 100644 index 6c2ce07..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/directory.yast +++ /dev/null @@ -1,5 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/subdir2-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/subdir2-file1.txt deleted file mode 100644 index ce01362..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/baseindex/subdir2/subdir2-file1.txt +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/directory.yast deleted file mode 100644 index 8c4b36d..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/directory.yast +++ /dev/null @@ -1,3 +0,0 @@ -directory.yast -subdir1/ -subdir2/ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS deleted file mode 100644 index e93f782..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS +++ /dev/null @@ -1,2 +0,0 @@ -f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 subdir1-file1.txt -e242ed3bffccdf271b7fbaf34ed72d089537b42f subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.asc deleted file mode 100644 index ac94d40..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaaxUACgkQm+zCtd2wN1ZLgACfcqpLHAavAr8cIjenaR3pJHpo -WoMAmwdbZQX2b9Yw6mY1aGbarwsEon6I -=/0VZ ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/directory.yast deleted file mode 100644 index 36efc80..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir1-file1.txt -subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file1.txt deleted file mode 100644 index f2fe044..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file1.txt +++ /dev/null @@ -1 +0,0 @@ -fooa diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file2.txt deleted file mode 100644 index 5716ca5..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir1/subdir1-file2.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS deleted file mode 100644 index c688c0b..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS +++ /dev/null @@ -1 +0,0 @@ -f572d396fae9206628714fb2ce00f72e94f2258f subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.asc deleted file mode 100644 index 42445ee..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaayAACgkQm+zCtd2wN1Z3GwCfUjf9mRdFrB5UvOHAW/DoEzWL -mpEAnRmkzRLTY3hXiZ+95XCYG1csiMmF -=X6am ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/directory.yast deleted file mode 100644 index 6c2ce07..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/directory.yast +++ /dev/null @@ -1,5 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/subdir2-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/subdir2-file1.txt deleted file mode 100644 index ce01362..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir-broken/subdir2/subdir2-file1.txt +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/directory.yast deleted file mode 100644 index 9be1c91..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/directory.yast +++ /dev/null @@ -1,2 +0,0 @@ -subdir1/ -subdir2/ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS deleted file mode 100644 index e93f782..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS +++ /dev/null @@ -1,2 +0,0 @@ -f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 subdir1-file1.txt -e242ed3bffccdf271b7fbaf34ed72d089537b42f subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.asc deleted file mode 100644 index ac94d40..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaaxUACgkQm+zCtd2wN1ZLgACfcqpLHAavAr8cIjenaR3pJHpo -WoMAmwdbZQX2b9Yw6mY1aGbarwsEon6I -=/0VZ ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/directory.yast deleted file mode 100644 index 36efc80..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir1-file1.txt -subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file1.txt deleted file mode 100644 index 257cc56..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file2.txt deleted file mode 100644 index 5716ca5..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir1/subdir1-file2.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS deleted file mode 100644 index c688c0b..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS +++ /dev/null @@ -1 +0,0 @@ -f572d396fae9206628714fb2ce00f72e94f2258f subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.asc deleted file mode 100644 index 42445ee..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkjaayAACgkQm+zCtd2wN1Z3GwCfUjf9mRdFrB5UvOHAW/DoEzWL -mpEAnRmkzRLTY3hXiZ+95XCYG1csiMmF -=X6am ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.key b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/SHA1SUMS.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/directory.yast deleted file mode 100644 index 6c2ce07..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/directory.yast +++ /dev/null @@ -1,5 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/subdir2-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/subdir2-file1.txt deleted file mode 100644 index ce01362..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/complexdir/subdir2/subdir2-file1.txt +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content deleted file mode 100644 index 7a674fa..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content +++ /dev/null @@ -1,3 +0,0 @@ -HASH SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 subdir1/subdir1-file1.txt -HASH SHA1 e242ed3bffccdf271b7fbaf34ed72d089537b42f subdir1/subdir1-file2.txt -HASH SHA1 f572d396fae9206628714fb2ce00f72e94f2258f subdir2/subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.asc deleted file mode 100644 index 30732f1..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkkHLgwACgkQm+zCtd2wN1ZD7QCghDVP3V6Pi/gBMoA6Flc77/4u -f30Anjf9MqPHx/YZXSFHrYtcst0welTn -=g7it ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.key b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/content.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/directory.yast deleted file mode 100644 index 8c4b36d..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/directory.yast +++ /dev/null @@ -1,3 +0,0 @@ -directory.yast -subdir1/ -subdir2/ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/directory.yast deleted file mode 100644 index 36efc80..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir1-file1.txt -subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file1.txt deleted file mode 100644 index 257cc56..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file2.txt deleted file mode 100644 index fb081f3..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir1/subdir1-file2.txt +++ /dev/null @@ -1 +0,0 @@ -bar OWNED diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/directory.yast deleted file mode 100644 index 6c2ce07..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/directory.yast +++ /dev/null @@ -1,5 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/subdir2-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/subdir2-file1.txt deleted file mode 100644 index ce01362..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex-broken-digest/subdir2/subdir2-file1.txt +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content deleted file mode 100644 index 7a674fa..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content +++ /dev/null @@ -1,3 +0,0 @@ -HASH SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 subdir1/subdir1-file1.txt -HASH SHA1 e242ed3bffccdf271b7fbaf34ed72d089537b42f subdir1/subdir1-file2.txt -HASH SHA1 f572d396fae9206628714fb2ce00f72e94f2258f subdir2/subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.asc deleted file mode 100644 index 30732f1..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkkHLgwACgkQm+zCtd2wN1ZD7QCghDVP3V6Pi/gBMoA6Flc77/4u -f30Anjf9MqPHx/YZXSFHrYtcst0welTn -=g7it ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.key b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/content.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/directory.yast deleted file mode 100644 index 9be1c91..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/directory.yast +++ /dev/null @@ -1,2 +0,0 @@ -subdir1/ -subdir2/ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/directory.yast deleted file mode 100644 index 36efc80..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/directory.yast +++ /dev/null @@ -1,6 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir1-file1.txt -subdir1-file2.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file1.txt deleted file mode 100644 index 257cc56..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file2.txt deleted file mode 100644 index 5716ca5..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir1/subdir1-file2.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/directory.yast deleted file mode 100644 index 6c2ce07..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/directory.yast +++ /dev/null @@ -1,5 +0,0 @@ -directory.yast -SHA1SUMS -SHA1SUMS.asc -SHA1SUMS.key -subdir2-file1.txt diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/subdir2-file1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/subdir2-file1.txt deleted file mode 100644 index ce01362..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/contentindex/subdir2/subdir2-file1.txt +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff deleted file mode 100644 index fb939c8..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff +++ /dev/null @@ -1,7 +0,0 @@ -20a21,26 -> [edit] Distribution -> -> In the past SUSE first released the Personal and Professional versions in boxed sets which included extensive printed documentation, then waited a few months before it released versions on its FTP servers. Under Novell and with advent of openSUSE this has been reversed: SUSE Linux 10.0 was available for download well before the retail release of SUSE Linux 10.0. In addition, Novell has discontinued the Personal version, renamed the Professional version to simply "SUSE Linux", and repriced "SUSE Linux" to about the same as the obsolete Personal version. Now Novell has also renamed SUSE Linux to openSUSE with version 10.2 of the distro. -> -> Starting with version 9.2, an unsupported 1 DVD ISO image of SUSE Professional was made available for download as well as a bootable LiveDVD evaluation. The FTP server continues to operate and has the advantage of "streamlined" installs: Only downloading packages the user feels they need. The ISO has the advantages of an easy install package, the ability to operate even if the user's network card does not work 'out of the box', and less experience needed (i.e., an inexperienced Linux user may not know whether or not to install a certain package, and the ISO offers several preselected sets of packages). The retail box DVD supports x86, and x86_64 installs, but the included CD-ROMs do not include x86_64 support. -> diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff.gz b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff.gz deleted file mode 100644 index 82941ab..0000000 Binary files a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-1-2.diff.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff deleted file mode 100644 index 275e632..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff +++ /dev/null @@ -1,36 +0,0 @@ -14a15,49 -> [edit] Versions -> Major Versions -> 1.0 - April 1994 -> 1.0.9 - July 1994 -> 11/94 - November 1994 -> 4/95 - April 1995 -> 8/95 - August 1995 -> 11/95 - November 1995 -> 4.2 - May 1996 -> 4.3 - September 1996 -> 4.4 - May 1997 -> 4.4.1 - February 1997 -> 5.0 - June 1997 -> 5.1 - November 1997 -> 5.2 - 23 March 1998 -> 6.0 - 21 December 1998 -> 6.1 - 7 April 1999 -> 6.2 - 12 August 1999 -> 6.3 - 25 November 1999 -> 6.4 - 27 March 2000 -> 7.0 - 27 September 2000 -> 7.1 - 24 January 2001 -> 7.2 - 15 June 2001 -> 7.3 - 13 October 2001 -> 8.0 - 22 April 2002 -> 8.1 - 30 September 2002 -> 8.2 - 7 April 2003 -> 9.0 - 15 October 2003 -> 9.1 - 23 April 2004 -> 9.2 - 25 October 2004 -> 9.3 - 16 April 2005 -> 10.0 - 6 October 2005 -> 10.1 - 11 May 2006 -> 10.2 - 7 December 2006 -> diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff.gz b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff.gz deleted file mode 100644 index b2db7df..0000000 Binary files a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-2-3.diff.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff deleted file mode 100644 index 070e5cf..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff +++ /dev/null @@ -1,5 +0,0 @@ -14a15,18 -> SUSE has support for resizing NTFS partitions during installation which allows it to co-exist with existing Windows 2000 or XP installations. SUSE has the ability to detect and install drivers for many common winmodems shipped with OEM desktop and laptop systems (such modems are designed to use Windows-specific software to operate). -> -> Several desktop environments such as KDE and GNOME and window managers like Window Maker and Blackbox are included, with the YaST2 installer allowing the user to choose a preselection of GNOME, KDE, or no desktop at all. SUSE ships with multimedia software such as K3B (CD/DVD burning), Amarok (audio playback), and Kaffeine (movie playback). It contains OpenOffice.org, and software for reading and/or creating other common document formats such as PDF. Due to patent problems, the distribution lacks codecs for proprietary formats like avi, but these can be installed with packages available on the internet. MP3s are handled in the fully capable graphical media studio Amarok with the Helix engine (part of RealNetworks' RealPlayer), when RealPlayer is installed. This is due to an agreement between Novell and RealNetworks to ship RealPlayer with SUSE as a solution to MP3 patent problems.[citation needed] -> diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff.gz b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff.gz deleted file mode 100644 index f0c5cea..0000000 Binary files a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-3-4.diff.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff deleted file mode 100644 index 3b7fad1..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff +++ /dev/null @@ -1,5 +0,0 @@ -6a7,10 -> On November 4, 2003, Novell announced it would acquire SuSE.[2] The acquisition was finalized in January 2004.[3] J. Philips (Novell's corporate technology strategist for the Asia Pacific region) stated that Novell would not "in the medium term" alter the way in which SUSE continues to be developed.[4] At Novell's annual BrainShare gathering in 2004, all computers ran SUSE Linux for the first time. At this gathering it was also announced that the proprietary SUSE administration program YaST2 would be released into the public under the GPL license. -> -> On August 4, 2005, Novell spokesman and director of public relations Bruce Lowry announced that the development of the SUSE Professional series will become more open and within the community project openSUSE try to reach a wider audience of users and developers. The software, by definition of open source, already had their coding "open," but now the development process will be more "open" than before, allowing developers and users to test the product and help develop it. Previously all development work was done in-house by SUSE, and version 10.0 was the first version that had public beta testing. As part of the change, YaST Online Update server access will be complimentary for SUSE Linux users, and along the lines of most open source distributions, there will both be a free download available on the web and a boxed edition. This change in philosophy led to the release of the SUSE Linux 10.0 release on October 6, 2005 in "OSS" (completely open source), "eval" (has both open source and proprietary applications and is actually a fully featured version) and retail boxed-set editions. -> diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff.gz b/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff.gz deleted file mode 100644 index d54de69..0000000 Binary files a/libzypp/tests/zypp/data/Fetcher/remote-site/diffs/file-4-current.diff.gz and /dev/null differ diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/directory.yast b/libzypp/tests/zypp/data/Fetcher/remote-site/directory.yast deleted file mode 100644 index 951afd1..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/directory.yast +++ /dev/null @@ -1,10 +0,0 @@ -complexdir/ -complexdir-broken/ -diffs/ -file-1.txt -file-2.txt -file-3.txt -file-4.txt -file-current.txt -file-current.txt.asc -file-current.txt.key diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-1.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/file-1.txt deleted file mode 100644 index a3670c4..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-1.txt +++ /dev/null @@ -1,64 +0,0 @@ -History - -The SUSE Linux distribution was originally a German translation of Slackware Linux. In mid-1992, Softlanding Linux System (SLS) was founded by Peter MacDonald, and was the first comprehensive distribution to contain elements such as X and TCP/IP. The Slackware distribution (maintained by Patrick Volkerding) was initially based largely on SLS. - -S.u.S.E was founded in late 1992 as a UNIX consulting group, which among other things regularly released software packages that included SLS and Slackware, and printed UNIX/Linux manuals. S.u.S.E is an acronym for the German phrase "Software- und System-Entwicklung" ("Software and system development"). There is a rumour that the name is a tribute to the German computer pioneer Konrad Zuse. They released the first CD version of SLS/Slackware in 1994, under the name S.u.S.E Linux 1.0. It later integrated with the Jurix distribution by Florian La Roche, to release the first really unique S.u.S.E Linux 4.2 in 1996. Over time, SuSE Linux incorporated many aspects of Red Hat Linux (e.g., using RPMs and /etc/sysconfig). In a move to more effectively reach its business audience, SuSE introduced the SuSE Linux Enterpriser Server in 2001, and consecutively changed the company name to SUSE Linux in September 2003 as a part of its overall new branding strategy, as announced by SUSE's marketing VP Uwe Schmid.[1] - -The current mascot of SuSE is Geeko, also known as the "SuSE Lizard" - -[edit] Features - -SUSE includes an installation and administration program called YaST2 which handles hard disk partitioning, system setup, RPM package management, online updates, network and firewall configuration, user administration and more in an integrated interface. - -Starting with the 10.1 release, SuSE includes a secondary installation program known as Zen-Updater, which can be used as a secondary means of installing software and replaces Suse-updater providing notification of software updates on the desktop. - -The latest release, openSUSE 10.2 is available as a retail package and as a no-cost open source package. In terms of software, there are major differences between the two packages (see Reference below), including the fact that the retail edition contains a number of proprietary components, such as Macromedia Flash. In addition, the retail package, available for 59.95 USD, includes a printed manual and limited technical support. openSUSE is available to download freely from their website. The retail and eval versions contain one DVD and six CDs, while openSUSE uses five CDs. It is the first SUSE release to be called openSUSE, previous versions were called SUSE Linux. - -Other flavors include dedicated server editions and groupware servers geared towards corporate networks and enterprises, along with a stripped-down business desktop which runs some software designed for Microsoft Windows out of the box by virtue of WINE. - -SUSE Linux Enterprise Server (SLES) and SUSE Linux Enterprise Desktop (SLED) are Novell's branded version of SUSE targeted at corporate environments. SUSE Linux Enterprise product line (SLES and SLED) include some proprietary software as well as technical support. For instance, SuSE Linux Enterprise Server 9 (SLES 9) has fewer packages (around 1,000 packages) than the SuSE Linux Professional (consumer) distribution which has around 3,500 packages. Most of the packages that have been removed are desktop applications which are more suited to consumers than to a business environment. SLES has a guaranteed life cycle of 5 years and only the SLES products are certified by independent hardware and software vendors. - -[edit] See also -Portal:Free software - Free software Portal - - * Novell - * OpenSUSE - * Linux on zSeries - * List of Linux distributions - * Comparison of Linux distributions - * Commercial and community Linux distributions by the same vendor - * Sax2 - -[edit] References - - 1. ^ Proffitt, B. (2003). SuSE Rebrands Ahead of 9.0 Launch. - 2. ^ Shankland, S. (2003). Novell to acquire SuSE Linux. Retrieved December 20, 2003. - 3. ^ Kennedy, D. (2003). Novell's Linux buy opens road to top. Retrieved December 20, 2003. - 4. ^ Ramesh, R. (2004). Novell: SuSE stays the same, for now. Retrieved January 14, 2004. - - * SuSE Roadmap - * Differences between boxed and retail version - -[edit] External links - - * openSUSE - * Novell SUSE Linux Enterprise 10 - * suse at DistroWatch - * Hacking SUSE Linux - * Fultus Technical Documentation eLibrary - SUSE - * 10.1 Review (tuxmachines.org) - * The Unofficial SUSE FAQ - * SUSE Linux Support Forums - * SUSE Linux Community Forums - * SuseBR Brazilian SUSE Linux Community Forums - - * SUSE Wiki - * SUSEroot - * The Linux Master Forums - * 10.0 Review - * SUSE Support Knowledgebase - * Links about SUSE Linux - * SuSE Linux OS Turkiye - * Planet SuSE - Blogs of SUSE employees and SUSE community members - * Linux Desktop Multiplier - Turn one SLED or openSUSE computer into 10 independent, full-client desktops - * Hong Kong & Macau Novell User Group - An unofficial web site provides news, articles and technical tips. diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-2.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/file-2.txt deleted file mode 100644 index 1272359..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-2.txt +++ /dev/null @@ -1,70 +0,0 @@ -History - -The SUSE Linux distribution was originally a German translation of Slackware Linux. In mid-1992, Softlanding Linux System (SLS) was founded by Peter MacDonald, and was the first comprehensive distribution to contain elements such as X and TCP/IP. The Slackware distribution (maintained by Patrick Volkerding) was initially based largely on SLS. - -S.u.S.E was founded in late 1992 as a UNIX consulting group, which among other things regularly released software packages that included SLS and Slackware, and printed UNIX/Linux manuals. S.u.S.E is an acronym for the German phrase "Software- und System-Entwicklung" ("Software and system development"). There is a rumour that the name is a tribute to the German computer pioneer Konrad Zuse. They released the first CD version of SLS/Slackware in 1994, under the name S.u.S.E Linux 1.0. It later integrated with the Jurix distribution by Florian La Roche, to release the first really unique S.u.S.E Linux 4.2 in 1996. Over time, SuSE Linux incorporated many aspects of Red Hat Linux (e.g., using RPMs and /etc/sysconfig). In a move to more effectively reach its business audience, SuSE introduced the SuSE Linux Enterpriser Server in 2001, and consecutively changed the company name to SUSE Linux in September 2003 as a part of its overall new branding strategy, as announced by SUSE's marketing VP Uwe Schmid.[1] - -The current mascot of SuSE is Geeko, also known as the "SuSE Lizard" - -[edit] Features - -SUSE includes an installation and administration program called YaST2 which handles hard disk partitioning, system setup, RPM package management, online updates, network and firewall configuration, user administration and more in an integrated interface. - -Starting with the 10.1 release, SuSE includes a secondary installation program known as Zen-Updater, which can be used as a secondary means of installing software and replaces Suse-updater providing notification of software updates on the desktop. - -The latest release, openSUSE 10.2 is available as a retail package and as a no-cost open source package. In terms of software, there are major differences between the two packages (see Reference below), including the fact that the retail edition contains a number of proprietary components, such as Macromedia Flash. In addition, the retail package, available for 59.95 USD, includes a printed manual and limited technical support. openSUSE is available to download freely from their website. The retail and eval versions contain one DVD and six CDs, while openSUSE uses five CDs. It is the first SUSE release to be called openSUSE, previous versions were called SUSE Linux. - -Other flavors include dedicated server editions and groupware servers geared towards corporate networks and enterprises, along with a stripped-down business desktop which runs some software designed for Microsoft Windows out of the box by virtue of WINE. - -SUSE Linux Enterprise Server (SLES) and SUSE Linux Enterprise Desktop (SLED) are Novell's branded version of SUSE targeted at corporate environments. SUSE Linux Enterprise product line (SLES and SLED) include some proprietary software as well as technical support. For instance, SuSE Linux Enterprise Server 9 (SLES 9) has fewer packages (around 1,000 packages) than the SuSE Linux Professional (consumer) distribution which has around 3,500 packages. Most of the packages that have been removed are desktop applications which are more suited to consumers than to a business environment. SLES has a guaranteed life cycle of 5 years and only the SLES products are certified by independent hardware and software vendors. - -[edit] Distribution - -In the past SUSE first released the Personal and Professional versions in boxed sets which included extensive printed documentation, then waited a few months before it released versions on its FTP servers. Under Novell and with advent of openSUSE this has been reversed: SUSE Linux 10.0 was available for download well before the retail release of SUSE Linux 10.0. In addition, Novell has discontinued the Personal version, renamed the Professional version to simply "SUSE Linux", and repriced "SUSE Linux" to about the same as the obsolete Personal version. Now Novell has also renamed SUSE Linux to openSUSE with version 10.2 of the distro. - -Starting with version 9.2, an unsupported 1 DVD ISO image of SUSE Professional was made available for download as well as a bootable LiveDVD evaluation. The FTP server continues to operate and has the advantage of "streamlined" installs: Only downloading packages the user feels they need. The ISO has the advantages of an easy install package, the ability to operate even if the user's network card does not work 'out of the box', and less experience needed (i.e., an inexperienced Linux user may not know whether or not to install a certain package, and the ISO offers several preselected sets of packages). The retail box DVD supports x86, and x86_64 installs, but the included CD-ROMs do not include x86_64 support. - -[edit] See also -Portal:Free software - Free software Portal - - * Novell - * OpenSUSE - * Linux on zSeries - * List of Linux distributions - * Comparison of Linux distributions - * Commercial and community Linux distributions by the same vendor - * Sax2 - -[edit] References - - 1. ^ Proffitt, B. (2003). SuSE Rebrands Ahead of 9.0 Launch. - 2. ^ Shankland, S. (2003). Novell to acquire SuSE Linux. Retrieved December 20, 2003. - 3. ^ Kennedy, D. (2003). Novell's Linux buy opens road to top. Retrieved December 20, 2003. - 4. ^ Ramesh, R. (2004). Novell: SuSE stays the same, for now. Retrieved January 14, 2004. - - * SuSE Roadmap - * Differences between boxed and retail version - -[edit] External links - - * openSUSE - * Novell SUSE Linux Enterprise 10 - * suse at DistroWatch - * Hacking SUSE Linux - * Fultus Technical Documentation eLibrary - SUSE - * 10.1 Review (tuxmachines.org) - * The Unofficial SUSE FAQ - * SUSE Linux Support Forums - * SUSE Linux Community Forums - * SuseBR Brazilian SUSE Linux Community Forums - - * SUSE Wiki - * SUSEroot - * The Linux Master Forums - * 10.0 Review - * SUSE Support Knowledgebase - * Links about SUSE Linux - * SuSE Linux OS Turkiye - * Planet SuSE - Blogs of SUSE employees and SUSE community members - * Linux Desktop Multiplier - Turn one SLED or openSUSE computer into 10 independent, full-client desktops - * Hong Kong & Macau Novell User Group - An unofficial web site provides news, articles and technical tips. diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-3.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/file-3.txt deleted file mode 100644 index 3ce92b3..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-3.txt +++ /dev/null @@ -1,105 +0,0 @@ -History - -The SUSE Linux distribution was originally a German translation of Slackware Linux. In mid-1992, Softlanding Linux System (SLS) was founded by Peter MacDonald, and was the first comprehensive distribution to contain elements such as X and TCP/IP. The Slackware distribution (maintained by Patrick Volkerding) was initially based largely on SLS. - -S.u.S.E was founded in late 1992 as a UNIX consulting group, which among other things regularly released software packages that included SLS and Slackware, and printed UNIX/Linux manuals. S.u.S.E is an acronym for the German phrase "Software- und System-Entwicklung" ("Software and system development"). There is a rumour that the name is a tribute to the German computer pioneer Konrad Zuse. They released the first CD version of SLS/Slackware in 1994, under the name S.u.S.E Linux 1.0. It later integrated with the Jurix distribution by Florian La Roche, to release the first really unique S.u.S.E Linux 4.2 in 1996. Over time, SuSE Linux incorporated many aspects of Red Hat Linux (e.g., using RPMs and /etc/sysconfig). In a move to more effectively reach its business audience, SuSE introduced the SuSE Linux Enterpriser Server in 2001, and consecutively changed the company name to SUSE Linux in September 2003 as a part of its overall new branding strategy, as announced by SUSE's marketing VP Uwe Schmid.[1] - -The current mascot of SuSE is Geeko, also known as the "SuSE Lizard" - -[edit] Features - -SUSE includes an installation and administration program called YaST2 which handles hard disk partitioning, system setup, RPM package management, online updates, network and firewall configuration, user administration and more in an integrated interface. - -Starting with the 10.1 release, SuSE includes a secondary installation program known as Zen-Updater, which can be used as a secondary means of installing software and replaces Suse-updater providing notification of software updates on the desktop. - -[edit] Versions -Major Versions -1.0 - April 1994 -1.0.9 - July 1994 -11/94 - November 1994 -4/95 - April 1995 -8/95 - August 1995 -11/95 - November 1995 -4.2 - May 1996 -4.3 - September 1996 -4.4 - May 1997 -4.4.1 - February 1997 -5.0 - June 1997 -5.1 - November 1997 -5.2 - 23 March 1998 -6.0 - 21 December 1998 -6.1 - 7 April 1999 -6.2 - 12 August 1999 -6.3 - 25 November 1999 -6.4 - 27 March 2000 -7.0 - 27 September 2000 -7.1 - 24 January 2001 -7.2 - 15 June 2001 -7.3 - 13 October 2001 -8.0 - 22 April 2002 -8.1 - 30 September 2002 -8.2 - 7 April 2003 -9.0 - 15 October 2003 -9.1 - 23 April 2004 -9.2 - 25 October 2004 -9.3 - 16 April 2005 -10.0 - 6 October 2005 -10.1 - 11 May 2006 -10.2 - 7 December 2006 - -The latest release, openSUSE 10.2 is available as a retail package and as a no-cost open source package. In terms of software, there are major differences between the two packages (see Reference below), including the fact that the retail edition contains a number of proprietary components, such as Macromedia Flash. In addition, the retail package, available for 59.95 USD, includes a printed manual and limited technical support. openSUSE is available to download freely from their website. The retail and eval versions contain one DVD and six CDs, while openSUSE uses five CDs. It is the first SUSE release to be called openSUSE, previous versions were called SUSE Linux. - -Other flavors include dedicated server editions and groupware servers geared towards corporate networks and enterprises, along with a stripped-down business desktop which runs some software designed for Microsoft Windows out of the box by virtue of WINE. - -SUSE Linux Enterprise Server (SLES) and SUSE Linux Enterprise Desktop (SLED) are Novell's branded version of SUSE targeted at corporate environments. SUSE Linux Enterprise product line (SLES and SLED) include some proprietary software as well as technical support. For instance, SuSE Linux Enterprise Server 9 (SLES 9) has fewer packages (around 1,000 packages) than the SuSE Linux Professional (consumer) distribution which has around 3,500 packages. Most of the packages that have been removed are desktop applications which are more suited to consumers than to a business environment. SLES has a guaranteed life cycle of 5 years and only the SLES products are certified by independent hardware and software vendors. - -[edit] Distribution - -In the past SUSE first released the Personal and Professional versions in boxed sets which included extensive printed documentation, then waited a few months before it released versions on its FTP servers. Under Novell and with advent of openSUSE this has been reversed: SUSE Linux 10.0 was available for download well before the retail release of SUSE Linux 10.0. In addition, Novell has discontinued the Personal version, renamed the Professional version to simply "SUSE Linux", and repriced "SUSE Linux" to about the same as the obsolete Personal version. Now Novell has also renamed SUSE Linux to openSUSE with version 10.2 of the distro. - -Starting with version 9.2, an unsupported 1 DVD ISO image of SUSE Professional was made available for download as well as a bootable LiveDVD evaluation. The FTP server continues to operate and has the advantage of "streamlined" installs: Only downloading packages the user feels they need. The ISO has the advantages of an easy install package, the ability to operate even if the user's network card does not work 'out of the box', and less experience needed (i.e., an inexperienced Linux user may not know whether or not to install a certain package, and the ISO offers several preselected sets of packages). The retail box DVD supports x86, and x86_64 installs, but the included CD-ROMs do not include x86_64 support. - -[edit] See also -Portal:Free software - Free software Portal - - * Novell - * OpenSUSE - * Linux on zSeries - * List of Linux distributions - * Comparison of Linux distributions - * Commercial and community Linux distributions by the same vendor - * Sax2 - -[edit] References - - 1. ^ Proffitt, B. (2003). SuSE Rebrands Ahead of 9.0 Launch. - 2. ^ Shankland, S. (2003). Novell to acquire SuSE Linux. Retrieved December 20, 2003. - 3. ^ Kennedy, D. (2003). Novell's Linux buy opens road to top. Retrieved December 20, 2003. - 4. ^ Ramesh, R. (2004). Novell: SuSE stays the same, for now. Retrieved January 14, 2004. - - * SuSE Roadmap - * Differences between boxed and retail version - -[edit] External links - - * openSUSE - * Novell SUSE Linux Enterprise 10 - * suse at DistroWatch - * Hacking SUSE Linux - * Fultus Technical Documentation eLibrary - SUSE - * 10.1 Review (tuxmachines.org) - * The Unofficial SUSE FAQ - * SUSE Linux Support Forums - * SUSE Linux Community Forums - * SuseBR Brazilian SUSE Linux Community Forums - - * SUSE Wiki - * SUSEroot - * The Linux Master Forums - * 10.0 Review - * SUSE Support Knowledgebase - * Links about SUSE Linux - * SuSE Linux OS Turkiye - * Planet SuSE - Blogs of SUSE employees and SUSE community members - * Linux Desktop Multiplier - Turn one SLED or openSUSE computer into 10 independent, full-client desktops - * Hong Kong & Macau Novell User Group - An unofficial web site provides news, articles and technical tips. diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-4.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/file-4.txt deleted file mode 100644 index e031d57..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-4.txt +++ /dev/null @@ -1,109 +0,0 @@ -History - -The SUSE Linux distribution was originally a German translation of Slackware Linux. In mid-1992, Softlanding Linux System (SLS) was founded by Peter MacDonald, and was the first comprehensive distribution to contain elements such as X and TCP/IP. The Slackware distribution (maintained by Patrick Volkerding) was initially based largely on SLS. - -S.u.S.E was founded in late 1992 as a UNIX consulting group, which among other things regularly released software packages that included SLS and Slackware, and printed UNIX/Linux manuals. S.u.S.E is an acronym for the German phrase "Software- und System-Entwicklung" ("Software and system development"). There is a rumour that the name is a tribute to the German computer pioneer Konrad Zuse. They released the first CD version of SLS/Slackware in 1994, under the name S.u.S.E Linux 1.0. It later integrated with the Jurix distribution by Florian La Roche, to release the first really unique S.u.S.E Linux 4.2 in 1996. Over time, SuSE Linux incorporated many aspects of Red Hat Linux (e.g., using RPMs and /etc/sysconfig). In a move to more effectively reach its business audience, SuSE introduced the SuSE Linux Enterpriser Server in 2001, and consecutively changed the company name to SUSE Linux in September 2003 as a part of its overall new branding strategy, as announced by SUSE's marketing VP Uwe Schmid.[1] - -The current mascot of SuSE is Geeko, also known as the "SuSE Lizard" - -[edit] Features - -SUSE includes an installation and administration program called YaST2 which handles hard disk partitioning, system setup, RPM package management, online updates, network and firewall configuration, user administration and more in an integrated interface. - -Starting with the 10.1 release, SuSE includes a secondary installation program known as Zen-Updater, which can be used as a secondary means of installing software and replaces Suse-updater providing notification of software updates on the desktop. - -SUSE has support for resizing NTFS partitions during installation which allows it to co-exist with existing Windows 2000 or XP installations. SUSE has the ability to detect and install drivers for many common winmodems shipped with OEM desktop and laptop systems (such modems are designed to use Windows-specific software to operate). - -Several desktop environments such as KDE and GNOME and window managers like Window Maker and Blackbox are included, with the YaST2 installer allowing the user to choose a preselection of GNOME, KDE, or no desktop at all. SUSE ships with multimedia software such as K3B (CD/DVD burning), Amarok (audio playback), and Kaffeine (movie playback). It contains OpenOffice.org, and software for reading and/or creating other common document formats such as PDF. Due to patent problems, the distribution lacks codecs for proprietary formats like avi, but these can be installed with packages available on the internet. MP3s are handled in the fully capable graphical media studio Amarok with the Helix engine (part of RealNetworks' RealPlayer), when RealPlayer is installed. This is due to an agreement between Novell and RealNetworks to ship RealPlayer with SUSE as a solution to MP3 patent problems.[citation needed] - -[edit] Versions -Major Versions -1.0 - April 1994 -1.0.9 - July 1994 -11/94 - November 1994 -4/95 - April 1995 -8/95 - August 1995 -11/95 - November 1995 -4.2 - May 1996 -4.3 - September 1996 -4.4 - May 1997 -4.4.1 - February 1997 -5.0 - June 1997 -5.1 - November 1997 -5.2 - 23 March 1998 -6.0 - 21 December 1998 -6.1 - 7 April 1999 -6.2 - 12 August 1999 -6.3 - 25 November 1999 -6.4 - 27 March 2000 -7.0 - 27 September 2000 -7.1 - 24 January 2001 -7.2 - 15 June 2001 -7.3 - 13 October 2001 -8.0 - 22 April 2002 -8.1 - 30 September 2002 -8.2 - 7 April 2003 -9.0 - 15 October 2003 -9.1 - 23 April 2004 -9.2 - 25 October 2004 -9.3 - 16 April 2005 -10.0 - 6 October 2005 -10.1 - 11 May 2006 -10.2 - 7 December 2006 - -The latest release, openSUSE 10.2 is available as a retail package and as a no-cost open source package. In terms of software, there are major differences between the two packages (see Reference below), including the fact that the retail edition contains a number of proprietary components, such as Macromedia Flash. In addition, the retail package, available for 59.95 USD, includes a printed manual and limited technical support. openSUSE is available to download freely from their website. The retail and eval versions contain one DVD and six CDs, while openSUSE uses five CDs. It is the first SUSE release to be called openSUSE, previous versions were called SUSE Linux. - -Other flavors include dedicated server editions and groupware servers geared towards corporate networks and enterprises, along with a stripped-down business desktop which runs some software designed for Microsoft Windows out of the box by virtue of WINE. - -SUSE Linux Enterprise Server (SLES) and SUSE Linux Enterprise Desktop (SLED) are Novell's branded version of SUSE targeted at corporate environments. SUSE Linux Enterprise product line (SLES and SLED) include some proprietary software as well as technical support. For instance, SuSE Linux Enterprise Server 9 (SLES 9) has fewer packages (around 1,000 packages) than the SuSE Linux Professional (consumer) distribution which has around 3,500 packages. Most of the packages that have been removed are desktop applications which are more suited to consumers than to a business environment. SLES has a guaranteed life cycle of 5 years and only the SLES products are certified by independent hardware and software vendors. - -[edit] Distribution - -In the past SUSE first released the Personal and Professional versions in boxed sets which included extensive printed documentation, then waited a few months before it released versions on its FTP servers. Under Novell and with advent of openSUSE this has been reversed: SUSE Linux 10.0 was available for download well before the retail release of SUSE Linux 10.0. In addition, Novell has discontinued the Personal version, renamed the Professional version to simply "SUSE Linux", and repriced "SUSE Linux" to about the same as the obsolete Personal version. Now Novell has also renamed SUSE Linux to openSUSE with version 10.2 of the distro. - -Starting with version 9.2, an unsupported 1 DVD ISO image of SUSE Professional was made available for download as well as a bootable LiveDVD evaluation. The FTP server continues to operate and has the advantage of "streamlined" installs: Only downloading packages the user feels they need. The ISO has the advantages of an easy install package, the ability to operate even if the user's network card does not work 'out of the box', and less experience needed (i.e., an inexperienced Linux user may not know whether or not to install a certain package, and the ISO offers several preselected sets of packages). The retail box DVD supports x86, and x86_64 installs, but the included CD-ROMs do not include x86_64 support. - -[edit] See also -Portal:Free software - Free software Portal - - * Novell - * OpenSUSE - * Linux on zSeries - * List of Linux distributions - * Comparison of Linux distributions - * Commercial and community Linux distributions by the same vendor - * Sax2 - -[edit] References - - 1. ^ Proffitt, B. (2003). SuSE Rebrands Ahead of 9.0 Launch. - 2. ^ Shankland, S. (2003). Novell to acquire SuSE Linux. Retrieved December 20, 2003. - 3. ^ Kennedy, D. (2003). Novell's Linux buy opens road to top. Retrieved December 20, 2003. - 4. ^ Ramesh, R. (2004). Novell: SuSE stays the same, for now. Retrieved January 14, 2004. - - * SuSE Roadmap - * Differences between boxed and retail version - -[edit] External links - - * openSUSE - * Novell SUSE Linux Enterprise 10 - * suse at DistroWatch - * Hacking SUSE Linux - * Fultus Technical Documentation eLibrary - SUSE - * 10.1 Review (tuxmachines.org) - * The Unofficial SUSE FAQ - * SUSE Linux Support Forums - * SUSE Linux Community Forums - * SuseBR Brazilian SUSE Linux Community Forums - - * SUSE Wiki - * SUSEroot - * The Linux Master Forums - * 10.0 Review - * SUSE Support Knowledgebase - * Links about SUSE Linux - * SuSE Linux OS Turkiye - * Planet SuSE - Blogs of SUSE employees and SUSE community members - * Linux Desktop Multiplier - Turn one SLED or openSUSE computer into 10 independent, full-client desktops - * Hong Kong & Macau Novell User Group - An unofficial web site provides news, articles and technical tips. diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt b/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt deleted file mode 100644 index 0358edd..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt +++ /dev/null @@ -1,113 +0,0 @@ -History - -The SUSE Linux distribution was originally a German translation of Slackware Linux. In mid-1992, Softlanding Linux System (SLS) was founded by Peter MacDonald, and was the first comprehensive distribution to contain elements such as X and TCP/IP. The Slackware distribution (maintained by Patrick Volkerding) was initially based largely on SLS. - -S.u.S.E was founded in late 1992 as a UNIX consulting group, which among other things regularly released software packages that included SLS and Slackware, and printed UNIX/Linux manuals. S.u.S.E is an acronym for the German phrase "Software- und System-Entwicklung" ("Software and system development"). There is a rumour that the name is a tribute to the German computer pioneer Konrad Zuse. They released the first CD version of SLS/Slackware in 1994, under the name S.u.S.E Linux 1.0. It later integrated with the Jurix distribution by Florian La Roche, to release the first really unique S.u.S.E Linux 4.2 in 1996. Over time, SuSE Linux incorporated many aspects of Red Hat Linux (e.g., using RPMs and /etc/sysconfig). In a move to more effectively reach its business audience, SuSE introduced the SuSE Linux Enterpriser Server in 2001, and consecutively changed the company name to SUSE Linux in September 2003 as a part of its overall new branding strategy, as announced by SUSE's marketing VP Uwe Schmid.[1] - -On November 4, 2003, Novell announced it would acquire SuSE.[2] The acquisition was finalized in January 2004.[3] J. Philips (Novell's corporate technology strategist for the Asia Pacific region) stated that Novell would not "in the medium term" alter the way in which SUSE continues to be developed.[4] At Novell's annual BrainShare gathering in 2004, all computers ran SUSE Linux for the first time. At this gathering it was also announced that the proprietary SUSE administration program YaST2 would be released into the public under the GPL license. - -On August 4, 2005, Novell spokesman and director of public relations Bruce Lowry announced that the development of the SUSE Professional series will become more open and within the community project openSUSE try to reach a wider audience of users and developers. The software, by definition of open source, already had their coding "open," but now the development process will be more "open" than before, allowing developers and users to test the product and help develop it. Previously all development work was done in-house by SUSE, and version 10.0 was the first version that had public beta testing. As part of the change, YaST Online Update server access will be complimentary for SUSE Linux users, and along the lines of most open source distributions, there will both be a free download available on the web and a boxed edition. This change in philosophy led to the release of the SUSE Linux 10.0 release on October 6, 2005 in "OSS" (completely open source), "eval" (has both open source and proprietary applications and is actually a fully featured version) and retail boxed-set editions. - -The current mascot of SuSE is Geeko, also known as the "SuSE Lizard" - -[edit] Features - -SUSE includes an installation and administration program called YaST2 which handles hard disk partitioning, system setup, RPM package management, online updates, network and firewall configuration, user administration and more in an integrated interface. - -Starting with the 10.1 release, SuSE includes a secondary installation program known as Zen-Updater, which can be used as a secondary means of installing software and replaces Suse-updater providing notification of software updates on the desktop. - -SUSE has support for resizing NTFS partitions during installation which allows it to co-exist with existing Windows 2000 or XP installations. SUSE has the ability to detect and install drivers for many common winmodems shipped with OEM desktop and laptop systems (such modems are designed to use Windows-specific software to operate). - -Several desktop environments such as KDE and GNOME and window managers like Window Maker and Blackbox are included, with the YaST2 installer allowing the user to choose a preselection of GNOME, KDE, or no desktop at all. SUSE ships with multimedia software such as K3B (CD/DVD burning), Amarok (audio playback), and Kaffeine (movie playback). It contains OpenOffice.org, and software for reading and/or creating other common document formats such as PDF. Due to patent problems, the distribution lacks codecs for proprietary formats like avi, but these can be installed with packages available on the internet. MP3s are handled in the fully capable graphical media studio Amarok with the Helix engine (part of RealNetworks' RealPlayer), when RealPlayer is installed. This is due to an agreement between Novell and RealNetworks to ship RealPlayer with SUSE as a solution to MP3 patent problems.[citation needed] - -[edit] Versions -Major Versions -1.0 - April 1994 -1.0.9 - July 1994 -11/94 - November 1994 -4/95 - April 1995 -8/95 - August 1995 -11/95 - November 1995 -4.2 - May 1996 -4.3 - September 1996 -4.4 - May 1997 -4.4.1 - February 1997 -5.0 - June 1997 -5.1 - November 1997 -5.2 - 23 March 1998 -6.0 - 21 December 1998 -6.1 - 7 April 1999 -6.2 - 12 August 1999 -6.3 - 25 November 1999 -6.4 - 27 March 2000 -7.0 - 27 September 2000 -7.1 - 24 January 2001 -7.2 - 15 June 2001 -7.3 - 13 October 2001 -8.0 - 22 April 2002 -8.1 - 30 September 2002 -8.2 - 7 April 2003 -9.0 - 15 October 2003 -9.1 - 23 April 2004 -9.2 - 25 October 2004 -9.3 - 16 April 2005 -10.0 - 6 October 2005 -10.1 - 11 May 2006 -10.2 - 7 December 2006 - -The latest release, openSUSE 10.2 is available as a retail package and as a no-cost open source package. In terms of software, there are major differences between the two packages (see Reference below), including the fact that the retail edition contains a number of proprietary components, such as Macromedia Flash. In addition, the retail package, available for 59.95 USD, includes a printed manual and limited technical support. openSUSE is available to download freely from their website. The retail and eval versions contain one DVD and six CDs, while openSUSE uses five CDs. It is the first SUSE release to be called openSUSE, previous versions were called SUSE Linux. - -Other flavors include dedicated server editions and groupware servers geared towards corporate networks and enterprises, along with a stripped-down business desktop which runs some software designed for Microsoft Windows out of the box by virtue of WINE. - -SUSE Linux Enterprise Server (SLES) and SUSE Linux Enterprise Desktop (SLED) are Novell's branded version of SUSE targeted at corporate environments. SUSE Linux Enterprise product line (SLES and SLED) include some proprietary software as well as technical support. For instance, SuSE Linux Enterprise Server 9 (SLES 9) has fewer packages (around 1,000 packages) than the SuSE Linux Professional (consumer) distribution which has around 3,500 packages. Most of the packages that have been removed are desktop applications which are more suited to consumers than to a business environment. SLES has a guaranteed life cycle of 5 years and only the SLES products are certified by independent hardware and software vendors. - -[edit] Distribution - -In the past SUSE first released the Personal and Professional versions in boxed sets which included extensive printed documentation, then waited a few months before it released versions on its FTP servers. Under Novell and with advent of openSUSE this has been reversed: SUSE Linux 10.0 was available for download well before the retail release of SUSE Linux 10.0. In addition, Novell has discontinued the Personal version, renamed the Professional version to simply "SUSE Linux", and repriced "SUSE Linux" to about the same as the obsolete Personal version. Now Novell has also renamed SUSE Linux to openSUSE with version 10.2 of the distro. - -Starting with version 9.2, an unsupported 1 DVD ISO image of SUSE Professional was made available for download as well as a bootable LiveDVD evaluation. The FTP server continues to operate and has the advantage of "streamlined" installs: Only downloading packages the user feels they need. The ISO has the advantages of an easy install package, the ability to operate even if the user's network card does not work 'out of the box', and less experience needed (i.e., an inexperienced Linux user may not know whether or not to install a certain package, and the ISO offers several preselected sets of packages). The retail box DVD supports x86, and x86_64 installs, but the included CD-ROMs do not include x86_64 support. - -[edit] See also -Portal:Free software - Free software Portal - - * Novell - * OpenSUSE - * Linux on zSeries - * List of Linux distributions - * Comparison of Linux distributions - * Commercial and community Linux distributions by the same vendor - * Sax2 - -[edit] References - - 1. ^ Proffitt, B. (2003). SuSE Rebrands Ahead of 9.0 Launch. - 2. ^ Shankland, S. (2003). Novell to acquire SuSE Linux. Retrieved December 20, 2003. - 3. ^ Kennedy, D. (2003). Novell's Linux buy opens road to top. Retrieved December 20, 2003. - 4. ^ Ramesh, R. (2004). Novell: SuSE stays the same, for now. Retrieved January 14, 2004. - - * SuSE Roadmap - * Differences between boxed and retail version - -[edit] External links - - * openSUSE - * Novell SUSE Linux Enterprise 10 - * suse at DistroWatch - * Hacking SUSE Linux - * Fultus Technical Documentation eLibrary - SUSE - * 10.1 Review (tuxmachines.org) - * The Unofficial SUSE FAQ - * SUSE Linux Support Forums - * SUSE Linux Community Forums - * SuseBR Brazilian SUSE Linux Community Forums - - * SUSE Wiki - * SUSEroot - * The Linux Master Forums - * 10.0 Review - * SUSE Support Knowledgebase - * Links about SUSE Linux - * SuSE Linux OS Turkiye - * Planet SuSE - Blogs of SUSE employees and SUSE community members - * Linux Desktop Multiplier - Turn one SLED or openSUSE computer into 10 independent, full-client desktops - * Hong Kong & Macau Novell User Group - An unofficial web site provides news, articles and technical tips. diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.asc deleted file mode 100644 index 1550f57..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.asc +++ /dev/null @@ -1,98 +0,0 @@ ------BEGIN PGP MESSAGE----- -Version: GnuPG v1.4.5 (GNU/Linux) - -owGFWbtvJMl5X0vw4wYQYKW2cCgw0JLGTJMzfOzxEmO5Q94+yCXNWd6etFgbNd01 -MyX2Y1TVzeFsIMCZAxtw4MiAIQdOFChxIBhOHStQYDixAwX+G5z693316B7unn3B -Lae6+ns/ft/Xf/u97z76zvd//fmvfjH72clvfueXj/95+ocznatB2hijyjqp7+uz -z3/+2+fa1pVZ93pvFkpMbian4lyXzb3IcG70tKl1VYqVtKIyeq5LmedrIcVXyhSy -FLWRpc0l36lmYpLL9HYljXI0EvGiFIXOBsPj41FfTKpZncsy0+Xc85isba0KsT05 -n+wwj1nVlJnKxHQtrlStjLiQ6bgC06wv8CbfqSHnTBtbi7QqlkYtVGn1ndoUuK7w -tKylLoXKVQF9rbBNuhAg8A2TevPsavfFVSJY7Sj3BpHtAu8TDS+RxKP0Vnxd5bfK -kBpOaF3qWrNdptLiai7NXOEXKECxpNebJE0ySU43NIRgsJsSZBoSSoqb1y++IaFt -k9dkormpmmVfrBaaxC4qHFXQ3cAAeGyFUfMGrMDIQEXmbGFhVmMJfeRckbFkDV5p -3hBTiMO6R32dVZcGauIxSbDrPAPnNjK3iQiya4hYCpmaqlwX0MKwH3wYLBcG/MXW -xPMfiIa4sHcHp2W9gtnyppxvie14hzlbFwCZulN5tSQ3be2wS/CcOArTFFVjnBrE -sJSFf+LcpMjTHUkoJBoKnCUcqPDvq6o0MhM/bqxiwh1rtYH0bCzulLEhis8nu21E -wFHw0UGfVFKmFSIYxtlrmOwh2mv2qRFkzrmRZNOVrhf80svG6AdZhZg6y5FWkPtc -iusqXcAh0MdL2BHQKI6vptQ/bR6yPkhGXsijRFzekYy6AKFJE3MZAVCZZeUkgpmQ -wXapUuQE1L3G2XOY113dVsk8gbKWQvD66sKyn3ZVne7CWQjPmZ7vcGJLUVR3bP+i -gp3UbAaKSEQOSImY1aA/JULKgkqTaVWmQS5YyFRZk3o3dGRFuCiDiLRQZKLMHZtT -jPb2hi5YKUNU2nhO6UKWc0+EfE+6sXsgVqeYgcJELRFqU5ADrX2XcktpajIBSQpd -DIwsSrUSU+PLFJwFm83Xfb5flkje1BUDIv7YwpjmVnG6fn0lblbQJF2g4iXvhu97 -vctSvAZZZooAIr59PgGblpiuxapq8gzJ9dNGG2eM5N3oPZcmPrQ6VuEZlWD9wVWQ -l5SlZk2UD5J3++/Fy0RcLXSul1ZsO0aQMfpe1CpdlFVezddBM4RjTOanVksUuVTP -dErVBSx3cI+DhhPQi+6kLatabEEGerNQmW4KkDfFlpB57fNkJdckpatg7A2qyXAI -FaZKTFVIfAWDHbwXTwOLx2xsFCBxYlB+JwtKxLmk6kemdvEAi5K/QsajICKPOj4P -arkMopxIiAOqp+3SqtmsqHVVxyex3ixNhVhUNVmZacusQL1n65FL8ByJXogfycmb -kbcM9Io1BnHu6tOymeYwa1tEvro6FzhB81IJh8rTZt5AUBcohzFQ7LK6VZZqG0V/ -hgBJ0a8paj1J8GJZLIyFhBLn1QrCfkKXTpWl1+vQ769MNUOKauqzAmmn4Z6VBuup -gnGVS284yUlABc27HU8LlKR6TWb4CeTiW0yzhghcyagQSLxEaocaQNxRj42rLSEG -jHXNODSxPqVZpmbcXl1lZiEsGgLVEZmDerYWC8nprw3k4aTdomv9LdSeGlG6+kh3 -CJtSSfI6Ov34pS0yFuqyQuwwh7xaEcVWRJbYyU6OVTaGCYpZzU8XKl+GNxBeyEij -7nTVWAJO4NgVZVWZW46/DN0KwTJY4J4K9cUVvNCZhnvJ3gMAFB6xi8kOPiSmCFgW -DsIj6G0sdOw1Lpl9DllxWeaoz+JmmVF9sK7eynTDPpRhuSZ5KQsorTpZxrZwgsqc -MAqxIJrcW4rK1l2vbfQ/vFZzp3eMAG6ImxQzo3CxWpV5BZXkndS5nOZKVC7qVmrq -2OGVe8Q3ag9Ro+BBZjvtqEQsUQgrWy0Xa5FTGrg8DL21mwC+hZN94+NSXCLPqHIf -uYQkkluXkwkwDBsE8JQwXqvbTl9sqTuZ48ICXmJ9uqo7pNWWE7mEVVOfuvSQYE1a -Nx5hzxr6d6Zk3RgVo2CHbxpQ0LnTf2BVHWxgEwfjPcRHd0LHZse7pmsBk9Rt1Xfl -7hbJUQofUFu+BX+QJtvq9d4RxffizLG3wLA33LUZSDIU1CVaQ+6xP/vj05UxxSXI -7wsktwK4KMtBBWWdKpq95fhkDRCw/YAKoRgBYICQgGcJu+AfCsU+XMSh23DoIpZK -VXM6kSxID7Vy3YEAS+Nk6nO0PhSU7nMJ0KXTK2I3+tPMZEoFelKTiIjvCOgQL8MQ -LxHVBPtAeLDOyM8bhgpWibb/sSoHLvtMwPoplyCSNXMwpaVVKMxbjFgcUcYoXUBt -1BLIFRJM8PrA2cYQ1zvNtRFdm9p7nNjiy96MIcmgxG1dLRPveApo2ywBIxxcQEjo -D0Tv9ZuzSes91LHGd+iOzn6CoWJqqd/ybDZQ94Q92Jr8J732VpcZXUK+7WHeFN9c -bVCicSRIQ0LKKaBOzY0mQzr6+uvfEJnRlDQsL2Nealckji6LKlMFNFro5TJg9MvT -i6A1k8nlkv50sQg4xdOjf5EnRZhgXrrCQjXbyz4gYM0IKpoWF6h3wLw7ZE/FQDPy -UuWdxlC1OaK+Gp+yEF+9vrw49W2XyPsEgFa5vg08MSTfUljj1gmNLSgLwk0ubuzr -tzHrstBbiN4JHY4ecnKQcxZVZakQY7i2iO80BAtL0yfh+uSdsmoNVhMp7x4yq3U8 -C5plCR3K1hxRx/0Tsf1svDv+eoxWbSj1UUKfAlFXt2KbsEIlEMzrKVTacR3mlcSQ -QUm/jdFDq/Yxz15+4LfiElX3cgYfqKQyc/dqZO/CV3I24MEufqb4zfHn5msfJ1mV -Ntyk8UYhO865Gp8lYtywY5fwqoMU6FCF62ibQx55hDB4plIXi90eEEizN+Wd7jNo -AQ3Y35eB4CwfpnGy/6gvcrVCEUzExdW+i1FXaHlUYNDALSWVS34NdQgtEuVZeAfV -bHLvgBgyz1WOuVWVc7Z7ABLXGEhfu4JrH/OvK/hCmR0qYuh57Ql1naiDb9KaCgXb -j2DtHP2eDQ3YslKqbEekbIMP3afY6hJnMR0w50pZ5XH/Ays8dE/yLtW1K0qlUkiN -97HTfe36q+1dyJ/ASfEnBnvx2UA8hctyXgTQSXJMZy8bWNMdDXePD+gojnt8fLB7 -fLjx8mHvi3DkwD6f0duHD98+7NFcj8MLyUyO8HuffrdzrD896Nx6Qr/RlnBypqaG -h0M+PnRqvGxKFQ6GD1nSIbMc7YOeQbDj8IvekXt1NBRjlcbLdM4UnrTqHeOMCQxH -HQXplCUfHW6wo3OWffTEs6Oy33vi2T3ZnNjpAfMbHXTH3iGOHctDp5w/Y4bD/Qji -+PgLT3rkRcbhCIdMdn9vkx89GHX1o+m9d+wogFmHMB0Pvd3i3QMcjrzWnbt07GQ7 -au8iBPYc4aPuXT5mwsMhOxhnR3Tm5Yru4HMGfrR+4nWRRyVxHuO3dLdqcL54IBng -FcM4Oi+rQfoQuvtLvPuhSd928UOA8lR1Cs6gTKNWGxr3bExsqifI5baIbVtA/Wvl -L+Ie2hFKiOtcoS8BgdXtFOtF9oi3LfoQumFr0GTcKbEE1jFcobv2YwW/oD2mq3pn -ubQLt8/KHMl+l42XtN8xHNXww+MEKXszGfe7mC/sUd3y1KEIXWjen9DmhYuth1FJ -65sNtxCWCaMPDUI0A0BWP+Fi9rGg5wZlLyKxobkjjAg2br5ppqTuyv0PRfzZ2DLG -zFXLHE2flkp3ip5yG9XdCZPvxH0k72w8oA8U+gQTeL5tBVhRKPh77YRFaw5usLNc -3lXGBtMBRWQESWmB7QbQMM6w5LwHd8iBn1oxV9Iw8MJp1t1vlaFTsE3iIpHmU55N -uVtQpzMM/AZk6XZFGcCMw6umAX9L+48IHSLkoxC40IghehRRa9XEGZsgGIZ4ILu6 -4Vnz7YvXpwFMP9xzhjXn9uT8dOIGvE/fG3sB6eJ4h3Mt7st4ZdnOiTzz8SKGPkaQ -aWXdMVQXdCbfwi3sNHjKYtmcaMw7uI4N1E23dhqhMKAubj8V/GeVcaigXQl/m1mO -PfPjHQb+M7WiiSZWEKAV+tgw7NPMEI533CLnwWp5Y9G1zZ9aCkCWB5+6/IhKCIop -7/cPO5SBrrgwOj9vfmdZyDuqYSh0RtFuPAuDgsPI3Xnfz0TGb59s46pEJYJU1mtQ -0Z4jRGjHbYlgo7CcYo52KGE4+vikZ0i9dZpz2B2KNXLF5QPm5bWzCL3ovetwYqoM -jYVus41oVsjtjIATTejtx5rg2js8Rf4mETyNOwbs9V6U3jahfoRvGJ3vLlfQkN1A -hDf8EosICphb8FhVB4PFL1nqvvaf/ULRDXBdxhpOC3M2q6SggaHLemH9co/m0ChQ -ZAn306eAszdXodYk4oY3th1I6opIdufXqO3Kk5Atb35cBNDrKvvyoxUTr5s3ukks -+JwwXsBOE+rsrB4Qe9C4vJQkBGI6LNsfWNxr2wdZ+lLin37CBYy3dbFE2Gy1fLf6 -YdFgNK2Xu484XKeVG2GEpe8wflSvpoDmqEMfiZFA6FVXcF5NBdE66rop2pmaXdDZ -i45CPnImVx+ta8JVQDKSXqC0u0IEFkNukS8ml0IXhIGCkTcsQj4rZKa+zXGdYkdr -yarmK+eITyJO3bmRYUmpOvG1+UHEbwncFjnsOLI7ZLYXbAvaKVlQRc62wlRlv6Qt -7joKQ1p36pKf62eAEvxzzaOPE4S0/ogR4zoYCSEXl1ctDnqwdwkiI9qRO7PIDx0p -7ONS3vJVoEufjPjo8WarfOxCKucSd7+kLxCEBt2IJrZ1opK+W821T7PO/hmuWTNx -2qrR/MkogzcUvG0KSkgudISMWlhXuvgnS1QEWNHz/YImbj9CCSJgGfrLBgKjbk9+ -9kFlxf0XR440/viLo4PoqTjet4Xs2XhwfXlBHwBY2tBX/YuhX8ZKOwFepgzpXeFY -5l+e0a48FObeZxs/hbvT6wn89yc+x/yPS59K/qezJTLkw4S//8Rj1+rc443dvb/x -jL65ols7xPF/3kNTS7Wv+O2Xo0+8Qk0o1g/XazyVibwfRVPEscGyhsNE/Dkn7UzX -dV+cJGKbZjN4ihHAtWKEZMXThULCQlia5c5lU6aLhN4f0fsT9NzbHPeASVoCvjpR -cet8ovWgFpQhuqJu3xnI3NdeJrxPhF+pEjm77ovxQ7LIFGeDaeM+J1hhqKTQ94pq -+f+TPyDy1zCVXfTFtaN+EKl/6URF+K1tNGqfixdypUs9DNVD9wHyIAlx48wHkQq5 -9EfjT8x2rld3vk74ohv9dXpP+ykEAMrXrQ3Uq81A9Kb+NCId7vlblhauAFyMO6q3 -sk4X/slzJCgVwJaAf3DW5DVGlDcRio67eEGoc434gPoD0ZGG5+9rTDeAD9t1c1/I -dEFIjNaKO/4O1YGbksKOo5sZnz39s2C8VpGJ358D+jaF/fj5s5gTmzeg68m1ODHy -A6ru5ifuh6+IQZfsW32rO78N2lJHZkfhAiANEbXBkVGK07pLLsj/CoGDwW6upsAk -bf2gqYtb/0em7yDwy4l405hbvQ4vXiHZVO2uDMRJXs1t7MAK0KNaK2XbkaitGwWn -gt2oX2E+uqCtM8A2FBsQPzcJ0+BCTSGiCNoMNKQ9AGQFrbvIt8/L0kEKIoB5HsIH -bs9plnxF//shrRJkE8L2hprRVzSvgvFTwhkxLuirJY3u/lsMdUO1osEUMCXNvY7t -oAT5ga//6k+/+7uPzj7/+W9//fmvfjH72clvvv+dR68f/cMP/uCz1Wzw++/f/sdf -3//Xfz/5l//pf/ZHj/7x73b+6e//819/MJ3/8b/9e/JLs/WX9d/83v8C -=Tb07 ------END PGP MESSAGE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.key b/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.key deleted file mode 100644 index 3b2cffa..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/file-current.txt.key +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.5 (GNU/Linux) - -mQGiBDslQEkRBADgDXtg08dhjHQpv9SisvzvROcsr6QRFOLWf95GWh7c6SI7Pj5m -TClUaJXBRjLuvOR0L7w8l5nVJ/4kzSjle1ad04eDzP3sB4rNK18l7GAwc0ijV0mp -/Kl9F4iibco3cCIMsjysWgUmlk+dYYWQubQA/EgTs7kFQo9QRxzojqnSywCg/5CZ -5TJ19gNS8knyu819v6ZSkV8D/01Fem2WZejqsmNBNiY1JoWxnTofi3AjMv6j/+Nj -yBuU9ozIhUicx4y+Ro05eKUZ+VAIecVbVhEqH9VUriX48TDrNxu4OGJh62q58s0u -/tqIX5OrvrpmdOC1UTdcc2CM88vssTt8oxauZeM7YAkY9rApXUniyfnJ3fdd3FlC -IbvaA/9XXrlBjG/3HQSPfknbqLlCvEclelRmm6LAX8fuf/JFgj0ctRMAJKB6HOE7 -/pvl3yRMMITwmd9lB/s2u+fqcwV1bDqfnyV8h3KFpTCGM1qKT+EaaT/8JhFJifYD -jBEnUe9mYG7dUlt+Ff9Fj6ZRJQs9vszzQcsJDzNpys+j/KJutbQtRHVuY2FuIE1h -Yy1WaWNhciBHYXLtbiA8ZHVuY2FuQG1hYy12aWNhci5jb20+iGAEEBECABgFAjsl -QEkICwMJCAcCAQoCGQEFGwMAAAAAEgkQwSqJHVebm9QHZUdQRwABAeHRAJsGKaYQ -p44NzYEjS9dsEAT4sYKzDgCgw4c7kDarZL/qKqFvHbvsPS6fRteIRgQQEQIABgUC -OyVG9QAKCRDNHrapZn5C0WO7AKCBUULk55fR/yavkYgUhL9AX0rShgCfQ0jjVarV -QNc/cj5ilTdKqSkeJ8q5Ag0EOyVAShAIAPZCV7cIfwgXcqK61qlC8wXo+VMROU+2 -8W65Szgg2gGnVqMU6Y9AVfPQB8bLQ6mUrfdMZIZJ+AyDvWXpF9Sh01D49Vlf3HZS -Tz09jdvOmeFXklnN/biudE/F/Ha8g8VHMGHOfMlm/xX5u/2RXscBqtNbno2gpXI6 -1Brwv0YAWCvl9Ij9WE5J280gtJ3kkQc2azNsOA1FHQ98iLMcfFstjvbzySPAQ/Cl -WxiNjrtVjLhdONM0/XwXV0OjHRhs3jMhLLUq/zzhsSlAGBGNfISnCnLWhsQDGcgH -KXrKlQzZlp+r0ApQmwJG0wg9ZqRdQZ+cfL2JSyIZJrqrol7DVekyCzsAAgIH/3NY -WNGw9Wa8B6Ow6NyS2WSBrx33ZxInDgObZe72mO/GSyxxZqxPiqTFTpajTD+HWKQu -vSfMGZdD1kJZTrNEI/MNLwVBhrgxLX2qrmq1aJgWa5aRcv05wHuIUrw2g220oZ09 -gUhXuF3U/oDUCAX36d16CaPCMJV1TRUoc2L1WoLP2BjzIkAgKrqUGvIFNsvtXe3c -NU5dSQzF0spExuCz1Wy67/T4fzLSJpiWadl/eN67cp83ega5fyYy9NpISmeiFcV2 -5UJqbQM0ktilZzDhx+evmYd6PHP7i8OqgC1oHajEohfo9kmyO/AXJ/v08svnSJVO -0G/9qQeuFp3JVeBHsN6IVAQYEQIADAUCOyVASgUbDAAAAAASCRDBKokdV5ub1Adl -R1BHAAEBRRIAnjhaS/m/eYLw2g79GuLD/1x12Xj9AKCW04cRwUxoIirwdJxLNRT2 -GoLAdg== -=BjTA ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/content b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/content deleted file mode 100644 index a85d664..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/content +++ /dev/null @@ -1,143 +0,0 @@ -CONTENTSTYLE 11 -BASEARCHS i586 -DATADIR suse -DESCRDIR suse/setup/descr -DISTRIBUTION openSUSE -FLAVOR dvd -LABEL openSUSE 11.1 -LINGUAS cs da de en en_GB en_US es fi fr hu it ja nb nl pl pt pt_BR ru sv zh zh_CN zh_TW -NAME openSUSE -REFERENCES openSUSE-release = 11.1 -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/11.0.42/release-notes-openSUSE.rpm -SUMMARY openSUSE -VERSION 11.1 -META SHA1 dd627cf38a5dee28421690d2ec6abea7af274a50 dvd-11.1-58.1.i586.pat.gz -META SHA1 fa49e3205fea8f95d395710a4ba79f55b4626ccd non_oss-11.1-58.1.i586.pat.gz -META SHA1 f6c6ef681aa5fc4c5e9532f04420d54fbec033a8 packages.cs.gz -META SHA1 cc5438a74d1b39f34bc31fbc2399ae6a95f43bc4 packages.de.gz -META SHA1 90dfa1e81f5515769f5b16fcf31c1ab63c55ff87 packages.DU.gz -META SHA1 b1c6b77703357297ecdd8d74b89a099ebbfe2fe6 packages.en.gz -META SHA1 b137fc7749531183b5250ec907d4b9adf4624288 packages.es.gz -META SHA1 3e55d6d5c21a6a1457ea6fef09c999b28883ade4 packages.fr.gz -META SHA1 b5b6092d57a701d4052ad2bb047636c68ac31d8b packages.gz -META SHA1 a893937892aeff71da1c38aa06f3cce5ba02de1c packages.hu.gz -META SHA1 f6c6ef681aa5fc4c5e9532f04420d54fbec033a8 packages.sk.gz -META SHA1 1d66972a977913541c7cb7130d61ec0e751148ba patterns -HASH SHA1 4ae30edd0588114b642bbb08fbd3fb71d7af257d license.tar.gz -HASH SHA1 67d82aa5cd4f08cf77cc70fe9ca1834a4b6212cc control.xml -HASH SHA1 e727c621ded4324cc61e94c615dbd423436f63e4 media.1/info.txt -HASH SHA1 7442eb13ca3c184fe0d47060dbc56fd45cfcb720 boot/i386/bind -HASH SHA1 99920bc0c322d0d0b63ac361d2f9c8f6bc9e3524 boot/i386/branding -HASH SHA1 ca2f0bce909d73d1bfaa7cdeb98595f17e4524aa boot/i386/common -HASH SHA1 d107fa19616c3eae9d49fe52e54971e5b9c160fa boot/i386/config -HASH SHA1 4b7d8525b1d3588562bea71b26cdb5e48e29ff64 boot/i386/cracklib-dict-full.rpm -HASH SHA1 1a8151b2bf88cf618be74eee60d65063386469e0 boot/i386/fonts-arabic.rpm -HASH SHA1 79aec7c93b730c2355aebd085eddf4195a9c1d36 boot/i386/fonts-thai.rpm -HASH SHA1 52e1040f8e0fae373d7426447b1f9d05d25b90f6 boot/i386/gdb -HASH SHA1 a1ba35bcecde55eb36be2e89b7210998b846be9d boot/i386/indic-fonts.rpm -HASH SHA1 6394ec4eb1883520de23bd2ac043490da6ed8fde boot/i386/initrd-xen -HASH SHA1 6394ec4eb1883520de23bd2ac043490da6ed8fde boot/i386/initrd-xenpae -HASH SHA1 6cebf392eaf1b17b53f3e5e88a6b6c6d8c2b76bb boot/i386/KhmerOS-fonts.rpm -HASH SHA1 e9c779539f1b3f56a96337f262b2bc548e6b223e boot/i386/LIESMICH -HASH SHA1 abdf17a0246be709efbcc7c0e0a68f8ad797a754 boot/i386/LIESMICH.DOS -HASH SHA1 f51e15897e5f77c7a7b4d1600dc53be6f117d9ec boot/i386/lklug.rpm -HASH SHA1 c4dca65aa97554bc45885b22ef4af24ad5177c75 boot/i386/mkbootdisk -HASH SHA1 99920bc0c322d0d0b63ac361d2f9c8f6bc9e3524 boot/i386/openSUSE -HASH SHA1 ae44557c57285f0866be41334fdaa20312ccdeab boot/i386/README -HASH SHA1 4a71ee6114eccfb88582dc5422020cbc5a2639dd boot/i386/README.DOS -HASH SHA1 e12efd095a7fb990d0c4be1e04999e72de84dd6a boot/i386/rescue -HASH SHA1 73e50e6321e6938471c4fc0521e0b2dce54f0346 boot/i386/root -HASH SHA1 9b4cced8b700c6737ab02af8f1521945c925c8f9 boot/i386/rpmlist -HASH SHA1 2181540518e50f88e7e35c619460e746934eacd4 boot/i386/sax2 -HASH SHA1 78d3ee95682c1150aa8a95132ba1c5d0d88c23bd boot/i386/ttf-arphic-uming.rpm -HASH SHA1 55a2d437b32d6c192c60e016756725f7a2e717e9 boot/i386/unfonts.rpm -HASH SHA1 7c6fbdc97c11e5e03098f19c196d85cd63e5ce85 boot/i386/vmlinuz-xen -HASH SHA1 7c6fbdc97c11e5e03098f19c196d85cd63e5ce85 boot/i386/vmlinuz-xenpae -HASH SHA1 67d109ba80c3f396710774ff03ace955a2184dc6 boot/i386/yast2-trans-af.rpm -HASH SHA1 3d835ea74b409914cf40ba48669a11590cffa902 boot/i386/yast2-trans-ar.rpm -HASH SHA1 5654cabb329f0b1251d5743624fdf599b92d71e5 boot/i386/yast2-trans-bg.rpm -HASH SHA1 1015f485542ae7c903ec9d1a9c7983d4701e2824 boot/i386/yast2-trans-bn.rpm -HASH SHA1 454e0f1b79d2076a9ba03b23c34da3cbc3e58e25 boot/i386/yast2-trans-bs.rpm -HASH SHA1 76bbfdb77952db51e9b21dc90ab167f2a46f4580 boot/i386/yast2-trans-ca.rpm -HASH SHA1 59f26af0b058b47f2d821f6fa8102d58af8d0377 boot/i386/yast2-trans-cs.rpm -HASH SHA1 db43e4829de2a26b4bb09aa1e93069af2b230377 boot/i386/yast2-trans-cy.rpm -HASH SHA1 1aee13cb0b0a1f4e7b1bbb49e809fd13919ba7e9 boot/i386/yast2-trans-da.rpm -HASH SHA1 36335f1ff2738071be00be65a64f7d41b7db1c33 boot/i386/yast2-trans-de.rpm -HASH SHA1 5297e40871de03217cfee404cb88e909422ceae8 boot/i386/yast2-trans-el.rpm -HASH SHA1 bc61efbd85302ed96ae51550a163cd0fc9ad59a3 boot/i386/yast2-trans-en_GB.rpm -HASH SHA1 a237b73e48777fcdd42505ec1e007484d9f398da boot/i386/yast2-trans-en_US.rpm -HASH SHA1 f2e0dba8e86a723ab72d7f7490665f8e631f63a1 boot/i386/yast2-trans-es.rpm -HASH SHA1 ca9bd8bf05434d42b6a7c2c7549e2ce0170c6be8 boot/i386/yast2-trans-et.rpm -HASH SHA1 57e5cd63079ac258734f28df5385e5288cd59db0 boot/i386/yast2-trans-fa.rpm -HASH SHA1 2983eb7ba93882e52434f396b49cd6e98d7b7399 boot/i386/yast2-trans-fi.rpm -HASH SHA1 0dfc3b38294524871f527d919ce31d6921cf77c0 boot/i386/yast2-trans-fr.rpm -HASH SHA1 2051d343881b288c5d22aec792e9d13ec192dfd1 boot/i386/yast2-trans-gl.rpm -HASH SHA1 49736a9798a371c3edf02f350ebe4db1e6fff011 boot/i386/yast2-trans-gu.rpm -HASH SHA1 d9737ea270e5166cbc409466c1d2a6f16fcc9f06 boot/i386/yast2-trans-hi.rpm -HASH SHA1 1e222655cfabbf0212e629ed1fccf304847ac732 boot/i386/yast2-trans-hr.rpm -HASH SHA1 1b6e646f9f8abc7c33ef2dd830b72c7a2f775620 boot/i386/yast2-trans-hu.rpm -HASH SHA1 723a18301396eccf7c0620f1f8f016719eaf7543 boot/i386/yast2-trans-id.rpm -HASH SHA1 70c272dbe7bfe963e44e5331edd5f440450bc827 boot/i386/yast2-trans-it.rpm -HASH SHA1 f17bc3588c7d2878821600d42fe174156971f87e boot/i386/yast2-trans-ja.rpm -HASH SHA1 d46ea44b7d98ade64658d1cf388013093d1c0d39 boot/i386/yast2-trans-jv.rpm -HASH SHA1 e4e684ebb7f93ac20461062544b49fe18c88627d boot/i386/yast2-trans-ka.rpm -HASH SHA1 123eb83403b88845cb5efd9046ef39351c1b68c3 boot/i386/yast2-trans-km.rpm -HASH SHA1 85c28913c4432f43fa29d8791d97b3e10456a42a boot/i386/yast2-trans-ko.rpm -HASH SHA1 6692fca0c1acb85b398bcbb9150d0826ea38f2c8 boot/i386/yast2-trans-lo.rpm -HASH SHA1 6247198d1348d31192dc158969ce8ae9252d6f0b boot/i386/yast2-trans-lt.rpm -HASH SHA1 a630f16e50a6227f814751931bb1a1ec15981c29 boot/i386/yast2-trans-mk.rpm -HASH SHA1 4f0bffd5cbeb7d37a7d78f1996cade7ae2ad2420 boot/i386/yast2-trans-mr.rpm -HASH SHA1 bbc950f9fec446e9a5a5876c532cd56e060c5eb4 boot/i386/yast2-trans-nb.rpm -HASH SHA1 edae4d58bd99064bbddd62278875b0387a2d495d boot/i386/yast2-trans-nl.rpm -HASH SHA1 85f1dc1eef8862066050c09eef023705a5d61039 boot/i386/yast2-trans-pa.rpm -HASH SHA1 e1eb02ebedff18a01facc150e00d05385affaa17 boot/i386/yast2-trans-pl.rpm -HASH SHA1 c3d31be5bf8af62c537e1a70db9afc98842b3f82 boot/i386/yast2-trans-pt_BR.rpm -HASH SHA1 b2bcd427139f2e13684a592ff186c3076a5b22d8 boot/i386/yast2-trans-pt.rpm -HASH SHA1 7fdb3299ca8230ec363d3ee8eee24915c931790c boot/i386/yast2-trans-ro.rpm -HASH SHA1 8b9bdb13f3b7c73e8c64303e8614e44bf640cc9f boot/i386/yast2-trans-ru.rpm -HASH SHA1 55876ae86c10a3504bbbcd71e49564f4c0b47149 boot/i386/yast2-trans-si.rpm -HASH SHA1 ee8ce4bc8a06b5094f8d51c79b32806531203d62 boot/i386/yast2-trans-sk.rpm -HASH SHA1 04130a176a24ce3adb663a2bb694fd484f2a7776 boot/i386/yast2-trans-sl.rpm -HASH SHA1 d3408d472a956ffbd1fb49354057da5c0b77879f boot/i386/yast2-trans-sr.rpm -HASH SHA1 fda2c586ff8a17d402108f007c2c6214bcaeca3f boot/i386/yast2-trans-sv.rpm -HASH SHA1 04021fd6654b2e7b6cbff65c094efa8c35424215 boot/i386/yast2-trans-ta.rpm -HASH SHA1 6aaae1e49e3188b5e73bedb3c3cd044c4108cca2 boot/i386/yast2-trans-th.rpm -HASH SHA1 6bb5903b7bc64185352c616099c344f8738bb768 boot/i386/yast2-trans-tr.rpm -HASH SHA1 9f631f117433db5e44a6bbed7c8a50cbbe5e8ac0 boot/i386/yast2-trans-uk.rpm -HASH SHA1 3ba5a8f4f3dc3f454e13223c2ecef9937824a611 boot/i386/yast2-trans-vi.rpm -HASH SHA1 bc2775d3a4a0a3ca80e5a5caa51a6612e7158d32 boot/i386/yast2-trans-wa.rpm -HASH SHA1 a3511637ca9bd4cbf5dc9eca58f8ccf5df49603c boot/i386/yast2-trans-xh.rpm -HASH SHA1 ba8875e4c0febe1d26d27c0c948e93128f14476a boot/i386/yast2-trans-zh_CN.rpm -HASH SHA1 d39b329ce32a0d59bebecd0d87ecfd59cb26e297 boot/i386/yast2-trans-zh_TW.rpm -HASH SHA1 0c6f45e6b01d531ac7e821ae9e479416149e92eb boot/i386/yast2-trans-zu.rpm -HASH SHA1 2325eb886cf06b58ca1892578383b5fcc5b11866 boot/i386/loader/linux -HASH SHA1 586ec9beb26fb337283f3b49149d843a3fb7c821 boot/i386/loader/initrd -HASH SHA1 d6b4db657272efe902f8ce92b53082fda4d5f1ca boot/i386/loader/08000600.spl -HASH SHA1 22d4aeede74fdf44b3c4a2524319fe9cf418d4c6 boot/i386/loader/10240600.spl -HASH SHA1 93e297fb9ffa23d6a167c50c318bbb46b0705e45 boot/i386/loader/10240768.spl -HASH SHA1 8c135621ac91216c3388f9ea9c02127b2f6375a0 boot/i386/loader/12800800.spl -HASH SHA1 54dd2bc17c9f73ad9d6a85489f99f518849cb84d boot/i386/loader/12801024.spl -HASH SHA1 ef0f517a3f3a3240349b9bdd01e794267372c4ab boot/i386/loader/14001050.spl -HASH SHA1 2abbc5b4c7c3dc8134ae1207f9d9e95a640046ef boot/i386/loader/16001200.spl -HASH SHA1 e37862355648f6330b6831c69c989dec02b80ab0 boot/i386/loader/16801050.spl -HASH SHA1 082a7887d2f43d049fdb0fc92c5051f1a5b7e663 boot/i386/loader/19201200.spl -HASH SHA1 ed5f4a87074367bcf8396da7a9b9b3d1be6dfcb2 images/base-i386.tar.lzma -HASH SHA1 9d055cacc983226171cdd3a3fe1acd6bb6fa044e images/base-meta-i386.tar.lzma -HASH SHA1 361e07c44526cd43a2d477b7b3448e49e674f0a8 images/common-base-i386.tar.lzma -HASH SHA1 6854608038e4d3b11fcc950e28ca49e4582fd2a4 images/common-desktop-i386.tar.lzma -HASH SHA1 5f6a43158c017e188309c094cdaf24c346de3dfb images/common-xorg-i386.tar.lzma -HASH SHA1 ce6620b820e494c042398b9fd7ed108578008168 images/details-i386.xml -HASH SHA1 22c466bf9af3003ee95fed6f7fb93b4c8c0cd993 images/gnome-i386.tar.lzma -HASH SHA1 49374551f38fe919cf4545d5af0fea7d45361738 images/gnome-meta-i386.tar.lzma -HASH SHA1 d1e9a38629e353d1f0136ded670cf28213d47e6f images/images.xml -HASH SHA1 0df7debf780a0e01b18004d18ef6ab21410b9480 images/kde-i386.tar.lzma -HASH SHA1 c418a15669de278e523893f030c209c479f490e6 images/kde-meta-i386.tar.lzma -HASH SHA1 6c4238796684f770a0b4ecd1ea4469e5a7a49b0d images/x11-i386.tar.lzma -HASH SHA1 cc50a8bc9d560c8d522660feed5feb019f9b889e images/x11-meta-i386.tar.lzma -KEY SHA1 17162a96933229a9771ee10c0976bdc047a2f53d gpg-pubkey-0dfb3188-41ed929b.asc -KEY SHA1 f6accbb18d705bfc104c893cf7dfca1247a33f3c gpg-pubkey-307e3d54-481f30aa.asc -KEY SHA1 47f6492d127ae9f6aac353a2dd23752fc0ed4f8d gpg-pubkey-3d25d3d9-36e12d04.asc -KEY SHA1 2288e5849740566e4fb65b7c9dc0c7e4f43b1039 gpg-pubkey-56b4177a-47965b33.asc -KEY SHA1 89d4bcd20a281553fd1d4ec1708603ebf88f1a59 gpg-pubkey-7e2e3b05-4816488f.asc -KEY SHA1 06ff5171362496c0db84beeccd29967f580350b2 gpg-pubkey-9c800aca-481f343a.asc -KEY SHA1 04544096c5c3b0ed7b01a83d79e048307c2af919 gpg-pubkey-a1912208-446a0899.asc diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/images/images.xml b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/images/images.xml deleted file mode 100644 index 7b252e8..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file-unsigned/images/images.xml +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - i386 - kde-meta-i386.tar.lzma - - - KDE [base] - tar - common-base-i386.tar.lzma - - - KDE [xorg] - tar - common-xorg-i386.tar.lzma - - - KDE [desktop] - tar - common-desktop-i386.tar.lzma - - - KDE - tar - kde-i386.tar.lzma - - - KDE [meta] - tar - kde-meta-i386.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - i386 - gnome-meta-i386.tar.lzma - - - GNOME [1] - tar - common-base-i386.tar.lzma - - - GNOME [2] - tar - common-xorg-i386.tar.lzma - - - GNOME [4] - tar - common-desktop-i386.tar.lzma - - - GNOME - tar - gnome-i386.tar.lzma - - - GNOME [meta] - tar - gnome-meta-i386.tar.lzma - - - - - base,enhanced_base,sw_management - i386 - base-meta-i386.tar.lzma - - - BASE [1] - tar - base-meta-i386.tar.lzma - - - BASE [2] - tar - base-i386.tar.lzma - - - BASE [3] - tar - common-base-i386.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - i386 - x11-meta-i386.tar.lzma - - - X11 [1] - tar - x11-meta-i386.tar.lzma - - - X11 [2] - tar - x11-i386.tar.lzma - - - X11 [3] - tar - common-xorg-i386.tar.lzma - - - X11 [4] - tar - common-base-i386.tar.lzma - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - x86_64 - kde-meta-x86_64.tar.lzma - - - KDE [base] - tar - common-base-x86_64.tar.lzma - - - KDE [xorg] - tar - common-xorg-x86_64.tar.lzma - - - KDE [desktop] - tar - common-desktop-x86_64.tar.lzma - - - KDE - tar - kde-x86_64.tar.lzma - - - KDE [meta] - tar - kde-meta-x86_64.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - x86_64 - gnome-meta-x86_64.tar.lzma - - - GNOME [1] - tar - common-base-x86_64.tar.lzma - - - GNOME [2] - tar - common-xorg-x86_64.tar.lzma - - - GNOME [4] - tar - common-desktop-x86_64.tar.lzma - - - GNOME - tar - gnome-x86_64.tar.lzma - - - GNOME [meta] - tar - gnome-meta-x86_64.tar.lzma - - - - - base,enhanced_base,sw_management - x86_64 - base-meta-x86_64.tar.lzma - - - BASE [1] - tar - base-meta-x86_64.tar.lzma - - - BASE [2] - tar - base-x86_64.tar.lzma - - - BASE [3] - tar - common-base-x86_64.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - x86_64 - x11-meta-x86_64.tar.lzma - - - X11 [1] - tar - x11-meta-x86_64.tar.lzma - - - X11 [2] - tar - x11-x86_64.tar.lzma - - - X11 [3] - tar - common-xorg-x86_64.tar.lzma - - - X11 [4] - tar - common-base-x86_64.tar.lzma - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - ppc - kde-meta-ppc.tar.lzma - - - KDE [base] - tar - common-base-ppc.tar.lzma - - - KDE [xorg] - tar - common-xorg-ppc.tar.lzma - - - KDE [desktop] - tar - common-desktop-ppc.tar.lzma - - - KDE - tar - kde-ppc.tar.lzma - - - KDE [meta] - tar - kde-meta-ppc.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - ppc - gnome-meta-ppc.tar.lzma - - - GNOME [1] - tar - common-base-ppc.tar.lzma - - - GNOME [2] - tar - common-xorg-ppc.tar.lzma - - - GNOME [4] - tar - common-desktop-ppc.tar.lzma - - - GNOME - tar - gnome-ppc.tar.lzma - - - GNOME [meta] - tar - gnome-meta-ppc.tar.lzma - - - - - base,enhanced_base,sw_management - ppc - base-meta-ppc.tar.lzma - - - BASE [1] - tar - base-meta-ppc.tar.lzma - - - BASE [2] - tar - base-ppc.tar.lzma - - - BASE [3] - tar - common-base-ppc.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - ppc - x11-meta-ppc.tar.lzma - - - X11 [1] - tar - x11-meta-ppc.tar.lzma - - - X11 [2] - tar - x11-ppc.tar.lzma - - - X11 [3] - tar - common-xorg-ppc.tar.lzma - - - X11 [4] - tar - common-base-ppc.tar.lzma - - - - - diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content deleted file mode 100644 index a85d664..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content +++ /dev/null @@ -1,143 +0,0 @@ -CONTENTSTYLE 11 -BASEARCHS i586 -DATADIR suse -DESCRDIR suse/setup/descr -DISTRIBUTION openSUSE -FLAVOR dvd -LABEL openSUSE 11.1 -LINGUAS cs da de en en_GB en_US es fi fr hu it ja nb nl pl pt pt_BR ru sv zh zh_CN zh_TW -NAME openSUSE -REFERENCES openSUSE-release = 11.1 -RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/11.0.42/release-notes-openSUSE.rpm -SUMMARY openSUSE -VERSION 11.1 -META SHA1 dd627cf38a5dee28421690d2ec6abea7af274a50 dvd-11.1-58.1.i586.pat.gz -META SHA1 fa49e3205fea8f95d395710a4ba79f55b4626ccd non_oss-11.1-58.1.i586.pat.gz -META SHA1 f6c6ef681aa5fc4c5e9532f04420d54fbec033a8 packages.cs.gz -META SHA1 cc5438a74d1b39f34bc31fbc2399ae6a95f43bc4 packages.de.gz -META SHA1 90dfa1e81f5515769f5b16fcf31c1ab63c55ff87 packages.DU.gz -META SHA1 b1c6b77703357297ecdd8d74b89a099ebbfe2fe6 packages.en.gz -META SHA1 b137fc7749531183b5250ec907d4b9adf4624288 packages.es.gz -META SHA1 3e55d6d5c21a6a1457ea6fef09c999b28883ade4 packages.fr.gz -META SHA1 b5b6092d57a701d4052ad2bb047636c68ac31d8b packages.gz -META SHA1 a893937892aeff71da1c38aa06f3cce5ba02de1c packages.hu.gz -META SHA1 f6c6ef681aa5fc4c5e9532f04420d54fbec033a8 packages.sk.gz -META SHA1 1d66972a977913541c7cb7130d61ec0e751148ba patterns -HASH SHA1 4ae30edd0588114b642bbb08fbd3fb71d7af257d license.tar.gz -HASH SHA1 67d82aa5cd4f08cf77cc70fe9ca1834a4b6212cc control.xml -HASH SHA1 e727c621ded4324cc61e94c615dbd423436f63e4 media.1/info.txt -HASH SHA1 7442eb13ca3c184fe0d47060dbc56fd45cfcb720 boot/i386/bind -HASH SHA1 99920bc0c322d0d0b63ac361d2f9c8f6bc9e3524 boot/i386/branding -HASH SHA1 ca2f0bce909d73d1bfaa7cdeb98595f17e4524aa boot/i386/common -HASH SHA1 d107fa19616c3eae9d49fe52e54971e5b9c160fa boot/i386/config -HASH SHA1 4b7d8525b1d3588562bea71b26cdb5e48e29ff64 boot/i386/cracklib-dict-full.rpm -HASH SHA1 1a8151b2bf88cf618be74eee60d65063386469e0 boot/i386/fonts-arabic.rpm -HASH SHA1 79aec7c93b730c2355aebd085eddf4195a9c1d36 boot/i386/fonts-thai.rpm -HASH SHA1 52e1040f8e0fae373d7426447b1f9d05d25b90f6 boot/i386/gdb -HASH SHA1 a1ba35bcecde55eb36be2e89b7210998b846be9d boot/i386/indic-fonts.rpm -HASH SHA1 6394ec4eb1883520de23bd2ac043490da6ed8fde boot/i386/initrd-xen -HASH SHA1 6394ec4eb1883520de23bd2ac043490da6ed8fde boot/i386/initrd-xenpae -HASH SHA1 6cebf392eaf1b17b53f3e5e88a6b6c6d8c2b76bb boot/i386/KhmerOS-fonts.rpm -HASH SHA1 e9c779539f1b3f56a96337f262b2bc548e6b223e boot/i386/LIESMICH -HASH SHA1 abdf17a0246be709efbcc7c0e0a68f8ad797a754 boot/i386/LIESMICH.DOS -HASH SHA1 f51e15897e5f77c7a7b4d1600dc53be6f117d9ec boot/i386/lklug.rpm -HASH SHA1 c4dca65aa97554bc45885b22ef4af24ad5177c75 boot/i386/mkbootdisk -HASH SHA1 99920bc0c322d0d0b63ac361d2f9c8f6bc9e3524 boot/i386/openSUSE -HASH SHA1 ae44557c57285f0866be41334fdaa20312ccdeab boot/i386/README -HASH SHA1 4a71ee6114eccfb88582dc5422020cbc5a2639dd boot/i386/README.DOS -HASH SHA1 e12efd095a7fb990d0c4be1e04999e72de84dd6a boot/i386/rescue -HASH SHA1 73e50e6321e6938471c4fc0521e0b2dce54f0346 boot/i386/root -HASH SHA1 9b4cced8b700c6737ab02af8f1521945c925c8f9 boot/i386/rpmlist -HASH SHA1 2181540518e50f88e7e35c619460e746934eacd4 boot/i386/sax2 -HASH SHA1 78d3ee95682c1150aa8a95132ba1c5d0d88c23bd boot/i386/ttf-arphic-uming.rpm -HASH SHA1 55a2d437b32d6c192c60e016756725f7a2e717e9 boot/i386/unfonts.rpm -HASH SHA1 7c6fbdc97c11e5e03098f19c196d85cd63e5ce85 boot/i386/vmlinuz-xen -HASH SHA1 7c6fbdc97c11e5e03098f19c196d85cd63e5ce85 boot/i386/vmlinuz-xenpae -HASH SHA1 67d109ba80c3f396710774ff03ace955a2184dc6 boot/i386/yast2-trans-af.rpm -HASH SHA1 3d835ea74b409914cf40ba48669a11590cffa902 boot/i386/yast2-trans-ar.rpm -HASH SHA1 5654cabb329f0b1251d5743624fdf599b92d71e5 boot/i386/yast2-trans-bg.rpm -HASH SHA1 1015f485542ae7c903ec9d1a9c7983d4701e2824 boot/i386/yast2-trans-bn.rpm -HASH SHA1 454e0f1b79d2076a9ba03b23c34da3cbc3e58e25 boot/i386/yast2-trans-bs.rpm -HASH SHA1 76bbfdb77952db51e9b21dc90ab167f2a46f4580 boot/i386/yast2-trans-ca.rpm -HASH SHA1 59f26af0b058b47f2d821f6fa8102d58af8d0377 boot/i386/yast2-trans-cs.rpm -HASH SHA1 db43e4829de2a26b4bb09aa1e93069af2b230377 boot/i386/yast2-trans-cy.rpm -HASH SHA1 1aee13cb0b0a1f4e7b1bbb49e809fd13919ba7e9 boot/i386/yast2-trans-da.rpm -HASH SHA1 36335f1ff2738071be00be65a64f7d41b7db1c33 boot/i386/yast2-trans-de.rpm -HASH SHA1 5297e40871de03217cfee404cb88e909422ceae8 boot/i386/yast2-trans-el.rpm -HASH SHA1 bc61efbd85302ed96ae51550a163cd0fc9ad59a3 boot/i386/yast2-trans-en_GB.rpm -HASH SHA1 a237b73e48777fcdd42505ec1e007484d9f398da boot/i386/yast2-trans-en_US.rpm -HASH SHA1 f2e0dba8e86a723ab72d7f7490665f8e631f63a1 boot/i386/yast2-trans-es.rpm -HASH SHA1 ca9bd8bf05434d42b6a7c2c7549e2ce0170c6be8 boot/i386/yast2-trans-et.rpm -HASH SHA1 57e5cd63079ac258734f28df5385e5288cd59db0 boot/i386/yast2-trans-fa.rpm -HASH SHA1 2983eb7ba93882e52434f396b49cd6e98d7b7399 boot/i386/yast2-trans-fi.rpm -HASH SHA1 0dfc3b38294524871f527d919ce31d6921cf77c0 boot/i386/yast2-trans-fr.rpm -HASH SHA1 2051d343881b288c5d22aec792e9d13ec192dfd1 boot/i386/yast2-trans-gl.rpm -HASH SHA1 49736a9798a371c3edf02f350ebe4db1e6fff011 boot/i386/yast2-trans-gu.rpm -HASH SHA1 d9737ea270e5166cbc409466c1d2a6f16fcc9f06 boot/i386/yast2-trans-hi.rpm -HASH SHA1 1e222655cfabbf0212e629ed1fccf304847ac732 boot/i386/yast2-trans-hr.rpm -HASH SHA1 1b6e646f9f8abc7c33ef2dd830b72c7a2f775620 boot/i386/yast2-trans-hu.rpm -HASH SHA1 723a18301396eccf7c0620f1f8f016719eaf7543 boot/i386/yast2-trans-id.rpm -HASH SHA1 70c272dbe7bfe963e44e5331edd5f440450bc827 boot/i386/yast2-trans-it.rpm -HASH SHA1 f17bc3588c7d2878821600d42fe174156971f87e boot/i386/yast2-trans-ja.rpm -HASH SHA1 d46ea44b7d98ade64658d1cf388013093d1c0d39 boot/i386/yast2-trans-jv.rpm -HASH SHA1 e4e684ebb7f93ac20461062544b49fe18c88627d boot/i386/yast2-trans-ka.rpm -HASH SHA1 123eb83403b88845cb5efd9046ef39351c1b68c3 boot/i386/yast2-trans-km.rpm -HASH SHA1 85c28913c4432f43fa29d8791d97b3e10456a42a boot/i386/yast2-trans-ko.rpm -HASH SHA1 6692fca0c1acb85b398bcbb9150d0826ea38f2c8 boot/i386/yast2-trans-lo.rpm -HASH SHA1 6247198d1348d31192dc158969ce8ae9252d6f0b boot/i386/yast2-trans-lt.rpm -HASH SHA1 a630f16e50a6227f814751931bb1a1ec15981c29 boot/i386/yast2-trans-mk.rpm -HASH SHA1 4f0bffd5cbeb7d37a7d78f1996cade7ae2ad2420 boot/i386/yast2-trans-mr.rpm -HASH SHA1 bbc950f9fec446e9a5a5876c532cd56e060c5eb4 boot/i386/yast2-trans-nb.rpm -HASH SHA1 edae4d58bd99064bbddd62278875b0387a2d495d boot/i386/yast2-trans-nl.rpm -HASH SHA1 85f1dc1eef8862066050c09eef023705a5d61039 boot/i386/yast2-trans-pa.rpm -HASH SHA1 e1eb02ebedff18a01facc150e00d05385affaa17 boot/i386/yast2-trans-pl.rpm -HASH SHA1 c3d31be5bf8af62c537e1a70db9afc98842b3f82 boot/i386/yast2-trans-pt_BR.rpm -HASH SHA1 b2bcd427139f2e13684a592ff186c3076a5b22d8 boot/i386/yast2-trans-pt.rpm -HASH SHA1 7fdb3299ca8230ec363d3ee8eee24915c931790c boot/i386/yast2-trans-ro.rpm -HASH SHA1 8b9bdb13f3b7c73e8c64303e8614e44bf640cc9f boot/i386/yast2-trans-ru.rpm -HASH SHA1 55876ae86c10a3504bbbcd71e49564f4c0b47149 boot/i386/yast2-trans-si.rpm -HASH SHA1 ee8ce4bc8a06b5094f8d51c79b32806531203d62 boot/i386/yast2-trans-sk.rpm -HASH SHA1 04130a176a24ce3adb663a2bb694fd484f2a7776 boot/i386/yast2-trans-sl.rpm -HASH SHA1 d3408d472a956ffbd1fb49354057da5c0b77879f boot/i386/yast2-trans-sr.rpm -HASH SHA1 fda2c586ff8a17d402108f007c2c6214bcaeca3f boot/i386/yast2-trans-sv.rpm -HASH SHA1 04021fd6654b2e7b6cbff65c094efa8c35424215 boot/i386/yast2-trans-ta.rpm -HASH SHA1 6aaae1e49e3188b5e73bedb3c3cd044c4108cca2 boot/i386/yast2-trans-th.rpm -HASH SHA1 6bb5903b7bc64185352c616099c344f8738bb768 boot/i386/yast2-trans-tr.rpm -HASH SHA1 9f631f117433db5e44a6bbed7c8a50cbbe5e8ac0 boot/i386/yast2-trans-uk.rpm -HASH SHA1 3ba5a8f4f3dc3f454e13223c2ecef9937824a611 boot/i386/yast2-trans-vi.rpm -HASH SHA1 bc2775d3a4a0a3ca80e5a5caa51a6612e7158d32 boot/i386/yast2-trans-wa.rpm -HASH SHA1 a3511637ca9bd4cbf5dc9eca58f8ccf5df49603c boot/i386/yast2-trans-xh.rpm -HASH SHA1 ba8875e4c0febe1d26d27c0c948e93128f14476a boot/i386/yast2-trans-zh_CN.rpm -HASH SHA1 d39b329ce32a0d59bebecd0d87ecfd59cb26e297 boot/i386/yast2-trans-zh_TW.rpm -HASH SHA1 0c6f45e6b01d531ac7e821ae9e479416149e92eb boot/i386/yast2-trans-zu.rpm -HASH SHA1 2325eb886cf06b58ca1892578383b5fcc5b11866 boot/i386/loader/linux -HASH SHA1 586ec9beb26fb337283f3b49149d843a3fb7c821 boot/i386/loader/initrd -HASH SHA1 d6b4db657272efe902f8ce92b53082fda4d5f1ca boot/i386/loader/08000600.spl -HASH SHA1 22d4aeede74fdf44b3c4a2524319fe9cf418d4c6 boot/i386/loader/10240600.spl -HASH SHA1 93e297fb9ffa23d6a167c50c318bbb46b0705e45 boot/i386/loader/10240768.spl -HASH SHA1 8c135621ac91216c3388f9ea9c02127b2f6375a0 boot/i386/loader/12800800.spl -HASH SHA1 54dd2bc17c9f73ad9d6a85489f99f518849cb84d boot/i386/loader/12801024.spl -HASH SHA1 ef0f517a3f3a3240349b9bdd01e794267372c4ab boot/i386/loader/14001050.spl -HASH SHA1 2abbc5b4c7c3dc8134ae1207f9d9e95a640046ef boot/i386/loader/16001200.spl -HASH SHA1 e37862355648f6330b6831c69c989dec02b80ab0 boot/i386/loader/16801050.spl -HASH SHA1 082a7887d2f43d049fdb0fc92c5051f1a5b7e663 boot/i386/loader/19201200.spl -HASH SHA1 ed5f4a87074367bcf8396da7a9b9b3d1be6dfcb2 images/base-i386.tar.lzma -HASH SHA1 9d055cacc983226171cdd3a3fe1acd6bb6fa044e images/base-meta-i386.tar.lzma -HASH SHA1 361e07c44526cd43a2d477b7b3448e49e674f0a8 images/common-base-i386.tar.lzma -HASH SHA1 6854608038e4d3b11fcc950e28ca49e4582fd2a4 images/common-desktop-i386.tar.lzma -HASH SHA1 5f6a43158c017e188309c094cdaf24c346de3dfb images/common-xorg-i386.tar.lzma -HASH SHA1 ce6620b820e494c042398b9fd7ed108578008168 images/details-i386.xml -HASH SHA1 22c466bf9af3003ee95fed6f7fb93b4c8c0cd993 images/gnome-i386.tar.lzma -HASH SHA1 49374551f38fe919cf4545d5af0fea7d45361738 images/gnome-meta-i386.tar.lzma -HASH SHA1 d1e9a38629e353d1f0136ded670cf28213d47e6f images/images.xml -HASH SHA1 0df7debf780a0e01b18004d18ef6ab21410b9480 images/kde-i386.tar.lzma -HASH SHA1 c418a15669de278e523893f030c209c479f490e6 images/kde-meta-i386.tar.lzma -HASH SHA1 6c4238796684f770a0b4ecd1ea4469e5a7a49b0d images/x11-i386.tar.lzma -HASH SHA1 cc50a8bc9d560c8d522660feed5feb019f9b889e images/x11-meta-i386.tar.lzma -KEY SHA1 17162a96933229a9771ee10c0976bdc047a2f53d gpg-pubkey-0dfb3188-41ed929b.asc -KEY SHA1 f6accbb18d705bfc104c893cf7dfca1247a33f3c gpg-pubkey-307e3d54-481f30aa.asc -KEY SHA1 47f6492d127ae9f6aac353a2dd23752fc0ed4f8d gpg-pubkey-3d25d3d9-36e12d04.asc -KEY SHA1 2288e5849740566e4fb65b7c9dc0c7e4f43b1039 gpg-pubkey-56b4177a-47965b33.asc -KEY SHA1 89d4bcd20a281553fd1d4ec1708603ebf88f1a59 gpg-pubkey-7e2e3b05-4816488f.asc -KEY SHA1 06ff5171362496c0db84beeccd29967f580350b2 gpg-pubkey-9c800aca-481f343a.asc -KEY SHA1 04544096c5c3b0ed7b01a83d79e048307c2af919 gpg-pubkey-a1912208-446a0899.asc diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.asc b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.asc deleted file mode 100644 index 1e13b6f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEABECAAYFAkkTDKoACgkQm+zCtd2wN1bWFwCcDMWfuN+JDv8/Dew9ozDLNkNM -JbAAn2nqGLhU1PcX6Ev4t/jlPsazliaC -=8Ava ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.key b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.key deleted file mode 100644 index 7b6734f..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/content.key +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.9 (GNU/Linux) - -mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF -110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e -DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu -s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC -kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/ -gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK -fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp -fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy -UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0 -IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm -TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao -hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA -toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr -VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH -cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues -73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL -HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y -0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w -N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=ZZx0 ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/images/images.xml b/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/images/images.xml deleted file mode 100644 index 7b252e8..0000000 --- a/libzypp/tests/zypp/data/Fetcher/remote-site/images-file/images/images.xml +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - i386 - kde-meta-i386.tar.lzma - - - KDE [base] - tar - common-base-i386.tar.lzma - - - KDE [xorg] - tar - common-xorg-i386.tar.lzma - - - KDE [desktop] - tar - common-desktop-i386.tar.lzma - - - KDE - tar - kde-i386.tar.lzma - - - KDE [meta] - tar - kde-meta-i386.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - i386 - gnome-meta-i386.tar.lzma - - - GNOME [1] - tar - common-base-i386.tar.lzma - - - GNOME [2] - tar - common-xorg-i386.tar.lzma - - - GNOME [4] - tar - common-desktop-i386.tar.lzma - - - GNOME - tar - gnome-i386.tar.lzma - - - GNOME [meta] - tar - gnome-meta-i386.tar.lzma - - - - - base,enhanced_base,sw_management - i386 - base-meta-i386.tar.lzma - - - BASE [1] - tar - base-meta-i386.tar.lzma - - - BASE [2] - tar - base-i386.tar.lzma - - - BASE [3] - tar - common-base-i386.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - i386 - x11-meta-i386.tar.lzma - - - X11 [1] - tar - x11-meta-i386.tar.lzma - - - X11 [2] - tar - x11-i386.tar.lzma - - - X11 [3] - tar - common-xorg-i386.tar.lzma - - - X11 [4] - tar - common-base-i386.tar.lzma - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - x86_64 - kde-meta-x86_64.tar.lzma - - - KDE [base] - tar - common-base-x86_64.tar.lzma - - - KDE [xorg] - tar - common-xorg-x86_64.tar.lzma - - - KDE [desktop] - tar - common-desktop-x86_64.tar.lzma - - - KDE - tar - kde-x86_64.tar.lzma - - - KDE [meta] - tar - kde-meta-x86_64.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - x86_64 - gnome-meta-x86_64.tar.lzma - - - GNOME [1] - tar - common-base-x86_64.tar.lzma - - - GNOME [2] - tar - common-xorg-x86_64.tar.lzma - - - GNOME [4] - tar - common-desktop-x86_64.tar.lzma - - - GNOME - tar - gnome-x86_64.tar.lzma - - - GNOME [meta] - tar - gnome-meta-x86_64.tar.lzma - - - - - base,enhanced_base,sw_management - x86_64 - base-meta-x86_64.tar.lzma - - - BASE [1] - tar - base-meta-x86_64.tar.lzma - - - BASE [2] - tar - base-x86_64.tar.lzma - - - BASE [3] - tar - common-base-x86_64.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - x86_64 - x11-meta-x86_64.tar.lzma - - - X11 [1] - tar - x11-meta-x86_64.tar.lzma - - - X11 [2] - tar - x11-x86_64.tar.lzma - - - X11 [3] - tar - common-xorg-x86_64.tar.lzma - - - X11 [4] - tar - common-base-x86_64.tar.lzma - - - - - base,enhanced_base,games,imaging,kde4,kde4_basis,multimedia,sw_management,x11,xgl - ppc - kde-meta-ppc.tar.lzma - - - KDE [base] - tar - common-base-ppc.tar.lzma - - - KDE [xorg] - tar - common-xorg-ppc.tar.lzma - - - KDE [desktop] - tar - common-desktop-ppc.tar.lzma - - - KDE - tar - kde-ppc.tar.lzma - - - KDE [meta] - tar - kde-meta-ppc.tar.lzma - - - - - base,enhanced_base,fonts,games,gnome,gnome_basis,imaging,multimedia,sw_management,x11,xgl - ppc - gnome-meta-ppc.tar.lzma - - - GNOME [1] - tar - common-base-ppc.tar.lzma - - - GNOME [2] - tar - common-xorg-ppc.tar.lzma - - - GNOME [4] - tar - common-desktop-ppc.tar.lzma - - - GNOME - tar - gnome-ppc.tar.lzma - - - GNOME [meta] - tar - gnome-meta-ppc.tar.lzma - - - - - base,enhanced_base,sw_management - ppc - base-meta-ppc.tar.lzma - - - BASE [1] - tar - base-meta-ppc.tar.lzma - - - BASE [2] - tar - base-ppc.tar.lzma - - - BASE [3] - tar - common-base-ppc.tar.lzma - - - - - base,enhanced_base,fonts,sw_management,x11 - ppc - x11-meta-ppc.tar.lzma - - - X11 [1] - tar - x11-meta-ppc.tar.lzma - - - X11 [2] - tar - x11-ppc.tar.lzma - - - X11 [3] - tar - common-xorg-ppc.tar.lzma - - - X11 [4] - tar - common-base-ppc.tar.lzma - - - - - diff --git a/libzypp/tests/zypp/data/FileChecker/hello.txt b/libzypp/tests/zypp/data/FileChecker/hello.txt deleted file mode 100644 index 10377d3..0000000 --- a/libzypp/tests/zypp/data/FileChecker/hello.txt +++ /dev/null @@ -1 +0,0 @@ -hello this is a test diff --git a/libzypp/tests/zypp/data/FileChecker/hello.txt.asc b/libzypp/tests/zypp/data/FileChecker/hello.txt.asc deleted file mode 100644 index f71bd45..0000000 --- a/libzypp/tests/zypp/data/FileChecker/hello.txt.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQBGXW7Gm+zCtd2wN1YRAuAXAJ9e2obl0RWM9eBQz8dmPdQjclmamQCfRnJS -XFIPNZAA1XeQL/Dvi51EIwc= -=3TuF ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/FileChecker/hello.txt.key b/libzypp/tests/zypp/data/FileChecker/hello.txt.key deleted file mode 100644 index 1ee7f92..0000000 --- a/libzypp/tests/zypp/data/FileChecker/hello.txt.key +++ /dev/null @@ -1,214 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.6 (GNU/Linux) - -mQGiBDsj/RYRBACQD/DCxkMgmEjBNYh53AfsV+zcMaz4nDmeEElANfHrVzVGx33N -Siiqs33RIjV35Gd8OH1iSnbA7ef0gWELgVSToK2ydv/3X5Cbcb1MOWYQKJE1dQz7 -fw7Ic9nP7NieM18YMsOYEmCvyL4sLZviQIlb3caP+OpI/GAoNINY8m9yowCgxgx1 -L+jnJznXyKy7v5WgwMyrE2cD/38Nvp62Rq1/IqhUDc3SDUp5+xPddwOZ/E7P9F73 -0Gb2ec2fhAm9QZyVvFvLa+SJq2/LvY+vITZSRI0HTBZf4Yrzd6eHu/cDp0m0o/BS -McuoaHmKeHYcyIa2w8LMREpchgdlY/LnHR83Yipc3iegBRUvoTtwUYMqpswwi+6i -50nhA/9MC5cPOZbPpqbaDbSz0NtAVM2gcvgiBx4VKCh/AhkZ+abzogeHn6uT2eaP -3Fnk4YOa0FEbO+YHg3Lu45tZV3pBQUZoY07r5niT0Sb6dAKO/j/omEt4q44OO3ba -fanEvFurtgpkszoD20yheQLhv7CVdS8IUfQ2R+r0eQjxtAfJWLQmRHVuY2FuIE1h -Yy1WaWNhciBQcmV0dCA8ZHVuY2FuQHB1Yy5jbD6IVwQTEQIAFwUCOyP9FgULBwoD -BAMVAwIDFgIBAheAAAoJEM0etqlmfkLRqZUAnA8SIsD1eQkhDR7GkekdXWtlbW1W -AJ0eAtcylAOTGf3AezgtP/vlWtLj5rkBDQQ7I/0vEAQAnZXsJoF43AMGs5ccBsfe -nbLa1GacjBA212+wJ/toRCbs9xzs5dozh+TnY4Px4cQSafdcsmm3jwMVeCdPdRZ0 -RuJ5qEm2e29qm9nj2MTLVMKEjbTS/FbK5SkxKuLUXHsgZyFLGssFjTWDKsX/jy8c -u0Kby++b6gPkO3Ft0BjwyRMAAwUEAJSn61N7TqyPOs5GSCxzUIAbsh4PlGeDZ3Uc -g+CY/+WZS7CzJlUZiDWqIFADmip5FcuF/MV0mYgcd8nMBVcy17maEf1OnfPhEhOj -spu8xBnSNBGWQHQx9h5CBy66riBSHG8czF9/IlKmWgyo+TGJXrxz1R2VIYgoato6 -BKZSduFZiEYEGBECAAYFAjsj/S8ACgkQzR62qWZ+QtFuBQCeMY2aH7t6yvVR6o1W -YopKmcxZw0UAn3iLjS38pR3qIfRN4Qhzktzu1ofBmQGiBDslJtURBADjFHks4HZl -ZIc3UjWQrICS2dKbbBWxbRIKmirXD0mOZsOCdmkMpIgy4BWM2HncN5BtP/1eyh+n -IwHHnFKgzqKxAIY3AjWzEDVLKPbJZ2xdQceEbKrx3Zrywt4KdyHG9DeAMYmhib8B -VZ9Gg0zyTD6/HqXmA0QUOfOHQKLBApVTVwCg/+F6iL4OlBX1xKlg17yHNbdAFsME -AIOH/1rBCnc2sIjyjFdgha5OxACwOJvrodAOLjDxRL/uRWnjOrKhM36A+TySc5Lv -PpaqnGYcPQMNm7hUThRoLU5rYf/rdUV49y/ARQZDAdZOFf4meYk0c735c7TTTcqw -f7Ri3gVGfrhsmRFwvU9JyNhkWJ/9HpOk1EZCYLgl8f4SA/sEI9CRWiLS+8PHf02p -PzVZkBZzTMZNIUlXKltPJ9hSsbn1P0PHAfk1hYxch0QAQWn786F5P8DBT7bY9/Fj -2Tuu9SReDg+hK1X3K/S8QpUZ3aDuQPBTvtzTryI0k7wsRioXl+dI7yJ5TrtmCUpl -J7QRTaEvpYRn1MuHorM8exqrxLQxRnJhbmNpc2NhIFF1aW50YW5hIE5hcmFuam8g -PGZyYW5jaXNjYUBob3Rwb3AuY29tPohgBBARAgAYBQI7JSbVCAsDCQgHAgEKAhkB -BRsDAAAAABIJEGcamjydIvodB2VHUEcAAQG0twCg462jbwEDWXbQkjp7BsOpn17h -NIgAoMTjKy9QT5pSPvCR2vg4O9DFKJJciEYEEBECAAYFAjslRYcACgkQzR62qWZ+ -QtGT6ACbBW2aYqhvqyE8UmOTpJNeSNa/HrkAoJr1/YGNLR0mOJ4Km5xZ8RprGHv7 -uQINBDslJtUQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmP -QFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24 -rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhO -SdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18 -F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsC -RtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCADd3vdMio1+IrBMRxfHs5bw -qUTxQbHuGIrX4gFqQswWQHnihWPpotDIGwf+uuBWz1X9RiHKCPIOE0rTvXk6DsH1 -s/5iE0+zCLHsoGPSY4DU7WYQgrqumSBP0CqEBFzBJSUN/iCD4PP6lfjzlrmfDznE -Yn73KDJKXM5c0T4YJbs9NFBSmq8qzY9MAixlkty5jvz3GX8/EMTgSxG9ih68CTac -uq+u7fzbQszjKcrAqrPRAgJMtVwTuzBrpyTp/nelvOG8STR0z30yKu0kxaSPupi/ -BDCg/pTjRwAT6TmkdNm1uhebJzK8L6bKy8msqZVMuscxnS/hO2HZ651RvCysyRFh -iFQEGBECAAwFAjslJtUFGwwAAAAAEgkQZxqaPJ0i+h0HZUdQRwABAXlmAKD1P1CN -skD6H649PbY7THYFIgrgswCglmKY5nhOTdRIUsTi5cN37CHIob6ZAaIEOyU2WhEE -AMSfxMgHwElMwonNAeawUGT8NhqgfgRGCqJGHK3v6yx3/ms51sVA4PdA7jt6wG8/ -nbhszeeQCIwiqZtaxGoHZcTEu4219EdOPzMebbLcm2iCH57kXGAc/vn6VOGChNhw -Zt+VgdpEgy/+9gEORKC0cBDT0X93oa5im1O4q5030frvAKD/3pf4Bz4qmi35U9vW -YDan/NqIFwQAocSAWtfn2WtS6UlqHkIBdpc/Zu49DUWJ1rL4wagIhRgGlblyzqZO -GLEhnOrBsHXj3/yxXi+sF3mdDy9Z112DK+1L1taSf8LkRFsutbxsJqumH+bTU1mw -bjnJgd4D8/oz8ryUOc6OnwsmAqaGjWR/Mul+H8mtzKbFpVHjL8uiMs8D/R/mTe6t -GTIQCKaninTn9ovJbRgu4V2H4wB+gvpV463W7UtnY6ypCZOxgjsw+sdRfrOKiH+T -k5bSkRUeaJgFm3Ohfbx9g4CcnKbYLDR1M8TWAlVcb1kZqqrb4daYHz9e5jD2oeZQ -vancOBrsTg6jj2Nrmqzns2LkV+jf/AcMZ80StClNaWNoYWVsIE1hYy1WaWNhciBQ -cmV0dCA8bWltYWN2aWNAcHVjLmNsPohgBBARAgAYBQI7JTZaCAsDCQgHAgEKAhkB -BRsDAAAAABIJEG1K/bpUtQOCB2VHUEcAAQGmEwCeKa3LJJqxvSg2hF18+JQS4F7i -5mQAoMZeMPJWVSWmlU41imAGjwHoP4NyiEYEEBECAAYFAjslRx8ACgkQzR62qWZ+ -QtFkQACfbMS0sv/k91tVcXV5poK0CR+m9EsAn3ywd5cQw3eenCn1z+q3gwI3G99z -uQINBDslNloQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmP -QFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24 -rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhO -SdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18 -F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsC -RtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICB/46z7Jy+uxh4TiACldUV23L -pzj0laL/HhAn+Sv02xAZW7YVgHIq21ZwyiQ9ZbEo005HqvLPch7YymIXxoYiokia -nCgbncHtG0aeaX1T/IPPbJbwNRx2+2GCLongbNvmAO9bCWP9LVeVaT9D4LpsCium -hAtiOw5t/Q2cAPMgN03hTLkRI2LEdZnsapLDogQo5v6oOiLEZasSrft0MMwv3l1G -MUvxdfwrR2HM7WopJS6H4AK2W0tSBLPKFanW9KAsLVcAVFV6u3lEXjuXncOo9feF -WUf8A4LBJr5cQBu2kKuBcy0iayCz18s46KlqxCCCWLu+gnxcTU3YNEdQF41NjdgY -iFQEGBECAAwFAjslNloFGwwAAAAAEgkQbUr9ulS1A4IHZUdQRwABAWk6AKDmE88v -eFoum1b8bwCADKJjNX1WzgCgqJ61xnX80EBLtAO8rQZQSBKyABSZAaIEOyVASREE -AOANe2DTx2GMdCm/1KKy/O9E5yyvpBEU4tZ/3kZaHtzpIjs+PmZMKVRolcFGMu68 -5HQvvDyXmdUn/iTNKOV7Vp3Th4PM/ewHis0rXyXsYDBzSKNXSan8qX0XiKJtyjdw -IgyyPKxaBSaWT51hhZC5tAD8SBOzuQVCj1BHHOiOqdLLAKD/kJnlMnX2A1LySfK7 -zX2/plKRXwP/TUV6bZZl6OqyY0E2JjUmhbGdOh+LcCMy/qP/42PIG5T2jMiFSJzH -jL5GjTl4pRn5UAh5xVtWESof1VSuJfjxMOs3G7g4YmHrarnyzS7+2ohfk6u+umZ0 -4LVRN1xzYIzzy+yxO3yjFq5l4ztgCRj2sCldSeLJ+cnd913cWUIhu9oD/1deuUGM -b/cdBI9+SduouUK8RyV6VGabosBfx+5/8kWCPRy1EwAkoHoc4Tv+m+XfJEwwhPCZ -32UH+za75+pzBXVsOp+fJXyHcoWlMIYzWopP4RppP/wmEUmJ9gOMESdR72Zgbt1S -W34V/0WPplElCz2+zPNBywkPM2nKz6P8om61tC1EdW5jYW4gTWFjLVZpY2FyIEdh -cu1uIDxkdW5jYW5AbWFjLXZpY2FyLmNvbT6IYAQQEQIAGAUCOyVASQgLAwkIBwIB -CgIZAQUbAwAAAAASCRDBKokdV5ub1AdlR1BHAAEB4dEAmwYpphCnjg3NgSNL12wQ -BPixgrMOAKDDhzuQNqtkv+oqoW8du+w9Lp9G14hGBBARAgAGBQI7JUb1AAoJEM0e -tqlmfkLRY7sAoIFRQuTnl9H/Jq+RiBSEv0BfStKGAJ9DSONVqtVA1z9yPmKVN0qp -KR4nyrkCDQQ7JUBKEAgA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadW -oxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeS -Wc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0 -iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF04 -0zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQ -ClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwACAgf/c1hY0bD1ZrwHo7Do -3JLZZIGvHfdnEicOA5tl7vaY78ZLLHFmrE+KpMVOlqNMP4dYpC69J8wZl0PWQllO -s0Qj8w0vBUGGuDEtfaquarVomBZrlpFy/TnAe4hSvDaDbbShnT2BSFe4XdT+gNQI -Bffp3XoJo8IwlXVNFShzYvVags/YGPMiQCAqupQa8gU2y+1d7dw1Tl1JDMXSykTG -4LPVbLrv9Ph/MtImmJZp2X943rtynzd6Brl/JjL02khKZ6IVxXblQmptAzSS2KVn -MOHH56+Zh3o8c/uLw6qALWgdqMSiF+j2SbI78Bcn+/Tyy+dIlU7Qb/2pB64WnclV -4Eew3ohUBBgRAgAMBQI7JUBKBRsMAAAAABIJEMEqiR1Xm5vUB2VHUEcAAQFFEgCe -OFpL+b95gvDaDv0a4sP/XHXZeP0AoJbThxHBTGgiKvB0nEs1FPYagsB2mQGiBENE -9tQRBACoPUvSF0C3Gyg93BzfjPoQzfIG7KcH+X1PMd7wsaF48B53t2V7px4MGw5W -CwRy6S+bkz86Os3Ycxewm0a7/We/G0QmzmyOOD+f+L5s7Sr0rM1fmFVGZRKin1MX -0s7YpX40rSHouNSYXXX2vu+o7uJvkzI8/yf16Kac4b1nP3jT5wCguV6Gl1eWkOS9 -DfwBUuIdwLObzjcD/2B9rPsuN4mhbjTAnPxz8fMKI2r+68UvEkicVIeKKauEp9JW -defR5Yfv2koagqZC3F9550SjZw2r/Wmx0RhAA4mskuMXwIato39NK9+oXqgSVbyT -CAb8SEgPlw60f/MctlIveRpTmSaSL37tj+UEHqOUSPoRk0VNXTML0prWpuVxA/9A -YiJ62X/0CV3DksecKvr3hWdD3WZhoniRInYhkeokHJFP0V0WkWpHD1+brNgHE0ig -jnbkTLWfVYDhppRccKjMiB4CxlwNoreOc2uRvO2cAzo5d0zCdJDfTNi1Ibspuf3r -lnYFZ+Y2dhrP825FMvcS0dL2ZTVcOXPwDVVJRDB0l7QvV2lsbCdzIEdXIGNyeXB0 -byB0ZXN0IGtleSA8d3N0ZXBoZW5zb25Ac3VzZS5kZT6IYAQTEQIAIAUCQ0T21AIb -AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEHfQbNrv1xE4iJkAn3W4/fWpkgZf -pit9du1vzKTaS+y6AJwLXPrzm5F9CDTX77AfCSPsvYOHYrkCDQRDRPbgEAgAveOV -KYqnKMeC9mZEzpYPFjwxMe0qSdVAqxPvAOknzbJpDHm0O9uIf8F/IQZC+Hq/COQk -9zowMkrHIBs93a0SSX4pV174XjshxDoYxDiUf/XTTDec43a420M3K3ji3ySj/MyI -gOr1zu1zCWN90nFIyhBbAUqWwiEO4tHtI96pMko6RvmMZb0gsC5ERMTd5iXfvEPC -437tNyuVokeZmZAPZ2QLJoms3rt1sRujF4vZeDORZXwrhUXGtscopNgg3C39Asw2 -eFS7waeblUdQbtH6iz3ofD+qz2PNc2wcnY5q6aeZTyB0USShG7PsQATLDhFwkeDP -qp8g5oI+JmvPgqyAYwADBQgApLDng/rWmEKEqaUEG5sgG2fqSe7Q8tSXD/OyjXGv -zjkurCe+gOUiWqUfPEtYRGBXGvE8VqYGveQZVjqiNxJ6l6tK8x4GKxMxC4hMFFTo -QWoBhEw1Jy5wvOY8KoqSLnDERjXFqqTQsDEnyFjMGBl4K2XWjOYMBmSqkaDJydtv -unqgH0yULu3ouxY7wk3ZKovDGmtt4i4MrthmYXq9W2tM1LutXh7PChJf4DVIo/0x -SghvMQvJIELAPoIIp8h4V07sjPdvGg+n4nSAhw67KLHCR/TEqgTULH5w83Aopwbr -yDnBKBXFh6zx3ArZu09YM19xW5J1ju4ureQG6jbly5Vmn4hIBBgRAgAJBQJDRPbg -AhsMAAoJEHfQbNrv1xE4qNsAn2soSMFX3ZErJ4Uwwk2pg7dvYlZ0AJUYWEKOTfAc -5kHox/B8rV0xDu90mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3y -EKeueNWc+z/0Kvff4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0P -FPboMvKx0FXl/A0dM+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xoc -QSVCFxcwvwCglVcOQliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/y -E/vdvpN6lF0tmFrKXBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqI -TuZC4CWxJa9GynBED3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBe -GaPdNCcmfZ66rKUdG5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn -4zLUOf6aeBAoV6NMCC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqaj -LfvkURHAeSsxXIoEmyW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF -+rQoU3VTRSBQYWNrYWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMR -AgAiBQJA2AY+AhsDBQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAK -ypCfAJ9RuZ6ZSV7QW4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+I -RgQQEQIABgUCOnBeUgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAe -jACeOO1HIbActAevk5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9A -n5vfiUUE1VQnt+T/EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2O -gSEISZxbzdXGnqIlcT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzne -OA9gTPSr+/fT3WeVnwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yry -k23pQUPAgJENDEqeU6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN -8C1yPqZd5CvvznYvB6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJ -t9IXSzyohEJB6XG5+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ -8UUTmIT2iQf07tRUKJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/g -O7fJEpD2hd2f+pMnOWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZ -NZfDqnFDP6L12w3z3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271h -hQBeRmmoGEKO2JRelGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5uc -TXstZy7vYjL6vTP4l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g -+9V3ORzw4LvO1pwRYJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbST -M5LpC/U6sheLP+l0bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlG -G6pqUN8QxGJYQnonl0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7 -mfoGx6INQjf3HGQpMXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMW -pO+M9bHp4d+puY0L1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zF -bpeqPQUsDv9V7CAJ1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspn -pgCfRbYwxT3iq+9l/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuOmQGi -BEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF110v -ZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6eDAbL -05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRius2ev -221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjCkfar -/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/gnQt -+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUKfZ3g -A/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzpfnWJ -3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAyUYuG -4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0IEtl -eSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNmTgIb -IwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2laohb2Q -4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQAtoB5 -TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnrVW9P -Kj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPHcMOc -31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues73DP -PyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsLHC5w -HMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y0KVa -pBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2wN1ap -uACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dzmQGi -BEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7BwW4E -qmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuciR3y -gsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY3q7e -R8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD++naz -SIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbnZ0yo -OaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9uAhgD -A/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3sYaE -tZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin1/4D -ABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0Y2Fz -ZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wCAhsD -BgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmOlWDx -WV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4T11K -PE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8WxezAsj -yTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUkyHYl -t8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5Ly4I -jfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUluHqD -aCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabMjQgG -hV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv8ZBk -ApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAREDWb -AzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/KiZ/C -6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9DDtpa -UeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/tDCe -J1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/vAwC -GwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6IaVSt -jbDRYEnTHQOGsVy9mQGiBER0ULcRBADZvvVUsUUSjMyQ2fUt8Uu4eGJuPbMhEtR/ -vF7pzF/8u9Br7kh6WASBZ02dMeNoqFzPTU7zv6PiP93iOLwy2MQNOSBLkS+MscR6 -fzS6ZL81mNr+DwgOF/rLZ4tucAsBY9Z3lgRx0mWhl+XunVPXHhkR9H9Rig4wOrrz -wBsYjjfXvwCguQ1PQ6+UQgL8STVqNaNnlVYzzUUD/336IftwogH/tKp6dV/FYP/V -pLHXtwFee0vcCh5FwcKP0vYo9NIfB6CR2g0pyYsHBWbheMWXRVTlCaUVOhaycd+D -XoyKl3FcxL61OD0F/feg2UEqH7n1csGV2MDGlqXsF5urKdPYcBRG56ynlWXs3W7D -zu9JN8skhWSnXdtBFa3BBACo+CAXSzLJnFrG7kg8AYT+0k+kTS/UydwAr57QSLUc -/blXR6seNd+TM4Kwj4Ij2pNL/LpZyzVrDS9BWNZHq3bQnERPrfXpK5XWX0quZn8z -g1ImFwxmJduHKmtyyxNjjPR1SUFzD1EXpPfCYgRL6kU4OflbgGoL2YpmgHO6LQ/O -GrQyb3BlblNVU0UgQnVpbGQgU2VydmljZSA8YnVpbGRzZXJ2aWNlQG9wZW5zdXNl -Lm9yZz6IZAQTEQIAJAUCRHRQtwIbAwUJA8JnAAYLCQgHAwIDFQIDAxYCAQIeAQIX -gAAKCRA7MBG3a51lI/ewAJkB4psDm44RckrzyMyjXEKBYXYKXQCcCLBW95t7ooAI -yqfsg94RICpbr50= -=NAat ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/FileChecker/hello2.txt b/libzypp/tests/zypp/data/FileChecker/hello2.txt deleted file mode 100644 index 43e4a03..0000000 --- a/libzypp/tests/zypp/data/FileChecker/hello2.txt +++ /dev/null @@ -1,2 +0,0 @@ -this is another text - diff --git a/libzypp/tests/zypp/data/KeyRing/private.asc b/libzypp/tests/zypp/data/KeyRing/private.asc deleted file mode 100644 index 803f0d7..0000000 --- a/libzypp/tests/zypp/data/KeyRing/private.asc +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN PGP PRIVATE KEY BLOCK----- -Version: GnuPG v1.4.5 (GNU/Linux) - -lQHhBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/v4DAwKtVz8ehZCg -rWAxhnYmmTtu8nnzDEF6BWQfS7gSUCu66LgtoWSjLfBuiZk0bSNDIrPPy6ZKvOOq -MrHTBrQrWllwcCB0ZXN0Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3Jn -PohgBBMRAgAgBQJGP7wCAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHY -m9mIIb7TJQCfTe4MwrmOlWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kx -uGn8nQJjBEY/vAwQCAD4T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVB -pYORxyWjS8QMc9ge8WxezAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7b -Ai4xx+NLOu9DuuU+jqUkyHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPx -vYrFAWnesgUJMqZo7Td5Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/ -m+MTV05nT6+1KCBqCRUluHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraa -tXyHnAyhwiwTZLq2jabMjQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSj -ZKlHAUdnGul0M2KuyJhv8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt6 -7abbezp/Dgs8+691OtAREDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2 -HGTzVy1k33vnuGCVwC/KiZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp -8dMJ+FFsTmzONzZpFC9DDtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+ -cFkE7hW8tyOwcx4sk1J/tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqC -GWJV/gMDAq1XPx6FkKCtYI80yXvLiqb3UuzJbGJv5vVmdtsUcwiHhGnyWRd6AbKy -Z0sflw+3PmpqEuAZ8LsdfJv8uIhkWh2W+eDYBrZBJ4IqQogALCf+AMCISQQYEQIA -CQUCRj+8DAIbDAAKCRC9Ydib2Yghvk73AJ9cke9SDyJr+M+nusuWZqzdsJYr0wCc -DHnEr0GsuEal8fCTCJuMQScd4zo= -=7nLA ------END PGP PRIVATE KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/KeyRing/public.asc b/libzypp/tests/zypp/data/KeyRing/public.asc deleted file mode 100644 index ca2aa69..0000000 --- a/libzypp/tests/zypp/data/KeyRing/public.asc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.5 (GNU/Linux) - -mQGiBEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7B -wW4EqmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuc -iR3ygsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY -3q7eR8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD+ -+nazSIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbn -Z0yoOaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9u -AhgDA/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3 -sYaEtZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin -1/4DABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0 -Y2FzZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wC -AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmO -lWDxWV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4 -T11KPE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8Wxe -zAsjyTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUk -yHYlt8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5 -Ly4IjfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUl -uHqDaCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabM -jQgGhV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv -8ZBkApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAR -EDWbAzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/K -iZ/C6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9D -DtpaUeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/ -tDCeJ1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/ -vAwCGwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6I -aVStjbDRYEnTHQOGsVy9 -=LiUY ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/KeyRing/readme.txt b/libzypp/tests/zypp/data/KeyRing/readme.txt deleted file mode 100644 index cfab478..0000000 --- a/libzypp/tests/zypp/data/KeyRing/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -passphrase for the key pair is zypp-devel - diff --git a/libzypp/tests/zypp/data/KeyRing/repomd.xml b/libzypp/tests/zypp/data/KeyRing/repomd.xml deleted file mode 100644 index f68f8dc..0000000 --- a/libzypp/tests/zypp/data/KeyRing/repomd.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - 49589f0e6569914ada9293e8c3895cb899b58a58 - 1177395604 - 67b155adc1e7622f7962849ee43965253a797765 - - - - 4174aed6d4ffb8cfee41b64ae357ce1db3fe904a - 1177395604 - 1981b7db9252974869ce1d71443bde69fa9423ca - - - - 2a72bebe987fb613673d9db73120e95a999f143d - 1177395604 - 6a328b1ec1fab195fb69035c13fe4340ee2b9cbd - - diff --git a/libzypp/tests/zypp/data/KeyRing/repomd.xml.asc b/libzypp/tests/zypp/data/KeyRing/repomd.xml.asc deleted file mode 100644 index 9b68fbb..0000000 --- a/libzypp/tests/zypp/data/KeyRing/repomd.xml.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQBGQFwzvWHYm9mIIb4RAnbuAJsHJkj5X8M5aOxeZ2KUsHjhQ1vKOACdFrQ0 -Vxp3Zznn3w4j5SaGAqpyGWA= -=iu9H ------END PGP SIGNATURE----- diff --git a/libzypp/tests/zypp/data/KeyRing/repomd.xml.corrupted b/libzypp/tests/zypp/data/KeyRing/repomd.xml.corrupted deleted file mode 100644 index b655532..0000000 --- a/libzypp/tests/zypp/data/KeyRing/repomd.xml.corrupted +++ /dev/null @@ -1,21 +0,0 @@ - - - - - 49589f0e6569914ada9293e8c3895cb899b58a58 - 1177395604 - 67b855adc1e7622f7962849ee43965253a797765 - - - - 4174aed6d4ffb8cfee41b64ae357ce1db3fe904a - 1177395604 - 1981b7db9252974869ce1d71443bde69fa9423ca - - - - 2a72bebe987fb613673d9db73120e95a999f143d - 1177395604 - 6a328b1ec1fab195fb69035c13fe4340ee2b9cbd - - diff --git a/libzypp/tests/zypp/data/Locks/locks b/libzypp/tests/zypp/data/Locks/locks deleted file mode 100644 index 464cd99..0000000 --- a/libzypp/tests/zypp/data/Locks/locks +++ /dev/null @@ -1 +0,0 @@ -query_string: zypper diff --git a/libzypp/tests/zypp/data/PoolQuery/savedqueries b/libzypp/tests/zypp/data/PoolQuery/savedqueries deleted file mode 100644 index 79c689b..0000000 --- a/libzypp/tests/zypp/data/PoolQuery/savedqueries +++ /dev/null @@ -1,12 +0,0 @@ -solvable_name: tool -repo: vbox -repo: zyppsvn - -query_string: ma* -repo: opensuse -type: patch -match_type: regex -require_all: on -case_sensitive: on -install_status: not-installed -version: != 0.8.3 diff --git a/libzypp/tests/zypp/data/PublicKey/multikey.asc b/libzypp/tests/zypp/data/PublicKey/multikey.asc deleted file mode 100644 index b42b9c7..0000000 --- a/libzypp/tests/zypp/data/PublicKey/multikey.asc +++ /dev/null @@ -1,38 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v2.0.19 (GNU/Linux) - -mIsERCAdXQEEAL7MrBTz+3SBWpCm2ae2yaDqV3ezQcs2JlvqidJVhsZqQe9/jkxi -KTEQW5+TXF/+BlQSiebunRI7oo3+9U8GyRCgs1sf+yRQWMLzZqRaarzRhw9w+Ihl -edtqYl6/U2JZCb8Adp6d7RzlRliJdJ/VtsfXj2ef7Dwu7elOVSsmaBdtAAYptChT -dVNFIFBhY2thZ2UgU2lnbmluZyBLZXkgPGJ1aWxkQHN1c2UuZGU+iLgEEwECACIC -GwMECwcDAgMVAgMDFgIBAh4BAheABQJL4BplBQkPRMsIAAoJEOOlw2Awfj1UhOsD -/RkkEhOIC9NNad0F5O0rEJxvsI7Nm+6FnNJq8LjyR5+87epQCXgpaBXEGd4RcjjO -TukLaHHrC1T/h4biIyf253VZHr4oJ46sUivNUFq60gl4gk56aTGTNeUWOsgrU4jm -auFca3dbGcNfiJ7c7dF2CkOAR+CPMLPYTvuVIRQBAjeSmQGiBEjKO60RBACeqGqC -khF+Zmzln1G7Jj9EaX6qiigk1hbs5VLQ5205lBIFMocOOAcmB9GI6r9D4VdwTew9 -PaXur4cRi8otaF93DaCCgsBvLsBTVFC1sKgJMJkhB/BKV4GdSCAylSNAzASYelZE -7KJSD1KxdS29HBVN07BOcSCBjR9eRC6kmW9IWwCg0t9U+Jx+CX7Fa9Q5mZ0/OfI1 -Bd8D/joPsDKz2uAit3gEXGgGorQdXiFZIbppLe89Jz9fLq/J9GFdd6lz3Yv2Vsf/ -hsaWPXQl5IZE+p6UPWUDUCwLVioLPQKh1p95KFdLn6pxFwG94UTougtjmm10E2ND -0PdssakeVtdYtNoeagQC1fYKmWyxBgXd4/nfhiNq0wFGsUUEBACbx8MIv5umcIIx -TG8sJRouOjIgRdfmWPiWpxAql+qyPTwnkZytZ0zJrfdVEnKrfX8FkZ86oDN1pc0Z -Zht59PrwxZpC5Kt3x0jNnyztn0FGwkADDhaEdzu8ZFXpkxglbsBAF2jx8HBLEMjN -CFCEYHUoFrcIVfCO/fHJKWZquYKQuLQhVW5zdXBwb3J0ZWQgPHVuc3VwcG9ydGVk -QHN1c2UuZGU+iGYEExECACYCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCS+Aa -8wUJCpqtRgAKCRAn+kG9inxk+XmpAKCUcG9rb6yU4jZn8PudBfsuQNhQNgCghiHo -heeFc3pKA2PJ5tUKuPpTLya5Ag0ESMo7tBAIAJr+eL5b7DNd6oEcgMWR2yZieSpr -YMDRGc5lU7HOsApcH2kHleBUQynle5NyYI0LOCuzV5QtAd0gwDV99A8VAVvYrcJl -uuh6Wj2yoENBulEySUZ9LYuGA5ErFDGWEMMbXDLNvvb2MVCDXnLE34aXzRVnDjKd -2+/vzpNFuEECwGZBcf78+u0BNxCfxgLgdKdLZsAmdcFEONu8Zx6hxpoL5h+B1doI -FqgePcAqhw3m7O+R8PCsODBvoIgQfViwk21BNKpnfBSvLFpJTA+AnwnRAuyljmda -hI1LwB7VZ+TSplpsbt08HvmDDPzKsfgURPp+NzsQU0iFmjeaYf/9cDYgbA8AAwUH -/A2dQA0JymANMkViHUt8HHtMpRPfUBEAICRriMmkSIWoUK6hZ/rD8t8PkOG7pfLC -os/WdIPtuuh+56Cw1u48pwXe4nR0M3iqVTxizdldt197MeQejjBppcza7OH7nyga -+NXf/GsniuuHcanImyh8yugaobWeBVD8i2juuLZFmlKc88Z1XWTC1ndB0WduWca2 -XEIJgvPyk84y/r6ItB45R+Pn3b/mafl2ebhI+YG8ywY8lqBhSWnQTNXaKG/ijb+a -xSEPVvNAHonZyv81XUDRNDEO/Rwsxmgb12J41k+5jpcB5yKo4lc6qNdHAwyuxSUB -D/xATGUaSFmUE7mxFlzCr0+ITwQYEQIADwIbDAUCS+AbAwUJCpqtTwAKCRAn+kG9 -inxk+TQ4AKCUWlqp8CgtApaaV/KBmNMhcE9TzwCfcTpQER3EMh/4CgK8wSHFcTuG -QEk= -=Dkxe ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/PublicKey/multikey2.asc b/libzypp/tests/zypp/data/PublicKey/multikey2.asc deleted file mode 100644 index 1ee7f92..0000000 --- a/libzypp/tests/zypp/data/PublicKey/multikey2.asc +++ /dev/null @@ -1,214 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.6 (GNU/Linux) - -mQGiBDsj/RYRBACQD/DCxkMgmEjBNYh53AfsV+zcMaz4nDmeEElANfHrVzVGx33N -Siiqs33RIjV35Gd8OH1iSnbA7ef0gWELgVSToK2ydv/3X5Cbcb1MOWYQKJE1dQz7 -fw7Ic9nP7NieM18YMsOYEmCvyL4sLZviQIlb3caP+OpI/GAoNINY8m9yowCgxgx1 -L+jnJznXyKy7v5WgwMyrE2cD/38Nvp62Rq1/IqhUDc3SDUp5+xPddwOZ/E7P9F73 -0Gb2ec2fhAm9QZyVvFvLa+SJq2/LvY+vITZSRI0HTBZf4Yrzd6eHu/cDp0m0o/BS -McuoaHmKeHYcyIa2w8LMREpchgdlY/LnHR83Yipc3iegBRUvoTtwUYMqpswwi+6i -50nhA/9MC5cPOZbPpqbaDbSz0NtAVM2gcvgiBx4VKCh/AhkZ+abzogeHn6uT2eaP -3Fnk4YOa0FEbO+YHg3Lu45tZV3pBQUZoY07r5niT0Sb6dAKO/j/omEt4q44OO3ba -fanEvFurtgpkszoD20yheQLhv7CVdS8IUfQ2R+r0eQjxtAfJWLQmRHVuY2FuIE1h -Yy1WaWNhciBQcmV0dCA8ZHVuY2FuQHB1Yy5jbD6IVwQTEQIAFwUCOyP9FgULBwoD -BAMVAwIDFgIBAheAAAoJEM0etqlmfkLRqZUAnA8SIsD1eQkhDR7GkekdXWtlbW1W -AJ0eAtcylAOTGf3AezgtP/vlWtLj5rkBDQQ7I/0vEAQAnZXsJoF43AMGs5ccBsfe -nbLa1GacjBA212+wJ/toRCbs9xzs5dozh+TnY4Px4cQSafdcsmm3jwMVeCdPdRZ0 -RuJ5qEm2e29qm9nj2MTLVMKEjbTS/FbK5SkxKuLUXHsgZyFLGssFjTWDKsX/jy8c -u0Kby++b6gPkO3Ft0BjwyRMAAwUEAJSn61N7TqyPOs5GSCxzUIAbsh4PlGeDZ3Uc -g+CY/+WZS7CzJlUZiDWqIFADmip5FcuF/MV0mYgcd8nMBVcy17maEf1OnfPhEhOj -spu8xBnSNBGWQHQx9h5CBy66riBSHG8czF9/IlKmWgyo+TGJXrxz1R2VIYgoato6 -BKZSduFZiEYEGBECAAYFAjsj/S8ACgkQzR62qWZ+QtFuBQCeMY2aH7t6yvVR6o1W -YopKmcxZw0UAn3iLjS38pR3qIfRN4Qhzktzu1ofBmQGiBDslJtURBADjFHks4HZl -ZIc3UjWQrICS2dKbbBWxbRIKmirXD0mOZsOCdmkMpIgy4BWM2HncN5BtP/1eyh+n -IwHHnFKgzqKxAIY3AjWzEDVLKPbJZ2xdQceEbKrx3Zrywt4KdyHG9DeAMYmhib8B -VZ9Gg0zyTD6/HqXmA0QUOfOHQKLBApVTVwCg/+F6iL4OlBX1xKlg17yHNbdAFsME -AIOH/1rBCnc2sIjyjFdgha5OxACwOJvrodAOLjDxRL/uRWnjOrKhM36A+TySc5Lv -PpaqnGYcPQMNm7hUThRoLU5rYf/rdUV49y/ARQZDAdZOFf4meYk0c735c7TTTcqw -f7Ri3gVGfrhsmRFwvU9JyNhkWJ/9HpOk1EZCYLgl8f4SA/sEI9CRWiLS+8PHf02p -PzVZkBZzTMZNIUlXKltPJ9hSsbn1P0PHAfk1hYxch0QAQWn786F5P8DBT7bY9/Fj -2Tuu9SReDg+hK1X3K/S8QpUZ3aDuQPBTvtzTryI0k7wsRioXl+dI7yJ5TrtmCUpl -J7QRTaEvpYRn1MuHorM8exqrxLQxRnJhbmNpc2NhIFF1aW50YW5hIE5hcmFuam8g -PGZyYW5jaXNjYUBob3Rwb3AuY29tPohgBBARAgAYBQI7JSbVCAsDCQgHAgEKAhkB -BRsDAAAAABIJEGcamjydIvodB2VHUEcAAQG0twCg462jbwEDWXbQkjp7BsOpn17h -NIgAoMTjKy9QT5pSPvCR2vg4O9DFKJJciEYEEBECAAYFAjslRYcACgkQzR62qWZ+ -QtGT6ACbBW2aYqhvqyE8UmOTpJNeSNa/HrkAoJr1/YGNLR0mOJ4Km5xZ8RprGHv7 -uQINBDslJtUQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmP -QFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24 -rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhO -SdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18 -F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsC -RtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCADd3vdMio1+IrBMRxfHs5bw -qUTxQbHuGIrX4gFqQswWQHnihWPpotDIGwf+uuBWz1X9RiHKCPIOE0rTvXk6DsH1 -s/5iE0+zCLHsoGPSY4DU7WYQgrqumSBP0CqEBFzBJSUN/iCD4PP6lfjzlrmfDznE -Yn73KDJKXM5c0T4YJbs9NFBSmq8qzY9MAixlkty5jvz3GX8/EMTgSxG9ih68CTac -uq+u7fzbQszjKcrAqrPRAgJMtVwTuzBrpyTp/nelvOG8STR0z30yKu0kxaSPupi/ -BDCg/pTjRwAT6TmkdNm1uhebJzK8L6bKy8msqZVMuscxnS/hO2HZ651RvCysyRFh -iFQEGBECAAwFAjslJtUFGwwAAAAAEgkQZxqaPJ0i+h0HZUdQRwABAXlmAKD1P1CN -skD6H649PbY7THYFIgrgswCglmKY5nhOTdRIUsTi5cN37CHIob6ZAaIEOyU2WhEE -AMSfxMgHwElMwonNAeawUGT8NhqgfgRGCqJGHK3v6yx3/ms51sVA4PdA7jt6wG8/ -nbhszeeQCIwiqZtaxGoHZcTEu4219EdOPzMebbLcm2iCH57kXGAc/vn6VOGChNhw -Zt+VgdpEgy/+9gEORKC0cBDT0X93oa5im1O4q5030frvAKD/3pf4Bz4qmi35U9vW -YDan/NqIFwQAocSAWtfn2WtS6UlqHkIBdpc/Zu49DUWJ1rL4wagIhRgGlblyzqZO -GLEhnOrBsHXj3/yxXi+sF3mdDy9Z112DK+1L1taSf8LkRFsutbxsJqumH+bTU1mw -bjnJgd4D8/oz8ryUOc6OnwsmAqaGjWR/Mul+H8mtzKbFpVHjL8uiMs8D/R/mTe6t -GTIQCKaninTn9ovJbRgu4V2H4wB+gvpV463W7UtnY6ypCZOxgjsw+sdRfrOKiH+T -k5bSkRUeaJgFm3Ohfbx9g4CcnKbYLDR1M8TWAlVcb1kZqqrb4daYHz9e5jD2oeZQ -vancOBrsTg6jj2Nrmqzns2LkV+jf/AcMZ80StClNaWNoYWVsIE1hYy1WaWNhciBQ -cmV0dCA8bWltYWN2aWNAcHVjLmNsPohgBBARAgAYBQI7JTZaCAsDCQgHAgEKAhkB -BRsDAAAAABIJEG1K/bpUtQOCB2VHUEcAAQGmEwCeKa3LJJqxvSg2hF18+JQS4F7i -5mQAoMZeMPJWVSWmlU41imAGjwHoP4NyiEYEEBECAAYFAjslRx8ACgkQzR62qWZ+ -QtFkQACfbMS0sv/k91tVcXV5poK0CR+m9EsAn3ywd5cQw3eenCn1z+q3gwI3G99z -uQINBDslNloQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmP -QFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24 -rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhO -SdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18 -F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsC -RtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICB/46z7Jy+uxh4TiACldUV23L -pzj0laL/HhAn+Sv02xAZW7YVgHIq21ZwyiQ9ZbEo005HqvLPch7YymIXxoYiokia -nCgbncHtG0aeaX1T/IPPbJbwNRx2+2GCLongbNvmAO9bCWP9LVeVaT9D4LpsCium -hAtiOw5t/Q2cAPMgN03hTLkRI2LEdZnsapLDogQo5v6oOiLEZasSrft0MMwv3l1G -MUvxdfwrR2HM7WopJS6H4AK2W0tSBLPKFanW9KAsLVcAVFV6u3lEXjuXncOo9feF -WUf8A4LBJr5cQBu2kKuBcy0iayCz18s46KlqxCCCWLu+gnxcTU3YNEdQF41NjdgY -iFQEGBECAAwFAjslNloFGwwAAAAAEgkQbUr9ulS1A4IHZUdQRwABAWk6AKDmE88v -eFoum1b8bwCADKJjNX1WzgCgqJ61xnX80EBLtAO8rQZQSBKyABSZAaIEOyVASREE -AOANe2DTx2GMdCm/1KKy/O9E5yyvpBEU4tZ/3kZaHtzpIjs+PmZMKVRolcFGMu68 -5HQvvDyXmdUn/iTNKOV7Vp3Th4PM/ewHis0rXyXsYDBzSKNXSan8qX0XiKJtyjdw -IgyyPKxaBSaWT51hhZC5tAD8SBOzuQVCj1BHHOiOqdLLAKD/kJnlMnX2A1LySfK7 -zX2/plKRXwP/TUV6bZZl6OqyY0E2JjUmhbGdOh+LcCMy/qP/42PIG5T2jMiFSJzH -jL5GjTl4pRn5UAh5xVtWESof1VSuJfjxMOs3G7g4YmHrarnyzS7+2ohfk6u+umZ0 -4LVRN1xzYIzzy+yxO3yjFq5l4ztgCRj2sCldSeLJ+cnd913cWUIhu9oD/1deuUGM -b/cdBI9+SduouUK8RyV6VGabosBfx+5/8kWCPRy1EwAkoHoc4Tv+m+XfJEwwhPCZ -32UH+za75+pzBXVsOp+fJXyHcoWlMIYzWopP4RppP/wmEUmJ9gOMESdR72Zgbt1S -W34V/0WPplElCz2+zPNBywkPM2nKz6P8om61tC1EdW5jYW4gTWFjLVZpY2FyIEdh -cu1uIDxkdW5jYW5AbWFjLXZpY2FyLmNvbT6IYAQQEQIAGAUCOyVASQgLAwkIBwIB -CgIZAQUbAwAAAAASCRDBKokdV5ub1AdlR1BHAAEB4dEAmwYpphCnjg3NgSNL12wQ -BPixgrMOAKDDhzuQNqtkv+oqoW8du+w9Lp9G14hGBBARAgAGBQI7JUb1AAoJEM0e -tqlmfkLRY7sAoIFRQuTnl9H/Jq+RiBSEv0BfStKGAJ9DSONVqtVA1z9yPmKVN0qp -KR4nyrkCDQQ7JUBKEAgA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadW -oxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeS -Wc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0 -iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF04 -0zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQ -ClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwACAgf/c1hY0bD1ZrwHo7Do -3JLZZIGvHfdnEicOA5tl7vaY78ZLLHFmrE+KpMVOlqNMP4dYpC69J8wZl0PWQllO -s0Qj8w0vBUGGuDEtfaquarVomBZrlpFy/TnAe4hSvDaDbbShnT2BSFe4XdT+gNQI -Bffp3XoJo8IwlXVNFShzYvVags/YGPMiQCAqupQa8gU2y+1d7dw1Tl1JDMXSykTG -4LPVbLrv9Ph/MtImmJZp2X943rtynzd6Brl/JjL02khKZ6IVxXblQmptAzSS2KVn -MOHH56+Zh3o8c/uLw6qALWgdqMSiF+j2SbI78Bcn+/Tyy+dIlU7Qb/2pB64WnclV -4Eew3ohUBBgRAgAMBQI7JUBKBRsMAAAAABIJEMEqiR1Xm5vUB2VHUEcAAQFFEgCe -OFpL+b95gvDaDv0a4sP/XHXZeP0AoJbThxHBTGgiKvB0nEs1FPYagsB2mQGiBENE -9tQRBACoPUvSF0C3Gyg93BzfjPoQzfIG7KcH+X1PMd7wsaF48B53t2V7px4MGw5W -CwRy6S+bkz86Os3Ycxewm0a7/We/G0QmzmyOOD+f+L5s7Sr0rM1fmFVGZRKin1MX -0s7YpX40rSHouNSYXXX2vu+o7uJvkzI8/yf16Kac4b1nP3jT5wCguV6Gl1eWkOS9 -DfwBUuIdwLObzjcD/2B9rPsuN4mhbjTAnPxz8fMKI2r+68UvEkicVIeKKauEp9JW -defR5Yfv2koagqZC3F9550SjZw2r/Wmx0RhAA4mskuMXwIato39NK9+oXqgSVbyT -CAb8SEgPlw60f/MctlIveRpTmSaSL37tj+UEHqOUSPoRk0VNXTML0prWpuVxA/9A -YiJ62X/0CV3DksecKvr3hWdD3WZhoniRInYhkeokHJFP0V0WkWpHD1+brNgHE0ig -jnbkTLWfVYDhppRccKjMiB4CxlwNoreOc2uRvO2cAzo5d0zCdJDfTNi1Ibspuf3r -lnYFZ+Y2dhrP825FMvcS0dL2ZTVcOXPwDVVJRDB0l7QvV2lsbCdzIEdXIGNyeXB0 -byB0ZXN0IGtleSA8d3N0ZXBoZW5zb25Ac3VzZS5kZT6IYAQTEQIAIAUCQ0T21AIb -AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEHfQbNrv1xE4iJkAn3W4/fWpkgZf -pit9du1vzKTaS+y6AJwLXPrzm5F9CDTX77AfCSPsvYOHYrkCDQRDRPbgEAgAveOV -KYqnKMeC9mZEzpYPFjwxMe0qSdVAqxPvAOknzbJpDHm0O9uIf8F/IQZC+Hq/COQk -9zowMkrHIBs93a0SSX4pV174XjshxDoYxDiUf/XTTDec43a420M3K3ji3ySj/MyI -gOr1zu1zCWN90nFIyhBbAUqWwiEO4tHtI96pMko6RvmMZb0gsC5ERMTd5iXfvEPC -437tNyuVokeZmZAPZ2QLJoms3rt1sRujF4vZeDORZXwrhUXGtscopNgg3C39Asw2 -eFS7waeblUdQbtH6iz3ofD+qz2PNc2wcnY5q6aeZTyB0USShG7PsQATLDhFwkeDP -qp8g5oI+JmvPgqyAYwADBQgApLDng/rWmEKEqaUEG5sgG2fqSe7Q8tSXD/OyjXGv -zjkurCe+gOUiWqUfPEtYRGBXGvE8VqYGveQZVjqiNxJ6l6tK8x4GKxMxC4hMFFTo -QWoBhEw1Jy5wvOY8KoqSLnDERjXFqqTQsDEnyFjMGBl4K2XWjOYMBmSqkaDJydtv -unqgH0yULu3ouxY7wk3ZKovDGmtt4i4MrthmYXq9W2tM1LutXh7PChJf4DVIo/0x -SghvMQvJIELAPoIIp8h4V07sjPdvGg+n4nSAhw67KLHCR/TEqgTULH5w83Aopwbr -yDnBKBXFh6zx3ArZu09YM19xW5J1ju4ureQG6jbly5Vmn4hIBBgRAgAJBQJDRPbg -AhsMAAoJEHfQbNrv1xE4qNsAn2soSMFX3ZErJ4Uwwk2pg7dvYlZ0AJUYWEKOTfAc -5kHox/B8rV0xDu90mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3y -EKeueNWc+z/0Kvff4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0P -FPboMvKx0FXl/A0dM+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xoc -QSVCFxcwvwCglVcOQliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/y -E/vdvpN6lF0tmFrKXBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqI -TuZC4CWxJa9GynBED3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBe -GaPdNCcmfZ66rKUdG5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn -4zLUOf6aeBAoV6NMCC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqaj -LfvkURHAeSsxXIoEmyW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF -+rQoU3VTRSBQYWNrYWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMR -AgAiBQJA2AY+AhsDBQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAK -ypCfAJ9RuZ6ZSV7QW4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+I -RgQQEQIABgUCOnBeUgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAe -jACeOO1HIbActAevk5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9A -n5vfiUUE1VQnt+T/EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2O -gSEISZxbzdXGnqIlcT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzne -OA9gTPSr+/fT3WeVnwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yry -k23pQUPAgJENDEqeU6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN -8C1yPqZd5CvvznYvB6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJ -t9IXSzyohEJB6XG5+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ -8UUTmIT2iQf07tRUKJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/g -O7fJEpD2hd2f+pMnOWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZ -NZfDqnFDP6L12w3z3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271h -hQBeRmmoGEKO2JRelGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5uc -TXstZy7vYjL6vTP4l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g -+9V3ORzw4LvO1pwRYJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbST -M5LpC/U6sheLP+l0bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlG -G6pqUN8QxGJYQnonl0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7 -mfoGx6INQjf3HGQpMXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMW -pO+M9bHp4d+puY0L1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zF -bpeqPQUsDv9V7CAJ1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspn -pgCfRbYwxT3iq+9l/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuOmQGi -BEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF110v -ZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6eDAbL -05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRius2ev -221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjCkfar -/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/gnQt -+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUKfZ3g -A/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzpfnWJ -3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAyUYuG -4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0IEtl -eSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNmTgIb -IwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2laohb2Q -4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQAtoB5 -TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnrVW9P -Kj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPHcMOc -31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues73DP -PyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsLHC5w -HMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y0KVa -pBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2wN1ap -uACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dzmQGi -BEY/vAIRBAD2cxLY83P2G1h5TkkKYQYTLopgWQh7/7H5UK0cf62gLH7R6F7BwW4E -qmLsm8eGE8kIOob5wCQU6pxpBMv+1UYoO1bohtx4L2JUY5ycJiq4u1CNyRuciR3y -gsueMRkelkQ2hpNuKvmficOcoazvU3tZM6ITJjV/tQvYTQRGqwEfwwCgs0OY3q7e -R8NwWekaj23t8TV7hjMEANS6QMgjsp5CdLglX02oeiCG82oEKLDOWoZ2ajD++naz -SIflJE0DaZ0W26QXewh7IRzTomV98fJV6inQNanlk5/TNuAb1elXdaYFuNbnZ0yo -OaTJx/mb88vm63Ur8FTyKdcN+dau8yzuNlJggj5yBcNg+/8ZOAm1ZkDMlg9uAhgD -A/0RSjXu/YNmflePFxIKBCAJFJenz4dQUZeb5cuJv20eCqnKn5CFYFU6YYg3sYaE -tZeultDXweRveGwe28E/vpLUa7p+aZq+XwtjI6U6W5VqvkCKIUsQqwVWRHin1/4D -ABJ5rnU+yPeLXNH6jrMQ+jDG8RieI91/4n+gCX1nbwZQ/rQrWllwcCB0ZXN0Y2Fz -ZSBrZXkgPHp5cHAtZGV2ZWxAb3BlbnN1c2Uub3JnPohgBBMRAgAgBQJGP7wCAhsD -BgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQvWHYm9mIIb7TJQCfTe4MwrmOlWDx -WV3yZ6E4B9xQq0YAoIWvs4oYVzbaQzclStHai5kxuGn8uQINBEY/vAwQCAD4T11K -PE7CzkqgGMaNP+yNQzfUDbd/SaEQ5Wce5q3VvmVBpYORxyWjS8QMc9ge8WxezAsj -yTKsXl+u7e/QmMKspPzPhkVKyB6s5D8FhR1Pdo7bAi4xx+NLOu9DuuU+jqUkyHYl -t8QF2zX98OOcCIuQc2hjk12dvfHKmUiDoUnfuQPxvYrFAWnesgUJMqZo7Td5Ly4I -jfMJQlQ7A186BGU8bPWoV1QqUInVkNGNXLmglel/m+MTV05nT6+1KCBqCRUluHqD -aCiFHOUOFVWvtirmPJZ/67J78NJpF7huzXvkQraatXyHnAyhwiwTZLq2jabMjQgG -hV8QyKd4qniSBL+jAAMGCACfH4FGqrs9pGBURmSjZKlHAUdnGul0M2KuyJhv8ZBk -ApUtPcMhZJco50pFpkqjfH7f3xXMRVDP5FpjaRt67abbezp/Dgs8+691OtAREDWb -AzarNNR3FbB9fUebh1J2i4W7tfBcoKwKFWJCvqX2HGTzVy1k33vnuGCVwC/KiZ/C -6pc4DqUwCWNoZNd8hmFadJgx3CMlxSTllsaIyOXp8dMJ+FFsTmzONzZpFC9DDtpa -UeEChCptjWwy5WkQFPe+FOLUH1BnGScQYwGlE8l+cFkE7hW8tyOwcx4sk1J/tDCe -J1wE8we1LXMdIiD5ugf3Jej1/98o+hQTHjfkwGqCGWJViEkEGBECAAkFAkY/vAwC -GwwACgkQvWHYm9mIIb5O9wCfeI0Ro1UCK/CVT1/BH9NNB0TyYzAAmwdQFE6IaVSt -jbDRYEnTHQOGsVy9mQGiBER0ULcRBADZvvVUsUUSjMyQ2fUt8Uu4eGJuPbMhEtR/ -vF7pzF/8u9Br7kh6WASBZ02dMeNoqFzPTU7zv6PiP93iOLwy2MQNOSBLkS+MscR6 -fzS6ZL81mNr+DwgOF/rLZ4tucAsBY9Z3lgRx0mWhl+XunVPXHhkR9H9Rig4wOrrz -wBsYjjfXvwCguQ1PQ6+UQgL8STVqNaNnlVYzzUUD/336IftwogH/tKp6dV/FYP/V -pLHXtwFee0vcCh5FwcKP0vYo9NIfB6CR2g0pyYsHBWbheMWXRVTlCaUVOhaycd+D -XoyKl3FcxL61OD0F/feg2UEqH7n1csGV2MDGlqXsF5urKdPYcBRG56ynlWXs3W7D -zu9JN8skhWSnXdtBFa3BBACo+CAXSzLJnFrG7kg8AYT+0k+kTS/UydwAr57QSLUc -/blXR6seNd+TM4Kwj4Ij2pNL/LpZyzVrDS9BWNZHq3bQnERPrfXpK5XWX0quZn8z -g1ImFwxmJduHKmtyyxNjjPR1SUFzD1EXpPfCYgRL6kU4OflbgGoL2YpmgHO6LQ/O -GrQyb3BlblNVU0UgQnVpbGQgU2VydmljZSA8YnVpbGRzZXJ2aWNlQG9wZW5zdXNl -Lm9yZz6IZAQTEQIAJAUCRHRQtwIbAwUJA8JnAAYLCQgHAwIDFQIDAxYCAQIeAQIX -gAAKCRA7MBG3a51lI/ewAJkB4psDm44RckrzyMyjXEKBYXYKXQCcCLBW95t7ooAI -yqfsg94RICpbr50= -=NAat ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/PublicKey/susekey.asc b/libzypp/tests/zypp/data/PublicKey/susekey.asc deleted file mode 100644 index b49e52d..0000000 --- a/libzypp/tests/zypp/data/PublicKey/susekey.asc +++ /dev/null @@ -1,37 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.2 (GNU/Linux) - -mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff -4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d -M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO -QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK -XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE -D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd -G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM -CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE -myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr -YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD -BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q -W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe -UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev -k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/ -EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl -cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV -nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe -U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv -B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5 -+D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU -KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn -OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z -3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe -lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4 -l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR -YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0 -bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon -l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp -MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L -1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ -1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l -/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO -=pJli ------END PGP PUBLIC KEY BLOCK----- diff --git a/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-1/services/service b/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-1/services/service deleted file mode 100755 index a5bb647..0000000 --- a/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-1/services/service +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -echo " -[repo1] -name=Repository1 -baseurl=http://somehost.com/repo1 -type=rpmmd - -[repo12] -name=Repository2 -baseurl=http://somehost.com/repo2 -type=rpmmd -" - diff --git a/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-2/services/service b/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-2/services/service deleted file mode 100755 index 97db399..0000000 --- a/libzypp/tests/zypp/data/RepoManager/plugin-service-lib-2/services/service +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -echo " -[repo3] -name=Repository3 -baseurl=http://somehost.com/repo3 -type=rpmmd -" - diff --git a/libzypp/tests/zypp/data/RepoManager/proprietary.repo b/libzypp/tests/zypp/data/RepoManager/proprietary.repo deleted file mode 100644 index 0392ffe..0000000 --- a/libzypp/tests/zypp/data/RepoManager/proprietary.repo +++ /dev/null @@ -1,14 +0,0 @@ -[macromedia] -name=Macromedia for i386 Linux -baseurl=http://macromedia.rediris.es/rpm/ -enabled=1 -gpgcheck=1 -gpgkey=http://macromedia.mplug.org/FEDORA-GPG-KEY - -[office] -name=Microsoft Office for Linux -baseurl=http://www.microsoft.com/linux/office -enabled=1 -gpgcheck=1 -gpgkey=http://www.microsoft.com/~sballmer/gpgkey.txt - diff --git a/libzypp/tests/zypp/data/RepoManager/repo/repoindex.xml b/libzypp/tests/zypp/data/RepoManager/repo/repoindex.xml deleted file mode 100644 index 06632c8..0000000 --- a/libzypp/tests/zypp/data/RepoManager/repo/repoindex.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo b/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo deleted file mode 100644 index 7571d48..0000000 --- a/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo +++ /dev/null @@ -1,7 +0,0 @@ -[filesharing] -name=Filesharing applications (SUSE_Factory) -type=rpm-md -baseurl=http://software.opensuse.org/download/filesharing/SUSE_Factory/ -gpgcheck=1 -gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc -enabled=1 diff --git a/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo b/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo deleted file mode 100644 index 3a79b29..0000000 --- a/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo +++ /dev/null @@ -1,7 +0,0 @@ -[home:dmacvicar] -name=Duncan Mac-Vicar SUSE rpms (openSUSE_Factory) -type=rpm-md -baseurl=http://software.opensuse.org/download/home:/dmacvicar/openSUSE_Factory/ -gpgcheck=1 -gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc -enabled=1 diff --git a/libzypp/tests/zypp/data/RepoManager/repos.d/proprietary.repo b/libzypp/tests/zypp/data/RepoManager/repos.d/proprietary.repo deleted file mode 100644 index e78c242..0000000 --- a/libzypp/tests/zypp/data/RepoManager/repos.d/proprietary.repo +++ /dev/null @@ -1,5 +0,0 @@ - -[adobe] -name=acrobat reader -baseurl=http://www.adobe.com/reader/linux - diff --git a/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo b/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo deleted file mode 100644 index 435ea1a..0000000 --- a/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo +++ /dev/null @@ -1,7 +0,0 @@ -[ruby] -name=Ruby is an Interpreted Object-Oriented Scripting Language (openSUSE_Factory) -type=rpm-md -baseurl=http://software.opensuse.org/download/ruby/openSUSE_Factory/ -gpgcheck=1 -gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc -enabled=1 diff --git a/libzypp/tests/zypp/data/RepoManager/second/repo/repoindex.xml b/libzypp/tests/zypp/data/RepoManager/second/repo/repoindex.xml deleted file mode 100644 index 3e87256..0000000 --- a/libzypp/tests/zypp/data/RepoManager/second/repo/repoindex.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/libzypp/tests/zypp/data/Target/product.prod b/libzypp/tests/zypp/data/Target/product.prod deleted file mode 100644 index 2e66b62..0000000 --- a/libzypp/tests/zypp/data/Target/product.prod +++ /dev/null @@ -1,36 +0,0 @@ - - - Novell - SUSE_SLES - 10 - 0 - i586 - sles - - sle-10-i586 - - special_edition - - A43242OOO - A cool distribution - Einfach genial - This is the coolest distribution on the world. - Try it out and find it useful. - Was soll man da sagen? - Einfach toll! - - da - de - - - http://www.suse.com/relnotes/i386/SLE/SERVER/11/release-notes-sles.rpm - http://foo - - - - af - - - - - diff --git a/libzypp/tests/zypp/data/Vendor/vendors.d/ati b/libzypp/tests/zypp/data/Vendor/vendors.d/ati deleted file mode 100644 index 57f8a7b..0000000 --- a/libzypp/tests/zypp/data/Vendor/vendors.d/ati +++ /dev/null @@ -1,3 +0,0 @@ -[main] - -vendors = ati,ati_new,ati_old \ No newline at end of file diff --git a/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia b/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia deleted file mode 100644 index 772ef16..0000000 --- a/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia +++ /dev/null @@ -1,3 +0,0 @@ -[main] - -vendors = nvidia,suse,old_suse \ No newline at end of file diff --git a/libzypp/tests/zypp/data/Vendor/zypp1.conf b/libzypp/tests/zypp/data/Vendor/zypp1.conf deleted file mode 100644 index 5c017e0..0000000 --- a/libzypp/tests/zypp/data/Vendor/zypp1.conf +++ /dev/null @@ -1,126 +0,0 @@ -## Configuration file for software management -## /etc/zypp/zypp.conf -## -## Boolean values are 0 1 yes no on off true false - - -[main] - - -## -## Override the detected architecture -## -## Valid values: i586, i686, x86_64, ppc, ppc64, ia64, s390, s390x, .. -## Default value: Autodetected -## -## ** CAUTION: Only set if you know what you're doing ! -## ** Changing this needs a full refresh (incl. download) -## ** of all repository data. -## -# arch = s390 - - -## -## Path where the repo metadata is downloaded and kept. -## -## Valid values: A directory -## Default value: /var/cache/zypp/raw -## -## Changing this needs a full refresh (incl. download) of all repository data -## -# metadatadir = /var/cache/zypp/raw - - -## -## Path where the known repositories .repo files are kept -## -## Valid values: A directory -## Default value: /etc/zypp/repos.d -## -## Changing this invalidates all known repositories -## -# reposdir = /etc/zypp/repos.d - - -## -## Path where the processed cache is kept (this is where zypp.db is located) -## -## Valid values: A directory -## Default value: /var/cache/zypp -## -## Changing this needs a full refresh (except download) of all repository data -## -# cachedir = /var/cache/zypp - - -## -## Whether repository urls should be probed when added -## -## Valid values: boolean -## Default value: false -## -## If true, accessability of repositories is checked immediately (when added) -## (e.g. 'zypper ar' will check immediately) -## If false, accessability of repositories is checked when refreshed -## (e.g. 'zypper ar' will delay the check until the next refresh) -## -# repo.add.probe = false - - -## -## Amount of time in minutes that must pass before another refresh. -## -## Valid values: Integer -## Default value: 10 -## -## If you have autorefresh enabled for a repository, it is checked for -## up-to-date metadata not more often than every -## minutes. If an automatic request for refresh comes before -## minutes passed since the last check, the request is ignored. -## -## A value of 0 means the repository will always be checked. To get the oposite -## effect, disable autorefresh for your repositories. -## -## This option has no effect for repositories with autorefresh disabled, nor for -## user-requested refresh. -## -# repo.refresh.delay = 10 - - -## -## Whether to consider using a .patch.rpm when downloading a package -## -## Valid values: boolean -## Default value: true -## -## Using a patch rpm will decrease the download size for package updates -## since it does not contain all files of the package but only the changed -## ones. The .patch.rpm is ready to be installed immediately after download. -## There is no further processing needed, as it is for a .delta.rpm. -## -# download.use_patchrpm = true - - -## -## Whether to consider using a .delta.rpm when downloading a package -## -## Valid values: boolean -## Default value: true -## -## Using a delta rpm will decrease the download size for package updates -## since it does not contain all files of the package but only the binary -## diff of changed ones. Recreating the rpm package on the local machine -## is an expensive operation (memory,CPU). If your network connection is -## not too slow, you benefit from disabling .delta.rpm. -## -# download.use_deltarpm = true - - -## -## Defining directory for equivalent vendors -## -## Valid values: A directory -## Default value: /etc/zypp/vondors.d -## -vendordir = data/Vendor/notExist - diff --git a/libzypp/tests/zypp/data/Vendor/zypp2.conf.cmake b/libzypp/tests/zypp/data/Vendor/zypp2.conf.cmake deleted file mode 100644 index 564a841..0000000 --- a/libzypp/tests/zypp/data/Vendor/zypp2.conf.cmake +++ /dev/null @@ -1,127 +0,0 @@ -## Configuration file for software management -## /etc/zypp/zypp.conf -## -## Boolean values are 0 1 yes no on off true false - - -[main] - - -## -## Override the detected architecture -## -## Valid values: i586, i686, x86_64, ppc, ppc64, ia64, s390, s390x, .. -## Default value: Autodetected -## -## ** CAUTION: Only set if you know what you're doing ! -## ** Changing this needs a full refresh (incl. download) -## ** of all repository data. -## -# arch = s390 - - -## -## Path where the repo metadata is downloaded and kept. -## -## Valid values: A directory -## Default value: /var/cache/zypp/raw -## -## Changing this needs a full refresh (incl. download) of all repository data -## -# metadatadir = /var/cache/zypp/raw - - -## -## Path where the known repositories .repo files are kept -## -## Valid values: A directory -## Default value: /etc/zypp/repos.d -## -## Changing this invalidates all known repositories -## -# reposdir = /etc/zypp/repos.d - - -## -## Path where the processed cache is kept (this is where zypp.db is located) -## -## Valid values: A directory -## Default value: /var/cache/zypp -## -## Changing this needs a full refresh (except download) of all repository data -## -# cachedir = /var/cache/zypp - - -## -## Whether repository urls should be probed when added -## -## Valid values: boolean -## Default value: false -## -## If true, accessability of repositories is checked immediately (when added) -## (e.g. 'zypper ar' will check immediately) -## If false, accessability of repositories is checked when refreshed -## (e.g. 'zypper ar' will delay the check until the next refresh) -## -# repo.add.probe = false - - -## -## Amount of time in minutes that must pass before another refresh. -## -## Valid values: Integer -## Default value: 10 -## -## If you have autorefresh enabled for a repository, it is checked for -## up-to-date metadata not more often than every -## minutes. If an automatic request for refresh comes before -## minutes passed since the last check, the request is ignored. -## -## A value of 0 means the repository will always be checked. To get the oposite -## effect, disable autorefresh for your repositories. -## -## This option has no effect for repositories with autorefresh disabled, nor for -## user-requested refresh. -## -# repo.refresh.delay = 10 - - -## -## Whether to consider using a .patch.rpm when downloading a package -## -## Valid values: boolean -## Default value: true -## -## Using a patch rpm will decrease the download size for package updates -## since it does not contain all files of the package but only the changed -## ones. The .patch.rpm is ready to be installed immediately after download. -## There is no further processing needed, as it is for a .delta.rpm. -## -# download.use_patchrpm = true - - -## -## Whether to consider using a .delta.rpm when downloading a package -## -## Valid values: boolean -## Default value: true -## -## Using a delta rpm will decrease the download size for package updates -## since it does not contain all files of the package but only the binary -## diff of changed ones. Recreating the rpm package on the local machine -## is an expensive operation (memory,CPU). If your network connection is -## not too slow, you benefit from disabling .delta.rpm. -## -# download.use_deltarpm = true - - -## -## Defining directory for equivalent vendors -## -## Valid values: A directory -## Default value: /etc/zypp/vondors.d -## -#vendordir = ./../../tests/zypp/data/Vendor/vendors.d -vendordir = @VENDOR_D@ - diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file1 b/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file1 deleted file mode 100644 index 55efc3e..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file1 +++ /dev/null @@ -1 +0,0 @@ -this is a file from dir diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file2 b/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file2 deleted file mode 100644 index 2ea4f1e..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/file2 +++ /dev/null @@ -1 +0,0 @@ -Occifer! I'm not as think as you stoned I am! diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file b/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file deleted file mode 100644 index edb5a3b..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/dir/subdir/file +++ /dev/null @@ -1 +0,0 @@ -this is a file from subdir diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/test.txt b/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/test.txt deleted file mode 100644 index cf9a2f2..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/test.txt +++ /dev/null @@ -1 +0,0 @@ -this is cd1 \ No newline at end of file diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/x.media1 b/libzypp/tests/zypp/data/mediasetaccess/src1/cd1/x.media1 deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/test.txt b/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/test.txt deleted file mode 100644 index 5687ff9..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/test.txt +++ /dev/null @@ -1 +0,0 @@ -this is cd2 \ No newline at end of file diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/x.mediabad b/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/x.mediabad deleted file mode 100644 index deec169..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd2/x.mediabad +++ /dev/null @@ -1 +0,0 @@ -.media2 would identify the cd2 correctly \ No newline at end of file diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd3/test.txt b/libzypp/tests/zypp/data/mediasetaccess/src1/cd3/test.txt deleted file mode 100644 index 6e7f9b2..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src1/cd3/test.txt +++ /dev/null @@ -1 +0,0 @@ -this is cd3 \ No newline at end of file diff --git a/libzypp/tests/zypp/data/mediasetaccess/src1/cd3/x.media3 b/libzypp/tests/zypp/data/mediasetaccess/src1/cd3/x.media3 deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tests/zypp/data/mediasetaccess/src2/test.txt b/libzypp/tests/zypp/data/mediasetaccess/src2/test.txt deleted file mode 100644 index bd99b59..0000000 --- a/libzypp/tests/zypp/data/mediasetaccess/src2/test.txt +++ /dev/null @@ -1 +0,0 @@ -this is a single media \ No newline at end of file diff --git a/libzypp/tests/zypp/data/mediasetaccess/src2/x.media b/libzypp/tests/zypp/data/mediasetaccess/src2/x.media deleted file mode 100644 index e69de29..0000000 diff --git a/libzypp/tools/CMakeLists.txt b/libzypp/tools/CMakeLists.txt deleted file mode 100644 index 2528a05..0000000 --- a/libzypp/tools/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -INSTALL( FILES notify-message DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/zypp" ) - -## ############################################################ - -FILE( GLOB ALLCC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" ) -STRING( REPLACE ".cc" ";" APLLPROG ${ALLCC} ) -FOREACH( loop_var ${APLLPROG} ) - ADD_EXECUTABLE( ${loop_var} - ${loop_var}.cc - ) - TARGET_LINK_LIBRARIES( ${loop_var} - zypp - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ) -ENDFOREACH( loop_var ) - -## ############################################################ - -INSTALL(TARGETS zypp-CheckAccessDeleted DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") -INSTALL(TARGETS zypp-NameReqPrv DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/libzypp/tools/DumpSelectable.cc b/libzypp/tools/DumpSelectable.cc deleted file mode 100644 index 070201e..0000000 --- a/libzypp/tools/DumpSelectable.cc +++ /dev/null @@ -1,170 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -#include -#include -#include - -static std::string appname( "DumpSelectable" ); - -#define message cout -using std::flush; - -int errexit( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - return exit_r; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - cerr << "Usage: " << appname << " [--root ROOTDIR] [OPTIONS] NAME..." << endl; - cerr << " Load all enabled repositories (no refresh) and search for" << endl; - cerr << " Selectables names NAME" << endl; - cerr << " --root Load repos from the system located below ROOTDIR. If ROOTDIR" << endl; - cerr << " denotes a sover testcase, the testcase is loaded." << endl; - cerr << " -v Verbose list solvables data." << endl; - cerr << "" << endl; - return exit_r; -} - -void dumpPi( std::ostream & message, const PoolItem & pi ) -{ - std::string indent(" "); - message << indent << "--------------------------------------------------" << endl; - message << indent << (pi->isSystem() ? "i " : "a ") << pi->satSolvable().asString() << endl; - message << indent << pi->summary() << endl; - if ( pi->isKind() ) - { - message << indent << pi->asKind()->changelog() << endl; - } -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc,++argv; - - Pathname sysRoot("/"); - bool verbose = false; - - while ( argc && (*argv)[0] == '-' ) - { - if ( (*argv) == std::string("--root") ) - { - --argc,++argv; - if ( ! argc ) - return errexit("--root requires an argument."); - - if ( ! PathInfo( *argv ).isDir() ) - return errexit("--root requires a directory."); - - sysRoot = *argv; - } - else if ( (*argv) == std::string("-v") ) - { - verbose = true; - } - - --argc,++argv; - } - - if ( ! argc ) - { - return usage(); - } - - /////////////////////////////////////////////////////////////////// - - ZConfig::instance(); - sat::Pool satpool( sat::Pool::instance() ); - - if ( TestSetup::isTestcase( sysRoot ) ) - { - message << str::form( "*** Load Testcase from '%s'", sysRoot.c_str() ) << endl; - TestSetup test; - test.loadTestcaseRepos( sysRoot ); - } - else if ( TestSetup::isTestSetup( sysRoot ) ) - { - message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl; - TestSetup test( sysRoot, Arch_x86_64 ); - test.loadRepos(); - } - else - { - // a system - message << str::form( "*** Load system at '%s'", sysRoot.c_str() ) << endl; - if ( true ) - { - message << "*** load target '" << Repository::systemRepoAlias() << "'\t" << endl; - getZYpp()->initializeTarget( sysRoot ); - getZYpp()->target()->load(); - message << satpool.systemRepo() << endl; - } - - if ( true ) - { - RepoManager repoManager( sysRoot ); - RepoInfoList repos = repoManager.knownRepositories(); - for_( it, repos.begin(), repos.end() ) - { - RepoInfo & nrepo( *it ); - - if ( ! nrepo.enabled() ) - continue; - - if ( ! repoManager.isCached( nrepo ) ) - { - message << str::form( "*** omit uncached repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - - message << str::form( "*** load repo '%s'\t", nrepo.name().c_str() ) << flush; - try - { - repoManager.loadFromCache( nrepo ); - message << satpool.reposFind( nrepo.alias() ) << endl; - } - catch ( const Exception & exp ) - { - message << exp.asString() + "\n" + exp.historyAsString() << endl; - message << str::form( "*** omit broken repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - } - } - } - - /////////////////////////////////////////////////////////////////// - - for ( ; argc; --argc,++argv ) - { - ui::Selectable::Ptr sel( ui::Selectable::get( IdString( *argv ) ) ); - message << dump( sel ) << endl; - if ( verbose ) - { - for_( it, sel->installedBegin(), sel->installedEnd() ) - dumpPi( message, *it ); - for_( it, sel->availableBegin(), sel->availableEnd() ) - dumpPi( message, *it ); - } - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} diff --git a/libzypp/tools/ProvideSignedDirectory.cc b/libzypp/tools/ProvideSignedDirectory.cc deleted file mode 100644 index 119220d..0000000 --- a/libzypp/tools/ProvideSignedDirectory.cc +++ /dev/null @@ -1,55 +0,0 @@ -#include - -#include -#include -#include - -#include -#include -#include -#include - - -using std::endl; - -int main ( int argc, const char * argv[] ) -try { - --argc; - ++argv; - //zypp::base::LogControl::instance().logToStdErr(); - INT << "===[START]==========================================" << endl; - /////////////////////////////////////////////////////////////////// - - zypp::Url oRemoteUrl( argv[0] ); //"http://download.opensuse.org/distribution/openSUSE-current/repo/oss" ); - std::string oRemoteDir( argv[1] ); //"/suse/setup/slide" ); - const bool oRecursive( true ); - zypp::Pathname oLocalDir( "" ); - - zypp::scoped_ptr tmpdir; - if ( oLocalDir.empty() ) - { - tmpdir.reset( new zypp::filesystem::TmpDir ); - oLocalDir = tmpdir->path(); - } - - zypp::Fetcher fetcher; - fetcher.setOptions( zypp::Fetcher::AutoAddIndexes ); - fetcher.enqueueDir( zypp::OnMediaLocation( oRemoteDir ), oRecursive ); - - zypp::KeyRing::setDefaultAccept( zypp::KeyRing::TRUST_KEY_TEMPORARILY ); - zypp::MediaSetAccess media( oRemoteUrl, "/" ); - fetcher.start( oLocalDir, media ); - - zypp::ExternalProgram( "find "+(oLocalDir/oRemoteDir).asString()+" -ls" ) >> std::cout; - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - zypp::base::LogControl::instance().logNothing(); - return 0; -} -catch ( const zypp::Exception & exp ) -{ - INT << exp << endl << exp.historyAsString(); -} -catch (...) -{} diff --git a/libzypp/tools/ToolScanRepos.cc b/libzypp/tools/ToolScanRepos.cc deleted file mode 100644 index 0acfdbd..0000000 --- a/libzypp/tools/ToolScanRepos.cc +++ /dev/null @@ -1,134 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -static std::string appname( "ToolScanRepos" ); - -void message( const std::string & msg_r ) -{ - cerr << "*** " << msg_r << endl; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl; - message( msg_r ); - cerr << endl; - } - cerr << "Usage: " << appname << "[OPTIONS] URL..." << endl; - cerr << " Load repos from URL to test system below /tmp/" << appname << "." << endl; - cerr << " -r ROOT Use /tmp/ROOT as location of test system (default: " << appname << ")." << endl; - cerr << " -a ARCH Use ARCH as test system architecture (default: x86_64)." << endl; - cerr << " -c Clear an existing test system (default)." << endl; - cerr << " -n Do not clear an existing test system but reuse it." << endl; - return exit_r; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc; - ++argv; - - if ( ! argc ) - { - return usage(); - } - - /////////////////////////////////////////////////////////////////// - Pathname mtmp( "/tmp" ); - Pathname mroot( mtmp/appname ); - Arch march( Arch_x86_64 ); - bool oClearRoot = true; - - std::vector urls; - - while ( argc ) - { - if ( argv[0] == std::string("-c") ) - { - oClearRoot = true; - } - else if ( argv[0] == std::string("-n") ) - { - oClearRoot = false; - } - else if ( argv[0] == std::string("-r") || argv[0] == std::string("--root")) - { - --argc; - ++argv; - if ( ! argc ) - return usage( "Missing arg to -r ROOT", 101 ); - - if ( *(argv[0]) ) // empty - mroot = mtmp/argv[0]; - else - mroot = mtmp/appname; - } - else if ( argv[0] == std::string("-a") ) - { - --argc; - ++argv; - if ( ! argc ) - return usage( "Missing arg to -a ARCH", 101 ); - - if ( *(argv[0]) ) // empty - march = Arch( argv[0] ); - else - march = Arch_x86_64; - } - else - { - urls.push_back( argv[0] ); - } - --argc; - ++argv; - } - - if ( urls.empty() ) - { - return usage( "Missing URLs", 102 ); - } - - /////////////////////////////////////////////////////////////////// - - if ( oClearRoot ) - { - message( "Clear test system at " + mroot.asString() ); - filesystem::recursive_rmdir( mroot ); - } - else - { - message( "Use test system at " + mroot.asString() ); - } - filesystem::assert_dir( mroot ); - - message( "Use archiecture " + march.asString() ); - TestSetup test( mroot, march ); - - int ret = 0; - for_( it, urls.begin(), urls.end() ) - { - message( "Setup " + *it ); - try - { - test.loadRepo( *it ); - } - catch ( const Exception & exp ) - { - message( exp.asString() + "\n" + exp.historyAsString() ); - ++ret; - } - } - - INT << "===[END]============================================" << endl << endl; - return ret; -} \ No newline at end of file diff --git a/libzypp/tools/migrate-sources/CMakeLists.txt b/libzypp/tools/migrate-sources/CMakeLists.txt deleted file mode 100644 index d89ebeb..0000000 --- a/libzypp/tools/migrate-sources/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -SET( migrate_SRCS -migrate-sources.cc -) - -ADD_EXECUTABLE( zypp-migrate-sources ${migrate_SRCS} ) -TARGET_LINK_LIBRARIES( zypp-migrate-sources zypp ) -TARGET_LINK_LIBRARIES( zypp-migrate-sources xml2 ) - -INSTALL(TARGETS zypp-migrate-sources RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/zypp ) \ No newline at end of file diff --git a/libzypp/tools/migrate-sources/migrate-sources.cc b/libzypp/tools/migrate-sources/migrate-sources.cc deleted file mode 100644 index 49bdfc9..0000000 --- a/libzypp/tools/migrate-sources/migrate-sources.cc +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/ZYpp.h" -#include "zypp/zypp_detail/ZYppReadOnlyHack.h" -#include "zypp/ZYppFactory.h" -#include "zypp/PathInfo.h" -#include "zypp/RepoManager.h" -#include "zypp/cache/CacheFSCK.h" - -#include "zypp/parser/xmlstore/XMLSourceCacheParser.h" - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zypp-cache" - - -using namespace std; -using namespace zypp; - -struct Options -{ - Options() - : fake(false) - , root("/") - , sources_dir("/var/lib/zypp/db/sources") - {} - - bool fake; - Pathname root; - Pathname sources_dir; -}; - -static void clear_cache( const Options &opt ) -{ - Pathname path = opt.root + "/var/lib/zypp/cache"; - if ( PathInfo(path).isDir() ) - { - cout << "Deleting old cache directory (" << path << ")." << endl; - if ( ! opt.fake ) - { - if ( filesystem::recursive_rmdir(path) != 0 ) - ERR << "Error removing cache directory" << path << endl; - } - } - - path = opt.root + "/var/lib/zypp/db"; - if ( PathInfo(path).isDir() ) - { - cout << "Deleting old db directory (" << path << ")." << endl; - if ( ! opt.fake ) - { - if ( filesystem::recursive_rmdir(path) != 0 ) - ERR << "Error removing db directory" << path << endl; - } - } -} - -static void migrate_sources( const Options &opt ) -{ - if ( getenv("YAST_IS_RUNNING") && (string(getenv("YAST_IS_RUNNING")) == "instsys" )) - { - MIL << "YaST is running in instsys. Not migrating old sources. YaST will do it." << endl; - return; - } - else - { - MIL << "YaST not running in instsys." << endl; - } - - zypp::zypp_readonly_hack::IWantIt(); - ZYpp::Ptr Z = zypp::getZYpp(); - RepoManager manager; - - Pathname source_p = opt.root + opt.sources_dir; - - if ( ! PathInfo(source_p).isExist() ) - { - cout << "No sources to migrate." << endl; - clear_cache( opt ); - return; - } - - RepoInfoList sources; - DBG << "Reading source cache in " << source_p << std::endl; - - list entries; - if ( filesystem::readdir( entries, source_p, false ) != 0 ) - ZYPP_THROW(Exception("failed to read directory")); - - int i=0; - for ( list::const_iterator it = entries.begin(); it != entries.end(); ++it ) - { - - MIL << "Processing " << *it << endl; - - std::ifstream anIstream((*it).c_str()); - zypp::parser::xmlstore::XMLSourceCacheParser iter(anIstream, ""); - for (; ! iter.atEnd(); ++iter) { - RepoInfo data = **iter; - string alias = "migrated_" + str::numstring(i); - try { - data.setAlias(alias); - data.setEnabled(false); - cout << "Migrating repo: " << endl << data << endl; - if ( ! opt.fake ) - { - manager.addRepository(data); - } - cout << "Deleting old source: " << *it << endl; - if ( ! opt.fake ) - { - if ( filesystem::unlink(*it) != 0 ) - ERR << "Error removing source " << *it << endl; - // delete old file - } - cout << "saved as " << alias << endl; - ++i; - } - catch ( const Exception &e ) - { - cout << "Error adding repository: " << e.msg() << endl << data << endl; - } - - } - - } - cout << i << " sources migrated."<< endl; - - // reread entries - if ( filesystem::readdir( entries, source_p, false ) != 0 ) - ZYPP_THROW(Exception("failed to read directory")); - if ( entries.size() == 0 ) - { - cout << "all sources migrated. deleting old source directory"<< endl; - if ( ! opt.fake ) - { - if ( filesystem::recursive_rmdir(source_p) != 0 ) - ERR << "Error removing source directory" << source_p << endl; - - clear_cache( opt ); - } - } - else - { - cout << "Not all sources migrated. leaving old source directory"<< endl; - } -} - -void usage(int argc, char **argv) -{ - cout << argv[0] << ". Migrates old sources to 10.3 repositories." << endl; - cout << "Usage:" << endl; - cout << argv[0] << " [--root root-path] [--fake] [--sp sources-path]" << endl; -} - -//----------------------------------------------------------------------------- - -int -main (int argc, char **argv) -{ - MIL << "-------------------------------------" << endl; - Options opt; - int i; - for ( i=1; i < argc; ++i ) - { - - if ( string(argv[i]) == "--help" ) - { - usage(argc, argv); - return 0; - } - if ( string(argv[i]) == "--fake" ) - opt.fake = true; - if ( string(argv[i]) == "--root" ) - opt.root = argv[++i]; - if ( string(argv[i]) == "--sp" ) - opt.sources_dir = argv[++i]; - } - migrate_sources(opt); - - return 0; -} - diff --git a/libzypp/tools/notify-message b/libzypp/tools/notify-message deleted file mode 100755 index 9bda07a..0000000 --- a/libzypp/tools/notify-message +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/bash -###################################################################### -test "$1" = "--help" && { -cat <&2 - exit 1; -} - -MAILTAG="[zypp-notify-message]" -MAIL_TO="root" -# curently just '-p packageident' -test "$1" = "-p" && { - MAILTAG="$MAILTAG $2" -} - -exec $MAILCMD -s "$MAILTAG" $MAIL_TO diff --git a/libzypp/tools/patch_find_bug.cc b/libzypp/tools/patch_find_bug.cc deleted file mode 100644 index 8609e5e..0000000 --- a/libzypp/tools/patch_find_bug.cc +++ /dev/null @@ -1,113 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -#include "zypp/PoolQuery.h" - -using namespace zypp; -using std::flush; - -static std::string appname( "patch_find_bug" ); - -int errexit( const std::string & msg_r = std::string(), int exit_r = 101 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - return exit_r; -} - - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - cerr << "Usage: " << appname << "[OPTIONS] bugnumber..." << endl; - cerr << " Find patches refering to bugnumber (substring)." << endl; - cerr << " --root SYSROOT: Load system located below directory SYSROOT" << endl; - return exit_r; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc; - ++argv; - - if ( ! argc ) - { - return usage(); - } - - /////////////////////////////////////////////////////////////////// - - ZConfig::instance(); - Pathname sysRoot("/"); - - if ( (*argv) == std::string("--root") ) - { - --argc,++argv; - if ( ! argc ) - return errexit("--root requires an argument."); - - if ( ! PathInfo( *argv ).isDir() ) - return errexit("--root requires a directory."); - - sysRoot = *argv; - --argc,++argv; - } - - TestSetup::LoadSystemAt( sysRoot ); - - for ( ; argc; --argc,++argv ) - { - PoolQuery q; - q.setMatchSubstring(); - q.setCaseSensitive( false ); - q.addAttribute( sat::SolvAttr::updateReferenceId, *argv ); - - if ( q.empty() ) - { - cout << "BUG REFERENCE '" << *argv << "': No match found." << endl; - } - else - { - cout << "BUG REFERENCE '" << *argv << endl; - for_( it , q.begin(), q.end() ) - { - // print the solvable that has a match: - cout << " - " << *it << endl; - - if ( true ) - { - // Print details about each match in that solvable: - for_( d, it.matchesBegin(), it.matchesEnd() ) - { - // directly access specific attribute like "subFind(updateReferenceType)": - cout << " - " << d->inSolvAttr() << "\t\"" << d->asString() << "\" has type \"" - << d->subFind( sat::SolvAttr::updateReferenceType ).asString() << "\"" << endl; - - // list the whole updateReference structure: - for_( s, d->subBegin(), d->subEnd() ) - { - cout << " -" << s.inSolvAttr() << "\t\"" << s.asString() << "\"" << endl; - } - } - } - } - } - } - - /////////////////////////////////////////////////////////////////// - INT << "===[END]============================================" << endl << endl; - return 0; -} diff --git a/libzypp/tools/percent-encode.cc b/libzypp/tools/percent-encode.cc deleted file mode 100644 index e9260f3..0000000 --- a/libzypp/tools/percent-encode.cc +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include - -static std::string doEncode( const std::string & str_r ) -{ return zypp::url::encode( str_r ); } - -static std::string doDecode( const std::string & str_r ) -{ return zypp::url::decode( str_r ); } - -int main( int argc, const char * argv[] ) -{ - bool encode( true ); - - --argc,++argv; - if ( argc ) - { - if ( *argv == std::string( "-d" ) || *argv == std::string( "--decode" ) ) - encode = false; - else if ( *argv == std::string( "-h" ) || *argv == std::string( "--help" ) ) - { - std::cout << "Usage: percent-encode [OPTION]" << std::endl; - std::cout << "Read lines from stdin and write them percent encoded to stdout." << std::endl; - std::cout << "" << std::endl; - std::cout << "Option:" << std::endl; - std::cout << " -d, --decode Decode lines read from stdin instead of encoding them." << std::endl; - std::cout << " -h --help Print this message." << std::endl; - return 0; - } - } - - std::string (*coder)( const std::string & str_r ) = encode ? doEncode: doDecode; - for( zypp::iostr::EachLine in( std::cin ); in; in.next() ) - { - std::cout << coder( *in ) << std::endl; - } - return 0; -} diff --git a/libzypp/tools/zypp-CheckAccessDeleted.cc b/libzypp/tools/zypp-CheckAccessDeleted.cc deleted file mode 100644 index ebdcd1e..0000000 --- a/libzypp/tools/zypp-CheckAccessDeleted.cc +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -/** Collect max string size. */ -struct TableCol -{ - TableCol( size_t size_r = 0 ) - : size( size_r ) - {} - TableCol( const std::string & header_r ) - : header( header_r ), size( header_r.size() ) - {} - void operator()( const std::string & val_r ) - { if ( val_r.size() > size ) size = val_r.size(); } - - std::string header; - size_t size; -}; - -/** Scan to determine column sizes, then print. */ -struct ProcInfoTable -{ - ProcInfoTable() - : pid ( "PID" ) - , ppid ( "PPID" ) - , puid ( "UID" ) - , login ( "LOGIN" ) - , command ( "COMMAND" ) - , service ( "SERVICE" ) - , files ( "FILES" ) - {} - - void scan( const zypp::CheckAccessDeleted::ProcInfo & val_r ) - { - pid( val_r.pid ); - ppid( val_r.ppid ); - puid( val_r.puid ); - login( val_r.login ); - command( val_r.command ); - service( val_r.service() ); - } - - void printHeader() const - { - printRow( pid.header, - ppid.header, - puid.header, - login.header, - command.header, - service.header, - files.header ); - } - - void print( const zypp::CheckAccessDeleted::ProcInfo & val_r ) const - { - printRow( val_r.pid, - val_r.ppid, - val_r.puid, - val_r.login, - val_r.command, - val_r.service(), - zypp::str::join( val_r.files, ", " ) ); - } - - void printRow( const std::string & pid_r, - const std::string & ppid_r, - const std::string & puid_r, - const std::string & login_r, - const std::string & command_r, - const std::string & service_r, - const std::string & files_r ) const - { - printf( "%*s %*s %*s %-*s %-*s %-*s %-s\n", - (int)pid.size, pid_r.c_str(), - (int)ppid.size, ppid_r.c_str(), - (int)puid.size, puid_r.c_str(), - (int)login.size, login_r.c_str(), - (int)command.size, command_r.c_str(), - (int)service.size, (service_r.empty() ? " -" : service_r.c_str()), - files_r.c_str() ); - } - - TableCol pid; - TableCol ppid; - TableCol puid; - TableCol login; - TableCol command; - TableCol service; - TableCol files; -}; - -int main( int argc, char * argv[] ) -{ - if ( argc >= 2 ) - { - std::string progname( zypp::Pathname::basename( argv[0] ) ); - if ( strcmp( argv[1], "--help" ) == 0 ) - { - std::cout << "Usage: " << progname << " [--help]" << std::endl; - std::cout << "List information about all running processe" << std::endl; - std::cout << "which access deleted executables or libraries." << std::endl; - std::cout << " PID " << "process ID" << std::endl; - std::cout << " PPID " << "parent process ID" << std::endl; - std::cout << " UID " << "process user ID" << std::endl; - std::cout << " LOGIN " << "process login name" << std::endl; - std::cout << " COMMAND " << "process command name" << std::endl; - std::cout << " SERVICE " << "/etc/init.d/ script that might be used to restart the command (guessed)" << std::endl; - std::cout << " FILES " << "list of deleted executables or libraries accessed" << std::endl; - return 0; - } - std::cerr << progname << ": unexpected argument '" << argv[1] << "'" << std::endl; - std::cerr << "Try `" << progname << " --help' for more information." << std::endl; - return 1; - } - - zypp::CheckAccessDeleted checker(false); // wait for explicit call to check() - try { - checker.check( /*verbose*/true ); - } - catch( const zypp::Exception & err ) - { - std::cerr << err << std::endl << err.historyAsString(); - return 2; - } - - ProcInfoTable table; - for_( it, checker.begin(), checker.end() ) - table.scan( *it ); - - table.printHeader(); - for_( it, checker.begin(), checker.end() ) - table.print( *it ); - - return 0; -} diff --git a/libzypp/tools/zypp-NameReqPrv.cc b/libzypp/tools/zypp-NameReqPrv.cc deleted file mode 100644 index da23d21..0000000 --- a/libzypp/tools/zypp-NameReqPrv.cc +++ /dev/null @@ -1,308 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -#include -#include -#include - -static std::string appname( "NameReqPrv" ); - -#define message cout -using std::flush; - -int errexit( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - return exit_r; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - cerr << "Usage: " << appname << " [--root ROOTDIR] [OPTIONS] NAME... [[OPTIONS] NAME...]..." << endl; - cerr << " Load all enabled repositories (no refresh) and search for" << endl; - cerr << " occurrences of NAME (regex) in package names or dependencies" << endl; - cerr << " --root Load repos from the system located below ROOTDIR. If ROOTDIR" << endl; - cerr << " denotes a sover testcase, the testcase is loaded." << endl; - cerr << " --installed Process installed packages only." << endl; - cerr << " -i/-I turn on/off case insensitive search (default on)" << endl; - cerr << " -n/-N turn on/off looking for names (default on)" << endl; - cerr << " -p/-P turn on/off looking for provides (default off)" << endl; - cerr << " -r/-R turn on/off looking for requires (default off)" << endl; - cerr << " -c/-C turn on/off looking for conflicts (default off)" << endl; - cerr << " -o/-O turn on/off looking for obsoletes (default off)" << endl; - cerr << " -m/-M turn on/off looking for recommends (default off)" << endl; - cerr << " -s/-S turn on/off looking for supplements (default off)" << endl; - cerr << " -a short for -n -p -r" << endl; - cerr << " -A short for -n -P -R" << endl; - cerr << " -D dump dependencies of " << endl; - cerr << "" << endl; - return exit_r; -} - -void tableOut( const std::string & s1 = std::string(), - const std::string & s2 = std::string(), - const std::string & s3 = std::string(), - const std::string & s4 = std::string(), - const std::string & s5 = std::string() ) -{ - message << " "; -#define TABEL(N) static unsigned w##N = 0; if ( ! s##N.empty() ) w##N = std::max( w##N, unsigned(s##N.size()) ); message << str::form( " %-*s ", w##N, s##N.c_str() ) -#define TABER(N) static unsigned w##N = 0; if ( ! s##N.empty() ) w##N = std::max( w##N, unsigned(s##N.size()) ); message << str::form( " %*s ", w##N, s##N.c_str() ) - TABER( 1 ); TABEL( 2 ); TABEL( 3 ); TABEL( 4 ); TABEL( 5 ); -#undef TABEL - message << endl; -} - - -/////////////////////////////////////////////////////////////////// - -void dDump( const std::string & spec_r ) -{ - message << "DUMP " << spec_r << " {"; - - sat::WhatProvides q( Capability::guessPackageSpec( spec_r ) ); - if ( q.empty() ) - { - message << "}" << endl; - return; - } - - for ( const auto & el : q ) - { - message << endl << "==============================" << endl << dump(el); - if ( isKind(el) ) - { - message << endl << "CONTENT: " << make(el)->contents(); - } - } - message << endl << "}" << endl; -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc,++argv; - - if ( ! argc ) - { - return usage(); - } - - /////////////////////////////////////////////////////////////////// - - ZConfig::instance(); - Pathname sysRoot("/"); - sat::Pool satpool( sat::Pool::instance() ); - - if ( argc && (*argv) == std::string("--root") ) - { - --argc,++argv; - if ( ! argc ) - return errexit("--root requires an argument."); - - if ( ! PathInfo( *argv ).isDir() ) - return errexit("--root requires a directory."); - - sysRoot = *argv; - --argc,++argv; - } - - bool onlyInstalled( false ); - if ( argc && (*argv) == std::string("--installed") ) - { - --argc,++argv; - onlyInstalled = true; - } - - if ( TestSetup::isTestcase( sysRoot ) ) - { - message << str::form( "*** Load Testcase from '%s'", sysRoot.c_str() ) << endl; - TestSetup test; - test.loadTestcaseRepos( sysRoot ); - dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl; - } - else if ( TestSetup::isTestSetup( sysRoot ) ) - { - message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl; - TestSetup test( sysRoot, Arch_x86_64 ); - test.loadRepos(); - dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl; - } - else - { - // a system - message << str::form( "*** Load system at '%s'", sysRoot.c_str() ) << endl; - if ( true ) - { - message << "*** load target '" << Repository::systemRepoAlias() << "'\t" << endl; - getZYpp()->initializeTarget( sysRoot ); - getZYpp()->target()->load(); - message << satpool.systemRepo() << endl; - } - - if ( !onlyInstalled ) - { - RepoManager repoManager( sysRoot ); - RepoInfoList repos = repoManager.knownRepositories(); - for_( it, repos.begin(), repos.end() ) - { - RepoInfo & nrepo( *it ); - - if ( ! nrepo.enabled() ) - continue; - - if ( ! repoManager.isCached( nrepo ) ) - { - message << str::form( "*** omit uncached repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - - message << str::form( "*** load repo '%s'\t", nrepo.name().c_str() ) << flush; - try - { - repoManager.loadFromCache( nrepo ); - message << satpool.reposFind( nrepo.alias() ) << endl; - } - catch ( const Exception & exp ) - { - message << exp.asString() + "\n" + exp.historyAsString() << endl; - message << str::form( "*** omit broken repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - } - } - } - - /////////////////////////////////////////////////////////////////// - - bool ignorecase ( true ); - bool names ( true ); - bool provides ( false ); - bool requires ( false ); - bool conflicts ( false ); - bool obsoletes ( false ); - bool recommends ( false ); - bool supplements ( false ); - - for ( ; argc; --argc,++argv ) - { - if ( (*argv)[0] == '-' ) - { - switch ( (*argv)[1] ) - { - case 'a': names = true, requires = provides = true; break; - case 'A': names = true, requires = provides = false; break; - case 'D': - if ( argc > 1 ) - { - --argc,++argv; - dDump( *argv ); - } - else - return errexit("-D requires an argument."); - break; - case 'i': ignorecase = true; break; - case 'I': ignorecase = false; break; - case 'n': names = true; break; - case 'N': names = false; break; - case 'r': requires = true; break; - case 'R': requires = false; break; - case 'p': provides = true; break; - case 'P': provides = false; break; - case 'c': conflicts = true; break; - case 'C': conflicts = false; break; - case 'o': obsoletes = true; break; - case 'O': obsoletes = false; break; - case 'm': recommends = true; break; - case 'M': recommends = false; break; - case 's': supplements = true; break; - case 'S': supplements = false; break; - } - continue; - } - - PoolQuery q; - if ( onlyInstalled ) - q.setInstalledOnly(); - std::string qstr( *argv ); - - if ( *argv == ResKind::product ) - { - q.addKind( ResKind::product ); - } - else if ( *argv == ResKind::patch ) - { - q.addKind( ResKind::patch ); - } - else if ( *argv == ResKind::pattern ) - { - q.addKind( ResKind::pattern ); - } - else - { - sat::Solvable::SplitIdent ident( qstr ); - if ( ident.kind() != ResKind::package ) - { - q.addKind( ident.kind() ); - q.addString( ident.name().asString() ); - } - else - q.addString( qstr ); - - q.setMatchRegex(); - q.setCaseSensitive( ! ignorecase ); - - if ( names ) - q.addAttribute( sat::SolvAttr::name ); - if ( provides ) - q.addDependency( sat::SolvAttr::provides ); - if ( requires ) - q.addDependency( sat::SolvAttr::requires ); - if ( conflicts ) - q.addDependency( sat::SolvAttr::conflicts ); - if ( obsoletes ) - q.addDependency( sat::SolvAttr::obsoletes ); - if ( recommends ) - q.addDependency( sat::SolvAttr::recommends ); - if ( supplements ) - q.addDependency( sat::SolvAttr::supplements ); - } - - message << *argv << " [" << (ignorecase?'i':'_') << (names?'n':'_') << (requires?'r':'_') << (provides?'p':'_') - << (conflicts?'c':'_') << (obsoletes?'o':'_') << (recommends?'m':'_') << (supplements?'s':'_') << "] {" << endl; - - for_( it, q.begin(), q.end() ) - { - tableOut( str::numstring( it->id() ), it->asString(), - str::form( "(%d)%s", it->repository().info().priority(), it->repository().name().c_str() ), - it->vendor().asString(), - str::numstring( PoolItem(*it)->buildtime() ) ); - if ( ! it.matchesEmpty() ) - { - for_( match, it.matchesBegin(), it.matchesEnd() ) - { - tableOut( "", "", "", match->inSolvAttr().asString().substr( 9, 3 )+": " +match->asString() ); - } - } - } - - message << "}" << endl; - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} diff --git a/libzypp/tools/zypp-cpeid.cc b/libzypp/tools/zypp-cpeid.cc deleted file mode 100644 index f653b2d..0000000 --- a/libzypp/tools/zypp-cpeid.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include - -using std::cout; -using std::endl; -using zypp::CpeId; -using zypp::Pathname; - -int main( int argc, const char * argv[] ) -{ - if ( argc == 1 || argv[1] == std::string( "--help" ) || argv[1] == std::string( "-h" ) ) - { - cout << - "Usage: " << Pathname::basename( argv[0] ) << " [CPEID]...\n" - "Check and print all supplied CPEIDs as FS, URI and WFN.\n" - "Afterwards compare them pairwise. \n" - "\n" - " (wfn:[part=\"a\",vendor=\"openSUSE\",product=\"libzypp\",version=\"14\\.17\\.3\"])\n" - " URI: cpe:/a:openSUSE:libzypp:14.17.3\n" - " FS: cpe:2.3:a:openSUSE:libzypp:14.17.3:*:*:*:*:*:*:*\n" - "\n"; - - return 0; - } - --argc, ++argv; - - - std::vector args; - args.reserve( argc ); - - for ( ; argc; --argc, ++argv ) - { - try { - CpeId cpe( argv[0] ); - cout << '[' << args.size() << "]-----------------------------------------------------------------------------" << endl; - cout << "arg: " << argv[0] << endl; - cout << " (" << cpe.asWfn() << ')' << endl; - cout << "URI: " << cpe.asUri() << endl; - cout << "FS: " << cpe<< endl; - args.push_back( cpe ); - } - catch ( const std::invalid_argument & exp ) - { - cout << "--------------------------------------------------------------------------------" << endl; - cout << "arg: " << argv[0] << endl; - cout << "ERR: " << exp.what() << endl; - } - } - - cout << "--------------------------------------------------------------------------------" << endl; - unsigned lhsidx = 0; - for ( const auto & lhs : args ) - { - unsigned rhsidx = 0; - for ( const auto & rhs : args ) - { - cout << "[" << lhsidx << "] " << lhs << endl; - cout << "[" << rhsidx << "] " << rhs << endl; - cout << " ==> " << compare( lhs, rhs ) << endl; - ++rhsidx; - } - ++lhsidx; - } - return 0; -} diff --git a/libzypp/tools/zypp-list.cc b/libzypp/tools/zypp-list.cc deleted file mode 100644 index 2bfdaa9..0000000 --- a/libzypp/tools/zypp-list.cc +++ /dev/null @@ -1,170 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST - -#include -#include - -static std::string appname( "zypp-list" ); - -#define message cerr -#define OUT cout -using std::flush; - -int errexit( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - return exit_r; -} - -int usage( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - cerr << "Usage: " << appname << " [GLOBALOPTS] COMMAND" << endl; - cerr << "List pool items according to command." << endl; - cerr << endl; - cerr << "GLOBALOPTS:" << endl; - cerr << " --root Load repos from the system located below ROOTDIR. If ROOTDIR" << endl; - cerr << " denotes a sover testcase, the testcase is loaded." << endl; - cerr << " -i, --installed Process installed packages only." << endl; - cerr << endl; - cerr << "COMMANDS:" << endl; - cerr << " locks: List all locked pool items." << endl; - cerr << " ." << endl; - cerr << endl; - return exit_r; -} - -void startup( const Pathname & sysRoot = "/", bool onlyInstalled = false ) -{ - ZConfig::instance(); - sat::Pool satpool( sat::Pool::instance() ); - - if ( TestSetup::isTestcase( sysRoot ) ) - { - message << str::form( "*** Load Testcase from '%s'", sysRoot.c_str() ) << endl; - TestSetup test; - test.loadTestcaseRepos( sysRoot ); - dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl; - } - else if ( TestSetup::isTestSetup( sysRoot ) ) - { - message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl; - TestSetup test( sysRoot, Arch_x86_64 ); - test.loadRepos(); - dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl; - } - else - { - // a system - message << str::form( "*** Load system at '%s'", sysRoot.c_str() ) << endl; - if ( true ) - { - message << "*** load target '" << Repository::systemRepoAlias() << "'\t"; - getZYpp()->initializeTarget( sysRoot ); - getZYpp()->target()->load(); - message << satpool.systemRepo() << endl; - } - - if ( !onlyInstalled ) - { - RepoManager repoManager( sysRoot ); - RepoInfoList repos = repoManager.knownRepositories(); - for_( it, repos.begin(), repos.end() ) - { - RepoInfo & nrepo( *it ); - - if ( ! nrepo.enabled() ) - continue; - - if ( ! repoManager.isCached( nrepo ) ) - { - message << str::form( "*** omit uncached repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - - message << str::form( "*** load repo '%s'\t", nrepo.name().c_str() ) << flush; - try - { - repoManager.loadFromCache( nrepo ); - message << satpool.reposFind( nrepo.alias() ) << endl; - } - catch ( const Exception & exp ) - { - message << exp.asString() + "\n" + exp.historyAsString() << endl; - message << str::form( "*** omit broken repo '%s' (do 'zypper refresh')", nrepo.name().c_str() ) << endl; - continue; - } - } - } - } -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - INT << "===[START]==========================================" << endl; - appname = Pathname::basename( argv[0] ); - --argc,++argv; - - if ( ! argc ) - { - return usage(); - } - - /////////////////////////////////////////////////////////////////// - - Pathname sysRoot( "/" ); - if ( argc && (*argv) == std::string("--root") ) - { - --argc,++argv; - if ( ! argc ) - return errexit("--root requires an argument."); - - if ( ! PathInfo( *argv ).isDir() ) - return errexit("--root requires a directory."); - - sysRoot = *argv; - --argc,++argv; - } - - bool onlyInstalled( false ); - if ( argc && (*argv) == std::string("--installed") ) - { - --argc,++argv; - onlyInstalled = true; - } - - /////////////////////////////////////////////////////////////////// - - if ( ! argc ) - { - return usage(); - } - - startup( sysRoot, onlyInstalled ); - ResPool pool( ResPool::instance() ); - - if ( argc && (*argv) == std::string("locked") ) - { - OUT << "*** Locked:" << endl; - for_( it, pool.begin(), pool.end() ) - { - if ( (*it).status().isLocked() ) - OUT << *it << endl; - } - } - - INT << "===[END]============================================" << endl << endl; - return 0; -} diff --git a/libzypp/tools/zypp-pubkey.cc b/libzypp/tools/zypp-pubkey.cc deleted file mode 100644 index 4d7ef6f..0000000 --- a/libzypp/tools/zypp-pubkey.cc +++ /dev/null @@ -1,127 +0,0 @@ -#define INCLUDE_TESTSETUP_WITHOUT_BOOST -#include "zypp/../tests/lib/TestSetup.h" -#undef INCLUDE_TESTSETUP_WITHOUT_BOOST -#define message cout -using std::flush; - -#include -namespace opt = boost::program_options; - -#include - -static std::string appname( "unknown" ); - -int errexit( const std::string & msg_r = std::string(), int exit_r = 100 ) -{ - if ( ! msg_r.empty() ) - { - cerr << endl << msg_r << endl << endl; - } - return exit_r; -} - -bool byTTL( const PublicKey & lhs, const PublicKey & rhs ) -{ - int cmp = lhs.gpgPubkeyVersion().compare( rhs.gpgPubkeyVersion() ); - if ( cmp ) return cmp < 0; - return lhs.gpgPubkeyRelease() > rhs.gpgPubkeyRelease(); // intentionally reverse cdate -} - -/****************************************************************** -** -** FUNCTION NAME : main -** FUNCTION TYPE : int -*/ -int main( int argc, char * argv[] ) -{ - appname = Pathname::basename( argv[0] ); - /////////////////////////////////////////////////////////////////// - - opt::options_description options( "Options" ); - options.add_options() - ( "key-file", opt::value >(), - "ASCII ascii armored public key file") - ( "root", opt::value()->default_value( "/" ), - "Use the rmp database from system rooted at ARG") - ( "help,?", "Produce this help message") - ; - - opt::positional_options_description positional; - positional.add( "key-file", -1 ); - - opt::variables_map vm; - opt::store( opt::command_line_parser( argc, argv ).options( options ).positional( positional ).run(), vm ); - opt::notify( vm ); - - if ( vm.count( "help" ) ) - { - cerr << "Usage: " << appname << " [OPTIONS] [key-files...]" << endl; - cerr << "If no key files are given, list info about all gpg-pubkeys in the rpm database." << endl; - cerr << "Otherwise print info about each key and wheter it is present in the rpm database. " << endl; - cerr << options << endl; - return 1; - } - /////////////////////////////////////////////////////////////////// - - if ( ! PathInfo( vm["root"].as() ).isDir() ) - return errexit("--root requires a directory"); - - target::rpm::RpmDb rpmdb; - rpmdb.initDatabase( vm["root"].as() ); - std::list rpmpubkeys( rpmdb.pubkeys() ); - rpmpubkeys.sort( byTTL ); - - if ( ! vm.count( "key-file" ) ) - { - std::string last; - for_each_( it, rpmpubkeys ) - { - if ( last == it->gpgPubkeyVersion() ) - cout << *it << endl; - else - { - cout << dump( *it ) << endl; - last = it->gpgPubkeyVersion(); - } - } - return 0; - } - - /////////////////////////////////////////////////////////////////// - - for_each_( it, vm["key-file"].as< std::vector >() ) - { - cout << "=== " << PathInfo(*it) << endl; - PublicKey pubkey( *it ); - cout << dump( pubkey ) << endl; - - std::string pubkeyV( pubkey.gpgPubkeyVersion() ); - std::string pubkeyR( pubkey.gpgPubkeyRelease() ); - unsigned count = 0; - for_each_( rpmpub, rpmpubkeys ) - { - if ( rpmpub->gpgPubkeyVersion() == pubkeyV ) - { - int cmp = rpmpub->gpgPubkeyRelease().compare( pubkeyR ); - if ( cmp < 0 ) - cout << "<<< "; - else if ( cmp > 0 ) - cout << ">>> "; - else - { - ++count; - cout << "*** "; - } - cout << "gpg-pubkey-" << rpmpub->gpgPubkeyVersion() << "-" << rpmpub->gpgPubkeyRelease() << " " << rpmpub->daysToLive() << endl; - } - } - if ( ! count ) - { - cout << "*** Not in rpm database." << endl; - } - cout << endl; - } - - /////////////////////////////////////////////////////////////////// - return 0; -} diff --git a/libzypp/vendor/CMakeLists.txt b/libzypp/vendor/CMakeLists.txt deleted file mode 100644 index a651570..0000000 --- a/libzypp/vendor/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -ADD_SUBDIRECTORY(mongoose) - - - - diff --git a/libzypp/vendor/mongoose/CMakeLists.txt b/libzypp/vendor/mongoose/CMakeLists.txt deleted file mode 100644 index ee7268f..0000000 --- a/libzypp/vendor/mongoose/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -ADD_DEFINITIONS( -DNO_CGI -D_POSIX_SOURCE -D_BSD_SOURCE ) -SET(mongoose_SOURCES - mongoose.c - mongoose.h -) - -ADD_LIBRARY(mongoose ${mongoose_SOURCES}) -TARGET_LINK_LIBRARIES(mongoose dl pthread) - diff --git a/libzypp/vendor/mongoose/mongoose.c b/libzypp/vendor/mongoose/mongoose.c deleted file mode 100644 index b412f97..0000000 --- a/libzypp/vendor/mongoose/mongoose.c +++ /dev/null @@ -1,3839 +0,0 @@ -/* - * Copyright (c) 2004-2009 Sergey Lyubka - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * $Id: mongoose.c 230 2009-02-15 09:59:53Z valenok $ - */ - -#ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */ -#include -#include -#include -#include -#include -#include -#endif /* _WIN32_WCE */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) /* Windows specific */ -#include - -#ifndef _WIN32_WCE -#include -#include -#include -#else /* _WIN32_WCE */ -/* Windows CE-specific definitions */ -#define NO_CGI /* WinCE has no pipes */ -#define NO_GUI /* temporarily until it is fixed */ -/* WinCE has both Unicode and ANSI versions of GetProcAddress */ -#undef GetProcAddress -#define GetProcAddress GetProcAddressA -#endif /* _WIN32_WCE */ - -/* - * Do not allow holes in data structures! - * This is needed so when Mongoose DLL is loaded, other languages that - * describe struct mg_request_info from mongoose.h, agree with C code. - */ -#pragma pack(1) - -#define __func__ __FUNCTION__ -#define ERRNO GetLastError() -#define NO_SOCKLEN_T -#define SSL_LIB "ssleay32.dll" -#define DIRSEP '\\' -#define IS_DIRSEP_CHAR(c) ((c) == '/' || (c) == '\\') -#define O_NONBLOCK 0 -#define EWOULDBLOCK WSAEWOULDBLOCK -#define dlopen(x,y) LoadLibrary(x) -#define dlsym(x,y) GetProcAddress((HINSTANCE) (x), (y)) -#define _POSIX_ - -#if !defined(R_OK) -#define R_OK 04 /* for _access() */ -#endif /* !R_OK MINGW #defines R_OK */ - -#define SHUT_WR 1 -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define popen(x, y) _popen(x, y) -#define pclose(x) _pclose(x) -#define access(x, y) _access(x, y) -#define getcwd(x, y) _getcwd(x, y) - -#ifdef HAVE_STRTOUI64 -#define strtoull(x, y, z) _strtoui64(x, y, z) -#else -#define strtoull(x, y, z) strtoul(x, y, z) -#endif /* HAVE_STRTOUI64 */ - -#define write(x, y, z) _write(x, y, (unsigned) z) -#define read(x, y, z) _read(x, y, (unsigned) z) -#define open(x, y, z) _open(x, y, z) -#define lseek(x, y, z) _lseek(x, y, z) -#define close(x) _close(x) - -#if !defined(fileno) -#define fileno(x) _fileno(x) -#endif /* !fileno MINGW #defines fileno */ - -typedef HANDLE pthread_mutex_t; -typedef HANDLE pthread_cond_t; - -#if !defined(S_ISDIR) -#define S_ISDIR(x) ((x) & _S_IFDIR) -#endif /* S_ISDIR */ - -#if defined(HAVE_STDINT) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned __int64 uint64_t; -#endif /* HAVE_STDINT */ - -/* - * POSIX dirent interface - */ -struct dirent { - char d_name[FILENAME_MAX]; -}; - -typedef struct DIR { - HANDLE handle; - WIN32_FIND_DATAW info; - struct dirent result; -} DIR; - -#else /* UNIX specific */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#define SSL_LIB "libssl.so" -#define DIRSEP '/' -#define IS_DIRSEP_CHAR(c) ((c) == '/') -#define O_BINARY 0 -#define closesocket(a) close(a) -#define mg_mkdir(x, y) mkdir(x, y) -#define mg_open(x, y, z) open(x, y, z) -#define mg_remove(x) remove(x) -#define mg_stat(x, y) stat(x, y) -#define ERRNO errno -#define INVALID_SOCKET (-1) -typedef int SOCKET; - -#endif /* End of Windows and UNIX specific includes */ - -#include "mongoose.h" - -#define MONGOOSE_VERSION "2.4" -#define PASSWORDS_FILE_NAME ".htpasswd" -#define CGI_ENVIRONMENT_SIZE 4096 -#define MAX_CGI_ENVIR_VARS 64 -#define MAX_REQUEST_SIZE 16384 -#define MAX_LISTENING_SOCKETS 10 -#define MAX_CALLBACKS 20 -#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) -#define UNKNOWN_CONTENT_LENGTH ((uint64_t) ~0ULL) - -/* - * Darwin prior to 7.0 and Win32 do not have socklen_t - */ -#ifdef NO_SOCKLEN_T -typedef int socklen_t; -#endif /* NO_SOCKLEN_T */ - -#if !defined(FALSE) -enum {FALSE, TRUE}; -#endif /* !FALSE */ - -typedef int bool_t; -typedef void * (*mg_thread_func_t)(void *); -static void cry(const char *, ...); - -static int tz_offset; -static const char *http_500_error = "Internal Server Error"; -static FILE *error_log; - -/* - * Snatched from OpenSSL includes. I put the prototypes here to be independent - * from the OpenSSL source installation. Having this, mongoose + SSL can be - * built on any system with binary SSL libraries installed. - */ -typedef struct ssl_st SSL; -typedef struct ssl_method_st SSL_METHOD; -typedef struct ssl_ctx_st SSL_CTX; - -#define SSL_ERROR_WANT_READ 2 -#define SSL_ERROR_WANT_WRITE 3 -#define SSL_FILETYPE_PEM 1 - -/* - * Dynamically loaded SSL functionality - */ -struct ssl_func { - const char *name; /* SSL function name */ - void (*ptr)(void); /* Function pointer */ -}; - -#define FUNC(x) ssl_sw[x].ptr - -#define SSL_free(x) (* (void (*)(SSL *)) FUNC(0))(x) -#define SSL_accept(x) (* (int (*)(SSL *)) FUNC(1))(x) -#define SSL_connect(x) (* (int (*)(SSL *)) FUNC(2))(x) -#define SSL_read(x,y,z) (* (int (*)(SSL *, void *, int)) FUNC(3))((x),(y),(z)) -#define SSL_write(x,y,z) \ - (* (int (*)(SSL *, const void *,int)) FUNC(4))((x), (y), (z)) -#define SSL_get_error(x,y)(* (int (*)(SSL *, int)) FUNC(5))((x), (y)) -#define SSL_set_fd(x,y) (* (int (*)(SSL *, SOCKET)) FUNC(6))((x), (y)) -#define SSL_new(x) (* (SSL * (*)(SSL_CTX *)) FUNC(7))(x) -#define SSL_CTX_new(x) (* (SSL_CTX * (*)(SSL_METHOD *)) FUNC(8))(x) -#define SSLv23_server_method() (* (SSL_METHOD * (*)(void)) FUNC(9))() -#define SSL_library_init() (* (int (*)(void)) FUNC(10))() -#define SSL_CTX_use_PrivateKey_file(x,y,z) (* (int (*)(SSL_CTX *, \ - const char *, int)) FUNC(11))((x), (y), (z)) -#define SSL_CTX_use_certificate_file(x,y,z) (* (int (*)(SSL_CTX *, \ - const char *, int)) FUNC(12))((x), (y), (z)) -#define SSL_CTX_set_default_passwd_cb(x,y) \ - (* (void (*)(SSL_CTX *, mg_spcb_t))FUNC(13))((x),(y)) - -static struct ssl_func ssl_sw[] = { - {"SSL_free", NULL}, - {"SSL_accept", NULL}, - {"SSL_connect", NULL}, - {"SSL_read", NULL}, - {"SSL_write", NULL}, - {"SSL_get_error", NULL}, - {"SSL_set_fd", NULL}, - {"SSL_new", NULL}, - {"SSL_CTX_new", NULL}, - {"SSLv23_server_method", NULL}, - {"SSL_library_init", NULL}, - {"SSL_CTX_use_PrivateKey_file", NULL}, - {"SSL_CTX_use_certificate_file",NULL}, - {"SSL_CTX_set_default_passwd_cb",NULL}, - {NULL, NULL} -}; - -struct usa { - socklen_t len; - union { - struct sockaddr sa; - struct sockaddr_in sin; - } u; -}; - -/* - * Numeric indexes for the option values in context, ctx->options - */ -enum mg_option_index { - OPT_ROOT, OPT_INDEX_FILES, OPT_PORTS, OPT_DIR_LIST, OPT_CGI_EXTENSIONS, - OPT_CGI_INTERPRETER, OPT_SSI_EXTENSIONS, OPT_AUTH_DOMAIN, - OPT_AUTH_GPASSWD, OPT_AUTH_PUT, OPT_ACCESS_LOG, OPT_ERROR_LOG, - OPT_SSL_CERTIFICATE, OPT_ALIASES, OPT_ACL, OPT_UID, - OPT_PROTECT, OPT_SERVICE, OPT_HIDE, OPT_ADMIN_URI, OPT_THREADS, - NUM_OPTIONS -}; - -struct socket { - SOCKET sock; /* Listening socket */ - struct usa usa; /* Socket address */ - - unsigned int flags; /* Flags */ -#define FLAG_SSL 1 -#define FLAG_TERMINATE 2 -}; - -/* - * Callback function, and where it is bound to - */ -struct callback { - char *uri_regex; /* URI regex to handle */ - mg_callback_t func; /* user callback */ - bool_t is_auth; /* func is auth checker */ - int status_code; /* error code to handle */ - void *user_data; /* opaque user data */ -}; - -/* - * Socket pool. - * Master thread to enqueue accepted sockets by means of put_socket() function. - * Worker threads grab sockets from the queue using get_socket() function. - */ -struct socket_pool { - struct socket sockets[20]; /* Array of sockets to process */ - - int size; /* Ringbuffer pointers */ - int head; - int tail; - - pthread_mutex_t mutex; - pthread_cond_t put_cond; - pthread_cond_t get_cond; -}; - -/* - * Mongoose context - */ -struct mg_context { - int stop_flag; /* Should we stop event loop */ - SSL_CTX *ssl_ctx; /* SSL context */ - - FILE *access_log; /* Opened access log */ - FILE *error_log; /* Opened error log */ - - struct socket listeners[MAX_LISTENING_SOCKETS]; - int num_listeners; - - struct callback callbacks[MAX_CALLBACKS]; - int num_callbacks; - - char *options[NUM_OPTIONS]; /* Configured opions */ - pthread_mutex_t mutex; /* Option setter/getter guard */ - struct socket_pool socket_pool; /* Socket pool */ - - mg_spcb_t ssl_password_callback; -}; - -struct mg_connection { - struct mg_request_info request_info; - struct mg_context *ctx; /* Mongoose context we belong to*/ - SSL *ssl; /* SSL descriptor */ - SOCKET sock; /* Connected socket */ - struct usa rsa; /* Remote socket address */ - struct usa lsa; /* Local socket address */ - time_t birth_time; /* Time connection was accepted */ - bool_t free_post_data; /* post_data was malloc-ed */ - bool_t keep_alive; /* Keep-Alive flag */ - uint64_t num_bytes_sent; /* Total bytes sent to client */ -}; - -/* - * In Mongoose, list of values are represented as comma separated - * string. For example, list of CGI extensions can be represented as - * ".cgi,.php,.pl", FOR_EACH_WORD_IN_LIST macro allows to - * loop through the individual values in that list. - * - * A "const char *" and "int" variables must be passed to the macro. - * - * In every iteration of the loop, "s" points to the current value, and - * "len" specifies its length. Code inside loop must not change "s" and "len". - */ -#define FOR_EACH_WORD_IN_LIST(s, len) \ - for (; s != NULL && (len = strcspn(s, ",")) != 0; \ - s += len, s+= strspn(s, ",")) - -/* - * Print error message to the opened error log stream. - */ -static void -cry(const char *fmt, ...) -{ - FILE *fp; - va_list ap; - - fp = error_log == NULL ? stderr : error_log; - va_start(ap, fmt); - (void) vfprintf(fp, fmt, ap); - va_end(ap); - - fputc('\n', fp); -} - -const char * -mg_version(void) -{ - return (MONGOOSE_VERSION); -} - -static void -mg_strlcpy(register char *dst, register const char *src, size_t n) -{ - for (; *src != '\0' && n > 1; n--) - *dst++ = *src++; - *dst = '\0'; -} - -static int -lowercase(const char *s) -{ - return (tolower(* (unsigned char *) s)); -} - -static int -mg_strncasecmp(const char *s1, const char *s2, size_t len) -{ - int diff = 0; - - if (len > 0) - do { - diff = lowercase(s1++) - lowercase(s2++); - } while (diff == 0 && s1[-1] != '\0' && --len > 0); - - return (diff); -} - -static int -mg_strcasecmp(const char *s1, const char *s2) -{ - int diff; - - do { - diff = lowercase(s1++) - lowercase(s2++); - } while (diff == 0 && s1[-1] != '\0'); - - return (diff); -} - -static char * -mg_strndup(const char *ptr, size_t len) -{ - char *p; - - if ((p = (char *) malloc(len + 1)) != NULL) - mg_strlcpy(p, ptr, len + 1); - - return (p); - -} - -static char * -mg_strdup(const char *str) -{ - return (mg_strndup(str, strlen(str))); -} - -/* - * Like snprintf(), but never returns negative value, or the value - * that is larger than a supplied buffer. - * Thanks to Adam Zeldis to pointing snprintf()-caused vulnerability - * in his audit report. - */ -static int -mg_vsnprintf(char *buf, size_t buflen, const char *fmt, va_list ap) -{ - int n; - - if (buflen == 0) - return (0); - - n = vsnprintf(buf, buflen, fmt, ap); - - if (n < 0) { - cry("vsnprintf error"); - n = 0; - } else if (n >= (int) buflen) { - cry("truncating vsnprintf buffer"); - n = (int) buflen - 1; - } - buf[n] = '\0'; - - return (n); -} - -static int -mg_snprintf(char *buf, size_t buflen, const char *fmt, ...) -{ - va_list ap; - int n; - - va_start(ap, fmt); - n = mg_vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - - return (n); -} - -/* - * Convert string representing a boolean value to a boolean value - */ -static bool_t -is_true(const char *str) -{ - static const char *trues[] = {"1", "yes", "true", "jawohl", NULL}; - const char **p; - - for (p = trues; *p != NULL; p++) - if (str && !mg_strcasecmp(str, *p)) - return (TRUE); - - return (FALSE); -} - -/* - * Skip the characters until one of the delimiters characters found. - * 0-terminate resulting word. Skip the rest of the delimiters if any. - * Advance pointer to buffer to the next word. Return found 0-terminated word. - */ -static char * -skip(char **buf, const char *delimiters) -{ - char *p, *begin_word, *end_word, *end_delimiters; - - begin_word = *buf; - end_word = begin_word + strcspn(begin_word, delimiters); - end_delimiters = end_word + strspn(end_word, delimiters); - - for (p = end_word; p < end_delimiters; p++) - *p = '\0'; - - *buf = end_delimiters; - - return (begin_word); -} - -/* - * Return HTTP header value, or NULL if not found. - */ -static const char * -get_header(const struct mg_request_info *ri, const char *name) -{ - int i; - - for (i = 0; i < ri->num_headers; i++) - if (!mg_strcasecmp(name, ri->http_headers[i].name)) - return (ri->http_headers[i].value); - - return (NULL); -} - -const char * -mg_get_header(const struct mg_connection *conn, const char *name) -{ - return (get_header(&conn->request_info, name)); -} - -#if !(defined(NO_CGI) && defined(NO_SSI)) -/* - * Verify that given file has certain extension - */ -static bool_t -match_extension(const char *path, const char *ext_list) -{ - size_t len, path_len; - - path_len = strlen(path); - - FOR_EACH_WORD_IN_LIST(ext_list, len) - if (len < path_len && path[path_len - (len + 1)] == '.' && - !mg_strncasecmp(path + path_len - len, ext_list, len)) - return (TRUE); - - return (FALSE); -} -#endif /* !(NO_CGI && NO_SSI) */ - -static bool_t -match_regex(const char *uri, const char *regexp) -{ - if (*regexp == '\0') - return (*uri == '\0'); - - if (*regexp == '*') - do { - if (match_regex(uri, regexp + 1)) - return (TRUE); - } while (*uri++ != '\0'); - - if (*uri != '\0' && *regexp == *uri) - return (match_regex(uri + 1, regexp + 1)); - - return (FALSE); -} - -static const struct callback * -find_callback(const struct mg_context *ctx, bool_t is_auth, - const char *uri, int status_code) -{ - const struct callback *cb; - int i; - - for (i = 0; i < ctx->num_callbacks; i++) { - cb = ctx->callbacks + i; - if ((uri != NULL && cb->uri_regex != NULL && - ((is_auth && cb->is_auth) || (!is_auth && !cb->is_auth)) && - match_regex(uri, cb->uri_regex)) || (uri == NULL && - (cb->status_code == 0 || cb->status_code == status_code))) - return (cb); - } - - return (NULL); -} - -/* - * Send error message back to a client. - */ -static void -send_error(struct mg_connection *conn, int status, const char *reason, - const char *fmt, ...) -{ - const struct callback *cb; - char buf[BUFSIZ]; - va_list ap; - int len; - - conn->request_info.status_code = status; - - /* If error handler is set, call it. Otherwise, send error message */ - if ((cb = find_callback(conn->ctx, FALSE, NULL, status)) != NULL) { - cb->func(conn, &conn->request_info, cb->user_data); - } else { - (void) mg_printf(conn, - "HTTP/1.1 %d %s\r\n" - "Content-Type: text/plain\r\n" - "Connection: close\r\n" - "\r\n", status, reason); - - /* Errors 1xx, 204 and 304 MUST NOT send a body */ - if (status > 199 && status != 204 && status != 304) { - conn->num_bytes_sent = mg_printf(conn, - "Error %d: %s\n", status, reason); - - va_start(ap, fmt); - len = mg_vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - conn->num_bytes_sent += mg_write(conn, buf, len); - } - } -} - -#ifdef _WIN32 -static int -pthread_mutex_init(pthread_mutex_t *mutex, void *unused) -{ - unused = NULL; - *mutex = CreateMutex(NULL, FALSE, NULL); - return (*mutex == NULL ? -1 : 0); -} - -static int -pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - return (CloseHandle(*mutex) == 0 ? -1 : 0); -} - -static int -pthread_mutex_lock(pthread_mutex_t *mutex) -{ - return (WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1); -} - -static int -pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - return (ReleaseMutex(*mutex) == 0 ? -1 : 0); -} - -static int -pthread_cond_init(pthread_cond_t *cv, const void *unused) -{ - unused = NULL; - *cv = CreateEvent(NULL, FALSE, FALSE, NULL); - return (*cv == NULL ? -1 : 0); -} - -static int -pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mutex) -{ - SignalObjectAndWait(*mutex, *cv, INFINITE, FALSE); - WaitForSingleObject(*mutex, INFINITE); - return (0); -} - -static int -pthread_cond_signal(pthread_cond_t *cv) -{ - return (SetEvent(*cv) == 0 ? -1 : 0); -} - -static int -pthread_cond_destroy(pthread_cond_t *cv) -{ - return (CloseHandle(*cv) == 0 ? -1 : 0); -} - -static void -fix_directory_separators(char *path) -{ - for (; *path != '\0'; path++) { - if (*path == '/') - *path = '\\'; - if (*path == '\\') - while (path[1] == '\\' || path[1] == '/') - (void) memmove(path + 1, - path + 2, strlen(path + 2) + 1); - } -} - -static void -to_unicode(const char *path, wchar_t *wbuf, size_t wbuf_len) -{ - char buf[FILENAME_MAX], *p; - - mg_strlcpy(buf, path, sizeof(buf)); - fix_directory_separators(buf); - - /* Point p to the end of the file name */ - p = buf + strlen(buf) - 1; - - /* Trim trailing backslash character */ - while (p > buf && *p == '\\' && p[-1] != ':') - *p-- = '\0'; - - /* - * Protect from CGI code disclosure. - * This is very nasty hole. Windows happily opens files with - * some garbage in the end of file name. So fopen("a.cgi ", "r") - * actually opens "a.cgi", and does not return an error! - */ - if (*p == 0x20 || *p == 0x2e || *p == 0x2b || (*p & ~0x7f)) { - cry("Rejecting suspicious path: [%s]", buf); - buf[0] = '\0'; - } - - MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, (int) wbuf_len); -} - -static int -mg_open(const char *path, int flags, int mode) -{ - wchar_t wbuf[FILENAME_MAX]; - - to_unicode(path, wbuf, ARRAY_SIZE(wbuf)); - - return (_wopen(wbuf, flags, mode)); -} - -static int -mg_stat(const char *path, struct stat *stp) -{ - wchar_t wbuf[FILENAME_MAX]; - - to_unicode(path, wbuf, ARRAY_SIZE(wbuf)); - - return (_wstat(wbuf, (struct _stat *) stp)); -} - -static int -mg_remove(const char *path) -{ - wchar_t wbuf[FILENAME_MAX]; - - to_unicode(path, wbuf, ARRAY_SIZE(wbuf)); - - return (_wremove(wbuf)); -} - -static DIR * -opendir(const char *name) -{ - DIR *dir = NULL; - char path[FILENAME_MAX]; - wchar_t wpath[FILENAME_MAX]; - - if (name == NULL || name[0] == '\0') { - errno = EINVAL; - } else if ((dir = (DIR *) malloc(sizeof(*dir))) == NULL) { - errno = ENOMEM; - } else { - mg_snprintf(path, sizeof(path), "%s/*", name); - to_unicode(path, wpath, ARRAY_SIZE(wpath)); - dir->handle = FindFirstFileW(wpath, &dir->info); - - if (dir->handle != INVALID_HANDLE_VALUE) { - dir->result.d_name[0] = '\0'; - } else { - free(dir); - dir = NULL; - } - } - - return (dir); -} - -static int -closedir(DIR *dir) -{ - int result = -1; - - if (dir != NULL) { - if (dir->handle != INVALID_HANDLE_VALUE) - result = FindClose(dir->handle) ? 0 : -1; - - free(dir); - } - - if (result == -1) - errno = EBADF; - - return (result); -} - -struct dirent * -readdir(DIR *dir) -{ - struct dirent *result = 0; - - if (dir && dir->handle != INVALID_HANDLE_VALUE) { - if(!dir->result.d_name || - FindNextFileW(dir->handle, &dir->info)) { - result = &dir->result; - - WideCharToMultiByte(CP_UTF8, 0, dir->info.cFileName, - -1, result->d_name, - sizeof(result->d_name), NULL, NULL); - } - } else { - errno = EBADF; - } - - return (result); -} - -#define set_close_on_exec(fd) /* No FD_CLOEXEC on Windows */ - -static int -start_thread(void * (*func)(void *), void *param) -{ - return (_beginthread((void (__cdecl *)( void *))func, 0, param) == 0); -} - -static bool_t -spawn_process(struct mg_connection *conn, const char *prog, char *envblk, - char *envp[], int fd_stdin, int fd_stdout, const char *dir) -{ - HANDLE me; - char *p, *interp, cmdline[FILENAME_MAX], line[FILENAME_MAX]; - FILE *fp; - bool_t retval; - STARTUPINFOA si; - PROCESS_INFORMATION pi; - - envp = NULL; /* Unused */ - - (void) memset(&si, 0, sizeof(si)); - (void) memset(&pi, 0, sizeof(pi)); - - /* XXX redirect CGI errors to the error log file */ - si.cb = sizeof(si); - si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; - - me = GetCurrentProcess(); - DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdin), me, - &si.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); - DuplicateHandle(me, (HANDLE) _get_osfhandle(fd_stdout), me, - &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); - - /* If CGI file is a script, try to read the interpreter line */ - interp = conn->ctx->options[OPT_CGI_INTERPRETER]; - if (interp == NULL) { - line[2] = '\0'; - (void) mg_snprintf(cmdline, sizeof(cmdline), "%s%c%s", - dir, DIRSEP, prog); - if ((fp = fopen(cmdline, "r")) != NULL) { - (void) fgets(line, sizeof(line), fp); - if (memcmp(line, "#!", 2) != 0) - line[2] = '\0'; - /* Trim whitespaces from interpreter name */ - for (p = &line[strlen(line) - 1]; p > line && - isspace(*p); p--) - *p = '\0'; - (void) fclose(fp); - } - interp = line + 2; - (void) mg_snprintf(cmdline, sizeof(cmdline), "%s%s%s", - line + 2, line[2] == '\0' ? "" : " ", prog); - } - - if ((p = (char *) strrchr(prog, '/')) != NULL) - prog = p + 1; - - (void) mg_snprintf(cmdline, sizeof(cmdline), "%s %s", interp, prog); - (void) mg_snprintf(line, sizeof(line), "%s", dir); - fix_directory_separators(line); - fix_directory_separators(cmdline); - - if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, - CREATE_NEW_PROCESS_GROUP, envblk, line, &si, &pi) == 0) { - cry("%s: CreateProcess(%s): %d", __func__, cmdline, ERRNO); - retval = FALSE; - } else { - close(fd_stdin); - close(fd_stdout); - retval = TRUE; - } - - CloseHandle(si.hStdOutput); - CloseHandle(si.hStdInput); - CloseHandle(pi.hThread); - CloseHandle(pi.hProcess); - - return (retval); -} - -static int -pipe(int *fds) -{ - return (_pipe(fds, BUFSIZ, _O_BINARY)); -} - -static int -mg_mkdir(const char *path, int mode) -{ - char buf[FILENAME_MAX]; - wchar_t wbuf[FILENAME_MAX]; - - mode = 0; /* Unused */ - mg_strlcpy(buf, path, sizeof(buf)); - fix_directory_separators(buf); - - MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, sizeof(wbuf)); - - return (_wmkdir(wbuf)); -} - -#else - -static void -set_close_on_exec(int fd) -{ - (void) fcntl(fd, F_SETFD, FD_CLOEXEC); -} - -static int -start_thread(void * (*func)(void *), void *param) -{ - pthread_t thread_id; - pthread_attr_t attr; - int retval; - - (void) pthread_attr_init(&attr); - (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - if ((retval = pthread_create(&thread_id, &attr, func, param)) != 0) - cry("%s: %s", __func__, strerror(retval)); - - return (retval); -} - -#ifndef NO_CGI -static bool_t -spawn_process(struct mg_connection *conn, const char *prog, char *envblk, - char *envp[], int fd_stdin, int fd_stdout, const char *dir) -{ - int ret; - pid_t pid; - const char *interp; - - envblk = NULL; /* unused */ - ret = FALSE; - - if ((pid = fork()) == -1) { - /* Parent */ - ret = -1; - send_error(conn, 500, http_500_error, - "fork(): %s", strerror(ERRNO)); - } else if (pid == 0) { - /* Child */ - if (chdir(dir) != 0) { - cry("chdir(%s): %s", dir, strerror(ERRNO)); - } else if (dup2(fd_stdin, 0) == -1) { - cry("dup2(stdin, %d): %s", fd_stdin, strerror(ERRNO)); - } else if (dup2(fd_stdout, 1) == -1) { - cry("dup2(stdout, %d): %s", fd_stdout, strerror(ERRNO)); - } else { - /* If error file is specified, send errors there */ - if (error_log != NULL) - (void) dup2(fileno(error_log), 2); - - (void) close(fd_stdin); - (void) close(fd_stdout); - - /* Execute CGI program */ - interp = conn->ctx->options[OPT_CGI_INTERPRETER]; - if (interp == NULL) { - (void) execle(prog, prog, NULL, envp); - cry("execle(%s): %s", prog, strerror(ERRNO)); - } else { - (void) execle(interp, interp, prog, NULL, envp); - cry("execle(%s %s): %s", - interp, prog, strerror(ERRNO)); - } - } - exit(EXIT_FAILURE); - } else { - /* Parent. Suspended until child does execle() */ - (void) close(fd_stdin); - (void) close(fd_stdout); - ret = TRUE; - } - - return (ret); -} -#endif /* !NO_CGI */ -#endif /* _WIN32 */ - -static void -mg_lock(struct mg_context *ctx) -{ - if (pthread_mutex_lock(&ctx->mutex) != 0) - cry("pthread_mutex_lock: %s", strerror(ERRNO)); -} - -static void -mg_unlock(struct mg_context *ctx) -{ - if (pthread_mutex_unlock(&ctx->mutex) != 0) - cry("pthread_mutex_unlock: %s", strerror(ERRNO)); -} - -static int -get_pool_space(const struct socket_pool *pool) -{ - return (pool->size - (pool->head - pool->tail)); -} - -static void -init_socket_pool(struct socket_pool *pool) -{ - pool->size = (int) ARRAY_SIZE(pool->sockets); - pool->head = pool->tail = 0; - - pthread_mutex_init(&pool->mutex, NULL); - pthread_cond_init(&pool->put_cond, NULL); - pthread_cond_init(&pool->get_cond, NULL); -} - -static void -destroy_socket_pool(struct socket_pool *pool) -{ - int i; - - pthread_mutex_lock(&pool->mutex); - for (i = 0; i < get_pool_space(pool); i++) - (void) closesocket(pool->sockets[i].sock); - pthread_mutex_unlock(&pool->mutex); - - /* - * TODO: all threads in a thread pool are blocked on pool->mutex. - * Before destroying the mutex, send a termination signal to all - * of these threads, and let them exit. Only after that destroy - * the mutex. - */ - - pthread_mutex_destroy(&pool->mutex); - pthread_cond_destroy(&pool->put_cond); - pthread_cond_destroy(&pool->get_cond); -} - -/* - * Put socket into the pool - */ -static void -put_socket(struct socket_pool *pool, const struct socket *sp) -{ - (void) pthread_mutex_lock(&pool->mutex); - - while (get_pool_space(pool) == 0) - pthread_cond_wait(&pool->put_cond, &pool->mutex); - - pool->sockets[pool->head++ % pool->size] = *sp; - - pthread_cond_signal(&pool->get_cond); - pthread_mutex_unlock(&pool->mutex); -} - -/* - * Get index of the socket to process - */ -static void -get_socket(struct socket_pool *pool, struct socket *sp) -{ - pthread_mutex_lock(&pool->mutex); - - while (get_pool_space(pool) == pool->size) - pthread_cond_wait(&pool->get_cond, &pool->mutex); - - *sp = pool->sockets[pool->tail++]; - - /* Wrap pointers */ - if (pool->tail == pool->size) { - pool->head -= pool->size; - pool->tail = 0; - } - - pthread_cond_signal(&pool->put_cond); - pthread_mutex_unlock(&pool->mutex); -} - - -/* - * Write data to the IO channel - opened file descriptor, socket or SSL - * descriptor. Return number of bytes written. - */ -static uint64_t -push(int fd, SOCKET sock, SSL *ssl, const char *buf, uint64_t len) -{ - uint64_t sent; - int n, k; - - sent = 0; - while (sent < len) { - - /* How many bytes we send in this iteration */ - k = len - sent > INT_MAX ? INT_MAX : (int) (len - sent); - - if (ssl != NULL) { - n = SSL_write(ssl, buf + sent, k); - } else if (fd != -1) { - n = write(fd, buf + sent, k); - } else { - n = send(sock, buf + sent, k, 0); - } - - if (n < 0) - break; - - sent += n; - } - - return (sent); -} - -/* - * Read from IO channel - opened file descriptor, socket, or SSL descriptor. - * Return number of bytes read. - */ -static int -pull(int fd, SOCKET sock, SSL *ssl, char *buf, int len) -{ - int nread; - - if (ssl != NULL) { - nread = SSL_read(ssl, buf, len); - } else if (fd != -1) { - nread = read(fd, buf, (size_t) len); - } else { - nread = recv(sock, buf, (size_t) len, 0); - } - - return (nread); -} - -int -mg_write(struct mg_connection *conn, const void *buf, int len) -{ - assert(len >= 0); - return ((int) push(-1, conn->sock, conn->ssl, - (const char *) buf, (uint64_t) len)); -} - -int -mg_printf(struct mg_connection *conn, const char *fmt, ...) -{ - char buf[MAX_REQUEST_SIZE]; - int len; - va_list ap; - - va_start(ap, fmt); - len = mg_vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - - return (mg_write(conn, buf, len)); -} - -/* - * Return content length of the request, or UNKNOWN_CONTENT_LENGTH constant if - * Content-Length header is not set. - */ -static uint64_t -get_content_length(const struct mg_connection *conn) -{ - const char *cl = mg_get_header(conn, "Content-Length"); - return (cl == NULL ? UNKNOWN_CONTENT_LENGTH : strtoull(cl, NULL, 10)); -} - -/* - * URL-decode input buffer into destination buffer. - * 0-terminate the destination buffer. Return the length of decoded data. - * form-url-encoded data differs from URI encoding in a way that it - * uses '+' as character for space, see RFC 1866 section 8.2.1 - * http://ftp.ics.uci.edu/pub/ietf/html/rfc1866.txt - */ -static size_t -url_decode(const char *src, size_t src_len, char *dst, size_t dst_len, - bool_t is_form_url_encoded) -{ - size_t i, j; - int a, b; -#define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W') - - for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) { - if (src[i] == '%' && - isxdigit(* (unsigned char *) (src + i + 1)) && - isxdigit(* (unsigned char *) (src + i + 2))) { - a = tolower(* (unsigned char *) (src + i + 1)); - b = tolower(* (unsigned char *) (src + i + 2)); - dst[j] = ((HEXTOI(a) << 4) | HEXTOI(b)) & 0xff; - i += 2; - } else if (is_form_url_encoded && src[i] == '+') { - dst[j] = ' '; - } else { - dst[j] = src[i]; - } - } - - dst[j] = '\0'; /* Null-terminate the destination */ - - return (j); -} - -/* - * Search for a form variable in a given buffer. - * Semantic is the same as for mg_get_var(). - */ -static char * -get_var(const char *name, const char *buf, size_t buf_len) -{ - const char *p, *e, *s; - char *val; - size_t var_len, len; - - var_len = strlen(name); - e = buf + buf_len; - val = NULL; - - /* buf is "var1=val1&var2=val2...". Find variable first */ - for (p = buf; p + var_len < e; p++) - if ((p == buf || p[-1] == '&') && p[var_len] == '=' && - !mg_strncasecmp(name, p, var_len)) { - - /* Point p to variable value */ - p += var_len + 1; - - /* Point s to the end of the value */ - s = (const char *) memchr(p, '&', e - p); - if (s == NULL) - s = e; - - /* Try to allocate the buffer */ - len = s - p + 1; - if ((val = malloc(len)) != NULL) - (void) url_decode(p, len, val, len, TRUE); - break; - } - - return (val); -} - -/* - * Return form data variable. - * It can be specified in query string, or in the POST data. - * Return NULL if the variable not found, or allocated 0-terminated value. - * It is caller's responsibility to free the returned value. - */ -char * -mg_get_var(const struct mg_connection *conn, const char *name) -{ - const struct mg_request_info *ri = &conn->request_info; - char *v1, *v2; - - v1 = v2 = NULL; - - /* Look in both query_string and POST data */ - if (ri->query_string != NULL) - v1 = get_var(name, ri->query_string, strlen(ri->query_string)); - if (ri->post_data_len > 0) - v2 = get_var(name, ri->post_data, ri->post_data_len); - - /* If they both have queried variable, POST data wins */ - if (v1 != NULL && v2 != NULL) - free(v1); - - return (v2 == NULL ? v1 : v2); -} - -/* - * Transform URI to the file name. - */ -static void -make_path(struct mg_context *ctx, const char *uri, char *buf, size_t buf_len) -{ - char *p, *s; - size_t len; - - mg_snprintf(buf, buf_len, "%s%s", ctx->options[OPT_ROOT], uri); - - /* If requested URI has aliased prefix, use alternate root */ - mg_lock(ctx); - s = ctx->options[OPT_ALIASES]; - FOR_EACH_WORD_IN_LIST(s, len) { - - p = (char *) memchr(s, '=', len); - if (p == NULL || p >= s + len || p == s) - continue; - - if (memcmp(uri, s, p - s) == 0) { - (void) mg_snprintf(buf, buf_len, "%.*s%s", - (s + len) - p - 1, p + 1, uri + (p - s)); - break; - } - } - mg_unlock(ctx); - - /* Remove trailing '/' characters, if directory is requested */ - for (p = buf + strlen(buf) - 1; p > buf && *p == '/'; p--) - *p = '\0'; - -#ifdef _WIN32 - for (p = buf; *p != '\0'; p++) - if (*p == '/') - *p = '\\'; -#endif /* _WIN32 */ -} - -/* - * Setup listening socket on given port, return socket - */ -static SOCKET -mg_open_listening_port(int port) -{ - SOCKET sock; - int on = 1; - struct usa sa; - - sa.len = sizeof(sa.u.sin); - sa.u.sin.sin_family = AF_INET; - sa.u.sin.sin_port = htons((uint16_t) port); - sa.u.sin.sin_addr.s_addr = htonl(INADDR_ANY); - - if ((sock = socket(PF_INET, SOCK_STREAM, 6)) != INVALID_SOCKET && - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *) &on, sizeof(on)) == 0 && - bind(sock, &sa.u.sa, sa.len) == 0 && - listen(sock, 128) == 0) { - /* Success */ - set_close_on_exec(sock); - } else { - /* Error */ - cry("open_listening_port(%d): %s", port, strerror(errno)); - if (sock != INVALID_SOCKET) - (void) closesocket(sock); - sock = INVALID_SOCKET; - } - - return (sock); -} - -/* - * Check whether full request is buffered Return headers length, or 0 - */ -static int -get_request_len(const char *buf, size_t buflen) -{ - const char *s, *e; - int len = 0; - - for (s = buf, e = s + buflen - 1; len <= 0 && s < e; s++) - /* Control characters are not allowed but >=128 is. */ - if (!isprint(* (unsigned char *) s) && *s != '\r' && - *s != '\n' && * (unsigned char *) s < 128) - len = -1; - else if (s[0] == '\n' && s[1] == '\n') - len = (int) (s - buf) + 2; - else if (s[0] == '\n' && &s[1] < e && - s[1] == '\r' && s[2] == '\n') - len = (int) (s - buf) + 3; - - return (len); -} - -/* - * Convert month to the month number. Return -1 on error, or month number - */ -static int -montoi(const char *s) -{ - static const char *month_names[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - size_t i; - - for (i = 0; i < sizeof(month_names) / sizeof(month_names[0]); i++) - if (!strcmp(s, month_names[i])) - return ((int) i); - - return (-1); -} - -/* - * Parse date-time string, and return the corresponding time_t value - */ -static time_t -date_to_epoch(const char *s) -{ - struct tm tm, *tmp; - time_t current_time; - char mon[32]; - int sec, min, hour, mday, month, year; - - (void) memset(&tm, 0, sizeof(tm)); - sec = min = hour = mday = month = year = 0; - - if (((sscanf(s, "%d/%3s/%d %d:%d:%d", - &mday, mon, &year, &hour, &min, &sec) == 6) || - (sscanf(s, "%d %3s %d %d:%d:%d", - &mday, mon, &year, &hour, &min, &sec) == 6) || - (sscanf(s, "%*3s, %d %3s %d %d:%d:%d", - &mday, mon, &year, &hour, &min, &sec) == 6) || - (sscanf(s, "%d-%3s-%d %d:%d:%d", - &mday, mon, &year, &hour, &min, &sec) == 6)) && - (month = montoi(mon)) != -1) { - tm.tm_mday = mday; - tm.tm_mon = month; - tm.tm_year = year; - tm.tm_hour = hour; - tm.tm_min = min; - tm.tm_sec = sec; - } - - if (tm.tm_year > 1900) - tm.tm_year -= 1900; - else if (tm.tm_year < 70) - tm.tm_year += 100; - - /* Set Daylight Saving Time field */ - current_time = time(NULL); - tmp = localtime(¤t_time); - tm.tm_isdst = tmp->tm_isdst; - - return (mktime(&tm)); -} - -static void -remove_double_dots(char *s) -{ - char *p = s; - - while (*s != '\0') { - *p++ = *s++; - if (s[-1] == '/' || s[-1] == '\\') - while (*s == '.' || *s == '/' || *s == '\\') - s++; - } - *p = '\0'; -} - -static const struct { - const char *extension; - const char *mime_type; -} mime_types[] = { - {"html", "text/html" }, - {"htm", "text/html" }, - {"shtm", "text/html" }, - {"shtml", "text/html" }, - {"css", "text/css" }, - {"js", "application/x-javascript" }, - {"ico", "image/x-icon" }, - {"gif", "image/gif" }, - {"jpg", "image/jpeg" }, - {"jpeg", "image/jpeg" }, - {"png", "image/png" }, - {"svg", "image/svg+xml" }, - {"torrent", "application/x-bittorrent" }, - {"wav", "audio/x-wav" }, - {"mp3", "audio/x-mp3" }, - {"mid", "audio/mid" }, - {"m3u", "audio/x-mpegurl" }, - {"ram", "audio/x-pn-realaudio" }, - {"ra", "audio/x-pn-realaudio" }, - {"doc", "application/msword", }, - {"exe", "application/octet-stream" }, - {"zip", "application/x-zip-compressed" }, - {"xls", "application/excel" }, - {"tgz", "application/x-tar-gz" }, - {"tar", "application/x-tar" }, - {"gz", "application/x-gunzip" }, - {"arj", "application/x-arj-compressed" }, - {"rar", "application/x-arj-compressed" }, - {"rtf", "application/rtf" }, - {"pdf", "application/pdf" }, - {"swf", "application/x-shockwave-flash" }, - {"mpg", "video/mpeg" }, - {"mpeg", "video/mpeg" }, - {"asf", "video/x-ms-asf" }, - {"avi", "video/x-msvideo" }, - {"bmp", "image/bmp" }, - {NULL, NULL } -}; - -static const char * -get_mime_type(const char *path) -{ - size_t i; - const char *ext; - - if ((ext = strrchr(path, '.')) != NULL) { - ext++; - for (i = 0; mime_types[i].extension != NULL; i++) - if (!mg_strcasecmp(ext, mime_types[i].extension)) - return (mime_types[i].mime_type); - } - - return ("text/plain"); -} - -#if !defined(NO_AUTH) -#ifndef HAVE_MD5 -typedef struct MD5Context { - uint32_t buf[4]; - uint32_t bits[2]; - unsigned char in[64]; -} MD5_CTX; - -#if __BYTE_ORDER == 1234 -#define byteReverse(buf, len) /* Nothing */ -#else -/* - * Note: this code is harmless on little-endian machines. - */ -static void -byteReverse(unsigned char *buf, unsigned longs) -{ - uint32_t t; - do { - t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | - ((unsigned) buf[1] << 8 | buf[0]); - *(uint32_t *) buf = t; - buf += 4; - } while (--longs); -} -#endif /* __BYTE_ORDER */ - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f, w, x, y, z, data, s) \ -( w += f(x, y, z) + data, w = w<>(32-s), w += x ) - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -static void -MD5Init(MD5_CTX *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bits[0] = 0; - ctx->bits[1] = 0; -} - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks - * the data and converts bytes into longwords for this routine. - */ -static void -MD5Transform(uint32_t buf[4], uint32_t const in[16]) -{ - register uint32_t a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -static void -MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len) -{ - uint32_t t; - - /* Update bitcount */ - - t = ctx->bits[0]; - if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - - /* Handle any leading odd-sized chunks */ - - if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; - - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ - - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - - memcpy(ctx->in, buf, len); -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -static void -MD5Final(unsigned char digest[16], MD5_CTX *ctx) -{ - unsigned count; - unsigned char *p; - - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; - - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); - } - byteReverse(ctx->in, 14); - - /* Append length in bits and transform */ - ((uint32_t *) ctx->in)[14] = ctx->bits[0]; - ((uint32_t *) ctx->in)[15] = ctx->bits[1]; - - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - byteReverse((unsigned char *) ctx->buf, 4); - memcpy(digest, ctx->buf, 16); - memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */ -} -#endif /* !HAVE_MD5 */ - -/* - * Stringify binary data. Output buffer must be twice as big as input, - * because each byte takes 2 bytes in string representation - */ -static void -bin2str(char *to, const unsigned char *p, size_t len) -{ - static const char *hex = "0123456789abcdef"; - - for (; len--; p++) { - *to++ = hex[p[0] >> 4]; - *to++ = hex[p[0] & 0x0f]; - } - *to = '\0'; -} - -/* - * Return stringified MD5 hash for list of vectors. - * buf must point to 33-bytes long buffer - */ -void -mg_md5(char *buf, ...) -{ - unsigned char hash[16]; - const char *p; - va_list ap; - MD5_CTX ctx; - - MD5Init(&ctx); - - va_start(ap, buf); - while ((p = va_arg(ap, const char *)) != NULL) - MD5Update(&ctx, (unsigned char *) p, (int) strlen(p)); - va_end(ap); - - MD5Final(hash, &ctx); - bin2str(buf, hash, sizeof(hash)); -} - -/* - * Check the user's password, return 1 if OK - */ -static bool_t -check_password(const char *method, const char *ha1, const char *uri, - const char *nonce, const char *nc, const char *cnonce, - const char *qop, const char *response) -{ - char ha2[32 + 1], expected_response[32 + 1]; - - /* XXX Due to a bug in MSIE, we do not compare the URI */ - /* Also, we do not check for authentication timeout */ - if (/*strcmp(dig->uri, c->ouri) != 0 || */ - strlen(response) != 32 /*|| - now - strtoul(dig->nonce, NULL, 10) > 3600 */) - return (FALSE); - - mg_md5(ha2, method, ":", uri, NULL); - mg_md5(expected_response, ha1, ":", nonce, ":", nc, - ":", cnonce, ":", qop, ":", ha2, NULL); - - return (!mg_strcasecmp(response, expected_response)); -} - -/* - * Use the global passwords file, if specified by auth_gpass option, - * or search for .htpasswd in the requested directory. - */ -static FILE * -open_auth_file(struct mg_context *ctx, const char *path) -{ - char name[FILENAME_MAX]; - const char *p, *e; - struct stat st; - FILE *fp; - - if (ctx->options[OPT_AUTH_GPASSWD] != NULL) { - /* Use global passwords file */ - if ((fp = fopen(ctx->options[OPT_AUTH_GPASSWD], "r")) == NULL) - cry("fopen(%s): %s", - ctx->options[OPT_AUTH_GPASSWD], strerror(ERRNO)); - } else if (!mg_stat(path, &st) && S_ISDIR(st.st_mode)) { - (void) mg_snprintf(name, sizeof(name), "%s%c%s", - path, DIRSEP, PASSWORDS_FILE_NAME); - fp = fopen(name, "r"); - } else { - /* - * Try to find .htpasswd in requested directory. - * Given the path, create the path to .htpasswd file - * in the same directory. Find the right-most - * directory separator character first. That would be the - * directory name. If directory separator character is not - * found, 'e' will point to 'p'. - */ - for (p = path, e = p + strlen(p) - 1; e > p; e--) - if (IS_DIRSEP_CHAR(*e)) - break; - - /* - * Make up the path by concatenating directory name and - * .htpasswd file name. - */ - (void) mg_snprintf(name, sizeof(name), "%.*s%c%s", - (int) (e - p), p, DIRSEP, PASSWORDS_FILE_NAME); - fp = fopen(name, "r"); - } - - return (fp); -} - -struct ah { - char *user, *uri, *cnonce, *response, *qop, *nc, *nonce; -}; - -static bool_t -parse_auth_header(struct mg_connection *conn, char *buf, size_t buf_size, - struct ah *ah) -{ - char *name, *value, *s; - const char *auth_header; - - if ((auth_header = mg_get_header(conn, "Authorization")) == NULL || - mg_strncasecmp(auth_header, "Digest ", 7) != 0) - return (FALSE); - - /* Make modifiable copy of the auth header */ - (void) mg_strlcpy(buf, auth_header + 7, buf_size); - - s = buf; - (void) memset(ah, 0, sizeof(*ah)); - - /* Gobble initial spaces */ - while (isspace(* (unsigned char *) s)) - s++; - - /* Parse authorization header */ - for (;;) { - name = skip(&s, "="); - value = skip(&s, ", "); - - if (*value == '"') { - value++; - value[strlen(value) - 1] = '\0'; - } else if (*value == '\0') { - break; - } - - if (!strcmp(name, "username")) { - ah->user = value; - } else if (!strcmp(name, "cnonce")) { - ah->cnonce = value; - } else if (!strcmp(name, "response")) { - ah->response = value; - } else if (!strcmp(name, "uri")) { - ah->uri = value; - } else if (!strcmp(name, "qop")) { - ah->qop = value; - } else if (!strcmp(name, "nc")) { - ah->nc = value; - } else if (!strcmp(name, "nonce")) { - ah->nonce = value; - } - } - - /* CGI needs it as REMOTE_USER */ - if (ah->user != NULL) - conn->request_info.remote_user = mg_strdup(ah->user); - - return (TRUE); -} - -/* - * Authorize against the opened passwords file. Return 1 if authorized. - */ -static bool_t -authorize(struct mg_connection *conn, FILE *fp) -{ - struct ah ah; - char line[256], f_user[256], domain[256], ha1[256], - buf[MAX_REQUEST_SIZE]; - - if (!parse_auth_header(conn, buf, sizeof(buf), &ah)) - return (FALSE); - - /* Loop over passwords file */ - while (fgets(line, sizeof(line), fp) != NULL) { - - if (sscanf(line, "%[^:]:%[^:]:%s", f_user, domain, ha1) != 3) - continue; - - if (!strcmp(ah.user, f_user) && - !strcmp(domain, conn->ctx->options[OPT_AUTH_DOMAIN])) - return (check_password( - conn->request_info.request_method, ha1, - ah.uri, ah.nonce, ah.nc, ah.cnonce, - ah.qop, ah.response)); - } - - return (FALSE); -} - -/* - * Return TRUE if request is authorised, FALSE otherwise. - */ -static bool_t -check_authorization(struct mg_connection *conn, const char *path) -{ - FILE *fp; - size_t len, n; - char protected_path[FILENAME_MAX]; - const char *p, *s; - const struct callback *cb; - bool_t authorized; - - fp = NULL; - authorized = TRUE; - - mg_lock(conn->ctx); - s = conn->ctx->options[OPT_PROTECT]; - FOR_EACH_WORD_IN_LIST(s, len) { - - p = (const char *) memchr(s, '=', len); - if (p == NULL || p >= s + len || p == s) - continue; - - if (!memcmp(conn->request_info.uri, s, p - s)) { - - n = (size_t) (s + len - p); - if (n > sizeof(protected_path) - 1) - n = sizeof(protected_path) - 1; - - mg_strlcpy(protected_path, p + 1, n); - - if ((fp = fopen(protected_path, "r")) == NULL) - cry("check_auth: cannot open %s: %s", - protected_path, strerror(errno)); - break; - } - } - mg_unlock(conn->ctx); - - if (fp == NULL) - fp = open_auth_file(conn->ctx, path); - - if (fp != NULL) { - authorized = authorize(conn, fp); - (void) fclose(fp); - } - - if ((cb = find_callback(conn->ctx, TRUE, - conn->request_info.uri, -1)) != NULL) { - struct ah ah; - char buf[MAX_REQUEST_SIZE]; - void *user_data = cb->user_data; - - authorized = FALSE; - if (parse_auth_header(conn, buf, sizeof(buf), &ah)) { - cb->func(conn, &conn->request_info, &user_data); - authorized = (bool_t) (long) user_data; - } - } - - return (authorized); -} - -static void -send_authorization_request(struct mg_connection *conn) -{ - (void) mg_printf(conn, - "HTTP/1.1 401 Unauthorized\r\n" - "WWW-Authenticate: Digest qop=\"auth\", " - "realm=\"%s\", nonce=\"%lu\"\r\n\r\n", - conn->ctx->options[OPT_AUTH_DOMAIN], (unsigned long) time(NULL)); -} - -static bool_t -is_authorized_for_put(struct mg_connection *conn) -{ - FILE *fp; - int ret = FALSE; - - if ((fp = fopen(conn->ctx->options[OPT_AUTH_PUT], "r")) != NULL) { - set_close_on_exec(fileno(fp)); - ret = authorize(conn, fp); - (void) fclose(fp); - } - - return (ret); -} -#endif /* NO_AUTH */ - -static bool_t -does_client_want_keep_alive(const struct mg_connection *conn) -{ - const char *value = mg_get_header(conn, "Connection"); - - /* HTTP/1.1 assumes keep-alive, if Connection header is not set */ - return ((value == NULL && conn->request_info.http_version_major == 1 && - conn->request_info.http_version_minor == 1) || (value != NULL && - !mg_strcasecmp(value, "keep-alive"))); -} - -struct de { - struct mg_connection *conn; - char *file_name; - struct stat st; -}; - -static void -print_dir_entry(struct de *de) -{ - char size[64], mod[64]; - - if (S_ISDIR(de->st.st_mode)) { - (void) mg_snprintf(size, sizeof(size), "%s", "[DIRECTORY]"); - } else { - if (de->st.st_size < 1024) - (void) mg_snprintf(size, sizeof(size), - "%lu", (unsigned long) de->st.st_size); - else if (de->st.st_size < 1024 * 1024) - (void) mg_snprintf(size, sizeof(size), - "%.1fk", (double) de->st.st_size / 1024); - else if (de->st.st_size < 1024 * 1024 * 1024) - (void) mg_snprintf(size, sizeof(size), - "%.1fM", (double) de->st.st_size / 1048576); - else - (void) mg_snprintf(size, sizeof(size), - "%.1fG", (double) de->st.st_size / 1073741824); - } - (void) strftime(mod, sizeof(mod), "%d-%b-%Y %H:%M", - localtime(&de->st.st_mtime)); - de->conn->num_bytes_sent += mg_printf(de->conn, - "%s%s" - " %s  %s\n", - de->conn->request_info.uri, de->file_name, de->file_name, - S_ISDIR(de->st.st_mode) ? "/" : "", mod, size); -} - -static int -compare_dir_entries(const void *p1, const void *p2) -{ - const struct de *a = (struct de *) p1, *b = (struct de *) p2; - const char *query_string = a->conn->request_info.query_string; - int cmp_result = 0; - - if (query_string == NULL) - query_string = "na"; - - if (S_ISDIR(a->st.st_mode) && !S_ISDIR(b->st.st_mode)) { - return (-1); /* Always put directories on top */ - } else if (!S_ISDIR(a->st.st_mode) && S_ISDIR(b->st.st_mode)) { - return (1); /* Always put directories on top */ - } else if (*query_string == 'n') { - cmp_result = strcmp(a->file_name, b->file_name); - } else if (*query_string == 's') { - cmp_result = a->st.st_size == b->st.st_size ? 0 : - a->st.st_size > b->st.st_size ? 1 : -1; - } else if (*query_string == 'd') { - cmp_result = a->st.st_mtime == b->st.st_mtime ? 0 : - a->st.st_mtime > b->st.st_mtime ? 1 : -1; - } - - return (query_string[1] == 'd' ? -cmp_result : cmp_result); -} - -static void -send_directory(struct mg_connection *conn, const char *dir) -{ - struct dirent *dp; - DIR *dirp; - struct de *entries = NULL; - char path[FILENAME_MAX], sort_direction; - int i, num_entries = 0, arr_size = 128; - - if ((dirp = opendir(dir)) == NULL) { - send_error(conn, 500, "Cannot open directory", - "Error: opendir(%s): %s", path, strerror(ERRNO)); - return; - } - - (void) mg_printf(conn, "%s", - "HTTP/1.1 200 OK\r\n" - "Connection: close\r\n" - "Content-Type: text/html; charset=utf-8\r\n\r\n"); - - sort_direction = conn->request_info.query_string != NULL && - conn->request_info.query_string[1] == 'd' ? 'a' : 'd'; - - while ((dp = readdir(dirp)) != NULL) { - - /* Do not show current dir and passwords file */ - if (!strcmp(dp->d_name, ".") || - !strcmp(dp->d_name, "..") || - !strcmp(dp->d_name, PASSWORDS_FILE_NAME)) - continue; - - if (entries == NULL || num_entries >= arr_size) { - arr_size *= 2; - entries = (struct de *) realloc(entries, - arr_size * sizeof(entries[0])); - } - - if (entries == NULL) { - send_error(conn, 500, "Cannot open directory", - "%s", "Error: cannot allocate memory"); - return; - } - - (void) mg_snprintf(path, sizeof(path), "%s%c%s", - dir, DIRSEP, dp->d_name); - - (void) stat(path, &entries[num_entries].st); - entries[num_entries].conn = conn; - entries[num_entries].file_name = mg_strdup(dp->d_name); - num_entries++; - } - (void) closedir(dirp); - - conn->num_bytes_sent += mg_printf(conn, - "Index of %s" - "" - "

Index of %s

"
-	    ""
-	    ""
-	    ""
-	    "",
-	    conn->request_info.uri, conn->request_info.uri,
-	    sort_direction, sort_direction, sort_direction);
-	
-	/* Print first entry - link to a parent directory */
-	conn->num_bytes_sent += mg_printf(conn,
-	    ""
-	    "\n",
-	    conn->request_info.uri, "..", "Parent directory", "-", "-");	
-
-	/* Sort and print directory entries */
-	qsort(entries, num_entries, sizeof(entries[0]), compare_dir_entries);
-	for (i = 0; i < num_entries; i++) {
-		print_dir_entry(&entries[i]);
-		free(entries[i].file_name);
-	}
-	free(entries);
-
-	conn->num_bytes_sent += mg_printf(conn, "%s", "
NameModifiedSize

%s %s  %s
"); - conn->request_info.status_code = 200; -} - -/* - * Send len bytes from the opened file to the client. - */ -static void -send_opened_file_stream(struct mg_connection *conn, int fd, uint64_t len) -{ - char buf[BUFSIZ]; - int n; - - while (len > 0) { - n = sizeof(buf); - if ((uint64_t) n > len) - n = (int) len; - if ((n = read(fd, buf, n)) <= 0) - break; - conn->num_bytes_sent += mg_write(conn, buf, n); - len -= n; - } -} - -static void -send_file(struct mg_connection *conn, const char *path, struct stat *stp) -{ - char date[64], lm[64], etag[64], range[64]; - const char *fmt = "%a, %d %b %Y %H:%M:%S GMT", *msg = "OK"; - const char *mime_type, *s; - time_t curtime = time(NULL); - unsigned long long cl, r1, r2; - int fd, n; - - mime_type = get_mime_type(path); - cl = stp->st_size; - conn->request_info.status_code = 200; - range[0] = '\0'; - - if ((fd = mg_open(path, O_RDONLY | O_BINARY, 0644)) == -1) { - send_error(conn, 500, http_500_error, - "fopen(%s): %s", path, strerror(ERRNO)); - return; - } - set_close_on_exec(fd); - - /* If Range: header specified, act accordingly */ - s = mg_get_header(conn, "Range"); - r1 = r2 = 0; - if (s != NULL && (n = sscanf(s,"bytes=%llu-%llu", &r1, &r2)) > 0) { - conn->request_info.status_code = 206; - (void) lseek(fd, (long) r1, SEEK_SET); - cl = n == 2 ? r2 - r1 + 1: cl - r1; - (void) mg_snprintf(range, sizeof(range), - "Content-Range: bytes %llu-%llu/%llu\r\n", - r1, r1 + cl - 1, cl); - msg = "Partial Content"; - } - - /* Prepare Etag, Date, Last-Modified headers */ - (void) strftime(date, sizeof(date), fmt, localtime(&curtime)); - (void) strftime(lm, sizeof(lm), fmt, localtime(&stp->st_mtime)); - (void) mg_snprintf(etag, sizeof(etag), "%lx.%lx", - (unsigned long) stp->st_mtime, (unsigned long) stp->st_size); - - /* Since we send Content-Length, we can keep the connection alive */ - conn->keep_alive = does_client_want_keep_alive(conn); - - (void) mg_printf(conn, - "HTTP/1.1 %d %s\r\n" - "Date: %s\r\n" - "Last-Modified: %s\r\n" - "Etag: \"%s\"\r\n" - "Content-Type: %s\r\n" - "Content-Length: %llu\r\n" - "Connection: %s\r\n" - "Accept-Ranges: bytes\r\n" - "%s\r\n", - conn->request_info.status_code, msg, date, lm, etag, mime_type, cl, - conn->keep_alive ? "keep-alive" : "close", range); - - if (strcmp(conn->request_info.request_method, "HEAD") != 0) - send_opened_file_stream(conn, fd, cl); - (void) close(fd); -} - -static void -parse_http_headers(char **buf, struct mg_request_info *ri) -{ - int i; - - for (i = 0; i < MAX_HTTP_HEADERS; i++) { - ri->http_headers[i].name = skip(buf, ": "); - ri->http_headers[i].value = skip(buf, "\r\n"); - if (ri->http_headers[i].name[0] == '\0') - break; - ri->num_headers = i + 1; - } -} - -static bool_t -is_known_http_method(const char *method) -{ - return (!strcmp(method, "GET") || - !strcmp(method, "POST") || - !strcmp(method, "HEAD") || - !strcmp(method, "PUT") || - !strcmp(method, "DELETE")); -} - -static bool_t -parse_http_request(char *buf, struct mg_request_info *ri, const struct usa *usa) -{ - char *http_version; - int n, success_code = FALSE; - - ri->request_method = skip(&buf, " "); - ri->uri = skip(&buf, " "); - http_version = skip(&buf, "\r\n"); - - if (is_known_http_method(ri->request_method) && - ri->uri[0] == '/' && - sscanf(http_version, "HTTP/%d.%d%n", - &ri->http_version_major, &ri->http_version_minor, &n) == 2 && - http_version[n] == '\0') { - parse_http_headers(&buf, ri); - ri->remote_port = ntohs(usa->u.sin.sin_port); - (void) memcpy(&ri->remote_ip, &usa->u.sin.sin_addr.s_addr, 4); - ri->remote_ip = ntohl(ri->remote_ip); - success_code = TRUE; - } - - return (success_code); -} - -static int -read_request(int fd, SOCKET sock, SSL *ssl, char *buf, int bufsiz, int *nread) -{ - int n, request_len; - - request_len = 0; - while (*nread < bufsiz && request_len == 0) { - n = pull(fd, sock, ssl, buf + *nread, bufsiz - *nread); - if (n <= 0) { - break; - } else { - *nread += n; - request_len = get_request_len(buf, (size_t) *nread); - } - } - - return (request_len); -} - -/* - * For given directory path, substitute it to valid index file. - * Return 0 if index file has been found, -1 if not found - */ -static bool_t -substitute_index_file(struct mg_connection *conn, - char *path, size_t path_len, struct stat *stp) -{ - const char *s; - struct stat st; - size_t len, n; - bool_t found; - - n = strlen(path); - path[n] = DIRSEP; - found = FALSE; - - mg_lock(conn->ctx); - s = conn->ctx->options[OPT_INDEX_FILES]; - FOR_EACH_WORD_IN_LIST(s, len) { - if (len > path_len - n - 1) - continue; - (void) mg_strlcpy(path + n + 1, s, len + 1); - if (stat(path, &st) == 0) { - *stp = st; - found = TRUE; - break; - } - } - mg_unlock(conn->ctx); - - if (found == FALSE) - path[n] = '\0'; - - return (found); -} - -static void -mg_bind(struct mg_context *ctx, const char *uri_regex, int status_code, - mg_callback_t func, bool_t is_auth, void *user_data) -{ - struct callback *cb; - - if (ctx->num_callbacks >= (int) ARRAY_SIZE(ctx->callbacks) - 1) { - cry("Too many callbacks! Increase MAX_CALLBACKS."); - } else { - cb = &ctx->callbacks[ctx->num_callbacks]; - cb->uri_regex = uri_regex ? mg_strdup(uri_regex) : NULL; - cb->func = func; - cb->is_auth = is_auth; - cb->status_code = status_code; - cb->user_data = user_data; - ctx->num_callbacks++; - } -} - -void -mg_bind_to_uri(struct mg_context *ctx, const char *uri_regex, - mg_callback_t func, void *user_data) -{ - assert(func != NULL); - assert(uri_regex != NULL); - mg_bind(ctx, uri_regex, -1, func, FALSE, user_data); -} - -void -mg_bind_to_error_code(struct mg_context *ctx, int error_code, - mg_callback_t func, void *user_data) -{ - assert(error_code >= 0 && error_code < 1000); - assert(func != NULL); - mg_bind(ctx, NULL, error_code, func, FALSE, user_data); -} - -void -mg_protect_uri(struct mg_context *ctx, const char *uri_regex, - mg_callback_t func, void *user_data) -{ - assert(func != NULL); - assert(uri_regex != NULL); - mg_bind(ctx, uri_regex, -1, func, TRUE, user_data); -} - -static int -not_modified(const struct mg_connection *conn, const struct stat *stp) -{ - const char *ims = mg_get_header(conn, "If-Modified-Since"); - return (ims != NULL && stp->st_mtime < date_to_epoch(ims)); -} - -static bool_t -append_chunk(struct mg_request_info *ri, int fd, const char *buf, int len) -{ - bool_t ret_code = TRUE; - - if (fd == -1) { - /* TODO: check for NULL here */ - ri->post_data = (char *) realloc(ri->post_data, - ri->post_data_len + len); - (void) memcpy(ri->post_data + ri->post_data_len, buf, len); - ri->post_data_len += len; - } else if (push(fd, INVALID_SOCKET, - NULL, buf, (uint64_t) len) != (uint64_t) len) { - ret_code = FALSE; - } - - return (ret_code); -} - -static bool_t -handle_request_body(struct mg_connection *conn, int fd) -{ - struct mg_request_info *ri = &conn->request_info; - const char *expect, *tmp; - uint64_t content_len; - char buf[BUFSIZ]; - int to_read, nread, already_read; - bool_t success_code = FALSE; - - content_len = get_content_length(conn); - expect = mg_get_header(conn, "Expect"); - - if (content_len == UNKNOWN_CONTENT_LENGTH) { - send_error(conn, 411, "Length Required", ""); - } else if (expect != NULL && mg_strcasecmp(expect, "100-continue")) { - send_error(conn, 417, "Expectation Failed", ""); - } else { - if (expect != NULL) - (void) mg_printf(conn, "HTTP/1.1 100 Continue\r\n\r\n"); - - already_read = ri->post_data_len; - assert(already_read >= 0); - - if (content_len <= (uint64_t) already_read) { - ri->post_data_len = (int) content_len; - /* - * If fd == -1, this is embedded mode, and we do not - * have to do anything: POST data is already there, - * no need to allocate a buffer and copy it in. - * If fd != -1, we need to write the data. - */ - success_code = (fd == -1) || (push(fd, INVALID_SOCKET, - NULL, ri->post_data, content_len) == content_len) ? - TRUE : FALSE; - } else { - - if (fd == -1) { - conn->free_post_data = TRUE; - tmp = ri->post_data; - /* +1 in case if already_read == 0 */ - ri->post_data = (char*)malloc(already_read + 1); - (void) memcpy(ri->post_data, tmp, already_read); - } else { - (void) push(fd, INVALID_SOCKET, NULL, - ri->post_data, (uint64_t) already_read); - } - - content_len -= already_read; - - while (content_len > 0) { - to_read = sizeof(buf); - if ((uint64_t) to_read > content_len) - to_read = (int) content_len; - nread = pull(-1, conn->sock, - conn->ssl, buf, to_read); - if (nread <= 0) - break; - if (!append_chunk(ri, fd, buf, nread)) - break; - content_len -= nread; - } - success_code = content_len == 0 ? TRUE : FALSE; - } - - /* Each error code path in this function must send an error */ - if (success_code != TRUE) - send_error(conn, 577, http_500_error, - "%s", "Error handling body data"); - } - - return (success_code); -} - -#if !defined(NO_CGI) -struct cgi_env_block { - char buf[CGI_ENVIRONMENT_SIZE]; /* Environment buffer */ - int len; /* Space taken */ - char *vars[MAX_CGI_ENVIR_VARS]; /* char **envp */ - int nvars; /* Number of variables */ -}; - -static char * -addenv(struct cgi_env_block *block, const char *fmt, ...) -{ - int n, space; - char *added; - va_list ap; - - space = sizeof(block->buf) - block->len - 2; - assert(space >= 0); - added = block->buf + block->len; - - va_start(ap, fmt); - n = mg_vsnprintf(added, (size_t) space, fmt, ap); - va_end(ap); - - if (n > 0 && n < space && - block->nvars < (int) ARRAY_SIZE(block->vars) - 2) { - block->vars[block->nvars++] = block->buf + block->len; - block->len += n + 1; /* Include \0 terminator */ - } - - return (added); -} - -static void -prepare_cgi_environment(struct mg_connection *conn, const char *prog, - struct cgi_env_block *blk) -{ - const char *s, *script_filename, *root; - char *p; - int i; - - blk->len = blk->nvars = 0; - - /* SCRIPT_FILENAME */ - script_filename = prog; - if ((s = strrchr(prog, '/')) != NULL) - script_filename = s + 1; - - mg_lock(conn->ctx); - root = conn->ctx->options[OPT_ROOT]; - addenv(blk, "SERVER_NAME=%s", conn->ctx->options[OPT_AUTH_DOMAIN]); - mg_unlock(conn->ctx); - - /* Prepare the environment block */ - addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1"); - addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1"); - addenv(blk, "%s", "REDIRECT_STATUS=200"); /* PHP */ - addenv(blk, "SERVER_PORT=%d", ntohs(conn->lsa.u.sin.sin_port)); - addenv(blk, "SERVER_ROOT=%s", root); - addenv(blk, "DOCUMENT_ROOT=%s", root); - addenv(blk, "REQUEST_METHOD=%s", conn->request_info.request_method); - addenv(blk, "REMOTE_ADDR=%s", inet_ntoa(conn->rsa.u.sin.sin_addr)); - addenv(blk, "REMOTE_PORT=%d", conn->request_info.remote_port); - addenv(blk, "REQUEST_URI=%s", conn->request_info.uri); - addenv(blk, "SCRIPT_NAME=%s", prog + strlen(root)); - addenv(blk, "SCRIPT_FILENAME=%s", script_filename); /* PHP */ - addenv(blk, "PATH_TRANSLATED=%s", prog); - - if ((s = mg_get_header(conn, "Content-Type")) != NULL) - addenv(blk, "CONTENT_TYPE=%s", s); - - if (conn->request_info.query_string != NULL) - addenv(blk, "QUERY_STRING=%s", conn->request_info.query_string); - - if ((s = mg_get_header(conn, "Content-Length")) != NULL) - addenv(blk, "CONTENT_LENGTH=%s", s); - - if ((s = getenv("PATH")) != NULL) - addenv(blk, "PATH=%s", s); - -#if defined(_WIN32) - if ((s = getenv("COMSPEC")) != NULL) - addenv(blk, "COMSPEC=%s", s); - if ((s = getenv("SYSTEMROOT")) != NULL) - addenv(blk, "SYSTEMROOT=%s", s); -#else - if ((s = getenv("LD_LIBRARY_PATH")) != NULL) - addenv(blk, "LD_LIBRARY_PATH=%s", s); -#endif /* _WIN32 */ - - if ((s = getenv("PERLLIB")) != NULL) - addenv(blk, "PERLLIB=%s", s); - - if (conn->request_info.remote_user != NULL) { - addenv(blk, "REMOTE_USER=%s", conn->request_info.remote_user); - addenv(blk, "%s", "AUTH_TYPE=Digest"); - } - - /* Add all headers as HTTP_* variables */ - for (i = 0; i < conn->request_info.num_headers; i++) { - p = addenv(blk, "HTTP_%s=%s", - conn->request_info.http_headers[i].name, - conn->request_info.http_headers[i].value); - - /* Convert variable name into uppercase, and change - to _ */ - for (; *p != '=' && *p != '\0'; p++) { - if (*p == '-') - *p = '_'; - *p = toupper(* (unsigned char *) p) & 0xff; - } - } - - blk->vars[blk->nvars++] = NULL; - blk->buf[blk->len++] = '\0'; - - assert(blk->nvars < (int) ARRAY_SIZE(blk->vars)); - assert(blk->len > 0); - assert(blk->len < (int) sizeof(blk->buf)); -} - -static void -send_cgi(struct mg_connection *conn, const char *prog) -{ - int headers_len, data_len, i, n; - const char *status; - char buf[MAX_REQUEST_SIZE], *pbuf; - struct mg_request_info ri; - struct cgi_env_block blk; - char dir[FILENAME_MAX], *p; - int fd_stdin[2], fd_stdout[2]; - - prepare_cgi_environment(conn, prog, &blk); - - /* CGI must be executed in its own directory */ - (void) mg_snprintf(dir, sizeof(dir), "%s", prog); - if ((p = strrchr(dir, DIRSEP)) != NULL) - *p++ = '\0'; - - fd_stdin[0] = fd_stdin[1] = fd_stdout[0] = fd_stdout[1] = -1; - if (pipe(fd_stdin) != 0 || pipe(fd_stdout) != 0) { - send_error(conn, 500, http_500_error, - "Cannot create CGI pipe: %s", strerror(ERRNO)); - goto done; - } - - if (!spawn_process(conn, p, blk.buf, blk.vars, - fd_stdin[0], fd_stdout[1], dir)) { - goto done; - } - - /* - * spawn_process() must close those! - * If we don't mark them as closed, close() attempt before - * return from this function throws an exception on Windows. - * Windows does not like when closed descriptor is closed again. - */ - fd_stdin[0] = fd_stdout[1] = -1; - - /* Send POST data to the CGI process if needed */ - if (!strcmp(conn->request_info.request_method, "POST") && - !handle_request_body(conn, fd_stdin[1])) { - goto done; - } - - /* - * Now read CGI reply into a buffer. We need to set correct - * status code, thus we need to see all HTTP headers first. - * Do not send anything back to client, until we buffer in all - * HTTP headers. - */ - data_len = 0; - headers_len = read_request(fd_stdout[0], INVALID_SOCKET, NULL, - buf, sizeof(buf), &data_len); - if (headers_len <= 0) { - send_error(conn, 500, http_500_error, - "CGI program sent malformed HTTP headers: [%.*s]", - data_len, buf); - goto done; - } - pbuf = buf; - buf[headers_len - 1] = '\0'; - parse_http_headers(&pbuf, &ri); - - /* Make up and send the status line */ - status = get_header(&ri, "Status"); - conn->request_info.status_code = status == NULL ? 200 : atoi(status); - (void) mg_printf(conn, "HTTP/1.1 %d OK\r\n", - conn->request_info.status_code); - - /* Send headers */ - for (i = 0; i < ri.num_headers; i++) - (void) mg_printf(conn, "%s: %s\r\n", - ri.http_headers[i].name, - ri.http_headers[i].value); - (void) mg_write(conn, "\r\n", 2); - - /* Send headers, and the rest of the data */ - conn->num_bytes_sent += mg_write(conn, - buf + headers_len, data_len - headers_len); - while ((n = pull(fd_stdout[0], - INVALID_SOCKET, NULL, buf, sizeof(buf))) > 0) - conn->num_bytes_sent += mg_write(conn, buf, n); - -done: - if (fd_stdin[0] != -1) (void) close(fd_stdin[0]); - if (fd_stdin[1] != -1) (void) close(fd_stdin[1]); - if (fd_stdout[0] != -1) (void) close(fd_stdout[0]); - if (fd_stdout[1] != -1) (void) close(fd_stdout[1]); -} -#endif /* !NO_CGI */ - -#if !defined(NO_AUTH) -/* - * For a given PUT path, create all intermediate subdirectories - * for given path. Return 0 if the path itself is a directory, - * or -1 on error, 1 if OK. - */ -static int -put_dir(const char *path) -{ - char buf[FILENAME_MAX]; - const char *s, *p; - struct stat st; - size_t len; - - for (s = p = path + 2; (p = strchr(s, '/')) != NULL; s = ++p) { - len = p - path; - assert(len < sizeof(buf)); - (void) memcpy(buf, path, len); - buf[len] = '\0'; - - /* Try to create intermediate directory */ - if (mg_stat(buf, &st) == -1 && mg_mkdir(buf, 0755) != 0) - return (-1); - - /* Is path itself a directory ? */ - if (p[1] == '\0') - return (0); - } - - return (1); -} - -static void -put_file(struct mg_connection *conn, const char *path) -{ - struct stat st; - int rc, fd; - - conn->request_info.status_code = mg_stat(path, &st) == 0 ? 200 : 201; - - if (mg_get_header(conn, "Range")) { - send_error(conn, 501, "Not Implemented", - "%s", "Range support for PUT requests is not implemented"); - } else if ((rc = put_dir(path)) == 0) { - send_error(conn, 200, "OK", ""); - } else if (rc == -1) { - send_error(conn, 500, http_500_error, - "put_dir(%s): %s", path, strerror(ERRNO)); - } else if ((fd = mg_open(path, - O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, 0644)) == -1) { - send_error(conn, 500, http_500_error, - "open(%s): %s", path, strerror(ERRNO)); - } else { - set_close_on_exec(fd); - if (handle_request_body(conn, fd)) - send_error(conn, conn->request_info.status_code, - "OK", ""); - (void) close(fd); - } -} -#endif /* NO_AUTH */ - -#if !defined(NO_SSI) -static void -do_ssi_include(struct mg_connection *conn, const char *ssi, char *tag) -{ - char file_name[BUFSIZ], path[FILENAME_MAX], *p; - FILE *fp; - - /* - * sscanf() is safe here, since send_ssi_file() also uses buffer - * of size BUFSIZ to get the tag. So strlen(tag) is always < BUFSIZ. - */ - if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) { - /* File name is relative to the webserver root */ - mg_lock(conn->ctx); - (void) mg_snprintf(path, sizeof(path), "%s%c%s", - conn->ctx->options[OPT_ROOT], DIRSEP, file_name); - mg_unlock(conn->ctx); - } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1) { - /* - * File name is relative to the webserver working directory - * or it is absolute system path - */ - (void) mg_snprintf(path, sizeof(path), "%s", file_name); - } else if (sscanf(tag, " \"%[^\"]\"", file_name) == 1) { - /* File name is relative to the currect document */ - (void) mg_snprintf(path, sizeof(path), "%s", ssi); - if ((p = strrchr(path, DIRSEP)) != NULL) - p[1] = '\0'; - (void) mg_snprintf(path + strlen(path), - sizeof(path) - strlen(path), "%s", file_name); - } else { - cry("Bad SSI #include: [%s]", tag); - return; - } - - if ((fp = fopen(path, "rb")) == NULL) { - cry("Cannot open SSI #include: [%s]: fopen(%s): %s", - tag, path, strerror(ERRNO)); - } else { - set_close_on_exec(fileno(fp)); - send_opened_file_stream(conn, fileno(fp), ~0ULL); - (void) fclose(fp); - } -} - -static void -do_ssi_exec(struct mg_connection *conn, char *tag) -{ - char cmd[BUFSIZ]; - FILE *fp; - - if (sscanf(tag, " \"%[^\"]\"", cmd) != 1) { - cry("Bad SSI #exec: [%s]", tag); - } else if ((fp = popen(cmd, "r")) == NULL) { - cry("Cannot SSI #exec: [%s]: %s", cmd, strerror(ERRNO)); - } else { - send_opened_file_stream(conn, fileno(fp), ~0ULL); - (void) pclose(fp); - } -} - -static void -send_ssi_file(struct mg_connection *conn, const char *path, FILE *fp) -{ - char buf[BUFSIZ]; - int ch, len, in_ssi_tag; - - in_ssi_tag = FALSE; - len = 0; - - while ((ch = fgetc(fp)) != EOF) { - if (in_ssi_tag && ch == '>') { - in_ssi_tag = FALSE; - buf[len++] = ch & 0xff; - buf[len] = '\0'; - assert(len <= (int) sizeof(buf)); - if (len < 6 || memcmp(buf, " empty line sep. header and body - - std::string::size_type sep( data.find( ':') ); - if ( sep == std::string::npos ) - ZYPP_THROW( PluginFrameException( "Missing colon in header" ) ); - - _header.insert( HeaderList::value_type( data.substr(0,sep), data.substr(sep+1) ) ); - } while ( true ); - - // data - _body = str::receiveUpTo( stream_r, '\0' ); - if ( ! stream_r.good() ) - ZYPP_THROW( PluginFrameException( "Missing NUL after body" ) ); - } - - std::ostream & PluginFrame::Impl::writeTo( std::ostream & stream_r ) const - { - //DBG << "Write " << *this << " to " << stream_r << endl; - if ( ! stream_r ) - ZYPP_THROW( PluginFrameException( "Bad Stream" ) ); - - // command - stream_r << _command << endl; - // header - for_( it, _header.begin(), _header.end() ) - stream_r << it->first << ':' << it->second << endl; - // body - stream_r << endl - << _body << '\0'; - - if ( ! stream_r ) - ZYPP_THROW( PluginFrameException( "Write error" ) ); - return stream_r; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PluginFrame - // - /////////////////////////////////////////////////////////////////// - - const std::string & PluginFrame::ackCommand() - { - static std::string _val( "ACK" ); - return _val; - } - - const std::string & PluginFrame::errorCommand() - { - static std::string _val( "ERROR" ); - return _val; - } - - const std::string & PluginFrame::enomethodCommand() - { - static std::string _val( "_ENOMETHOD" ); - return _val; - } - - PluginFrame::PluginFrame() - : _pimpl( Impl::nullimpl() ) - {} - - PluginFrame::PluginFrame( const std::string & command_r ) - : _pimpl( new Impl( command_r ) ) - {} - - PluginFrame::PluginFrame( const std::string & command_r, const std::string & body_r ) - : _pimpl( new Impl( command_r, body_r ) ) - {} - - PluginFrame::PluginFrame( const std::string & command_r, HeaderInitializerList contents_r ) - : _pimpl( new Impl( command_r, contents_r ) ) - {} - - PluginFrame::PluginFrame( const std::string & command_r, const std::string & body_r, HeaderInitializerList contents_r ) - : _pimpl( new Impl( command_r, body_r, contents_r ) ) - {} - - PluginFrame::PluginFrame( std::istream & stream_r ) - : _pimpl( new Impl( stream_r ) ) - {} - - bool PluginFrame::empty() const - { return _pimpl->empty(); } - - const std::string & PluginFrame::command() const - { return _pimpl->command(); } - - void PluginFrame::setCommand( const std::string & command_r ) - { _pimpl->setCommand( command_r ); } - - const std::string & PluginFrame::body() const - { return _pimpl->body(); } - - std::string & PluginFrame::bodyRef() - { return _pimpl->bodyRef(); } - - void PluginFrame::setBody( const std::string & body_r ) - { _pimpl->setBody( body_r ); } - - std::ostream & PluginFrame::writeTo( std::ostream & stream_r ) const - { return _pimpl->writeTo( stream_r ); } - - PluginFrame::HeaderList & PluginFrame::headerList() - { return _pimpl->headerList(); } - - const PluginFrame::HeaderList & PluginFrame::headerList() const - { return _pimpl->headerList(); } - - const std::string & PluginFrame::getHeader( const std::string & key_r ) const - { return _pimpl->getHeader( key_r ); } - - const std::string & PluginFrame::getHeader( const std::string & key_r, const std::string & default_r ) const - { return _pimpl->getHeader( key_r, default_r ); } - - const std::string & PluginFrame::getHeaderNT( const std::string & key_r, const std::string & default_r ) const - { return _pimpl->getHeaderNT( key_r, default_r ); } - - void PluginFrame::setHeader( const std::string & key_r, const std::string & value_r ) - { _pimpl->setHeader( key_r, value_r ); } - - void PluginFrame::addHeader( const std::string & key_r, const std::string & value_r ) - { _pimpl->addHeader( key_r, value_r ); } - - void PluginFrame::addHeader( HeaderInitializerList contents_r ) - { _pimpl->addHeader( contents_r ); } - - void PluginFrame::clearHeader( const std::string & key_r ) - { _pimpl->clearHeader( key_r ); } - - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const PluginFrame & obj ) - { return str << *obj._pimpl; } - - bool operator==( const PluginFrame & lhs, const PluginFrame & rhs ) - { - return ( lhs._pimpl == rhs._pimpl ) - || (( lhs.command() == rhs.command() ) && ( lhs.headerList() == rhs.headerList() ) && ( lhs.body() == rhs.body() )); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PluginFrame.h b/libzypp/zypp/PluginFrame.h deleted file mode 100644 index 8683fe2..0000000 --- a/libzypp/zypp/PluginFrame.h +++ /dev/null @@ -1,277 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginFrame.h - * -*/ -#ifndef ZYPP_PLUGINFRAME_H -#define ZYPP_PLUGINFRAME_H - -#include -#include -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/PluginFrameException.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Command frame for communication with \ref PluginScript - * - * \code - * COMMAND - * key:value header lines - * - * multiline body separated from header - * by an empty line and terminated by NUL. - * ^@ - * \endcode - * - * \see PluginScript - */ - class PluginFrame - { - friend std::ostream & operator<<( std::ostream & str, const PluginFrame & obj ); - friend bool operator==( const PluginFrame & lhs, const PluginFrame & rhs ); - - typedef const std::initializer_list> & HeaderInitializerList; - - public: - /** "ACK" command. */ - static const std::string & ackCommand(); - /** "ERROR" command. */ - static const std::string & errorCommand(); - /** "_ENOMETHOD" command. */ - static const std::string & enomethodCommand(); - - public: - /** Default exception type */ - typedef PluginFrameException Exception; - - /** Default ctor (empty frame) */ - PluginFrame(); - - /** Ctor taking the command - * \throw PluginFrameException If \ref setCommand throws - */ - PluginFrame( const std::string & command_r ); - - /** Ctor taking command and body - * \throw PluginFrameException If \ref setCommand throws - */ - PluginFrame( const std::string & command_r, const std::string & body_r ); - - /** Ctor taking the command and a HeaderInitializerList - * \throw PluginFrameException If \ref setCommand throws - */ - PluginFrame( const std::string & command_r, HeaderInitializerList contents_r ); - - /** Ctor taking command, body and a HeaderInitializerList - * \throw PluginFrameException If \ref setCommand throws - */ - PluginFrame( const std::string & command_r, const std::string & body_r, HeaderInitializerList contents_r ); - - /** Ctor reading frame data from a stream - * \throw PluginFrameException On error reading from stream - * \throw PluginFrameException On error parsing the data - */ - PluginFrame( std::istream & stream_r ); - - public: - /** Whether this is an empty frame. */ - bool empty() const; - - /** Evaluate in a boolean context (empty frame) */ - explicit operator bool() const - { return empty(); } - - public: - /** Return the frame command. */ - const std::string & command() const; - - /** Set the frame command - * \throw PluginFrameException If illegal command string (e.g. multiline) - */ - void setCommand( const std::string & command_r ); - - /** Convenience to identify an ACK command. */ - bool isAckCommand() const - { return command() == ackCommand(); } - - /** Convenience to identify an ERROR command. */ - bool isErrorCommand() const - {return command() == errorCommand(); } - - /** Convenience to identify an _ENOMETHOD command. */ - bool isEnomethodCommand() const - {return command() == enomethodCommand(); } - - /** Return the frame body. */ - const std::string & body() const; - - /** Return a reference to the frame body. - * This may avoid creating unnecessary copies if you - * want to manipulate large body data. - * \code - * std::string tmp; - * frame.bodyRef().swap( tmp ); - * \endcode - */ - std::string & bodyRef(); - - /** Set the frame body */ - void setBody( const std::string & body_r ); - - public: - /** The header list */ - typedef std::multimap HeaderList; - - /** Header list iterator */ - typedef HeaderList::const_iterator HeaderListIterator; - - private: - /** Modifyalble header list for internal use only. */ - HeaderList & headerList(); - - public: - /** The header list. */ - const HeaderList & headerList() const; - - /** Whether header list is empty. */ - bool headerEmpty() const - { return headerList().empty(); } - - /** Return size of the header list. */ - unsigned headerSize() const - { return headerList().size(); } - - /** Return iterator pointing to the 1st header (or \ref headerEnd) */ - HeaderListIterator headerBegin() const - { return headerList().begin(); } - - /** Return iterator pointing behind the last header. */ - HeaderListIterator headerEnd() const - { return headerList().end(); } - - /** Clear the list of headers. */ - void headerClear() - { headerList().clear(); } - - - /** Whether the header list contains at least one entry for \c key_r. */ - bool hasKey( const std::string & key_r ) const - { return ! keyEmpty( key_r ); } - - /** \overload */ - bool keyEmpty( const std::string & key_r ) const - { return headerList().find( key_r ) == headerEnd(); } - - /** Return number of header entires for \c key_r. */ - bool keySize( const std::string & key_r ) const - { return headerList().count( key_r ); } - - /** Return iterator pointing to the 1st header for \c key_r (or \ref keyEnd(key_r)) */ - HeaderListIterator keyBegin( const std::string & key_r ) const - { return headerList().lower_bound( key_r ); } - - /** Return iterator pointing behind the last header for \c key_r.*/ - HeaderListIterator keyEnd( const std::string & key_r ) const - { return headerList().upper_bound( key_r ); } - - - /** Return header value for \c key_r. - * \throw PluginFrameException If no header for key_r exists. - * \throw PluginFrameException If multiple header for key_r exist. - */ - const std::string & getHeader( const std::string & key_r ) const; - - /** Return header value for \c key_r or \c default_r if it does not exist. - * \throw PluginFrameException If multiple header for key_r exist. - */ - const std::string & getHeader( const std::string & key_r, const std::string & default_r ) const; - - /** Not throwing version returing one of the matching header values or \c default_r string. */ - const std::string & getHeaderNT( const std::string & key_r, const std::string & default_r = std::string() ) const; - - /** Set header for \c key_r removing all other occurences of \c key_r. - * \throw PluginFrameException If key contains illegal chars (\c NL or \c :) - * \throw PluginFrameException If value contains illegal chars (\c NL) - */ - void setHeader( const std::string & key_r, const std::string & value_r = std::string() ); - - /** Set a new header list - * \throw PluginFrameException If key contains illegal chars (\c NL or \c :) - * \throw PluginFrameException If value contains illegal chars (\c NL) - */ - void setHeader( HeaderInitializerList contents_r ) - { headerList().clear(); addHeader( contents_r ); } - - /** Add header for \c key_r leaving already existing headers for \c key_r unchanged. - * \throw PluginFrameException If key contains illegal chars (\c NL or \c :) - * \throw PluginFrameException If value contains illegal chars (\c NL) - */ - void addHeader( const std::string & key_r, const std::string & value_r = std::string() ); - /** \overload taking an initializer_list */ - void addHeader( HeaderInitializerList contents_r ); - - /** Remove all headers for \c key_r. */ - void clearHeader( const std::string & key_r ); - - public: - /** Write frame to stream - * \throw PluginFrameException On error writing to stream - */ - std::ostream & writeTo( std::ostream & stream_r ) const; - - /** \overload Static version. */ - static std::ostream & writeTo( std::ostream & stream_r, const PluginFrame & frame_r ) - { return frame_r.writeTo( stream_r ); } - - /** Read frame from stream - * \throw PluginFrameException If \ref PluginFrame(std::istream&) throws - */ - std::istream & readFrom( std::istream & stream_r ) - { *this = PluginFrame( stream_r ); return stream_r; } - - /** \overload Static version. */ - static std::istream & readFrom( std::istream & stream_r, PluginFrame & frame_r ) - { frame_r = PluginFrame( stream_r ); return stream_r; } - - public: - /** Implementation */ - class Impl; - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - - /** \relates PluginFrame Stream output for logging */ - std::ostream & operator<<( std::ostream & str, const PluginFrame & obj ); - - /** \relates PluginFrame Stream output sending all data */ - inline std::ostream & dumpOn( std::ostream & str, const PluginFrame & obj ) - { return PluginFrame::writeTo( str, obj ); } - - /** \relates PluginFrame Construct from stream. */ - inline std::istream & operator>>( std::istream & str, PluginFrame & obj ) - { return PluginFrame::readFrom( str, obj ); } - - /** \relates PluginFrame Comparison based on content. */ - bool operator==( const PluginFrame & lhs, const PluginFrame & rhs ); - - /** \relates PluginFrame Comparison based on content. */ - inline bool operator!=( const PluginFrame & lhs, const PluginFrame & rhs ) - { return( ! operator==( lhs, rhs ) ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PLUGINFRAME_H diff --git a/libzypp/zypp/PluginFrameException.cc b/libzypp/zypp/PluginFrameException.cc deleted file mode 100644 index bbe72e8..0000000 --- a/libzypp/zypp/PluginFrameException.cc +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginFrameException.cc - * -*/ -#include -//#include "zypp/base/LogTools.h" - -#include "zypp/PluginFrameException.h" -#include "zypp/PluginFrame.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - PluginFrameException::PluginFrameException() - : Exception( "PluginFrameException" ) - {} - - PluginFrameException::PluginFrameException( const std::string & msg_r ) - : Exception( msg_r ) - {} - - PluginFrameException::PluginFrameException( const std::string & msg_r, const std::string & hist_r ) - : Exception( msg_r ) - { addHistory( hist_r ); } - - PluginFrameException::~PluginFrameException() throw() - {}; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PluginFrameException.h b/libzypp/zypp/PluginFrameException.h deleted file mode 100644 index 1451621..0000000 --- a/libzypp/zypp/PluginFrameException.h +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginFrameException.h - * -*/ -#ifndef ZYPP_PLUGINFRAMEEXCEPTION_H -#define ZYPP_PLUGINFRAMEEXCEPTION_H - -#include - -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PluginFrameException - // - /** Base class for \ref PluginFrame \ref Exception. */ - class PluginFrameException : public Exception - { - public: - PluginFrameException(); - PluginFrameException( const std::string & msg_r ); - PluginFrameException( const std::string & msg_r, const std::string & hist_r ); - virtual ~PluginFrameException() throw(); - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PLUGINFRAMEEXCEPTION_H diff --git a/libzypp/zypp/PluginScript.cc b/libzypp/zypp/PluginScript.cc deleted file mode 100644 index 4024bc7..0000000 --- a/libzypp/zypp/PluginScript.cc +++ /dev/null @@ -1,517 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginScript.cc - * -*/ -#include -#include - -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/base/String.h" -#include "zypp/base/Signal.h" -#include "zypp/base/IOStream.h" - -#include "zypp/PluginScript.h" -#include "zypp/ExternalProgram.h" -#include "zypp/PathInfo.h" - -using std::endl; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::plugin" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace - { - const char * PLUGIN_DEBUG = getenv( "ZYPP_PLUGIN_DEBUG" ); - - /** Dump buffer string if PLUGIN_DEBUG is on. - * \ingroup g_RAII - */ - struct PluginDebugBuffer - { - PluginDebugBuffer( const std::string & buffer_r ) : _buffer( buffer_r ) {} - ~PluginDebugBuffer() - { - if ( PLUGIN_DEBUG ) - { - if ( _buffer.empty() ) - { - _DBG("PLUGIN") << "< (empty)" << endl; - } - else - { - std::istringstream datas( _buffer ); - iostr::copyIndent( datas, _DBG("PLUGIN"), "< " ) << endl; - } - } - } - const std::string & _buffer; - }; - - /** Dump programms stderr. - * \ingroup g_RAII - */ - struct PluginDumpStderr - { - PluginDumpStderr( ExternalProgramWithStderr & prog_r ) : _prog( prog_r ) {} - ~PluginDumpStderr() - { - std::string line; - while ( _prog.stderrGetline( line ) ) - _WAR("PLUGIN") << "! " << line << endl; - } - ExternalProgramWithStderr & _prog; - }; - - inline void setBlocking( FILE * file_r, bool yesno_r = true ) - { - if ( ! file_r ) - ZYPP_THROW( PluginScriptException( "setNonBlocking" ) ); - - int fd = ::fileno( file_r ); - if ( fd == -1 ) - ZYPP_THROW( PluginScriptException( "setNonBlocking" ) ); - - int flags = ::fcntl( fd, F_GETFL ); - if ( flags == -1 ) - ZYPP_THROW( PluginScriptException( "setNonBlocking" ) ); - - if ( ! yesno_r ) - flags |= O_NONBLOCK; - else if ( flags & O_NONBLOCK ) - flags ^= O_NONBLOCK; - - flags = ::fcntl( fd, F_SETFL, flags ); - if ( flags == -1 ) - ZYPP_THROW( PluginScriptException( "setNonBlocking" ) ); - } - - inline void setNonBlocking( FILE * file_r, bool yesno_r = true ) - { setBlocking( file_r, !yesno_r ); } - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PluginScript::Impl - // - /** \ref PluginScript implementation. */ - struct PluginScript::Impl - { - public: - Impl( const Pathname & script_r = Pathname(), const Arguments & args_r = Arguments() ) - : _sendTimeout( _defaultSendTimeout ) - , _receiveTimeout( _defaultReceiveTimeout ) - , _script( script_r ) - , _args( args_r ) - {} - - ~ Impl() - { try { close(); } catch(...) {} } - - public: - static long _defaultSendTimeout; - static long _defaultReceiveTimeout; - - long _sendTimeout; - long _receiveTimeout; - - public: - const Pathname & script() const - { return _script; } - - const Arguments & args() const - { return _args; } - - pid_t getPid() const - { return _cmd ? _cmd->getpid() : NotConnected; } - - bool isOpen() const - { return _cmd != nullptr; } - - int lastReturn() const - { return _lastReturn; } - - const std::string & lastExecError() const - { return _lastExecError; } - - public: - void open( const Pathname & script_r = Pathname(), const Arguments & args_r = Arguments() ); - - int close(); - - void send( const PluginFrame & frame_r ) const; - - PluginFrame receive() const; - - private: - Pathname _script; - Arguments _args; - scoped_ptr _cmd; - DefaultIntegral _lastReturn; - std::string _lastExecError; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PluginScrip::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const PluginScript::Impl & obj ) - { - return str << "PluginScript[" << obj.getPid() << "] " << obj.script(); - } - - /////////////////////////////////////////////////////////////////// - - namespace - { - const long PLUGIN_TIMEOUT = str::strtonum( getenv( "ZYPP_PLUGIN_TIMEOUT" ) ); - const long PLUGIN_SEND_TIMEOUT = str::strtonum( getenv( "ZYPP_PLUGIN_SEND_TIMEOUT" ) ); - const long PLUGIN_RECEIVE_TIMEOUT = str::strtonum( getenv( "ZYPP_PLUGIN_RECEIVE_TIMEOUT" ) ); - } - - long PluginScript::Impl::_defaultSendTimeout = ( PLUGIN_SEND_TIMEOUT > 0 ? PLUGIN_SEND_TIMEOUT - : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) ); - long PluginScript::Impl::_defaultReceiveTimeout = ( PLUGIN_RECEIVE_TIMEOUT > 0 ? PLUGIN_RECEIVE_TIMEOUT - : ( PLUGIN_TIMEOUT > 0 ? PLUGIN_TIMEOUT : 30 ) ); - - /////////////////////////////////////////////////////////////////// - - void PluginScript::Impl::open( const Pathname & script_r, const Arguments & args_r ) - { - dumpRangeLine( DBG << "Open " << script_r, args_r.begin(), args_r.end() ) << endl; - - if ( _cmd ) - ZYPP_THROW( PluginScriptException( "Already connected", str::Str() << *this ) ); - - { - PathInfo pi( script_r ); - if ( ! ( pi.isFile() && pi.isX() ) ) - ZYPP_THROW( PluginScriptException( "Script is not executable", str::Str() << pi ) ); - } - - // go and launch script - // TODO: ExternalProgram::maybe use Stderr_To_FileDesc for script loging - Arguments args; - args.reserve( args_r.size()+1 ); - args.push_back( script_r.asString() ); - args.insert( args.end(), args_r.begin(), args_r.end() ); - _cmd.reset( new ExternalProgramWithStderr( args ) ); - - // Be protected against full pipe, etc. - setNonBlocking( _cmd->outputFile() ); - setNonBlocking( _cmd->inputFile() ); - - // store running scripts data - _script = script_r; - _args = args_r; - _lastReturn.reset(); - _lastExecError.clear(); - - dumpRangeLine( DBG << *this, _args.begin(), _args.end() ) << endl; - } - - int PluginScript::Impl::close() - { - if ( _cmd ) - { - DBG << "Close:" << *this << endl; - bool doKill = true; - try { - // do not kill script if _DISCONNECT is ACKed. - send( PluginFrame( "_DISCONNECT" ) ); - PluginFrame ret( receive() ); - if ( ret.isAckCommand() ) - { - doKill = false; - str::strtonum( ret.getHeaderNT( "exit" ), _lastReturn.get() ); - _lastExecError = ret.body(); - } - } - catch (...) - { /* NOP */ } - - if ( doKill ) - { - _cmd->kill(); - _lastReturn = _cmd->close(); - _lastExecError = _cmd->execError(); - } - DBG << *this << " -> [" << _lastReturn << "] " << _lastExecError << endl; - _cmd.reset(); - } - return _lastReturn; - } - - void PluginScript::Impl::send( const PluginFrame & frame_r ) const - { - if ( !_cmd ) - ZYPP_THROW( PluginScriptNotConnected( "Not connected", str::Str() << *this ) ); - - if ( frame_r.command().empty() ) - WAR << "Send: No command in frame" << frame_r << endl; - - // prepare frame data to write - std::string data; - { - std::ostringstream datas; - frame_r.writeTo( datas ); - datas.str().swap( data ); - } - DBG << *this << " ->send " << frame_r << endl; - - if ( PLUGIN_DEBUG ) - { - std::istringstream datas( data ); - iostr::copyIndent( datas, _DBG("PLUGIN") ) << endl; - } - - // try writing the pipe.... - FILE * filep = _cmd->outputFile(); - if ( ! filep ) - ZYPP_THROW( PluginScriptException( "Bad file pointer." ) ); - - int fd = ::fileno( filep ); - if ( fd == -1 ) - ZYPP_THROW( PluginScriptException( "Bad file descriptor" ) ); - - //DBG << " ->[" << fd << " " << (::feof(filep)?'e':'_') << (::ferror(filep)?'F':'_') << "]" << endl; - { - PluginDumpStderr _dump( *_cmd ); // dump scripts stderr before leaving - SignalSaver sigsav( SIGPIPE, SIG_IGN ); - const char * buffer = data.c_str(); - ssize_t buffsize = data.size(); - do { - fd_set wfds; - FD_ZERO( &wfds ); - FD_SET( fd, &wfds ); - - struct timeval tv; - tv.tv_sec = _sendTimeout; - tv.tv_usec = 0; - - int retval = select( fd+1, NULL, &wfds, NULL, &tv ); - if ( retval > 0 ) // FD_ISSET( fd, &wfds ) will be true. - { - //DBG << "Ready to write..." << endl; - ssize_t ret = ::write( fd, buffer, buffsize ); - if ( ret == buffsize ) - { - //DBG << "::write(" << buffsize << ") -> " << ret << endl; - ::fflush( filep ); - break; // -> done - } - else if ( ret > 0 ) - { - //WAR << "::write(" << buffsize << ") -> " << ret << " INCOMPLETE..." << endl; - ::fflush( filep ); - buffsize -= ret; - buffer += ret; // -> continue - } - else // ( retval == -1 ) - { - if ( errno != EINTR ) - { - ERR << "write(): " << Errno() << endl; - if ( errno == EPIPE ) - ZYPP_THROW( PluginScriptDiedUnexpectedly( "Send: script died unexpectedly", str::Str() << Errno() ) ); - else - ZYPP_THROW( PluginScriptException( "Send: send error", str::Str() << Errno() ) ); - } - } - } - else if ( retval == 0 ) - { - WAR << "Not ready to write within timeout." << endl; - ZYPP_THROW( PluginScriptSendTimeout( "Not ready to write within timeout." ) ); - } - else // ( retval == -1 ) - { - if ( errno != EINTR ) - { - ERR << "select(): " << Errno() << endl; - ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) ); - } - } - } while( true ); - } - } - - PluginFrame PluginScript::Impl::receive() const - { - if ( !_cmd ) - ZYPP_THROW( PluginScriptNotConnected( "Not connected", str::Str() << *this ) ); - - // try reading the pipe.... - FILE * filep = _cmd->inputFile(); - if ( ! filep ) - ZYPP_THROW( PluginScriptException( "Bad file pointer." ) ); - - int fd = ::fileno( filep ); - if ( fd == -1 ) - ZYPP_THROW( PluginScriptException( "Bad file descriptor" ) ); - - ::clearerr( filep ); - std::string data; - { - PluginDebugBuffer _debug( data ); // dump receive buffer if PLUGIN_DEBUG - PluginDumpStderr _dump( *_cmd ); // dump scripts stderr before leaving - do { - int ch = fgetc( filep ); - if ( ch != EOF ) - { - data.push_back( ch ); - if ( ch == '\0' ) - break; - } - else if ( ::feof( filep ) ) - { - WAR << "Unexpected EOF" << endl; - ZYPP_THROW( PluginScriptDiedUnexpectedly( "Receive: script died unexpectedly", str::Str() << Errno() ) ); - } - else if ( errno != EINTR ) - { - if ( errno == EWOULDBLOCK ) - { - // wait a while for fd to become ready for reading... - fd_set rfds; - FD_ZERO( &rfds ); - FD_SET( fd, &rfds ); - - struct timeval tv; - tv.tv_sec = _receiveTimeout; - tv.tv_usec = 0; - - int retval = select( fd+1, &rfds, NULL, NULL, &tv ); - if ( retval > 0 ) // FD_ISSET( fd, &rfds ) will be true. - { - ::clearerr( filep ); - } - else if ( retval == 0 ) - { - WAR << "Not ready to read within timeout." << endl; - ZYPP_THROW( PluginScriptReceiveTimeout( "Not ready to read within timeout." ) ); - } - else // ( retval == -1 ) - { - if ( errno != EINTR ) - { - ERR << "select(): " << Errno() << endl; - ZYPP_THROW( PluginScriptException( "Error waiting on file descriptor", str::Str() << Errno() ) ); - } - } - } - else - { - ERR << "read(): " << Errno() << endl; - ZYPP_THROW( PluginScriptException( "Receive: receive error", str::Str() << Errno() ) ); - } - } - } while ( true ); - } - // DBG << " <-read " << data.size() << endl; - std::istringstream datas( data ); - PluginFrame ret( datas ); - DBG << *this << " <-" << ret << endl; - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PluginScript - // - /////////////////////////////////////////////////////////////////// - - const pid_t PluginScript::NotConnected( -1 ); - - long PluginScript::defaultSendTimeout() - { return Impl::_defaultSendTimeout; } - - long PluginScript::defaultReceiveTimeout() - { return Impl::_defaultReceiveTimeout; } - - void PluginScript::defaultSendTimeout( long newval_r ) - { Impl::_defaultSendTimeout = newval_r > 0 ? newval_r : 0; } - - void PluginScript::defaultReceiveTimeout( long newval_r ) - { Impl::_defaultReceiveTimeout = newval_r > 0 ? newval_r : 0; } - - long PluginScript::sendTimeout() const - { return _pimpl->_sendTimeout; } - - long PluginScript::receiveTimeout() const - { return _pimpl->_receiveTimeout; } - - void PluginScript::sendTimeout( long newval_r ) - { _pimpl->_sendTimeout = newval_r > 0 ? newval_r : 0; } - - void PluginScript::receiveTimeout( long newval_r ) - { _pimpl->_receiveTimeout = newval_r > 0 ? newval_r : 0; } - - PluginScript::PluginScript() - : _pimpl( new Impl ) - {} - - PluginScript::PluginScript( const Pathname & script_r ) - : _pimpl( new Impl( script_r ) ) - {} - - PluginScript::PluginScript( const Pathname & script_r, const Arguments & args_r ) - : _pimpl( new Impl( script_r, args_r ) ) - {} - - const Pathname & PluginScript::script() const - { return _pimpl->script(); } - - const PluginScript::Arguments & PluginScript::args() const - { return _pimpl->args(); } - - bool PluginScript::isOpen() const - { return _pimpl->isOpen(); } - - pid_t PluginScript::getPid() const - { return _pimpl->getPid(); } - - int PluginScript::lastReturn() const - { return _pimpl->lastReturn(); } - - const std::string & PluginScript::lastExecError() const - { return _pimpl->lastExecError(); } - - void PluginScript::open() - { _pimpl->open( _pimpl->script(), _pimpl->args() ); } - - void PluginScript::open( const Pathname & script_r ) - { _pimpl->open( script_r ); } - - void PluginScript::open( const Pathname & script_r, const Arguments & args_r ) - { _pimpl->open( script_r, args_r ); } - - int PluginScript::close() - { return _pimpl->close(); } - - void PluginScript::send( const PluginFrame & frame_r ) const - { _pimpl->send( frame_r ); } - - PluginFrame PluginScript::receive() const - { return _pimpl->receive(); } - - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const PluginScript & obj ) - { return str << *obj._pimpl; } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PluginScript.h b/libzypp/zypp/PluginScript.h deleted file mode 100644 index 2f1e4d9..0000000 --- a/libzypp/zypp/PluginScript.h +++ /dev/null @@ -1,197 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginScript.h - * -*/ -#ifndef ZYPP_PLUGINSCRIPT_H -#define ZYPP_PLUGINSCRIPT_H - -#include -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/Pathname.h" - -#include "zypp/PluginFrame.h" -#include "zypp/PluginScriptException.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** - * \brief Interface to pluigin scripts using a \c Stomp inspired communication protocol. - * - * \note \ref PluginScript is copyable and assignable, but the connection is shared - * among multiple copies. It gets automatically closed if the last copy goes out of - * scope. - * - * Timeout when sending/receiving data to/from a plugin default to 30 sec. The value - * (in seconds) my be changed via the environment variables \c ZYPP_PLUGIN_SEND_TIMEOUT, - * \c ZYPP_PLUGIN_RECEIVE_TIMEOUT or \c ZYPP_PLUGIN_TIMEOUT (both: send and receive). - * - * \code - * // Setup comnnection to plugin script - * PluginScript scr; - * PluginScript::Arguments args; - * args.push_back( "-v" ); - * scr.open( "/soem/testplugin", args ); - * - * // send frame to plugin - * PluginFrame f( "COMMAND" ); - * f.setHeader( "key", "value" ); - * f.setBody( "some\ndata" ); - * scr.send( f ); - * - * // receive frame from plugin - * PluginFrame r( scr.receive() ); - * - * // explicitly close or let PluginScript go out of scope - * scr.close(); - * \endcode - * - * \see http://stomp.codehaus.org/ - */ - class PluginScript - { - friend std::ostream & operator<<( std::ostream & str, const PluginScript & obj ); - - public: - /** Commandline arguments passed to a script on \ref open. */ - typedef std::vector Arguments; - - /** \c pid_t(-1) constant indicating no connection. */ - static const pid_t NotConnected; - - public: - /** \name Get/set the global timeout settings. - * Timeout when sending/receiving data to/from a plugin default to 30 sec. The value - * (in seconds) my be changed via the environment variables \c ZYPP_PLUGIN_SEND_TIMEOUT, - * \c ZYPP_PLUGIN_RECEIVE_TIMEOUT or \c ZYPP_PLUGIN_TIMEOUT (both: send and receive). - */ - //@{ - /** Global default timeout (sec.) when sending data. */ - static long defaultSendTimeout(); - - /** Global default timeout (sec.) when receiving data. */ - static long defaultReceiveTimeout(); - - /** Set global default timeout (sec.) when sending data. */ - static void defaultSendTimeout( long newval_r ); - - /** Set global default timeout (sec.) when receiving data. */ - static void defaultReceiveTimeout( long newval_r ); - - /** Set global default timeout (sec.) (both: send and receive).*/ - static void defaultTimeout( long newval_r ) - { defaultSendTimeout( newval_r ); defaultReceiveTimeout( newval_r ); } - //@} - - public: - /** Default ctor. */ - PluginScript(); - - /** Ctor taking script path and no arguments. */ - PluginScript( const Pathname & script_r ); - - /** Ctor taking script path and script arguments. */ - PluginScript( const Pathname & script_r, const Arguments & args_r ); - - public: - /** Return the script path if set. */ - const Pathname & script() const; - - /** Return the script arguments if set. */ - const Arguments & args() const; - - /** Whether we are connected to a script. */ - bool isOpen() const; - - /** Return a connected scripts pid or \ref NotConnected. */ - pid_t getPid() const; - - /** Remembers a scripts return value after \ref close until next \ref open. */ - int lastReturn() const; - - /** Remembers a scripts execError string after \ref close until next \ref open. - * \see \ref ExternalProgram::execError. - */ - const std::string & lastExecError() const; - - public: - /** \name Get/set local timeout settings. */ - //@{ - /** Local default timeout (sec.) when sending data. */ - long sendTimeout() const; - - /** Local default timeout (sec.) when receiving data. */ - long receiveTimeout() const; - - /** Set local default timeout (sec.) when sending data. */ - void sendTimeout( long newval_r ); - - /** Set local default timeout (sec.) when receiving data. */ - void receiveTimeout( long newval_r ); - - /** Set local default timeout (sec.) (both: send and receive).*/ - void timeout( long newval_r ) - { sendTimeout( newval_r ); receiveTimeout( newval_r ); } - //@} - - public: - /** Setup connection and execute script. - * \throw PluginScriptException if already connected to a script - * \throw PluginScriptException if script does not exist or is not executable - * \throw PluginScriptException on error - */ - void open(); - - /** \overload taking script path and no arguments. */ - void open( const Pathname & script_r ); - - /** \overload taking script path and script arguments. */ - void open( const Pathname & script_r, const Arguments & args_r ); - - /** Close any open connection. */ - int close(); - - public: - /** Send a \ref PluginFrame. - * \throw PluginScriptNotConnected - * \throw PluginScriptSendTimeout - * \throw PluginScriptDiedUnexpectedly (does not \ref close) - * \throw PluginScriptException on error - * - */ - void send( const PluginFrame & frame_r ) const; - - /** Receive a \ref PluginFrame. - * \throw PluginScriptNotConnected - * \throw PluginScriptReceiveTimeout - * \throw PluginScriptDiedUnexpectedly (does not \ref close) - * \throw PluginScriptException on error - */ - PluginFrame receive() const; - - public: - /** Implementation. */ - class Impl; - private: - /** Pointer to implementation. */ - RW_pointer _pimpl; - }; - - /** \relates PluginScript Stream output */ - std::ostream & operator<<( std::ostream & str, const PluginScript & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PLUGINSCRIPT_H diff --git a/libzypp/zypp/PluginScriptException.cc b/libzypp/zypp/PluginScriptException.cc deleted file mode 100644 index 77e2a21..0000000 --- a/libzypp/zypp/PluginScriptException.cc +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginScriptException.cc - * -*/ -#include -//#include "zypp/base/LogTools.h" - -#include "zypp/PluginScriptException.h" -#include "zypp/PluginScript.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - PluginScriptException::PluginScriptException() - : Exception( "PluginScriptException" ) - {} - - PluginScriptException::PluginScriptException( const std::string & msg_r ) - : Exception( msg_r ) - {} - - PluginScriptException::PluginScriptException( const std::string & msg_r, const std::string & hist_r ) - : Exception( msg_r ) - { addHistory( hist_r ); } - - PluginScriptException::~PluginScriptException() throw() - {} - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PluginScriptException.h b/libzypp/zypp/PluginScriptException.h deleted file mode 100644 index bf8c8cf..0000000 --- a/libzypp/zypp/PluginScriptException.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PluginScriptException.h - * -*/ -#ifndef ZYPP_PLUGINSCRIPTEXCEPTION_H -#define ZYPP_PLUGINSCRIPTEXCEPTION_H - -#include - -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Base class for \ref PluginScript \ref Exception. */ - class PluginScriptException : public Exception - { - public: - PluginScriptException(); - PluginScriptException( const std::string & msg_r ); - PluginScriptException( const std::string & msg_r, const std::string & hist_r ); - virtual ~PluginScriptException() throw(); - }; - - /** Convenience macro to declare more specific PluginScriptExceptions. */ -#define declException( EXCP, BASE ) \ - class EXCP : public BASE { \ - public: \ - EXCP() : BASE( #EXCP ) {} \ - EXCP( const std::string & msg_r ) : BASE( msg_r ) {} \ - EXCP( const std::string & msg_r, const std::string & hist_r ) : BASE( msg_r, hist_r ) {} \ - virtual ~EXCP() throw() {} \ - } - - /** Script connection not open. */ - declException( PluginScriptNotConnected, PluginScriptException ); - - /** Script died unexpectedly. */ - declException( PluginScriptDiedUnexpectedly, PluginScriptException ); - - - /** Communication timeout. */ - declException( PluginScriptTimeout, PluginScriptException ); - - /** Timeout while sending data. */ - declException( PluginScriptSendTimeout, PluginScriptTimeout ); - - /** Timeout while receiving data. */ - declException( PluginScriptReceiveTimeout, PluginScriptTimeout ); - -#undef declException - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PLUGINSCRIPTEXCEPTION_H diff --git a/libzypp/zypp/PoolItem.cc b/libzypp/zypp/PoolItem.cc deleted file mode 100644 index 3f9e633..0000000 --- a/libzypp/zypp/PoolItem.cc +++ /dev/null @@ -1,295 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolItem.cc - * -*/ -#include -#include "zypp/base/Logger.h" -#include "zypp/base/DefaultIntegral.h" - -#include "zypp/PoolItem.h" -#include "zypp/ResPool.h" -#include "zypp/Package.h" -#include "zypp/VendorAttr.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItem::Impl - // - /** PoolItem implementation. - * \c _buddy handling: - * \li \c ==0 no buddy - * \li \c >0 this uses \c _buddy status - * \li \c <0 this status used by \c -_buddy - */ - struct PoolItem::Impl - { - public: - Impl() {} - - Impl( ResObject::constPtr res_r, - const ResStatus & status_r ) - : _status( status_r ) - , _resolvable( res_r ) - {} - - ResStatus & status() const - { return _buddy > 0 ? PoolItem(buddy()).status() : _status; } - - sat::Solvable buddy() const - { - if ( !_buddy ) - return sat::Solvable::noSolvable; - if ( _buddy < 0 ) - return sat::Solvable( -_buddy ); - return sat::Solvable( _buddy ); - } - - void setBuddy( sat::Solvable solv_r ); - - ResObject::constPtr resolvable() const - { return _resolvable; } - - ResStatus & statusReset() const - { - _status.setLock( false, zypp::ResStatus::USER ); - _status.resetTransact( zypp::ResStatus::USER ); - return _status; - } - - public: - bool isUndetermined() const - { - return status().isUndetermined(); - } - - bool isRelevant() const - { - return !status().isNonRelevant(); - } - - bool isSatisfied() const - { - return status().isSatisfied(); - } - - bool isBroken() const - { - return status().isBroken(); - } - - bool isNeeded() const - { - return status().isToBeInstalled() || ( isBroken() && ! status().isLocked() ); - } - - bool isUnwanted() const - { - return isBroken() && status().isLocked(); - } - - private: - mutable ResStatus _status; - ResObject::constPtr _resolvable; - DefaultIntegral _buddy; - - /** \name Poor man's save/restore state. - * \todo There may be better save/restore state strategies. - */ - //@{ - public: - void saveState() const - { _savedStatus = status(); } - void restoreState() const - { status() = _savedStatus; } - bool sameState() const - { - if ( status() == _savedStatus ) - return true; - // some bits changed... - if ( status().getTransactValue() != _savedStatus.getTransactValue() - && ( ! status().isBySolver() // ignore solver state changes - // removing a user lock also goes to bySolver - || _savedStatus.getTransactValue() == ResStatus::LOCKED ) ) - return false; - if ( status().isLicenceConfirmed() != _savedStatus.isLicenceConfirmed() ) - return false; - return true; - } - private: - mutable ResStatus _savedStatus; - //@} - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolItem::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const PoolItem::Impl & obj ) - { - str << obj.status(); - if (obj.resolvable()) - str << *obj.resolvable(); - else - str << "(NULL)"; - return str; - } - - inline void PoolItem::Impl::setBuddy( sat::Solvable solv_r ) - { - PoolItem myBuddy( solv_r ); - if ( myBuddy ) - { - myBuddy._pimpl->_buddy = -resolvable()->satSolvable().id(); - _buddy = myBuddy.satSolvable().id(); - DBG << *this << " has buddy " << myBuddy << endl; - } - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItem - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::PoolItem - // METHOD TYPE : Ctor - // - PoolItem::PoolItem() - : _pimpl( Impl::nullimpl() ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::PoolItem - // METHOD TYPE : Ctor - // - PoolItem::PoolItem( const sat::Solvable & solvable_r ) - : _pimpl( ResPool::instance().find( solvable_r )._pimpl ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::PoolItem - // METHOD TYPE : Ctor - // - PoolItem::PoolItem( const ResObject::constPtr & resolvable_r ) - : _pimpl( ResPool::instance().find( resolvable_r )._pimpl ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::PoolItem - // METHOD TYPE : Ctor - // - PoolItem::PoolItem( Impl * implptr_r ) - : _pimpl( implptr_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::makePoolItem - // METHOD TYPE : PoolItem - // - PoolItem PoolItem::makePoolItem( const sat::Solvable & solvable_r ) - { - return PoolItem( new Impl( makeResObject( solvable_r ), solvable_r.isSystem() ) ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::~PoolItem - // METHOD TYPE : Dtor - // - PoolItem::~PoolItem() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolItem::pool - // METHOD TYPE : ResPool - // - ResPool PoolItem::pool() const - { return ResPool::instance(); } - - /////////////////////////////////////////////////////////////////// - // - // Forward to Impl: - // - /////////////////////////////////////////////////////////////////// - - ResStatus & PoolItem::status() const - { return _pimpl->status(); } - - ResStatus & PoolItem::statusReset() const - { return _pimpl->statusReset(); } - - sat::Solvable PoolItem::buddy() const - { return _pimpl->buddy(); } - - void PoolItem::setBuddy( sat::Solvable solv_r ) - { _pimpl->setBuddy( solv_r ); } - - bool PoolItem::isUndetermined() const - { return _pimpl->isUndetermined(); } - - bool PoolItem::isRelevant() const - { return _pimpl->isRelevant(); } - - bool PoolItem::isSatisfied() const - { return _pimpl->isSatisfied(); } - - bool PoolItem::isBroken() const - { return _pimpl->isBroken(); } - - bool PoolItem::isNeeded() const - { return _pimpl->isNeeded(); } - - bool PoolItem::isUnwanted() const - { return _pimpl->isUnwanted(); } - - void PoolItem::saveState() const - { _pimpl->saveState(); } - - void PoolItem::restoreState() const - { _pimpl->restoreState(); } - - bool PoolItem::sameState() const - { return _pimpl->sameState(); } - - ResObject::constPtr PoolItem::resolvable() const - { return _pimpl->resolvable(); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const PoolItem & obj ) - { - return str << *obj._pimpl; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PoolItem.h b/libzypp/zypp/PoolItem.h deleted file mode 100644 index 878cf8a..0000000 --- a/libzypp/zypp/PoolItem.h +++ /dev/null @@ -1,248 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolItem.h - * -*/ -#ifndef ZYPP_POOLITEM_H -#define ZYPP_POOLITEM_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/ResObject.h" -#include "zypp/ResStatus.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class ResPool; - - namespace pool - { - class PoolImpl; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItem - // - /** Reference to a PoolItem connecting ResObject and ResStatus. - * - * The "real" PoolItem is usg. somewhere in the ResPool. This is - * a reference to it. All copies made will reference (and modify) - * the same PoolItem. All changes via a PoolItem are immediately - * visible in all copies (now COW). - * - * \note Constness: Like pointer types, a const PoolItem - * does \b not refer to a const PoolItem. The reference is - * \c const, i.e. you can't change the refered PoolItem. The PoolItem - * (i.e. the status) is always mutable. - * - */ - class PoolItem - { - friend std::ostream & operator<<( std::ostream & str, const PoolItem & obj ); - - public: - /** Implementation */ - class Impl; - - public: - /** Default ctor for use in std::container. */ - PoolItem(); - - /** Ctor looking up the \ref sat::Solvable in the \ref ResPool. */ - explicit PoolItem( const sat::Solvable & solvable_r ); - - /** Ctor looking up the \ref ResObject in the \ref ResPool. */ - explicit PoolItem( const ResObject::constPtr & resolvable_r ); - - /** Dtor */ - ~PoolItem(); - - public: - /** \name Status related methods. */ - //@{ - /** Returns the current status. */ - ResStatus & status() const; - - /** Reset status. */ - ResStatus & statusReset() const; - - - /** \name Status validation. - * Performed for non-packages. - */ - //@{ - /** No validation is performed for packages. */ - bool isUndetermined() const; - - /** Returns true if the solvable is relevant which means e.g. for patches - * that at least one package of the patch is installed. - */ - bool isRelevant() const; - - /** Whether a relevant items requirements are met. */ - bool isSatisfied() const; - - /** Whether a relevant items requirements are broken. */ - bool isBroken() const; - - /** This includes \c unlocked broken patches, as well as those already - * selected to be installed (otherwise classified as \c satisfied). - */ - bool isNeeded() const; - - /** Broken (needed) but locked patches. */ - bool isUnwanted() const; - //@} - - //@} - public: - /** Return the \ref ResPool the item belongs to. */ - ResPool pool() const; - - /** Return the corresponding \ref sat::Solvable. */ - sat::Solvable satSolvable() const - { return resolvable() ? resolvable()->satSolvable() : sat::Solvable::noSolvable; } - - /** Return the buddy we share our status object with. - * A \ref Product e.g. may share it's status with an associated reference \ref Package. - */ - sat::Solvable buddy() const; - - public: - /** Returns the ResObject::constPtr. - * \see \ref operator-> - */ - ResObject::constPtr resolvable() const; - - /** Implicit conversion into ResObject::constPtr to - * support query filters operating on ResObject. - */ - operator ResObject::constPtr() const - { return resolvable(); } - - /** Forward \c -> access to ResObject. */ - ResObject::constPtr operator->() const - { return resolvable(); } - - /** Conversion to bool to allow pointer style tests - * for nonNULL \ref resolvable. */ - explicit operator bool() const - { return bool(resolvable()); } - - private: - friend class Impl; - friend class pool::PoolImpl; - /** \ref PoolItem generator for \ref pool::PoolImpl. */ - static PoolItem makePoolItem( const sat::Solvable & solvable_r ); - /** Buddies are set by \ref pool::PoolImpl.*/ - void setBuddy( sat::Solvable solv_r ); - /** internal ctor */ - explicit PoolItem( Impl * implptr_r ); - /** Pointer to implementation */ - RW_pointer _pimpl; - - private: - /** \name tmp hack for save/restore state. */ - /** \todo get rid of it. */ - //@{ - friend class PoolItemSaver; - void saveState() const; - void restoreState() const; - bool sameState() const; - //@} - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolItem Stream output */ - std::ostream & operator<<( std::ostream & str, const PoolItem & obj ); - - /** \relates PoolItem */ - inline bool operator==( const PoolItem & lhs, const PoolItem & rhs ) - { return lhs.resolvable() == rhs.resolvable(); } - - /** \relates PoolItem */ - inline bool operator==( const PoolItem & lhs, const ResObject::constPtr & rhs ) - { return lhs.resolvable() == rhs; } - - /** \relates PoolItem */ - inline bool operator==( const ResObject::constPtr & lhs, const PoolItem & rhs ) - { return lhs == rhs.resolvable(); } - - - /** \relates PoolItem */ - inline bool operator!=( const PoolItem & lhs, const PoolItem & rhs ) - { return ! (lhs==rhs); } - - /** \relates PoolItem */ - inline bool operator!=( const PoolItem & lhs, const ResObject::constPtr & rhs ) - { return ! (lhs==rhs); } - - /** \relates PoolItem */ - inline bool operator!=( const ResObject::constPtr & lhs, const PoolItem & rhs ) - { return ! (lhs==rhs); } - - - /** \relates PoolItem Test for same content. */ - inline bool identical( const PoolItem & lhs, const PoolItem & rhs ) - { return lhs == rhs || lhs.satSolvable().identical( rhs.satSolvable() ); } - - /** \relates PoolItem Test for same content. */ - inline bool identical( const PoolItem & lhs, sat::Solvable rhs ) - { return lhs.satSolvable().identical( rhs ); } - - /** \relates PoolItem Test for same content. */ - inline bool identical( sat::Solvable lhs, const PoolItem & rhs ) - { return lhs.identical( rhs.satSolvable() ); } - - - /** \relates PoolItem Test for same name version release and arch. */ - inline bool sameNVRA( const PoolItem & lhs, const PoolItem & rhs ) - { return lhs == rhs || lhs.satSolvable().sameNVRA( rhs.satSolvable() ); } - - /** \relates PoolItem Test for same name version release and arch. */ - inline bool sameNVRA( const PoolItem & lhs, sat::Solvable rhs ) - { return lhs.satSolvable().sameNVRA( rhs ); } - - /** \relates PoolItem Test for same name version release and arch. */ - inline bool sameNVRA( sat::Solvable lhs, const PoolItem & rhs ) - { return lhs.sameNVRA( rhs.satSolvable() ); } - - /** Solvable to PoolItem transform functor. - * \relates PoolItem - * \relates sat::SolvIterMixin - */ - struct asPoolItem - { - typedef PoolItem result_type; - - PoolItem operator()( const sat::Solvable & solv_r ) const - { return PoolItem( solv_r ); } - }; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace std -{ ///////////////////////////////////////////////////////////////// - - /** \relates zypp::PoolItem Order in std::container follows ResObject::constPtr.*/ - template<> - inline bool less::operator()( const zypp::PoolItem & lhs, const zypp::PoolItem & rhs ) const - { return lhs.resolvable() < rhs.resolvable(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOLITEM_H diff --git a/libzypp/zypp/PoolItemBest.cc b/libzypp/zypp/PoolItemBest.cc deleted file mode 100644 index d6e4062..0000000 --- a/libzypp/zypp/PoolItemBest.cc +++ /dev/null @@ -1,80 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolItemBest.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/PoolItemBest.h" -#include "zypp/ui/SelectableTraits.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItemBest::Impl - // - /** PoolItemBest implementation. */ - struct PoolItemBest::Impl - { - Container _container; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItemBest - // - /////////////////////////////////////////////////////////////////// - - void PoolItemBest::_ctor_init() - { _dont_use_this_use_pimpl.reset( new RWCOW_pointer(new Impl) ); } - - const PoolItemBest::Container & PoolItemBest::container() const - { return pimpl()->_container; } - - void PoolItemBest::add( const PoolItem & pi_r ) - { - Container & container( pimpl()->_container ); - PoolItem & ccand( container[pi_r.satSolvable().ident()] ); - if ( ! ccand || ui::SelectableTraits::AVOrder()( pi_r, ccand ) ) - ccand = pi_r; - } - - PoolItem PoolItemBest::find( IdString ident_r ) const - { - const Container & container( pimpl()->_container ); - Container::const_iterator it( container.find( ident_r ) ); - return it != container.end() ? it->second : PoolItem(); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const PoolItemBest & obj ) - { - return dumpRange( str << "(" << obj.size() << ") ", obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PoolItemBest.h b/libzypp/zypp/PoolItemBest.h deleted file mode 100644 index 2dbebcb..0000000 --- a/libzypp/zypp/PoolItemBest.h +++ /dev/null @@ -1,155 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolItemBest.h - * -*/ -#ifndef ZYPP_POOLITEMBEST_H -#define ZYPP_POOLITEMBEST_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/Tr1hash.h" - -#include "zypp/PoolItem.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolItemBest - // - /** Find the best candidates e.g. in a \ref PoolQuery result. - * - * The class basically maintains a \c map and remembers - * for each \c ident (\ref sat::Solvable::ident) the best \ref PoolItem that - * was added. - * - * The default \ref Predicate to determine the best choice is the same that - * sorts the \ref ui::Selectable list of available objects, thus follows the - * same rules the \ref resolver will apply. - * - * \code - * PoolQuery q; - * q.addAttribute(sat::SolvAttr::name, "lib*"); - * q.setMatchGlob(); - * - * // get the best matches and tag them for installation: - * PoolItemBest bestMatches( q.begin(), q.end() ); - * if ( ! bestMatches.empty() ) - * { - * for_( it, bestMatches.begin(), bestMatches.end() ) - * { - * ui::asSelectable()( *it )->setOnSystem( *it, ResStatus::USER ); - * } - * } - * \endcode - * - * \todo Support arbitrary Predicates. - */ - class PoolItemBest - { - typedef std::tr1::unordered_map Container; - public: - /** Predicate returning \c True if \a lhs is a better choice. */ - typedef boost::function Predicate; - - typedef Container::size_type size_type; - typedef Container::value_type value_type; - typedef MapKVIteratorTraits::Value_const_iterator iterator; - typedef MapKVIteratorTraits::Key_const_iterator ident_iterator; - - public: - /** Default ctor. */ - PoolItemBest() - {} - - /** Ctor feeding a \ref sat::Solvable. */ - PoolItemBest( sat::Solvable slv_r ) - { _ctor_init(); add( slv_r ); } - - /** Ctor feeding a \ref PoolItem. */ - PoolItemBest( const PoolItem & pi_r ) - { _ctor_init(); add( pi_r ); } - - /** Ctor feeding a range of \ref sat::Solvable or \ref PoolItem. */ - template - PoolItemBest( _Iterator begin_r, _Iterator end_r ) - { _ctor_init(); add( begin_r, end_r ); } - - public: - /** Feed one \ref sat::Solvable. */ - void add( sat::Solvable slv_r ) - { add( PoolItem( slv_r ) ); } - - /** Feed one \ref PoolItem. */ - void add( const PoolItem & pi_r ); - - /** Feed a range of \ref sat::Solvable or \ref PoolItem. */ - template - void add( _Iterator begin_r, _Iterator end_r ) - { - for_( it, begin_r, end_r ) - add( *it ); - } - - public: - /** \name Iterate the collected PoolItems. */ - //@{ - /** Whether PoolItems were collected. */ - bool empty() const { return container().empty(); } - /** Number of PoolItems collected. */ - size_type size() const { return container().size(); } - /** Pointer to the first PoolItem. */ - iterator begin() const { return make_map_value_begin( container() ); } - /** Pointer behind the last PoolItem. */ - iterator end() const { return make_map_value_end( container() ); } - - /** Return the collected \ref PoolItem with \ref sat::Solvable::ident \a ident_r. */ - PoolItem find( IdString ident_r ) const; - /** \overload Use Solvables ident string. */ - PoolItem find( sat::Solvable slv_r ) const { return find( slv_r.ident() ); } - /** \overload Use PoolItems ident string. */ - PoolItem find( const PoolItem & pi_r ) const { return find( pi_r.satSolvable().ident() ); } - //@} - - /** \name Iterate the collected PoolItems ident strings. */ - //@{ - /** Pointer to the first item. */ - ident_iterator identBegin() const { return make_map_key_begin( container() ); } - /** Pointer behind the last item. */ - ident_iterator identEnd() const { return make_map_key_end( container() ); } - //@} - - private: - void _ctor_init(); - const Container & container() const; - private: - /** Implementation */ - class Impl; - /** Pointer to implementation */ - RWCOW_pointer & pimpl() { return *(reinterpret_cast*>( _dont_use_this_use_pimpl.get() )); } - /** Pointer to implementation */ - const RWCOW_pointer & pimpl() const { return *(reinterpret_cast*>( _dont_use_this_use_pimpl.get() )); } - /** Avoid need to include Impl definition when inlined ctors (due to tepmlate) are provided. */ - shared_ptr _dont_use_this_use_pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolItemBest Stream output */ - std::ostream & operator<<( std::ostream & str, const PoolItemBest & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOLITEMBEST_H diff --git a/libzypp/zypp/PoolQuery.cc b/libzypp/zypp/PoolQuery.cc deleted file mode 100644 index 4e286b2..0000000 --- a/libzypp/zypp/PoolQuery.cc +++ /dev/null @@ -1,1743 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolQuery.cc - * -*/ -#include -#include - -#include "zypp/base/Gettext.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Algorithm.h" -#include "zypp/base/String.h" -#include "zypp/repo/RepoException.h" -#include "zypp/RelCompare.h" - -#include "zypp/sat/Pool.h" -#include "zypp/sat/Solvable.h" -#include "zypp/base/StrMatcher.h" - -#include "zypp/PoolQuery.h" - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "PoolQuery" - -using namespace std; -using namespace zypp::sat; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - // some Helpers and Predicates - ///////////////////////////////////////////////////////////////// - - bool isDependencyAttribute( sat::SolvAttr attr_r ) - { - static sat::SolvAttr deps[] = { - SolvAttr::provides, - SolvAttr::requires, - SolvAttr::recommends, - SolvAttr::obsoletes, - SolvAttr::conflicts, - SolvAttr::suggests, - SolvAttr::supplements, - SolvAttr::enhances, - }; - for_( it, arrayBegin(deps), arrayEnd(deps) ) - if ( *it == attr_r ) - return true; - return false; - } - - /** Whether the current capabilities edition range ovelaps and/or its solvables arch matches. - * Query asserts \a iter_r points to a capability and we - * have to check the range only. - */ - struct EditionRangePredicate - { - EditionRangePredicate( const Rel & op, const Edition & edition ) - : _range( op, edition ) - , _arch( Arch_empty ) - {} - EditionRangePredicate( const Rel & op, const Edition & edition, const Arch & arch ) - : _range( op, edition ) - , _arch( arch ) - {} - - bool operator()( sat::LookupAttr::iterator iter_r ) - { - if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch ) - return false; - - CapDetail cap( iter_r.id() ); - if ( ! cap.isSimple() ) - return false; - if ( cap.isNamed() ) // no range to match - return true; - return overlaps( Edition::MatchRange( cap.op(), cap.ed() ), _range ); - } - - std::string serialize() const - { - std::string ret( "EditionRange" ); - str::appendEscaped( ret, _range.op.asString() ); - str::appendEscaped( ret, _range.value.asString() ); - str::appendEscaped( ret, _arch.asString() ); - return ret; - } - - Edition::MatchRange _range; - Arch _arch; - }; - - /** Whether the current Solvables edition is within a given range and/or its arch matches. */ - struct SolvableRangePredicate - { - SolvableRangePredicate( const Rel & op, const Edition & edition ) - : _range( op, edition ) - , _arch( Arch_empty ) - {} - - SolvableRangePredicate( const Rel & op, const Edition & edition, const Arch & arch ) - : _range( op, edition ) - , _arch( arch ) - {} - - bool operator()( sat::LookupAttr::iterator iter_r ) - { - if ( !_arch.empty() && iter_r.inSolvable().arch() != _arch ) - return false; - return overlaps( Edition::MatchRange( Rel::EQ, iter_r.inSolvable().edition() ), _range ); - } - - std::string serialize() const - { - std::string ret( "SolvableRange" ); - str::appendEscaped( ret, _range.op.asString() ); - str::appendEscaped( ret, _range.value.asString() ); - str::appendEscaped( ret, _arch.asString() ); - return ret; - } - - Edition::MatchRange _range; - Arch _arch; - }; - - /** Whether the current capability matches a given one. - * Query asserts \a iter_r points to a capability and we - * have to check the match only. - */ - struct CapabilityMatchPredicate - { - CapabilityMatchPredicate( Capability cap_r ) - : _cap( cap_r ) - {} - - bool operator()( sat::LookupAttr::iterator iter_r ) const - { - return _cap.matches( iter_r.asType() ) == CapMatch::yes; - } - - std::string serialize() const - { - std::string ret( "CapabilityMatch" ); - str::appendEscaped( ret, _cap.asString() ); - return ret; - } - - Capability _cap; - }; - - ///////////////////////////////////////////////////////////////// - // - ///////////////////////////////////////////////////////////////// - /** Match data per attribtue. - * - * This includes the attribute itself, an optional \ref StrMatcher - * to restrict the query to certain string values, and an optional - * boolean \ref Predicate that may apply further restrictions that can - * not be expressed by the \ref strMatcher. - * - * Example for such a \ref predicate would be an additional edition range - * check whan looking for dependencies. The \ref strMatcher would - * find potential matches by looking at the dependencies name, the - * predicate will then check the edition ranges. - * - * As the \ref predicate takes an iterator pointing to the current - * match, it's also suitable for sub-structure (flexarray) inspection - * (\see \ref sat::LookupAttr::iterator::solvAttrSubEntry). - * - * \note: \see \ref addPredicate for further constraints. - */ - struct AttrMatchData - { - typedef function Predicate; - - static bool always( sat::LookupAttr::iterator ) { return true; } - static bool never( sat::LookupAttr::iterator ) { return false; } - - AttrMatchData() - {} - - AttrMatchData( sat::SolvAttr attr_r, const StrMatcher & strMatcher_r ) - : attr( attr_r ) - , strMatcher( strMatcher_r ) - {} - - AttrMatchData( sat::SolvAttr attr_r, const StrMatcher & strMatcher_r, - const Predicate & predicate_r, const std::string & predicateStr_r ) - : attr( attr_r ) - , strMatcher( strMatcher_r ) - , predicate( predicate_r ) - , predicateStr( predicateStr_r ) - {} - - /** A usable Predicate must provide a string serialization. - * As there is no \c operator== for \ref Predicate, we compare it's - * string representation instead. If you add new predicated, check the - * deserialization code in \ref deserialize. - */ - template - void addPredicate( const _Predicate & predicate_r ) - { - predicate = predicate_r; - predicateStr = predicate_r.serialize(); - } - - /** Dumb serialization. - * \code - * AttrMatchData ATTRIBUTE SEARCHSTRING [C|X] SERIALIZED_PREDICATE - * \endcode - */ - std::string serialize() const - { - std::string ret( "AttrMatchData" ); - str::appendEscaped( ret, attr.asString() ); - str::appendEscaped( ret, strMatcher.searchstring() ); - // TODO: Actually the flag should be serialized too, but for PoolQuery - // it's by now sufficient to differ between mode OTHER and others, - // i.e. whether to compile or not compile. - str::appendEscaped( ret, strMatcher.flags().mode() == Match::OTHER ? "C" : "X" ); - str::appendEscaped( ret, predicateStr ); - return ret; - } - - /** Dumb restore from serialized string. - * \throw Exception on parse error. - */ - static AttrMatchData deserialize( const std::string & str_r ) - { - std::vector words; - str::splitEscaped( str_r, std::back_inserter(words) ); - if ( words.empty() || words[0] != "AttrMatchData" ) - ZYPP_THROW( Exception( str::Str() << "Expecting AttrMatchData: " << str_r ) ); - if ( words.size() != 5 ) - ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) ); - - AttrMatchData ret; - ret.attr = sat::SolvAttr( words[1] ); - ret.strMatcher = StrMatcher( words[2] ); - if ( words[3] == "C" ) - ret.strMatcher.setFlags( Match::OTHER ); - ret.predicateStr = words[4]; - - // now the predicate - words.clear(); - str::splitEscaped( ret.predicateStr, std::back_inserter(words) ); - if ( ! words.empty() ) - { - if ( words[0] == "EditionRange" ) - { - switch( words.size() ) - { - case 3: - ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]) ); - break; - case 4: - ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) ); - break; - default: - ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) ); - break; - } - } - else if ( words[0] == "SolvableRange" ) - { - switch( words.size() ) - { - case 3: - ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]) ); - break; - case 4: - ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) ); - break; - default: - ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) ); - break; - } - } - else if ( words[0] == "CapabilityMatch" ) - { - if ( words.size() != 2 ) - ZYPP_THROW( Exception( str::Str() << "Wrong number of words: " << str_r ) ); - ret.predicate = CapabilityMatchPredicate( Capability(words[1]) ); - } - else - ZYPP_THROW( Exception( str::Str() << "Unknown predicate: " << str_r ) ); - } - return ret; - } - - sat::SolvAttr attr; - StrMatcher strMatcher; - Predicate predicate; - std::string predicateStr; - }; - - /** \relates AttrMatchData */ - inline std::ostream & operator<<( std::ostream & str, const AttrMatchData & obj ) - { - str << obj.attr << ": " << obj.strMatcher; - if ( obj.predicate ) - str << " +(" << obj.predicateStr << ")"; - return str; - } - - /** \relates AttrMatchData */ - inline bool operator==( const AttrMatchData & lhs, const AttrMatchData & rhs ) - { - return ( lhs.attr == rhs.attr - && lhs.strMatcher == rhs.strMatcher - && lhs.predicateStr == rhs.predicateStr ); - } - - /** \relates AttrMatchData */ - inline bool operator!=( const AttrMatchData & lhs, const AttrMatchData & rhs ) - { return !( lhs == rhs ); } - - /** \relates AttrMatchData Arbitrary order for std::container. */ - inline bool operator<( const AttrMatchData & lhs, const AttrMatchData & rhs ) - { - if ( lhs.attr != rhs.attr ) - return ( lhs.attr < rhs.attr ); - if ( lhs.strMatcher != rhs.strMatcher ) - return ( lhs.strMatcher < rhs.strMatcher ); - if ( lhs.predicateStr != rhs.predicateStr ) - return ( lhs.predicateStr < rhs.predicateStr ); - return false; - } - - typedef std::list AttrMatchList; - - - } ///////////////////////////////////////////////////////////////// - // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQuery::Impl - // - /** */ - class PoolQuery::Impl - { - public: - Impl() - : _flags( Match::SUBSTRING | Match::NOCASE | Match::SKIP_KIND ) - , _match_word(false) - , _require_all(false) - , _status_flags(ALL) - {} - - ~Impl() - {} - - public: - /** String representation */ - string asString() const; - - /** \name Raw query options. */ - //@{ - /** Raw search strings. */ - StrContainer _strings; - /** Raw attributes */ - AttrRawStrMap _attrs; - /** Uncompiled attributes with predicate. */ - std::set _uncompiledPredicated; - - /** Sat solver search flags */ - Match _flags; - bool _match_word; - bool _require_all; - - /** Sat solver status flags */ - StatusFilter _status_flags; - - /** Edition condition operand */ - Edition _edition; - /** Operator for edition condition */ - Rel _op; - - /** Repos to search. */ - StrContainer _repos; - - /** Kinds to search */ - Kinds _kinds; - //@} - - public: - - bool operator==( const PoolQuery::Impl & rhs ) const - { - if ( _flags == rhs._flags - // bnc#792901: while libzypp uses exact match mode for a single - // package name lock, zypper always uses glob. :( - // We unify those two forms to enable zypper to remove zypp locks - // without need to actually evaluate the query (which would require - // repos to be loaded). - || ( ( ( _flags.isModeString() && rhs._flags.isModeGlob() ) - || ( _flags.isModeGlob() && rhs._flags.isModeString() ) ) - && _strings.empty() - && _attrs.size() == 1 - && _attrs.begin()->first == sat::SolvAttr::name ) ) - { - return ( _strings == rhs._strings - && _attrs == rhs._attrs - && _uncompiledPredicated == rhs._uncompiledPredicated - && _match_word == rhs._match_word - && _require_all == rhs._require_all - && _status_flags == rhs._status_flags - && _edition == rhs._edition - && _op == rhs._op - && _repos == rhs._repos - && _kinds == rhs._kinds ); - } - return false; - } - - bool operator!=( const PoolQuery::Impl & rhs ) const - { return ! operator==( rhs ); } - - public: - /** Compile the regex. - * Basically building the \ref _attrMatchList from strings. - * \throws MatchException Any of the exceptions thrown by \ref StrMatcher::compile. - */ - void compile() const; - - /** StrMatcher per attribtue. */ - mutable AttrMatchList _attrMatchList; - - private: - /** Pass flags from \ref compile, as they may have been changed. */ - string createRegex( const StrContainer & container, const Match & flags ) const; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - - /////////////////////////////////////////////////////////////////// - - struct MyInserter - { - MyInserter(PoolQuery::StrContainer & cont) : _cont(cont) {} - - bool operator()(const string & str) - { - _cont.insert(str); - return true; - } - - PoolQuery::StrContainer & _cont; - }; - - - struct EmptyFilter - { - bool operator()(const string & str) - { - return !str.empty(); - } - }; - - void PoolQuery::Impl::compile() const - { - _attrMatchList.clear(); - - Match cflags( _flags ); - if ( cflags.mode() == Match::OTHER ) // this will never succeed... - ZYPP_THROW( MatchUnknownModeException( cflags ) ); - - /** Compiled search strings. */ - string rcstrings; - - - // 'different' - will have to iterate through all and match by ourselves (slow) - // 'same' - will pass the compiled string to dataiterator_init - // 'one-attr' - will pass it to dataiterator_init - // 'one-non-regex-str' - will pass to dataiterator_init, set flag to SEARCH_STRING or SEARCH_SUBSTRING - - // // NO ATTRIBUTE - // else - // for all _strings - // create regex; store in rcstrings; if more strings flag regex; - if (_attrs.empty()) - { - ; // A default 'query-all' will be added after all sources are processed. - } - - // // ONE ATTRIBUTE - // else if _attrs is not empty but it contains just one attr - // for all _strings and _attr[key] strings - // create regex; flag 'one-attr'; if more strings flag regex; - else if (_attrs.size() == 1) - { - StrContainer joined; - invokeOnEach(_strings.begin(), _strings.end(), EmptyFilter(), MyInserter(joined)); - invokeOnEach(_attrs.begin()->second.begin(), _attrs.begin()->second.end(), EmptyFilter(), MyInserter(joined)); - rcstrings = createRegex(joined, cflags); - if (joined.size() > 1) // switch to regex for multiple strings - cflags.setModeRegex(); - _attrMatchList.push_back( AttrMatchData( _attrs.begin()->first, - StrMatcher( rcstrings, cflags ) ) ); - } - - // // MULTIPLE ATTRIBUTES - else - { - // check whether there are any per-attribute strings - bool attrvals_empty = true; - for (AttrRawStrMap::const_iterator ai = _attrs.begin(); ai != _attrs.end(); ++ai) - if (!ai->second.empty()) - for(StrContainer::const_iterator it = ai->second.begin(); - it != ai->second.end(); it++) - if (!it->empty()) - { - attrvals_empty = false; - goto attremptycheckend; - } -attremptycheckend: - - // chceck whether the per-attribute strings are all the same - bool attrvals_thesame = true; - AttrRawStrMap::const_iterator ai = _attrs.begin(); - const StrContainer & set1 = ai->second; - ++ai; - for (; ai != _attrs.end(); ++ai) - { - StrContainer result; - set_difference( - set1.begin(), set1.end(), - ai->second.begin(), ai->second.end(), - inserter(result, result.begin())/*, ltstr()*/); - if (!result.empty()) - { - attrvals_thesame = false; - break; - } - } - - // // THE SAME STRINGS FOR DIFFERENT ATTRS - // else if _attrs is not empty but it does not contain strings - // for each key in _attrs take all _strings - // create regex; store in rcstrings; flag 'same'; if more strings flag regex; - if (attrvals_empty || attrvals_thesame) - { - StrContainer joined; - if (attrvals_empty) - { - invokeOnEach(_strings.begin(), _strings.end(), EmptyFilter(), MyInserter(joined)); - rcstrings = createRegex(joined, cflags); - } - else - { - invokeOnEach(_strings.begin(), _strings.end(), EmptyFilter(), MyInserter(joined)); - invokeOnEach(_attrs.begin()->second.begin(), _attrs.begin()->second.end(), EmptyFilter(), MyInserter(joined)); - rcstrings = createRegex(joined, cflags); - } - if (joined.size() > 1) // switch to regex for multiple strings - cflags.setModeRegex(); - // May use the same StrMatcher for all - StrMatcher matcher( rcstrings, cflags ); - for_( ai, _attrs.begin(), _attrs.end() ) - { - _attrMatchList.push_back( AttrMatchData( ai->first, matcher ) ); - } - } - - // // DIFFERENT STRINGS FOR DIFFERENT ATTRS - // if _attrs is not empty and it contains non-empty vectors with non-empty strings - // for each key in _attrs take all _strings + all _attrs[key] strings - // create regex; flag 'different'; if more strings flag regex; - else - { - for_(ai, _attrs.begin(), _attrs.end()) - { - StrContainer joined; - invokeOnEach(_strings.begin(), _strings.end(), EmptyFilter(), MyInserter(joined)); - invokeOnEach(ai->second.begin(), ai->second.end(), EmptyFilter(), MyInserter(joined)); - string s = createRegex(joined, cflags); - if (joined.size() > 1) // switch to regex for multiple strings - cflags.setModeRegex(); - _attrMatchList.push_back( AttrMatchData( ai->first, - StrMatcher( s, cflags ) ) ); - } - } - } - - // Now handle any predicated queries - if ( ! _uncompiledPredicated.empty() ) - { - StrContainer global; - invokeOnEach( _strings.begin(), _strings.end(), EmptyFilter(), MyInserter(global) ); - for_( it, _uncompiledPredicated.begin(), _uncompiledPredicated.end() ) - { - if ( it->strMatcher.flags().mode() == Match::OTHER ) - { - // need to compile: - StrContainer joined( global ); - const std::string & mstr( it->strMatcher.searchstring() ); - if ( ! mstr.empty() ) - joined.insert( mstr ); - - cflags = _flags; - rcstrings = createRegex( joined, cflags ); - if ( joined.size() > 1 ) // switch to regex for multiple strings - cflags.setModeRegex(); - - _attrMatchList.push_back( AttrMatchData( it->attr, - StrMatcher( rcstrings, cflags ), - it->predicate, it->predicateStr ) ); - } - else - { - // copy matcher - _attrMatchList.push_back( *it ); - } - } - } - - // If no attributes defined at all, then add 'query all' - if ( _attrMatchList.empty() ) - { - cflags = _flags; - rcstrings = createRegex( _strings, cflags ); - if ( _strings.size() > 1 ) // switch to regex for multiple strings - cflags.setModeRegex(); - _attrMatchList.push_back( AttrMatchData( sat::SolvAttr::allAttr, - StrMatcher( rcstrings, cflags ) ) ); - } - - // Finally check here, whether all involved regex compile. - for_( it, _attrMatchList.begin(), _attrMatchList.end() ) - { - it->strMatcher.compile(); // throws on error - } - //DBG << asString() << endl; - } - - - /** - * Converts '*' and '?' wildcards within str into their regex equivalents. - */ - static string wildcards2regex(const string & str) - { - string regexed = str; - - string r_all(".*"); // regex equivalent of '*' - string r_one("."); // regex equivalent of '?' - string::size_type pos; - - // replace all "*" in input with ".*" - for (pos = 0; (pos = regexed.find("*", pos)) != std::string::npos; pos+=2) - regexed = regexed.replace(pos, 1, r_all); - - // replace all "?" in input with "." - for (pos = 0; (pos = regexed.find('?', pos)) != std::string::npos; ++pos) - regexed = regexed.replace(pos, 1, r_one); - - return regexed; - } - - string PoolQuery::Impl::createRegex( const StrContainer & container, const Match & flags ) const - { -//! macro for word boundary tags for regexes -#define WB (_match_word ? string("\\b") : string()) - string rstr; - - if (container.empty()) - return rstr; - - if (container.size() == 1) - { - return WB + *container.begin() + WB; - } - - // multiple strings - - bool use_wildcards = flags.isModeGlob(); - StrContainer::const_iterator it = container.begin(); - string tmp; - - if (use_wildcards) - tmp = wildcards2regex(*it); - else - tmp = *it; - - if (_require_all) - { - if ( ! flags.isModeString() ) // not match exact - tmp += ".*" + WB + tmp; - rstr = "(?=" + tmp + ")"; - } - else - { - if ( flags.isModeString() || flags.isModeGlob() ) - rstr = "^"; - rstr += WB + "(" + tmp; - } - - ++it; - - for (; it != container.end(); ++it) - { - if (use_wildcards) - tmp = wildcards2regex(*it); - else - tmp = *it; - - if (_require_all) - { - if ( ! flags.isModeString() ) // not match exact - tmp += ".*" + WB + tmp; - rstr += "(?=" + tmp + ")"; - } - else - { - rstr += "|" + tmp; - } - } - - if (_require_all) - { - if ( ! flags.isModeString() ) // not match exact - rstr += WB + ".*"; - } - else - { - rstr += ")" + WB; - if ( flags.isModeString() || flags.isModeGlob() ) - rstr += "$"; - } - - return rstr; -#undef WB - } - - string PoolQuery::Impl::asString() const - { - ostringstream o; - - o << "kinds: "; - if ( _kinds.empty() ) - o << "ALL"; - else - { - for(Kinds::const_iterator it = _kinds.begin(); - it != _kinds.end(); ++it) - o << *it << " "; - } - o << endl; - - o << "repos: "; - if ( _repos.empty() ) - o << "ALL"; - else - { - for(StrContainer::const_iterator it = _repos.begin(); - it != _repos.end(); ++it) - o << *it << " "; - } - o << endl; - - o << "version: "<< _op << " " << _edition.asString() << endl; - o << "status: " << ( _status_flags ? ( _status_flags == INSTALLED_ONLY ? "INSTALLED_ONLY" : "UNINSTALLED_ONLY" ) - : "ALL" ) << endl; - - o << "string match flags: " << Match(_flags) << endl; - - // raw - o << "strings: "; - for(StrContainer::const_iterator it = _strings.begin(); - it != _strings.end(); ++it) - o << *it << " "; - o << endl; - - o << "attributes: " << endl; - for(AttrRawStrMap::const_iterator ai = _attrs.begin(); ai != _attrs.end(); ++ai) - { - o << "* " << ai->first << ": "; - for(StrContainer::const_iterator vi = ai->second.begin(); - vi != ai->second.end(); ++vi) - o << *vi << " "; - o << endl; - } - - o << "predicated: " << endl; - for_( it, _uncompiledPredicated.begin(), _uncompiledPredicated.end() ) - { - o << "* " << *it << endl; - } - - // compiled - o << "last attribute matcher compiled: " << endl; - if ( _attrMatchList.empty() ) - { - o << "not yet compiled" << endl; - } - else - { - for_( it, _attrMatchList.begin(), _attrMatchList.end() ) - { - o << "* " << *it << endl; - } - } - return o.str(); - } - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQuery - // - /////////////////////////////////////////////////////////////////// - - PoolQuery::PoolQuery() - : _pimpl(new Impl()) - {} - - PoolQuery::~PoolQuery() - {} - - void PoolQuery::addRepo(const std::string &repoalias) - { - if (repoalias.empty()) - { - WAR << "ignoring an empty repository alias" << endl; - return; - } - _pimpl->_repos.insert(repoalias); - } - - void PoolQuery::addKind(const ResKind & kind) - { _pimpl->_kinds.insert(kind); } - - void PoolQuery::addString(const string & value) - { _pimpl->_strings.insert(value); } - - void PoolQuery::addAttribute(const sat::SolvAttr & attr, const std::string & value) - { _pimpl->_attrs[attr].insert(value); } - - void PoolQuery::addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition ) - { return addDependency( attr, name, op, edition, Arch_empty ); } - - void PoolQuery::addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition, const Arch & arch ) - { - switch ( op.inSwitch() ) - { - case Rel::ANY_e: // no additional constraint on edition. - if ( arch.empty() ) // no additional constraint on arch. - { - addAttribute( attr, name ); - return; - } - break; - - case Rel::NONE_e: // will never match. - return; - - default: // go and add the predicated query (uncompiled) - break; - } - - // Match::OTHER indicates need to compile - // (merge global search strings into name). - AttrMatchData attrMatchData( attr, StrMatcher( name, Match::OTHER ) ); - - if ( isDependencyAttribute( attr ) ) - attrMatchData.addPredicate( EditionRangePredicate( op, edition, arch ) ); - else - attrMatchData.addPredicate( SolvableRangePredicate( op, edition, arch ) ); - - _pimpl->_uncompiledPredicated.insert( attrMatchData ); - } - - void PoolQuery::addDependency( const sat::SolvAttr & attr, Capability cap_r ) - { - CapDetail cap( cap_r ); - if ( ! cap.isSimple() ) // will never match. - return; - - // Matches STRING per default. (won't get compiled!) - AttrMatchData attrMatchData( attr, StrMatcher( cap.name().asString() ) ); - - if ( isDependencyAttribute( attr ) ) - attrMatchData.addPredicate( CapabilityMatchPredicate( cap_r ) ); - else - attrMatchData.addPredicate( SolvableRangePredicate( cap.op(), cap.ed() ) ); - - _pimpl->_uncompiledPredicated.insert( attrMatchData ); - } - - void PoolQuery::setEdition(const Edition & edition, const Rel & op) - { - _pimpl->_edition = edition; - _pimpl->_op = op; - } - - void PoolQuery::setMatchSubstring() { _pimpl->_flags.setModeSubstring(); } - void PoolQuery::setMatchExact() { _pimpl->_flags.setModeString(); } - void PoolQuery::setMatchRegex() { _pimpl->_flags.setModeRegex(); } - void PoolQuery::setMatchGlob() { _pimpl->_flags.setModeGlob(); } - void PoolQuery::setMatchWord() - { - _pimpl->_match_word = true; - _pimpl->_flags.setModeRegex(); - } - - Match PoolQuery::flags() const - { return _pimpl->_flags; } - void PoolQuery::setFlags( const Match & flags ) - { _pimpl->_flags = flags; } - - - void PoolQuery::setInstalledOnly() - { _pimpl->_status_flags = INSTALLED_ONLY; } - void PoolQuery::setUninstalledOnly() - { _pimpl->_status_flags = UNINSTALLED_ONLY; } - void PoolQuery::setStatusFilterFlags( PoolQuery::StatusFilter flags ) - { _pimpl->_status_flags = flags; } - - - void PoolQuery::setRequireAll(bool require_all) - { _pimpl->_require_all = require_all; } - - - const PoolQuery::StrContainer & - PoolQuery::strings() const - { return _pimpl->_strings; } - - const PoolQuery::AttrRawStrMap & - PoolQuery::attributes() const - { return _pimpl->_attrs; } - - const PoolQuery::StrContainer & - PoolQuery::attribute(const sat::SolvAttr & attr) const - { - static const PoolQuery::StrContainer nocontainer; - AttrRawStrMap::const_iterator it = _pimpl->_attrs.find(attr); - return it != _pimpl->_attrs.end() ? it->second : nocontainer; - } - - const Edition PoolQuery::edition() const - { return _pimpl->_edition; } - const Rel PoolQuery::editionRel() const - { return _pimpl->_op; } - - - const PoolQuery::Kinds & - PoolQuery::kinds() const - { return _pimpl->_kinds; } - - const PoolQuery::StrContainer & - PoolQuery::repos() const - { return _pimpl->_repos; } - - - bool PoolQuery::caseSensitive() const - { return !_pimpl->_flags.test( Match::NOCASE ); } - void PoolQuery::setCaseSensitive( bool value ) - { _pimpl->_flags.turn( Match::NOCASE, !value ); } - - bool PoolQuery::filesMatchFullPath() const - { return _pimpl->_flags.test( Match::FILES ); } - void PoolQuery::setFilesMatchFullPath( bool value ) - { _pimpl->_flags.turn( Match::FILES, value ); } - - bool PoolQuery::matchExact() const { return _pimpl->_flags.isModeString(); } - bool PoolQuery::matchSubstring() const { return _pimpl->_flags.isModeSubstring(); } - bool PoolQuery::matchGlob() const { return _pimpl->_flags.isModeGlob(); } - bool PoolQuery::matchRegex() const { return _pimpl->_flags.isModeRegex(); } - - bool PoolQuery::matchWord() const - { return _pimpl->_match_word; } - - bool PoolQuery::requireAll() const - { return _pimpl->_require_all; } - - PoolQuery::StatusFilter PoolQuery::statusFilterFlags() const - { return _pimpl->_status_flags; } - - bool PoolQuery::empty() const - { - try { return begin() == end(); } - catch (const Exception & ex) {} - return true; - } - - PoolQuery::size_type PoolQuery::size() const - { - try - { - size_type count = 0; - for_( it, begin(), end() ) - ++count; - return count; - } - catch (const Exception & ex) {} - return 0; - } - - void PoolQuery::execute(ProcessResolvable fnc) - { invokeOnEach( begin(), end(), fnc); } - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQuery::Attr - // - /** - * represents all atributes in PoolQuery except SolvAtributes, which are - * used as is (not needed extend anything if someone adds new solv attr) - */ - struct PoolQueryAttr : public IdStringType - { - private: - friend class IdStringType; - IdString _str; - public: - - //noAttr - PoolQueryAttr(){} - - explicit PoolQueryAttr( const char* cstr_r ) - : _str( cstr_r ) - {} - - explicit PoolQueryAttr( const std::string & str_r ) - : _str( str_r ) - {} - - // unknown atributes - static const PoolQueryAttr noAttr; - - // PoolQuery's own attributes - static const PoolQueryAttr repoAttr; - static const PoolQueryAttr kindAttr; - static const PoolQueryAttr stringAttr; - static const PoolQueryAttr stringTypeAttr; - static const PoolQueryAttr requireAllAttr; - static const PoolQueryAttr caseSensitiveAttr; - static const PoolQueryAttr installStatusAttr; - static const PoolQueryAttr editionAttr; - static const PoolQueryAttr complexAttr; - }; - - const PoolQueryAttr PoolQueryAttr::noAttr; - - const PoolQueryAttr PoolQueryAttr::repoAttr( "repo" ); - const PoolQueryAttr PoolQueryAttr::kindAttr( "type" ); - const PoolQueryAttr PoolQueryAttr::stringAttr( "query_string" ); - const PoolQueryAttr PoolQueryAttr::stringTypeAttr("match_type"); - const PoolQueryAttr PoolQueryAttr::requireAllAttr("require_all"); - const PoolQueryAttr PoolQueryAttr::caseSensitiveAttr("case_sensitive"); - const PoolQueryAttr PoolQueryAttr::installStatusAttr("install_status"); - const PoolQueryAttr PoolQueryAttr::editionAttr("version"); - const PoolQueryAttr PoolQueryAttr::complexAttr("complex"); - - class StringTypeAttr : public IdStringType - { - friend class IdStringType; - IdString _str; - - public: - StringTypeAttr(){} - explicit StringTypeAttr( const char* cstr_r ) - : _str( cstr_r ){} - explicit StringTypeAttr( const std::string & str_r ) - : _str( str_r ){} - - static const StringTypeAttr noAttr; - - static const StringTypeAttr exactAttr; - static const StringTypeAttr substringAttr; - static const StringTypeAttr regexAttr; - static const StringTypeAttr globAttr; - static const StringTypeAttr wordAttr; - }; - - const StringTypeAttr StringTypeAttr::noAttr; - - const StringTypeAttr StringTypeAttr::exactAttr("exact"); - const StringTypeAttr StringTypeAttr::substringAttr("substring"); - const StringTypeAttr StringTypeAttr::regexAttr("regex"); - const StringTypeAttr StringTypeAttr::globAttr("glob"); - const StringTypeAttr StringTypeAttr::wordAttr("word"); - - /////////////////////////////////////////////////////////////////// - - - //\TODO maybe ctor with stream can be usefull - //\TODO let it throw, let it throw, let it throw. - bool PoolQuery::recover( istream &str, char delim ) - { - bool finded_something = false; //indicates some atributes is finded - string s; - do { - if ( str.eof() ) - break; - - getline( str, s, delim ); - - if ((!s.empty()) && s[0]=='#') //comment - { - continue; - } - - string::size_type pos = s.find(':'); - if (s.empty() || pos == s.npos) // some garbage on line... act like blank line - { - if (finded_something) //is first blank line after record? - { - break; - } - else - { - continue; - } - } - - finded_something = true; - - string attrName(str::trim(string(s,0,pos))); // trimmed name of atribute - string attrValue(str::trim(string(s,pos+1,s.npos))); //trimmed value - - PoolQueryAttr attribute( attrName ); - - if ( attribute==PoolQueryAttr::repoAttr ) - { - addRepo( attrValue ); - } - /* some backwards compatibility */ - else if ( attribute==PoolQueryAttr::kindAttr || attribute=="kind" ) - { - addKind( ResKind(attrValue) ); - } - else if ( attribute==PoolQueryAttr::stringAttr - || attribute=="global_string") - { - addString( attrValue ); - } - else if ( attribute==PoolQueryAttr::stringTypeAttr - || attribute=="string_type" ) - { - StringTypeAttr s(attrValue); - if( s == StringTypeAttr::regexAttr ) - { - setMatchRegex(); - } - else if ( s == StringTypeAttr::globAttr ) - { - setMatchGlob(); - } - else if ( s == StringTypeAttr::exactAttr ) - { - setMatchExact(); - } - else if ( s == StringTypeAttr::substringAttr ) - { - setMatchSubstring(); - } - else if ( s == StringTypeAttr::wordAttr ) - { - setMatchWord(); - } - else if ( s == StringTypeAttr::noAttr ) - { - WAR << "unknown string type " << attrValue << endl; - } - else - { - WAR << "forget recover some attribute defined as String type attribute: " << attrValue << endl; - } - } - else if ( attribute==PoolQueryAttr::requireAllAttr ) - { - if ( str::strToTrue(attrValue) ) - { - setRequireAll(true); - } - else if ( !str::strToFalse(attrValue) ) - { - setRequireAll(false); - } - else - { - WAR << "unknown boolean value " << attrValue << endl; - } - } - else if ( attribute==PoolQueryAttr::caseSensitiveAttr ) - { - if ( str::strToTrue(attrValue) ) - { - setCaseSensitive(true); - } - else if ( !str::strToFalse(attrValue) ) - { - setCaseSensitive(false); - } - else - { - WAR << "unknown boolean value " << attrValue << endl; - } - } - else if ( attribute==PoolQueryAttr::installStatusAttr ) - { - if( attrValue == "all" ) - { - setStatusFilterFlags( ALL ); - } - else if( attrValue == "installed" ) - { - setInstalledOnly(); - } - else if( attrValue == "not-installed" ) - { - setUninstalledOnly(); - } - else - { - WAR << "Unknown value for install status " << attrValue << endl; - } - } - else if ( attribute == PoolQueryAttr::editionAttr) - { - string::size_type pos; - Rel rel("=="); - if (attrValue.find_first_of("=<>!") == 0) - { - pos = attrValue.find_last_of("=<>"); - rel = Rel(attrValue.substr(0, pos+1)); - attrValue = str::trim(attrValue.substr(pos+1, attrValue.npos)); - } - - setEdition(Edition(attrValue), rel); - } - else if ( attribute == PoolQueryAttr::complexAttr ) - { - try - { - _pimpl->_uncompiledPredicated.insert( AttrMatchData::deserialize( attrValue ) ); - } - catch ( const Exception & err ) - { - WAR << "Unparsable value for complex: " << err.asUserHistory() << endl; - - } - } - else if ( attribute==PoolQueryAttr::noAttr ) - { - WAR << "empty attribute name" << endl; - } - else - { - string s = attrName; - str::replaceAll( s,"_",":" ); - SolvAttr a(s); - if ( a == SolvAttr::name || isDependencyAttribute( a ) ) - { - Capability c( attrValue ); - CapDetail d( c ); - if ( d.isVersioned() ) - addDependency( a, d.name().asString(), d.op(), d.ed() ); - else - addDependency( a, attrValue ); - } - else - addAttribute( a, attrValue ); - } - - } while ( true ); - - return finded_something; - } - - void PoolQuery::serialize( ostream &str, char delim ) const - { - //separating delim - str << delim; - //iterate thrue all settings and write it - static const zypp::PoolQuery q; //not save default options, so create default query example - - for_( it, repos().begin(), repos().end() ) - { - str << "repo: " << *it << delim ; - } - - for_( it, kinds().begin(), kinds().end() ) - { - str << PoolQueryAttr::kindAttr.asString() << ": " - << it->idStr() << delim ; - } - - if (editionRel() != Rel::ANY && edition() != Edition::noedition) - str << PoolQueryAttr::editionAttr.asString() << ": " << editionRel() << " " << edition() << delim; - - if (matchMode()!=q.matchMode()) - { - switch( matchMode() ) - { - case Match::STRING: - str << PoolQueryAttr::stringTypeAttr.asString() << ": exact" << delim; - break; - case Match::SUBSTRING: - str << PoolQueryAttr::stringTypeAttr.asString() - << ": substring" << delim; - break; - case Match::GLOB: - str << PoolQueryAttr::stringTypeAttr.asString() << ": glob" << delim; - break; - case Match::REGEX: - str << PoolQueryAttr::stringTypeAttr.asString() << ": regex" << delim; - break; - default: - WAR << "unknown match type " << matchMode() << endl; - } - } - - if( caseSensitive() != q.caseSensitive() ) - { - str << "case_sensitive: "; - if (caseSensitive()) - { - str << "on" << delim; - } - else - { - str << "off" << delim; - } - } - - if( requireAll() != q.requireAll() ) - { - str << "require_all: "; - if (requireAll()) - { - str << "on" << delim; - } - else - { - str << "off" << delim; - } - } - - if( statusFilterFlags() != q.statusFilterFlags() ) - { - switch( statusFilterFlags() ) - { - case ALL: - str << "install_status: all" << delim; - break; - case INSTALLED_ONLY: - str << "install_status: installed" << delim; - break; - case UNINSTALLED_ONLY: - str << "install_status: not-installed" << delim; - break; - } - } - - for_( it, strings().begin(), strings().end() ) - { - str << PoolQueryAttr::stringAttr.asString()<< ": " << *it << delim; - } - - for_( it, attributes().begin(), attributes().end() ) - { - string s = it->first.asString(); - str::replaceAll(s,":","_"); - for_( it2,it->second.begin(),it->second.end() ) - { - str << s <<": "<< *it2 << delim; - } - } - - for_( it, _pimpl->_uncompiledPredicated.begin(), _pimpl->_uncompiledPredicated.end() ) - { - str << "complex: "<< it->serialize() << delim; - } - - //separating delim - protection - str << delim; - } - - string PoolQuery::asString() const - { return _pimpl->asString(); } - - ostream & operator<<( ostream & str, const PoolQuery & obj ) - { return str << obj.asString(); } - - std::ostream & dumpOn( std::ostream & str, const PoolQuery & obj ) - { return dumpRange( str << obj, obj.begin(), obj.end() ); } - - bool PoolQuery::operator==( const PoolQuery & rhs ) const - { return *_pimpl == *rhs._pimpl; } - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQueryMatcher - // - /** Store \ref PoolQuery settings and assist \ref PoolQueryIterator. - * - * Basically the matcher performs a base query, which should preselect - * candidates for a match. And has some filter conditions on top of it. - * Query and fileter depend on the \ref PoolQuery settings. - * - * Matcher must be stateless, as it is shared between multiple - * \ref PoolQueryIterator instances. - * - * If \ref base_iterator is at the \ref end, \ref advance moves it - * to the first match. Otherwise advance moves to the next match, or - * to the \ref end, if there is no more match. - * - * \note The original implementation treated an empty search string as - * "match always". We stay compatible. - */ - class PoolQueryMatcher - { - public: - typedef sat::LookupAttr::iterator base_iterator; - - public: - const base_iterator & end() const - { - static base_iterator _end; - return _end; - } - - bool advance( base_iterator & base_r ) const - { - if ( base_r == end() ) - base_r = startNewQyery(); // first candidate - else - { - base_r.nextSkipSolvable(); // assert we don't visit this Solvable again - ++base_r; // advance to next candidate - } - - while ( base_r != end() ) - { - if ( isAMatch( base_r ) ) - return true; - // No match: try next - ++base_r; - } - return false; - } - - /** Provide all matching attributes within this solvable. - * - */ - void matchDetail( const base_iterator & base_r, std::vector & return_r ) const - { - if ( base_r == end() ) - return; - - sat::Solvable inSolvable( base_r.inSolvable() ); - - if ( _attrMatchList.size() == 1 ) - { - // base_r is already on the 1st matching attribute! - // String matching is done by the base iterator. We must check the predicate here. - // Let's see if there are more matches for this solvable: - base_iterator base( base_r ); - base.stayInThisSolvable(); // avoid discarding matches we found far away from here. - return_r.push_back( base ); - - const AttrMatchData::Predicate & predicate( _attrMatchList.front().predicate ); - for ( ++base; base.inSolvable() == inSolvable; ++base ) // safe even if base == end() - { - if ( ! predicate || predicate( base ) ) - return_r.push_back( base ); - } - } - else - { - // Here: search all attributes ;( - for_( mi, _attrMatchList.begin(), _attrMatchList.end() ) - { - const AttrMatchData & matchData( *mi ); - sat::LookupAttr q( matchData.attr, inSolvable ); - if ( matchData.strMatcher ) // an empty searchstring matches always - q.setStrMatcher( matchData.strMatcher ); - - if ( ! q.empty() ) // there are matches. - { - // now check any predicate: - const AttrMatchData::Predicate & predicate( matchData.predicate ); - for_( it, q.begin(), q.end() ) - { - if ( ! predicate || predicate( it ) ) - return_r.push_back( it ); - } - } - } - } - } - - public: - /** Ctor stores the \ref PoolQuery settings. - * \throw MatchException Any of the exceptions thrown by \ref PoolQuery::Impl::compile. - */ - PoolQueryMatcher( const shared_ptr & query_r ) - { - query_r->compile(); - - // Repo restriction: - sat::Pool satpool( sat::Pool::instance() ); - - for_( it, query_r->_repos.begin(), query_r->_repos.end() ) - { - Repository r( satpool.reposFind( *it ) ); - if ( r ) - _repos.insert( r ); - else - _neverMatchRepo = true; - } - // _neverMatchRepo: we just need to catch the case that no repo - // matched, so we'd interpret the empty list as 'take from all' - if ( _neverMatchRepo && ! _repos.empty() ) - _neverMatchRepo = false; - - // Kind restriction: - _kinds = query_r->_kinds; - // Edition restriction: - _op = query_r->_op; - _edition = query_r->_edition; - // Status restriction: - _status_flags = query_r->_status_flags; - // StrMatcher - _attrMatchList = query_r->_attrMatchList; - } - - ~PoolQueryMatcher() - {} - - private: - /** Initialize a new base query. */ - base_iterator startNewQyery() const - { - sat::LookupAttr q; - - if ( _neverMatchRepo ) - return q.end(); - - // Repo restriction: - if ( _repos.size() == 1 ) - q.setRepo( *_repos.begin() ); - // else: handled in isAMatch. - - // Attribute restriction: - if ( _attrMatchList.size() == 1 ) // all (SolvAttr::allAttr) or 1 attr - { - const AttrMatchData & matchData( _attrMatchList.front() ); - q.setAttr( matchData.attr ); - if ( matchData.strMatcher ) // empty searchstring matches always - q.setStrMatcher( matchData.strMatcher ); - } - else // more than 1 attr (but not all) - { - // no restriction, it's all handled in isAMatch. - q.setAttr( sat::SolvAttr::allAttr ); - } - - return q.begin(); - } - - - /** Check whether we are on a match. - * - * The check covers the whole Solvable, not just the current - * attribute \c base_r points to. If there's no match, also - * prepare \c base_r to advance appropriately. If there is - * a match, simply return \c true. \ref advance always moves - * to the next Solvable if there was a match. - * - * \note: Caller asserts we're not at \ref end. - */ - bool isAMatch( base_iterator & base_r ) const - { - ///////////////////////////////////////////////////////////////////// - Repository inRepo( base_r.inRepo() ); - // Status restriction: - if ( _status_flags - && ( (_status_flags == PoolQuery::INSTALLED_ONLY) != inRepo.isSystemRepo() ) ) - { - base_r.nextSkipRepo(); - return false; - } - // Repo restriction: - if ( _repos.size() > 1 && _repos.find( inRepo ) == _repos.end() ) - { - base_r.nextSkipRepo(); - return false; - } - ///////////////////////////////////////////////////////////////////// - sat::Solvable inSolvable( base_r.inSolvable() ); - // Kind restriction: - if ( ! _kinds.empty() && ! inSolvable.isKind( _kinds.begin(), _kinds.end() ) ) - { - base_r.nextSkipSolvable(); - return false; - } - - // Edition restriction: - if ( _op != Rel::ANY && !compareByRel( _op, inSolvable.edition(), _edition, Edition::Match() ) ) - { - base_r.nextSkipSolvable(); - return false; - } - ///////////////////////////////////////////////////////////////////// - // string and predicate matching: - - if ( _attrMatchList.size() == 1 ) - { - // String matching was done by the base iterator. - // Now check any predicate: - const AttrMatchData::Predicate & predicate( _attrMatchList.front().predicate ); - if ( ! predicate || predicate( base_r ) ) - return true; - - return false; // no skip as there may be more occurrences od this attr. - } - - // Here: search all attributes ;( - for_( mi, _attrMatchList.begin(), _attrMatchList.end() ) - { - const AttrMatchData & matchData( *mi ); - sat::LookupAttr q( matchData.attr, inSolvable ); - if ( matchData.strMatcher ) // an empty searchstring matches always - q.setStrMatcher( matchData.strMatcher ); - - if ( ! q.empty() ) // there are matches. - { - // now check any predicate: - const AttrMatchData::Predicate & predicate( matchData.predicate ); - if ( predicate ) - { - for_( it, q.begin(), q.end() ) - { - if ( predicate( it ) ) - return true; - } - } - else - return true; - } - } - base_r.nextSkipSolvable(); - return false; - } - - private: - /** Repositories include in the search. */ - std::set _repos; - DefaultIntegral _neverMatchRepo; - /** Resolvable kinds to include. */ - std::set _kinds; - /** Edition filter. */ - Rel _op; - Edition _edition; - /** Installed status filter flags. \see PoolQuery::StatusFilter */ - int _status_flags; - /** StrMatcher per attribtue. */ - AttrMatchList _attrMatchList; - }; - /////////////////////////////////////////////////////////////////// - - void PoolQueryIterator::increment() - { - // matcher restarts if at end! It is called from the ctor - // to get the 1st match. But if the end is reached, it should - // be deleted, otherwise we'd start over again. - if ( !_matcher ) - return; // at end - if ( _matches ) - _matches.reset(); // invalidate old matches - if ( ! _matcher->advance( base_reference() ) ) - _matcher.reset(); - } - - const PoolQueryIterator::Matches & PoolQueryIterator::matches() const - { - if ( _matches ) - return *_matches; - - if ( !_matcher ) - { - // at end of query: - static const Matches _none; - return _none; - } - - _matches.reset( new Matches ); - _matcher->matchDetail( base_reference(), *_matches ); - return *_matches; - } - - std::ostream & dumpOn( std::ostream & str, const PoolQueryIterator & obj ) - { - str << *obj; - if ( ! obj.matchesEmpty() ) - { - for_( it, obj.matchesBegin(), obj.matchesEnd() ) - { - str << endl << " " << it->inSolvAttr() << "\t" << it->asString(); - } - } - return str; - } - - /////////////////////////////////////////////////////////////////// - } //namespace detail - /////////////////////////////////////////////////////////////////// - - detail::PoolQueryIterator PoolQuery::begin() const - { - return shared_ptr( new detail::PoolQueryMatcher( _pimpl.getPtr() ) ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/PoolQuery.h b/libzypp/zypp/PoolQuery.h deleted file mode 100644 index aeb3b4b..0000000 --- a/libzypp/zypp/PoolQuery.h +++ /dev/null @@ -1,623 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolQuery.h - * -*/ -#ifndef ZYPP_POOLQUERY_H -#define ZYPP_POOLQUERY_H - -#include -#include -#include - -#include "zypp/base/Regex.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" - -#include "zypp/sat/SolvIterMixin.h" -#include "zypp/sat/LookupAttr.h" -#include "zypp/base/StrMatcher.h" -#include "zypp/sat/Pool.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace detail - { - class PoolQueryIterator; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQuery - // - /** - * Meta-data query API. Returns solvables of specified kinds from specified - * repositories with attributes matching the specified search strings. - * - * The search strings can be specified via \ref addString() and - * \ref addAttribute() methods. String matching type can be set using the - * setMatch*() methods. Multiple search strings for a particular attribute - * will be combined into a regex (see \ref addString() and - * \ref addAttribute() for more details). - * - * The begin() and end() methods return a PoolQueryIterator returning - * \ref sat::Solvable objects which can easily be turned into \ref Resolvable - * objects. Additionally, thanx to the \ref sat::SolvIterMixin, a Selectable - * and PoolItem iterators are automatically available. - * - * \note You will sometimes face the problem, that when using the \ref PoolItem - * iterator you hit multiple version of the same package, while when using the - * \ref ui::Selectable iterator the information which of the available candidates - * actually matched got lost. In this case class \ref PoolItemBest may help you. - * Use it to pick the best version only. - * - * - * PoolQuery q; - * q.addAttribute(sat::SolvAttr::name, "zypp*"); - * q.addKind(ResKind::package); - * q.setMatchGlob(); - * - * for (PoolQuery::Selectable_iterator it = q.selectableBegin(); - * it != q.selectableEnd(); ++it) - * { - * ui::Selectable::constPtr s = *it; - * // ... - * } - * - * - * Performance considerations - * - * Results of simple queries like those using one string and/or one attribute - * and/or one repository are filtered by sat-solver's Dataiterator directly, - * and thus it is fast. - * - * Queries with multiple strings are implemented using regexes. Queries based - * on kinds, multiple repos, and multiple attributes are filtered inside - * the PoolQuery, so these tend to be slower. - * - * \see detail::PoolQueryIterator on how to inspect matches in detail. - * \see tests/zypp/PoolQuery_test.cc for more examples - * \see sat::SolvIterMixin - */ - class PoolQuery : public sat::SolvIterMixin - { - public: - typedef std::set Kinds; - typedef std::set StrContainer; - typedef std::map AttrRawStrMap; - - typedef detail::PoolQueryIterator const_iterator; - typedef unsigned int size_type; - - public: - typedef function ProcessResolvable; - - PoolQuery(); - ~PoolQuery(); - - /** Query result accessers. */ - //@{ - /** - * Compile the query and return an iterator to the result. - * - * \return An iterator (\ref detail::PoolQueryIterator) returning - * sat::Solvable objects pointing at the beginning of the query result. - * \throws sat::MatchInvalidRegexException if the query was about to use a regex which - * failed to compile. - * - * \note Note that PoolQuery is derived from \ref sat::SolvIterMixin which - * makes PoolItem and Selectable iterators automatically available. - * \see \ref sat::SolvIterMixin - */ - const_iterator begin() const; - - /** An iterator pointing to the end of the query result. */ - const_iterator end() const; - - /** Whether the result is empty. */ - bool empty() const; - - /** Number of solvables in the query result. */ - size_type size() const; - //@} - - /** - * Executes the query with the current settings. - * Results are yielded via the \a fnc callback. - */ - void execute(ProcessResolvable fnc); - - /** - * Filter by selectable kind. - * - * By default, all kinds will be returned. If addKind() is used, - * only the specified kinds will be returned (multiple kinds will be ORed). - * - * Pass ResKind constants to this method, (e.g. ResKind::package). - */ - void addKind(const ResKind & kind); - - /** - * Filter by repo. - * - * By default, all repos will be returned. If addRepo() is used, - * only the specified repo will be returned (multiple repos will be ORed). - */ - void addRepo(const std::string &repoalias); - - /** Installed status filter setters. */ - //@{ - - /** - * Filter by status (installed uninstalled) - */ - enum StatusFilter { - ALL = 0, // both install filter and uninstall filter bits are 0 - INSTALLED_ONLY = 1, - UNINSTALLED_ONLY = 2 - }; - - /** Return only @System repo packages */ - void setInstalledOnly(); - /** Return only packages from repos other than @System. */ - void setUninstalledOnly(); - /** Set status filter directly \see StatusFilter */ - void setStatusFilterFlags( StatusFilter flags ); - - //@} - - /** - * Add a global query string. The string added via this method is applied - * to all query attributes as if addAttribute(..., \value) was called - * for all of them. - * - * This method can be used multiple times in which case the query strings - * will be combined (together with strings added via addAttribute()) into - * a regex. Searched attribute value will match this regex if any - * of these strings will match the value. This can be changed by - * (not yet implemented) \ref setRequireAll() method. - */ - void addString(const std::string & value); - - /** - * Filter by the \a value of the specified \a attr attribute. This can - * be any of the available solvable attributes. - * - * This method can be used multiple times with the same \a attr in which - * case the query strings will be combined (together with strings added - * via addString()) into a regex. Searched attribute value will match - * this regex if any of these strings will match the value. - * This can be changed by (not yet implemented) \ref setRequireAll() - * method. - * - * \note Though it is possible to use dependency attributes like - * \ref Solv::Attr::provides here, note that the query string is - * matched against a dependencies \c "name" part only. Any - * "op edition" part of a \ref Capability is \b not - * considered at all. \see \ref addDependency on how to query for - * capabilities including edition ranges. - * - * \note Solvables of a kind not supporting the specified attribute will - * not be returned. - * \todo check the above - * - * \param attr Attribute identfier. Use sat::Solvattr::* constants - * \param value What to search for. - * - * \see sat::SolvAttr - */ - void addAttribute( const sat::SolvAttr & attr, const std::string & value = "" ); - - /** \name Filter by dependencies matching a broken down capability name [op edition] and/or architecture. - * - * The capabilities \c name part may be defined as query string - * like with \ref addAttribute. Globing and regex are supported. - * Global query strings defined by \ref addString are considered. - * - * So without any op edition arch addDependency behaves the - * same as \ref addAttribute. If an edition range is given, matches - * are restricted accordingly. There are various overloads, so pick - * the one you like best. - * - * An optional \c arch argument will additionally require the matching - * solvable to be of this arch. - * - * \code - * { - * setMatchGlob(); - * setCaseSensitive( false ); - * addDependency( sat::SolvAttr::provides, "kde*", Rel::EQ, Edition("2.0") ); - * addDependency( sat::SolvAttr::provides, "kde*", Edition("2.0") ); // same as above - * } - * { - * setMatchGlob(); - * setCaseSensitive( false ); - * addString( "kde*" ); - * addDependency( sat::SolvAttr::provides, Rel::EQ, Edition("2.0") );// same as above - * addDependency( sat::SolvAttr::provides, Edition("2.0") ); // same as above - * } - * \endcode - * - * \note Thre's also a version of \ref addDependency provided, that takes a - * complete \ref Capability as argument. This always requires an exact match - * of the name part (as the resolver would do it). - * - * This is the list of valid dependency attributes: - * \code - * SolvAttr::provides - * SolvAttr::obsoletes - * SolvAttr::conflicts - * SolvAttr::requires - * SolvAttr::recommends - * SolvAttr::suggests - * SolvAttr::supplements - * SolvAttr::enhances - * \endcode - * - * \note What happens if a non dependency attribute is passed?<\b> - * If an edition range is given, it is matched against the matching - * solvables edition instead. Without edition range it behaves the - * same as \ref addAttribute. - * - * \code - * // Find all packages providing "kernel > 2.0" - * addDependency( sat::SolvAttr::provides, "kernel", Rel::GT, Edition("2.0") ); - * - * // // Find all packages named "kernel" and with edition "> 2.0" - * addDependency( sat::SolvAttr::name, "kernel", Rel::GT, Edition("2.0") ); - * \endcode - */ - //@{ - /** Query "name|global op edition". */ - void addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition ); - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition, const Arch & arch ); - - /** \overload Query "name|global == edition". */ - void addDependency( const sat::SolvAttr & attr, const std::string & name, const Edition & edition ) - { addDependency( attr, name, Rel::EQ, edition ); } - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const std::string & name, const Edition & edition, const Arch & arch ) - { addDependency( attr, name, Rel::EQ, edition, arch ); } - - /** \overload Query "name|global". */ - void addDependency( const sat::SolvAttr & attr, const std::string & name ) - { addDependency( attr, name, Rel::ANY, Edition() ); } - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const std::string & name, const Arch & arch ) - { addDependency( attr, name, Rel::ANY, Edition(), arch ); } - - /** \overload Query "global op edition".*/ - void addDependency( const sat::SolvAttr & attr, const Rel & op, const Edition & edition ) - { addDependency( attr, std::string(), op, edition ); } - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const Rel & op, const Edition & edition, const Arch & arch ) - { addDependency( attr, std::string(), op, edition, arch ); } - - /** \overload Query "global == edition". */ - void addDependency( const sat::SolvAttr & attr, const Edition & edition ) - { addDependency( attr, std::string(), Rel::EQ, edition ); } - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const Edition & edition, const Arch & arch ) - { addDependency( attr, std::string(), Rel::EQ, edition, arch ); } - - /** \overload Query "global". */ - void addDependency( const sat::SolvAttr & attr ) - { addDependency( attr, std::string(), Rel::ANY, Edition() ); } - /** \overload also restricting architecture */ - void addDependency( const sat::SolvAttr & attr, const Arch & arch ) - { addDependency( attr, std::string(), Rel::ANY, Edition(), arch ); } - - /** \overload Query taking a \ref Capability (always exact name match). - * \note If a non dependency attribute is passed, the \ref Capability - * will always be matched against the Solvables \c name and \c edition. - */ - void addDependency( const sat::SolvAttr & attr, Capability cap_r ); - //@} - - /** - * Set version condition. This will filter out solvables not matching - * solvableEdition \a op \a edition. - * - * \param edition Edition to look for. - * \param op Found-wanted relation operator. - */ - void setEdition(const Edition & edition, const Rel & op = Rel::EQ); - - /** \name Text Matching Options - * \note The implementation treats an empty search string as - * "match always". So if you want to actually match - * an empty value, try ( "^$", setMatchRegex ). - */ - //@{ - /** - * Turn case sentitivity on or off (unsets or sets \ref SEARCH_NOCASE flag). - * PoolQuery defaults to case insensitive search unless this method - * is used. - * - * \param value Whether to turn the case sensitivity on (default) or off. - */ - void setCaseSensitive( bool value = true ); - - /** - * If set (default), look at the full path when searching in filelists. - * Otherwise just match the the basenames. - * \see \ref Match::FILES - */ - void setFilesMatchFullPath( bool value = true ); - /** \overload */ - void setFilesMatchBasename( bool value = true ) - { setFilesMatchFullPath( !value ); } - - /** Set to match exact string instead of substring.*/ - void setMatchExact(); - /** Set to substring (the default). */ - void setMatchSubstring(); - /** Set to match globs. */ - void setMatchGlob(); - /** Set to use the query strings as regexes */ - void setMatchRegex(); - /** Set to match words (uses regex) */ - void setMatchWord(); - //void setLocale(const Locale & locale); - //@} - - /** - * Require that all of the values set by addString or addAttribute - * match the values of respective attributes. - * - * \todo doesn't work yet, don't use this function - */ - void setRequireAll( bool require_all = true ); - - - /** \name getters */ - //@{ - - /** Search strings added via addString() */ - const StrContainer & strings() const; - /** - * Map (map) of attribute values added via - * addAttribute(), addDep in string form */ - const AttrRawStrMap & attributes() const; - - const StrContainer & attribute(const sat::SolvAttr & attr) const; - - const Kinds & kinds() const; - - const StrContainer & repos() const; - - const Edition edition() const; - const Rel editionRel() const; - - /** - * returns true if search is case sensitive - */ - bool caseSensitive() const; - - /** Whether searching in filelists looks at the full path or just at the basenames. */ - bool filesMatchFullPath() const; - /** \overload */ - bool filesMatchBasename() const - { return !filesMatchFullPath(); } - - bool matchExact() const; - bool matchSubstring() const; - bool matchGlob() const; - bool matchRegex() const; - bool matchWord() const; - - /** Returns string matching mode as enum. - * \see \ref Match::Mode - */ - Match::Mode matchMode() const - { return flags().mode(); } - - /** - * Whether all values added via addString() or addAttribute() are required - * to match the values of the respective attributes. - */ - bool requireAll() const; - - StatusFilter statusFilterFlags() const; - //@} - - /** - * Reads from stream query. Attributes is sepated by delim. Query is - * separated by two delim. - * - * \param str input stream which contains query - * \param delim delimeter for attributes - * \return true if non-empty query is recovered - * - * \see readPoolQueriesFromFile - */ - bool recover( std::istream &str, char delim = '\n' ); - - /** - * Writes a machine-readable string representation of the query to stream. - * Use \a delim as attribute delimiter. - * - * \param str output stream to write to - * \param delim delimiter for attributes - * - * \see writePoolQueriesToFile - */ - void serialize( std::ostream &str, char delim = '\n' ) const; - - /** Return a human-readable description of the query */ - std::string asString() const; - - bool operator==(const PoolQuery& b) const; - bool operator!=(const PoolQuery& b) const { return !(*this == b ); } - - // low level API - - /** - * Free function to get libsolv repo search - * flags. - * - * \see \ref Match - */ - Match flags() const; - - /** - * Free function to set libsolv repo search - * flags. - * - * \see \ref Match - */ - void setFlags( const Match & flags ); - - public: - class Impl; - private: - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolQuery Stream output. */ - std::ostream & operator<<( std::ostream & str, const PoolQuery & obj ); - - /** \relates PoolQuery Detailed stream output. */ - std::ostream & dumpOn( std::ostream & str, const PoolQuery & obj ); - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - class PoolQueryMatcher; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQuery::PoolQueryIterator - // - /** \ref PoolQuery iterator as returned by \ref PoolQuery::begin. - * - * The \ref PoolQueryIterator visits sat::Solavables that do contain matches. - * - * But it also provides an iterator by itself, to allow a detailed inspection of - * the individual attribute matches within the current Solvable. - */ - class PoolQueryIterator : public boost::iterator_adaptor< - PoolQueryIterator // Derived - , sat::LookupAttr::iterator // Base - , const sat::Solvable // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , const sat::Solvable // Reference - > - { - typedef std::vector Matches; - public: - typedef Matches::size_type size_type; - typedef Matches::const_iterator matches_iterator; - public: - /** Default ctor is also \c end.*/ - PoolQueryIterator() - {} - - /** \Ref PoolQuery ctor. */ - PoolQueryIterator( const shared_ptr & matcher_r ) - : _matcher( matcher_r ) - { increment(); } - - /** \name Detailed inspection of attribute matches within the current Solvable. - * - * The \ref matches_iterator visits all attribute matches within the current Solvable, - * providing a \ref sat::LookupAttr::iterator pointing to attribute. While a - * \ref matches_iterator itself becomes invalid if the PoolQueryIterator is advanced, - * the \ref sat::LookupAttr::iterator it pointed to stays valid, even after the query - * ended. - * - * \code - * // Setup query for "libzypp" in name or requires: - * PoolQuery q; - * q.addString( "libzypp" ); - * q.setMatchSubstring(); - * q.setCaseSensitive( false ); - * q.addAttribute( sat::SolvAttr::name ); - * q.addDependency( sat::SolvAttr::requires ); - * - * // Iterate the result: - * for_( solvIter, q.begin(), q.end() ) - * { - * sat::Solvable solvable( *solvIter ); - * cout << "Found matches in " << solvable << endl; - * if ( verbose ) - * for_( attrIter, solvIter.matchesBegin(), solvIter.matchesEnd() ) - * { - * sat::LookupAttr::iterator attr( *attrIter ); - * cout << " " << attr.inSolvAttr() << "\t\"" << attr.asString() << "\"" << endl; - * } - * } - * - * - * Found matches in PackageKit-0.3.11-1.12.i586(@System) - * solvable:requires "libzypp.so.523" - * Found matches in libqdialogsolver1-1.2.6-1.1.2.i586(@System) - * solvable:requires "libzypp.so.523" - * solvable:requires "libzypp >= 5.25.3-0.1.2" - * Found matches in libzypp-5.30.3-0.1.1.i586(@System) - * solvable:name "libzypp" - * Found matches in libzypp-testsuite-tools-4.2.6-8.1.i586(@System) - * solvable:name "libzypp-testsuite-tools" - * solvable:requires "libzypp.so.523" - * ... - * \endcode - */ - //@{ - /** \c False unless this is the \c end iterator. */ - bool matchesEmpty() const { return ! _matcher; } - /** Number of attribute matches. */ - size_type matchesSize() const { return matches().size(); } - /** Begin of matches. */ - matches_iterator matchesBegin() const { return matches().begin(); } - /** End of matches. */ - matches_iterator matchesEnd() const { return matches().end(); } - //@} - - private: - friend class boost::iterator_core_access; - - sat::Solvable dereference() const - { return base_reference().inSolvable(); } - - void increment(); - - private: - const Matches & matches() const; - - private: - shared_ptr _matcher; - mutable shared_ptr _matches; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolQueryIterator Stream output. */ - inline std::ostream & operator<<( std::ostream & str, const PoolQueryIterator & obj ) - { return str << obj.base(); } - - /** \relates PoolQueryIterator Detailed stream output. */ - std::ostream & dumpOn( std::ostream & str, const PoolQueryIterator & obj ); - - /////////////////////////////////////////////////////////////////// - } //namespace detail - /////////////////////////////////////////////////////////////////// - - inline detail::PoolQueryIterator PoolQuery::end() const - { return detail::PoolQueryIterator(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif // ZYPP_POOLQUERY_H diff --git a/libzypp/zypp/PoolQueryResult.cc b/libzypp/zypp/PoolQueryResult.cc deleted file mode 100644 index c69f69c..0000000 --- a/libzypp/zypp/PoolQueryResult.cc +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolQueryResult.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/PoolQueryResult.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const PoolQueryResult & obj ) - { - return dumpRange( str, obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PoolQueryResult.h b/libzypp/zypp/PoolQueryResult.h deleted file mode 100644 index fded69a..0000000 --- a/libzypp/zypp/PoolQueryResult.h +++ /dev/null @@ -1,234 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolQueryResult.h - * -*/ -#ifndef ZYPP_POOLQUERYRESULT_H -#define ZYPP_POOLQUERYRESULT_H - -#include - -#include "zypp/base/Tr1hash.h" -#include "zypp/base/Exception.h" -#include "zypp/sat/SolvIterMixin.h" - -#include "zypp/PoolItem.h" -#include "zypp/PoolQuery.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolQueryResult - // - /** Helper class to collect (not only) \ref PoolQuery results. - * - * \note Unfortunately \ref PoolQuery::begin might throw. Exceptions - * are caught and the query is treated as empty. - * - * \ref PoolQueryResult maintains a set of \ref sat::Solvable. You can - * add/remove solvables to/from the set defined by: - * - * \li a single \ref sat::Solvable - * \li a single \ref PoolItem - * \li a \ref PoolQuery - * \li an other \ref PoolQueryResult - * \li any iterator pair with \c value_type \ref sat::Solvable - * or \ref PoolItem or \ref PoolQuery or any type that fits - * \c operator+=. - * - * The class is a \ref sat::SolvIterMixin, so you can iterate the result - * not just as \ref sat::Solvable, but also as \ref PoolItem or - * \ref ui::Selectable. - * - * \code - * // Constructed from PoolItem iterator pair - * PoolQueryResult result( pool.byKindBegin(), pool.byKindEnd() ); - * MIL << result.size() << endl; - * - * { - * // Removing a PoolQuery result - * PoolQuery q; - * q.addAttribute( sat::SolvAttr::name, "[a-zA-Z]*" ); - * q.setMatchGlob(); - * result -= q; - * MIL << result.size() << endl; - * } - * MIL << result << endl; - * - * // Removing a range of sat::Solvables - * sat::WhatProvides poviders( Capability("3ddiag") ); - * result -= PoolQueryResult( poviders.begin(), poviders.end() ); - * - * // packages not starting with a letter, except 3ddiag - * MIL << result << endl; - * \endcode - */ - class PoolQueryResult : public sat::SolvIterMixin::const_iterator> - { - public: - typedef std::tr1::unordered_set ResultSet; - typedef ResultSet::size_type size_type; - typedef ResultSet::const_iterator const_iterator; - - public: - /** Default ctor (empty result) */ - PoolQueryResult() - {} - - /** Ctor adding one \ref sat::Solvable. */ - explicit PoolQueryResult( sat::Solvable result_r ) - { operator+=( result_r ); } - - /** Ctor adding one \ref PoolItem. */ - explicit PoolQueryResult( const PoolItem & result_r ) - { operator+=( result_r ); } - - /** Ctor adding one \ref PoolQuery result. */ - explicit PoolQueryResult( const PoolQuery & query_r ) - { operator+=( query_r ); } - - /** Ctor adding a range of items for which \ref operator+= is defined. */ - template - PoolQueryResult( _QueryResultIter begin_r, _QueryResultIter end_r ) - { - for_( it, begin_r, end_r ) - { - operator+=( *it ); - } - } - - public: - /** Whether the result is empty. */ - bool empty() const - { return _result.empty(); } - /** The number of \ref sat::Solvables. */ - size_type size() const - { return _result.size(); } - /** */ - const_iterator begin() const - { return _result.begin(); } - /** */ - const_iterator end() const - { return _result.end(); } - - /** Test whether some item is in the result set. */ - bool contains(sat::Solvable result_r ) const - { return( _result.find( result_r ) != _result.end() ); } - /** \overload */ - bool contains( const PoolItem & result_r ) const - { return contains( result_r.satSolvable() ); } - - public: - /** Clear the result. */ - void clear() - { _result.clear(); } - - /** Add items to the result. */ - PoolQueryResult & operator+=( const PoolQueryResult & query_r ) - { - if ( ! query_r.empty() ) - _result.insert( query_r.begin(), query_r.end() ); - return *this; - } - /** \overload */ - PoolQueryResult & operator+=( const PoolQuery & query_r ) - { - try - { - for_( it, query_r.begin(), query_r.end() ) - _result.insert( *it ); - } - catch ( const Exception & ) - {} - return *this; - } - /** \overload */ - PoolQueryResult & operator+=( sat::Solvable result_r ) - { - _result.insert( result_r ); - return *this; - } - /** \overload */ - PoolQueryResult & operator+=( const PoolItem & result_r ) - { - _result.insert( result_r.satSolvable() ); - return *this; - } - - /** Remove Items from the result. */ - PoolQueryResult & operator-=( const PoolQueryResult & query_r ) - { - if ( &query_r == this ) // catch self removal! - clear(); - else - for_( it, query_r.begin(), query_r.end() ) - _result.erase( *it ); - return *this; - } - /** \overload */ - PoolQueryResult & operator-=( const PoolQuery & query_r ) - { - try - { - for_( it, query_r.begin(), query_r.end() ) - _result.erase( *it ); - } - catch ( const Exception & ) - {} - return *this; - } - /** \overload */ - PoolQueryResult & operator-=( sat::Solvable result_r ) - { - _result.erase( result_r ); - return *this; - } - /** \overload */ - PoolQueryResult & operator-=( const PoolItem & result_r ) - { - _result.erase( result_r.satSolvable() ); - return *this; - } - - public: - /** Combine results. */ - PoolQueryResult operator+( const PoolQueryResult & query_r ) const - { return PoolQueryResult(*this) += query_r; } - /** \overload */ - PoolQueryResult operator+( const PoolQuery & query_r ) const - { return PoolQueryResult(*this) += query_r; } - /** \overload */ - PoolQueryResult operator+( sat::Solvable result_r ) const - { return PoolQueryResult(*this) += result_r; } - - /** Intersect results. */ - PoolQueryResult operator-( const PoolQueryResult & query_r ) const - { return PoolQueryResult(*this) -= query_r; } - /** \overload */ - PoolQueryResult operator-( const PoolQuery & query_r ) const - { return PoolQueryResult(*this) -= query_r; } - /** \overload */ - PoolQueryResult operator-( sat::Solvable result_r ) const - { return PoolQueryResult(*this) -= result_r; } - - private: - ResultSet _result; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolQueryResult Stream output */ - std::ostream & operator<<( std::ostream & str, const PoolQueryResult & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOLQUERYRESULT_H diff --git a/libzypp/zypp/PoolQueryUtil.tcc b/libzypp/zypp/PoolQueryUtil.tcc deleted file mode 100644 index 4a0ec40..0000000 --- a/libzypp/zypp/PoolQueryUtil.tcc +++ /dev/null @@ -1,78 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PoolQueryUtil.tcc - * - * including fstream is not hell here because this header only included - * by implementation file, header doesn't need include it. -*/ -#ifndef ZYPP_POOLQUERYUTIL_TCC -#define ZYPP_POOLQUERYUTIL_TCC - -#include - -#include "zypp/Pathname.h" -#include "zypp/PoolQuery.h" -#include "zypp/base/String.h" - -namespace zypp -{ - - /** - * sends to output iterator all queries readed from file. - * - * \code - * list s; - * insert_iterator > ii(s, s.end()); - * readPoolQueriesFromStream(f,ii); - * \endcode - */ - template - void readPoolQueriesFromFile(const zypp::filesystem::Pathname &file, - OutputIterator out ) - { - bool found; - std::ifstream fin( file.c_str() ); - - if (!fin) - ZYPP_THROW(Exception(str::form("Cannot open file %s",file.c_str()))); - - do - { - zypp::PoolQuery q; - found = q.recover( fin ); - if (found) - *out++ = q; - } while ( found ); - - fin.close(); - } - - /** - * Writes all queries from begin to end. - */ - - template - void writePoolQueriesToFile(const zypp::filesystem::Pathname &file, - InputIterator begin, InputIterator end ) - { - std::ofstream fout( file.c_str(), std::ios_base::out | std::ios_base::trunc ); - - if (!fout) - ZYPP_THROW(Exception(str::form("Cannot open file %s",file.c_str()))); - - for_( it, begin, end ) - { - it->serialize( fout ); - } - - fout.close(); - } - -} -#endif // ZYPP_POOLQUERYUTIL_H diff --git a/libzypp/zypp/ProblemSolution.cc b/libzypp/zypp/ProblemSolution.cc deleted file mode 100644 index b5ae8da..0000000 --- a/libzypp/zypp/ProblemSolution.cc +++ /dev/null @@ -1,127 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include "zypp/solver/detail/Types.h" -#include "zypp/solver/detail/SolutionAction.h" -#include "zypp/ProblemSolution.h" -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/Resolver.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolution); - -//--------------------------------------------------------------------------- - -ostream& -operator<<( ostream& os, const ProblemSolution & solution) -{ - os << "Solution:" << endl; - os << solution._description << endl; - if ( ! solution._details.empty() ) - os << solution._details << endl; - os << solution._actions; - return os; -} - -ostream& -operator<<( ostream& os, const ProblemSolutionList & solutionlist) -{ - for (ProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) { - os << *(*iter); - } - return os; -} - -ostream& -operator<<( ostream& os, const CProblemSolutionList & solutionlist) -{ - for (CProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) { - os << *(*iter) << endl; - } - return os; -} - -//--------------------------------------------------------------------------- - -ProblemSolution::ProblemSolution( ResolverProblem_Ptr parent, const string & description, const string & details ) - : _problem (parent) - , _description (description) - , _details (details) -{ -} - - -ProblemSolution::~ProblemSolution() -{ -} - - -/** - * Apply this solution, i.e. execute all of its actions. - * - * Returns 'true' on success, 'false' if actions could not be performed. - **/ - -bool -ProblemSolution::apply (solver::detail::Resolver & resolver) -{ - DBG << "apply solution " << *this << endl; - bool ret = true; - for (solver::detail::CSolutionActionList::const_iterator iter = _actions.begin(); - iter != _actions.end(); ++iter) { - solver::detail::SolutionAction_constPtr action = *iter; - if (! action->execute (resolver)) - { - WAR << "apply solution action failed: " << action << endl; - ret = false; - break; - } - } - return ret; -} - - -/** - * Add an action to the actions list. - **/ -void -ProblemSolution::addAction (solver::detail::SolutionAction_constPtr action) -{ - _actions.push_back (action); -} - - -void -ProblemSolution::clear() -{ - _actions.clear(); -} - - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ProblemSolution.h b/libzypp/zypp/ProblemSolution.h deleted file mode 100644 index a239817..0000000 --- a/libzypp/zypp/ProblemSolution.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Author: Stefan Hundhammer - * - **/ - -#ifndef ZYPP_PROBLEMSOLUTION_H -#define ZYPP_PROBLEMSOLUTION_H - -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/solver/detail/Resolver.h" -#include "zypp/ResolverProblem.h" -#include "zypp/solver/detail/SolutionAction.h" -#include "zypp/solver/detail/Types.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - - /** - * Class representing one possible solution to one problem found during resolving - * - * All problems should have at least 2-3 (mutually exclusive) solutions: - * - * - Undo: Do not perform the offending transaction - * (do not install the package that had unsatisfied requirements, - * do not remove the package that would break other packages' requirements) - * - * - Remove referrers: Remove all packages that would break because - * they depend on the package that is requested to be removed - * - * - Ignore: Inject artificial "provides" for a missing requirement - * (pretend that requirement is satisfied) - **/ - class ProblemSolution : public base::ReferenceCounted - { - protected: - - /** - * Clear all data. - * In particular, delete all members of _actions. - **/ - void clear(); - - // - // Data members - // - ResolverProblem_Ptr _problem; - solver::detail::CSolutionActionList _actions; - std::string _description; - std::string _details; - - public: - - /** - * Constructor. - **/ - ProblemSolution( ResolverProblem_Ptr parent, const std::string & description, const std::string & details ); - - /** - * Destructor. - **/ - ~ProblemSolution(); - - // ---------------------------------- I/O - - friend std::ostream& operator<<(std::ostream&, const ProblemSolution & solution); - friend std::ostream& operator<<(std::ostream&, const ProblemSolutionList & solutionlist); - friend std::ostream& operator<<(std::ostream&, const CProblemSolutionList & solutionlist); - - // ---------------------------------- accessors - /** - * Return a one-line text description of this solution. - **/ - std::string description() const { return _description; } - - /** - * Return a (possibly multi-line) detailed description of this - * solution or an empty string if there are no useful details. - **/ - std::string details() const { return _details; } - - /** - * Return the parent dependency problem. - **/ - ResolverProblem_Ptr problem() const { return _problem; } - - // ---------------------------------- methods - - /** - * Apply this solution, i.e. execute all of its actions. - * - * Returns 'true' on success, 'false' if actions could not be performed. - **/ - bool apply (solver::detail::Resolver & resolver); - - /** - * Add an action to the actions list. - **/ - void addAction( solver::detail::SolutionAction_constPtr action ); - - solver::detail::CSolutionActionList actions() {return _actions;} - - }; - - - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_PROBLEMSOLUTION_H - diff --git a/libzypp/zypp/ProblemTypes.h b/libzypp/zypp/ProblemTypes.h deleted file mode 100644 index 051b34a..0000000 --- a/libzypp/zypp/ProblemTypes.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Types.h - * - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_PROBLEMTYPES_H -#define ZYPP_PROBLEMTYPES_H - -#include -#include -#include -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Functional.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - DEFINE_PTR_TYPE(Resolver); - - DEFINE_PTR_TYPE(ProblemSolution); - typedef std::list ProblemSolutionList; - typedef std::list CProblemSolutionList; - - DEFINE_PTR_TYPE(ResolverProblem); - typedef std::list ResolverProblemList; - typedef std::list CResolverProblemList; - - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_TYPES_H diff --git a/libzypp/zypp/Product.cc b/libzypp/zypp/Product.cc deleted file mode 100644 index 75def80..0000000 --- a/libzypp/zypp/Product.cc +++ /dev/null @@ -1,286 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Product.cc - * -*/ -#include -#include "zypp/base/LogTools.h" -#include "zypp/base/StrMatcher.h" - -#include "zypp/Product.h" -#include "zypp/Url.h" - -#include "zypp/sat/LookupAttr.h" -#include "zypp/sat/WhatProvides.h" -#include "zypp/sat/WhatObsoletes.h" -#include "zypp/PoolItem.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(Product); - - namespace - { - void fillList( std::list & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r ) - { - sat::LookupAttr query( attr_r, solv_r ); - for_( it, query.begin(), query.end() ) - { - try // ignore malformed urls - { - ret_r.push_back( Url( it.asString() ) ); - } - catch( const url::UrlException & ) - {} - } - } - - void fillList( std::list & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r ) - { - sat::LookupAttr query( attr_r, solv_r ); - for_( it, query.begin(), query.end() ) - { - ret_r.push_back( it.asString() ); - } - } - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Product::Product - // METHOD TYPE : Ctor - // - Product::Product( const sat::Solvable & solvable_r ) - : ResObject( solvable_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Product::~Product - // METHOD TYPE : Dtor - // - Product::~Product() - {} - - /////////////////////////////////////////////////////////////////// - - sat::Solvable Product::referencePackage() const - { - // Look for a provider of 'product(name) = version' of same - // architecture and within the same repo. - // - // bnc #497696: Update repos may have multiple release package versions - // providing the same product. As a workaround we link to the one with - // the highest version. - Capability identCap( str::form( "product(%s) = %s", name().c_str(), edition().c_str() ) ); - - sat::Solvable found; - sat::WhatProvides providers( identCap ); - for_( it, providers.begin(), providers.end() ) - { - if ( it->repository() == repository() - && it->arch() == arch() ) - { - if ( ! found || found.edition() < it->edition() ) - found = *it; - } - } - - if ( ! found && isSystem() ) - { - // bnc#784900: for installed products check whether the file is owned by - // some package. If so, ust this as buddy. - sat::LookupAttr q( sat::SolvAttr::filelist, repository() ); - std::string refFile( referenceFilename() ); - if ( ! refFile.empty() ) - { - StrMatcher matcher( referenceFilename() ); - q.setStrMatcher( matcher ); - if ( ! q.empty() ) - found = q.begin().inSolvable(); - } - else - INT << "Product referenceFilename unexpectedly empty!" << endl; - } - - if ( ! found ) - WAR << *this << ": no reference package found: " << identCap << endl; - return found; - } - - std::string Product::referenceFilename() const - { return lookupStrAttribute( sat::SolvAttr::productReferenceFile ); } - - Product::ReplacedProducts Product::replacedProducts() const - { - std::vector ret; - // By now we simply collect what is obsoleted by the Product, - // or by the products buddy (release-package). - - // Check our own dependencies. We should not have any, - // but just to be shure. - sat::WhatObsoletes obsoleting( satSolvable() ); - for_( it, obsoleting.begin(), obsoleting.end() ) - { - if ( it->isKind( ResKind::product ) ) - ret.push_back( make( *it ) ); - } - - // If we have a buddy, we check what product buddies the - // buddy replaces. - obsoleting = sat::WhatObsoletes( poolItem().buddy() ); - for_( it, obsoleting.poolItemBegin(), obsoleting.poolItemEnd() ) - { - if ( (*it).buddy().isKind( ResKind::product ) ) - ret.push_back( make( (*it).buddy() ) ); - } - return ret; - } - - CapabilitySet Product::droplist() const - { return poolItem().buddy().valuesOfNamespace( "weakremover" ); } - - std::string Product::productLine() const - { return lookupStrAttribute( sat::SolvAttr::productProductLine ); } - - /////////////////////////////////////////////////////////////////// - - std::string Product::shortName() const - { - std::string ret( lookupStrAttribute( sat::SolvAttr::productShortlabel ) ); - if ( ret.empty() ) ret = name(); - return ret; - - } - - std::string Product::flavor() const - { - // Look for a provider of 'product_flavor(name) = version' - // within the same repo. Unlike the reference package, we - // can be relaxed and ignore the architecture. - Capability identCap( str::form( "product_flavor(%s) = %s", name().c_str(), edition().c_str() ) ); - - sat::WhatProvides providers( identCap ); - for_( it, providers.begin(), providers.end() ) - { - if ( it->repository() == repository() ) - { - // Got the package now try to get the provided 'flavor(...)' - Capabilities provides( it->provides() ); - for_( cap, provides.begin(), provides.end() ) - { - std::string capstr( cap->asString() ); - if ( str::hasPrefix( capstr, "flavor(" ) ) - { - capstr = str::stripPrefix( capstr, "flavor(" ); - capstr.erase( capstr.size()-1 ); // trailing ')' - return capstr; - } - } - } - } - return std::string(); - } - - std::string Product::type() const - { return lookupStrAttribute( sat::SolvAttr::productType ); } - - std::list Product::flags() const - { - std::list ret; - fillList( ret, satSolvable(), sat::SolvAttr::productFlags ); - return ret; - } - - Date Product::endOfLife() const - { return Date( lookupNumAttribute( sat::SolvAttr::productEndOfLife ) );} - - std::vector Product::updateContentIdentifier() const - { - std::vector ret; - sat::LookupAttr q( sat::SolvAttr::productUpdatesRepoid, sat::SolvAttr::productUpdates, *this ); - if ( ! q.empty() ) - { - ret.reserve( 2 ); - for_( it, q.begin(), q.end() ) - ret.push_back( it.asString() ); - } - return ret; - } - - bool Product::hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const - { - sat::LookupAttr q( sat::SolvAttr::productUpdatesRepoid, sat::SolvAttr::productUpdates, *this ); - for_( it, q.begin(), q.end() ) - { - if ( it.asString() == cident_r ) - return true; - } - return false; - } - - bool Product::isTargetDistribution() const - { return isSystem() && lookupStrAttribute( sat::SolvAttr::productType ) == "base"; } - - std::string Product::registerTarget() const - { return lookupStrAttribute( sat::SolvAttr::productRegisterTarget ); } - - std::string Product::registerRelease() const - { return lookupStrAttribute( sat::SolvAttr::productRegisterRelease ); } - - std::string Product::registerFlavor() const - { return lookupStrAttribute( sat::SolvAttr::productRegisterFlavor ); } - - ///////////////////////////////////////////////////////////////// - - Product::UrlList Product::urls( const std::string & key_r ) const - { - UrlList ret; - - sat::LookupAttr url( sat::SolvAttr::productUrl, *this ); - sat::LookupAttr url_type( sat::SolvAttr::productUrlType, *this ); - - sat::LookupAttr::iterator url_it(url.begin()); - sat::LookupAttr::iterator url_type_it(url_type.begin()); - - for (;url_it != url.end(); ++url_it, ++url_type_it) - { - /* safety checks, shouldn't happen (tm) */ - if (url_type_it == url_type.end()) - { - ERR << *this << " : The thing that should not happen, happened." << endl; - break; - } - - if ( url_type_it.asString() == key_r ) - { - ret._list.push_back(url_it.asString()); - } - } /* while (attribute array) */ - - return ret; - } - - Product::UrlList Product::releaseNotesUrls() const { return urls( "releasenotes" ); } - Product::UrlList Product::registerUrls() const { return urls( "register" ); } - Product::UrlList Product::smoltUrls() const { return urls( "smolt" ); } - Product::UrlList Product::updateUrls() const { return urls( "update" ); } - Product::UrlList Product::extraUrls() const { return urls( "extra" ); } - Product::UrlList Product::optionalUrls() const { return urls( "optional" ); } - - std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj ) - { return dumpRange( str << obj.key() << ' ', obj.begin(), obj.end() ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Product.h b/libzypp/zypp/Product.h deleted file mode 100644 index 7c9bb3f..0000000 --- a/libzypp/zypp/Product.h +++ /dev/null @@ -1,237 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Product.h - * -*/ -#ifndef ZYPP_PRODUCT_H -#define ZYPP_PRODUCT_H - -#include -#include - -#include "zypp/ResObject.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - DEFINE_PTR_TYPE(Product); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Product - // - /** Product interface. - */ - class Product : public ResObject - { - public: - typedef Product Self; - typedef ResTraits TraitsType; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - /** The reference package providing the product metadata, - * if such a package exists. - */ - sat::Solvable referencePackage() const; - - /** For installed products the name of the coddesponding - * \c /etc/products.d entry. - .*/ - std::string referenceFilename() const; - - /** List of packages included in older versions of this product and now dropped. - * - * This evaluates the \ref referencePackage \c weakremover namespace. It actually - * returns a \ref CapabilitySet, because we support to drop specific versions or - * version ranges of a package. Use \ref sat::WhatProvides to get the actually - * installed and available packages matching this list. - * \code - * const Product & openSUSE; - * sat::WhatProvides dropped( openSUSE.droplist() ); - * for_( it, dropped.poolItemBegin(), dropped.poolItemEnd() ) - * { - * if ( it->status().isInstalled() ) - * { - * MIL << "Installed but no longer supported package: " << *it << endl; - * } - * } - * \endcode - */ - CapabilitySet droplist() const; - - public: - /***/ - typedef std::vector ReplacedProducts; - - /** Array of \b installed Products that would be replaced by - * installing this one. - */ - ReplacedProducts replacedProducts() const; - - /** Vendor specific string denoting the product line. */ - std::string productLine() const; - - public: - /** Untranslated short name like SLES 10 (fallback: name) */ - std::string shortName() const; - - /** The product flavor (LiveCD Demo, FTP edition,...). */ - std::string flavor() const; - - /** Get the product type - * Well, in an ideal world there is only one base product. - * It's the installed product denoted by a symlink in - * \c /etc/products.d. - */ - std::string type() const; - - /** The product flags */ - std::list flags() const; - - /** The date when this Product goes out of support as indicated by it's medadata. */ - Date endOfLife() const; - - /** ContentIdentifier of required update repositories. */ - std::vector updateContentIdentifier() const; - - /** Whether \a cident_r is listed as required update repository. */ - bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const; - - /** Whether one of the ContentIdentifier is listed as required update repository. */ - template - bool hasUpdateContentIdentifier( _Iterator begin, _Iterator end ) const - { - for_( it, begin, end ) - if ( hasUpdateContentIdentifier( *it ) ) - return true; - return false; - } - - public: - /** This is the \b installed product that is also targeted by the - * \c /etc/products.d/baseproduct symlink. - */ - bool isTargetDistribution() const; - - /** This is \c register.target attribute of a product. - * Used for registration and filtering service repos. - */ - std::string registerTarget() const; - - /** This is \c register.release attribute of an \b installed product. - * Used for registration. - */ - std::string registerRelease() const; - - /** This is \c register.flavor attribute of a product. - * Used for registration. - */ - std::string registerFlavor() const; - - public: - /***/ - class UrlList; - - /** Rerieve urls flagged with \c key_r for this product. - * - * This is the most common interface. There are convenience methods for - * wellknown flags like \c "releasenotes", \c "register", \c "updateurls", - * \c "extraurls", \c "optionalurls" and \c "smolt" below. - */ - UrlList urls( const std::string & key_r ) const; - - /** The URL to download the release notes for this product. */ - UrlList releaseNotesUrls() const; - - /** The URL for registration. */ - UrlList registerUrls() const; - - /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */ - UrlList smoltUrls() const; - - /** - * Online updates for the product. - * They are complementary, not alternatives. #163192 - */ - UrlList updateUrls() const; - - /** - * Additional software for the product - * They are complementary, not alternatives. - */ - UrlList extraUrls() const; - - /** - * Optional software for the product. - * (for example. Non OSS repositories) - * They are complementary, not alternatives. - */ - UrlList optionalUrls() const; - - protected: - friend Ptr make( const sat::Solvable & solvable_r ); - /** Ctor */ - Product( const sat::Solvable & solvable_r ); - /** Dtor */ - virtual ~Product(); - }; - - /** Helper to iterate a products URL lists. - * \ref first is a convenience for 'lists' with just - * one entry (e.g. releaseNotesUrls) - */ - class Product::UrlList - { - private: - /** \todo Change to directly iterate the .solv */ - typedef std::list ListType; - - public: - typedef ListType::value_type value_type; - typedef ListType::size_type size_type; - typedef ListType::const_iterator const_iterator; - - bool empty() const - { return _list.empty(); } - - size_type size() const - { return _list.size(); } - - const_iterator begin() const - { return _list.begin(); } - - const_iterator end() const - { return _list.end(); } - - /** The first Url or an empty Url. */ - Url first() const - { return empty() ? value_type() : _list.front(); } - - public: - /** The key used to retrieve this list (for debug) */ - std::string key() const - { return _key; } - - private: - friend class Product; - /** Change to directly iterate the .solv */ - std::string _key; - ListType _list; - }; - - /** \relates Product::UrlList Stream output. */ - std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PRODUCT_H diff --git a/libzypp/zypp/ProgressData.cc b/libzypp/zypp/ProgressData.cc deleted file mode 100644 index 251ab3d..0000000 --- a/libzypp/zypp/ProgressData.cc +++ /dev/null @@ -1,152 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ProgressData.cc - * -*/ -#include -#include "zypp/base/Logger.h" -#include "zypp/base/InputStream.h" -#include "zypp/base/String.h" - -#include "zypp/ProgressData.h" - -using std::endl; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "Progress" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ProgressData::report - // METHOD TYPE : void - // - bool ProgressData::report() - { - Date now = Date::now(); - - // compute value and check whether to report it - if ( hasRange() ) - { - value_type newVal = _d->_val * 100 / ( _d->_max - _d->_min ); - - if ( newVal - _d->_last_val > 10 - || now - _d->_last_send > 1 - || ( _d->_last_val == 0 && newVal > 0 ) - || ( newVal == 100 && _d->_last_val != 100 ) - || ( newVal != 100 && _d->_last_val == 100 ) - || _d->_state != RUN /*INIT||END*/ ) - { - _d->_last_val = newVal; - _d->_last_send = now; - } - else - return true; // skip report, continue per default - } - else - { - if ( now - _d->_last_send > 1 || _d->_state != RUN /*INIT||END*/ ) - { - _d->_last_val = _d->_val; - _d->_last_send = now; - } - else - return true; // skip report, continue per default - } - - // now send report - if ( _d->_state == INIT ) - { - _d->_state = RUN; - } - // XXX << str::form( "{#%u|%s}(%lld%s)", numericId(), name().c_str(), _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl; - - if ( _d->_receiver ) - { - if ( ! _d->_receiver( *this ) ) - { - if ( _d->_state != END ) - { - WAR << "User request to ABORT pending action. " - << str::form( "{#%u|%s}(%lld%s)", numericId(), name().c_str(), - _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl; - } - return false; // aborted by user - } - } - else if ( _d->_state == END ) - { - DBG << str::form( "{#%u|%s}END", numericId(), name().c_str() ) << endl; - } - - return true; // continue per default - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ProgressData & obj ) - { - if ( obj.hasRange() ) - { - return str << str::form( "{%u|%s}[%lld,%lld](%lld)%lld%%)", - obj.numericId(), obj.name().c_str(), - obj.min(), obj.max(), obj.val(), obj.reportValue() ); - } - return str << str::form( "{%u|%s}[-,-](%lld)", - obj.numericId(), obj.name().c_str(), - obj.val() ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - ProgressData makeProgressData( const InputStream & input_r ) - { - ProgressData ret; - ret.name( input_r.name() ); - if ( input_r.size() > 0 ) - ret.range( input_r.size() ); - return ret; - } - - CombinedProgressData::CombinedProgressData( ProgressData &pd, - ProgressData::value_type weight ) - : _weight(weight), - _last_value(0), - _pd(pd) - { - - } - - bool CombinedProgressData::operator()( const ProgressData &progress ) - { - if ( progress.reportAlive() || ( _weight == 0 ) ) - return _pd.tick(); - - // factor [0,1] of increase in subtask ( ie: before 0,2 now 0.5 ) - float increment = ((float)(progress.val() - _last_value))/(progress.max() - progress.min()); - // how much the subtask affects the parent task ie: 0,1 - float parent_factor = (float)(_weight)/(_pd.max() - _pd.min()); - // real increment of the parent task - float real_increment = parent_factor*increment; - _last_value = progress.val(); - return _pd.incr( (int)( (_pd.max()-_pd.min()) * real_increment) ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ProgressData.h b/libzypp/zypp/ProgressData.h deleted file mode 100644 index 1cb757a..0000000 --- a/libzypp/zypp/ProgressData.h +++ /dev/null @@ -1,425 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ProgressData.h - * -*/ -#ifndef ZYPP_PROGRESSDATA_H -#define ZYPP_PROGRESSDATA_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/base/ProvideNumericId.h" - -#include "zypp/Date.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ProgressData - // - /** Maintain [min,max] and counter (value) for progress counting. - * - * This class should provide everything the producer of progress data - * needs. As a convention, a zero sizes range indicates that you are just - * able to send 'still alive' triggers. - * - * The counter should be updated in reasonable intervals. Don't mind whether - * the counter value actually increased or not. ProgressData will recognize - * your triggers and knows when to actually send notification to a consumer. - * - * Each ProgressData object provides a unique numeric id and you may assign - * it a name. - * - * \code - * bool exampleReceiver( ProgressData::value_type v ) - * { - * DBG << "got ->" << v << endl; - * return( v <= 100 ); // Abort if ( v > 100 ) - * } - * - * class Example - * { - * public: - * - * Example( const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() ) - * : _fnc( fnc_r ) - * {} - * - * void SendTo( const ProgressData::ReceiverFnc & fnc_r ) - * { _fnc = fnc_r; } - * - * public: - * - * void action() - * { - * ProgressData tics( 10 ); // Expect range 0 -> 10 - * tics.name( "test ticks" ); // Some arbitrary name - * tics.sendTo( _fnc ); // Send reports to _fnc - * tics.toMin(); // start sending min (0) - * - * for ( int i = 0; i < 10; ++i ) - * { - * if ( ! tics.set( i ) ) - * return; // user requested abort - * } - * - * tics.toMax(); // take care 100% are reported on success - * } - * - * void action2() - * { - * ProgressData tics; // Just send 'still alive' messages - * tics.name( "test ticks" ); // Some arbitrary name - * tics.sendTo( _fnc ); // Send reports to _fnc - * tics.toMin(); // start sending min (0) - * - * for ( int i = 0; i < 10; ++i ) - * { - * if ( ! tics.set( i ) ) - * return; // user requested abort - * } - * - * tics.toMax(); // - * } - * - * private: - * ProgressData::ReceiverFnc _fnc; - * }; - * \endcode - * \code - * Example t( exampleReceiver ); - * DBG << "Reporting %:" << endl; - * t.action(); - * DBG << "Reporting 'still alive':" << endl; - * t.action2(); - * \endcode - * \code - * Reporting %: - * got ->0 - * got ->10 - * got ->20 - * got ->30 - * got ->40 - * got ->50 - * got ->60 - * got ->70 - * got ->80 - * got ->90 - * got ->100 - * got ->100 - * Reporting 'still alive': - * got ->0 - * got ->9 - * \endcode - * - * The different ammount of triggers is due to different rules for sending - * percent or 'still alive' messages. - */ - class ProgressData : public base::ProvideNumericId - { - public: - typedef long long value_type; - /** Most simple version of progress reporting - * The percentage in most cases. Sometimes just keepalive. - * \p sender ProgressData object who sends the progress info - * \p - */ - typedef function ReceiverFnc; - - private: - enum State { INIT, RUN, END }; - - class Data - { - public: - Data( value_type min_r, value_type max_r, value_type val_r ) - : _state( INIT ), _min( min_r ), _max( max_r ), _val( val_r ) - , _last_val( 0 ), _last_send( 0 ) - {} - - public: - State _state; - std::string _name; - value_type _min; - value_type _max; - value_type _val; - - ReceiverFnc _receiver; - value_type _last_val; - Date _last_send; - - private: - /** clone for RWCOW_pointer */ - friend Data * rwcowClone( const Data * rhs ); - Data * clone() const { return new Data( *this ); } - }; - - public: - /** Ctor no range [0,0](0). */ - ProgressData() - : _d( new Data( 0, 0, 0 ) ) - {} - - /** Ctor [0,max](0). */ - ProgressData( value_type max_r ) - : _d( new Data( 0, max_r, 0 ) ) - {} - - /** Ctor [min,max](min). */ - ProgressData( value_type min_r, value_type max_r ) - : _d( new Data( min_r, max_r, min_r ) ) - {} - - /** Ctor [min,max](val). */ - ProgressData( value_type min_r, value_type max_r, value_type val_r ) - : _d( new Data( min_r, max_r, val_r ) ) - {} - - ~ProgressData() - { - if ( _d->_state == RUN ) - { - _d->_state = END; - report(); - } - } - - public: - /** Set new \c min value. */ - void min( value_type min_r ) - { _d->_min = min_r; } - - /** Set new \c max value. */ - void max( value_type max_r ) - { _d->_max = max_r; } - - /** Set no range [0,0]. */ - void noRange() - { range( 0, 0 ); } - - /** Set new [0,max]. */ - void range( value_type max_r ) - { range( 0, max_r ); } - - /** Set new [min,max]. */ - void range( value_type min_r, value_type max_r ) - { min( min_r ); max( max_r ); } - - public: - /** Set counter name. */ - void name( const std::string & name_r ) - { _d->_name = name_r; } - - /** Set ReceiverFnc. */ - void sendTo( const ReceiverFnc & fnc_r ) - { _d->_receiver = fnc_r; } - - /** Set no ReceiverFnc. */ - void noSend() - { _d->_receiver = ReceiverFnc(); } - - public: - /** \name Progress reporting. - * - * These methods may actually cause a progress report to be sent. - * - * All methods return \c bool, because a progress receiver may - * return \c false to indicate the desire to abort the pending - * action. The incident is logged, but it's finaly up to the caller - * to honor this. - */ - //@{ - - /** Set new counter \c value. */ - bool set( value_type val_r ) - { - _d->_val = val_r; - return report(); - } - - /** Set range and counter from an other \ref ProgressData. */ - bool set( const ProgressData & rhs ) - { - min( rhs.min() ); - max( rhs.max() ); - return set( rhs.val() ); - } - - /** Increment counter \c value (default by 1). */ - bool incr( value_type val_r = 1 ) - { return set( val() + val_r ); } - - /** Decrement counter \c value (default by 1). */ - bool decr( value_type val_r = 1 ) - { return set( val() - val_r ); } - - /** Set counter value to current \c min value. */ - bool toMin() - { return set( min() ); } - - /** Set counter value to current \c max value (unless no range). */ - bool toMax() - { return hasRange() ? set( max() ) : tick(); } - - /** Leave counter value unchanged (still alive). */ - bool tick() - { return report(); } - - //@} - - public: - /** \name Progress receiving. - */ - //@{ - /** @return Current \c min value. */ - value_type min() const - { return _d->_min; } - - /** @return Current \c max value. */ - value_type max() const - { return _d->_max; } - - /** @return Current counter \c value. */ - value_type val() const - { return _d->_val; } - - /** @return Whether [min,max] defines a nonempty range. */ - bool hasRange() const - { return min() != max(); } - - /** @return Whether \ref reportValue will return a percent value. - * Same as \ref hasRange. - * \see \ref reportAlive - */ - bool reportPercent() const - { return hasRange(); } - - /** @return Whether \ref reportValue always returns -1, because we - * trigger 'still alive' messages. I.e. \ref hasrange is \c false. - * \see \ref reportPercent - */ - bool reportAlive() const - { return ! hasRange(); } - - /** @return Either a a percent value or -1. - * \see \ref reportPercent and \ref reportAlive. - */ - value_type reportValue() const - { return hasRange() ? val() * 100 / ( max() - min() ) : -1; } - - /** @return The counters name. */ - const std::string & name() const - { return _d->_name; } - - /** @return The ReceiverFnc. */ - const ReceiverFnc & receiver() const - { return _d->_receiver; } - - /** @return Return \c true if this is the final report sent by the - * ProgressData dtor. - */ - bool finalReport() const - { return( _d->_state == END ); } - - //@} - - private: - /** Send report if necessary. */ - bool report(); - - /** Pointer to data. */ - RWCOW_pointer _d; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ProgressData Stream output */ - std::ostream & operator<<( std::ostream & str, const ProgressData & obj ); - - /////////////////////////////////////////////////////////////////// - - class InputStream; - /** \relates ProgressData Setup from \ref InputStream. */ - ProgressData makeProgressData( const InputStream & input_r ); - - /////////////////////////////////////////////////////////////////// - - /** - * \short Progress callback from another progress - * - * This class allows you to pass a progress callback to a - * subtask based on a current progress data, plus a weight - * value. Every progress reported by the subtask via - * this callback will be forwarded to the main progress - * data, with the corresponding weight. - * - * Example: - * - * \code - * - * // receiver for main task - * void task_receiver( ProgressData &progress ); - * - * // subtask prototypes - * void do_subtask_one( ProgressData::ReceiverFnc &fnc ); - * void do_subtask_two( ProgressData::ReceiverFnc &fnc ); - * - * // main task - * ProgressData progress; - * //progress for subtask 1 - * // which is 80% - * CombinedProgressData sub1(pd, 80); - * // the second is only 20% - * CombinedProgressData sub2(pd, 20); - * do_subtask_one( sub1 ); - * do_subtask_two( sub2 ); - * - * \endcode - */ - class CombinedProgressData - { - public: - /** - * \short Ctor - * - * Creates a \ref ProgressData::ReceiverFnc - * from a \ref ProgressData object - * - * \param pd \ref ProgressData object - * \param weight Weight of the subtask - * relative to the main task range. - * - * If weight is 0, or \param pd only reports - * keepalives. then only ticks are sent. - * - */ - CombinedProgressData( ProgressData &pd, - ProgressData::value_type weight = 0 ); - - /** - * Implements the \ref ProgressData::ReceiverFnc - * callback interface - */ - bool operator()( const ProgressData &progress ); - - private: - ProgressData::value_type _weight; - ProgressData::value_type _last_value; - ProgressData &_pd; - }; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PROGRESSDATA_H diff --git a/libzypp/zypp/ProvideFilePolicy.cc b/libzypp/zypp/ProvideFilePolicy.cc deleted file mode 100644 index 9eff514..0000000 --- a/libzypp/zypp/ProvideFilePolicy.cc +++ /dev/null @@ -1,60 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include -#include -#include "zypp/base/Logger.h" - -#include "zypp/ProvideFilePolicy.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ProvideFilePolicy - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - bool yes() { return true; } - bool no() { return false; } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - ProvideFilePolicy & ProvideFilePolicy::failOnChecksumErrorCB( bool yesno_r ) - { - _failOnChecksumErrorCB = (yesno_r ? &yes : &no); - return *this; - } - - bool ProvideFilePolicy::progress( int value ) const - { - if ( _progressCB ) - return _progressCB( value ); - return true; - } - - bool ProvideFilePolicy::failOnChecksumError() const - { - if ( _failOnChecksumErrorCB ) - return _failOnChecksumErrorCB(); - return true; - } - -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ProvideFilePolicy.h b/libzypp/zypp/ProvideFilePolicy.h deleted file mode 100644 index d57d048..0000000 --- a/libzypp/zypp/ProvideFilePolicy.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_PROVIDEFILEPOLICY_H -#define ZYPP_PROVIDEFILEPOLICY_H - -#include - -#include "zypp/base/Function.h" -#include "zypp/base/Functional.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -// CLASS NAME : ProvideFilePolicy - - /** Policy for \ref provideFile. - * Provides callback hooks for e.g progress reporting or - * behaviour on checksum failure. Provides default - * implementations if no callback is set. - */ - class ProvideFilePolicy - { - public: - /** Progress callback signature. */ - typedef function ProgressCB; - - /** Set callback. */ - ProvideFilePolicy & progressCB( ProgressCB progressCB_r ) - { _progressCB = progressCB_r; return *this; } - - /** Evaluate callback. */ - bool progress( int value ) const; - - public: - /** FailOnChecksumError callback signature. */ - typedef function FailOnChecksumErrorCB; - - /** Set callback. */ - ProvideFilePolicy & failOnChecksumErrorCB( FailOnChecksumErrorCB failOnChecksumErrorCB_r ) - { _failOnChecksumErrorCB = failOnChecksumErrorCB_r; return *this; } - - /** Set callback convenience. - * Let callback return \c yesno_r. - */ - ProvideFilePolicy & failOnChecksumErrorCB( bool yesno_r ); - - /** Evaluate callback. */ - bool failOnChecksumError() const; - - private: - FailOnChecksumErrorCB _failOnChecksumErrorCB; - ProgressCB _progressCB; - }; - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PROVIDEFILEPOLICY_H diff --git a/libzypp/zypp/PublicKey.cc b/libzypp/zypp/PublicKey.cc deleted file mode 100644 index 4d3d773..0000000 --- a/libzypp/zypp/PublicKey.cc +++ /dev/null @@ -1,496 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PublicKey.cc - * -*/ -#include - -#include -#include - -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/base/Regex.h" -#include "zypp/PublicKey.h" -#include "zypp/ExternalProgram.h" -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" -#include "zypp/base/Exception.h" -#include "zypp/base/LogTools.h" -#include "zypp/Date.h" -#include "zypp/TmpPath.h" - -#include - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class PublicKeyData::Impl - /// \brief PublicKeyData implementation. - /////////////////////////////////////////////////////////////////// - struct PublicKeyData::Impl - { - std::string _id; - std::string _name; - std::string _fingerprint; - Date _created; - Date _expires; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// class PublicKeyData - /////////////////////////////////////////////////////////////////// - - PublicKeyData::PublicKeyData() - : _pimpl( Impl::nullimpl() ) - {} - - PublicKeyData::~PublicKeyData() - {} - - PublicKeyData::operator bool() const - { return !_pimpl->_fingerprint.empty(); } - - std::string PublicKeyData::id() const - { return _pimpl->_id; } - - std::string PublicKeyData::name() const - { return _pimpl->_name; } - - std::string PublicKeyData::fingerprint() const - { return _pimpl->_fingerprint; } - - Date PublicKeyData::created() const - { return _pimpl->_created; } - - Date PublicKeyData::expires() const - { return _pimpl->_expires; } - - bool PublicKeyData::expired() const - { return( _pimpl->_expires && _pimpl->_expires < Date::now() ); } - - int PublicKeyData::daysToLive() const - { - if ( _pimpl->_expires ) - { - Date exp( _pimpl->_expires - Date::now() ); - int ret = exp / Date::day; - if ( exp < 0 ) ret -= 1; - return ret; - } - return INT_MAX; - } - - std::string PublicKeyData::expiresAsString() const - { - if ( !_pimpl->_expires ) - { // translators: an annotation to a gpg keys expiry date - return _("(does not expire)"); - } - std::string ret( _pimpl->_expires.asString() ); - int ttl( daysToLive() ); - if ( ttl <= 90 ) - { - ret += " "; - if ( ttl < 0 ) - { // translators: an annotation to a gpg keys expiry date - ret += _("(EXPIRED)"); - } - else if ( ttl == 0 ) - { // translators: an annotation to a gpg keys expiry date - ret += _("(expires within 24h)"); - } - else - { // translators: an annotation to a gpg keys expiry date - ret += str::form( _PL("(expires in %d day)", "(expires in %d days)", ttl ), ttl ); - } - } - return ret; - } - - std::string PublicKeyData::gpgPubkeyVersion() const - { return _pimpl->_id.empty() ? _pimpl->_id : str::toLower( _pimpl->_id.substr(8,8) ); } - - std::string PublicKeyData::gpgPubkeyRelease() const - { return _pimpl->_created ? str::hexstring( _pimpl->_created ).substr(2) : std::string(); } - - std::string PublicKeyData::asString() const - { - return str::form( "[%s-%s] [%s] [%s] [TTL %d]", - _pimpl->_id.c_str(), - gpgPubkeyRelease().c_str(), - _pimpl->_name.c_str(), - _pimpl->_fingerprint.c_str(), - daysToLive() ); - } - - std::ostream & dumpOn( std::ostream & str, const PublicKeyData & obj ) - { - str << "[" << obj.name() << "]" << endl; - str << " fpr " << obj.fingerprint() << endl; - str << " id " << obj.id() << endl; - str << " cre " << Date::ValueType(obj.created()) << ' ' << obj.created() << endl; - str << " exp " << Date::ValueType(obj.expires()) << ' ' << obj.expiresAsString() << endl; - str << " ttl " << obj.daysToLive() << endl; - str << " rpm " << obj.gpgPubkeyVersion() << "-" << obj.gpgPubkeyRelease() << endl; - str << "]"; - return str; - } - - bool operator==( const PublicKeyData & lhs, const PublicKeyData & rhs ) - { return ( lhs.fingerprint() == rhs.fingerprint() && lhs.created() == rhs.created() ); } - - - /////////////////////////////////////////////////////////////////// - /// \class PublicKeyScanner::Impl - /// \brief PublicKeyScanner implementation. - /////////////////////////////////////////////////////////////////// - struct PublicKeyScanner::Impl - { - std::vector _words; - enum { pNONE, pPUB, pSIG, pFPR, pUID } _parseEntry; - bool _parseOff; // no 'sub:' key parsing - - Impl() - : _parseEntry( pNONE ) - , _parseOff( false ) - {} - - void scan( std::string & line_r, std::list & keys_r ) - { - // pub:-:1024:17:A84EDAE89C800ACA:971961473:1214043198::-:SuSE Package Signing Key : - // fpr:::::::::79C179B2E1C820C1890F9994A84EDAE89C800ACA: - // sig:::17:A84EDAE89C800ACA:1087899198:::::[selfsig]::13x: - // sig:::17:9E40E310000AABA4:980442706::::[User ID not found]:10x: - // sig:::1:77B2E6003D25D3D9:980443247::::[User ID not found]:10x: - // sig:::17:A84EDAE89C800ACA:1318348291:::::[selfsig]::13x: - // sub:-:2048:16:197448E88495160C:971961490:1214043258::: [expires: 2008-06-21] - // sig:::17:A84EDAE89C800ACA:1087899258:::::[keybind]::18x: - if ( line_r.empty() ) - return; - - // quick check for interesting entries, no parsing in subkeys - _parseEntry = pNONE; - switch ( line_r[0] ) - { - case 'p': - if ( line_r[1] == 'u' && line_r[2] == 'b' && line_r[3] == ':' ) - { - _parseEntry = pPUB; - _parseOff = false; - } - break; - - case 'f': - if ( line_r[1] == 'p' && line_r[2] == 'r' && line_r[3] == ':' ) - _parseEntry = pFPR; - break; - - case 'u': - if ( line_r[1] == 'i' && line_r[2] == 'd' && line_r[3] == ':' ) - _parseEntry = pUID; - break; - - case 's': - if ( line_r[1] == 'i' && line_r[2] == 'g' && line_r[3] == ':' ) - _parseEntry = pSIG; - else if ( line_r[1] == 'u' && line_r[2] == 'b' && line_r[3] == ':' ) - _parseOff = true; - break; - - default: - return; - } - if ( _parseOff || _parseEntry == pNONE ) - return; - - if ( line_r[line_r.size()-1] == '\n' ) - line_r.erase( line_r.size()-1 ); - // DBG << line_r << endl; - - _words.clear(); - str::splitFields( line_r, std::back_inserter(_words), ":" ); - - PublicKeyData * key( &keys_r.back() ); - - switch ( _parseEntry ) - { - case pPUB: - keys_r.push_back( PublicKeyData() ); // reset upon new key - key = &keys_r.back(); - key->_pimpl->_id = _words[4]; - key->_pimpl->_name = str::replaceAll( _words[9], "\\x3a", ":" ); - key->_pimpl->_created = Date(str::strtonum(_words[5])); - key->_pimpl->_expires = Date(str::strtonum(_words[6])); - break; - - case pSIG: - // Update creation/modification date from signatures type "13x". - if ( ( _words.size() > 10 && _words[10] == "13x" ) - || ( _words.size() > 12 && _words[12] == "13x" ) ) - { - Date cdate(str::strtonum(_words[5])); - if ( key->_pimpl->_created < cdate ) - key->_pimpl->_created = cdate; - } - break; - - case pFPR: - if ( key->_pimpl->_fingerprint.empty() ) - key->_pimpl->_fingerprint = _words[9]; - break; - - case pUID: - if ( ! _words[9].empty() ) - key->_pimpl->_name = str::replaceAll( _words[9], "\\x3a", ":" ); - break; - - case pNONE: - break; // intentionally no default: - } - } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // class PublicKeyScanner - /////////////////////////////////////////////////////////////////// - - PublicKeyScanner::PublicKeyScanner() - : _pimpl( new Impl ) - {} - - PublicKeyScanner::~PublicKeyScanner() - {} - - void PublicKeyScanner::scan( std::string line_r ) - { _pimpl->scan( line_r, _keys ); } - - - /////////////////////////////////////////////////////////////////// - /// \class PublicKey::Impl - /// \brief PublicKey implementation. - /////////////////////////////////////////////////////////////////// - struct PublicKey::Impl - { - Impl() - {} - - Impl( const Pathname & keyFile_r ) - { - PathInfo info( keyFile_r ); - MIL << "Taking pubkey from " << keyFile_r << " of size " << info.size() << " and sha1 " << filesystem::checksum(keyFile_r, "sha1") << endl; - - if ( !info.isExist() ) - ZYPP_THROW(Exception("Can't read public key from " + keyFile_r.asString() + ", file not found")); - - if ( filesystem::hardlinkCopy( keyFile_r, _dataFile.path() ) != 0 ) - ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " + _dataFile.path().asString() )); - - readFromFile(); - } - - Impl( const filesystem::TmpFile & sharedFile_r ) - : _dataFile( sharedFile_r ) - { readFromFile(); } - - Impl( const filesystem::TmpFile & sharedFile_r, const PublicKeyData & keyData_r ) - : _dataFile( sharedFile_r ) - , _keyData( keyData_r ) - { - if ( ! keyData_r ) - { - WAR << "Invalid PublicKeyData supplied: scanning from file" << endl; - readFromFile(); - } - } - - public: - const PublicKeyData & keyData() const - { return _keyData; } - - Pathname path() const - { return _dataFile.path(); } - - const std::list & hiddenKeys() const - { return _hiddenKeys; } - - protected: - void readFromFile() - { - PathInfo info( _dataFile.path() ); - MIL << "Reading pubkey from " << info.path() << " of size " << info.size() << " and sha1 " << filesystem::checksum(info.path(), "sha1") << endl; - - static filesystem::TmpDir dir; - const char* argv[] = - { - "gpg", - "-v", - "--no-default-keyring", - "--fixed-list-mode", - "--with-fingerprint", - "--with-colons", - "--homedir", - dir.path().asString().c_str(), - "--quiet", - "--no-tty", - "--no-greeting", - "--batch", - "--status-fd", "1", - _dataFile.path().asString().c_str(), - NULL - }; - ExternalProgram prog( argv, ExternalProgram::Discard_Stderr, false, -1, true ); - - PublicKeyScanner scanner; - for ( std::string line = prog.receiveLine(); !line.empty(); line = prog.receiveLine() ) - { - scanner.scan( line ); - } - prog.close(); - - switch ( scanner._keys.size() ) - { - case 0: - ZYPP_THROW( BadKeyException( "File " + _dataFile.path().asString() + " doesn't contain public key data" , _dataFile.path() ) ); - break; - - case 1: - // ok. - _keyData = scanner._keys.back(); - _hiddenKeys.clear(); - break; - - default: - WAR << "File " << _dataFile.path().asString() << " contains multiple keys: " << scanner._keys << endl; - _keyData = scanner._keys.back(); - scanner._keys.pop_back(); - _hiddenKeys.swap( scanner._keys ); - break; - } - - MIL << "Read pubkey from " << info.path() << ": " << _keyData << endl; - } - - private: - filesystem::TmpFile _dataFile; - PublicKeyData _keyData; - std::list _hiddenKeys; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // class PublicKey - /////////////////////////////////////////////////////////////////// - PublicKey::PublicKey() - : _pimpl( Impl::nullimpl() ) - {} - - PublicKey::PublicKey( const Pathname & file ) - : _pimpl( new Impl( file ) ) - {} - - PublicKey::PublicKey( const filesystem::TmpFile & sharedfile ) - : _pimpl( new Impl( sharedfile ) ) - {} - - PublicKey::PublicKey( const filesystem::TmpFile & sharedfile, const PublicKeyData & keydata ) - : _pimpl( new Impl( sharedfile, keydata ) ) - {} - - PublicKey::~PublicKey() - {} - - const PublicKeyData & PublicKey::keyData() const - { return _pimpl->keyData(); } - - Pathname PublicKey::path() const - { return _pimpl->path(); } - - const std::list & PublicKey::hiddenKeys() const - { return _pimpl->hiddenKeys(); } - - std::string PublicKey::id() const - { return keyData().id(); } - - std::string PublicKey::name() const - { return keyData().name(); } - - std::string PublicKey::fingerprint() const - { return keyData().fingerprint(); } - - Date PublicKey::created() const - { return keyData().created(); } - - Date PublicKey::expires() const - { return keyData().expires(); } - - bool PublicKey::expired() const - { return keyData().expired(); } - - int PublicKey::daysToLive() const - { return keyData().daysToLive(); } - - std::string PublicKey::expiresAsString() const - { return keyData().expiresAsString(); } - - std::string PublicKey::gpgPubkeyVersion() const - { return keyData().gpgPubkeyVersion(); } - - std::string PublicKey::gpgPubkeyRelease() const - { return keyData().gpgPubkeyRelease(); } - - std::string PublicKey::asString() const - { return keyData().asString(); } - - bool PublicKey::operator==( const PublicKey & rhs ) const - { return rhs.keyData() == keyData(); } - - bool PublicKey::operator==( const std::string & sid ) const - { return sid == id(); } - - std::ostream & dumpOn( std::ostream & str, const PublicKey & obj ) - { return dumpOn( str, obj.keyData() ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/PublicKey.h b/libzypp/zypp/PublicKey.h deleted file mode 100644 index 9ba6bad..0000000 --- a/libzypp/zypp/PublicKey.h +++ /dev/null @@ -1,289 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/PublicKey.h - * -*/ -#ifndef ZYPP_PUBLICKEY_H -#define ZYPP_PUBLICKEY_H - -#include -#include -#include -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" -#include "zypp/Date.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace filesystem - { - class TmpFile; - } - - /////////////////////////////////////////////////////////////////// - /// \class BadKeyException - /// \brief Exception thrown when the supplied key is not a valid gpg key - /////////////////////////////////////////////////////////////////// - class BadKeyException : public Exception - { - public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - BadKeyException() - : Exception( "Bad Key Exception" ) - {} - - Pathname keyFile() const - { return _keyfile; } - - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - BadKeyException( const std::string & msg_r, const Pathname &keyfile = Pathname() ) - : Exception( msg_r ), _keyfile(keyfile) - {} - /** Dtor. */ - virtual ~BadKeyException() throw() {}; - private: - Pathname _keyfile; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class PublicKeyData - /// \brief Class representing one GPG Public Keys data. - /// \ref PublicKeyData are provided e.g. by a \ref PublicKey or - /// a \ref KeyRing. \ref PublicKeyData are usually easier to - /// retrieve and sufficient unless you actually need an ASCII - /// armored version of the key placed in a tempfile. In this - /// case use \ref PublicKey. - /////////////////////////////////////////////////////////////////// - class PublicKeyData - { - public: - /** Default constructed: empty data. */ - PublicKeyData(); - - ~PublicKeyData(); - - /** Scan data from 'gpg --with-colons' key listings. */ - friend class PublicKeyScanner; - - /** Whether this contains valid data (not default constructed). */ - explicit operator bool() const; - - public: - /** Key ID. */ - std::string id() const; - - /** Key name. */ - std::string name() const; - - /** Key fingerprint.*/ - std::string fingerprint() const; - - /** Creation / last modification date (latest selfsig). */ - Date created() const; - - /** Expiry date, or \c Date() if the key never expires. */ - Date expires() const; - - /** Whether the key has expired. */ - bool expired() const; - - /** Number of days (24h) until the key expires (or since it exired). - * A value of \c 0 means the key will expire within the next 24h. - * Negative values indicate the key has expired less than \c N days ago. - * For keys without expiration date \c INT_MAX is returned. - */ - int daysToLive() const; - - /** * Expiry info in a human readable form. - * The exipry daye plus an annotation if the key has expired, or will - * expire within 90 days. - * \code - * (does not expire) - * Tue May 11 13:37:33 CEST 2010 - * Tue May 11 13:37:33 CEST 2010 (expires in 90 days) - * Tue May 11 13:37:33 CEST 2010 (expires in 1 day) - * Tue May 11 13:37:33 CEST 2010 (expires within 24h) - * Tue May 11 13:37:33 CEST 2010 (EXPIRED) - * \endcode - */ - std::string expiresAsString() const; - - /** Gpg-pubkey version as computed by rpm (trailing 8 byte \ref id) */ - std::string gpgPubkeyVersion() const; - - /** Gpg-pubkey release as computed by rpm (hexencoded \ref created) */ - std::string gpgPubkeyRelease() const; - - /** Simple string representation. - * Encodes \ref id, \ref gpgPubkeyRelease, \ref name and \ref fingerprint. - * \code - * [E3A5C360307E3D54-4be01a65] [SuSE Package Signing Key ] [4E98E67519D98DC7362A5990E3A5C360307E3D54] - * \endcode - */ - std::string asString() const; - - private: - class Impl; - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PublicKeyData Stream output */ - inline std::ostream & operator<<( std::ostream & str, const PublicKeyData & obj ) - { return str << obj.asString(); } - - /** \relates PublicKeyData Detailed stream output */ - std::ostream & dumpOn( std::ostream & str, const PublicKeyData & obj ); - - /** \relates PublicKeyData Equal based on fingerprint anf creation date. */ - bool operator==( const PublicKeyData & lhs, const PublicKeyData & rhs ); - - /** \relates PublicKeyData NotEqual. */ - inline bool operator!=( const PublicKeyData & lhs, const PublicKeyData & rhs ) - { return !( lhs == rhs ); } - - /////////////////////////////////////////////////////////////////// - /// \class PublicKeyScanner - /// \brief Scan abstract from 'gpg --with-colons' key listings. - /// Feed gpg output line by line into \ref scan. The collected \ref PublicKeyData - /// contain the keys data (fingerprint, uid,...) but not the key itself (ASCII - /// armored stored in a file). - /// \code - /// std::list result; - /// { - /// PublicKeyScanner scanner; - /// for ( std::string line = prog.receiveLine(); !line.empty(); line = prog.receiveLine() ) - /// scanner.scan( line ); - /// result.swap( scanner._keys ); - /// } - /// \endcode - /// \relates PublicKeyData - /////////////////////////////////////////////////////////////////// - struct PublicKeyScanner - { - PublicKeyScanner(); - ~PublicKeyScanner(); - - /** Feed gpg output line by line into \ref scan. */ - void scan( std::string line_r ); - - /** Extracted keys. */ - std::list _keys; - - private: - class Impl; - RW_pointer > _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - /// \class PublicKey - /// \brief Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile). - /// - /// If you don't need the ASCII armored version of the key stored in - /// a tempfile, using \ref PublicKeyData might be sufficient. - /// - /// \note In case the ASCII armored blob actually contains multiple - /// keys, the \b last keys data are made available via the API. The - /// additional keys data are made available via \ref hiddenKeys. - /////////////////////////////////////////////////////////////////// - class PublicKey - { - public: - /** Implementation */ - class Impl; - - public: - /** Default ctor. */ - PublicKey(); - - /** Ctor taking the key from a file. - * - * This is quite expensive, as a copy of the file is created and - * used. If you can construct PublicKey from a \ref filesystem::TmpFile, - * this prevents copying. - * - * \throws when data does not make a key - */ - explicit PublicKey( const Pathname & keyFile_r ); - - /** Ctor reading the key from a \ref TmpFile. - * - * PublicKey holds a reference on the TmpFile providing the key. - * - * \throws when data does not make a key - */ - explicit PublicKey( const filesystem::TmpFile & sharedFile_r ); - - ~PublicKey(); - - public: - /** The public keys data (\see \ref PublicKeyData).*/ - const PublicKeyData & keyData() const; - - bool isValid() const - { return ! ( id().empty() || fingerprint().empty() ); } - - std::string id() const; //!< \see \ref PublicKeyData - std::string name() const; //!< \see \ref PublicKeyData - std::string fingerprint() const; //!< \see \ref PublicKeyData - Date created() const; //!< \see \ref PublicKeyData - Date expires() const; //!< \see \ref PublicKeyData - std::string expiresAsString() const; //!< \see \ref PublicKeyData - bool expired() const; //!< \see \ref PublicKeyData - int daysToLive() const; //!< \see \ref PublicKeyData - std::string gpgPubkeyVersion() const; //!< \see \ref PublicKeyData - std::string gpgPubkeyRelease() const; //!< \see \ref PublicKeyData - std::string asString() const; //!< \see \ref PublicKeyData - - public: - /** File containig the ASCII armored key. */ - Pathname path() const; - - /** Additional keys data in case the ASCII armored blob containes multiple keys. */ - const std::list & hiddenKeys() const; - - public: - bool operator==( const PublicKey & rhs ) const; - bool operator==( const std::string & sid ) const; - - private: - friend class KeyRing; - /** KeyRing ctor: No need to parse file if KeyRing already had valid KeyData. */ - PublicKey( const filesystem::TmpFile & sharedFile_r, const PublicKeyData & keyData_r ); - - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PublicKey Stream output */ - inline std::ostream & operator<<( std::ostream & str, const PublicKey & obj ) - { return str << obj.asString(); } - - /** \relates PublicKey Detailed stream output */ - std::ostream & dumpOn( std::ostream & str, const PublicKey & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PUBLICKEY_H diff --git a/libzypp/zypp/Range.cc b/libzypp/zypp/Range.cc deleted file mode 100644 index 34d11bc..0000000 --- a/libzypp/zypp/Range.cc +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Range.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/Range.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace range_detail - { - /** Compute Range overlaps. - * Takes the \a lhs and \a rhs operator and the result - * of comparing \a lhs and \a rhs (-1,0,1). - * - */ - bool overlaps( Rel lhs, Rel rhs, int cmp ) - { - if ( lhs == Rel::NONE || rhs == Rel::NONE ) - return false; - if ( lhs == Rel::ANY || rhs == Rel::ANY ) - return true; - - if ( lhs == Rel::NE ) - { - if ( cmp < 0 ) - { - // lhs < rhs - return( rhs == Rel::GE - || rhs == Rel::EQ ); - } else if ( cmp > 0) - { - // lhs > rhs - return( rhs == Rel::LT - || rhs == Rel::EQ ); - } else - { - //lhs == rhs - return ( rhs == Rel::GT - || rhs == Rel::LT ); - } - } - - if ( rhs == Rel::NE ) - { - if ( cmp < 0 ) - { - // lhs < rhs - return( lhs == Rel::LE - || lhs == Rel::EQ ); - } else if ( cmp > 0) - { - // lhs > rhs - return( lhs == Rel::GT - || lhs == Rel::EQ ); - } else - { - //lhs == rhs - return ( lhs == Rel::GT - || lhs == Rel::LT ); - } - } - - if ( cmp < 0 ) - { - // lhs < rhs: either lhs includes greater values or rhs includes lower. - return( lhs == Rel::GT - || lhs == Rel::GE - || rhs == Rel::LT - || rhs == Rel::LE ); - } - - if ( cmp > 0 ) - { - // lhs > rhs: either lhs includes lower values or rhs includes greater. - return( lhs == Rel::LT - || lhs == Rel::LE - || rhs == Rel::GT - || rhs == Rel::GE ); - } - - // lhs == rhs: either both ranges include Rel::EQ, or both head - // into the same direction. - if ( ( lhs == Rel::LE || lhs == Rel::EQ || lhs == Rel::GE ) - && ( rhs == Rel::LE || rhs == Rel::EQ || rhs == Rel::GE ) ) - return true; - if ( ( lhs == Rel::LT && ( rhs == Rel::LT || rhs == Rel::LE ) ) - || ( lhs == Rel::GT && ( rhs == Rel::GT || rhs == Rel::GE ) ) - || ( rhs == Rel::LT && ( lhs == Rel::LT || lhs == Rel::LE ) ) - || ( rhs == Rel::GT && ( lhs == Rel::GT || lhs == Rel::GE ) ) ) - return true; - // else - return false; - - } - } - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Range.h b/libzypp/zypp/Range.h deleted file mode 100644 index 41878e3..0000000 --- a/libzypp/zypp/Range.h +++ /dev/null @@ -1,95 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Range.h - * -*/ -#ifndef ZYPP_RANGE_H -#define ZYPP_RANGE_H - -#include "zypp/RelCompare.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace range_detail - { - bool overlaps( Rel lhs, Rel rhs, int cmp ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Range - // - /** - * - */ - template > - struct Range - { - /** */ - Rel op; - /** */ - _Tp value; - - /** Default ctor: \ref Rel::ANY. */ - Range() - : op( Rel::ANY ) - {} - - /** Ctor taking \a _Tp (\ref Rel::EQ). */ - Range( const _Tp & value_r ) - : op( Rel::EQ ) - , value( value_r ) - {} - - /** Ctor taking \ref Rel and \a _Tp. */ - Range( Rel op_r, const _Tp & value_r ) - : op( op_r ) - , value( value_r ) - {} - - /** Return whether two Ranges overlap. */ - bool overlaps( const Range & rhs ) const - { - return range_detail::overlaps( op, rhs.op, - _Compare()( value, rhs.value ) ); - } - }; - /////////////////////////////////////////////////////////////////// - - template - inline bool overlaps( const Range<_Tp,_Compare> & lhs, - const Range<_Tp,_Compare> & rhs ) - { return lhs.overlaps( rhs ); } - - /////////////////////////////////////////////////////////////////// - - template - inline bool operator==( const Range<_Tp,_Compare> & lhs, - const Range<_Tp,_Compare> & rhs ) - { - return( lhs.op == rhs.op - && ( lhs.op == Rel::ANY - || lhs.op == Rel::NONE - || relCompare( Rel::EQ, lhs.value, rhs.value, - _Compare() ) - ) - ); - } - - template - inline bool operator!=( const Range<_Tp,_Compare> & lhs, - const Range<_Tp,_Compare> & rhs ) - { return ! ( lhs == rhs ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RANGE_H diff --git a/libzypp/zypp/Rel.cc b/libzypp/zypp/Rel.cc deleted file mode 100644 index 1839c63..0000000 --- a/libzypp/zypp/Rel.cc +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Rel.cc - * -*/ -#include -#include - -#include "zypp/base/Exception.h" - -#include "zypp/Rel.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace - { - std::map _table; - - std::map::const_iterator findStr( const std::string & strval_r ) - { - if ( _table.empty() ) - { - // initialize it - _table["EQ"] = _table["eq"] = _table["=="] = _table["="] = Rel::EQ_e; - _table["NE"] = _table["ne"] = _table["!="] = Rel::NE_e; - _table["LT"] = _table["lt"] = _table["<"] = Rel::LT_e; - _table["LE"] = _table["le"] = _table["lte"] = _table["<="] = Rel::LE_e; - _table["GT"] = _table["gt"] = _table[">"] = Rel::GT_e; - _table["GE"] = _table["ge"] = _table["gte"] = _table[">="] = Rel::GE_e; - _table["ANY"] = _table["any"] = _table["(any)"] = _table[""] = Rel::ANY_e; - _table["NONE"] = _table["none"] = Rel::NONE_e; - } - - return _table.find( strval_r ); - } - - Rel::for_use_in_switch parse( const std::string & strval_r ) - { - std::map::const_iterator it = findStr( strval_r ); - if ( it == _table.end() ) - { - ZYPP_THROW( Exception("Rel parse: illegal string value '"+strval_r+"'") ); - } - return it->second; - } - - Rel::for_use_in_switch parse( const std::string & strval_r, const Rel & default_r ) - { - std::map::const_iterator it = findStr( strval_r ); - if ( it == _table.end() ) - { - return default_r.inSwitch(); - } - return it->second; - } - } - /////////////////////////////////////////////////////////////////// - - const Rel Rel::EQ( Rel::EQ_e ); - const Rel Rel::NE( Rel::NE_e ); - const Rel Rel::LT( Rel::LT_e ); - const Rel Rel::LE( Rel::LE_e ); - const Rel Rel::GT( Rel::GT_e ); - const Rel Rel::GE( Rel::GE_e ); - const Rel Rel::ANY( Rel::ANY_e ); - const Rel Rel::NONE( Rel::NONE_e ); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Rel::Rel - // METHOD TYPE : Constructor - // - Rel::Rel( const std::string & strval_r ) - : _op( parse( strval_r ) ) - {} - - Rel::Rel( const std::string & strval_r, const Rel & default_r ) - : _op( parse( strval_r, default_r ) ) - {} - - bool Rel::parseFrom( const std::string & strval_r ) - { - std::map::const_iterator it = findStr( strval_r ); - if ( it == _table.end() ) - { - return false; - } - _op = it->second; - return true; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Rel::asString - // METHOD TYPE : const std::string & - // - const std::string & Rel::asString() const - { - static std::map _table; - if ( _table.empty() ) - { - // initialize it - _table[EQ_e] = "=="; - _table[NE_e] = "!="; - _table[LT_e] = "<"; - _table[LE_e] = "<="; - _table[GT_e] = ">"; - _table[GE_e] = ">="; - _table[ANY_e] = "ANY"; - _table[NONE_e] = "NONE"; - } - return _table[_op]; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Rel.h b/libzypp/zypp/Rel.h deleted file mode 100644 index 6c86587..0000000 --- a/libzypp/zypp/Rel.h +++ /dev/null @@ -1,175 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Rel.h - * -*/ -#ifndef ZYPP_REL_H -#define ZYPP_REL_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Rel - // - /** Relational operators. - * Yes, it could as well be simply an \c enum.
- * Yes, you can use the relational operators as if it was an \c enum.
- * Except for use in a \c switch statement; see \ref inSwitch for this. - * - * But we want to construct them from a string representation, as well as - * providing one. And this way they are wrapped into a namespace, which is - * a good idea anyway. - * - * \ref ANY and \ref NONE are somewhat special. \ref ANY is the - * operator created by the default ctor, and it should always resolve - * to \c true. This may be handy in queries when you're looking for a - * Resolvable in \c ANY Edition if no operator was specified. - * While \ref NONE should always resolve to \c false. - * - * \ingroup g_EnumerationClass - */ - struct Rel - { - /** \name Relational operators - * These are the \em real relational operator contants to - * use. Don't mind that it's not an enum. See also: \ref zypp::Rel::inSwitch - */ - //@{ - static const Rel EQ; - static const Rel NE; - static const Rel LT; - static const Rel LE; - static const Rel GT; - static const Rel GE; - static const Rel ANY; - static const Rel NONE; - //@} - - /** Enumarators provided \b only for use \ref inSwitch statement. - * \see inSwitch - * \note Enumarator values also correspond to the values libsolv - * uses to encode these relations. - */ - enum for_use_in_switch { - NONE_e = 0U, - GT_e = 1U, - EQ_e = 2U, - LT_e = 4U, - GE_e = GT_e|EQ_e, - LE_e = LT_e|EQ_e, - NE_e = GT_e|LT_e, - ANY_e = GT_e|EQ_e|LT_e, - }; - - /** DefaultCtor ANY. */ - Rel() - : _op( ANY_e ) - {} - - /** Ctor from string. - * Legal values for \a strval_r are: "==", "!=", "<", "<=", ">", ">=",
- * as well as "EQ", "NE", "LT", "LE", "GT", "GE", "ANY", "NONE"
- * and "" (empty string resolves to ANY). - * - * Lower case names are accepted as well. - * - * \throw PARSE if \a strval_r is not legal. - * \todo refine exceptions and check throw. - */ - explicit - Rel( const std::string & strval_r ); - - /** Ctor from string (non-throwing). - * Illegal string values resolve to \c default_r - */ - Rel( const std::string & strval_r, const Rel & default_r ); - - /** Assign from string IFF it contains a legal value. - * \return Whether \a strval_r contained a legal value. - */ - bool parseFrom( const std::string & strval_r ); - - /** Ctor from bits. */ - explicit - Rel( unsigned bits_r ) - : _op( for_use_in_switch(bits_r & ANY_e) ) - {} - - /** Test whether \a bits_r is a valid \ref Rel (no extra bits set). */ - static bool isRel( unsigned bits_r ) - { return (bits_r & ANY_e) == bits_r; } - - /** String representation of relational operator. - * \return "==", "!=", "<", "<=", ">", ">=", "ANY" or "NONE" - */ - const std::string & asString() const; - /** \overload */ - const char * c_str() const - { return asString().c_str(); } - - /** Enumarator provided for use in \c switch statement. - * The sole reason for providing enum \ref for_use_in_switch is, - * that we may want to use the relational operators in a \c switch - * statement. Tht's the only case where you should have to use the - * enumarator. - * \code - * Rel op; - * switch ( op.inSwitch() ) - * { - * case Rel::EQ_e: - * ... - * break; - * case Rel::NE_e: - * ... - * - * // No default! Let compiler warn if case is missing - * } - * \endcode - */ - for_use_in_switch inSwitch() const - { return _op; } - - /** Enumarator values suitable for libsolv. */ - unsigned bits() const - { return _op; } - - private: - /** Ctor to initialize the relational operator contants. */ - Rel( for_use_in_switch op_r ) - : _op( op_r ) - {} - /** The operator. */ - for_use_in_switch _op; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Rel Stream output. */ - inline std::ostream & operator<<( std::ostream & str, const Rel & obj ) - { return str << obj.asString(); } - - /////////////////////////////////////////////////////////////////// - - /** \relates Rel */ - inline bool operator==( const Rel & lhs, const Rel & rhs ) - { return lhs.inSwitch() == rhs.inSwitch(); } - - /** \relates Rel */ - inline bool operator!=( const Rel & lhs, const Rel & rhs ) - { return ! ( lhs == rhs ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_REL_H diff --git a/libzypp/zypp/RelCompare.h b/libzypp/zypp/RelCompare.h deleted file mode 100644 index ac3dc1f..0000000 --- a/libzypp/zypp/RelCompare.h +++ /dev/null @@ -1,233 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RelCompare.h - * -*/ -#ifndef ZYPP_RELCOMPARE_H -#define ZYPP_RELCOMPARE_H - -#include - -#include "zypp/Rel.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** \defgroup RelCompare Comparison using relational operator zypp::Rel. - * - * . Take a class like zypp::Edition. Editions are comaprable. - * You can compare them lexicographical, or according to their - * version and release values, or match them (i.e. taking empty - * version or release values as wildcard). - * - * No matter which way is appropriate within a certain context. - * You need functions to compare, and may want to use classes like - * zypp::Range, based on the desired comparison. - * - * All the class has to do, is providing a general comparison - * method (preferably static) - * \code - * // Compare two elements returning -1, 0, 1 - * // if the elemants compare <,==,>. - * static int compare( const _Tp & lhs, const _Tp & rhs ); - * \endcode - * - * Compare\<_Tp\> provides a functor wrapping \c compare. - * In case the general comparison method is named differently, the - * class, or you, have to provide an approriate functor. - * - * compareByRel then compares two elements using a certain - * operator and general comparison method. - * \code - * compareByRel( Rel::EQ, lhs, rhs, Edition::compare ); - * compareByRel( Rel::EQ, lhs, rhs, Edition::match ); - * compareByRel( Rel::EQ, lhs, rhs ); // defaults to Compare\ - * // thus Edition::compare - * \endcode - * - * Furthermore a bunch of functors using a certain opertator is - * defined. All templated by type and general comparison - * method (defaults to Compare\<_Tp\>). - * \code - * // Editions sets use lexicographical order per default: - * std::set - * - * // An Edition set using Edition::compare as order: - * std::set >; - * - * // Edition::match is not transitive, thus not an appropriate - * // order relation for std::set or std::map. - * \endcode - * - * Classes like zypp:Range are templated by by type and general - * comparison method as well. Thus you may use Edition ranges based - * on Edition::Compare, as well as ranges based on Edition::Match - * (Edition provides these two functors). - * - * Again: Everything a class has to provide is the general - * comparison method. Comparison functors and ranges are then - * immediately available. - */ - //@{ - - /** General compare functor returning -1, 0, 1. - * Expects _Tp::compare to be a static comaprison method - * returning -1, 0, 1 if the elements compare - * \<,==,\>. - */ - template - struct Compare : public std::binary_function<_Tp,_Tp,int> - { - int operator()( const _Tp & lhs, const _Tp & rhs ) const - { return _Tp::compare( lhs, rhs ); } - }; - - /////////////////////////////////////////////////////////////////// - - /** Comparison of two elements using relational operator \a op. - * Expects \a _Compare to be a binary operator returning - * -1, 0, 1 if the elemants compare \<,==,\>. - * \code - * // Signature of compare function or functor: - * int compare( const _Tp & lhs, const _Tp & rhs ); - * \endcode - * \li If \a op is Rel::ANY, the expression is always \c true. - * \li If \a op is Rel::NONE, the expression is always \c false. - * \li Otherwise the expression is evaluated using \a compare. - * - * \ingroup RelCompare - */ - template - inline bool compareByRel( Rel op, const _Tp & lhs, const _Tp & rhs, - _Compare compare ) - { - switch ( op.inSwitch() ) - { - case Rel::EQ_e: - return compare( lhs, rhs ) == 0; - break; - case Rel::NE_e: - return compare( lhs, rhs ) != 0; - break; - case Rel::LT_e: - return compare( lhs, rhs ) < 0; - break; - case Rel::LE_e: - return compare( lhs, rhs ) <= 0; - break; - case Rel::GT_e: - return compare( lhs, rhs ) > 0; - break; - case Rel::GE_e: - return compare( lhs, rhs ) >= 0; - break; - case Rel::ANY_e: - return true; - break; - case Rel::NONE_e: - return false; - break; - } - return false; - } - - /** \ref compareByRel convenience using Compare<_Tp> as general compare - * functor. - */ - template - inline bool compareByRel( Rel op, const _Tp & lhs, const _Tp & rhs ) - { return compareByRel( op, lhs, rhs, Compare<_Tp>() ); } - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - - /** Functor to compare two elements by \ref Rel based on - * a general \a _Compare functor. - * - * Expects \a _Compare to be suitable for use in \ref compareByRel. - * Defaults to Compare\<_Tp\>. - */ - template > - struct CompareBy : public std::binary_function<_Tp,_Tp,bool> - { - CompareBy( Rel op_r ) - : _op( op_r ) - {} - - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( _op, lhs, rhs, _Compare() ); } - - Rel _op; - }; - - template > - struct CompareByEQ : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::EQ, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByNE : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::NE, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByLT : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::LT, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByLE : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::LE, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByGT : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::GT, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByGE : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::GE, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByANY : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::ANY, lhs, rhs, _Compare() ); } - }; - - template > - struct CompareByNONE : public std::binary_function<_Tp,_Tp,bool> - { - bool operator()( const _Tp & lhs, const _Tp & rhs ) const - { return compareByRel( Rel::NONE, lhs, rhs, _Compare() ); } - }; - - /////////////////////////////////////////////////////////////////// - - //@} - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RELCOMPARE_H diff --git a/libzypp/zypp/RepoInfo.cc b/libzypp/zypp/RepoInfo.cc deleted file mode 100644 index cd20b96..0000000 --- a/libzypp/zypp/RepoInfo.cc +++ /dev/null @@ -1,559 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoInfo.cc - * -*/ -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/parser/xml/XmlEscape.h" - -#include "zypp/RepoInfo.h" -#include "zypp/TriBool.h" -#include "zypp/Pathname.h" -#include "zypp/repo/RepoMirrorList.h" -#include "zypp/ExternalProgram.h" -#include "zypp/media/MediaAccess.h" - -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/parser/xml/Reader.h" - -using std::endl; -using zypp::xml::escape; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoInfo::Impl - // - /** RepoInfo implementation. */ - struct RepoInfo::Impl - { - Impl() - : gpgcheck(indeterminate) - , keeppackages(indeterminate) - , type(repo::RepoType::NONE_e) - , emptybaseurls(false) - {} - - ~Impl() - {} - - public: - static const unsigned defaultPriority = 99; - - void setProbedType( const repo::RepoType & t ) const - { - if ( type == repo::RepoType::NONE - && t != repo::RepoType::NONE ) - { - // lazy init! - const_cast(this)->type = t; - } - } - - public: - Pathname licenseTgz() const - { return metadatapath.empty() ? Pathname() : metadatapath / path / "license.tar.gz"; } - - Url mirrorListUrl() const - { return replacer(mirrorlist_url); } - - void mirrorListUrl( const Url & url_r ) - { mirrorlist_url = url_r; } - - const Url & rawMirrorListUrl() const - { return mirrorlist_url; } - - const url_set & baseUrls() const - { - if ( _baseUrls.empty() && ! mirrorListUrl().asString().empty() ) - { - emptybaseurls = true; - DBG << "MetadataPath: " << metadatapath << endl; - repo::RepoMirrorList rmurls( mirrorListUrl(), metadatapath ); - _baseUrls.insert( _baseUrls.end(), rmurls.getUrls().begin(), rmurls.getUrls().end() ); - } - return _baseUrls; - } - - url_set & baseUrls() - { return _baseUrls; } - - bool baseurl2dump() const - { return !emptybaseurls && !_baseUrls.empty(); } - - - void addContent( const std::string & keyword_r ) - { _keywords.insert( keyword_r ); } - - bool hasContent( const std::string & keyword_r ) const - { - if ( _keywords.empty() && ! metadatapath.empty() ) - { - // HACK directly check master index file until RepoManager offers - // some content probing ans zypepr uses it. - ///////////////////////////////////////////////////////////////// - MIL << "Empty keywords...." << metadatapath << endl; - Pathname master; - if ( PathInfo( (master=metadatapath/"/repodata/repomd.xml") ).isFile() ) - { - //MIL << "GO repomd.." << endl; - xml::Reader reader( master ); - while ( reader.seekToNode( 2, "content" ) ) - { - _keywords.insert( reader.nodeText().asString() ); - reader.seekToEndNode( 2, "content" ); - } - _keywords.insert( "" ); // valid content in _keywords even if empty - } - else if ( PathInfo( (master=metadatapath/"/content") ).isFile() ) - { - //MIL << "GO content.." << endl; - iostr::forEachLine( InputStream( master ), - [this]( int num_r, std::string line_r )->bool - { - if ( str::startsWith( line_r, "REPOKEYWORDS" ) ) - { - std::vector words; - if ( str::split( line_r, std::back_inserter(words) ) > 1 - && words[0].length() == 12 /*"REPOKEYWORDS"*/ ) - { - this->_keywords.insert( ++words.begin(), words.end() ); - } - return true; // mult. occurrances are ok. - } - return( ! str::startsWith( line_r, "META " ) ); // no need to parse into META section. - } ); - _keywords.insert( "" ); - } - ///////////////////////////////////////////////////////////////// - } - return( _keywords.find( keyword_r ) != _keywords.end() ); - - } - - public: - TriBool gpgcheck; - TriBool keeppackages; - Url gpgkey_url; - repo::RepoType type; - Pathname path; - std::string service; - std::string targetDistro; - Pathname metadatapath; - Pathname packagespath; - DefaultIntegral priority; - mutable bool emptybaseurls; - repo::RepoVariablesUrlReplacer replacer; - - private: - Url mirrorlist_url; - mutable url_set _baseUrls; - mutable std::set _keywords; - - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoInfo::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj ) - { - return str << "RepoInfo::Impl"; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoInfo - // - /////////////////////////////////////////////////////////////////// - - const RepoInfo RepoInfo::noRepo; - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : RepoInfo::RepoInfo - // METHOD TYPE : Ctor - // - RepoInfo::RepoInfo() - : _pimpl( new Impl() ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : RepoInfo::~RepoInfo - // METHOD TYPE : Dtor - // - RepoInfo::~RepoInfo() - { - //MIL << std::endl; - } - - unsigned RepoInfo::priority() const - { return _pimpl->priority; } - - unsigned RepoInfo::defaultPriority() - { return Impl::defaultPriority; } - - void RepoInfo::setPriority( unsigned newval_r ) - { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; } - - void RepoInfo::setGpgCheck( bool check ) - { _pimpl->gpgcheck = check; } - - void RepoInfo::setMirrorListUrl( const Url & url_r ) - { _pimpl->mirrorListUrl( url_r ); } - - void RepoInfo::setGpgKeyUrl( const Url & url_r ) - { _pimpl->gpgkey_url = url_r; } - - void RepoInfo::addBaseUrl( const Url & url_r ) - { - for ( const auto & url : _pimpl->baseUrls() ) // unique! - if ( url == url_r ) - return; - _pimpl->baseUrls().push_back( url_r ); - } - - void RepoInfo::setBaseUrl( const Url & url_r ) - { - _pimpl->baseUrls().clear(); - _pimpl->baseUrls().push_back( url_r ); - } - - void RepoInfo::setPath( const Pathname &path ) - { _pimpl->path = path; } - - void RepoInfo::setType( const repo::RepoType &t ) - { _pimpl->type = t; } - - void RepoInfo::setProbedType( const repo::RepoType &t ) const - { _pimpl->setProbedType( t ); } - - - void RepoInfo::setMetadataPath( const Pathname &path ) - { _pimpl->metadatapath = path; } - - void RepoInfo::setPackagesPath( const Pathname &path ) - { _pimpl->packagespath = path; } - - void RepoInfo::setKeepPackages( bool keep ) - { _pimpl->keeppackages = keep; } - - void RepoInfo::setService( const std::string& name ) - { _pimpl->service = name; } - - void RepoInfo::setTargetDistribution( const std::string & targetDistribution ) - { _pimpl->targetDistro = targetDistribution; } - - bool RepoInfo::gpgCheck() const - { return indeterminate(_pimpl->gpgcheck) ? true : (bool)_pimpl->gpgcheck; } - - bool RepoInfo::keepPackages() const - { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; } - - Pathname RepoInfo::metadataPath() const - { return _pimpl->metadatapath; } - - Pathname RepoInfo::packagesPath() const - { return _pimpl->packagespath; } - - repo::RepoType RepoInfo::type() const - { return _pimpl->type; } - - Url RepoInfo::mirrorListUrl() const - { return _pimpl->mirrorListUrl(); } - - Url RepoInfo::rawMirrorListUrl() const - { return _pimpl->rawMirrorListUrl(); } - - Url RepoInfo::gpgKeyUrl() const - { return _pimpl->gpgkey_url; } - - RepoInfo::url_set RepoInfo::baseUrls() const - { return url_set( baseUrlsBegin(), baseUrlsEnd() ); } // Variables replaced! - - Pathname RepoInfo::path() const - { return _pimpl->path; } - - std::string RepoInfo::service() const - { return _pimpl->service; } - - std::string RepoInfo::targetDistribution() const - { return _pimpl->targetDistro; } - - Url RepoInfo::rawUrl() const - { return( _pimpl->baseUrls().empty() ? Url() : *_pimpl->baseUrls().begin() ); } - - RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const - { - return make_transform_iterator( _pimpl->baseUrls().begin(), - _pimpl->replacer ); - } - - RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const - { - return make_transform_iterator( _pimpl->baseUrls().end(), - _pimpl->replacer ); - } - - RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const - { return _pimpl->baseUrls().size(); } - - bool RepoInfo::baseUrlsEmpty() const - { return _pimpl->baseUrls().empty(); } - - bool RepoInfo::baseUrlSet() const - { return _pimpl->baseurl2dump(); } - - - void RepoInfo::addContent( const std::string & keyword_r ) - { _pimpl->addContent( keyword_r ); } - - bool RepoInfo::hasContent( const std::string & keyword_r ) const - { return _pimpl->hasContent( keyword_r ); } - - /////////////////////////////////////////////////////////////////// - - bool RepoInfo::hasLicense() const - { - Pathname licenseTgz( _pimpl->licenseTgz() ); - return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile(); - } - - bool RepoInfo::needToAcceptLicense() const - { - static const std::string noAcceptanceFile = "no-acceptance-needed\n"; - bool accept = true; - - Pathname licenseTgz( _pimpl->licenseTgz() ); - if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() ) - return false; // no licenses at all - - ExternalProgram::Arguments cmd; - cmd.push_back( "tar" ); - cmd.push_back( "-t" ); - cmd.push_back( "-z" ); - cmd.push_back( "-f" ); - cmd.push_back( licenseTgz.asString() ); - - ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); - for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) - { - if ( output == noAcceptanceFile ) - { - accept = false; - } - } - MIL << "License for " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl; - return accept; - } - - std::string RepoInfo::getLicense( const Locale & lang_r ) - { return const_cast(this)->getLicense( lang_r ); } - - std::string RepoInfo::getLicense( const Locale & lang_r ) const - { - LocaleSet avlocales( getLicenseLocales() ); - if ( avlocales.empty() ) - return std::string(); - - Locale getLang( Locale::bestMatch( avlocales, lang_r ) ); - if ( getLang == Locale::noCode - && avlocales.find( Locale::noCode ) == avlocales.end() ) - { - WAR << "License.tar.gz contains no fallback text! " << *this << endl; - // Using the fist locale instead of returning no text at all. - // So the user might recognize that there is a license, even if he - // can't read it. - getLang = *avlocales.begin(); - } - - // now extract the license file. - static const std::string licenseFileFallback( "license.txt" ); - std::string licenseFile( getLang == Locale::noCode - ? licenseFileFallback - : str::form( "license.%s.txt", getLang.code().c_str() ) ); - - ExternalProgram::Arguments cmd; - cmd.push_back( "tar" ); - cmd.push_back( "-x" ); - cmd.push_back( "-z" ); - cmd.push_back( "-O" ); - cmd.push_back( "-f" ); - cmd.push_back( _pimpl->licenseTgz().asString() ); // if it not exists, avlocales was empty. - cmd.push_back( licenseFile ); - - std::string ret; - ExternalProgram prog( cmd, ExternalProgram::Discard_Stderr ); - for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) - { - ret += output; - } - prog.close(); - return ret; - } - - LocaleSet RepoInfo::getLicenseLocales() const - { - Pathname licenseTgz( _pimpl->licenseTgz() ); - if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() ) - return LocaleSet(); - - ExternalProgram::Arguments cmd; - cmd.push_back( "tar" ); - cmd.push_back( "-t" ); - cmd.push_back( "-z" ); - cmd.push_back( "-f" ); - cmd.push_back( licenseTgz.asString() ); - - LocaleSet ret; - ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); - for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) - { - static const C_Str license( "license." ); - static const C_Str dotTxt( ".txt\n" ); - if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) ) - { - if ( output.size() <= license.size() + dotTxt.size() ) // license.txt - ret.insert( Locale() ); - else - ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) ); - } - } - prog.close(); - return ret; - } - - /////////////////////////////////////////////////////////////////// - - std::ostream & RepoInfo::dumpOn( std::ostream & str ) const - { - RepoInfoBase::dumpOn(str); - if ( _pimpl->baseurl2dump() ) - { - for ( const auto & url : _pimpl->baseUrls() ) - { - str << "- url : " << url << std::endl; - } - } - - // print if non empty value - auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) { - if ( ! value_r.empty() ) - str << tag_r << value_r << std::endl; - }); - - strif( "- mirrorlist : ", _pimpl->rawMirrorListUrl().asString() ); - strif( "- path : ", path().asString() ); - str << "- type : " << type() << std::endl; - str << "- priority : " << priority() << std::endl; - str << "- gpgcheck : " << gpgCheck() << std::endl; - strif( "- gpgkey : ", gpgKeyUrl().asString() ); - - if ( ! indeterminate(_pimpl->keeppackages) ) - str << "- keeppackages: " << keepPackages() << std::endl; - - strif( "- service : ", service() ); - strif( "- targetdistro: ", targetDistribution() ); - strif( "- metadataPath: ", metadataPath().asString() ); - strif( "- packagesPath: ", packagesPath().asString() ); - - return str; - } - - std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const - { - RepoInfoBase::dumpAsIniOn(str); - - if ( _pimpl->baseurl2dump() ) - { - str << "baseurl="; - std::string indent; - for ( const auto & url : _pimpl->baseUrls() ) - { - str << indent << url << endl; - if ( indent.empty() ) indent = " "; // "baseurl=" - } - } - - if ( ! _pimpl->path.empty() ) - str << "path="<< path() << endl; - - if ( ! (_pimpl->rawMirrorListUrl().asString().empty()) ) - str << "mirrorlist=" << _pimpl->rawMirrorListUrl() << endl; - - str << "type=" << type().asString() << endl; - - if ( priority() != defaultPriority() ) - str << "priority=" << priority() << endl; - - if (!indeterminate(_pimpl->gpgcheck)) - str << "gpgcheck=" << (gpgCheck() ? "1" : "0") << endl; - if ( ! (gpgKeyUrl().asString().empty()) ) - str << "gpgkey=" <keeppackages)) - str << "keeppackages=" << keepPackages() << endl; - - if( ! service().empty() ) - str << "service=" << service() << endl; - - return str; - } - - std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const - { - std::string tmpstr; - str - << "" << endl; - - if ( _pimpl->baseurl2dump() ) - { - for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables - str << "" << escape((*it).asString()) << "" << endl; - } - - str << "" << endl; - return str; - } - - - std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) - { - return obj.dumpOn(str); - } - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/RepoInfo.h b/libzypp/zypp/RepoInfo.h deleted file mode 100644 index b757edb..0000000 --- a/libzypp/zypp/RepoInfo.h +++ /dev/null @@ -1,427 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoInfo.h - * -*/ -#ifndef ZYPP2_REPOSITORYINFO_H -#define ZYPP2_REPOSITORYINFO_H - -#include -#include - -#include "zypp/base/Iterator.h" -#include "zypp/APIConfig.h" - -#include "zypp/Url.h" -#include "zypp/Locale.h" -#include "zypp/repo/RepoType.h" -#include "zypp/repo/RepoVariables.h" - -#include "zypp/repo/RepoInfoBase.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoInfo - // - /** - * \short What is known about a repository - * - * The class RepoInfo represents everything that - * is known about a software repository. - * - * It can be used to store information about known - * sources. - * - * This class tries to be compatible with the - * concept of a .repo file used by YUM and - * also available in the openSUSE build service. - * See man yum.conf. - * - * Example file - * - * \code - * [ruby] - * name=Ruby repository (openSUSE_10.2) - * type=rpm-md - * baseurl=http://software.opensuse.org/download/ruby/openSUSE_10.2/ - * http://some.opensuse.mirror/ruby/openSUSE_10.2/ - * gpgcheck=1 - * gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc - * enabled=1 - * priority=10 - * \endcode - * - * \note A RepoInfo is a hint about how - * to create a Repository. - * - * \note Name, baseUrls and mirrorUrl are subject to repo variable replacement - * (\see \ref RepoVariablesStringReplacer). - */ - class RepoInfo : public repo::RepoInfoBase - { - friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ); - - public: - RepoInfo(); - virtual ~RepoInfo(); - - /** Represents no Repository (one with an empty alias). */ - static const RepoInfo noRepo; - - public: - /** - * The default priority (\c 99). - */ - static unsigned defaultPriority(); - /** - * Repository priority for solver. - * Some number between \c 1 (highest priority) and \c 99 (\ref defaultPriority). - */ - unsigned priority() const; - /** - * Set repository priority for solver. - * A \c newval_r of \c 0 sets the default priority. - * \see \ref priority. - */ - void setPriority( unsigned newval_r ); - - typedef std::list url_set; - typedef url_set::size_type urls_size_type; - typedef transform_iterator urls_const_iterator; - /** - * whether repository urls are available - */ - bool baseUrlsEmpty() const; - /** - * Whether there are manualy configured repository urls. - * If \c false, a mirrorlist might be used. - */ - bool baseUrlSet() const; - /** - * number of repository urls - */ - urls_size_type baseUrlsSize() const; - /** - * iterator that points at begin of repository urls - */ - urls_const_iterator baseUrlsBegin() const; - /** - * iterator that points at end of repository urls - */ - urls_const_iterator baseUrlsEnd() const; - /** - * Pars pro toto: The first repository url - */ - Url url() const - { return( baseUrlsEmpty() ? Url() : *baseUrlsBegin()); } - /** - * Pars pro toto: The first repository url (no variables replaced) - */ - Url rawUrl() const; - /** - * A Url under which the metadata are located, or a set of mirrors. - * - * This can't be empty in order the repository to be valid - * unless the download of the mirror list succeeds and it - * contains a valid url. - */ - url_set baseUrls() const; - /** - * Add a base url. \see baseUrls - * \param url The base url for the repository. - * - * To recreate the base URLs list, use \ref setBaseUrl(const Url &) followed - * by addBaseUrl(). - */ - void addBaseUrl( const Url &url ); - /** - * Clears current base URL list and adds \a url. - */ - void setBaseUrl( const Url &url ); - - /** - * \short Repository path - * - * Pathname relative to the base Url where the product/repository - * is located - * - * For media containing more than one product, or repositories not - * located at the root of the media it is important to know the path - * to the product directory relative to the media root. So a media - * verifier can be set for that media. You may also read it as - * baseUrl = url to mount and path = path on the - * mounted media. - * - * It is not mandatory, and the default is \c /. - * - * \note As a repository can have multiple Urls, the path is unique and - * the same for all Urls, so it is assumed all the Urls have the - * same media layout. - * - */ - Pathname path() const; - /** - * set the product path. \see path() - * \param path the path to the product - */ - void setPath( const Pathname &path ); - - /** - * Url of a file which contains a list of Urls - * If empty, the base url will be used. - */ - Url mirrorListUrl() const; - /** - * The raw mirrorListUrl (no variables replaced). - */ - Url rawMirrorListUrl() const; - /** - * Set mirror list url. \see mirrorListUrl - * \param url The base url for the list - */ - void setMirrorListUrl( const Url &url ); - - /** - * Type of repository, - * - */ - repo::RepoType type() const; - /** - * This allows to adjust the \ref RepoType lazy, from \c NONE to - * some probed value, even for const objects. - * - * This is a NOOP if the current type is not \c NONE. - */ - void setProbedType( const repo::RepoType &t ) const; - /** - * set the repository type \see type - * \param t - */ - void setType( const repo::RepoType &t ); - - /** - * \short Path where this repo metadata was read from - * - * \note could be an empty pathname for repo - * infos created in memory. - */ - Pathname metadataPath() const; - /** - * \short set the path where the local metadata is stored - * - * The path to the metadata of this repository - * was defined, or empty if nowhere. - * - * \param path directory path - */ - void setMetadataPath( const Pathname &path ); - - /** - * \short Path where this repo packages are cached - */ - Pathname packagesPath() const; - /** - * \short set the path where the local packages are stored - * - * \param path directory path - */ - void setPackagesPath( const Pathname &path ); - - /** - * \short Whether to check or not this repository with gpg - * - * \note This is a just a hint to the application and can - * be ignored. - * - */ - bool gpgCheck() const; - /** - * \short Whether to check or not this repository with gpg - * - * \param check true (check) or false (dont'check) - * - * \note This is a just a hint to the application and can - * be ignored. - * - */ - void setGpgCheck( bool check ); - - /** - * \short Key to use for gpg checking of this repository - * - * \param url Url to the key in ASCII armored format - * - * \note This is a just a hint to the application and can - * be ignored. - * - */ - Url gpgKeyUrl() const; - /** - * \short Key to use for gpg checking of this repository - * - * \param url Url to the key in ASCII armored format - * - * \note This is a just a hint to the application and can - * be ignored. - * - */ - void setGpgKeyUrl( const Url &gpgkey ); - - /** - * \short Whether packages downloaded from this repository will be kept in local cache - */ - bool keepPackages() const; - /** - * \short Set if packaqes downloaded from this repository will be kept in local cache - * - * If the setting is true, all downloaded packages from this repository will be - * copied to the local raw cache. - * - * \param keep true (keep the downloaded packages) or false (delete them after installation) - * - */ - void setKeepPackages( bool keep ); - - /** - * Gets name of the service to which this repository belongs or empty string - * if it has been added manually. - */ - std::string service() const; - /** - * sets service which added this repository - */ - void setService( const std::string& name ); - - /** - * Distribution for which is this repository meant. - */ - std::string targetDistribution() const; - /** - * Sets the distribution for which is this repository meant. This is - * an in-memory value only, does not get written to the .repo file upon - * saving. - */ - void setTargetDistribution(const std::string & targetDistribution); - - /** Add content keywords */ - void addContent( const std::string & keyword_r ); - /** \overload add keywords from container */ - template - void addContentFrom( _Iterator begin_r, _Iterator end_r ) - { for_( it, begin_r, end_r ) addContent( *it ); } - /** \overload */ - template - void addContentFrom( const _Container & container_r ) - { addContentFrom( container_r.begin(), container_r.end() ); } - - /** Check for content keywords. - * Checking for an empty string returns whether content kewords are - * known at all. They may be missing due to missing metadata in disabled - * repos. - */ - bool hasContent( const std::string & keyword_r = std::string() ) const; - /** \overload check for \b all keywords being present */ - template - bool hasContentAll( _Iterator begin_r, _Iterator end_r ) const - { for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; } - /** \overload */ - template - bool hasContentAll( const _Container & container_r ) const - { return hasContentAll( container_r.begin(), container_r.end() ); } - /** \overload check for \b any keyword being present */ - template - bool hasContentAny( _Iterator begin_r, _Iterator end_r ) const - { for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; } - /** \overload */ - template - bool hasContentAny( const _Container & container_r ) const - { return hasContentAny( container_r.begin(), container_r.end() ); } - - public: - /** \name Repository license - */ - //@{ - /** Whether there is a license associated with the repo. */ - bool hasLicense() const; - - /** Whether the repo license has to be accepted, e.g. there is no - * no acceptance needed for openSUSE. - */ - bool needToAcceptLicense() const; - - /** Return the best license for the current (or a specified) locale. */ - std::string getLicense( const Locale & lang_r = Locale() ) const; - std::string getLicense( const Locale & lang_r = Locale() ); // LEGACY API - - /** Return the locales the license is available for. - * \ref Locale::noCode is included in case of \c license.txt which does - * not specify a specific locale. - */ - LocaleSet getLicenseLocales() const; - //@} - - /** \name Repository global unique id - * - * - */ - //@{ - //@} - - public: - /** - * Write a human-readable representation of this RepoInfo object - * into the \a str stream. Useful for logging. - */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - - /** - * Write this RepoInfo object into \a str in a .repo file format. - * Raw values, no variable replacement. - */ - virtual std::ostream & dumpAsIniOn( std::ostream & str ) const; - - /** - * Write an XML representation of this RepoInfo object. - * Repo variables replaced. - * - * \param str - * \param content this argument is ignored (used in other classed derived - * from RepoInfoBase. - */ - virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const; - - /** \deprecated Use camel cased dumpAsXmlOn */ - ZYPP_DEPRECATED std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content = "" ) const { return dumpAsXmlOn( str, content ); } - - class Impl; - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoInfo */ - typedef shared_ptr RepoInfo_Ptr; - /** \relates RepoInfo */ - typedef shared_ptr RepoInfo_constPtr; - /** \relates RepoInfo */ - typedef std::list RepoInfoList; - - /** \relates RepoInfo Stream output */ - std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ); - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP2_REPOSITORYINFO_H diff --git a/libzypp/zypp/RepoManager.cc b/libzypp/zypp/RepoManager.cc deleted file mode 100644 index 5f2a672..0000000 --- a/libzypp/zypp/RepoManager.cc +++ /dev/null @@ -1,2479 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoManager.cc - * -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "zypp/base/InputStream.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/base/Function.h" -#include "zypp/base/Regex.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" - -#include "zypp/ServiceInfo.h" -#include "zypp/repo/RepoException.h" -#include "zypp/RepoManager.h" - -#include "zypp/media/MediaManager.h" -#include "zypp/media/CredentialManager.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/ExternalProgram.h" -#include "zypp/ManagedFile.h" - -#include "zypp/parser/RepoFileReader.h" -#include "zypp/parser/ServiceFileReader.h" -#include "zypp/repo/ServiceRepos.h" -#include "zypp/repo/yum/Downloader.h" -#include "zypp/repo/susetags/Downloader.h" -#include "zypp/repo/PluginServices.h" - -#include "zypp/Target.h" // for Target::targetDistribution() for repo index services -#include "zypp/ZYppFactory.h" // to get the Target from ZYpp instance -#include "zypp/HistoryLog.h" // to write history :O) - -#include "zypp/ZYppCallbacks.h" - -#include "sat/Pool.h" - -using std::endl; -using std::string; -using namespace zypp::repo; - -#define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc() - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace - { - /** Simple media mounter to access non-downloading URLs e.g. for non-local plaindir repos. - * \ingroup g_RAII - */ - class MediaMounter - { - public: - /** Ctor provides media access. */ - MediaMounter( const Url & url_r ) - { - media::MediaManager mediamanager; - _mid = mediamanager.open( url_r ); - mediamanager.attach( _mid ); - } - - /** Ctor releases the media. */ - ~MediaMounter() - { - media::MediaManager mediamanager; - mediamanager.release( _mid ); - mediamanager.close( _mid ); - } - - /** Convert a path relative to the media into an absolute path. - * - * Called without argument it returns the path to the medias root directory. - */ - Pathname getPathName( const Pathname & path_r = Pathname() ) const - { - media::MediaManager mediamanager; - return mediamanager.localPath( _mid, path_r ); - } - - private: - media::MediaAccessId _mid; - }; - /////////////////////////////////////////////////////////////////// - - /** Check if alias_r is present in repo/service container. */ - template - inline bool foundAliasIn( const std::string & alias_r, Iterator begin_r, Iterator end_r ) - { - for_( it, begin_r, end_r ) - if ( it->alias() == alias_r ) - return true; - return false; - } - /** \overload */ - template - inline bool foundAliasIn( const std::string & alias_r, const Container & cont_r ) - { return foundAliasIn( alias_r, cont_r.begin(), cont_r.end() ); } - - /** Find alias_r in repo/service container. */ - template - inline Iterator findAlias( const std::string & alias_r, Iterator begin_r, Iterator end_r ) - { - for_( it, begin_r, end_r ) - if ( it->alias() == alias_r ) - return it; - return end_r; - } - /** \overload */ - template - inline typename Container::iterator findAlias( const std::string & alias_r, Container & cont_r ) - { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); } - /** \overload */ - template - inline typename Container::const_iterator findAlias( const std::string & alias_r, const Container & cont_r ) - { return findAlias( alias_r, cont_r.begin(), cont_r.end() ); } - - - /** \short Generate a related filename from a repo/service infos alias */ - inline std::string filenameFromAlias( const std::string & alias_r, const std::string & stem_r ) - { - std::string filename( alias_r ); - // replace slashes with underscores - str::replaceAll( filename, "/", "_" ); - - filename = Pathname(filename).extend("."+stem_r).asString(); - MIL << "generating filename for " << stem_r << " [" << alias_r << "] : '" << filename << "'" << endl; - return filename; - } - - /** - * \short Simple callback to collect the results - * - * Classes like RepoFileReader call the callback - * once per each repo in a file. - * - * Passing this functor as callback, you can collect - * all results at the end, without dealing with async - * code. - * - * If targetDistro is set, all repos with non-empty RepoInfo::targetDistribution() - * will be skipped. - * - * \todo do this through a separate filter - */ - struct RepoCollector : private base::NonCopyable - { - RepoCollector() - {} - - RepoCollector(const std::string & targetDistro_) - : targetDistro(targetDistro_) - {} - - bool collect( const RepoInfo &repo ) - { - // skip repositories meant for other distros than specified - if (!targetDistro.empty() - && !repo.targetDistribution().empty() - && repo.targetDistribution() != targetDistro) - { - MIL - << "Skipping repository meant for '" << repo.targetDistribution() - << "' distribution (current distro is '" - << targetDistro << "')." << endl; - - return true; - } - - repos.push_back(repo); - return true; - } - - RepoInfoList repos; - std::string targetDistro; - }; - //////////////////////////////////////////////////////////////////////////// - - /** - * Reads RepoInfo's from a repo file. - * - * \param file pathname of the file to read. - */ - std::list repositories_in_file( const Pathname & file ) - { - MIL << "repo file: " << file << endl; - RepoCollector collector; - parser::RepoFileReader parser( file, bind( &RepoCollector::collect, &collector, _1 ) ); - return std::move(collector.repos); - } - - //////////////////////////////////////////////////////////////////////////// - - /** - * \short List of RepoInfo's from a directory - * - * Goes trough every file ending with ".repo" in a directory and adds all - * RepoInfo's contained in that file. - * - * \param dir pathname of the directory to read. - */ - std::list repositories_in_dir( const Pathname &dir ) - { - MIL << "directory " << dir << endl; - std::list repos; - bool nonroot( geteuid() != 0 ); - if ( nonroot && ! PathInfo(dir).userMayRX() ) - { - JobReport::warning( formatNAC(_("Cannot read repo directory '%1%': Permission denied")) % dir ); - } - else - { - std::list entries; - if ( filesystem::readdir( entries, dir, false ) != 0 ) - { - // TranslatorExplanation '%s' is a pathname - ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), dir.c_str()))); - } - - str::regex allowedRepoExt("^\\.repo(_[0-9]+)?$"); - for ( std::list::const_iterator it = entries.begin(); it != entries.end(); ++it ) - { - if ( str::regex_match(it->extension(), allowedRepoExt) ) - { - if ( nonroot && ! PathInfo(*it).userMayR() ) - { - JobReport::warning( formatNAC(_("Cannot read repo file '%1%': Permission denied")) % *it ); - } - else - { - const std::list & tmp( repositories_in_file( *it ) ); - repos.insert( repos.end(), tmp.begin(), tmp.end() ); - } - } - } - } - return repos; - } - - //////////////////////////////////////////////////////////////////////////// - - inline void assert_alias( const RepoInfo & info ) - { - if ( info.alias().empty() ) - ZYPP_THROW( RepoNoAliasException( info ) ); - // bnc #473834. Maybe we can match the alias against a regex to define - // and check for valid aliases - if ( info.alias()[0] == '.') - ZYPP_THROW(RepoInvalidAliasException( - info, _("Repository alias cannot start with dot."))); - } - - inline void assert_alias( const ServiceInfo & info ) - { - if ( info.alias().empty() ) - ZYPP_THROW( ServiceNoAliasException( info ) ); - // bnc #473834. Maybe we can match the alias against a regex to define - // and check for valid aliases - if ( info.alias()[0] == '.') - ZYPP_THROW(ServiceInvalidAliasException( - info, _("Service alias cannot start with dot."))); - } - - //////////////////////////////////////////////////////////////////////////// - - inline void assert_urls( const RepoInfo & info ) - { - if ( info.baseUrlsEmpty() ) - ZYPP_THROW( RepoNoUrlException( info ) ); - } - - inline void assert_url( const ServiceInfo & info ) - { - if ( ! info.url().isValid() ) - ZYPP_THROW( ServiceNoUrlException( info ) ); - } - - //////////////////////////////////////////////////////////////////////////// - - /** - * \short Calculates the raw cache path for a repository, this is usually - * /var/cache/zypp/alias - */ - inline Pathname rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info ) - { - assert_alias(info); - return opt.repoRawCachePath / info.escaped_alias(); - } - - /** - * \short Calculates the raw product metadata path for a repository, this is - * inside the raw cache dir, plus an optional path where the metadata is. - * - * It should be different only for repositories that are not in the root of - * the media. - * for example /var/cache/zypp/alias/addondir - */ - inline Pathname rawproductdata_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info ) - { - assert_alias(info); - return opt.repoRawCachePath / info.escaped_alias() / info.path(); - } - - /** - * \short Calculates the packages cache path for a repository - */ - inline Pathname packagescache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info ) - { - assert_alias(info); - return opt.repoPackagesCachePath / info.escaped_alias(); - } - - /** - * \short Calculates the solv cache path for a repository - */ - inline Pathname solv_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info) - { - assert_alias(info); - return opt.repoSolvCachePath / info.escaped_alias(); - } - - //////////////////////////////////////////////////////////////////////////// - - /** Functor collecting ServiceInfos into a ServiceSet. */ - class ServiceCollector - { - public: - typedef std::set ServiceSet; - - ServiceCollector( ServiceSet & services_r ) - : _services( services_r ) - {} - - bool operator()( const ServiceInfo & service_r ) const - { - _services.insert( service_r ); - return true; - } - - private: - ServiceSet & _services; - }; - //////////////////////////////////////////////////////////////////////////// - - } // namespace - /////////////////////////////////////////////////////////////////// - - std::list readRepoFile( const Url & repo_file ) - { - // no interface to download a specific file, using workaround: - //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr) - Url url(repo_file); - Pathname path(url.getPathName()); - url.setPathName ("/"); - MediaSetAccess access(url); - Pathname local = access.provideFile(path); - - DBG << "reading repo file " << repo_file << ", local path: " << local << endl; - - return repositories_in_file(local); - } - - /////////////////////////////////////////////////////////////////// - // - // class RepoManagerOptions - // - //////////////////////////////////////////////////////////////////// - - RepoManagerOptions::RepoManagerOptions( const Pathname & root_r ) - { - repoCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoCachePath() ); - repoRawCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoMetadataPath() ); - repoSolvCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoSolvfilesPath() ); - repoPackagesCachePath = Pathname::assertprefix( root_r, ZConfig::instance().repoPackagesPath() ); - knownReposPath = Pathname::assertprefix( root_r, ZConfig::instance().knownReposPath() ); - knownServicesPath = Pathname::assertprefix( root_r, ZConfig::instance().knownServicesPath() ); - pluginsPath = Pathname::assertprefix( root_r, ZConfig::instance().pluginsPath() ); - probe = ZConfig::instance().repo_add_probe(); - - rootDir = root_r; - } - - RepoManagerOptions RepoManagerOptions::makeTestSetup( const Pathname & root_r ) - { - RepoManagerOptions ret; - ret.repoCachePath = root_r; - ret.repoRawCachePath = root_r/"raw"; - ret.repoSolvCachePath = root_r/"solv"; - ret.repoPackagesCachePath = root_r/"packages"; - ret.knownReposPath = root_r/"repos.d"; - ret.knownServicesPath = root_r/"services.d"; - ret.pluginsPath = root_r/"plugins"; - ret.rootDir = root_r; - return ret; - } - - std:: ostream & operator<<( std::ostream & str, const RepoManagerOptions & obj ) - { -#define OUTS(X) str << " " #X "\t" << obj.X << endl - str << "RepoManagerOptions (" << obj.rootDir << ") {" << endl; - OUTS( repoRawCachePath ); - OUTS( repoSolvCachePath ); - OUTS( repoPackagesCachePath ); - OUTS( knownReposPath ); - OUTS( knownServicesPath ); - OUTS( pluginsPath ); - str << "}" << endl; -#undef OUTS - return str; - } - - /////////////////////////////////////////////////////////////////// - /// \class RepoManager::Impl - /// \brief RepoManager implementation. - /// - /////////////////////////////////////////////////////////////////// - struct RepoManager::Impl - { - public: - Impl( const RepoManagerOptions &opt ) - : _options(opt) - { - init_knownServices(); - init_knownRepositories(); - } - - ~Impl() - { - // trigger appdata refresh if some repos change - if ( _reposDirty && geteuid() == 0 && ( _options.rootDir.empty() || _options.rootDir == "/" ) ) - { - try { - std::list entries; - filesystem::readdir( entries, _options.pluginsPath/"appdata", false ); - if ( ! entries.empty() ) - { - ExternalProgram::Arguments cmd; - cmd.push_back( "<" ); // discard stdin - cmd.push_back( ">" ); // discard stdout - cmd.push_back( "PROGRAM" ); // [2] - fix index below if changing! - for ( const auto & rinfo : repos() ) - { - if ( ! rinfo.enabled() ) - continue; - cmd.push_back( "-R" ); - cmd.push_back( rinfo.alias() ); - cmd.push_back( "-t" ); - cmd.push_back( rinfo.type().asString() ); - cmd.push_back( "-p" ); - cmd.push_back( rinfo.metadataPath().asString() ); - } - - for_( it, entries.begin(), entries.end() ) - { - PathInfo pi( *it ); - //DBG << "/tmp/xx ->" << pi << endl; - if ( pi.isFile() && pi.userMayRX() ) - { - // trigger plugin - cmd[2] = pi.asString(); // [2] - PROGRAM - ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); - } - } - } - } - catch (...) {} // no throw in dtor - } - } - - public: - bool repoEmpty() const { return repos().empty(); } - RepoSizeType repoSize() const { return repos().size(); } - RepoConstIterator repoBegin() const { return repos().begin(); } - RepoConstIterator repoEnd() const { return repos().end(); } - - bool hasRepo( const std::string & alias ) const - { return foundAliasIn( alias, repos() ); } - - RepoInfo getRepo( const std::string & alias ) const - { - RepoConstIterator it( findAlias( alias, repos() ) ); - return it == repos().end() ? RepoInfo::noRepo : *it; - } - - public: - Pathname metadataPath( const RepoInfo & info ) const - { return rawcache_path_for_repoinfo( _options, info ); } - - Pathname packagesPath( const RepoInfo & info ) const - { return packagescache_path_for_repoinfo( _options, info ); } - - RepoStatus metadataStatus( const RepoInfo & info ) const; - - RefreshCheckStatus checkIfToRefreshMetadata( const RepoInfo & info, const Url & url, RawMetadataRefreshPolicy policy ); - - void refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, OPT_PROGRESS ); - - void cleanMetadata( const RepoInfo & info, OPT_PROGRESS ); - - void cleanPackages( const RepoInfo & info, OPT_PROGRESS ); - - void buildCache( const RepoInfo & info, CacheBuildPolicy policy, OPT_PROGRESS ); - - repo::RepoType probe( const Url & url, const Pathname & path = Pathname() ) const; - - void cleanCacheDirGarbage( OPT_PROGRESS ); - - void cleanCache( const RepoInfo & info, OPT_PROGRESS ); - - bool isCached( const RepoInfo & info ) const - { return PathInfo(solv_path_for_repoinfo( _options, info ) / "solv").isExist(); } - - RepoStatus cacheStatus( const RepoInfo & info ) const - { return RepoStatus::fromCookieFile(solv_path_for_repoinfo(_options, info) / "cookie"); } - - void loadFromCache( const RepoInfo & info, OPT_PROGRESS ); - - void addRepository( const RepoInfo & info, OPT_PROGRESS ); - - void addRepositories( const Url & url, OPT_PROGRESS ); - - void removeRepository( const RepoInfo & info, OPT_PROGRESS ); - - void modifyRepository( const std::string & alias, const RepoInfo & newinfo_r, OPT_PROGRESS ); - - RepoInfo getRepositoryInfo( const std::string & alias, OPT_PROGRESS ); - RepoInfo getRepositoryInfo( const Url & url, const url::ViewOption & urlview, OPT_PROGRESS ); - - public: - bool serviceEmpty() const { return _services.empty(); } - ServiceSizeType serviceSize() const { return _services.size(); } - ServiceConstIterator serviceBegin() const { return _services.begin(); } - ServiceConstIterator serviceEnd() const { return _services.end(); } - - bool hasService( const std::string & alias ) const - { return foundAliasIn( alias, _services ); } - - ServiceInfo getService( const std::string & alias ) const - { - ServiceConstIterator it( findAlias( alias, _services ) ); - return it == _services.end() ? ServiceInfo::noService : *it; - } - - public: - void addService( const ServiceInfo & service ); - void addService( const std::string & alias, const Url & url ) - { addService( ServiceInfo( alias, url ) ); } - - void removeService( const std::string & alias ); - void removeService( const ServiceInfo & service ) - { removeService( service.alias() ); } - - void refreshServices( const RefreshServiceOptions & options_r ); - - void refreshService( const std::string & alias, const RefreshServiceOptions & options_r ); - void refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r ) - { refreshService( service.alias(), options_r ); } - - void modifyService( const std::string & oldAlias, const ServiceInfo & newService ); - - repo::ServiceType probeService( const Url & url ) const; - - private: - void saveService( ServiceInfo & service ) const; - - Pathname generateNonExistingName( const Pathname & dir, const std::string & basefilename ) const; - - std::string generateFilename( const RepoInfo & info ) const - { return filenameFromAlias( info.alias(), "repo" ); } - - std::string generateFilename( const ServiceInfo & info ) const - { return filenameFromAlias( info.alias(), "service" ); } - - void setCacheStatus( const RepoInfo & info, const RepoStatus & status ) - { - Pathname base = solv_path_for_repoinfo( _options, info ); - filesystem::assert_dir(base); - status.saveToCookieFile( base / "cookie" ); - } - - void touchIndexFile( const RepoInfo & info ); - - template - void getRepositoriesInService( const std::string & alias, OutputIterator out ) const - { - MatchServiceAlias filter( alias ); - std::copy( boost::make_filter_iterator( filter, repos().begin(), repos().end() ), - boost::make_filter_iterator( filter, repos().end(), repos().end() ), - out); - } - - private: - void init_knownServices(); - void init_knownRepositories(); - - const RepoSet & repos() const { return _reposX; } - RepoSet & reposManip() { if ( ! _reposDirty ) _reposDirty = true; return _reposX; } - - private: - RepoManagerOptions _options; - RepoSet _reposX; - ServiceSet _services; - - DefaultIntegral _reposDirty; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoManager::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const RepoManager::Impl & obj ) - { return str << "RepoManager::Impl"; } - - /////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::saveService( ServiceInfo & service ) const - { - filesystem::assert_dir( _options.knownServicesPath ); - Pathname servfile = generateNonExistingName( _options.knownServicesPath, - generateFilename( service ) ); - service.setFilepath( servfile ); - - MIL << "saving service in " << servfile << endl; - - std::ofstream file( servfile.c_str() ); - if ( !file ) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), servfile.c_str() ))); - } - service.dumpAsIniOn( file ); - MIL << "done" << endl; - } - - /** - * Generate a non existing filename in a directory, using a base - * name. For example if a directory contains 3 files - * - * |-- bar - * |-- foo - * `-- moo - * - * If you try to generate a unique filename for this directory, - * based on "ruu" you will get "ruu", but if you use the base - * "foo" you will get "foo_1" - * - * \param dir Directory where the file needs to be unique - * \param basefilename string to base the filename on. - */ - Pathname RepoManager::Impl::generateNonExistingName( const Pathname & dir, - const std::string & basefilename ) const - { - std::string final_filename = basefilename; - int counter = 1; - while ( PathInfo(dir + final_filename).isExist() ) - { - final_filename = basefilename + "_" + str::numstring(counter); - ++counter; - } - return dir + Pathname(final_filename); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::init_knownServices() - { - Pathname dir = _options.knownServicesPath; - std::list entries; - if (PathInfo(dir).isExist()) - { - if ( filesystem::readdir( entries, dir, false ) != 0 ) - { - // TranslatorExplanation '%s' is a pathname - ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), dir.c_str()))); - } - - //str::regex allowedServiceExt("^\\.service(_[0-9]+)?$"); - for_(it, entries.begin(), entries.end() ) - { - parser::ServiceFileReader(*it, ServiceCollector(_services)); - } - } - - repo::PluginServices(_options.pluginsPath/"services", ServiceCollector(_services)); - } - - /////////////////////////////////////////////////////////////////// - namespace { - /** Delete \a cachePath_r subdirs not matching known aliases in \a repoEscAliases_r (must be sorted!) - * \note bnc#891515: Auto-cleanup only zypp.conf default locations. Otherwise - * we'd need some magic file to identify zypp cache directories. Without this - * we may easily remove user data (zypper --pkg-cache-dir . download ...) - */ - inline void cleanupNonRepoMetadtaFolders( const Pathname & cachePath_r, - const Pathname & defaultCachePath_r, - const std::list & repoEscAliases_r ) - { - if ( cachePath_r != defaultCachePath_r ) - return; - - std::list entries; - if ( filesystem::readdir( entries, cachePath_r, false ) == 0 ) - { - entries.sort(); - std::set oldfiles; - set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(), - std::inserter( oldfiles, oldfiles.end() ) ); - for ( const std::string & old : oldfiles ) - { - if ( old == Repository::systemRepoAlias() ) // don't remove the @System solv file - continue; - filesystem::recursive_rmdir( cachePath_r / old ); - } - } - } - } // namespace - /////////////////////////////////////////////////////////////////// - void RepoManager::Impl::init_knownRepositories() - { - MIL << "start construct known repos" << endl; - - if ( PathInfo(_options.knownReposPath).isExist() ) - { - std::list repoEscAliases; - std::list orphanedRepos; - for ( RepoInfo & repoInfo : repositories_in_dir(_options.knownReposPath) ) - { - // set the metadata path for the repo - repoInfo.setMetadataPath( rawcache_path_for_repoinfo(_options, repoInfo) ); - // set the downloaded packages path for the repo - repoInfo.setPackagesPath( packagescache_path_for_repoinfo(_options, repoInfo) ); - // remember it - _reposX.insert( repoInfo ); // direct access via _reposX in ctor! no reposManip. - - // detect orphaned repos belonging to a deleted service - const std::string & serviceAlias( repoInfo.service() ); - if ( ! ( serviceAlias.empty() || hasService( serviceAlias ) ) ) - { - WAR << "Schedule orphaned service repo for deletion: " << repoInfo << endl; - orphanedRepos.push_back( repoInfo ); - continue; // don't remember it in repoEscAliases - } - - repoEscAliases.push_back(repoInfo.escaped_alias()); - } - - // Cleanup orphanded service repos: - if ( ! orphanedRepos.empty() ) - { - for ( auto & repoInfo : orphanedRepos ) - { - MIL << "Delete orphaned service repo " << repoInfo.alias() << endl; - // translators: Cleanup a repository previously owned by a meanwhile unknown (deleted) service. - // %1% = service name - // %2% = repository name - JobReport::warning( formatNAC(_("Unknown service '%1%': Removing orphaned service repository '%2%'" )) - % repoInfo.service() - % repoInfo.alias() ); - try { - removeRepository( repoInfo ); - } - catch ( const Exception & caugth ) - { - JobReport::error( caugth.asUserHistory() ); - } - } - } - - // delete metadata folders without corresponding repo (e.g. old tmp directories) - // - // bnc#891515: Auto-cleanup only zypp.conf default locations. Otherwise - // we'd need somemagic file to identify zypp cache directories. Without this - // we may easily remove user data (zypper --pkg-cache-dir . download ...) - repoEscAliases.sort(); - RepoManagerOptions defaultCache( _options.rootDir ); - cleanupNonRepoMetadtaFolders( _options.repoRawCachePath, defaultCache.repoRawCachePath, repoEscAliases ); - cleanupNonRepoMetadtaFolders( _options.repoSolvCachePath, defaultCache.repoSolvCachePath, repoEscAliases ); - cleanupNonRepoMetadtaFolders( _options.repoPackagesCachePath, defaultCache.repoPackagesCachePath, repoEscAliases ); - } - MIL << "end construct known repos" << endl; - } - - /////////////////////////////////////////////////////////////////// - - RepoStatus RepoManager::Impl::metadataStatus( const RepoInfo & info ) const - { - Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info ); - Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info ); - - RepoType repokind = info.type(); - // If unknown, probe the local metadata - if ( repokind == RepoType::NONE ) - repokind = probe( productdatapath.asUrl() ); - - RepoStatus status; - switch ( repokind.toEnum() ) - { - case RepoType::RPMMD_e : - status = RepoStatus( productdatapath/"repodata/repomd.xml"); - break; - - case RepoType::YAST2_e : - status = RepoStatus( productdatapath/"content" ) && RepoStatus( mediarootpath/"media.1/media" ); - break; - - case RepoType::RPMPLAINDIR_e : - status = RepoStatus::fromCookieFile( productdatapath/"cookie" ); - break; - - case RepoType::NONE_e : - // Return default RepoStatus in case of RepoType::NONE - // indicating it should be created? - // ZYPP_THROW(RepoUnknownTypeException()); - break; - } - return status; - } - - - void RepoManager::Impl::touchIndexFile( const RepoInfo & info ) - { - Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info ); - - RepoType repokind = info.type(); - if ( repokind.toEnum() == RepoType::NONE_e ) - // unknown, probe the local metadata - repokind = probe( productdatapath.asUrl() ); - // if still unknown, just return - if (repokind == RepoType::NONE_e) - return; - - Pathname p; - switch ( repokind.toEnum() ) - { - case RepoType::RPMMD_e : - p = Pathname(productdatapath + "/repodata/repomd.xml"); - break; - - case RepoType::YAST2_e : - p = Pathname(productdatapath + "/content"); - break; - - case RepoType::RPMPLAINDIR_e : - p = Pathname(productdatapath + "/cookie"); - break; - - case RepoType::NONE_e : - default: - break; - } - - // touch the file, ignore error (they are logged anyway) - filesystem::touch(p); - } - - - RepoManager::RefreshCheckStatus RepoManager::Impl::checkIfToRefreshMetadata( const RepoInfo & info, const Url & url, RawMetadataRefreshPolicy policy ) - { - assert_alias(info); - try - { - MIL << "Going to try to check whether refresh is needed for " << url << endl; - - // first check old (cached) metadata - Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info ); - filesystem::assert_dir( mediarootpath ); - RepoStatus oldstatus = metadataStatus( info ); - - if ( oldstatus.empty() ) - { - MIL << "No cached metadata, going to refresh" << endl; - return REFRESH_NEEDED; - } - - { - if ( url.schemeIsVolatile() ) - { - MIL << "never refresh CD/DVD" << endl; - return REPO_UP_TO_DATE; - } - if ( url.schemeIsLocal() ) - { - policy = RefreshIfNeededIgnoreDelay; - } - } - - // now we've got the old (cached) status, we can decide repo.refresh.delay - if (policy != RefreshForced && policy != RefreshIfNeededIgnoreDelay) - { - // difference in seconds - double diff = difftime( - (Date::ValueType)Date::now(), - (Date::ValueType)oldstatus.timestamp()) / 60; - - DBG << "oldstatus: " << (Date::ValueType)oldstatus.timestamp() << endl; - DBG << "current time: " << (Date::ValueType)Date::now() << endl; - DBG << "last refresh = " << diff << " minutes ago" << endl; - - if ( diff < ZConfig::instance().repo_refresh_delay() ) - { - if ( diff < 0 ) - { - WAR << "Repository '" << info.alias() << "' was refreshed in the future!" << endl; - } - else - { - MIL << "Repository '" << info.alias() - << "' has been refreshed less than repo.refresh.delay (" - << ZConfig::instance().repo_refresh_delay() - << ") minutes ago. Advising to skip refresh" << endl; - return REPO_CHECK_DELAYED; - } - } - } - - repo::RepoType repokind = info.type(); - // if unknown: probe it - if ( repokind == RepoType::NONE ) - repokind = probe( url, info.path() ); - - // retrieve newstatus - RepoStatus newstatus; - switch ( repokind.toEnum() ) - { - case RepoType::RPMMD_e: - { - MediaSetAccess media( url ); - newstatus = yum::Downloader( info, mediarootpath ).status( media ); - } - break; - - case RepoType::YAST2_e: - { - MediaSetAccess media( url ); - newstatus = susetags::Downloader( info, mediarootpath ).status( media ); - } - break; - - case RepoType::RPMPLAINDIR_e: - newstatus = RepoStatus( MediaMounter(url).getPathName(info.path()) ); // dir status - break; - - default: - case RepoType::NONE_e: - ZYPP_THROW( RepoUnknownTypeException( info ) ); - break; - } - - // check status - bool refresh = false; - if ( oldstatus == newstatus ) - { - MIL << "repo has not changed" << endl; - if ( policy == RefreshForced ) - { - MIL << "refresh set to forced" << endl; - refresh = true; - } - } - else - { - MIL << "repo has changed, going to refresh" << endl; - refresh = true; - } - - if (!refresh) - touchIndexFile(info); - - return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE; - - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - ERR << "refresh check failed for " << url << endl; - ZYPP_RETHROW(e); - } - - return REFRESH_NEEDED; // default - } - - - void RepoManager::Impl::refreshMetadata( const RepoInfo & info, RawMetadataRefreshPolicy policy, const ProgressData::ReceiverFnc & progress ) - { - assert_alias(info); - assert_urls(info); - - // we will throw this later if no URL checks out fine - RepoException rexception( info, _PL("Valid metadata not found at specified URL", - "Valid metadata not found at specified URLs", - info.baseUrlsSize() ) ); - - // try urls one by one - for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); it != info.baseUrlsEnd(); ++it ) - { - try - { - Url url(*it); - - // check whether to refresh metadata - // if the check fails for this url, it throws, so another url will be checked - if (checkIfToRefreshMetadata(info, url, policy)!=REFRESH_NEEDED) - return; - - MIL << "Going to refresh metadata from " << url << endl; - - repo::RepoType repokind = info.type(); - - // if the type is unknown, try probing. - if ( repokind == RepoType::NONE ) - { - // unknown, probe it - repokind = probe( *it, info.path() ); - - if (repokind.toEnum() != RepoType::NONE_e) - { - // Adjust the probed type in RepoInfo - info.setProbedType( repokind ); // lazy init! - //save probed type only for repos in system - for_( it, repoBegin(), repoEnd() ) - { - if ( info.alias() == (*it).alias() ) - { - RepoInfo modifiedrepo = info; - modifiedrepo.setType( repokind ); - modifyRepository( info.alias(), modifiedrepo ); - break; - } - } - } - } - - Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info ); - if( filesystem::assert_dir(mediarootpath) ) - { - Exception ex(str::form( _("Can't create %s"), mediarootpath.c_str()) ); - ZYPP_THROW(ex); - } - - // create temp dir as sibling of mediarootpath - filesystem::TmpDir tmpdir( filesystem::TmpDir::makeSibling( mediarootpath ) ); - if( tmpdir.path().empty() ) - { - Exception ex(_("Can't create metadata cache directory.")); - ZYPP_THROW(ex); - } - - if ( ( repokind.toEnum() == RepoType::RPMMD_e ) || - ( repokind.toEnum() == RepoType::YAST2_e ) ) - { - MediaSetAccess media(url); - shared_ptr downloader_ptr; - - MIL << "Creating downloader for [ " << info.alias() << " ]" << endl; - - if ( repokind.toEnum() == RepoType::RPMMD_e ) - downloader_ptr.reset(new yum::Downloader(info, mediarootpath)); - else - downloader_ptr.reset( new susetags::Downloader(info, mediarootpath) ); - - /** - * Given a downloader, sets the other repos raw metadata - * path as cache paths for the fetcher, so if another - * repo has the same file, it will not download it - * but copy it from the other repository - */ - for_( it, repoBegin(), repoEnd() ) - { - Pathname cachepath(rawcache_path_for_repoinfo( _options, *it )); - if ( PathInfo(cachepath).isExist() ) - downloader_ptr->addCachePath(cachepath); - } - - downloader_ptr->download( media, tmpdir.path() ); - } - else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e ) - { - MediaMounter media( url ); - RepoStatus newstatus = RepoStatus( media.getPathName( info.path() ) ); // dir status - - Pathname productpath( tmpdir.path() / info.path() ); - filesystem::assert_dir( productpath ); - newstatus.saveToCookieFile( productpath/"cookie" ); - } - else - { - ZYPP_THROW(RepoUnknownTypeException( info )); - } - - // ok we have the metadata, now exchange - // the contents - filesystem::exchange( tmpdir.path(), mediarootpath ); - reposManip(); // remember to trigger appdata refresh - - // we are done. - return; - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - ERR << "Trying another url..." << endl; - - // remember the exception caught for the *first URL* - // if all other URLs fail, the rexception will be thrown with the - // cause of the problem of the first URL remembered - if (it == info.baseUrlsBegin()) - rexception.remember(e); - } - } // for every url - ERR << "No more urls..." << endl; - ZYPP_THROW(rexception); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::cleanMetadata( const RepoInfo & info, const ProgressData::ReceiverFnc & progressfnc ) - { - ProgressData progress(100); - progress.sendTo(progressfnc); - - filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_options, info)); - progress.toMax(); - } - - - void RepoManager::Impl::cleanPackages( const RepoInfo & info, const ProgressData::ReceiverFnc & progressfnc ) - { - ProgressData progress(100); - progress.sendTo(progressfnc); - - filesystem::recursive_rmdir(packagescache_path_for_repoinfo(_options, info)); - progress.toMax(); - } - - - void RepoManager::Impl::buildCache( const RepoInfo & info, CacheBuildPolicy policy, const ProgressData::ReceiverFnc & progressrcv ) - { - assert_alias(info); - Pathname mediarootpath = rawcache_path_for_repoinfo( _options, info ); - Pathname productdatapath = rawproductdata_path_for_repoinfo( _options, info ); - - if( filesystem::assert_dir(_options.repoCachePath) ) - { - Exception ex(str::form( _("Can't create %s"), _options.repoCachePath.c_str()) ); - ZYPP_THROW(ex); - } - RepoStatus raw_metadata_status = metadataStatus(info); - if ( raw_metadata_status.empty() ) - { - /* if there is no cache at this point, we refresh the raw - in case this is the first time - if it's !autorefresh, - we may still refresh */ - refreshMetadata(info, RefreshIfNeeded, progressrcv ); - raw_metadata_status = metadataStatus(info); - } - - bool needs_cleaning = false; - if ( isCached( info ) ) - { - MIL << info.alias() << " is already cached." << endl; - RepoStatus cache_status = cacheStatus(info); - - if ( cache_status == raw_metadata_status ) - { - MIL << info.alias() << " cache is up to date with metadata." << endl; - if ( policy == BuildIfNeeded ) { - return; - } - else { - MIL << info.alias() << " cache rebuild is forced" << endl; - } - } - - needs_cleaning = true; - } - - ProgressData progress(100); - callback::SendReport report; - progress.sendTo( ProgressReportAdaptor( progressrcv, report ) ); - progress.name(str::form(_("Building repository '%s' cache"), info.label().c_str())); - progress.toMin(); - - if (needs_cleaning) - { - cleanCache(info); - } - - MIL << info.alias() << " building cache..." << info.type() << endl; - - Pathname base = solv_path_for_repoinfo( _options, info); - - if( filesystem::assert_dir(base) ) - { - Exception ex(str::form( _("Can't create %s"), base.c_str()) ); - ZYPP_THROW(ex); - } - - if( ! PathInfo(base).userMayW() ) - { - Exception ex(str::form( _("Can't create cache at %s - no writing permissions."), base.c_str()) ); - ZYPP_THROW(ex); - } - Pathname solvfile = base / "solv"; - - // do we have type? - repo::RepoType repokind = info.type(); - - // if the type is unknown, try probing. - switch ( repokind.toEnum() ) - { - case RepoType::NONE_e: - // unknown, probe the local metadata - repokind = probe( productdatapath.asUrl() ); - break; - default: - break; - } - - MIL << "repo type is " << repokind << endl; - - switch ( repokind.toEnum() ) - { - case RepoType::RPMMD_e : - case RepoType::YAST2_e : - case RepoType::RPMPLAINDIR_e : - { - // Take care we unlink the solvfile on exception - ManagedFile guard( solvfile, filesystem::unlink ); - scoped_ptr forPlainDirs; - - ExternalProgram::Arguments cmd; - cmd.push_back( "repo2solv.sh" ); - // repo2solv expects -o as 1st arg! - cmd.push_back( "-o" ); - cmd.push_back( solvfile.asString() ); - cmd.push_back( "-X" ); // autogenerate pattern from pattern-package - - if ( repokind == RepoType::RPMPLAINDIR ) - { - forPlainDirs.reset( new MediaMounter( *info.baseUrlsBegin() ) ); - // recusive for plaindir as 2nd arg! - cmd.push_back( "-R" ); - // FIXME this does only work form dir: URLs - cmd.push_back( forPlainDirs->getPathName( info.path() ).c_str() ); - } - else - cmd.push_back( productdatapath.asString() ); - - ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout ); - std::string errdetail; - - for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) { - WAR << " " << output; - if ( errdetail.empty() ) { - errdetail = prog.command(); - errdetail += '\n'; - } - errdetail += output; - } - - int ret = prog.close(); - if ( ret != 0 ) - { - RepoException ex(str::form( _("Failed to cache repo (%d)."), ret )); - ex.remember( errdetail ); - ZYPP_THROW(ex); - } - - // We keep it. - guard.resetDispose(); - } - break; - default: - ZYPP_THROW(RepoUnknownTypeException( info, _("Unhandled repository type") )); - break; - } - // update timestamp and checksum - setCacheStatus(info, raw_metadata_status); - MIL << "Commit cache.." << endl; - progress.toMax(); - } - - //////////////////////////////////////////////////////////////////////////// - - repo::RepoType RepoManager::Impl::probe( const Url & url, const Pathname & path ) const - { - MIL << "going to probe the repo type at " << url << " (" << path << ")" << endl; - - if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName()/path ).isDir() ) - { - // Handle non existing local directory in advance, as - // MediaSetAccess does not support it. - MIL << "Probed type NONE (not exists) at " << url << " (" << path << ")" << endl; - return repo::RepoType::NONE; - } - - // prepare exception to be thrown if the type could not be determined - // due to a media exception. We can't throw right away, because of some - // problems with proxy servers returning an incorrect error - // on ftp file-not-found(bnc #335906). Instead we'll check another types - // before throwing. - - // TranslatorExplanation '%s' is an URL - RepoException enew(str::form( _("Error trying to read from '%s'"), url.asString().c_str() )); - bool gotMediaException = false; - try - { - MediaSetAccess access(url); - try - { - if ( access.doesFileExist(path/"/repodata/repomd.xml") ) - { - MIL << "Probed type RPMMD at " << url << " (" << path << ")" << endl; - return repo::RepoType::RPMMD; - } - } - catch ( const media::MediaException &e ) - { - ZYPP_CAUGHT(e); - DBG << "problem checking for repodata/repomd.xml file" << endl; - enew.remember(e); - gotMediaException = true; - } - - try - { - if ( access.doesFileExist(path/"/content") ) - { - MIL << "Probed type YAST2 at " << url << " (" << path << ")" << endl; - return repo::RepoType::YAST2; - } - } - catch ( const media::MediaException &e ) - { - ZYPP_CAUGHT(e); - DBG << "problem checking for content file" << endl; - enew.remember(e); - gotMediaException = true; - } - - // if it is a non-downloading URL denoting a directory - if ( ! url.schemeIsDownloading() ) - { - MediaMounter media( url ); - if ( PathInfo(media.getPathName()/path).isDir() ) - { - // allow empty dirs for now - MIL << "Probed type RPMPLAINDIR at " << url << " (" << path << ")" << endl; - return repo::RepoType::RPMPLAINDIR; - } - } - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - // TranslatorExplanation '%s' is an URL - Exception enew(str::form( _("Unknown error reading from '%s'"), url.asString().c_str() )); - enew.remember(e); - ZYPP_THROW(enew); - } - - if (gotMediaException) - ZYPP_THROW(enew); - - MIL << "Probed type NONE at " << url << " (" << path << ")" << endl; - return repo::RepoType::NONE; - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::cleanCacheDirGarbage( const ProgressData::ReceiverFnc & progressrcv ) - { - MIL << "Going to clean up garbage in cache dirs" << endl; - - ProgressData progress(300); - progress.sendTo(progressrcv); - progress.toMin(); - - std::list cachedirs; - cachedirs.push_back(_options.repoRawCachePath); - cachedirs.push_back(_options.repoPackagesCachePath); - cachedirs.push_back(_options.repoSolvCachePath); - - for_( dir, cachedirs.begin(), cachedirs.end() ) - { - if ( PathInfo(*dir).isExist() ) - { - std::list entries; - if ( filesystem::readdir( entries, *dir, false ) != 0 ) - // TranslatorExplanation '%s' is a pathname - ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), dir->c_str()))); - - unsigned sdircount = entries.size(); - unsigned sdircurrent = 1; - for_( subdir, entries.begin(), entries.end() ) - { - // if it does not belong known repo, make it disappear - bool found = false; - for_( r, repoBegin(), repoEnd() ) - if ( subdir->basename() == r->escaped_alias() ) - { found = true; break; } - - if ( ! found && ( Date::now()-PathInfo(*subdir).mtime() > Date::day ) ) - filesystem::recursive_rmdir( *subdir ); - - progress.set( progress.val() + sdircurrent * 100 / sdircount ); - ++sdircurrent; - } - } - else - progress.set( progress.val() + 100 ); - } - progress.toMax(); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::cleanCache( const RepoInfo & info, const ProgressData::ReceiverFnc & progressrcv ) - { - ProgressData progress(100); - progress.sendTo(progressrcv); - progress.toMin(); - - MIL << "Removing raw metadata cache for " << info.alias() << endl; - filesystem::recursive_rmdir(solv_path_for_repoinfo(_options, info)); - - progress.toMax(); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::loadFromCache( const RepoInfo & info, const ProgressData::ReceiverFnc & progressrcv ) - { - assert_alias(info); - Pathname solvfile = solv_path_for_repoinfo(_options, info) / "solv"; - - if ( ! PathInfo(solvfile).isExist() ) - ZYPP_THROW(RepoNotCachedException(info)); - - sat::Pool::instance().reposErase( info.alias() ); - try - { - Repository repo = sat::Pool::instance().addRepoSolv( solvfile, info ); - // test toolversion in order to rebuild solv file in case - // it was written by an old libsolv-tool parser. - // - // Known version strings used: - // - - // - "1.0" - // - sat::LookupRepoAttr toolversion( sat::SolvAttr::repositoryToolVersion, repo ); - if ( toolversion.begin().asString().empty() ) - { - repo.eraseFromPool(); - ZYPP_THROW(Exception("Solv-file was created by old parser.")); - } - // else: up-to-date (or even newer). - } - catch ( const Exception & exp ) - { - ZYPP_CAUGHT( exp ); - MIL << "Try to handle exception by rebuilding the solv-file" << endl; - cleanCache( info, progressrcv ); - buildCache( info, BuildIfNeeded, progressrcv ); - - sat::Pool::instance().addRepoSolv( solvfile, info ); - } - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::addRepository( const RepoInfo & info, const ProgressData::ReceiverFnc & progressrcv ) - { - assert_alias(info); - - ProgressData progress(100); - callback::SendReport report; - progress.sendTo( ProgressReportAdaptor( progressrcv, report ) ); - progress.name(str::form(_("Adding repository '%s'"), info.label().c_str())); - progress.toMin(); - - MIL << "Try adding repo " << info << endl; - - RepoInfo tosave = info; - if ( repos().find(tosave) != repos().end() ) - ZYPP_THROW(RepoAlreadyExistsException(info)); - - // check the first url for now - if ( _options.probe ) - { - DBG << "unknown repository type, probing" << endl; - - RepoType probedtype; - probedtype = probe( *tosave.baseUrlsBegin(), info.path() ); - if ( tosave.baseUrlsSize() > 0 ) - { - if ( probedtype == RepoType::NONE ) - ZYPP_THROW(RepoUnknownTypeException(info)); - else - tosave.setType(probedtype); - } - } - - progress.set(50); - - // assert the directory exists - filesystem::assert_dir(_options.knownReposPath); - - Pathname repofile = generateNonExistingName( - _options.knownReposPath, generateFilename(tosave)); - // now we have a filename that does not exists - MIL << "Saving repo in " << repofile << endl; - - std::ofstream file(repofile.c_str()); - if (!file) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), repofile.c_str() ))); - } - - tosave.dumpAsIniOn(file); - tosave.setFilepath(repofile); - tosave.setMetadataPath( metadataPath( tosave ) ); - tosave.setPackagesPath( packagesPath( tosave ) ); - { - // We chould fix the API as we must injet those paths - // into the repoinfo in order to keep it usable. - RepoInfo & oinfo( const_cast(info) ); - oinfo.setMetadataPath( metadataPath( tosave ) ); - oinfo.setPackagesPath( packagesPath( tosave ) ); - } - reposManip().insert(tosave); - - progress.set(90); - - // check for credentials in Urls - bool havePasswords = false; - for_( urlit, tosave.baseUrlsBegin(), tosave.baseUrlsEnd() ) - if ( urlit->hasCredentialsInAuthority() ) - { - havePasswords = true; - break; - } - // save the credentials - if ( havePasswords ) - { - media::CredentialManager cm( - media::CredManagerOptions(_options.rootDir) ); - - for_(urlit, tosave.baseUrlsBegin(), tosave.baseUrlsEnd()) - if (urlit->hasCredentialsInAuthority()) - //! \todo use a method calling UI callbacks to ask where to save creds? - cm.saveInUser(media::AuthData(*urlit)); - } - - HistoryLog().addRepository(tosave); - - progress.toMax(); - MIL << "done" << endl; - } - - - void RepoManager::Impl::addRepositories( const Url & url, const ProgressData::ReceiverFnc & progressrcv ) - { - std::list repos = readRepoFile(url); - for ( std::list::const_iterator it = repos.begin(); - it != repos.end(); - ++it ) - { - // look if the alias is in the known repos. - for_ ( kit, repoBegin(), repoEnd() ) - { - if ( (*it).alias() == (*kit).alias() ) - { - ERR << "To be added repo " << (*it).alias() << " conflicts with existing repo " << (*kit).alias() << endl; - ZYPP_THROW(RepoAlreadyExistsException(*it)); - } - } - } - - std::string filename = Pathname(url.getPathName()).basename(); - - if ( filename == Pathname() ) - { - // TranslatorExplanation '%s' is an URL - ZYPP_THROW(RepoException(str::form( _("Invalid repo file name at '%s'"), url.asString().c_str() ))); - } - - // assert the directory exists - filesystem::assert_dir(_options.knownReposPath); - - Pathname repofile = generateNonExistingName(_options.knownReposPath, filename); - // now we have a filename that does not exists - MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl; - - std::ofstream file(repofile.c_str()); - if (!file) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), repofile.c_str() ))); - } - - for ( std::list::iterator it = repos.begin(); - it != repos.end(); - ++it ) - { - MIL << "Saving " << (*it).alias() << endl; - it->setFilepath(repofile.asString()); - it->dumpAsIniOn(file); - reposManip().insert(*it); - - HistoryLog(_options.rootDir).addRepository(*it); - } - - MIL << "done" << endl; - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::removeRepository( const RepoInfo & info, const ProgressData::ReceiverFnc & progressrcv ) - { - ProgressData progress; - callback::SendReport report; - progress.sendTo( ProgressReportAdaptor( progressrcv, report ) ); - progress.name(str::form(_("Removing repository '%s'"), info.label().c_str())); - - MIL << "Going to delete repo " << info.alias() << endl; - - for_( it, repoBegin(), repoEnd() ) - { - // they can be the same only if the provided is empty, that means - // the provided repo has no alias - // then skip - if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) ) - continue; - - // TODO match by url - - // we have a matcing repository, now we need to know - // where it does come from. - RepoInfo todelete = *it; - if (todelete.filepath().empty()) - { - ZYPP_THROW(RepoException( todelete, _("Can't figure out where the repo is stored.") )); - } - else - { - // figure how many repos are there in the file: - std::list filerepos = repositories_in_file(todelete.filepath()); - if ( (filerepos.size() == 1) && ( filerepos.front().alias() == todelete.alias() ) ) - { - // easy, only this one, just delete the file - if ( filesystem::unlink(todelete.filepath()) != 0 ) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW(RepoException( todelete, str::form( _("Can't delete '%s'"), todelete.filepath().c_str() ))); - } - MIL << todelete.alias() << " successfully deleted." << endl; - } - else - { - // there are more repos in the same file - // write them back except the deleted one. - //TmpFile tmp; - //std::ofstream file(tmp.path().c_str()); - - // assert the directory exists - filesystem::assert_dir(todelete.filepath().dirname()); - - std::ofstream file(todelete.filepath().c_str()); - if (!file) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), todelete.filepath().c_str() ))); - } - for ( std::list::const_iterator fit = filerepos.begin(); - fit != filerepos.end(); - ++fit ) - { - if ( (*fit).alias() != todelete.alias() ) - (*fit).dumpAsIniOn(file); - } - } - - CombinedProgressData cSubprogrcv(progress, 20); - CombinedProgressData mSubprogrcv(progress, 40); - CombinedProgressData pSubprogrcv(progress, 40); - // now delete it from cache - if ( isCached(todelete) ) - cleanCache( todelete, cSubprogrcv); - // now delete metadata (#301037) - cleanMetadata( todelete, mSubprogrcv ); - cleanPackages( todelete, pSubprogrcv ); - reposManip().erase(todelete); - MIL << todelete.alias() << " successfully deleted." << endl; - HistoryLog(_options.rootDir).removeRepository(todelete); - return; - } // else filepath is empty - - } - // should not be reached on a sucess workflow - ZYPP_THROW(RepoNotFoundException(info)); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::modifyRepository( const std::string & alias, const RepoInfo & newinfo_r, const ProgressData::ReceiverFnc & progressrcv ) - { - RepoInfo toedit = getRepositoryInfo(alias); - RepoInfo newinfo( newinfo_r ); // need writable copy to upadte housekeeping data - - // check if the new alias already exists when renaming the repo - if ( alias != newinfo.alias() && hasRepo( newinfo.alias() ) ) - { - ZYPP_THROW(RepoAlreadyExistsException(newinfo)); - } - - if (toedit.filepath().empty()) - { - ZYPP_THROW(RepoException( toedit, _("Can't figure out where the repo is stored.") )); - } - else - { - // figure how many repos are there in the file: - std::list filerepos = repositories_in_file(toedit.filepath()); - - // there are more repos in the same file - // write them back except the deleted one. - //TmpFile tmp; - //std::ofstream file(tmp.path().c_str()); - - // assert the directory exists - filesystem::assert_dir(toedit.filepath().dirname()); - - std::ofstream file(toedit.filepath().c_str()); - if (!file) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), toedit.filepath().c_str() ))); - } - for ( std::list::const_iterator fit = filerepos.begin(); - fit != filerepos.end(); - ++fit ) - { - // if the alias is different, dump the original - // if it is the same, dump the provided one - if ( (*fit).alias() != toedit.alias() ) - (*fit).dumpAsIniOn(file); - else - newinfo.dumpAsIniOn(file); - } - - newinfo.setFilepath(toedit.filepath()); - reposManip().erase(toedit); - reposManip().insert(newinfo); - HistoryLog(_options.rootDir).modifyRepository(toedit, newinfo); - MIL << "repo " << alias << " modified" << endl; - } - } - - //////////////////////////////////////////////////////////////////////////// - - RepoInfo RepoManager::Impl::getRepositoryInfo( const std::string & alias, const ProgressData::ReceiverFnc & progressrcv ) - { - RepoConstIterator it( findAlias( alias, repos() ) ); - if ( it != repos().end() ) - return *it; - RepoInfo info; - info.setAlias( alias ); - ZYPP_THROW( RepoNotFoundException(info) ); - } - - - RepoInfo RepoManager::Impl::getRepositoryInfo( const Url & url, const url::ViewOption & urlview, const ProgressData::ReceiverFnc & progressrcv ) - { - for_( it, repoBegin(), repoEnd() ) - { - for_( urlit, (*it).baseUrlsBegin(), (*it).baseUrlsEnd() ) - { - if ( (*urlit).asString(urlview) == url.asString(urlview) ) - return *it; - } - } - RepoInfo info; - info.setBaseUrl( url ); - ZYPP_THROW( RepoNotFoundException(info) ); - } - - //////////////////////////////////////////////////////////////////////////// - // - // Services - // - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::addService( const ServiceInfo & service ) - { - assert_alias( service ); - - // check if service already exists - if ( hasService( service.alias() ) ) - ZYPP_THROW( ServiceAlreadyExistsException( service ) ); - - // Writable ServiceInfo is needed to save the location - // of the .service file. Finaly insert into the service list. - ServiceInfo toSave( service ); - saveService( toSave ); - _services.insert( toSave ); - - // check for credentials in Url (username:password, not ?credentials param) - if ( toSave.url().hasCredentialsInAuthority() ) - { - media::CredentialManager cm( - media::CredManagerOptions(_options.rootDir) ); - - //! \todo use a method calling UI callbacks to ask where to save creds? - cm.saveInUser(media::AuthData(toSave.url())); - } - - MIL << "added service " << toSave.alias() << endl; - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::removeService( const std::string & alias ) - { - MIL << "Going to delete service " << alias << endl; - - const ServiceInfo & service = getService( alias ); - - Pathname location = service.filepath(); - if( location.empty() ) - { - ZYPP_THROW(ServiceException( service, _("Can't figure out where the service is stored.") )); - } - - ServiceSet tmpSet; - parser::ServiceFileReader( location, ServiceCollector(tmpSet) ); - - // only one service definition in the file - if ( tmpSet.size() == 1 ) - { - if ( filesystem::unlink(location) != 0 ) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW(ServiceException( service, str::form( _("Can't delete '%s'"), location.c_str() ) )); - } - MIL << alias << " successfully deleted." << endl; - } - else - { - filesystem::assert_dir(location.dirname()); - - std::ofstream file(location.c_str()); - if( !file ) - { - // TranslatorExplanation '%s' is a filename - ZYPP_THROW( Exception(str::form( _("Can't open file '%s' for writing."), location.c_str() ))); - } - - for_(it, tmpSet.begin(), tmpSet.end()) - { - if( it->alias() != alias ) - it->dumpAsIniOn(file); - } - - MIL << alias << " successfully deleted from file " << location << endl; - } - - // now remove all repositories added by this service - RepoCollector rcollector; - getRepositoriesInService( alias, - boost::make_function_output_iterator( bind( &RepoCollector::collect, &rcollector, _1 ) ) ); - // cannot do this directly in getRepositoriesInService - would invalidate iterators - for_(rit, rcollector.repos.begin(), rcollector.repos.end()) - removeRepository(*rit); - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::refreshServices( const RefreshServiceOptions & options_r ) - { - // copy the set of services since refreshService - // can eventually invalidate the iterator - ServiceSet services( serviceBegin(), serviceEnd() ); - for_( it, services.begin(), services.end() ) - { - if ( !it->enabled() ) - continue; - - try { - refreshService(*it, options_r); - } - catch ( const repo::ServicePluginInformalException & e ) - { ;/* ignore ServicePluginInformalException */ } - } - } - - void RepoManager::Impl::refreshService( const std::string & alias, const RefreshServiceOptions & options_r ) - { - ServiceInfo service( getService( alias ) ); - assert_alias( service ); - assert_url( service ); - // NOTE: It might be necessary to modify and rewrite the service info. - // Either when probing the type, or when adjusting the repositories - // enable/disable state.: - bool serviceModified = false; - MIL << "Going to refresh service '" << service.alias() << "', url: "<< service.url() << ", opts: " << options_r << endl; - - //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed) - - // if the type is unknown, try probing. - if ( service.type() == repo::ServiceType::NONE ) - { - repo::ServiceType type = probeService( service.url() ); - if ( type != ServiceType::NONE ) - { - service.setProbedType( type ); // lazy init! - serviceModified = true; - } - } - - // get target distro identifier - std::string servicesTargetDistro = _options.servicesTargetDistro; - if ( servicesTargetDistro.empty() ) - { - servicesTargetDistro = Target::targetDistribution( Pathname() ); - } - DBG << "ServicesTargetDistro: " << servicesTargetDistro << endl; - - // parse it - RepoCollector collector(servicesTargetDistro); - // FIXME Ugly hack: ServiceRepos may throw ServicePluginInformalException - // which is actually a notification. Using an exception for this - // instead of signal/callback is bad. Needs to be fixed here, in refreshServices() - // and in zypper. - std::pair, repo::ServicePluginInformalException> uglyHack; - try { - ServiceRepos repos(service, bind( &RepoCollector::collect, &collector, _1 )); - } - catch ( const repo::ServicePluginInformalException & e ) - { - /* ignore ServicePluginInformalException and throw later */ - uglyHack.first = true; - uglyHack.second = e; - } - - //////////////////////////////////////////////////////////////////////////// - // On the fly remember the new repo states as defined the reopoindex.xml. - // Move into ServiceInfo later. - ServiceInfo::RepoStates newRepoStates; - - // set service alias and base url for all collected repositories - for_( it, collector.repos.begin(), collector.repos.end() ) - { - // First of all: Prepend service alias: - it->setAlias( str::form( "%s:%s", service.alias().c_str(), it->alias().c_str() ) ); - // set refrence to the parent service - it->setService( service.alias() ); - - // remember the new parsed repo state - newRepoStates[it->alias()] = *it; - - // if the repo url was not set by the repoindex parser, set service's url - Url url; - if ( it->baseUrlsEmpty() ) - url = service.url(); - else - { - // service repo can contain only one URL now, so no need to iterate. - url = it->rawUrl(); // raw! - } - - // libzypp currently has problem with separate url + path handling - // so just append the path to the baseurl - if ( !it->path().empty() ) - { - Pathname path(url.getPathName()); - path /= it->path(); - url.setPathName( path.asString() ); - it->setPath(""); - } - - // save the url - it->setBaseUrl( url ); - } - - //////////////////////////////////////////////////////////////////////////// - // Now compare collected repos with the ones in the system... - // - RepoInfoList oldRepos; - getRepositoriesInService( service.alias(), std::back_inserter( oldRepos ) ); - - //////////////////////////////////////////////////////////////////////////// - // find old repositories to remove... - for_( oldRepo, oldRepos.begin(), oldRepos.end() ) - { - if ( ! foundAliasIn( oldRepo->alias(), collector.repos ) ) - { - if ( oldRepo->enabled() ) - { - // Currently enabled. If this was a user modification remember the state. - const auto & last = service.repoStates().find( oldRepo->alias() ); - if ( last != service.repoStates().end() && ! last->second.enabled ) - { - DBG << "Service removes user enabled repo " << oldRepo->alias() << endl; - service.addRepoToEnable( oldRepo->alias() ); - serviceModified = true; - } - else - DBG << "Service removes enabled repo " << oldRepo->alias() << endl; - } - else - DBG << "Service removes disabled repo " << oldRepo->alias() << endl; - - removeRepository( *oldRepo ); - } - } - - //////////////////////////////////////////////////////////////////////////// - // create missing repositories and modify exising ones if needed... - for_( it, collector.repos.begin(), collector.repos.end() ) - { - // User explicitly requested the repo being enabled? - // User explicitly requested the repo being disabled? - // And hopefully not both ;) If so, enable wins. - - TriBool toBeEnabled( indeterminate ); // indeterminate - follow the service request - DBG << "Service request to " << (it->enabled()?"enable":"disable") << " service repo " << it->alias() << endl; - - if ( options_r.testFlag( RefreshService_restoreStatus ) ) - { - DBG << "Opt RefreshService_restoreStatus " << it->alias() << endl; - // this overrides any pending request! - // Remove from enable request list. - // NOTE: repoToDisable is handled differently. - // It gets cleared on each refresh. - service.delRepoToEnable( it->alias() ); - // toBeEnabled stays indeterminate! - } - else - { - if ( service.repoToEnableFind( it->alias() ) ) - { - DBG << "User request to enable service repo " << it->alias() << endl; - toBeEnabled = true; - // Remove from enable request list. - // NOTE: repoToDisable is handled differently. - // It gets cleared on each refresh. - service.delRepoToEnable( it->alias() ); - serviceModified = true; - } - else if ( service.repoToDisableFind( it->alias() ) ) - { - DBG << "User request to disable service repo " << it->alias() << endl; - toBeEnabled = false; - } - } - - RepoInfoList::iterator oldRepo( findAlias( it->alias(), oldRepos ) ); - if ( oldRepo == oldRepos.end() ) - { - // Not found in oldRepos ==> a new repo to add - - // Make sure the service repo is created with the appropriate enablement - if ( ! indeterminate(toBeEnabled) ) - it->setEnabled( toBeEnabled ); - - DBG << "Service adds repo " << it->alias() << " " << (it->enabled()?"enabled":"disabled") << endl; - addRepository( *it ); - } - else - { - // ==> an exising repo to check - bool oldRepoModified = false; - - if ( indeterminate(toBeEnabled) ) - { - // No user request: check for an old user modificaton otherwise follow service request. - // NOTE: Assert toBeEnabled is boolean afterwards! - if ( oldRepo->enabled() == it->enabled() ) - toBeEnabled = it->enabled(); // service requests no change to the system - else if (options_r.testFlag( RefreshService_restoreStatus ) ) - { - toBeEnabled = it->enabled(); // RefreshService_restoreStatus forced - DBG << "Opt RefreshService_restoreStatus " << it->alias() << " forces " << (toBeEnabled?"enabled":"disabled") << endl; - } - else - { - const auto & last = service.repoStates().find( oldRepo->alias() ); - if ( last == service.repoStates().end() || last->second.enabled != it->enabled() ) - toBeEnabled = it->enabled(); // service request has changed since last refresh -> follow - else - { - toBeEnabled = oldRepo->enabled(); // service request unchaned since last refresh -> keep user modification - DBG << "User modified service repo " << it->alias() << " may stay " << (toBeEnabled?"enabled":"disabled") << endl; - } - } - } - - // changed enable? - if ( toBeEnabled == oldRepo->enabled() ) - { - DBG << "Service repo " << it->alias() << " stays " << (oldRepo->enabled()?"enabled":"disabled") << endl; - } - else if ( toBeEnabled ) - { - DBG << "Service repo " << it->alias() << " gets enabled" << endl; - oldRepo->setEnabled( true ); - oldRepoModified = true; - } - else - { - DBG << "Service repo " << it->alias() << " gets disabled" << endl; - oldRepo->setEnabled( false ); - oldRepoModified = true; - } - - // all other attributes follow the service request: - - // changed name (raw!) - if ( oldRepo->rawName() != it->rawName() ) - { - DBG << "Service repo " << it->alias() << " gets new NAME " << it->rawName() << endl; - oldRepo->setName( it->rawName() ); - oldRepoModified = true; - } - - // changed autorefresh - if ( oldRepo->autorefresh() != it->autorefresh() ) - { - DBG << "Service repo " << it->alias() << " gets new AUTOREFRESH " << it->autorefresh() << endl; - oldRepo->setAutorefresh( it->autorefresh() ); - oldRepoModified = true; - } - - // changed priority? - if ( oldRepo->priority() != it->priority() ) - { - DBG << "Service repo " << it->alias() << " gets new PRIORITY " << it->priority() << endl; - oldRepo->setPriority( it->priority() ); - oldRepoModified = true; - } - - // changed url? - // service repo can contain only one URL now, so no need to iterate. - if ( oldRepo->rawUrl() != it->rawUrl() ) - { - DBG << "Service repo " << it->alias() << " gets new URL " << it->rawUrl() << endl; - oldRepo->setBaseUrl( it->rawUrl() ); - oldRepoModified = true; - } - - // save if modified: - if ( oldRepoModified ) - { - modifyRepository( oldRepo->alias(), *oldRepo ); - } - } - } - - // Unlike reposToEnable, reposToDisable is always cleared after refresh. - if ( ! service.reposToDisableEmpty() ) - { - service.clearReposToDisable(); - serviceModified = true; - } - - // Remember original service request for next refresh - if ( service.repoStates() != newRepoStates ) - { - service.setRepoStates( std::move(newRepoStates) ); - serviceModified = true; - } - - //////////////////////////////////////////////////////////////////////////// - // save service if modified: (unless a plugin service) - if ( serviceModified && service.type() != ServiceType::PLUGIN ) - { - // write out modified service file. - modifyService( service.alias(), service ); - } - - if ( uglyHack.first ) - { - throw( uglyHack.second ); // intentionally not ZYPP_THROW - } - } - - //////////////////////////////////////////////////////////////////////////// - - void RepoManager::Impl::modifyService( const std::string & oldAlias, const ServiceInfo & newService ) - { - MIL << "Going to modify service " << oldAlias << endl; - - // we need a writable copy to link it to the file where - // it is saved if we modify it - ServiceInfo service(newService); - - if ( service.type() == ServiceType::PLUGIN ) - { - ZYPP_THROW(ServicePluginImmutableException( service )); - } - - const ServiceInfo & oldService = getService(oldAlias); - - Pathname location = oldService.filepath(); - if( location.empty() ) - { - ZYPP_THROW(ServiceException( oldService, _("Can't figure out where the service is stored.") )); - } - - // remember: there may multiple services being defined in one file: - ServiceSet tmpSet; - parser::ServiceFileReader( location, ServiceCollector(tmpSet) ); - - filesystem::assert_dir(location.dirname()); - std::ofstream file(location.c_str()); - for_(it, tmpSet.begin(), tmpSet.end()) - { - if( *it != oldAlias ) - it->dumpAsIniOn(file); - } - service.dumpAsIniOn(file); - file.close(); - service.setFilepath(location); - - _services.erase(oldAlias); - _services.insert(service); - - // changed properties affecting also repositories - if ( oldAlias != service.alias() // changed alias - || oldService.enabled() != service.enabled() ) // changed enabled status - { - std::vector toModify; - getRepositoriesInService(oldAlias, std::back_inserter(toModify)); - for_( it, toModify.begin(), toModify.end() ) - { - if ( oldService.enabled() != service.enabled() ) - { - if ( service.enabled() ) - { - // reset to last refreshs state - const auto & last = service.repoStates().find( it->alias() ); - if ( last != service.repoStates().end() ) - it->setEnabled( last->second.enabled ); - } - else - it->setEnabled( false ); - } - - if ( oldAlias != service.alias() ) - it->setService(service.alias()); - - modifyRepository(it->alias(), *it); - } - } - - //! \todo refresh the service automatically if url is changed? - } - - //////////////////////////////////////////////////////////////////////////// - - repo::ServiceType RepoManager::Impl::probeService( const Url & url ) const - { - try - { - MediaSetAccess access(url); - if ( access.doesFileExist("/repo/repoindex.xml") ) - return repo::ServiceType::RIS; - } - catch ( const media::MediaException &e ) - { - ZYPP_CAUGHT(e); - // TranslatorExplanation '%s' is an URL - RepoException enew(str::form( _("Error trying to read from '%s'"), url.asString().c_str() )); - enew.remember(e); - ZYPP_THROW(enew); - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT(e); - // TranslatorExplanation '%s' is an URL - Exception enew(str::form( _("Unknown error reading from '%s'"), url.asString().c_str() )); - enew.remember(e); - ZYPP_THROW(enew); - } - - return repo::ServiceType::NONE; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoManager - // - /////////////////////////////////////////////////////////////////// - - RepoManager::RepoManager( const RepoManagerOptions & opt ) - : _pimpl( new Impl(opt) ) - {} - - RepoManager::~RepoManager() - {} - - bool RepoManager::repoEmpty() const - { return _pimpl->repoEmpty(); } - - RepoManager::RepoSizeType RepoManager::repoSize() const - { return _pimpl->repoSize(); } - - RepoManager::RepoConstIterator RepoManager::repoBegin() const - { return _pimpl->repoBegin(); } - - RepoManager::RepoConstIterator RepoManager::repoEnd() const - { return _pimpl->repoEnd(); } - - RepoInfo RepoManager::getRepo( const std::string & alias ) const - { return _pimpl->getRepo( alias ); } - - bool RepoManager::hasRepo( const std::string & alias ) const - { return _pimpl->hasRepo( alias ); } - - std::string RepoManager::makeStupidAlias( const Url & url_r ) - { - std::string ret( url_r.getScheme() ); - if ( ret.empty() ) - ret = "repo-"; - else - ret += "-"; - - std::string host( url_r.getHost() ); - if ( ! host.empty() ) - { - ret += host; - ret += "-"; - } - - static Date::ValueType serial = Date::now(); - ret += Digest::digest( Digest::sha1(), str::hexstring( ++serial ) +url_r.asCompleteString() ).substr(0,8); - return ret; - } - - RepoStatus RepoManager::metadataStatus( const RepoInfo & info ) const - { return _pimpl->metadataStatus( info ); } - - RepoManager::RefreshCheckStatus RepoManager::checkIfToRefreshMetadata( const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy ) - { return _pimpl->checkIfToRefreshMetadata( info, url, policy ); } - - Pathname RepoManager::metadataPath( const RepoInfo &info ) const - { return _pimpl->metadataPath( info ); } - - Pathname RepoManager::packagesPath( const RepoInfo &info ) const - { return _pimpl->packagesPath( info ); } - - void RepoManager::refreshMetadata( const RepoInfo &info, RawMetadataRefreshPolicy policy, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->refreshMetadata( info, policy, progressrcv ); } - - void RepoManager::cleanMetadata( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->cleanMetadata( info, progressrcv ); } - - void RepoManager::cleanPackages( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->cleanPackages( info, progressrcv ); } - - RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const - { return _pimpl->cacheStatus( info ); } - - void RepoManager::buildCache( const RepoInfo &info, CacheBuildPolicy policy, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->buildCache( info, policy, progressrcv ); } - - void RepoManager::cleanCache( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->cleanCache( info, progressrcv ); } - - bool RepoManager::isCached( const RepoInfo &info ) const - { return _pimpl->isCached( info ); } - - void RepoManager::loadFromCache( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->loadFromCache( info, progressrcv ); } - - void RepoManager::cleanCacheDirGarbage( const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->cleanCacheDirGarbage( progressrcv ); } - - repo::RepoType RepoManager::probe( const Url & url, const Pathname & path ) const - { return _pimpl->probe( url, path ); } - - repo::RepoType RepoManager::probe( const Url & url ) const - { return _pimpl->probe( url ); } - - void RepoManager::addRepository( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->addRepository( info, progressrcv ); } - - void RepoManager::addRepositories( const Url &url, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->addRepositories( url, progressrcv ); } - - void RepoManager::removeRepository( const RepoInfo & info, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->removeRepository( info, progressrcv ); } - - void RepoManager::modifyRepository( const std::string &alias, const RepoInfo & newinfo, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->modifyRepository( alias, newinfo, progressrcv ); } - - RepoInfo RepoManager::getRepositoryInfo( const std::string &alias, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->getRepositoryInfo( alias, progressrcv ); } - - RepoInfo RepoManager::getRepositoryInfo( const Url & url, const url::ViewOption & urlview, const ProgressData::ReceiverFnc & progressrcv ) - { return _pimpl->getRepositoryInfo( url, urlview, progressrcv ); } - - bool RepoManager::serviceEmpty() const - { return _pimpl->serviceEmpty(); } - - RepoManager::ServiceSizeType RepoManager::serviceSize() const - { return _pimpl->serviceSize(); } - - RepoManager::ServiceConstIterator RepoManager::serviceBegin() const - { return _pimpl->serviceBegin(); } - - RepoManager::ServiceConstIterator RepoManager::serviceEnd() const - { return _pimpl->serviceEnd(); } - - ServiceInfo RepoManager::getService( const std::string & alias ) const - { return _pimpl->getService( alias ); } - - bool RepoManager::hasService( const std::string & alias ) const - { return _pimpl->hasService( alias ); } - - repo::ServiceType RepoManager::probeService( const Url &url ) const - { return _pimpl->probeService( url ); } - - void RepoManager::addService( const std::string & alias, const Url& url ) - { return _pimpl->addService( alias, url ); } - - void RepoManager::addService( const ServiceInfo & service ) - { return _pimpl->addService( service ); } - - void RepoManager::removeService( const std::string & alias ) - { return _pimpl->removeService( alias ); } - - void RepoManager::removeService( const ServiceInfo & service ) - { return _pimpl->removeService( service ); } - - void RepoManager::refreshServices( const RefreshServiceOptions & options_r ) - { return _pimpl->refreshServices( options_r ); } - - void RepoManager::refreshService( const std::string & alias, const RefreshServiceOptions & options_r ) - { return _pimpl->refreshService( alias, options_r ); } - - void RepoManager::refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r ) - { return _pimpl->refreshService( service, options_r ); } - - void RepoManager::modifyService( const std::string & oldAlias, const ServiceInfo & service ) - { return _pimpl->modifyService( oldAlias, service ); } - - //////////////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const RepoManager & obj ) - { return str << *obj._pimpl; } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/RepoManager.h b/libzypp/zypp/RepoManager.h deleted file mode 100644 index 8717b9f..0000000 --- a/libzypp/zypp/RepoManager.h +++ /dev/null @@ -1,708 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoManager.h - * -*/ -#ifndef ZYPP_REPOMANAGER_H -#define ZYPP_REPOMANAGER_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/Flags.h" - -#include "zypp/Pathname.h" -#include "zypp/ZConfig.h" -#include "zypp/RepoInfo.h" -#include "zypp/repo/RepoException.h" -#include "zypp/repo/RepoType.h" -#include "zypp/repo/ServiceType.h" -#include "zypp/ServiceInfo.h" -#include "zypp/RepoStatus.h" -#include "zypp/ProgressData.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** - * Parses \a repo_file and returns a list of \ref RepoInfo objects - * corresponding to repositories found within the file. - * - * \param repo_file Valid URL of the repo file. - * \return found list - * - * \throws MediaException If the access to the url fails - * \throws ParseException If the file parsing fails - * \throws Exception On other errors. - */ - std::list readRepoFile(const Url & repo_file); - - /** - * Repo manager settings. - * Settings default to ZYpp global settings. - */ - struct RepoManagerOptions - { - /** Default ctor following \ref ZConfig global settings. - * If an optional \c root_r directory is given, all paths will - * be prefixed accordingly. - * \code - * root_r\repoCachePath - * \repoRawCachePath - * \repoSolvCachePath - * \repoPackagesCachePath - * \knownReposPath - * \endcode - */ - RepoManagerOptions( const Pathname & root_r = Pathname() ); - - /** Test setup adjusting all paths to be located below one \c root_r directory. - * \code - * root_r\ - repoCachePath - * \raw - repoRawCachePath - * \solv - repoSolvCachePath - * \packages - repoPackagesCachePath - * \repos.d - knownReposPath - * \endcode - */ - static RepoManagerOptions makeTestSetup( const Pathname & root_r ); - - Pathname repoCachePath; - Pathname repoRawCachePath; - Pathname repoSolvCachePath; - Pathname repoPackagesCachePath; - Pathname knownReposPath; - Pathname knownServicesPath; - Pathname pluginsPath; - bool probe; - /** - * Target distro ID to be used when refreshing repo index services. - * Repositories not maching this ID will be skipped/removed. - * - * The value is initialized upon construction to - * \ref Target::targetDistribution() if the Target is already initialized, - * otherwise the value is initially empty. - * - * If empty, no repositories contained in the index will be skipped. - */ - std::string servicesTargetDistro; - - /** remembers root_r value for later use */ - Pathname rootDir; - }; - - - - /** - * \short creates and provides information about known sources. - * - */ - class RepoManager - { - friend std::ostream & operator<<( std::ostream & str, const RepoManager & obj ); - - public: - /** Implementation */ - class Impl; - - /** ServiceInfo typedefs */ - typedef std::set ServiceSet; - typedef ServiceSet::const_iterator ServiceConstIterator; - typedef ServiceSet::size_type ServiceSizeType; - - /** RepoInfo typedefs */ - typedef std::set RepoSet; - typedef RepoSet::const_iterator RepoConstIterator; - typedef RepoSet::size_type RepoSizeType; - - public: - RepoManager( const RepoManagerOptions &options = RepoManagerOptions() ); - /** Dtor */ - ~RepoManager(); - - enum RawMetadataRefreshPolicy - { - RefreshIfNeeded, - RefreshForced, - RefreshIfNeededIgnoreDelay - }; - - enum CacheBuildPolicy - { - BuildIfNeeded, - BuildForced - }; - - /** Flags for tuning RefreshService */ - enum RefreshServiceBit - { - RefreshService_restoreStatus = (1<<0) ///< Force restoring repo enabled/disabled staus - }; - ZYPP_DECLARE_FLAGS(RefreshServiceFlags,RefreshServiceBit); - - /** Options tuning RefreshService */ - typedef RefreshServiceFlags RefreshServiceOptions; - - - /** \name Known repositories. - * - * The known repositories are read from - * \ref RepoManagerOptions::knownReposPath passed on the Ctor. - * Which defaults to ZYpp global settings. - */ - //@{ - bool repoEmpty() const; - RepoSizeType repoSize() const; - RepoConstIterator repoBegin() const; - RepoConstIterator repoEnd() const; - - /** List of known repositories. */ - std::list knownRepositories() const - { return std::list(repoBegin(),repoEnd()); } - - /** Find RepoInfo by alias or return \ref RepoInfo::noRepo. */ - RepoInfo getRepo( const std::string & alias ) const; - /** \overload Take alias from RepoInfo. */ - RepoInfo getRepo( const RepoInfo & info_r ) const - { return getRepo( info_r.alias() ); } - - /** Return whether there is a known repository for \c alias. */ - bool hasRepo( const std::string & alias ) const; - /** \overload Take alias from RepoInfo. */ - bool hasRepo( const RepoInfo & info_r ) const - { return hasRepo( info_r.alias() ); } - - /** Some stupid string but suitable as alias for your url if nothing better is available. - * Something like \c "http-download.opensuse.org-83df67e5" - */ - static std::string makeStupidAlias( const Url & url_r = Url() ); - //@} - - /** - * \short Status of local metadata - */ - RepoStatus metadataStatus( const RepoInfo &info ) const; - - /** - * Possibly return state of checkIfRefreshMEtadata function - */ - enum RefreshCheckStatus { - REFRESH_NEEDED, /**< refresh is needed */ - REPO_UP_TO_DATE, /**< repository not changed */ - REPO_CHECK_DELAYED /**< refresh is delayed due to settings */ - }; - - /** - * Checks whether to refresh metadata for specified repository and url. - *

- * The need for refresh is evaluated according to the following conditions, - * in that order: - *

    - *
  • the refresh policy (refresh may be forced) - *
  • the repo.refresh.delay ZConfig value compared to the difference between - * cached index file timestamp and actual time - *
  • the timestamp of cached repo index file compared to the remote - * index file timestamp. - *
- *

- * This method checks the status against the specified url only. If more - * baseurls are defined for in the RepoInfo, each one must be check - * individually. Example: - * - * - * - * RepoInfo info; - * // try urls one by one - * for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); - * it != info.baseUrlsEnd(); ++it ) - * { - * try - * { - * // check whether to refresh metadata - * // if the check fails for this url, it throws, so another url will be checked - * if (checkIfToRefreshMetadata(info, *it, policy)!=RepoInfo::REFRESH_NEEDED) - * return; - * - * // do the actual refresh - * } - * catch (const Exception & e) - * { - * ZYPP_CAUGHT(e); - * ERR << *it << " doesn't look good. Trying another url." << endl; - * } - * } // for all urls - * - * handle("No more URLs."); - * - * - * - * \param info - * \param url - * \param policy - * \return state of repository - * \see RefreshCheckStatus - * \throws RepoUnknownTypeException - * \throws repo::RepoNoAliasException if can't figure an alias - * \throws Exception on unknown error - * - */ - RefreshCheckStatus checkIfToRefreshMetadata( const RepoInfo &info, - const Url &url, - RawMetadataRefreshPolicy policy = RefreshIfNeeded); - - /** - * \short Path where the metadata is downloaded and kept - * - * Given a repoinfo, tells where \ref RepoManager will download - * and keep the raw metadata. - * - * \param info Repository information - * - * \throws repo::RepoNoAliasException if can't figure an alias - */ - Pathname metadataPath( const RepoInfo &info ) const; - - - /** - * \short Path where the rpm packages are downloaded and kept - * - * Given a repoinfo, tells where \ref RepoProvidePackage will download - * and keep the .rpm files. - * - * \param info Repository information - * - * \throws repo::RepoNoAliasException if can't figure an alias - */ - Pathname packagesPath( const RepoInfo &info ) const; - - - /** - * \short Refresh local raw cache - * - * Will try to download the metadata - * - * In case of falure the metadata remains - * as it was before. - * - * \throws repo::RepoNoUrlException if no urls are available. - * \throws repo::RepoNoAliasException if can't figure an alias - * \throws repo::RepoUnknownTypeException if the metadata is unknown - * \throws repo::RepoException if the repository is invalid - * (no valid metadata found at any of baseurls) - */ - void refreshMetadata( const RepoInfo &info, - RawMetadataRefreshPolicy policy = RefreshIfNeeded, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Clean local metadata - * - * Empty local metadata. - * - * \throws repo::RepoNoAliasException if can't figure an alias - * \throws Exception on unknown error. - */ - void cleanMetadata( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Clean local package cache - * - * Empty local directory with downloaded packages - * - * \throws repo::RepoNoAliasException if can't figure an alias - * \throws Exception on unknown error. - */ - void cleanPackages( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Status of metadata cache - */ - RepoStatus cacheStatus( const RepoInfo &info ) const; - - /** - * \short Refresh local cache - * - * Will try to build the cache from local metadata. - * - * If the cache exists it will be overwriten. - * - * \note the local metadata must be valid. - * - * \throws repo::RepoNoAliasException if can't figure - * an alias to look in cache - * \throws repo::RepoMetadataException if the metadata - * is not enough to build a cache (empty, incorrect, or - * refresh needed) - * \throws repo::RepoUnknownTypeException - * \throws parser::ParseException if parser encounters an error. - * \throws Exception on unknown error. - */ - void buildCache( const RepoInfo &info, - CacheBuildPolicy policy = BuildIfNeeded, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short clean local cache - * - * Clean the cached version of the metadata - * - * \note the local metadata must be valid. - * - * \throws repo::RepoNoAliasException if can't figure an alias to look in cache - * \throws cache::CacheRecordNotFoundException if the cache could not be - * cleaned because of repository record not found. - * \throws Exception on unknown error. - */ - void cleanCache( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Whether a repository exists in cache - * - * \param RepoInfo to be checked. - */ - bool isCached( const RepoInfo &info ) const; - - - /** - * \short Load resolvables into the pool - * - * Creating from cache requires that the repository is - * refreshed (metadata downloaded) and cached - * - * \throws repo::RepoNoAliasException if can't figure an alias to look in cache - * \throw RepoNotCachedException When the source is not cached. - */ - void loadFromCache( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * Remove any subdirectories of cache directories which no longer belong - * to any of known repositories. - * - * These can be temporary directories left by interrupted refresh, - * or dirs left after changing .repo files outside of libzypp. - */ - void cleanCacheDirGarbage( const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Probe repo metadata type. - * - * The location to probe consists of the base \a url (you may think of it as - * a mountpoint) and the \a path to the repository on the mounted media - * (ususally \c / ). - */ - repo::RepoType probe( const Url & url, const Pathname & path ) const; - /** - * \overload Using the default path \c "/". - */ - repo::RepoType probe( const Url & url ) const; - - - /** - * \short Adds a repository to the list of known repositories. - * - * - * - * \throws repo::RepoAlreadyExistsException If the repo clash some - * unique attribute like alias - * \throws RepoUnknownType - * If RepoManagerOptions::probe is true - * and repository type can't be determined. - * \throws RepoException - * If RepoManagerOptions::probe is true and access to the url fails. - * \throws Exception On other errors. - */ - void addRepository( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Adds repositores from a repo file to the list of known repositories. - * \param url Url of the repo file - * - * \throws repo::RepoAlreadyExistsException If the repo clash some - * unique attribute like alias - * \throws MediaException If the access to the url fails - * \throws ParseException If the file parsing fails - * \throws RepoUnknownType If repository type can't be determined - * \throws RepoException ON other repository related errors - * \throws Exception On other errors. - */ - void addRepositories( const Url &url, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - /** - * \short Remove the best matching repository from known repos list - * - * \throws RepoNotFoundException If no repo match - */ - void removeRepository( const RepoInfo & info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Modify repository attributes - * - * \throws RepoAlreadyExistsException if the alias specified in newinfo - * is already used by another repository - * \throws RepoNotFoundException If no repo match - * \throws ParseException If the file parsing fails - * \throws Exception On other errors. - */ - void modifyRepository( const std::string &alias, - const RepoInfo & newinfo, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - /** \overload Take alias from RepoInfo. */ - void modifyRepository( const RepoInfo & newinfo, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ) - { modifyRepository( newinfo.alias(), newinfo, progressrcv ); } - - /** - * \short Find a matching repository info - * - * \note if multiple repositories incorrectly share the - * same alias, the first one found will be returned. - * - * \param alias Repository alias - * \param progressrcv Progress reporting function - * \return RepoInfo of the found repository - * \throws RepoNotFoundException If no repo match the alias - * \throws ParseException If the file parsing fails - * \throws Exception On other errors. - */ - RepoInfo getRepositoryInfo( const std::string &alias, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - /** - * \short Find repository info by URL. - * - * \param url URL to find. - * \param urlview url::ViewOption to influence URL matching. - * \param progressrcv Progress receiver function. - * \return RepoInfo of the found repository. - * - * \note if multpile repositories incorrectly share the - * same URL, the first one found will be returned. - * - * \note the string representation of the URLs are compared. - * The \a urlview can be used to influence which - parts of the URL are to be compared. - * - * \throws RepoNotFoundException If no repo match - * \throws ParseException If the file parsing fails - * \throws Exception On other errors. - */ - RepoInfo getRepositoryInfo( const Url & url, - const url::ViewOption & urlview = url::ViewOption::DEFAULTS, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - - /** \name Known services. - * - * The known services are read from - * \ref RepoManagerOptions::knownServicesPath passed on the Ctor. - * Which defaults to ZYpp global settings. - */ - //@{ - /** - * Gets true if no service is in RepoManager (so no one in specified location) - * - * \return true if any ServiceInfo is in RepoManager - */ - bool serviceEmpty() const; - - /** - * Gets count of service in RepoManager (in specified location) - * - * \return count of service - */ - ServiceSizeType serviceSize() const; - - /** - * Iterator to first service in internal storage. - * \note Iterator is immutable, so you cannot change pointed ServiceInfo - * \return Iterator to first service - */ - ServiceConstIterator serviceBegin() const; - - /** - * Iterator to place behind last service in internal storage. - * \return iterator to end - */ - ServiceConstIterator serviceEnd() const; - - /** List of known services. */ - std::list knownServices() const - { return std::list(serviceBegin(),serviceEnd()); } - - /** - * \short Finds ServiceInfo by alias or return \ref ServiceInfo::noService - * - * \param alias unique identifier of service - * \return information about service - */ - ServiceInfo getService( const std::string & alias ) const; - - /** Return whether there is a known service for \c alias. */ - bool hasService( const std::string & alias ) const; - //@} - - /** - * \short Probe the type or the service. - */ - repo::ServiceType probeService( const Url &url ) const; - - /** - * Adds new service by it's alias and url - * - * \param alias unique identifier of the service - * \param url url to service - * - * \throws FIXME RepoAlreadyExistException and as reponame is service name - */ - void addService( const std::string & alias, const Url& url ); - - /** - * Adds new service - * - * \param service service info - * - * \throws FIXME RepoAlreadyExistException and as reponame is service name - */ - void addService( const ServiceInfo & service ); - - /** - * Removes service specified by its name - * - * \param alias unique indientifier of the service to remove - * - * \throws RepoException if service is not found or file with ServiceInfo cannot be deleted - * \throws Exception if file contain more services and rewrite file failed - */ - void removeService( const std::string & alias ); - /** \overload Take alias from ServiceInfo */ - void removeService( const ServiceInfo & service ); - - - /** - * Refreshes all enabled services. - * - * \see refreshService(ServiceInfo) - */ - void refreshServices( const RefreshServiceOptions & options_r = RefreshServiceOptions() ); - - /** - * Refresh specific service. - * - * \param alias unique indientifier of the service to refresh - * - * \throws RepoException if service is not found. - * \throws MediaException If there's a problem downloading the repo index file. - */ - void refreshService( const std::string & alias, const RefreshServiceOptions & options_r = RefreshServiceOptions() ); - /** \overload Take alias from ServiceInfo */ - void refreshService( const ServiceInfo & service, const RefreshServiceOptions & options_r = RefreshServiceOptions() ); - - /** - * Modifies service file (rewrites it with new values) and underlying - * repositories if needed. - * - * Modifications of a service can lead to rewrite of all .repo files of - * contained repositories. Particularily, disabling a service (changing - * ServiceInfo::enabled() from true to false) will disable all contained - * repositories. Renaming of a service will modify the "service" key - * of all contained repositories. - * - * \param oldAlias Old alias of the service - * \param service ServiceInfo object containing new data - * - * \throws RepoException if sservice with oldAlias is not known - * \throws Exception if have problems with files - */ - void modifyService( const std::string & oldAlias, const ServiceInfo & service ); - /** \overload Take alias from ServiceInfo. */ - void modifyService( const ServiceInfo & service ) - { modifyService( service.alias(), service ); } - - private: - /** - * Functor thats filter RepoInfo by service which it belongs to. - */ - struct MatchServiceAlias - { - public: - MatchServiceAlias( const std::string & alias_ ) : alias(alias_) {} - bool operator()( const RepoInfo & info ) const - { return info.service() == alias; } - private: - std::string alias; - }; - - public: - - /** - * fill to output iterator repositories in service name. This output iterator can perform - * any action on with Repo or service Container, because it is sets and it isn't dynamic recreate. - * - * \note Don't use this function with RepoManager::removeRepository(), it will lead to segfaults - * due to invalidated internal iterators. FIXME can this be solved (using STL) so that this - * warning would not be needed? - * - * \param alias service alias - * \param out output iterator which get all the repositories belonging to - * specified service - * - * example how set priority for each RepoInfo in this service: - * \code - * //functor - * class ChangePriority - * { - * private: - * int priority; - * public: - * ChangePriority(int prio) : priority(prio) {} - * // missing rewrite priority back via RepoManager::modifyRepo - * void doIt( RepoInfo info ) { info.setPriority(priority); } - * } - * - * //somewhere in code - * ChangePriority changer(10); - * getRepositoriesInService(name, - * boost::make_function_output_iterator( - * bind(&ChangePriority::doIt, &changer, _1))); - * \endcode - */ - template - void getRepositoriesInService( const std::string & alias, - OutputIterator out ) const - { - MatchServiceAlias filter(alias); - - std::copy( boost::make_filter_iterator( filter, repoBegin(), repoEnd() ), - boost::make_filter_iterator( filter, repoEnd(), repoEnd() ), - out); - } - - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - ZYPP_DECLARE_OPERATORS_FOR_FLAGS(RepoManager::RefreshServiceFlags); - /////////////////////////////////////////////////////////////////// - - /** \relates RepoManager Stream output */ - std::ostream & operator<<( std::ostream & str, const RepoManager & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP2_REPOMANAGER_H diff --git a/libzypp/zypp/RepoStatus.cc b/libzypp/zypp/RepoStatus.cc deleted file mode 100644 index b51b25c..0000000 --- a/libzypp/zypp/RepoStatus.cc +++ /dev/null @@ -1,171 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoStatus.cc - * -*/ -#include -#include -#include -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/RepoStatus.h" -#include "zypp/PathInfo.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoStatus::Impl - // - /** RepoStatus implementation. */ - struct RepoStatus::Impl - { - public: - string _checksum; - Date _timestamp; - - /** Recursive computation of max dir timestamp. */ - static void recursive_timestamp( const Pathname & dir_r, time_t & max_r ) - { - std::list dircontent; - if ( filesystem::readdir( dircontent, dir_r, false/*no dots*/ ) != 0 ) - return; // readdir logged the error - - for_( it, dircontent.begin(), dircontent.end() ) - { - PathInfo pi( dir_r + *it, PathInfo::LSTAT ); - if ( pi.isDir() ) - { - if ( pi.mtime() > max_r ) - max_r = pi.mtime(); - recursive_timestamp( pi.path(), max_r ); - } - } - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoStatus::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const RepoStatus::Impl & obj ) - { return str << obj._checksum << " " << (time_t)obj._timestamp; } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoStatus - // - /////////////////////////////////////////////////////////////////// - - RepoStatus::RepoStatus() - : _pimpl( new Impl() ) - {} - - RepoStatus::RepoStatus( const Pathname & path_r ) - : _pimpl( new Impl() ) - { - PathInfo info( path_r ); - if ( info.isExist() ) - { - if ( info.isFile() ) - { - _pimpl->_timestamp = Date( info.mtime() ); - _pimpl->_checksum = filesystem::sha1sum( path_r ); - } - else if ( info.isDir() ) - { - time_t t = info.mtime(); - Impl::recursive_timestamp( path_r, t ); - _pimpl->_timestamp = Date(t); - _pimpl->_checksum = CheckSum::sha1FromString( str::numstring( t ) ).checksum(); - } - - // NOTE: changing magic will once invalidate all solv file caches - // Helpfull if solv file content must be refreshed (e.g. due to different - // repo2* arguments) even if raw metadata are unchanged. - static const std::string magic( "42" ); - _pimpl->_checksum += magic; - } - } - - RepoStatus::~RepoStatus() - {} - - RepoStatus RepoStatus::fromCookieFile( const Pathname & path_r ) - { - RepoStatus ret; - std::ifstream file( path_r.c_str() ); - if ( !file ) - { - WAR << "No cookie file " << path_r << endl; - } - else - { - // line := "[checksum] time_t" - std::string line( str::getline( file ) ); - ret._pimpl->_timestamp = Date( str::strtonum( str::stripLastWord( line ) ) ); - ret._pimpl->_checksum = line; - } - return ret; - } - - void RepoStatus::saveToCookieFile( const Pathname & path_r ) const - { - std::ofstream file(path_r.c_str()); - if (!file) { - ZYPP_THROW (Exception( "Can't open " + path_r.asString() ) ); - } - file << _pimpl->_checksum << " " << (time_t)_pimpl->_timestamp << endl; - file.close(); - } - - bool RepoStatus::empty() const - { return _pimpl->_checksum.empty(); } - - Date RepoStatus::timestamp() const - { return _pimpl->_timestamp; } - - std::ostream & operator<<( std::ostream & str, const RepoStatus & obj ) - { return str << *obj._pimpl; } - - RepoStatus operator&&( const RepoStatus & lhs, const RepoStatus & rhs ) - { - RepoStatus result; - - if ( lhs.empty() ) - result = rhs; - else if ( rhs.empty() ) - result = lhs; - else - { - // order strings to assert && is kommutativ - std::string lchk( lhs._pimpl->_checksum ); - std::string rchk( rhs._pimpl->_checksum ); - stringstream ss( lchk < rchk ? lchk+rchk : rchk+lchk ); - - result._pimpl->_checksum = CheckSum::sha1(ss).checksum(); - result._pimpl->_timestamp = std::max( lhs._pimpl->_timestamp, rhs._pimpl->_timestamp ); - } - return result; - } - - bool operator==( const RepoStatus & lhs, const RepoStatus & rhs ) - { return lhs._pimpl->_checksum == rhs._pimpl->_checksum; } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/RepoStatus.h b/libzypp/zypp/RepoStatus.h deleted file mode 100644 index 587a507..0000000 --- a/libzypp/zypp/RepoStatus.h +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/RepoStatus.h - * -*/ -#ifndef ZYPP2_REPOSTATUS_H -#define ZYPP2_REPOSTATUS_H - -#include -#include "zypp/base/PtrTypes.h" -#include "zypp/CheckSum.h" -#include "zypp/Date.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class RepoStatus - /// \brief Track changing files or directories. - /// - /// Compute timestamp and checksum for individual files or - /// directories (recursively) to track changing content. - /// - /// The timestamp most probably denotes the time the data were - /// changed the last time, that's why it is exposed. - /// - /// The checksum however is an implementation detail and of no - /// use outside this class. \ref operator== tells if the checksums - /// of two rRepoStatus are the same. - /////////////////////////////////////////////////////////////////// - class RepoStatus - { - friend std::ostream & operator<<( std::ostream & str, const RepoStatus & obj ); - friend RepoStatus operator&&( const RepoStatus & lhs, const RepoStatus & rhs ); - friend bool operator==( const RepoStatus & lhs, const RepoStatus & rhs ); - - public: - /** Default ctor */ - RepoStatus(); - - /** Compute status for single file or directory (recursively) - * - * \note Construction from a non existing file will result - * in an empty status. - */ - explicit RepoStatus( const Pathname & path_r ); - - /** Dtor */ - ~RepoStatus(); - - public: - /** Reads the status from a cookie file - * \returns An empty \ref RepoStatus if the file does not - * exist or is not readable. - * \see \ref saveToCookieFile - */ - static RepoStatus fromCookieFile( const Pathname & path ); - - /** Save the status information to a cookie file - * \throws Exception if the file can't be saved - * \see \ref fromCookieFile - */ - void saveToCookieFile( const Pathname & path_r ) const; - - public: - /** Whether the status is empty (default constucted) */ - bool empty() const; - - /** The time the data were changed the last time */ - Date timestamp() const; - - public: - class Impl; ///< Implementation - private: - RWCOW_pointer _pimpl; ///< Pointer to implementation - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoStatus Stream output */ - std::ostream & operator<<( std::ostream & str, const RepoStatus & obj ); - - /** \relates RepoStatus Combine two RepoStatus (combined checksum and newest timestamp) */ - RepoStatus operator&&( const RepoStatus & lhs, const RepoStatus & rhs ); - - /** \relates RepoStatus Whether 2 RepoStatus refer to the same content checksum */ - bool operator==( const RepoStatus & lhs, const RepoStatus & rhs ); - - /** \relates RepoStatus Whether 2 RepoStatus refer to different content checksums */ - inline bool operator!=( const RepoStatus & lhs, const RepoStatus & rhs ) - { return ! ( lhs == rhs ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP2_REPOSTATUS_H diff --git a/libzypp/zypp/Repository.cc b/libzypp/zypp/Repository.cc deleted file mode 100644 index ae31925..0000000 --- a/libzypp/zypp/Repository.cc +++ /dev/null @@ -1,425 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Repository.cc - * -*/ -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Exception.h" -#include "zypp/base/Xml.h" - -#include "zypp/AutoDispose.h" -#include "zypp/Pathname.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/Repository.h" -#include "zypp/ResPool.h" -#include "zypp/Product.h" -#include "zypp/sat/Pool.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - const Repository Repository::noRepository; - - const std::string & Repository::systemRepoAlias() - { return sat::detail::PoolImpl::systemRepoAlias(); } - - ///////////////////////////////////////////////////////////////// - - ::_Repo * Repository::get() const - { return myPool().getRepo( _id ); } - -#define NO_REPOSITORY_RETURN( VAL ) \ - ::_Repo * _repo( get() ); \ - if ( ! _repo ) return VAL - -#define NO_REPOSITORY_THROW( VAL ) \ - ::_Repo * _repo( get() ); \ - if ( ! _repo ) ZYPP_THROW( VAL ) - - bool Repository::isSystemRepo() const - { - NO_REPOSITORY_RETURN( false ); - return myPool().isSystemRepo( _repo ); - } - - std::string Repository::alias() const - { - NO_REPOSITORY_RETURN( std::string() ); - if ( ! _repo->name ) - return std::string(); - return _repo->name; - } - - std::string Repository::name() const - { return info().name(); } - - std::string Repository::label() const - { return info().label(); } - - int Repository::satInternalPriority() const - { - NO_REPOSITORY_RETURN( INT_MIN ); - return _repo->priority; - } - - int Repository::satInternalSubPriority() const - { - NO_REPOSITORY_RETURN( INT_MIN ); - return _repo->subpriority; - } - - Repository::ContentRevision Repository::contentRevision() const - { - NO_REPOSITORY_RETURN( ContentRevision() ); - sat::LookupRepoAttr q( sat::SolvAttr::repositoryRevision, *this ); - return q.empty() ? std::string() : q.begin().asString(); - } - - Repository::ContentIdentifier Repository::contentIdentifier() const - { - NO_REPOSITORY_RETURN( ContentIdentifier() ); - sat::LookupRepoAttr q( sat::SolvAttr::repositoryRepoid, *this ); - return q.empty() ? std::string() : q.begin().asString(); - } - - bool Repository::hasContentIdentifier( const ContentIdentifier & id_r ) const - { - NO_REPOSITORY_RETURN( false ); - sat::LookupRepoAttr q( sat::SolvAttr::repositoryRepoid, *this ); - for_( it, q.begin(), q.end() ) - if ( it.asString() == id_r ) - return true; - return false; - } - - zypp::Date Repository::generatedTimestamp() const - { - NO_REPOSITORY_RETURN( 0 ); - sat::LookupRepoAttr q( sat::SolvAttr::repositoryTimestamp, *this ); - return( q.empty() ? 0 : q.begin().asUnsigned() ); - } - - zypp::Date Repository::suggestedExpirationTimestamp() const - { - NO_REPOSITORY_RETURN( 0 ); - Date generated = generatedTimestamp(); - if ( ! generated ) - return 0; // do not calculate over a missing generated timestamp - - sat::LookupRepoAttr q( sat::SolvAttr::repositoryExpire, *this ); - if ( q.empty() ) - return 0; - - return generated + Date(q.begin().asUnsigned()); - } - - Repository::Keywords Repository::keywords() const - { - NO_REPOSITORY_RETURN( Keywords() ); - return Keywords( sat::SolvAttr::repositoryKeywords, *this, sat::LookupAttr::REPO_ATTR ); - } - - bool Repository::hasKeyword( const std::string & val_r ) const - { - for ( const auto & val : keywords() ) - if ( val == val_r ) - return true; - return false; - } - - bool Repository::maybeOutdated() const - { - NO_REPOSITORY_RETURN( false ); - // system repo is not mirrored - if ( isSystemRepo() ) - return false; - - Date suggested = suggestedExpirationTimestamp(); - - // if no data, don't suggest - if ( ! suggested ) - return false; - - return suggestedExpirationTimestamp() < Date::now(); - } - - bool Repository::providesUpdatesFor( const CpeId & cpeid_r ) const - { - NO_REPOSITORY_RETURN( false ); - if ( ! cpeid_r ) - return false; // filter queries/products without CpeId, as an empty CpeId matches ANYthing. - - // check in repository metadata - for_( it, updatesProductBegin(), updatesProductEnd() ) - { - if ( compare( cpeid_r, it.cpeId(), SetRelation::subset ) ) - return true; - } - - // check whether known products refer to this as update repo - sat::LookupRepoAttr myIds( sat::SolvAttr::repositoryRepoid, *this ); // usually just one, but... - if ( ! myIds.empty() ) - { - const ResPool & pool( ResPool::instance() ); - for_( it, pool.byKindBegin(), pool.byKindEnd() ) - { - Product::constPtr prod( (*it)->asKind() ); - if ( compare( cpeid_r, prod->cpeId(), SetRelation::superset ) ) - { - for_( myId, myIds.begin(), myIds.end() ) - { - if ( prod->hasUpdateContentIdentifier( myId.asString() ) ) - return true; - } - } - } - } - return false; - } - - bool Repository::isUpdateRepo() const - { - NO_REPOSITORY_RETURN( false ); - - // check in repository metadata - if ( updatesProductBegin() != updatesProductEnd() ) - return true; - - // check whether known products refer to this as update repo - sat::LookupRepoAttr myIds( sat::SolvAttr::repositoryRepoid, *this ); // usually just one, but... - if ( ! myIds.empty() ) - { - const ResPool & pool( ResPool::instance() ); - for_( it, pool.byKindBegin(), pool.byKindEnd() ) - { - for_( myId, myIds.begin(), myIds.end() ) - { - if ( (*it)->asKind()->hasUpdateContentIdentifier( myId.asString() ) ) - return true; - } - } - } - return false; - } - - bool Repository::solvablesEmpty() const - { - NO_REPOSITORY_RETURN( true ); - return !_repo->nsolvables; - } - - Repository::size_type Repository::solvablesSize() const - { - NO_REPOSITORY_RETURN( 0 ); - return _repo->nsolvables; - } - - Repository::SolvableIterator Repository::solvablesBegin() const - { - NO_REPOSITORY_RETURN( make_filter_iterator( detail::ByRepository( *this ), - sat::detail::SolvableIterator(), - sat::detail::SolvableIterator() ) ); - return make_filter_iterator( detail::ByRepository( *this ), - sat::detail::SolvableIterator(_repo->start), - sat::detail::SolvableIterator(_repo->end) ); - } - - Repository::SolvableIterator Repository::solvablesEnd() const - { - NO_REPOSITORY_RETURN( make_filter_iterator( detail::ByRepository( *this ), - sat::detail::SolvableIterator(), - sat::detail::SolvableIterator() ) ); - return make_filter_iterator(detail::ByRepository( *this ), - sat::detail::SolvableIterator(_repo->end), - sat::detail::SolvableIterator(_repo->end) ); - } - - Repository::ProductInfoIterator Repository::compatibleWithProductBegin() const - { - NO_REPOSITORY_RETURN( ProductInfoIterator() ); - return ProductInfoIterator( sat::SolvAttr::repositoryDistros, *this ); - } - - Repository::ProductInfoIterator Repository::compatibleWithProductEnd() const - { - return ProductInfoIterator(); - } - - Repository::ProductInfoIterator Repository::updatesProductBegin() const - { - NO_REPOSITORY_RETURN( ProductInfoIterator() ); - return ProductInfoIterator( sat::SolvAttr::repositoryUpdates, *this ); - } - - Repository::ProductInfoIterator Repository::updatesProductEnd() const - { - return ProductInfoIterator(); - } - - RepoInfo Repository::info() const - { - NO_REPOSITORY_RETURN( RepoInfo() ); - return myPool().repoInfo( _repo ); - } - - void Repository::setInfo( const RepoInfo & info_r ) - { - NO_REPOSITORY_THROW( Exception( "Can't set RepoInfo for norepo." ) ); - if ( info_r.alias() != alias() ) - { - ZYPP_THROW( Exception( str::form( "RepoInfo alias (%s) does not match repository alias (%s)", - info_r.alias().c_str(), alias().c_str() ) ) ); - } - myPool().setRepoInfo( _repo, info_r ); - MIL << *this << endl; - } - - void Repository::clearInfo() - { - NO_REPOSITORY_RETURN(); - myPool().setRepoInfo( _repo, RepoInfo() ); - } - - void Repository::eraseFromPool() - { - NO_REPOSITORY_RETURN(); - MIL << *this << " removed from pool" << endl; - myPool()._deleteRepo( _repo ); - _id = sat::detail::noRepoId; - } - - Repository Repository::nextInPool() const - { - NO_REPOSITORY_RETURN( noRepository ); - for_( it, sat::Pool::instance().reposBegin(), sat::Pool::instance().reposEnd() ) - { - if ( *it == *this ) - { - if ( ++it != _for_end ) - return *it; - break; - } - } - return noRepository; - } - - void Repository::addSolv( const Pathname & file_r ) - { - NO_REPOSITORY_THROW( Exception( "Can't add solvables to norepo." ) ); - - AutoDispose file( ::fopen( file_r.c_str(), "re" ), ::fclose ); - if ( file == NULL ) - { - file.resetDispose(); - ZYPP_THROW( Exception( "Can't open solv-file: "+file_r.asString() ) ); - } - - if ( myPool()._addSolv( _repo, file ) != 0 ) - { - ZYPP_THROW( Exception( "Error reading solv-file: "+file_r.asString() ) ); - } - - MIL << *this << " after adding " << file_r << endl; - } - - void Repository::addHelix( const Pathname & file_r ) - { - NO_REPOSITORY_THROW( Exception( "Can't add solvables to norepo." ) ); - - std::string command( file_r.extension() == ".gz" ? "zcat " : "cat " ); - command += file_r.asString(); - - AutoDispose file( ::popen( command.c_str(), "re" ), ::pclose ); - if ( file == NULL ) - { - file.resetDispose(); - ZYPP_THROW( Exception( "Can't open helix-file: "+file_r.asString() ) ); - } - - if ( myPool()._addHelix( _repo, file ) != 0 ) - { - ZYPP_THROW( Exception( "Error reading helix-file: "+file_r.asString() ) ); - } - - MIL << *this << " after adding " << file_r << endl; - } - - sat::detail::SolvableIdType Repository::addSolvables( unsigned count_r ) - { - NO_REPOSITORY_THROW( Exception( "Can't add solvables to norepo.") ); - return myPool()._addSolvables( _repo, count_r ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const Repository & obj ) - { - if ( ! obj ) - return str << "noRepository"; - - return str << "sat::repo(" << obj.alias() << ")" - << "{" - << "prio " << obj.get()->priority << '.' << obj.get()->subpriority - << ", size " << obj.solvablesSize() - << "}"; - } - - std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj ) - { - return xmlout::node( str, "repository", { - { "name", obj.name() }, - { "alias", obj.alias() } - } ); - } - - ////////////////////////////////////////////////////////////////// - namespace detail - { - void RepositoryIterator::increment() - { - if ( base() ) - { - ::_Pool * satpool = sat::Pool::instance().get(); - do { - ++base_reference(); - } while ( base() < satpool->repos+satpool->nrepos && !*base() ); - } - } - } // namespace detail - ////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // Repository::ProductInfoIterator - // - /////////////////////////////////////////////////////////////////// - - Repository::ProductInfoIterator::ProductInfoIterator( sat::SolvAttr attr_r, Repository repo_r ) - { base_reference() = sat::LookupRepoAttr( attr_r, repo_r ).begin(); } - - std::string Repository::ProductInfoIterator::label() const - { return base_reference().subFind( sat::SolvAttr::repositoryProductLabel ).asString(); } - - CpeId Repository::ProductInfoIterator::cpeId() const - { return CpeId( base_reference().subFind( sat::SolvAttr::repositoryProductCpeid ).asString(), CpeId::noThrow ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Repository.h b/libzypp/zypp/Repository.h deleted file mode 100644 index 6ed1725..0000000 --- a/libzypp/zypp/Repository.h +++ /dev/null @@ -1,481 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Repository.h - * -*/ -#ifndef ZYPP_SAT_REPOSITORY_H -#define ZYPP_SAT_REPOSITORY_H - -#include -#include "zypp/Pathname.h" -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/LookupAttr.h" // LookupAttrTools.h included at EOF -#include "zypp/sat/Solvable.h" -#include "zypp/RepoInfo.h" -#include "zypp/Date.h" -#include "zypp/CpeId.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace detail - { - struct ByRepository; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Repository - // - /** */ - class Repository : protected sat::detail::PoolMember - { - public: - typedef filter_iterator SolvableIterator; - typedef sat::detail::size_type size_type; - typedef sat::detail::RepoIdType IdType; - - typedef sat::ArrayAttr Keywords; - - typedef std::string ContentRevision; - typedef std::string ContentIdentifier; - - public: - /** Default ctor creates \ref noRepository.*/ - Repository() - : _id( sat::detail::noRepoId ) {} - - /** \ref PoolImpl ctor. */ - explicit Repository( IdType id_r ) - : _id( id_r ) {} - - public: - /** Represents no \ref Repository. */ - static const Repository noRepository; - - /** Evaluate \ref Repository in a boolean context (\c != \c noRepository). */ - explicit operator bool() const - { return get() != nullptr; } - - /** Reserved system repository alias \c @System. */ - static const std::string & systemRepoAlias(); - - /** Return whether this is the system repository. */ - bool isSystemRepo() const; - - public: - /** - * Short unique string to identify a repo. - * ie: openSUSE-10.3 - * - * If you are looking for a label to display - * see \ref name(). - * ie: "openSUSE 10.3 Main repository" - * - */ - std::string alias() const; - - /** Label to display for this repo. */ - std::string name() const; - - /** Alias or name, according to \ref ZConfig::repoLabelIsAlias */ - std::string label() const; - - /** User string: \ref label (alias or name) */ - std::string asUserString() const - { return label(); } - - public: - /** Timestamp or arbitrary user supplied string. - * \c /repomd/revision/text() in \c repomd.xml. - */ - ContentRevision contentRevision() const; - - /** Unique string identifying a repositories content. - * \c /repomd/tags/repo/text() in \c repomd.xml. - * \code - * - * - * obsrepository://build.suse.de/SUSE:Factory:Head:Internal/standard - * \endcode - * Semantically the value is just a plain string, even - * if OBS often uses the location of the project as - * unique identifyer. - */ - ContentIdentifier contentIdentifier() const; - - /** Whether \a id_r matches this repos content identifier. */ - bool hasContentIdentifier( const ContentIdentifier & id_r ) const; - - /** - * Timestamp when this repository was generated - * - * Usually this value is calculated as the newer - * timestamp from the timestamp of all the resources - * that conform the repository's metadata. - * - * For example in a rpm-md repository, it would be - * the resource specified in the xml file whith - * the newest timestamp attribute (which is the - * timestamp of the file in the server ). - * - * The timestamp is 0 if the repository does not - * specify when it was generated. - * - */ - Date generatedTimestamp() const; - - /** - * Suggested expiration timestamp. - * - * Repositories can define an amount of time - * they expire, with the generated timestamp as - * the base point of time. - * - * Note that is the responsability of the repository - * to freshen the generated timestamp to tell the - * client that the repo is alive and updating the - * metadata. - * - * The timestamp is 0 if the repository does not specify - * an expiration date. - * - */ - Date suggestedExpirationTimestamp() const; - - /** - * repository keywords (tags) - */ - Keywords keywords() const; - - /** Whether \a val_r is present in keywords. */ - bool hasKeyword( const std::string & val_r ) const; - - /** - * The suggested expiration date of this repository - * already passed - * - * rpm-md repositories can provide this tag using the - * expire extension tag: - * \see http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml - */ - bool maybeOutdated() const; - - /** Hint whether the Repo may provide updates for a product. - * - * Either the repository claims to update a product via a repository updates - * tag in it's metadata or a known product lists the repositories ContentIdentifier - * as required update repo. - */ - bool isUpdateRepo() const; - - /** Hint whether the Repo may provide updates for a product identified by it's \ref CpeId - * - * Either the repository claims to update a product via a repository updates - * tag in it's metadata or a known product lists the repositories ContentIdentifier - * as required update repo. - */ - bool providesUpdatesFor( const CpeId & cpeid_r ) const; - - /** Whether \ref Repository contains solvables. */ - bool solvablesEmpty() const; - - /** Number of solvables in \ref Repository. */ - size_type solvablesSize() const; - - /** Iterator to the first \ref Solvable. */ - SolvableIterator solvablesBegin() const; - - /** Iterator behind the last \ref Solvable. */ - SolvableIterator solvablesEnd() const; - - public: - - /** Query class for Repository related products */ - class ProductInfoIterator; - - /** - * Get an iterator to the beginning of the repository - * compatible distros. - * \note This is only a hint. There is no guarantee that - * the repository is built for that product. - * \see Repository::ProductInfoIterator - */ - ProductInfoIterator compatibleWithProductBegin() const; - - /** - * Get an iterator to the end of the repository - * compatible distros. - * \see Repository::ProductInfoIterator - */ - ProductInfoIterator compatibleWithProductEnd() const; - - /** - * Get an iterator to the beginning of distos the repository - * provides upadates for. - * \note This is only a hint within the repositories metadata. - * The same realation might be expressed by a product listing - * this repositories ContentIdentifier as required update repo. - * \see Repository::ProductInfoIterator - */ - ProductInfoIterator updatesProductBegin() const; - - /** - * Get an iterator to the end of distos the repository - * provides upadates for. - * \see Repository::ProductInfoIterator - */ - ProductInfoIterator updatesProductEnd() const; - - public: - /** Return any associated \ref RepoInfo. */ - RepoInfo info() const; - - /** Set \ref RepoInfo for this repository. - * \throws Exception if this is \ref noRepository - * \throws Exception if the \ref RepoInfo::alias - * does not match the \ref Repository::name. - */ - void setInfo( const RepoInfo & info_r ); - - /** Remove any \ref RepoInfo set for this repository. */ - void clearInfo(); - - public: - /** Remove this \ref Repository from it's \ref Pool. */ - void eraseFromPool(); - - /** Functor calling \ref eraseFromPool. */ - struct EraseFromPool; - - public: - /** Return next Repository in \ref Pool (or \ref noRepository). */ - Repository nextInPool() const; - - public: - /** \name Repository content manipulating methods. - * \todo maybe a separate Repository/Solvable content manip interface - * provided by the pool. - */ - //@{ - /** Load \ref Solvables from a solv-file. - * In case of an exception the repository remains in the \ref Pool. - * \throws Exception if this is \ref noRepository - * \throws Exception if loading the solv-file fails. - * \see \ref Pool::addRepoSolv and \ref Repository::EraseFromPool - */ - void addSolv( const Pathname & file_r ); - - /** Load \ref Solvables from a helix-file. - * Supports loading of gzip compressed files (.gz). In case of an exception - * the repository remains in the \ref Pool. - * \throws Exception if this is \ref noRepository - * \throws Exception if loading the helix-file fails. - * \see \ref Pool::addRepoHelix and \ref Repository::EraseFromPool - */ - void addHelix( const Pathname & file_r ); - - /** Add \c count_r new empty \ref Solvable to this \ref Repository. */ - sat::Solvable::IdType addSolvables( unsigned count_r ); - /** \overload Add only one new \ref Solvable. */ - sat::Solvable::IdType addSolvable() - { return addSolvables( 1 ); } - //@} - - public: - /** Expert backdoor. */ - ::_Repo * get() const; - /** Expert backdoor. */ - IdType id() const { return _id; } - /** libsolv internal priorities. - * Unlike the \ref RepoInfo priority which tries to be YUM conform - * (H[1-99]L), this one is the solvers internal priority representation. - * It is type \c int and as one might expect it, the higher the value - * the higher the priority. Subpriority is currently used to express - * media preferences (\see \ref MediaPriority). - */ - //@{ - int satInternalPriority() const; - int satInternalSubPriority() const; - //@} - - private: - IdType _id; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Repository Stream output */ - std::ostream & operator<<( std::ostream & str, const Repository & obj ); - - /** \relates Repository XML output */ - std::ostream & dumpAsXmlOn( std::ostream & str, const Repository & obj ); - - /** \relates Repository */ - inline bool operator==( const Repository & lhs, const Repository & rhs ) - { return lhs.get() == rhs.get(); } - - /** \relates Repository */ - inline bool operator!=( const Repository & lhs, const Repository & rhs ) - { return lhs.get() != rhs.get(); } - - /** \relates Repository */ - inline bool operator<( const Repository & lhs, const Repository & rhs ) - { return lhs.get() < rhs.get(); } - - /////////////////////////////////////////////////////////////////// - /** - * Query class for Repository related products - * - * Products are identified by CpeIds within the repositories metadata. - * \see http://en.opensuse.org/Standards/Rpm_Metadata#SUSE_repository_info_.28suseinfo.xml.29.2C_extensions_to_repomd.xml - * - * The iterator does not provide a dereference - * operator so you can do * on it, but you can - * access the attributes of each related product - * directly from the iterator. - * - * \code - * for_( it, repo.compatibleWithProductBegin(), repo.compatibleWithProductEnd() ) - * { - * cout << it.label() << ": " << it.cpeid() << endl; - * } - * \endcode - * - */ - class Repository::ProductInfoIterator : public boost::iterator_adaptor< - Repository::ProductInfoIterator // Derived - , sat::LookupAttr::iterator // Base - , int // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , int // Reference - > - { - public: - ProductInfoIterator() - {} - - /** Product label */ - std::string label() const; - - /** The Common Platform Enumeration name for this product. */ - CpeId cpeId() const; - - private: - friend class Repository; - /** Hide ctor as just a limited set of attributes is valid. */ - explicit ProductInfoIterator( sat::SolvAttr attr_r, Repository repo_r ); - - private: - friend class boost::iterator_core_access; - int dereference() const { return 0; } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Repository::EraseFromPool - // - /** Functor removing \ref Repository from it's \ref Pool. - * - * E.g. used as dispose function in. \ref AutoDispose - * to provide a convenient and exception safe temporary - * \ref Repository. - * \code - * sat::Pool satpool; - * MIL << "1 " << satpool << endl; - * { - * AutoDispose tmprepo( (Repository::EraseFromPool()) ); - * *tmprepo = satpool.reposInsert( "A" ); - * tmprepo->addSolv( "sl10.1-beta7-packages.solv" ); - * DBG << "2 " << satpool << endl; - * // Calling 'tmprepo.resetDispose();' here - * // would keep the Repo. - * } - * MIL << "3 " << satpool << endl; - * \endcode - * \code - * 1 sat::pool(){0repos|2slov} - * 2 sat::pool(){1repos|2612slov} - * 3 sat::pool(){0repos|2slov} - * \endcode - * Leaving the block without calling tmprepo.resetDispose(); - * before, will automatically remove the \ref Repo from it's \ref Pool. - */ - struct Repository::EraseFromPool - { - void operator()( Repository repository_r ) const - { repository_r.eraseFromPool(); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepositoryIterator - // - /** */ - class RepositoryIterator : public boost::iterator_adaptor< - RepositoryIterator // Derived - , ::_Repo ** // Base - , Repository // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , Repository // Reference - > - { - public: - RepositoryIterator() - : RepositoryIterator::iterator_adaptor_( 0 ) - {} - - explicit RepositoryIterator( ::_Repo ** p ) - : RepositoryIterator::iterator_adaptor_( p ) - {} - - private: - friend class boost::iterator_core_access; - - Repository dereference() const - { return Repository( *base() ); } - - void increment(); - }; - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ByRepository - // - /** Functor filtering \ref Solvable by \ref Repository.*/ - struct ByRepository - { - public: - ByRepository( const Repository & repository_r ) : _repository( repository_r ) {} - ByRepository( sat::detail::RepoIdType id_r ) : _repository( id_r ) {} - ByRepository() {} - - bool operator()( const sat::Solvable & slv_r ) const - { return slv_r.repository() == _repository; } - - private: - Repository _repository; - }; - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -// Late include as sat::ArrayAttr requires Repository.h -#include "zypp/sat/LookupAttrTools.h" - -#endif // ZYPP_SAT_REPOSITORY_H diff --git a/libzypp/zypp/ResFilters.h b/libzypp/zypp/ResFilters.h deleted file mode 100644 index c7a6db2..0000000 --- a/libzypp/zypp/ResFilters.h +++ /dev/null @@ -1,357 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResFilters.h - * -*/ -#ifndef ZYPP_RESFILTERS_H -#define ZYPP_RESFILTERS_H - -#include - -#include "zypp/base/Functional.h" -#include "zypp/Filter.h" -#include "zypp/Resolvable.h" - -#include "zypp/PoolItem.h" -#include "zypp/Repository.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace resfilter - { ///////////////////////////////////////////////////////////////// - - /** \defgroup RESFILTERS Filter functors operating on ResObjects. - * \ingroup g_Functor - * - * A simple filter is a function or functor matching the signature: - * \code - * bool simplefilter( ResObject::Ptr ); - * \endcode - * - * \note It's not neccessary that your function or functor actually - * returns \c bool. Anything which is convertible into a \c bool - * will do; - * - * Besides basic filter functors which actually evaluate the - * \c ResObject (e.g. \ref ByKind, \ref ByName) you may - * use \ref LOGICALFILTERS to build more complex filters. - * - * \code - * // some 'action' functor, printing and counting - * // ResObjects. - * struct PrintAndCount - * { - * PrintAndCount( unsigned & counter_r ) - * : _counter( counter_r ) - * {} - * - * bool operator()( ResObject::Ptr p ) const - * { - * DBG << *p << endl; - * ++_counter; - * return true; - * } - * - * unsigned _counter; - * }; - * - * ResStore store; - * unsigned counter = 0; - * - * // print and count all resolvables - * store.forEach( PrintAndCount(counter) ); - * - * // print and count all resolvables named "kernel" - * counter = 0; - * store.forEach( ByName("kernel"), PrintAndCount(counter) ); - * - * // print and count all Packages named "kernel" - * counter = 0; - * store.forEach( chain( ByKind(ResKind::package), - * ByName("kernel") ), - * PrintAndCount(counter) ); - * - * // print and count all Packages not named "kernel" - * counter = 0; - * store.forEach( chain( ByKind(ResKind::package), - * not_c(ByName("kernel")) ), - * PrintAndCount(counter) ); - * - * // same as above ;) - * counter = 0; - * store.forEach( chain( ByKind(ResKind::package), - * chain( not_c(ByName("kernel")), - * PrintAndCount(counter) ) ), - * true_c() ); - * \endcode - * - * As you can see in the last example there is no difference in using - * a filter or an action functor, as both have the same signature. - * A difference of course is the way forEach interprets the returned - * value. - * - * Consequently you can netgate and chain actions as well. Thus - * PrintAndCount(counter) could be - * chain(Print(),Count(counter)), if these functors are - * provided. - * - * \note These functors are not limited to be used with ResStore::forEach. - * You can use them with std::algorithms as well. - * - * \note In case you already have functions or methods which do what you - * want, but thet don't perfectly match the required signature: Make yourself - * familiar with std::ptr_fun, mem_fun, bind1st, bind2nd and compose. - * They are sometimes quite helpfull. - * - * \c PrintAndCount is an example how a functor can return data collected - * during the query. You ca easily write a collector, that takes a - * std:list\\& and fills it with the matches - * found. - * - * But as a rule of thumb, a functor should be lightweight. If you - * want to get data out, pass references to variables in (and assert - * these variables live as long as the query lasts). Or use \ref FunctorRef. - * - * Internally all functors are passed by value. Thus it would not help - * you to create an instance of some collecting functor, and pass it - * to the query. The query will then fill a copy of your functor, you - * won't get the data back. (Well, you probabely could, by using - * boosr::ref). - * - * Why functors and not plain functions? - * - * You can use plain functions if they don't have to deliver data back to - * the application. - * The \c C-style approach is having functions that take a void * data - * as last argument. This \c data pointer is then passed arround and casted - * up and down. - * - * If you look at a functor, you'll see that it contains both, the function - * to call (it's operator() ) and the data you'd otherwise pass as - * void * data. That's nice and safe. - * - * \todo migrate to namespace filter and enhance to support Solvables as well. - */ - //@{ - /////////////////////////////////////////////////////////////////// - // - // Some ResObject attributes - // - /////////////////////////////////////////////////////////////////// - - /** */ - typedef std::unary_function ResObjectFilterFunctor; - typedef boost::function ResFilter; - - /** */ - template - inline filter::ByKind byKind() - { return filter::ByKind( ResTraits<_Res>::kind ); } - - /** Select ResObject by name. */ - struct ByName : public ResObjectFilterFunctor - { - ByName( const std::string & name_r ) - : _name( name_r ) - {} - - bool operator()( ResObject::constPtr p ) const - { - return p->name() == _name; - } - - std::string _name; - }; - - /** Select ResObject by repository or repository alias. */ - struct ByRepository : public ResObjectFilterFunctor - { - ByRepository( Repository repository_r ) - : _alias( repository_r.info().alias() ) - {} - - ByRepository( const std::string & alias_r ) - : _alias( alias_r ) - {} - - bool operator()( ResObject::constPtr p ) const - { - return p->repoInfo().alias() == _alias; - } - - std::string _alias; - }; - - /** Select ResObject by Edition using \a _Compare functor. - * - * Selects ResObject if _Compare( ResObject->edition(), _edition ) - * is \c true. - * \code - * // use the convenience funktions to create ByEdition: - * - * byEdition( someedition ); // selects ResObjects with edition == someedition - * - * byEdition( someedition, CompareByGT() ) // edition > someedition - * \endcode - */ - template > - struct ByEdition : public ResObjectFilterFunctor - { - ByEdition( const Edition & edition_r, - _Compare cmp_r ) - : _edition( edition_r ) - , _cmp( cmp_r ) - {} - - bool operator()( ResObject::constPtr p ) const - { - return _cmp( p->edition(), _edition ); - } - - Edition _edition; - _Compare _cmp; - }; - - /** */ - template - ByEdition<_Compare> byEdition( const Edition & edition_r, _Compare cmp_r ) - { return ByEdition<_Compare>( edition_r, cmp_r ); } - - /** */ - template - ByEdition<_Compare> byEdition( const Edition & edition_r ) - { return byEdition( edition_r, _Compare() ); } - - - /** Select ResObject by Arch using \a _Compare functor. - * - * Selects ResObject if _Compare( ResObject->arch(), _arch ) - * is \c true. - * \code - * // use the convenience funktions to create ByArch: - * - * byArch( somearch ); // selects ResObjects with arch == somearch - * - * byArch( somearch, CompareByGT() ) // arch > somearch - * \endcode - */ - template > - struct ByArch : public ResObjectFilterFunctor - { - ByArch( const Arch & arch_r, - _Compare cmp_r ) - : _arch( arch_r ) - , _cmp( cmp_r ) - {} - - bool operator()( ResObject::constPtr p ) const - { - return _cmp( p->arch(), _arch ); - } - - Arch _arch; - _Compare _cmp; - }; - - /** */ - template - ByArch<_Compare> byArch( const Arch & arch_r, _Compare cmp_r ) - { return ByArch<_Compare>( arch_r, cmp_r ); } - - /** */ - template - ByArch<_Compare> byArch( const Arch & arch_r ) - { return byArch( arch_r, _Compare() ); } - - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // Some PoolItem attributes - // - /////////////////////////////////////////////////////////////////// - - /** */ - typedef std::unary_function PoolItemFilterFunctor; - - /** Select PoolItem by installed. */ - struct ByInstalled : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isInstalled(); - } - - }; - - /** Select PoolItem by uninstalled. */ - struct ByUninstalled : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isUninstalled(); - } - }; - - /** Select PoolItem by transact. */ - struct ByTransact : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().transacts(); - } - }; - - /** Select PoolItem by lock. */ - struct ByLock : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isLocked(); - } - }; - - /** Select PoolItem by keep. */ - struct ByKeep : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isKept(); - } - }; - - /** PoolItem which is recommended. */ - struct ByRecommended : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isRecommended(); - } - }; - - /** PoolItem which is suggested. */ - struct BySuggested : public PoolItemFilterFunctor - { - bool operator()( const PoolItem & p ) const - { - return p.status().isSuggested(); - } - }; - - //@} - ///////////////////////////////////////////////////////////////// - } // namespace resfilter - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESFILTERS_H diff --git a/libzypp/zypp/ResKind.cc b/libzypp/zypp/ResKind.cc deleted file mode 100644 index ad0fb7e..0000000 --- a/libzypp/zypp/ResKind.cc +++ /dev/null @@ -1,77 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResKind.cc - * -*/ -#include - -#include "zypp/base/String.h" - -#include "zypp/ResKind.h" -#include "zypp/ResTraits.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - const ResKind ResKind::nokind; - const ResKind ResKind::package ( "package" ); - const ResKind ResKind::patch ( "patch" ); - const ResKind ResKind::pattern ( "pattern" ); - const ResKind ResKind::product ( "product" ); - const ResKind ResKind::srcpackage ( "srcpackage" ); - const ResKind ResKind::application ( "application" ); - - template<> - const ResKind ResTraits ::kind( ResKind::package ); - template<> - const ResKind ResTraits ::kind( ResKind::patch ); - template<> - const ResKind ResTraits ::kind( ResKind::pattern ); - template<> - const ResKind ResTraits ::kind( ResKind::product ); - template<> - const ResKind ResTraits ::kind( ResKind::srcpackage ); - template<> - const ResKind ResTraits::kind( ResKind::application ); - - ResKind ResKind::explicitBuiltin( const char * str_r ) - { - if ( str_r && str_r[0] && str_r[1] && str_r[2] ) - { - switch ( str_r[3] ) - { - // NOTE: it needs to be assertd that the separating ':' is present - // if a known kind is retuirned. Dependent code relies on this! - #define OUTS(K,S) if ( !::strncmp( str_r, ResKind::K.c_str(), S ) && str_r[S] == ':' ) return ResKind::K - // ----v - case 'c': OUTS( patch, 5 ); break; - case 'd': OUTS( product, 7 ); break; - case 'k': OUTS( package, 7 ); break; - case 'l': OUTS( application, 11 );break; - case 'p': OUTS( srcpackage, 10 ); break; - case 't': OUTS( pattern, 7 ); break; - #undef OUTS - } - } - return nokind; - } - - std::string ResKind::satIdent( const ResKind & refers_r, const std::string & name_r ) - { - if ( ! refers_r || refers_r == package || refers_r == srcpackage ) - return name_r; - return str::form( "%s:%s", refers_r.c_str(), name_r.c_str() ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResKind.h b/libzypp/zypp/ResKind.h deleted file mode 100644 index c47498a..0000000 --- a/libzypp/zypp/ResKind.h +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResKind.h - * -*/ -#ifndef ZYPP_RESKIND_H -#define ZYPP_RESKIND_H - -#include -#include - -#include "zypp/APIConfig.h" -#include "zypp/base/String.h" -#include "zypp/IdStringType.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class ResKind - /// \brief Resolvable kinds. - /// A \b lowercased string and used as identification. Comparison - /// against string values is always case insensitive. - /////////////////////////////////////////////////////////////////// - class ResKind : public IdStringType - { - public: - /** \name Some builtin ResKind constants. */ - //@{ - /** Value representing \c nokind ("")*/ - static const ResKind nokind; - - static const ResKind package; - static const ResKind patch; - static const ResKind pattern; - static const ResKind product; - static const ResKind srcpackage; - static const ResKind application; - //@} - - /** Return the builtin kind if \a str_r explicitly prefixed. - * \a str_r must start with a builtin kind followed by a \c ':'. - * If no builtin kind is detected, \ref nokind is returned, - * which usually indicates a \ref package or \ref srcpackage. - */ - static ResKind explicitBuiltin( const char * str_r ); - /** \overload */ - static ResKind explicitBuiltin( const std::string & str_r ) - { return explicitBuiltin( str_r.c_str() ); } - /** \overload */ - static ResKind explicitBuiltin( const IdString & str_r ) - { return explicitBuiltin( str_r.c_str() ); } - - public: - /** Default ctor: \ref nokind */ - ResKind() {} - - /** Ctor taking kind as string. */ - explicit ResKind( sat::detail::IdType id_r ) : _str( str::toLower(IdString(id_r).c_str()) ) {} - explicit ResKind( const IdString & idstr_r ) : _str( str::toLower(idstr_r.c_str()) ) {} - explicit ResKind( const std::string & str_r ) : _str( str::toLower(str_r) ) {} - explicit ResKind( const char * cstr_r ) : _str( str::toLower(cstr_r) ) {} - - public: - /** Return libsolv identifier for name. - * Libsolv combines the objects kind and name in a single - * identifier \c "pattern:kde_multimedia", \b except for packages - * and source packes. They are not prefixed by any kind string. - */ - static std::string satIdent( const ResKind & refers_r, const std::string & name_r ); - /** \overload */ - std::string satIdent( const std::string & name_r ) const - { return satIdent( *this, name_r ); } - - private: - static int _doCompare( const char * lhs, const char * rhs ) - { - if ( lhs == rhs ) return 0; - if ( lhs && rhs ) return ::strcasecmp( lhs, rhs ); - return( lhs ? 1 : -1 ); - } - - private: - friend class IdStringType; - IdString _str; - }; - - /** \relates ResKind XML output. */ - inline std::ostream & dumpAsXmlOn( std::ostream & str, const ResKind & obj ) - { return str << "" << obj << ""; } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESKIND_H diff --git a/libzypp/zypp/ResObject.cc b/libzypp/zypp/ResObject.cc deleted file mode 100644 index 5407b3a..0000000 --- a/libzypp/zypp/ResObject.cc +++ /dev/null @@ -1,142 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResObject.cc - * -*/ - -#include "zypp/ResObject.h" -#include "zypp/sat/SolvAttr.h" -#include "zypp/sat/Solvable.h" -#include "zypp/Repository.h" -#include "zypp/RepoInfo.h" -#include "zypp/IdString.h" - -#include "zypp/ui/Selectable.h" - -using namespace zypp; -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(ResObject); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResObject::ResObject - // METHOD TYPE : Ctor - // - ResObject::ResObject( const sat::Solvable & solvable_r ) - : Resolvable( solvable_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResObject::~ResObject - // METHOD TYPE : Dtor - // - ResObject::~ResObject() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResObject::dumpOn - // METHOD TYPE : std::ostream & - // - std::ostream & ResObject::dumpOn( std::ostream & str ) const - { - return Resolvable::dumpOn( str ); - } - - /////////////////////////////////////////////////////////////////// - - std::string ResObject::summary( const Locale & lang_r ) const - { return lookupStrAttribute( sat::SolvAttr::summary, lang_r ); } - - std::string ResObject::description( const Locale & lang_r ) const - { return lookupStrAttribute( sat::SolvAttr::description, lang_r ); } - - std::string ResObject::insnotify( const Locale & lang_r ) const - { return lookupStrAttribute( sat::SolvAttr::insnotify, lang_r ); } - - std::string ResObject::delnotify( const Locale & lang_r ) const - { return lookupStrAttribute( sat::SolvAttr::delnotify, lang_r ); } - - std::string ResObject::licenseToConfirm( const Locale & lang_r ) const - { - std::string ret = lookupStrAttribute( sat::SolvAttr::eula, lang_r ); - if ( ret.empty() && isKind() ) - { - const RepoInfo & ri( repoInfo() ); - if ( ri.needToAcceptLicense() || ! ui::Selectable::get( *this )->hasInstalledObj() ) - ret = ri.getLicense( lang_r ); // bnc#908976: suppress informal license upon update - } - return ret; - } - - bool ResObject::needToAcceptLicense() const - { - if ( isKind() ) - return repoInfo().needToAcceptLicense( ); - return true; - } - - std::string ResObject::distribution() const - { return lookupStrAttribute( sat::SolvAttr::distribution ); } - - CpeId ResObject::cpeId() const - { return CpeId( lookupStrAttribute( sat::SolvAttr::cpeid ), CpeId::noThrow ); } - - ByteCount ResObject::installSize() const - { return ByteCount( lookupNumAttribute( sat::SolvAttr::installsize ) ); } - - ByteCount ResObject::downloadSize() const - { return ByteCount( lookupNumAttribute( sat::SolvAttr::downloadsize ) ); } - - unsigned ResObject::mediaNr() const - { return lookupNumAttribute( sat::SolvAttr::medianr ); } - - Date ResObject::buildtime() const - { return Date( lookupNumAttribute( sat::SolvAttr::buildtime ) ); } - - Date ResObject::installtime() const - { return Date( lookupNumAttribute( sat::SolvAttr::installtime ) ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#include "zypp/ResObjects.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - ResObject::Ptr makeResObject( const sat::Solvable & solvable_r ) - { - if ( ! solvable_r ) - return 0; - - ResKind kind( solvable_r.kind() ); -#define OUTS(X) if ( kind == ResTraits::kind ) return make( solvable_r ); - OUTS( Package ); - OUTS( Patch ); - OUTS( Pattern ); - OUTS( Product ); - OUTS( SrcPackage ); - OUTS( Application ); -#undef OUTS - // unknow => return a plain ResObject - return new ResObject( solvable_r ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResObject.h b/libzypp/zypp/ResObject.h deleted file mode 100644 index 9bdb6bc..0000000 --- a/libzypp/zypp/ResObject.h +++ /dev/null @@ -1,292 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResObject.h - * -*/ -#ifndef ZYPP_RESOBJECT_H -#define ZYPP_RESOBJECT_H - -#include "zypp/APIConfig.h" - -#include "zypp/Resolvable.h" -#include "zypp/Date.h" -#include "zypp/Locale.h" -#include "zypp/Vendor.h" -#include "zypp/ByteCount.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/Repository.h" -#include "zypp/CpeId.h" - -#include "zypp/sat/LookupAttr.h" -#include "zypp/sat/SolvableSet.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResObject - // - /** - * Interface base for resolvable objects (common data). - * That is, all data not needed for solving, but common - * across all Resolvable kinds. - * - * \see \ref makeResObject for how to construct ResObjects. - */ - class ResObject : public Resolvable - { - public: - typedef ResObject Self; - typedef ResTraits TraitsType; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - - /** Convert \c this into a Ptr of a certain Kind. - * This is a convenience to access type specific - * attributes. - * \return \c NULL if \c this is not of the specified kind. - * \code - * PoolItem pi; - * Package::constPtr pkg = pi->asKind(); - * - * if ( pi->isKind() ) - * DBG << pi->asKind()->keywords() << endl; - * \endcode - */ - template - inline typename ResTraits<_Res>::constPtrType asKind() const; - - template - inline typename ResTraits<_Res>::PtrType asKind(); - - public: - /** \name Locale support. - * \see \ref sat::Solvable - */ - //@{ - /** \see \ref sat::Solvable::supportsLocales */ - bool supportsLocales() const - { return sat::Solvable::supportsLocales(); } - - /** \see \ref sat::Solvable::supportsLocale */ - bool supportsLocale( const Locale & locale_r ) const - { return sat::Solvable::supportsLocale( locale_r ); } - - bool supportsLocale( const LocaleSet & locales_r ) const - { return sat::Solvable::supportsLocale( locales_r ); } - - /** \see \ref sat::Solvable::supportsRequestedLocales */ - bool supportsRequestedLocales() const - { return sat::Solvable::supportsRequestedLocales(); } - - /** \see \ref sat::Solvable::getSupportedLocales */ - LocaleSet getSupportedLocales() const - { return sat::Solvable::getSupportedLocales(); } - //@} - - public: - /** - * \short Short text describing the resolvable. - * This attribute is usually displayed in columns. - */ - std::string summary( const Locale & lang_r = Locale() ) const; - - /** - * \short Long text describing the resolvable. - */ - std::string description( const Locale & lang_r = Locale() ) const; - - /** - * \short Installation Notification - * - * This text can be used to tell the user some notes - * When he selects the resovable for installation. - */ - std::string insnotify( const Locale & lang_r = Locale() ) const; - - /** - * \short De-Installation Notification - * - * This text can be used to tell the user some notes - * When he selects the resovable for deinstall. - */ - std::string delnotify( const Locale & lang_r = Locale() ) const; - - /** - * \short License or agreement to accept - * - * Agreement, warning or license the user should - * accept before installing the resolvable. - */ - std::string licenseToConfirm( const Locale & lang_r = Locale() ) const; - - /** - * \short Acceptance of Product License needed? - * - * Returns whether a product license has to be accepted - * (no acceptance is needed for openSUSE) - */ - bool needToAcceptLicense() const; - - /** - * \short Vendor - * - * For example "Novell Inc." - */ - Vendor vendor() const - { return Resolvable::vendor().asString(); } - - /** The distribution string. - * E.g. \c code-11. - */ - std::string distribution() const; - - /** The Common Platform Enumeration name for this product. */ - CpeId cpeId() const; - - /** Installed (unpacked) size. - * This is just a total number. Many objects provide even more detailed - * disk usage data. You can use \ref DiskUsageCounter to find out - * how objects data are distributed across partitions/directories. - * \code - * // Load directory set into ducounter - * DiskUsageCounter ducounter( { "/", "/usr", "/var" } ); - * - * // see how noch space the packages use - * for ( const PoolItem & pi : pool ) - * { - * cout << pi << ducounter.disk_usage( pi ) << endl; - * // I__s_(7)GeoIP-1.4.8-3.1.2.x86_64(@System) { - * // dir:[/] [ bs: 0 B ts: 0 B us: 0 B (+-: 1.0 KiB)] - * // dir:[/usr] [ bs: 0 B ts: 0 B us: 0 B (+-: 133.0 KiB)] - * // dir:[/var] [ bs: 0 B ts: 0 B us: 0 B (+-: 1.1 MiB)] - * // } - * } - * \endcode - * \see \ref DiskUsageCounter - */ - ByteCount installSize() const; - - /** Download size. */ - ByteCount downloadSize() const; - - /** \see \ref sat::Solvable::repository */ - Repository repository() const - { return sat::Solvable::repository(); } - - /** \ref RepoInfo associated with the repository - * providing this resolvable. - */ - RepoInfo repoInfo() const - { return repository().info(); } - - /** - * Media number where the resolvable is located - * 0 if no media access is required. - */ - unsigned mediaNr() const; - - /** - * \short build time of the resolvable - */ - Date buildtime() const; - - /** - * \short Installation time - * 0 if the resolvable is not installed. - */ - Date installtime() const; - - protected: - friend ResObject::Ptr makeResObject( const sat::Solvable & solvable_r ); - /** Ctor */ - ResObject( const sat::Solvable & solvable_r ); - /** Dtor */ - virtual ~ResObject(); - /** Helper for stream output */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - }; - /////////////////////////////////////////////////////////////////// - - /** Create \ref ResObject from \ref sat::Solvable. - * - * This function creates the apropriate kind of ResObject - * depending on the sat::Solvables kind, and returns a smart - * pointer to it. - * - * If the sat::Solvables kind is not convertible, a NULL - * pointer is returned. - * - * \code - * sat::Solvable s; - * ResObject::Ptr p( makeResObject( s ) ); - * ResObject::Ptr q( make( s ) ); - * Package::Ptr pkg( make( s ) ); - * \endcode - */ - ResObject::Ptr makeResObject( const sat::Solvable & solvable_r ); - - /** Directly create a certain kind of ResObject from \ref sat::Solvable. - * - * If the sat::Solvables kind is not appropriate, a NULL - * pointer is returned. - * \code - * sat::Solvable s; - * ResObject::Ptr p( makeResObject( s ) ); - * ResObject::Ptr q( make( s ) ); - * Package::Ptr pkg( make( s ) ); - * \endcode - * \todo make<> was a poor choice (AFAIR because gcc had some trouble with - * asKind<>(sat::Solvable)). Remove it in favour of asKind<>(sat::Solvable) - */ - template - inline typename ResTraits<_Res>::PtrType make( const sat::Solvable & solvable_r ) - { return( isKind<_Res>( solvable_r ) ? new _Res( solvable_r ) : 0 ); } - /** \overload Specialisation for ResObject autodetecting the kind of resolvable. */ - template<> - inline ResObject::Ptr make( const sat::Solvable & solvable_r ) - { return makeResObject( solvable_r ); } - - /** Directly create a certain kind of ResObject from \ref sat::Solvable. */ - template - inline typename ResTraits<_Res>::PtrType asKind( const sat::Solvable & solvable_r ) - { return make<_Res>( solvable_r ); } - - /** Convert ResObject::Ptr into Ptr of a certain Kind. - * \return \c NULL iff \a p is \c NULL or points to a Resolvable - * not of the specified Kind. - * \relates ResObject - * \code - * asKind(resPtr); - * \endcode - */ - template - inline typename ResTraits<_Res>::PtrType asKind( const ResObject::Ptr & p ) - { return dynamic_pointer_cast<_Res>(p); } - - template - inline typename ResTraits<_Res>::constPtrType asKind( const ResObject::constPtr & p ) - { return dynamic_pointer_cast(p); } - - template - inline typename ResTraits<_Res>::constPtrType ResObject::asKind() const - { return dynamic_cast( this ); } - - template - inline typename ResTraits<_Res>::PtrType ResObject::asKind() - { return dynamic_cast<_Res *>( this ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESOBJECT_H diff --git a/libzypp/zypp/ResObjects.h b/libzypp/zypp/ResObjects.h deleted file mode 100644 index 1545085..0000000 --- a/libzypp/zypp/ResObjects.h +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResObjects.h - * -*/ -#ifndef ZYPP_RESOBJECTS_H -#define ZYPP_RESOBJECTS_H - -#include "zypp/Package.h" -#include "zypp/Patch.h" -#include "zypp/Pattern.h" -#include "zypp/Product.h" -#include "zypp/SrcPackage.h" -#include "zypp/Application.h" - -#endif // ZYPP_RESOBJECTS_H diff --git a/libzypp/zypp/ResPool.cc b/libzypp/zypp/ResPool.cc deleted file mode 100644 index fa708ee..0000000 --- a/libzypp/zypp/ResPool.cc +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResPool.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/base/SerialNumber.h" - -#include "zypp/ZYppFactory.h" -#include "zypp/ResPool.h" -#include "zypp/pool/PoolImpl.h" -#include "zypp/pool/PoolStats.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResPool::instance - // METHOD TYPE : ResPool - // - ResPool ResPool::instance() - { - static ResPool _val( pool::PoolTraits::Impl_Ptr( new pool::PoolImpl ) ); - return _val; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResPool::ResPool - // METHOD TYPE : Ctor - // - ResPool::ResPool( pool::PoolTraits::Impl_Ptr impl_r ) - : _pimpl( impl_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // Forward to impementation: - // - /////////////////////////////////////////////////////////////////// - - ResPoolProxy ResPool::proxy() const - { return _pimpl->proxy( *this ); } - - Resolver & ResPool::resolver() const - { return *getZYpp()->resolver(); } - - const SerialNumber & ResPool::serial() const - { return _pimpl->serial(); } - - bool ResPool::empty() const - { return _pimpl->empty(); } - - ResPool::size_type ResPool::size() const - { return _pimpl->size(); } - - - PoolItem ResPool::find( const sat::Solvable & slv_r ) const - { return _pimpl->find( slv_r ); } - - - ResPool::size_type ResPool::knownRepositoriesSize() const - { return _pimpl->knownRepositoriesSize(); } - - ResPool::repository_iterator ResPool::knownRepositoriesBegin() const - { return _pimpl->knownRepositoriesBegin(); } - - ResPool::repository_iterator ResPool::knownRepositoriesEnd() const - { return _pimpl->knownRepositoriesEnd(); } - - Repository ResPool::reposFind( const std::string & alias_r ) const - { return _pimpl->reposFind( alias_r ); } - - bool ResPool::hardLockQueriesEmpty() const - { return _pimpl->hardLockQueries().empty(); } - - ResPool::size_type ResPool::hardLockQueriesSize() const - { return _pimpl->hardLockQueries().size(); } - - ResPool::hardLockQueries_iterator ResPool::hardLockQueriesBegin() const - { return _pimpl->hardLockQueries().begin(); } - - ResPool::hardLockQueries_iterator ResPool::hardLockQueriesEnd() const - { return _pimpl->hardLockQueries().end(); } - - void ResPool::setHardLockQueries( const HardLockQueries & newLocks_r ) - { _pimpl->setHardLockQueries( newLocks_r ); } - - void ResPool::getHardLockQueries( HardLockQueries & activeLocks_r ) - { _pimpl->getHardLockQueries( activeLocks_r ); } - - - const pool::PoolTraits::ItemContainerT & ResPool::store() const - { return _pimpl->store(); } - - const pool::PoolTraits::Id2ItemT & ResPool::id2item() const - { return _pimpl->id2item(); } - - /////////////////////////////////////////////////////////////////// - // - // Forward to sat::Pool: - // - /////////////////////////////////////////////////////////////////// - void ResPool::setRequestedLocales( const LocaleSet & locales_r ) - { sat::Pool::instance().setRequestedLocales( locales_r ); } - - bool ResPool::addRequestedLocale( const Locale & locale_r ) - { return sat::Pool::instance().addRequestedLocale( locale_r ); } - - bool ResPool::eraseRequestedLocale( const Locale & locale_r ) - { return sat::Pool::instance().eraseRequestedLocale( locale_r ); } - - const LocaleSet & ResPool::getRequestedLocales() const - { return sat::Pool::instance().getRequestedLocales(); } - - bool ResPool::isRequestedLocale( const Locale & locale_r ) const - { return sat::Pool::instance().isRequestedLocale( locale_r ); } - - const LocaleSet & ResPool::getAvailableLocales() const - { return sat::Pool::instance().getAvailableLocales(); } - - bool ResPool::isAvailableLocale( const Locale & locale_r ) const - { return sat::Pool::instance().isAvailableLocale( locale_r ); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ResPool & obj ) - { - return dumpPoolStats( str << "ResPool " << sat::Pool::instance() << endl << " ", - obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResPool.h b/libzypp/zypp/ResPool.h deleted file mode 100644 index a8d37d9..0000000 --- a/libzypp/zypp/ResPool.h +++ /dev/null @@ -1,372 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResPool.h - * -*/ -#ifndef ZYPP_RESPOOL_H -#define ZYPP_RESPOOL_H - -#include - -#include "zypp/APIConfig.h" -#include "zypp/base/Iterator.h" - -#include "zypp/pool/PoolTraits.h" -#include "zypp/PoolItem.h" -#include "zypp/Filter.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class SerialNumber; - class ResPoolProxy; - class Resolver; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResPool - // - /** Global ResObject pool. - * - * Explicitly shared singleton. - * - * \note Filter iterators provided by ResPool are intended to - * operate on internal index tables for faster access. If the - * the index is not yet implemented, they are realized as - * an ordinary filter iterator. Do not provide filter iterators - * here, if there is no index table for it. - * - * \include n_ResPool_nomorenameiter - */ - class ResPool - { - friend std::ostream & operator<<( std::ostream & str, const ResPool & obj ); - - public: - /** \ref PoolItem */ - typedef PoolItem value_type; - typedef pool::PoolTraits::size_type size_type; - typedef pool::PoolTraits::const_iterator const_iterator; - typedef pool::PoolTraits::repository_iterator repository_iterator; - - public: - /** Singleton ctor. */ - static ResPool instance(); - - /** preliminary */ - ResPoolProxy proxy() const; - - /** The Resolver */ - Resolver & resolver() const; - - public: - /** The pools serial number. Changing whenever the - * whenever the content changes. (Resolvables or - * Dependencies). - */ - const SerialNumber & serial() const; - - public: - /** */ - bool empty() const; - /** */ - size_type size() const; - - /** \name Iterate over all PoolItems (all kinds). */ - //@{ - /** */ - const_iterator begin() const - { return make_filter_begin( pool::ByPoolItem(), store() ); } - /** */ - const_iterator end() const - { return make_filter_end( pool::ByPoolItem(), store() ); } - //@} - - public: - /** Return the corresponding \ref PoolItem. - * Pool and sat pool should be in sync. Returns an empty - * \ref PoolItem if there is no corresponding \ref PoolItem. - * \see \ref PoolItem::satSolvable. - */ - PoolItem find( const sat::Solvable & slv_r ) const; - /** \overload */ - PoolItem find( const ResObject::constPtr & resolvable_r ) const - { return( resolvable_r ? find( resolvable_r->satSolvable() ) : PoolItem() ); } - - public: - /** \name Iterate over all PoolItems matching a \c _Filter. */ - //@{ - template - filter_iterator<_Filter,const_iterator> filterBegin( const _Filter & filter_r ) const - { return make_filter_begin( filter_r, *this ); } - - template - filter_iterator<_Filter,const_iterator> filterEnd( const _Filter & filter_r ) const - { return make_filter_end( filter_r, *this ); } - //@} - - /** \name Iterate over all PoolItems by status. - * - * Simply pass the \ref ResStatus predicate you want to use as filter: - * \code - * // iterate over all orphaned items: - * for_( it, pool.byStatusBegin(&ResStatus::isOrphaned), pool.byStatusEnd(&ResStatus::isOrphaned) ) - * {...} - * \endcode - * - * Or use \ref filter::ByStatus in more complex queries: - * \code - * // iterate over all (orphaned and recommended) items: - * functor::Chain myfilter( filter::ByStatus(&ResStatus::isOrphaned), - * filter::ByStatus(&ResStatus::isRecommended) ); - * for_( it, pool.filterBegin(myfilter), pool.filterEnd(myfilter) ) - * { ... } - * \endcode - */ - //@{ - filter_iterator byStatusBegin( const filter::ByStatus & filter_r ) const - { return make_filter_begin( filter_r, *this ); } - - filter_iterator byStatusEnd( const filter::ByStatus & filter_r ) const - { return make_filter_end( filter_r, *this ); } - //@} - - public: - /** \name Iterate over all PoolItems of a certain name and kind. */ - //@{ - typedef pool::ByIdent ByIdent; - typedef pool::PoolTraits::byIdent_iterator byIdent_iterator; - - byIdent_iterator byIdentBegin( const ByIdent & ident_r ) const - { - return make_transform_iterator( id2item().equal_range( ident_r.get() ).first, - pool::PoolTraits::Id2ItemValueSelector() ); - } - - byIdent_iterator byIdentBegin( ResKind kind_r, IdString name_r ) const - { return byIdentBegin( ByIdent(kind_r,name_r) ); } - - byIdent_iterator byIdentBegin( ResKind kind_r, const C_Str & name_r ) const - { return byIdentBegin( ByIdent(kind_r,name_r) ); } - - template - byIdent_iterator byIdentBegin( IdString name_r ) const - { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); } - - template - byIdent_iterator byIdentBegin( const C_Str & name_r ) const - { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); } - - /** Derive name and kind from \ref PoolItem. */ - byIdent_iterator byIdentBegin( const PoolItem & pi_r ) const - { return byIdentBegin( ByIdent(pi_r.satSolvable()) ); } - /** Derive name and kind from \ref sat::Solvable. */ - byIdent_iterator byIdentBegin( sat::Solvable slv_r ) const - { return byIdentBegin( ByIdent(slv_r) ); } - /** Takes a \ref sat::Solvable::ident string. */ - byIdent_iterator byIdentBegin( IdString ident_r ) const - { return byIdentBegin( ByIdent(ident_r) ); } - - - byIdent_iterator byIdentEnd( const ByIdent & ident_r ) const - { - return make_transform_iterator( id2item().equal_range( ident_r.get() ).second, - pool::PoolTraits::Id2ItemValueSelector() ); - } - - byIdent_iterator byIdentEnd( ResKind kind_r, IdString name_r ) const - { return byIdentEnd( ByIdent(kind_r,name_r) ); } - - byIdent_iterator byIdentEnd( ResKind kind_r, const C_Str & name_r ) const - { return byIdentEnd( ByIdent(kind_r,name_r) ); } - - template - byIdent_iterator byIdentEnd( IdString name_r ) const - { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); } - - template - byIdent_iterator byIdentEnd( const C_Str & name_r ) const - { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); } - - /** Derive name and kind from \ref PoolItem. */ - byIdent_iterator byIdentEnd( const PoolItem & pi_r ) const - { return byIdentEnd( ByIdent(pi_r.satSolvable()) ); } - /** Derive name and kind from \ref sat::Solvable. */ - byIdent_iterator byIdentEnd( sat::Solvable slv_r ) const - { return byIdentEnd( ByIdent(slv_r) ); } - /** Takes a \ref sat::Solvable::ident string. */ - byIdent_iterator byIdentEnd( IdString ident_r ) const - { return byIdentEnd( ByIdent(ident_r) ); } - //@} - - public: - /** \name Iterate over all ResObjects of a certain kind. */ - //@{ - typedef filter::ByKind ByKind; - typedef filter_iterator byKind_iterator; - - byKind_iterator byKindBegin( const ResKind & kind_r ) const - { return make_filter_begin( ByKind(kind_r), *this ); } - - template - byKind_iterator byKindBegin() const - { return make_filter_begin( resfilter::byKind<_Res>(), *this ); } - - byKind_iterator byKindEnd( const ResKind & kind_r ) const - { return make_filter_end( ByKind(kind_r), *this ); } - - template - byKind_iterator byKindEnd() const - { return make_filter_end( resfilter::byKind<_Res>(), *this ); } - //@} - - public: - /** \name Iterate over all ResObjects with a certain name (all kinds). */ - //@{ - typedef zypp::resfilter::ByName ByName; - typedef filter_iterator byName_iterator; - - byName_iterator byNameBegin( const std::string & name_r ) const - { return make_filter_begin( ByName(name_r), *this ); } - - byName_iterator byNameEnd( const std::string & name_r ) const - { return make_filter_end( ByName(name_r), *this ); } - //@} - - public: - /** \name Special iterators. */ - //@{ - - //@} - public: - /** \name Iterate over all Repositories that contribute ResObjects. - */ - //@{ - size_type knownRepositoriesSize() const; - - repository_iterator knownRepositoriesBegin() const; - - repository_iterator knownRepositoriesEnd() const; - - /** Find a \ref Repository named \c alias_r. - * Returns \ref Repository::norepository if there is no such \ref Repository. - */ - Repository reposFind( const std::string & alias_r ) const; - //@} - - public: - /** \name Handle locale support. - * - * A \ref filter::ByLocaleSupport is provided to iterate over - * all items supporting a specific locale. - * - * \see \ref sat::LocaleSupport for a more convenient interface. - * - * \code - * ResPool pool( ResPool::instance() ); - * - * filter::ByLocaleSupport f( Locale("de") ); - * for_( it, pool.filterBegin(f), pool.filterEnd(f) ) - * { - * MIL << *it << endl; // supporting "de" - * } - * - * f = filter::ByLocaleSupport( pool.getRequestedLocales() ); - * for_( it, pool.filterBegin(f), pool.filterEnd(f) ) - * { - * MIL << *it << endl; // supporting any requested locale - * } - * \endcode - */ - //@{ - /** Set the requested locales. - * Languages to be supported by the system, e.g. language specific - * packages to be installed. - */ - void setRequestedLocales( const LocaleSet & locales_r ); - - /** Add one \ref Locale to the set of requested locales. - * Return \c true if \c locale_r was newly added to the set. - */ - bool addRequestedLocale( const Locale & locale_r ); - - /** Erase one \ref Locale from the set of requested locales. - * Return \c false if \c locale_r was not found in the set. - */ - bool eraseRequestedLocale( const Locale & locale_r ); - - /** Return the requested locales. - * \see \ref setRequestedLocales - */ - const LocaleSet & getRequestedLocales() const; - - /** Whether this \ref Locale is in the set of requested locales. */ - bool isRequestedLocale( const Locale & locale_r ) const; - - /** Get the set of available locales. - * This is computed from the package data so it actually - * represents all locales packages claim to support. - */ - const LocaleSet & getAvailableLocales() const; - - /** Whether this \ref Locale is in the set of available locales. */ - bool isAvailableLocale( const Locale & locale_r ) const; - //@} - - public: - /** \name Handle hard locks (e.g set from /etc/zypp/locks). - * - * As this kind of lock is query based, it's quite expensive. - * - * These queries are re-evaluated when adding new repos to the pool. - */ - //@{ - typedef pool::PoolTraits::HardLockQueries HardLockQueries; - typedef pool::PoolTraits::hardLockQueries_iterator hardLockQueries_iterator; - - bool hardLockQueriesEmpty() const; - size_type hardLockQueriesSize() const; - hardLockQueries_iterator hardLockQueriesBegin() const; - hardLockQueries_iterator hardLockQueriesEnd() const; - - /** Set a new set of queries. - * The hard-locks of existing PoolItems are adjusted according - * to the queries. (usually called on target load) - */ - void setHardLockQueries( const HardLockQueries & newLocks_r ); - - /** Suggest a new set of queries based on the current selection. - * (usually remembered on commit). - */ - void getHardLockQueries( HardLockQueries & activeLocks_r ); - //@} - - private: - const pool::PoolTraits::ItemContainerT & store() const; - const pool::PoolTraits::Id2ItemT & id2item() const; - - private: - /** Ctor */ - ResPool( pool::PoolTraits::Impl_Ptr impl_r ); - /** Access to implementation. */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ResPool Stream output */ - std::ostream & operator<<( std::ostream & str, const ResPool & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#include "zypp/ResPoolProxy.h" - -#endif // ZYPP_RESPOOL_H diff --git a/libzypp/zypp/ResPoolProxy.cc b/libzypp/zypp/ResPoolProxy.cc deleted file mode 100644 index c942fb2..0000000 --- a/libzypp/zypp/ResPoolProxy.cc +++ /dev/null @@ -1,337 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResPoolProxy.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/base/Iterator.h" -#include "zypp/base/Algorithm.h" -#include "zypp/base/Functional.h" - -#include "zypp/ResPoolProxy.h" -#include "zypp/pool/PoolImpl.h" -#include "zypp/ui/SelectableImpl.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Tem. friend of PoolItem */ - struct PoolItemSaver - { - void saveState( ResPool pool_r ) - { - std::for_each( pool_r.begin(), pool_r.end(), - std::mem_fun_ref(&PoolItem::saveState) ); - } - - void saveState( ResPool pool_r, const ResKind & kind_r ) - { - std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r), - std::mem_fun_ref(&PoolItem::saveState) ); - } - - void restoreState( ResPool pool_r ) - { - std::for_each( pool_r.begin(), pool_r.end(), - std::mem_fun_ref(&PoolItem::restoreState) ); - } - - void restoreState( ResPool pool_r, const ResKind & kind_r ) - { - std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r), - std::mem_fun_ref(&PoolItem::restoreState) ); - } - - bool diffState( ResPool pool_r ) const - { - // return whether some PoolItem::sameState reported \c false. - return( invokeOnEach( pool_r.begin(), pool_r.end(), - std::mem_fun_ref(&PoolItem::sameState) ) < 0 ); - } - - bool diffState( ResPool pool_r, const ResKind & kind_r ) const - { - // return whether some PoolItem::sameState reported \c false. - return( invokeOnEach( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r), - std::mem_fun_ref(&PoolItem::sameState) ) < 0 ); - } - }; - - namespace - { - ui::Selectable::Ptr makeSelectablePtr( pool::PoolImpl::Id2ItemT::const_iterator begin_r, - pool::PoolImpl::Id2ItemT::const_iterator end_r ) - { - pool::PoolTraits::byIdent_iterator begin( begin_r, pool::PoolTraits::Id2ItemValueSelector() ); - pool::PoolTraits::byIdent_iterator end( end_r, pool::PoolTraits::Id2ItemValueSelector() ); - sat::Solvable solv( begin->satSolvable() ); - - return new ui::Selectable( ui::Selectable::Impl_Ptr( new ui::Selectable::Impl( solv.kind(), solv.name(), begin, end ) ) ); - } - } // namespace - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResPoolProxy::Impl - // - /** ResPoolProxy implementation. - * \todo Seedup as it is still using old index - */ - struct ResPoolProxy::Impl - { - friend std::ostream & operator<<( std::ostream & str, const Impl & obj ); - friend std::ostream & dumpOn( std::ostream & str, const Impl & obj ); - - typedef std::tr1::unordered_map SelectableIndex; - typedef ResPoolProxy::const_iterator const_iterator; - - public: - Impl() - :_pool( ResPool::instance() ) - {} - - Impl( ResPool pool_r, const pool::PoolImpl & poolImpl_r ) - : _pool( pool_r ) - { - const pool::PoolImpl::Id2ItemT & id2item( poolImpl_r.id2item() ); - if ( ! id2item.empty() ) - { - // set startpoint - pool::PoolImpl::Id2ItemT::const_iterator cbegin = id2item.begin(); - - for_( it, id2item.begin(), id2item.end() ) - { - if ( it->first != cbegin->first ) - { - // starting a new Selectable, create the previous one - ui::Selectable::Ptr p( makeSelectablePtr( cbegin, it ) ); - _selPool.insert( SelectablePool::value_type( p->kind(), p ) ); - _selIndex[cbegin->first] = p; - // remember new startpoint - cbegin = it; - } - } - // create the final one - ui::Selectable::Ptr p( makeSelectablePtr( cbegin, id2item.end() ) ); - _selPool.insert( SelectablePool::value_type( p->kind(), p ) ); - _selIndex[cbegin->first] = p; - } - } - - public: - ui::Selectable::Ptr lookup( const pool::ByIdent & ident_r ) const - { - SelectableIndex::const_iterator it( _selIndex.find( ident_r.get() ) ); - if ( it != _selIndex.end() ) - return it->second; - return ui::Selectable::Ptr(); - } - - public: - bool empty() const - { return _selPool.empty(); } - - size_type size() const - { return _selPool.size(); } - - const_iterator begin() const - { return make_map_value_begin( _selPool ); } - - const_iterator end() const - { return make_map_value_end( _selPool ); } - - public: - bool empty( const ResKind & kind_r ) const - { return( _selPool.count( kind_r ) == 0 ); } - - size_type size( const ResKind & kind_r ) const - { return _selPool.count( kind_r ); } - - const_iterator byKindBegin( const ResKind & kind_r ) const - { return make_map_value_lower_bound( _selPool, kind_r ); } - - const_iterator byKindEnd( const ResKind & kind_r ) const - { return make_map_value_upper_bound( _selPool, kind_r ); } - - public: - size_type knownRepositoriesSize() const - { return _pool.knownRepositoriesSize(); } - - repository_iterator knownRepositoriesBegin() const - { return _pool.knownRepositoriesBegin(); } - - repository_iterator knownRepositoriesEnd() const - { return _pool.knownRepositoriesEnd(); } - - public: - - void saveState() const - { PoolItemSaver().saveState( _pool ); } - - void saveState( const ResKind & kind_r ) const - { PoolItemSaver().saveState( _pool, kind_r ); } - - void restoreState() const - { PoolItemSaver().restoreState( _pool ); } - - void restoreState( const ResKind & kind_r ) const - { PoolItemSaver().restoreState( _pool, kind_r ); } - - bool diffState() const - { return PoolItemSaver().diffState( _pool ); } - - bool diffState( const ResKind & kind_r ) const - { return PoolItemSaver().diffState( _pool, kind_r ); } - - private: - ResPool _pool; - mutable SelectablePool _selPool; - mutable SelectableIndex _selIndex; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ResPoolProxy::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const ResPoolProxy::Impl & obj ) - { - return str << "ResPoolProxy (" << obj._pool.serial() << ") [" << obj._pool.size() - << "solv/" << obj.size()<< "sel]"; - } - - namespace detail - { - struct DumpFilter - { - bool operator()( const ui::Selectable::Ptr & selp ) const - { return selp->toModify(); } - }; - } - - /** \relates ResPoolProxy::Impl Verbose stream output */ - inline std::ostream & dumpOn( std::ostream & str, const ResPoolProxy::Impl & obj ) - { - detail::DumpFilter f; - return dumpRange( str << obj << " toModify: ", - make_filter_begin( f, obj ), - make_filter_end( f, obj ) ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResPoolProxy - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResPoolProxy::ResPoolProxy - // METHOD TYPE : Ctor - // - ResPoolProxy::ResPoolProxy() - : _pimpl( Impl::nullimpl() ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResPoolProxy::ResPoolProxy - // METHOD TYPE : Ctor - // - ResPoolProxy::ResPoolProxy( ResPool pool_r, const pool::PoolImpl & poolImpl_r ) - : _pimpl( new Impl( pool_r, poolImpl_r ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResPoolProxy::~ResPoolProxy - // METHOD TYPE : Dtor - // - ResPoolProxy::~ResPoolProxy() - {} - - /////////////////////////////////////////////////////////////////// - // - // forward to implementation - // - /////////////////////////////////////////////////////////////////// - - ui::Selectable::Ptr ResPoolProxy::lookup( const pool::ByIdent & ident_r ) const - { return _pimpl->lookup( ident_r ); } - - bool ResPoolProxy::empty() const - { return _pimpl->empty(); } - - ResPoolProxy::size_type ResPoolProxy::size() const - { return _pimpl->size(); } - - ResPoolProxy::const_iterator ResPoolProxy::begin() const - { return _pimpl->begin(); } - - ResPoolProxy::const_iterator ResPoolProxy::end() const - { return _pimpl->end(); } - - bool ResPoolProxy::empty( const ResKind & kind_r ) const - { return _pimpl->empty( kind_r ); } - - ResPoolProxy::size_type ResPoolProxy::size( const ResKind & kind_r ) const - { return _pimpl->size( kind_r ); } - - ResPoolProxy::const_iterator ResPoolProxy::byKindBegin( const ResKind & kind_r ) const - { return _pimpl->byKindBegin( kind_r ); } - - ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResKind & kind_r ) const - { return _pimpl->byKindEnd( kind_r ); } - - ResPoolProxy::size_type ResPoolProxy::knownRepositoriesSize() const - { return _pimpl->knownRepositoriesSize(); } - - ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesBegin() const - { return _pimpl->knownRepositoriesBegin(); } - - ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesEnd() const - { return _pimpl->knownRepositoriesEnd(); } - - void ResPoolProxy::saveState() const - { _pimpl->saveState(); } - - void ResPoolProxy::saveState( const ResKind & kind_r ) const - { _pimpl->saveState( kind_r ); } - - void ResPoolProxy::restoreState() const - { _pimpl->restoreState(); } - - void ResPoolProxy::restoreState( const ResKind & kind_r ) const - { _pimpl->restoreState( kind_r ); } - - bool ResPoolProxy::diffState() const - { return _pimpl->diffState(); } - - bool ResPoolProxy::diffState( const ResKind & kind_r ) const - { return _pimpl->diffState( kind_r ); } - - std::ostream & operator<<( std::ostream & str, const ResPoolProxy & obj ) - { return str << *obj._pimpl; } - - std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj ) - { return dumpOn( str, *obj._pimpl ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResPoolProxy.h b/libzypp/zypp/ResPoolProxy.h deleted file mode 100644 index 6234bc5..0000000 --- a/libzypp/zypp/ResPoolProxy.h +++ /dev/null @@ -1,232 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResPoolProxy.h - * -*/ -#ifndef ZYPP_RESPOOLPROXY_H -#define ZYPP_RESPOOLPROXY_H - -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/ResPool.h" -#include "zypp/ui/Selectable.h" -#include "zypp/ui/SelFilters.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResPoolProxy - // - /** ResPool::instance().proxy(); - * \todo integrate it into ResPool - */ - class ResPoolProxy - { - friend std::ostream & operator<<( std::ostream & str, const ResPoolProxy & obj ); - friend std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj ); - typedef std::multimap SelectablePool; - - public: - /** Implementation */ - class Impl; - - typedef MapKVIteratorTraits::Value_const_iterator const_iterator; - typedef SelectablePool::size_type size_type; - - typedef ResPool::repository_iterator repository_iterator; - - public: - - /** Default ctor: no pool - * Nonempty proxies are provided by \ref ResPool. - * \see \ref ResPool::proxy - * \code - * ResPoolProxy p( ResPool::instance().proxy() ); - * \endcode - */ - ResPoolProxy(); - - /** Dtor */ - ~ResPoolProxy(); - - public: - /** \name Lookup individual Selectables. */ - //@{ - ui::Selectable::Ptr lookup( const pool::ByIdent & ident_r ) const; - - ui::Selectable::Ptr lookup( IdString ident_r ) const - { return lookup( pool::ByIdent( ident_r ) ); } - - ui::Selectable::Ptr lookup( ResKind kind_r, const std::string & name_r ) const - { return lookup( pool::ByIdent( kind_r, name_r ) ); } - - ui::Selectable::Ptr lookup( const sat::Solvable & solv_r ) const - { return lookup( pool::ByIdent( solv_r ) ); } - - ui::Selectable::Ptr lookup( const ResObject::constPtr & resolvable_r ) const - { return resolvable_r ? lookup( resolvable_r->satSolvable() ) : ui::Selectable::Ptr(); } - - ui::Selectable::Ptr lookup( const PoolItem & pi_r ) const - { return lookup( pi_r.satSolvable() ); } - //@} - - public: - /** \name Iterate through all Selectables of a all kind. */ - //@{ - bool empty() const; - size_type size() const; - const_iterator begin() const; - const_iterator end() const; - //@} - - /** \name Iterate through all Selectables of a certain kind. */ - //@{ - /** True if there are items of a certain kind. */ - bool empty( const ResKind & kind_r ) const; - - template - bool empty() const - { return empty( ResTraits<_Res>::kind ); } - - /** Number of Items of a certain kind. */ - size_type size( const ResKind & kind_r ) const; - - template - size_type size() const - { return size( ResTraits<_Res>::kind ); } - - const_iterator byKindBegin( const ResKind & kind_r ) const; - - template - const_iterator byKindBegin() const - { return byKindBegin( ResTraits<_Res>::kind ); } - - - const_iterator byKindEnd( const ResKind & kind_r ) const; - - template - const_iterator byKindEnd() const - { return byKindEnd( ResTraits<_Res>::kind ); } - //@} - - public: - /** \name Iterate through all Repositories that contribute ResObjects. - */ - //@{ - size_type knownRepositoriesSize() const; - - repository_iterator knownRepositoriesBegin() const; - - repository_iterator knownRepositoriesEnd() const; - //@} - - public: - /** Test whether there is at least one ui::Selectable with - * an installed object. - */ - bool hasInstalledObj( const ResKind & kind_r ) const - { - return( make_begin( kind_r ) - != make_end( kind_r ) ); - } - - template - bool hasInstalledObj() const - { return hasInstalledObj( ResTraits<_Res>::kind ); } - - public: - /** \name Save and restore state per kind of resolvable. - * Simple version, no savety net. So don't restore or diff, - * if you didn't save before. - * - * Diff returns true, if current stat differs from the saved - * state. - */ - //@{ - void saveState() const; - - void saveState( const ResKind & kind_r ) const; - - template - void saveState() const - { return saveState( ResTraits<_Res>::kind ); } - - void restoreState() const; - - void restoreState( const ResKind & kind_r ) const; - - template - void restoreState() const - { return restoreState( ResTraits<_Res>::kind ); } - - bool diffState() const; - - bool diffState( const ResKind & kind_r ) const; - - template - bool diffState() const - { return diffState( ResTraits<_Res>::kind ); } - //@} - - private: - template - filter_iterator<_Filter,const_iterator> - make_begin( _Filter filter_r, const ResKind & kind_r ) const - { - return make_filter_iterator( filter_r, - byKindBegin(kind_r), - byKindEnd(kind_r) ); - } - template - filter_iterator<_Filter,const_iterator> - make_begin( const ResKind & kind_r ) const - { - return make_begin( _Filter(), kind_r ); - } - - - template - filter_iterator<_Filter,const_iterator> - make_end( _Filter filter_r, const ResKind & kind_r ) const - { - return make_filter_iterator( filter_r, - byKindEnd(kind_r), - byKindEnd(kind_r) ); - } - template - filter_iterator<_Filter,const_iterator> - make_end( const ResKind & kind_r ) const - { - return make_end( _Filter(), kind_r ); - } - - private: - friend class pool::PoolImpl; - /** Ctor */ - ResPoolProxy( ResPool pool_r, const pool::PoolImpl & poolImpl_r ); - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ResPoolProxy Stream output */ - std::ostream & operator<<( std::ostream & str, const ResPoolProxy & obj ); - - /** \relates ResPoolProxy Verbose stream output */ - std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESPOOLPROXY_H diff --git a/libzypp/zypp/ResStatus.cc b/libzypp/zypp/ResStatus.cc deleted file mode 100644 index ee770f3..0000000 --- a/libzypp/zypp/ResStatus.cc +++ /dev/null @@ -1,127 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResStatus.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/ResStatus.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - const ResStatus ResStatus::toBeInstalled (UNINSTALLED, UNDETERMINED, TRANSACT); - const ResStatus ResStatus::toBeUninstalled (INSTALLED, UNDETERMINED, TRANSACT); - const ResStatus ResStatus::toBeUninstalledDueToUpgrade (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UPGRADE); - const ResStatus ResStatus::toBeUninstalledDueToObsolete(INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResStatus::ResStatus - // METHOD TYPE : Ctor - // - ResStatus::ResStatus() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResStatus::ResStatus - // METHOD TYPE : Ctor - // - ResStatus::ResStatus( bool isInstalled_r ) - : _bitfield( isInstalled_r ? INSTALLED : UNINSTALLED ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ResStatus::~ResStatus - // METHOD TYPE : Dtor - // - ResStatus::~ResStatus() - {} - - - ResStatus::ResStatus (enum StateValue s, enum ValidateValue v, enum TransactValue t, enum InstallDetailValue i, enum RemoveDetailValue r) - : _bitfield (s) - { - fieldValueAssign(v); - fieldValueAssign(t); - if (t == TRANSACT) { - if (s == INSTALLED) fieldValueAssign(r); - else fieldValueAssign(i); - } - } - - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ResStatus & obj ) - { - str << (obj.isInstalled() ? "I" : "U"); - - str << (obj.isBroken() ? "B" : - ( obj.isSatisfied() ? "S" : - ( obj.isNonRelevant() ? "N" : "_") ) ); - - str << (obj.transacts () ? "T" - : (obj.isLocked() ? "L" : "_") ); - - if (obj.isBySolver()) str << "s"; - else if (obj.isByApplLow()) str << "l"; - else if (obj.isByApplHigh()) str << "h"; - else if (obj.isByUser()) str << "u"; - - str << (obj.isToBeUninstalledDueToObsolete() ? "O" : - ( obj.isToBeUninstalledDueToUpgrade() ? "U" : - ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) ); - - str << (obj.isRecommended() ? "r" : "" ); - str << (obj.isSuggested() ? "s" : "" ); - str << (obj.isOrphaned() ? "o" : "" ); - str << (obj.isUnneeded() ? "u" : "" ); - - return str; - } - - -#define OUTS(X) case ResStatus::X: return str << #X; break - - std::ostream & operator<<( std::ostream & str, ResStatus::TransactValue obj ) - { - switch ( obj ) - { - OUTS( KEEP_STATE ); - OUTS( LOCKED ); - OUTS( TRANSACT ); - } - return str; - } - - std::ostream & operator<<( std::ostream & str, ResStatus::TransactByValue obj ) - { - switch ( obj ) - { - OUTS( SOLVER ); - OUTS( APPL_LOW ); - OUTS( APPL_HIGH ); - OUTS( USER ); - } - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResStatus.h b/libzypp/zypp/ResStatus.h deleted file mode 100644 index 908e05b..0000000 --- a/libzypp/zypp/ResStatus.h +++ /dev/null @@ -1,737 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResStatus.h - * -*/ -#ifndef ZYPP_RESSTATUS_H -#define ZYPP_RESSTATUS_H - -#include -#include -#include "zypp/Bit.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace resstatus - { - class UserLockQueryManip; - class StatusBackup; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ResStatus - // - /** Status bitfield. - * - * \li \c StateField Whether the resolvable is or uninstalled (available). - * \li \c ValidateField Validate status computed by the solver as - * nonrelevant: it is unimportant for the user - * satisfied: it important nothing has to be done - * broken: it is incomplete. So e.g. an update is needed - * \li \c TransactField Whether to transact this resolvable - * (delete if installed install if uninstalled). - * In case the resolvable is locked, only USER may modify the - * transact bit. - * \li \c TransactByField Who triggered the transaction. Transaction - * bit may be reset by higer levels only. - * \li \c TransactDetailField Reason why the Resolvable transacts. - * Splitted into \c InstallDetailValue and \c RemoveDetailValue - * dependent on the kind of transaction. - * \li \c WeakField The solvable will be recommended/suggested by - * a to be installed/deleted solvable. - * - */ - class ResStatus - { - friend std::ostream & operator<<( std::ostream & str, const ResStatus & obj ); - friend bool operator==( const ResStatus & lhs, const ResStatus & rhs ); - - public: - /** \name BitField range definitions. - * - * \note Enlarge FieldType if more bit's needed. It's not yet - * checked by the compiler. - */ - //@{ - typedef uint16_t FieldType; - typedef bit::BitField BitFieldType; - // Bit Ranges within FieldType defined by 1st bit and size: - typedef bit::Range StateField; - typedef bit::Range ValidateField; - typedef bit::Range TransactField; - typedef bit::Range TransactByField; - typedef bit::Range TransactDetailField; - typedef bit::Range LicenceConfirmedField; - typedef bit::Range WeakField; - typedef bit::Range UserLockQueryField; // internal - // enlarge FieldType if more bit's needed. It's not yet - // checked by the compiler. - //@} - public: - - /** \name Status values. - * - * Each enum corresponds to a BitField range. - * \note Take care that enumerator values actually fit into - * the corresponding field. It's not yet checked by the compiler. - */ - //@{ - enum StateValue - { - UNINSTALLED = bit::RangeValue::value, - INSTALLED = bit::RangeValue::value - }; - enum ValidateValue - { - UNDETERMINED = bit::RangeValue::value, - BROKEN = bit::RangeValue::value, - SATISFIED = bit::RangeValue::value, - NONRELEVANT = bit::RangeValue::value - }; - enum TransactValue - { - KEEP_STATE = bit::RangeValue::value, - LOCKED = bit::RangeValue::value, // locked, must not transact - TRANSACT = bit::RangeValue::value // transact according to state - }; - enum TransactByValue - { - SOLVER = bit::RangeValue::value, - APPL_LOW = bit::RangeValue::value, - APPL_HIGH = bit::RangeValue::value, - USER = bit::RangeValue::value - }; - - enum DetailValue - { - /** Detail for no transact, i.e. reset any Install/RemoveDetailValue. */ - NO_DETAIL = bit::RangeValue::value, - }; - enum InstallDetailValue - { - EXPLICIT_INSTALL = bit::RangeValue::value, - SOFT_INSTALL = bit::RangeValue::value - }; - enum RemoveDetailValue - { - EXPLICIT_REMOVE = bit::RangeValue::value, - SOFT_REMOVE = bit::RangeValue::value, - DUE_TO_OBSOLETE = bit::RangeValue::value, - DUE_TO_UPGRADE = bit::RangeValue::value - }; - - enum LicenceConfirmedValue - { - LICENCE_UNCONFIRMED = bit::RangeValue::value, - LICENCE_CONFIRMED = bit::RangeValue::value - }; - - enum WeakValue // Unlike the other fields those are BITS that may be or'ed! - { - NO_WEAK = bit::RangeValue::value, - SUGGESTED = bit::RangeValue::value, - RECOMMENDED = bit::RangeValue::value, - ORPHANED = bit::RangeValue::value, - UNNEEDED = bit::RangeValue::value - }; - - enum UserLockQuery // internal - { - USERLOCK_NOMATCH = bit::RangeValue::value, - USERLOCK_MATCH = bit::RangeValue::value - }; - //@} - - public: - - /** Default ctor. */ - ResStatus(); - - /** Ctor setting the initial . */ - ResStatus( bool isInstalled_r ); - - /** Dtor. */ - ~ResStatus(); - - /** Debug helper returning the bitfield. - * It's save to expose the bitfield, as it can't be used to - * recreate a ResStatus. So it is not possible to bypass - * transition rules. - */ - BitFieldType bitfield() const - { return _bitfield; } - - public: - - bool isLicenceConfirmed() const - { return fieldValueIs( LICENCE_CONFIRMED ); } - - void setLicenceConfirmed( bool toVal_r = true ) - { fieldValueAssign( toVal_r ? LICENCE_CONFIRMED : LICENCE_UNCONFIRMED ); } - - public: - bool isRecommended() const - { return _bitfield.test( RECOMMENDED ); } - - bool isSuggested() const - { return _bitfield.test( SUGGESTED ); } - - bool isOrphaned() const - { return _bitfield.test( ORPHANED ); } - - bool isUnneeded() const - { return _bitfield.test( UNNEEDED ); } - - void resetWeak() - { return fieldValueAssign( NO_WEAK ); } - - void setRecommended( bool toVal_r = true ) - { _bitfield.set( RECOMMENDED, toVal_r ); } - - void setSuggested( bool toVal_r = true ) - { _bitfield.set( SUGGESTED, toVal_r ); } - - void setOrphaned( bool toVal_r = true ) - { _bitfield.set( ORPHANED, toVal_r ); } - - void setUnneeded( bool toVal_r = true ) - { _bitfield.set( UNNEEDED, toVal_r ); } - - public: - ValidateValue validate() const - { return (ValidateValue)_bitfield.value(); } - - bool isUndetermined() const - { return fieldValueIs( UNDETERMINED ); } - - bool isSatisfied() const - { return fieldValueIs( SATISFIED ); } - - bool isBroken() const - { return fieldValueIs( BROKEN ); } - - bool isNonRelevant() const - { return fieldValueIs( NONRELEVANT ); } - - public: - // These two are IMMUTABLE! - - bool isInstalled() const - { return fieldValueIs( INSTALLED ); } - - bool isUninstalled() const - { return fieldValueIs( UNINSTALLED ); } - - public: - - bool staysInstalled() const - { return isInstalled() && !transacts(); } - - bool wasInstalled() const { return staysInstalled(); } //for old status - - bool isToBeInstalled() const - { return isUninstalled() && transacts(); } - - bool staysUninstalled() const - { return isUninstalled() && !transacts(); } - - bool wasUninstalled() const { return staysUninstalled(); } // for old status - - bool isToBeUninstalled() const - { return isInstalled() && transacts(); } - - bool isLocked() const - { return fieldValueIs( LOCKED ); } - - bool isUserLocked() const - { return isLocked() && isByUser(); } - - bool isSoftLocked() const - { return isKept() && ( isByApplLow() || isByUser() ); } - - bool isKept() const - { return fieldValueIs( KEEP_STATE ); } - - bool transacts() const - { return fieldValueIs( TRANSACT ); } - - TransactValue getTransactValue() const - { return (TransactValue)_bitfield.value(); } - - /** True if would be on system after commit. */ - bool onSystem() const - { return( isInstalled() != transacts() ); } - - /** True if would be off system after commit. */ - bool offSystem() const - { return ! onSystem(); } - - bool isBySolver() const - { return fieldValueIs( SOLVER ); } - - bool isByApplLow() const - { return fieldValueIs( APPL_LOW ); } - - bool isByApplHigh() const - { return fieldValueIs( APPL_HIGH ); } - - bool isByUser() const - { return fieldValueIs( USER ); } - - TransactByValue getTransactByValue() const - { return (TransactByValue)_bitfield.value(); } - - bool setTransactByValue(TransactByValue causer) - { - if ( isLessThan( causer ) ) { - fieldValueAssign( causer ); - return true; - } else { - return false; - } - } - - bool isToBeUninstalledDueToObsolete () const - { return isToBeUninstalled() && fieldValueIs( DUE_TO_OBSOLETE ); } - - bool isToBeUninstalledDueToUpgrade() const - { return isToBeUninstalled() && fieldValueIs( DUE_TO_UPGRADE ); } - - bool isToBeInstalledSoft () const - { return isToBeInstalled() && fieldValueIs( SOFT_INSTALL ); } - - bool isToBeInstalledNotSoft () const - { return isToBeInstalled() && !fieldValueIs( SOFT_INSTALL ); } - - bool isToBeUninstalledSoft () const - { return isToBeUninstalled() && fieldValueIs( SOFT_REMOVE ); } - - private: - - /** \name Internal hard lock maintainance */ - //@{ - friend class resstatus::UserLockQueryManip; - - bool isUserLockQueryMatch() const - { return fieldValueIs( USERLOCK_MATCH ); } - - void setUserLockQueryMatch( bool match_r ) - { fieldValueAssign( match_r ? USERLOCK_MATCH : USERLOCK_NOMATCH ); } - //@} - - public: - - //------------------------------------------------------------------------ - // get/set functions, returnig \c true if requested status change - // was successfull (i.e. leading to the desired transaction). - // If a lower level (e.g.SOLVER) wants to transact, but it's - // already set by a higher level, \c true should be returned. - // Removing a higher levels transaction bit should fail. - // - // The may functions checks only, if the action would return true - // if it is called. - - /** Set TransactValue. - * Convenience to set TransactValue from enum. - */ - bool setTransactValue( TransactValue newVal_r, TransactByValue causer_r ) - { - switch ( newVal_r ) - { - case KEEP_STATE: - return setTransact( false, causer_r ); - break; - case LOCKED: - return setLock( true, causer_r ); - break; - case TRANSACT: - return setTransact( true, causer_r ); - break; - } - return false; - } - - bool maySetTransactValue( TransactValue newVal_r, TransactByValue causer_r ) - { - bit::BitField savBitfield = _bitfield; - bool ret = setTransactValue( newVal_r, causer_r ); - _bitfield = savBitfield; - return ret; - } - - /** Apply a lock (prevent transaction). - * Currently by USER or APPL_HIGH only, but who knows... - * Set LOCKED from KEEP_STATE to be shure all transaction - * details were reset properly. - */ - bool setLock( bool toLock_r, TransactByValue causer_r ) - { - if ( toLock_r == isLocked() ) - { - // we're already in the desired state, but in case of - // LOCKED, remember a superior causer. - if ( isLocked() && isLessThan( causer_r ) ) - fieldValueAssign( causer_r ); - return true; - } - // Here: Lock status is to be changed: - if ( causer_r != USER && causer_r != APPL_HIGH ) - return false; - if ( toLock_r ) { - // We're in unlocked state, which includes TRANSACT. - // Causer must be allowed to reset this. But from - // KEEP_STATE every causer is allowed to set the lock. - if ( ! setTransact( false, causer_r ) ) - return false; - fieldValueAssign( LOCKED ); - fieldValueAssign( causer_r ); - } else { - // To leave Locked state it needs a superior causer. - if ( isGreaterThan( causer_r ) ) - return false; - fieldValueAssign( KEEP_STATE ); - fieldValueAssign( SOLVER ); // reset to lowest causer - // in order to distinguish from keep_state_by_user - } - return true; - } - - bool maySetLock( bool to_r, TransactByValue causer_r ) - { - bit::BitField savBitfield = _bitfield; - bool ret = setLock( to_r, causer_r ); - _bitfield = savBitfield; - return ret; - } - - /** Toggle between TRANSACT and KEEP_STATE. - * LOCKED state means KEEP_STATE. But in contrary to KEEP_STATE, - * LOCKED state is immutable for \a causer_r less than TransactByValue. - * KEEP_STATE may be canged by any \a causer_r. - */ - bool setTransact( bool toTansact_r, TransactByValue causer_r ) - { - if ( toTansact_r == transacts() ) - { - // we're already in the desired state, but in case of - // TRANSACT, remember a superior causer. - if ( transacts() && isLessThan( causer_r ) ) - fieldValueAssign( causer_r ); - - fieldValueAssign( NO_DETAIL ); // Details has to be set again - return true; - } - // Here: transact status is to be changed: - if ( ! fieldValueIs( KEEP_STATE ) - && isGreaterThan( causer_r ) ) { - return false; - } - - if ( toTansact_r ) - { - fieldValueAssign( TRANSACT ); - } - else - { - fieldValueAssign( KEEP_STATE ); - } - fieldValueAssign( NO_DETAIL ); // Details has to be set again - fieldValueAssign( causer_r ); - return true; - } - - bool maySetTransact( bool val_r, TransactByValue causer ) - { - bit::BitField savBitfield = _bitfield; - bool ret = setTransact (val_r, causer); - _bitfield = savBitfield; - return ret; - } - - /** */ - bool setSoftLock( TransactByValue causer_r ) - { - if ( ! setTransact( false, causer_r ) ) - return false; - if ( fieldValueIs( KEEP_STATE ) - && isLessThan( causer_r ) ) - fieldValueAssign( causer_r ); - return true; - } - - /** Not the same as setTransact( false ). - */ - bool resetTransact( TransactByValue causer_r ) - { - if ( ! setTransact( false, causer_r ) ) - return false; - if ( fieldValueIs( KEEP_STATE ) ) - fieldValueAssign( SOLVER ); - return true; - } - - /** Soft toggle between TRANSACT and KEEP_STATE. - * Similar to setTransact, but leaving KEEP_STATE also requires - * a superior \a causerLimit_r. So this is a kind of soft lock. - * \code - * // SOLVER wants to set TRANSACT, iff KEEP_STATE is - * // not superior to APPL_LOW. - * setSoftTransact( true, SOLVER, APPL_LOW ); - * \endcode - */ - bool setSoftTransact( bool toTansact_r, TransactByValue causer_r, - TransactByValue causerLimit_r ) - { - if ( fieldValueIs( KEEP_STATE ) - && toTansact_r != transacts() - && isGreaterThan( causerLimit_r ) ) - { - // any transact status change requires a superior causer. - return false; - } - return setTransact( toTansact_r, causer_r ); - } - - bool setSoftTransact( bool toTansact_r, TransactByValue causer_r ) - { return setSoftTransact( toTansact_r, causer_r, causer_r ); } - - bool maySetSoftTransact( bool val_r, TransactByValue causer, - TransactByValue causerLimit_r ) - { - bit::BitField savBitfield = _bitfield; - bool ret = setSoftTransact( val_r, causer, causerLimit_r ); - _bitfield = savBitfield; - return ret; - } - - bool maySetSoftTransact( bool val_r, TransactByValue causer ) - { return maySetSoftTransact( val_r, causer, causer ); } - - bool setToBeInstalled (TransactByValue causer) - { - if (isInstalled()) return false; - return setTransact (true, causer); - } - - bool maySetToBeInstalled (TransactByValue causer) - { - bit::BitField savBitfield = _bitfield; - bool ret = setToBeInstalled (causer); - _bitfield = savBitfield; - return ret; - } - - bool setToBeUninstalled (TransactByValue causer) - { - if (!isInstalled()) return false; - return setTransact (true, causer); - } - - bool maySetToBeUninstalled (TransactByValue causer) - { - bit::BitField savBitfield = _bitfield; - bool ret = setToBeUninstalled (causer); - _bitfield = savBitfield; - return ret; - } - - //------------------------------------------------------------------------ - // *** These are only for the Resolver *** - - bool setToBeUninstalledDueToObsolete ( ) - { - if (!setToBeUninstalled (SOLVER)) return false; - fieldValueAssign(DUE_TO_OBSOLETE); - return true; - } - - bool setToBeUninstalledDueToUpgrade ( TransactByValue causer ) - { - if (!setToBeUninstalled (causer)) return false; - fieldValueAssign(DUE_TO_UPGRADE); - return true; - } - - bool setToBeInstalledSoft ( ) - { - if (isInstalled() - || !setSoftTransact (true, SOLVER)) - return false; - - fieldValueAssign(SOFT_INSTALL); - return true; - } - - bool setToBeUninstalledSoft ( ) - { - if (!isInstalled() - || !setSoftTransact (true, SOLVER)) - return false; - - fieldValueAssign(SOFT_REMOVE); - return true; - } - - bool maySetToBeUninstalledSoft () - { - bit::BitField savBitfield = _bitfield; - bool ret = setToBeUninstalledSoft (); - _bitfield = savBitfield; - return ret; - } - - bool isSoftInstall () { - return fieldValueIs (SOFT_INSTALL); - } - - bool isSoftUninstall () { - return fieldValueIs (SOFT_REMOVE); - } - - bool setSoftInstall (bool flag) { - fieldValueAssign(flag?SOFT_INSTALL:0); - return true; - } - - bool setSoftUninstall (bool flag) { - fieldValueAssign(flag?SOFT_REMOVE:0); - return true; - } - - bool setUndetermined () - { - fieldValueAssign(UNDETERMINED); - return true; - } - - bool setSatisfied () - { - fieldValueAssign(SATISFIED); - return true; - } - - bool setBroken () - { - fieldValueAssign(BROKEN); - return true; - } - - bool setNonRelevant () - { - fieldValueAssign(NONRELEVANT); - return true; - } - - bool setStatus( ResStatus newStatus_r ) - { - // State field is immutable! - if ( _bitfield.value() != newStatus_r._bitfield.value() ) - return false; - // Transaction state change allowed? - if ( ! setTransactValue( newStatus_r.getTransactValue(), newStatus_r.getTransactByValue() ) ) - return false; - - // Ok, we take it all.. - _bitfield = newStatus_r._bitfield; - return true; - } - - /** \name Builtin ResStatus constants. */ - //@{ - static const ResStatus toBeInstalled; - static const ResStatus toBeUninstalled; - static const ResStatus toBeUninstalledDueToUpgrade; - static const ResStatus toBeUninstalledDueToObsolete; - //@} - - private: - /** Ctor for intialization of builtin constants. */ - ResStatus( StateValue s, - ValidateValue v = UNDETERMINED, - TransactValue t = KEEP_STATE, - InstallDetailValue i = EXPLICIT_INSTALL, - RemoveDetailValue r = EXPLICIT_REMOVE ); - - /** Return whether the corresponding Field has value \a val_r. - */ - template - bool fieldValueIs( FieldType val_r ) const - { return _bitfield.isEqual<_Field>( val_r ); } - - /** Set the corresponding Field to value \a val_r. - */ - template - void fieldValueAssign( FieldType val_r ) - { _bitfield.assign<_Field>( val_r ); } - - /** compare two values. - */ - template - bool isGreaterThan( FieldType val_r ) - { return _bitfield.value<_Field>() > val_r; } - - template - bool isLessThan( FieldType val_r ) - { return _bitfield.value<_Field>() < val_r; } - - private: - friend class resstatus::StatusBackup; - BitFieldType _bitfield; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ResStatus Stream output */ - std::ostream & operator<<( std::ostream & str, const ResStatus & obj ); - - /** \relates ResStatus Stream output */ - std::ostream & operator<<( std::ostream & str, ResStatus::TransactValue obj ); - - /** \relates ResStatus Stream output */ - std::ostream & operator<<( std::ostream & str, ResStatus::TransactByValue obj ); - - /** \relates ResStatus */ - inline bool operator==( const ResStatus & lhs, const ResStatus & rhs ) - { return lhs._bitfield == rhs._bitfield; } - - /** \relates ResStatus */ - inline bool operator!=( const ResStatus & lhs, const ResStatus & rhs ) - { return ! (lhs == rhs); } - - /////////////////////////////////////////////////////////////////// - - namespace resstatus - { - class StatusBackup - { - public: - StatusBackup() - : _status( 0 ) - {} - - StatusBackup( ResStatus & status_r ) - : _status( &status_r ) - , _bitfield( _status->_bitfield ) - {} - - void replay() - { if ( _status ) _status->_bitfield = _bitfield; } - - private: - ResStatus * _status; - ResStatus::BitFieldType _bitfield; - }; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESSTATUS_H diff --git a/libzypp/zypp/ResTraits.h b/libzypp/zypp/ResTraits.h deleted file mode 100644 index 42e4324..0000000 --- a/libzypp/zypp/ResTraits.h +++ /dev/null @@ -1,147 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ResTraits.h - * -*/ -#ifndef ZYPP_RESTRAITS_H -#define ZYPP_RESTRAITS_H - -#include "zypp/base/PtrTypes.h" -#include "zypp/ResKind.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace traits - { ///////////////////////////////////////////////////////////////// - - /** Those are denoted to be installed, if the - * solver verifies them as being satisfied. */ - inline bool isPseudoInstalled( ResKind kind_r ) - { return( kind_r == ResKind::patch ); } - - ///////////////////////////////////////////////////////////////// - } // namespace traits - /////////////////////////////////////////////////////////////////// - - /** \defgroup ZYPP_RESOLVABLE_SMART_POINTER_TYPES - * Resolvable smart pointer types. - * - * Forward declaration of all Resolvable smart pointer - * types provided in \c ResTraits.h (recommended in header files): - * \code - * #include "zypp/ResTraits.h" - * - * Resolvable_Ptr // Resolvable * - * ResTraits::PtrType // same as above - * - * Resolvable_constPtr // const Resolvable * - * ResTraits::constPtrType // same as above - * \endcode - * - * Synonym, but requires \c Resolvable.h being included: - * \code - * #include "zypp/Resolvable.h" - * - * Resolvable::Ptr // same as Resolvable_Ptr but requires Resolvable.h - * Resolvable::constPtr // same as Resolvable_constPtr but requires Resolvable.h - * \endcode - * - * \note When adding a \c NewResolvable type here, dont forgett to - * put IMPL_PTR_TYPE(NewResolvable); into the \c NewResolvable.cc. - * Also check class \ref ResKind, ResKind.cc, ResObject.cc(makeResObject) - */ - //@{ - DEFINE_PTR_TYPE( Resolvable ); - DEFINE_PTR_TYPE( ResObject ); - - DEFINE_PTR_TYPE( Package ); - DEFINE_PTR_TYPE( SrcPackage ); - DEFINE_PTR_TYPE( Pattern ); - DEFINE_PTR_TYPE( Product ); - DEFINE_PTR_TYPE( Patch ); - DEFINE_PTR_TYPE( Application ); - //@} - - /** Frequently associated. */ - class PoolItem; - - /** ResTraits. Defines common types and the ResKind value. */ - template - struct ResTraits - { - typedef ResKind KindType; - typedef intrusive_ptr<_Res> PtrType; - typedef intrusive_ptr constPtrType; - - static const ResKind kind; ///< Defined in ResKind.cc - - /** Those are denoted to be installed, if the - * solver verifies them as being satisfied. */ - static bool isPseudoInstalled() { return traits::isPseudoInstalled( kind ); } - }; - - /** ResTraits specialisation for Resolvable. - * Resolvable is common base and has no Kind value. - */ - template<> - struct ResTraits - { - typedef ResKind KindType; - typedef intrusive_ptr PtrType; - typedef intrusive_ptr constPtrType; - }; - - /** ResTraits specialisation for ResObject. - * ResObject is common base and has no Kind value. - */ - template<> - struct ResTraits - { - typedef ResKind KindType; - typedef intrusive_ptr PtrType; - typedef intrusive_ptr constPtrType; - }; - - /** Convenient access to well known ResKinds. - * \code - * ResKind packagekind = ResKind::package; - * ResKind packagekind = resKind(); - * \endcode - */ - template - inline ResKind resKind() { return ResTraits<_Res>::kind; } - - /** Convenient test for ResKinds. - * \code - * ResKind value; - * if ( ResKind::package == value ) - * if ( resKind() == value ) - * if ( isKind( value ) ) - * \endcode - */ - template - inline bool isKind( const ResKind & val_r ) - { return( resKind<_Res>() == val_r ); } - /** \overload */ - template - inline bool isKind( const std::string & val_r ) - { return( resKind<_Res>() == val_r ); } - /** \overload */ - template - inline bool isKind( const char * val_r ) - { return( resKind<_Res>() == val_r ); } - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESTRAITS_H diff --git a/libzypp/zypp/Resolvable.cc b/libzypp/zypp/Resolvable.cc deleted file mode 100644 index aa8ccad..0000000 --- a/libzypp/zypp/Resolvable.cc +++ /dev/null @@ -1,57 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Resolvable.cc - * -*/ -#include "zypp/Resolvable.h" -#include "zypp/ResObject.h" -#include "zypp/PoolItem.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(Resolvable); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::Resolvable - // METHOD TYPE : Ctor - // - Resolvable::Resolvable( const sat::Solvable & solvable_r ) - : sat::Solvable( solvable_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::~Resolvable - // METHOD TYPE : Dtor - // - Resolvable::~Resolvable() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::poolItem - // METHOD TYPE : PoolItem - // - PoolItem Resolvable::poolItem() const - { return PoolItem( *this ); } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::dumpOn - // METHOD TYPE : std::ostream & - // - std::ostream & Resolvable::dumpOn( std::ostream & str ) const - { return str << satSolvable(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Resolvable.h b/libzypp/zypp/Resolvable.h deleted file mode 100644 index 907a17f..0000000 --- a/libzypp/zypp/Resolvable.h +++ /dev/null @@ -1,254 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Resolvable.h - * -*/ -#ifndef ZYPP_RESOLVABLE_H -#define ZYPP_RESOLVABLE_H - -#include -#include - -#include "zypp/APIConfig.h" - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/sat/Solvable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class PoolItem; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Resolvable - // - /** Interface base for resolvable objects (identification and dependencies). - * \todo Merge with ResObject - */ - class Resolvable : protected zypp::sat::Solvable, // Note: gcc bug #52841 prohibits using just sat::Solvable - public base::ReferenceCounted, private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj ); - - public: - typedef Resolvable Self; - typedef ResTraits TraitsType; - typedef TraitsType::KindType Kind; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - /** Whether this represents an installed solvable. */ - bool isSystem() const - { return sat::Solvable::isSystem(); } - - /** \copydoc sat::Solvable::onSystemByUser() */ - bool onSystemByUser() const - { return sat::Solvable::onSystemByUser(); } - - IdString ident() const - { return sat::Solvable::ident(); } - - ResKind kind() const - { return sat::Solvable::kind(); } - - bool isKind( const ResKind & kind_r ) const - { return sat::Solvable::isKind( kind_r ); } - - template - bool isKind() const - { return sat::Solvable::isKind<_Res>(); } - - std::string name() const - { return sat::Solvable::name(); } - - Edition edition() const - { return sat::Solvable::edition(); } - - Arch arch() const - { return sat::Solvable::arch(); } - - /** Whether different versions of this package can be installed at the same time. - * Per default \c false. \see also \ref ZConfig::multiversion. - */ - bool multiversionInstall() const - { return sat::Solvable::multiversionInstall(); } - - /** \name Dependencies. */ - //@{ - /** Select by Dep. */ - Capabilities dep( Dep which_r ) const - { return operator[]( which_r ); } - - Capabilities operator[]( Dep which_r ) const - { return sat::Solvable::operator[]( which_r ); } - - Capabilities provides() const - { return sat::Solvable::provides(); } - - Capabilities requires() const - { return sat::Solvable::requires(); } - - Capabilities conflicts() const - { return sat::Solvable::conflicts(); } - - Capabilities obsoletes() const - { return sat::Solvable::obsoletes(); } - - Capabilities recommends() const - { return sat::Solvable::recommends(); } - - Capabilities suggests() const - { return sat::Solvable::suggests(); } - - Capabilities enhances() const - { return sat::Solvable::enhances(); } - - Capabilities supplements() const - { return sat::Solvable::supplements(); } - - Capabilities prerequires() const - { return sat::Solvable::prerequires(); } - - CapabilitySet providesNamespace( const std::string & namespace_r ) const - { return sat::Solvable::providesNamespace( namespace_r ); } - - CapabilitySet valuesOfNamespace( const std::string & namespace_r ) const - { return sat::Solvable::valuesOfNamespace( namespace_r ); } - //@} - - public: - /** Access the corresponding \ref sat:::Solvable. */ - const sat::Solvable & satSolvable() const { return *this; } - - /** Access the corresponding \ref PoolItem. */ - PoolItem poolItem() const; - - protected: - /** Ctor */ - Resolvable( const sat::Solvable & solvable_r ); - /** Dtor */ - virtual ~Resolvable(); - /** Helper for stream output */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Resolvable Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj ) - { return obj.dumpOn( str ); } - - /** \relates Resolvable More verbose stream output including dependencies */ - inline std::ostream & dumpOn( std::ostream & str, const Resolvable & obj ) - { return dumpOn( str, obj.satSolvable() ); } - - /** Test whether a Resolvable::Ptr is of a certain Kind. - * \return \c Ture iff \a p is not \c NULL and points to a Resolvable - * of the specified Kind. - * \relates Resolvable - * \code - * isKind(resPtr); - * \endcode - */ - template - inline bool isKind( const Resolvable::constPtr & p ) - { return p && p->kind() == ResTraits<_Res>::kind; } - - // Specialization for Resolvable: Always true. - template<> - inline bool isKind( const Resolvable::constPtr & p ) - { return !!p; } - - // Specialization for ResObject: Always true. - template<> - inline bool isKind( const Resolvable::constPtr & p ) - { return !!p; } - - - /** Convert Resolvable::Ptr into Ptr of a certain Kind. - * \return \c NULL iff \a p is \c NULL or points to a Resolvable - * not of the specified Kind. - * \relates Resolvable - * \code - * asKind(resPtr); - * \endcode - */ - template - inline typename ResTraits<_Res>::PtrType asKind( const Resolvable::Ptr & p ) - { return dynamic_pointer_cast<_Res>(p); } - - template - inline typename ResTraits<_Res>::constPtrType asKind( const Resolvable::constPtr & p ) - { return dynamic_pointer_cast(p); } - - /////////////////////////////////////////////////////////////////// - - /** \relates Resolvable Compare Resolvable::constPtr according to - * \a kind and \a name. - */ - inline int compareByN( const Resolvable::constPtr & lhs, - const Resolvable::constPtr & rhs ) - { - if ( lhs == rhs ) - return 0; - if ( ! (lhs && rhs) ) - return lhs ? 1 : -1; - int res = 0; - if ( (res = lhs->kind().compare( rhs->kind() )) ) - return res; - return lhs->name().compare( rhs->name() ); - } - - /** \relates Resolvable Compare Resolvable::constPtr according to - * \a kind, \a name and \a edition(compare!). - */ - inline int compareByNVR( const Resolvable::constPtr & lhs, - const Resolvable::constPtr & rhs ) - { - if ( lhs == rhs ) - return 0; - if ( ! (lhs && rhs) ) - return lhs ? 1 : -1; - int res = 0; - if ( (res = lhs->kind().compare( rhs->kind() )) ) - return res; - if ( (res = lhs->name().compare( rhs->name() )) ) - return res; - return lhs->edition().compare( rhs->edition() ); - } - - /** \relates Resolvable Compare Resolvable::constPtr according to - * \a kind, \a name, \a edition(compare!) and \a arch. - */ - inline int compareByNVRA( const Resolvable::constPtr & lhs, - const Resolvable::constPtr & rhs ) - { - if ( lhs == rhs ) - return 0; - if ( ! (lhs && rhs) ) - return lhs ? 1 : -1; - int res = 0; - if ( (res = lhs->kind().compare( rhs->kind() )) ) - return res; - if ( (res = lhs->name().compare( rhs->name() )) ) - return res; - if ( (res = lhs->edition().compare( rhs->edition() )) ) - return res; - return lhs->arch().compare( rhs->arch() ); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESOLVABLE_H diff --git a/libzypp/zypp/Resolver.cc b/libzypp/zypp/Resolver.cc deleted file mode 100644 index 1b7243a..0000000 --- a/libzypp/zypp/Resolver.cc +++ /dev/null @@ -1,151 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Resolver.cc - * -*/ -#include - -#include "zypp/Resolver.h" -#include "zypp/ZConfig.h" -#include "zypp/TriBool.h" -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/Testcase.h" -#include "zypp/sat/Transaction.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - using namespace solver; - - IMPL_PTR_TYPE(Resolver); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolver::Resolver - // METHOD TYPE : Ctor - // - Resolver::Resolver( const ResPool & pool ) - : _pimpl( new Impl(pool) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolver::~Resolver - // METHOD TYPE : Dtor - // - Resolver::~Resolver() - {} - - /////////////////////////////////////////////////////////////////// - // - // Resolver interface forwarded to implementation - // - /////////////////////////////////////////////////////////////////// - bool Resolver::verifySystem () - { return _pimpl->verifySystem(); } - - bool Resolver::resolvePool () - { return _pimpl->resolvePool(); } - - bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue ) - { return _pimpl->resolveQueue(queue); } - - void Resolver::undo() - { _pimpl->undo(); } - - ResolverProblemList Resolver::problems () - { return _pimpl->problems (); } - - void Resolver::applySolutions( const ProblemSolutionList & solutions ) - { _pimpl->applySolutions (solutions); } - - sat::Transaction Resolver::getTransaction() - { return _pimpl->getTransaction(); } - - bool Resolver::doUpgrade() - { return _pimpl->doUpgrade(); } - - void Resolver::doUpdate() - { _pimpl->doUpdate(); } - - void Resolver::setForceResolve( bool yesno_r ) { _pimpl->setForceResolve( yesno_r ); } - bool Resolver::forceResolve() const { return _pimpl->forceResolve(); } - - void Resolver::setIgnoreAlreadyRecommended( bool yesno_r) { _pimpl->setIgnoreAlreadyRecommended( yesno_r ); } - bool Resolver::ignoreAlreadyRecommended() const { return _pimpl->ignoreAlreadyRecommended(); } - - void Resolver::setOnlyRequires( bool yesno_r ) { _pimpl->setOnlyRequires( yesno_r ); } - void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); } - bool Resolver::onlyRequires() const { return _pimpl->onlyRequires(); } - - void Resolver::setUpgradeMode( bool yesno_r ) { return _pimpl->setUpgradeMode( yesno_r ); } - bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); } - - void Resolver::setAllowVendorChange( bool yesno_r ) { _pimpl->setAllowVendorChange( yesno_r ); } - void Resolver::setDefaultAllowVendorChange() { _pimpl->setAllowVendorChange( indeterminate ); } - bool Resolver::allowVendorChange() const { return _pimpl->allowVendorChange(); } - - void Resolver::setSystemVerification( bool yesno_r ) { _pimpl->setVerifyingMode( yesno_r ); } - void Resolver::setDefaultSystemVerification() { _pimpl->setVerifyingMode( indeterminate ); } - bool Resolver::systemVerification() const { return _pimpl->isVerifyingMode(); } - - void Resolver::setSolveSrcPackages( bool yesno_r ) { _pimpl->setSolveSrcPackages( yesno_r ); } - void Resolver::setDefaultSolveSrcPackages() { _pimpl->setSolveSrcPackages( indeterminate ); } - bool Resolver::solveSrcPackages() const { return _pimpl->solveSrcPackages(); } - - void Resolver::setCleandepsOnRemove( bool yesno_r ) { _pimpl->setCleandepsOnRemove( yesno_r ); } - void Resolver::setDefaultCleandepsOnRemove() { _pimpl->setCleandepsOnRemove( indeterminate ); } - bool Resolver::cleandepsOnRemove() const { return _pimpl->cleandepsOnRemove(); } - - void Resolver::addUpgradeRepo( Repository repo_r ) { _pimpl->addUpgradeRepo( repo_r ); } - bool Resolver::upgradingRepo( Repository repo_r ) const { return _pimpl->upgradingRepo( repo_r ); } - void Resolver::removeUpgradeRepo( Repository repo_r ) { _pimpl->removeUpgradeRepo( repo_r ); } - void Resolver::removeUpgradeRepos() { _pimpl->removeUpgradeRepos(); } - - void Resolver::addRequire( const Capability & capability ) { _pimpl->addExtraRequire( capability ); } - void Resolver::addConflict( const Capability & capability ) { _pimpl->addExtraConflict( capability ); } - void Resolver::removeRequire( const Capability & capability ) { _pimpl->removeExtraRequire( capability ); } - void Resolver::removeConflict( const Capability & capability ){ _pimpl->removeExtraConflict( capability ); } - - CapabilitySet Resolver::getRequire() const { return _pimpl->extraRequires(); } - CapabilitySet Resolver::getConflict() const { return _pimpl->extraConflicts(); } - - std::list Resolver::problematicUpdateItems() const - { return _pimpl->problematicUpdateItems(); } - - bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver ) - { - solver::detail::Testcase testcase (dumpPath); - return testcase.createTestcase(*_pimpl, true, runSolver); - } - - solver::detail::ItemCapKindList Resolver::isInstalledBy( const PoolItem & item ) - { return _pimpl->isInstalledBy (item); } - - solver::detail::ItemCapKindList Resolver::installs( const PoolItem & item ) - { return _pimpl->installs (item); } - - solver::detail::ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item ) - { return _pimpl->satifiedByInstalled (item); } - - solver::detail::ItemCapKindList Resolver::installedSatisfied( const PoolItem & item ) - { return _pimpl->installedSatisfied (item); } - - void Resolver::reset() - { _pimpl->reset( false ); /* Do not keep extra requires/conflicts */ } - - std::ostream & operator<<( std::ostream & str, const Resolver & obj ) - { return str << *obj._pimpl; } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Resolver.h b/libzypp/zypp/Resolver.h deleted file mode 100644 index 3ba8fdd..0000000 --- a/libzypp/zypp/Resolver.h +++ /dev/null @@ -1,396 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Resolver.h - * -*/ -#ifndef ZYPP_RESOLVER_H -#define ZYPP_RESOLVER_H - -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/ResPool.h" -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/SolverQueueItem.h" -#include "zypp/ProblemTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace sat - { - class Transaction; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Resolver - // - /** - * Dependency resolver interface. - * - * To resolve dependencies after making changes to the \ref ResPool (using - * \ref addRequire(), \ref addConflict(), \ref applySolutions(), or by making - * the changes directly on the \ref PoolItem status objects, - * call the \ref resolvePool() method. - */ - class Resolver : public base::ReferenceCounted, private base::NonCopyable - { - public: - - /** Ctor */ - Resolver( const ResPool & pool ); - /** Dtor */ - virtual ~Resolver(); - - /** - * Resolve package dependencies: - * - * Enter \ref systemVerification mode to monitor and repair dependencies - * of already installed packages, and solve immediately. - * - * Call \ref setSystemVerification to turn of this mode. - **/ - bool verifySystem(); - - - /** - * Resolve package dependencies: - * - * Try to execute all pending transactions (there may be more than - * one!). - * The solver collects all transactions (install/delete resolvables) - * from the pool, generates task, solving it and writes the - * results back to pool - * - * Returns "true" on success (i.e., if there were no problems that - * need user interaction) and "false" if there were problems. In - * the latter case, use problems() and later applySolutions() - * below. - **/ - bool resolvePool(); - - - /** - * Resolve package dependencies: - * - * The solver works off the given queue and writes back the solution - * to pool. - * - * Returns "true" on success (i.e., if there were no problems that - * need user interaction) and "false" if there were problems. In - * the latter case, use problems() and later applySolutions() - * below. - * The solution could be that the solver remove/add some entries - * in the task queue. So make a new call of resolveQueue after you - * have applied any solution AND check the parameter "queue" if - * there has been any changes by the solver and adapt these changes - * to e.g. the selectables. - * - **/ - bool resolveQueue( solver::detail::SolverQueueItemList & queue ); - - /* - * Undo solver changes done in resolvePool() - * Throwing away all ignored dependencies. - */ - void undo(); - - /* - * Resets solver information and verify option. - */ - void reset(); - - - /** - * Do an distribution upgrade - * - * Perform a distribution upgrade. This performs an update of - * all packages with a special resolver algorithm which takes - * care of package splits, pattern and product updates, - * etc. - * This call also turns the solver into \ref upgradeMode, so - * consecutive calls to \ref resolvePool performed in this - * mode too. Call \ref setUpgradeMode to turn this mode off. - * - * \see \ref addUpgradeRepo - **/ - bool doUpgrade(); - - /** - * Update to newest package - * - * Install the newest version of your installed packages as - * far as possible. This means a newer package will NOT be - * installed if it generates dependency problems. - * So the user will not get an error message. - * - **/ - void doUpdate( ); - - /** - * Unmaintained packages which does not fit to - * the updated system (broken dependencies) will be - * deleted. - * Return the list of deleted items. - * Note : This list is valid after the call doUpgrade() only. - **/ - std::list problematicUpdateItems() const; - - /** - * Return the dependency problems found by the last call to - * resolveDependencies(). If there were no problems, the returned - * list will be empty. - **/ - ResolverProblemList problems(); - - - /** - * Apply problem solutions. No more than one solution per problem - * can be applied. - **/ - void applySolutions( const ProblemSolutionList & solutions ); - - /** - * Return the \ref Transaction computed by the last solver run. - */ - sat::Transaction getTransaction(); - - /** - * Remove resolvables which are conflicts with others or - * have unfulfilled requirements. - * This behaviour is favourited by ZMD. - **/ - void setForceResolve( bool force ); - bool forceResolve() const; - - /** - * Ignore recommended packages that were already recommended by - * the installed packages - **/ - void setIgnoreAlreadyRecommended( bool yesno_r ); - bool ignoreAlreadyRecommended() const; - - /** - * Setting whether required packages are installed ONLY - * So recommended packages, language packages and packages which depend - * on hardware (modalias) will not be regarded. - **/ - void setOnlyRequires( bool yesno_r ); - void resetOnlyRequires(); // set back to default (described in zypp.conf) - bool onlyRequires() const; - - /** - * Setting whether the solver should perform in 'upgrade' mode or - * not. - * \see \ref doUpgrade. - */ - void setUpgradeMode( bool yesno_r ); - bool upgradeMode() const; - - /** - * Setting whether the solver should allow or disallow vendor changes. - * - * If OFF (the default) the solver will replace packages with packages - * of the same (or equivalent) vendor ony. - * - * \see \ref VendorAttr for definition of vendor equivalence. - **/ - void setAllowVendorChange( bool yesno_r ); - void setDefaultAllowVendorChange(); // set back to default (in zypp.conf) - bool allowVendorChange() const; - - /** - * System verification mode also monitors and repairs dependencies - * of already installed packages. - * \see \ref verifySystem - */ - void setSystemVerification( bool yesno_r ); - void setDefaultSystemVerification(); - bool systemVerification() const; - - /** - * Set whether to solve source packages build dependencies per default. - * Usually turned off and if, enabled per source package. - * \NOTE This affects only source packges selected in the \ref ResPool. No solver rule - * will be generated for them. Source packages requested via e.g. \ref addRequire will - * always be solved. - * \NOTE Be carefull. The older the source package is, the stranger may be the - * result of solving it's build dependencies. - */ - void setSolveSrcPackages( bool yesno_r ); - void setDefaultSolveSrcPackages(); - bool solveSrcPackages() const; - - /** - * Cleanup when deleting packages. Whether the solver should per default - * try to remove packages exclusively required by the ones he's asked to delete. - */ - void setCleandepsOnRemove( bool yesno_r ); - void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf) - bool cleandepsOnRemove() const; - - /** \name Upgrade to content of a specific repository. - * \note This is an ordinary solver request. You should simply - * \ref resolvePool to execute, and not \ref doUpgrade. - */ - //@{ - /** - * Adding request to perform a dist upgrade restricted to this repository. - * - * This is what e.g. zypper dup --repo myrepo should perform. - * \see \ref doUpgrade - */ - void addUpgradeRepo( Repository repo_r ); - - /** - * Whether there is an \c UpgradeRepo request pending for this repo. - */ - bool upgradingRepo( Repository repo_r ) const; - - /** - * Remove an upgrade request for this repo. - */ - void removeUpgradeRepo( Repository repo_r ); - - /** - * Remove all upgrade repo requests. - */ - void removeUpgradeRepos(); - //@} - - /** - * Adding additional requirement - * - */ - void addRequire( const Capability & capability ); - - /** - * Adding additional conflict - * - */ - void addConflict( const Capability & capability ); - - /** - * Remove the additional requirement set by \ref addRequire(Capability). - * - */ - void removeRequire( const Capability & capability ); - - /** - * Remove the additional conflict set by \ref addConflict(Capability). - * - */ - void removeConflict( const Capability & capability ); - - /** - * Get all the additional requirements set by \ref addRequire(Capability). - * - */ - CapabilitySet getRequire() const; - - /** - * Get all the additional conflicts set by \ref addConflict(Capability). - * - */ - CapabilitySet getConflict() const; - - /** - * Generates a solver Testcase of the current state - * - * \parame dumpPath destination directory of the created directory - * \return true if it was successful - */ - bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true ); - - /** - * Gives information about WHO has pused an installation of an given item. - * - * \param item Evaluate additional information for this resolvable. - * \return A list of structures which contains: - * item Item which has triggered the installation of the given param item. - * initialInstallation This item has triggered the installation - * Not already fullfilled requierement only. - * cap Capability which has triggerd this installation - * capKind Kind of that capability (e.g. Dep::REQUIRES,Dep::RECOMMENDS,... ) - * - * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid. - * - */ - solver::detail::ItemCapKindList isInstalledBy( const PoolItem & item ); - - /** - * Gives information about WHICH additional items will be installed due the installation of an item. - * - * \param item Evaluate additional information for this resolvable. - * \return A list of structures which contains: - * item Item which has triggered the installation of the given param item. - * initialInstallation This item has triggered the installation - * Not already fullfilled requierement only. - * cap Capability which has triggerd this installation - * capKind Kind of that capability (e.g. Dep::REQUIRES,Dep::RECOMMENDS,... ) - * - * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid. - * - */ - solver::detail::ItemCapKindList installs( const PoolItem & item ); - - /** - * Gives information about WHICH installed items are requested by the installation of an item. - * - * \param item Evaluate additional information for this resolvable. - * \return A list of structures which contains: - * item Item which has triggered the installation of the given param item. - * initialInstallation This item has triggered the installation - * Not already fullfilled requierement only. - * cap Capability which has triggerd this installation - * capKind Kind of that capability (e.g. Dep::REQUIRES,Dep::RECOMMENDS,... ) - * - * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid. - * - */ - solver::detail::ItemCapKindList satifiedByInstalled( const PoolItem & item ); - - - /** - * Gives information about WHICH items require an already installed item. - * - * \param item Evaluate additional information for this resolvable. - * \return A list of structures which contains: - * item Item which has triggered the installation of the given param item. - * initialInstallation This item has triggered the installation - * Not already fullfilled requierement only. - * cap Capability which has triggerd this installation - * capKind Kind of that capability (e.g. Dep::REQUIRES,Dep::RECOMMENDS,... ) - * - * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid. - * - */ - solver::detail::ItemCapKindList installedSatisfied( const PoolItem & item ); - - - private: - friend std::ostream & operator<<( std::ostream & str, const Resolver & obj ); - - typedef solver::detail::Resolver Impl; - zypp::RW_pointer > _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Resolver Stream output */ - std::ostream & operator<<( std::ostream & str, const Resolver & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_RESOLVER_H diff --git a/libzypp/zypp/ResolverProblem.cc b/libzypp/zypp/ResolverProblem.cc deleted file mode 100644 index 4c86f13..0000000 --- a/libzypp/zypp/ResolverProblem.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ResolverProblem.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "zypp/ResolverProblem.h" -#include "zypp/ProblemSolution.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ResolverProblem); - -//--------------------------------------------------------------------------- - -ostream& -operator<<( ostream& os, const ResolverProblem & problem) -{ - os << "Problem:" << endl; - os << "==============================" << endl; - os << problem._description << endl; - os << problem._details << endl; - os << "------------------------------" << endl; - os << problem._solutions; - os << "==============================" << endl; - return os; -} - - -ostream& -operator<<( ostream& os, const ResolverProblemList & problemlist) -{ - for (ResolverProblemList::const_iterator iter = problemlist.begin(); iter != problemlist.end(); ++iter) { - if (iter != problemlist.begin()) - os << ", "; - os << (*iter); - } - return os; -} - -//--------------------------------------------------------------------------- - -/** - * Constructor. - **/ -ResolverProblem::ResolverProblem( const string & description, const string & details ) - : _description (description) - , _details (details) -{ -} - -/** - * Destructor. - **/ -ResolverProblem::~ResolverProblem() -{ -} - -/** - * Return the possible solutions to this problem. - * All problems should have at least 2-3 (mutually exclusive) solutions: - * - * - Undo: Do not perform the offending transaction - * (do not install the package that had unsatisfied requirements, - * do not remove the package that would break other packages' requirements) - * - * - Remove referrers: Remove all packages that would break because - * they depend on the package that is requested to be removed - * - * - Ignore: Inject artificial "provides" for a missing requirement - * (pretend that requirement is satisfied) - **/ - -ProblemSolutionList -ResolverProblem::solutions() const -{ - return _solutions; -} - -/** - * Add a solution to this problem. This class takes over ownership of - * the problem and will delete it when neccessary. - **/ - -void -ResolverProblem::addSolution( ProblemSolution_Ptr solution, - bool inFront ) -{ - if (inFront) { - _solutions.push_front (solution); - } else { - _solutions.push_back (solution); - } -} - -void -ResolverProblem::clear() -{ - _solutions.clear(); -} - - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ResolverProblem.h b/libzypp/zypp/ResolverProblem.h deleted file mode 100644 index 92f52ad..0000000 --- a/libzypp/zypp/ResolverProblem.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Author: Stefan Hundhammer - * - **/ - -#ifndef ZYPP_RESOLVERPROBLEM_H -#define ZYPP_RESOLVERPROBLEM_H - -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/ProblemSolution.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - - class ResolverProblem : public base::ReferenceCounted - { - private: - - /** - * Clear all data. - * In particular, delete all members of _solutions. - **/ - void clear(); - - - // - // Data members - // - - Resolver_constPtr _resolver; - std::string _description; - std::string _details; - ProblemSolutionList _solutions; - - public: - - /** - * Constructor. - **/ - ResolverProblem( const std::string & description, const std::string & details ); - - /** - * Destructor. - **/ - ~ResolverProblem(); - - // ---------------------------------- I/O - - friend std::ostream& operator<<(std::ostream&, const ResolverProblem & problem); - - // ---------------------------------- accessors - - /** - * Return a one-line description of the problem. - **/ - std::string description() const { return _description; } - - /** - * Return a (possibly muti-line) detailed description of the problem - * or an empty string if there are no useful details. - **/ - std::string details() const { return _details; } - - /** - * Set description of the problem. - **/ - void setDescription(const std::string & description) - { _description=description; } - - /** - * Set detail description of the problem. - **/ - void setDetails(const std::string & detail) - { _details=detail; } - - /** - * Return the possible solutions to this problem. - * All problems should have at least 2-3 (mutually exclusive) solutions: - * - * - Undo: Do not perform the offending transaction - * (do not install the package that had unsatisfied requirements, - * do not remove the package that would break other packages' requirements) - * - * - Remove referrers: Remove all packages that would break because - * they depend on the package that is requested to be removed - * - * - Ignore: Inject artificial "provides" for a missing requirement - * (pretend that requirement is satisfied) - **/ - ProblemSolutionList solutions() const; - - /** - * Return the parent dependency resolver. - **/ - Resolver_constPtr resolver() const { return _resolver; } - - // ---------------------------------- methods - - /** - * Add a solution to this problem. This class takes over ownership of - * the problem and will delete it when neccessary. - **/ - void addSolution( ProblemSolution_Ptr solution, bool inFront = false ); - - }; - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_RESOLVERPROBLEM_H - diff --git a/libzypp/zypp/ServiceInfo.cc b/libzypp/zypp/ServiceInfo.cc deleted file mode 100644 index 470396c..0000000 --- a/libzypp/zypp/ServiceInfo.cc +++ /dev/null @@ -1,238 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ServiceInfo.cc - * - */ -#include -#include - -#include "zypp/base/String.h" -#include "zypp/parser/xml/XmlEscape.h" - -#include "zypp/RepoInfo.h" -#include "zypp/ServiceInfo.h" - -using namespace std; -using zypp::xml::escape; - -/////////////////////////////////////////////////////////////////////////////// -namespace zypp -{////////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ServiceInfo::Impl - // - struct ServiceInfo::Impl - { - typedef ServiceInfo::ReposToEnable ReposToEnable; - typedef ServiceInfo::ReposToDisable ReposToDisable; - - public: - Url url; - repo::ServiceType type; - ReposToEnable reposToEnable; - ReposToDisable reposToDisable; - RepoStates repoStates; - - - public: - Impl() - : type(repo::ServiceType::NONE_e) - {} - - Impl(const Url & url_) - : url(url_) - , type(repo::ServiceType::NONE_e) - {} - - ~Impl() - {} - - void setProbedType( const repo::ServiceType & t ) const - { - if ( type == repo::ServiceType::NONE - && t != repo::ServiceType::NONE ) - { - // lazy init! - const_cast(this)->type = t; - } - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ServiceInfo::Impl - // - /////////////////////////////////////////////////////////////////// - - const ServiceInfo ServiceInfo::noService; - - ServiceInfo::ServiceInfo() : _pimpl( new Impl() ) {} - - ServiceInfo::ServiceInfo(const string & alias) - : repo::RepoInfoBase(alias), _pimpl( new Impl() ) - {} - - ServiceInfo::ServiceInfo(const string & alias, const Url & url) - : repo::RepoInfoBase(alias), _pimpl( new Impl(url) ) - {} - - ServiceInfo::~ServiceInfo() - {} - - Url ServiceInfo::url() const { return _pimpl->url; } - void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; } - - repo::ServiceType ServiceInfo::type() const - { return _pimpl->type; } - void ServiceInfo::setType( const repo::ServiceType & type ) - { _pimpl->type = type; } - - void ServiceInfo::setProbedType( const repo::ServiceType &t ) const - { _pimpl->setProbedType( t ); } - - bool ServiceInfo::reposToEnableEmpty() const - { return _pimpl->reposToEnable.empty(); } - - ServiceInfo::ReposToEnable::size_type ServiceInfo::reposToEnableSize() const - { return _pimpl->reposToEnable.size(); } - - ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableBegin() const - { return _pimpl->reposToEnable.begin(); } - - ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableEnd() const - { return _pimpl->reposToEnable.end(); } - - bool ServiceInfo::repoToEnableFind( const std::string & alias_r ) const - { return( _pimpl->reposToEnable.find( alias_r ) != _pimpl->reposToEnable.end() ); } - - void ServiceInfo::addRepoToEnable( const std::string & alias_r ) - { - _pimpl->reposToEnable.insert( alias_r ); - _pimpl->reposToDisable.erase( alias_r ); - } - - void ServiceInfo::delRepoToEnable( const std::string & alias_r ) - { _pimpl->reposToEnable.erase( alias_r ); } - - void ServiceInfo::clearReposToEnable() - { _pimpl->reposToEnable.clear(); } - - - bool ServiceInfo::reposToDisableEmpty() const - { return _pimpl->reposToDisable.empty(); } - - ServiceInfo::ReposToDisable::size_type ServiceInfo::reposToDisableSize() const - { return _pimpl->reposToDisable.size(); } - - ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableBegin() const - { return _pimpl->reposToDisable.begin(); } - - ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableEnd() const - { return _pimpl->reposToDisable.end(); } - - bool ServiceInfo::repoToDisableFind( const std::string & alias_r ) const - { return( _pimpl->reposToDisable.find( alias_r ) != _pimpl->reposToDisable.end() ); } - - void ServiceInfo::addRepoToDisable( const std::string & alias_r ) - { - _pimpl->reposToDisable.insert( alias_r ); - _pimpl->reposToEnable.erase( alias_r ); - } - - void ServiceInfo::delRepoToDisable( const std::string & alias_r ) - { _pimpl->reposToDisable.erase( alias_r ); } - - void ServiceInfo::clearReposToDisable() - { _pimpl->reposToDisable.clear(); } - - const ServiceInfo::RepoStates & ServiceInfo::repoStates() const - { return _pimpl->repoStates; } - - void ServiceInfo::setRepoStates( RepoStates newStates_r ) - { swap( _pimpl->repoStates, newStates_r ); } - - std::ostream & operator<<( std::ostream & str, const ServiceInfo::RepoState & obj ) - { - return str - << "enabled=" << obj.enabled << " " - << "autorefresh=" << obj.autorefresh << " " - << "priority=" << obj.priority; - } - - std::ostream & ServiceInfo::dumpAsIniOn( std::ostream & str ) const - { - RepoInfoBase::dumpAsIniOn(str) - << "url = " << url() << endl - << "type = " << type() << endl; - - if ( ! repoStates().empty() ) - { - unsigned cnt = 0U; - for ( const auto & el : repoStates() ) - { - std::string tag( "repo_" ); - tag += str::numstring( ++cnt ); - const RepoState & state( el.second ); - - str << tag << "=" << el.first << endl - << tag << "_enabled=" << state.enabled << endl - << tag << "_autorefresh=" << state.autorefresh << endl; - if ( state.priority != RepoInfo::defaultPriority() ) - str - << tag << "_priority=" << state.priority << endl; - } - } - - if ( ! reposToEnableEmpty() ) - str << "repostoenable = " << str::joinEscaped( reposToEnableBegin(), reposToEnableEnd() ) << endl; - if ( ! reposToDisableEmpty() ) - str << "repostodisable = " << str::joinEscaped( reposToDisableBegin(), reposToDisableEnd() ) << endl; - return str; - } - - ostream & ServiceInfo::dumpAsXmlOn( ostream & str, const string & content ) const - { - str - << "" << endl; - else - str << ">" << endl << content << "" << endl; - - return str; - } - - - std::ostream & operator<<( std::ostream& str, const ServiceInfo &obj ) - { - return obj.dumpAsIniOn(str); - } - - -/////////////////////////////////////////////////////////////////////////////// -} //namespace zypp -/////////////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ServiceInfo.h b/libzypp/zypp/ServiceInfo.h deleted file mode 100644 index d40ad8a..0000000 --- a/libzypp/zypp/ServiceInfo.h +++ /dev/null @@ -1,215 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ServiceInfo.h - * - */ -#ifndef ZYPP_SERVICE_H -#define ZYPP_SERVICE_H - -#include -#include - -#include "zypp/Url.h" - -#include "zypp/repo/ServiceType.h" -#include "zypp/RepoInfo.h" - - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ServiceInfo - // - /** */ - class ServiceInfo : public repo::RepoInfoBase - { - public: - /** Default ctor creates \ref noService.*/ - ServiceInfo(); - - /** - * Creates ServiceInfo with specified alias. - * - * \param alias unique short name of service - */ - ServiceInfo( const std::string & alias ); - - /** - * ServiceInfo with alias and its URL - * - * \param alias unique shortname of service - * \param url url to service - */ - ServiceInfo( const std::string & alias, const Url& url ); - - virtual ~ServiceInfo(); - - public: - /** Represents an empty service. */ - static const ServiceInfo noService; - - public: - - /** - * Gets url to service - * - * \return url to service - */ - Url url() const; - - /** - * Sets url for this service - * - * \param url url to this service - */ - void setUrl( const Url& url ); - - /** - * - */ - repo::ServiceType type() const; - - /** - * Set service type. - * - * \param type the new type - */ - void setType( const repo::ServiceType & type ); - - void setProbedType( const repo::ServiceType & t ) const; - - - /** \name Set of repos (repository aliases) to enable on next refresh. - * - * Per default new repositories are created in disabled state. But repositories - * mentioned here will be created in enabled state on the next refresh. - * Afterwards they get removed from the list. - */ - //@{ - /** Container of repos. */ - typedef std::set ReposToEnable; - bool reposToEnableEmpty() const; - ReposToEnable::size_type reposToEnableSize() const; - ReposToEnable::const_iterator reposToEnableBegin() const; - ReposToEnable::const_iterator reposToEnableEnd() const; - - /** Whether \c alias_r is mentioned in ReposToEnable. */ - bool repoToEnableFind( const std::string & alias_r ) const; - - /** Add \c alias_r to the set of ReposToEnable. */ - void addRepoToEnable( const std::string & alias_r ); - /** Remove \c alias_r from the set of ReposToEnable. */ - void delRepoToEnable( const std::string & alias_r ); - /** Clear the set of ReposToEnable. */ - void clearReposToEnable(); - //@} - - /** \name Set of repos (repository aliases) to disable on next refresh. - * - * Repositories mentioned here will be disabled on the next refresh, in case they - * still exist. Afterwards they get removed from the list. - */ - //@{ - /** Container of repos. */ - typedef std::set ReposToDisable; - bool reposToDisableEmpty() const; - ReposToDisable::size_type reposToDisableSize() const; - ReposToDisable::const_iterator reposToDisableBegin() const; - ReposToDisable::const_iterator reposToDisableEnd() const; - - /** Whether \c alias_r is mentioned in ReposToDisable. */ - bool repoToDisableFind( const std::string & alias_r ) const; - - /** Add \c alias_r to the set of ReposToDisable. */ - void addRepoToDisable( const std::string & alias_r ); - /** Remove \c alias_r from the set of ReposToDisable. */ - void delRepoToDisable( const std::string & alias_r ); - /** Clear the set of ReposToDisable. */ - void clearReposToDisable(); - //@} - - /** \name The original repo state as defined by the repoindex.xml upon last refresh. - * - * This state is remembered to detect any user modifications applied to the repos. - * It may not be available for all repos or in plugin services. In this case all - * changes requested by a service refresh are applied unconditionally. - */ - //@{ - struct RepoState - { - bool enabled; - bool autorefresh; - unsigned priority; - - RepoState() - : enabled( false ), autorefresh( true ), priority( RepoInfo::defaultPriority() ) - {} - RepoState( const RepoInfo & repo_r ) - : enabled( repo_r.enabled() ), autorefresh( repo_r.autorefresh() ), priority( repo_r.priority() ) - {} - bool operator==( const RepoState & rhs ) const - { return( enabled==rhs.enabled && autorefresh==rhs.autorefresh && priority==rhs.priority ); } - bool operator!=( const RepoState & rhs ) const - { return ! operator==( rhs ); } - friend std::ostream & operator<<( std::ostream & str, const RepoState & obj ); - }; - typedef std::map RepoStates; - - /** Access the remembered repository states. */ - const RepoStates & repoStates() const; - - /** Remember a new set of repository states. */ - void setRepoStates( RepoStates newStates_r ); - //@} - - public: - /** - * Writes ServiceInfo to stream in ".service" format - * - * \param str stream where serialized version service is written - */ - virtual std::ostream & dumpAsIniOn( std::ostream & str ) const; - - /** - * Write an XML representation of this ServiceInfo object. - * - * \param str - * \param content if not empty, produces content - * otherwise - */ - virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const; - - /** \deprecated Use camel cased dumpAsXmlOn */ - ZYPP_DEPRECATED std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content = "" ) const { return dumpAsXmlOn( str, content ); } - - class Impl; - - private: - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ServiceInfo */ - typedef shared_ptr ServiceInfo_Ptr; - /** \relates ServiceInfo */ - typedef shared_ptr ServiceInfo_constPtr; - /** \relates ServiceInfo */ - typedef std::list ServiceInfoList; - - /** \relates ServiceInfo Stream output */ - std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj ); - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_REPOSITORY_H diff --git a/libzypp/zypp/Signature.cc b/libzypp/zypp/Signature.cc deleted file mode 100644 index f5d1a11..0000000 --- a/libzypp/zypp/Signature.cc +++ /dev/null @@ -1,30 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include -#include "zypp/Signature.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - Signature::Signature() - { - - } - - std::ostream & Signature::dumpOn( std::ostream & str ) const - { - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Signature.h b/libzypp/zypp/Signature.h deleted file mode 100644 index a3d00fb..0000000 --- a/libzypp/zypp/Signature.h +++ /dev/null @@ -1,37 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - - -#ifndef ZYPP_Signature_H -#define ZYPP_Signature_H - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class Signature - { - public: - Signature(); - ~Signature(); - - /** Overload to realize stream output. */ - std::ostream & dumpOn( std::ostream & str ) const; - - private: - }; - - /** \relates Signature Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Signature & obj ) - { return obj.dumpOn( str ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_Signature_H diff --git a/libzypp/zypp/SrcPackage.cc b/libzypp/zypp/SrcPackage.cc deleted file mode 100644 index dacb48f..0000000 --- a/libzypp/zypp/SrcPackage.cc +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/SrcPackage.cc - * -*/ -#include "zypp/SrcPackage.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(SrcPackage); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SrcPackage::SrcPackage - // METHOD TYPE : Ctor - // - SrcPackage::SrcPackage( const sat::Solvable & solvable_r ) - : ResObject( solvable_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SrcPackage::~SrcPackage - // METHOD TYPE : Dtor - // - SrcPackage::~SrcPackage() - {} - - /////////////////////////////////////////////////////////////////// - // - // SrcPackage interface forwarded to implementation - // - /////////////////////////////////////////////////////////////////// - - std::string SrcPackage::sourcePkgType() const - { return lookupStrAttribute( sat::SolvAttr::arch ); } - - OnMediaLocation SrcPackage::location() const - { return lookupLocation(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/SrcPackage.h b/libzypp/zypp/SrcPackage.h deleted file mode 100644 index 01d8861..0000000 --- a/libzypp/zypp/SrcPackage.h +++ /dev/null @@ -1,57 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/SrcPackage.h - * -*/ -#ifndef ZYPP_SRCPACKAGE_H -#define ZYPP_SRCPACKAGE_H - -#include "zypp/ResObject.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - DEFINE_PTR_TYPE(SrcPackage); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SrcPackage - // - /** SrcPackage interface. - */ - class SrcPackage : public ResObject - { - - public: - typedef SrcPackage Self; - typedef ResTraits TraitsType; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - /** The type of the source rpm ("src" or "nosrc"). */ - std::string sourcePkgType() const; - - /** location of resolvable in repo */ - OnMediaLocation location() const; - - protected: - friend Ptr make( const sat::Solvable & solvable_r ); - /** Ctor */ - SrcPackage( const sat::Solvable & solvable_r ); - /** Dtor */ - virtual ~SrcPackage(); - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SRCPACKAGE_H diff --git a/libzypp/zypp/SysContent.cc b/libzypp/zypp/SysContent.cc deleted file mode 100644 index 3e33bdc..0000000 --- a/libzypp/zypp/SysContent.cc +++ /dev/null @@ -1,457 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/SysContent.cc - * -*/ -#include -#include "zypp/base/Logger.h" - -#include "zypp/SysContent.h" -#include "zypp/parser/xml/Reader.h" -#include "zypp/parser/xml/ParseDef.h" -#include "zypp/parser/xml/ParseDefConsume.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace syscontent - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace // Writer helpers - { ///////////////////////////////////////////////////////////////// - - /** writeXml helper. - * \return tag="value" if value not empty, else - * an empty string. - */ - inline std::string attrIf( const std::string & tag_r, - const std::string & value_r ) - { - std::string ret; - if ( ! value_r.empty() ) - { - ret += " "; - ret += tag_r; - ret += "=\""; - ret += value_r; - ret += "\""; - } - return ret; - } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Writer::Impl - // - /** \see Writer */ - class Writer::Impl - { - public: - std::ostream & writeXml( std::ostream & str ) const; - - public: - std::string _name; - Edition _edition; - std::string _description; - StorageT _onsys; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Writer::Impl::writeXml - // METHOD TYPE : std::ostream & - // - std::ostream & Writer::Impl::writeXml( std::ostream & str ) const - { - // intro - str << "\n"; - str << "\n"; - // ident data - str << " \n"; - str << " " << _name << "\n"; - str << " \n"; - str << " " << _description << "\n"; - str << " " << Date::now().asSeconds() << "\n"; - str << " \n"; - // ResObjects - str << " \n"; - for ( iterator it = _onsys.begin(); it != _onsys.end(); ++it ) - { - str << " kind().asString() ) - << attrIf( "name", (*it)->name() ) - << attrIf( "epoch", str::numstring((*it)->edition().epoch()) ) - << attrIf( "ver", (*it)->edition().version() ) - << attrIf( "rel", (*it)->edition().release() ) - << attrIf( "arch", (*it)->arch().asString() ) - << "/>\n"; - } - str << " \n"; - // extro - str << "" << endl; - return str; - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Writer - // - /////////////////////////////////////////////////////////////////// - - Writer::Writer() - : _pimpl( Impl::nullimpl() ) - {} - - const std::string & Writer::name() const - { return _pimpl->_name; } - - Writer & Writer::name( const std::string & val_r ) - { _pimpl->_name = val_r; return *this; } - - const Edition & Writer::edition() const - { return _pimpl->_edition; } - - Writer & Writer::edition( const Edition & val_r ) - { _pimpl->_edition = val_r; return *this; } - - const std::string & Writer::description() const - { return _pimpl->_description; } - - Writer & Writer::description( const std::string & val_r ) - { _pimpl->_description = val_r; return *this; } - - void Writer::addInstalled( const PoolItem & obj_r ) - { - if ( obj_r.status().isInstalled() ) - { - _pimpl->_onsys.insert( obj_r.resolvable() ); - } - } - - void Writer::addIf( const PoolItem & obj_r ) - { - if ( obj_r.status().isInstalled() != obj_r.status().transacts() - && ! ( obj_r.status().transacts() && obj_r.status().isBySolver() ) ) - { - _pimpl->_onsys.insert( obj_r.resolvable() ); - } - } - - void Writer::add( const ResObject::constPtr & obj_r ) - { _pimpl->_onsys.insert( obj_r ); } - - bool Writer::empty() const - { return _pimpl->_onsys.empty(); } - - Writer::size_type Writer::size() const - { return _pimpl->_onsys.size(); } - - Writer::const_iterator Writer::begin() const - { return _pimpl->_onsys.begin(); } - - Writer::const_iterator Writer::end() const - { return _pimpl->_onsys.end(); } - - std::ostream & Writer::writeXml( std::ostream & str ) const - { return _pimpl->writeXml( str ); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader::Entry::Impl - // - class Reader::Entry::Impl - { - public: - std::string _kind; - std::string _name; - Edition _edition; - Arch _arch; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader::Entry - // - /////////////////////////////////////////////////////////////////// - - Reader::Entry::Entry() - : _pimpl( new Impl ) - {} - - Reader::Entry::Entry( const shared_ptr & pimpl_r ) - : _pimpl( pimpl_r ) - {} - - const std::string & Reader::Entry::kind() const - { return _pimpl->_kind; } - - const std::string & Reader::Entry::name() const - { return _pimpl->_name; } - - const Edition & Reader::Entry::edition() const - { return _pimpl->_edition; } - - const Arch & Reader::Entry::arch() const - { return _pimpl->_arch; } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader::Impl - // - /** \see Reader */ - class Reader::Impl - { - public: - Impl() - {} - - Impl( std::istream & input_r ); - - public: - std::string _name; - Edition _edition; - std::string _description; - Date _created; - - std::list _content; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace // Reader helpers - { ///////////////////////////////////////////////////////////////// - - using namespace xml; - - /** Sycontent xml node structure. */ - struct SycontentNode : public ParseDef - { - SycontentNode( Mode mode_r ) - : ParseDef( "syscontent", mode_r ) - { - (*this)("ident", OPTIONAL) - ("onsys", OPTIONAL) - ; - - (*this)["ident"] - ("name", OPTIONAL) - ("version", OPTIONAL) - ("description", OPTIONAL) - ("created", OPTIONAL) - ; - - (*this)["onsys"] - ("entry", MULTIPLE_OPTIONAL) - ; - } - }; - - /** Parse Edition from ver/rel/eopch attributes. */ - struct ConsumeEdition : public ParseDefConsume - { - ConsumeEdition( Edition & value_r ) - : _value( & value_r ) - {} - - virtual void start( const Node & node_r ) - { - *_value = Edition( node_r.getAttribute("ver").asString(), - node_r.getAttribute("rel").asString(), - node_r.getAttribute("epoch").asString() ); - } - - Edition *_value; - }; - - /** Parse std::string from node value. */ - struct ConsumeString : public ParseDefConsume - { - ConsumeString( std::string & value_r ) - : _value( & value_r ) - {} - - virtual void text( const Node & node_r ) - { - *_value = node_r.value().asString(); - } - - std::string *_value; - }; - - /** Parse Date from node value. */ - struct ConsumeDate : public ParseDefConsume - { - ConsumeDate( Date & value_r ) - : _value( & value_r ) - {} - - virtual void text( const Node & node_r ) - { - *_value = Date(node_r.value().asString()); - } - - Date *_value; - }; - - /** Parse entry list. */ - struct ConsumeEntries : public ParseDefConsume - { - ConsumeEntries( std::list & value_r ) - : _value( & value_r ) - {} - - virtual void start( const Node & node_r ) - { - shared_ptr centry( new Reader::Entry::Impl ); - - centry->_kind = node_r.getAttribute("kind").asString(); - centry->_name = node_r.getAttribute("name").asString(); - centry->_edition = Edition( node_r.getAttribute("ver").asString(), - node_r.getAttribute("rel").asString(), - node_r.getAttribute("epoch").asString() ); - centry->_arch = Arch( node_r.getAttribute("arch").asString() ); - - _value->push_back( Reader::Entry( centry ) ); - } - - std::list *_value; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::Impl::Impl - // METHOD TYPE : Constructor - // - Reader::Impl::Impl( std::istream & input_r ) - { - xml::Reader reader( input_r ); - SycontentNode rootNode( xml::ParseDef::MANDTAORY ); - - rootNode["ident"]["name"].setConsumer - ( new ConsumeString( _name ) ); - - rootNode["ident"]["version"].setConsumer - ( new ConsumeEdition( _edition ) ); - - rootNode["ident"]["description"].setConsumer - ( new ConsumeString( _description ) ); - - rootNode["ident"]["created"].setConsumer - ( new ConsumeDate( _created ) ); - - rootNode["onsys"]["entry"].setConsumer - ( new ConsumeEntries( _content ) ); - - // parse - rootNode.take( reader ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader - // - /////////////////////////////////////////////////////////////////// - - Reader::Reader() - : _pimpl( Impl::nullimpl() ) - {} - - Reader::Reader( std::istream & input_r ) - : _pimpl( new Impl( input_r ) ) - {} - - const std::string & Reader::name() const - { return _pimpl->_name; } - - const Edition & Reader::edition() const - { return _pimpl->_edition; } - - const std::string & Reader::description() const - { return _pimpl->_description; } - - const Date & Reader::ctime() const - { return _pimpl->_created; } - - bool Reader::empty() const - { return _pimpl->_content.empty(); } - - Reader::size_type Reader::size() const - { return _pimpl->_content.size(); } - - Reader::const_iterator Reader::begin() const - { return _pimpl->_content.begin(); } - - Reader::const_iterator Reader::end() const - { return _pimpl->_content.end(); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : inline std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const Reader & obj ) - { - return str << "syscontent(" << obj.name() << "-" << obj.edition() - << ", " << obj.size() << " entries" - << ", created " << obj.ctime() - << ")"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace syscontent - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/SysContent.h b/libzypp/zypp/SysContent.h deleted file mode 100644 index d95616d..0000000 --- a/libzypp/zypp/SysContent.h +++ /dev/null @@ -1,256 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/SysContent.h - * -*/ -#ifndef ZYPP_SYSCONTENT_H -#define ZYPP_SYSCONTENT_H - -#include -#include -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/PoolItem.h" -#include "zypp/Edition.h" -#include "zypp/Date.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace syscontent - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Writer - // - /** Collect and serialize a set of \ref ResObject. - * \code - * - * - * - * mycollection - * - * All the cool stuff... - * 1165270942 - * - * - * - * - * - * - * \endcode - * \see Reader - */ - class Writer - { - typedef std::set StorageT; - public: - typedef StorageT::value_type value_type; - typedef StorageT::size_type size_type; - typedef StorageT::iterator iterator; - typedef StorageT::const_iterator const_iterator; - - public: - /** Default Ctor. */ - Writer(); - - public: - /** \name Identification. - * User provided optional data to identify the collection. - */ - //@{ - /** Get name. */ - const std::string & name() const; - - /** Set name. */ - Writer & name( const std::string & val_r ); - - /** Get edition. */ - const Edition & edition() const; - - /** Set edition. */ - Writer & edition( const Edition & val_r ); - - /** Get description. */ - const std::string & description() const; - - /** Set description.*/ - Writer & description( const std::string & val_r ); - //@} - - public: - /** \name Collecting data. - * \code - * syscontent::Writer contentW; - * contentW.name( "mycollection" ) - * .edition( Edition( "1.0" ) ) - * .description( "All the cool stuff..." ); - * - * ResPool pool( getZYpp()->pool() ); - * for_each( pool.begin(), pool.end(), - * bind( &syscontent::Writer::addIf, ref(contentW), _1 ) ); - * - * std::ofstream my_file( "some_file" ); - * my_file << contentW; - * my_file.close(); - * \endcode - */ - //@{ - /** Collect currently installed \ref PoolItem. */ - void addInstalled( const PoolItem & obj_r ); - - /** Collect \ref PoolItem if it stays on the system. - * I.e. it stays installed or is tagged to be installed. - * Solver selected items are omitted. - */ - void addIf( const PoolItem & obj_r ); - - /** Unconditionally add this \ref ResObject (or \ref PoolItem). */ - void add( const ResObject::constPtr & obj_r ); - //@} - - public: - /** \name Collected data. */ - //@{ - /** Whether no data collected so far. */ - bool empty() const; - - /** Number of items collected. */ - size_type size() const; - - /** Iterator to the begin of collected data. */ - const_iterator begin() const; - - /** Iterator to the end of collected data. */ - const_iterator end() const; - //@} - - public: - /** Write collected data as XML. - * Read them back using \ref Reader. - */ - std::ostream & writeXml( std::ostream & str ) const; - - private: - class Impl; - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Writer Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Writer & obj ) - { return obj.writeXml( str ); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader - // - /** Retrieve \ref ResObject data serialized by \ref Writer. - * \see Writer - */ - class Reader - { - public: - /** Restored \ref ResObject data. */ - class Entry; - - private: - typedef std::list StorageT; - - public: - typedef StorageT::value_type value_type; - typedef StorageT::size_type size_type; - typedef StorageT::iterator iterator; - typedef StorageT::const_iterator const_iterator; - - public: - /** Default Ctor. */ - Reader(); - - /** Ctor parsing data from \a input_r. - * \throws Exception on read or parse error. - */ - Reader( std::istream & input_r ); - - public: - /** \name Identification. - * User provided optional data to identify the collection. - */ - //@{ - /** Get name. */ - const std::string & name() const; - - /** Get edition. */ - const Edition & edition() const; - - /** Get description. */ - const std::string & description() const; - - /** Get creation date. */ - const Date & ctime() const; - - public: - /** \name Collected data. */ - //@{ - /** Whether no data collected so far. */ - bool empty() const; - - /** Number of items collected. */ - size_type size() const; - - /** Iterator to the begin of collected data. */ - const_iterator begin() const; - - /** Iterator to the end of collected data. */ - const_iterator end() const; - //@} - - private: - class Impl; - RWCOW_pointer _pimpl; - }; - - /** \relates Reader Stream output */ - std::ostream & operator<<( std::ostream & str, const Reader & obj ); - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader::Entry - // - /** Restored \ref ResObject data. */ - class Reader::Entry - { - public: - Entry(); - const std::string & kind() const; - const std::string & name() const; - const Edition & edition() const; - const Arch & arch() const; - public: - class Impl; - Entry( const shared_ptr & pimpl_r ); - private: - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace syscontent - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SYSCONTENT_H diff --git a/libzypp/zypp/Target.cc b/libzypp/zypp/Target.cc deleted file mode 100644 index 26a22f8..0000000 --- a/libzypp/zypp/Target.cc +++ /dev/null @@ -1,151 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Target.cc - * -*/ -#include - -#include - -#include "zypp/Target.h" -#include "zypp/target/TargetImpl.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(Target); - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Target::Target - // METHOD TYPE : Ctor - // - Target::Target( const Pathname & root, bool doRebuild_r ) - : _pimpl( new Impl(root,doRebuild_r) ) - { - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Target::Target - // METHOD TYPE : Ctor - // - Target::Target( const Impl_Ptr & impl_r ) - : _pimpl( impl_r ) - { - assert( impl_r ); - } - - Target_Ptr Target::_nullimpl; - - /** Null implementation */ - Target_Ptr Target::nullimpl() - { - if (! _nullimpl) - { - _nullimpl = new Target(target::TargetImpl::nullimpl()); - } - return _nullimpl; - } - - std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj ) - { - str << "summary=" << obj.summary << endl; - str << "shortName=" << obj.shortName << endl; - return str; - } - - /////////////////////////////////////////////////////////////////// - // - // Forward to TargetImpl: - // - /////////////////////////////////////////////////////////////////// - - void Target::buildCache() - { _pimpl->buildCache(); } - - void Target::cleanCache() - { _pimpl->clearCache(); } - - void Target::load() - { _pimpl->load(); } - - void Target::reload() - { _pimpl->reload(); } - - void Target::unload() - { _pimpl->unload(); } - - target::rpm::RpmDb & Target::rpmDb() - { return _pimpl->rpm(); } - - Pathname Target::root() const - { return _pimpl->root(); } - - bool Target::providesFile (const std::string & name_str, const std::string & path_str) const - { return _pimpl->providesFile (name_str, path_str); } - - std::string Target::whoOwnsFile (const std::string & path_str) const - { return _pimpl->whoOwnsFile (path_str); } - - std::ostream & Target::dumpOn( std::ostream & str ) const - { return _pimpl->dumpOn( str ); } - - Date Target::timestamp() const - { return _pimpl->timestamp(); } - - Product::constPtr Target::baseProduct() const - { return _pimpl->baseProduct(); } - - LocaleSet Target::requestedLocales() const - { return _pimpl->requestedLocales(); } - LocaleSet Target::requestedLocales( const Pathname & root_r ) - { return target::TargetImpl::requestedLocales( root_r ); } - - std::string Target::targetDistribution() const - { return _pimpl->targetDistribution(); } - std::string Target::targetDistribution( const Pathname & root_r ) - { return target::TargetImpl::targetDistribution( root_r ); } - - std::string Target::targetDistributionRelease() const - { return _pimpl->targetDistributionRelease(); } - std::string Target::targetDistributionRelease( const Pathname & root_r ) - { return target::TargetImpl::targetDistributionRelease( root_r ); } - - std::string Target::targetDistributionFlavor() const - { return _pimpl->targetDistributionFlavor(); } - std::string Target::targetDistributionFlavor( const Pathname & root_r ) - { return target::TargetImpl::targetDistributionFlavor( root_r ); } - - Target::DistributionLabel Target::distributionLabel() const - { return _pimpl->distributionLabel(); } - Target::DistributionLabel Target::distributionLabel( const Pathname & root_r ) - { return target::TargetImpl::distributionLabel( root_r ); } - - std::string Target::distributionVersion() const - { return _pimpl->distributionVersion(); } - std::string Target::distributionVersion( const Pathname & root_r ) - { return target::TargetImpl::distributionVersion( root_r ); } - - std::string Target::distributionFlavor() const - { return _pimpl->distributionFlavor(); } - std::string Target::distributionFlavor( const Pathname & root_r ) - { return target::TargetImpl::distributionFlavor( root_r ); } - - std::string Target::anonymousUniqueId() const - { return _pimpl->anonymousUniqueId(); } - std::string Target::anonymousUniqueId( const Pathname & root_r ) - { return target::TargetImpl::anonymousUniqueId( root_r ); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/Target.h b/libzypp/zypp/Target.h deleted file mode 100644 index 10f1119..0000000 --- a/libzypp/zypp/Target.h +++ /dev/null @@ -1,247 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Target.h - * -*/ -#ifndef ZYPP_TARGET_H -#define ZYPP_TARGET_H - -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/APIConfig.h" - -#include "zypp/Product.h" -#include "zypp/Pathname.h" -#include "zypp/ResPool.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - namespace target - { - class TargetImpl; - namespace rpm { - class RpmDb; - } - } - namespace zypp_detail - { - class ZYppImpl; - } - - DEFINE_PTR_TYPE(Target); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Target - // - /** - */ - class Target : public base::ReferenceCounted, public base::NonCopyable - { - public: - typedef target::TargetImpl Impl; - typedef intrusive_ptr Impl_Ptr; - typedef std::list PoolItemList; - - public: - - /** - * builds or refreshes the target cache - */ - void buildCache(); - - /** - * cleans the target cache (.solv files) - */ - void cleanCache(); - - /** - * load resolvables into the pool - */ - void load(); - - void reload(); - - /** - * unload target resolvables from the - * pool - */ - void unload(); - - /** Null implementation */ - static Target_Ptr nullimpl(); - - /** Refference to the RPM database */ - target::rpm::RpmDb & rpmDb(); - - /** If the package is installed and provides the file - Needed to evaluate split provides during Resolver::Upgrade() */ - bool providesFile (const std::string & name_str, const std::string & path_str) const; - - /** Return name of package owning \a path_str - * or empty string if no installed package owns \a path_str. - **/ - std::string whoOwnsFile (const std::string & path_str) const; - - /** Return the root set for this target */ - Pathname root() const; - - /** Return the path prefixed by the target root, unless it already is prefixed. */ - Pathname assertRootPrefix( const Pathname & path_r ) const - { return Pathname::assertprefix( root(), path_r ); } - - /** return the last modification date of the target */ - Date timestamp() const; - - /** - * returns the target base installed product, also known as - * the distribution or platform. - * - * returns 0 if there is no base installed product in the - * pool. - * - * \note this method requires the target to be loaded, - * otherwise it will return 0 as no product is found. - * - * if you require some base product attributes when the - * target is not loaded into the pool, see - * \ref targetDistribution , \ref targetDistributionRelease - * and \ref distributionVersion that obtain the data - * on demand from the installed product information. - */ - Product::constPtr baseProduct() const; - - /** - * \brief Languages to be supported by the system. - * E.g. language specific packages to be installed. - */ - LocaleSet requestedLocales() const; - /** \overload Use a specific root_r, if empty the default targets root, or '/' - */ - static LocaleSet requestedLocales( const Pathname & root_r ); - - public: - /** \name Base product and registration. - * - * Static methods herein allow to retrieve the values without explicitly - * initializing the \ref Target. They take a targets root directory as - * argument. If an empty \ref Pathname is passed, an already existing - * Targets root is used, otherwise \c "/" is assumed. - */ - //@{ - /** This is \c register.target attribute of the installed base product. - * Used for registration and \ref Service refresh. - */ - std::string targetDistribution() const; - /** \overload */ - static std::string targetDistribution( const Pathname & root_r ); - - /** This is \c register.release attribute of the installed base product. - * Used for registration. - */ - std::string targetDistributionRelease() const; - /** \overload */ - static std::string targetDistributionRelease( const Pathname & root_r ); - - /** This is \c register.flavor attribute of the installed base product. - * Used for registration. - * \note don't mistake this for \ref distributionFlavor - */ - std::string targetDistributionFlavor() const; - /** \overload */ - static std::string targetDistributionFlavor( const Pathname & root_r ); - - struct DistributionLabel { std::string shortName; std::string summary; }; - /** This is \c shortName and \c summary attribute of the installed base product. - * Used e.g. for the bootloader menu. - */ - DistributionLabel distributionLabel() const; - /** \overload */ - static DistributionLabel distributionLabel( const Pathname & root_r ); - - /** This is \c version attribute of the installed base product. - * For example http://download.opensue.org/update/11.0 - * The 11.0 corresponds to the base product version. - */ - std::string distributionVersion() const; - /** \overload */ - static std::string distributionVersion( const Pathname & root_r ); - - /** - * This is \c flavor attribute of the installed base product - * but does not require the target to be loaded as it remembers - * the last used one. It can be empty is the target has never - * been loaded, as the value is not present in the system - * but computer from a package provides - * \note don't mistake this for \ref targetDistributionFlavor - */ - std::string distributionFlavor() const; - /** \overload */ - static std::string distributionFlavor( const Pathname & root_r ); - - /** - * anonymous unique id - * - * This id is generated once and stays in the - * saved in the target. - * It is unique and is used only for statistics. - * - */ - std::string anonymousUniqueId() const; - /** \overload */ - static std::string anonymousUniqueId( const Pathname & root_r ); - //@} - - public: - /** Ctor. If \c doRebuild_r is \c true, an already existing - * database is rebuilt (rpm --rebuilddb ). - */ - explicit - Target( const Pathname & root = "/", bool doRebuild_r = false ); - /** Ctor */ - explicit - Target( const Impl_Ptr & impl_r ); - - private: - friend std::ostream & operator<<( std::ostream & str, const Target & obj ); - /** Stream output. */ - std::ostream & dumpOn( std::ostream & str ) const; - - private: - /** Direct access to Impl. */ - friend class zypp_detail::ZYppImpl; - - /** Pointer to implementation */ - RW_pointer > _pimpl; - - static Target_Ptr _nullimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Target Stream output. */ - inline std::ostream & operator<<( std::ostream & str, const Target & obj ) - { return obj.dumpOn( str ); } - - /** \relates Target::DistributionLabel Stream output. - * Write out the content as key/value pairs: - * \code - * summary=Beautiful Name - * shortName=BN - * \endcode - */ - std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_H diff --git a/libzypp/zypp/TmpPath.cc b/libzypp/zypp/TmpPath.cc deleted file mode 100644 index a8334cd..0000000 --- a/libzypp/zypp/TmpPath.cc +++ /dev/null @@ -1,312 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/TmpPath.cc - * -*/ - -#include -#include -#include - -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/Logger.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" - -using namespace std; - -namespace zypp { - namespace filesystem { - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpPath::Impl - /** - * Clean or delete a directory on destruction. - **/ - class TmpPath::Impl : public base::ReferenceCounted, private base::NonCopyable - { - public: - - enum Flags - { - NoOp = 0, - Autodelete = 1L << 0, - KeepTopdir = 1L << 1, - // - CtorDefault = Autodelete - }; - - public: - - Impl( const Pathname & path_r, Flags flags_r = CtorDefault ) - : _path( path_r ), _flags( flags_r ) - {} - - ~Impl() - { - if ( ! (_flags & Autodelete) || _path.empty() ) - return; - - PathInfo p( _path, PathInfo::LSTAT ); - if ( ! p.isExist() ) - return; - - int res = 0; - if ( p.isDir() ) - { - if ( _flags & KeepTopdir ) - res = clean_dir( _path ); - else - res = recursive_rmdir( _path ); - } - else - res = unlink( _path ); - - if ( res ) - INT << "TmpPath cleanup error (" << res << ") " << p << endl; - else - DBG << "TmpPath cleaned up " << p << endl; - } - - const Pathname & - path() const - { return _path; } - - bool autoCleanup() const - { return( _flags & Autodelete ); } - - void autoCleanup( bool yesno_r ) - { _flags = yesno_r ? CtorDefault : NoOp; } - - private: - Pathname _path; - Flags _flags; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpPath - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::TmpPath - // METHOD TYPE : Constructor - // - TmpPath::TmpPath() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::TmpPath - // METHOD TYPE : Constructor - // - TmpPath::TmpPath( const Pathname & tmpPath_r ) - :_impl( tmpPath_r.empty() ? nullptr : new Impl( tmpPath_r ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::~TmpPath - // METHOD TYPE : Destructor - // - TmpPath::~TmpPath() - { - // virtual not inlined dtor. - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::operator const void * - // METHOD TYPE : - // - TmpPath::operator bool() const - { - return _impl.get(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::path - // METHOD TYPE : Pathname - // - Pathname - TmpPath::path() const - { - return _impl.get() ? _impl->path() : Pathname(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpPath::defaultLocation - // METHOD TYPE : const Pathname & - // - const Pathname & - TmpPath::defaultLocation() - { - static Pathname p( getenv("ZYPPTMPDIR") ? getenv("ZYPPTMPDIR") : "/var/tmp" ); - return p; - } - - bool TmpPath::autoCleanup() const - { return _impl.get() ? _impl->autoCleanup() : false; } - - void TmpPath::autoCleanup( bool yesno_r ) - { if ( _impl.get() ) _impl->autoCleanup( yesno_r ); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpFile - // - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpFile::TmpFile - // METHOD TYPE : Constructor - // - TmpFile::TmpFile( const Pathname & inParentDir_r, - const std::string & prefix_r ) - { - // parent dir must exist - if ( filesystem::assert_dir( inParentDir_r ) != 0 ) - { - ERR << "Parent directory '" << inParentDir_r << "' can't be created." << endl; - return; - } - - // create the temp file - Pathname tmpPath = (inParentDir_r + prefix_r).extend( "XXXXXX"); - char * buf = ::strdup( tmpPath.asString().c_str() ); - if ( ! buf ) - { - ERR << "Out of memory" << endl; - return; - } - - int tmpFd = ::mkostemp( buf, O_CLOEXEC ); - if ( tmpFd != -1 ) - { - // success; create _impl - ::close( tmpFd ); - _impl = RW_pointer( new Impl( buf ) ); - } - else - ERR << "Cant create '" << buf << "' " << ::strerror( errno ) << endl; - - ::free( buf ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpFile::makeSibling - // METHOD TYPE : TmpFile - // - TmpFile TmpFile::makeSibling( const Pathname & sibling_r ) - { - TmpFile ret( sibling_r.dirname(), sibling_r.basename() ); - // clone mode if sibling_r exists - PathInfo p( sibling_r ); - if ( p.isFile() ) - { - ::chmod( ret.path().c_str(), p.st_mode() ); - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpFile::defaultPrefix - // METHOD TYPE : const std::string & - // - const std::string & - TmpFile::defaultPrefix() - { - static string p( "TmpFile." ); - return p; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpDir - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpDir::TmpDir - // METHOD TYPE : Constructor - // - TmpDir::TmpDir( const Pathname & inParentDir_r, - const std::string & prefix_r ) - { - // parent dir must exist - if ( filesystem::assert_dir( inParentDir_r ) != 0 ) - { - ERR << "Parent directory '" << inParentDir_r << "' can't be created." << endl; - return; - } - - // create the temp dir - Pathname tmpPath = (inParentDir_r + prefix_r).extend( "XXXXXX"); - char * buf = ::strdup( tmpPath.asString().c_str() ); - if ( ! buf ) - { - ERR << "Out of memory" << endl; - return; - } - - char * tmp = ::mkdtemp( buf ); - if ( tmp ) - // success; create _impl - _impl = RW_pointer( new Impl( tmp ) ); - else - ERR << "Cant create '" << tmpPath << "' " << ::strerror( errno ) << endl; - - ::free( buf ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpDir::makeSibling - // METHOD TYPE : TmpDir - // - TmpDir TmpDir::makeSibling( const Pathname & sibling_r ) - { - TmpDir ret( sibling_r.dirname(), sibling_r.basename() ); - // clone mode if sibling_r exists - PathInfo p( sibling_r ); - if ( p.isDir() ) - { - ::chmod( ret.path().c_str(), p.st_mode() ); - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TmpDir::defaultPrefix - // METHOD TYPE : const std::string & - // - const std::string & - TmpDir::defaultPrefix() - { - static string p( "TmpDir." ); - return p; - } - - } // namespace filesystem -} // namespace zypp diff --git a/libzypp/zypp/TmpPath.h b/libzypp/zypp/TmpPath.h deleted file mode 100644 index 39f6371..0000000 --- a/libzypp/zypp/TmpPath.h +++ /dev/null @@ -1,201 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/TmpPath.h - * -*/ -#ifndef ZYPP_TMPPATH_H -#define ZYPP_TMPPATH_H - -#include - -#include "zypp/Pathname.h" -#include "zypp/base/PtrTypes.h" - -namespace zypp { - namespace filesystem { - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpPath - /** - * @short Automaticaly deletes files or directories when no longer needed. - * - * TmpPath is constructed from a Pathname. Multiple TmpPath instances - * created by copy and assign, share the same reference counted internal - * repesentation. - * - * When the last reference drops any file or directory located at the path - * passed to the ctor is deleted (recursivly in case of directories). This - * behavior can be canged by calling \ref autoCleanup. - * - * Principally serves as base class, but standalone usable. - **/ - class TmpPath - { - public: - /** - * Default Ctor. An empty Pathname. - **/ - TmpPath(); - - /** - * Ctor. Takes a Pathname. - **/ - explicit - TmpPath( const Pathname & tmpPath_r ); - - /** - * Dtor. - **/ - virtual - ~TmpPath(); - - /** - * Test whether the Pathname is valid (i.e. not empty. NOT whether - * it really denotes an existing file or directory). - **/ - explicit operator bool() const; - - /** - * @return The Pathname. - **/ - Pathname - path() const; - - /** - * Type conversion to Pathname. - **/ - operator Pathname() const - { return path(); } - - /** - * Whether path is valid and deleted when the last reference drops. - */ - bool autoCleanup() const; - - /** - * Turn \ref autoCleanup on/off if path is valid. - */ - void autoCleanup( bool yesno_r ); - - public: - /** - * @return The default directory where temporary - * files should be are created (/var/tmp). - **/ - static const Pathname & - defaultLocation(); - - protected: - class Impl; - RW_pointer _impl; - - }; - /////////////////////////////////////////////////////////////////// - - /** - * Stream output as pathname. - **/ - inline std::ostream & - operator<<( std::ostream & str, const TmpPath & obj ) - { return str << static_cast(obj); } - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpFile - /** - * @short Provide a new empty temporary file and delete it when no - * longer needed. - * - * The temporary file is per default created in '/var/tmp' and named - * 'TmpFile.XXXXXX', with XXXXXX replaced by a string which makes the - * name unique. Different location and file prefix may be passed to - * the ctor. TmpFile is created with mode 0600. - * - * TmpFile provides the Pathname of the temporary file, or an empty - * path in case of any error. - **/ - class TmpFile : public TmpPath - { - public: - /** - * Ctor. Takes a Pathname. - **/ - explicit - TmpFile( const Pathname & inParentDir_r = defaultLocation(), - const std::string & prefix_r = defaultPrefix() ); - - /** Provide a new empty temporary directory as sibling. - * \code - * TmpFile s = makeSibling( "/var/lib/myfile" ); - * // returns: /var/lib/myfile.XXXXXX - * \endcode - * If \c sibling_r exists, sibling is created using the same mode. - */ - static TmpFile makeSibling( const Pathname & sibling_r ); - - public: - /** - * @return The default prefix for temporary files (TmpFile.) - **/ - static const std::string & - defaultPrefix(); - - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TmpDir - /** - * @short Provide a new empty temporary directory and recursively - * delete it when no longer needed. - * - * The temporary directory is per default created in '/var/tmp' and - * named 'TmpDir.XXXXXX', with XXXXXX replaced by a string which makes - * the name unique. Different location and file prefix may be passed - * to the ctor. TmpDir is created with mode 0700. - * - * TmpDir provides the Pathname of the temporary directory , or an empty - * path in case of any error. - **/ - class TmpDir : public TmpPath - { - public: - /** - * Ctor. Takes a Pathname. - **/ - explicit - TmpDir( const Pathname & inParentDir_r = defaultLocation(), - const std::string & prefix_r = defaultPrefix() ); - - /** Provide a new empty temporary directory as sibling. - * \code - * TmpDir s = makeSibling( "/var/lib/mydir" ); - * // returns: /var/lib/mydir.XXXXXX - * \endcode - * If \c sibling_r exists, sibling is created using the same mode. - */ - static TmpDir makeSibling( const Pathname & sibling_r ); - - public: - /** - * @return The default prefix for temporary directories (TmpDir.) - **/ - static const std::string & - defaultPrefix(); - }; - /////////////////////////////////////////////////////////////////// - - } // namespace filesystem -} // namespace zypp - -#endif // ZYPP_TMPPATH_H diff --git a/libzypp/zypp/TriBool.h b/libzypp/zypp/TriBool.h deleted file mode 100644 index 64488d1..0000000 --- a/libzypp/zypp/TriBool.h +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/TriBool.h - * -*/ -#ifndef ZYPP_TRIBOOL_H -#define ZYPP_TRIBOOL_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** 3-state boolean logic (\c true, \c false and \c indeterminate). - * \code - * namespace zypp - * { - * typedef boost::logic::tribool TriBool; - * using boost::logic::tribool; - * using boost::logic::indeterminate; - * } - * \endcode - * - * \warning Be carefull.esp. when comparing \ref TriBool using - * \c operator==, as ( indeterminate == indeterminate ) - * does \b not evaluate \b true. It's \c indeterminate. - * - * \see http://www.boost.org/doc/html/tribool.html - * \ingroup BOOST - */ - typedef boost::logic::tribool TriBool; - using boost::logic::tribool; - using boost::logic::indeterminate; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -namespace boost -{ - namespace logic - { - /** \relates TriBool stream output */ - inline std::ostream & operator<<(std::ostream & s, const tribool & obj) - { - if (indeterminate(obj)) - s << "indeterminate"; - else if (obj) - s << "true"; - else - s << "false"; - return s; - } - } -} -#endif // ZYPP_TRIBOOL_H diff --git a/libzypp/zypp/Url.cc b/libzypp/zypp/Url.cc deleted file mode 100644 index 1eede89..0000000 --- a/libzypp/zypp/Url.cc +++ /dev/null @@ -1,879 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/Url.cc - */ - -#include "zypp/Url.h" -#include "zypp/Pathname.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/base/Regex.h" -#include -#include - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - - using namespace zypp::url; - - - // ----------------------------------------------------------------- - /* - * url = [scheme:] [//authority] /path [?query] [#fragment] - */ - #define RX_SPLIT_URL "^([^:/?#]+:|)" \ - "(//[^/?#]*|)" \ - "([^?#]*)" \ - "([?][^#]*|)" \ - "(#.*|)" - - - //////////////////////////////////////////////////////////////////// - namespace - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - class LDAPUrl: public UrlBase - { - public: - LDAPUrl(): UrlBase() - { - configure(); - } - - LDAPUrl(const LDAPUrl &url): UrlBase(url) - {} - - virtual UrlBase * - clone() const - { - return new LDAPUrl(*this); - } - - virtual UrlSchemes - getKnownSchemes() const - { - UrlSchemes schemes(2); - schemes[0] = "ldap"; - schemes[1] = "ldaps"; - return schemes; - } - - virtual void - configure() - { - config("sep_pathparams", ""); - - config("psep_querystr", "?"); - config("vsep_querystr", ""); - - // host is required (isValid=>false) - // but not mandatory (see RFC 2255), - // that is, accept empty host. - config("require_host", "y"); - - // not allowed here - config("rx_username", ""); - config("rx_password", ""); - config("rx_fragment", ""); - config("rx_pathparams", ""); - } - - virtual zypp::url::ParamMap - getQueryStringMap(zypp::url::EEncoding eflag) const - { - static const char * const keys[] = { - "attrs", "scope", "filter", "exts", NULL - }; - zypp::url::ParamMap pmap; - zypp::url::ParamVec pvec( getQueryStringVec()); - if( pvec.size() <= 4) - { - for(size_t i=0; ifirst == keys[i]) - { - found=true; - pvec[i] = zypp::url::encode(p->second, join_safe); - } - } - if( !found) - { - ZYPP_THROW(url::UrlNotSupportedException( - str::form(_("Invalid LDAP URL query parameter '%s'"), - p->first.c_str()) - )); - } - } - setQueryStringVec(pvec); - } - }; - - - // --------------------------------------------------------------- - // FIXME: hmm.. - class UrlByScheme - { - private: - typedef std::map UrlBySchemeMap; - UrlBySchemeMap urlByScheme; - - public: - UrlByScheme() - { - UrlRef ref; - - // ===================================== - ref.reset( new LDAPUrl()); - addUrlByScheme("ldap", ref); - addUrlByScheme("ldaps", ref); - - - // ===================================== - ref.reset( new UrlBase()); - ref->config("with_authority", "n"); // disallow host,... - ref->config("require_pathname", "m"); // path is mandatory - addUrlByScheme("hd", ref); - addUrlByScheme("cd", ref); - addUrlByScheme("dvd", ref); - addUrlByScheme("dir", ref); - addUrlByScheme("iso", ref); - - // don't show empty authority - ref->setViewOptions( zypp::url::ViewOption::DEFAULTS - - zypp::url::ViewOption::EMPTY_AUTHORITY); - addUrlByScheme("mailto", ref); - addUrlByScheme("urn", ref); - addUrlByScheme("plugin", ref); // zypp plugable media handler: - - // RFC1738, 3.10: may contain a host - ref->config("with_authority", "y"); // allow host, - ref->config("with_port", "n"); // but no port, - ref->config("rx_username", ""); // username or - ref->config("rx_password", ""); // password ... - addUrlByScheme("file", ref); - - // ===================================== - ref.reset( new UrlBase()); - ref->config("require_host", "m"); // host is mandatory - addUrlByScheme("nfs", ref); - addUrlByScheme("nfs4", ref); - addUrlByScheme("smb", ref); - addUrlByScheme("cifs", ref); - addUrlByScheme("http", ref); - addUrlByScheme("https", ref); - ref->config("path_encode_slash2", "y"); // always encode 2. slash - addUrlByScheme("ftp", ref); - addUrlByScheme("sftp", ref); - addUrlByScheme("tftp", ref); - } - - bool - addUrlByScheme(const std::string &scheme, - UrlRef urlImpl) - { - if( urlImpl && urlImpl->isValidScheme(scheme)) - { - UrlRef ref(urlImpl); - ref->clear(); - urlByScheme[str::toLower(scheme)] = ref; - return true; - } - return false; - } - - UrlRef - getUrlByScheme(const std::string &scheme) const - { - UrlBySchemeMap::const_iterator i(urlByScheme.find(str::toLower(scheme))); - if( i != urlByScheme.end()) - { - return i->second; - } - return UrlRef(); - } - - bool - isRegisteredScheme(const std::string &scheme) const - { - return urlByScheme.find(str::toLower(scheme)) != urlByScheme.end(); - } - - UrlSchemes - getRegisteredSchemes() const - { - UrlBySchemeMap::const_iterator i(urlByScheme.begin()); - UrlSchemes schemes; - - schemes.reserve(urlByScheme.size()); - for( ; i != urlByScheme.end(); ++i) - { - schemes.push_back(i->first); - } - return schemes; - } - }; - - - // --------------------------------------------------------------- - UrlByScheme & g_urlSchemeRepository() - { - static UrlByScheme _v; - return _v; - } - - ////////////////////////////////////////////////////////////////// - } // anonymous namespace - //////////////////////////////////////////////////////////////////// - - - // ----------------------------------------------------------------- - Url::~Url() - { - } - - - // ----------------------------------------------------------------- - Url::Url() - : m_impl( new UrlBase()) - { - } - - - // ----------------------------------------------------------------- - Url::Url(const Url &url) - : m_impl( url.m_impl) - { - if( !m_impl) - { - ZYPP_THROW(url::UrlException( - _("Unable to clone Url object") - )); - } - } - - - // ----------------------------------------------------------------- - Url::Url(const zypp::url::UrlRef &url) - : m_impl( url) - { - if( !m_impl) - { - ZYPP_THROW(url::UrlException( - _("Invalid empty Url object reference") - )); - } - } - - - // ----------------------------------------------------------------- - Url::Url(const std::string &encodedUrl) - : m_impl( parseUrl(encodedUrl)) - { - if( !m_impl) - { - ZYPP_THROW(url::UrlParsingException( - _("Unable to parse Url components") - )); - } - } - - - // ----------------------------------------------------------------- - Url& - Url::operator = (const std::string &encodedUrl) - { - UrlRef url( parseUrl(encodedUrl)); - if( !url) - { - ZYPP_THROW(url::UrlParsingException( - _("Unable to parse Url components") - )); - } - m_impl = url; - return *this; - } - - - // ----------------------------------------------------------------- - Url& - Url::operator = (const Url &url) - { - m_impl = url.m_impl; - return *this; - } - - - // ----------------------------------------------------------------- - // static - bool - Url::registerScheme(const std::string &scheme, - UrlRef urlImpl) - { - return g_urlSchemeRepository().addUrlByScheme(scheme, urlImpl); - } - - - // ----------------------------------------------------------------- - // static - UrlRef - Url::parseUrl(const std::string &encodedUrl) - { - UrlRef url; - str::smatch out; - bool ret = false; - - try - { - str::regex rex(RX_SPLIT_URL); - ret = str::regex_match(encodedUrl, out, rex); - } - catch( ... ) - {} - - if(ret && out.size() == 6) - { - std::string scheme = out[1]; - if (scheme.size() > 1) - scheme = scheme.substr(0, scheme.size()-1); - std::string authority = out[2]; - if (authority.size() >= 2) - authority = authority.substr(2); - std::string query = out[4]; - if (query.size() > 1) - query = query.substr(1); - std::string fragment = out[5]; - if (fragment.size() > 1) - fragment = fragment.substr(1); - - url = g_urlSchemeRepository().getUrlByScheme(scheme); - if( !url) - { - url.reset( new UrlBase()); - } - url->init(scheme, authority, out[3], - query, fragment); - } - return url; - } - - - // ----------------------------------------------------------------- - // static - zypp::url::UrlSchemes - Url::getRegisteredSchemes() - { - return g_urlSchemeRepository().getRegisteredSchemes(); - } - - - // ----------------------------------------------------------------- - // static - bool - Url::isRegisteredScheme(const std::string &scheme) - { - return g_urlSchemeRepository().isRegisteredScheme(scheme); - } - - - // ----------------------------------------------------------------- - zypp::url::UrlSchemes - Url::getKnownSchemes() const - { - return m_impl->getKnownSchemes(); - } - - - // ----------------------------------------------------------------- - bool - Url::isValidScheme(const std::string &scheme) const - { - return m_impl->isValidScheme(scheme); - } - - - /////////////////////////////////////////////////////////////////// - namespace - { - inline bool isInList( const char ** begin_r, const char ** end_r, const std::string & scheme_r ) - { - for ( ; begin_r != end_r; ++begin_r ) - if ( scheme_r == *begin_r ) - return true; - return false; - } - } - bool Url::schemeIsLocal( const std::string & scheme_r ) - { - static const char * val[] = { "cd", "dvd", "dir", "hd", "iso", "file" }; - return isInList( arrayBegin(val), arrayEnd(val), scheme_r ); - } - - bool Url::schemeIsRemote( const std::string & scheme_r ) - { - static const char * val[] = { "http", "https", "nfs", "nfs4", "smb", "cifs", "ftp", "sftp", "tftp" }; - return isInList( arrayBegin(val), arrayEnd(val), scheme_r ); - } - - bool Url::schemeIsVolatile( const std::string & scheme_r ) - { - static const char * val[] = { "cd", "dvd" }; - return isInList( arrayBegin(val), arrayEnd(val), scheme_r ); - } - - bool Url::schemeIsDownloading( const std::string & scheme_r ) - { - static const char * val[] = { "http", "https", "ftp", "sftp", "tftp" }; - return isInList( arrayBegin(val), arrayEnd(val), scheme_r ); - } - /////////////////////////////////////////////////////////////////// - - // ----------------------------------------------------------------- - bool - Url::isValid() const - { - return m_impl->isValid(); - } - - - // ----------------------------------------------------------------- - std::string - Url::asString() const - { - return m_impl->asString(); - } - - - // ----------------------------------------------------------------- - std::string - Url::asCompleteString() const - { - // make sure, all url components are included; - // regardless of the current configuration... - ViewOptions opts(getViewOptions() + - ViewOption::WITH_SCHEME + - ViewOption::WITH_USERNAME + - ViewOption::WITH_PASSWORD + - ViewOption::WITH_HOST + - ViewOption::WITH_PORT + - ViewOption::WITH_PATH_NAME + - ViewOption::WITH_PATH_PARAMS + - ViewOption::WITH_QUERY_STR + - ViewOption::WITH_FRAGMENT); - return m_impl->asString(opts); - } - - - // ----------------------------------------------------------------- - std::string - Url::asString(const ViewOptions &opts) const - { - return m_impl->asString(opts); - } - - - // ----------------------------------------------------------------- - std::string - Url::getScheme() const - { - return m_impl->getScheme(); - } - - - // ----------------------------------------------------------------- - std::string - Url::getAuthority() const - { - return m_impl->getAuthority(); - } - - // ----------------------------------------------------------------- - std::string - Url::getPathData() const - { - return m_impl->getPathData(); - } - - - // ----------------------------------------------------------------- - std::string - Url::getQueryString() const - { - return m_impl->getQueryString(); - } - - - // ----------------------------------------------------------------- - std::string - Url::getFragment(zypp::url::EEncoding eflag) const - { - return m_impl->getFragment(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getUsername(EEncoding eflag) const - { - return m_impl->getUsername(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getPassword(EEncoding eflag) const - { - return m_impl->getPassword(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getHost(EEncoding eflag) const - { - return m_impl->getHost(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getPort() const - { - return m_impl->getPort(); - } - - - // ----------------------------------------------------------------- - std::string - Url::getPathName(EEncoding eflag) const - { - return m_impl->getPathName(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getPathParams() const - { - return m_impl->getPathParams(); - } - - - // ----------------------------------------------------------------- - zypp::url::ParamVec - Url::getPathParamsVec() const - { - return m_impl->getPathParamsVec(); - } - - - // ----------------------------------------------------------------- - zypp::url::ParamMap - Url::getPathParamsMap(EEncoding eflag) const - { - return m_impl->getPathParamsMap(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getPathParam(const std::string ¶m, EEncoding eflag) const - { - return m_impl->getPathParam(param, eflag); - } - - - // ----------------------------------------------------------------- - zypp::url::ParamVec - Url::getQueryStringVec() const - { - return m_impl->getQueryStringVec(); - } - - - // ----------------------------------------------------------------- - zypp::url::ParamMap - Url::getQueryStringMap(EEncoding eflag) const - { - return m_impl->getQueryStringMap(eflag); - } - - - // ----------------------------------------------------------------- - std::string - Url::getQueryParam(const std::string ¶m, EEncoding eflag) const - { - return m_impl->getQueryParam(param, eflag); - } - - - // ----------------------------------------------------------------- - void - Url::setScheme(const std::string &scheme) - { - if(scheme == m_impl->getScheme()) - { - return; - } - if( m_impl->isKnownScheme(scheme)) - { - m_impl->setScheme(scheme); - return; - } - - UrlRef url = g_urlSchemeRepository().getUrlByScheme(scheme); - if( !url) - { - url.reset( new UrlBase()); - } - url->init( - scheme, - m_impl->getAuthority(), - m_impl->getPathData(), - m_impl->getQueryString(), - m_impl->getFragment(zypp::url::E_ENCODED) - ); - m_impl = url; - } - - - // ----------------------------------------------------------------- - void - Url::setAuthority(const std::string &authority) - { - m_impl->setAuthority(authority); - } - - - // ----------------------------------------------------------------- - void - Url::setPathData(const std::string &pathdata) - { - m_impl->setPathData(pathdata); - } - - - // ----------------------------------------------------------------- - void - Url::setQueryString(const std::string &querystr) - { - m_impl->setQueryString(querystr); - } - - - // ----------------------------------------------------------------- - void - Url::setFragment(const std::string &fragment, EEncoding eflag) - { - m_impl->setFragment(fragment, eflag); - } - - - // ----------------------------------------------------------------- - void - Url::setUsername(const std::string &user, - EEncoding eflag) - { - m_impl->setUsername(user, eflag); - } - - - // ----------------------------------------------------------------- - void - Url::setPassword(const std::string &pass, - EEncoding eflag) - { - m_impl->setPassword(pass, eflag); - } - - - // ----------------------------------------------------------------- - void - Url::setHost(const std::string &host) - { - m_impl->setHost(host); - } - - - // ----------------------------------------------------------------- - void - Url::setPort(const std::string &port) - { - m_impl->setPort(port); - } - - - // ----------------------------------------------------------------- - void - Url::setPathName(const std::string &path, - EEncoding eflag) - { - m_impl->setPathName(path, eflag); - } - - void - Url::setPathName(const Pathname &path, - EEncoding eflag) - { - m_impl->setPathName(path.asString(), eflag); - } - - void - Url::setPathName(const char *path, - EEncoding eflag) - { - m_impl->setPathName(path, eflag); - } - - // ----------------------------------------------------------------- - void - Url::setPathParams(const std::string ¶ms) - { - m_impl->setPathParams(params); - } - - - // ----------------------------------------------------------------- - void - Url::setPathParamsVec(const zypp::url::ParamVec &pvec) - { - m_impl->setPathParamsVec(pvec); - } - - - // ----------------------------------------------------------------- - void - Url::setPathParamsMap(const zypp::url::ParamMap &pmap) - { - m_impl->setPathParamsMap(pmap); - } - - - // ----------------------------------------------------------------- - void - Url::setPathParam(const std::string ¶m, const std::string &value) - { - m_impl->setPathParam(param, value); - } - - - // ----------------------------------------------------------------- - void - Url::setQueryStringVec(const zypp::url::ParamVec &pvec) - { - m_impl->setQueryStringVec(pvec); - } - - - // ----------------------------------------------------------------- - void - Url::setQueryStringMap(const zypp::url::ParamMap &pmap) - { - m_impl->setQueryStringMap(pmap); - } - - // ----------------------------------------------------------------- - void - Url::setQueryParam(const std::string ¶m, const std::string &value) - { - m_impl->setQueryParam(param, value); - } - - // ----------------------------------------------------------------- - void - Url::delQueryParam(const std::string ¶m) - { - m_impl->delQueryParam(param); - } - - // ----------------------------------------------------------------- - ViewOptions - Url::getViewOptions() const - { - return m_impl->getViewOptions(); - } - - // ----------------------------------------------------------------- - void - Url::setViewOptions(const ViewOptions &vopts) - { - m_impl->setViewOptions(vopts); - } - - // ----------------------------------------------------------------- - std::ostream & operator<<( std::ostream & str, const Url & url ) - { - return str << url.asString(); - } - - bool operator<( const Url &lhs, const Url &rhs ) - { - return (lhs.asCompleteString() < rhs.asCompleteString()); - } - - bool operator==( const Url &lhs, const Url &rhs ) - { - return (lhs.asCompleteString() == rhs.asCompleteString()); - } - - bool operator!=( const Url &lhs, const Url &rhs ) - { - return (lhs.asCompleteString() != rhs.asCompleteString()); - } - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/Url.h b/libzypp/zypp/Url.h deleted file mode 100644 index 277b879..0000000 --- a/libzypp/zypp/Url.h +++ /dev/null @@ -1,844 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/Url.h - */ -#ifndef ZYPP_URL_H -#define ZYPP_URL_H - -#include "zypp/url/UrlBase.h" -#include "zypp/url/UrlUtils.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - namespace filesystem { - class Pathname; - } - using filesystem::Pathname; - - /** - * \class Url - * \brief Url manipulation class. - * - * The generic URL (URI) syntax and its main components are defined in - * RFC3986 (http://rfc.net/rfc3986.html) Section 3, "Syntax Components". - * The scheme specific URL syntax and semantics is defined in the - * specification of the particular scheme. See also RFC1738 - * (http://rfc.net/rfc1738.html), that defines specific syntax for - * several URL schemes. - * - * This class provides methods to access and manipulate generic and - * common scheme-specific URL components (or using the more general - * term, URI components). - * To consider the scheme-specifics of a URL, the Url class contains - * a reference object pointing to a UrlBase or derived object, that - * implements the scheme specifics. - * - * Using the Url::registerScheme() method, it is possible to register - * a preconfigured or derived UrlBase object for a specific scheme - * name. The registered object will be cloned to handle all URL's - * containing the specified scheme name. - * - * \par RFC3986, Syntax Components: - * - * The generic URI syntax consists of a hierarchical sequence of - * components referred to as the scheme, authority, path, query, - * and fragment. - * - * \code - * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] - * - * hier-part = "//" authority path-abempty - * / path-absolute - * / path-rootless - * / path-empty - * \endcode - * - * The scheme and path components are required, though the path may be - * empty (no characters). - * When authority is present, the path must either be empty or begin - * with a slash ("/") character. - * When authority is not present, the path cannot begin with two slash - * characters ("//"). - * These restrictions result in five different ABNF rules for a path - * (Section 3.3), only one of which will match any given URI reference. - * - * The following are two example URIs and their component parts: - * \code - * foo://example.com:8042/over/there?name=ferret#nose - * \_/ \______________/\_________/ \_________/ \__/ - * | | | | | - * scheme authority path query fragment - * | _____________________|__ - * / \ / \ - * urn:example:animal:ferret:nose - * \endcode - * - */ - class Url - { - public: - /** - * Encoding flags. - */ - typedef zypp::url::EEncoding EEncoding; - - /** - * View options. - */ - typedef zypp::url::ViewOptions ViewOptions; - - - ~Url(); - Url(); - - /** - * Create a new Url object as shared copy of the given one. - * - * Upon return, both objects will point to the same underlying - * object. This state will remain until one of the object is - * modified. - * - * \param url The Url object to make a copy of. - * \throws url::UrlException if copy fails (should not happen). - */ - Url(const Url &url); - - - /** - * Create a new Url object as shared copy of the given reference. - * - * Upon return, both objects will point to the same underlying - * object. This state will remain until one of the object is - * modified. - * - * \param url The URL implementation reference to make a copy of. - * \throws url::UrlException if reference is empty. - */ - Url(const zypp::url::UrlRef &url); - - - /** - * \brief Construct a Url object from percent-encoded URL string. - * - * Parses the \p encodedUrl string using the parseUrl() method - * and assings the result to the new created object. - * - * \param encodedUrl A percent-encoded URL string. - * \throws url::UrlParsingException if parsing of the url fails. - * \throws url::UrlNotAllowedException if one of the components - * is not allowed for the scheme. - * \throws url::UrlBadComponentException if one of the components - * contains an invalid character. - */ - Url(const std::string &encodedUrl); - - - // ----------------- - /** - * \brief Parse a percent-encoded URL string. - * - * Trys to parses the given string into generic URL components - * and created a clone of a scheme-specialized object or a new - * UrlBase object. - * - * \param encodedUrl A percent-encoded URL string. - * \return A reference to a (derived) UrlBase object or - * empty reference if the \p encodedUrl string - * does not match the generic URL syntax. - * \throws url::UrlNotAllowedException if one of the components - * is not allowed for the scheme. - * \throws url::UrlBadComponentException if one of the components - * contains an invalid character. - */ - static url::UrlRef - parseUrl(const std::string &encodedUrl); - - - // ----------------- - /** - * \brief Assigns parsed percent-encoded URL string to the object. - * - * Parses \p encodedUrl string using the parseUrl() method - * and assigns the result to the current object. - * - * \param encodedUrl A percent-encoded URL string. - * \return A reference to this Url object. - * \throws url::UrlParsingException if parsing of the url fails. - * \throws url::UrlNotAllowedException if one of the components - * is not allowed for the scheme. - * \throws url::UrlBadComponentException if one of the components - * contains an invalid character. - */ - Url& - operator = (const std::string &encodedUrl); - - - /** - * \brief Assign shared copy of \p url to the current object. - * - * Upon return, both objects will point to the same underlying - * object. This state will remain until one of the object is - * modified. - * - * \param url The Url object to make a copy of. - * \return A reference to this Url object. - */ - Url& - operator = (const Url &url); - - - // ----------------- - /** - * \brief Register a scheme-specific implementation. - * - * \param scheme A name of a scheme. - * \param urlImpl A UrlBase object specialized for this scheme. - * \return True, if the object claims to implement the scheme. - */ - static bool - registerScheme(const std::string &scheme, - url::UrlRef urlImpl); - - /** - * \brief Returns all registered scheme names. - * \return A vector with registered URL scheme names. - */ - static zypp::url::UrlSchemes - getRegisteredSchemes(); - - /** - * \brief Returns if scheme name is registered. - * \return True, if scheme name is registered. - */ - static bool - isRegisteredScheme(const std::string &scheme); - - - // ----------------- - /** - * \brief Returns scheme names known to this object. - * \return A vector with scheme names known by this object. - */ - zypp::url::UrlSchemes - getKnownSchemes() const; - - - /** - * \brief Verifies specified scheme name. - * - * Verifies the generic syntax of the specified \p scheme name - * and if it is contained in the current object's list of known - * schemes (see getKnownSchemes()) if the list is not empty. - * - * The default implementation in the UrlBase class returns an - * emtpy list of known schemes, causing a check of the generic - * syntax only. - * - * \return True, if generic scheme name syntax is valid and - * the scheme name is known to the current object. - */ - bool - isValidScheme(const std::string &scheme) const; - - - /** hd cd dvd dir file iso */ - static bool schemeIsLocal( const std::string & scheme_r ); - /** \overload nonstatic version */ - bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); } - - /** nfs nfs4 smb cifs http https ftp sftp tftp */ - static bool schemeIsRemote( const std::string & scheme_r ); - /** \overload nonstatic version */ - bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); } - - /** cd dvd */ - static bool schemeIsVolatile( const std::string & scheme_r ); - /** \overload nonstatic version */ - bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); } - - /** http https ftp sftp tftp */ - static bool schemeIsDownloading( const std::string & scheme_r ); - /** \overload nonstatic version */ - bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); } - - /** - * \brief Verifies the Url. - * - * Verifies if the current object contains a non-empty scheme - * name. Additional semantical URL checks may be performed by - * derived UrlBase objects. - * - * \return True, if the Url seems to be valid. - */ - bool - isValid() const; - - - // ----------------- - /** - * Returns a default string representation of the Url object. - * - * By default, a password in the URL will be hidden. - * - * \return A default string representation of the Url object. - */ - std::string - asString() const; - - /** - * Returns a string representation of the Url object. - * - * To include a password in the resulting Url string, use: - * \code - * url.asString(url.getViewOptions() + - * url::ViewOptions::WITH_PASSWORD); - * \endcode - * - * \param opts A combination of view options. - * \return A string representation of the Url object. - */ - std::string - asString(const ViewOptions &opts) const; - - /** - * Returns a complete string representation of the Url object. - * - * This function ignores the configuration of the view options - * in the current object (see setViewOption()) and forces to - * return an string with all URL components included. - * - * \return A complete string representation of the Url object. - */ - std::string - asCompleteString() const; - - - // ----------------- - /** - * Returns the scheme name of the URL. - * \return Scheme name of the current Url object. - */ - std::string - getScheme() const; - - - // ----------------- - /** - * Returns the encoded authority component of the URL. - * - * The returned authority string does not contain the leading - * "//" separator characters, but just its "user:pass@host:port" - * content only. - * - * \return The encoded authority component string. - */ - std::string - getAuthority() const; - - /** - * Returns the username from the URL authority. - * \param eflag Flag if the usename should be percent-decoded or not. - * \return The username sub-component from the URL authority. - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getUsername(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Returns the password from the URL authority. - * \param eflag Flag if the password should be percent-decoded or not. - * \return The password sub-component from the URL authority. - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getPassword(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Returns \c true if username \b and password are encoded in the authority component. - */ - bool hasCredentialsInAuthority() const - { return ! ( getUsername().empty() || getPassword().empty() ); } - - /** - * Returns the hostname or IP from the URL authority. - * - * In case the Url contains an IP number, it may be surrounded - * by "[" and "]" characters, for example "[::1]" for an IPv6 - * localhost address. - * - * \param eflag Flag if the host should be percent-decoded or not. - * \return The host sub-component from the URL authority. - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getHost(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Returns the port from the URL authority. - * \return The port sub-component from the URL authority. - */ - std::string - getPort() const; - - - // ----------------- - /** - * Returns the encoded path component of the URL. - * - * The path data contains the path name, optionally - * followed by path parameters separated with a ";" - * character, for example "/foo/bar;version=1.1". - * - * \return The encoded path component of the URL. - */ - std::string - getPathData() const; - - /** - * Returns the path name from the URL. - * \param eflag Flag if the path should be decoded or not. - * \return The path name sub-component without path parameters - * from Path-Data component of the URL. - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getPathName(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Returns the path parameters from the URL. - * \return The encoded path parameters from the URL. - */ - std::string - getPathParams() const; - - /** - * Returns a vector with path parameter substrings. - * - * The default path parameter separator is the \c ',' character. - * A schema specific object may overide the default separators. - * - * For example, the path parameters string "foo=1,bar=2" is splited - * by default into a vector containing the substrings "foo=1" and - * "bar=2". - * - * \return The path parameters splited into a vector of substrings. - */ - zypp::url::ParamVec - getPathParamsVec() const; - - /** - * Returns a string map with path parameter keys and values. - * - * The default path parameter separator is the \c ',' character, - * the default key/value separator for the path parameters is - * the \c '=' character. - * A schema specific object may overide the default separators. - * - * For example, the path parameters string "foo=1,bar=2" is splited - * into a map containing "foo" = "1" and "bar" = "2" by default. - * - * \param eflag Flag if the path parameter keys and values should - * be decoded or not. - * \return The path parameters key and values as a string map. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - zypp::url::ParamMap - getPathParamsMap(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Return the value for the specified path parameter. - * - * For example, if the path parameters string is "foo=1,bar=2" - * the method will return the substring "1" for the param key - * "foo" and "2" for the param key "bar". - * - * \param param The path parameter key. - * \param eflag Flag if the path parameter keys and values should - * be decoded or not. - * \return The value for the path parameter key or empty string. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getPathParam(const std::string ¶m, - EEncoding eflag = zypp::url::E_DECODED) const; - - - // ----------------- - /** - * Returns the encoded query string component of the URL. - * - * The query string is returned without first "?" (separator) - * character. Further "?" characters as in e.g. LDAP URL's - * remains in the returned string. - * - * \return The encoded query string component of the URL. - */ - std::string - getQueryString() const; - - /** - * Returns a vector with query string parameter substrings. - * - * The default query string parameter separator is the \c '&' - * character. - * A schema specific object may overide the default separators. - * - * For example, the query string "foo=1&bar=2" is splited by - * default into a vector containing the substrings "foo=1" and - * "bar=2". - * - * \return The query string splited into a vector of substrings. - */ - zypp::url::ParamVec - getQueryStringVec() const; - - /** - * Returns a string map with query parameter and their values. - * - * The default query string parameter separator is the \c ',' - * character, the default key/value separator the \c '=' character. - * A schema specific object may overide the default separators. - * - * For example, the query string "foo=1&bar=2" is splited by - * default into a map containing "foo" = "1" and "bar" = "2". - * - * \param eflag Flag if the query string keys and values should - * be decoded or not. - * \return The query string as a key/value string map. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - zypp::url::ParamMap - getQueryStringMap(EEncoding eflag = zypp::url::E_DECODED) const; - - /** - * Return the value for the specified query parameter. - * - * For example, if the query string is "foo=1,bar=2" the method - * will return the substring "1" for the param key "foo" and - * "2" for the param key "bar". - * - * \param param The query parameter key. - * \param eflag Flag if the query parameter keys and values should - * be decoded or not. - * \return The value for the query parameter key or empty string. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getQueryParam(const std::string ¶m, - EEncoding eflag = zypp::url::E_DECODED) const; - - - // ----------------- - /** - * Returns the encoded fragment component of the URL. - * \param eflag Flag if the fragment should be percent-decoded or not. - * \return The encoded fragment component of the URL. - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - std::string - getFragment(EEncoding eflag = zypp::url::E_DECODED) const; - - - // ----------------- - /** - * \brief Set the scheme name in the URL. - * \param scheme The new scheme name. - * \throws url::UrlBadComponentException if the \p scheme - * contains an invalid character or is empty. - */ - void - setScheme(const std::string &scheme); - - - // ----------------- - /** - * \brief Set the authority component in the URL. - * - * The \p authority string shoud contain the "user:pass@host:port" - * sub-components without any leading "//" separator characters. - * - * \param authority The encoded authority component string. - * \throws url::UrlNotAllowedException if the \p authority - * has to be empty in for the current scheme. - * \throws url::UrlBadComponentException if the \p authority - * contains an invalid character. - * \throws url::UrlParsingException if \p authority parsing fails. - */ - void - setAuthority(const std::string &authority); - - /** - * \brief Set the username in the URL authority. - * \param user The new username. - * \param eflag If the \p username is encoded or not. - * \throws url::UrlNotAllowedException if the \p user - * has to be empty in for the current scheme - * \throws url::UrlBadComponentException if the \p user - * contains an invalid character. - */ - void - setUsername(const std::string &user, - EEncoding eflag = zypp::url::E_DECODED); - - /** - * \brief Set the password in the URL authority. - * \param pass The new password. - * \param eflag If the \p password is encoded or not. - * \throws url::UrlNotAllowedException if the \p pass - * has to be empty in for the current scheme. - * \throws url::UrlBadComponentException if the \p pass - * contains an invalid character. - */ - void - setPassword(const std::string &pass, - EEncoding eflag = zypp::url::E_DECODED); - - /** - * \brief Set the hostname or IP in the URL authority. - * - * The \p host parameter may contain a hostname, an IPv4 address - * in dotted-decimal form or an IPv6 address literal encapsulated - * within square brackets (RFC3513, Sect. 2.2). - * - * A hostname may contain national alphanumeric UTF8 characters - * (letters other than ASCII a-z0-9), that will be encoded. - * This function allows to specify both, a encoded or decoded - * hostname. - * - * Other IP literals in "[v ... ]" square bracket format are not - * supported by the implementation in UrlBase class. - * - * \param host The new hostname or IP address. - * \throws url::UrlNotAllowedException if the \p host (authority) - * has to be empty in for the current scheme. - * \throws url::UrlBadComponentException if the \p host is invalid. - */ - void - setHost(const std::string &host); - - /** - * \brief Set the port number in the URL authority. - * \param port The new port number. - * \throws url::UrlNotAllowedException if the \p port (authority) - * has to be empty in for the current scheme. - * \throws url::UrlBadComponentException if the \p port is invalid. - */ - void - setPort(const std::string &port); - - - // ----------------- - /** - * \brief Set the path data component in the URL. - * - * By default, the \p pathdata string may include path - * parameters separated by the ";" separator character. - * - * \param pathdata The encoded path data component string. - * \throws url::UrlBadComponentException if the \p pathdata - * contains an invalid character. - */ - void - setPathData(const std::string &pathdata); - - /** - * \brief Set the path name. - * \param path The new path name. - * \param eflag If the \p path name is encoded or not. - * \throws url::UrlBadComponentException if the \p path name - * contains an invalid character. - */ - void - setPathName(const std::string &path, - EEncoding eflag = zypp::url::E_DECODED); - /** \overload */ - void - setPathName(const Pathname &path, - EEncoding eflag = zypp::url::E_DECODED); - /** \overload */ - void - setPathName(const char *path, - EEncoding eflag = zypp::url::E_DECODED); - - /** - * \brief Set the path parameters. - * \param params The new encoded path parameter string. - * \throws url::UrlBadComponentException if the path \p params - * contains an invalid character. - */ - void - setPathParams(const std::string ¶ms); - - /** - * \brief Set the path parameters. - * \param pvec The vector with encoded path parameters. - * \throws url::UrlBadComponentException if the \p pvec - * contains an invalid character. - */ - void - setPathParamsVec(const zypp::url::ParamVec &pvec); - - /** - * \brief Set the path parameters. - * \param pmap The map with decoded path parameters. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - */ - void - setPathParamsMap(const zypp::url::ParamMap &pmap); - - /** - * \brief Set or add value for the specified path parameter. - * \param param The decoded path parameter name. - * \param value The decoded path parameter value. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - void - setPathParam(const std::string ¶m, const std::string &value); - - - // ----------------- - /** - * \brief Set the query string in the URL. - * \param querystr The new encoded query string. - * \throws url::UrlBadComponentException if the \p querystr - * contains an invalid character. - */ - void - setQueryString(const std::string &querystr); - - /** - * \brief Set the query parameters. - * \param qvec The vector with encoded query parameters. - * \throws url::UrlBadComponentException if the \p qvec - * contains an invalid character. - */ - void - setQueryStringVec(const zypp::url::ParamVec &qvec); - - /** - * \brief Set the query parameters. - * \param qmap The map with decoded query parameters. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - */ - void - setQueryStringMap(const zypp::url::ParamMap &qmap); - - /** - * \brief Set or add value for the specified query parameter. - * \param param The decoded query parameter name. - * \param value The decoded query parameter value. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - void - setQueryParam(const std::string ¶m, const std::string &value); - - /** - * \brief remove the specified query parameter. - * \param param The decoded query parameter name. - * \throws url::UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws url::UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - void - delQueryParam(const std::string ¶m); - - - // ----------------- - /** - * \brief Set the fragment string in the URL. - * \param fragment The new fragment string. - * \param eflag If the \p fragment is encoded or not. - * \throws url::UrlBadComponentException if the \p fragment - * contains an invalid character. - */ - void - setFragment(const std::string &fragment, - EEncoding eflag = zypp::url::E_DECODED); - - - // ----------------- - /** - * Return the view options of the current object. - * - * This method is used to query the view options - * used by the asString() method. - * - * \return The current view option combination. - */ - ViewOptions - getViewOptions() const; - - /** - * Change the view options of the current object. - * - * This method is used to change the view options - * used by the asString() method. - * - * \param vopts New view options combination. - */ - void - setViewOptions(const ViewOptions &vopts); - - private: - url::UrlRef m_impl; - }; - - std::ostream & operator<<( std::ostream & str, const Url & url ); - - /** - * needed for std::set - */ - bool operator<( const Url &lhs, const Url &rhs ); - - /** - * needed for find - */ - bool operator==( const Url &lhs, const Url &rhs ); - - - bool operator!=( const Url &lhs, const Url &rhs ); - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif /* ZYPP_URL_H */ -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/UserData.h b/libzypp/zypp/UserData.h deleted file mode 100644 index acb5526..0000000 --- a/libzypp/zypp/UserData.h +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/UserData.h - */ -#ifndef ZYPP_USERDATA_H -#define ZYPP_USERDATA_H - -#include -#include -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/ContentType.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace callback - { - /////////////////////////////////////////////////////////////////// - /// \class UserData - /// \brief Typesafe passing of user data via callbacks - /// - /// Basically a std::map plus - /// associated \ref ContentType. - /////////////////////////////////////////////////////////////////// - class UserData - { - typedef std::map DataType; - public: - /** Default ctor */ - UserData() - {} - - public: - /** Get type */ - const ContentType & type() const - { return _type; } - - /** Set type */ - void type( const ContentType & type_r ) - { _type = type_r; } - - public: - /** Validate object in a boolean context: has data */ - explicit operator bool() const - { return ! ( _dataP == nullptr || _dataP->empty() ); } - - private: - ContentType _type; - shared_ptr _dataP; - }; - - /** \relates UserData Stream output */ - inline std::ostream & operator<<( std::ostream & str, const UserData & obj ) - { return str << "UserData(" << obj.type() << ")";} - - } // namespace callback - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_USERDATA_H diff --git a/libzypp/zypp/Vendor.h b/libzypp/zypp/Vendor.h deleted file mode 100644 index 8de5063..0000000 --- a/libzypp/zypp/Vendor.h +++ /dev/null @@ -1,30 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/Vendor.h - * -*/ -#ifndef ZYPP_VENDOR_H -#define ZYPP_VENDOR_H - -#include -#include "zypp/IdString.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - typedef std::string Vendor; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#include "VendorAttr.h" - -#endif // ZYPP_VENDOR_H diff --git a/libzypp/zypp/VendorAttr.cc b/libzypp/zypp/VendorAttr.cc deleted file mode 100644 index 2cef434..0000000 --- a/libzypp/zypp/VendorAttr.cc +++ /dev/null @@ -1,310 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/* - File: VendorAttr.cc - - Author: Michael Andres - Maintainer: Michael Andres - - Purpose: Manage vendor attributes - -/-*/ - -#include -#include -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/PathInfo.h" -#include "zypp/VendorAttr.h" -#include "zypp/ZYppFactory.h" - -#include "zypp/ZConfig.h" -#include "zypp/PathInfo.h" -#include "zypp/parser/IniDict.h" - -using namespace std; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::VendorAttr" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - typedef map VendorMap; - VendorMap _vendorMap; - unsigned int vendorGroupCounter; - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - typedef DefaultIntegral VendorMatchEntry; - typedef std::tr1::unordered_map VendorMatch; - int _nextId = -1; - VendorMatch _vendorMatch; - - /** Reset match cache if global VendorMap was changed. */ - inline void vendorMatchIdReset() - { - _nextId = -1; - _vendorMatch.clear(); - } - - /** - * Helper mapping vendor string to eqivalence class ID. - * - * \li Return the vendor strings eqivalence class ID stored in _vendorMatch. - * \li If not found, assign and return the eqivalence class ID of the lowercased string. - * \li If not found, assign and return a new ID (look into the predefined VendorMap (id>0), - * otherwise create a new ID (<0)). - */ - inline unsigned vendorMatchId( IdString vendor ) - { - VendorMatchEntry & ent( _vendorMatch[vendor] ); - if ( ! ent ) - { - IdString lcvendor( str::toLower( vendor.asString() ) ); - VendorMatchEntry & lcent( _vendorMatch[lcvendor] ); - if ( ! lcent ) - { - unsigned myid = 0; - // bnc#812608: no pefix compare in opensuse namespace - static const IdString openSUSE( "opensuse" ); - if ( lcvendor == openSUSE || ! str::hasPrefix( lcvendor.c_str(), openSUSE.c_str() ) ) - { - // Compare this entry with the global vendor map. - // Reversed to get the longest prefix. - for ( VendorMap::reverse_iterator it = _vendorMap.rbegin(); it != _vendorMap.rend(); ++it ) - { - if ( str::hasPrefix( lcvendor.c_str(), it->first ) ) - { - myid = it->second; - break; // found - } - } - } - if ( ! myid ) - { - myid = --_nextId; // get a new class ID - } - ent = lcent = myid; // remember the new DI - } - else - { - ent = lcent; // take the ID from the lowercased vendor string - } - } - return ent; - } - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - const VendorAttr & VendorAttr::instance() - { - static VendorAttr _val; - return _val; - } - - VendorAttr::VendorAttr () - { - vendorGroupCounter = 1; - Pathname vendorPath (ZConfig::instance().vendorPath()); - { - Target_Ptr trg( getZYpp()->getTarget() ); - if ( trg ) - vendorPath = trg->root() / vendorPath; - } - // creating entries - addVendorDirectory (vendorPath); - - // Checking if suse,opensuse has been defined, else create entries: - // - if both are defined we leve them as thay are. - // - if only one of them is defined, we add the other to the same group. - // - if both are undefined they make up a new group - VendorMap::const_iterator suseit( _vendorMap.find("suse") ); - VendorMap::const_iterator opensuseit( _vendorMap.find("opensuse") ); - if ( suseit == _vendorMap.end() ) - { - if ( opensuseit == _vendorMap.end() ) - { - // both are undefined - _vendorMap["suse"] = _vendorMap["opensuse"] = ++vendorGroupCounter; - } - else - { - // add suse to opensuse - _vendorMap["suse"] = opensuseit->second; - } - } - else if ( opensuseit == _vendorMap.end() ) - { - // add opensuse to suse - _vendorMap["opensuse"] = suseit->second; - } - - MIL << *this << endl; - } - - void VendorAttr::_addVendorList( VendorList & vendorList_r ) const - { - unsigned int nextId = vendorGroupCounter + 1; - // convert to lowercase and check if a vendor is already defined - // in an existing group. - - for_( it, vendorList_r.begin(), vendorList_r.end() ) - { - *it = str::toLower( *it ); - if (_vendorMap.find(*it) != _vendorMap.end()) - { - if (nextId != vendorGroupCounter + 1 && - nextId != _vendorMap[*it]) - { - // We have at least 3 groups which has to be mixed --> mix the third group to the first - unsigned int moveID = _vendorMap[*it]; - for_( itMap, _vendorMap.begin(), _vendorMap.end() ) - { - if (itMap->second == moveID) - itMap->second = nextId; - } - } - else - { - nextId = _vendorMap[*it]; - WAR << "Vendor " << *it << " is already used in another vendor group. --> mixing these groups" << endl; - } - } - } - // add new entries - for_( it, vendorList_r.begin(), vendorList_r.end() ) - { - _vendorMap[*it] = nextId; - } - - if (nextId == vendorGroupCounter + 1) - ++vendorGroupCounter; - - // invalidate any match cache - vendorMatchIdReset(); - } - - bool VendorAttr::addVendorFile( const Pathname & filename ) const - { - parser::IniDict dict; - - if ( PathInfo(filename).isExist()) - { - InputStream is(filename); - dict.read(is); - } - else - { - MIL << filename << " not found." << endl; - return false; - } - - for ( parser::IniDict::section_const_iterator sit = dict.sectionsBegin(); - sit != dict.sectionsEnd(); - ++sit ) - { - string section(*sit); - //MIL << section << endl; - for ( parser::IniDict::entry_const_iterator it = dict.entriesBegin(*sit); - it != dict.entriesEnd(*sit); - ++it ) - { - string entry(it->first); - string value(it->second); - if ( section == "main" ) - { - if ( entry == "vendors" ) - { - VendorList vendorlist; - str::split( value, back_inserter(vendorlist), "," ); - _addVendorList (vendorlist); - break; - } - } - } - } - - return true; - } - - bool VendorAttr::addVendorDirectory( const Pathname & dirname ) const - { - if ( ! PathInfo(dirname).isExist() ) - { - MIL << dirname << " not found." << endl; - return false; - } - - list filenames; - - filesystem::readdir( filenames, - dirname, false ); - for (list::iterator it = filenames.begin(); - it != filenames.end(); ++it) { - MIL << "Adding file " << *it << endl; - addVendorFile( *it ); - } - return true; - } - - ////////////////////////////////////////////////////////////////// - // vendor equivalence: - ////////////////////////////////////////////////////////////////// - - bool VendorAttr::equivalent( IdString lVendor, IdString rVendor ) const - { - if ( lVendor == rVendor ) - return true; - return vendorMatchId( lVendor ) == vendorMatchId( rVendor ); - } - - bool VendorAttr::equivalent( const Vendor & lVendor, const Vendor & rVendor ) const - { return equivalent( IdString( lVendor ), IdString( rVendor ) ); - } - - bool VendorAttr::equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const - { return equivalent( lVendor.vendor(), rVendor.vendor() ); } - - bool VendorAttr::equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const - { return equivalent( lVendor.satSolvable().vendor(), rVendor.satSolvable().vendor() ); } - - ////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const VendorAttr & /*obj*/ ) - { - str << "Equivalent vendors:"; - for_( it, _vendorMap.begin(), _vendorMap.end() ) - { - str << endl << " [" << it->second << "] " << it->first; - } - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/VendorAttr.h b/libzypp/zypp/VendorAttr.h deleted file mode 100644 index 0f2a291..0000000 --- a/libzypp/zypp/VendorAttr.h +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/VendorAttr.h - * -*/ -#ifndef ZYPP_VENDORATTR_H -#define ZYPP_VENDORATTR_H - -#include -#include -#include - -#include "zypp/PathInfo.h" -#include "zypp/Vendor.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp { -////////////////////////////////////////////////////////////////// - - class PoolItem; - namespace sat - { - class Solvable; - } - -/** Definition of vendor equivalence. - * - * Packages with equivalment vendor strings may replace themself without - * creating a solver error. - * - * Per default vendor strings starting with \c "suse" or \c "opensuse" - * are treated equivalent. This may be changed by providing customized - * vendor description files in \c /etc/zypp/vendors.d. - * - * \see \ref pg_zypp-solv-vendorchange -*/ -class VendorAttr -{ - public: - typedef std::vector VendorList; - - /** Singleton */ - static const VendorAttr & instance(); - - /** - * Adding new equivalent vendors described in a directory - **/ - bool addVendorDirectory( const Pathname & dirname ) const; - - /** - * Adding new equivalent vendors described in a file - **/ - bool addVendorFile( const Pathname & filename ) const; - - /** - * Adding new equivalent vendor set from list - **/ - template - void addVendorList( _Iterator begin, _Iterator end ) const - { VendorList tmp( begin, end ); _addVendorList( tmp ); } - - /** Return whether two vendor strings shold be treated as the same vendor. - * Usually the solver is allowed to automatically select a package of an - * equivalent vendor when updating. Replacing a package with one of a - * different vendor usually must be confirmed by the user. - */ - bool equivalent( const Vendor & lVendor, const Vendor & rVendor ) const; - /** \overload using \ref IdStrings */ - bool equivalent( IdString lVendor, IdString rVendor ) const; - /** \overload using \ref sat::Solvable */ - bool equivalent( sat::Solvable lVendor, sat::Solvable rVendor ) const; - /** \overload using \ref PoolItem */ - bool equivalent( const PoolItem & lVendor, const PoolItem & rVendor ) const; - - private: - VendorAttr(); - void _addVendorList( VendorList & ) const; -}; - -/** \relates VendorAttr Stream output */ -std::ostream & operator<<( std::ostream & str, const VendorAttr & obj ); - -/////////////////////////////////////////////////////////////////// -}; // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif // ZYPP_VENDORATTR_H diff --git a/libzypp/zypp/VendorSupportOptions.cc b/libzypp/zypp/VendorSupportOptions.cc deleted file mode 100644 index 8839906..0000000 --- a/libzypp/zypp/VendorSupportOptions.cc +++ /dev/null @@ -1,61 +0,0 @@ - -#include "zypp/VendorSupportOptions.h" -#include "zypp/base/Gettext.h" - -namespace zypp -{ - -std::string -asUserString( VendorSupportOption opt ) -{ - switch (opt) - { - case VendorSupportUnknown: - return _("unknown"); - break; - case VendorSupportUnsupported: - return _("unsupported"); - break; - case VendorSupportLevel1: - return _("Level 1"); - break; - case VendorSupportLevel2: - return _("Level 2"); - break; - case VendorSupportLevel3: - return _("Level 3"); - break; - case VendorSupportACC: - return _("Additional Customer Contract Necessary"); - } - return _("invalid"); -} - -std::string asUserStringDescription( VendorSupportOption opt ) -{ - switch (opt) - { - case VendorSupportUnknown: - return _("The level of support is unspecified"); - break; - case VendorSupportUnsupported: - return _("The vendor does not provide support."); - break; - case VendorSupportLevel1: - return _("Problem determination, which means technical support designed to provide compatibility information, installation assistance, usage support, on-going maintenance and basic troubleshooting. Level 1 Support is not intended to correct product defect errors."); - break; - case VendorSupportLevel2: - return _("Problem isolation, which means technical support designed to duplicate customer problems, isolate problem area and provide resolution for problems not resolved by Level 1 Support."); - break; - case VendorSupportLevel3: - return _("Problem resolution, which means technical support designed to resolve complex problems by engaging engineering in resolution of product defects which have been identified by Level 2 Support."); - break; - case VendorSupportACC: - return _("An additional customer contract is necessary for getting support."); - } - return _("Unknown support option. Description not available"); -} - -} - - diff --git a/libzypp/zypp/VendorSupportOptions.h b/libzypp/zypp/VendorSupportOptions.h deleted file mode 100644 index 497ba48..0000000 --- a/libzypp/zypp/VendorSupportOptions.h +++ /dev/null @@ -1,87 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/VendorSupportOptions.h - * -*/ -#ifndef ZYPP_VendorSupportOptions_H -#define ZYPP_VendorSupportOptions_H - -#include -#include "zypp/base/Flags.h" - -namespace zypp -{ - - enum VendorSupportOption - { - /** - * The support for this package is unknown - */ - VendorSupportUnknown = 0, - /** - * The package is known to be unsupported by the vendor - */ - VendorSupportUnsupported = (1<<0), - /** - * Additional Customer Contract necessary - */ - VendorSupportACC = (1<<1), - /** - * Problem determination, which means technical support - * designed to provide compatibility information, - * installation assistance, usage support, on-going maintenance - * and basic troubleshooting. Level 1 Support is not intended to - * correct product defect errors. - * - * May have different semantics for different organizations. - */ - VendorSupportLevel1 = (1<<2), - /** - * Problem isolation, which means technical support designed - * to duplicate customer problems, isolate problem area and provide - * resolution for problems not resolved by Level 1 Support. - * - * May have different semantics for different organizations. - */ - VendorSupportLevel2 = (1<<3), - /** - * Problem resolution, which means technical support designed - * to resolve complex problems by engaging engineering in resolution - * of product defects which have been identified by Level 2 Support. - * - * May have different semantics for different organizations. - */ - VendorSupportLevel3 = (1<<4) - }; - - // Make a flag set for this - ZYPP_DECLARE_FLAGS(VendorSupportOptions,VendorSupportOption); - ZYPP_DECLARE_OPERATORS_FOR_FLAGS(VendorSupportOptions) - - /** - * converts the support option to a name intended to be printed - * to the user. - * - * Note the description is based in the way Novell defines the support - * levels, and the semantics may be different for other vendors. - */ - std::string asUserString( VendorSupportOption ); - - /** - * converts the support option to a description intended to be printed - * to the user. - * - * Note the description is based in the way Novell defines the support - * levels, and the semantics may be different for other vendors. - */ - std::string asUserStringDescription( VendorSupportOption ); - -} - -#endif diff --git a/libzypp/zypp/ZConfig.cc b/libzypp/zypp/ZConfig.cc deleted file mode 100644 index a28c7d4..0000000 --- a/libzypp/zypp/ZConfig.cc +++ /dev/null @@ -1,987 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZConfig.cc - * -*/ -extern "C" -{ -#include -#include -#if __GLIBC_PREREQ (2,16) -#include // getauxval for PPC64P7 detection -#endif -#include -#include -} -#include -#include -#include "zypp/base/Logger.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/base/String.h" - -#include "zypp/ZConfig.h" -#include "zypp/ZYppFactory.h" -#include "zypp/PathInfo.h" -#include "zypp/parser/IniDict.h" - -#include "zypp/sat/Pool.h" - -using namespace std; -using namespace zypp::filesystem; -using namespace zypp::parser; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zconfig" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /** \addtogroup ZyppConfig Zypp Configuration Options - * - * The global \c zypp.conf configuration file is per default located in \c /etc/zypp/. - * An alternate config file can be set using the environment varaible \c ZYPP_CONF= - * (see \ref zypp-envars). - * - * \section ZyppConfig_ZyppConfSample Sample zypp.conf - * \include ../zypp.conf - */ - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - /** Determine system architecture evaluating \c uname and \c /proc/cpuinfo. - */ - Arch _autodetectSystemArchitecture() - { - struct ::utsname buf; - if ( ::uname( &buf ) < 0 ) - { - ERR << "Can't determine system architecture" << endl; - return Arch_noarch; - } - - Arch architecture( buf.machine ); - MIL << "Uname architecture is '" << buf.machine << "'" << endl; - - if ( architecture == Arch_i686 ) - { - // some CPUs report i686 but dont implement cx8 and cmov - // check for both flags in /proc/cpuinfo and downgrade - // to i586 if either is missing (cf bug #18885) - std::ifstream cpuinfo( "/proc/cpuinfo" ); - if ( cpuinfo ) - { - for( iostr::EachLine in( cpuinfo ); in; in.next() ) - { - if ( str::hasPrefix( *in, "flags" ) ) - { - if ( in->find( "cx8" ) == std::string::npos - || in->find( "cmov" ) == std::string::npos ) - { - architecture = Arch_i586; - WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl; - } - break; - } - } - } - else - { - ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl; - } - } - else if ( architecture == Arch_sparc || architecture == Arch_sparc64 ) - { - // Check for sun4[vum] to get the real arch. (bug #566291) - std::ifstream cpuinfo( "/proc/cpuinfo" ); - if ( cpuinfo ) - { - for( iostr::EachLine in( cpuinfo ); in; in.next() ) - { - if ( str::hasPrefix( *in, "type" ) ) - { - if ( in->find( "sun4v" ) != std::string::npos ) - { - architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v ); - WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl; - } - else if ( in->find( "sun4u" ) != std::string::npos ) - { - architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 ); - WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl; - } - else if ( in->find( "sun4m" ) != std::string::npos ) - { - architecture = Arch_sparcv8; - WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl; - } - break; - } - } - } - else - { - ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl; - } - } - else if ( architecture == Arch_armv7l || architecture == Arch_armv6l ) - { - std::ifstream platform( "/etc/rpm/platform" ); - if (platform) - { - for( iostr::EachLine in( platform ); in; in.next() ) - { - if ( str::hasPrefix( *in, "armv7hl-" ) ) - { - architecture = Arch_armv7hl; - WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl; - break; - } - if ( str::hasPrefix( *in, "armv6hl-" ) ) - { - architecture = Arch_armv6hl; - WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl; - break; - } - } - } - } -#if __GLIBC_PREREQ (2,16) - else if ( architecture == Arch_ppc64 ) - { - const char * platform = (const char *)getauxval( AT_PLATFORM ); - int powerlvl; - if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 ) - architecture = Arch_ppc64p7; - } -#endif - return architecture; - } - - /** The locale to be used for texts and messages. - * - * For the encoding to be used the preference is - * - * LC_ALL, LC_CTYPE, LANG - * - * For the language of the messages to be used, the preference is - * - * LANGUAGE, LC_ALL, LC_MESSAGES, LANG - * - * Note that LANGUAGE can contain more than one locale name, it can be - * a list of locale names like for example - * - * LANGUAGE=ja_JP.UTF-8:de_DE.UTF-8:fr_FR.UTF-8 - - * \todo Support dynamic fallbacklists defined by LANGUAGE - */ - Locale _autodetectTextLocale() - { - Locale ret( "en" ); - const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL }; - for ( const char ** envvar = envlist; *envvar; ++envvar ) - { - const char * envlang = getenv( *envvar ); - if ( envlang ) - { - std::string envstr( envlang ); - if ( envstr != "POSIX" && envstr != "C" ) - { - Locale lang( envstr ); - if ( ! lang.code().empty() ) - { - MIL << "Found " << *envvar << "=" << envstr << endl; - ret = lang; - break; - } - } - } - } - MIL << "Default text locale is '" << ret << "'" << endl; -#warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS - setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 ); - return ret; - } - - ///////////////////////////////////////////////////////////////// - } // namespace zypp - /////////////////////////////////////////////////////////////////// - - /** Mutable option. */ - template - struct Option - { - typedef _Tp value_type; - - /** No default ctor, explicit initialisation! */ - Option( const value_type & initial_r ) - : _val( initial_r ) - {} - - /** Get the value. */ - const value_type & get() const - { return _val; } - - /** Autoconversion to value_type. */ - operator const value_type &() const - { return _val; } - - /** Set a new value. */ - void set( const value_type & newval_r ) - { _val = newval_r; } - - /** Non-const reference to set a new value. */ - value_type & ref() - { return _val; } - - private: - value_type _val; - }; - - /** Mutable option with initial value also remembering a config value. */ - template - struct DefaultOption : public Option<_Tp> - { - typedef _Tp value_type; - typedef Option<_Tp> option_type; - - DefaultOption( const value_type & initial_r ) - : Option<_Tp>( initial_r ), _default( initial_r ) - {} - - /** Reset value to the current default. */ - void restoreToDefault() - { this->set( _default.get() ); } - - /** Reset value to a new default. */ - void restoreToDefault( const value_type & newval_r ) - { setDefault( newval_r ); restoreToDefault(); } - - /** Get the current default value. */ - const value_type & getDefault() const - { return _default.get(); } - - /** Set a new default value. */ - void setDefault( const value_type & newval_r ) - { _default.set( newval_r ); } - - private: - option_type _default; - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZConfig::Impl - // - /** ZConfig implementation. - * \todo Enrich section and entry definition by some comment - * (including the default setting and provide some method to - * write this into a sample zypp.conf. - */ - class ZConfig::Impl - { - public: - Impl( const Pathname & override_r = Pathname() ) - : _parsedZyppConf ( override_r ) - , cfg_arch ( defaultSystemArchitecture() ) - , cfg_textLocale ( defaultTextLocale() ) - , updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" ) - , repo_add_probe ( false ) - , repo_refresh_delay ( 10 ) - , repoLabelIsAlias ( false ) - , download_use_deltarpm ( true ) - , download_use_deltarpm_always ( false ) - , download_media_prefer_download( true ) - , download_max_concurrent_connections( 5 ) - , download_min_download_speed ( 0 ) - , download_max_download_speed ( 0 ) - , download_max_silent_tries ( 5 ) - , download_transfer_timeout ( 180 ) - , commit_downloadMode ( DownloadDefault ) - , solver_onlyRequires ( false ) - , solver_allowVendorChange ( false ) - , solver_cleandepsOnRemove ( false ) - , solver_upgradeTestcasesToKeep ( 2 ) - , solverUpgradeRemoveDroppedPackages( true ) - , apply_locks_file ( true ) - , pluginsPath ( "/usr/lib/zypp/plugins" ) - { - MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl; - // override_r has higest prio - // ZYPP_CONF might override /etc/zypp/zypp.conf - if ( _parsedZyppConf.empty() ) - { - const char *env_confpath = getenv( "ZYPP_CONF" ); - _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf"; - } - else - { - // Inject this into ZConfig. Be shure this is - // allocated via new. See: reconfigureZConfig - INT << "Reconfigure to " << _parsedZyppConf << endl; - ZConfig::instance()._pimpl.reset( this ); - } - if ( PathInfo(_parsedZyppConf).isExist() ) - { - parser::IniDict dict( _parsedZyppConf ); - for ( IniDict::section_const_iterator sit = dict.sectionsBegin(); - sit != dict.sectionsEnd(); - ++sit ) - { - string section(*sit); - //MIL << section << endl; - for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit); - it != dict.entriesEnd(*sit); - ++it ) - { - string entry(it->first); - string value(it->second); - //DBG << (*it).first << "=" << (*it).second << endl; - if ( section == "main" ) - { - if ( entry == "arch" ) - { - Arch carch( value ); - if ( carch != cfg_arch ) - { - WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl; - cfg_arch = carch; - } - } - else if ( entry == "cachedir" ) - { - cfg_cache_path = Pathname(value); - } - else if ( entry == "metadatadir" ) - { - cfg_metadata_path = Pathname(value); - } - else if ( entry == "solvfilesdir" ) - { - cfg_solvfiles_path = Pathname(value); - } - else if ( entry == "packagesdir" ) - { - cfg_packages_path = Pathname(value); - } - else if ( entry == "configdir" ) - { - cfg_config_path = Pathname(value); - } - else if ( entry == "reposdir" ) - { - cfg_known_repos_path = Pathname(value); - } - else if ( entry == "servicesdir" ) - { - cfg_known_services_path = Pathname(value); - } - else if ( entry == "repo.add.probe" ) - { - repo_add_probe = str::strToBool( value, repo_add_probe ); - } - else if ( entry == "repo.refresh.delay" ) - { - str::strtonum(value, repo_refresh_delay); - } - else if ( entry == "repo.refresh.locales" ) - { - std::vector tmp; - str::split( value, back_inserter( tmp ), ", \t" ); - - boost::function transform( - [](const std::string & str_r)->Locale{ return Locale(str_r); } - ); - repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ), - make_transform_iterator( tmp.end(), transform ) ); - } - else if ( entry == "download.use_deltarpm" ) - { - download_use_deltarpm = str::strToBool( value, download_use_deltarpm ); - } - else if ( entry == "download.use_deltarpm.always" ) - { - download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always ); - } - else if ( entry == "download.media_preference" ) - { - download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 ); - } - else if ( entry == "download.max_concurrent_connections" ) - { - str::strtonum(value, download_max_concurrent_connections); - } - else if ( entry == "download.min_download_speed" ) - { - str::strtonum(value, download_min_download_speed); - } - else if ( entry == "download.max_download_speed" ) - { - str::strtonum(value, download_max_download_speed); - } - else if ( entry == "download.max_silent_tries" ) - { - str::strtonum(value, download_max_silent_tries); - } - else if ( entry == "download.transfer_timeout" ) - { - str::strtonum(value, download_transfer_timeout); - if ( download_transfer_timeout < 0 ) download_transfer_timeout = 0; - else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600; - } - else if ( entry == "commit.downloadMode" ) - { - commit_downloadMode.set( deserializeDownloadMode( value ) ); - } - else if ( entry == "vendordir" ) - { - cfg_vendor_path = Pathname(value); - } - else if ( entry == "multiversiondir" ) - { - cfg_multiversion_path = Pathname(value); - } - else if ( entry == "solver.onlyRequires" ) - { - solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) ); - } - else if ( entry == "solver.allowVendorChange" ) - { - solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) ); - } - else if ( entry == "solver.cleandepsOnRemove" ) - { - solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) ); - } - else if ( entry == "solver.upgradeTestcasesToKeep" ) - { - solver_upgradeTestcasesToKeep.set( str::strtonum( value ) ); - } - else if ( entry == "solver.upgradeRemoveDroppedPackages" ) - { - solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) ); - } - else if ( entry == "solver.checkSystemFile" ) - { - solver_checkSystemFile = Pathname(value); - } - else if ( entry == "solver.checkSystemFileDir" ) - { - solver_checkSystemFileDir = Pathname(value); - } - else if ( entry == "multiversion" ) - { - str::split( value, inserter( _multiversion, _multiversion.end() ), ", \t" ); - } - else if ( entry == "locksfile.path" ) - { - locks_file = Pathname(value); - } - else if ( entry == "locksfile.apply" ) - { - apply_locks_file = str::strToBool( value, apply_locks_file ); - } - else if ( entry == "update.datadir" ) - { - update_data_path = Pathname(value); - } - else if ( entry == "update.scriptsdir" ) - { - update_scripts_path = Pathname(value); - } - else if ( entry == "update.messagessdir" ) - { - update_messages_path = Pathname(value); - } - else if ( entry == "update.messages.notify" ) - { - updateMessagesNotify.set( value ); - } - else if ( entry == "rpm.install.excludedocs" ) - { - rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS, - str::strToBool( value, false ) ); - } - else if ( entry == "history.logfile" ) - { - history_log_path = Pathname(value); - } - else if ( entry == "credentials.global.dir" ) - { - credentials_global_dir_path = Pathname(value); - } - else if ( entry == "credentials.global.file" ) - { - credentials_global_file_path = Pathname(value); - } - } - } - } - } - else - { - MIL << _parsedZyppConf << " not found, using defaults instead." << endl; - _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" ); - } - - // legacy: - if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) ) - { - Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) ); - if ( carch != cfg_arch ) - { - WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl; - cfg_arch = carch; - } - } - MIL << "ZConfig singleton created." << endl; - } - - ~Impl() - {} - - public: - /** Remember any parsed zypp.conf. */ - Pathname _parsedZyppConf; - - Arch cfg_arch; - Locale cfg_textLocale; - - Pathname cfg_cache_path; - Pathname cfg_metadata_path; - Pathname cfg_solvfiles_path; - Pathname cfg_packages_path; - - Pathname cfg_config_path; - Pathname cfg_known_repos_path; - Pathname cfg_known_services_path; - - Pathname cfg_vendor_path; - Pathname cfg_multiversion_path; - Pathname locks_file; - - Pathname update_data_path; - Pathname update_scripts_path; - Pathname update_messages_path; - DefaultOption updateMessagesNotify; - - bool repo_add_probe; - unsigned repo_refresh_delay; - LocaleSet repoRefreshLocales; - bool repoLabelIsAlias; - - bool download_use_deltarpm; - bool download_use_deltarpm_always; - DefaultOption download_media_prefer_download; - - int download_max_concurrent_connections; - int download_min_download_speed; - int download_max_download_speed; - int download_max_silent_tries; - int download_transfer_timeout; - - Option commit_downloadMode; - - Option solver_onlyRequires; - Option solver_allowVendorChange; - Option solver_cleandepsOnRemove; - Option solver_upgradeTestcasesToKeep; - DefaultOption solverUpgradeRemoveDroppedPackages; - - Pathname solver_checkSystemFile; - Pathname solver_checkSystemFileDir; - - std::set & multiversion() { return getMultiversion(); } - const std::set & multiversion() const { return getMultiversion(); } - - bool apply_locks_file; - - target::rpm::RpmInstFlags rpmInstallFlags; - - Pathname history_log_path; - Pathname credentials_global_dir_path; - Pathname credentials_global_file_path; - - std::string userData; - - Option pluginsPath; - - private: - std::set & getMultiversion() const - { - if ( ! _multiversionInitialized ) - { - Pathname multiversionDir( cfg_multiversion_path ); - if ( multiversionDir.empty() ) - multiversionDir = ( cfg_config_path.empty() ? Pathname("/etc/zypp") : cfg_config_path ) / "multiversion.d"; - - filesystem::dirForEach( multiversionDir, - [this]( const Pathname & dir_r, const char *const & name_r )->bool - { - MIL << "Parsing " << dir_r/name_r << endl; - iostr::simpleParseFile( InputStream( dir_r/name_r ), - [this]( int num_r, std::string line_r )->bool - { - DBG << " found " << line_r << endl; - _multiversion.insert( line_r ); - return true; - } ); - return true; - } ); - _multiversionInitialized = true; - } - return _multiversion; - } - mutable std::set _multiversion; - mutable DefaultIntegral _multiversionInitialized; - }; - /////////////////////////////////////////////////////////////////// - - // Backdoor to redirect ZConfig from within the running - // TEST-application. HANDLE WITH CARE! - void reconfigureZConfig( const Pathname & override_r ) - { - // ctor puts itself unter smart pointer control. - new ZConfig::Impl( override_r ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZConfig::instance - // METHOD TYPE : ZConfig & - // - ZConfig & ZConfig::instance() - { - static ZConfig _instance; // The singleton - return _instance; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZConfig::ZConfig - // METHOD TYPE : Ctor - // - ZConfig::ZConfig() - : _pimpl( new Impl ) - { - about( MIL ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZConfig::~ZConfig - // METHOD TYPE : Dtor - // - ZConfig::~ZConfig( ) - {} - - Pathname ZConfig::systemRoot() const - { - Target_Ptr target( getZYpp()->getTarget() ); - return target ? target->root() : Pathname(); - } - - /////////////////////////////////////////////////////////////////// - // - // system architecture - // - /////////////////////////////////////////////////////////////////// - - Arch ZConfig::defaultSystemArchitecture() - { - static Arch _val( _autodetectSystemArchitecture() ); - return _val; - } - - Arch ZConfig::systemArchitecture() const - { return _pimpl->cfg_arch; } - - void ZConfig::setSystemArchitecture( const Arch & arch_r ) - { - if ( arch_r != _pimpl->cfg_arch ) - { - WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl; - _pimpl->cfg_arch = arch_r; - } - } - - /////////////////////////////////////////////////////////////////// - // - // text locale - // - /////////////////////////////////////////////////////////////////// - - Locale ZConfig::defaultTextLocale() - { - static Locale _val( _autodetectTextLocale() ); - return _val; - } - - Locale ZConfig::textLocale() const - { return _pimpl->cfg_textLocale; } - - void ZConfig::setTextLocale( const Locale & locale_r ) - { - if ( locale_r != _pimpl->cfg_textLocale ) - { - WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl; - _pimpl->cfg_textLocale = locale_r; -#warning prefer signal - sat::Pool::instance().setTextLocale( locale_r ); - } - } - - /////////////////////////////////////////////////////////////////// - // user data - /////////////////////////////////////////////////////////////////// - - bool ZConfig::hasUserData() const - { return !_pimpl->userData.empty(); } - - std::string ZConfig::userData() const - { return _pimpl->userData; } - - bool ZConfig::setUserData( const std::string & str_r ) - { - for_( ch, str_r.begin(), str_r.end() ) - { - if ( *ch < ' ' && *ch != '\t' ) - { - ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl; - return false; - } - } - MIL << "Set user data string to '" << str_r << "'" << endl; - _pimpl->userData = str_r; - return true; - } - - /////////////////////////////////////////////////////////////////// - - Pathname ZConfig::repoCachePath() const - { - return ( _pimpl->cfg_cache_path.empty() - ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path ); - } - - Pathname ZConfig::repoMetadataPath() const - { - return ( _pimpl->cfg_metadata_path.empty() - ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path ); - } - - Pathname ZConfig::repoSolvfilesPath() const - { - return ( _pimpl->cfg_solvfiles_path.empty() - ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path ); - } - - Pathname ZConfig::repoPackagesPath() const - { - return ( _pimpl->cfg_packages_path.empty() - ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path ); - } - - /////////////////////////////////////////////////////////////////// - - Pathname ZConfig::configPath() const - { - return ( _pimpl->cfg_config_path.empty() - ? Pathname("/etc/zypp") : _pimpl->cfg_config_path ); - } - - Pathname ZConfig::knownReposPath() const - { - return ( _pimpl->cfg_known_repos_path.empty() - ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path ); - } - - Pathname ZConfig::knownServicesPath() const - { - return ( _pimpl->cfg_known_services_path.empty() - ? (configPath()/"services.d") : _pimpl->cfg_known_services_path ); - } - - Pathname ZConfig::vendorPath() const - { - return ( _pimpl->cfg_vendor_path.empty() - ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path ); - } - - Pathname ZConfig::locksFile() const - { - return ( _pimpl->locks_file.empty() - ? (configPath()/"locks") : _pimpl->locks_file ); - } - - /////////////////////////////////////////////////////////////////// - - bool ZConfig::repo_add_probe() const - { return _pimpl->repo_add_probe; } - - unsigned ZConfig::repo_refresh_delay() const - { return _pimpl->repo_refresh_delay; } - - LocaleSet ZConfig::repoRefreshLocales() const - { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; } - - bool ZConfig::repoLabelIsAlias() const - { return _pimpl->repoLabelIsAlias; } - - void ZConfig::repoLabelIsAlias( bool yesno_r ) - { _pimpl->repoLabelIsAlias = yesno_r; } - - bool ZConfig::download_use_deltarpm() const - { return _pimpl->download_use_deltarpm; } - - bool ZConfig::download_use_deltarpm_always() const - { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; } - - bool ZConfig::download_media_prefer_download() const - { return _pimpl->download_media_prefer_download; } - - void ZConfig::set_download_media_prefer_download( bool yesno_r ) - { _pimpl->download_media_prefer_download.set( yesno_r ); } - - void ZConfig::set_default_download_media_prefer_download() - { _pimpl->download_media_prefer_download.restoreToDefault(); } - - long ZConfig::download_max_concurrent_connections() const - { return _pimpl->download_max_concurrent_connections; } - - long ZConfig::download_min_download_speed() const - { return _pimpl->download_min_download_speed; } - - long ZConfig::download_max_download_speed() const - { return _pimpl->download_max_download_speed; } - - long ZConfig::download_max_silent_tries() const - { return _pimpl->download_max_silent_tries; } - - long ZConfig::download_transfer_timeout() const - { return _pimpl->download_transfer_timeout; } - - DownloadMode ZConfig::commit_downloadMode() const - { return _pimpl->commit_downloadMode; } - - bool ZConfig::solver_onlyRequires() const - { return _pimpl->solver_onlyRequires; } - - bool ZConfig::solver_allowVendorChange() const - { return _pimpl->solver_allowVendorChange; } - - bool ZConfig::solver_cleandepsOnRemove() const - { return _pimpl->solver_cleandepsOnRemove; } - - Pathname ZConfig::solver_checkSystemFile() const - { return ( _pimpl->solver_checkSystemFile.empty() - ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); } - - Pathname ZConfig::solver_checkSystemFileDir() const - { return ( _pimpl->solver_checkSystemFileDir.empty() - ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); } - - unsigned ZConfig::solver_upgradeTestcasesToKeep() const - { return _pimpl->solver_upgradeTestcasesToKeep; } - - bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; } - void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); } - void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); } - - const std::set & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); } - void ZConfig::multiversionSpec( std::set new_r ) { _pimpl->multiversion().swap( new_r ); } - void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); } - void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); } - void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); } - - bool ZConfig::apply_locks_file() const - { return _pimpl->apply_locks_file; } - - Pathname ZConfig::update_dataPath() const - { - return ( _pimpl->update_data_path.empty() - ? Pathname("/var/adm") : _pimpl->update_data_path ); - } - - Pathname ZConfig::update_messagesPath() const - { - return ( _pimpl->update_messages_path.empty() - ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path ); - } - - Pathname ZConfig::update_scriptsPath() const - { - return ( _pimpl->update_scripts_path.empty() - ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path ); - } - - std::string ZConfig::updateMessagesNotify() const - { return _pimpl->updateMessagesNotify; } - - void ZConfig::setUpdateMessagesNotify( const std::string & val_r ) - { _pimpl->updateMessagesNotify.set( val_r ); } - - void ZConfig::resetUpdateMessagesNotify() - { _pimpl->updateMessagesNotify.restoreToDefault(); } - - /////////////////////////////////////////////////////////////////// - - target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const - { return _pimpl->rpmInstallFlags; } - - - Pathname ZConfig::historyLogFile() const - { - return ( _pimpl->history_log_path.empty() ? - Pathname("/var/log/zypp/history") : _pimpl->history_log_path ); - } - - Pathname ZConfig::credentialsGlobalDir() const - { - return ( _pimpl->credentials_global_dir_path.empty() ? - Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path ); - } - - Pathname ZConfig::credentialsGlobalFile() const - { - return ( _pimpl->credentials_global_file_path.empty() ? - Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path ); - } - - /////////////////////////////////////////////////////////////////// - - std::string ZConfig::distroverpkg() const - { return "redhat-release"; } - - /////////////////////////////////////////////////////////////////// - - Pathname ZConfig::pluginsPath() const - { return _pimpl->pluginsPath.get(); } - - /////////////////////////////////////////////////////////////////// - - std::ostream & ZConfig::about( std::ostream & str ) const - { - str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl; - - str << "libsolv: " << solv_version; - if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) ) - str << " (built against " << LIBSOLV_VERSION_STRING << ")"; - str << endl; - - str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl; - str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl; - str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl; - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ZConfig.h b/libzypp/zypp/ZConfig.h deleted file mode 100644 index dff6dc7..0000000 --- a/libzypp/zypp/ZConfig.h +++ /dev/null @@ -1,441 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZConfig.h - * -*/ -#ifndef ZYPP_ZCONFIG_H -#define ZYPP_ZCONFIG_H - -#include -#include -#include - -#include "zypp/APIConfig.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/Arch.h" -#include "zypp/Locale.h" -#include "zypp/Pathname.h" -#include "zypp/IdString.h" - -#include "zypp/DownloadMode.h" -#include "zypp/target/rpm/RpmFlags.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZConfig - // - /** Interim helper class to collect global options and settings. - * Use it to avoid hardcoded values and calls to getZYpp() just - * to retrieve some value like architecture, languages or tmppath. - * - * It reads /etc/zypp/zypp.conf, the filename can be overridden by - * setting the ZYPP_CONF environment variable to a different file. - * - * Note, if you add settings to this file, please follow the following - * convention: - * - * namespace.settingname - * - * should become - * - * namespace_settingName() - * - * \ingroup ZyppConfig - * \ingroup Singleton - */ - class ZConfig : private base::NonCopyable - { - public: - - /** Singleton ctor */ - static ZConfig & instance(); - - /** Print some detail about the current libzypp version.*/ - std::ostream & about( std::ostream & str ) const; - - public: - - /** The target root directory. - * Returns an empty path if no target is set. - */ - Pathname systemRoot() const; - - public: - - /** The autodetected system architecture. */ - static Arch defaultSystemArchitecture(); - - /** The system architecture zypp uses. */ - Arch systemArchitecture() const; - - /** Override the zypp system architecture. - * This is useful for test scenarious. But be warned, zypp does - * not expect the system architecture to change at runtime. So - * set it at the verry beginning before you acess any other - * zypp component. - */ - void setSystemArchitecture( const Arch & arch_r ); - - /** Reset the zypp system architecture to the default. */ - void resetSystemArchitecture() - { setSystemArchitecture( defaultSystemArchitecture() ); } - - public: - /** The autodetected prefered locale for translated texts. - */ - static Locale defaultTextLocale(); - - /** The locale for translated texts zypp uses. - */ - Locale textLocale() const; - - /** Set the prefered locale for translated texts. */ - void setTextLocale( const Locale & locale_r ); - - /** Reset the locale for translated texts to the default. */ - void resetTextLocale() - { setTextLocale( defaultTextLocale() ); } - - public: - /** \name Maintain user data - * \see \ref zypp-userdata - */ - //@{ - /** Whether a (non empty) user data sting is defined. */ - bool hasUserData() const; - - /** User defined string value to be passed to log, history, plugins... */ - std::string userData() const; - - /** Set a new \ref userData string. - * \returns \c TRUE if the string was accepted; \c FALSE if the - * string was rejected due to nonprintable characters or newlines. - */ - bool setUserData( const std::string & str_r ); - //@} - - public: - /** - * Path where the caches are kept (/var/cache/zypp) - * \ingroup g_ZC_REPOCACHE - */ - Pathname repoCachePath() const; - - /** - * Path where the repo metadata is downloaded and kept (repoCachePath()/raw). - * \ingroup g_ZC_REPOCACHE - */ - Pathname repoMetadataPath() const; - - /** - * Path where the repo solv files are created and kept (repoCachePath()/solv). - * \ingroup g_ZC_REPOCACHE - */ - Pathname repoSolvfilesPath() const; - - /** - * Path where the repo packages are downloaded and kept (repoCachePath()/packages). - * \ingroup g_ZC_REPOCACHE - */ - Pathname repoPackagesPath() const; - - /** - * Path where the configfiles are kept (/etc/zypp). - * \ingroup g_ZC_CONFIGFILES - */ - Pathname configPath() const; - - /** - * Path where the known repositories .repo files are kept (configPath()/repos.d). - * \ingroup g_ZC_CONFIGFILES - */ - Pathname knownReposPath() const; - - /** - * Path where the known services .service files are kept (configPath()/services.d). - * \ingroup g_ZC_CONFIGFILES - */ - Pathname knownServicesPath() const; - - /** - * Whether repository urls should be probed. - / config option - * repo.add.probe - */ - bool repo_add_probe() const; - - /** - * Amount of time in minutes that must pass before another refresh. - */ - unsigned repo_refresh_delay() const; - - /** - * List of locales for which translated package descriptions should be downloaded. - */ - LocaleSet repoRefreshLocales() const; - - /** - * Whether to use repository alias or name in user messages (progress, - * exceptions, ...). - * True: use alias, false: use name. - */ - bool repoLabelIsAlias() const; - - /** - * Whether to use repository alias or name in user messages (progress, - * exceptions, ...). Console applications might prefer to use and display - * the shorter alias instead of full repository name. - * - * Default: false; i.e. repo label is 'name' - */ - void repoLabelIsAlias( bool yesno_r ); - - /** - * Maximum number of concurrent connections for a single transfer - */ - long download_max_concurrent_connections() const; - - /** - * Minimum download speed (bytes per second) - * until the connection is dropped - */ - long download_min_download_speed() const; - - /** - * Maximum download speed (bytes per second) - */ - long download_max_download_speed() const; - - /** - * Maximum silent tries - */ - long download_max_silent_tries() const; - - /** - * Maximum time in seconds that you allow a transfer operation to take. - */ - long download_transfer_timeout() const; - - - /** Whether to consider using a deltarpm when downloading a package. - * Config option download.use_deltarpm (true) - */ - bool download_use_deltarpm() const; - - /** Whether to consider using a deltarpm even when rpm is local. - * This requires \ref download_use_deltarpm being \c true. - * Config option download.use_deltarpm.always (false) - */ - bool download_use_deltarpm_always() const; - - /** - * Hint which media to prefer when installing packages (download vs. CD). - * \see class \ref media::MediaPriority - */ - bool download_media_prefer_download() const; - /** \overload */ - bool download_media_prefer_volatile() const - { return ! download_media_prefer_download(); } - /** - * Set \ref download_media_prefer_download to a specific value. - */ - void set_download_media_prefer_download( bool yesno_r ); - /** - * Set \ref download_media_prefer_download to the configfiles default. - */ - void set_default_download_media_prefer_download(); - - /** - * Commit download policy to use as default. - */ - DownloadMode commit_downloadMode() const; - - /** - * Directory for equivalent vendor definitions (configPath()/vendors.d) - * \ingroup g_ZC_CONFIGFILES - */ - Pathname vendorPath() const; - - /** - * Solver regards required packages,patterns,... only - */ - bool solver_onlyRequires() const; - - /** - * File in which dependencies described which has to be - * fulfilled for a running system. - */ - Pathname solver_checkSystemFile() const; - - /** - * Directory, which may or may not contain files in which - * dependencies described which has to be fulfilled for a - * running system. - */ - Pathname solver_checkSystemFileDir() const; - - /** - * Whether vendor check is by default enabled. - */ - bool solver_allowVendorChange() const; - - /** - * Whether removing a package should also remove no longer needed requirements. - */ - bool solver_cleandepsOnRemove() const; - - /** - * When committing a dist upgrade (e.g. zypper dup) - * a solver testcase is written. It is needed in bugreports, - * in case something went wrong. This returns the number of - * testcases to keep on the system. Old cases will be deleted, - * as new ones are created. Use \c 0 to write no testcase at all. - */ - unsigned solver_upgradeTestcasesToKeep() const; - - /** Whether dist upgrade should remove a products dropped packages (true). - * - * A new product may suggest a list of old and no longer supported - * packages (dropped packages). Performing a dist upgrade the solver - * may try to delete them, even if they do not cause any dependency - * problem. - * - * Turning this option off, the solver will not try to remove those - * packages unless they actually do cause dependency trouble. At any - * time you may use zypper to detect orphaned packages, and do the - * cleanup manually. Or simply leave them installed as long as you don't - * need the disk space. - */ - bool solverUpgradeRemoveDroppedPackages() const; - /** Set \ref solverUpgradeRemoveDroppedPackages to \a val_r. */ - void setSolverUpgradeRemoveDroppedPackages( bool val_r ); - /** Reset \ref solverUpgradeRemoveDroppedPackages to the \c zypp.conf default. */ - void resetSolverUpgradeRemoveDroppedPackages(); - - /** \name Packages which can be installed in different versions at the same time. - * This returns the config file values (\c names or \c provides:...). For the corresponding - * packages use e.g \ref sat::Pool::multiversionBegin, or \ref sat::Solbale::multiversionInstall - * (\ref ui::Selectable::multiversionInstall). - */ - //@{ - const std::set & multiversionSpec() const; - void multiversionSpec( std::set new_r ); - void clearMultiversionSpec(); - void addMultiversionSpec( const std::string & name_r ); - void removeMultiversionSpec( const std::string & name_r ); - //@} - - /** - * Path where zypp can find or create lock file (configPath()/locks) - * \ingroup g_ZC_CONFIGFILES - */ - Pathname locksFile() const; - - /** - * Whether locks file should be read and applied after start (true) - */ - bool apply_locks_file() const; - - /** - * Path where the update items are kept (/var/adm) - */ - Pathname update_dataPath() const; - - /** - * Path where the repo metadata is downloaded and kept (update_dataPath()/). - * \ingroup g_ZC_REPOCACHE - */ - Pathname update_scriptsPath() const; - - /** - * Path where the repo solv files are created and kept (update_dataPath()/solv). - * \ingroup g_ZC_REPOCACHE - */ - Pathname update_messagesPath() const; - - /** \name Command to be invoked to send update messages. */ - //@{ - /** Command definition for sending update messages.*/ - std::string updateMessagesNotify() const; - /** Set a new command definition (see update.messages.notify in zypp.conf). */ - void setUpdateMessagesNotify( const std::string & val_r ); - /** Reset to the zypp.conf default. */ - void resetUpdateMessagesNotify(); - //@} - - /** \name Options for package installation */ - //@{ - /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy. - * Or-combination of \ref target::rpm::RpmInstFlag. - * \code - * ZConfig.instance().rpmInstallFlags().testFlag( target::rpm::RPMINST_EXCLUDEDOCS ); - * \endcode - */ - target::rpm::RpmInstFlags rpmInstallFlags() const; - //@} - - /** - * Path where ZYpp install history is logged. Defaults to - * /var/log/zypp/history. - * - * \see http://en.opensuse.org/Libzypp/Package_History - */ - Pathname historyLogFile() const; - - /** - * Defaults to /etc/zypp/credentials.d - */ - Pathname credentialsGlobalDir() const; - - /** - * Defaults to /etc/zypp/credentials.cat - */ - Pathname credentialsGlobalFile() const; - - /** Package telling the "product version" on systems not using /etc/product.d/baseproduct. - * - * On RHEL, Fedora and others the "product version" is determined by the first package - * providing 'redhat-release'. This value is not hardcoded in YUM and can be configured - * with the $distroverpkg variable. - * - * Defaults to 'redhat-release'. - */ - std::string distroverpkg() const; - - /** \name Plugins */ - //@{ - /** - * Defaults to \c /usr/lib/zypp/plugins - */ - Pathname pluginsPath() const; - - //@} - public: - class Impl; - /** Dtor */ - ~ZConfig(); - private: - friend class Impl; - /** Default ctor. */ - ZConfig(); - /** Pointer to implementation */ - RW_pointer > _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZCONFIG_H diff --git a/libzypp/zypp/ZYpp.cc b/libzypp/zypp/ZYpp.cc deleted file mode 100644 index ffa5895..0000000 --- a/libzypp/zypp/ZYpp.cc +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYpp.cc - * -*/ -#include -#include "zypp/base/Logger.h" - -#include "zypp/ZYpp.h" -#include "zypp/zypp_detail/ZYppImpl.h" -#include "zypp/sat/Pool.h" -#include "zypp/ManagedFile.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYpp::ZYpp - // METHOD TYPE : Ctor - // - ZYpp::ZYpp( const Impl_Ptr & impl_r ) - : _pimpl( impl_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYpp::~ZYpp - // METHOD TYPE : Dtor - // - ZYpp::~ZYpp() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYpp::dumpOn - // METHOD TYPE : std::ostream & - // - std::ostream & ZYpp::dumpOn( std::ostream & str ) const - { - return str << *_pimpl; - } - - /////////////////////////////////////////////////////////////////// - // - // Forward to Impl: - // - /////////////////////////////////////////////////////////////////// - - ResPool ZYpp::pool() const - { return _pimpl->pool(); } - - DiskUsageCounter::MountPointSet ZYpp::diskUsage() - { return _pimpl->diskUsage(); } - - void ZYpp::setPartitions(const DiskUsageCounter::MountPointSet &mp) - { return _pimpl->setPartitions(mp); } - - DiskUsageCounter::MountPointSet ZYpp::getPartitions() const - { return _pimpl->getPartitions(); } - - ResPoolProxy ZYpp::poolProxy() const - { return _pimpl->poolProxy(); } - - Resolver_Ptr ZYpp::resolver() const - { return _pimpl->resolver(); } - - KeyRing_Ptr ZYpp::keyRing() const - { return _pimpl->keyRing(); } - - /////////////////////////////////////////////////////////////////// - // - // Forward to Impl: - // - /////////////////////////////////////////////////////////////////// - - Target_Ptr ZYpp::target() const - { return _pimpl->target(); } - - Target_Ptr ZYpp::getTarget() const - { return _pimpl->getTarget(); } - - void ZYpp::initializeTarget( const Pathname & root, bool doRebuild_r ) - { _pimpl->initializeTarget( root, doRebuild_r ); } - - void ZYpp::finishTarget() - { _pimpl->finishTarget(); } - - ZYppCommitResult ZYpp::commit( const ZYppCommitPolicy & policy_r ) - { return _pimpl->commit( policy_r ); } - - void ZYpp::installSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - { _pimpl->installSrcPackage( srcPackage_r ); } - - ManagedFile ZYpp::provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - {return _pimpl->provideSrcPackage( srcPackage_r ); } - /////////////////////////////////////////////////////////////////// - - Pathname ZYpp::homePath() const - { return _pimpl->homePath(); } - - Pathname ZYpp::tmpPath() const - { return _pimpl->tmpPath(); } - - void ZYpp::setHomePath( const Pathname & path ) - { _pimpl->setHomePath(path); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ZYpp.h b/libzypp/zypp/ZYpp.h deleted file mode 100644 index f193f97..0000000 --- a/libzypp/zypp/ZYpp.h +++ /dev/null @@ -1,166 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYpp.h - * -*/ -#ifndef ZYPP_ZYPP_H -#define ZYPP_ZYPP_H - -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/APIConfig.h" - -#include "zypp/ZConfig.h" -#include "zypp/ManagedFile.h" - -#include "zypp/ZYppCommit.h" -#include "zypp/ResTraits.h" - -#include "zypp/Target.h" -#include "zypp/Resolver.h" -#include "zypp/KeyRing.h" -#include "zypp/DiskUsageCounter.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace zypp_detail - { - class ZYppImpl; - } - - class ZYppFactory; - class ResPool; - class ResPoolProxy; - class KeyRing; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYpp - // - /** - * \todo define Exceptions - * ZYpp API main interface - */ - class ZYpp : public base::ReferenceCounted, private base::NonCopyable - { - public: - - typedef intrusive_ptr Ptr; - typedef intrusive_ptr constPtr; - - public: - - /** - * Access to the global resolvable pool. - * Same as \ref zypp::ResPool::instance - */ - ResPool pool() const; - - /** Pool of ui::Selectable. - * Based on the ResPool, ui::Selectable groups ResObjetcs of - * same kind and name. - */ - ResPoolProxy poolProxy() const; - - DiskUsageCounter::MountPointSet diskUsage(); - - void setPartitions(const DiskUsageCounter::MountPointSet &mp); - - DiskUsageCounter::MountPointSet getPartitions() const; - - public: - /** - * \throws Exception - */ - Target_Ptr target() const; - - /** Same as \ref target but returns NULL if target is not - * initialized, instead of throwing. - */ - Target_Ptr getTarget() const; - - /** - * \throws Exception - * Just init the target, dont populate store or pool. - * If \c doRebuild_r is \c true, an already existing - * database is rebuilt (rpm --rebuilddb ). - */ - void initializeTarget(const Pathname & root, bool doRebuild_r = false); - - /** - * \throws Exception - */ - void finishTarget(); - - - public: - typedef ZYppCommitResult CommitResult; - - /** Commit changes and transactions. - * \param \ref CommitPolicy - * \return \ref CommitResult - * \throws Exception - */ - ZYppCommitResult commit( const ZYppCommitPolicy & policy_r ); - - /** Install a source package on the Target. - * \throws Exception - */ - void installSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - /** Provides a source package on the Target. - * \throws Exception - */ - ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - public: - /** */ - Resolver_Ptr resolver() const; - KeyRing_Ptr keyRing() const; - - public: - /** Get the path where zypp related plugins store persistent data and caches */ - Pathname homePath() const; - - /** Get the path where zypp related plugins store temp data */ - Pathname tmpPath() const; - - /** set the home, if you need to change it */ - void setHomePath( const Pathname & path ); - - protected: - /** Dtor */ - virtual ~ZYpp(); - /** Stream output */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - private: - /** Factory */ - friend class ZYppFactory; - - /** */ - typedef zypp_detail::ZYppImpl Impl; - typedef shared_ptr Impl_Ptr; - /** Factory ctor */ - explicit - ZYpp( const Impl_Ptr & impl_r ); - private: - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPP_H diff --git a/libzypp/zypp/ZYppCallbacks.h b/libzypp/zypp/ZYppCallbacks.h deleted file mode 100644 index 9f0a96a..0000000 --- a/libzypp/zypp/ZYppCallbacks.h +++ /dev/null @@ -1,827 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCallbacks.h - * -*/ -#ifndef ZYPP_ZYPPCALLBACKS_H -#define ZYPP_ZYPPCALLBACKS_H - -#include "zypp/base/EnumClass.h" -#include "zypp/Callback.h" -#include "zypp/UserData.h" -#include "zypp/Resolvable.h" -#include "zypp/RepoInfo.h" -#include "zypp/Pathname.h" -#include "zypp/Package.h" -#include "zypp/Patch.h" -#include "zypp/Url.h" -#include "zypp/ProgressData.h" -#include "zypp/media/MediaUserAuth.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace sat - { - class Queue; - class FileConflicts; - } // namespace sat - /////////////////////////////////////////////////////////////////// - - struct ProgressReport : public callback::ReportBase - { - virtual void start( const ProgressData &/*task*/ ) - {} - - virtual bool progress( const ProgressData &/*task*/ ) - { return true; } - -// virtual Action problem( -// Repo /*source*/ -// , Error /*error*/ -// , const std::string &/*description*/ ) -// { return ABORT; } - - virtual void finish( const ProgressData &/*task*/ ) - {} - - }; - - struct ProgressReportAdaptor - { - - ProgressReportAdaptor( const ProgressData::ReceiverFnc &fnc, - callback::SendReport &report ) - : _fnc(fnc) - , _report(report) - , _first(true) - { - } - - bool operator()( const ProgressData &progress ) - { - if ( _first ) - { - _report->start(progress); - _first = false; - } - - _report->progress(progress); - bool value = true; - if ( _fnc ) - value = _fnc(progress); - - - if ( progress.finalReport() ) - { - _report->finish(progress); - } - return value; - } - - ProgressData::ReceiverFnc _fnc; - callback::SendReport &_report; - bool _first; - }; - - //////////////////////////////////////////////////////////////////////////// - - namespace repo - { - // progress for downloading a resolvable - struct DownloadResolvableReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE, // ignore this resolvable but continue - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // the downloaded file is invalid - }; - - /** Hint that package is available in the local cache (no download needed). - * This will be the only trigger for an already cached package. - */ - virtual void infoInCache( Resolvable::constPtr res_r, const Pathname & localfile_r ) - {} - - virtual void start( - Resolvable::constPtr /*resolvable_ptr*/ - , const Url &/*url*/ - ) {} - - - // Dowmload delta rpm: - // - path below url reported on start() - // - expected download size (0 if unknown) - // - download is interruptable - // - problems are just informal - virtual void startDeltaDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ ) - {} - - virtual bool progressDeltaDownload( int /*value*/ ) - { return true; } - - virtual void problemDeltaDownload( const std::string &/*description*/ ) - {} - - virtual void finishDeltaDownload() - {} - - // Apply delta rpm: - // - local path of downloaded delta - // - aplpy is not interruptable - // - problems are just informal - virtual void startDeltaApply( const Pathname & /*filename*/ ) - {} - - virtual void progressDeltaApply( int /*value*/ ) - {} - - virtual void problemDeltaApply( const std::string &/*description*/ ) - {} - - virtual void finishDeltaApply() - {} - - /** \deprecated Unused since 2008 */ - virtual ZYPP_DEPRECATED void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ ) - {} - - /** \deprecated Unused since 2008 */ - virtual ZYPP_DEPRECATED bool progressPatchDownload( int /*value*/ ) - { return true; } - - /** \deprecated Unused since 2008 */ - virtual ZYPP_DEPRECATED void problemPatchDownload( const std::string &/*description*/ ) - {} - - /** \deprecated Unused since 2008 */ - virtual ZYPP_DEPRECATED void finishPatchDownload() - {} - - - // return false if the download should be aborted right now - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable_ptr*/) - { return true; } - - virtual Action problem( - Resolvable::constPtr /*resolvable_ptr*/ - , Error /*error*/ - , const std::string &/*description*/ - ) { return ABORT; } - - virtual void finish(Resolvable::constPtr /*resolvable_ptr*/ - , Error /*error*/ - , const std::string &/*reason*/ - ) {} - }; - - // progress for probing a source - struct ProbeRepoReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY // retry - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID, // th source is invalid - UNKNOWN - }; - - virtual void start(const Url &/*url*/) {} - virtual void failedProbe( const Url &/*url*/, const std::string &/*type*/ ) {} - virtual void successProbe( const Url &/*url*/, const std::string &/*type*/ ) {} - virtual void finish(const Url &/*url*/, Error /*error*/, const std::string &/*reason*/ ) {} - - virtual bool progress(const Url &/*url*/, int /*value*/) - { return true; } - - virtual Action problem( const Url &/*url*/, Error /*error*/, const std::string &/*description*/ ) { return ABORT; } - }; - - struct RepoCreateReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // skip refresh, ignore failed refresh - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - REJECTED, - INVALID, // th source is invali - UNKNOWN - }; - - virtual void start( const zypp::Url &/*url*/ ) {} - virtual bool progress( int /*value*/ ) - { return true; } - - virtual Action problem( - const zypp::Url &/*url*/ - , Error /*error*/ - , const std::string &/*description*/ ) - { return ABORT; } - - virtual void finish( - const zypp::Url &/*url*/ - , Error /*error*/ - , const std::string &/*reason*/ ) - {} - }; - - struct RepoReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // skip refresh, ignore failed refresh - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th source is invalid - }; - - virtual void start( const ProgressData &/*task*/, const RepoInfo /*repo*/ ) {} - virtual bool progress( const ProgressData &/*task*/ ) - { return true; } - - virtual Action problem( - Repository /*source*/ - , Error /*error*/ - , const std::string &/*description*/ ) - { return ABORT; } - - virtual void finish( - Repository /*source*/ - , const std::string &/*task*/ - , Error /*error*/ - , const std::string &/*reason*/ ) - {} - }; - - - ///////////////////////////////////////////////////////////////// - } // namespace source - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace media - { - // media change request callback - struct MediaChangeReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE, // ignore this media in future, not available anymore - IGNORE_ID, // ignore wrong medium id - CHANGE_URL, // change media URL - EJECT // eject the medium - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the medie not found at all - IO, // error accessing the media - INVALID, // media is broken - WRONG, // wrong media, need a different one - IO_SOFT /**< IO error which can happen on worse connection like timeout exceed */ - }; - - /** - * - * \param url in: url for which the media is requested, - * out: url to use instead of the original one - * \param mediumNr requested medium number - * \param label label of requested medium - * \param error type of error from \ref Error enum - * \param description error message (media not desired or error foo occured) - * \param devices list of the available devices (for eject) - * \param dev_current in: index of the currently used device in the \a devices list - * out: index of the devices to be ejected in the \a devices list - * \return \ref Action (ABORT by default) - */ - virtual Action requestMedia( - Url & /* url (I/O parameter) */ - , unsigned /*mediumNr*/ - , const std::string & /* label */ - , Error /*error*/ - , const std::string & /*description*/ - , const std::vector & /* devices */ - , unsigned int & /* dev_current (I/O param) */ - ) { return ABORT; } - }; - - // progress for downloading a file - struct DownloadProgressReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - ACCESS_DENIED, // user authent. failed while accessing restricted file - ERROR // other error - }; - - virtual void start( const Url &/*file*/, Pathname /*localfile*/ ) {} - - /** - * Download progress. - * - * \param value Percentage value. - * \param file File URI. - * \param dbps_avg Average download rate so far. -1 if unknown. - * \param dbps_current Current download (cca last 1 sec). -1 if unknown. - */ - virtual bool progress(int /*value*/, const Url &/*file*/, - double dbps_avg = -1, - double dbps_current = -1) - { return true; } - - virtual Action problem( - const Url &/*file*/ - , Error /*error*/ - , const std::string &/*description*/ - ) { return ABORT; } - - virtual void finish( - const Url &/*file*/ - , Error /*error*/ - , const std::string &/*reason*/ - ) {} - }; - - // authentication issues report - struct AuthenticationReport : public callback::ReportBase - { - /** - * Prompt for authentication data. - * - * \param url URL which required the authentication - * \param msg prompt text - * \param auth_data input/output object for handling authentication - * data. As an input parameter auth_data can be prefilled with - * username (from previous try) or auth_type (available - * authentication methods aquired from server (only CurlAuthData)). - * As an output parameter it serves for sending username, pasword - * or other special data (derived AuthData objects). - * \return true if user chooses to continue with authentication, - * false otherwise - */ - virtual bool prompt(const Url & /* url */, - const std::string & /* msg */, - AuthData & /* auth_data */) - { - return false; - } - }; - - ///////////////////////////////////////////////////////////////// - } // namespace media - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace target - { - /** Request to display the pre commit message of a patch. */ - struct PatchMessageReport : public callback::ReportBase - { - /** Display \c patch->message(). - * Return \c true to continue, \c false to abort commit. - */ - virtual bool show( Patch::constPtr & /*patch*/ ) - { return true; } - }; - - /** Indicate execution of a patch script. This is a sort of - * \c %post script shipped by a package and to be executed - * after the package was installed. - */ - struct PatchScriptReport : public callback::ReportBase - { - enum Notify { OUTPUT, PING }; - enum Action { - ABORT, // abort commit and return error - RETRY, // (re)try to execute this script - IGNORE // ignore any failue and continue - }; - - /** Start executing the script provided by package. - */ - virtual void start( const Package::constPtr & /*package*/, - const Pathname & /*script path*/ ) - {} - /** Progress provides the script output. If the script is quiet, - * from time to time still-alive pings are sent to the ui. Returning \c FALSE - * aborts script execution. - */ - virtual bool progress( Notify /*OUTPUT or PING*/, - const std::string & /*output*/ = std::string() ) - { return true; } - /** Report error. */ - virtual Action problem( const std::string & /*description*/ ) - { return ABORT; } - /** Report success. */ - virtual void finish() - {} - }; - - /////////////////////////////////////////////////////////////////// - /// \class FindFileConflictstReport - /// \brief Check for package file conflicts in commit (after download) - /// - /// File conflict check requires that all packages are downloaded and - /// now available in the cache (need to access the filelists). Missing - /// packages are omitted from check and their number is reported in - /// \a noFilelist_r. This usually happens if download mode 'as-needed' - /// is used. - /////////////////////////////////////////////////////////////////// - struct FindFileConflictstReport : public callback::ReportBase - { - /** - * \param progress_r Progress counter for packages to check. - * \return \c true to continue, \c false upon user abort request. - */ - virtual bool start( const ProgressData & progress_r ) - { return true; } - - /** - * \param progress_r Progress counter for packages to check. - * \param noFilelist_r Queue of so far skipped solvables (no filelist/not yet downloaded). - * \return \c true to continue, \c false upon user abort request. - */ - virtual bool progress( const ProgressData & progress_r, const sat::Queue & noFilelist_r ) - { return true; } - - /** - * \param progress_r Progress counter for packages to check. - * \param noFilelist_r Queue of skipped solvables (no filelist/not yet downloaded). - * \param conflicts_r File conflits queue. - * \return \c true to continue, \c false upon user abort request. - */ - virtual bool result( const ProgressData & progress_r, const sat::Queue & noFilelist_r, const sat::FileConflicts & conflicts_r ) - { return true; } - }; - - - /////////////////////////////////////////////////////////////////// - namespace rpm - { - - // progress for installing a resolvable - struct InstallResolvableReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; - - // the level of RPM pushing - /** \deprecated We fortunately no longer do 3 attempts. */ - enum RpmLevel { - RPM, - RPM_NODEPS, - RPM_NODEPS_FORCE //!< only this one used - }; - - virtual void start( - Resolvable::constPtr /*resolvable*/ - ) {} - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { return true; } - - virtual Action problem( - Resolvable::constPtr /*resolvable*/ - , Error /*error*/ - , const std::string &/*description*/ - , RpmLevel /*level*/ - ) { return ABORT; } - - virtual void finish( - Resolvable::constPtr /*resolvable*/ - , Error /*error*/ - , const std::string &/*reason*/ - , RpmLevel /*level*/ - ) {} - }; - - // progress for removing a resolvable - struct RemoveResolvableReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - NOT_FOUND, // the requested Url was not found - IO, // IO error - INVALID // th resolvable is invalid - }; - - virtual void start( - Resolvable::constPtr /*resolvable*/ - ) {} - - virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/) - { return true; } - - virtual Action problem( - Resolvable::constPtr /*resolvable*/ - , Error /*error*/ - , const std::string &/*description*/ - ) { return ABORT; } - - virtual void finish( - Resolvable::constPtr /*resolvable*/ - , Error /*error*/ - , const std::string &/*reason*/ - ) {} - }; - - // progress for rebuilding the database - struct RebuildDBReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - FAILED // failed to rebuild - }; - - virtual void start(Pathname /*path*/) {} - - virtual bool progress(int /*value*/, Pathname /*path*/) - { return true; } - - virtual Action problem( - Pathname /*path*/ - , Error /*error*/ - , const std::string &/*description*/ - ) { return ABORT; } - - virtual void finish( - Pathname /*path*/ - , Error /*error*/ - , const std::string &/*reason*/ - ) {} - }; - - // progress for converting the database - struct ConvertDBReport : public callback::ReportBase - { - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore the failure - }; - - enum Error { - NO_ERROR, - FAILED // conversion failed - }; - - virtual void start( - Pathname /*path*/ - ) {} - - virtual bool progress(int /*value*/, Pathname /*path*/) - { return true; } - - virtual Action problem( - Pathname /*path*/ - , Error /*error*/ - , const std::string &/*description*/ - ) { return ABORT; } - - virtual void finish( - Pathname /*path*/ - , Error /*error*/ - , const std::string &/*reason*/ - ) {} - }; - - ///////////////////////////////////////////////////////////////// - } // namespace rpm - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - - class PoolQuery; - - /** \name Locks */ - //@{ - /** - * Callback for cleaning locks which doesn't lock anything in pool. - */ - - struct CleanEmptyLocksReport : public callback::ReportBase - { - /** - * action performed by cleaning api to specific lock - */ - enum Action { - ABORT, /**< abort and return error */ - DELETE, /**< delete empty lock */ - IGNORE /**< skip empty lock */ - }; - - /** - * result of cleaning - */ - enum Error { - NO_ERROR, /**< no problem */ - ABORTED /** cleaning aborted by user */ - }; - - /** - * cleaning is started - */ - virtual void start( - ) {} - - /** - * progress of cleaning specifies in percents - * \return if continue - */ - virtual bool progress(int /*value*/) - { return true; } - - /** - * When find empty lock ask what to do with it - * \return action - */ - virtual Action execute( - const PoolQuery& /*error*/ - ) { return DELETE; } - - /** - * cleaning is done - */ - virtual void finish( - Error /*error*/ - ) {} - - }; - - /** - * this callback handles merging old locks with newly added or removed - */ - struct SavingLocksReport : public callback::ReportBase - { - /** - * action for old lock which is in conflict - * \see ConflictState - */ - enum Action { - ABORT, /**< abort and return error*/ - DELETE, /**< delete conflicted lock */ - IGNORE /**< skip conflict lock */ - }; - - /** - * result of merging - */ - enum Error { - NO_ERROR, /**< no problem */ - ABORTED /**< cleaning aborted by user */ - }; - - /** - * type of conflict of old and new lock - */ - enum ConflictState{ - SAME_RESULTS, /**< locks lock same item in pool but his parameters is different */ - INTERSECT /**< locks lock some file and unlocking lock unlock only part - * of iti, so removing old lock can unlock more items in pool */ - }; - - virtual void start() {} - - /** - * merging still live - * \return if continue - */ - virtual bool progress() - { return true; } - - /** - * When user unlock something which is locked by non-identical query - */ - virtual Action conflict( - const PoolQuery&, /**< problematic query*/ - ConflictState - ) { return DELETE; } - - virtual void finish( - Error /*error*/ - ) {} - }; - - /////////////////////////////////////////////////////////////////// - /// \class JobReport - /// \brief Generic report for sending messages. - /////////////////////////////////////////////////////////////////// - struct JobReport : public callback::ReportBase - { - public: - /** message type (use like 'enum class \ref MsgType') */ - struct _MsgTypeDef { - enum Enum { debug, info, warning, error, important, data }; - }; - typedef base::EnumClass<_MsgTypeDef> MsgType; ///< 'enum class MsgType' - - /** typsafe map of userdata */ - typedef callback::UserData UserData; - - public: - /** Send a ready to show message text. */ - virtual bool message( MsgType type_r, const std::string & msg_r, const UserData & userData_r ) const - { return true; } - - - /** \name Static sender instance */ - //@{ - /** Singleton sender instance */ - static callback::SendReport & instance(); // impl in ZYppImpl.cc - - /** send debug message text */ - static bool debug( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::debug, msg_r, userData_r ); } - - /** send message text */ - static bool info( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::info, msg_r, userData_r ); } - - /** send warning text */ - static bool warning( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::warning, msg_r, userData_r ); } - - /** send error text */ - static bool error( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::error, msg_r, userData_r ); } - - /** send important message text */ - static bool important( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::important, msg_r, userData_r ); } - - /** send data message */ - static bool data( const MessageString & msg_r, const UserData & userData_r = UserData() ) - { return instance()->message( MsgType::data, msg_r, userData_r ); } - //@} - }; - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif // ZYPP_ZYPPCALLBACKS_H diff --git a/libzypp/zypp/ZYppCommit.h b/libzypp/zypp/ZYppCommit.h deleted file mode 100644 index 959ad73..0000000 --- a/libzypp/zypp/ZYppCommit.h +++ /dev/null @@ -1,26 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCommit.h - * -*/ -#ifndef ZYPP_ZYPPCOMMIT_H -#define ZYPP_ZYPPCOMMIT_H - -#include - -#include "zypp/ZYppCommitPolicy.h" -#include "zypp/ZYppCommitResult.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPPCOMMIT_H diff --git a/libzypp/zypp/ZYppCommitPolicy.cc b/libzypp/zypp/ZYppCommitPolicy.cc deleted file mode 100644 index 8527486..0000000 --- a/libzypp/zypp/ZYppCommitPolicy.cc +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCommitPolicy.cc - * -*/ - -#include - -#include "zypp/base/String.h" - -#include "zypp/ZConfig.h" -#include "zypp/ZYppCommitPolicy.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitPolicy::Impl - // - /////////////////////////////////////////////////////////////////// - - class ZYppCommitPolicy::Impl - { - public: - Impl() - : _restrictToMedia ( 0 ) - , _dryRun ( false ) - , _downloadMode ( ZConfig::instance().commit_downloadMode() ) - , _rpmInstFlags ( ZConfig::instance().rpmInstallFlags() ) - , _syncPoolAfterCommit ( true ) - {} - - public: - unsigned _restrictToMedia; - bool _dryRun; - DownloadMode _downloadMode; - target::rpm::RpmInstFlags _rpmInstFlags; - bool _syncPoolAfterCommit; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const { return new Impl( *this ); } - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitPolicy - // - /////////////////////////////////////////////////////////////////// - - ZYppCommitPolicy::ZYppCommitPolicy() - : _pimpl( new Impl ) - {} - - - ZYppCommitPolicy & ZYppCommitPolicy::restrictToMedia( unsigned mediaNr_r ) - { _pimpl->_restrictToMedia = ( mediaNr_r == 1 ) ? 1 : 0; return *this; } - - unsigned ZYppCommitPolicy::restrictToMedia() const - { return _pimpl->_restrictToMedia; } - - - ZYppCommitPolicy & ZYppCommitPolicy::dryRun( bool yesNo_r ) - { _pimpl->_dryRun = yesNo_r; return *this; } - - bool ZYppCommitPolicy::dryRun() const - { return _pimpl->_dryRun; } - - - ZYppCommitPolicy & ZYppCommitPolicy::downloadMode( DownloadMode val_r ) - { _pimpl->_downloadMode = val_r; return *this; } - - DownloadMode ZYppCommitPolicy::downloadMode() const - { return _pimpl->_downloadMode; } - - - ZYppCommitPolicy & ZYppCommitPolicy::rpmInstFlags( target::rpm::RpmInstFlags newFlags_r ) - { _pimpl->_rpmInstFlags = newFlags_r; return *this; } - - ZYppCommitPolicy & ZYppCommitPolicy::rpmNoSignature( bool yesNo_r ) - { _pimpl->_rpmInstFlags.setFlag( target::rpm::RPMINST_NOSIGNATURE, yesNo_r ); return *this; } - - ZYppCommitPolicy & ZYppCommitPolicy::rpmExcludeDocs( bool yesNo_r ) - { _pimpl->_rpmInstFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS, yesNo_r ); return *this; } - - target::rpm::RpmInstFlags ZYppCommitPolicy::rpmInstFlags() const - { return _pimpl->_rpmInstFlags; } - - bool ZYppCommitPolicy::rpmNoSignature() const - { return _pimpl->_rpmInstFlags.testFlag( target::rpm::RPMINST_NOSIGNATURE ); } - - bool ZYppCommitPolicy::rpmExcludeDocs() const - { return _pimpl->_rpmInstFlags.testFlag( target::rpm::RPMINST_EXCLUDEDOCS ); } - - - ZYppCommitPolicy & ZYppCommitPolicy::syncPoolAfterCommit( bool yesNo_r ) - { _pimpl->_syncPoolAfterCommit = yesNo_r; return *this; } - - bool ZYppCommitPolicy::syncPoolAfterCommit() const - { return _pimpl->_syncPoolAfterCommit; } - - - std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj ) - { - str << "CommitPolicy("; - if ( obj.restrictToMedia() ) - str << " restrictToMedia:" << obj.restrictToMedia(); - if ( obj.dryRun() ) - str << " dryRun"; - str << " " << obj.downloadMode(); - if ( obj.syncPoolAfterCommit() ) - str << " syncPoolAfterCommit"; - if ( obj.rpmInstFlags() ) - str << " rpmInstFlags{" << str::hexstring(obj.rpmInstFlags()) << "}"; - return str << " )"; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ZYppCommitPolicy.h b/libzypp/zypp/ZYppCommitPolicy.h deleted file mode 100644 index 69624e0..0000000 --- a/libzypp/zypp/ZYppCommitPolicy.h +++ /dev/null @@ -1,108 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCommitPolicy.h - * -*/ -#ifndef ZYPP_ZYPPCOMMITPOLICY_H -#define ZYPP_ZYPPCOMMITPOLICY_H - -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/DownloadMode.h" -#include "zypp/target/rpm/RpmFlags.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitPolicy - // - /** Options and policies for ZYpp::commit. - * \see \ref ZYpp::commit - */ - class ZYppCommitPolicy - { - public: - - ZYppCommitPolicy(); - - public: - /** Restrict commit to media 1. - * Fake outstanding YCP fix: Honour restriction to media 1 - * at installation, but install all remaining packages if - * post-boot (called with mediaNr_r > 1). - */ - ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r ); - - /** Process all media (default) */ - ZYppCommitPolicy & allMedia() - { return restrictToMedia( 0 ); } - - unsigned restrictToMedia() const; - - - /** Set dry run (default: false). - * Dry-run should not change anything on the system, unless - * the \ref downloadMode is set to \ref DownloadOnly. In that - * case packages are downloaded to the local cache. - */ - ZYppCommitPolicy & dryRun( bool yesNo_r ); - - bool dryRun() const; - - - /** Commit download policy to use. (default: \ref DownloadDefault) - * \note \ref DownloadOnly also implies a \ref dryRun. - */ - ZYppCommitPolicy & downloadMode( DownloadMode val_r ); - - DownloadMode downloadMode() const; - - - /** The default \ref target::rpm::RpmInstFlags. (default: none)*/ - ZYppCommitPolicy & rpmInstFlags( target::rpm::RpmInstFlags newFlags_r ); - - /** Use rpm option --nosignature (default: false) */ - ZYppCommitPolicy & rpmNoSignature( bool yesNo_r ); - - /** Use rpm option --excludedocs (default: false) */ - ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r ); - - target::rpm::RpmInstFlags rpmInstFlags() const; - - bool rpmNoSignature() const; - - bool rpmExcludeDocs() const; - - - /** Kepp pool in sync with the Target databases after commit (default: true) */ - ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r ); - - bool syncPoolAfterCommit() const; - - public: - /** Implementation */ - class Impl; - private: - /** Pointer to data. */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ZYppCommitPolicy Stream output. */ - std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPPCOMMITPOLICY_H diff --git a/libzypp/zypp/ZYppCommitResult.cc b/libzypp/zypp/ZYppCommitResult.cc deleted file mode 100644 index 4834760..0000000 --- a/libzypp/zypp/ZYppCommitResult.cc +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCommitResult.cc - * -*/ - -#include -#include "zypp/base/LogTools.h" - -#include "zypp/ZYppCommitResult.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitResult::Impl - // - /////////////////////////////////////////////////////////////////// - - class ZYppCommitResult::Impl - { - public: - Impl() - {} - - public: - Pathname _root; - sat::Transaction _transaction; - TransactionStepList _transactionStepList; - UpdateNotifications _updateMessages; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const { return new Impl( *this ); } - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitResult - // - /////////////////////////////////////////////////////////////////// - - ZYppCommitResult::ZYppCommitResult() - : _pimpl( new Impl ) - {} - - ZYppCommitResult::ZYppCommitResult( const ZYppCommitResult & lhs_r ) - : _pimpl( lhs_r._pimpl ) - {} - - ZYppCommitResult::ZYppCommitResult( const Pathname & root_r ) - : _pimpl( new Impl ) - { _pimpl->_root = root_r; } - - ZYppCommitResult::~ZYppCommitResult() - {} - - const Pathname & ZYppCommitResult::root() const - { return _pimpl->_root; } - - const sat::Transaction & ZYppCommitResult::transaction() const - { return _pimpl->_transaction; } - - sat::Transaction & ZYppCommitResult::rTransaction() - { return _pimpl->_transaction; } - - const ZYppCommitResult::TransactionStepList & ZYppCommitResult::transactionStepList() const - { return _pimpl->_transactionStepList; } - - ZYppCommitResult::TransactionStepList & ZYppCommitResult::rTransactionStepList() - { return _pimpl->_transactionStepList; } - - const UpdateNotifications & ZYppCommitResult::updateMessages() const - { return _pimpl->_updateMessages; } - - UpdateNotifications & ZYppCommitResult::rUpdateMessages() - { return _pimpl->_updateMessages; } - - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj ) - { - DefaultIntegral result[4]; - for_( it, obj.transaction().actionBegin(), obj.transaction().actionEnd() ) - { - ++result[0]; - switch ( it->stepStage() ) - { - case sat::Transaction::STEP_DONE : ++result[1]; break; - case sat::Transaction::STEP_ERROR : ++result[2]; break; - case sat::Transaction::STEP_TODO : ++result[3]; break; - } - } - str << "CommitResult " - << " (total " << result[0] - << ", done " << result[1] - << ", error " << result[2] - << ", skipped " << result[3] - << ", updateMessages " << obj.updateMessages().size() - << ")"; - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ZYppCommitResult.h b/libzypp/zypp/ZYppCommitResult.h deleted file mode 100644 index 1769cab..0000000 --- a/libzypp/zypp/ZYppCommitResult.h +++ /dev/null @@ -1,181 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppCommitResult.h - * -*/ -#ifndef ZYPP_ZYPPCOMMITRESULT_H -#define ZYPP_ZYPPCOMMITRESULT_H - -#include -#include -#include - -#include "zypp/PoolItem.h" -#include "zypp/sat/Transaction.h" -#include "zypp/base/DefaultIntegral.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace sat - { - class Transaction; - } - - /** Pair of \ref sat::Solvable and \ref Pathname. */ - class UpdateNotificationFile - { - public: - UpdateNotificationFile( sat::Solvable solvable_r, const Pathname & file_r ) - : _solvable( solvable_r ), _file( file_r ) - {} - public: - sat::Solvable solvable() const { return _solvable; } - const Pathname & file() const { return _file; } - private: - sat::Solvable _solvable; - Pathname _file; - }; - - typedef std::list UpdateNotifications; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppCommitResult - // - /** Result returned from ZYpp::commit. - * - * \note Transaction data are provided and maintained during commit. - * Though the interface does not inhibit manipulation of transaction - * data outside commit (those methods could have been made \c private:), - * this is not recommended as you may easily mess up things. - * - * \see \ref ZYpp::commit - */ - class ZYppCommitResult - { - public: - typedef std::vector TransactionStepList; - - public: - ZYppCommitResult(); - ZYppCommitResult( const ZYppCommitResult & lhs_r ); - ZYppCommitResult( const Pathname & root_r ); - ~ZYppCommitResult(); - - public: - /** Remembered root directory of the target. - * \Note Pathnames within this class are relative to the - * targets root directory. - */ - const Pathname & root() const; - - /** The full transaction list. - * The complete list including transaction steps that do not require - * any action (like obsoletes or non-package actions). Depending on - * \ref ZYppCommitPolicy::restrictToMedia only a subset of this - * transaction might have been executed. - * \see \ref transactionStepList. - */ - const sat::Transaction & transaction() const; - - /** Manipulate \ref transaction */ - sat::Transaction & rTransaction(); - - /** List of \ref sat::Transaction::Step to be executed by commit. - * The list of transaction step commit actually tried to execute. - */ - const TransactionStepList & transactionStepList() const; - - /** Manipulate \ref transactionStepList. */ - TransactionStepList & rTransactionStepList(); - - /** List of update messages installed during this commit. - * \Note Pathnames are relative to the targets root directory. - * \code - * ZYppCommitResult result; - * ... - * if ( ! result.updateMessages().empty() ) - * { - * MIL << "Received " << result.updateMessages().size() << " update notification(s):" << endl; - * for_( it, result.updateMessages().begin(), result.updateMessages().end() ) - * { - * MIL << "- From " << it->solvable().asString() << " in file " << Pathname::showRootIf( result.root(), it->file() ) << ":" << endl; - * { - * // store message files content in a string: - * InputStream istr( Pathname::assertprefix( result.root(), it->file() ) ); - * std::ostringstream strstr; - * iostr::copy( istr, strstr ); - * std::string message( strstr.str() ); // contains the message - * } - * { - * // or write out the message file indented: - * InputStream istr( Pathname::assertprefix( result.root(), it->file() ) ); - * iostr::copyIndent( istr, MIL, "> " ) << endl; - * } - * } - * } - * \endcode - */ - const UpdateNotifications & updateMessages() const; - - /** Manipulate \ref updateMessages - * \Note Pathnames are relative to the targets root directory. - */ - UpdateNotifications & rUpdateMessages(); - - public: - - /** \name Some statistics based on \ref Transaction - * - * Class \ref Transaction allows to count and iterate the action steps to - * get more detailed information about the transaction result. Here are just - * a few convenience methods for easy evaluation. - * - * \code - * ZYppCommitResult result; - * const sat::Transaction & trans( result.transaction() ); - * for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() ) - * { - * // process all steps not DONE (ERROR and TODO) - * if ( it->satSolvable() ) - * std::cout << it->satSolvable() << endl; - * else // deleted @System solvable: print post mortem data available - * std::cout << it->ident() << endl; - * } - * \endcode - * \see \ref Transaction, \ref transaction() - */ - //@{ - /** Whether all steps were performed successfully (none skipped or error) */ - bool allDone() const - { return transaction().actionEmpty( ~sat::Transaction::STEP_DONE ); } - - /** Whether an error ocurred (skipped streps are ok). */ - bool noError() const - { return transaction().actionEmpty( sat::Transaction::STEP_ERROR ); } - //@} - - public: - /** Implementation */ - class Impl; - private: - /** Pointer to data. */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ZYppCommitResult Stream output. */ - std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPPCOMMITRESULT_H diff --git a/libzypp/zypp/ZYppFactory.cc b/libzypp/zypp/ZYppFactory.cc deleted file mode 100644 index 45fc1c2..0000000 --- a/libzypp/zypp/ZYppFactory.cc +++ /dev/null @@ -1,428 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppFactory.cc - * -*/ -extern "C" -{ -#include -} -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/Functional.h" -#include "zypp/base/Backtrace.h" -#include "zypp/PathInfo.h" - -#include "zypp/ZYppFactory.h" -#include "zypp/zypp_detail/ZYppImpl.h" -#include "zypp/zypp_detail/ZYppReadOnlyHack.h" - -#include -#include -#include - -using boost::interprocess::file_lock; -using boost::interprocess::scoped_lock; -using boost::interprocess::sharable_lock; - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace - { - void sigsegvHandler( int sig ); - ::sighandler_t lastSigsegvHandler = ::signal( SIGSEGV, sigsegvHandler ); - - /** SIGSEGV handler to log stack trace */ - void sigsegvHandler( int sig ) - { - INT << "Error: signal " << sig << endl << dumpBacktrace << endl; - ::signal( SIGSEGV, lastSigsegvHandler ); - } - } - - namespace env - { - /** Hack to circumvent the currently poor --root support. */ - inline Pathname ZYPP_LOCKFILE_ROOT() - { return getenv("ZYPP_LOCKFILE_ROOT") ? getenv("ZYPP_LOCKFILE_ROOT") : "/"; } - } - - /////////////////////////////////////////////////////////////////// - namespace zypp_readonly_hack - { ///////////////////////////////////////////////////////////////// - - static bool active = getenv("ZYPP_READONLY_HACK"); - - void IWantIt() - { - active = true; - MIL << "ZYPP_READONLY promised." << endl; - } - - bool IGotIt() - { - return active; - } - - ///////////////////////////////////////////////////////////////// - } // namespace zypp_readonly_hack - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class ZYppGlobalLock - /// \brief Our broken global lock - /// - /////////////////////////////////////////////////////////////////// - class ZYppGlobalLock - { - public: - ZYppGlobalLock() - : _zyppLockFilePath( env::ZYPP_LOCKFILE_ROOT() / "/var/run/zypp.pid" ) - , _zyppLockFile( NULL ) - , _lockerPid( 0 ) - , _cleanLock( false ) - { - filesystem::assert_dir(_zyppLockFilePath.dirname() ); - } - - ~ZYppGlobalLock() - { - if ( _cleanLock ) - try { - // Exception safe access to the lockfile. - ScopedGuard closeOnReturn( accessLockFile() ); - { - scoped_lock flock( _zyppLockFileLock ); // aquire write lock - // Truncate the file rather than deleting it. Other processes may - // still use it to synchronsize. - ftruncate( fileno(_zyppLockFile), 0 ); - } - MIL << "Cleanned lock file. (" << getpid() << ")" << std::endl; - } - catch(...) {} // let no exception escape. - } - - pid_t lockerPid() const - { return _lockerPid; } - - const std::string & lockerName() const - { return _lockerName; } - - const Pathname & zyppLockFilePath() const - { return _zyppLockFilePath; } - - - private: - Pathname _zyppLockFilePath; - file_lock _zyppLockFileLock; - FILE * _zyppLockFile; - - pid_t _lockerPid; - std::string _lockerName; - bool _cleanLock; - - private: - typedef shared_ptr ScopedGuard; - - /** Exception safe access to the lockfile. - * \code - * // Exception safe access to the lockfile. - * ScopedGuard closeOnReturn( accessLockFile() ); - * \endcode - */ - ScopedGuard accessLockFile() - { - _openLockFile(); - return ScopedGuard( static_cast(0), - bind( mem_fun_ref( &ZYppGlobalLock::_closeLockFile ), ref(*this) ) ); - } - - /** Use \ref accessLockFile. */ - void _openLockFile() - { - if ( _zyppLockFile != NULL ) - return; // is open - - // open pid file rw so we are sure it exist when creating the flock - _zyppLockFile = fopen( _zyppLockFilePath.c_str(), "a+" ); - if ( _zyppLockFile == NULL ) - ZYPP_THROW( Exception( "Cant open " + _zyppLockFilePath.asString() ) ); - _zyppLockFileLock = _zyppLockFilePath.c_str(); - MIL << "Open lockfile " << _zyppLockFilePath << endl; - } - - /** Use \ref accessLockFile. */ - void _closeLockFile() - { - if ( _zyppLockFile == NULL ) - return; // is closed - - clearerr( _zyppLockFile ); - fflush( _zyppLockFile ); - // http://www.boost.org/doc/libs/1_50_0/doc/html/interprocess/synchronization_mechanisms.html - // If you are using a std::fstream/native file handle to write to the file - // while using file locks on that file, don't close the file before releasing - // all the locks of the file. - _zyppLockFileLock = file_lock(); - fclose( _zyppLockFile ); - _zyppLockFile = NULL; - MIL << "Close lockfile " << _zyppLockFilePath << endl; - } - - - bool isProcessRunning( pid_t pid_r ) - { - // it is another program, not me, see if it is still running - Pathname procdir( "/proc"/str::numstring(pid_r) ); - PathInfo status( procdir ); - MIL << "Checking " << status << endl; - - if ( ! status.isDir() ) - { - DBG << "No such process." << endl; - return false; - } - - static char buffer[513]; - buffer[0] = buffer[512] = 0; - // man proc(5): /proc/[pid]/cmdline is empty if zombie. - if ( std::ifstream( (procdir/"cmdline").c_str() ).read( buffer, 512 ).gcount() > 0 ) - { - _lockerName = buffer; - DBG << "Is running: " << _lockerName << endl; - return true; - } - - DBG << "In zombie state." << endl; - return false; - } - - pid_t readLockFile() - { - clearerr( _zyppLockFile ); - fseek( _zyppLockFile, 0, SEEK_SET ); - long readpid = 0; - fscanf( _zyppLockFile, "%ld", &readpid ); - MIL << "read: Lockfile " << _zyppLockFilePath << " has pid " << readpid << " (our pid: " << getpid() << ") "<< std::endl; - return (pid_t)readpid; - } - - void writeLockFile() - { - clearerr( _zyppLockFile ); - fseek( _zyppLockFile, 0, SEEK_SET ); - ftruncate( fileno(_zyppLockFile), 0 ); - fprintf(_zyppLockFile, "%ld\n", (long)getpid() ); - fflush( _zyppLockFile ); - _cleanLock = true; // cleanup on exit - MIL << "write: Lockfile " << _zyppLockFilePath << " got pid " << getpid() << std::endl; - } - - public: - - /** Try to aquire a lock. - * \return \c true if zypp is already locked by another process. - */ - bool zyppLocked() - { - if ( geteuid() != 0 ) - return false; // no lock as non-root - - // Exception safe access to the lockfile. - ScopedGuard closeOnReturn( accessLockFile() ); - { - scoped_lock flock( _zyppLockFileLock ); // aquire write lock - - _lockerPid = readLockFile(); - if ( _lockerPid == 0 ) - { - // no or empty lock file - writeLockFile(); - return false; - } - else if ( _lockerPid == getpid() ) - { - // keep my own lock - return false; - } - else - { - // a foreign pid in lock - if ( isProcessRunning( _lockerPid ) ) - { - WAR << _lockerPid << " is running and has a ZYpp lock. Sorry." << std::endl; - return true; - } - else - { - MIL << _lockerPid << " is dead. Taking the lock file." << std::endl; - writeLockFile(); - return false; - } - } - } - INT << "Oops! We should not be here!" << std::endl; - return true; - } - - }; - - namespace - { - static ZYppGlobalLock & globalLock() - { - static ZYppGlobalLock lock; - return lock; - } - bool _haveZYpp = false; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppFactoryException - // - /////////////////////////////////////////////////////////////////// - - ZYppFactoryException::ZYppFactoryException( const std::string & msg_r, pid_t lockerPid_r, const std::string & lockerName_r ) - : Exception( msg_r ) - , _lockerPid( lockerPid_r ) - , _lockerName( lockerName_r ) - {} - - ZYppFactoryException::~ZYppFactoryException() throw () - {} - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppFactory - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYppFactory::instance - // METHOD TYPE : ZYppFactory - // - ZYppFactory ZYppFactory::instance() - { - return ZYppFactory(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYppFactory::ZYppFactory - // METHOD TYPE : Ctor - // - ZYppFactory::ZYppFactory() - { - - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYppFactory::~ZYppFactory - // METHOD TYPE : Dtor - // - ZYppFactory::~ZYppFactory() - {} - - /////////////////////////////////////////////////////////////////// - // - ZYpp::Ptr ZYppFactory::getZYpp() const - { - static ZYpp::Ptr _instance; - - if ( ! _instance ) - { - if ( geteuid() != 0 ) - { - MIL << "Running as user. Skip creating " << globalLock().zyppLockFilePath() << std::endl; - } - else if ( zypp_readonly_hack::active ) - { - MIL << "ZYPP_READONLY active." << endl; - } - else if ( globalLock().zyppLocked() ) - { - bool failed = true; - const long LOCK_TIMEOUT = str::strtonum( getenv( "ZYPP_LOCK_TIMEOUT" ) ); - if ( LOCK_TIMEOUT > 0 ) - { - MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within $LOCK_TIMEOUT=" << LOCK_TIMEOUT << " sec." << endl; - unsigned delay = 1; - Pathname procdir( "/proc"/str::numstring(globalLock().lockerPid()) ); - for ( long i = 0; i < LOCK_TIMEOUT; i += delay ) - { - if ( PathInfo( procdir ).isDir() ) // wait for /proc/pid to disapear - sleep( delay ); - else - { - MIL << "Retry after " << i << " sec." << endl; - failed = globalLock().zyppLocked(); - if ( failed ) - { - // another proc locked faster. maybe it ends fast as well.... - MIL << "Waiting whether pid " << globalLock().lockerPid() << " ends within " << (LOCK_TIMEOUT-i) << " sec." << endl; - procdir = Pathname( "/proc"/str::numstring(globalLock().lockerPid()) ); - } - else - { - MIL << "Finally got the lock!" << endl; - break; // gotcha - } - } - } - - } - if ( failed ) - { - std::string t = str::form(_("System management is locked by the application with pid %d (%s).\n" - "Close this application before trying again."), - globalLock().lockerPid(), - globalLock().lockerName().c_str() - ); - ZYPP_THROW(ZYppFactoryException(t, globalLock().lockerPid(), globalLock().lockerName() )); - } - } - // Here we go... - _instance = new ZYpp( ZYpp::Impl_Ptr(new ZYpp::Impl) ); - if ( _instance ) - _haveZYpp = true; - } - - return _instance; - } - - /////////////////////////////////////////////////////////////////// - // - bool ZYppFactory::haveZYpp() const - { return _haveZYpp; } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj ) - { - return str << "ZYppFactory"; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ZYppFactory.h b/libzypp/zypp/ZYppFactory.h deleted file mode 100644 index 8cfbf3f..0000000 --- a/libzypp/zypp/ZYppFactory.h +++ /dev/null @@ -1,81 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ZYppFactory.h - * -*/ -#ifndef ZYPP_ZYPPFACTORY_H -#define ZYPP_ZYPPFACTORY_H - -#include - -#include "zypp/base/Exception.h" -#include "zypp/ZYpp.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class ZYppFactoryException : public Exception - { - public: - ZYppFactoryException( const std::string & msg_r, pid_t lockerPid_r, const std::string & lockerName_r ); - virtual ~ZYppFactoryException() throw (); - public: - pid_t lockerPid() const { return _lockerPid; } - const std::string & lockerName() const { return _lockerName; } - private: - pid_t _lockerPid; - std::string _lockerName; - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppFactory - // - /** ZYpp factory class (Singleton) - */ - class ZYppFactory - { - friend std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj ); - - public: - /** Singleton ctor */ - static ZYppFactory instance(); - /** Dtor */ - ~ZYppFactory(); - - public: - /** \return Pointer to the ZYpp instance. - * \throw EXCEPTION In case we can't acquire a lock. - */ - ZYpp::Ptr getZYpp() const; - - /** Whether the ZYpp instance is already created.*/ - bool haveZYpp() const; - - private: - /** Default ctor. */ - ZYppFactory(); - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ZYppFactory Stream output */ - std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj ); - - /** \relates ZYppFactory Convenience to get the Pointer - * to the ZYpp instance. - * \see ZYppFactory::getZYpp - */ - inline ZYpp::Ptr getZYpp() - { return ZYppFactory::instance().getZYpp(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPPFACTORY_H diff --git a/libzypp/zypp/base/Algorithm.h b/libzypp/zypp/base/Algorithm.h deleted file mode 100644 index b67db98..0000000 --- a/libzypp/zypp/base/Algorithm.h +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Algorithm.h - * -*/ -#ifndef ZYPP_BASE_ALGORITHM_H -#define ZYPP_BASE_ALGORITHM_H - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Iterate through [begin_r,end_r) and invoke \a fnc_r - * on each item that passes \a filter_r. - * - * Iteration aborts if \a fnc_r returns \c false. - * - * \return Number of invokations of \a fnc_r, negative if - * loop was aborted by \a fnc_. - */ - template - inline int invokeOnEach( _Iterator begin_r, _Iterator end_r, - _Filter filter_r, - _Function fnc_r ) - { - int cnt = 0; - for ( _Iterator it = begin_r; it != end_r; ++it ) - { - if ( filter_r( *it ) ) - { - ++cnt; - if ( ! fnc_r( *it ) ) - return -cnt; - } - } - return cnt; - } - - /** Iterate through [begin_r,end_r) and invoke \a fnc_r - * on each item. - * - * Iteration aborts if \a fnc_r returns \c false. - * - * \return Number of invokations of \a fnc_r, negative if - * loop was aborted by \a fnc_. - */ - template - inline int invokeOnEach( _Iterator begin_r, _Iterator end_r, - _Function fnc_r ) - { - int cnt = 0; - for ( _Iterator it = begin_r; it != end_r; ++it ) - { - ++cnt; - if ( ! fnc_r( *it ) ) - return -cnt; - } - return cnt; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_ALGORITHM_H diff --git a/libzypp/zypp/base/Backtrace.cc b/libzypp/zypp/base/Backtrace.cc deleted file mode 100644 index 9c3ba96..0000000 --- a/libzypp/zypp/base/Backtrace.cc +++ /dev/null @@ -1,106 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Backtrace.cc - */ -#include -#include - -#include -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" -#include "zypp/base/Backtrace.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - std::ostream & dumpBacktrace( std::ostream & stream_r ) - { - // get void*'s for all entries on the stack - static const size_t arraySize = 50; - void *array[arraySize]; - size_t size = ::backtrace( array, arraySize ); - - // Print out all frames to stderr. Separate sigsegvHandler stack - // [dumpBacktrace][sigsegvHandler][libc throwing] from actual - // code stack. - char ** messages = ::backtrace_symbols( array, size ); - if ( messages ) - { - static const size_t handlerStack = 3; // [dumpBacktrace][sigsegvHandler][libc throwing] - static const size_t first = 0; - for ( size_t i = first; i < size; ++i ) - { - char * mangled_name = 0; - char * offset_begin = 0; - char * offset_end = 0; - - // find parentheses and +address offset surrounding mangled name - for ( char * p = messages[i]; *p; ++p ) - { - if ( *p == '(' ) - { - mangled_name = p; - } - else if ( *p == '+' ) - { - offset_begin = p; - } - else if ( *p == ')' ) - { - offset_end = p; - break; - } - } - - int btLevel = i-handlerStack; // negative level in sigsegvHandler - if ( i > first ) - { - stream_r << endl; - if ( btLevel == 0 ) - stream_r << "vvvvvvvvvv----------------------------------------" << endl; - } - stream_r << "[" << (btLevel<0 ?"hd":"bt") << "]: (" << btLevel << ") "; - - // if the line could be processed, attempt to demangle the symbol - if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin ) - { - *mangled_name++ = '\0'; - *offset_begin++ = '\0'; - *offset_end++ = '\0'; - - int status; - char * real_name = ::abi::__cxa_demangle( mangled_name, 0, 0, &status ); - - // if demangling is successful, output the demangled function name - if ( status == 0 ) - { - stream_r << messages[i] << " : " << real_name << "+" << offset_begin << offset_end; - } - // otherwise, output the mangled function name - else - { - stream_r << messages[i] << " : " << mangled_name << "+" << offset_begin << offset_end; - } - ::free( real_name ); - } - else - { - // otherwise, print the whole line - stream_r << messages[i]; - } - } - ::free( messages ); - } - return stream_r; - } - -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Backtrace.h b/libzypp/zypp/base/Backtrace.h deleted file mode 100644 index b94a9ef..0000000 --- a/libzypp/zypp/base/Backtrace.h +++ /dev/null @@ -1,36 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Backtrace.h - */ -#ifndef ZYPP_BASE_BACKTRACE_H -#define ZYPP_BASE_BACKTRACE_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - - /** Dump current stack trace to a stream. - * Thanks to http://stackoverflow.com/questions/77005. - * \code - * #include - * std::cerr << zypp::dumpBacktrace << std::endl; - * \endcode - * \code - * #include - * std::string trace( str::Str() << zypp::dumpBacktrace ); - * \endcode - */ - std::ostream & dumpBacktrace( std::ostream & stream_r ); - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_BACKTRACE_H diff --git a/libzypp/zypp/base/Collector.h b/libzypp/zypp/base/Collector.h deleted file mode 100644 index 605e7b4..0000000 --- a/libzypp/zypp/base/Collector.h +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Collector.h - * -*/ -#ifndef ZYPP_BASE_COLLECTOR_H -#define ZYPP_BASE_COLLECTOR_H - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace functor -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : _Collector<_OutputIterator> - // - /** Functor feeding values to an output_iterator. - * - * \code - * LocaleSet locales; - * for_each( begin(), end(), - * Collector( std::inserter( locales_r, locales_r.begin() ) ) ); - * \endcode - * - * \see Convenience constructor \ref Collector. - */ - template - struct _Collector - { - _Collector( _OutputIterator iter_r ) : _iter( iter_r ) {} - - template - bool operator()( const _Tp & value_r ) const - { - *_iter++ = value_r; - return true; - } - - private: - mutable _OutputIterator _iter; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates _Collector Convenience constructor. */ - template - inline _Collector<_OutputIterator> Collector( _OutputIterator iter_r ) - { return _Collector<_OutputIterator>( iter_r ); } - - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace functor -/////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_COLLECTOR_H diff --git a/libzypp/zypp/base/Counter.h b/libzypp/zypp/base/Counter.h deleted file mode 100644 index ce5418d..0000000 --- a/libzypp/zypp/base/Counter.h +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Counter.h - * -*/ -#ifndef ZYPP_BASE_COUNTER_H -#define ZYPP_BASE_COUNTER_H - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Counter - // - /** Integral type with initial value \c 0. - */ - template - class Counter - { - public: - Counter( _IntT value_r = _IntT(0) ) - : _value( _IntT( value_r ) ) - {} - - operator _IntT &() - { return _value; } - - operator const _IntT &() const - { return _value; } - - public: - _IntT _value; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_COUNTER_H diff --git a/libzypp/zypp/base/Debug.h b/libzypp/zypp/base/Debug.h deleted file mode 100644 index e19d94f..0000000 --- a/libzypp/zypp/base/Debug.h +++ /dev/null @@ -1,172 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Debug.h - * - * Debuging tools which should not be used in released code. -*/ -#warning ZYPP_BASE_DEBUG_H included -#ifndef ZYPP_BASE_DEBUG_H -#define ZYPP_BASE_DEBUG_H - -#include -//#include -//#include -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/ExternalProgram.h" -#include "zypp/base/ProvideNumericId.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace debug - { ///////////////////////////////////////////////////////////////// - - /** \defgroup DEBUG Debug tools - */ - -#define TAG INT << __PRETTY_FUNCTION__ << std::endl - - /** 'ps v' */ - inline std::ostream & dumpMemOn( std::ostream & str, const std::string & msg = std::string() ) - { - static std::string mypid( str::numstring( getpid() ) ); - const char* argv[] = - { - "ps", - "v", - mypid.c_str(), - NULL - }; - ExternalProgram prog(argv,ExternalProgram::Discard_Stderr, false, -1, true); - - str << "MEMUSAGE " << msg << std::endl; - for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() ) - str << line; - - prog.close(); - return str; - } - - /////////////////////////////////////////////////////////////////// - /** \defgroup DBG_TRACER Tracer - * \ingroup DEBUG - */ - //@{ - /** Base for a simple tracer. Provides an enum indicating which - * traced functions were called. - */ - struct TraceCADBase - { - enum What { CTOR, COPYCTOR, ASSIGN, DTOR, PING }; - std::string _ident; - }; - - /** \relates TraceCADBase Stream output of TraceCADBase::What. */ - inline std::ostream & operator<<( std::ostream & str, TraceCADBase::What obj ) - { - switch( obj ) - { - case TraceCADBase::CTOR: return str << "CTOR"; - case TraceCADBase::COPYCTOR: return str << "COPYCTOR"; - case TraceCADBase::ASSIGN: return str << "ASSIGN"; - case TraceCADBase::DTOR: return str << "DTOR"; - case TraceCADBase::PING: return str << "PING"; - } - return str; - } - - /** A simple tracer for (copy) Construction, Assignment, and - * Destruction. To trace class Foo, derive public from - * TraceCAD. This tracer simply calls traceCAD in each - * traced method, and traceCAD simply drops a line in the log. - * - * This tracer logs construction, copy construction, assignment, - * destruction and _PING. - * - * assignment: In case the traced class defines an operator= - * it must be altered to call TraceCAD::operator=, otherwise it - * won't be triggered. - * - * _PING: Completely up to you. Call _PING somewhere in the traced - * class to indicate something. In case you overload traceCAD, do - * whatever is appropriate on _PING. It's just an offer to perform - * logging or actions here, and not in the traced code. - * - * But traceCAD may be overloaded to produce more stats. - * - * \see \c Example.COW_debug.cc. - */ - template - struct TraceCAD : public base::ProvideNumericId, unsigned long> - , public TraceCADBase - { - static unsigned long & _totalTraceCAD() - { static unsigned long _val = 0; - return _val; } - - TraceCAD() - { _ident = __PRETTY_FUNCTION__; - ++_totalTraceCAD(); - traceCAD( CTOR, *this, *this ); } - - TraceCAD( const TraceCAD & rhs ) - { ++_totalTraceCAD(); - traceCAD( COPYCTOR, *this, rhs ); } - - TraceCAD & operator=( const TraceCAD & rhs ) - { traceCAD( ASSIGN, *this, rhs ); return *this; } - - virtual ~TraceCAD() - { --_totalTraceCAD(); - traceCAD( DTOR, *this, *this ); } - - void _PING() const - { traceCAD( PING, *this, *this ); } - }; - - /** \relates TraceCAD Stream output. */ - template - inline std::ostream & operator<<( std::ostream & str, const TraceCAD<_Tp> & obj ) - { return str << "(ID " << obj.numericId() << ", TOTAL " << obj._totalTraceCAD() - << ") [" << &obj << "] "; } - - /** Drop a log line about the traced method. Overload to - * fit your needs. - */ - template - void traceCAD( TraceCADBase::What what_r, - const TraceCAD<_Tp> & self_r, - const TraceCAD<_Tp> & rhs_r ) - { - switch( what_r ) - { - case TraceCADBase::CTOR: - case TraceCADBase::PING: - case TraceCADBase::DTOR: - _DBG("DEBUG") << what_r << self_r << " (" << self_r._ident << ")" << std::endl; - break; - - case TraceCADBase::COPYCTOR: - case TraceCADBase::ASSIGN: - _DBG("DEBUG") << what_r << self_r << "( " << rhs_r << ")" << " (" << self_r._ident << ")" << std::endl; - break; - } - } - //@} - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace debug - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_DEBUG_H diff --git a/libzypp/zypp/base/DefaultIntegral.h b/libzypp/zypp/base/DefaultIntegral.h deleted file mode 100644 index fc0a0b8..0000000 --- a/libzypp/zypp/base/DefaultIntegral.h +++ /dev/null @@ -1,87 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/DefaultIntegral.h - * -*/ -#ifndef ZYPP_BASE_DEFAULTINTEGRAL_H -#define ZYPP_BASE_DEFAULTINTEGRAL_H - -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : DefaultIntegral<_Tp,_Initial> - // - /** Integral type with defined initial value when default constructed. - * - * \code - * typedef DefaultIntegral Counter; - * std::map stats; - * for ( all keys ) - * ++(stats[key]); - * \endcode - * - * \todo maybe specialize for bool, add logical and bit operators - * \todo let _Initial default to 0 then remove base/Counter.h - */ - template - class DefaultIntegral - { - public: - typedef _Tp value_type; - - public: - DefaultIntegral( _Tp val_r = _Initial ) - : _val( val_r ) - { BOOST_STATIC_ASSERT(boost::is_integral<_Tp>::value); } - - /** Conversion to _Tp. */ - //@{ - _Tp & get() { return _val; } - _Tp get() const { return _val; } - - operator _Tp &() { return get(); } - operator _Tp () const { return get(); } - //@} - - /** Reset to the defined initial value. */ - DefaultIntegral & reset() { _val = _Initial; return *this; } - - /** \name Arithmetic operations. - * \c + \c - \c * \c / are provided via conversion to _Tp. - */ - //@{ - DefaultIntegral & operator=( _Tp rhs ) { _val = rhs; return *this; } - DefaultIntegral & operator+=( _Tp rhs ) { _val += rhs; return *this; } - DefaultIntegral & operator-=( _Tp rhs ) { _val -= rhs; return *this; } - DefaultIntegral & operator*=( _Tp rhs ) { _val *= rhs; return *this; } - DefaultIntegral & operator/=( _Tp rhs ) { _val /= rhs; return *this; } - - DefaultIntegral & operator++(/*prefix*/) { ++_val; return *this; } - DefaultIntegral & operator--(/*prefix*/) { --_val; return *this; } - - DefaultIntegral operator++(int/*postfix*/) { return _val++; } - DefaultIntegral operator--(int/*postfix*/) { return _val--; } - //@} - - private: - _Tp _val; - }; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_DEFAULTINTEGRAL_H diff --git a/libzypp/zypp/base/DtorReset.h b/libzypp/zypp/base/DtorReset.h deleted file mode 100644 index 48e8fdf..0000000 --- a/libzypp/zypp/base/DtorReset.h +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/DtorReset.h - * -*/ -#ifndef ZYPP_BASE_DTORRESET_H -#define ZYPP_BASE_DTORRESET_H - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : DtorReset - // - /** Assign a vaiable a certain value when going out of scope. - * Use it e.g. to reset/cleanup in presence of exceptions. - * \code - * struct Foo - * { - * void consume() - * { - * DtorReset x(_inConsume,false); - * _inConsume = true; - * MIL << _inConsume << endl; - * }; - * - * DefaultIntegral _inConsume; - * }; - * - * Foo f; - * MIL << f._inConsume << endl; // 0 - * f.consume(); // 1 - * MIL << f._inConsume << endl; // 0 - * \endcode - * \ingroup g_RAII - * \todo Check if using call_traits enables 'DtorReset(std::string,"value")', - * as this currently would require assignment of 'char[]'. - */ - class DtorReset - { - public: - template - DtorReset( _Var & var_r ) - : _pimpl( new Impl<_Var,_Var>( var_r, var_r ) ) - {} - template - DtorReset( _Var & var_r, const _Val & val_r ) - : _pimpl( new Impl<_Var,_Val>( var_r, val_r ) ) - {} - - private: - /** Requires _Val being copy constructible, and assignment - * _Var = _Val defined. */ - template - struct Impl - { - Impl( _Var & var_r, const _Val & val_r ) - : _var( var_r ) - , _val( val_r ) - {} - ~Impl() - { _var = _val; } - _Var & _var; - _Val _val; - }; - shared_ptr _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_DTORRESET_H diff --git a/libzypp/zypp/base/Easy.h b/libzypp/zypp/base/Easy.h deleted file mode 100644 index 018b399..0000000 --- a/libzypp/zypp/base/Easy.h +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Easy.h - * -*/ -#ifndef ZYPP_BASE_EASY_H -#define ZYPP_BASE_EASY_H - -#include - -/** Convenient for-loops using iterator. - * \code - * std::set; _store; - * for_( it, _store.begin(), _store.end() ) - * { - * cout << *it << endl; - * } - * \endcode -*/ -#ifndef __GXX_EXPERIMENTAL_CXX0X__ -#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT ) -#else -#define for_(IT,BEG,END) for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT ) -#endif -#define for_each_(IT,CONT) for_( IT, CONT.begin(), CONT.end() ) - -/** Simple C-array iterator - * \code - * const char * defstrings[] = { "", "a", "default", "two words" }; - * for_( it, arrayBegin(defstrings), arrayEnd(defstrings) ) - * cout << *it << endl; - * \endcode -*/ -#define arrayBegin(A) (&A[0]) -#define arraySize(A) (sizeof(A)/sizeof(*A)) -#define arrayEnd(A) (&A[0] + arraySize(A)) - -/** - * \code - * defConstStr( strANY(), "ANY" ); - * std::str str = strANY(); - * \endcode - */ -#define defConstStr(FNC,STR) inline const std::string & FNC { static const std::string val( STR ); return val; } - -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -#if GCC_VERSION < 40600 || not defined(__GXX_EXPERIMENTAL_CXX0X__) -#define nullptr NULL -#endif - -/** Delete copy ctor and copy assign */ -#define NON_COPYABLE(CLASS) \ - CLASS( const CLASS & ) = delete; \ - CLASS & operator=( const CLASS & ) = delete - -/** Default copy ctor and copy assign */ -#define DEFAULT_COPYABLE(CLASS) \ - CLASS( const CLASS & ) = default; \ - CLASS & operator=( const CLASS & ) = default - -#ifndef SWIG // Swig treats it as syntax error -/** Delete move ctor and move assign */ -#define NON_MOVABLE(CLASS) \ - CLASS( CLASS && ) = delete; \ - CLASS & operator=( CLASS && ) = delete - -/** Default move ctor and move assign */ -#define DEFAULT_MOVABLE(CLASS) \ - CLASS( CLASS && ) = default; \ - CLASS & operator=( CLASS && ) = default -#else -#define NON_MOVABLE(CLASS) -#define DEFAULT_MOVABLE(CLASS) -#endif - -/** Delete copy ctor and copy assign but enable default move */ -#define NON_COPYABLE_BUT_MOVE( CLASS ) \ - NON_COPYABLE(CLASS); \ - DEFAULT_MOVABLE(CLASS) - -/** Default move ctor and move assign but enable default copy */ -#define NON_MOVABLE_BUT_COPY( CLASS ) \ - NON_MOVABLE(CLASS); \ - DEFAULT_COPYABLE(CLASS) - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_EASY_H diff --git a/libzypp/zypp/base/EnumClass.h b/libzypp/zypp/base/EnumClass.h deleted file mode 100644 index 747b413..0000000 --- a/libzypp/zypp/base/EnumClass.h +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/EnumClass.h - */ -#ifndef ZYPP_BASE_ENUMCLASS_H -#define ZYPP_BASE_ENUMCLASS_H - -#include - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace base - { - /////////////////////////////////////////////////////////////////// - /// \class EnumClass - /// \brief Type safe enum (workaround SWIG not supporting enum class) - /// \code - /// struct _ColorDef { enum Enum { R, G ,B }; }; - /// typedef EnumClass<_ColorDef> Color; - /// \endcode - /// Conversion to from string can be easily added, e.g. like this: - /// \code - /// struct _ColorDef { - /// enum Enum { R, G ,B }; - /// static Enum fromString( const std::string & val_r ); - /// static const std::string & asString( Enum val_r ); - /// }; - /// std::ostream & operator<<( std::ostream & str, const _ColorDef & obj ) - /// { return str << _ColorDef::asString( obj.inSwitch() ); } - /// - /// typedef EnumClass<_ColorDef> Color; - /// Color red = Color::fromString("red"); - /// cout << red << endl; // "red" - /// \endcode - /////////////////////////////////////////////////////////////////// - template - class EnumClass : public _EnumDef - { - public: - typedef typename _EnumDef::Enum Enum; ///< The underlying enum type - typedef typename std::underlying_type::type Integral;///< The underlying integral type - - EnumClass( Enum val_r ) : _val( val_r ) {} - - /** Underlying enum value for use in switch - * \code - * struct _ColorDef { enum Enum { R, G ,B }; } - * typedef EnumClass<_ColorDef> Color; - * - * Color a; - * switch ( a.asEnum() ) - * \endcode - */ - Enum asEnum() const { return _val; } - - /** Underlying integral value (e.g. array index) - * \code - * struct _ColorDef { enum Enum { R, G ,B }; } - * typedef EnumClass<_ColorDef> Color; - * - * Color a; - * std::string table[] = { "red", "green", "blue" }; - * std::cout << table[a.asIntegral()] << std::endl; - */ - Integral asIntegral() const { return static_cast(_val); } - - friend bool operator==( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val == rhs._val; } - friend bool operator!=( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val != rhs._val; } - friend bool operator< ( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val < rhs._val; } - friend bool operator<=( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val <= rhs._val; } - friend bool operator> ( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val > rhs._val; } - friend bool operator>=( const EnumClass & lhs, const EnumClass & rhs ) { return lhs._val >= rhs._val; } - - private: - Enum _val; - }; - } // namespace base - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_ENUMCLASS_H diff --git a/libzypp/zypp/base/Errno.h b/libzypp/zypp/base/Errno.h deleted file mode 100644 index 9965612..0000000 --- a/libzypp/zypp/base/Errno.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Errno.h - * -*/ -#ifndef ZYPP_BASE_ERRNO_H -#define ZYPP_BASE_ERRNO_H - -#include -#include - -#include "zypp/base/String.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Convenience \c errno wrapper. */ - class Errno - { - public: - /** Default ctor: \c errno */ - Errno() : _errno( errno ) {} - - /** Ctor set to \c errno if error condition, else \c 0. - * \code - * int ret = ::write( fd, buffer, size ); - * DBG << "write returns: " << Errno( ret != size ) << end; - * // on success: "write returns: [0-Success]" - * // on error e.g.: "write returns: [11-Resource temporarily unavailable]" - * \endcode - */ - Errno( bool error_r ) : _errno( error_r ? errno : 0 ) {} - - /** Ctor taking an explicit errno value. */ - Errno( int errno_r ) : _errno( errno_r ) {} - - public: - /** Return the stored errno. */ - int get() const { return _errno; } - - /** Allow implicit conversion to \c int. */ - operator int() const { return get(); } - - /** Return human readable error string. */ - std::string asString() const { return str::form( "[%d-%s]", _errno, ::strerror(_errno) ); } - - private: - int _errno; - }; - - /** \relates Errno Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Errno & obj ) - { return str << obj.asString(); } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_ERRNO_H diff --git a/libzypp/zypp/base/Exception.cc b/libzypp/zypp/base/Exception.cc deleted file mode 100644 index 86f7b51..0000000 --- a/libzypp/zypp/base/Exception.cc +++ /dev/null @@ -1,142 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Exception.cc - * -*/ -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/base/Exception.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace exception_detail - { ///////////////////////////////////////////////////////////////// - - std::string CodeLocation::asString() const - { - return str::form( "%s(%s):%u", - _file.c_str(), - _func.c_str(), - _line ); - } - - std::ostream & operator<<( std::ostream & str, const CodeLocation & obj ) - { return str << obj.asString(); } - - ///////////////////////////////////////////////////////////////// - } // namespace exception_detail - /////////////////////////////////////////////////////////////////// - - Exception::Exception() - {} - - Exception::Exception( const std::string & msg_r ) - : _msg( msg_r ) - {} - - Exception::Exception( const std::string & msg_r, const Exception & history_r ) - : _msg( msg_r ) - { remember( history_r ); } - - Exception::~Exception() throw() - {} - - std::string Exception::asString() const - { - std::ostringstream str; - dumpOn( str ); - return str.str(); - } - - std::string Exception::asUserString() const - { - std::ostringstream str; - dumpOn( str ); - // call gettext to translate the message. This will - // not work if dumpOn() uses composed messages. - return _(str.str().c_str()); - } - - std::string Exception::asUserHistory() const - { - if ( historyEmpty() ) - return asUserString(); - - std::string ret( asUserString() ); - if ( ret.empty() ) - return historyAsString(); - - ret += '\n'; - ret += historyAsString(); - return ret; - } - - void Exception::remember( const Exception & old_r ) - { - if ( &old_r != this ) // no self-remember - { - History newh( old_r._history.begin(), old_r._history.end() ); - newh.push_front( old_r.asUserString() ); - _history.swap( newh ); - } - } - - void Exception::addHistory( const std::string & msg_r ) - { - _history.push_front( msg_r ); - } - - std::string Exception::historyAsString() const - { - // TranslatorExplanation followed by the list of error messages that lead to this exception - std::string history( _("History:") ); - std::ostringstream ret; - dumpRange( ret, historyBegin(), historyEnd(), - "", history+"\n - ", "\n - ", "\n", "" ); - return ret.str(); - } - - std::ostream & Exception::dumpOn( std::ostream & str ) const - { return str << _msg; } - - std::ostream & Exception::dumpError( std::ostream & str ) const - { return dumpOn( str << _where << ": " ); } - - std::ostream & operator<<( std::ostream & str, const Exception & obj ) - { return obj.dumpError( str ); } - - - std::string Exception::strErrno( int errno_r ) - { return str::strerror( errno_r ); } - - std::string Exception::strErrno( int errno_r, const std::string & msg_r ) - { - std::string ret( msg_r ); - ret += ": "; - return ret += strErrno( errno_r ); - } - - void Exception::log( const Exception & excpt_r, const CodeLocation & where_r, - const char *const prefix_r ) - { - INT << where_r << " " << prefix_r << " " << excpt_r.asUserHistory() << endl; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Exception.h b/libzypp/zypp/base/Exception.h deleted file mode 100644 index 4d0f5be..0000000 --- a/libzypp/zypp/base/Exception.h +++ /dev/null @@ -1,356 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Exception.h - * -*/ -#ifndef ZYPP_BASE_EXCEPTION_H -#define ZYPP_BASE_EXCEPTION_H - -#include -#include -#include -#include - -#include "zypp/base/Errno.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace exception_detail - { ///////////////////////////////////////////////////////////////// - - /** Keep _FILE_, _FUNCTION_ and _LINE_. - * Construct it using the \ref ZYPP_EX_CODELOCATION macro. - */ - struct CodeLocation - { - friend std::ostream & operator<<( std::ostream & str, const CodeLocation & obj ); - - /** Ctor */ - CodeLocation() - : _line( 0 ) - {} - - /** Ctor */ - CodeLocation( const std::string & file_r, - const std::string & func_r, - unsigned line_r ) - : _file( file_r ), _func( func_r ), _line( line_r ) - {} - - /** Location as string */ - std::string asString() const; - - private: - std::string _file; - std::string _func; - unsigned _line; - }; - /////////////////////////////////////////////////////////////////// - - /** Create CodeLocation object storing the current location. */ - //#define ZYPP_EX_CODELOCATION ::zypp::exception_detail::CodeLocation(__FILE__,__FUNCTION__,__LINE__) -#define ZYPP_EX_CODELOCATION ::zypp::exception_detail::CodeLocation(( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ ),__FUNCTION__,__LINE__) - - /** \relates CodeLocation Stream output */ - std::ostream & operator<<( std::ostream & str, const CodeLocation & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace exception_detail - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Exception - /** Base class for Exception. - * - * Exception offers to store a message string passed to the ctor. - * Derived classes may provide additional information. Overload - * \ref dumpOn to provide a proper error text. - * - * \li Use \ref ZYPP_THROW to throw exceptions. - * \li Use \ref ZYPP_CAUGHT If you caught an exceptions in order to handle it. - * \li Use \ref ZYPP_RETHROW to rethrow a caught exception. - * - * The use of these macros is not mandatory. but \c ZYPP_THROW and - * \c ZYPP_RETHROW will adjust the code location information stored in - * the Exception. All three macros will drop a line in the logfile. - - * \code - * 43 try - * 44 { - * 45 try - * 46 { - * 47 ZYPP_THROW( Exception("Something bad happened.") ); - * 48 } - * 49 catch ( Exception & excpt ) - * 50 { - * 51 ZYPP_RETHROW( excpt ); - * 52 } - * 53 - * 54 } - * 55 catch ( Exception & excpt ) - * 56 { - * 57 ZYPP_CAUGHT( excpt ); - * 58 } - * \endcode - * The above produces the following log lines: - * \code - * Main.cc(main):47 THROW: Main.cc(main):47: Something bad happened. - * Main.cc(main):51 RETHROW: Main.cc(main):47: Something bad happened. - * Main.cc(main):57 CAUGHT: Main.cc(main):51: Something bad happened. - * \endcode - * - * - * Class Exception now offers a history list of message strings. - * These messages should describe what lead to the exception. - * - * The Exceptions message itself is NOT included in the history. - * - * Rethrow, remembering an old exception: - * \code - * try - * { - * .... - * } - * catch( const Exception & olderr_r ) - * { - * ZYPP_CAUGHT( olderr_r ) - * HighLevelException newerr( "Something failed." ); - * newerr.rember( olderr_r ); - * ZYPP_THROW( newerr ); - * } - * \endcode - * - * Print an Exception followed by it's history if available: - * \code - * Exception error; - * ERR << error << endl << error.historyAsString(); - * \endcode - * - * \todo That's a draft to have a common way of throwing exceptions. - * Most probabely we'll finally use blocxx exceptions. Here, but not - * in the remaining code of zypp. If we can we should try to wrap - * the blocxx macros and typedef the classes in here. - **/ - class Exception : public std::exception - { - friend std::ostream & operator<<( std::ostream & str, const Exception & obj ); - - public: - typedef exception_detail::CodeLocation CodeLocation; - typedef std::list History; - typedef History::const_iterator HistoryIterator; - typedef History::size_type HistorySize; - - /** Default ctor. - * Use \ref ZYPP_THROW to throw exceptions. - */ - Exception(); - - /** Ctor taking a message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - Exception( const std::string & msg_r ); - - /** Ctor taking a message and an exception to remember as history - * \see \ref remember - * Use \ref ZYPP_THROW to throw exceptions. - */ - Exception( const std::string & msg_r, const Exception & history_r ); - - /** Dtor. */ - virtual ~Exception() throw(); - - /** Return CodeLocation. */ - const CodeLocation & where() const - { return _where; } - - /** Exchange location on rethrow. */ - void relocate( const CodeLocation & where_r ) const - { _where = where_r; } - - /** Return the message string provided to the ctor. - * \note This is not necessarily the complete error message. - * The whole error message is provided by \ref asString or - * \ref dumpOn. - */ - const std::string & msg() const - { return _msg; } - - /** Error message provided by \ref dumpOn as string. */ - std::string asString() const; - - /** Translated error message as string suitable for the user. - * \see \ref asUserStringHistory - */ - std::string asUserString() const; - - public: - /** \name History list of message strings. - * Maintain a simple list of individual error messages, that lead - * to this Exception. The Exceptions message itself is not included - * in the history. The History list stores the most recent message - * fist. - */ - //@{ - - /** Store an other Exception as history. */ - void remember( const Exception & old_r ); - - /** Add some message text to the history. */ - void addHistory( const std::string & msg_r ); - - /** Iterator pointing to the most recent message. */ - HistoryIterator historyBegin() const - { return _history.begin(); } - - /** Iterator pointing behind the last message. */ - HistoryIterator historyEnd() const - { return _history.end(); } - - /** Whether the history list is empty. */ - bool historyEmpty() const - { return _history.empty(); } - - /** The size of the history list. */ - HistorySize historySize() const - { return _history.size(); } - - /** The history as string. Empty if \ref historyEmpty. - * Otherwise: - * \code - * History: - * - most recent message - * - 2nd message - * ... - * - oldest message - * \endcode - */ - std::string historyAsString() const; - - /** A single (multiline) string composed of \ref asUserString and \ref historyAsString. */ - std::string asUserHistory() const; - //@} - - protected: - - /** Overload this to print a proper error message. */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - - public: - /** Make a string from \a errno_r. */ - static std::string strErrno( int errno_r ); - /** Make a string from \a errno_r and \a msg_r. */ - static std::string strErrno( int errno_r, const std::string & msg_r ); - - public: - /** Drop a logline on throw, catch or rethrow. - * Used by \ref ZYPP_THROW macros. - */ - static void log( const Exception & excpt_r, const CodeLocation & where_r, - const char *const prefix_r ); - - private: - mutable CodeLocation _where; - std::string _msg; - History _history; - - /** Return message string. */ - virtual const char * what() const throw() - { return _msg.c_str(); } - - /** Called by std::ostream & operator\<\<. - * Prints \ref CodeLocation and the error message provided by - * \ref dumpOn. - */ - std::ostream & dumpError( std::ostream & str ) const; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Exception Stream output */ - std::ostream & operator<<( std::ostream & str, const Exception & obj ); - - /////////////////////////////////////////////////////////////////// - - /** Helper for \ref ZYPP_THROW. */ - template - void _ZYPP_THROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) __attribute__((noreturn)); - template - void _ZYPP_THROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) - { - excpt_r.relocate( where_r ); - Exception::log( excpt_r, where_r, "THROW: " ); - throw( excpt_r ); - } - - /** Helper for \ref ZYPP_THROW. */ - template - void _ZYPP_CAUGHT( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) - { - Exception::log( excpt_r, where_r, "CAUGHT: " ); - } - - /** Helper for \ref ZYPP_THROW. */ - template - void _ZYPP_RETHROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) __attribute__((noreturn)); - template - void _ZYPP_RETHROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) - { - Exception::log( excpt_r, where_r, "RETHROW: " ); - excpt_r.relocate( where_r ); - throw; - } - - /////////////////////////////////////////////////////////////////// - - /** \defgroup ZYPP_THROW ZYPP_THROW macros - * Macros for throwing Exception. - * \see \ref zypp::Exception for an example. - */ - //@{ - /** Drops a logline and throws the Exception. */ -#define ZYPP_THROW(EXCPT)\ - _ZYPP_THROW( EXCPT, ZYPP_EX_CODELOCATION ) - - /** Drops a logline telling the Exception was caught (in order to handle it). */ -#define ZYPP_CAUGHT(EXCPT)\ - _ZYPP_CAUGHT( EXCPT, ZYPP_EX_CODELOCATION ) - - /** Drops a logline and rethrows, updating the CodeLocation. */ -#define ZYPP_RETHROW(EXCPT)\ - _ZYPP_RETHROW( EXCPT, ZYPP_EX_CODELOCATION ) - - - /** Throw Exception built from a message string. */ -#define ZYPP_THROW_MSG(EXCPTTYPE, MSG)\ - ZYPP_THROW( EXCPTTYPE( MSG ) ) - - /** Throw Exception built from errno. */ -#define ZYPP_THROW_ERRNO(EXCPTTYPE)\ - ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno) ) ) - - /** Throw Exception built from errno provided as argument. */ -#define ZYPP_THROW_ERRNO1(EXCPTTYPE, ERRNO)\ - ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO) ) ) - - /** Throw Exception built from errno and a message string. */ -#define ZYPP_THROW_ERRNO_MSG(EXCPTTYPE, MSG)\ - ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno,MSG) ) ) - - /** Throw Exception built from errno provided as argument and a message string */ -#define ZYPP_THROW_ERRNO_MSG1(EXCPTTYPE, ERRNO,MSG)\ - ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO,MSG) ) ) - //@} - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_EXCEPTION_H diff --git a/libzypp/zypp/base/ExternalDataSource.cc b/libzypp/zypp/base/ExternalDataSource.cc deleted file mode 100644 index 35023e9..0000000 --- a/libzypp/zypp/base/ExternalDataSource.cc +++ /dev/null @@ -1,156 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ExternalDataSource.cc - */ - -#define _GNU_SOURCE 1 // for ::getline - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/ExternalDataSource.h" - -using namespace std; - -namespace zypp { - namespace externalprogram { - - ExternalDataSource::ExternalDataSource (FILE *ifile, FILE *ofile) - : inputfile (ifile), - outputfile (ofile), - linebuffer (0), - linebuffer_size (0) - { - } - - - ExternalDataSource::~ExternalDataSource () - { - if (linebuffer) - free (linebuffer); - close (); - } - - - bool - ExternalDataSource::send (const char *buffer, size_t length) - { - if (outputfile) { - bool success = fwrite (buffer, length, 1, outputfile) != 0; - fflush (outputfile); - return success; - } - else - return false; - } - - - bool - ExternalDataSource::send (std::string s) - { - DBG << "send (" << s << ")"; - return send(s.data(), s.length()); - } - - - string - ExternalDataSource::receiveUpto (char c) - { - if (inputfile && !feof(inputfile)) - { - std::ostringstream datas; - while ( true ) - { - int readc = fgetc(inputfile); - if (readc == EOF) break; - datas << (char)readc; - if ((char)readc == c) break; - } - return datas.str(); - } - return string(); - } - - - size_t - ExternalDataSource::receive (char *buffer, size_t length) - { - if (inputfile) - return fread (buffer, 1, length, inputfile); - else - return 0; - } - - void ExternalDataSource::setBlocking(bool mode) - { - if(!inputfile) return; - - int fd = ::fileno(inputfile); - - if(fd == -1) - { ERR << strerror(errno) << endl; return; } - - int flags = ::fcntl(fd,F_GETFL); - - if(flags == -1) - { ERR << strerror(errno) << endl; return; } - - if(!mode) - flags = flags | O_NONBLOCK; - else if(flags & O_NONBLOCK) - flags = flags ^ O_NONBLOCK; - - flags = ::fcntl(fd,F_SETFL,flags); - - if(flags == -1) - { ERR << strerror(errno) << endl; return; } - } - - string - ExternalDataSource::receiveLine() - { - if (inputfile) - { - ssize_t nread = getline (&linebuffer, &linebuffer_size, inputfile); - if (nread == -1) - return ""; - else - return string (linebuffer, nread); - } - else - return ""; - } - - - int - ExternalDataSource::close () - { - if (inputfile && inputfile != outputfile) - fclose (inputfile); - if (outputfile) - fclose (outputfile); - inputfile = 0; - outputfile = 0; - return 0; - } - - - } // namespace externalprogram -} // namespace zypp - diff --git a/libzypp/zypp/base/ExternalDataSource.h b/libzypp/zypp/base/ExternalDataSource.h deleted file mode 100644 index ed2773b..0000000 --- a/libzypp/zypp/base/ExternalDataSource.h +++ /dev/null @@ -1,108 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ExternalDataSource.h - */ - -#ifndef ZYPP_EXTERNALDATASOURCE_H -#define ZYPP_EXTERNALDATASOURCE_H - -#include - -#include - -namespace zypp { - namespace externalprogram { - - /** - * @short Bidirectional stream to external data - */ - class ExternalDataSource - { - protected: - FILE *inputfile; - FILE *outputfile; - - private: - char *linebuffer; - size_t linebuffer_size; - - public: - /** - * Create a new instance. - * @param inputfile The stream for reading - * @param outputfile The stream for writing - * Either can be NULL if no reading/writing is allowed. - */ - ExternalDataSource(FILE *inputfile = 0, FILE *outputfile = 0); - - /** - * Implicitly close the connection. - */ - virtual ~ExternalDataSource(); - - /** - * Send some data to the output stream. - * @param buffer The data to send - * @param length The size of it - */ - bool send (const char *buffer, size_t length); - - /** - * Send some data down the stream. - * @param string The data to send - */ - bool send (std::string s); - - /** - * Read some data from the input stream. - * @param buffer Where to put the data - * @param length How much to read at most - * Returns the amount actually received - */ - size_t receive(char *buffer, size_t length); - - /** - * Read one line from the input stream. - * Returns the line read, including the terminator. - */ - std::string receiveLine(); - - /** - * Read characters into a string until character c is - * read. C is put at the end of the string. - */ - std::string receiveUpto(char c); - /** - * Set the blocking mode of the input stream. - * @param mode True if the reader should be blocked waiting for input. - * This is the initial default. - */ - void setBlocking(bool mode); - - /** - * Close the input and output streams. - */ - virtual int close(); - - /** - * Return the input stream. - */ - FILE *inputFile() const { return inputfile; } - - /** - * Return the output stream. - */ - FILE *outputFile() const { return outputfile; } - }; - - } // namespace externalprogram -} // namespace zypp - -#endif // ZYPP_EXTERNALDATASOURCE_H - diff --git a/libzypp/zypp/base/Fd.cc b/libzypp/zypp/base/Fd.cc deleted file mode 100644 index 29887ea..0000000 --- a/libzypp/zypp/base/Fd.cc +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Fd.cc - * -*/ -extern "C" -{ -#include -#include -#include -} - -#include - -#include "zypp/base/Exception.h" -#include "zypp/base/Fd.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Fd::Fd - // METHOD TYPE : Ctor - // - Fd::Fd( const Pathname & file_r, int open_flags, mode_t mode ) - : m_fd( -1 ) - { - m_fd = open( file_r.asString().c_str(), open_flags, mode ); - if ( m_fd == -1 ) - ZYPP_THROW_ERRNO_MSG( Exception, std::string("open ")+file_r.asString() ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Fd::close - // METHOD TYPE : void - // - void Fd::close() - { - if ( m_fd != -1 ) - { - ::close( m_fd ); - m_fd = -1; - } - } - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Fd.h b/libzypp/zypp/base/Fd.h deleted file mode 100644 index 0cca746..0000000 --- a/libzypp/zypp/base/Fd.h +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Fd.h - * -*/ -#ifndef ZYPP_BASE_FD_H -#define ZYPP_BASE_FD_H - -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Fd - // - /** Assert \c close called on open filedescriptor. - * \code - * ... - * scoped_ptr fd; // calls close when going out of scope - * try { - * fd.reset( new Fd( "/some/file" ) ); - * } catch ( ... ) { - * // open failed. - * } - * read( fd->fd(), ... ), - * \endcode - * - * \ingroup g_RAII - * \todo It's dumb. Openflags and more related functions (read/write..) - * could be added. - */ - class Fd - { - public: - /** Ctor opens file. - * \throw EXCEPTION If open fails. - */ - Fd( const Pathname & file_r, int open_flags, mode_t mode = 0 ); - - /** Dtor closes file. */ - ~Fd() - { close(); } - - /** Explicitly close the file. */ - void close(); - - /** Test for valid filedescriptor. */ - bool isOpen() const - { return m_fd != -1; } - - /** Return the filedescriptor. */ - int fd() const - { return m_fd; } - - private: - /** The filedescriptor. */ - int m_fd; - /** No copy. */ - Fd( const Fd & ); - /** No assign. */ - Fd & operator=( const Fd & ); - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_FD_H diff --git a/libzypp/zypp/base/Flags.h b/libzypp/zypp/base/Flags.h deleted file mode 100644 index 6bf7f10..0000000 --- a/libzypp/zypp/base/Flags.h +++ /dev/null @@ -1,138 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Flags.h - * -*/ -#ifndef ZYPP_BASE_FLAGS_H -#define ZYPP_BASE_FLAGS_H - -#include "zypp/base/String.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Flags - // - /** A type-safe way of storing OR-combinations of enum values (like QTs QFlags). - * \see QFlags Class Reference - * \code - * class RpmDb - * { - * public: - * enum DbStateInfoBits { - * DbSI_NO_INIT = 0x0000, - * DbSI_HAVE_V4 = 0x0001, - * DbSI_MADE_V4 = 0x0002, - * DbSI_MODIFIED_V4 = 0x0004, - * DbSI_HAVE_V3 = 0x0008, - * DbSI_HAVE_V3TOV4 = 0x0010, - * DbSI_MADE_V3TOV4 = 0x0020 - * }; - * - * ZYPP_DECLARE_FLAGS(DbStateInfo,DbStateInfoBits); - * }; - * ZYPP_DECLARE_OPERATORS_FOR_FLAGS(RpmDb::DbStateInfo); - * - * ... - * enum Other { OTHERVAL = 13 }; - * { - * XRpmDb::DbStateInfo s; - * s = XRpmDb::DbSI_MODIFIED_V4|XRpmDb::DbSI_HAVE_V4; - * // s |= OTHERVAL; // As desired: it does not compile - * } - * \endcode - */ - template - class Flags - { - public: - typedef _Enum Enum; ///< The underlying enum type - typedef typename std::underlying_type::type Integral; ///< The underlying integral type - - public: - constexpr Flags() : _val( 0 ) {} - constexpr Flags( Enum flag_r ) : _val( flag_r ) {} - explicit constexpr Flags( Integral flag_r ) : _val( flag_r ) {} - - Flags & operator&=( Flags rhs ) { _val &= rhs._val; return *this; } - Flags & operator&=( Enum rhs ) { _val &= rhs; return *this; } - - Flags & operator|=( Flags rhs ) { _val |= rhs._val; return *this; } - Flags & operator|=( Enum rhs ) { _val |= rhs; return *this; } - - Flags & operator^=( Flags rhs ) { _val ^= rhs._val; return *this; } - Flags & operator^=( Enum rhs ) { _val ^= rhs; return *this; } - - public: - constexpr operator Integral() const { return _val; } - - constexpr Flags operator&( Flags rhs ) const { return Flags( _val & rhs._val ); } - constexpr Flags operator&( Enum rhs ) const { return Flags( _val & rhs ); } - - constexpr Flags operator|( Flags rhs ) const { return Flags( _val | rhs._val ); } - constexpr Flags operator|( Enum rhs ) const { return Flags( _val | rhs ); } - - constexpr Flags operator^( Flags rhs ) const { return Flags( _val ^ rhs._val ); } - constexpr Flags operator^( Enum rhs ) const { return Flags( _val ^ rhs ); } - - constexpr Flags operator~() const { return Flags( ~_val ); } - - public: - Flags & setFlag( Flags flag_r, bool newval_r ) { return( newval_r ? setFlag(flag_r) : unsetFlag(flag_r) ); } - Flags & setFlag( Enum flag_r, bool newval_r ) { return( newval_r ? setFlag(flag_r) : unsetFlag(flag_r) ); } - - Flags & setFlag( Flags flag_r ) { _val |= flag_r; return *this; } - Flags & setFlag( Enum flag_r ) { _val |= flag_r; return *this; } - - Flags & unsetFlag( Flags flag_r ) { _val &= ~flag_r; return *this; } - Flags & unsetFlag( Enum flag_r ) { _val &= ~flag_r; return *this; } - - bool testFlag( Flags flag_r ) const { return ( _val & flag_r ) == flag_r; } - bool testFlag( Enum flag_r ) const { return ( _val & flag_r ) == flag_r; } - - private: - Integral _val; - }; - /////////////////////////////////////////////////////////////////// - - template - inline std::ostream & operator<<( std::ostream & str, const Flags & obj ) - { return str << str::hexstring(obj); } - - /** \relates Flags */ -#define ZYPP_DECLARE_FLAGS(Name,Enum) typedef zypp::base::Flags Name - - /** \relates Flags */ -#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name) \ -inline constexpr Name operator&( Name::Enum lhs, Name::Enum rhs ) { return Name( lhs ) & rhs; } \ -inline constexpr Name operator&( Name::Enum lhs, Name rhs ) { return rhs & lhs; } \ -inline constexpr Name operator|( Name::Enum lhs, Name::Enum rhs ) { return Name( lhs ) | rhs; } \ -inline constexpr Name operator|( Name::Enum lhs, Name rhs ) { return rhs | lhs; } \ -inline constexpr Name operator^( Name::Enum lhs, Name::Enum rhs ) { return Name( lhs ) ^ rhs; } \ -inline constexpr Name operator^( Name::Enum lhs, Name rhs ) { return rhs ^ lhs; } \ -inline constexpr Name operator~( Name::Enum lhs ) { return ~Name( lhs ); } - - /** \relates Flags */ -#define ZYPP_DECLARE_FLAGS_AND_OPERATORS(Name,Enum) \ - ZYPP_DECLARE_FLAGS(Name,Enum); \ - ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name) - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_FLAGS_H diff --git a/libzypp/zypp/base/Function.h b/libzypp/zypp/base/Function.h deleted file mode 100644 index 95b1fe7..0000000 --- a/libzypp/zypp/base/Function.h +++ /dev/null @@ -1,78 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Function.h - * -*/ -#ifndef ZYPP_BASE_FUNCTION_H -#define ZYPP_BASE_FUNCTION_H - -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /* http://www.boost.org/doc/html/function.html - - The Boost.Function library contains a family of class templates - that are function object wrappers. The notion is similar to a - generalized callback. It shares features with function pointers - in that both define a call interface (e.g., a function taking - two integer arguments and returning a floating-point value) - through which some implementation can be called, and the - implementation that is invoked may change throughout the - course of the program. - - Generally, any place in which a function pointer would be used - to defer a call or make a callback, Boost.Function can be used - instead to allow the user greater flexibility in the implementation - of the target. Targets can be any 'compatible' function object - (or function pointer), meaning that the arguments to the interface - designated by Boost.Function can be converted to the arguments of - the target function object. - */ - using boost::function; - - /* http://www.boost.org/libs/bind/bind.html - - boost::bind is a generalization of the standard functions std::bind1st - and std::bind2nd. It supports arbitrary function objects, functions, - function pointers, and member function pointers, and is able to bind - any argument to a specific value or route input arguments into arbitrary - positions. bind does not place any requirements on the function object; - in particular, it does not need the result_type, first_argument_type and - second_argument_type standard typedefs. - */ - using boost::bind; - - /* http://www.boost.org/doc/html/ref.html - - The Ref library is a small library that is useful for passing references - to function templates (algorithms) that would usually take copies of their - arguments. It defines the class template boost::reference_wrapper, the - two functions boost::ref and boost::cref that return instances of - boost::reference_wrapper, and the two traits classes - boost::is_reference_wrapper and boost::unwrap_reference. - - The purpose of boost::reference_wrapper is to contain a reference to an - object of type T. It is primarily used to "feed" references to function - templates (algorithms) that take their parameter by value. - - To support this usage, boost::reference_wrapper provides an implicit - conversion to T&. This usually allows the function templates to work on - references unmodified. - */ - using boost::ref; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_FUNCTION_H diff --git a/libzypp/zypp/base/Functional.h b/libzypp/zypp/base/Functional.h deleted file mode 100644 index 9d6de50..0000000 --- a/libzypp/zypp/base/Functional.h +++ /dev/null @@ -1,445 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Functional.h - * -*/ -#ifndef ZYPP_BASE_FUNCTIONAL_H -#define ZYPP_BASE_FUNCTIONAL_H - -#include - -#include "zypp/base/Function.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /* http://www.boost.org/libs/functional/mem_fun.html - - The header functional.hpp includes improved versions of - the full range of member function adapters from the - C++ Standard Library. - */ - using boost::mem_fun; - using boost::mem_fun_ref; - - /////////////////////////////////////////////////////////////////// - namespace functor - { ///////////////////////////////////////////////////////////////// - - /** An unary functor forwarding to some other _Functor &. - * \ingroup g_Functor - * - * Most algorithms take functor arguments by value. That's inconvenient - * if the functor wants to collect and return data. Creating and - * passing a \ref FunctorRef to the algorithm, may help you out of this. - * - * \code - * // Counts invokations of operator(). - * template - * struct Counter : public std::unary_function<_Tp, void> - * { - * void operator()( _Tp ) - * { ++_value; } - * - * Counter() : _value( 0 ) {} - * - * unsigned _value; - * }; - * - * std::set c; - * Counter counter; - * // Invokations of FunctorRef are forwarded to counter: - * std::for_each( c.begin, c.end(), - * // currently you must specify the - * // operator() signature: - * functorRef(counter) - * ); - * \endcode - * - * \note FunctorRef must be able to deduce the signature of - * \c _Functor::operator(). This is currently not automated, - * so you must specify the operator() signature as template - * arguments. - * - * \note The order is (this - * differs from std::, where the result comes last). - * - * \todo drop it an use boost::ref - */ - - ///////////////////////////////////////////////////////////////// - namespace functor_detail - { - template - struct FunctorRef0 - { - FunctorRef0( _Functor & f_r ) - : _f( f_r ) - {} - - res_type operator()() const - { - return _f(); - } - - private: - _Functor & _f; - }; - - template - struct FunctorRef1 : public std::unary_function - { - FunctorRef1( _Functor & f_r ) - : _f( f_r ) - {} - - res_type operator()( arg1_type a1 ) const - { - return _f( a1 ); - } - - private: - _Functor & _f; - }; - - template - struct FunctorRef2 : public std::binary_function - { - FunctorRef2( _Functor & f_r ) - : _f( f_r ) - {} - - res_type operator()( arg1_type a1, arg2_type a2 ) const - { - return _f( a1, a2 ); - } - - private: - _Functor & _f; - }; - - struct nil - {}; - } - ///////////////////////////////////////////////////////////////// - - /** A binary \ref FunctorRef. - * Create it using \ref functorRef convenience function. - */ - template - struct FunctorRef - : public functor_detail::FunctorRef2<_Functor, res_type, arg1_type, arg2_type> - { - FunctorRef( _Functor & f_r ) - : functor_detail::FunctorRef2<_Functor, res_type, arg1_type, arg2_type>( f_r ) - {} - }; - - /** A unary \ref FunctorRef. - * Create it using \ref functorRef convenience function. - */ - template - struct FunctorRef<_Functor, res_type, arg1_type> - : public functor_detail::FunctorRef1<_Functor, res_type, arg1_type> - { - FunctorRef( _Functor & f_r ) - : functor_detail::FunctorRef1<_Functor, res_type, arg1_type>( f_r ) - {} - }; - - /** A nullary \ref FunctorRef. - * Create it using \ref functorRef convenience function. - */ - template - struct FunctorRef<_Functor, res_type> - : public functor_detail::FunctorRef0<_Functor, res_type> - { - FunctorRef( _Functor & f_r ) - : functor_detail::FunctorRef0<_Functor, res_type>( f_r ) - {} - }; - - /** Convenience function creating a binary \ref FunctorRef. */ - template - FunctorRef<_Functor, res_type, arg1_type, arg2_type> - functorRef( _Functor & f_r ) - { return FunctorRef<_Functor, res_type, arg1_type, arg2_type>( f_r ); } - template - FunctorRef<_Functor, res_type, arg1_type> - functorRef( _Functor & f_r ) - { return FunctorRef<_Functor, res_type, arg1_type>( f_r ); } - template - FunctorRef<_Functor, res_type> - functorRef( _Functor & f_r ) - { return FunctorRef<_Functor, res_type>( f_r ); } - - ///////////////////////////////////////////////////////////////// - - /** \defgroup LOGICALFILTERS Functors for building compex queries. - * \ingroup g_Functor - * - * Some logical functors to build more complex queries: - * - * \li \ref True and \ref False. No supprise, they always return - * \c true or \c false. - * \li \ref Not\<_Condition\>. _Condition is a functor, and - * it's result is inverted. - * \li \ref Chain\<_ACondition,_BCondition\>. \c _ACondition and \c _BCondition - * are functors, and Chain evaluates _ACondition && _BCondition. - * - * As it's no fun to get and write the correct template arguments, - * convenience functions creating the correct functor are provided. - * - * \li \c true_c and \c false_c. (provided just to match the schema) - * \li \c not_c. Takes a functor as argument and returns the appropriate - * \ref Not functor. - * \li \c chain. Takes two functors and returns the appropriate - * \ref Cain functor. - * - * \code - * struct Print; // functor printing elements - * struct Count; // functor counting number of elements - * - * std::for_each( c.begin(), c.end(), - * chain( Print(), Count() ) ); - * \endcode - */ - //@{ - - /* functor that always returns a copied - value */ - template - struct Constant - { - Constant( const T &value ) - : _value(value) - {} - - template - T operator()( _Tp ) const - { return _value; } - - T operator()() const - { return _value; } - - T _value; - }; - - template - inline Constant constant( const T &value ) - { return Constant(value); } - - /** Logical functor always \c true. - */ - struct True - { - template - bool operator()( _Tp ) const - { - return true; - } - }; - - /** Convenience function for creating a True. */ - inline True true_c() - { return True(); } - - /** Logical functor always \c false. - */ - struct False - { - template - bool operator()( _Tp ) const - { - return false; - } - }; - - /** Convenience function for creating a False. */ - inline False false_c() - { return False(); } - - /** Logical functor inverting \a _Condition. - */ - template - struct Not - { - Not( _Condition cond_r ) - : _cond( cond_r ) - {} - - template - bool operator()( _Tp t ) const - { - return ! _cond( t ); - } - - _Condition _cond; - }; - - /** Convenience function for creating a Not from \a _Condition. */ - template - inline Not<_Condition> not_c( _Condition cond_r ) - { - return Not<_Condition>( cond_r ); - } - - /** Logical functor chaining \a _ACondition \c OR \a _BCondition. - */ - template - struct Or - { - Or( _ACondition conda_r, _BCondition condb_r ) - : _conda( conda_r ) - , _condb( condb_r ) - {} - - template - bool operator()( _Tp t ) const - { - return _conda( t ) || _condb( t ); - } - - _ACondition _conda; - _BCondition _condb; - }; - - /** Convenience function for creating a Or from two conditions - * \a conda_r OR \a condb_r. - */ - template - inline Or<_ACondition, _BCondition> or_c( _ACondition conda_r, _BCondition condb_r ) - { - return Or<_ACondition, _BCondition>( conda_r, condb_r ); - } - - /** Logical functor chaining \a _ACondition \c AND \a _BCondition. - */ - template - struct Chain - { - Chain( _ACondition conda_r, _BCondition condb_r ) - : _conda( conda_r ) - , _condb( condb_r ) - {} - - template - bool operator()( _Tp t ) const - { - return _conda( t ) && _condb( t ); - } - - _ACondition _conda; - _BCondition _condb; - }; - - /** Convenience function for creating a Chain from two conditions - * \a conda_r and \a condb_r. - */ - template - inline Chain<_ACondition, _BCondition> chain( _ACondition conda_r, _BCondition condb_r ) - { - return Chain<_ACondition, _BCondition>( conda_r, condb_r ); - } - - //@} - /////////////////////////////////////////////////////////////////// - - /** \defgroup ACTIONFUNCTOR - * \ingroup g_Functor - */ - //@{ - - /** Strore the 1st result found in the variable passed to the ctor. - * \code - * PoolItem result; - * invokeOnEach( pool.byIdentBegin(installed), pool.byIdentEnd(installed), - * filter::SameItem( installed ), - * getFirst( result ) ); - * \endcode - */ - template - struct GetFirst - { - GetFirst( _Tp & result_r ) - : _result( &result_r ) - {} - bool operator()( const _Tp & val_r ) - { *_result = val_r; return false; } - - private: - _Tp * _result; - }; - - /** Convenience function for creating \ref GetFirst. */ - template - GetFirst<_Tp> getFirst( _Tp & result_r ) - { return GetFirst<_Tp>( result_r ); } - - - /** Strore the last result found in the variable passed to the ctor. - */ - template - struct GetLast - { - GetLast( _Tp & result_r ) - : _result( &result_r ) - {} - bool operator()( const _Tp & val_r ) - { *_result = val_r; return true; } - - private: - _Tp * _result; - }; - - /** Convenience function for creating \ref GetLast. */ - template - GetLast<_Tp> getLast( _Tp & result_r ) - { return GetLast<_Tp>( result_r ); } - - - /** Store all results found to some output_iterator. - * \code - * std::vector result; - * parser::ProductFileReader::scanDir( functor::getAll( std::back_inserter( result ) ), - sysRoot / "etc/products.d" ); - * \endcode - */ - template - struct GetAll - { - GetAll( _OutputIterator result_r ) - : _result( result_r ) - {} - - template - bool operator()( const _Tp & val_r ) const - { *(_result++) = val_r; return true; } - - private: - mutable _OutputIterator _result; - }; - - /** Convenience function for creating \ref GetAll. */ - template - GetAll<_OutputIterator> getAll( _OutputIterator result_r ) - { return GetAll<_OutputIterator>( result_r ); } - - //@} - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace functor - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_FUNCTIONAL_H diff --git a/libzypp/zypp/base/Gettext.cc b/libzypp/zypp/base/Gettext.cc deleted file mode 100644 index f90ec91..0000000 --- a/libzypp/zypp/base/Gettext.cc +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Gettext.cc - * -*/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -extern "C" { -#include -} - -#include "zypp/base/Gettext.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace gettext - { ///////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - // TEXTDOMAIN and LOCALEDIR must be provided via config.h - // or at compile time using -D. - ///////////////////////////////////////////////////////////////// - - inline void assertInit() - { - static bool initialized = false; - if ( ! initialized ) - { - ::bindtextdomain( TEXTDOMAIN, LOCALEDIR ); - ::bind_textdomain_codeset( TEXTDOMAIN, "UTF-8" ); - initialized = true; - } - } - - const char * dgettext( const char * msgid ) - { - assertInit(); - return ::dgettext( TEXTDOMAIN, msgid ); - } - - const char * dngettext( const char * msgid1, const char * msgid2, - unsigned long n ) - { - assertInit(); - return ::dngettext( TEXTDOMAIN, msgid1, msgid2, n ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace gettext - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Gettext.h b/libzypp/zypp/base/Gettext.h deleted file mode 100644 index fb9fe8a..0000000 --- a/libzypp/zypp/base/Gettext.h +++ /dev/null @@ -1,46 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Gettext.h - * - * Interface to gettext. - * -*/ -#ifndef ZYPP_BASE_GETTEXT_H -#define ZYPP_BASE_GETTEXT_H - -/** Just tag text for translation. */ -#define N_(MSG) MSG - -/** Return translated text. */ -#define _(MSG) ::zypp::gettext::dgettext( MSG ) - -/** Return translated text (plural form). */ -#define _PL(MSG1,MSG2,N) ::zypp::gettext::dngettext( MSG1, MSG2, N ) - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace gettext - { ///////////////////////////////////////////////////////////////// - - /** Return translated text. */ - const char * dgettext( const char * msgid ); - - /** Return translated text (plural form). */ - const char * dngettext( const char * msgid1, const char * msgid2, - unsigned long n ); - - ///////////////////////////////////////////////////////////////// - } // namespace gettext - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_GETTEXT_H diff --git a/libzypp/zypp/base/GzStream.cc b/libzypp/zypp/base/GzStream.cc deleted file mode 100644 index 2d9edfc..0000000 --- a/libzypp/zypp/base/GzStream.cc +++ /dev/null @@ -1,365 +0,0 @@ -/*---------------------------------------------------------------------\ -| | -| __ __ ____ _____ ____ | -| \ \ / /_ _/ ___|_ _|___ \ | -| \ V / _` \___ \ | | __) | | -| | | (_| |___) || | / __/ | -| |_|\__,_|____/ |_| |_____| | -| | -| core system | -| (C) SuSE Linux Products GmbH | -\----------------------------------------------------------------------/ - - File: GzStream.cc - - Author: Michael Andres - Maintainer: Michael Andres - - Purpose: Streams reading and writing gzip files. - -/-*/ - -#include -#include -#include "zypp/base/LogControl.h" -#include "zypp/base/LogTools.h" -using std::endl; - -#include "zypp/base/GzStream.h" - -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace gzstream_detail - { ///////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZlibError - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZlibError::strerror - // METHOD TYPE : std::string - // - std::string - ZlibError::strerror() const - { - std::string ret = ( _zError ? ::zError( _zError ) : "OK" ); - if ( _zError == Z_ERRNO ) - ret += std::string("(") + ::strerror( _errno ) + ")"; - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : fgzstreambuf - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::open - // METHOD TYPE : fgzstreambuf * - // - fgzstreambuf * - fgzstreambuf::open( const char * name_r, std::ios_base::openmode mode_r ) - { - fgzstreambuf * ret = NULL; - if ( ! isOpen() ) - { - // we expect gzdopen to handle errors of ::open - if ( mode_r == std::ios_base::in ) - { - _fd = ::open( name_r, O_RDONLY | O_CLOEXEC ); - _file = gzdopen( _fd, "rb" ); - } - else if ( mode_r == std::ios_base::out ) - { - _fd = ::open( name_r, O_WRONLY|O_CREAT|O_CLOEXEC, 0666 ); - _file = gzdopen( _fd, "wb" ); - } - // else: not supported - - if ( isOpen() ) - { - // Store mode and initialize the internal buffer. - _mode = mode_r; - if ( inReadMode() ) - { - setp( NULL, NULL ); - setg( &(_buffer[0]), &(_buffer[0]), &(_buffer[0]) ); - } - else - { - setp( &(_buffer[0]), &(_buffer[_buffer.size()-1]) ); - setg( NULL, NULL, NULL ); - } - ret = this; - } - else - setZError(); - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::close - // METHOD TYPE : fgzstreambuf * - // - fgzstreambuf * - fgzstreambuf::close() - { - fgzstreambuf * ret = NULL; - if ( isOpen() ) - { - bool failed = false; - if ( sync() != 0 ) - failed = true; - // it also closes _fd, fine - int r = gzclose( _file ); - if ( r != Z_OK ) - { - failed = true; - // DONT call setZError() here, as _file is no longer valid - _error._zError = r; - _error._errno = errno; - } - - // Reset everything - _fd = -1; - _file = NULL; - _mode = std::ios_base::openmode(0); - setp( NULL, NULL ); - setg( NULL, NULL, NULL ); - if ( ! failed ) - ret = this; - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::sync - // METHOD TYPE : int - // - int - fgzstreambuf::sync() - { - int ret = 0; - if ( pbase() < pptr() ) { - const int_type res = overflow(); - if ( traits_type::eq_int_type( res, traits_type::eof() ) ) - ret = -1; - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::overflow - // METHOD TYPE : fgzstreambuf::int_type - // - fgzstreambuf::int_type - fgzstreambuf::overflow( int_type c ) - { - int_type ret = traits_type::eof(); - if ( inWriteMode() ) - { - if ( ! traits_type::eq_int_type( c, traits_type::eof() ) ) - { - *pptr() = traits_type::to_char_type( c ); - pbump(1); - } - if ( pbase() <= pptr() ) - { - if ( zWriteFrom( pbase(), pptr() - pbase() ) ) - { - setp( &(_buffer[0]), &(_buffer[_buffer.size()-1]) ); - ret = traits_type::not_eof( c ); - } - // else: error writing the file - } - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::underflow - // METHOD TYPE : fgzstreambuf::int_type - // - fgzstreambuf::int_type - fgzstreambuf::underflow() - { - int_type ret = traits_type::eof(); - if ( inReadMode() ) - { - if ( gptr() < egptr() ) - return traits_type::to_int_type( *gptr() ); - - const std::streamsize got = zReadTo( &(_buffer[0]), _buffer.size() ); - if ( got > 0 ) - { - setg( &(_buffer[0]), &(_buffer[0]), &(_buffer[got]) ); - ret = traits_type::to_int_type( *gptr() ); - } - else if ( got == 0 ) - { - // EOF - setg( &(_buffer[0]), &(_buffer[0]), &(_buffer[0]) ); - } - // else: error reading the file - } - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::zReadTo - // METHOD TYPE : std::streamsize - // - std::streamsize - fgzstreambuf::zReadTo( char * buffer_r, std::streamsize maxcount_r ) - { - int read = gzread( _file, buffer_r, maxcount_r ); - if ( read < 0 ) - setZError(); - return read; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::zWriteFrom - // METHOD TYPE : bool - // - bool - fgzstreambuf::zWriteFrom( const char * buffer_r, std::streamsize count_r ) - { - int written = 0; - if ( count_r ) - { - if ( (written = gzwrite( _file, buffer_r, count_r )) == 0 ) - setZError(); - } - return( written == count_r ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::zSeekTo - // METHOD TYPE : fgzstreambuf::pos_type - // - fgzstreambuf::pos_type - fgzstreambuf::zSeekTo( off_type off_r, std::ios_base::seekdir way_r ) - { - z_off_t ret = gzseek( _file, off_r, way_r ); - if ( ret == -1 ) - setZError(); - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::zTell - // METHOD TYPE : fgzstreambuf::pos_type - // - fgzstreambuf::pos_type - fgzstreambuf::zTell() - { - z_off_t ret = gztell( _file ); - if ( ret == -1 ) - setZError(); - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : fgzstreambuf::seekTo - // METHOD TYPE : fgzstreambuf::pos_type - // - fgzstreambuf::pos_type - fgzstreambuf::seekTo( off_type off_r, std::ios_base::seekdir way_r ) - { - pos_type ret = pos_type(off_type(-1)); - if ( isOpen() ) - { - if ( inWriteMode() ) - { - if ( sync() == 0 ) - ret = zSeekTo( off_r, way_r ); - } - else - { - off_type zegptr = zTell(); - if ( zegptr != off_type(-1) ) - { - if ( way_r == std::ios_base::end ) - { - // Invalidate buffer and seek. - // XXX improve by transformation into ios_base::beg - // to see whether we stay inside the buffer. - setg( &(_buffer[0]), &(_buffer[0]), &(_buffer[0]) ); - ret = zSeekTo( off_r, way_r ); - } - else - { - // Transform into ios_base::beg and seek. - off_type zeback = zegptr - ( egptr() - eback() ); - off_type zgptr = zegptr - ( egptr() - gptr() ); - off_type zngptr = off_r; - if ( way_r == std::ios_base::cur ) - { - zngptr += zgptr; - way_r = std::ios_base::beg; - } - - if ( way_r == std::ios_base::beg ) - { - if ( zeback <= zngptr && zngptr <= zegptr ) - { - // Still inside buffer, adjust gptr and - // calculate new position. - setg( eback(), - eback() + (zngptr-zeback), - egptr() ); - ret = pos_type(zngptr); - } - else - { - // Invalidate buffer and seek. - setg( &(_buffer[0]), &(_buffer[0]), &(_buffer[0]) ); - ret = zSeekTo( off_r, way_r ); - } - } - } - } - } - } - return ret; - } - - fgzstreambuf::pos_type - fgzstreambuf::compressed_tell() const - { - off_t pos = lseek (_fd, 0, SEEK_CUR); - // hopefully the conversion is ok - return pos; - } - - ///////////////////////////////////////////////////////////////// - } // namespace gzstream_detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/base/GzStream.h b/libzypp/zypp/base/GzStream.h deleted file mode 100644 index eaadd83..0000000 --- a/libzypp/zypp/base/GzStream.h +++ /dev/null @@ -1,286 +0,0 @@ -/*---------------------------------------------------------------------\ -| | -| __ __ ____ _____ ____ | -| \ \ / /_ _/ ___|_ _|___ \ | -| \ V / _` \___ \ | | __) | | -| | | (_| |___) || | / __/ | -| |_|\__,_|____/ |_| |_____| | -| | -| core system | -| (C) SuSE Linux Products GmbH | -\----------------------------------------------------------------------/ - - File: GzStream.h - - Author: Michael Andres - Maintainer: Michael Andres - - Purpose: Streams reading and writing gzip files. - -/-*/ -#ifndef ZYPP_BASE_GZSTREAM_H -#define ZYPP_BASE_GZSTREAM_H - -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace gzstream_detail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZlibError - /** - * @short Helper class to ship zlib errors. - **/ - struct ZlibError - { - /** - * The zlib error code - **/ - int _zError; - - /** - * errno, valid if zError is Z_ERRNO - **/ - int _errno; - - ZlibError() - : _zError( 0 ), _errno( 0 ) - {} - - /** - * Return string describing the zlib error code - **/ - std::string - strerror() const; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ZlibError Stream output. */ - inline std::ostream & operator<<( std::ostream & str, const ZlibError & obj ) - { return str << obj.strerror(); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : fgzstreambuf - /** - * @short Streambuffer reading or writing gzip files. - * - * Read and write mode are mutual exclusive. Seek is supported, - * but zlib restrictions appy (only forward seek in write mode; - * backward seek in read mode might be expensive).Putback is not - * supported. - * - * Reading plain (no gziped) files is possible as well. - * - * This streambuf is used in @ref ifgzstream and @ref ofgzstream. - **/ - class fgzstreambuf : public std::streambuf { - - public: - - fgzstreambuf( unsigned bufferSize_r = 512 ) - : _fd( -1 ) - ,_file( NULL ) - , _mode( std::ios_base::openmode(0) ) - , _buffer( (bufferSize_r?bufferSize_r:1), 0 ) - {} - - virtual - ~fgzstreambuf() - { close(); } - - bool - isOpen() const - { return _file; } - - bool - inReadMode() const - { return( _mode == std::ios_base::in ); } - - bool - inWriteMode() const - { return( _mode == std::ios_base::out ); } - - fgzstreambuf * - open( const char * name_r, std::ios_base::openmode mode_r = std::ios_base::in ); - - fgzstreambuf * - close(); - - //! Tell the file position in the compressed file. - //! Analogous to tell(2), complementary to gztell. - pos_type compressed_tell() const; - - /** - * The last error returned fron zlib. - **/ - ZlibError - zError() const - { return _error; } - - protected: - - virtual int - sync(); - - virtual int_type - overflow( int_type c = traits_type::eof() ); - - virtual int_type - underflow(); - - virtual pos_type - seekoff( off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode /* ignored */ ) - { return seekTo( off_r, way_r ); } - - virtual pos_type - seekpos( pos_type pos_r, std::ios_base::openmode /* ignored */ ) - { return seekTo( off_type(pos_r), std::ios_base::beg ); } - - private: - - typedef std::vector buffer_type; - - //! file descriptor of the compressed file - int _fd; - - gzFile _file; - - std::ios_base::openmode _mode; - - buffer_type _buffer; - - ZlibError _error; - - private: - - void - setZError() - { gzerror( _file, &_error._zError ); } - - std::streamsize - zReadTo( char * buffer_r, std::streamsize maxcount_r ); - - bool - zWriteFrom( const char * buffer_r, std::streamsize count_r ); - - pos_type - zSeekTo( off_type off_r, std::ios_base::seekdir way_r ); - - pos_type - zTell(); - - pos_type - seekTo( off_type off_r, std::ios_base::seekdir way_r ); - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : fXstream - /** - * @short Common template to define ifgzstream/ofgzstream - * reading/writing gzip files. - * - * Don't use fXstream directly, but @ref ifgzstream or - * @ref ofgzstream. fXstream is just to avoid almost - * duplicate code. - **/ - template - class fXstream : public _BStream - { - public: - - typedef gzstream_detail::ZlibError ZlibError; - typedef _BStream stream_type; - typedef _StreamBuf streambuf_type; - - fXstream() - : stream_type( NULL ) - { this->init( &_streambuf ); } - - explicit - fXstream( const char * file_r ) - : stream_type( NULL ) - { this->init( &_streambuf ); this->open( file_r ); } - - virtual - ~fXstream() - {} - - bool - is_open() const - { return _streambuf.isOpen(); } - - void - open( const char * file_r ) - { - if ( !_streambuf.open( file_r, defMode(*this) ) ) - this->setstate(std::ios_base::failbit); - else - this->clear(); - } - - void - close() - { - if ( !_streambuf.close() ) - this->setstate(std::ios_base::failbit); - } - - /** - * The last error returned retuned fron zlib. - **/ - ZlibError - zError() const - { return _streambuf.zError(); } - - //! Similar to ios::rdbuf. - //! But it returns our specific type, not the generic streambuf *. - const streambuf_type& - getbuf() const - { return _streambuf; } - - private: - - streambuf_type _streambuf; - - std::ios_base::openmode - defMode( const std::istream & str_r ) - { return std::ios_base::in; } - - std::ios_base::openmode - defMode( const std::ostream & str_r ) - { return std::ios_base::out; } - - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace gzstream_detail - /////////////////////////////////////////////////////////////////// - - /** - * istream reading gzip files as well as plain files. - **/ - typedef gzstream_detail::fXstream ifgzstream; - - /** - * ostream writing gzip files. - **/ - typedef gzstream_detail::fXstream ofgzstream; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif // ZYPP_BASE_GZSTREAM_H diff --git a/libzypp/zypp/base/IOStream.cc b/libzypp/zypp/base/IOStream.cc deleted file mode 100644 index cd22598..0000000 --- a/libzypp/zypp/base/IOStream.cc +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/IOStream.cc - * -*/ -#include -#include -#include -//#include "zypp/base/Logger.h" - -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -using std::endl; -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace iostr - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : getline - ** FUNCTION TYPE : std::string - */ - std::string getline( std::istream & str ) - { - static const unsigned tmpBuffLen = 1024; - static char tmpBuff[tmpBuffLen]; - std::string ret; - do { - str.clear(); - str.getline( tmpBuff, tmpBuffLen ); // always writes '\0' terminated - ret += tmpBuff; - } while( str.rdstate() == std::ios::failbit ); - - return ret; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : EachLine - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : EachLine::EachLine - // METHOD TYPE : Ctor - // - EachLine::EachLine( std::istream & str_r, unsigned lineNo_r ) - : _str( str_r ) - , _lineStart( -1 ) - , _lineNo( lineNo_r ) - , _valid( true ) - { - next(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : EachLine::next - // METHOD TYPE : bool - // - bool EachLine::next() - { - if ( ! _valid ) - { - return false; - } - - if ( ! _str ) // usg: saw EOF in previous read - { - _line.clear(); - return(_valid = false); - } - - _lineStart = _str.tellg(); - _line = iostr::getline( _str ); - ++_lineNo; - if ( _str.fail() || _str.bad() ) - { - _line.clear(); - return(_valid = false); - } - return(_valid = true); - } - - /////////////////////////////////////////////////////////////////// - // forEachLine - /////////////////////////////////////////////////////////////////// - - int forEachLine( std::istream & str_r, function consume_r ) - { - int lineno = 0; - while ( str_r ) - { - std::string line( getline( str_r ) ); - if ( ! (str_r.fail() || str_r.bad()) ) - { - // line contains valid data to be consumed. - ++lineno; - if ( consume_r && ! consume_r( lineno, line ) ) - { - lineno = -lineno; - break; - } - } - } - return lineno; - } - - // MPL checks to assert equal values for PF_?TRIM and str::?TRIM - BOOST_MPL_ASSERT_RELATION( int(PF_LTRIM), ==, int(str::L_TRIM) ); - BOOST_MPL_ASSERT_RELATION( int(PF_RTRIM), ==, int(str::R_TRIM) ); - - int simpleParseFile( std::istream & str_r, ParseFlags flags_r, function consume_r ) - { - return forEachLine( str_r, - [&]( int num_r, std::string line_r )->bool - { - if ( ! consume_r ) - return true; - - if ( flags_r ) - { - if ( flags_r & PF_TRIM ) - line_r = str::trim( line_r, str::Trim( unsigned(flags_r & PF_TRIM) ) ); - - if ( flags_r & ~PF_TRIM ) - { - const char* firstNW = line_r.c_str(); - while ( *firstNW == ' ' || *firstNW == '\t' ) - ++firstNW; - switch ( *firstNW ) - { - case '\0': if ( flags_r & PF_SKIP_EMPTY ) return true; break; - case '#': if ( flags_r & PF_SKIP_SHARP_COMMENT ) return true; break; - } - } - } - return consume_r( num_r, line_r ); - } ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace iostr - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/IOStream.h b/libzypp/zypp/base/IOStream.h deleted file mode 100644 index f19f6d6..0000000 --- a/libzypp/zypp/base/IOStream.h +++ /dev/null @@ -1,212 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/IOStream.h - * -*/ -#ifndef ZYPP_BASE_IOSTREAM_H -#define ZYPP_BASE_IOSTREAM_H - -#include -#include - -#include "zypp/base/Flags.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/base/NonCopyable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - /** Iostream related utilities. - */ - namespace iostr - { ///////////////////////////////////////////////////////////////// - - /** Save and restore streams \c width, \c precision - * and \c fmtflags. - */ - typedef boost::io::ios_base_all_saver IosFmtFlagsSaver; - - - /** Read one line from stream. - * - * Reads everything up to the next newline or EOF. newline - * is read but not returned. - * - * \see \ref forEachLine - */ - std::string getline( std::istream & str ); - - /** Copy istream to ostream. - * \return reference to the ostream. - */ - inline std::ostream & copy( std::istream & from_r, std::ostream & to_r ) - { - if ( from_r && to_r ) - { - char ch; - while ( from_r && from_r.get( ch ) ) - to_r.put( ch ); - } - return to_r; - } - - /** Copy istream to ostream, prefixing each line with \a indent_r (default "> " ). - * \return reference to the ostream. - */ - inline std::ostream & copyIndent( std::istream & from_r, std::ostream & to_r, const std::string & indent_r = "> " ) - { - if ( from_r && to_r ) - { - char ch; - bool indent = true; - while ( from_r && from_r.get( ch ) ) - { - if ( indent ) - to_r << indent_r; - indent = ( ch == '\n' ); - to_r.put( ch ); - } - } - return to_r; - } - - /** Copy istream to ostream, prefixing each line with \a indent_r (default "> " ). - * \return reference to the ostream. - */ - inline void tee( std::istream & from_r, std::ostream & to1_r, std::ostream & to2_r ) - { - if ( from_r && ( to1_r ||to2_r ) ) - { - char ch; - while ( from_r && from_r.get( ch ) ) - { - to1_r.put( ch ); - to2_r.put( ch ); - } - } - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : EachLine - // - /** Simple lineparser: Traverse each line in a file. - * - * \code - * std::ifstream infile( "somefile" ); - * for( iostr::EachLine in( infile ); in; in.next() ) - * { - * DBG << *in << endl; - * } - * \endcode - */ - class EachLine : private base::NonCopyable - { - public: - /** Ctor taking a stream and reading the 1st line from it. */ - EachLine( std::istream & str_r, unsigned lineNo_r = 0 ); - - /** Whether \c this contains a valid line to consume. */ - bool valid() const - { return _valid; } - - /** Evaluate class in a boolean context. */ - explicit operator bool() const - { return _valid; } - - /** Return the current line number. */ - unsigned lineNo() const - { return _lineNo; } - - std::streamoff lineStart() const - { return _lineStart; }; - - /** Set current line number. */ - void setLineNo( unsigned lineNo_r ) - { _lineNo = lineNo_r; } - - /** Access the current line. */ - const std::string & operator*() const - { return _line; } - /** \overload non const access */ - std::string & operator*() - { return _line; } - - /** Access the current line. */ - const std::string * operator->() const - { return &_line; } - - /** Advance to next line. */ - bool next(); - - /** Advance \a num_r lines. */ - bool next( unsigned num_r ) - { - while ( num_r-- && next() ) - ; /* EMPTY */ - return valid(); - } - - private: - std::istream & _str; - std::string _line; - std::streamoff _lineStart; - unsigned _lineNo; - bool _valid; - }; - /////////////////////////////////////////////////////////////////// - - /** Simple lineparser: Call functor \a consume_r for each line. - * - * \param str_r istream to read from. - * \param consume_r callback function taking linenumber and content - * - * The loop is aborted if the callback returns \c false. - * - * \code - * iostr::forEachLine( InputStream( "/my/file/to/read.txt" ), - * []( int num_r, std::string line_r )->bool - * { - * MIL << " [" num_r << "]'" << line_r << "'" << endl; - * return true; - * } ); - * \endcode - * - * \return Number if lines consumed (negative if aborted by callback). - */ - int forEachLine( std::istream & str_r, function consume_r ); - - /** \ref simpleParseFile modifications before consuming a line. */ - enum ParseFlag - { - PF_LTRIM = 1 << 0, //< left trim whitespace - PF_RTRIM = 1 << 1, //< right trim whitespace - PF_TRIM = PF_LTRIM | PF_RTRIM, //< trim whitespace - PF_SKIP_EMPTY = 1 << 2, //< skip lines containing whitespace only - PF_SKIP_SHARP_COMMENT = 1 << 3 //< skip lines beginning with '#' - }; - ZYPP_DECLARE_FLAGS( ParseFlags, ParseFlag ); - ZYPP_DECLARE_OPERATORS_FOR_FLAGS( ParseFlags ); - - /** Simple lineparser optionally trimming and skipping comments. */ - int simpleParseFile( std::istream & str_r, ParseFlags flags_r, function consume_r ); - - /** \overload trimming lines, skipping '#'-comments and empty lines. */ - inline int simpleParseFile( std::istream & str_r, function consume_r ) - { return simpleParseFile( str_r, PF_TRIM | PF_SKIP_EMPTY | PF_SKIP_SHARP_COMMENT , consume_r ); } - - ///////////////////////////////////////////////////////////////// - } // namespace iostr - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_IOSTREAM_H diff --git a/libzypp/zypp/base/InputStream.cc b/libzypp/zypp/base/InputStream.cc deleted file mode 100644 index 81c138b..0000000 --- a/libzypp/zypp/base/InputStream.cc +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/InputStream.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/base/InputStream.h" -#include "zypp/base/GzStream.h" - -#include "zypp/PathInfo.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - inline std::streamoff _heplerInitSize( const Pathname & file_r ) - { - PathInfo p( file_r ); - if ( p.isFile() && filesystem::zipType( file_r ) == filesystem::ZT_NONE ) - return p.size(); - return -1; - } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream() - : _stream( &std::cin, NullDeleter() ) - , _name( "STDIN" ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( std::istream & stream_r, - const std::string & name_r ) - : _stream( &stream_r, NullDeleter() ) - , _name( name_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const Pathname & file_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( _path.asString() ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const Pathname & file_r, - const std::string & name_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( name_r ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const std::string & file_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( _path.asString() ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const std::string & file_r, - const std::string & name_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( name_r ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const char * file_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( _path.asString() ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::InputStream - // METHOD TYPE : Constructor - // - InputStream::InputStream( const char * file_r, - const std::string & name_r ) - : _path( file_r ) - , _stream( new ifgzstream( _path.asString().c_str() ) ) - , _name( name_r ) - , _size( _heplerInitSize( _path ) ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : InputStream::~InputStream - // METHOD TYPE : Destructor - // - InputStream::~InputStream() - {} - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const InputStream & obj ) - { - return str << obj.name() << obj.stream(); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/InputStream.h b/libzypp/zypp/base/InputStream.h deleted file mode 100644 index cbf12d4..0000000 --- a/libzypp/zypp/base/InputStream.h +++ /dev/null @@ -1,144 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/InputStream.h - * -*/ -#ifndef ZYPP_BASE_INPUTSTREAM_H -#define ZYPP_BASE_INPUTSTREAM_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : InputStream - // - /** Helper to create and pass std::istream. - * The provided std::istream may either be std::cin, - * sone (gziped) file or an aleady existig \c std::istream. - * - * An optional \c name arument may be passed to the ctor, - * to identify the stream in log messages, even if it is - * not a file. - * - * Per default the name is "STDIN", the path to an input file - * or empty. - * - * \code - * void parse( const InputStream & input = InputStream() ) - * { - * // process input.stream() and refer to input.name() - * // in log messages. - * } - * - * parse(); // std::cin - * parse( "/some/file" ); // file - * parse( "/some/file.gz" ); // gziped file - * std::istream & mystream; - * parse( mystream ); // some existing stream - * parse( InputStream( mystream, - * "my stream's name" ) ); - * \endcode - */ - class InputStream - { - public: - /** Default ctor providing \c std::cin. */ - InputStream(); - - /** Ctor providing an aleady existig \c std::istream. */ - InputStream( std::istream & stream_r, - const std::string & name_r = std::string() ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const Pathname & file_r ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const Pathname & file_r, - const std::string & name_r ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const std::string & file_r ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const std::string & file_r, - const std::string & name_r ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const char * file_r ); - - /** Ctor for reading a (gziped) file. */ - InputStream( const char * file_r, - const std::string & name_r ); - - /** Dtor. */ - ~InputStream(); - - /** The std::istream. - * \note The provided std::istream is never \c const. - */ - std::istream & stream() const - { return *_stream; } - - /** Allow implicit conversion to std::istream.*/ - operator std::istream &() const - { return *_stream; } - - /** Name of the std::istream. - * Per default this is "STDIN", the path to an input file or - * empty. A custom string may be provided to the ctor. - * - * This may be used in log messages to identify the stream even - * even if it is not a file. - */ - const std::string & name() const - { return _name; } - - /** Path to the input file or empty if no file. */ - const Pathname & path() const - { return _path; } - - /** Size of the input stream (informal). - * If constructed from an uncompressed file, the file size. - * Otherwise \c -1. See \ref setSize; - */ - std::streamoff size() const - { return _size; } - - /** Set the size of the input stream. - * You may set it to whatever vaule is appropriate. E.g. - * *=10 to compensate gzip comression. or the - * number of items, lines, ... The value is not used here, - * just provided. - */ - void setSize( std::streamoff val_r ) - { _size = val_r; } - - private: - Pathname _path; - shared_ptr _stream; - std::string _name; - DefaultIntegral _size; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates InputStream Stream output */ - std::ostream & operator<<( std::ostream & str, const InputStream & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_INPUTSTREAM_H diff --git a/libzypp/zypp/base/InterProcessMutex.cc b/libzypp/zypp/base/InterProcessMutex.cc deleted file mode 100644 index a9c9e69..0000000 --- a/libzypp/zypp/base/InterProcessMutex.cc +++ /dev/null @@ -1,348 +0,0 @@ - -extern "C" -{ -#include -} -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InterProcessMutex.h" -#include "zypp/base/String.h" - -#include "zypp/TmpPath.h" -#include "zypp/Pathname.h" -#include "zypp/PathInfo.h" - -#define LMIL MIL << "LOCK [" << _options.name << "] " - -using namespace std; - -namespace zypp -{ -namespace base -{ - -ZYppLockedException::ZYppLockedException( const std::string & msg_r, - const std::string &name, - pid_t locker_pid ) - : Exception(msg_r) - , _locker_pid (locker_pid) - , _name(name) -{} - -ZYppLockedException::~ZYppLockedException() throw() -{} - - -InterProcessMutex::Options::Options( ConsumerType ptype, - const std::string &pname, - int ptimeout ) - : name(pname) - , timeout(ptimeout) - , type(ptype) -{ - if ( geteuid() == 0 ) - base = "/var/run"; - else - base = filesystem::TmpPath::defaultLocation() + ( string("zypp-") + getenv("USER") ); -} - - - -InterProcessMutex::InterProcessMutex( const Options &poptions ) - : _options(poptions) -{ - // get the current pid - pid_t curr_pid = getpid(); - Pathname lock_file = lockFilePath(); - int totalslept = 0; - int k = 0; - - while (1) - { - k++; - - // try to create the lock file atomically, this will fail if - // the lock exists - try { - _fd.reset( new Fd( lock_file, O_RDWR | O_CREAT | O_EXCL, 0666) ); - } catch (...) { - _fd.reset(); - } - if ( !_fd || !_fd->isOpen() ) - { - struct flock lock; - - // the file exists, lets see if someone has it locked exclusively - _fd.reset( new Fd( lock_file, O_RDWR ) ); - if ( !_fd->isOpen() ) - { - ZYPP_THROW(Exception(str::form(_("Can't open lock file: %s"), strerror(errno)))); - } - - memset(&lock, 0, sizeof(struct flock)); - lock.l_whence = SEEK_SET; - - // GETLK tells you the conflicting lock as if the lock you pass - // would have been set. So set the lock type depending on whether - // we are a writer or a reader. - lock.l_type = ( ( _options.type == Writer ) ? F_WRLCK : F_RDLCK ); - - - // get lock information - if (fcntl(_fd->fd(), F_GETLK, &lock) < 0) - { - ZYPP_THROW(Exception(string("Error getting lock info: ") + strerror(errno))); - } - - - MIL << lock_file << " : "; - switch ( lock.l_type ) - { - case F_WRLCK: - MIL << " Write-Lock conflicts" << endl; - break; - case F_RDLCK: - MIL << " Read-Lock conflicts" << endl; - break; - case F_UNLCK: - MIL << " No lock conflicts" << endl; - break; - default: - break; - - } - - // F_GETLK is confusing - // http://groups.google.com/group/comp.unix.solaris/tree/browse_frm/month/2005-09/123fae2c774bceed?rnum=61&_done=%2Fgroup%2Fcomp.unix.solaris%2Fbrowse_frm%2Fmonth%2F2005-09%3F - // new table of access - // F_WRLCK Reader Wait or abort - // F_WRLCK Writer Wait or abort - // F_RDLCK Writer Wait or abort - // F_RDLCK Reader Can't happen, anyway, wait or abort - // F_UNLCK Reader Take reader lock - // F_UNLCK Writer Take writer lock - - - - // wait or abort - if ( lock.l_type != F_UNLCK ) - { - // some lock conflicts with us. - LMIL << "pid " << lock.l_pid << " is running and has a lock that conflicts with us." << std::endl; - - // abort if we have slept more or equal than the timeout, but - // not for the case where timeout is negative which means no - // timeout and therefore we never abort. - if ( (totalslept >= _options.timeout) && (_options.timeout >= 0 ) ) - { - ZYPP_THROW(ZYppLockedException( - _("This action is being run by another program already."), - _options.name, lock.l_pid)); - } - - // if not, let sleep one second and count it - LMIL << "waiting 1 second..." << endl; - sleep(1); - ++totalslept; - continue; - } - else if ( ( lock.l_type == F_UNLCK ) && ( _options.type == Reader ) ) - { - // either there is no lock or a reader has it so we just - // acquire a reader lock. - - // try to get more lock info - lock.l_type = F_WRLCK; - - if (fcntl(_fd->fd(), F_GETLK, &lock) < 0) - { - ZYPP_THROW(Exception(string("Error getting lock info: ") + strerror(errno))); - } - - if ( lock.l_type == F_UNLCK ) - { - LMIL << "no previous readers, unlinking lock file and retrying." << endl; - - // actually there are no readers - // lets delete it and break, so the next loop will - // probably succeed in creating it. The worst thing that can - // happen is that another process will take it first, but - // we are not aiming at such level of correctness. Otherwise - // the code path will complicate too much. - memset(&lock, 0, sizeof(struct flock)); - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_pid = getpid(); - - if (fcntl(_fd->fd(), F_SETLK, &lock) < 0) - { - ZYPP_THROW (Exception( "Can't lock file to unlink it.")); - } - filesystem::unlink(lock_file.c_str()); - continue; - } - else if ( lock.l_type == F_RDLCK ) - { - // there is another reader. - LMIL << "previous readers on lock file. taking lock as a reader." << std::endl; - memset(&lock, 0, sizeof(struct flock)); - lock.l_type = F_RDLCK; - lock.l_whence = SEEK_SET; - lock.l_pid = getpid(); - - if (fcntl(_fd->fd(), F_SETLK, &lock) < 0) - { - ZYPP_THROW (Exception( "Can't lock file for reader")); - } - // and keep the lock open. - break; - } - else - { - // cant happen! - ERR << "impossible condition" << endl; - - break; - } - } - else if ( ( lock.l_type == F_UNLCK ) && ( _options.type == Writer ) ) - { - LMIL << "stale lock found" << endl; - // Nobody conflicts with a writer lock so nobody is actually - // locking. - // lets delete it and break, so the next loop will - // probably succeed in creating it. The worst thing that can - // happen is that another process will take it first, but - // we are not aiming at such level of correctness. Otherwise - // the code path will complicate too much. - memset(&lock, 0, sizeof(struct flock)); - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_pid = getpid(); - - if (fcntl(_fd->fd(), F_SETLK, &lock) < 0) - { - ZYPP_THROW (Exception( "Can't lock file to unlink it.")); - } - filesystem::unlink(lock_file.c_str()); - continue; - } - else - { - // undefined case, just get out of the loop - LMIL << "undefined case!" << endl; - - break; - } - - } - else - { - // exclusive file creation succeeded. So may be we are the - // first writer or first reader - - // try to lock it exclusively - // if it fails, someone won us, so we just go for another try - // or just abort - LMIL << "no lock found, taking ownership of it as a " << ( (_options.type == Reader ) ? "reader" : "writer" ) << endl; - struct flock lock; - memset(&lock, 0, sizeof(struct flock)); - lock.l_whence = SEEK_SET; - lock.l_type = F_WRLCK; - lock.l_pid = getpid(); - - if (fcntl(_fd->fd(), F_SETLK, &lock) < 0) - ZYPP_THROW (Exception( "Can't lock file to write pid.")); - - char buffer[100]; - sprintf( buffer, "%d\n", curr_pid); - write( _fd->fd(), buffer, strlen(buffer)); - - // by now the pid is written and the file locked. - // If we are a reader, just downgrade the lock to - // read shared lock. - if ( _options.type == Reader ) - { - lock.l_type = F_RDLCK; - - if (fcntl(_fd->fd(), F_SETLK, &lock) < 0) - ZYPP_THROW (Exception( "Can't set lock file to shared")); - } - - break; - } - } // end loop - - LMIL << "Lock intialized" << endl; - -} - -InterProcessMutex::~InterProcessMutex() -{ - try - { - Pathname lock_file = lockFilePath(); - LMIL << "dropping " - << ( (_options.type == Reader ) ? "reader" : "writer" ) - << " lock on " << lock_file << endl; - - switch ( _options.type ) - { - case Reader: - - break; - - case Writer: - // we are the only writer, so unlink the file - filesystem::unlink(lock_file.c_str()); - break; - - } - // and finally close the file and release the lock - // (happens automatically) - } - catch(...) {} // let no exception escape. -} - - -Pathname InterProcessMutex::lockFilePath() const -{ - filesystem::assert_dir(_options.base); - return _options.base + ("zypp-" + _options.name + ".lock"); -} - -bool InterProcessMutex::isProcessRunning(pid_t pid_r) -{ - // it is another program, not me, see if it is still running - Pathname procdir( Pathname("/proc") / str::numstring(pid_r) ); - - PathInfo status( procdir/"status" ); - XXX << "Checking " << status << endl; - bool still_running = status.isExist(); - - if ( still_running ) - { - Pathname p( procdir/"exe" ); - XXX << p << " -> " << filesystem::readlink( p ) << endl; - - p = procdir/"cmdline"; - XXX << p << ": "; - std::ifstream infile( p.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) - { - XXX << *in << endl; - } - } - - return still_running; -} - - -} -} - - diff --git a/libzypp/zypp/base/InterProcessMutex.h b/libzypp/zypp/base/InterProcessMutex.h deleted file mode 100644 index fa6eaaa..0000000 --- a/libzypp/zypp/base/InterProcessMutex.h +++ /dev/null @@ -1,129 +0,0 @@ - -#ifndef ZYPP_BASE_INTER_PROCESS_MUTEX_H -#define ZYPP_BASE_INTER_PROCESS_MUTEX_H - -#include -#include "zypp/base/Fd.h" -#include "zypp/base/Exception.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/Pathname.h" - -namespace zypp -{ -namespace base -{ - -class ZYppLockedException : public Exception -{ -public: - ZYppLockedException( const std::string & msg_r, - const std::string &name, - pid_t locker_pid ); - virtual ~ZYppLockedException() throw(); - pid_t locker_pid() const { return _locker_pid; } - std::string name() const { return _name; } -private: - pid_t _locker_pid; - std::string _name; -}; - -/** - * - * Inter process scoped lock implementation - * - * This mutex will allow only one writer process to - * reach a critical region protected by a mutex - * of the same name, if there are no readers - * at the same time. - * - * Multiple readers are allowed if there is no - * currently a writer. - * - */ -class InterProcessMutex : private base::NonCopyable -{ -public: - /** - * Processes can be of two types - * Reader or Writer - */ - enum ConsumerType - { - Reader, - Writer - }; - - /** - * options to alter the mutex behavor - */ - class Options - { - public: - /** - * Options for a mutex of type \ref ptype - * with a given name and timeout. - * Default is name "zypp" and no timeout - * (wait till resource is free) - * - * The mutex type, Writer or Reader must be - * given explictly. - * - * The mutex will be handled using a lock file - * located on default library path if the - * library is running as root, and in users home - * directory if not. - * - */ - Options( ConsumerType ptype, - const std::string &pname = "zypp", - int ptimeout = -1 ); - - /** - * set the path where the lockfile is - * created. - */ - void setPath( const Pathname &base ); - - std::string name; - int timeout; - ConsumerType type; - Pathname base; - }; - - /** - * Creates a mutex with a name and a timeout. - * - * default timeout is -1 which means no timeout - * at all, and the mutex will wait forever if - * other process is accessing the critical region - * for a mutex in with the same name. - * - * If the timeout is 0, then if the lock is acquired - * an exception will be thrown inmediately. - * - * Otherwise, the timeout exception will come after - * the timeout is reached. - * - */ - InterProcessMutex( const Options &poptions ); - - /** - * Destructor, gives up the lock on the named - * resource. - */ - ~InterProcessMutex(); - -private: - bool isProcessRunning(pid_t pid_r); - Pathname lockFilePath() const; -private: - shared_ptr _fd; - Options _options; -}; - - -} } - - -#endif - diff --git a/libzypp/zypp/base/Iterator.h b/libzypp/zypp/base/Iterator.h deleted file mode 100644 index 1c21b02..0000000 --- a/libzypp/zypp/base/Iterator.h +++ /dev/null @@ -1,285 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Iterator.h - * -*/ -#ifndef ZYPP_BASE_ITERATOR_H -#define ZYPP_BASE_ITERATOR_H - -#include -#include - -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** \defgroup ITERATOR Boost.Iterator Library - * - * \see http://www.boost.org/libs/iterator/doc/index.html - * - * \li \b counting_iterator: an iterator over a sequence of - * consecutive values. Implements a "lazy sequence" - * \li \b filter_iterator: an iterator over the subset of elements - * of some sequence which satisfy a given predicate - * \li \b function_output_iterator: an output iterator wrapping a - * unary function object; each time an element is written into - * the dereferenced iterator, it is passed as a parameter to - * the function object. - * \li \b indirect_iterator: an iterator over the objects pointed-to - * by the elements of some sequence. - * \li \b permutation_iterator: an iterator over the elements of - * some random-access sequence, rearranged according to some - * sequence of integer indices. - * \li \b reverse_iterator: an iterator which traverses the elements - * of some bidirectional sequence in reverse. Corrects many of the shortcomings of C++98's std::reverse_iterator. - * \li \b shared_container_iterator: an iterator over elements of - * a container whose lifetime is maintained by a shared_ptr - * stored in the iterator. - * \li \b transform_iterator: an iterator over elements which are - * the result of applying some functional transformation to - * the elements of an underlying sequence. This component - * also replaces the old projection_iterator_adaptor. - * \li \b zip_iterator: an iterator over tuples of the elements - * at corresponding positions of heterogeneous underlying - * iterators. - * - * There are in fact more interesting iterator concepts - * available than the ones listed above. Have a look at them. - * - * Some of the iterator types are already dragged into namespace - * zypp. Feel free to add what's missing. - * - * \todo Separate them into individual zypp header files. - */ - //@{ - - /** \class filter_iterator - * An iterator over the subset of elements of some sequence - * which satisfy a given predicate. - * - * Provides boost::filter_iterator and boost::make_filter_iterator - * convenience function. - * \see http://www.boost.org/libs/iterator/doc/filter_iterator.html - * \code - * template - * filter_iterator - * make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()); - * - * template - * filter_iterator - * make_filter_iterator(Iterator x, Iterator end = Iterator()); - * \endcode - * Remember the deduction rules for template arguments. - * \code - * struct MyDefaultConstructibleFilter; - * make_filter_iterator( c.begin(), c.end() ); - * make_filter_iterator( MyDefaultConstructibleFilter(), c.begin(), c.end() ); - * ... - * make_filter_iterator( resfilter::ByName("foo"), c.begin(), c.end() ); - * - * \endcode - */ - using boost::filter_iterator; - using boost::make_filter_iterator; - - /** Convenience to create filter_iterator from container::begin(). */ - template - filter_iterator<_Filter, typename _Container::const_iterator> - make_filter_begin( _Filter f, const _Container & c ) - { - return make_filter_iterator( f, c.begin(), c.end() ); - } - - /** Convenience to create filter_iterator from container::begin(). */ - template - filter_iterator<_Filter, typename _Container::const_iterator> - make_filter_begin( const _Container & c ) - { - return make_filter_iterator( _Filter(), c.begin(), c.end() ); - } - - /** Convenience to create filter_iterator from container::end(). */ - template - filter_iterator<_Filter, typename _Container::const_iterator> - make_filter_end( _Filter f, const _Container & c ) - { - return make_filter_iterator( f, c.end(), c.end() ); - } - - /** Convenience to create filter_iterator from container::end(). */ - template - filter_iterator<_Filter, typename _Container::const_iterator> - make_filter_end( const _Container & c ) - { - return make_filter_iterator( _Filter(), c.end(), c.end() ); - } - - /** \class transform_iterator - * An iterator over elements which are the result of applying - * some functional transformation to the elements of an underlying - * sequence. - * - * Provides boost::transform_iterator and boost::make_transform_iterator - * convenience function. - * \see http://www.boost.org/libs/iterator/doc/transform_iterator.html - * \code - * template - * transform_iterator - * make_transform_iterator(Iterator it, UnaryFunction fun); - * - * template - * transform_iterator - * make_transform_iterator(Iterator it); - * \endcode - */ - using boost::transform_iterator; - using boost::make_transform_iterator; - - /** Functor taking a \c std::pair returning \c std::pair.first. - * \see MapKVIteratorTraits - */ - template - struct GetPairFirst : public std::unary_function<_Pair, const typename _Pair::first_type &> - { - const typename _Pair::first_type & operator()( const _Pair & pair_r ) const - { return pair_r.first; } - }; - - /** Functor taking a \c std::pair returning \c std::pair.second . - * \see MapKVIteratorTraits - */ - template - struct GetPairSecond : public std::unary_function<_Pair, const typename _Pair::second_type &> - { - const typename _Pair::second_type & operator()( const _Pair & pair_r ) const - { return pair_r.second; } - }; - - /** Traits for std::map key and value iterators. - * - * \ref GetPairFirst and \ref GetPairSecond help building a transform_iterator - * that iterates over keys or values of a std::map. Class MapKVIteratorTraits - * provides some typedefs, you usg. do not want to write explicitly. - * - * \code - * // typedefs - * typedef std::map MapType; - * - * // transform_iterator, MapType::const_iterator> - * typedef MapKVIteratorTraits::Key_const_iterator MapTypeKey_iterator; - * // transform_iterator, MapType::const_iterator> - * typedef MapKVIteratorTraits::Value_const_iterator MapTypeValue_iterator; - * - * // usage - * MapType mymap; - * - * MapTypeKey_const_iterator keyBegin( make_map_key_begin( mymap ) ); - * MapTypeKey_const_iterator keyEnd ( make_map_key_end( mymap ) ); - * - * MapTypeValue_const_iterator valBegin( make_map_value_begin( mymap ) ); - * MapTypeValue_const_iterator valEnd ( make_map_value_end( mymap ) ); - * - * std::for_each( keyBegin, keyEnd, DoSomething() ); - * std::for_each( valBegin, valEnd, DoSomething() ); - * \endcode - * - * Or short: - * - * \code - * typedef std::map MapType; - * MapType mymap; - * - * std::for_each( make_map_key_begin( mymap ), make_map_key_end( mymap ), DoSomething() ); - * std::for_each( make_map_value_begin( mymap ), make_map_value_end( mymap ), DoSomething() ); - * \endcode - */ - template - struct MapKVIteratorTraits - { - /** The map type */ - typedef _Map MapType; - /** The maps key type */ - typedef typename _Map::key_type KeyType; - /** The key iterator type */ - typedef transform_iterator, - typename MapType::const_iterator> Key_const_iterator; - /** The maps value (mapped) type */ - typedef typename _Map::mapped_type ValueType; - /** The value iterator type */ - typedef transform_iterator, - typename MapType::const_iterator> Value_const_iterator; - }; - - /** Convenience to create the key iterator from container::begin() */ - template - inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_begin( const _Map & map_r ) - { return make_transform_iterator( map_r.begin(), GetPairFirst() ); } - - /** Convenience to create the key iterator from container::end() */ - template - inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_end( const _Map & map_r ) - { return make_transform_iterator( map_r.end(), GetPairFirst() ); } - - /** Convenience to create the value iterator from container::begin() */ - template - inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_begin( const _Map & map_r ) - { return make_transform_iterator( map_r.begin(), GetPairSecond() ); } - - /** Convenience to create the value iterator from container::end() */ - template - inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_end( const _Map & map_r ) - { return make_transform_iterator( map_r.end(), GetPairSecond() ); } - - /** Convenience to create the key iterator from container::lower_bound() */ - template - inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_lower_bound( const _Map & map_r, const typename _Map::key_type & key_r ) - { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairFirst() ); } - - /** Convenience to create the key iterator from container::upper_bound() */ - template - inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_upper_bound( const _Map & map_r, const typename _Map::key_type & key_r ) - { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairFirst() ); } - - /** Convenience to create the value iterator from container::lower_bound() */ - template - inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_lower_bound( const _Map & map_r, const typename _Map::key_type & key_r ) - { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairSecond() ); } - - /** Convenience to create the value iterator from container::upper_bound() */ - template - inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_upper_bound( const _Map & map_r, const typename _Map::key_type & key_r ) - { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairSecond() ); } - - /** \class function_output_iterator - * An output iterator wrapping a unary function object; each time an - * element is written into the dereferenced iterator, it is passed as - * a parameter to the function object. - * - * Provides boost::function_output_iterator and boost::make_function_output_iterator - * convenience function. - * \see http://www.boost.org/libs/iterator/doc/function_output_iterator.html - * \code - * template - * function_output_iterator - * make_function_output_iterator(const UnaryFunction& f = UnaryFunction()); - * \endcode - */ - using boost::function_output_iterator; - using boost::make_function_output_iterator; - - //@} - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_ITERATOR_H diff --git a/libzypp/zypp/base/Json.h b/libzypp/zypp/base/Json.h deleted file mode 100644 index 7957af9..0000000 --- a/libzypp/zypp/base/Json.h +++ /dev/null @@ -1,383 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Json.h - * -*/ -#ifndef ZYPP_BASE_JSON_H -#define ZYPP_BASE_JSON_H - -#include -#include -#include -#include -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/String.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace json - { - // JSN Keywords - inline static const std::string & nullJSON() { static const std::string _s( "null" ); return _s; } - inline static const std::string & trueJSON() { static const std::string _s( "true" ); return _s; } - inline static const std::string & falseJSON() { static const std::string _s( "false" ); return _s; } - - /////////////////////////////////////////////////////////////////// - namespace detail - { - inline std::string strEncode( std::string val_r ) - { - typedef unsigned char uchar; - - std::string::size_type add = 2; // enclosing "s - for_( r, val_r.begin(), val_r.end() ) - { - if ( uchar(*r) < 32u ) - { - switch ( *r ) - { - case '\b': - case '\f': - case '\n': - case '\r': - case '\t': - add += 1; // "\c" - break; - default: - add += 5; // "\uXXXX" - break; - } - } - else - { - switch ( *r ) - { - case '"': - case '/': - case '\\': - add += 1; // \-escape - break; - } - } - } - - val_r.resize( val_r.size() + add, '@' ); - auto w( val_r.rbegin() ); - auto r( w + add ); - - *w++ = '"'; - for ( ; r != val_r.rend(); ++r ) - { - if ( uchar(*r) < 32u ) - { - static const char * digit = "0123456789abcdef"; - switch ( *r ) - { - case '\b': // "\c" - *w++ = 'b'; - *w++ = '\\'; - break; - case '\f': // "\c" - *w++ = 'f'; - *w++ = '\\'; - break; - case '\n': // "\c" - *w++ = 'n'; - *w++ = '\\'; - break; - case '\r': // "\c" - *w++ = 'r'; - *w++ = '\\'; - break; - case '\t': // "\c" - *w++ = 't'; - *w++ = '\\'; - break; - default: // "\uXXXX" - *w++ = digit[uchar(*r) % 15]; - *w++ = digit[uchar(*r) / 16]; - *w++ = '0'; - *w++ = '0'; - *w++ = 'u'; - *w++ = '\\'; - break; - } - } - else - { - switch ( (*w++ = *r) ) - { - case '"': - case '/': - case '\\': // \-escape - *w++ = '\\'; - break; - } - } - } - *w++ = '"'; - return val_r; - } - } // namespace detail - /////////////////////////////////////////////////////////////////// - - // null - inline std::string toJSON( void ) { return nullJSON(); } - inline std::string toJSON( std::nullptr_t ) { return nullJSON(); } - - // bool - inline std::string toJSON( bool val_r ) { return val_r ? trueJSON() : falseJSON(); } - inline std::string toJSON( const void * val_r ) { return val_r ? trueJSON() : falseJSON(); } - - // numbers - inline std::string toJSON( short val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( unsigned short val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( int val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( unsigned val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( long val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( unsigned long val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( long long val_r ) { return str::numstring( val_r ); } - inline std::string toJSON( unsigned long long val_r ){ return str::numstring( val_r ); } - - // strings - inline std::string toJSON( const char val_r ) { return detail::strEncode( std::string( 1, val_r ) ); } - inline std::string toJSON( const char * val_r ) { return val_r ? detail::strEncode( val_r ) : nullJSON(); } - inline std::string toJSON( const std::string & val_r ){ return detail::strEncode( val_r ); } - - // container to Array - template std::string toJSON( const std::vector & cont_r ); - template std::string toJSON( const std::list & cont_r ); - template std::string toJSON( const std::set & cont_r ); - - // map to Object - template std::string toJSON( const std::map & cont_r ); - - /** Type to JSON string representation. - * This can be implemented as non-static memberfunction \c asJSON, - * or as non-memberfunction \c toJSON; - * \code - * class Type; - * std::string Type::asJSON() const; - * std::string toJSON( const Type & ); - * \endcode - */ - template - std::string toJSON( const T & val_r ) { return val_r.asJSON(); } - - /////////////////////////////////////////////////////////////////// - /// \class Value - /// \brief JSON representation of datatypes via \ref toJSON - /// \code - /// namespace mynamspace - /// { - /// struct Mydata - /// {...}; - /// - /// std::string toJSON( const Mydata & ) - /// { return json::Array{ "answer", 42 }.asJSON(); } - /// } - /// - /// mynamspace::Mydata data; - /// json::Object bigone { - /// { "mydata", data }, - /// { "panic", false }, - /// { "nested", json::Object{ {"one",1}, {"two",2}, {"three",3} } } - /// }; - /// - /// cout << bigone << endl; - ///\endcode - /// \see http://www.json.org/ - /////////////////////////////////////////////////////////////////// - struct Value - { - /** Default ctor (null) */ - Value() : _data( toJSON() ) {} - - /** Copy ctor */ - Value( const Value & rhs ) : _data( rhs._data ) {} - - /** Ctor creating a JSON representation of \a T via \ref toJSON(T) */ - template - Value( const T & val_r ) : _data( toJSON( val_r ) ) {} - - /** JSON representation */ - const std::string & asJSON() const - { return _data; } - - /** String representation */ - const std::string & asString() const - { return asJSON(); } - - /** Stream output */ - std::ostream & dumpOn( std::ostream & str ) const - { return str << _data; } - - private: - std::string _data; - }; - - /** \relates Value Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Value & obj ) - { return obj.dumpOn( str ); } - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class String - /// \brief JSON string - /// Force representation as JSON string, mapping e.g. \c null values - /// to an empty string. Maninly used in \ref Object as key. - /////////////////////////////////////////////////////////////////// - struct String : public Value - { - String() : Value( "" ) {} - String( std::nullptr_t ) : Value( "" ) {} - - String( const char val_r ) : Value( val_r ) {} - String( const char * val_r ) : Value( val_r ? val_r : "" ) {} - String( const std::string & val_r ): Value( val_r ) {} - }; - - /////////////////////////////////////////////////////////////////// - /// \class Array - /// \brief JSON array - /////////////////////////////////////////////////////////////////// - struct Array - { - Array() {} - - /** Construct from container iterator */ - template - Array( Iterator begin, Iterator end ) - { for_( it, begin, end ) add( *it ); } - - /** Construct from container initializer list { v1, v2,... } */ - Array( const std::initializer_list & contents_r ) - : Array( contents_r.begin(), contents_r.end() ) - {} - - /** Push JSON Value to Array */ - void add( const Value & val_r ) - { _data.push_back( val_r.asJSON() ); } - - /** \overload from container initializer list { v1, v2,... } */ - void add( const std::initializer_list & contents_r ) - { for_( it, contents_r.begin(), contents_r.end() ) add( *it ); } - - /** JSON representation */ - std::string asJSON() const - { return str::Str() << *this; } - - /** String representation */ - std::string asString() const - { return asJSON(); } - - /** Stream output */ - std::ostream & dumpOn( std::ostream & str ) const - { - if ( _data.empty() ) - return str << "[]"; - str << '[' << *_data.begin(); - for_( val, ++_data.begin(), _data.end() ) - str << ", " << *val; - return str << ']'; - } - - private: - std::list _data; - }; - - /** \relates Array Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Array & obj ) - { return obj.dumpOn( str ); } - - template - std::string toJSON( const std::vector & cont_r ) - { return json::Array( cont_r.begin(), cont_r.end() ).asJSON(); } - - template - std::string toJSON( const std::list & cont_r ) - { return json::Array( cont_r.begin(), cont_r.end() ).asJSON(); } - - template - std::string toJSON( const std::set & cont_r ) - { return json::Array( cont_r.begin(), cont_r.end() ).asJSON(); } - - /////////////////////////////////////////////////////////////////// - /// \class Object - /// \brief JSON object - /////////////////////////////////////////////////////////////////// - struct Object - { - Object() {} - - /** Construct from map-iterator */ - template - Object( Iterator begin, Iterator end ) - { for_( it, begin, end ) add( it->first, it->second ); } - - /** Construct from map-initializer list { {k1,v1}, {k2,v2},... } */ - Object( const std::initializer_list> & contents_r ) - : Object( contents_r.begin(), contents_r.end() ) - {} - - /** Add key/value pair */ - void add( const String & key_r, const Value & val_r ) - { _data[key_r.asJSON()] = val_r.asJSON(); } - - /** \overload from map-initializer list { {k1,v1}, {k2,v2},... } */ - void add( const std::initializer_list> & contents_r ) - { for_( it, contents_r.begin(), contents_r.end() ) add( it->first, it->second ); } - - /** JSON representation */ - std::string asJSON() const - { return str::Str() << *this; } - - /** String representation */ - std::string asString() const - { return asJSON(); } - - /** Stream output */ - std::ostream & dumpOn( std::ostream & str ) const - { - using std::endl; - if ( _data.empty() ) - return str << "{}"; - dumpOn( str << '{' << endl, _data.begin() ); - for_ ( val, ++_data.begin(), _data.end() ) - dumpOn( str << ',' << endl, val ); - return str << endl << '}'; - } - - private: - std::ostream & dumpOn( std::ostream & str, std::map::const_iterator val_r ) const - { return str << val_r->first << ": " << val_r->second; } - - std::map _data; - }; - - /** \relates Object Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Object & obj ) - { return obj.dumpOn( str ); } - - template - std::string toJSON( const std::map & cont_r ) - { return json::Object( cont_r.begin(), cont_r.end() ).asJSON(); } - - - } // namespace json - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_JSON_H diff --git a/libzypp/zypp/base/LogControl.cc b/libzypp/zypp/base/LogControl.cc deleted file mode 100644 index 03080bb..0000000 --- a/libzypp/zypp/base/LogControl.cc +++ /dev/null @@ -1,450 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/LogControl.cc - * -*/ -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/LogControl.h" -#include "zypp/base/ProfilingFormater.h" -#include "zypp/base/String.h" -#include "zypp/Date.h" -#include "zypp/PathInfo.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace log - { ///////////////////////////////////////////////////////////////// - - StdoutLineWriter::StdoutLineWriter() - : StreamLineWriter( std::cout ) - {} - - StderrLineWriter::StderrLineWriter() - : StreamLineWriter( std::cerr ) - {} - - FileLineWriter::FileLineWriter( const Pathname & file_r, mode_t mode_r ) - { - if ( file_r == Pathname("-") ) - { - _str = &std::cerr; - } - else - { - if ( mode_r ) - { - // not filesystem::assert_file as filesystem:: functions log, - // and this FileWriter is not yet in place. - int fd = ::open( file_r.c_str(), O_CREAT|O_EXCL, mode_r ); - if ( fd != -1 ) - ::close( fd ); - } - // set unbuffered write - std::ofstream * fstr = 0; - _outs.reset( (fstr = new std::ofstream( file_r.asString().c_str(), std::ios_base::app )) ); - fstr->rdbuf()->pubsetbuf(0,0); - _str = &(*fstr); - } - } - - ///////////////////////////////////////////////////////////////// - } // namespace log - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // LineFormater - /////////////////////////////////////////////////////////////////// - std::string LogControl::LineFormater::format( const std::string & group_r, - logger::LogLevel level_r, - const char * file_r, - const char * func_r, - int line_r, - const std::string & message_r ) - { - static char hostname[1024]; - static char nohostname[] = "unknown"; - std::string now( Date::now().form( "%Y-%m-%d %H:%M:%S" ) ); - return str::form( "%s <%d> %s(%d) [%s] %s(%s):%d %s", - now.c_str(), level_r, - ( gethostname( hostname, 1024 ) ? nohostname : hostname ), - getpid(), - group_r.c_str(), - file_r, func_r, line_r, - message_r.c_str() ); - } - - /////////////////////////////////////////////////////////////////// - namespace logger - { ///////////////////////////////////////////////////////////////// - - inline void putStream( const std::string & group_r, LogLevel level_r, - const char * file_r, const char * func_r, int line_r, - const std::string & buffer_r ); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Loglinebuf - // - class Loglinebuf : public std::streambuf { - - public: - /** */ - Loglinebuf( const std::string & group_r, LogLevel level_r ) - : _group( group_r ) - , _level( level_r ) - , _file( "" ) - , _func( "" ) - , _line( -1 ) - {} - /** */ - ~Loglinebuf() - { - if ( !_buffer.empty() ) - writeout( "\n", 1 ); - } - - /** */ - void tagSet( const char * fil_r, const char * fnc_r, int lne_r ) - { - _file = fil_r; - _func = fnc_r; - _line = lne_r; - } - - private: - /** */ - virtual std::streamsize xsputn( const char * s, std::streamsize n ) - { return writeout( s, n ); } - /** */ - virtual int overflow( int ch = EOF ) - { - if ( ch != EOF ) - { - char tmp = ch; - writeout( &tmp, 1 ); - } - return 0; - } - /** */ - virtual int writeout( const char* s, std::streamsize n ) - { - //logger::putStream( _group, _level, _file, _func, _line, _buffer ); - //return n; - if ( s && n ) - { - const char * c = s; - for ( int i = 0; i < n; ++i, ++c ) - { - if ( *c == '\n' ) { - _buffer += std::string( s, c-s ); - logger::putStream( _group, _level, _file, _func, _line, _buffer ); - _buffer = std::string(); - s = c+1; - } - } - if ( s < c ) - { - _buffer += std::string( s, c-s ); - } - } - return n; - } - - private: - std::string _group; - LogLevel _level; - const char * _file; - const char * _func; - int _line; - std::string _buffer; - }; - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Loglinestream - // - class Loglinestream { - - public: - /** */ - Loglinestream( const std::string & group_r, LogLevel level_r ) - : _mybuf( group_r, level_r ) - , _mystream( &_mybuf ) - {} - /** */ - ~Loglinestream() - { _mystream.flush(); } - - public: - /** */ - std::ostream & getStream( const char * fil_r, const char * fnc_r, int lne_r ) - { - _mybuf.tagSet( fil_r, fnc_r, lne_r ); - return _mystream; - } - - private: - Loglinebuf _mybuf; - std::ostream _mystream; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LogControlImpl - // - /** LogControl implementation (Singleton). - * - * \note There is a slight difference in using the _lineFormater and _lineWriter! - * \li \c _lineFormater must not be NULL (create default LogControl::LineFormater) - * \li \c _lineWriter is NULL if no logging is performed, this way we can pass - * _no_stream as logstream to the application, and avoid unnecessary formating - * of logliles, which would then be discarded when passed to some dummy - * LineWriter. - */ - struct LogControlImpl - { - public: - bool isExcessive() - { return _excessive; } - - void excessive( bool onOff_r ) - { _excessive = onOff_r; } - - /** NULL _lineWriter indicates no loggin. */ - void setLineWriter( const shared_ptr & writer_r ) - { _lineWriter = writer_r; } - - shared_ptr getLineWriter() const - { return _lineWriter; } - - /** Assert \a _lineFormater is not NULL. */ - void setLineFormater( const shared_ptr & format_r ) - { - if ( format_r ) - _lineFormater = format_r; - else - _lineFormater.reset( new LogControl::LineFormater ); - } - - void logfile( const Pathname & logfile_r, mode_t mode_r = 0640 ) - { - if ( logfile_r.empty() ) - setLineWriter( shared_ptr() ); - else if ( logfile_r == Pathname( "-" ) ) - setLineWriter( shared_ptr(new log::StderrLineWriter) ); - else - setLineWriter( shared_ptr(new log::FileLineWriter(logfile_r, mode_r)) ); - } - - private: - std::ostream _no_stream; - bool _excessive; - - shared_ptr _lineFormater; - shared_ptr _lineWriter; - - public: - /** Provide the log stream to write (logger interface) */ - std::ostream & getStream( const std::string & group_r, - LogLevel level_r, - const char * file_r, - const char * func_r, - const int line_r ) - { - if ( ! _lineWriter ) - return _no_stream; - if ( level_r == E_XXX && !_excessive ) - return _no_stream; - - if ( !_streamtable[group_r][level_r] ) - { - _streamtable[group_r][level_r].reset( new Loglinestream( group_r, level_r ) ); - } - return _streamtable[group_r][level_r]->getStream( file_r, func_r, line_r ); - } - - /** Format and write out a logline from Loglinebuf. */ - void putStream( const std::string & group_r, - LogLevel level_r, - const char * file_r, - const char * func_r, - int line_r, - const std::string & message_r ) - { - if ( _lineWriter ) - _lineWriter->writeOut( _lineFormater->format( group_r, level_r, - file_r, func_r, line_r, - message_r ) ); - } - - private: - typedef shared_ptr StreamPtr; - typedef std::map StreamSet; - typedef std::map StreamTable; - /** one streambuffer per group and level */ - StreamTable _streamtable; - - private: - /** Singleton ctor. - * No logging per default, unless enabled via $ZYPP_LOGFILE. - */ - LogControlImpl() - : _no_stream( NULL ) - , _excessive( getenv("ZYPP_FULLLOG") ) - , _lineFormater( new LogControl::LineFormater ) - { - if ( getenv("ZYPP_LOGFILE") ) - logfile( getenv("ZYPP_LOGFILE") ); - - if ( getenv("ZYPP_PROFILING") ) - { - shared_ptr formater(new ProfilingFormater); - setLineFormater(formater); - } - } - - ~LogControlImpl() - { - _lineWriter.reset(); - } - - public: - /** The LogControlImpl singleton - * \note As most dtors log, it is inportant that the - * LogControlImpl instance is the last static variable - * destructed. At least destucted after all statics - * which log from their dtor. - */ - static LogControlImpl & instance(); - }; - /////////////////////////////////////////////////////////////////// - - // 'THE' LogControlImpl singleton - inline LogControlImpl & LogControlImpl::instance() - { - static LogControlImpl _instance; - return _instance; - } - - /////////////////////////////////////////////////////////////////// - - /** \relates LogControlImpl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const LogControlImpl & obj ) - { - return str << "LogControlImpl"; - } - - /////////////////////////////////////////////////////////////////// - // - // Access from logger:: - // - /////////////////////////////////////////////////////////////////// - - std::ostream & getStream( const char * group_r, - LogLevel level_r, - const char * file_r, - const char * func_r, - const int line_r ) - { - return LogControlImpl::instance().getStream( group_r, - level_r, - file_r, - func_r, - line_r ); - } - - /** That's what Loglinebuf calls. */ - inline void putStream( const std::string & group_r, LogLevel level_r, - const char * file_r, const char * func_r, int line_r, - const std::string & buffer_r ) - { - LogControlImpl::instance().putStream( group_r, level_r, - file_r, func_r, line_r, - buffer_r ); - } - - bool isExcessive() - { return LogControlImpl::instance().isExcessive(); } - - ///////////////////////////////////////////////////////////////// - } // namespace logger - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LogControl - // Forward to LogControlImpl singleton. - // - /////////////////////////////////////////////////////////////////// - - using logger::LogControlImpl; - - void LogControl::logfile( const Pathname & logfile_r ) - { LogControlImpl::instance().logfile( logfile_r ); } - - void LogControl::logfile( const Pathname & logfile_r, mode_t mode_r ) - { LogControlImpl::instance().logfile( logfile_r, mode_r ); } - - shared_ptr LogControl::getLineWriter() const - { return LogControlImpl::instance().getLineWriter(); } - - void LogControl::setLineWriter( const shared_ptr & writer_r ) - { LogControlImpl::instance().setLineWriter( writer_r ); } - - void LogControl::setLineFormater( const shared_ptr & formater_r ) - { LogControlImpl::instance().setLineFormater( formater_r ); } - - void LogControl::logNothing() - { LogControlImpl::instance().setLineWriter( shared_ptr() ); } - - void LogControl::logToStdErr() - { LogControlImpl::instance().setLineWriter( shared_ptr( new log::StderrLineWriter ) ); } - - /////////////////////////////////////////////////////////////////// - // - // LogControl::TmpExcessive - // - /////////////////////////////////////////////////////////////////// - LogControl::TmpExcessive::TmpExcessive() - { LogControlImpl::instance().excessive( true ); } - LogControl::TmpExcessive::~TmpExcessive() - { LogControlImpl::instance().excessive( false ); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const LogControl & obj ) - { - return str << LogControlImpl::instance(); - } - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/LogControl.h b/libzypp/zypp/base/LogControl.h deleted file mode 100644 index 84262a5..0000000 --- a/libzypp/zypp/base/LogControl.h +++ /dev/null @@ -1,208 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/LogControl.h - * -*/ -#ifndef ZYPP_BASE_LOGCONTROL_H -#define ZYPP_BASE_LOGCONTROL_H - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace log - { ///////////////////////////////////////////////////////////////// - - /** If you want to log the (formated) loglines by yourself, - * derive from this, and overload \c writeOut. - * Expect \a formated_r to be a formated log line without trailing \c NL. - * Ready to be written to the log. - */ - struct LineWriter - { - virtual void writeOut( const std::string & /*formated_r*/ ) - {} - virtual ~LineWriter() - {} - }; - - /** Base class for ostream based \ref LineWriter */ - struct StreamLineWriter : public LineWriter - { - StreamLineWriter( std::ostream & str_r ) : _str( &str_r ) {} - - virtual void writeOut( const std::string & formated_r ) - { (*_str) << formated_r << std::endl; } - - protected: - StreamLineWriter() : _str( 0 ) {} - std::ostream *_str; - }; - - /** \ref LineWriter to stdout. */ - struct StdoutLineWriter : public StreamLineWriter - { - StdoutLineWriter(); - }; - - /** \ref LineWriter to stderr. */ - struct StderrLineWriter : public StreamLineWriter - { - StderrLineWriter(); - }; - - /** \ref LineWriter to file. - * If \c mode_r is not \c 0, \c file_r persissions are changed - * accordingly. \c "-" logs to \c cerr. - */ - struct FileLineWriter : public StreamLineWriter - { - FileLineWriter( const Pathname & file_r, mode_t mode_r = 0 ); - protected: - shared_ptr _outs; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace log - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LogControl - // - /** Maintain logfile related options. - * \note A Singleton using a Singleton implementation class, - * that's why there is no _pimpl like in other classes. - */ - class LogControl - { - friend std::ostream & operator<<( std::ostream & str, const LogControl & obj ); - - public: - /** Singleton access. */ - static LogControl instance() - { return LogControl(); } - - - /** \see \ref log::LineWriter */ - typedef log::LineWriter LineWriter; - - /** If you want to format loglines by yourself, - * derive from this, and overload \c format. - * Return a formated logline without trailing \c NL. - * Ready to be written to the log. - */ - struct LineFormater - { - virtual std::string format( const std::string & /*group_r*/, - logger::LogLevel /*level_r*/, - const char * /*file_r*/, - const char * /*func_r*/, - int /*line_r*/, - const std::string & /*message_r*/ ); - virtual ~LineFormater() {} - }; - - public: - /** Assign a LineFormater. - * If you want to format loglines by yourself. NULL installs the - * default formater. - */ - void setLineFormater( const shared_ptr & formater_r ); - - public: - /** Set path for the logfile. - * Permission for logfiles is set to 0640 unless an explicit mode_t - * value is given. An empty pathname turns off logging. "-" - * logs to std::err. - * \throw if \a logfile_r is not usable. - */ - void logfile( const Pathname & logfile_r ); - void logfile( const Pathname & logfile_r, mode_t mode_r ); - - /** Turn off logging. */ - void logNothing(); - - /** Log to std::err. */ - void logToStdErr(); - - public: - /** Get the current LineWriter */ - shared_ptr getLineWriter() const; - - /** Assign a LineWriter. - * If you want to log the (formated) loglines by yourself. - * NULL turns off logging (same as logNothing) - * \see \ref log::LineWriter - */ - void setLineWriter( const shared_ptr & writer_r ); - - public: - /** Turn on excessive logging for the lifetime of this object.*/ - struct TmpExcessive - { - TmpExcessive(); - ~TmpExcessive(); - }; - - /** Exchange LineWriter for the lifetime of this object. - * \see \ref log::LineWriter - */ - struct TmpLineWriter - { - TmpLineWriter( const shared_ptr & writer_r = shared_ptr() ) - : _writer( LogControl::instance().getLineWriter() ) - { LogControl::instance().setLineWriter( writer_r ); } - - /** Convenience ctor taking over ownership of an allocated LineWriter. - *\code - * TmpLineWriter mylw( new log::StderrLineWriter ); - * \endcode - */ - template - TmpLineWriter( _LineWriter * _allocated_r ) - : _writer( LogControl::instance().getLineWriter() ) - { LogControl::instance().setLineWriter( shared_ptr( _allocated_r ) ); } - - ~TmpLineWriter() - { LogControl::instance().setLineWriter( _writer ); } - - private: - shared_ptr _writer; - }; - - private: - /** Default ctor: Singleton */ - LogControl() - {} - }; - /////////////////////////////////////////////////////////////////// - - /** \relates LogControl Stream output */ - std::ostream & operator<<( std::ostream & str, const LogControl & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_LOGCONTROL_H diff --git a/libzypp/zypp/base/LogTools.h b/libzypp/zypp/base/LogTools.h deleted file mode 100644 index 0e9b9cf..0000000 --- a/libzypp/zypp/base/LogTools.h +++ /dev/null @@ -1,391 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/LogTools.h - * -*/ -#ifndef ZYPP_BASE_LOGTOOLS_H -#define ZYPP_BASE_LOGTOOLS_H - -#include -#include -#include -#include -#include -#include - -#include "zypp/base/Tr1hash.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Iterator.h" -#include "zypp/APIConfig.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - using std::endl; - - /** Print range defined by iterators (multiline style). - * \code - * intro [ pfx ITEM [ { sep ITEM }+ ] sfx ] extro - * \endcode - * - * The defaults print the range enclosed in \c {}, one item per - * line indented by 2 spaces. - * \code - * { - * item1 - * item2 - * } - * {} // on empty range - * \endcode - * - * A comma separated list enclosed in \c () would be: - * \code - * dumpRange( stream, begin, end, "(", "", ", ", "", ")" ); - * // or shorter: - * dumpRangeLine( stream, begin, end ); - * \endcode - * - * \note Some special handling is required for printing std::maps. - * Therefore iomaipulators \ref dumpMap, \ref dumpKeys and \ref dumpValues - * are provided. - * \code - * std::map m; - * m["a"]=1; - * m["b"]=2; - * m["c"]=3; - * - * dumpRange( DBG, dumpMap(m).begin(), dumpMap(m).end() ) << endl; - * // { - * // [a] = 1 - * // [b] = 2 - * // [c] = 3 - * // } - * dumpRange( DBG, dumpKeys(m).begin(), dumpKeys(m).end() ) << endl; - * // { - * // a - * // b - * // c - * // } - * dumpRange( DBG, dumpValues(m).begin(), dumpValues(m).end() ) << endl; - * // { - * // 1 - * // 2 - * // 3 - * // } - * dumpRangeLine( DBG, dumpMap(m).begin(), dumpMap(m).end() ) << endl; - * // ([a] = 1, [b] = 2, [c] = 3) - * dumpRangeLine( DBG, dumpKeys(m).begin(), dumpKeys(m).end() ) << endl; - * // (a, b, c) - * dumpRangeLine( DBG, dumpValues(m).begin(), dumpValues(m).end() ) << endl; - * // (1, 2, 3) - * \endcode - */ - template - std::ostream & dumpRange( std::ostream & str, - _Iterator begin, _Iterator end, - const std::string & intro = "{", - const std::string & pfx = "\n ", - const std::string & sep = "\n ", - const std::string & sfx = "\n", - const std::string & extro = "}" ) - { - str << intro; - if ( begin != end ) - { - str << pfx << *begin; - for ( ++begin; begin != end; ++begin ) - str << sep << *begin; - str << sfx; - } - return str << extro; - } - - /** Print range defined by iterators (single line style). - * \see dumpRange - */ - template - std::ostream & dumpRangeLine( std::ostream & str, - _Iterator begin, _Iterator end ) - { return dumpRange( str, begin, end, "(", "", ", ", "", ")" ); } - - - template - std::ostream & operator<<( std::ostream & str, const std::vector<_Tp> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - template - std::ostream & operator<<( std::ostream & str, const std::set<_Tp,_Cmp,_Alloc> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - template - std::ostream & operator<<( std::ostream & str, const std::tr1::unordered_set<_Tp> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - template - std::ostream & operator<<( std::ostream & str, const std::multiset<_Tp> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - template - std::ostream & operator<<( std::ostream & str, const std::list<_Tp> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - /////////////////////////////////////////////////////////////////// - namespace _logtoolsdetail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // mapEntry - /////////////////////////////////////////////////////////////////// - - /** std::pair wrapper for std::map output. - * Just because we want a special output format for std::pair - * used in a std::map. The mapped std::pair is printed as - * [key] = value. - */ - template - class MapEntry - { - public: - MapEntry( const _Pair & pair_r ) - : _pair( &pair_r ) - {} - - const _Pair & pair() const - { return *_pair; } - - private: - const _Pair *const _pair; - }; - - /** \relates MapEntry Stream output. */ - template - std::ostream & operator<<( std::ostream & str, const MapEntry<_Pair> & obj ) - { - return str << '[' << obj.pair().first << "] = " << obj.pair().second; - } - - /** \relates MapEntry Convenience function to create MapEntry from std::pair. */ - template - MapEntry<_Pair> mapEntry( const _Pair & pair_r ) - { return MapEntry<_Pair>( pair_r ); } - - /////////////////////////////////////////////////////////////////// - // dumpMap - /////////////////////////////////////////////////////////////////// - - /** std::map wrapper for stream output. - * Uses a transform_iterator to wrap the std::pair into MapEntry. - * - */ - template - class DumpMap - { - public: - typedef _Map MapType; - typedef typename _Map::value_type PairType; - typedef MapEntry MapEntryType; - - struct Transformer : public std::unary_function - { - MapEntryType operator()( const PairType & pair_r ) const - { return mapEntry( pair_r ); } - }; - - typedef transform_iterator - MapEntry_const_iterator; - - public: - DumpMap( const _Map & map_r ) - : _map( &map_r ) - {} - - const _Map & map() const - { return *_map; } - - MapEntry_const_iterator begin() const - { return make_transform_iterator( map().begin(), Transformer() ); } - - MapEntry_const_iterator end() const - { return make_transform_iterator( map().end(), Transformer() );} - - private: - const _Map *const _map; - }; - - /** \relates DumpMap Stream output. */ - template - std::ostream & operator<<( std::ostream & str, const DumpMap<_Map> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - /** \relates DumpMap Convenience function to create DumpMap from std::map. */ - template - DumpMap<_Map> dumpMap( const _Map & map_r ) - { return DumpMap<_Map>( map_r ); } - - /////////////////////////////////////////////////////////////////// - // dumpKeys - /////////////////////////////////////////////////////////////////// - - /** std::map wrapper for stream output of keys. - * Uses MapKVIterator iterate and write the key values. - * \code - * std::map<...> mymap; - * std::cout << dumpKeys(mymap) << std::endl; - * \endcode - */ - template - class DumpKeys - { - public: - typedef typename MapKVIteratorTraits<_Map>::Key_const_iterator MapKey_const_iterator; - - public: - DumpKeys( const _Map & map_r ) - : _map( &map_r ) - {} - - const _Map & map() const - { return *_map; } - - MapKey_const_iterator begin() const - { return make_map_key_begin( map() ); } - - MapKey_const_iterator end() const - { return make_map_key_end( map() ); } - - private: - const _Map *const _map; - }; - - /** \relates DumpKeys Stream output. */ - template - std::ostream & operator<<( std::ostream & str, const DumpKeys<_Map> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - /** \relates DumpKeys Convenience function to create DumpKeys from std::map. */ - template - DumpKeys<_Map> dumpKeys( const _Map & map_r ) - { return DumpKeys<_Map>( map_r ); } - - /////////////////////////////////////////////////////////////////// - // dumpValues - /////////////////////////////////////////////////////////////////// - - /** std::map wrapper for stream output of values. - * Uses MapKVIterator iterate and write the values. - * \code - * std::map<...> mymap; - * std::cout << dumpValues(mymap) << std::endl; - * \endcode - */ - template - class DumpValues - { - public: - typedef typename MapKVIteratorTraits<_Map>::Value_const_iterator MapValue_const_iterator; - - public: - DumpValues( const _Map & map_r ) - : _map( &map_r ) - {} - - const _Map & map() const - { return *_map; } - - MapValue_const_iterator begin() const - { return make_map_value_begin( map() ); } - - MapValue_const_iterator end() const - { return make_map_value_end( map() ); } - - private: - const _Map *const _map; - }; - - /** \relates DumpValues Stream output. */ - template - std::ostream & operator<<( std::ostream & str, const DumpValues<_Map> & obj ) - { return dumpRange( str, obj.begin(), obj.end() ); } - - /** \relates DumpValues Convenience function to create DumpValues from std::map. */ - template - DumpValues<_Map> dumpValues( const _Map & map_r ) - { return DumpValues<_Map>( map_r ); } - - ///////////////////////////////////////////////////////////////// - } // namespace _logtoolsdetail - /////////////////////////////////////////////////////////////////// - - // iomanipulator - using _logtoolsdetail::mapEntry; // std::pair as '[key] = value' - using _logtoolsdetail::dumpMap; // dumpRange '[key] = value' - using _logtoolsdetail::dumpKeys; // dumpRange keys - using _logtoolsdetail::dumpValues; // dumpRange values - - template - std::ostream & operator<<( std::ostream & str, const std::map<_Key, _Tp> & obj ) - { return str << dumpMap( obj ); } - - template - std::ostream & operator<<( std::ostream & str, const std::tr1::unordered_map<_Key, _Tp> & obj ) - { return str << dumpMap( obj ); } - - template - std::ostream & operator<<( std::ostream & str, const std::multimap<_Key, _Tp> & obj ) - { return str << dumpMap( obj ); } - - /** Print stream status bits. - * Prints the values of a streams \c good, \c eof, \c failed and \c bad bit. - * - * \code - * [g___] - good - * [_eF_] - eof and fail bit set - * [__FB] - fail and bad bit set - * \endcode - */ - inline std::ostream & operator<<( std::ostream & str, const std::basic_ios & obj ) - { - std::string ret( "[" ); - ret += ( obj.good() ? 'g' : '_' ); - ret += ( obj.eof() ? 'e' : '_' ); - ret += ( obj.fail() ? 'F' : '_' ); - ret += ( obj.bad() ? 'B' : '_' ); - ret += "]"; - return str << ret; - } - - /////////////////////////////////////////////////////////////////// - // iomanipulator: str << dump(val) << ... - // calls: std::ostream & dumpOn( std::ostream & str, const Type & obj ) - /////////////////////////////////////////////////////////////////// - - namespace detail - { - template - struct Dump - { - Dump( const _Tp & obj_r ) : _obj( obj_r ) {} - const _Tp & _obj; - }; - - template - std::ostream & operator<<( std::ostream & str, const Dump<_Tp> & obj ) - { return dumpOn( str, obj._obj ); } - } - - template - detail::Dump<_Tp> dump( const _Tp & obj_r ) - { return detail::Dump<_Tp>(obj_r); } - - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_LOGTOOLS_H diff --git a/libzypp/zypp/base/Logger.h b/libzypp/zypp/base/Logger.h deleted file mode 100644 index 4ba1955..0000000 --- a/libzypp/zypp/base/Logger.h +++ /dev/null @@ -1,124 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Logger.h - * -*/ -#ifndef ZYPP_BASE_LOGGER_H -#define ZYPP_BASE_LOGGER_H - -#include -#include - -/** \defgroup ZYPP_BASE_LOGGER_MACROS ZYPP_BASE_LOGGER_MACROS - * Convenience macros for logging. - * - * The macros finaly call @ref getStream, providing appropriate arguments, - * to return the log stream. - * - * @code - * _DBG("foo") << .... - * @endcode - * Logs a debug message for group @a "foo". - * - * @code - * #undef ZYPP_BASE_LOGGER_LOGGROUP - * #define ZYPP_BASE_LOGGER_LOGGROUP "foo" - * - * DBG << .... - * @endcode - * Defines group @a "foo" as default for log messages and logs a - * debug message. - */ -/*@{*/ - -#ifndef ZYPP_BASE_LOGGER_LOGGROUP -/** Default log group if undefined. */ -#define ZYPP_BASE_LOGGER_LOGGROUP "DEFINE_LOGGROUP" -#endif - -#define XXX _XXX( ZYPP_BASE_LOGGER_LOGGROUP ) -#define DBG _DBG( ZYPP_BASE_LOGGER_LOGGROUP ) -#define MIL _MIL( ZYPP_BASE_LOGGER_LOGGROUP ) -#define WAR _WAR( ZYPP_BASE_LOGGER_LOGGROUP ) -#define ERR _ERR( ZYPP_BASE_LOGGER_LOGGROUP ) -#define SEC _SEC( ZYPP_BASE_LOGGER_LOGGROUP ) -#define INT _INT( ZYPP_BASE_LOGGER_LOGGROUP ) -#define USR _USR( ZYPP_BASE_LOGGER_LOGGROUP ) - -#define _XXX(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_XXX ) -#define _DBG(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP"++", zypp::base::logger::E_MIL ) -#define _MIL(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_MIL ) -#define _WAR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_WAR ) -#define _ERR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_ERR ) -#define _SEC(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_SEC ) -#define _INT(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_INT ) -#define _USR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_USR ) - -#define _BASEFILE ( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ ) - -/** Actual call to @ref getStream. */ -#define ZYPP_BASE_LOGGER_LOG(GROUP,LEVEL) \ - zypp::base::logger::getStream( GROUP, LEVEL, _BASEFILE, __FUNCTION__, __LINE__ ) - -/*@}*/ - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace logger - { ///////////////////////////////////////////////////////////////// - - /** Definition of log levels. - * - * @see getStream - */ - enum LogLevel { - E_XXX = 999, /**< Excessive logging. */ - E_DBG = 0, /**< Debug or verbose. */ - E_MIL, /**< Milestone. */ - E_WAR, /**< Warning. */ - E_ERR, /**< Error. */ - E_SEC, /**< Secutrity related. */ - E_INT, /**< Internal error. */ - E_USR /**< User log. */ - }; - - /** Return a log stream to write on. - * - * The returned log stream is determined by @a group_r and - * @a level_r. The remaining arguments @a file_r, @a func_r - * and @a line_r are expected to denote the location in the - * source code that issued the message. - * - * @note You won't call @ref getStream directly, but use the - * @ref ZYPP_BASE_LOGGER_MACROS. - */ - extern std::ostream & getStream( const char * group_r, - LogLevel level_r, - const char * file_r, - const char * func_r, - const int line_r ); - extern bool isExcessive(); - - ///////////////////////////////////////////////////////////////// - } // namespace logger - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_LOGGER_H diff --git a/libzypp/zypp/base/Measure.cc b/libzypp/zypp/base/Measure.cc deleted file mode 100644 index eaaa3d5..0000000 --- a/libzypp/zypp/base/Measure.cc +++ /dev/null @@ -1,244 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Measure.cc - * -*/ -extern "C" -{ -#include -#include -} -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Measure.h" -#include "zypp/base/String.h" - -using std::endl; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "Measure" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace debug - { ///////////////////////////////////////////////////////////////// - - /** Times measured by \ref Measure. */ - struct Tm - { - Tm() - : _real( 0 ) - , _proc( tmsEmpty ) - {} - - void get() - { - _real = ::time(NULL); - ::times( &_proc ); - } - - Tm operator-( const Tm & rhs ) const - { - Tm ret( *this ); - ret._real -= rhs._real; - ret._proc.tms_utime -= rhs._proc.tms_utime; - ret._proc.tms_stime -= rhs._proc.tms_stime; - ret._proc.tms_cutime -= rhs._proc.tms_cutime; - ret._proc.tms_cstime -= rhs._proc.tms_cstime; - return ret; - } - - std::string asString() const - { - std::string ret( timeStr( _real ) ); - ret += " (u "; - ret += timeStr( asSec( _proc.tms_utime ) ); - ret += " s "; - ret += timeStr( asSec( _proc.tms_stime ) ); - ret += " c "; - ret += timeStr( asSec( _proc.tms_cutime + _proc.tms_cstime ) ); - ret += ")"; - return ret; - } - - std::string stringIf( clock_t ticks_r, const std::string & tag_r ) const - { - std::string ret; - if ( ticks_r ) - { - ret += tag_r; - ret += timeStr( asSec( ticks_r ) ); - } - return ret; - } - - double asSec( clock_t ticks_r ) const - { return double(ticks_r) / ticks; } - - std::string timeStr( time_t sec_r ) const - { - time_t h = sec_r/3600; - sec_r -= h*3600; - time_t m = sec_r/60; - sec_r -= m*60; - if ( h ) - return str::form( "%lu:%02lu:%02lu", h, m, sec_r ); - if ( m ) - return str::form( "%lu:%02lu", m, sec_r ); - return str::form( "%lu", sec_r ); - } - - std::string timeStr( double sec_r ) const - { - time_t h = time_t(sec_r)/3600; - sec_r -= h*3600; - time_t m = time_t(sec_r)/60; - sec_r -= m*60; - if ( h ) - return str::form( "%lu:%02lu:%05.2lf", h, m, sec_r ); - if ( m ) - return str::form( "%lu:%05.2lf", m, sec_r ); - return str::form( "%.2lf", sec_r ); - } - - /** Systems ticks per second. */ - static const long ticks; - /** Empty struct tms. */ - static const struct tms tmsEmpty; - /** Real time via \c ::time. */ - time_t _real; - /** Process times via \c ::times. */ - struct tms _proc; - }; - - const struct tms Tm::tmsEmpty = { 0, 0, 0, 0 }; - const long Tm::ticks = sysconf(_SC_CLK_TCK); - - /** \refers Tm Stream output. */ - std::ostream & operator<<( std::ostream & str, const Tm & obj ) - { - return str << obj.asString(); - } - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Measure::Impl - // - /** Measure implementation. */ - class Measure::Impl - { - public: - Impl( const std::string & ident_r ) - : _ident ( ident_r ) - , _level ( _glevel ) - , _seq ( 0 ) - { - _glevel += ".."; - INT << _level << "START MEASURE(" << _ident << ")" << endl; - _start.get(); - } - - ~Impl() - { - _stop.get(); - ++_seq; - std::ostream & str( INT << _level << "MEASURE(" << _ident << ") " ); - dumpMeasure( str ); - _glevel.erase( 0, 2 ); - } - - void restart() - { - INT << _level << "RESTART MEASURE(" << _ident << ")" << endl; - _start = _stop; - } - - void elapsed() const - { - _stop.get(); - ++_seq; - std::ostream & str( INT << _level << "ELAPSED(" << _ident << ") " ); - dumpMeasure( str ); - _elapsed = _stop; - } - - private: - std::ostream & dumpMeasure( std::ostream & str_r ) const - { - str_r << ( _stop - _start ); - if ( _seq > 1 ) // diff to previous _elapsed - { - str_r << " [" << ( _stop - _elapsed ) << "]"; - } - return str_r << endl; - } - - private: - static std::string _glevel; - - std::string _ident; - std::string _level; - Tm _start; - mutable unsigned _seq; - mutable Tm _elapsed; - mutable Tm _stop; - }; - - std::string Measure::Impl::_glevel; - - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Measure - // - /////////////////////////////////////////////////////////////////// - - Measure::Measure() - {} - - Measure::Measure( const std::string & ident_r ) - : _pimpl( new Impl( ident_r ) ) - {} - - Measure::~Measure() - {} - - void Measure::start( const std::string & ident_r ) - { - stop(); - _pimpl.reset( new Impl( ident_r ) ); - } - - void Measure::restart() - { - _pimpl->restart(); - } - - void Measure::elapsed() const - { - if ( _pimpl ) - _pimpl->elapsed(); - } - - void Measure::stop() - { - _pimpl.reset(); - } - - ///////////////////////////////////////////////////////////////// - } // namespace debug - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Measure.h b/libzypp/zypp/base/Measure.h deleted file mode 100644 index 8c2806b..0000000 --- a/libzypp/zypp/base/Measure.h +++ /dev/null @@ -1,111 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Measure.h - * -*/ -#ifndef ZYPP_BASE_MEASURE_H -#define ZYPP_BASE_MEASURE_H - -#include -#include - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace debug - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Measure - // - /** Tool to measure elapsed real and process times. - * - * Timer is started by either passing a string to the ctor, - * or callign \ref start. The string passed is printed on - * all messages to help identifying the timer. - * - * Elapsed time is printed on calling \ref elapsed (timer - * keeps running) or \ref stop. - * - * Calling \ref stop, stops the timer. The same, if the timer - * goes out of scope. - * - * Elapsed time is printed as: - * \code - * 'REAL TIME' (u 'USER TIME' s 'SYSTEM TIME' c 'TIME OF CHILDREN') - * \endcode - * In brackets the time elapsed since a previous call to \ref elapsed. - * All units are seconds. - * - * \code - * Measure m( "Parse" ); - * ... - * m.elapsed(); - * ... - * m.elapsed(); - * ... - * m.elapsed(); - * ... - * m.stop(); - * - * // START MEASURE(Parse) - * // ELAPSED(Parse) 0 (u 0.13 s 0.00 c 0.00) - * // ELAPSED(Parse) 0 (u 0.15 s 0.02 c 0.00) [ 0 (u 0.02 s 0.02 c 0.00)] - * // ELAPSED(Parse) 0 (u 0.17 s 0.02 c 0.00) [ 0 (u 0.02 s 0.00 c 0.00)] - * // MEASURE(Parse) 0 (u 0.17 s 0.02 c 0.00) [ 0 (u 0.00 s 0.00 c 0.00)] - * \endcode - */ - class Measure - { - public: - /** Default Ctor does nothing. */ - Measure(); - - /** Ctor taking \a ident_r string and auto starts timer. */ - explicit - Measure( const std::string & ident_r ); - - /** Dtor. */ - ~Measure(); - - /** Start timer for \a ident_r string. - * Implies stoping a running timer. - */ - void start( const std::string & ident_r = std::string() ); - - /** re start the timer without reset-ing it. */ - void restart(); - - /** Print elapsed time for a running timer. - * Timer keeps on running. - */ - void elapsed() const; - - /** Stop a running timer. */ - void stop(); - - private: - /** Implementation. */ - class Impl; - /** Pointer to implementation. */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace debug - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_MEASURE_H diff --git a/libzypp/zypp/base/NamedValue.h b/libzypp/zypp/base/NamedValue.h deleted file mode 100644 index db3c724..0000000 --- a/libzypp/zypp/base/NamedValue.h +++ /dev/null @@ -1,161 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/NamedValue.h - * -*/ -#ifndef ZYPP_BASE_NAMEDVALUE_H -#define ZYPP_BASE_NAMEDVALUE_H - -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - - /////////////////////////////////////////////////////////////////// - /// \class NamedValue<_Tp> - /// \brief Simple value<>name mapping supporting aliases. - /// \code - /// enum Commands { - /// CMD_1, - /// CMD_2 - /// }; - /// NamedValue clist; - /// // Value | Name | Alias... - /// clist( CMD_1 ) | "cmd1"; - /// clist( CMD_2 ) | "cmd2" | "second"; - /// - /// std::string name( clist.getName( CMD_1 ) ); - /// Commands cmd( clist.getValue( "second" ) ); - /// \endcode - /////////////////////////////////////////////////////////////////// - template< class _Tp, const bool _WithAlias = true > - class NamedValue - { - typedef std::map< std::string, _Tp > NameMap; - typedef std::map< _Tp, std::string > ValueMap; - - public: - /** Whether not initialized (no (name,value) pair remembered) */ - bool empty() const - { return( _nameMap.empty() && _valueMap.empty() ); } - - public: - /** \name Get value for name or alias. */ - //@{ - /** Whether there is a \c value mapped for \a name_r. - */ - bool haveValue( const std::string & name_r ) const - { - typename NameMap::const_iterator it( _nameMap.find( name_r ) ); - return( it != _nameMap.end() ); - } - - /** Get value mapped for name or alias. - * \return \c true if name or alias was found. - */ - bool getValue( const std::string & name_r, _Tp & value_r ) const - { - typename NameMap::const_iterator it( _nameMap.find( name_r ) ); - if ( it == _nameMap.end() ) - return false; - value_r = it->second; - return true; - } - /** \overload \throws std::out_of_range exception if \a name_r was not found. */ - const _Tp & getValue( const std::string & name_r ) const - { return _nameMap.at( name_r ); } - //@} - - - /** \name Get name for value. */ - //@{ - /** Whether there is a \c name mapped for \a value_r. - */ - bool haveName( const std::string & value_r ) const - { - typename ValueMap::const_iterator it( _valueMap.find( value_r ) ); - return( it != _valueMap.end() ); - } - - /** Get name of value. - * \return \c true if name or alias was found. - */ - bool getName( const _Tp & value_r, std::string & name_r ) const - { - typename ValueMap::const_iterator it( _valueMap.find( value_r ) ); - if ( it == _valueMap.end() ) - return false; - value_r = it->second; - return true; - } - /** \overload \throws std::out_of_range exception if \a value_r was not found. */ - const std::string & getName( const _Tp & value_r ) const - { return _valueMap.at( value_r ); } - //@} - - public: - /** \name Inserter - */ - //@{ - class _Inserter - { - public: - _Inserter( NamedValue & parent_r, const _Tp & value_r ) - : _parent( &parent_r ) - , _value( value_r ) - {} - _Inserter & operator|( const std::string & name_r ) - { _parent->insert( _value, name_r ); return *this; } - private: - NamedValue * _parent; - _Tp _value; - }; - - _Inserter operator()( const _Tp & value_r ) - { return _Inserter( *this, value_r ); } - //@} - - /** Remember name (1st call) or alias (subsequent calls). - * \return \C true if this is the 1st call for \a value_r. - * \throws std::logic_error if \a name_r is already used as name or alias. - * \throws std::logic_error if \c _WithAlias is \c false and a name for \a value_r is already defined. - */ - bool insert( const _Tp & value_r, const std::string & name_r ) - { - typename NameMap::const_iterator nit( _nameMap.find( name_r ) ); - if ( nit != _nameMap.end() ) // duplicate name - throw std::logic_error( "NamedValue::insert name" ); - - typename ValueMap::const_iterator tit( _valueMap.find( value_r ) ); - if ( tit != _valueMap.end() ) // duplicate value, i.e. an alias - { - if ( !_WithAlias ) - throw std::logic_error( "NamedValue::insert alias" ); - - _nameMap[name_r] = value_r; - return false; - } - // here: 1st entry for value_r - _nameMap[name_r] = value_r; - _valueMap[value_r] = name_r; - return true; - } - - private: - NameMap _nameMap; - ValueMap _valueMap; - }; - /////////////////////////////////////////////////////////////////// - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_NAMEDVALUE_H diff --git a/libzypp/zypp/base/NonCopyable.h b/libzypp/zypp/base/NonCopyable.h deleted file mode 100644 index 78d2cfb..0000000 --- a/libzypp/zypp/base/NonCopyable.h +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/NonCopyable.h -*/ -#ifndef ZYPP_BASE_NONCOPYABLE_H -#define ZYPP_BASE_NONCOPYABLE_H - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /** Ensure derived classes cannot be copied. - * Use private inheritance. - */ - typedef boost::noncopyable NonCopyable; - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_NONCOPYABLE_H diff --git a/libzypp/zypp/base/ProfilingFormater.cc b/libzypp/zypp/base/ProfilingFormater.cc deleted file mode 100644 index 63fc9ac..0000000 --- a/libzypp/zypp/base/ProfilingFormater.cc +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ProfilingFormater.cc - * -*/ - -#include - -#include -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/LogControl.h" -#include "zypp/base/String.h" -#include "zypp/Date.h" -#include "zypp/PathInfo.h" - - -#include "zypp/base/ProfilingFormater.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // ProfilingFormater - /////////////////////////////////////////////////////////////////// - - std::string ProfilingFormater::format( const std::string & group_r, - logger::LogLevel level_r, - const char * file_r, - const char * func_r, - int line_r, - const std::string & message_r ) - { - struct timeval tp; - gettimeofday( &tp, NULL); - - return str::form( "%ld.%ld [%d] <%d> %s(%s):%d %s", - tp.tv_sec, - tp.tv_usec, - level_r, - getpid(), - /*group_r.c_str(),*/ - file_r, func_r, line_r, - message_r.c_str() ); - } - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/ProfilingFormater.h b/libzypp/zypp/base/ProfilingFormater.h deleted file mode 100644 index de9e047..0000000 --- a/libzypp/zypp/base/ProfilingFormater.h +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ProfilingFormater.h - * -*/ -#ifndef ZYPP_BASE_PROFILINGFORMATER_H -#define ZYPP_BASE_PROFILINGFORMATER_H - -#include -#include -#include "zypp/base/LogControl.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - struct ProfilingFormater : public LogControl::LineFormater - { - virtual std::string format( const std::string & /*group_r*/, - logger::LogLevel /*level_r*/, - const char * /*file_r*/, - const char * /*func_r*/, - int /*line_r*/, - const std::string & /*message_r*/ ); - virtual ~ProfilingFormater() {} - }; - - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_PROFILINGFORMATER_H diff --git a/libzypp/zypp/base/ProvideNumericId.h b/libzypp/zypp/base/ProvideNumericId.h deleted file mode 100644 index 2990e2d..0000000 --- a/libzypp/zypp/base/ProvideNumericId.h +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ProvideNumericId.h - * -*/ -#ifndef ZYPP_BASE_PROVIDENUMERICID_H -#define ZYPP_BASE_PROVIDENUMERICID_H - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ProvideNumericId - // - /** Base class for objects providing a numeric Id. - * The ctor creates a NumericId from some static counter. - * - * The only assertion is that \c 0 is not used as an Id, - * \b unless the derived class explicitly requests this by - * using \ref ProvideNumericId( const void *const ). - * - * Why should you want to use \c 0 as an Id? E.g if your class - * provides some (singleton) No-object. Might be desirable to - * make the No-object have No-Id. - * - * \code - * struct Foo : public base::ProvideNumericId - * {}; - * Foo foo; - * foo.numericId(); // returns foo's NumericId. - * \endcode - */ - template - struct ProvideNumericId - { - public: - /** \return The objects numeric Id. */ - _NumericIdType numericId() const - { return _numericId; } - - protected: - /** Default ctor */ - ProvideNumericId() - : _numericId( nextId() ) - {} - /** Copy ctor */ - ProvideNumericId( const ProvideNumericId & /*rhs*/ ) - : _numericId( nextId() ) - {} - /** Assign */ - ProvideNumericId & operator=( const ProvideNumericId & /*rhs*/ ) - { return *this; } - /** Dtor */ - ~ProvideNumericId() - {} - protected: - /** No-Id ctor (0). - * Explicitly request Id \c 0. Use it with care! - */ - ProvideNumericId( const void *const ) - : _numericId( 0 ) - {} - private: - /** Provide the next Id to use. */ - static _NumericIdType nextId() - { - static _NumericIdType _staticCounter = 0; - // Assert not returning 0 - return ++_staticCounter; - } - /** */ - const _NumericIdType _numericId; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_PROVIDENUMERICID_H diff --git a/libzypp/zypp/base/PtrTypes.h b/libzypp/zypp/base/PtrTypes.h deleted file mode 100644 index e6d26d1..0000000 --- a/libzypp/zypp/base/PtrTypes.h +++ /dev/null @@ -1,631 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/PtrTypes.h - * \ingroup ZYPP_SMART_PTR - * \see ZYPP_SMART_PTR -*/ -#ifndef ZYPP_BASE_PTRTYPES_H -#define ZYPP_BASE_PTRTYPES_H - -#include -#include - -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace str - { - // printing void* (prevents us from including ) - std::string form( const char * format, ... ) __attribute__ ((format (printf, 1, 2))); - } - - /** \defgroup ZYPP_SMART_PTR Smart pointer types - * Smart pointer types. - * - * Namespace zypp provides 3 smart pointer types \b using the - * boost smart pointer library. - * - * \li \c scoped_ptr Simple sole ownership of single objects. Noncopyable. - * - * \li \c shared_ptr Object ownership shared among multiple pointers - * - * \li \c weak_ptr Non-owning observers of an object owned by shared_ptr. - * - * And \ref zypp::RW_pointer, as wrapper around a smart pointer, - * poviding \c const correct read/write access to the object it refers. - */ - /*@{*/ - - /** shared_ptr custom deleter doing nothing. - * A custom deleter is a function being called when the - * last shared_ptr goes out of score. Per default the - * object gets deleted, but you can insall custom deleters - * as well. This one does nothing. - * - * \code - * // Some class providing a std::istream - * struct InpuStream - * { - * // Per deafult use std::cin. - * InputStream() - * : _stream( &std::cin, NullDeleter() ) - * {} - * // Or read from a file. - * InputStream( const Pathname & file_r ) - * : _stream( new ifgzstream( _path.asString().c_str() ) ) - * {} - * // Or use a stream priovided by the application. - * InputStream( std::istream & stream_r ) - * : _stream( &stream_r, NullDeleter() ) - * {} - * - * std::istream & stream() - * { return *_stream; } - * - * private: - * shared_ptr _stream; - * }; - * \endcode - */ - struct NullDeleter - { - void operator()( const void *const ) const - {} - }; - - /** \class scoped_ptr */ - using boost::scoped_ptr; - - /** \class shared_ptr */ - using boost::shared_ptr; - - /** \class weak_ptr */ - using boost::weak_ptr; - - /** \class intrusive_ptr */ - using boost::intrusive_ptr; - - /** */ - using boost::static_pointer_cast; - /** */ - using boost::const_pointer_cast; - /** */ - using boost::dynamic_pointer_cast; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace std -{ ///////////////////////////////////////////////////////////////// - - // namespace sub { - // class Foo; - // typedef zypp::intrusive_ptr Foo_Ptr; // see DEFINE_PTR_TYPE(NAME) macro below - // } - - // Defined in namespace std g++ finds the output operator (König-Lookup), - // even if we typedef the pointer in a different namespace than ::zypp. - // Otherwise we had to define an output operator always in the same namespace - // as the typedef (else g++ will just print the pointer value). - - /** \relates zypp::shared_ptr Stream output. */ - template - inline std::ostream & operator<<( std::ostream & str, const zypp::shared_ptr<_D> & obj ) - { - if ( obj ) - return str << *obj; - return str << std::string("NULL"); - } - /** \overload specialize for void */ - template<> - inline std::ostream & operator<<( std::ostream & str, const zypp::shared_ptr & obj ) - { - if ( obj ) - return str << zypp::str::form( "%p", (void*)obj.get() ); - return str << std::string("NULL"); - } - - /** \relates zypp::shared_ptr Stream output. */ - template - inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr<_D> & obj ) - { - if ( obj ) - return dumpOn( str, *obj ); - return str << std::string("NULL"); - } - /** \overload specialize for void */ - template<> - inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr & obj ) - { return str << obj; } - - /** \relates zypp::intrusive_ptr Stream output. */ - template - inline std::ostream & operator<<( std::ostream & str, const zypp::intrusive_ptr<_D> & obj ) - { - if ( obj ) - return str << *obj; - return str << std::string("NULL"); - } - /** \relates zypp::intrusive_ptr Stream output. */ - template - inline std::ostream & dumpOn( std::ostream & str, const zypp::intrusive_ptr<_D> & obj ) - { - if ( obj ) - return dumpOn( str, *obj ); - return str << std::string("NULL"); - } - ///////////////////////////////////////////////////////////////// -} // namespace std -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // RW_pointer traits - // - /////////////////////////////////////////////////////////////////// - /** - * Don't forgett to provide versions for _Ptr and _constPtr, - * esp. if creation a of temporary is not acceptable (eg. when - * checking the ref count value). - */ - namespace rw_pointer { - - template - struct Shared - { - typedef shared_ptr<_D> _Ptr; - typedef shared_ptr _constPtr; - /** Check whether pointer is not shared. */ - bool unique( const _constPtr & ptr_r ) - { return !ptr_r || ptr_r.unique(); } - bool unique( const _Ptr & ptr_r ) - { return !ptr_r || ptr_r.unique(); } - /** Return number of references. */ - long use_count( const _constPtr & ptr_r ) const - { return ptr_r.use_count(); } - long use_count( const _Ptr & ptr_r ) const - { return ptr_r.use_count(); } - }; - - template - struct Intrusive - { - typedef intrusive_ptr<_D> _Ptr; - typedef intrusive_ptr _constPtr; - /** Check whether pointer is not shared. */ - bool unique( const _constPtr & ptr_r ) - { return !ptr_r || (ptr_r->refCount() <= 1); } - bool unique( const _Ptr & ptr_r ) - { return !ptr_r || (ptr_r->refCount() <= 1); } - /** Return number of references. */ - long use_count( const _constPtr & ptr_r ) const - { return ptr_r ? ptr_r->refCount() : 0; } - long use_count( const _Ptr & ptr_r ) const - { return ptr_r ? ptr_r->refCount() : 0; } - }; - - template - struct Scoped - { - typedef scoped_ptr<_D> _Ptr; - typedef scoped_ptr _constPtr; - /** Check whether pointer is not shared. */ - bool unique( const _constPtr & ptr_r ) - { return true; } - bool unique( const _Ptr & ptr_r ) - { return true; } - /** Return number of references. */ - long use_count( const _constPtr & ptr_r ) const - { return ptr_r ? 1 : 0; } - long use_count( const _Ptr & ptr_r ) const - { return ptr_r ? 1 : 0; } - }; - - } - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RW_pointer - // - /** Wrapper for \c const correct access via \ref ZYPP_SMART_PTR. - * - * zypp::RW_pointer\<_D,_Traits> stores a \ref ZYPP_SMART_PTR - * of type \c _Traits::_Ptr, which must be convertible into a _D *. - * Pointer style access (via \c -> and \c *) offers a const _D * in const - * a context, otherwise a _D *. Thus \em RW_ means \em read/write, - * as you get a different type, dependent on whether you're allowed to - * read or write. - * - * Forwarding access from an interface to an implemantation class, an - * RW_pointer prevents const interface methods from accidentally calling - * nonconst implementation methods. - * - * The second template argument defaults to - * _Traits = rw_pointer::Shared<_D> thus wraping a - * shared_ptr<_D>. To wrap an intrusive_ptr<_D> - * use rw_pointer::Intrusive<_D>. - * - * \see zypp::RWCOW_pointer for 'copy on write' functionality. - * - * \code - * #include "zypp/base/PtrTypes.h" - * - * class Foo - * { - * ... - * private: - * // Implementation class - * struct Impl; - * // Pointer to implementation; actually a shared_ptr - * RW_pointer _pimpl; - * - * void baa() { _pimpl->... } // is Impl * - * void baa() const { _pimpl->... } // is Impl const * - * }; - * \endcode - */ - template > - struct RW_pointer - { - typedef typename _Traits::_Ptr _Ptr; - typedef typename _Traits::_constPtr _constPtr; - - RW_pointer() - {} - - RW_pointer( std::nullptr_t ) - {} - - explicit - RW_pointer( typename _Ptr::element_type * dptr ) - : _dptr( dptr ) - {} - - explicit - RW_pointer( _Ptr dptr ) - : _dptr( dptr ) - {} - - RW_pointer & operator=( std::nullptr_t ) - { reset(); return *this; } - - void reset() - { _Ptr().swap( _dptr ); } - - void reset( typename _Ptr::element_type * dptr ) - { _Ptr( dptr ).swap( _dptr ); } - - void swap( RW_pointer & rhs ) - { _dptr.swap( rhs._dptr ); } - - void swap( _Ptr & rhs ) - { _dptr.swap( rhs ); } - - explicit operator bool() const - { return _dptr.get() != nullptr; } - - const _D & operator*() const - { return *_dptr; }; - - const _D * operator->() const - { return _dptr.operator->(); } - - const _D * get() const - { return _dptr.get(); } - - _D & operator*() - { return *_dptr; } - - _D * operator->() - { return _dptr.operator->(); } - - _D * get() - { return _dptr.get(); } - - public: - bool unique() const - { return _Traits().unique( _dptr ); } - - long use_count() const - { return _Traits().use_count( _dptr ); } - - _constPtr getPtr() const - { return _dptr; } - - _Ptr getPtr() - { return _dptr; } - - _constPtr cgetPtr() - { return _dptr; } - - private: - _Ptr _dptr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RW_pointer Stream output. - * - * Print the \c _D object the RW_pointer refers, or \c "NULL" - * if the pointer is \c NULL. - */ - template - inline std::ostream & operator<<( std::ostream & str, const RW_pointer<_D, _Ptr> & obj ) - { - if ( obj.get() ) - return str << *obj.get(); - return str << std::string("NULL"); - } - - /** \relates RW_pointer */ - template - inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RW_pointer */ - template - inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RW_pointer */ - template - inline bool operator==( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RW_pointer */ - template - inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RW_pointer */ - template - inline bool operator==( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RW_pointer */ - template - inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, std::nullptr_t ) - { return( lhs.get() == nullptr ); } - /** \relates RW_pointer */ - template - inline bool operator==( std::nullptr_t, const RW_pointer<_D, _Ptr> & rhs ) - { return( nullptr == rhs.get() ); } - - - /** \relates RW_pointer */ - template - inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RW_pointer */ - template - inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RW_pointer */ - template - inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RW_pointer */ - template - inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RW_pointer */ - template - inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RW_pointer */ - template - inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, std::nullptr_t ) - { return( lhs.get() != nullptr ); } - /** \relates RW_pointer */ - template - inline bool operator!=( std::nullptr_t, const RW_pointer<_D, _Ptr> & rhs ) - { return( nullptr != rhs.get() ); } - - /////////////////////////////////////////////////////////////////// - - /** \relates RWCOW_pointer Clone the underlying object. - * Calls \a rhs -\>clone(). Being defined as a - * function outside \ref RWCOW_pointer allows to overload - * it, in case a specific \a _D does not have clone(). - */ - template - inline _D * rwcowClone( const _D * rhs ) - { return rhs->clone(); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RWCOW_pointer - // - /** \ref RW_pointer supporting 'copy on write' functionality. - * - * \em Write access to the underlying object creates a copy, iff - * the object is shared. - * - * See \ref RW_pointer. - */ - template > - struct RWCOW_pointer - { - typedef typename _Traits::_Ptr _Ptr; - typedef typename _Traits::_constPtr _constPtr; - - RWCOW_pointer() - {} - - RWCOW_pointer( std::nullptr_t ) - {} - - explicit - RWCOW_pointer( typename _Ptr::element_type * dptr ) - : _dptr( dptr ) - {} - - explicit - RWCOW_pointer( _Ptr dptr ) - : _dptr( dptr ) - {} - - RWCOW_pointer & operator=( std::nullptr_t ) - { reset(); return *this; } - - void reset() - { _Ptr().swap( _dptr ); } - - void reset( typename _Ptr::element_type * dptr ) - { _Ptr( dptr ).swap( _dptr ); } - - void swap( RWCOW_pointer & rhs ) - { _dptr.swap( rhs._dptr ); } - - void swap( _Ptr & rhs ) - { _dptr.swap( rhs ); } - - explicit operator bool() const - { return _dptr.get() != nullptr; } - - const _D & operator*() const - { return *_dptr; }; - - const _D * operator->() const - { return _dptr.operator->(); } - - const _D * get() const - { return _dptr.get(); } - - _D & operator*() - { assertUnshared(); return *_dptr; } - - _D * operator->() - { assertUnshared(); return _dptr.operator->(); } - - _D * get() - { assertUnshared(); return _dptr.get(); } - - public: - bool unique() const - { return _Traits().unique( _dptr ); } - - long use_count() const - { return _Traits().use_count( _dptr ); } - - _constPtr getPtr() const - { return _dptr; } - - _Ptr getPtr() - { assertUnshared(); return _dptr; } - - _constPtr cgetPtr() - { return _dptr; } - - private: - - void assertUnshared() - { - if ( !unique() ) - _Ptr( rwcowClone( _dptr.get() ) ).swap( _dptr ); - } - - private: - _Ptr _dptr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RWCOW_pointer Stream output. - * - * Print the \c _D object the RWCOW_pointer refers, or \c "NULL" - * if the pointer is \c NULL. - */ - template - inline std::ostream & operator<<( std::ostream & str, const RWCOW_pointer<_D, _Ptr> & obj ) - { - if ( obj.get() ) - return str << *obj.get(); - return str << std::string("NULL"); - } - - /** \relates RWCOW_pointer */ - template - inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return( lhs.get() == rhs.get() ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, std::nullptr_t ) - { return( lhs.get() == nullptr ); } - /** \relates RWCOW_pointer */ - template - inline bool operator==( std::nullptr_t, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return( nullptr == rhs.get() ); } - - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return ! ( lhs == rhs ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, std::nullptr_t ) - { return( lhs.get() != nullptr ); } - /** \relates RWCOW_pointer */ - template - inline bool operator!=( std::nullptr_t, const RWCOW_pointer<_D, _Ptr> & rhs ) - { return( nullptr != rhs.get() ); } - - /////////////////////////////////////////////////////////////////// - - /*@}*/ - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -/** Forward declaration of Ptr types */ -#define DEFINE_PTR_TYPE(NAME) \ -class NAME; \ -extern void intrusive_ptr_add_ref( const NAME * ); \ -extern void intrusive_ptr_release( const NAME * ); \ -typedef zypp::intrusive_ptr NAME##_Ptr; \ -typedef zypp::intrusive_ptr NAME##_constPtr; - -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_PTRTYPES_H diff --git a/libzypp/zypp/base/Random.cc b/libzypp/zypp/base/Random.cc deleted file mode 100644 index 2b24ebd..0000000 --- a/libzypp/zypp/base/Random.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include "zypp/base/Random.h" - -using namespace std; - -namespace zypp { namespace base { - - // Taken from KApplication -int random_int() -{ - static bool init = false; - if (!init) - { - unsigned int seed; - init = true; - int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC); - if (fd < 0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed)) - { - // No /dev/urandom... try something else. - srand(getpid()); - seed = rand()+time(0); - } - if (fd >= 0) close(fd); - srand(seed); - } - return rand(); -} - -// Taken from KApplication -std::string random_string(int length) -{ - if (length <=0 ) return std::string(); - - std::string str; str.resize( length ); - int i = 0; - while (length--) - { - int r=::random() % 62; - r+=48; - if (r>57) r+=7; - if (r>90) r+=6; - str[i++] = char(r); - // so what if I work backwards? - } - return str; -} - - -} } - diff --git a/libzypp/zypp/base/Random.h b/libzypp/zypp/base/Random.h deleted file mode 100644 index 9c988f9..0000000 --- a/libzypp/zypp/base/Random.h +++ /dev/null @@ -1,48 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_BASE_Random_H -#define ZYPP_BASE_Random_H - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { /////////////////////////// - // Taken from KApplication - int random_int(); - // Taken from KApplication - std::string random_string(int length); - - - /** Return a random number from [0,RAND_MAX[. */ - inline unsigned random() - { - return random_int(); - } - /** Return a random number from [0,size_r[. */ - inline unsigned random( unsigned size_r ) - { - return random_int() % size_r; - } - /** Return a random number from [min_r,min_r+size_r[. */ - inline unsigned random( unsigned min_r, unsigned size_r ) - { - return min_r + random( size_r ); - } - - - } //ns base -} // ns zypp - -#endif - diff --git a/libzypp/zypp/base/ReferenceCounted.cc b/libzypp/zypp/base/ReferenceCounted.cc deleted file mode 100644 index ccd5ff7..0000000 --- a/libzypp/zypp/base/ReferenceCounted.cc +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ReferenceCounted.cc - * -*/ -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/base/ReferenceCounted.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - ReferenceCounted::ReferenceCounted() - : _counter( 0 ) - {} - - ReferenceCounted::ReferenceCounted( const ReferenceCounted & /*rhs*/ ) - : _counter( 0 ) - {} - - ReferenceCounted::~ReferenceCounted() - { - if ( _counter ) - { - INT << "~ReferenceCounted: nonzero reference count" << std::endl; - throw std::out_of_range( "~ReferenceCounted: nonzero reference count" ); - } - } - - void ReferenceCounted::unrefException() const - { - INT << "ReferenceCounted::unref: zero reference count" << std::endl; - throw std::out_of_range( "ReferenceCounted::unref: zero reference count" ); - } - - std::ostream & ReferenceCounted::dumpOn( std::ostream & str ) const - { - return str << "ReferenceCounted(@" << (const void *)this - << "<=" << _counter << ")"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/ReferenceCounted.h b/libzypp/zypp/base/ReferenceCounted.h deleted file mode 100644 index 9ec2b02..0000000 --- a/libzypp/zypp/base/ReferenceCounted.h +++ /dev/null @@ -1,143 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/ReferenceCounted.h - * -*/ -#ifndef ZYPP_BASE_REFERENCECOUNTED_H -#define ZYPP_BASE_REFERENCECOUNTED_H - -#include - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ReferenceCounted - // - /** Base class for reference counted objects. - * \todo Make counter thread safe. - */ - class ReferenceCounted - { - /** Stream output via dumpOn. */ - friend std::ostream & operator<<( std::ostream & str, const ReferenceCounted & obj ); - - public: - /** Default ctor. - * Initial reference count is zero. - */ - ReferenceCounted(); - - /** Copy ctor. - * Initial reference count is zero. - */ - ReferenceCounted( const ReferenceCounted & rhs ); - - /** Dtor. - * \throw std::out_of_range if reference count is not zero. - */ - virtual ~ReferenceCounted(); - - /** Assignment. - * Reference count remains untouched. - */ - ReferenceCounted & operator=( const ReferenceCounted & ) - { return *this; } - - public: - /** Return reference counter value. */ - unsigned refCount() const - { return _counter; } - - /** Add a reference. */ - void ref() const - { ref_to( ++_counter ); } - - /** Release a reference. - * Deletes the object if reference count gets zero. - * \throw std::out_of_range if reference count is zero. - */ - void unref() const - { - if ( !_counter ) - unrefException(); // will throw! - if ( --_counter ) - unref_to( _counter ); - else - delete this; - } - - /** Called by zypp::intrusive_ptr to add a reference. - * \see ZYPP_SMART_PTR - */ - static void add_ref( const ReferenceCounted * ptr_r ) - { if( ptr_r ) ptr_r->ref(); } - - /** Called by zypp::intrusive_ptr to add a reference. - * \see ZYPP_SMART_PTR - */ - static void release( const ReferenceCounted * ptr_r ) - { if( ptr_r ) ptr_r->unref(); } - - protected: - /** Overload to realize std::ostream & operator\<\<. */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - - /** Trigger derived classes after refCount was increased. */ - virtual void ref_to( unsigned /* rep_cnt_r */ ) const {} - - /** Trigger derived classes after refCount was decreased. - * No trigger is sent, if refCount got zero (i.e. the - * object is deleted). - **/ - virtual void unref_to( unsigned /* rep_cnt_r */ ) const {} - - private: - /** The reference counter. */ - mutable unsigned _counter; - - /** Throws Exception on unref. */ - void unrefException() const; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ReferenceCounted intrusive_ptr hook to add_ref. */ - inline void intrusive_ptr_add_ref( const ReferenceCounted * ptr_r ) - { ReferenceCounted::add_ref( ptr_r ); } - - /** \relates ReferenceCounted intrusive_ptr hook to release. */ - inline void intrusive_ptr_release( const ReferenceCounted * ptr_r ) - { ReferenceCounted::release( ptr_r ); } - - /** \relates ReferenceCounted Stream output. */ - inline std::ostream & operator<<( std::ostream & str, const ReferenceCounted & obj ) - { return obj.dumpOn( str ); } - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#define IMPL_PTR_TYPE(NAME) \ -void intrusive_ptr_add_ref( const NAME * ptr_r ) \ -{ zypp::base::ReferenceCounted::add_ref( ptr_r ); } \ -void intrusive_ptr_release( const NAME * ptr_r ) \ -{ zypp::base::ReferenceCounted::release( ptr_r ); } - -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_REFERENCECOUNTED_H diff --git a/libzypp/zypp/base/Regex.cc b/libzypp/zypp/base/Regex.cc deleted file mode 100644 index 13adc4f..0000000 --- a/libzypp/zypp/base/Regex.cc +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Regex.cc - * -*/ -#include -#include - -#include - -#include "zypp/base/Regex.h" - -using namespace zypp; -using namespace zypp::str; - -regex::regex() - : m_flags(match_extended) - , m_valid(false) -{ - -} - -void regex::assign(const std::string& str,int flags) -{ - m_valid = true; - m_str = str; - m_flags = flags; - int err; - char errbuff[100]; - static const int normal = 1<<16; // deprecated legacy, use match_extended - if (!(flags & normal)) { - flags |= match_extended; - flags &= ~(normal); - } - - if ((err = regcomp(&m_preg, str.c_str(), flags))) { - m_valid = false; - regerror(err, &m_preg, errbuff, sizeof(errbuff)); - ZYPP_THROW(regex_error(std::string(errbuff))); - } -} - -regex::regex(const std::string& str, int flags) -{ - assign(str, flags); -} - -regex::~regex() throw() -{ - if (m_valid) - regfree(&m_preg); -} - -bool zypp::str::regex_match(const char * s, smatch& matches, const regex& regex) -{ - bool r = s && regex.m_valid && !regexec(®ex.m_preg, s, 12, &matches.pmatch[0], 0); - if (r) - matches.match_str = s; - return r; -} - -bool zypp::str::regex_match(const char * s, const regex& regex) -{ - return s && !regexec(®ex.m_preg, s, 0, NULL, 0); -} - -smatch::smatch() -{ - memset(&pmatch, -1, sizeof(pmatch)); -} - -std::string smatch::operator[](unsigned i) const -{ - if ( i < sizeof(pmatch)/sizeof(*pmatch) && pmatch[i].rm_so != -1 ) - return match_str.substr( pmatch[i].rm_so, pmatch[i].rm_eo-pmatch[i].rm_so ); - - return std::string(); -} - - -unsigned smatch::size() const -{ - unsigned matches = unsigned(-1); - // Get highest (pmatch[i].rm_so != -1). Just looking for the 1st - // (pmatch[i].rm_so == -1) is wrong as optional mayches "()?" - // may be embeded. - for ( unsigned i = 0; i < sizeof(pmatch)/sizeof(*pmatch); ++i ) - { - if ( pmatch[i].rm_so != -1 ) - matches = i; - } - return ++matches; -} diff --git a/libzypp/zypp/base/Regex.h b/libzypp/zypp/base/Regex.h deleted file mode 100644 index f66f07b..0000000 --- a/libzypp/zypp/base/Regex.h +++ /dev/null @@ -1,162 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Regex.h - * -*/ -#ifndef ZYPP_BASE_REGEX_H -#define ZYPP_BASE_REGEX_H - -#include -#include -#include - -#include "zypp/base/Exception.h" - -////////////////////////////////////////////////////////////////// -namespace zypp -{ - ////////////////////////////////////////////////////////////////// - /// \namespace str - /// \brief String related utilities and \ref ZYPP_STR_REGEX. - namespace str - { - ////////////////////////////////////////////////////////////////// - /// \defgroup ZYPP_STR_REGEX Regular expression matching - /// \brief Regular expressions using the glibc regex library. - /// - /// \see also \ref StrMatcher string matcher also supporting globing, etc. - /// - /// \code - /// str::regex rxexpr( "^(A)?([0-9]*) im" ); - /// str::smatch what; - /// - /// std::string mytext( "Y123 imXXXX" ); - /// if ( str::regex_match( mytext, what, rxexpr ) ) - /// { - /// MIL << "MATCH '" << what[0] << "'" << endl; - /// MIL << " subs: " << what.size()-1 << endl; - /// for_( i, 1U, what.size() ) - /// MIL << " [" << i << "] " << what[i] << endl; - /// } - /// else - /// { - /// WAR << "NO MATCH '" << rxexpr << "' in '" << mytext << endl; - /// } - /// \endcode - ////////////////////////////////////////////////////////////////// - - typedef Exception regex_error; - - class smatch; - class regex; - - ////////////////////////////////////////////////////////////////// - /// \brief Regular expression matching - /// - /// \ingroup ZYPP_STR_REGEX - /// \relates regex - /// Return whether a \ref regex matches a specific string. An optionally - /// passed \ref smatch object will contain the match reults. - ////////////////////////////////////////////////////////////////// - bool regex_match( const char * s, smatch & matches, const regex & regex ); - - /** \copydoc regex_match \relates regex \ingroup ZYPP_STR_REGEX */ - inline bool regex_match(const std::string & s, smatch & matches, const regex & regex) - { return regex_match( s.c_str(), matches, regex ); } - - /** \copydoc regex_match \relates regex \ingroup ZYPP_STR_REGEX */ - bool regex_match( const char * s, const regex & regex ); - - /** \copydoc regex_match \relates regex \ingroup ZYPP_STR_REGEX */ - inline bool regex_match( const std::string & s, const regex & regex ) - { return regex_match( s.c_str(), regex ); } - - ////////////////////////////////////////////////////////////////// - /// \class regex - /// \brief Regular expression - /// - /// \ingroup ZYPP_STR_REGEX - ////////////////////////////////////////////////////////////////// - class regex - { - public: - - enum RegFlags { - icase = REG_ICASE, ///< Do not differentiate case - nosubs = REG_NOSUB, ///< Support for substring addressing of matches is not required - match_extended = REG_EXTENDED, ///< Use POSIX Extended Regular Expression syntax when interpreting regex. - }; - - regex(); - regex(const std::string& s,int flags = match_extended); - ~regex() throw(); - - regex(const regex & rhs) - { assign(rhs.m_str, rhs.m_flags); } - - regex & operator=(const regex & rhs) - { assign(rhs.m_str, rhs.m_flags); return *this; } - - /** - * string representation of the regular expression - */ - std::string asString() const - { return m_str; } - - public: - /** Expert backdoor. Returns pointer to the compiled regex for direct use in regexec() */ - regex_t * get() - { return & m_preg; } - - private: - void assign(const std::string& s,int flags = match_extended); - - private: - friend class smatch; - friend bool regex_match(const char * s, str::smatch& matches, const regex& regex); - friend bool regex_match(const char * s, const regex& regex); - std::string m_str; - int m_flags; - regex_t m_preg; - bool m_valid; - }; - - /** \relates regex Stream output */ - inline std::ostream & operator<<( std::ostream & str, const regex & obj ) - { return str << obj.asString(); } - - ////////////////////////////////////////////////////////////////// - /// \class smatch - /// \brief Regular expression match result - /// - /// \ingroup ZYPP_STR_REGEX - /// - /// Index \c n=0 returns the string object representing the character - /// sequence that matched the whole regular expression. - /// If \c n is out of range, or if \c n is an unmatched sub-expression, - /// then an empty string is returned. - ////////////////////////////////////////////////////////////////// - class smatch - { - public: - smatch(); - - std::string operator[](unsigned i) const; - - unsigned size() const; - - std::string match_str; - regmatch_t pmatch[12]; - }; - - } // namespace str - ////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_STRING_H diff --git a/libzypp/zypp/base/SerialNumber.cc b/libzypp/zypp/base/SerialNumber.cc deleted file mode 100644 index 4d77e42..0000000 --- a/libzypp/zypp/base/SerialNumber.cc +++ /dev/null @@ -1,101 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/SerialNumber.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/base/SerialNumber.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SerialNumber - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SerialNumber::SerialNumber - // METHOD TYPE : Ctor - // - SerialNumber::SerialNumber( bool dirty_r ) - : _dirty( dirty_r ) - , _serial( 0 ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SerialNumber::~SerialNumber - // METHOD TYPE : Dtor - // - SerialNumber::~SerialNumber() - {} - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const SerialNumber & obj ) - { - return str << "SERIAL" << (obj._dirty?"*":"(") << obj._serial << (obj._dirty?"*":")"); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SerialNumberWatcher - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SerialNumberWatcher::SerialNumberWatcher - // METHOD TYPE : Ctor - // - SerialNumberWatcher::SerialNumberWatcher( unsigned serial_r ) - : _serial( serial_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SerialNumberWatcher::SerialNumberWatcher - // METHOD TYPE : Ctor - // - SerialNumberWatcher::SerialNumberWatcher( const SerialNumber & serial_r ) - : _serial( serial_r.serial() ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SerialNumber::~SerialNumber - // METHOD TYPE : Dtor - // - SerialNumberWatcher::~SerialNumberWatcher() - {} - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const SerialNumberWatcher & obj ) - { - return str << "LAST_SERIAL(" << obj._serial << ")"; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/SerialNumber.h b/libzypp/zypp/base/SerialNumber.h deleted file mode 100644 index 86be153..0000000 --- a/libzypp/zypp/base/SerialNumber.h +++ /dev/null @@ -1,184 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/SerialNumber.h - * -*/ -#ifndef ZYPP_BASE_SERIALNUMBER_H -#define ZYPP_BASE_SERIALNUMBER_H - -#include - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SerialNumber - // - /** Simple serial number provider. - * - * \ref serial returns a serial number. The number returned stays - * the same unless \ref setDirty was called to bring the object - * into \c dirty state. The next call to \ref serial will increment - * the serial number and bring the object into \c clean state. - * - * \code - * SerialNumber sno; - * sno.serial(); // SERIAL(0); () = clean - * sno.setDirty(); // SERIAL*0*; ** = dirty - * sno.serial(); // SERIAL(1) - * sno.setDirty(); // SERIAL*1* - * sno.setDirty(); // SERIAL*1* - * sno.serial(); // SERIAL(2) - * \endcode - */ - class SerialNumber - { - friend std::ostream & operator<<( std::ostream & str, const SerialNumber & obj ); - - public: - /** Ctor taking initial \c dirty value. */ - SerialNumber( bool dirty_r = false ); - /** Dtor */ - virtual ~SerialNumber(); - - public: - void setDirty() - { _dirty = true; } - - public: - bool dirty() const - { return _dirty; } - - bool clean() const - { return !_dirty; } - - unsigned serial() const - { - if ( _dirty ) - { - ++_serial; - _dirty = false; - } - return _serial; - } - - private: - mutable bool _dirty; - mutable unsigned _serial; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates SerialNumber Stream output */ - std::ostream & operator<<( std::ostream & str, const SerialNumber & obj ); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SerialNumberWatcher - // - /** Simple serial number watcher. - * - * \ref SerialNumberWatcher remembers a serial number - * and tells whenever new numbers you feed change. - * - * All methods are overloaded to take an \unsigned or a - * const SerialNumber & as argument. - * - * \code - * SerialNumber sno; - * - * void check() - * { - * static SerialNumberWatcher watcher( sno ); - * - * if ( watcher.remember( sno ) ) - * { - * cout << "Serial number changed." << endl; - * } - * } - * - * int main() - * { - * check(); // This call would trigger, if check used a - * // default constructed SerialNumberWatcher. - * - * check(); // - * sno.dirty(); - * check(); // "Serial number changed." - * check(); // - * sno.dirty(); - * check(); // "Serial number changed." - * \endcode - */ - class SerialNumberWatcher - { - friend std::ostream & operator<<( std::ostream & str, const SerialNumberWatcher & obj ); - - public: - /** Ctor taking an initial \c serial value. - * - * A default constructed SerialNumberWatcher remembers the serial - * number (unsigned)-1. So it is most likely the the 1st - * call to \ref remember returns \ref isDirty. - * - * Vice versa, initializing the SerialNumberWatcher with the current - * SerialNumber, most likely prevents the 1st to \ref remember to - * return \ref isDirty. - */ - SerialNumberWatcher( unsigned serial_r = (unsigned)-1 ); - /** Ctor taking an initial \c serial value. */ - SerialNumberWatcher( const SerialNumber & serial_r ); - /** Dtor */ - virtual ~SerialNumberWatcher(); - - public: - /** Return whether \c serial_r differs. */ - bool isDirty( unsigned serial_r ) const - { return( _serial != serial_r ); } - /** \overload */ - bool isDirty( const SerialNumber & serial_r ) const - { return( _serial != serial_r.serial() ); } - - /** Return whether \c serial_r is still unchanged. */ - bool isClean( unsigned serial_r ) const - { return( _serial == serial_r ); } - /** \overload */ - bool isClean( const SerialNumber & serial_r ) const - { return( _serial == serial_r.serial() ); } - - public: - /** Return \ref isDirty, storing \c serial_r as new value. */ - bool remember( unsigned serial_r ) const - { - if ( isDirty( serial_r ) ) - { - _serial = serial_r; - return true; - } - return false; - } - /** \overload */ - bool remember( const SerialNumber & serial_r ) const - { return remember( serial_r.serial() ); } - - private: - mutable unsigned _serial; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates SerialNumberWatcher Stream output */ - std::ostream & operator<<( std::ostream & str, const SerialNumberWatcher & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_SERIALNUMBER_H diff --git a/libzypp/zypp/base/SetRelationMixin.cc b/libzypp/zypp/base/SetRelationMixin.cc deleted file mode 100644 index 5b37830..0000000 --- a/libzypp/zypp/base/SetRelationMixin.cc +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/SetRelationMixin.cc - */ - -#include -#include "zypp/base/SetRelationMixin.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - const std::string & _SetCompareDef::asString( Enum val_r ) - { - static std::map _table = { - { uncomparable, "{?}" }, - { equal, "{=}" }, - { properSubset, "{<}" }, - { properSuperset, "{>}" }, - { disjoint, "{ }" }, - }; - return _table[val_r]; - } - - const std::string & _SetRelationDef::asString( Enum val_r ) - { - static std::map _table = { - { uncomparable, "{??}" }, - { equal, "{==}" }, - { properSubset, "{<<}" }, - { properSuperset, "{>>}" }, - { disjoint, "{ }" }, - { subset, "{<=}" }, - { superset, "{>=}" }, - }; - return _table[val_r]; - } -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/SetRelationMixin.h b/libzypp/zypp/base/SetRelationMixin.h deleted file mode 100644 index 7ca5479..0000000 --- a/libzypp/zypp/base/SetRelationMixin.h +++ /dev/null @@ -1,242 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/SetRelationMixin.h - */ -#ifndef ZYPP_BASE_SETRELATIONMIXIN_H -#define ZYPP_BASE_SETRELATIONMIXIN_H - -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/EnumClass.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - /// \class _SetCompareDef - /// \brief Result of set comparison (use like 'enum class \ref SetCompare') - /// This is the type a \c compare function should return. - /////////////////////////////////////////////////////////////////// - struct _SetCompareDef { - enum Enum { - uncomparable = 0, ///< "{?}" - equal = (1<<0), ///< "{=}" - properSubset = (1<<1), ///< "{<}" - properSuperset = (1<<2), ///< "{>}" - disjoint = (1<<3), ///< "{ }" - }; - /** String representantion */ - static const std::string & asString( Enum val_r ); - }; - /** \relates _SetCompareDef typedef 'enum class SetCompare' */ - typedef base::EnumClass<_SetCompareDef> SetCompare; - - /** \relates SetCompare Stream output */ - inline std::ostream & operator<<( std::ostream & str, const SetCompare::Enum & obj ) - { return str << SetCompare::asString( obj ); } - /** \overload */ - inline std::ostream & operator<<( std::ostream & str, const SetCompare & obj ) - { return str << obj.asEnum(); } - - /////////////////////////////////////////////////////////////////// - /// \class _SetRelationDef - /// \brief Set Relation based on \ref SetCompare (use like 'enum class \ref SetRelation') - /// Comparison (\c== \c!=) between \ref SetRelation and \ref SetCompare - /// is defined to let \c SetRelation::subset match \c SetCompare::equal - /// as well as \c SetCompare::properSubset. Accordingly \c SetRelation::subset - /// matches \c SetCompare::equal as well as \c SetCompare::properSuperset. - /////////////////////////////////////////////////////////////////// - struct _SetRelationDef { - enum Enum { - uncomparable = SetCompare::uncomparable, ///< "{??}" - equal = SetCompare::equal, ///< "{==}" - properSubset = SetCompare::properSubset, ///< "{<<}" - properSuperset = SetCompare::properSuperset, ///< "{>>}" - disjoint = SetCompare::disjoint, ///< "{ }" - subset = properSubset|equal, ///< "{<=}" - superset = properSuperset|equal, ///< "{>=}" - }; - /** String representantion */ - static const std::string & asString( Enum val_r ); - }; - /** \relates _SetRelationDef typedef 'enum class SetRelation' */ - typedef base::EnumClass<_SetRelationDef> SetRelation; - - /** \relates SetRelation Stream output */ - inline std::ostream & operator<<( std::ostream & str, const SetRelation::Enum & obj ) - { return str << SetRelation::asString( obj ); } - /** \overload */ - inline std::ostream & operator<<( std::ostream & str, const SetRelation & obj ) - { return str << obj.asEnum(); } - - /** \relates SetRelation \relates SetCompare Matching \ref SetCompare and \ref SetRelation */ - inline bool operator==( const SetRelation::Enum & lhs, const SetCompare::Enum & rhs ) - { return( lhs&rhs || !(lhs|rhs) ); } - /** \overload */ - inline bool operator==( const SetRelation::Enum & lhs, const SetCompare & rhs ) - { return( lhs == rhs.asEnum() ); } - /** \overload */ - inline bool operator==( const SetRelation & lhs, const SetCompare::Enum & rhs ) - { return( lhs.asEnum() == rhs ); } - /** \overload */ - inline bool operator==( const SetRelation & lhs, const SetCompare & rhs ) - { return( lhs.asEnum() == rhs.asEnum() ); } - /** \overload */ - inline bool operator==( const SetCompare::Enum & lhs, const SetRelation::Enum & rhs ) - { return( rhs == lhs ); } - /** \overload */ - inline bool operator==( const SetCompare::Enum & lhs, const SetRelation & rhs ) - { return( rhs == lhs ); } - /** \overload */ - inline bool operator==( const SetCompare & lhs, const SetRelation::Enum & rhs ) - { return( rhs == lhs ); } - /** \overload */ - inline bool operator==( const SetCompare & lhs, const SetRelation & rhs ) - { return( rhs == lhs ); } - - /** \relates SetRelation \relates SetCompare Matching \ref SetCompare and \ref SetRelation */ - inline bool operator!=( const SetRelation::Enum & lhs, const SetCompare::Enum & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetRelation::Enum & lhs, const SetCompare & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetRelation & lhs, const SetCompare::Enum & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetRelation & lhs, const SetCompare & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetCompare::Enum & lhs, const SetRelation::Enum & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetCompare::Enum & lhs, const SetRelation & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetCompare & lhs, const SetRelation::Enum & rhs ) - { return !( lhs == rhs ); } - /** \overload */ - inline bool operator!=( const SetCompare & lhs, const SetRelation & rhs ) - { return !( lhs == rhs ); } - - /////////////////////////////////////////////////////////////////// - namespace base - { - /////////////////////////////////////////////////////////////////// - /// \class SetRelationMixin - /// \brief Provide set relation methods based on Derived::setRelationMixinCompare - /// A class using this mixin must provide: - /// \code - /// SetCompare setRelationMixinCompare( const Derived & rhs ) const; - /// \endcode - /// \see \ref SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN - /// \ingroup g_CRTP - /////////////////////////////////////////////////////////////////// - template - class SetRelationMixin - { - public: - /** Compare sets */ - SetCompare compare( const Derived & trg ) const - { return derived().setRelationMixinCompare( trg ); } - /** \overload */ - SetCompare compare( const SetRelationMixin & trg ) const - { return compare( trg.derived() ); } - - /** Compare sets and match against \ref SetCompare */ - bool compare( const Derived & trg, SetCompare cmp ) const - { return compare( trg ) == cmp; } - /** \overload */ - bool compare( const SetRelationMixin & trg, SetCompare cmp ) const - { return compare( trg ) == cmp; } - - /** Compare sets and match against \ref SetRelation */ - bool compare( const Derived & trg, SetRelation rel ) const - { return compare( trg ) == rel; } - /** \overload */ - bool compare( const SetRelationMixin & trg, SetRelation rel ) const - { return compare( trg ) == rel; } - - protected: - SetRelationMixin() {} - DEFAULT_COPYABLE( SetRelationMixin ); - DEFAULT_MOVABLE( SetRelationMixin ); - ~SetRelationMixin() {} - - private: - /** Access to sublass Derived*/ - const Derived & derived() const - { return *static_cast( this ); } - }; - - /** \relates SetRelationMixin Compare sets */ - template - inline SetCompare compare( const SetRelationMixin & src, const SetRelationMixin & trg ) - { return src.compare( trg ); } - - /** \relates SetRelationMixin Compare sets and match against \ref SetCompare */ - template - inline bool compare( const SetRelationMixin & src, const SetRelationMixin & trg, SetCompare cmp ) - { return src.compare( trg, cmp ); } - - /** \relates SetRelationMixin Compare sets and match against \ref SetRelation */ - template - inline bool compare( const SetRelationMixin & src, const SetRelationMixin & trg, SetRelation rel ) - { return src.compare( trg, rel ); } - - /** \relates SetRelationMixin Equal */ - template - inline bool operator==( const SetRelationMixin & src, const SetRelationMixin & trg ) - { return src.compare( trg, SetRelation::equal ); } - - /** \relates SetRelationMixin Unequal */ - template - inline bool operator!=( const SetRelationMixin & src, const SetRelationMixin & trg ) - { return !( src == trg ); } - - /** \relates SetRelationMixin Define compare between Derived and some other type (e.g. std::string) - * \code - * class Foo : public base::SetRelationMixin {...}; - * SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( Foo, const char * ); - * SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( Foo, const std::string & ); - * \endcode - */ -#define SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN(DERIVED_TYPE,OTHER_TYPE) \ - inline SetCompare compare( const base::SetRelationMixin & src, OTHER_TYPE trg ) \ - { return src.compare( DERIVED_TYPE(trg) ); } \ - inline SetCompare compare( OTHER_TYPE src, const base::SetRelationMixin & trg ) \ - { return DERIVED_TYPE(src).compare( trg ); } \ - \ - inline bool compare( const base::SetRelationMixin & src, OTHER_TYPE trg, SetCompare cmp ) \ - { return src.compare( DERIVED_TYPE(trg), cmp ); } \ - inline bool compare( OTHER_TYPE src, const base::SetRelationMixin & trg, SetCompare cmp ) \ - { return DERIVED_TYPE(src).compare( trg, cmp ); } \ - \ - inline bool compare( const base::SetRelationMixin & src, OTHER_TYPE trg, SetRelation rel ) \ - { return src.compare( DERIVED_TYPE(trg), rel ); } \ - inline bool compare( OTHER_TYPE src, const base::SetRelationMixin & trg, SetRelation rel ) \ - { return DERIVED_TYPE(src).compare( trg, rel ); } \ - \ - inline bool operator==( const base::SetRelationMixin & src, OTHER_TYPE trg ) \ - { return src.compare( DERIVED_TYPE(trg), SetRelation::equal ); } \ - inline bool operator==( OTHER_TYPE src, const base::SetRelationMixin & trg ) \ - { return DERIVED_TYPE(src).compare( trg, SetRelation::equal ); } \ - \ - inline bool operator!=( const base::SetRelationMixin & src, OTHER_TYPE trg ) \ - { return !( src == trg ); } \ - inline bool operator!=( OTHER_TYPE src, const base::SetRelationMixin & trg ) \ - { return !( src == trg ); } - - } // namespace base - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_SETRELATIONMIXIN_H diff --git a/libzypp/zypp/base/Signal.h b/libzypp/zypp/base/Signal.h deleted file mode 100644 index e4ffd6a..0000000 --- a/libzypp/zypp/base/Signal.h +++ /dev/null @@ -1,84 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Signal.h - * -*/ -#ifndef ZYPP_BASE_SIGNAL_H -#define ZYPP_BASE_SIGNAL_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Exception safe signal handler save/restore. - * \ingroup g_RAII - */ - class SignalSaver - { - public: - SignalSaver( int signum_r, sighandler_t handler_r ) - : _signum( signum_r ) - { _orighandler = ::signal( signum_r, handler_r ); } - ~SignalSaver() - { ::signal( _signum, _orighandler ); } - private: - int _signum; - ::sighandler_t _orighandler; - }; - - /** Exception safe sigprocmask save/restore. - * \ingroup g_RAII - */ - class SigprocmaskSaver - { - public: - /** Ctor saving the original sigprocmask. */ - SigprocmaskSaver() - { ::sigprocmask( SIG_SETMASK, NULL, &_origmask ); } - /** Dtor restoring the original sigprocmask. */ - ~SigprocmaskSaver() - { ::sigprocmask( SIG_SETMASK, &_origmask, NULL ); } - public: - /** Temporary block signal. */ - void block( int signum_r ) - { - ::sigset_t mask; - ::sigemptyset( & mask ); - ::sigaddset( & mask, signum_r ); - ::sigprocmask( SIG_BLOCK, &mask, NULL ); - } - /** Temporary unblock signal. */ - void unblock( int signum_r ) - { - ::sigset_t mask; - ::sigemptyset( & mask ); - ::sigaddset( & mask, signum_r ); - ::sigprocmask( SIG_UNBLOCK, &mask, NULL ); - } - /** Whether signal delivery is pending. */ - bool pending( int signum_r ) - { - ::sigset_t mask; - ::sigpending( &mask ); - return ::sigismember( &mask, signum_r ); - } - /** Wait for signals not blocked in original sigprocmask. */ - void suspend() - { ::sigsuspend( &_origmask ); } - private: - ::sigset_t _origmask; - }; - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_SIGNAL_H diff --git a/libzypp/zypp/base/StrMatcher.cc b/libzypp/zypp/base/StrMatcher.cc deleted file mode 100644 index 0315364..0000000 --- a/libzypp/zypp/base/StrMatcher.cc +++ /dev/null @@ -1,324 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/StrMatcher.cc - * -*/ -extern "C" -{ -#include -} - -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" - -#include "zypp/base/StrMatcher.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - // class Match - /////////////////////////////////////////////////////////////////// - - const int Match::_modemask = SEARCH_STRINGMASK; - const int Match::_flagmask = ~_modemask; - - // option flags - const Match Match::NOCASE (SEARCH_NOCASE); - - // sat::LookupAttr option flags - const Match Match::NO_STORAGE_SOLVABLE(SEARCH_NO_STORAGE_SOLVABLE); - const Match Match::SUB (SEARCH_SUB); - const Match Match::ARRAYSENTINEL (SEARCH_ARRAYSENTINEL); - const Match Match::DISABLED_REPOS (SEARCH_DISABLED_REPOS); - const Match Match::COMPLETE_FILELIST (SEARCH_COMPLETE_FILELIST); - const Match Match::SKIP_KIND (SEARCH_SKIP_KIND); - const Match Match::FILES (SEARCH_FILES); - const Match Match::CHECKSUMS (SEARCH_CHECKSUMS); - - Match::Mode Match::mode() const - { - switch ( modeval() ) - { - case 0: return NOTHING; break; - case SEARCH_STRING: return STRING; break; - case SEARCH_STRINGSTART: return STRINGSTART; break; - case SEARCH_STRINGEND: return STRINGEND; break; - case SEARCH_SUBSTRING: return SUBSTRING; break; - case SEARCH_GLOB: return GLOB; break; - case SEARCH_REGEX: return REGEX; break; - } - return OTHER; - } - - int Match::modeval( Mode mode_r ) - { - switch ( mode_r ) - { - case NOTHING: return 0; break; - case STRING: return SEARCH_STRING; break; - case STRINGSTART: return SEARCH_STRINGSTART; break; - case STRINGEND: return SEARCH_STRINGEND; break; - case SUBSTRING: return SEARCH_SUBSTRING; break; - case GLOB: return SEARCH_GLOB; break; - case REGEX: return SEARCH_REGEX; break; - case OTHER: return SEARCH_STRINGMASK; break; - } - return SEARCH_STRINGMASK; - } - - std::string Match::asString() const - { std::ostringstream str; str << *this; return str.str(); } - - std::ostream & operator<<( std::ostream & str, Match::Mode obj ) - { - switch ( obj ) - { -#define OUTS(V) case Match::V: return str << #V; break - OUTS( NOTHING ); - OUTS( STRING ); - OUTS( STRINGSTART ); - OUTS( STRINGEND ); - OUTS( SUBSTRING ); - OUTS( GLOB ); - OUTS( REGEX ); - OUTS( OTHER ); -#undef OUTS - } - return str << "Match::Mode::UNKNOWN"; - } - - std::ostream & operator<<( std::ostream & str, const Match & obj ) - { - if ( ! obj ) - return str << "NOTHING"; - - const char * sep = "|"; - Match::Mode mode( obj.mode() ); - switch ( mode ) - { - case Match::NOTHING: - sep = 0; // suppress 'NOTHING|' - break; - case Match::OTHER: - str << mode<<"("< _matcher; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( _search, _flags ); } - }; - - /** \relates StrMatcher::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const StrMatcher::Impl & obj ) - { - return str << "\"" << obj.searchstring() << "\"{" << obj.flags() << "}"; - } - - /////////////////////////////////////////////////////////////////// - // class StrMatcher - /////////////////////////////////////////////////////////////////// - - StrMatcher::StrMatcher() - : _pimpl( new Impl ) - {} - - StrMatcher::StrMatcher( const std::string & search_r ) - : _pimpl( new Impl( search_r, Match::STRING ) ) - {} - - StrMatcher::StrMatcher( const std::string & search_r, const Match & flags_r ) - : _pimpl( new Impl( search_r, flags_r ) ) - {} - - StrMatcher::StrMatcher( const std::string & search_r, const Match::Mode & flags_r ) - : _pimpl( new Impl( search_r, flags_r ) ) - {} - - StrMatcher::StrMatcher( const std::string & search_r, int flags_r ) - : _pimpl( new Impl( search_r, Match(flags_r) ) ) - {} - - void StrMatcher::compile() const - { return _pimpl->compile(); } - - bool StrMatcher::isCompiled() const - { return _pimpl->isCompiled(); } - - bool StrMatcher::doMatch( const char * string_r ) const - { return _pimpl->doMatch( string_r ); } - - const std::string & StrMatcher::searchstring() const - { return _pimpl->searchstring(); } - - void StrMatcher::setSearchstring( const std::string & string_r ) - { _pimpl->setSearchstring( string_r ); } - - void StrMatcher::setSearchstring( const std::string & string_r, const Match & flags_r ) - { - _pimpl->setSearchstring( string_r ); - _pimpl->setFlags( flags_r ); - } - - const Match & StrMatcher::flags() const - { return _pimpl->flags(); } - - void StrMatcher::setFlags( const Match & flags_r ) - { _pimpl->setFlags( flags_r ); } - - std::ostream & operator<<( std::ostream & str, const StrMatcher & obj ) - { return str << *obj._pimpl; } - - bool operator==( const StrMatcher & lhs, const StrMatcher & rhs ) - { - return ( lhs.flags() == rhs.flags() - && lhs.searchstring() == rhs.searchstring() ); - } - - bool operator<( const StrMatcher & lhs, const StrMatcher & rhs ) - { - if ( lhs.flags().get() != rhs.flags().get() ) - return ( lhs.flags().get() < rhs.flags().get() ); - - return ( lhs.searchstring() < rhs.searchstring() ); - } - -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/StrMatcher.h b/libzypp/zypp/base/StrMatcher.h deleted file mode 100644 index 6b4114a..0000000 --- a/libzypp/zypp/base/StrMatcher.h +++ /dev/null @@ -1,398 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/StrMatcher.h - * -*/ -#ifndef ZYPP_BASE_STRMATCHER_H -#define ZYPP_BASE_STRMATCHER_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Exception.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - /// \class Match - /// \brief String matching option flags as used e.g. by \ref StrMatcher. - /// - /// \code - /// Match mode( Match::GLOB | Match::NOCASE ); - /// \endcode - /////////////////////////////////////////////////////////////////// - class Match - { - private: - static const int _modemask; - static const int _flagmask; - - public: - /** Mode flags (mutual exclusive). */ - enum Mode - { - NOTHING, //!< Match nothing - STRING, //!< Excat matching - STRINGSTART, //!< Match at string start - STRINGEND, //!< Match at string end - SUBSTRING, //!< Match substring - GLOB, //!< Glob - REGEX, //!< Regular Expression - OTHER //!< Something else. - }; - - /** \name \ref Option flags - * Most flags are actually \ref sat::LookupAttr specific, as they tell - * how to retrieve the attribute values from solv-files. The plain - * \ref StrMatcher will ignore those flags and use the ones related - * to string matching only. - */ - //@{ - static const Match NOCASE; //!< If set, match case insensitive. - //@} - - /** \name \ref sat::LookupAttr option flags - * These flags are actually \ref sat::LookupAttr specific, as they tell - * how to retrieve the attribute values from solv-files. The plain - * \ref StrMatcher will ignore these flags and use the ones related - * to string matching only. - */ - //@{ - static const Match NO_STORAGE_SOLVABLE; //!< LookupAttr: internal - static const Match SUB; //!< LookupAttr: internal - static const Match ARRAYSENTINEL; //!< LookupAttr: internal - static const Match DISABLED_REPOS; //!< LookupAttr: internal - static const Match COMPLETE_FILELIST; //!< LookupAttr: internal - static const Match SKIP_KIND; //!< LookupAttr: skip any \c kind: prefix when looking at a \ref Solvable name. - static const Match FILES; //!< LookupAttr: match full path when matching in filelists, otherwise just the basenames. - static const Match CHECKSUMS; //!< LookupAttr: also look for matches in checksums - //@} - - public: - /** Default ctor \c 0 or \ref NOTHING. */ - Match() - : _val( 0 ) - {} - - /** Ctor from \ref Mode value. */ - Match( Mode val_r ) - : _val( modeval( val_r ) ) - {} - - /** Just in case one needs it. */ - explicit Match( int val_r ) - : _val( val_r ) - {} - - /** Evaluate in a boolean context ( != 0 ). */ - explicit operator bool() const - { return _val; } - - public: - /** Test whether \c all of the \a rhs bits are set (same mode if \a rhs has one). */ - bool test( const Match & rhs ) const - { return ( ( flagval() & rhs.flagval() ) == rhs.flagval() ) && ( !rhs.modeval() || rhs.modeval() == modeval() ); } - - /** Whether at least one of the \a rhs bits is set (or the same mode). */ - bool testAnyOf( const Match & rhs ) const - { return ( flagval() & rhs.flagval() ) || ( rhs.modeval() && rhs.modeval() == modeval() ); } - - /** Set all of the \a rhs bits (setting a new mode if \a rhs has one). */ - void set( const Match & rhs ) - { - if ( rhs.modeval() ) - _val = rhs._val | flagval(); // also set the rhs mode - else - _val |= rhs._val; // just set the flags - } - - /** Unset all of the \a rhs bits (unsets mode if the same as \a rhs). */ - void unset( const Match & rhs ) - { - if ( modeval() == rhs.modeval() ) - _val = flagval() & ~rhs.flagval(); // also unset mode - else - _val &= ~rhs.flagval(); // just unset falgs - } - - /** Depending on the value of \a onoff, set or unset flags. */ - void turn( const Match & rhs, bool onoff ) - { onoff ? set( rhs ) : unset( rhs ); } - - /** Add flags. */ - Match & operator|=( const Match & rhs ) - { set( rhs ); return *this; } - - /** Remove flags.*/ - Match & operator-=( const Match & rhs ) - { unset( rhs ); return *this; } - - public: - /** Return the \c mode part. */ - Mode mode() const; - - /** Return the \c flags part. */ - Match flags() const - { return Match( flagval() ); } - - public: - /** \name Low level integer representation. */ - //@{ - /** Return the integer representation. */ - int get() const { return _val; } - /** Return the modes integer representation. */ - int modeval() const { return _val & _modemask; } - /** Return the flags integer representation. */ - int flagval() const { return _val & _flagmask; } - //@} - - public: - /** \name Mode flag manip/query convenience. */ - //@{ - /** Whether this has mode \a rhs */ - bool isMode( Mode rhs ) const - { return modeval() == modeval( rhs ); } - /** Whether this has mode \ref STRING. */ - bool isModeString() const - { return isMode( STRING ); } - /** Whether this has mode \ref STRINGSTART. */ - bool isModeStringstart() const - { return isMode( STRINGSTART ); } - /** Whether this has mode \ref STRINGEND. */ - bool isModeStringend() const - { return isMode( STRINGEND ); } - /** Whether this has mode \ref SUBSTRING. */ - bool isModeSubstring() const - { return isMode( SUBSTRING ); } - /** Whether this has mode \ref GLOB. */ - bool isModeGlob() const - { return isMode( GLOB ); } - /** Whether this has mode \ref REGEX. */ - bool isModeRegex() const - { return isMode( REGEX ); } - - /** Set the mode part to \a rhs . */ - void setMode( Mode rhs ) - { _val = modeval( rhs ) | flagval(); } - /** Set the mode \ref STRING. */ - void setModeString() - { setMode( STRING ); } - /** Set the mode \ref STRINGSTART. */ - void setModeStringstart() - { setMode( STRINGSTART ); } - /** Set the mode \ref STRINGEND. */ - void setModeStringend() - { setMode( STRINGEND ); } - /** Set the mode \ref SUBSTRING. */ - void setModeSubstring() - { setMode( SUBSTRING ); } - /** Set the mode \ref GLOB. */ - void setModeGlob() - { setMode( GLOB ); } - /** Set the mode \ref REGEX. */ - void setModeRegex() - { setMode( REGEX ); } - //@} - - /** String representation. */ - std::string asString() const; - - private: - /** Numeric value for enum (short for Match(m).get()). */ - static int modeval( Mode mode_r ); - - private: - int _val; - }; - - /** \relates Match */ - inline bool operator==( const Match & lhs, const Match & rhs ) - { return lhs.get() == rhs.get(); } - /** \relates Match */ - inline bool operator!=( const Match & lhs, const Match & rhs ) - { return lhs.get() != rhs.get(); } - - /** \relates Match */ - inline Match operator|( const Match & lhs, const Match & rhs ) - { return Match(lhs) |= rhs; } - /** \relates Match \overload to disambiguate 'int|int'. */ - inline Match operator|( Match::Mode lhs, Match::Mode rhs ) - { return Match(lhs) |= rhs; } - - /** \relates Match */ - inline Match operator-( const Match & lhs, const Match & rhs ) - { return Match(lhs) -= rhs; } - /** \relates Match \overload to disambiguate 'int-int'. */ - inline Match operator-( Match::Mode lhs, Match::Mode rhs ) - { return Match(lhs) -= rhs; } - - /** \relates Match::Mode Stream output */ - std::ostream & operator<<( std::ostream & str, Match::Mode obj ); - - /** \relates Match Stream output */ - std::ostream & operator<<( std::ostream & str, const Match & obj ); - - /////////////////////////////////////////////////////////////////// - /// \class MatchException - /// \brief Exceptions thrown from attribute matching. - /////////////////////////////////////////////////////////////////// - struct MatchException : public Exception - { - /** Supplied message. */ - explicit MatchException( const std::string & msg_r ) : Exception( msg_r ) {} - }; - - /////////////////////////////////////////////////////////////////// - /// \class MatchUnknownModeException - /// \brief Unknown match mode. - /////////////////////////////////////////////////////////////////// - struct MatchUnknownModeException : public MatchException - { - /** Supplied message. */ - explicit MatchUnknownModeException( const std::string & msg_r ) : MatchException( msg_r ) {} - - /** Build message including the \a mode and optional the pattern string. */ - MatchUnknownModeException( const Match & mode_r, const std::string & msg_r = std::string() ); - }; - - /////////////////////////////////////////////////////////////////// - /// \class MatchInvalidRegexException - /// \brief Invalid regular expression (failed ::regcomp). - /////////////////////////////////////////////////////////////////// - struct MatchInvalidRegexException : public MatchException - { - /** Supplied message. */ - explicit MatchInvalidRegexException( const std::string & msg_r ) : MatchException( msg_r ) {} - - /** Build message including the \a regex and \c ::regcomp returncode (use \c 0 if unknown). */ - MatchInvalidRegexException( const std::string & regex_r, int regcomp_r ); - }; - - /////////////////////////////////////////////////////////////////// - /// \class StrMatcher - /// \brief String matching (STRING|SUBSTRING|GLOB|REGEX). - /// - /// Used by e.g. \ref PoolQuery and \ref LookupAttr for queries, - /// but it can also be used for matching arbitrary strings. - /// - /// \code - /// StrMatcher matches( "foo", Match::SUBSTRING ); - /// for_( it, stringlist.begin(), stringlist().end() ) - /// { - /// if ( matches( *it ) ) - /// cout << *it << " has substring 'foo'" << endl; - /// } - /// \endcode - /// - /// \Note Those flags are always set: REG_EXTENDED | REG_NOSUB | REG_NEWLINE - /////////////////////////////////////////////////////////////////// - class StrMatcher - { - friend std::ostream & operator<<( std::ostream & str, const StrMatcher & obj ); - - public: - typedef MatchException Exception; - - public: - /** Implementation */ - class Impl; - - public: - /** Default ctor matches nothing. */ - StrMatcher(); - - /** Ctor from string matches in \ref Match::STRING mode per default. */ - StrMatcher( const std::string & search_r ); - - /** Ctor taking string and \ref Match flags. */ - StrMatcher( const std::string & search_r, const Match & flags_r ); - - /** Ctor taking string and \ref Match::Mode. - * Needed because we want them to be treated as \ref Match, - * and not as \ref int as the compiler woud do. - */ - StrMatcher( const std::string & search_r, const Match::Mode & flags_r ); - - /** Low level interface wraps \a flags into \ref Match. */ - StrMatcher( const std::string & search_r, int flags_r ); - - /** Evaluate in a boolean context ( ! searchstring().empty() ). */ - explicit operator bool() const - { return !searchstring().empty(); } - - public: - /** Return whether string matches. - * You can use it with any class that impements \c c_str. - * (\c std::string, \ref Pathname, \ref IdString, ...). - * \Note \c NULL never matches. - */ - template - bool operator()( const _Tp & string_r ) const - { return doMatch( string_r.c_str() ); } - /** \overload */ - bool operator()( const char * string_r ) const - { return doMatch( string_r ); } - - public: - /** The current searchstring. */ - const std::string & searchstring() const; - - /** Set a new searchstring. */ - void setSearchstring( const std::string & string_r ); - - /** Set a new searchstring and flags. */ - void setSearchstring( const std::string & string_r, const Match & flags_r ); - - /** The current search flags. */ - const Match & flags() const; - - /** Set new search flags. */ - void setFlags( const Match & flags_r ); - - public: - /** Compile the pattern e.g. in case of \c REGEX. - * \throws MatchUnknownModeException If the \ref Match flag more than - * one mode bit set. - * \throws MatchInvalidRegexException If \ref Match::REGEX is set - * and \ref searchstring is not a valid regular expression. - */ - void compile() const; - - /** Whether the \ref StrMatcher is already compiled. */ - bool isCompiled() const; - - /** Return whether string matches. - * Compiles the \ref StrMatcher if this was not yet done. - * \throws MatchException Any of the exceptions thrown by \ref StrMatcher::compile. - */ - bool doMatch( const char * string_r ) const; - - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - - /** \relates StrMatcher Stream output */ - std::ostream & operator<<( std::ostream & str, const StrMatcher & obj ); - - /** \relates StrMatcher */ - bool operator==( const StrMatcher & lhs, const StrMatcher & rhs ); - - /** \relates StrMatcher */ - inline bool operator!=( const StrMatcher & lhs, const StrMatcher & rhs ) - { return !( lhs == rhs ); } - - /** \relates StrMatcher Arbitrary order for std::container. */ - bool operator<( const StrMatcher & lhs, const StrMatcher & rhs ); - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_STRMATCHER_H diff --git a/libzypp/zypp/base/String.cc b/libzypp/zypp/base/String.cc deleted file mode 100644 index 666e79a..0000000 --- a/libzypp/zypp/base/String.cc +++ /dev/null @@ -1,411 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/String.cc - * -*/ -#include -#include - -#include - -#include "zypp/base/String.h" -#include "zypp/base/LogTools.h" - -using std::string; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace str - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : form - ** FUNCTION TYPE : std::string - */ - std::string form( const char * format, ... ) - { - SafeBuf safe; - - va_list ap; - va_start( ap, format ); - vasprintf( &safe._buf, format, ap ); - va_end( ap ); - - return safe.asString(); - } - - /****************************************************************** - ** - ** FUNCTION NAME : strerror - ** FUNCTION TYPE : std::string - */ - std::string strerror( int errno_r ) - { - return form( "(%d)%s", errno_r, ::strerror( errno_r ) ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : strToTrue - ** FUNCTION TYPE : bool - */ - bool strToTrue( const C_Str & str ) - { - std::string t( toLower( str ) ); - return( t == "1" - || t == "yes" - || t == "true" - || t == "on" - || t == "+" - || strtonum( str ) - ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : strToFalse - ** FUNCTION TYPE : bool - */ - bool strToFalse( const C_Str & str ) - { - std::string t( toLower( str ) ); - return ! ( t == "0" - || t == "no" - || t == "false" - || t == "off" - || t == "-" - ); - } - - /////////////////////////////////////////////////////////////////// - // Hexencode - /////////////////////////////////////////////////////////////////// - namespace { - /** What's not decoded. */ - inline bool heIsAlNum( char ch ) - { - return ( ( 'a' <= ch && ch <= 'z' ) - ||( 'A' <= ch && ch <= 'Z' ) - ||( '0' <= ch && ch <= '9' ) ); - } - /** Hex-digit to number or -1. */ - inline int heDecodeCh( char ch ) - { - if ( '0' <= ch && ch <= '9' ) - return( ch - '0' ); - if ( 'A' <= ch && ch <= 'F' ) - return( ch - 'A' + 10 ); - if ( 'a' <= ch && ch <= 'f' ) - return( ch - 'a' + 10 ); - return -1; - } - } - - std::string hexencode( const C_Str & str_r ) - { - static const char *const hdig = "0123456789ABCDEF"; - std::string res; - res.reserve( str_r.size() ); - for ( const char * it = str_r.c_str(); *it; ++it ) - { - if ( heIsAlNum( *it ) ) - { - res += *it; - } - else - { - res += '%'; - res += hdig[(unsigned char)(*it)/16]; - res += hdig[(unsigned char)(*it)%16]; - } - } - return res; - } - - std::string hexdecode( const C_Str & str_r ) - { - std::string res; - res.reserve( str_r.size() ); - for_( it, str_r.c_str(), str_r.c_str()+str_r.size() ) - { - if ( *it == '%' ) - { - int d1 = heDecodeCh( *(it+1) ); - if ( d1 != -1 ) - { - int d2 = heDecodeCh( *(it+2) ); - if ( d2 != -1 ) - { - res += (d1<<4)|d2; - it += 2; - continue; - } - } - } - // verbatim if no %XX: - res += *it; - } - return res; - } - /////////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : toLower - ** FUNCTION TYPE : std::string - */ - std::string toLower( const std::string & s ) - { - if ( s.empty() ) - return s; - - std::string ret( s ); - for ( std::string::size_type i = 0; i < ret.length(); ++i ) - { - if ( isupper( ret[i] ) ) - ret[i] = static_cast(tolower( ret[i] )); - } - return ret; - } - - /****************************************************************** - ** - ** FUNCTION NAME : toUpper - ** FUNCTION TYPE : std::string - */ - std::string toUpper( const std::string & s ) - { - if ( s.empty() ) - return s; - - std::string ret( s ); - for ( std::string::size_type i = 0; i < ret.length(); ++i ) - { - if ( islower( ret[i] ) ) - ret[i] = static_cast(toupper( ret[i] )); - } - return ret; - } - - /****************************************************************** - ** - ** FUNCTION NAME : trim - ** FUNCTION TYPE : std::string - */ - std::string trim( const std::string & s, const Trim trim_r ) - { - if ( s.empty() || trim_r == NO_TRIM ) - return s; - - std::string ret( s ); - - if ( trim_r & L_TRIM ) - { - std::string::size_type p = ret.find_first_not_of( " \t\n" ); - if ( p == std::string::npos ) - return std::string(); - - ret = ret.substr( p ); - } - - if ( trim_r & R_TRIM ) - { - std::string::size_type p = ret.find_last_not_of( " \t\n" ); - if ( p == std::string::npos ) - return std::string(); - - ret = ret.substr( 0, p+1 ); - } - - return ret; - } - - /****************************************************************** - ** - ** FUNCTION NAME : stripFirstWord - ** FUNCTION TYPE : std::string - */ - std::string stripFirstWord( std::string & line, const bool ltrim_first ) - { - if ( ltrim_first ) - line = ltrim( line ); - - if ( line.empty() ) - return line; - - std::string ret; - std::string::size_type p = line.find_first_of( " \t" ); - - if ( p == std::string::npos ) { - // no ws on line - ret = line; - line.erase(); - } else if ( p == 0 ) { - // starts with ws - // ret remains empty - line = ltrim( line ); - } - else { - // strip word and ltim line - ret = line.substr( 0, p ); - line = ltrim( line.erase( 0, p ) ); - } - return ret; - } - - /****************************************************************** - ** - ** FUNCTION NAME : stripLastWord - ** FUNCTION TYPE : std::string - */ - std::string stripLastWord( std::string & line, const bool rtrim_first ) - { - if ( rtrim_first ) - line = rtrim( line ); - - if ( line.empty() ) - return line; - - std::string ret; - std::string::size_type p = line.find_last_of( " \t" ); - - if ( p == std::string::npos ) { - // no ws on line - ret = line; - line.erase(); - } else if ( p == line.size()-1 ) { - // ends with ws - // ret remains empty - line = rtrim( line ); - } - else { - // strip word and rtim line - ret = line.substr( p+1 ); - line = rtrim( line.erase( p ) ); - } - return ret; - } - - std::string gsub( const std::string & str_r, const std::string & from_r, const std::string & to_r ) - { - std::string ret( str_r ); - return replaceAll( ret, from_r, to_r ); - } - - std::string & replaceAll( std::string & str_r, const std::string & from_r, const std::string & to_r ) - { - if ( ! from_r.empty() ) - { - std::string::size_type pos = 0; - while ( (pos = str_r.find( from_r, pos )) != std::string::npos ) - { - str_r.replace( pos, from_r.size(), to_r ); - pos += to_r.size(); - - if ( pos >= str_r.length() ) - break; - } - } - return str_r; - } - - std::string gsubFun( const std::string & str_r, const std::string & from_r, function to_r ) - { - std::string ret( str_r ); - return replaceAllFun( ret, from_r, to_r ); - } - - std::string & replaceAllFun( std::string & str_r, const std::string & from_r, function to_r ) - { - if ( ! from_r.empty() ) - { - std::string::size_type pos = 0; - while ( (pos = str_r.find( from_r, pos )) != std::string::npos ) - { - std::string to( to_r() ); - str_r.replace( pos, from_r.size(), to ); - pos += to.size(); - - if ( pos >= str_r.length() ) - break; - } - } - return str_r; - } - - std::string escape( const C_Str & str_r, const char sep_r ) - { - std::vector buf; - for_( s, str_r.c_str(), s+str_r.size() ) - { - switch ( *s ) - { - case '"': - case '\'': - case '\\': - buf.push_back( '\\' ); - buf.push_back( *s ); - break; - default: - if ( *s == sep_r ) - buf.push_back( '\\' ); - buf.push_back( *s ); - } - } - return std::string( buf.begin(), buf.end() ); - } - - std::string getline( std::istream & str, const Trim trim_r ) - { - return trim( receiveUpTo( str, '\n' ), trim_r ); - } - - std::string getline( std::istream & str, bool trim_r ) - { - return trim( receiveUpTo( str, '\n' ), trim_r?TRIM:NO_TRIM ); - } - - std::string receiveUpTo( std::istream & str, const char delim_r, bool returnDelim_r ) - { - std::ostringstream datas; - do { - char ch; - if ( str.get( ch ) ) - { - if ( ch != delim_r ) - { - datas.put( ch ); - } - else - { - if ( returnDelim_r ) - datas.put( ch ); - break; // --> delimiter found - } - } - else - { - // clear fail bit if we read data before reaching EOF - if ( str.eof() && datas.tellp() ) - str.clear( std::ios::eofbit ); - break; // --> no consumable data. - } - } while ( true ); - return datas.str(); - } - - ///////////////////////////////////////////////////////////////// - } // namespace str - /////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/String.h b/libzypp/zypp/base/String.h deleted file mode 100644 index e69a106..0000000 --- a/libzypp/zypp/base/String.h +++ /dev/null @@ -1,1023 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/String.h - * -*/ -#ifndef ZYPP_BASE_STRING_H -#define ZYPP_BASE_STRING_H - -#include - -#include -#include -#include -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" - - -/////////////////////////////////////////////////////////////////// -namespace boost -{ - /** A formater with (N)o (A)rgument (C)heck. - * It won't complain about missing or excess arguments. Sometimes - * usefull when dealing with translations or classes providing a - * default formater. - */ - inline format formatNAC( const std::string & string_r ) { - using namespace boost::io; - format fmter( string_r ); - fmter.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) ); - return fmter; - } -} // namespace boost -namespace zypp { using boost::formatNAC; } -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /** Request a human readable (translated) string representation of _Tp [_Tp.asUserString()] - * Classes may implement a default as member function. - */ - template - std::string asUserString( const _Tp & val_r ) - { return val_r.asUserString(); } - -}// namespace zypp -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - struct MessageString : public std::string - { - MessageString() {} - MessageString( const char * str_r ) : std::string( str_r ? str_r : "" ) {} - MessageString( const std::string & str_r ) : std::string( str_r ) {} - // boost::format, std::ostringstream, str::Str ... - template - MessageString( const _Str & str_r ) : std::string( str_r.str() ) {} - }; - - /** Convenience \c char* constructible from \c std::string and \c char*, - * it maps \c (char*)0 to an empty string. - * - * \code - * bool hasPrefix( const std::string & str_r, const std::string & prefix_r ) - * { return( ::strncmp( str_r.c_str(), prefix_r.c_str(), prefix_r.size() ) == 0 ); } - * \endcode - * - * Called with a plain \c char* as argument, the \c std::string is created form - * for nothing. The implementation actually does not use the \c std::string. - * - * Best would be to implement \c hasPrefix for each combination of \c char* - * and \c std::string arguments: - * - * \code - * bool hasPrefix( const std::string & str_r, const std::string & prefix_r ) - * { return( ::strncmp( str_r.c_str(), prefix_r.c_str(), prefix_r.size() ) == 0 ); } - * - * bool hasPrefix( const std::string & str_r, const char * prefix_r ) - * { return( !prefix_r || ::strncmp( str_r.c_str(), prefix_r, ::strlen(prefix_r) ) == 0 ); } - * - * bool hasPrefix( const char * str_r, const std::string & prefix_r ) - * { return( str_r ? ::strncmp( str_r, prefix_r.c_str(), prefix_r.size() ) == 0 : prefix_r.empty() ); } - * - * bool hasPrefix( const char * str_r, const char * prefix_r ) - * { return( str && prefix_r ? ::strncmp( str_r, prefix_r, ::strlen(prefix_r) ) == 0 - * : !((str_r && *str_r) || (prefix_r && *prefix_r)); } - * \endcode - * - * This is where \ref C_Str can help. Constructible from \c std::string and \c char*, - * it \e reduces the \c std::string to it's \c char*. At the same time it converts - * \c (char*)0 into an \c "" string. - * - * \code - * bool hasPrefix( const C_Str & str_r, const C_Str & prefix_r ) - * { return( ::strncmp( str_r, prefix_r, prefix_r.size() ) == 0 ); } - * \endcode - */ - class C_Str - { - public: - typedef std::string::size_type size_type; - - public: - C_Str() : _val( 0 ), _sze( 0 ) {} - C_Str( char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {} - C_Str( const char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {} - C_Str( const std::string & str_r ) : _val( str_r.c_str() ), _sze( str_r.size() ) {} - - public: - bool isNull() const { return !_val; } - bool empty() const { return !(_val && *_val); } - size_type size() const - { - if ( _sze == std::string::npos ) - { _sze = _val ? ::strlen( _val ) : 0; } - return _sze; - }; - - operator const char *() const { return c_str(); } - const char * c_str() const { return _val ? _val : ""; } - - private: - const char *const _val; - mutable size_type _sze; - }; - - /** \relates C_Str Stream output */ - inline std::ostream & operator<<( std::ostream & str, const C_Str & obj ) - { return str << obj.c_str(); } - - /////////////////////////////////////////////////////////////////// - /** String related utilities and \ref ZYPP_STR_REGEX. - \see \ref ZYPP_STR_REGEX - */ - - namespace str - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /** - * Global asString() that works with std::string too - */ - inline std::string asString( const std::string &t ) - { return t; } - -#ifndef SWIG // Swig treats it as syntax error - inline std::string asString( std::string && t ) - { return std::move(t); } -#endif - - inline std::string asString( const char * t ) - { return t; } - - inline std::string asString( char * t ) - { return t; } - - template - inline std::string asString( const _T &t ) - { return t.asString(); } - - template - inline std::string asString( const intrusive_ptr<_T> &p ) - { return p->asString(); } - - template - inline std::string asString( const weak_ptr<_T> &p ) - { return p->asString(); } - - template<> - inline std::string asString( const bool &t ) - { return t ? "true" : "false"; } - - /////////////////////////////////////////////////////////////////// - /** Printf style construction of std::string. */ - std::string form( const char * format, ... ) - __attribute__ ((format (printf, 1, 2))); - - /////////////////////////////////////////////////////////////////// - /** Return string describing the \a error_r code. - * Like ::strerror, but the numerical value is included in - * the string as well. - */ - std::string strerror( int errno_r ); - - /////////////////////////////////////////////////////////////////// - /** Assert \c free called for allocated char *. - * \code - * ... - * SafeBuf safe; - * vasprintf( &safe._buf, format, ap ); - * return safe.asString(); - * \endcode - * - * \ingroup g_RAII - */ - struct SafeBuf - { - char * _buf; - SafeBuf() : _buf( 0 ) {} - ~SafeBuf() { if ( _buf ) free( _buf ); } - std::string asString() const - { return _buf ? std::string(_buf) : std::string(); } - }; - - /////////////////////////////////////////////////////////////////// - /** Convenient building of std::string via std::ostream::operator<<. - * Basically this is an \ref ostringstream which is autocenvertible - * into a \ref string. - * \code - * void fnc( const std::string & txt_r ); - * fnc( str::Str() << "Hello " << 13 ); - * - * std::string txt( str::Str() << 45 ); - * \endcode - */ - struct Str - { - template - Str & operator<<( const _Tp & val ) - { _str << val; return *this; } - - operator std::string() const - { return _str.str(); } - - std::string str() const - { return _str.str(); } - - std::ostream & stream() - { return _str; } - - void clear() - { _str.str( std::string() ); } - - std::ostringstream _str; - }; - - inline std::ostream & operator<<( std::ostream & str, const Str & obj ) - { return str << (std::string)obj; } - - /////////////////////////////////////////////////////////////////// - /** \name String representation of number. - * - * Optional second argument sets the minimal string width (' ' padded). - * Negative values will cause the number to be left adjusted within the string. - * - * Default width is 0. - * \code - * numstring(42) -> "42" - * numstring(42, 4) -> " 42" - * numstring(42,-4) -> "42 " - * \endcode - **/ - //@{ - inline std::string numstring( char n, int w = 0 ) { return form( "%*hhd", w, n ); } - inline std::string numstring( unsigned char n, int w = 0 ) { return form( "%*hhu", w, n ); } - inline std::string numstring( short n, int w = 0 ) { return form( "%*hd", w, n ); } - inline std::string numstring( unsigned short n, int w = 0 ) { return form( "%*hu", w, n ); } - inline std::string numstring( int n, int w = 0 ) { return form( "%*d", w, n ); } - inline std::string numstring( unsigned n, int w = 0 ) { return form( "%*u", w, n ); } - inline std::string numstring( long n, int w = 0 ) { return form( "%*ld", w, n ); } - inline std::string numstring( unsigned long n, int w = 0 ) { return form( "%*lu", w, n ); } - inline std::string numstring( long long n, int w = 0 ) { return form( "%*lld", w, n ); } - inline std::string numstring( unsigned long long n, int w = 0 ) { return form( "%*llu", w, n ); } - - template<> inline std::string asString( const char & t ) { return numstring( t ); } - template<> inline std::string asString( const unsigned char & t ) { return numstring( t ); } - template<> inline std::string asString( const short & t ) { return numstring( t ); } - template<> inline std::string asString( const unsigned short & t ) { return numstring( t ); } - template<> inline std::string asString( const int & t ) { return numstring( t ); } - template<> inline std::string asString( const unsigned & t ) { return numstring( t ); } - template<> inline std::string asString( const long & t ) { return numstring( t ); } - template<> inline std::string asString( const unsigned long & t ) { return numstring( t ); } - template<> inline std::string asString( const long long & t ) { return numstring( t ); } - template<> inline std::string asString( const unsigned long long & t ) { return numstring( t ); } - //@} - - /////////////////////////////////////////////////////////////////// - /** \name String representation of number as hex value with leading '0x'. - * Optional second argument sets the minimal - * string width (0 padded). Negative values will cause the number to be left adjusted - * within the string. Default width is 10 (4 for char). - *

-     * hexstring(42)           -> "0x0000002a"
-     * hexstring(42, 4)        -> "0x2a"
-     * hexstring(42,-4)        -> "0x2a"
-     * 
- **/ - //@{ - inline std::string hexstring( char n, int w = 4 ) { return form( "%#0*hhx", w, n ); } - inline std::string hexstring( unsigned char n, int w = 4 ) { return form( "%#0*hhx", w, n ); } - inline std::string hexstring( short n, int w = 10 ){ return form( "%#0*hx", w, n ); } - inline std::string hexstring( unsigned short n, int w = 10 ){ return form( "%#0*hx", w, n ); } - inline std::string hexstring( int n, int w = 10 ){ return form( "%#0*x", w, n ); } - inline std::string hexstring( unsigned n, int w = 10 ){ return form( "%#0*x", w, n ); } - inline std::string hexstring( long n, int w = 10 ){ return form( "%#0*lx", w, n ); } - inline std::string hexstring( unsigned long n, int w = 10 ){ return form( "%#0*lx", w, n ); } - inline std::string hexstring( long long n, int w = 0 ) { return form( "%#0*llx", w, n ); } - inline std::string hexstring( unsigned long long n, int w = 0 ) { return form( "%#0*llx", w, n ); } - //@} - - /////////////////////////////////////////////////////////////////// - /** \name String representation of number as octal value with leading '0'. - * Optional second argument sets the minimal - * string width (0 padded). Negative values will cause the number to be left adjusted - * within the string. Default width is 5 (4 for char). - *
-     * octstring(42)           -> "00052"
-     * octstring(42, 4)        -> "0052"
-     * octstring(42,-4)        -> "052 "
-     * 
- **/ - //@{ - inline std::string octstring( char n, int w = 4 ) { return form( "%#0*hho", w, n ); } - inline std::string octstring( unsigned char n, int w = 4 ) { return form( "%#0*hho", w, n ); } - inline std::string octstring( short n, int w = 5 ) { return form( "%#0*ho", w, n ); } - inline std::string octstring( unsigned short n, int w = 5 ) { return form( "%#0*ho", w, n ); } - inline std::string octstring( int n, int w = 5 ) { return form( "%#0*o", w, n ); } - inline std::string octstring( unsigned n, int w = 5 ) { return form( "%#0*o", w, n ); } - inline std::string octstring( long n, int w = 5 ) { return form( "%#0*lo", w, n ); } - inline std::string octstring( unsigned long n, int w = 5 ) { return form( "%#0*lo", w, n ); } - inline std::string octstring( long long n, int w = 0 ) { return form( "%#0*llo", w, n ); } - inline std::string octstring( unsigned long long n, int w = 0 ) { return form( "%#0*llo", w, n ); } - //@} - - /////////////////////////////////////////////////////////////////// - /** Parsing numbers from string. - */ - //@{ - /** String to integer type determined by template arg. - * \note Only specializations are defined. - * \code - * time_t t = strtonum( "42" ); - * \endcode - */ - template - _It strtonum( const C_Str & str ); - - template<> - inline short strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); } - template<> - inline int strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); } - template<> - inline long strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); } - template<> - inline long long strtonum( const C_Str & str ) { return ::strtoll ( str, NULL, 0 ); } - - template<> - inline unsigned short strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); } - template<> - inline unsigned strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); } - template<> - inline unsigned long strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); } - template<> - inline unsigned long long strtonum( const C_Str & str ) { return ::strtoull( str, NULL, 0 ); } - - /** String to integer type detemined 2nd function arg \a i. - * \code - * time_t t; strtonum( "42", t ); - * \endcode - */ - template - inline _It strtonum( const C_Str & str, _It & i ) - { return i = strtonum<_It>( str ); } - //@} - - /////////////////////////////////////////////////////////////////// - /** Parsing boolean from string. - */ - //@{ - /** Return \c true if str is 1, true, yes, on (or a nonzero number). */ - bool strToTrue( const C_Str & str ); - - /** Return \c false if str is 0, false, no, off. */ - bool strToFalse( const C_Str & str ); - - /** Parse \c str into a bool depending on the default value. - * If the \c default is true, look for a legal \c false string. - * If the \c default is false, look for a legal \c true string. - */ - inline bool strToBool( const C_Str & str, bool default_r ) - { return( default_r ? strToFalse( str ) : strToTrue( str ) ); } - - /** Parse \c str into a bool if it's a legal \c true or \c false string. - * If \c str is not a recognized \c true or \c false string, \a return_r - * is left unchanged. - */ - inline bool strToBoolNodefault( const C_Str & str, bool & return_r ) - { - if ( strToTrue( str ) ) return (return_r = true); - if ( !strToFalse( str ) ) return (return_r = false); - return return_r; - } - - //@} - - /** - * \short Return a string with all occurrences of \c from_r replaced with \c to_r. - */ - std::string gsub( const std::string & str_r, const std::string & from_r, const std::string & to_r ); - - /** \overload A function is called on demand to compute each replacement value. - */ - std::string gsubFun( const std::string & str_r, const std::string & from_r, function to_r ); - - /** - * \short Replace all occurrences of \c from_r with \c to_r in \c str_r (inplace). - * A reference to \c str_r is also returned for convenience. - */ - std::string & replaceAll( std::string & str_r, const std::string & from_r, const std::string & to_r ); - - /** \overload A function is called on demand to compute each replacement value. - */ - std::string & replaceAllFun( std::string & str_r, const std::string & from_r, function to_r ); - - /** Enhance readability: insert gaps at regular distance - * \code - * // no gaps - * Key Fingerprint: 22C07BA534178CD02EFE22AAB88B2FD43DBDC284 - * // gapify 8 - * Key Fingerprint: 22C07BA5 34178CD0 2EFE22AA B88B2FD4 3DBDC284 - * // gapify 4 - * Key Fingerprint: 22C0 7BA5 3417 8CD0 2EFE 22AA B88B 2FD4 3DBD C284 - * // gapify 4, '-' - * Key Fingerprint: 22C0-7BA5-3417-8CD0-2EFE-22AA-B88B-2FD4-3DBD-C284 - * \endcode - */ - inline std::string gapify( std::string inp_r, std::string::size_type gap_r = 1, char gapchar = ' ' ) - { - if ( gap_r && inp_r.size() > gap_r ) - { - inp_r.reserve( inp_r.size() + (inp_r.size()-1)/gap_r ); - for ( std::string::size_type pos = gap_r; pos < inp_r.size(); pos += gap_r+1 ) - inp_r.insert( pos, 1, gapchar ); - } - return inp_r; - } - - /////////////////////////////////////////////////////////////////// - /** \name Split. */ - //@{ - /** Split \a line_r into words. - * Any sequence of characters in \a sepchars_r is treated as - * delimiter. The words are passed to OutputIterator \a result_r. - * \code - * std::vector words; - * str::split( "some line", std::back_inserter(words) ) - * \endcode - * - */ - template - unsigned split( const C_Str & line_r, - _OutputIterator result_r, - const C_Str & sepchars_r = " \t" ) - { - const char * beg = line_r; - const char * cur = beg; - // skip leading sepchars - while ( *cur && ::strchr( sepchars_r, *cur ) ) - ++cur; - unsigned ret = 0; - for ( beg = cur; *beg; beg = cur, ++result_r, ++ret ) - { - // skip non sepchars - while( *cur && !::strchr( sepchars_r, *cur ) ) - ++cur; - // build string - *result_r = std::string( beg, cur-beg ); - // skip sepchars - while ( *cur && ::strchr( sepchars_r, *cur ) ) - ++cur; - } - return ret; - } - - /** Split \a line_r into words with respect to escape delimeters. - * Any sequence of characters in \a sepchars_r is treated as - * delimiter if not inside \c "" or \c '' or escaped by \c \. - * - * \li A non-quoted backslash (\) preserves the literal value of the next character. - * \li Enclosing characters in single quotes preserves the literal value of each - * character within the quotes. A single quote may not occur between single - * quotes, even when preceded by a backslash. - * \li Enclosing characters in double quotes preserves the literal value of all - * characters within the quotes, with the exception of \c \. The backslash - * retains its special meaning only when followed by \c " or \c \. - * - * The words are passed to OutputIterator \a result_r. - * - * \see \ref splitEscaped - * - * \code - * std::vector words; - * str::splitEscaped( "some line", std::back_inserter(words) ) - * \endcode - * - * \code - * example splitted strings - * normal line -> 2 elements ( "normal", "line" ) - * escaped\ line -> 1 element(escaped line) - * "quoted line" -> 1 element same as above - * 'quoted line' -> 1 element same as above - * "escaped quote\"" -> 1 element (escaped quote") - * - * \param line_r The string to parse. - * \param result_r - * \param sepchars_r String of separator characters. - * \param withEmpty Whether to include empty fields between separators in the result. - * - * \endcode - */ - template - unsigned splitEscaped( const C_Str & line_r, - _OutputIterator result_r, - const C_Str & sepchars_r = " \t", - bool withEmpty = false) - { - const char * beg = line_r; - const char * cur = beg; - unsigned ret = 0; - - // skip leading sepchars - while ( *cur && ::strchr( sepchars_r, *cur ) ) - { - ++cur; - if (withEmpty) - { - *result_r = ""; - ++ret; - } - } - - // there were only sepchars in the string - if (!*cur && withEmpty) - { - *result_r = ""; - return ++ret; - } - - // after the leading sepchars - enum class Quote { None, Slash, Single, Double, DoubleSlash }; - std::vector buf; - Quote quoting = Quote::None; - for ( beg = cur; *beg; beg = cur, ++result_r, ++ret ) - { - // read next value until unquoted sepchar - buf.clear(); - quoting = Quote::None; - do { - switch ( quoting ) - { - case Quote::None: - switch ( *cur ) - { - case '\\': quoting = Quote::Slash; break; - case '\'': quoting = Quote::Single; break; - case '"': quoting = Quote::Double; break; - default: buf.push_back( *cur ); break; - } - break; - - case Quote::Slash: - buf.push_back( *cur ); - quoting = Quote::None; - break; - - case Quote::Single: - switch ( *cur ) - { - case '\'': quoting = Quote::None; break; - default: buf.push_back( *cur ); break; - } - break; - - case Quote::Double: - switch ( *cur ) - { - case '\"': quoting = Quote::None; break; - case '\\': quoting = Quote::DoubleSlash; break; - default: buf.push_back( *cur ); break; - } - break; - - case Quote::DoubleSlash: - switch ( *cur ) - { - case '\"': /*fallthrough*/ - case '\\': buf.push_back( *cur ); break; - default: - buf.push_back( '\\' ); - buf.push_back( *cur ); - break; - } - quoting = Quote::Double; - break; - } - ++cur; - } while ( *cur && ( quoting != Quote::None || !::strchr( sepchars_r, *cur ) ) ); - *result_r = std::string( buf.begin(), buf.end() ); - - - // skip sepchars - if ( *cur && ::strchr( sepchars_r, *cur ) ) - ++cur; - while ( *cur && ::strchr( sepchars_r, *cur ) ) - { - ++cur; - if (withEmpty) - { - *result_r = ""; - ++ret; - } - } - // the last was a separator => one more field - if ( !*cur && withEmpty && ::strchr( sepchars_r, *(cur-1) ) ) - { - *result_r = ""; - ++ret; - } - } - return ret; - } - - /** Split \a line_r into fields. - * Any single character in \a sepchars_r is treated as a - * field separator unless \-escaped. The words are passed - * to OutputIterator. - * \a result_r. - * \code - * "" -> words 0 - * ":" -> words 2 ||| - * "a" -> words 1 |a| - * ":a" -> words 2 ||a| - * "a:" -> words 2 |a|| - * ":a:" -> words 3 ||a|| - * - * \endcode - * - * \code - * std::vector words; - * str::split( "some line", std::back_inserter(words) ) - * \endcode - * - */ - template - unsigned splitFields( const C_Str & line_r, - _OutputIterator result_r, - const C_Str & sepchars_r = ":" ) - { - const char * beg = line_r; - const char * cur = beg; - unsigned ret = 0; - for ( beg = cur; *beg; beg = cur, ++result_r ) - { - // skip non sepchars - while( *cur && !::strchr( sepchars_r, *cur ) ) - { - if ( *cur == '\\' && *(cur+1) ) - ++cur; - ++cur; - } - // build string - *result_r = std::string( beg, cur-beg ); - ++ret; - // skip sepchar - if ( *cur ) - { - ++cur; - if ( ! *cur ) // ending with sepchar - { - *result_r = std::string(); // add final empty field - ++ret; - break; - } - } - } - return ret; - } - - /** - * Split \a line_r into fields handling also escaped separators. - * - * \see splitFields() - * \see splitEscaped() - */ - template - unsigned splitFieldsEscaped( const C_Str & line_r, - _OutputIterator result_r, - const C_Str & sepchars_r = ":" ) - { - return - splitEscaped( line_r, result_r, sepchars_r, true /* withEmpty */ ); - } - - //@} - - /////////////////////////////////////////////////////////////////// - /** \name Join. */ - //@{ - /** Join strings using separator \a sep_r (defaults to BLANK). */ - template - std::string join( _Iterator begin, _Iterator end, - const C_Str & sep_r = " " ) - { - std::string res; - for ( _Iterator iter = begin; iter != end; ++ iter ) - { - if ( iter != begin ) - res += sep_r; - res += asString(*iter); - } - return res; - } - - /** Join strings using separator \a sep_r (defaults to BLANK). */ - template - std::string join( const _Container & cont_r, - const C_Str & sep_r = " " ) - { return join( cont_r.begin(), cont_r.end(), sep_r ); } - - /** Join strings using separator \a sep_r, quoting or escaping the values. - * Separator defaults to BLANK. Use \ref splitEscaped to restore the - * values. - */ - template - std::string joinEscaped( _Iterator begin, _Iterator end, - const char sep_r = ' ' ) - { - std::vector buf; - for ( _Iterator iter = begin; iter != end; ++ iter ) - { - if ( iter != begin ) - buf.push_back( sep_r ); - - if ( iter->empty() ) - { - // empty string goes "" - buf.push_back( '"' ); - buf.push_back( '"' ); - } - else - { - std::string toadd( asString(*iter) ); - for_( ch, toadd.begin(), toadd.end() ) - { - switch ( *ch ) - { - case '"': - case '\'': - case '\\': - buf.push_back( '\\' ); - buf.push_back( *ch ); - break; - default: - if ( *ch == sep_r ) - buf.push_back( '\\' ); - buf.push_back( *ch ); - } - } - } - } - return std::string( buf.begin(), buf.end() ); - } - //@} - - - /////////////////////////////////////////////////////////////////// - /** \name Indent. */ - //@{ - /** Indent by string [" "] optionally wrap. - * Prints nothing for an empty string. Asserts a trainling '\n' on - * the last line. Optionally wrap lines at ' ' at a given length. - */ - inline std::ostream & printIndented( std::ostream & str, const std::string & text_r, const std::string & indent_r = " ", unsigned maxWitdh_r = 0 ) - { - if ( maxWitdh_r ) - { - if ( indent_r.size() >= maxWitdh_r ) - maxWitdh_r = 0; // nonsense: indent larger than line witdh - else - maxWitdh_r -= indent_r.size(); - } - unsigned width = 0; - for ( const char * e = text_r.c_str(), * s = e; *e; s = ++e ) - { - for ( ; *e && *e != '\n'; ++e ) ;/*searching*/ - width = e-s; - if ( maxWitdh_r && width > maxWitdh_r ) - { - // must break line - width = maxWitdh_r; - for ( e = s+width; e > s && *e != ' '; --e ) ;/*searching*/ - if ( e > s ) - width = e-s; // on a ' ', replaced by '\n' - else - e = s+width-1; // cut line; - } - str << indent_r; - str.write( s, width ); - str << "\n"; - if ( !*e ) // on '\0' - break; - } - return str; - } - /** \overload Indent by number of chars [' '] optionally wrap. */ - inline std::ostream & printIndented( std::ostream & str, const std::string & text_r, unsigned indent_r, char indentch_r = ' ', unsigned maxWitdh_r = 0 ) - { return printIndented( str, text_r, std::string( indent_r, indentch_r ), maxWitdh_r ); } - /** \overload Indent by number of chars [' '] wrap. */ - inline std::ostream & printIndented( std::ostream & str, const std::string & text_r, unsigned indent_r, unsigned maxWitdh_r, char indentch_r = ' ' ) - { return printIndented( str, text_r, std::string( indent_r, indentch_r ), maxWitdh_r ); } - - /** Prefix lines by string computed by function taking line begin/end [std::string(const char*, const char*)] - * Prints nothing for an empty string. Asserts a trainling '\n' on the last line. - */ - inline std::ostream & autoPrefix( std::ostream & str, const std::string & text_r, function fnc_r ) - { - for ( const char * e = text_r.c_str(); *e; ++e ) - { - const char * s = e; - for ( ; *e && *e != '\n'; ++e ) /*searching*/; - str << fnc_r( s, e ); - str.write( s, e-s ); - str << "\n"; - if ( !*e ) // on '\0' - break; - } - return str; - } - /** \overload Prefix lines by string generated by function [std::string()] */ - inline std::ostream & autoPrefix0( std::ostream & str, const std::string & text_r, function fnc_r ) - { - auto wrap = [&fnc_r]( const char*, const char* )-> std::string { - return fnc_r(); - }; - return autoPrefix( str, text_r, wrap ); - } - //@} - /////////////////////////////////////////////////////////////////// - /** \name Escape. */ - //@{ - /** - * Escape desired character \a c using a backslash. - * - * For use when printing \a c separated values, and where - * \ref joinEscaped() is too heavy. - */ - std::string escape( const C_Str & str_r, const char c = ' ' ); - - /** Escape \a next_r and append it to \a str_r using separator \a sep_r. */ - inline void appendEscaped( std::string & str_r, const C_Str & next_r, const char sep_r = ' ' ) - { - if ( ! str_r.empty() ) - str_r += sep_r; - if ( next_r.empty() ) - str_r += "\"\""; - else - str_r += escape( next_r, sep_r ); - } - - //! \todo unsecape() - - //@} - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - /** \name Hexencode. - * Encode all characters other than [a-zA-Z0-9] as %XX. - * This includes the % character itself, which becomes %25. - */ - //@{ - /** Encode all characters other than [a-zA-Z0-9] as %XX. - * This includes the % character itself, which becomes %25. - */ - std::string hexencode( const C_Str & str_r ); - /** Decode hexencoded %XX sequences. */ - std::string hexdecode( const C_Str & str_r ); - //@} - /////////////////////////////////////////////////////////////////// - - /** \name Case conversion. */ - //@{ - /** Return lowercase version of \a s - * \todo improve - */ - std::string toLower( const std::string & s ); - /** \overload */ - inline std::string toLower( const char * s ) - { return( s ? toLower( std::string(s) ) : std::string() ); } - - /** Return uppercase version of \a s - * \todo improve - */ - std::string toUpper( const std::string & s ); - /** \overload */ - inline std::string toUpper( const char * s ) - { return( s ? toUpper( std::string(s) ) : std::string() ); } - //@} - - - /** \name Case insensitive comparison. */ - //@{ - inline int compareCI( const C_Str & lhs, const C_Str & rhs ) - { return ::strcasecmp( lhs, rhs ); } - //@} - - /** \name Locate substring. */ - //@{ - /** Locate substring case sensitive. */ - inline bool contains( const C_Str & str_r, const C_Str & val_r ) - { return ::strstr( str_r, val_r ); } - /** Locate substring case insensitive. */ - inline bool containsCI( const C_Str & str_r, const C_Str & val_r ) - { return ::strcasestr( str_r, val_r ); } - //@} - - /////////////////////////////////////////////////////////////////// - /** \name Trimming whitepace. - * \todo optimize l/r trim. - */ - //@{ - /** To define how to trim. */ - enum Trim { - NO_TRIM = 0x00, - L_TRIM = 0x01, - R_TRIM = 0x02, - TRIM = (L_TRIM|R_TRIM) - }; - - std::string trim( const std::string & s, const Trim trim_r = TRIM ); - - inline std::string ltrim( const std::string & s ) - { return trim( s, L_TRIM ); } - - inline std::string rtrim( const std::string & s ) - { return trim( s, R_TRIM ); } - //@} - - std::string stripFirstWord( std::string & line, const bool ltrim_first = true ); - - std::string stripLastWord( std::string & line, const bool rtrim_first = true ); - - /** Return stream content up to (but not returning) the next newline. - * \see \ref receiveUpTo - */ - std::string getline( std::istream & str, bool trim = false ); - - /** Return stream content up to (but not returning) the next newline. - * \see \ref receiveUpTo - */ - std::string getline( std::istream & str, const Trim trim_r ); - - /** Return stream content up to the next ocurrence of \c delim_r or EOF - * \c delim_r, if found, is always read from the stream. Whether it is - * also returned in the string depends on \c returnDelim_r. - * If the stream status is \c good, \c delim_r was found in the stream. - * If we reached EOF while looking for \c delim_r, \c eof is set; and - * also \c fail, if we did not read any data before. - */ - std::string receiveUpTo( std::istream & str, const char delim_r, bool returnDelim_r = false ); - - /////////////////////////////////////////////////////////////////// - - /** \name String prefix/suffix handling. - */ - //@{ - /** Return whether \a str_r has prefix \a prefix_r. */ - inline bool hasPrefix( const C_Str & str_r, const C_Str & prefix_r ) - { return( ::strncmp( str_r, prefix_r, prefix_r.size() ) == 0 ); } - - /** Strip a \a prefix_r from \a str_r and return the resulting string. */ - inline std::string stripPrefix( const C_Str & str_r, const C_Str & prefix_r ) - { return( hasPrefix( str_r, prefix_r ) ? str_r + prefix_r.size() : str_r.c_str() ); } - - /** Return whether \a str_r has suffix \a suffix_r. */ - inline bool hasSuffix( const C_Str & str_r, const C_Str & suffix_r ) - { return( str_r.size() >= suffix_r.size() && ::strncmp( str_r + str_r.size() - suffix_r.size() , suffix_r, suffix_r.size() ) == 0 ); } - - /** Strip a \a suffix_r from \a str_r and return the resulting string. */ - inline std::string stripSuffix( const C_Str & str_r, const C_Str & suffix_r ) - { - if ( hasSuffix( str_r, suffix_r ) ) - return std::string( str_r, str_r.size() - suffix_r.size() ); - return str_r.c_str(); - } - /** Return size of the common prefix of \a lhs and \a rhs. */ - inline std::string::size_type commonPrefix( const C_Str & lhs, const C_Str & rhs ) - { - const char * lp = lhs.c_str(); - const char * rp = rhs.c_str(); - std::string::size_type ret = 0; - while ( *lp == *rp && *lp != '\0' ) - { ++lp, ++rp, ++ret; } - return ret; - } - - /** alias for \ref hasPrefix */ - inline bool startsWith( const C_Str & str_r, const C_Str & prefix_r ) - { return hasPrefix( str_r, prefix_r ); } - /** alias for \ref hasSuffix */ - inline bool endsWith( const C_Str & str_r, const C_Str & prefix_r ) - { return hasSuffix( str_r, prefix_r ); } - //@} - } // namespace str - /////////////////////////////////////////////////////////////////// - - // drag into zypp:: namespace - using str::asString; - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_STRING_H diff --git a/libzypp/zypp/base/Sysconfig.cc b/libzypp/zypp/base/Sysconfig.cc deleted file mode 100644 index 0d11ec4..0000000 --- a/libzypp/zypp/base/Sysconfig.cc +++ /dev/null @@ -1,155 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Sysconfig.cc - * -*/ - -#include -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/StrMatcher.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/Pathname.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" - -#include "zypp/base/Sysconfig.h" - -using namespace std; -using namespace zypp::base; - -namespace zypp { - namespace base { - namespace sysconfig { - - map read( const Pathname & _path ) - { - DBG << "Load '" << _path << "'" << endl; - map ret; - - string line; - ifstream in( _path.asString().c_str() ); - if ( in.fail() ) { - WAR << "Unable to load '" << _path << "'" << endl; - return ret; - } - - while( getline( in, line ) ) { - if ( *line.begin() != '#' ) { - - string::size_type pos = line.find( '=', 0 ); - - if ( pos != string::npos ) { - - string key = str::trim( line.substr( 0, pos ) ); - string value = str::trim( line.substr( pos + 1, line.length() - pos - 1 ) ); - - if ( value.length() >= 2 - && *(value.begin()) == '"' - && *(value.rbegin()) == '"' ) - { - value = value.substr( 1, value.length() - 2 ); - } - if ( value.length() >= 2 - && *(value.begin()) == '\'' - && *(value.rbegin()) == '\'' ) - { - value = value.substr( 1, value.length() - 2 ); - } - XXX << "KEY: '" << key << "' VALUE: '" << value << "'" << endl; - ret[key] = value; - - } // '=' found - - } // not comment - - } // while getline - MIL << "done reading '" << _path << "'" << endl; - return ret; - } - - bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r ) - { - if ( key_r.empty() ) - { - WAR << "Empty key in write " << path_r << endl; - return false; - } - - PathInfo pi( path_r ); - if ( ! pi.isFile() ) - ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(ENOENT) ) ); - if ( ! pi.userMayRW() ) - ZYPP_THROW( Exception( str::Str() << path_r << ": " << Errno(EACCES) ) ); - - bool found = false; - filesystem::TmpFile tmpf( filesystem::TmpFile::makeSibling( path_r ) ); - { - StrMatcher matches( "^[ \t]*"+key_r+"[ \t]*=", Match::REGEX ); - std::ofstream o( tmpf.path().c_str() ); - iostr::forEachLine( InputStream( path_r ), - [&]( int num_r, std::string line_r )->bool - { - if ( !found && matches( line_r ) ) - { - o << key_r << '=' << val_r << endl; - found = true; - MIL << path_r << ": " << key_r << '=' << val_r << " changed on line " << num_r << endl; - } - else - o << line_r << endl; - return true; - } ); - if ( !found ) - { - if ( newcomment_r.empty() ) - { - WAR << path_r << ": " << key_r << '=' << val_r << " can not be added (no comment provided)." << endl; - } - else - { - std::vector lines; - str::split( newcomment_r, std::back_inserter(lines), "\r\n" ); - o << endl; - for ( auto line : lines ) - { - if ( line[0] != '#' ) - o << "# "; - o << line << endl; - } - o << key_r << '=' << val_r << endl; - found = true; - MIL << path_r << ": " << key_r << '=' << val_r << " appended. " << endl; - } - } - - if ( ! o ) - ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(EIO) ) ); - } - - // If everything is fine, exchange the files: - int res = exchange( tmpf.path(), path_r ); - if ( res ) - { - ZYPP_THROW( Exception( str::Str() << tmpf.path() << ": " << Errno(res) ) ); - } - return found; - } - - bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r, const std::string & newcomment_r ) - { - return write( path_r, key_r, str::Str() << '"' << str::escape( val_r, '"' )<< '"', newcomment_r ); - } - - } // namespace sysconfig - } // namespace base -} // namespace zypp diff --git a/libzypp/zypp/base/Sysconfig.h b/libzypp/zypp/base/Sysconfig.h deleted file mode 100644 index c9ae7cb..0000000 --- a/libzypp/zypp/base/Sysconfig.h +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Sysconfig.h - * -*/ -#ifndef ZYPP_BASE_SYSCONFIG_H -#define ZYPP_BASE_SYSCONFIG_H - -#include -#include -#include "zypp/Pathname.h" - -namespace zypp { - namespace base { - namespace sysconfig { - - /** Read sysconfig file \a path_r and return (key,valye) pairs. */ - std::map read( const Pathname & _path ); - - /** Add or change a value in sysconfig file \a path_r. - * - * If \a key_r already exists, only the \a val_r is changed accordingly. - * - * In case \a key_r is not yet present in the file, a new entry may be created - * at the end of the file, using the lines in \a newcomment_r as comment - * block. If \a newcomment_r is not provided or empty, a new value is not - * created and \c false is returned. - * - * \returns \c TRUE if an entry was changed or created. - * - * \throws Exception if \a path_r can not be read or written. - * - * \note \a val_r is written as it is. The caller is responsible for escaping and - * enclosing in '"', in case this is needed (\see \ref writeStringVal and \ref str::escape). - * - * \note Lines in \a newcomment_r which do not already start with a '#', - * are prefixes with "# ". - * - * \code - * ## Type: string - * ## Default: "" - * # - * # A multiline description of - * # the options purpose. - * # - * KEY="value" - * \endcode - */ - bool write( const Pathname & path_r, const std::string & key_r, const std::string & val_r, - const std::string & newcomment_r = std::string() ); - - /** Convenience to add or change a string-value in sysconfig file \a path_r. - * - * \a val_r is expected to be a plain string value, so it is propery escaped and enclosed in - * double quotes before it is written to the sysconfig file \a path_r. - * - * \see \ref write - */ - bool writeStringVal( const Pathname & path_r, const std::string & key_r, const std::string & val_r, - const std::string & newcomment_r = std::string() ); - - } // namespace sysconfig - } // namespace base -} // namespace zypp - -#endif // ZYPP_BASE_SYSCONFIG_H diff --git a/libzypp/zypp/base/Tr1hash.h b/libzypp/zypp/base/Tr1hash.h deleted file mode 100644 index 00747c9..0000000 --- a/libzypp/zypp/base/Tr1hash.h +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Tr1hash.h - * -*/ -#ifndef ZYPP_BASE_TR1HASH_H -#define ZYPP_BASE_TR1HASH_H - -#include -#include -#include - -/** Define hash function for id based classes. - * Class has to provide a method \c id() retuning a unique number. - * \code - * // in global namespace define: - * ZYPP_DEFINE_ID_HASHABLE( ::zypp::sat::Sovable ) - * \endcode - */ -#define ZYPP_DEFINE_ID_HASHABLE(C) \ -namespace std { namespace tr1 { \ - template struct hash; \ - template<> struct hash \ - { \ - size_t operator()( const C & __s ) const \ - { return __s.id(); } \ - }; \ -}} - -/////////////////////////////////////////////////////////////////// -namespace std -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace tr1 - { ///////////////////////////////////////////////////////////////// - - /** clone function for RW_pointer */ - template - inline unordered_set<_D> * rwcowClone( const std::tr1::unordered_set<_D> * rhs ) - { return new std::tr1::unordered_set<_D>( *rhs ); } - - /** clone function for RW_pointer */ - template - inline std::tr1::unordered_map<_K,_V> * rwcowClone( const std::tr1::unordered_map<_K,_V> * rhs ) - { return new std::tr1::unordered_map<_K,_V>( *rhs ); } - - ///////////////////////////////////////////////////////////////// - } // namespace tr1 - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace std -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_TR1HASH_H diff --git a/libzypp/zypp/base/Unit.cc b/libzypp/zypp/base/Unit.cc deleted file mode 100644 index 264a1d8..0000000 --- a/libzypp/zypp/base/Unit.cc +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Unit.cc - * -*/ -#include "zypp/base/String.h" - -#include "zypp/base/Unit.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - std::string Unit::form( double val_r, - const std::string & symbol_r, - unsigned field_width_r, - unsigned unit_width_r, - unsigned prec_r ) - { - std::string ret = str::form( "%*.*f", field_width_r, prec_r, val_r ); - if ( unit_width_r ) - { - ret += str::form( " %*s", unit_width_r, symbol_r.c_str() ); - } - return ret; - } - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/Unit.h b/libzypp/zypp/base/Unit.h deleted file mode 100644 index 5fb7ac8..0000000 --- a/libzypp/zypp/base/Unit.h +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Unit.h - * -*/ -#ifndef ZYPP_BASE_UNIT_H -#define ZYPP_BASE_UNIT_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace base - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Unit - // - /** Simple handling of Units. - * - * Unit stores factor and symbol, and a precision value for printing. - * \ref form builds a string from a value according to the format - * specification. - * \code - * static const Unit B( 1, "B", 0 ); - * static const Unit K( 1024, "K", 1 ); - * static const Unit M( 1048576, "M", 1 ); - * static const Unit G( 1073741824, "G", 2 ); - * static const Unit T( 1099511627776, "T", 3 ); - * \endcode - */ - class Unit - { - public: - typedef long long ValueType; - - /** Default ctor */ - Unit() - : _factor( 1 ) - , _prec( 0 ) - {} - - /** ctor */ - Unit( ValueType factor_r, std::string symbol_r, unsigned prec_r ) - : _factor( factor_r ) - , _symbol( symbol_r ) - , _prec( prec_r ) - {} - - ValueType factor() const - { return _factor; } - - const std::string & symbol() const - { return _symbol; } - - unsigned prec() const - { return _prec; } - - /** Build string representation of \a val_r. */ - std::string form( ValueType val_r, - unsigned field_width_r = 0, - unsigned unit_width_r = 1 ) const - { return form( val_r, field_width_r, unit_width_r, _prec ); } - - std::string form( ValueType val_r, - unsigned field_width_r, - unsigned unit_width_r, - unsigned prec_r ) const - { return form( double(val_r)/_factor, _symbol, - field_width_r, unit_width_r, prec_r ); } - - - static std::string form( double val_r, - const std::string & symbol_r, - unsigned field_width_r, - unsigned unit_width_r, - unsigned prec_r ); - - private: - ValueType _factor; - std::string _symbol; - unsigned _prec; - }; - /////////////////////////////////////////////////////////////////// - - - ///////////////////////////////////////////////////////////////// - } // namespace base - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_UNIT_H diff --git a/libzypp/zypp/base/UserRequestException.cc b/libzypp/zypp/base/UserRequestException.cc deleted file mode 100644 index 707bafb..0000000 --- a/libzypp/zypp/base/UserRequestException.cc +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/UserRequestException.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/base/UserRequestException.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : UserRequestException::UserRequestException - // METHOD TYPE : Ctor - // - UserRequestException::UserRequestException( const std::string & msg_r ) - : Exception( msg_r ), _kind( UNSPECIFIED ) - {} - - UserRequestException::UserRequestException( const std::string & msg_r, const Exception & history_r ) - : Exception( msg_r, history_r ), _kind( UNSPECIFIED ) - {} - - UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r ) - : Exception( msg_r ), _kind( kind_r ) - {} - - UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r ) - : Exception( msg_r, history_r ), _kind( kind_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : UserRequestException::dumpOn - // METHOD TYPE : std::ostream & - // - std::ostream & UserRequestException::dumpOn( std::ostream & str ) const - { - switch ( _kind ) - { - case UNSPECIFIED: str << "UNSPECIFIED"; break; - case IGNORE: str << "IGNORE"; break; - case SKIP: str << "SKIP"; break; - case RETRY: str << "RETRY"; break; - case ABORT: str << "ABORT"; break; - // no default ! - } - return str << " request: " << msg(); - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/base/UserRequestException.h b/libzypp/zypp/base/UserRequestException.h deleted file mode 100644 index c4103b2..0000000 --- a/libzypp/zypp/base/UserRequestException.h +++ /dev/null @@ -1,107 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/UserRequestException.h - * -*/ -#ifndef ZYPP_BASE_USERREQUESTEXCEPTION_H -#define ZYPP_BASE_USERREQUESTEXCEPTION_H - -#include - -#include "zypp/base/Exception.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : UserRequestException - // - /** Base for exceptions caused by explicit user request. - * - * Use the derived convenience classes to throw exceptions - * of a certain kind. - * \code - * ProgressData ticks( makeProgressData( input_r ) ); - * ticks.sendTo( fnc_r ); - * ticks.toMin(); // start sending min (0) - * - * iostr::EachLine line( input_r ); - * for( ; line; line.next() ) - * { - * // process the line - * - * if ( ! ticks.set( input_r.stream().tellg() ) ) - * ZYPP_THROW( AbortRequestException( "" ) ); - * } - * \endcode - * \code - * // either this way - * catch ( const AbortRequestException & excpt_r ) - * { - * ... - * } - * - * // or that - * catch ( const UserRequestException & excpt_r ) - * { - * switch ( excpt_r.kind() ) - * { - * case UserRequestException::ABORT: - * ... - * break; - * } - * } - * \endcode - */ - class UserRequestException : public Exception - { - public: - enum Kind { UNSPECIFIED, IGNORE, SKIP, RETRY, ABORT }; - public: - explicit - UserRequestException( const std::string & msg_r = std::string() ); - UserRequestException( const std::string & msg_r, const Exception & history_r ); - explicit - UserRequestException( Kind kind_r, const std::string & msg_r = std::string() ); - UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r ); - public: - Kind kind() const - { return _kind; } - protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; - private: - Kind _kind; - }; - /////////////////////////////////////////////////////////////////// - - /** Convenience macro to declare more specific PluginScriptExceptions. */ -#define declException( EXCP, KIND ) \ - struct EXCP : public UserRequestException { \ - explicit \ - EXCP( const std::string & msg_r = std::string() ) \ - : UserRequestException( KIND, msg_r ) \ - {} \ - EXCP( const std::string & msg_r, const Exception & history_r ) \ - : UserRequestException( KIND, msg_r, history_r ) \ - {} \ - } - - declException( IgnoreRequestException, IGNORE ); - declException( SkipRequestException, SKIP ); - declException( RetryRequestException, RETRY ); - declException( AbortRequestException, ABORT ); - -#undef declException - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_USERREQUESTEXCEPTION_H diff --git a/libzypp/zypp/base/WatchFile.h b/libzypp/zypp/base/WatchFile.h deleted file mode 100644 index b731f6e..0000000 --- a/libzypp/zypp/base/WatchFile.h +++ /dev/null @@ -1,90 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/WatchFile.h - * -*/ -#ifndef ZYPP_BASE_WATCHFILE_H -#define ZYPP_BASE_WATCHFILE_H - -#include - -#include "zypp/PathInfo.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WatchFile - // - /** Remember a files attributes to detect content changes. - * - * Repeatedly call \ref hasChanged to check whether the content has - * changed since the last call. Creation or deletion of the file will - * be reported as change as well. - * - * Per default the ctor stats the file, so \ref hasChanged will detect - * changes done after \ref WatchFile was created. - * - * You may omit the initial stat by passing \c NO_INIT as second argument - * to the ctor. \ref WatchFile will behave as if the file did not exist - * at the time \ref WatchFile was created. - * - * \code - * static WatchFile sysconfigFile( "/etc/sysconfig/SuSEfirewall2", - * WatchFile::NO_INIT ); - * if ( sysconfigFile.hasChanged() ) - * { - * // reload the file... - * } - * \endcode - */ - class WatchFile - { - public: - enum Initial { NO_INIT, INIT }; - - public: - /** */ - WatchFile( const Pathname & path_r = Pathname(), - Initial mode = INIT ) - : _path( path_r ) - { - PathInfo pi( mode == INIT ? path_r : Pathname() ); - _size = pi.size(); - _mtime = pi.mtime(); - } - - const Pathname & path() const - { return _path; } - - bool hasChanged() - { - PathInfo pi( _path ); - if ( _size != pi.size() || _mtime != pi.mtime() ) - { - _size = pi.size(); - _mtime = pi.mtime(); - return true; - } - return false; - } - - private: - Pathname _path; - off_t _size; - time_t _mtime; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_BASE_WATCHFILE_H diff --git a/libzypp/zypp/base/Xml.h b/libzypp/zypp/base/Xml.h deleted file mode 100644 index 717a9f3..0000000 --- a/libzypp/zypp/base/Xml.h +++ /dev/null @@ -1,196 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/base/Xml.h - * -*/ -#ifndef ZYPP_BASE_XML_H -#define ZYPP_BASE_XML_H - -#include -#include -#include -#include -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/String.h" -#include "zypp/parser/xml/XmlEscape.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace xmlout - { - using xml::escape; - using xml::unescape; - - /** \relates NodeAttr NODE ATTRIBUTE representation of types [asString] */ - template - std::string asXmlNodeAttr( const _Tp & val_r ) - { return asString( val_r ); } - - /////////////////////////////////////////////////////////////////// - /// \class NodeAttr - /// \brief (Key, Value) string pair of XML node attributes - struct NodeAttr : public std::pair - { - typedef std::pair Pair; - - template - NodeAttr( std::string key_r, const _Type & val_r ) - : Pair( std::move(key_r), asXmlNodeAttr(val_r) ) - {} - - NodeAttr( std::string key_r, std::string val_r ) - : Pair( std::move(key_r), std::move(val_r) ) - {} - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class Node - /// \brief RAII writing a nodes start/end tag - /// \code - /// { - /// Node node( std::cout, "node", { "attr", "val" } ); // - /// *node << "write nodes body...." - /// } // - /// \endcode - /// \note If the \ref optionalContent flag is passed to the \c ctor, the start - /// node is kept open, until the first call to \ref operator*. The start node - /// is closed before returning the stream. - /// \code - /// { - /// Node node( std::cout, "node", Node::optionalContent, { "attr", "val" } ); - /// // - /// { - /// Node node( std::cout, "node", Node::optionalContent, { "attr", "val" } ); - /// // write nodes body... - /// } // - /// \endcode - /// - /// \note If the nodename is empty or starts with an \c !, a comment is written. - /// - struct Node - { - NON_COPYABLE_BUT_MOVE( Node ); - typedef NodeAttr Attr; - - struct OptionalContentType {}; ///< Ctor arg type - static constexpr OptionalContentType optionalContent = OptionalContentType(); - - /** Ctor taking nodename and attribute list */ - Node( std::ostream & out_r, std::string name_r, const std::initializer_list & attrs_r = {} ) - : _out( out_r ), _name( std::move(name_r) ), _hasContent( true ) - { printStart( attrs_r ); } - - /** Convenience ctor for one attribute pair */ - Node( std::ostream & out_r, std::string name_r, Attr attr_r ) - : Node( out_r, std::move(name_r), { attr_r } ) - {} - - /** Optional content ctor taking nodename and attribute list */ - Node( std::ostream & out_r, std::string name_r, OptionalContentType, const std::initializer_list & attrs_r = {} ) - : _out( out_r ), _name( std::move(name_r) ), _hasContent( false ) - { printStart( attrs_r ); } - - /** Optional content Convenience ctor for one attribute pair */ - Node( std::ostream & out_r, std::string name_r, OptionalContentType, Attr attr_r ) - : Node( out_r, std::move(name_r), optionalContent, { attr_r } ) - {} - - /** Dtor wrting end tag */ - ~Node() - { - if ( _name.empty() ) - _out << "-->"; - else - { - if ( _hasContent ) - _out << ""; - else - _out << "/>"; - } - } - - /** Return the output stream */ - std::ostream & operator*() - { - if ( ! _hasContent ) - { - _hasContent = true; - if ( _name.empty() ) - _out << "|"; - else - _out << ">"; - } - return _out; - } - - private: - void printStart( const std::initializer_list & attrs_r ) - { - if ( _name.empty() || _name[0] == '!' ) - { - _out << " ", node_r ); - ParseDefConsumeRedirect::startSubnode( node_r ); - } - - virtual void doneSubnode( const Node & node_r ) - { - debuglog( "<--- ", node_r ); - ParseDefConsumeRedirect::doneSubnode( node_r ); - } - - void debuglog( const char *const tag_r, const Node & node_r ) - { - if ( ParseDef::_debug ) - DBG << tag_r << node_r << endl; - } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDef::Impl - // - /** ParseDef implementation. - * \todo Check using share_ptr_from_this for parent in addNode. - */ - class ParseDef::Impl - { - friend std::ostream & operator<<( std::ostream & str, const ParseDef::Impl & obj ); - public: - typedef shared_ptr ImplPtr; - typedef std::map SubNodes; - - public: - Impl( const std::string & name_r, Mode mode_r, const shared_ptr & target_r = shared_ptr() ) - : _name( name_r ) - , _mode( mode_r ) - , _parent( NULL ) - { - if ( target_r ) - _callback.setRedirect( target_r ); - } - - ~Impl() - { - for ( SubNodes::iterator it = _subnodes.begin(); it != _subnodes.end(); ++it ) - { - it->second->_parent = NULL; - } - } - - bool isOptional() const - { return Traits::ModeBits(_mode).isEqual( Traits::BIT_OPTIONAL ); } - - bool isMandatory() const - { return Traits::ModeBits(_mode).isEqual( Traits::BIT_MANDTAORY ); } - - bool singleDef() const - { return Traits::ModeBits(_mode).isEqual( Traits::BIT_ONCE ); } - - bool multiDef() const - { return Traits::ModeBits(_mode).isEqual( Traits::BIT_MULTIPLE ); } - - public: - void addNode( const ImplPtr & subnode_r ); - - ImplPtr getNode( const std::string & name_r ) const - { - SubNodes::const_iterator it = _subnodes.find( name_r ); - if ( it != _subnodes.end() ) - return it->second; - return ImplPtr(); - } - - void take( Reader & reader_r ); - - private: - /** Skip the current node. - * \pre Current node must be XML_READER_TYPE_ELEMENT. - * \post At the corresponding end node. - (XML_READER_TYPE_END_ELEMENT or atill at the same node, - if it'a an empty element <node />). - * \return last call to xml::Reader::nextNode. - * \throws ParseDefValidateException if no matching end node found. - */ - bool skipNode( Reader & reader_r ); - - std::string exstr( const std::string & what_r, const Impl & impl_r ) const - { - std::ostringstream str; - str << impl_r << ": " << what_r; - return str.str(); - } - std::string exstr( const std::string & what_r, const Impl & impl_r, const Reader & reader_r ) const - { - std::ostringstream str; - str << impl_r << ": " << what_r << " |reading " << *reader_r; - return str.str(); - } - - public: - std::string _name; - Mode _mode; - DefaultIntegral _visited; - - Impl * _parent; - SubNodes _subnodes; - ParseDefImplConsume _callback; - - DefaultIntegral _parseDepth; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDef::Impl::addNode - // METHOD TYPE : void - // - void ParseDef::Impl::addNode( const ImplPtr & subnode_r ) - { - std::pair res - = _subnodes.insert( std::make_pair( subnode_r->_name, subnode_r ) ); - - if ( ! res.second ) - { - ZYPP_THROW( ParseDefBuildException( exstr("Multiple definiton of subnode "+subnode_r->_name, *this) ) ); - } - if ( res.first->second->_parent ) - { - ZYPP_THROW( ParseDefBuildException( exstr("Can not reparent subnode "+subnode_r->_name, *this) ) ); - } - res.first->second->_parent = this; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDef::Impl::take - // METHOD TYPE : void - // - void ParseDef::Impl::take( Reader & reader_r ) - { - if ( reader_r->nodeType() != XML_READER_TYPE_ELEMENT ) - { - if ( reader_r->depth() == 0 ) - { - // on the verry first level we skip any initial whitespace and comments... - do { - // advance to next node - if ( ! reader_r.nextNode() ) - { - ZYPP_THROW( ParseDefValidateException( exstr( "Unexpected EOF ", *this ) ) ); - } - } while( reader_r->nodeType() != XML_READER_TYPE_ELEMENT ); - } - else - { - ZYPP_THROW( ParseDefValidateException( exstr("Expected ELEMENT", *this, reader_r) ) ); - } - } - if ( reader_r->name() != _name ) - { - ZYPP_THROW( ParseDefValidateException( exstr("Wrong ELEMENT name", *this, reader_r) ) ); - } - if ( _visited >= 1 && ! multiDef() ) - { - ZYPP_THROW( ParseDefValidateException( exstr("Multiple definitions", *this, reader_r) ) ); - } - - ++_visited; // Accepted to parse - DtorReset x( _parseDepth, -1 ); - _parseDepth = reader_r->depth(); - - // Parse attributes - _callback.start( *reader_r ); - - // Get content up to end node - // Empty element () has no separate end node, so - // there's nothing to parse. - if ( ! reader_r->isEmptyElement() ) - { - // For non empty elements () parse known nodes - // text and cdata elelments skip unknown nodes. - for ( bool done = false; ! done ; /*advance in inside loop*/) - { - // advance to next node - if ( ! reader_r.nextNode() ) - { - ZYPP_THROW( ParseDefValidateException( exstr( "Unexpected EOF ", *this ) ) ); - } - - switch ( reader_r->nodeType() ) - { - case XML_READER_TYPE_ELEMENT: - // Parse or skip unknown. Anyway reader is located at the - // corresponding end node, or an exception was thrown. - { - ImplPtr sub( getNode( reader_r->name().asString() ) ); - if ( sub ) - { - _callback.startSubnode( *reader_r ); - sub->take( reader_r ); - _callback.doneSubnode( *reader_r ); - } - else - { - if ( ParseDef::_debug ) - WAR << "Skip unknown node " << *reader_r << " in "<< *this << endl; - skipNode( reader_r ); - } - } - break; - - case XML_READER_TYPE_END_ELEMENT: - // This must be the corresponding end node! - if ( reader_r->depth() == _parseDepth - && reader_r->name() == _name ) - { - done = true; - } - else - { - ZYPP_THROW( ParseDefValidateException( exstr("unexpected END_ELEMENT name", *this, reader_r) ) ); - } - break; - - case XML_READER_TYPE_TEXT: - // collect or skip - _callback.text( *reader_r ); - break; - - case XML_READER_TYPE_CDATA: - // collect or skip - _callback.cdata( *reader_r ); - break; - - default: - //DBG << exstr("SKIP ", *this, reader_r) << endl; - break; - } - } - } - - // Parsing complete. Check whether all mandatory nodes were - // present. Finally position behind the end node. - for ( SubNodes::iterator it = _subnodes.begin(); it != _subnodes.end(); ++it ) - { - if ( ! it->second->_visited && it->second->isMandatory() ) - { - ZYPP_THROW( ParseDefValidateException( exstr("Mandatory ELEMENT missing", *(it->second), reader_r) ) ); - } - it->second->_visited = 0; // reset to be ready for an other visit to this!! - } - - _callback.done( *reader_r ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDef::Impl::skipNode - // METHOD TYPE : void - // - bool ParseDef::Impl::skipNode( xml::Reader & reader_r ) - { - if ( ! reader_r.seekToEndNode( reader_r->depth(), - reader_r->name().asString() ) ) - { - ZYPP_THROW( ParseDefValidateException - ( exstr( str::form( "EOF while looking for [%d] <\\%s>", - reader_r->depth(), - reader_r->name().c_str() ), - *this ) ) ); - } - return true; - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ParseDef::Impl & obj ) - { - return str << "ParseDef(" << obj._name - << ", " << obj._mode - << ", visits " << obj._visited - << ")"; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDef - // - /////////////////////////////////////////////////////////////////// - - bool ParseDef::_debug = false; - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDef::ParseDef - // METHOD TYPE : Ctor - // - ParseDef::ParseDef( const std::string & name_r, Mode mode_r ) - : _pimpl( new Impl( name_r, mode_r ) ) - {} - - ParseDef::ParseDef( const std::string & name_r, Mode mode_r, const shared_ptr & target_r ) - : _pimpl( new Impl( name_r, mode_r, target_r ) ) - {} - - ParseDef::ParseDef( const shared_ptr & pimpl_r ) - : _pimpl( pimpl_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDef::~ParseDef - // METHOD TYPE : Dtor - // - ParseDef::~ParseDef() - {} - - const std::string & ParseDef::name() const - { return _pimpl->_name; } - - ParseDef::Mode ParseDef::mode() const - { return _pimpl->_mode; } - - bool ParseDef::isOptional() const - { return _pimpl->isOptional(); } - - bool ParseDef::isMandatory() const - { return _pimpl->isMandatory(); } - - bool ParseDef::singleDef() const - { return _pimpl->singleDef(); } - - bool ParseDef::multiDef() const - { return _pimpl->multiDef(); } - - unsigned ParseDef::visited() const - { return _pimpl->_visited; } - - ParseDef & ParseDef::addNode( ParseDef & subnode_r ) - { _pimpl->addNode( subnode_r._pimpl.getPtr() ); return *this; } - - ParseDef ParseDef::operator[]( const std::string & name_r ) - { - shared_ptr retimpl( _pimpl->getNode( name_r ) ); - if ( ! retimpl ) - { - ZYPP_THROW( ParseDefBuildException( "No subnode "+name_r ) ); - } - return retimpl; - } - - void ParseDef::setConsumer( const shared_ptr & target_r ) - { _pimpl->_callback.setRedirect( target_r ); } - - void ParseDef::setConsumer( ParseDefConsume * allocatedTarget_r ) - { _pimpl->_callback.setRedirect( allocatedTarget_r ); } - - void ParseDef::setConsumer( ParseDefConsume & target_r ) - { _pimpl->_callback.setRedirect( target_r ); } - - void ParseDef::cancelConsumer() - { _pimpl->_callback.cancelRedirect(); } - - shared_ptr ParseDef::getConsumer() const - { return _pimpl->_callback.getRedirect(); } - - - void ParseDef::take( Reader & reader_r ) - { _pimpl->take( reader_r ); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, ParseDef::Mode obj ) - { - switch ( obj ) - { -#define X(T) case ParseDef::T: return str << #T - X(OPTIONAL); - X(MANDTAORY); - X(MULTIPLE_OPTIONAL); - X(MULTIPLE_MANDTAORY); -#undef X - } - return str; - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ParseDef & obj ) - { - return str << obj._pimpl; - } - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/ParseDef.h b/libzypp/zypp/parser/xml/ParseDef.h deleted file mode 100644 index 44b5261..0000000 --- a/libzypp/zypp/parser/xml/ParseDef.h +++ /dev/null @@ -1,245 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDef.h - * -*/ -#ifndef ZYPP_PARSER_XML_PARSEDEF_H -#define ZYPP_PARSER_XML_PARSEDEF_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/parser/xml/ParseDefTraits.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - class Reader; - class ParseDefConsume; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDef - // - /** Define a xml node structure to parse. - * - * An xml file like this: - * \code - * - * - * - * mycollection - * - * All the cool stuff... - * 1165270942 - * - * - * - * - * - * - * \endcode - * - * Could be described by: - * \code - * using namespace xml; - * struct SycontentNode : public ParseDef - * { - * SycontentNode( Mode mode_r ) - * : ParseDef( "syscontent", mode_r ) - * { - * (*this)("ident", OPTIONAL) - * ("onsys", OPTIONAL) - * ; - * - * (*this)["ident"] - * ("name", OPTIONAL) - * ("version", OPTIONAL) - * ("description", OPTIONAL) - * ("created", OPTIONAL) - * ; - * - * (*this)["onsys"] - * ("entry", MULTIPLE_OPTIONAL) - * ; - * } - * }; - * \endcode - * - * To parse it using an \ref xml::Reader: - * \code - * xml::Reader reader( input_r ); - * SycontentNode rootNode( xml::ParseDef::MANDTAORY ); - * // Define data consumers here. - * rootNode.take( reader ); - * \endcode - * - * Whithout data consumers this will just parse the file - * but not retrieve any data. You may attach a consumer - * derived from \ref xml::ParseDefConsume to each node: - * - * \code - * // Parse Edition from ver/rel/eopch attributes. - * struct ConsumeEdition : public ParseDefConsume - * { - * ConsumeEdition( Edition & value_r ) - * : _value( & value_r ) - * {} - * - * virtual void start( const Node & node_r ) - * { - * *_value = Edition( node_r.getAttribute("ver").asString(), - * node_r.getAttribute("rel").asString(), - * node_r.getAttribute("epoch").asString() ); - * } - * - * Edition *_value; - * }; - * \endcode - * \see \ref xml::ParseDefConsume - * - * \code - * xml::Reader reader( input_r ); - * SycontentNode rootNode( xml::ParseDef::MANDTAORY ); - * - * // Define data consumers here. - * Edition _edition; - * rootNode["ident"]["version"].setConsumer - * ( new ConsumeEdition( _edition ) ); - * - * rootNode.take( reader ); - * \endcode - * - * That's just one way to collect the data. You could as well - * use a \ref xml::ParseDefConsumeCallback, and redirect the - * \c start call to some arbitrary function or method. - */ - class ParseDef - { - typedef ParseDefTraits Traits; - - public: - enum Mode - { - OPTIONAL = Traits::BIT_OPTIONAL | Traits::BIT_ONCE, - MANDTAORY = Traits::BIT_MANDTAORY | Traits::BIT_ONCE, - MULTIPLE_OPTIONAL = Traits::BIT_OPTIONAL | Traits::BIT_MULTIPLE, - MULTIPLE_MANDTAORY = Traits::BIT_MANDTAORY | Traits::BIT_MULTIPLE - }; - - public: - ParseDef( const std::string & name_r, Mode mode_r ); - ParseDef( const std::string & name_r, Mode mode_r, const shared_ptr & target_r ); - - virtual ~ParseDef(); - - public: - const std::string & name() const; - Mode mode() const; - bool isOptional() const; - bool isMandatory() const; - bool singleDef() const; - bool multiDef() const; - unsigned visited() const; - - public: - /** Add subnode definition. - * \note As ParseDef copies share their implementation you can - * not add the same subnode to multiple parents. - * \return *this. - * \throws ParseDefBuildException if a subnode with the same name - * is already defined, or if the subnode is already - * subnode of an other ParseDef. - */ - ParseDef & addNode( ParseDef & subnode_r ); - - ParseDef & addNode( const std::string & name_r, Mode mode_r ) - { ParseDef tmp( name_r, mode_r ); return addNode( tmp ); } - - ParseDef & addNode( const std::string & name_r, Mode mode_r, const shared_ptr & target_r ) - { ParseDef tmp( name_r, mode_r, target_r ); return addNode( tmp ); } - - /** Add subnode definition. - * \see addNode. - */ - ParseDef & operator()( ParseDef & subnode_r ) - { return addNode( subnode_r ); } - - ParseDef & operator()( const std::string & name_r, Mode mode_r ) - { return addNode( name_r, mode_r ); } - - ParseDef & operator()( const std::string & name_r, Mode mode_r, const shared_ptr & target_r ) - { return addNode( name_r, mode_r, target_r ); } - - /** Get subnode by name. - * \throws ParseDefBuildException if no subnode with \a name_r exists. - */ - ParseDef operator[]( const std::string & name_r ); - - public: - /** Set data consumer. */ - void setConsumer( const shared_ptr & target_r ); - /** Set data consumer. - * \note \a allocatedTarget_r is immediately wraped into a - * shared_ptr. - */ - void setConsumer( ParseDefConsume * allocatedTarget_r ); - /** Set data consumer. */ - void setConsumer( ParseDefConsume & target_r ); - /** Unset data consumer. */ - void cancelConsumer(); - - /** Get data consumer. */ - shared_ptr getConsumer() const; - - /** Parse the node. - * This parses the node and all defined subnodes. Unknown - * subnodes are skipped and leave a warning in the logfile. - * \pre Current node must be XML_READER_TYPE_ELEMENT matching - * this ParseDefs name. - * \post All data parsed. At the corresponding end node. - * (XML_READER_TYPE_END_ELEMENT or atill at the same node, - * if it'a an empty element <node />). - * \throws ParseDefException on error. - */ - void take( Reader & reader_r ); - - private: - /** Implementation */ - class Impl; - /** Pointer to implementation (shared!) */ - RW_pointer _pimpl; - - ParseDef( const shared_ptr & pimpl_r ); - friend std::ostream & operator<<( std::ostream & str, const ParseDef & obj ); - friend std::ostream & operator<<( std::ostream & str, const ParseDef::Impl & obj ); - - public: - static bool _debug; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ParseDef ParseDef::Mode stream output. */ - std::ostream & operator<<( std::ostream & str, ParseDef::Mode obj ); - - /** \relates ParseDef Stream output. */ - std::ostream & operator<<( std::ostream & str, const ParseDef & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_PARSEDEF_H diff --git a/libzypp/zypp/parser/xml/ParseDefConsume.cc b/libzypp/zypp/parser/xml/ParseDefConsume.cc deleted file mode 100644 index be7bbc4..0000000 --- a/libzypp/zypp/parser/xml/ParseDefConsume.cc +++ /dev/null @@ -1,176 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDefConsume.cc - * -*/ -#include "zypp/parser/xml/ParseDefConsume.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsume - // - /////////////////////////////////////////////////////////////////// - - ParseDefConsume::~ParseDefConsume() - {} - - void ParseDefConsume::start( const Node & _node ) - {} - - void ParseDefConsume::text( const Node & _node ) - {} - - void ParseDefConsume::cdata( const Node & _node ) - {} - - void ParseDefConsume::done( const Node & _node ) - {} - - void ParseDefConsume::startSubnode( const Node & _node ) - {} - - void ParseDefConsume::doneSubnode( const Node & _node ) - {} - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsumeRedirect - // - /////////////////////////////////////////////////////////////////// - - ParseDefConsumeRedirect::ParseDefConsumeRedirect() - {} - - ParseDefConsumeRedirect::ParseDefConsumeRedirect( const shared_ptr & target_r ) - : _target( target_r ) - {} - - ParseDefConsumeRedirect::ParseDefConsumeRedirect( ParseDefConsume * allocatedTarget_r ) - : _target( allocatedTarget_r ) - {} - - ParseDefConsumeRedirect::ParseDefConsumeRedirect( ParseDefConsume & target_r ) - : _target( &target_r, NullDeleter() ) - {} - - ParseDefConsumeRedirect::~ParseDefConsumeRedirect() - {} - - void ParseDefConsumeRedirect::setRedirect( const shared_ptr & target_r ) - { _target = target_r; } - - void ParseDefConsumeRedirect::setRedirect( ParseDefConsume * allocatedTarget_r ) - { _target.reset( allocatedTarget_r ); } - - void ParseDefConsumeRedirect::setRedirect( ParseDefConsume & target_r ) - { _target.reset( &target_r, NullDeleter() ); } - - void ParseDefConsumeRedirect::cancelRedirect() - { _target.reset(); } - - shared_ptr ParseDefConsumeRedirect::getRedirect() const - { return _target; } - - void ParseDefConsumeRedirect::start( const Node & _node ) - { - if ( _target ) - _target->start( _node ); - } - - void ParseDefConsumeRedirect::text( const Node & _node ) - { - if ( _target ) - _target->text( _node ); - } - - void ParseDefConsumeRedirect::cdata( const Node & _node ) - { - if ( _target ) - _target->cdata( _node ); - } - - void ParseDefConsumeRedirect::done( const Node & _node ) - { - if ( _target ) - _target->done( _node ); - } - - void ParseDefConsumeRedirect::startSubnode( const Node & _node ) - { - if ( _target ) - _target->startSubnode( _node ); - } - - void ParseDefConsumeRedirect::doneSubnode ( const Node & _node ) - { - if ( _target ) - _target->doneSubnode( _node ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsumeCallback - // - /////////////////////////////////////////////////////////////////// - - ParseDefConsumeCallback::ParseDefConsumeCallback() - {} - - ParseDefConsumeCallback::~ParseDefConsumeCallback() - {} - - void ParseDefConsumeCallback::start( const Node & node_r ) - { - if ( _start ) - _start( node_r ); - } - - void ParseDefConsumeCallback::text( const Node & node_r ) - { - if ( _text ) - _text( node_r ); - } - - void ParseDefConsumeCallback::cdata( const Node & node_r ) - { - if ( _cdata ) - _cdata( node_r ); - } - - void ParseDefConsumeCallback::done( const Node & node_r ) - { - if ( _done ) - _done( node_r ); - } - - void ParseDefConsumeCallback::startSubnode( const Node & node_r ) - { - if ( _startSubnode ) - _startSubnode( node_r ); - } - - void ParseDefConsumeCallback::doneSubnode( const Node & node_r ) - { - if ( _doneSubnode ) - _doneSubnode( node_r ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/ParseDefConsume.h b/libzypp/zypp/parser/xml/ParseDefConsume.h deleted file mode 100644 index 2f75dc9..0000000 --- a/libzypp/zypp/parser/xml/ParseDefConsume.h +++ /dev/null @@ -1,374 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDefConsume.h - * -*/ -#ifndef ZYPP_PARSER_XML_PARSEDEFCONSUME_H -#define ZYPP_PARSER_XML_PARSEDEFCONSUME_H - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/base/Tr1hash.h" -#include "zypp/base/String.h" -#include "zypp/base/DefaultIntegral.h" - -#include "zypp/parser/xml/Node.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - class Node; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsume - // - /** Base class for ParseDef consumer. - */ - struct ParseDefConsume - { - virtual ~ParseDefConsume(); - - virtual void start( const Node & _node ); - virtual void text ( const Node & _node ); - virtual void cdata( const Node & _node ); - virtual void done ( const Node & _node ); - - virtual void startSubnode( const Node & _node ); - virtual void doneSubnode ( const Node & _node ); - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsumeRedirect - // - /** ParseDef consumer redirecting all events to another consumer. - * \note Allocated ParseDefConsume * passed are - * immediately wraped into a shared_ptr. - */ - class ParseDefConsumeRedirect : public ParseDefConsume - { - public: - ParseDefConsumeRedirect(); - ParseDefConsumeRedirect( const shared_ptr & target_r ); - ParseDefConsumeRedirect( ParseDefConsume * allocatedTarget_r ); - ParseDefConsumeRedirect( ParseDefConsume & target_r ); - - virtual ~ParseDefConsumeRedirect(); - - public: - void setRedirect( const shared_ptr & target_r ); - void setRedirect( ParseDefConsume * allocatedTarget_r ); - void setRedirect( ParseDefConsume & target_r ); - void cancelRedirect(); - - shared_ptr getRedirect() const; - - public: - virtual void start( const Node & _node ); - virtual void text ( const Node & _node ); - virtual void cdata( const Node & _node ); - virtual void done ( const Node & _node ); - virtual void startSubnode( const Node & _node ); - virtual void doneSubnode ( const Node & _node ); - - private: - shared_ptr _target; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefConsumeCallback - // - /** ParseDef consumer that invokes callbacks. - */ - class ParseDefConsumeCallback : public ParseDefConsume - { - public: - typedef function Callback; - - ParseDefConsumeCallback(); - - virtual ~ParseDefConsumeCallback(); - - public: - virtual void start( const Node & node_r ); - virtual void text( const Node & node_r ); - virtual void cdata( const Node & node_r ); - virtual void done( const Node & node_r ); - virtual void startSubnode( const Node & node_r ); - virtual void doneSubnode( const Node & node_r ); - - public: - Callback _start; - Callback _text; - Callback _cdata; - Callback _done; - Callback _startSubnode; - Callback _doneSubnode; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /** \ref parseDefAssign exposed details */ - namespace parse_def_assign - { ///////////////////////////////////////////////////////////////// - template struct Assigner; - - typedef shared_ptr > AssignerRef; - - /** Common interface to all Assigner types. */ - template <> - struct Assigner - { - virtual ~Assigner() - {} - virtual void assign( const char * text_r ) - {} - }; - - /** Assigner assigns text to types constructible from \c char*. - * \see \ref assigner consvenience constructor. - */ - template - struct Assigner : public Assigner - { - Assigner(_Type & value_r ) - : _value( &value_r ) - {} - - virtual void assign( const char * text_r ) - { *_value = _Type( text_r ); } - - private: - _Type * _value; - }; - - /** \name Assigner specialisation for numeric and boolean values. - * \relates Assigner - */ - //@{ - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - template <> - inline void Assigner::assign( const char * text_r ) { str::strtonum( text_r, *_value ); } - - template <> - inline void Assigner::assign( const char * text_r ) { str::strToBoolNodefault( text_r, *_value ); } - //@} - - /** \name \relates Assigner Convenience constructor */ - //@{ - template - inline AssignerRef assigner( _Type & value_r ) - { return AssignerRef( new Assigner<_Type>( value_r ) ); } - - template - inline AssignerRef assigner( DefaultIntegral<_Tp,_Initial> & value_r ) - { return AssignerRef( new Assigner<_Tp>( value_r.get() ) ); } - //@} - - - /** \ref ParseDef consumer assigning \ref Node text and attribues values to variables. - * - * This can be used with all types supported by \ref Assigner. - * Basically all types constructible from \c char*, or where a - * specialisation exists (e.g. numeric and bool). - * - * You may also set a void( const Node & ) notification - * callback which is invoked after the node was processed. - * - * \note Use and see \ref xml::parseDefAssign convenience constructor. - * - * \code - * // parsedef for 'value' - * ParseDef( "attr", MANDTAORY, xml::parseDefAssign( data.value ) - * ( "attr", data.attr ) ) - * \endcode - */ - struct Consumer : public ParseDefConsume - { - /** Extend \ref Consumer. */ - void add( const AssignerRef & assigner_r ) - { _text.push_back( assigner_r ); } - - /** Extend \ref Consumer. */ - void add( const std::string & attr_r, const AssignerRef & assigner_r ) - { _attr[attr_r].push_back( assigner_r ); } - - /** Set pre notification callback. */ - void prenotify( function pre_r ) - { _pre = pre_r; } - - /** Set post notification callback. */ - void postnotify( function post_r ) - { _post = post_r; } - - virtual void start( const xml::Node & node_r ) - { - if ( _pre ) - _pre( node_r ); - - if ( ! _attr.empty() ) - for_( it, _attr.begin(), _attr.end() ) - assign( it->second, node_r.getAttribute( it->first.c_str() ).c_str() ); - } - - virtual void text( const xml::Node & node_r ) - { - if ( ! _text.empty() ) - assign( _text, node_r.value().c_str() ); - } - - virtual void done( const xml::Node & node_r ) - { - if ( _post ) - _post( node_r ); - } - - private: - void assign( const std::vector & vec_r, const char * value_r ) - { - if ( value_r ) - for_( it, vec_r.begin(), vec_r.end() ) - (*it)->assign( value_r ); - } - - private: - std::tr1::unordered_map > _attr; - std::vector _text; - function _pre; - function _post; - }; - - /** Helper class to build a \ref Consumer. - * \relates Consumer - * - * The class constructs the consumer, allows to extend it via - * \ref operator(), and provides a conversion to - * \c shared_ptr, so it can be passed as a - * node consumer to \ref ParseDef. - * - * You may also set a void( const Node & ) notification - * callback which is invoked before/after the node was processed. - * - * \note Use and see \ref xml::parseDefAssign convenience constructor. - */ - struct Builder - { - /** Contruct \ref Consumer. */ - Builder() - : _ptr( new Consumer ) - {} - - /** Contruct \ref Consumer. */ - template - Builder( _Type & value_r ) - : _ptr( new Consumer ) - { operator()( value_r ); } - - /** Contruct \ref Consumer. */ - template - Builder( const std::string & attr_r, _Type & value_r ) - : _ptr( new Consumer ) - { operator()( attr_r, value_r ); } - - /** Extend \ref Consumer. */ - template - Builder & operator()( _Type & value_r ) - { _ptr->add( assigner( value_r ) ); return *this; } - - /** Extend \ref Consumer. */ - template - Builder & operator()( const std::string & attr_r, _Type & value_r ) - { _ptr->add( attr_r, assigner( value_r ) ); return *this; } - - /** Set pre notification callback. */ - Builder & operator<<( function done_r ) - { _ptr->prenotify( done_r ); return *this; } - - /** Set post notification callback. */ - Builder & operator>>( function done_r ) - { _ptr->postnotify( done_r ); return *this; } - - /** Type conversion so this can be passed as node consumer to \ref ParseDef. */ - operator shared_ptr () const - { return _ptr; } - - private: - shared_ptr _ptr; - }; - ///////////////////////////////////////////////////////////////// - } // namespace parse_def_assign - /////////////////////////////////////////////////////////////////// - - /** \name \ref ParseDef consumer assigning \ref Node text and attribues values to variables. - * \relates parse_def_assign::Consumer - * \relates parse_def_assign::Builder - * - * This function allows convenient contruction of a \ref parse_def_assign::Consumer - * to be passed as \ref Node conssumer to \ref ParseDef. Simply list each attributes - * name together with the variable it's value should be assigned to. If the attribute - * name is omitted, the nodes text value gets assigned. - * - * Target variables can be of any type tsupported by \ref Assigner. - * Basically all types constructible from \c char*, or where a - * specialisation exists (e.g. numeric and bool). - * - * \code - * void setupDone( const xml::Node & _node ) - * { ... } - * - * // parsedef for 'value' - * ParseDef( "attr", MANDTAORY, - * xml::parseDefAssign( data.value ) - * ( "attr", data.attr ) - * >> &setupDone ); - * \endcode - * - * \see \ref xml::rnParse for more example. - */ - //@{ - inline parse_def_assign::Builder parseDefAssign() - { return parse_def_assign::Builder(); } - - template - inline parse_def_assign::Builder parseDefAssign( _Type & value_r ) - { return parse_def_assign::Builder( value_r ); } - - template - inline parse_def_assign::Builder parseDefAssign( const std::string & attr_r, _Type & value_r ) - { return parse_def_assign::Builder( attr_r, value_r ); } - //@} - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_PARSEDEFCONSUME_H diff --git a/libzypp/zypp/parser/xml/ParseDefException.cc b/libzypp/zypp/parser/xml/ParseDefException.cc deleted file mode 100644 index 45b3f13..0000000 --- a/libzypp/zypp/parser/xml/ParseDefException.cc +++ /dev/null @@ -1,62 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDefException.cc - * -*/ -#include "zypp/parser/xml/ParseDefException.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDefException::ParseDefException - // METHOD TYPE : Constructor - // - ParseDefException::ParseDefException( const std::string & what_r ) - : Exception( what_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDefBuildException::ParseDefBuildException - // METHOD TYPE : Constructor - // - ParseDefBuildException::ParseDefBuildException( const std::string & what_r ) - : ParseDefException( what_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDefValidateException::ParseDefValidateException - // METHOD TYPE : Constructor - // - ParseDefValidateException::ParseDefValidateException( const std::string & what_r ) - : ParseDefException( what_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ParseDefDataException::ParseDefDataException - // METHOD TYPE : Constructor - // - ParseDefDataException::ParseDefDataException( const std::string & what_r ) - : ParseDefException( what_r ) - {} - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/ParseDefException.h b/libzypp/zypp/parser/xml/ParseDefException.h deleted file mode 100644 index e203e75..0000000 --- a/libzypp/zypp/parser/xml/ParseDefException.h +++ /dev/null @@ -1,76 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDefException.h - * -*/ -#ifndef ZYPP_PARSER_XML_PARSEDEFEXCEPTION_H -#define ZYPP_PARSER_XML_PARSEDEFEXCEPTION_H - -#include - -#include "zypp/base/Exception.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefException - // - /** Common base class for \ref ParseDef exceptions. */ - struct ParseDefException : public Exception - { - ParseDefException( const std::string & what_r ); - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefBuildException - // - /** Exceptions when building a ParseDef tree. */ - struct ParseDefBuildException : public ParseDefException - { - ParseDefBuildException( const std::string & what_r ); - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefValidateException - // - /** Parse exceptions related to the documents node structure. */ - struct ParseDefValidateException : public ParseDefException - { - ParseDefValidateException( const std::string & what_r ); - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefDataException - // - /** Parse exceptions related to the nodes content. */ - struct ParseDefDataException : public ParseDefException - { - ParseDefDataException( const std::string & what_r ); - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_PARSEDEFEXCEPTION_H diff --git a/libzypp/zypp/parser/xml/ParseDefTraits.h b/libzypp/zypp/parser/xml/ParseDefTraits.h deleted file mode 100644 index e7a6673..0000000 --- a/libzypp/zypp/parser/xml/ParseDefTraits.h +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/ParseDefTraits.h - * -*/ -#ifndef ZYPP_PARSER_XML_PARSEDEFTRAITS_H -#define ZYPP_PARSER_XML_PARSEDEFTRAITS_H - -#include "zypp/Bit.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ParseDefTraits - // - /** */ - struct ParseDefTraits - { - typedef unsigned char ModeBitsType; - typedef bit::BitField ModeBits; - typedef bit::Range TypeBits; - typedef bit::Range VisitBits; - - enum TypeValue - { - BIT_OPTIONAL = bit::RangeValue::value, - BIT_MANDTAORY = bit::RangeValue::value - }; - - enum VisitValue - { - BIT_ONCE = bit::RangeValue::value, - BIT_MULTIPLE = bit::RangeValue::value - }; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_PARSEDEFTRAITS_H diff --git a/libzypp/zypp/parser/xml/Reader.cc b/libzypp/zypp/parser/xml/Reader.cc deleted file mode 100644 index d06be45..0000000 --- a/libzypp/zypp/parser/xml/Reader.cc +++ /dev/null @@ -1,255 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/Reader.cc - * -*/ -#include -#include - -#include - -#include "zypp/base/LogControl.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Exception.h" -#include "zypp/base/String.h" - -#include "zypp/parser/xml/Reader.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - int ioread( void * context_r, char * buffer_r, int bufferLen_r ) - { - if ( context_r && buffer_r ) - { - return reinterpret_cast(context_r) - ->stream().read( buffer_r, bufferLen_r ).gcount(); - } - INT << "XML parser error: null pointer check failed " << context_r << ' ' << (void *)buffer_r << endl; - return -1; - } - - int ioclose( void * /*context_r*/ ) - { return 0; } - - - std::list structuredErrors; - void structuredErrorFunc( void * userData, xmlErrorPtr error ) - { - if ( error ) - { - // error->message is NL terminated - std::string err( str::form( "%s[%d] %s", Pathname::basename(error->file).c_str(), error->line, - str::stripSuffix( error->message, "\n" ).c_str() ) ); - structuredErrors.push_back( err ); - WAR << err << endl; - } -#if 0 - if ( error ) - { -#define X(m) SEC << " " << #m << "\t" << error->m << endl -#define XS(m) SEC << " " << #m << "\t" << (error->m?error->m:"NA") << endl - X(domain); - X(code); - XS(message); - X(level); - XS(file); - X(line); - XS(str1); - XS(str2); - XS(str3); - X(int1); - X(int2); - X(ctxt); - X(node); -#undef X -#undef XS - } -#endif - } - - struct ParseException : public Exception - { - ParseException() - : Exception( "Parse error: " + ( structuredErrors.empty() ? std::string("unknown error"): structuredErrors.back() ) ) - { - for_( it, structuredErrors.begin(), --structuredErrors.end() ) - addHistory( *it ); - } - }; - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::Reader - // METHOD TYPE : Constructor - // - Reader::Reader( const InputStream & stream_r, - const Validate & validate_r ) - : _stream( stream_r ) - , _reader( xmlReaderForIO( ioread, ioclose, &_stream, - stream_r.path().asString().c_str(), "utf-8", XML_PARSE_PEDANTIC ) ) - , _node( _reader ) - { - MIL << "Start Parsing " << _stream << endl; - if ( ! _reader || ! stream_r.stream().good() ) - ZYPP_THROW( Exception( "Bad input stream" ) ); - // set error handler - // TODO: Fix using a global lastStructuredError string is not reentrant. - structuredErrors.clear(); - xmlTextReaderSetStructuredErrorHandler( _reader, structuredErrorFunc, NULL ); - // TODO: set validation - - // advance to 1st node - nextNode(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::~Reader - // METHOD TYPE : Destructor - // - Reader::~Reader() - { - if ( _reader ) - { - xmlFreeTextReader( _reader ); - } - MIL << "Done Parsing " << _stream << endl; - } - - XmlString Reader::nodeText() - { - if ( ! _node.isEmptyElement() ) - { - if ( nextNode() ) - { - if ( _node.nodeType() == XML_READER_TYPE_TEXT ) - { - return _node.value(); - } - } - } - return XmlString(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::nextNode - // METHOD TYPE : bool - // - bool Reader::nextNode() - { - int ret = xmlTextReaderRead( _reader ); - if ( ret == 1 ) - { - return true; - } - xmlTextReaderClose( _reader ); - if ( ret != 0 ) - { - ZYPP_THROW( ParseException() ); - } - return false; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::nextNodeAttribute - // METHOD TYPE : bool - // - bool Reader::nextNodeAttribute() - { - int ret = xmlTextReaderMoveToNextAttribute( _reader ); - if ( ret == 1 ) - { - return true; - } - if ( ret != 0 ) - { - ZYPP_THROW( ParseException() ); - } - return false; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::close - // METHOD TYPE : void - // - void Reader::close() - { - if ( _reader ) - { - xmlTextReaderClose( _reader ); - } - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::seekToNode - // METHOD TYPE : bool - // - bool Reader::seekToNode( int depth_r, const std::string & name_r ) - { - do - { - if ( _node.depth() == depth_r - && _node.name() == name_r - && _node.nodeType() == XML_READER_TYPE_ELEMENT ) - { - break; - } - } while( nextNode() ); - - return ! atEnd(); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Reader::seekToEndNode - // METHOD TYPE : bool - // - bool Reader::seekToEndNode( int depth_r, const std::string & name_r ) - { - // Empty element has no separate end node: - do - { - if ( _node.depth() == depth_r - && _node.name() == name_r - && ( _node.nodeType() == XML_READER_TYPE_END_ELEMENT - || ( _node.nodeType() == XML_READER_TYPE_ELEMENT - && _node.isEmptyElement() ) ) ) - { - break; - } - } while( nextNode() ); - - return ! atEnd(); - } - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/Reader.h b/libzypp/zypp/parser/xml/Reader.h deleted file mode 100644 index 42c0d90..0000000 --- a/libzypp/zypp/parser/xml/Reader.h +++ /dev/null @@ -1,203 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/Reader.h - * -*/ -#ifndef ZYPP_PARSER_XML_READER_H -#define ZYPP_PARSER_XML_READER_H - -#include - -#include "zypp/base/NonCopyable.h" -#include "zypp/base/InputStream.h" -#include "zypp/base/Function.h" - -#include "zypp/parser/xml/Node.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Validate - // - /** xmlTextReader document validation. - * \todo Implement RelaxNG and W3C XSD - **/ - struct Validate - { - static Validate none() - { return Validate(); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Reader - // - /** xmlTextReader based interface to iterate xml streams. - * - * \code - * // Consume a node. - * bool consumeNode( XML::Reader & reader_r ) - * { - * DBG << *reader_r << endl; - * return true; - * } - * - * // Consume all nodes (omitting attributes) - * void example() - * { - * try - * { - * XML::Reader reader( "/Local/repodata/repomd.xml" ); - * reader.foreachNode( consumeNode ); - * } - * catch ( const Exception & ) - * { ; } // parse error - * } - * \endcode - * - * \code - * // Consume a node. - * bool consumeNodeAndAttribute( XML::Reader & reader_r ) - * { - * consumeNode( reader_r ); - * return reader_r.foreachNodeAttribute( consumeNode ); - * } - * - * // Consume all nodes and thair attributes. - * void example() - * { - * Pathname repodata( "/Local/repodata/repomd.xml" ); - * try - * { - * XML::Reader reader( "/Local/repodata/repomd.xml" ); - * reader.foreachNode( consumeNodeAndAttribute ); - * // or: - * // reader.foreachNodeOrAttribute( consumeNode ) - * } - * catch ( const Exception & ) - * { ; } // parse error - * } - * \endcode - **/ - class Reader : private zypp::base::NonCopyable - { - public: - /** Ctor. Setup xmlTextReader and advance to the 1st Node. */ - Reader( const InputStream & stream_r, - const Validate & validate_r = Validate::none() ); - - /** Dtor. */ - ~Reader(); - - public: - - /** - * If the curent node is not empty, advances the reader to the next - * node, and returns the value - * - * \note if the node has a xml subtree you will probably jump to that node - * and get a empty text value back. Use it only if you are sure the node - * has no XML subtree. - */ - XmlString nodeText(); - - /** */ - bool nextNode(); - - /** */ - bool nextNodeAttribute(); - - /** */ - bool nextNodeOrAttribute() - { return( nextNodeAttribute() || nextNode() ); } - - /** */ - bool atEnd() const - { return( _node.readState() == XML_TEXTREADER_MODE_CLOSED ); } - - /** */ - const Node & operator*() const - { return _node; } - - /** */ - const Node * operator->() const - { return &_node; } - - public: - /** */ - typedef function ProcessNode; - - /** */ - bool foreachNode( ProcessNode fnc_r ) - { - if ( _node.isAttribute() ) - nextNode(); - for ( ; ! atEnd(); nextNode() ) - { - if ( ! fnc_r( *this ) ) - return false; - } - return true; - } - - /** */ - bool foreachNodeAttribute( ProcessNode fnc_r ) - { - if ( _node.isAttribute() && ! fnc_r( *this ) ) - return false; - while( nextNodeAttribute() ) - { - if ( ! fnc_r( *this ) ) - return false; - } - return true; - } - - /** */ - bool foreachNodeOrAttribute( ProcessNode fnc_r ) - { - for ( ; ! atEnd(); nextNodeOrAttribute() ) - { - if ( ! fnc_r( *this ) ) - return false; - } - return true; - } - - public: - /** */ - bool seekToNode( int depth_r, const std::string & name_r ); - - /** */ - bool seekToEndNode( int depth_r, const std::string & name_r ); - - private: - void close(); - - private: - InputStream _stream; - xmlTextReaderPtr _reader; - Node _node; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_READER_H diff --git a/libzypp/zypp/parser/xml/XmlEscape.cc b/libzypp/zypp/parser/xml/XmlEscape.cc deleted file mode 100644 index 090119f..0000000 --- a/libzypp/zypp/parser/xml/XmlEscape.cc +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/XmlEscape.cc - * -*/ - -#include -#include "zypp/parser/xml/XmlEscape.h" - -/* -IoBind Library License: --------------------------- - -The zlib/libpng License Copyright (c) 2003 Jonathan de Halleux - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution -*/ -/////////////////////////////////////////////////////////////////// -namespace iobind -{ - /////////////////////////////////////////////////////////////////// - namespace parser - { - struct ZYPP_LOCAL xml_escape_parser - { - std::string unescape(const std::string &istr) const - { - size_t i; - std::string str = istr; - i = str.find_first_of("&"); - while (i != std::string::npos) - { - if (str[i] == '&') - { - if (!str.compare(i + 1, 3, "lt;")) - str.replace(i, 4, 1, '<'); - else if (!str.compare(i + 1, 3, "gt;")) - str.replace(i, 4, 1, '>'); - else if (!str.compare(i + 1, 4, "amp;")) - str.replace(i, 5, 1, '&'); - else if (!str.compare(i + 1, 5, "apos;")) - str.replace(i, 6, 1, '\''); - else if (!str.compare(i + 1, 5, "quot;")) - str.replace(i, 6, 1, '"'); - } - i = str.find_first_of("&", i + 1); - } - return str; - } - }; - } // namespace parser - /////////////////////////////////////////////////////////////////// -} // namespace iobind -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace xml - { - /////////////////////////////////////////////////////////////////// - namespace detail - { - std::ostream & EscapedString::dumpOn( std::ostream & str ) const - { - typedef unsigned char uchar; - for ( char ch : _in ) - { - switch ( ch ) - { - case '<': str << "<"; break; - case '>': str << ">"; break; - case '&': str << "&"; break; - case '"': str << """; break; - case '\'': str << "'"; break; - - // control chars we allow: - case '\n': - case '\r': - case '\t': - str << ch; - break; - - default: - if ( uchar(ch) < 32u ) - str << '?'; // filter problematic control chars (XML1.0) - else - str << ch; - break; - } - } - return str; - } - - } // detail - /////////////////////////////////////////////////////////////////// - - std::string unescape( const std::string & in_r ) - { return iobind::parser::xml_escape_parser().unescape( in_r ); } - - } // namespace xml - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/XmlEscape.h b/libzypp/zypp/parser/xml/XmlEscape.h deleted file mode 100644 index 8acf6c6..0000000 --- a/libzypp/zypp/parser/xml/XmlEscape.h +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/XmlEscape.h - * -*/ -#ifndef ZYPP_PARSER_XML_XMLESCAPE_H -#define ZYPP_PARSER_XML_XMLESCAPE_H - -#include -#include -#include "zypp/APIConfig.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace xml - { - /////////////////////////////////////////////////////////////////// - namespace detail - { - struct EscapedString - { - EscapedString( const std::string & in_r ) : _in( in_r ) {} - std::ostream & dumpOn( std::ostream & str ) const; - std::string asString() const - { std::ostringstream str; dumpOn( str ); return str.str(); } - operator std::string() const - { return asString(); } - private: - const std::string & _in; - }; - - /** \relates EscapedString Stream output */ - inline std::ostream & operator<<( std::ostream & str, const EscapedString & obj ) - { return obj.dumpOn( str ); } - - } // detail - /////////////////////////////////////////////////////////////////// - - /** Escape xml special charaters (& -> &; from IoBind library). - * The \ref detail::EscapedString can be dumped to an ostream and implicitly - * converts into a std::string. - */ - inline detail::EscapedString escape( const std::string & in_r ) - { return detail::EscapedString( in_r ); } - - /** Unescape xml special charaters (& -> &; from IoBind library) */ - ZYPP_API std::string unescape( const std::string & in_r ); - - } // namespace xml - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_XMLESCAPE_H diff --git a/libzypp/zypp/parser/xml/XmlString.cc b/libzypp/zypp/parser/xml/XmlString.cc deleted file mode 100644 index 427c922..0000000 --- a/libzypp/zypp/parser/xml/XmlString.cc +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/XmlString.cc - * -*/ - -#include - -#include "zypp/parser/xml/XmlString.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : XmlString::XmlString - // METHOD TYPE : Constructor - // - XmlString::XmlString( const xmlChar *const xmlstr_r, - OnDelete ondelete_r ) - { - if ( xmlstr_r ) - { - if ( ondelete_r == FREE ) - _xmlstr.reset( xmlstr_r, Deleter() ); - else - _xmlstr.reset( xmlstr_r, NullDeleter() ); - } - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const XmlString & obj ) - { - if ( obj ) - return str << obj.c_str(); - return str << "NULL"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/XmlString.h b/libzypp/zypp/parser/xml/XmlString.h deleted file mode 100644 index 28a7abd..0000000 --- a/libzypp/zypp/parser/xml/XmlString.h +++ /dev/null @@ -1,118 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/XmlString.h - * -*/ -#ifndef ZYPP_PARSER_XML_XMLSTRING_H -#define ZYPP_PARSER_XML_XMLSTRING_H - -#include -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/parser/xml/libxmlfwd.h" -#include "zypp/parser/xml/XmlEscape.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : XmlString - // - /** xmlChar * wrapper. - * - * Common handling of xmlChar * that do or do not need to - * be freed. If the wraped xmlChar * needs to be freed by - * calling \c xmlFree, pass \c FREE as 2nd argument to the ctor. - **/ - class XmlString - { - /** shared_ptr custom deleter calling \c xmlFree. */ - struct Deleter - { - void operator()( const xmlChar * xmlstr_r ) const - { xmlFree( (void*)(xmlstr_r) ); } - }; - - public: - - /** Dtor policy. */ - enum OnDelete { NOFREE, FREE }; - - /** Ctor from xmlChar. - * Pass \c FREE as 2nd arg if \c xmlFree needs to be called on destruction. - */ - XmlString( const xmlChar *const xmlstr_r = NULL, - OnDelete ondelete_r = NOFREE ); - - /** Access the xmlChar *. */ - const xmlChar * get() const - { - if ( ! _xmlstr ) - return NULL; - return &(*_xmlstr); - } - - /** Implicit conversion to xmlChar *. */ - operator const xmlChar * () const - { return get(); } - - /** Explicit conversion to const char *. */ - const char * c_str() const - { return reinterpret_cast(get()); } - - /** Explicit conversion to std::string. */ - std::string asString() const - { - if ( ! _xmlstr ) - return std::string(); - return c_str(); - } - - bool operator==( const std::string & rhs ) const - { return( rhs == c_str() ); } - - bool operator!=( const std::string & rhs ) const - { return( rhs != c_str() ); } - - bool operator==( const char *const rhs ) const - { return( asString() == rhs ); } - - bool operator!=( const char *const rhs ) const - { return( asString() != rhs ); } - - bool operator==( const XmlString & rhs ) const - { return( asString() == rhs.c_str() ); } - - bool operator!=( const XmlString & rhs ) const - { return( asString() != rhs.c_str() ); } - - private: - /** Wraps the xmlChar *. - * The appropriate custom deleter is set by the ctor. */ - shared_ptr _xmlstr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates XmlString Stream output. */ - std::ostream & operator<<( std::ostream & str, const XmlString & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_XMLSTRING_H diff --git a/libzypp/zypp/parser/xml/libxmlfwd.cc b/libzypp/zypp/parser/xml/libxmlfwd.cc deleted file mode 100644 index 16af63b..0000000 --- a/libzypp/zypp/parser/xml/libxmlfwd.cc +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/libxmlfwd.cc - * -*/ - -#include - -#include "zypp/parser/xml/libxmlfwd.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ReadState & obj ) - { - switch ( obj ) - { -#define X(T) case XML_TEXTREADER_MODE_##T: return str << #T - X(INITIAL); - X(INTERACTIVE); - X(ERROR); - X(EOF); - X(CLOSED); - X(READING); -#undef X - } - return str << "UNKNOWN_READ_STATE"; - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const NodeType & obj ) - { - switch ( obj ) - { -#define X(T) case XML_READER_TYPE_##T: return str << #T - X(NONE); - X(ELEMENT); - X(ATTRIBUTE); - X(TEXT); - X(CDATA); - X(ENTITY_REFERENCE); - X(ENTITY); - X(PROCESSING_INSTRUCTION); - X(COMMENT); - X(DOCUMENT); - X(DOCUMENT_TYPE); - X(DOCUMENT_FRAGMENT); - X(NOTATION); - X(WHITESPACE); - X(SIGNIFICANT_WHITESPACE); - X(END_ELEMENT); - X(END_ENTITY); - X(XML_DECLARATION); -#undef X - } - return str << "UNKNOWN_NODE_TYPE"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/parser/xml/libxmlfwd.h b/libzypp/zypp/parser/xml/libxmlfwd.h deleted file mode 100644 index 00df261..0000000 --- a/libzypp/zypp/parser/xml/libxmlfwd.h +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/xml/libxmlfwd.h - * -*/ -#ifndef ZYPP_PARSER_XML_LIBXMLFWD_H -#define ZYPP_PARSER_XML_LIBXMLFWD_H - -extern "C" -{ -#include -#include -} - -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace xml - { ///////////////////////////////////////////////////////////////// - - typedef xmlTextReaderMode ReadState; - /** \relates ReadState Stream output. */ - std::ostream & operator<<( std::ostream & str, const ReadState & obj ); - - typedef xmlReaderTypes NodeType; - /** \relates NodeType Stream output. */ - std::ostream & operator<<( std::ostream & str, const NodeType & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace xml - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_XML_LIBXMLFWD_H diff --git a/libzypp/zypp/parser/yum/PatchesFileReader.cc b/libzypp/zypp/parser/yum/PatchesFileReader.cc deleted file mode 100644 index b5ad479..0000000 --- a/libzypp/zypp/parser/yum/PatchesFileReader.cc +++ /dev/null @@ -1,155 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/yum/PatchesFileReader.cc - * Implementation of patches.xml file reader. - */ -#include - -#include "zypp/base/String.h" -#include "zypp/base/Logger.h" - -#include "zypp/Date.h" -#include "zypp/CheckSum.h" -#include "zypp/OnMediaLocation.h" - -#include "zypp/parser/xml/Reader.h" -#include "zypp/parser/yum/PatchesFileReader.h" - - -using namespace std; -using namespace zypp::xml; - -namespace zypp -{ - namespace parser - { - namespace yum - { - - - enum Tag - { - tag_NONE, - tag_Patches, - tag_Patch, - tag_Location, - tag_CheckSum, - tag_Timestamp, - tag_OpenCheckSum - }; - - - /////////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PatchesFileReader::Impl - // - class PatchesFileReader::Impl : private base::NonCopyable - { - public: - /** - * CTOR - */ - Impl(const Pathname &patches_file, const ProcessResource & callback); - - /** - * Callback provided to the XML parser. Don't use it. - */ - bool consumeNode( Reader & reader_r ); - - private: - OnMediaLocation _location; - Tag _tag; - std::string _id; - ProcessResource _callback; - CheckSum _checksum; - std::string _checksum_type; - Date _timestamp; - }; - /////////////////////////////////////////////////////////////////////// - - - PatchesFileReader::Impl::Impl(const Pathname & patches_file, - const ProcessResource & callback) - : _tag(tag_NONE), _callback(callback) - { - Reader reader( patches_file ); - MIL << "Reading " << patches_file << endl; - reader.foreachNode(bind( &PatchesFileReader::Impl::consumeNode, this, _1 )); - } - - // -------------------------------------------------------------------------- - - bool PatchesFileReader::Impl::consumeNode( Reader & reader_r ) - { - //MIL << reader_r->name() << endl; - std::string data_type; - if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT ) - { - if ( reader_r->name() == "patches" ) - { - _tag = tag_Patches; - return true; - } - if ( reader_r->name() == "patch" ) - { - _tag = tag_Patch; - _id = reader_r->getAttribute("id").asString(); - return true; - } - if ( reader_r->name() == "location" ) - { - _tag = tag_Location; - _location.setLocation( reader_r->getAttribute("href").asString(), 1 ); - return true; - } - if ( reader_r->name() == "checksum" ) - { - _tag = tag_CheckSum; - string checksum_type = reader_r->getAttribute("type").asString() ; - string checksum_vaue = reader_r.nodeText().asString(); - _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) ); - return true; - } - if ( reader_r->name() == "timestamp" ) - { - // ignore it - return true; - } - } - else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT ) - { - //MIL << "end element" << endl; - if ( reader_r->name() == "patch" ) - _callback( _location, _id ); - return true; - } - return true; - } - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PatchesFileReader - // - /////////////////////////////////////////////////////////////////// - - PatchesFileReader::PatchesFileReader(const Pathname & patches_file, - const ProcessResource & callback) - : _pimpl(new Impl(patches_file, callback)) - {} - - PatchesFileReader::~PatchesFileReader() - {} - - - } // ns yum - } // ns parser -} // ns zypp - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/parser/yum/PatchesFileReader.h b/libzypp/zypp/parser/yum/PatchesFileReader.h deleted file mode 100644 index 53b344a..0000000 --- a/libzypp/zypp/parser/yum/PatchesFileReader.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/yum/PatchesFileReader.h - * Interface of patches.xml file reader. - */ -#ifndef zypp_source_yum_PatchesFileReader_H -#define zypp_source_yum_PatchesFileReader_H - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/Function.h" - - -namespace zypp -{ - namespace parser - { - namespace yum - { - - - /** - * Iterates through a patches.xml file giving on each iteration - * a \ref OnMediaLocation object with the resource and its - * patch id. - * The iteration is done via a callback provided on - * construction. - * - * \code - * PatchesFileReader reader(patches_file, - * bind( &SomeClass::callbackfunc, &object, _1, _2 ) ); - * \endcode - */ - class PatchesFileReader : private base::NonCopyable - { - public: - - /** - * Callback definition - * first parameter is a \ref OnMediaLocation object with the resource - * second parameter is the patch id. - */ - typedef - function - ProcessResource; - - - /** - * CTOR. Creates also \ref xml::Reader and starts reading. - * - * \param patches_file is the patches.xml file you want to read - * \param callback is a function. - * - * \see PatchesFileReader::ProcessResource - */ - PatchesFileReader(const Pathname &patches_file, - const ProcessResource & callback); - - /** - * DTOR - */ - ~PatchesFileReader(); - - private: - class Impl; - RW_pointer > _pimpl; - }; - - - } // ns yum - } // ns parser -} // ns zypp - -#endif /*zypp_source_yum_PatchesFileReader_H*/ - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/parser/yum/RepomdFileReader.cc b/libzypp/zypp/parser/yum/RepomdFileReader.cc deleted file mode 100644 index 6163a78..0000000 --- a/libzypp/zypp/parser/yum/RepomdFileReader.cc +++ /dev/null @@ -1,207 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/yum/RepomdFileReader.cc - * Implementation of repomd.xml file reader. - */ -#include - -#include "zypp/base/String.h" -#include "zypp/base/Logger.h" - -#include "zypp/Pathname.h" -#include "zypp/Date.h" -#include "zypp/CheckSum.h" -#include "zypp/parser/xml/Reader.h" - -#include "zypp/parser/yum/RepomdFileReader.h" - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum" - -using namespace std; -using namespace zypp::xml; -using zypp::repo::yum::ResourceType; - -namespace zypp -{ - namespace parser - { - namespace yum - { - - - /////////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepomdFileReader::Impl - // - class RepomdFileReader::Impl : private base::NonCopyable - { - public: - - /** - * Enumeration of repomd.xml tags. - * \see _tag - */ - enum Tag - { - tag_NONE, - tag_Repomd, - tag_Data, - tag_Location, - tag_CheckSum, - tag_Timestamp, - tag_OpenCheckSum - }; - - public: - /** - * CTOR - * - * \see RepomdFileReader::RepomdFileReader(Pathname,ProcessResource) - */ - Impl(const Pathname &repomd_file, const ProcessResource & callback); - - /** - * Callback provided to the XML parser. - */ - bool consumeNode( Reader & reader_r ); - - - private: - /** Location of metadata file. */ - OnMediaLocation _location; - - /** Used to remember currently processed tag */ - Tag _tag; - - /** Type of metadata file. */ - repo::yum::ResourceType _type; - - /** Function for processing collected data. Passed-in through constructor. */ - ProcessResource _callback; - - /** Checksum of metadata file */ - CheckSum _checksum; - - /** Type of checksum of metadata file */ - std::string _checksum_type; - - /** Metadata file time-stamp. */ - Date _timestamp; - }; - /////////////////////////////////////////////////////////////////////// - - RepomdFileReader::Impl::Impl( - const Pathname &repomd_file, const ProcessResource & callback) - : - _tag(tag_NONE), _type(ResourceType::NONE_e), _callback(callback) - { - Reader reader( repomd_file ); - MIL << "Reading " << repomd_file << endl; - reader.foreachNode( bind( &RepomdFileReader::Impl::consumeNode, this, _1 ) ); - } - - // -------------------------------------------------------------------------- - - /* - * xpath and multiplicity of processed nodes are included in the code - * for convenience: - * - * // xpath: (?|*|+) - * - * if multiplicity is ommited, then the node has multiplicity 'one'. - */ - - // -------------------------------------------------------------------------- - - bool RepomdFileReader::Impl::consumeNode( Reader & reader_r ) - { - if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT ) - { - // xpath: /repomd - if ( reader_r->name() == "repomd" ) - { - _tag = tag_Repomd; - return true; - } - - // xpath: /repomd/data (+) - if ( reader_r->name() == "data" ) - { - _tag = tag_Data; - _type = ResourceType(reader_r->getAttribute("type").asString()); - return true; - } - - // xpath: /repomd/location - if ( reader_r->name() == "location" ) - { - _tag = tag_Location; - _location.setLocation( reader_r->getAttribute("href").asString(), 1 ); - // ignoring attribute xml:base - return true; - } - - // xpath: /repomd/checksum - if ( reader_r->name() == "checksum" ) - { - _tag = tag_CheckSum; - string checksum_type = reader_r->getAttribute("type").asString() ; - string checksum_vaue = reader_r.nodeText().asString(); - _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) ); - return true; - } - - // xpath: /repomd/timestamp - if ( reader_r->name() == "timestamp" ) - { - // ignore it - return true; - } - - //! \todo xpath: /repomd/open-checksum (?) - } - - else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT ) - { - // xpath: /repomd/data - if ( reader_r->name() == "data" ) - { - if (_callback) - _callback( _location, _type ); - - return true; - } - } - - return true; - } - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepomdFileReader - // - /////////////////////////////////////////////////////////////////// - - RepomdFileReader::RepomdFileReader( - const Pathname & repomd_file, const ProcessResource & callback) - : - _pimpl(new Impl(repomd_file, callback)) - {} - - RepomdFileReader::~RepomdFileReader() - {} - - - } // ns yum - } // ns parser -} // ns zypp - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/parser/yum/RepomdFileReader.h b/libzypp/zypp/parser/yum/RepomdFileReader.h deleted file mode 100644 index dd193ea..0000000 --- a/libzypp/zypp/parser/yum/RepomdFileReader.h +++ /dev/null @@ -1,87 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/yum/RepomdFileReader.h - * Interface of repomd.xml file reader. - */ -#ifndef zypp_source_yum_RepomdFileReader_H -#define zypp_source_yum_RepomdFileReader_H - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/Function.h" - -#include "zypp/OnMediaLocation.h" -#include "zypp/repo/yum/ResourceType.h" - -namespace zypp -{ - namespace parser - { - namespace yum - { - - - /** - * Reads through a repomd.xml file and collects type, location, checksum and - * other data about metadata files to be processed. - * - * After each package is read, a \ref OnMediaLocation - * and \ref repo::yum::ResourceType is prepared and \ref _callback - * is called with these two objects passed in. - * - * The \ref _callback is provided on construction. - * - * - * \code - * RepomdFileReader reader(repomd_file, - * bind( &SomeClass::callbackfunc, &SomeClassInstance, _1, _2 ) ); - * \endcode - */ - class RepomdFileReader : private base::NonCopyable - { - public: - /** - * Callback definition. - * First parameter is a \ref OnMediaLocation object with the resource - * second parameter is the resource type. - */ - typedef function< bool( - const OnMediaLocation &, - const repo::yum::ResourceType &)> - ProcessResource; - - /** - * CTOR. Creates also \ref xml::Reader and starts reading. - * - * \param repomd_file is the repomd.xml file you want to read - * \param callback is a function. - * - * \see RepomdFileReader::ProcessResource - */ - RepomdFileReader( - const Pathname & repomd_file, const ProcessResource & callback); - - /** - * DTOR - */ - ~RepomdFileReader(); - - private: - class Impl; - RW_pointer > _pimpl; - }; - - - } // ns yum - } // ns parser -} // ns zypp - -#endif /*zypp_source_yum_RepomdFileReader_H*/ - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/parser/yum/schema/common-inc.rnc b/libzypp/zypp/parser/yum/schema/common-inc.rnc deleted file mode 100644 index fc529b4..0000000 --- a/libzypp/zypp/parser/yum/schema/common-inc.rnc +++ /dev/null @@ -1,72 +0,0 @@ -# private is not an XML namespace, just a holder for reusable -# attribute/element sets - -private.positive = xsd:positiveInteger { pattern="[1-9][0-9]*" } - -private.nonnegative = "0" | private.positive - -# Unix timestamp (seconds since epoch) -# For our purposes, this is always positive -private.unixts = private.positive - -private.size = private.nonnegative - -private.checksum = - (attribute type { "md5" }, xsd:string { length="32" pattern="[0-9a-f]*" }) | - (attribute type { "sha" }, xsd:string { length="40" pattern="[0-9a-f]*" }) | - (attribute type { "sha256" }, xsd:string { length="64" pattern="[0-9a-f]*" }) | - (attribute type { "sha" }, xsd:string { length="32" pattern="[0-9a-f]*" }) -# The last option is totally broken, but is in the wild!!! :( - -private.evr = - attribute epoch { private.nonnegative }?, - attribute ver { text }, - attribute rel { text }? - -private.localizedtext = attribute lang { "en" | "de" }, text - -private.archenum = "noarch" - | "i386" - | "i486" - | "i586" - | "i686" - | "athlon" - | "x86_64" - | "pentium3" - | "pentium4" - | "s390" - | "s390x" - | "ppc" - | "ppc64" - | "ia64" - | "alphaev67" - | "alphaev6" - | "alphapca56" - | "alphaev56" - | "alphaev5" - | "alpha" - | "sparc64v" - | "sparcv9v" - | "sparc64" - | "sparcv9" - | "sparcv8" - | "sparc" - | "aarch64" - | "armv7tnhl" - | "armv7thl" - | "armv7nhl" - | "armv7hl" - | "armv7l" - | "armv6l" - | "armv5tejl" - | "armv5tel" - | "armv5l" - | "armv4tl" - | "armv4l" - | "armv3l" - | "sh3" - | "sh4" - | "sh4a" - | "m68k" - | "src" - diff --git a/libzypp/zypp/parser/yum/schema/common-inc.rng b/libzypp/zypp/parser/yum/schema/common-inc.rng deleted file mode 100644 index 6a2caef..0000000 --- a/libzypp/zypp/parser/yum/schema/common-inc.rng +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - [1-9][0-9]* - - - - - 0 - - - - - - - - - - - - - - - md5 - - - 32 - [0-9a-f]* - - - - - sha - - - 40 - [0-9a-f]* - - - - - sha256 - - - 64 - [0-9a-f]* - - - - - sha - - - 32 - [0-9a-f]* - - - - - - - - - - - - - - - - - - - - en - de - - - - - - - noarch - i386 - i486 - i586 - i686 - athlon - x86_64 - pentium3 - pentium4 - s390 - s390x - ppc - ppc64 - ia64 - alphaev67 - alphaev6 - alphapca56 - alphaev56 - alphaev5 - alpha - sparc64v - sparcv9v - sparc64 - sparcv9 - sparcv8 - sparc - aarch64 - armv7tnhl - armv7thl - armv7nhl - armv7hl - armv7l - armv6l - armv5tejl - armv5tel - armv5l - armv4tl - armv4l - armv3l - sh3 - sh4 - sh4a - m68k - src - - - diff --git a/libzypp/zypp/parser/yum/schema/deltainfo.rnc b/libzypp/zypp/parser/yum/schema/deltainfo.rnc deleted file mode 100644 index 71c2c40..0000000 --- a/libzypp/zypp/parser/yum/schema/deltainfo.rnc +++ /dev/null @@ -1,21 +0,0 @@ -include "common-inc.rnc" - -start = element deltainfo { - element newpackage { - attribute name { text }, - attribute arch { private.archenum }, - attribute version { text }, - attribute release { text }, - element delta { - attribute oldepoch { private.nonnegative }, - # two different formats, with different attribute names with same data - ((attribute oldversion { text }, attribute oldrelease { text }) | - (attribute ver { text }, attribute rel { text })), - element filename { text }, - element sequence { text }, - element size { private.size }, - element checksum { private.checksum } - }+ - }* -} - diff --git a/libzypp/zypp/parser/yum/schema/deltainfo.rng b/libzypp/zypp/parser/yum/schema/deltainfo.rng deleted file mode 100644 index 5fb5946..0000000 --- a/libzypp/zypp/parser/yum/schema/deltainfo.rng +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/filelists.rnc b/libzypp/zypp/parser/yum/schema/filelists.rnc deleted file mode 100644 index da1802b..0000000 --- a/libzypp/zypp/parser/yum/schema/filelists.rnc +++ /dev/null @@ -1,17 +0,0 @@ -default namespace = "http://linux.duke.edu/metadata/filelists" - -include "common-inc.rnc" - -start = element filelists { - attribute packages { xsd:nonNegativeInteger }, - element package { - attribute pkgid { text }, - attribute name { text }, - attribute arch { private.archenum }, - element version { private.evr }, - element file { - attribute type { "dir" | "ghost" }?, - text - }* - }* -} diff --git a/libzypp/zypp/parser/yum/schema/filelists.rng b/libzypp/zypp/parser/yum/schema/filelists.rng deleted file mode 100644 index 48afa75..0000000 --- a/libzypp/zypp/parser/yum/schema/filelists.rng +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - dir - ghost - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/other.rnc b/libzypp/zypp/parser/yum/schema/other.rnc deleted file mode 100644 index 3aafe3a..0000000 --- a/libzypp/zypp/parser/yum/schema/other.rnc +++ /dev/null @@ -1,18 +0,0 @@ -default namespace = "http://linux.duke.edu/metadata/other" - -include "common-inc.rnc" - -start = element otherdata { - attribute packages { private.nonnegative }, - element package { - attribute pkgid { text }, - attribute name { text }, - attribute arch { private.archenum }, - element version { private.evr }, - element changelog { - attribute author { text }, - attribute date { private.unixts }, - text - }* - }* -} diff --git a/libzypp/zypp/parser/yum/schema/other.rng b/libzypp/zypp/parser/yum/schema/other.rng deleted file mode 100644 index 45302f0..0000000 --- a/libzypp/zypp/parser/yum/schema/other.rng +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/patch.rnc b/libzypp/zypp/parser/yum/schema/patch.rnc deleted file mode 100644 index 46cc255..0000000 --- a/libzypp/zypp/parser/yum/schema/patch.rnc +++ /dev/null @@ -1,146 +0,0 @@ -default namespace = "http://novell.com/package/metadata/suse/patch" -namespace yum = "http://linux.duke.edu/metadata/common" -namespace suse = "http://novell.com/package/metadata/suse/common" - -include "rpm-inc.rnc" - -yum.name = element yum:name { text } - -yum.arch = element yum:arch { private.archenum } - -yum.version = element yum:version { - private.evr -} - -suse.freshens = element suse:freshens { - element suse:entry { - attribute kind { "package" }, - attribute name { text } - }+ -} - -group.deps = rpm.requires?, rpm.obsoletes?, rpm.provides?, rpm.recommends?, rpm.supplements?, rpm.conflicts?, suse.freshens? - -patch.location = element location { - attribute href { xsd:anyURI } -} - -patch.checksum = element checksum { - private.checksum -} - -patch.time = element time { - attribute file { private.unixts }, - attribute build { private.unixts } -} - -patch.size = element size { - attribute package { private.size }, - attribute archive { private.size } -} - -start = element patch { - attribute patchid { text }, - attribute timestamp { private.unixts }, - attribute engine { "1.0" }, - yum.name, - element summary { - private.localizedtext - }+, - element description { - private.localizedtext - }+, - element license-to-confirm { - private.localizedtext - }?, - yum.version, - group.deps, - element reboot-needed { empty }?, - element package-manager { empty }?, - element category { "security" | "recommended" | "optional" }, - # This is in two places (with slightly different definiton) - # because that is what is seen in the wild - element license-to-confirm { - text - }?, - element atoms { - element message { - yum.name, - yum.version, - element text { - private.localizedtext - }, - group.deps - }?, - element yum:package { - attribute type { "rpm" }, - yum.name, - yum.arch, - yum.version, - element yum:checksum { - attribute pkgid { "YES" }, - private.checksum - }, - element yum:time { - attribute file { private.unixts }, - attribute build { private.unixts } - }, - element yum:size { - attribute package { private.size }, - attribute installed { private.size }, - attribute archive { xsd:nonNegativeInteger } - }, - element yum:location { - attribute href { xsd:anyURI } - }, - element yum:format { - group.deps - }, - element pkgfiles { - element patchrpm { - patch.location, - patch.checksum, - patch.time, - patch.size, - element base-version { - private.evr - }+ - }?, - element deltarpm { - patch.location, - patch.checksum, - patch.time, - patch.size, - element base-version { - private.evr, - attribute md5sum { xsd:string { length="32" pattern="[0-9a-f]*" } }, - attribute buildtime { private.unixts }, - attribute sequence_info { text } - } - }* - } - }*, - element message { - yum.name, - yum.version, - element text { - private.localizedtext - }, - group.deps - }?, - element script { - yum.name, - yum.version, - # Script can either be remote (do-location and do-checksum) - # or inline (do), but not both - ((element do-location { - attribute href { xsd:anyURI } - }, - element do-checksum { - private.checksum - }) | element do { text }), - group.deps - }? - }? -} - diff --git a/libzypp/zypp/parser/yum/schema/patch.rng b/libzypp/zypp/parser/yum/schema/patch.rng deleted file mode 100644 index 8c54b01..0000000 --- a/libzypp/zypp/parser/yum/schema/patch.rng +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - security - recommended - optional - - - - - - - - - - - - - - - - - - - - - - - - rpm - - - - - - - YES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 - [0-9a-f]* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/patches.rnc b/libzypp/zypp/parser/yum/schema/patches.rnc deleted file mode 100644 index 3819bcd..0000000 --- a/libzypp/zypp/parser/yum/schema/patches.rnc +++ /dev/null @@ -1,16 +0,0 @@ -default namespace = "http://novell.com/package/metadata/suse/patches" - -include "common-inc.rnc" - -start = element patches { - element patch { - attribute id { text }, - element checksum { - private.checksum - }, - element location { - attribute href { xsd:anyURI } - }, - element category { "recommended" | "security" | "optional" }? - }* -} diff --git a/libzypp/zypp/parser/yum/schema/patches.rng b/libzypp/zypp/parser/yum/schema/patches.rng deleted file mode 100644 index b386da3..0000000 --- a/libzypp/zypp/parser/yum/schema/patches.rng +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - recommended - security - optional - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/patterns.rnc b/libzypp/zypp/parser/yum/schema/patterns.rnc deleted file mode 100644 index 6efa68c..0000000 --- a/libzypp/zypp/parser/yum/schema/patterns.rnc +++ /dev/null @@ -1,30 +0,0 @@ -namespace suse = "http://novell.com/package/metadata/suse/pattern" -namespace rpm = "http://linux.duke.edu/metadata/rpm" - -include "rpm-inc.rnc" - -suse.uservisible = element suse:uservisible { empty } - -suse.category = element suse:category { private.localizedtext } - -suse.plaincat = element suse:category { text } - -start = element patterns { - # seen missing in the wild - attribute count { xsd:nonNegativeInteger }?, - element suse:pattern { - element suse:name { text }, - element suse:arch { private.archenum }?, - element suse:version { private.evr }?, - element suse:summary { text }, - element suse:description { text }?, - ((suse.uservisible, suse.category?) | (suse.plaincat, suse.uservisible?)), - rpm.provides?, - element rpm:freshens { - rpm.entry+ - }?, - rpm.suggests?, - rpm.requires?, - rpm.recommends? - }+ -} diff --git a/libzypp/zypp/parser/yum/schema/patterns.rng b/libzypp/zypp/parser/yum/schema/patterns.rng deleted file mode 100644 index 3d0c6bb..0000000 --- a/libzypp/zypp/parser/yum/schema/patterns.rng +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/primary.rnc b/libzypp/zypp/parser/yum/schema/primary.rnc deleted file mode 100644 index a8de88b..0000000 --- a/libzypp/zypp/parser/yum/schema/primary.rnc +++ /dev/null @@ -1,88 +0,0 @@ -default namespace = "http://linux.duke.edu/metadata/common" -namespace rpm = "http://linux.duke.edu/metadata/rpm" -namespace suse = "http://novell.com/package/metadata/suse/common" - -include "rpm-inc.rnc" - -yum.name = element name { text } - -yum.arch = element arch { private.archenum } - -yum.version = element version { - private.evr -} - -group.deps = rpm.provides?, rpm.requires?, rpm.conflicts?, - rpm.obsoletes?, rpm.suggests?, rpm.recommends?, - rpm.supplements?, rpm.enhances? - -group.deps1 = rpm.provides?, rpm.requires?, rpm.conflicts?, - rpm.obsoletes?, rpm.suggests?, rpm.enhances?, rpm.recommends?, - rpm.supplements? - - -group.deps2 = rpm.provides?, rpm.conflicts?, rpm.obsoletes?, rpm.enhances?, - rpm.supplements?, rpm.suggests?, rpm.recommends?, - rpm.requires? - -yum.location = element location { - attribute href { xsd:anyURI } -} - -yum.checksum = element checksum { - attribute pkgid { "YES" }, - private.checksum -} - -yum.time = element time { - attribute file { private.unixts }, - attribute build { private.unixts } -} - -yum.size = element size { - attribute package { private.size }, - # Found this blank in the wild - attribute archive { private.size | "" }, - attribute installed { private.size } -} - -start = element metadata { - attribute packages { private.nonnegative }, - element package { - attribute type { "rpm" }, - yum.name, - yum.arch, - yum.version, - yum.checksum, - # Found unlocalized in the wild - element summary { private.localizedtext | text }, - element description { private.localizedtext | text }, - element packager { text }, - # 10-SP1 stuff has a broken URL in the wild - element url { xsd:anyURI | text }, - yum.time, - yum.size, - yum.location, - element format { - element rpm:license { text }, - element rpm:vendor { text }, - element rpm:group { text }, - element rpm:buildhost { text }, - # Two different options seen in the wild - # one omits the element, the other leaves the value empty - element rpm:sourcerpm { text | empty }?, - element rpm:header-range { - attribute start { private.positive }, - attribute end { private.positive } - }, - # any of these orders is valid, all are in use - (group.deps | group.deps1 | group.deps2), - element file { - attribute type { "dir" | "ghost" }?, - text - }* - }, - element suse:license-to-confirm { text }? - }* -} - diff --git a/libzypp/zypp/parser/yum/schema/primary.rng b/libzypp/zypp/parser/yum/schema/primary.rng deleted file mode 100644 index 3f4fc45..0000000 --- a/libzypp/zypp/parser/yum/schema/primary.rng +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - YES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rpm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dir - ghost - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/product.rnc b/libzypp/zypp/parser/yum/schema/product.rnc deleted file mode 100644 index c8e60d1..0000000 --- a/libzypp/zypp/parser/yum/schema/product.rnc +++ /dev/null @@ -1,22 +0,0 @@ -default namespace = "http://novell.com/package/metadata/suse/product" - -include "rpm-inc.rnc" - -start = element product { - attribute type { "add-on" | "base" }, - element vendor { text }, - element name { text }, - element arch { private.archenum }, - element version { private.evr }, - element displayname { private.localizedtext }, - element shortname { text }, - element distribution-name { text }, - element distribution-edition { text }, - element description { private.localizedtext }, - element release-notes-url { xsd:anyURI }?, - rpm.provides, - rpm.obsoletes?, - rpm.requires?, - rpm.conflicts? -} - diff --git a/libzypp/zypp/parser/yum/schema/product.rng b/libzypp/zypp/parser/yum/schema/product.rng deleted file mode 100644 index 1b97f32..0000000 --- a/libzypp/zypp/parser/yum/schema/product.rng +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - add-on - base - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/products.rnc b/libzypp/zypp/parser/yum/schema/products.rnc deleted file mode 100644 index 8e69fd3..0000000 --- a/libzypp/zypp/parser/yum/schema/products.rnc +++ /dev/null @@ -1,15 +0,0 @@ -include "common-inc.rnc" - -start = element products { - element product { - attribute id { text }?, - attribute schemeversion { "0" }?, - element name { text }, - element version { private.evr }, - element arch { private.archenum }, - element vendor { text }, - element summary { text }, - element description { text } - }+ -} - diff --git a/libzypp/zypp/parser/yum/schema/products.rng b/libzypp/zypp/parser/yum/schema/products.rng deleted file mode 100644 index a4a0e2a..0000000 --- a/libzypp/zypp/parser/yum/schema/products.rng +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/repomd.rnc b/libzypp/zypp/parser/yum/schema/repomd.rnc deleted file mode 100644 index 8ae2538..0000000 --- a/libzypp/zypp/parser/yum/schema/repomd.rnc +++ /dev/null @@ -1,29 +0,0 @@ -default namespace = "http://linux.duke.edu/metadata/repo" - -include "common-inc.rnc" - -repomd.location = element location { - attribute href { xsd:anyURI } -} -repomd.meta = element checksum { - private.checksum -}, -# Oddity in the wild: a timestamp wiht a decimal -element timestamp { private.unixts | xsd:decimal }, -element size { private.positive }?, -element open-size { private.positive }?, -element open-checksum { - private.checksum -} - - -start = element repomd { - element revision { private.unixts }?, - element tags { - element repo { xsd:anyURI } - }?, - element data { - attribute type { "deltainfo" | "filelists" | "other" | "primary" | "susedata" | "suseinfo" | "updateinfo" | "patches" | "products" | "product" | "patterns" | "pattern" }, - ((repomd.meta, repomd.location) | (repomd.location, repomd.meta)) - }* -} diff --git a/libzypp/zypp/parser/yum/schema/repomd.rng b/libzypp/zypp/parser/yum/schema/repomd.rng deleted file mode 100644 index 0233022..0000000 --- a/libzypp/zypp/parser/yum/schema/repomd.rng +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - deltainfo - filelists - other - primary - susedata - suseinfo - updateinfo - patches - products - product - patterns - pattern - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/rnc2rng b/libzypp/zypp/parser/yum/schema/rnc2rng deleted file mode 100755 index cd65ef6..0000000 --- a/libzypp/zypp/parser/yum/schema/rnc2rng +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -for i in *.rnc; do - g=${i%.rnc}.rng - test $i -ot $g && continue - echo $i... - trang -I rnc -O rng $i $g -done diff --git a/libzypp/zypp/parser/yum/schema/rpm-inc.rnc b/libzypp/zypp/parser/yum/schema/rpm-inc.rnc deleted file mode 100644 index e512c7a..0000000 --- a/libzypp/zypp/parser/yum/schema/rpm-inc.rnc +++ /dev/null @@ -1,45 +0,0 @@ -namespace rpm = "http://linux.duke.edu/metadata/rpm" - -include "common-inc.rnc" - -rpm.entry = element rpm:entry { - attribute pre { "1" }?, - attribute kind { "atom" | "message" | "package" | "script" | "product" | "patch" | "pattern" }?, - attribute name { text }, - (private.evr, - attribute flags { "EQ" | "GE" | "LE" | "LT" | "GT" })? -} - -rpm.requires = element rpm:requires { - # pre should not be here, but it is in the wild - attribute pre { "1" }?, - rpm.entry* -} - -rpm.obsoletes = element rpm:obsoletes { - rpm.entry+ -} - -rpm.provides = element rpm:provides { - rpm.entry* -} - -rpm.recommends = element rpm:recommends { - rpm.entry* -} - -rpm.supplements = element rpm:supplements { - rpm.entry* -} - -rpm.conflicts = element rpm:conflicts { - rpm.entry+ -} - -rpm.enhances = element rpm:enhances { - rpm.entry+ -} - -rpm.suggests = element rpm:suggests { - rpm.entry* -} diff --git a/libzypp/zypp/parser/yum/schema/rpm-inc.rng b/libzypp/zypp/parser/yum/schema/rpm-inc.rng deleted file mode 100644 index 1ae4097..0000000 --- a/libzypp/zypp/parser/yum/schema/rpm-inc.rng +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - 1 - - - - - - atom - message - package - script - product - patch - pattern - - - - - - - - - EQ - GE - LE - LT - GT - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/susedata.rnc b/libzypp/zypp/parser/yum/schema/susedata.rnc deleted file mode 100644 index aba6301..0000000 --- a/libzypp/zypp/parser/yum/schema/susedata.rnc +++ /dev/null @@ -1,31 +0,0 @@ -namespace susedata = "http://linux.duke.edu/metadata/susedata" - -include "common-inc.rnc" - -ns.susedata = element susedata:susedata { - attribute packages { private.nonnegative }, - element susedata:package { - attribute pkgid { text }, - attribute name { text }, - attribute arch { private.archenum }, - element susedata:version { private.evr }, - element susedata:eula { text }?, - element susedata:keyword { text }? - }* -} - -plain.susedata = element susedata { - attribute packages { private.nonnegative }, - element package { - attribute pkgid { text }, - attribute name { text }, - attribute arch { private.archenum }, - element version { private.evr }, - element eula { text }?, - element keyword { text }? - }* -} - -# Unfortunately there are some susedata files without namespaces in the wild -start = (ns.susedata | plain.susedata) - diff --git a/libzypp/zypp/parser/yum/schema/susedata.rng b/libzypp/zypp/parser/yum/schema/susedata.rng deleted file mode 100644 index 137b783..0000000 --- a/libzypp/zypp/parser/yum/schema/susedata.rng +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/suseinfo.rnc b/libzypp/zypp/parser/yum/schema/suseinfo.rnc deleted file mode 100644 index d05e718..0000000 --- a/libzypp/zypp/parser/yum/schema/suseinfo.rnc +++ /dev/null @@ -1,19 +0,0 @@ -namespace yum = "http://linux.duke.edu/metadata/repo" - -include "common-inc.rnc" - -# There is a horribly broken suseinfo variant we have to handle -good = element yum:suseinfo { - element yum:expire { private.positive } -} - -bad = element suseinfo { - element keywords { - element k { empty } - }, - element products { - element id { empty } - } -} - -start = (good | bad) diff --git a/libzypp/zypp/parser/yum/schema/suseinfo.rng b/libzypp/zypp/parser/yum/schema/suseinfo.rng deleted file mode 100644 index 0277bd9..0000000 --- a/libzypp/zypp/parser/yum/schema/suseinfo.rng +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/updateinfo.rnc b/libzypp/zypp/parser/yum/schema/updateinfo.rnc deleted file mode 100644 index fc7b4dc..0000000 --- a/libzypp/zypp/parser/yum/schema/updateinfo.rnc +++ /dev/null @@ -1,51 +0,0 @@ -default namespace = "http://novell.com/package/metadata/suse/updateinfo" - -include "common-inc.rnc" - -start = element updates { - element update { - # Seen missing in the wild - attribute from { "maint-coord@suse.de" }?, - attribute status { "stable" }, - attribute type { "recommended" | "security" | "optional" | "feature" }, - attribute version { xsd:string }, - element id { text }, - element title { text }, - # Seen missing in the wild - element release { text }?, - # Usually with date attribute, but seen in the wild with content instead - element issued { - (attribute date { private.unixts } | private.unixts) - }, - # Seen missing in the wild - element references { - element reference { - # Appears to always start with https://bugzilla.novellc.om/show_bug.cgi?id= - # if type="bugzilla" and http://cve.mitre.org/cgi-bin/cvename.cgi?name= - # if type="cve" - attribute href { xsd:anyURI }, - attribute id { xsd:string }, - attribute title { xsd:string }, - attribute type { "bugzilla" | "cve" } - }+ - }?, - element description { text }, - element pkglist { - element collection { - element package { - attribute name { xsd:string }, - attribute arch { private.archenum }, - # not private.evr because "version" and "release" are spelled out - attribute epoch { private.nonnegative }?, - attribute version { text }?, - attribute release { text }?, - element filename { text }, - element restart_suggested { "1" }?, - element reboot_suggested { "1" }?, - element relogin_suggested { "1" }? - }+ - } - } - }+ -} - diff --git a/libzypp/zypp/parser/yum/schema/updateinfo.rng b/libzypp/zypp/parser/yum/schema/updateinfo.rng deleted file mode 100644 index 1fcf3d0..0000000 --- a/libzypp/zypp/parser/yum/schema/updateinfo.rng +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - maint-coord@suse.de - - - - stable - - - - recommended - security - optional - feature - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bugzilla - cve - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - 1 - - - - - 1 - - - - - - - - - - - diff --git a/libzypp/zypp/parser/yum/schema/validate-all b/libzypp/zypp/parser/yum/schema/validate-all deleted file mode 100755 index 7124e95..0000000 --- a/libzypp/zypp/parser/yum/schema/validate-all +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash -DEBUG=1 - -TARGET=/mounts/you -#TARGET=/mounts/dist/ibs -#TARGET=/mounts/mirror/SuSE/* - -SCHEMAS=$(dirname "$0") - -val_jing_compact() { - gzip -dcf "$2" | jing -c "$SCHEMAS/$1.rnc" /proc/self/fd/0 -} - -val_jing() { - gzip -dcf "$2" | jing "$SCHEMAS/$1.rng" /proc/self/fd/0 -} - -val_xmllint() { - gzip -dcf "$2" | xmllint --noout --relaxng "$SCHEMAS/$1.rng" - 2>/dev/null -} - -validate() { - [ $DEBUG -gt 4 ] && echo "$2" >&2 - if [ ! -f "$2" ]; then - echo "File missing: $2" - return 5 - fi - $VAL "$1" "$2" - if [ $? -ne 0 ]; then - echo "Validation failed: $2 (using $1)" - return 2 - fi -} - -get_xpath_href() { - xpath "$1" "$2" 2>/dev/null | sed -r -e 's/ href="/\n/g;s/$/\n/' \ - | sed -e 's/"$//' | tail -n +2 -} - -get_data_type() { - get_xpath_href "$1" '/repomd/data[@type="'"$2"'"]/location/@href' -} - -get_patches() { - get_xpath_href "$1" '/patches/patch/location/@href' -} - -if [ $(type -p xmllint) ]; then - VAL=val_xmllint -elif [ $(type -p jing) ]; then - VAL=val_jing_compact -else - echo "No validators found!!" - exit 100 -fi - -if [ -z $(type -p xpath) ]; then - echo "xpath command not fond" -fi - -find $TARGET -noleaf -name 'repomd.xml' 2>/dev/null | while read FN; do - [ $DEBUG -gt 0 ] && echo "$FN" >&2 - validate repomd "$FN" -# [ $? -eq 0 ] || break - D=$(dirname "$FN") - BASE=$(dirname "$D") - B=$(basename "$D") - if [ "$B" != "repodata" ]; then - echo "Found $FN not in repodata directory" - exit 3 - fi - - get_data_type "$FN" patterns | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate patterns "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" pattern | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate patterns "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" primary | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate primary "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" other | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate other "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" filelists | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate filelists "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" suseinfo | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate suseinfo "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" susedata | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate susedata "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" product | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate product "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" products | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate products "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" updateinfo | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate updateinfo "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" deltainfo | while read UIFN; do - [ $DEBUG -gt 1 ] && echo "$UIFN" >&2 - validate deltainfo "$BASE/$UIFN" - [ $? -eq 0 ] || exit 11 - done - - get_data_type "$FN" patches | while read PFN; do - [ $DEBUG -gt 1 ] && echo "$PFN" >&2 - validate patches "$BASE/$PFN" - [ $? -eq 0 ] || exit 12 - get_patches "$BASE/$PFN" | while read PATCH; do - [ $DEBUG -gt 2 ] && echo "$PATCH" >&2 - validate patch "$BASE/$PATCH" - [ $? -eq 0 ] || exit 13 - done - done -done diff --git a/libzypp/zypp/pool/ByIdent.h b/libzypp/zypp/pool/ByIdent.h deleted file mode 100644 index 3f8b192..0000000 --- a/libzypp/zypp/pool/ByIdent.h +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/ByIdent.h - * -*/ -#ifndef ZYPP_POOL_BYIDENT_H -#define ZYPP_POOL_BYIDENT_H - -#include "zypp/PoolItem.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - /** Main filter selecting PoolItems by \c name and \c kind. - */ - class ByIdent - { - public: - ByIdent() - : _id( 0 ) - {} - - explicit ByIdent( sat::Solvable slv_r ) - : _id( makeIdent( slv_r ) ) - {} - - explicit ByIdent( IdString ident_r ) - : _id( ident_r.id() ) - {} - - ByIdent( ResKind kind_r, IdString name_r ) - : _id( makeIdent( kind_r, name_r ) ) - {} - - ByIdent( ResKind kind_r, const C_Str & name_r ) - : _id( makeIdent( kind_r, name_r ) ) - {} - - public: - bool operator()( sat::Solvable slv_r ) const - { - return _id >= 0 ? ( slv_r.ident().id() == _id && ! slv_r.isKind( ResKind::srcpackage ) ) - : ( slv_r.ident().id() == -_id && slv_r.isKind( ResKind::srcpackage ) ); - } - - bool operator()( const PoolItem & pi_r ) const - { return operator()( pi_r.satSolvable() ); } - - bool operator()( ResObject::constPtr p_r ) const - { return p_r ? operator()( p_r->satSolvable() ) : !_id; } - - private: - sat::detail::IdType makeIdent( sat::Solvable slv_r ) - { - return slv_r.isKind( ResKind::srcpackage ) ? -slv_r.ident().id() - : slv_r.ident().id(); - } - - sat::detail::IdType makeIdent( ResKind kind_r, IdString name_r ) - { - if ( kind_r == ResKind::package ) - return name_r.id(); - else if ( kind_r == ResKind::srcpackage ) - return -name_r.id(); - return IdString( str::form( "%s:%s", kind_r.c_str(), name_r.c_str() ) ).id(); - } - - sat::detail::IdType makeIdent( ResKind kind_r, const C_Str & name_r ) - { - if ( kind_r == ResKind::package ) - return IdString( name_r ).id(); - else if ( kind_r == ResKind::srcpackage ) - return -(IdString( name_r ).id()); - return IdString( str::form( "%s:%s", kind_r.c_str(), name_r.c_str() ) ).id(); - } - - public: - sat::detail::IdType get() const { return _id; } - - private: - /** negative \c _id for \c srcpackage, as they use the same \c ident - * as \c package. - */ - sat::detail::IdType _id; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOL_BYIDENT_H diff --git a/libzypp/zypp/pool/PoolImpl.cc b/libzypp/zypp/pool/PoolImpl.cc deleted file mode 100644 index 23d803a..0000000 --- a/libzypp/zypp/pool/PoolImpl.cc +++ /dev/null @@ -1,54 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/PoolImpl.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/pool/PoolImpl.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // Class PoolImpl::PoolImpl - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolImpl::PoolImpl - // METHOD TYPE : Ctor - // - PoolImpl::PoolImpl() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolImpl::~PoolImpl - // METHOD TYPE : Dtor - // - PoolImpl::~PoolImpl() - {} - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/pool/PoolImpl.h b/libzypp/zypp/pool/PoolImpl.h deleted file mode 100644 index 9c0aeb5..0000000 --- a/libzypp/zypp/pool/PoolImpl.h +++ /dev/null @@ -1,421 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/PoolImpl.h - * -*/ -#ifndef ZYPP_POOL_POOLIMPL_H -#define ZYPP_POOL_POOLIMPL_H - -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/SerialNumber.h" -#include "zypp/APIConfig.h" - -#include "zypp/pool/PoolTraits.h" -#include "zypp/ResPoolProxy.h" -#include "zypp/PoolQueryResult.h" - -#include "zypp/sat/Pool.h" -#include "zypp/Product.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - namespace resstatus - { - /** Manipulator for \ref ResStatus::UserLockQueryField. - * Field is not public available. It is intended to remember the - * initial lock status usually derived from /etc/zypp/locks. So - * we are able to detect changes we have to write back on commit. - */ - struct UserLockQueryManip - { - /** Set lock and UserLockQuery bit according to \c yesno_r. */ - static void setLock( ResStatus & status_r, bool yesno_r ) - { - status_r.setLock( yesno_r, ResStatus::USER ); - status_r.setUserLockQueryMatch( yesno_r ); - } - - /** Update lock and UserLockQuery bit IFF the item gained the bit. */ - static void reapplyLock( ResStatus & status_r, bool yesno_r ) - { - if ( yesno_r && ! status_r.isUserLockQueryMatch() ) - { - status_r.setLock( yesno_r, ResStatus::USER ); - status_r.setUserLockQueryMatch( yesno_r ); - } - } - - /** Test whether the lock status differs from the remembered UserLockQuery bit. */ - static int diffLock( const ResStatus & status_r ) - { - bool userLock( status_r.isUserLocked() ); - if ( userLock == status_r.isUserLockQueryMatch() ) - return 0; - return userLock ? 1 : -1; - } - - }; - } - - namespace - { - inline PoolQuery makeTrivialQuery( IdString ident_r ) - { - sat::Solvable::SplitIdent ident( ident_r ); - - PoolQuery q; - q.addAttribute( sat::SolvAttr::name, ident.name().asString() ); - q.addKind( ident.kind() ); - q.setMatchExact(); - q.setCaseSensitive(true); - return q; - } - - inline bool hardLockQueriesRemove( pool::PoolTraits::HardLockQueries & activeLocks_r, IdString ident_r ) - { - unsigned s( activeLocks_r.size() ); - activeLocks_r.remove( makeTrivialQuery( ident_r ) ); - return( activeLocks_r.size() != s ); - } - - inline bool hardLockQueriesAdd( pool::PoolTraits::HardLockQueries & activeLocks_r, IdString ident_r ) - { - PoolQuery q( makeTrivialQuery( ident_r ) ); - for_( it, activeLocks_r.begin(), activeLocks_r.end() ) - { - if ( *it == q ) - return false; - } - activeLocks_r.push_back( q ); - return true; - } - } - - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolImpl - // - /** */ - class PoolImpl - { - friend std::ostream & operator<<( std::ostream & str, const PoolImpl & obj ); - - public: - /** */ - typedef PoolTraits::ItemContainerT ContainerT; - typedef PoolTraits::size_type size_type; - typedef PoolTraits::const_iterator const_iterator; - typedef PoolTraits::Id2ItemT Id2ItemT; - - typedef PoolTraits::repository_iterator repository_iterator; - - typedef sat::detail::SolvableIdType SolvableIdType; - - public: - /** Default ctor */ - PoolImpl(); - /** Dtor */ - ~PoolImpl(); - - public: - /** convenience. */ - const sat::Pool satpool() const - { return sat::Pool::instance(); } - - /** Housekeeping data serial number. */ - const SerialNumber & serial() const - { return satpool().serial(); } - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - public: - /** */ - bool empty() const - { return satpool().solvablesEmpty(); } - - /** */ - size_type size() const - { return satpool().solvablesSize(); } - - const_iterator begin() const - { return make_filter_begin( pool::ByPoolItem(), store() ); } - - const_iterator end() const - { return make_filter_end( pool::ByPoolItem(), store() ); } - - public: - /** Return the corresponding \ref PoolItem. - * Pool and sat pool should be in sync. Returns an empty - * \ref PoolItem if there is no corresponding \ref PoolItem. - * \see \ref PoolItem::satSolvable. - */ - PoolItem find( const sat::Solvable & slv_r ) const - { - const ContainerT & mystore( store() ); - return( slv_r.id() < mystore.size() ? mystore[slv_r.id()] : PoolItem() ); - } - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - public: - /** \name Save and restore state. */ - //@{ - void SaveState( const ResObject::Kind & kind_r ); - - void RestoreState( const ResObject::Kind & kind_r ); - //@} - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - public: - ResPoolProxy proxy( ResPool self ) const - { - checkSerial(); - if ( !_poolProxy ) - { - _poolProxy.reset( new ResPoolProxy( self, *this ) ); - } - return *_poolProxy; - } - - public: - /** Forward list of Repositories that contribute ResObjects from \ref sat::Pool */ - size_type knownRepositoriesSize() const - { checkSerial(); return satpool().reposSize(); } - - repository_iterator knownRepositoriesBegin() const - { checkSerial(); return satpool().reposBegin(); } - - repository_iterator knownRepositoriesEnd() const - { checkSerial(); return satpool().reposEnd(); } - - Repository reposFind( const std::string & alias_r ) const - { checkSerial(); return satpool().reposFind( alias_r ); } - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - public: - typedef PoolTraits::HardLockQueries HardLockQueries; - typedef PoolTraits::hardLockQueries_iterator hardLockQueries_iterator; - - const HardLockQueries & hardLockQueries() const - { return _hardLockQueries; } - - void reapplyHardLocks() const - { - // It is assumed that reapplyHardLocks is called after new - // items were added to the pool, but the _hardLockQueries - // did not change since. Action is to be performed only on - // those items that gained the bit in the UserLockQueryField. - MIL << "Re-apply " << _hardLockQueries.size() << " HardLockQueries" << endl; - PoolQueryResult locked; - for_( it, _hardLockQueries.begin(), _hardLockQueries.end() ) - { - locked += *it; - } - MIL << "HardLockQueries match " << locked.size() << " Solvables." << endl; - for_( it, begin(), end() ) - { - resstatus::UserLockQueryManip::reapplyLock( it->status(), locked.contains( *it ) ); - } - } - - void setHardLockQueries( const HardLockQueries & newLocks_r ) - { - MIL << "Apply " << newLocks_r.size() << " HardLockQueries" << endl; - _hardLockQueries = newLocks_r; - // now adjust the pool status - PoolQueryResult locked; - for_( it, _hardLockQueries.begin(), _hardLockQueries.end() ) - { - locked += *it; - } - MIL << "HardLockQueries match " << locked.size() << " Solvables." << endl; - for_( it, begin(), end() ) - { - resstatus::UserLockQueryManip::setLock( it->status(), locked.contains( *it ) ); - } - } - - bool getHardLockQueries( HardLockQueries & activeLocks_r ) - { - activeLocks_r = _hardLockQueries; // current queries - // Now diff to the pool collecting names only. - // Thus added and removed locks are not necessarily - // disjoint. Added locks win. - typedef std::tr1::unordered_set IdentSet; - IdentSet addedLocks; - IdentSet removedLocks; - for_( it, begin(), end() ) - { - switch ( resstatus::UserLockQueryManip::diffLock( it->status() ) ) - { - case 0: // unchanged - break; - case 1: - addedLocks.insert( it->satSolvable().ident() ); - break; - case -1: - removedLocks.insert( it->satSolvable().ident() ); - break; - } - } - // now the bad part - adjust the queries - bool setChanged = false; - for_( it, removedLocks.begin(), removedLocks.end() ) - { - if ( addedLocks.find( *it ) != addedLocks.end() ) - continue; // Added locks win - if ( hardLockQueriesRemove( activeLocks_r, *it ) && ! setChanged ) - setChanged = true; - } - for_( it, addedLocks.begin(), addedLocks.end() ) - { - if ( hardLockQueriesAdd( activeLocks_r, *it ) && ! setChanged ) - setChanged = true; - } - return setChanged; - } - - public: - const ContainerT & store() const - { - checkSerial(); - if ( _storeDirty ) - { - sat::Pool pool( satpool() ); - bool addedItems = false; - std::list addedProducts; - - _store.resize( pool.capacity() ); - - if ( pool.capacity() ) - { - for ( sat::detail::SolvableIdType i = pool.capacity()-1; i != 0; --i ) - { - sat::Solvable s( i ); - PoolItem & pi( _store[i] ); - if ( ! s && pi ) - { - // the PoolItem got invalidated (e.g unloaded repo) - pi = PoolItem(); - } - else if ( s && ! pi ) - { - // new PoolItem to add - pi = PoolItem::makePoolItem( s ); // the only way to create a new one! - // remember products for buddy processing (requires clean store) - if ( s.isKind( ResKind::product ) ) - addedProducts.push_back( pi ); - if ( !addedItems ) - addedItems = true; - } - } - } - _storeDirty = false; - - // Now, as the pool is adjusted, .... - - // .... we check for product buddies. - if ( ! addedProducts.empty() ) - { - for_( it, addedProducts.begin(), addedProducts.end() ) - { - it->setBuddy( asKind(*it)->referencePackage() ); - } - } - - // .... we must reapply those query based hard locks. - if ( addedItems ) - { - reapplyHardLocks(); - } - } - return _store; - } - - const Id2ItemT & id2item () const - { - checkSerial(); - if ( _id2itemDirty ) - { - store(); - _id2item = Id2ItemT( size() ); - for_( it, begin(), end() ) - { - const sat::Solvable &s = (*it)->satSolvable(); - sat::detail::IdType id = s.ident().id(); - if ( s.isKind( ResKind::srcpackage ) ) - id = -id; - _id2item.insert( std::make_pair( id, *it ) ); - } - //INT << _id2item << endl; - _id2itemDirty = false; - } - return _id2item; - } - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - private: - void checkSerial() const - { - if ( _watcher.remember( serial() ) ) - invalidate(); - satpool().prepare(); // always ajust dependencies. - } - - void invalidate() const - { - _storeDirty = true; - _id2itemDirty = true; - _id2item.clear(); - _poolProxy.reset(); - } - - private: - /** Watch sat pools serial number. */ - SerialNumberWatcher _watcher; - mutable ContainerT _store; - mutable DefaultIntegral _storeDirty; - mutable Id2ItemT _id2item; - mutable DefaultIntegral _id2itemDirty; - - private: - mutable shared_ptr _poolProxy; - - private: - /** Set of queries that define hardlocks. */ - HardLockQueries _hardLockQueries; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOL_POOLIMPL_H diff --git a/libzypp/zypp/pool/PoolStats.cc b/libzypp/zypp/pool/PoolStats.cc deleted file mode 100644 index 9b19531..0000000 --- a/libzypp/zypp/pool/PoolStats.cc +++ /dev/null @@ -1,46 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/PoolStats.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/pool/PoolStats.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const PoolStats & obj ) - { - str << "ResObjects: " << obj._total; - for( PoolStats::KindMap::const_iterator it = obj._perKind.begin(); it != obj._perKind.end(); ++it ) - { - str << endl << " " << it->first << ":\t" << it->second; - } - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/pool/PoolStats.h b/libzypp/zypp/pool/PoolStats.h deleted file mode 100644 index a01abed..0000000 --- a/libzypp/zypp/pool/PoolStats.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/PoolStats.h - * -*/ -#ifndef ZYPP_POOL_POOLSTATS_H -#define ZYPP_POOL_POOLSTATS_H - -#include - -#include "zypp/base/Iterator.h" -#include "zypp/base/Functional.h" -#include "zypp/base/Counter.h" -#include "zypp/ResObject.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolStats - // - /** Functor counting ResObjects per Kind. - * \see dumpPoolStats - * \code - * Total: 2830 - * language: 81 - * package: 2710 - * product: 2 - * selection: 36 - * system: 1 - * \endcode - */ - struct PoolStats : public std::unary_function - { - void operator()( ResObject::constPtr ptr ) - { - ++_total; - ++_perKind[ptr->kind()]; - } - public: - typedef std::map > KindMap; - Counter _total; - KindMap _perKind; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates PoolStats Stream output */ - std::ostream & operator<<( std::ostream & str, const PoolStats & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - - /** \relates pool::PoolStats Convenience to count and print out the - * number of ResObjects per Kind in a container. - * Fits container of ResObject::Ptr or PoolItem. - */ - template - std::ostream & dumpPoolStats( std::ostream & str, - _Iterator begin_r, _Iterator end_r ) - { - pool::PoolStats stats; - std::for_each( begin_r, end_r, - functor::functorRef(stats) ); - return str << stats; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOL_POOLSTATS_H diff --git a/libzypp/zypp/pool/PoolTraits.h b/libzypp/zypp/pool/PoolTraits.h deleted file mode 100644 index 5b2770b..0000000 --- a/libzypp/zypp/pool/PoolTraits.h +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/pool/PoolTraits.h - * -*/ -#ifndef ZYPP_POOL_POOLTRAITS_H -#define ZYPP_POOL_POOLTRAITS_H - -#include -#include -#include -#include - -#include "zypp/base/Iterator.h" -#include "zypp/base/Tr1hash.h" - -#include "zypp/PoolItem.h" -#include "zypp/pool/ByIdent.h" -#include "zypp/sat/Pool.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class PoolQuery; - - /////////////////////////////////////////////////////////////////// - namespace pool - { ///////////////////////////////////////////////////////////////// - - class PoolImpl; - - /** Pool internal filter skiping invalid/unwanted PoolItems. */ - struct ByPoolItem - { - bool operator()( const PoolItem & pi ) const - { return bool(pi); } - }; - - /** In CXX0X std::_Select2nd does no longer derive from std::unary_function - */ - template - struct P_Select2nd : public std::unary_function<_Pair, typename _Pair::second_type> - { - typename _Pair::second_type& - operator()(_Pair& __x) const - { return __x.second; } - - const typename _Pair::second_type& - operator()(const _Pair& __x) const - { return __x.second; } - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolTraits - // - /** */ - struct PoolTraits - { - public: - typedef sat::detail::SolvableIdType SolvableIdType; - - /** pure items */ - typedef std::vector ItemContainerT; - typedef ItemContainerT::const_iterator item_iterator; - typedef filter_iterator - const_iterator; - typedef ItemContainerT::size_type size_type; - - /** ident index */ - typedef std::tr1::unordered_multimap - Id2ItemT; - typedef P_Select2nd Id2ItemValueSelector; - typedef transform_iterator - byIdent_iterator; - - /** list of known Repositories */ - typedef sat::Pool::RepositoryIterator repository_iterator; - - /** hard locks from etc/zypp/locks */ - typedef std::list HardLockQueries; - typedef HardLockQueries::const_iterator hardLockQueries_iterator; - - typedef PoolImpl Impl; - typedef shared_ptr Impl_Ptr; - typedef shared_ptr Impl_constPtr; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace pool - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_POOL_POOLTRAITS_H diff --git a/libzypp/zypp/repo/Applydeltarpm.cc b/libzypp/zypp/repo/Applydeltarpm.cc deleted file mode 100644 index 7b382be..0000000 --- a/libzypp/zypp/repo/Applydeltarpm.cc +++ /dev/null @@ -1,193 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/source/Applydeltarpm.cc - * -*/ -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/Regex.h" -#include "zypp/repo/Applydeltarpm.h" -#include "zypp/ExternalProgram.h" -#include "zypp/AutoDispose.h" -#include "zypp/PathInfo.h" -#include "zypp/TriBool.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace applydeltarpm - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - const Pathname applydeltarpm_prog( "/usr/bin/applydeltarpm" ); - const str::regex applydeltarpm_tick ( "([0-9]+) percent finished" ); - - /****************************************************************** - ** - ** FUNCTION NAME : applydeltarpm - ** FUNCTION TYPE : bool - */ - bool applydeltarpm( const char *const argv_r[], - const Progress & report_r = Progress() ) - { - ExternalProgram prog( argv_r, ExternalProgram::Stderr_To_Stdout ); - str::smatch what; - for ( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() ) - { - if ( report_r && str::regex_match( line, what, applydeltarpm_tick ) ) - { - report_r( str::strtonum( what[1] ) ); - } - else - DBG << "Applydeltarpm : " << line; - } - return( prog.close() == 0 ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : haveApplydeltarpm - ** FUNCTION TYPE : bool - */ - bool haveApplydeltarpm() - { - // To track changes in availability of applydeltarpm. - static TriBool _last = indeterminate; - PathInfo prog( applydeltarpm_prog ); - bool have = prog.isX(); - if ( _last == have ) - ; // TriBool! 'else' is not '_last != have' - else - { - // _last is 'indeterminate' or '!have' - if ( (_last = have) ) - MIL << "Found executable " << prog << endl; - else - WAR << "No executable " << prog << endl; - } - return _last; - } - - /****************************************************************** - ** - ** FUNCTION NAME : check - ** FUNCTION TYPE : bool - */ - bool check( const std::string & sequenceinfo_r, bool quick_r ) - { - if ( ! haveApplydeltarpm() ) - return false; - - const char *const argv[] = { - "/usr/bin/applydeltarpm", - ( quick_r ? "-C" : "-c" ), - "-s", sequenceinfo_r.c_str(), - NULL - }; - - return( applydeltarpm( argv ) ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : check - ** FUNCTION TYPE : bool - */ - bool check( const Pathname & delta_r, bool quick_r ) - { - if ( ! haveApplydeltarpm() ) - return false; - - const char *const argv[] = { - "/usr/bin/applydeltarpm", - ( quick_r ? "-C" : "-c" ), - delta_r.asString().c_str(), - NULL - }; - - return( applydeltarpm( argv ) ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : provide - ** FUNCTION TYPE : bool - */ - bool provide( const Pathname & delta_r, const Pathname & new_r, - const Progress & report_r ) - { - // cleanup on error - AutoDispose guard( new_r, filesystem::unlink ); - - if ( ! haveApplydeltarpm() ) - return false; - - const char *const argv[] = { - "/usr/bin/applydeltarpm", - "-p", "-p", // twice to get percent output one per line - delta_r.asString().c_str(), - new_r.asString().c_str(), - NULL - }; - - if ( ! applydeltarpm( argv, report_r ) ) - return false; - - guard.resetDispose(); // no cleanup on success - return true; - } - - /****************************************************************** - ** - ** FUNCTION NAME : provide - ** FUNCTION TYPE : bool - */ - bool provide( const Pathname & old_r, const Pathname & delta_r, - const Pathname & new_r, - const Progress & report_r ) - { - // cleanup on error - AutoDispose guard( new_r, filesystem::unlink ); - - if ( ! haveApplydeltarpm() ) - return false; - - const char *const argv[] = { - "/usr/bin/applydeltarpm", - "-p", "-p", // twice to get percent output one per line - "-r", old_r.asString().c_str(), - delta_r.asString().c_str(), - new_r.asString().c_str(), - NULL - }; - - if ( ! applydeltarpm( argv, report_r ) ) - return false; - - guard.resetDispose(); // no cleanup on success - return true; - } - - ///////////////////////////////////////////////////////////////// - } // namespace applydeltarpm - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/Applydeltarpm.h b/libzypp/zypp/repo/Applydeltarpm.h deleted file mode 100644 index d4ccf40..0000000 --- a/libzypp/zypp/repo/Applydeltarpm.h +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/source/Applydeltarpm.h - * -*/ -#ifndef ZYPP_SOURCE_APPLYDELTARPM_H -#define ZYPP_SOURCE_APPLYDELTARPM_H - -#include -#include - -#include "zypp/base/Function.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /** Namespace wrapping invocations of /usr/bin/applydeltarpm. */ - /////////////////////////////////////////////////////////////////// - namespace applydeltarpm - { ///////////////////////////////////////////////////////////////// - - /** Test whether an execuatble applydeltarpm program is available. */ - bool haveApplydeltarpm(); - - /** \name Check if reconstruction of rpm is possible. - * \see man applydeltarpm - */ - //@{ - /** Check via sequence info. - * \see applydeltarpm [-c|-C] -s sequence - */ - bool check( const std::string & sequenceinfo_r, bool quick_r = false ); - - /** Check via deltarpm. - * \see applydeltarpm [-c|-C] deltarpm - */ - bool check( const Pathname & delta_r, bool quick_r = false ); - - /** Quick via check sequence info.*/ - inline bool quickcheck( const std::string & sequenceinfo_r ) - { return check( sequenceinfo_r, true ); } - - /** Quick check via deltarpm.*/ - inline bool quickcheck( const Pathname & delta_r ) - { return check( delta_r, true ); } - //@} - - /** \name Re-create a new rpm from binary delta. - * \see man applydeltarpm - */ - //@{ - /** progress reporting */ - typedef function Progress; - - /** Apply a binary delta to on-disk data to re-create a new rpm. - * \see applydeltarpm deltarpm newrpm - */ - bool provide( const Pathname & delta_r, const Pathname & new_r, - const Progress & report_r = Progress() ); - - /** Apply a binary delta to an old rpm to re-create a new rpm. - * \see applydeltarpm -r oldrpm deltarpm newrpm - */ - bool provide( const Pathname & old_r, const Pathname & delta_r, - const Pathname & new_r, - const Progress & report_r = Progress() ); - //@} - - ///////////////////////////////////////////////////////////////// - } // namespace applydeltarpm - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SOURCE_APPLYDELTARPM_H diff --git a/libzypp/zypp/repo/DeltaCandidates.cc b/libzypp/zypp/repo/DeltaCandidates.cc deleted file mode 100644 index 4b329a3..0000000 --- a/libzypp/zypp/repo/DeltaCandidates.cc +++ /dev/null @@ -1,117 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -extern "C" -{ -#include -} - -#include -#include "zypp/base/Logger.h" -#include "zypp/Repository.h" -#include "zypp/repo/DeltaCandidates.h" -#include "zypp/sat/Pool.h" - - -using std::endl; -using namespace zypp::packagedelta; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /** DeltaCandidates implementation. */ - struct DeltaCandidates::Impl - { - public: - Impl() - {} - - Impl( const std::list & repos, const std::string & pkgname = "" ) - : repos(repos), pkgname(pkgname) - {} - - std::list repos; - std::string pkgname; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /** \relates DeltaCandidates::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const DeltaCandidates::Impl & obj ) - { - return str << "DeltaCandidates::Impl"; - } - - /////////////////////////////////////////////////////////////////// - // - // class DeltaCandidates - // - /////////////////////////////////////////////////////////////////// - - DeltaCandidates::DeltaCandidates() - : _pimpl( new Impl ) - {} - - - DeltaCandidates::DeltaCandidates(const std::list & repos, - const std::string & pkgname) - : _pimpl( new Impl(repos, pkgname) ) - {} - - DeltaCandidates::~DeltaCandidates() - {} - - std::list DeltaCandidates::deltaRpms(const Package::constPtr & package) const - { - std::list candidates; - - DBG << "package: " << package << endl; - for_( rit, _pimpl->repos.begin(), _pimpl->repos.end() ) - { - sat::LookupRepoAttr q( sat::SolvAttr::repositoryDeltaInfo, *rit ); - for_( it, q.begin(), q.end() ) - { - if ( _pimpl->pkgname.empty() - || it.subFind( sat::SolvAttr(DELTA_PACKAGE_NAME) ).asString() == _pimpl->pkgname ) - { - DeltaRpm delta( it ); - //DBG << "checking delta: " << delta << endl; - if ( ! package - || ( package->name() == delta.name() - && package->edition() == delta.edition() - && package->arch() == delta.arch() ) ) - { - DBG << "got delta candidate: " << delta << endl; - candidates.push_back( delta ); - } - } - } - } - return candidates; - } - - std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj ) - { - return str << *obj._pimpl; - } - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/DeltaCandidates.h b/libzypp/zypp/repo/DeltaCandidates.h deleted file mode 100644 index e59cd12..0000000 --- a/libzypp/zypp/repo/DeltaCandidates.h +++ /dev/null @@ -1,88 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_DELTACANDIDATES_H -#define ZYPP_REPO_DELTACANDIDATES_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/repo/PackageDelta.h" -#include "zypp/Repository.h" -#include "zypp/Package.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /** - * \short Candidate delta and patches for a package - * - * Basically a container that given N repositories, - * gets all patches and deltas from them for a given - * package. - */ - class DeltaCandidates - { - friend std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj ); - - public: - /** Implementation */ - class Impl; - - public: - DeltaCandidates(); - /** - * \short Creates a candidate calculator - * \param repos Set of repositories providing patch and delta packages - */ - DeltaCandidates( const std::list & repos, const std::string & pkgname = "" ); - /** Dtor */ - ~DeltaCandidates(); - - std::list deltaRpms(const Package::constPtr & package) const; - - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates DeltaCandidates Stream output */ - std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj ); - - /////////////////////////////////////////////////////////////////// - - /** \relates DeltaCandidates Convenient construction. - * \todo templated ctor - */ - template - inline DeltaCandidates makeDeltaCandidates( RepoIter begin_r, RepoIter end_r ) - { return DeltaCandidates( std::list( begin_r, end_r ) ); } - - /** \relates DeltaCandidates Convenient construction. - * \todo templated ctor - */ - template - inline DeltaCandidates makeDeltaCandidates( const RepoContainer & cont_r ) - { return makeDeltaCandidates( cont_r.begin(), cont_r.end() ); } - - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_REPO_DELTACANDIDATES_H diff --git a/libzypp/zypp/repo/Downloader.cc b/libzypp/zypp/repo/Downloader.cc deleted file mode 100644 index 2bf752c..0000000 --- a/libzypp/zypp/repo/Downloader.cc +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include "zypp/base/String.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" - -#include "Downloader.h" -#include "zypp/KeyContext.h" -#include "zypp/ZYppCallbacks.h" - -using namespace std; - -namespace zypp -{ -namespace repo -{ - -Downloader::Downloader() -{ -} -Downloader::Downloader(const RepoInfo & repoinfo) : _repoinfo(repoinfo) -{ -} -Downloader::~Downloader() -{ -} - -RepoStatus Downloader::status( MediaSetAccess &media ) -{ - WAR << "Non implemented" << endl; - return RepoStatus(); -} - -void Downloader::download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progress ) -{ - WAR << "Non implemented" << endl; -} - -void Downloader::defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pathname & destdir_r, const Pathname & masterIndex_r ) -{ - Pathname sigpath = masterIndex_r.extend( ".asc" ); - Pathname keypath = masterIndex_r.extend( ".key" ); - - SignatureFileChecker sigchecker; - - enqueue( OnMediaLocation( sigpath, 1 ).setOptional( true ) ); - start( destdir_r, media_r ); - reset(); - - // only add the signature if it exists - if ( PathInfo(destdir_r / sigpath).isExist() ) - sigchecker = SignatureFileChecker( destdir_r / sigpath ); - - enqueue( OnMediaLocation( keypath, 1 ).setOptional( true ) ); - start( destdir_r, media_r ); - reset(); - - KeyContext context; - context.setRepoInfo( repoInfo() ); - // only add the key if it exists - if ( PathInfo(destdir_r / keypath).isExist() ) - sigchecker.addPublicKey( destdir_r / keypath, context ); - else - // set the checker context even if the key is not known (unsigned repo, key - // file missing; bnc #495977) - sigchecker.setKeyContext( context ); - - if ( ! repoInfo().gpgCheck() ) - { - WAR << "Signature checking disabled in config of repository " << repoInfo().alias() << endl; - } - enqueue( OnMediaLocation( masterIndex_r, 1 ), - repoInfo().gpgCheck() ? FileChecker(sigchecker) : FileChecker(NullFileChecker()) ); - start( destdir_r, media_r ); - reset(); -} - - -}// ns repo -} // ns zypp - - - diff --git a/libzypp/zypp/repo/Downloader.h b/libzypp/zypp/repo/Downloader.h deleted file mode 100644 index 64c6a41..0000000 --- a/libzypp/zypp/repo/Downloader.h +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_DOWNLOADER -#define ZYPP_REPO_DOWNLOADER - -#include "zypp/Url.h" -#include "zypp/Pathname.h" -#include "zypp/ProgressData.h" -#include "zypp/RepoStatus.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/Fetcher.h" -#include "zypp/RepoInfo.h" - -namespace zypp -{ - namespace repo - { - /** - * \short Downloader base class - * - * a Downloader encapsulates all the knowledge of - * which files have to be downloaded to the local disk. - * - */ - class Downloader : public Fetcher - { - public: - /** - * \short Constructor - */ - Downloader(); - /** C-tor associating the downloader with a RepoInfo */ - Downloader(const RepoInfo & info); - virtual ~Downloader(); - - /** - * \short Download metadata to a local directory - * - * \param media Media access to the repository url - * \param dest_dir Local destination directory - * \param progress progress receiver - */ - virtual void download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); - /** - * \short Status of the remote repository - */ - virtual RepoStatus status( MediaSetAccess &media ); - - const RepoInfo & repoInfo() const { return _repoinfo; } - - protected: - /** Common workflow downloading a (signed) master index file */ - void defaultDownloadMasterIndex( MediaSetAccess & media_r, const Pathname & destdir_r, const Pathname & masterIndex_r ); - - private: - RepoInfo _repoinfo; - }; - } // ns repo -} // ns zypp - -#endif diff --git a/libzypp/zypp/repo/MediaInfoDownloader.cc b/libzypp/zypp/repo/MediaInfoDownloader.cc deleted file mode 100644 index 9c35864..0000000 --- a/libzypp/zypp/repo/MediaInfoDownloader.cc +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include "zypp/base/String.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Function.h" - -#include "MediaInfoDownloader.h" -#include "zypp/base/UserRequestException.h" - -using namespace std; - -namespace zypp -{ -namespace repo -{ - -void downloadMediaInfo( const Pathname &dest_dir, - MediaSetAccess &media, - const ProgressData::ReceiverFnc & progressrcv ) -{ - Fetcher fetcher; - fetcher.enqueue( OnMediaLocation("/media.1/media") ); - fetcher.start( dest_dir, media, progressrcv ); - // ready, go! - fetcher.reset(); -} - -}// ns repo -} // ns zypp - - - diff --git a/libzypp/zypp/repo/MediaInfoDownloader.h b/libzypp/zypp/repo/MediaInfoDownloader.h deleted file mode 100644 index 01b403e..0000000 --- a/libzypp/zypp/repo/MediaInfoDownloader.h +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_MEDIAINFO_DOWNLOADER -#define ZYPP_REPO_MEDIAINFO_DOWNLOADER - -#include "zypp/Url.h" -#include "zypp/Pathname.h" -#include "zypp/Fetcher.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/ProgressData.h" - -namespace zypp -{ - namespace repo - { - - /** - * \short Downloads the media info (/media.1) to a local directory - * \param dest_dir Destination directory - * \param media \ref MediaSetAccess object to some media - * \param progress Progress callback function - * - * \throws Exception on error - */ - void downloadMediaInfo( const Pathname &dest_dir, - MediaSetAccess &media, - const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); - } // ns repo -} // ns zypp - -#endif diff --git a/libzypp/zypp/repo/PackageDelta.cc b/libzypp/zypp/repo/PackageDelta.cc deleted file mode 100644 index 608ab00..0000000 --- a/libzypp/zypp/repo/PackageDelta.cc +++ /dev/null @@ -1,141 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/source/PackageDelta.cc - * -*/ -#include -extern "C" -{ -#include -} - -#include "zypp/base/LogTools.h" - -#include "zypp/repo/PackageDelta.h" -#include "zypp/sat/Pool.h" - - -using std::endl; -using std::string; - - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace packagedelta - { ///////////////////////////////////////////////////////////////// - - DeltaRpm::DeltaRpm( sat::LookupAttr::iterator deltaInfo_r ) - { - if ( deltaInfo_r.inSolvAttr() != sat::SolvAttr::repositoryDeltaInfo ) - { - INT << "Illegal non-repositoryDeltaInfo iterator: " << deltaInfo_r << endl; - return; - } - _repo = deltaInfo_r.inRepo(); - - IdString locdir; - IdString locname; - IdString locevr; - IdString locsuffix; - - IdString seqname; - IdString seqevr; - std::string seqnum; - - for_( it, deltaInfo_r.subBegin(), deltaInfo_r.subEnd() ) - { - switch ( it.inSolvAttr().id() ) - { - case DELTA_PACKAGE_NAME: - _name = it.asString(); - break; - - case DELTA_PACKAGE_EVR: - _edition = Edition( it.idStr() ); - break; - - case DELTA_PACKAGE_ARCH: - _arch = Arch( it.idStr() ); - break; - - case DELTA_LOCATION_DIR: - locdir = it.idStr(); - break; - - case DELTA_LOCATION_NAME: - locname = it.idStr(); - break; - - case DELTA_LOCATION_EVR: - locevr = it.idStr(); - break; - - case DELTA_LOCATION_SUFFIX: - locsuffix = it.idStr(); - break; - - case DELTA_DOWNLOADSIZE: - _location.setDownloadSize( ByteCount( it.asUnsignedLL() ) ); - break; - - case DELTA_CHECKSUM: - _location.setChecksum( it.asCheckSum() ); - break; - - case DELTA_BASE_EVR: - _baseversion.setEdition( Edition( it.idStr() ) ); - break; - - case DELTA_SEQ_NAME: - seqname = it.idStr(); - break; - - case DELTA_SEQ_EVR: - seqevr = it.idStr(); - break; - - case DELTA_SEQ_NUM: - seqnum = it.asString(); - break; - - default: - WAR << "Igore unknown attribute: " << it << endl; - } - } - - _location.setLocation( str::form( "%s/%s-%s.%s", - locdir.c_str(), - locname.c_str(), - locevr.c_str(), - locsuffix.c_str() ) ); - - _baseversion.setSequenceinfo( str::form( "%s-%s-%s", - seqname.c_str(), - seqevr.c_str(), - seqnum.c_str() ) ); - } - - std::ostream & operator<<( std::ostream & str, const DeltaRpm & obj ) - { - return str - << "DeltaRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch() - << "](" << obj.location() - << '|' << obj.baseversion().edition() - << ',' << obj.baseversion().sequenceinfo() - << ')'; - } - - ///////////////////////////////////////////////////////////////// - } // namespace packagedelta - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/PackageDelta.h b/libzypp/zypp/repo/PackageDelta.h deleted file mode 100644 index 3c4a810..0000000 --- a/libzypp/zypp/repo/PackageDelta.h +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/source/PackageDelta.h - * -*/ -#ifndef ZYPP_SOURCE_PACKAGEDELTA_H -#define ZYPP_SOURCE_PACKAGEDELTA_H - -#include -#include - -#include "zypp/OnMediaLocation.h" -#include "zypp/Edition.h" -#include "zypp/Arch.h" -#include "zypp/Date.h" - -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/Repository.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace packagedelta - { ///////////////////////////////////////////////////////////////// - - - /** \todo cheap copy! (switch to RWCOW) */ - class DeltaRpm - { - public: - class BaseVersion - { - public: - BaseVersion() - {} - - public: - const Edition & edition() const { return _edition; } - const std::string & sequenceinfo() const { return _sequenceinfo; } - - public: - BaseVersion & setEdition( const Edition & val_r ) { _edition = val_r; return *this; } - BaseVersion & setSequenceinfo( const std::string & val_r ) { _sequenceinfo = val_r; return *this; } - - private: - Edition _edition; - std::string _sequenceinfo; - }; - - public: - DeltaRpm() {} - DeltaRpm( sat::LookupAttr::iterator deltaInfo_r ); - - public: - /** \name Target package ident. */ - //@{ - const std::string & name() const { return _name; } - const Edition & edition() const { return _edition; } - const Arch & arch() const { return _arch; } - //@} - const OnMediaLocation & location() const { return _location; } - const BaseVersion & baseversion() const { return _baseversion; } - const Repository & repository() const { return _repo; } - - public: - DeltaRpm & setName( const std::string & val_r ) { _name = val_r; return *this; } - DeltaRpm & setEdition( const Edition & val_r ) { _edition = val_r; return *this; } - DeltaRpm & setArch( const Arch & val_r ) { _arch = val_r; return *this; } - DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; } - DeltaRpm & setBaseversion( const BaseVersion & val_r ) { _baseversion = val_r; return *this; } - - private: - std::string _name; - Edition _edition; - Arch _arch; - OnMediaLocation _location; - BaseVersion _baseversion; - Repository _repo; - }; - - /** \relates DeltaRpm Stream output. */ - std::ostream & operator<<( std::ostream & str, const DeltaRpm & obj ); - - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace packagedelta - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SOURCE_PACKAGEDELTA_H diff --git a/libzypp/zypp/repo/PackageProvider.cc b/libzypp/zypp/repo/PackageProvider.cc deleted file mode 100644 index 251160b..0000000 --- a/libzypp/zypp/repo/PackageProvider.cc +++ /dev/null @@ -1,502 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/PackageProvider.cc - * -*/ -#include -#include -#include -#include "zypp/repo/PackageDelta.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/UserRequestException.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/repo/PackageProvider.h" -#include "zypp/repo/Applydeltarpm.h" -#include "zypp/repo/PackageDelta.h" - -#include "zypp/TmpPath.h" -#include "zypp/ZConfig.h" -#include "zypp/RepoInfo.h" -#include "zypp/RepoManager.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace repo - { - /////////////////////////////////////////////////////////////////// - // class PackageProviderPolicy - /////////////////////////////////////////////////////////////////// - - bool PackageProviderPolicy::queryInstalled( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) const - { - if ( _queryInstalledCB ) - return _queryInstalledCB( name_r, ed_r, arch_r ); - return false; - } - - - /////////////////////////////////////////////////////////////////// - /// \class PackageProvider::Impl - /// \brief PackageProvider implementation. - /////////////////////////////////////////////////////////////////// - class PackageProvider::Impl : private base::NonCopyable - { - public: - /** Ctor taking the Package to provide. */ - Impl( RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ) - : _policy( policy_r ) - , _package( package_r ) - , _deltas( deltas_r ) - , _access( access_r ) - , _retry(false) - {} - - virtual ~Impl() {} - - /** Factory method providing the appropriate implementation. - * Called by PackageProvider ctor. Returned pointer should be - * immediately wrapped into a smartpointer. - */ - static Impl * factoryMake( RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ); - - public: - /** Provide the package. - * The basic workflow. - * \throws Exception. - */ - ManagedFile providePackage() const; - - /** Provide the package if it is cached. */ - ManagedFile providePackageFromCache() const - { - ManagedFile ret( doProvidePackageFromCache() ); - if ( ! ( ret->empty() || _package->repoInfo().keepPackages() ) ) - ret.setDispose( filesystem::unlink ); - return ret; - } - - /** Whether the package is cached. */ - bool isCached() const - { return ! doProvidePackageFromCache()->empty(); } - - protected: - typedef PackageProvider::Impl Base; - typedef callback::SendReport Report; - - /** Lookup the final rpm in cache. - * - * A non empty ManagedFile will be returned to the caller. - * - * \note File disposal depending on the repos keepPackages setting - * are not set here, but in \ref providePackage or \ref providePackageFromCache. - * - * \note The provoided default implementation returns an empty ManagedFile - * (cache miss). - */ - virtual ManagedFile doProvidePackageFromCache() const = 0; - - /** Actually provide the final rpm. - * Report start/problem/finish and retry loop are hadled by \ref providePackage. - * Here you trigger just progress and delta/plugin callbacks as needed. - * - * Proxy methods for progressPackageDownload and failOnChecksum are provided here. - * Create similar proxies for other progress callbacks in derived classes and link - * it to ProvideFilePolicy for download: - * \code - * ProvideFilePolicy policy; - * policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) ); - * policy.failOnChecksumErrorCB( bind( &Base::failOnChecksumError, this ) ); - * return _access.provideFile( _package->repoInfo(), loc, policy ); - * \endcode - * - * \note The provoided default implementation retrieves the packages default - * location. - */ - virtual ManagedFile doProvidePackage() const = 0; - - protected: - /** Access to the DownloadResolvableReport */ - Report & report() const - { return *_report; } - - /** Redirect ProvideFilePolicy package download progress to this. */ - bool progressPackageDownload( int value ) const - { return report()->progress( value, _package ); } - - /** Redirect ProvideFilePolicy failOnChecksumError to this if needed. */ - bool failOnChecksumError() const - { - std::string package_str = _package->name() + "-" + _package->edition().asString(); - - // TranslatorExplanation %s = package being checked for integrity - switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s seems to be corrupted during transfer. Do you want to retry retrieval?"), package_str.c_str() ) ) ) - { - case repo::DownloadResolvableReport::RETRY: - _retry = true; - break; - case repo::DownloadResolvableReport::IGNORE: - ZYPP_THROW(SkipRequestException("User requested skip of corrupted file")); - break; - case repo::DownloadResolvableReport::ABORT: - ZYPP_THROW(AbortRequestException("User requested to abort")); - break; - default: - break; - } - return true; // anyway a failure - } - - protected: - PackageProviderPolicy _policy; - Package::constPtr _package; - DeltaCandidates _deltas; - RepoMediaAccess & _access; - - private: - typedef shared_ptr ScopedGuard; - - ScopedGuard newReport() const - { - _report.reset( new Report ); - // Use a custom deleter calling _report.reset() when guard goes out of - // scope (cast required as reset is overloaded). We want report to end - // when leaving providePackage and not wait for *this going out of scope. - return shared_ptr( static_cast(0), - bind( mem_fun_ref( static_cast::*)()>(&shared_ptr::reset) ), - ref(_report) ) ); - } - - mutable bool _retry; - mutable shared_ptr _report; - }; - /////////////////////////////////////////////////////////////////// - - /** Default implementation (cache miss). */ - ManagedFile PackageProvider::Impl::doProvidePackageFromCache() const - { return ManagedFile(); } - - /** Default implementation (provide full package) */ - ManagedFile PackageProvider::Impl::doProvidePackage() const - { - ManagedFile ret; - OnMediaLocation loc = _package->location(); - - ProvideFilePolicy policy; - policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) ); - policy.failOnChecksumErrorCB( bind( &Base::failOnChecksumError, this ) ); - return _access.provideFile( _package->repoInfo(), loc, policy ); - } - - /////////////////////////////////////////////////////////////////// - - ManagedFile PackageProvider::Impl::providePackage() const - { - ScopedGuard guardReport( newReport() ); - - // check for cache hit: - ManagedFile ret( providePackageFromCache() ); - if ( ! ret->empty() ) - { - MIL << "provided Package from cache " << _package << " at " << ret << endl; - report()->infoInCache( _package, ret ); - return ret; // <-- cache hit - } - - // HERE: cache misss, check toplevel cache or do download: - RepoInfo info = _package->repoInfo(); - - // Check toplevel cache - { - RepoManagerOptions topCache; - if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath ) // not using toplevel cache - { - const OnMediaLocation & loc( _package->location() ); - if ( ! loc.checksum().empty() ) // no cache hit without checksum - { - PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / loc.filename() ); - if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) ) - { - report()->start( _package, pi.path().asFileUrl() ); - const Pathname & dest( info.packagesPath() / loc.filename() ); - if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 ) - { - ret = ManagedFile( dest ); - if ( ! info.keepPackages() ) - ret.setDispose( filesystem::unlink ); - - MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl; - report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() ); - return ret; // <-- toplevel cache hit - } - } - } - } - } - - // FIXME we only support the first url for now. - if ( info.baseUrlsEmpty() ) - ZYPP_THROW(Exception("No url in repository.")); - - MIL << "provide Package " << _package << endl; - Url url = * info.baseUrlsBegin(); - do { - _retry = false; - report()->start( _package, url ); - try // ELIMINATE try/catch by providing a log-guard - { - ret = doProvidePackage(); - } - catch ( const UserRequestException & excpt ) - { - // UserRequestException e.g. from failOnChecksumError was already reported. - ERR << "Failed to provide Package " << _package << endl; - if ( ! _retry ) - { - ZYPP_RETHROW( excpt ); - } - } - catch ( const Exception & excpt ) - { - ERR << "Failed to provide Package " << _package << endl; - if ( ! _retry ) - { - // Aything else gets reported - std::string package_str = _package->name() + "-" + _package->edition().asString(); - - // TranslatorExplanation %s = name of the package being processed. - std::string detail_str( str::form(_("Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) ); - detail_str += str::form( "\n\n%s", excpt.asUserHistory().c_str() ); - - switch ( report()->problem( _package, repo::DownloadResolvableReport::IO, detail_str.c_str() ) ) - { - case repo::DownloadResolvableReport::RETRY: - _retry = true; - break; - case repo::DownloadResolvableReport::IGNORE: - ZYPP_THROW(SkipRequestException("User requested skip of corrupted file", excpt)); - break; - case repo::DownloadResolvableReport::ABORT: - ZYPP_THROW(AbortRequestException("User requested to abort", excpt)); - break; - default: - ZYPP_RETHROW( excpt ); - break; - } - } - } - } while ( _retry ); - - report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() ); - MIL << "provided Package " << _package << " at " << ret << endl; - return ret; - } - - - /////////////////////////////////////////////////////////////////// - /// \class RpmPackageProvider - /// \brief RPM PackageProvider implementation. - /////////////////////////////////////////////////////////////////// - class RpmPackageProvider : public PackageProvider::Impl - { - public: - RpmPackageProvider( RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ) - : PackageProvider::Impl( access_r, package_r, deltas_r, policy_r ) - {} - - protected: - virtual ManagedFile doProvidePackageFromCache() const; - - virtual ManagedFile doProvidePackage() const; - - private: - typedef packagedelta::DeltaRpm DeltaRpm; - - ManagedFile tryDelta( const DeltaRpm & delta_r ) const; - - bool progressDeltaDownload( int value ) const - { return report()->progressDeltaDownload( value ); } - - void progressDeltaApply( int value ) const - { return report()->progressDeltaApply( value ); } - - bool queryInstalled( const Edition & ed_r = Edition() ) const - { return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); } - }; - /////////////////////////////////////////////////////////////////// - - ManagedFile RpmPackageProvider::doProvidePackageFromCache() const - { - return ManagedFile( _package->cachedLocation() ); - } - - ManagedFile RpmPackageProvider::doProvidePackage() const - { - Url url; - RepoInfo info = _package->repoInfo(); - // FIXME we only support the first url for now. - if ( info.baseUrlsEmpty() ) - ZYPP_THROW(Exception("No url in repository.")); - else - url = * info.baseUrlsBegin(); - - // check whether to process patch/delta rpms - if ( ZConfig::instance().download_use_deltarpm() - && ( url.schemeIsDownloading() || ZConfig::instance().download_use_deltarpm_always() ) ) - { - std::list deltaRpms; - _deltas.deltaRpms( _package ).swap( deltaRpms ); - - if ( ! deltaRpms.empty() && queryInstalled() && applydeltarpm::haveApplydeltarpm() ) - { - for_( it, deltaRpms.begin(), deltaRpms.end()) - { - DBG << "tryDelta " << *it << endl; - ManagedFile ret( tryDelta( *it ) ); - if ( ! ret->empty() ) - return ret; - } - } - } - - // no patch/delta -> provide full package - return Base::doProvidePackage(); - } - - ManagedFile RpmPackageProvider::tryDelta( const DeltaRpm & delta_r ) const - { - if ( delta_r.baseversion().edition() != Edition::noedition - && ! queryInstalled( delta_r.baseversion().edition() ) ) - return ManagedFile(); - - if ( ! applydeltarpm::quickcheck( delta_r.baseversion().sequenceinfo() ) ) - return ManagedFile(); - - report()->startDeltaDownload( delta_r.location().filename(), - delta_r.location().downloadSize() ); - ManagedFile delta; - try - { - ProvideFilePolicy policy; - policy.progressCB( bind( &RpmPackageProvider::progressDeltaDownload, this, _1 ) ); - delta = _access.provideFile( delta_r.repository().info(), delta_r.location(), policy ); - } - catch ( const Exception & excpt ) - { - report()->problemDeltaDownload( excpt.asUserHistory() ); - return ManagedFile(); - } - report()->finishDeltaDownload(); - - report()->startDeltaApply( delta ); - if ( ! applydeltarpm::check( delta_r.baseversion().sequenceinfo() ) ) - { - report()->problemDeltaApply( _("applydeltarpm check failed.") ); - return ManagedFile(); - } - - // build the package and put it into the cache - Pathname destination( _package->repoInfo().packagesPath() / _package->location().filename() ); - // ensure that the destination directory exists - filesystem::assert_dir( destination.dirname() ); - - if ( ! applydeltarpm::provide( delta, destination, - bind( &RpmPackageProvider::progressDeltaApply, this, _1 ) ) ) - { - report()->problemDeltaApply( _("applydeltarpm failed.") ); - return ManagedFile(); - } - report()->finishDeltaApply(); - - return ManagedFile( destination, filesystem::unlink ); - } - -#if 0 - /////////////////////////////////////////////////////////////////// - /// \class PluginPackageProvider - /// \brief Plugin PackageProvider implementation. - /// - /// Basically downloads the default package and calls a - /// 'stem'2rpm plugin to cteate the final .rpm package. - /////////////////////////////////////////////////////////////////// - class PluginPackageProvider : public PackageProvider::Impl - { - public: - PluginPackageProvider( const std::string & stem_r, - RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ) - : Base( access_r, package_r, deltas_r, policy_r ) - {} - - protected: - virtual ManagedFile doProvidePackageFromCache() const - { - return Base::doProvidePackageFromCache(); - } - - virtual ManagedFile doProvidePackage() const - { - return Base::doProvidePackage(); - } - }; - /////////////////////////////////////////////////////////////////// -#endif - - /////////////////////////////////////////////////////////////////// - // class PackageProvider - /////////////////////////////////////////////////////////////////// - - PackageProvider::Impl * PackageProvider::Impl::factoryMake( RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ) - { - return new RpmPackageProvider( access_r, package_r, deltas_r, policy_r ); - } - - PackageProvider::PackageProvider( RepoMediaAccess & access_r, - const Package::constPtr & package_r, - const DeltaCandidates & deltas_r, - const PackageProviderPolicy & policy_r ) - : _pimpl( Impl::factoryMake( access_r, package_r, deltas_r, policy_r ) ) - {} - - PackageProvider::~PackageProvider() - {} - - ManagedFile PackageProvider::providePackage() const - { return _pimpl->providePackage(); } - - ManagedFile PackageProvider::providePackageFromCache() const - { return _pimpl->providePackageFromCache(); } - - bool PackageProvider::isCached() const - { return _pimpl->isCached(); } - - } // namespace repo - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/PackageProvider.h b/libzypp/zypp/repo/PackageProvider.h deleted file mode 100644 index ee1c8e7..0000000 --- a/libzypp/zypp/repo/PackageProvider.h +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/PackageProvider.h - * -*/ -#ifndef ZYPP_REPO_PACKAGEPROVIDER_H -#define ZYPP_REPO_PACKAGEPROVIDER_H - -#include - -#include "zypp/ZYppCallbacks.h" -#include "zypp/Package.h" -#include "zypp/ManagedFile.h" -#include "zypp/repo/DeltaCandidates.h" -#include "zypp/repo/RepoProvideFile.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace repo - { - - /////////////////////////////////////////////////////////////////// - /// \class PackageProviderPolicy - /// \brief Policies and options for \ref PackageProvider - /////////////////////////////////////////////////////////////////// - class PackageProviderPolicy - { - public: - /** Get installed Editions callback signature. */ - typedef function QueryInstalledCB; - - /** Set callback. */ - PackageProviderPolicy & queryInstalledCB( QueryInstalledCB queryInstalledCB_r ) - { _queryInstalledCB = queryInstalledCB_r; return *this; } - - /** Evaluate callback. */ - bool queryInstalled( const std::string & name_r, - const Edition & ed_r, - const Arch & arch_r ) const; - - private: - QueryInstalledCB _queryInstalledCB; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class PackageProvider - /// \brief Provide a package from a Repo. - /// - /// Use available deltarpm if apropriate. - /////////////////////////////////////////////////////////////////// - class PackageProvider - { - public: - /** Ctor taking the Package to provide. */ - PackageProvider( RepoMediaAccess & access, - const Package::constPtr & package, - const DeltaCandidates & deltas, - const PackageProviderPolicy & policy_r = PackageProviderPolicy() ); - ~PackageProvider(); - - public: - /** Provide the package. - * \throws Exception. - */ - ManagedFile providePackage() const; - - /** Provide the package if it is cached. */ - ManagedFile providePackageFromCache() const; - - /** Whether the package is cached. */ - bool isCached() const; - - public: - class Impl; ///< Implementation class. - private: - RW_pointer _pimpl; ///< Pointer to implementation. - }; - /////////////////////////////////////////////////////////////////// - - } // namespace repo - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SOURCE_PACKAGEPROVIDER_H diff --git a/libzypp/zypp/repo/PluginServices.cc b/libzypp/zypp/repo/PluginServices.cc deleted file mode 100644 index 7382a66..0000000 --- a/libzypp/zypp/repo/PluginServices.cc +++ /dev/null @@ -1,90 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -#include -#include -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/base/InputStream.h" -#include "zypp/base/UserRequestException.h" - -#include "zypp/repo/PluginServices.h" -#include "zypp/ServiceInfo.h" -#include "zypp/RepoInfo.h" -#include "zypp/PathInfo.h" - -using std::endl; -using std::stringstream; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - class PluginServices::Impl - { - public: - static void loadServices( const Pathname &path, - const PluginServices::ProcessService &callback ); - }; - - void PluginServices::Impl::loadServices( const Pathname &path, - const PluginServices::ProcessService & callback/*, - const ProgressData::ReceiverFnc &progress*/ ) - { - std::list entries; - if (PathInfo(path).isExist()) - { - if ( filesystem::readdir( entries, path, false ) != 0 ) - { - // TranslatorExplanation '%s' is a pathname - ZYPP_THROW(Exception(str::form(_("Failed to read directory '%s'"), path.c_str()))); - } - - //str::regex allowedServiceExt("^\\.service(_[0-9]+)?$"); - for_(it, entries.begin(), entries.end() ) - { - ServiceInfo service_info; - service_info.setAlias((*it).basename()); - Url url; - url.setPathName((*it).asString()); - url.setScheme("file"); - service_info.setUrl(url); - service_info.setType(ServiceType::PLUGIN); - service_info.setAutorefresh( true ); - DBG << "Plugin Service: " << service_info << endl; - callback(service_info); - } - - } - } - - PluginServices::PluginServices( const Pathname &path, - const ProcessService & callback/*, - const ProgressData::ReceiverFnc &progress */) - { - Impl::loadServices(path, callback/*, progress*/); - } - - PluginServices::~PluginServices() - {} - - std::ostream & operator<<( std::ostream & str, const PluginServices & obj ) - { - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/PluginServices.h b/libzypp/zypp/repo/PluginServices.h deleted file mode 100644 index 6c69c52..0000000 --- a/libzypp/zypp/repo/PluginServices.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_PLUGINSERVICES_H -#define ZYPP_REPO_PLUGINSERVICES_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/ProgressData.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class ServiceInfo; - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - class PluginServices - { - friend std::ostream & operator<<( std::ostream & str, const PluginServices& obj ); - public: - - /** - * Callback definition. - * First parameter is a \ref ServiceInfo object with the resource. - * - * Return false from the callback to get a \ref AbortRequestException - * to be thrown and the processing to be cancelled. - */ - typedef function< bool( const ServiceInfo & )> ProcessService; - - /** Implementation */ - class Impl; - - public: - PluginServices(const Pathname &path, - const ProcessService & callback); - - /** - * Dtor - */ - ~PluginServices(); - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ServiceFileReader Stream output */ - std::ostream & operator<<( std::ostream & str, const PluginServices & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_REPO_LOCALSERVICES_H diff --git a/libzypp/zypp/repo/RepoException.cc b/libzypp/zypp/repo/RepoException.cc deleted file mode 100644 index b4c19cc..0000000 --- a/libzypp/zypp/repo/RepoException.cc +++ /dev/null @@ -1,137 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/RepoException.cc - * -*/ -#include -#include "zypp/repo/RepoException.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // Repository related exceptions - // - /////////////////////////////////////////////////////////////////// - - RepoException::RepoException() - : Exception( "Repo exception" ) - {} - - RepoException::RepoException( const std::string & msg_r ) - : Exception( msg_r ) - {} - - RepoException::RepoException( const RepoInfo & info ) - : Exception( "Repo exception" ), _info( info ) - {} - - RepoException::RepoException( const RepoInfo & info, const std::string& msg_r ) - : Exception( msg_r ), _info( info ) - {} - - RepoException::~RepoException() throw() - {} - - std::ostream & RepoException::dumpOn( std::ostream & str ) const - { - str << "[" << _info.alias() << "|" << _info.url() << "] "; - return Exception::dumpOn( str ); - } - - /////////////////////////////////////////////////////////////////// - -#define DEF_CTORS( CLASS, MSG ) \ - CLASS::CLASS() : RepoException( MSG ) {} \ - CLASS::CLASS( const std::string & msg_r ) : RepoException( msg_r ) {} \ - CLASS::CLASS( const RepoInfo & service_r ) : RepoException( service_r, MSG ) {} \ - CLASS::CLASS( const RepoInfo & service_r, const std::string & msg_r ) : RepoException( service_r, msg_r ) {} - - DEF_CTORS( RepoNotCachedException, "Repository is not cached" ); - DEF_CTORS( RepoNoUrlException, "Repository has no or invalid url defined." ); - DEF_CTORS( RepoNoAliasException, "Repository has no alias defined." ); - DEF_CTORS( RepoInvalidAliasException, "Repository has an invalid alias." ); - DEF_CTORS( RepoNotFoundException, "Repository not found." ); - DEF_CTORS( RepoAlreadyExistsException, "Repository already exists." ); - DEF_CTORS( RepoUnknownTypeException, "Repository type can't be determined." ); - DEF_CTORS( RepoMetadataException, "Repository metadata not usable." ); - -#undef DEF_CTORS - - /////////////////////////////////////////////////////////////////// - // - // Service related exceptions - // - /////////////////////////////////////////////////////////////////// - - ServiceException::ServiceException() - : Exception( "Service exception" ) - {} - - ServiceException::ServiceException( const std::string & msg_r ) - : Exception( msg_r ) - {} - - ServiceException::ServiceException( const ServiceInfo & service_r ) - : Exception( "Service exception" ), _service( service_r ) - {} - - ServiceException::ServiceException( const ServiceInfo & service_r, const std::string & msg_r ) - : Exception( msg_r ), _service( service_r ) - {} - - ServiceException::~ServiceException() throw() - {} - - std::ostream & ServiceException::dumpOn( std::ostream & str ) const - { - str << "[" << _service.alias() << "|" << _service.url() << "] "; - return Exception::dumpOn( str ); - } - - /////////////////////////////////////////////////////////////////// - -#define DEF_CTORS( CLASS, MSG ) \ - CLASS::CLASS() : DEF_BASECLASS( MSG ) {} \ - CLASS::CLASS( const std::string & msg_r ) : DEF_BASECLASS( msg_r ) {} \ - CLASS::CLASS( const ServiceInfo & service_r ) : DEF_BASECLASS( service_r, MSG ) {} \ - CLASS::CLASS( const ServiceInfo & service_r, const std::string & msg_r ) : DEF_BASECLASS( service_r, msg_r ) {} - -#define DEF_BASECLASS ServiceException - DEF_CTORS( ServiceNoAliasException, "Service has no alias defined." ); - DEF_CTORS( ServiceInvalidAliasException, "Service has an invalid alias." ); - DEF_CTORS( ServiceAlreadyExistsException, "Service already exists." ); - DEF_CTORS( ServiceNoUrlException, "Service has no or invalid url defined." ); - - // sub classes: - DEF_CTORS( ServicePluginException, "PLUGIN service exception." ); - - /////////////////////////////////////////////////////////////////// - // sub class: ServicePluginException -#undef DEF_BASECLASS -#define DEF_BASECLASS ServicePluginException - DEF_CTORS( ServicePluginInformalException, "Service plugin has trouble providing the metadata but this should not be treated as error." ); - DEF_CTORS( ServicePluginImmutableException, _("Service plugin does not support changing an attribute.") ); - -#undef DEF_CTORS - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/RepoException.h b/libzypp/zypp/repo/RepoException.h deleted file mode 100644 index daf97a3..0000000 --- a/libzypp/zypp/repo/RepoException.h +++ /dev/null @@ -1,289 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/parser/tagfile/RepoException.h - * -*/ -#ifndef ZYPP_REPO_REPOEXCEPTION_H -#define ZYPP_REPO_REPOEXCEPTION_H - -#include -#include - -#include "zypp/base/Exception.h" -#include "zypp/base/UserRequestException.h" -#include "zypp/RepoInfo.h" -#include "zypp/ServiceInfo.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /** \name Repository related exceptions. - */ - //@{ - - /** - * \short Exception for repository handling. - */ - class RepoException : public Exception - { - public: - RepoException(); - RepoException( const std::string & msg_r ); - RepoException( const RepoInfo & info ); - RepoException( const RepoInfo & info, const std::string & msg_r ); - virtual ~RepoException() throw(); - - RepoInfo info() - { return _info; } - - std::string alias() - { return info().alias(); } - - protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; - - private: - RepoInfo _info; - }; - /////////////////////////////////////////////////////////////////// - - /** - * The repository cache is not built yet - * so you can't create the repostories from - * the cache. - */ - class RepoNotCachedException : public RepoException - { - public: - RepoNotCachedException(); - RepoNotCachedException( const std::string & msg_r ); - RepoNotCachedException( const RepoInfo & info ); - RepoNotCachedException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * thrown when it was impossible to - * determine one url for this repo. - */ - class RepoNoUrlException : public RepoException - { - public: - RepoNoUrlException(); - RepoNoUrlException( const std::string & msg_r ); - RepoNoUrlException( const RepoInfo & info ); - RepoNoUrlException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * thrown when it was impossible to - * determine an alias for this repo. - */ - class RepoNoAliasException : public RepoException - { - public: - RepoNoAliasException(); - RepoNoAliasException( const std::string & msg_r ); - RepoNoAliasException( const RepoInfo & info ); - RepoNoAliasException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * Thrown when the repo alias is found to be invalid. - */ - class RepoInvalidAliasException : public RepoException - { - public: - RepoInvalidAliasException(); - RepoInvalidAliasException( const std::string & msg_r ); - RepoInvalidAliasException( const RepoInfo & info ); - RepoInvalidAliasException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * thrown when it was impossible to - * match a repository - */ - class RepoNotFoundException : public RepoException - { - public: - RepoNotFoundException(); - RepoNotFoundException( const std::string & msg_r ); - RepoNotFoundException( const RepoInfo & info ); - RepoNotFoundException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * Repository already exists and some unique - * attribute can't be duplicated. - */ - class RepoAlreadyExistsException : public RepoException - { - public: - RepoAlreadyExistsException(); - RepoAlreadyExistsException( const std::string & msg_r ); - RepoAlreadyExistsException( const RepoInfo & info ); - RepoAlreadyExistsException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * thrown when it was impossible to - * determine this repo type. - */ - class RepoUnknownTypeException : public RepoException - { - public: - RepoUnknownTypeException(); - RepoUnknownTypeException( const std::string & msg_r ); - RepoUnknownTypeException( const RepoInfo & info ); - RepoUnknownTypeException( const RepoInfo & info, const std::string & msg_r ); - }; - - /** - * thrown when it was impossible to - * use the raw metadata for this repo. - */ - class RepoMetadataException : public RepoException - { - public: - RepoMetadataException(); - RepoMetadataException( const std::string & msg_r ); - RepoMetadataException( const RepoInfo & info ); - RepoMetadataException( const RepoInfo & info, const std::string & msg_r ); - }; - - //@} - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** \name Service related exceptions. - */ - //@{ - - /** Base Exception for service handling. - */ - class ServiceException : public Exception - { - public: - ServiceException(); - ServiceException( const std::string & msg_r ); - ServiceException( const ServiceInfo & service_r ); - ServiceException( const ServiceInfo & service_r, const std::string & msg_r ); - virtual ~ServiceException() throw(); - - ServiceInfo service() - { return _service; } - - std::string alias() - { return service().alias(); } - - protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; - - private: - ServiceInfo _service; - }; - /////////////////////////////////////////////////////////////////// - - /** Service without alias was used in an operation. - */ - class ServiceNoAliasException : public ServiceException - { - public: - ServiceNoAliasException(); - ServiceNoAliasException( const std::string & msg_r ); - ServiceNoAliasException( const ServiceInfo & service_r ); - ServiceNoAliasException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - - /** - * Thrown when the repo alias is found to be invalid. - */ - class ServiceInvalidAliasException : public ServiceException - { - public: - ServiceInvalidAliasException(); - ServiceInvalidAliasException( const std::string & msg_r ); - ServiceInvalidAliasException( const ServiceInfo & info ); - ServiceInvalidAliasException( const ServiceInfo & info, const std::string & msg_r ); - }; - - /** Service already exists and some unique attribute can't be duplicated. - */ - class ServiceAlreadyExistsException : public ServiceException - { - public: - ServiceAlreadyExistsException(); - ServiceAlreadyExistsException( const std::string & msg_r ); - ServiceAlreadyExistsException( const ServiceInfo & service_r ); - ServiceAlreadyExistsException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - - /** Service has no or invalid url defined. - */ - class ServiceNoUrlException : public ServiceException - { - public: - ServiceNoUrlException(); - ServiceNoUrlException( const std::string & msg_r ); - ServiceNoUrlException( const ServiceInfo & service_r ); - ServiceNoUrlException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - //@} - - - /** \name PLUGIN Service related exceptions. - */ - //@{ - - /** PLUGIN Service related exceptions - */ - class ServicePluginException : public ServiceException - { - public: - ServicePluginException(); - ServicePluginException( const std::string & msg_r ); - ServicePluginException( const ServiceInfo & service_r ); - ServicePluginException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - - /** Service plugin has trouble providing the metadata but this should not be treated as error. - */ - class ServicePluginInformalException : public ServicePluginException - { - public: - ServicePluginInformalException(); - ServicePluginInformalException( const std::string & msg_r ); - ServicePluginInformalException( const ServiceInfo & service_r ); - ServicePluginInformalException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - - /** Service plugin is immutable. - */ - class ServicePluginImmutableException : public ServicePluginException - { - public: - ServicePluginImmutableException(); - ServicePluginImmutableException( const std::string & msg_r ); - ServicePluginImmutableException( const ServiceInfo & service_r ); - ServicePluginImmutableException( const ServiceInfo & service_r, const std::string & msg_r ); - }; - //@} - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_PARSER_TAGFILE_PARSEEXCEPTION_H diff --git a/libzypp/zypp/repo/RepoInfoBase.cc b/libzypp/zypp/repo/RepoInfoBase.cc deleted file mode 100644 index f3bf4ff..0000000 --- a/libzypp/zypp/repo/RepoInfoBase.cc +++ /dev/null @@ -1,175 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/RepoInfoBase.cc - * - */ -#include - -#include "zypp/ZConfig.h" -#include "zypp/repo/RepoVariables.h" - -#include "zypp/repo/RepoInfoBase.h" -#include "zypp/TriBool.h" -#include "zypp/Pathname.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace repo - { - - /////////////////////////////////////////////////////////////////// - /// \class RepoInfoBase::Impl - /// \brief RepoInfoBase data - /////////////////////////////////////////////////////////////////// - struct RepoInfoBase::Impl - { - Impl() - : _enabled( indeterminate ) - , _autorefresh( indeterminate ) - {} - - Impl( const std::string & alias_r ) - : _enabled( indeterminate ) - , _autorefresh( indeterminate ) - { setAlias( alias_r ); } - - public: - TriBool _enabled; - TriBool _autorefresh; - std::string _alias; - std::string _escaped_alias; - std::string _name; - Pathname _filepath; - - public: - - void setAlias( const std::string & alias_r ) - { - _alias = _escaped_alias = alias_r; - // replace slashes with underscores - str::replaceAll( _escaped_alias, "/", "_" ); - } - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoInfoBase - // - /////////////////////////////////////////////////////////////////// - - RepoInfoBase::RepoInfoBase() - : _pimpl( new Impl() ) - {} - - RepoInfoBase::RepoInfoBase(const string & alias) - : _pimpl( new Impl(alias) ) - {} - - RepoInfoBase::~RepoInfoBase() - {} - - void RepoInfoBase::setEnabled( bool enabled ) - { _pimpl->_enabled = enabled; } - - void RepoInfoBase::setAutorefresh( bool autorefresh ) - { _pimpl->_autorefresh = autorefresh; } - - void RepoInfoBase::setAlias( const std::string &alias ) - { _pimpl->setAlias(alias); } - - void RepoInfoBase::setName( const std::string &name ) - { _pimpl->_name = name; } - - void RepoInfoBase::setFilepath( const Pathname &filepath ) - { _pimpl->_filepath = filepath; } - - // true by default (if not set by setEnabled()) - bool RepoInfoBase::enabled() const - { return indeterminate(_pimpl->_enabled) ? true : (bool) _pimpl->_enabled; } - - // false by default (if not set by setAutorefresh()) - bool RepoInfoBase::autorefresh() const - { return indeterminate(_pimpl->_autorefresh) ? false : (bool) _pimpl->_autorefresh; } - - std::string RepoInfoBase::alias() const - { return _pimpl->_alias; } - - std::string RepoInfoBase::escaped_alias() const - { return _pimpl->_escaped_alias; } - - std::string RepoInfoBase::name() const - { - if ( rawName().empty() ) - return alias(); - return repo::RepoVariablesStringReplacer()( rawName() ); - } - - std::string RepoInfoBase::rawName() const - { return _pimpl->_name; } - - std::string RepoInfoBase::label() const - { - if ( ZConfig::instance().repoLabelIsAlias() ) - return alias(); - return name(); - } - - Pathname RepoInfoBase::filepath() const - { return _pimpl->_filepath; } - - - std::ostream & RepoInfoBase::dumpOn( std::ostream & str ) const - { - str << "--------------------------------------" << std::endl; - str << "- alias : " << alias() << std::endl; - if ( ! rawName().empty() ) - str << "- name : " << rawName() << std::endl; - str << "- enabled : " << enabled() << std::endl; - str << "- autorefresh : " << autorefresh() << std::endl; - - return str; - } - - std::ostream & RepoInfoBase::dumpAsIniOn( std::ostream & str ) const - { - // we save the original data without variable replacement - str << "[" << alias() << "]" << endl; - if ( ! rawName().empty() ) - str << "name=" << rawName() << endl; - str << "enabled=" << (enabled() ? "1" : "0") << endl; - str << "autorefresh=" << (autorefresh() ? "1" : "0") << endl; - - return str; - } - - std::ostream & RepoInfoBase::dumpAsXmlOn( std::ostream & str, const std::string & content ) const - { - return str << "" << endl; - } - - std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj ) - { - return obj.dumpOn(str); - } - - } // namespace repo - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/RepoInfoBase.h b/libzypp/zypp/repo/RepoInfoBase.h deleted file mode 100644 index a3dfd49..0000000 --- a/libzypp/zypp/repo/RepoInfoBase.h +++ /dev/null @@ -1,197 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/RepoInfoBase.h - * - */ -#ifndef REPOINFOBASE_H_ -#define REPOINFOBASE_H_ - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/APIConfig.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RepoInfoBase - // - /** - * \short Base class implementing common features of \ref RepoInfo and - * \ref ServiceInfo. - * - * \note Name is subject to repo variable replacement - * (\see \ref RepoVariablesStringReplacer). - */ - class RepoInfoBase - { - friend std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj ); - - public: - RepoInfoBase(); - RepoInfoBase(const std::string & alias); - virtual ~RepoInfoBase(); - - /** - * unique identifier for this source. If not specified - * It should be generated from the base url. - * - * Normally, in a .repo file the section name is used - * ( [somerepo] ) - */ - std::string alias() const; - - /** - * Same as alias(), just escaped in a way to be a valid file name. - */ - std::string escaped_alias() const; - - /** - * \short Repository name - * - * Short label or description of the repository. Defaults to \ref alias. - * Subject to repo variable replacement (\see \ref RepoVariablesStringReplacer). - * ie: "SUSE Linux 10.2 updates" - */ - std::string name() const; - - /** The raw metadata name (no default, no variables replaced). */ - std::string rawName() const; - - /** - * \short Label for use in messages for the user interface. - * - * Returns an alias or name, according to ZConfig::repoLabelIsAlias(). - */ - std::string label() const; - - /** User string: \ref label (alias or name) */ - std::string asUserString() const - { return label(); } - - /** - * If enabled is false, then this repository must be ignored as if does - * not exists, except when checking for duplicate alias. - */ - bool enabled() const; - - /** - * If true, the repostory must be refreshed before creating resolvables - * from it - */ - bool autorefresh() const; - - /** - * \short File where this repo was read from - * - * \note could be an empty pathname for repo - * infos created in memory. - */ - Pathname filepath() const; - - - public: - - /** - * set the repository alias \see alias - * \param alias - */ - void setAlias( const std::string &alias ); - - /** - * set the repository name \see name - * \param name - */ - void setName( const std::string &name ); - - /** - * enable or disable the repository \see enabled - * \param enabled - */ - void setEnabled( bool enabled ); - - /** - * enable or disable autorefresh \see autorefresh - * \param enabled - */ - void setAutorefresh( bool autorefresh ); - - /** - * \short set the path to the .repo file - * - * The path to the .repo file where this repository - * was defined, or empty if nowhere. - * - * \param path File path - */ - void setFilepath( const Pathname &filename ); - - /** - * Write a human-readable representation of this RepoInfoBase object - * into the \a str stream. Useful for logging. - */ - virtual std::ostream & dumpOn( std::ostream & str ) const; - - /** - * Write this RepoInfoBase object into \a str in a .repo (ini) file format. - * Raw values, no variable replacement. - */ - virtual std::ostream & dumpAsIniOn( std::ostream & str ) const; - - /** - * Write an XML representation of this object with content (if available). - * Repo variables replaced. - */ - virtual std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const; - - /** \deprecated Use camel cased dumpAsXmlOn */ - ZYPP_DEPRECATED std::ostream & dumpAsXMLOn( std::ostream & str, const std::string & content = "" ) const { return dumpAsXmlOn( str, content ); } - - class Impl; - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoInfoBase */ - inline bool operator==( const RepoInfoBase & lhs, const RepoInfoBase & rhs ) - { return lhs.alias() == rhs.alias(); } - - /** \relates RepoInfoBase */ - inline bool operator!=( const RepoInfoBase & lhs, const RepoInfoBase & rhs ) - { return lhs.alias() != rhs.alias(); } - - inline bool operator<( const RepoInfoBase & lhs, const RepoInfoBase & rhs ) - { return lhs.alias() < rhs.alias(); } - - /** \relates RepoInfoBase Stream output */ - std::ostream & operator<<( std::ostream & str, const RepoInfoBase & obj ); - - /** \relates RepoInfoBase */ - typedef shared_ptr RepoInfoBase_Ptr; - /** \relates RepoInfoBase */ - typedef shared_ptr RepoInfoBase_constPtr; - - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif /*REPOINFOBASE_H_*/ diff --git a/libzypp/zypp/repo/RepoMirrorList.cc b/libzypp/zypp/repo/RepoMirrorList.cc deleted file mode 100644 index ad44f25..0000000 --- a/libzypp/zypp/repo/RepoMirrorList.cc +++ /dev/null @@ -1,170 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/RepoMirrorList.cc - * -*/ - -#include -#include -#include -#include "zypp/repo/RepoMirrorList.h" -#include "zypp/media/MetaLinkParser.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/base/LogTools.h" -#include "zypp/ZConfig.h" -#include "zypp/PathInfo.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { - /////////////////////////////////////////////////////////////////// - /// \class RepoMirrorListTempProvider - /// \brief Provide access to downloaded mirror list (in temp space) - /// \ingroup g_RAII - /// - /// Tempspace (and mirror list) are deleted when provider goes out - /// of scope. - struct RepoMirrorListTempProvider - { - RepoMirrorListTempProvider() - {} - RepoMirrorListTempProvider( const Pathname & localfile_r ) - : _localfile( localfile_r ) - {} - RepoMirrorListTempProvider( const Url & url_r ) - { - Url abs_url( url_r ); - abs_url.setPathName( "/" ); - abs_url.setQueryParam( "mediahandler", "curl" ); - _access.reset( new MediaSetAccess( abs_url ) ); - _localfile = _access->provideFile( url_r.getPathName() ); - } - - const Pathname & localfile() const - { return _localfile; } - - private: - shared_ptr _access; - Pathname _localfile; - }; - /////////////////////////////////////////////////////////////////// - - inline std::vector RepoMirrorListParseXML( const Pathname &tmpfile ) - { - InputStream tmpfstream (tmpfile); - media::MetaLinkParser metalink; - metalink.parse(tmpfstream); - return metalink.getUrls(); - } - - inline std::vector RepoMirrorListParseTXT( const Pathname &tmpfile ) - { - InputStream tmpfstream (tmpfile); - std::vector my_urls; - string tmpurl; - while (getline(tmpfstream.stream(), tmpurl)) - { - my_urls.push_back(Url(tmpurl)); - } - return my_urls; - } - - /** Parse a local mirrorlist \a listfile_r and return usable URLs */ - inline std::vector RepoMirrorListParse( const Url & url_r, const Pathname & listfile_r ) - { - USR << url_r << " " << listfile_r << endl; - - std::vector mirrorurls; - if ( url_r.asString().find( "/metalink" ) != string::npos ) - mirrorurls = RepoMirrorListParseXML( listfile_r ); - else - mirrorurls = RepoMirrorListParseTXT( listfile_r ); - - - std::vector ret; - for ( auto & murl : mirrorurls ) - { - if ( murl.getScheme() != "rsync" ) - { - size_t delpos = murl.getPathName().find("repodata/repomd.xml"); - if( delpos != string::npos ) - { - murl.setPathName( murl.getPathName().erase(delpos) ); - } - ret.push_back( murl ); - - if ( ret.size() >= 4 ) // why 4? - break; - } - } - return ret; - } - - } // namespace - /////////////////////////////////////////////////////////////////// - - - RepoMirrorList::RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r ) - { - if ( url_r.getScheme() == "file" ) - { - // never cache for local mirrorlist - _urls = RepoMirrorListParse( url_r, url_r.getPathName() ); - } - else if ( ! PathInfo( metadatapath_r).isDir() ) - { - // no cachedir - RepoMirrorListTempProvider provider( url_r ); // RAII: lifetime of any downloaded files - _urls = RepoMirrorListParse( url_r, provider.localfile() ); - } - else - { - // have cachedir - Pathname cachefile( metadatapath_r ); - if ( url_r.asString().find( "/metalink" ) != string::npos ) - cachefile /= "mirrorlist.xml"; - else - cachefile /= "mirrorlist.txt"; - - zypp::filesystem::PathInfo cacheinfo( cachefile ); - if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ZConfig::instance().repo_refresh_delay() * 60 ) - { - DBG << "Getting MirrorList from URL: " << url_r << endl; - RepoMirrorListTempProvider provider( url_r ); // RAII: lifetime of downloaded file - - // Create directory, if not existing - DBG << "Copy MirrorList file to " << cachefile << endl; - zypp::filesystem::assert_dir( metadatapath_r ); - zypp::filesystem::hardlinkCopy( provider.localfile(), cachefile ); - } - - _urls = RepoMirrorListParse( url_r, cachefile ); - if( _urls.empty() ) - { - DBG << "Removing Cachefile as it contains no URLs" << endl; - zypp::filesystem::unlink( cachefile ); - } - } - } - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/RepoMirrorList.h b/libzypp/zypp/repo/RepoMirrorList.h deleted file mode 100644 index e6ad1fd..0000000 --- a/libzypp/zypp/repo/RepoMirrorList.h +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_MIRRORLIST_H_ -#define ZYPP_REPO_MIRRORLIST_H_ - -#include -#include "zypp/Url.h" -#include "zypp/Pathname.h" - -namespace zypp -{ - namespace repo - { - class RepoMirrorList - { - public: - RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r = Pathname() ); - - const std::vector & getUrls() const - { return _urls; } - - std::vector & getUrls() - { return _urls; } - - private: - std::vector _urls; - }; - } // ns repo -} // ns zypp - -#endif - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/RepoProvideFile.cc b/libzypp/zypp/repo/RepoProvideFile.cc deleted file mode 100644 index 5ac2815..0000000 --- a/libzypp/zypp/repo/RepoProvideFile.cc +++ /dev/null @@ -1,384 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/source/RepoProvideFile.cc - * -*/ -#include -#include -#include -#include - -#include "zypp/base/Gettext.h" -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/UserRequestException.h" -#include "zypp/repo/RepoProvideFile.h" -#include "zypp/ZYppCallbacks.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/ZConfig.h" -#include "zypp/ZYppFactory.h" -#include "zypp/repo/SUSEMediaVerifier.h" -#include "zypp/repo/RepoException.h" - -#include "zypp/repo/SUSEMediaVerifier.h" -#include "zypp/repo/RepoException.h" -#include "zypp/FileChecker.h" -#include "zypp/Fetcher.h" - -using std::endl; -using std::set; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // provideFile - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - /** Hack to extract progress information from media::DownloadProgressReport. - * We redirect the static report triggered from RepoInfo::provideFile - * to feed the ProvideFilePolicy callbacks in addition to any connected - * media::DownloadProgressReport. - */ - struct DownloadFileReportHack : public callback::ReceiveReport - { - typedef callback::ReceiveReport BaseType; - typedef function RedirectType; - - DownloadFileReportHack( RedirectType redirect_r ) - : _oldRec( Distributor::instance().getReceiver() ) - , _redirect( redirect_r ) - { connect(); } - ~DownloadFileReportHack() - { if ( _oldRec ) Distributor::instance().setReceiver( *_oldRec ); else Distributor::instance().noReceiver(); } - - virtual void start( const Url & file, Pathname localfile ) - { - if ( _oldRec ) - _oldRec->start( file, localfile ); - else - BaseType::start( file, localfile ); - } - - virtual bool progress( int value, const Url & file, double dbps_avg = -1, double dbps_current = -1 ) - { - bool ret = true; - if ( _oldRec ) - ret &= _oldRec->progress( value, file, dbps_avg, dbps_current ); - if ( _redirect ) - ret &= _redirect( value ); - return ret; - } - - virtual Action problem( const Url & file, Error error, const std::string & description ) - { - if ( _oldRec ) - return _oldRec->problem( file, error, description ); - return BaseType::problem( file, error, description ); - } - virtual void finish( const Url & file, Error error, const std::string & reason ) - { - if ( _oldRec ) - _oldRec->finish( file, error, reason ); - else - BaseType::finish( file, error, reason ); - } - - private: - Receiver * _oldRec; - RedirectType _redirect; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - ManagedFile provideFile( RepoInfo repo_r, - const OnMediaLocation & loc_r, - const ProvideFilePolicy & policy_r ) - { - RepoMediaAccess access; - return access.provideFile(repo_r, loc_r, policy_r ); - } - - /////////////////////////////////////////////////////////////////// - class RepoMediaAccess::Impl - { - public: - Impl( const ProvideFilePolicy & defaultPolicy_r ) - : _defaultPolicy( defaultPolicy_r ) - {} - - ~Impl() - { - std::map >::iterator it; - for ( it = _medias.begin(); - it != _medias.end(); - ++it ) - { - it->second->release(); - } - } - - /** Provide a MediaSetAccess for \c url with label and verifyer adjusted. - * - * As the same url (e.g. \c 'dvd:///' ) might be used for multiple repos - * we must always adjust the repo specific data (label,verifyer). - * - * \todo This mixture of media and repos specific data is fragile. - */ - shared_ptr mediaAccessForUrl( const Url &url, RepoInfo repo ) - { - std::map >::const_iterator it; - it = _medias.find(url); - shared_ptr media; - if ( it != _medias.end() ) - { - media = it->second; - } - else - { - media.reset( new MediaSetAccess(url) ); - _medias[url] = media; - } - setVerifierForRepo( repo, media ); - return media; - } - - private: - void setVerifierForRepo( RepoInfo repo, shared_ptr media ) - { - // Always set the MediaSetAccess label. - media->setLabel( repo.name() ); - - // set a verifier if the repository has it - - Pathname mediafile = repo.metadataPath() + "/media.1/media"; - if ( ! repo.metadataPath().empty() ) - { - if ( PathInfo(mediafile).isExist() ) - { - std::map, RepoInfo>::const_iterator it; - it = _verifier.find(media); - if ( it != _verifier.end() ) - { - if ( it->second.alias() == repo.alias() ) - { - // this media is already using this repo verifier - return; - } - } - - std::ifstream str(mediafile.asString().c_str()); - std::string vendor; - std::string mediaid; - std::string buffer; - if ( str ) - { - getline(str, vendor); - getline(str, mediaid); - getline(str, buffer); - - unsigned media_nr = str::strtonum(buffer); - MIL << "Repository '" << repo.alias() << "' has " << media_nr << " medias"<< endl; - - for ( unsigned i=1; i <= media_nr; ++i ) - { - media::MediaVerifierRef verifier( new repo::SUSEMediaVerifier( vendor, mediaid, i ) ); - - media->setVerifier( i, verifier); - } - _verifier[media] = repo; - } - else - { - ZYPP_THROW(RepoMetadataException(repo)); - } - } - else - { - WAR << "No media verifier for repo '" << repo.alias() << "' media/media.1 does not exist in '" << repo.metadataPath() << "'" << endl; - } - } - else - { - WAR << "'" << repo.alias() << "' metadata path is empty. Can't set verifier. Probably this repository does not come from RepoManager." << endl; - } - } - - private: - std::map, RepoInfo> _verifier; - std::map > _medias; - - public: - ProvideFilePolicy _defaultPolicy; - }; - /////////////////////////////////////////////////////////////////// - - - RepoMediaAccess::RepoMediaAccess( const ProvideFilePolicy & defaultPolicy_r ) - : _impl( new Impl( defaultPolicy_r ) ) - {} - - RepoMediaAccess::~RepoMediaAccess() - {} - - void RepoMediaAccess::setDefaultPolicy( const ProvideFilePolicy & policy_r ) - { _impl->_defaultPolicy = policy_r; } - - const ProvideFilePolicy & RepoMediaAccess::defaultPolicy() const - { return _impl->_defaultPolicy; } - - ManagedFile RepoMediaAccess::provideFile( RepoInfo repo_r, - const OnMediaLocation & loc_r, - const ProvideFilePolicy & policy_r ) - { - MIL << loc_r << endl; - // Arrange DownloadFileReportHack to recieve the source::DownloadFileReport - // and redirect download progress triggers to call the ProvideFilePolicy - // callback. - DownloadFileReportHack dumb( bind( mem_fun_ref( &ProvideFilePolicy::progress ), ref( policy_r ), _1 ) ); - - RepoException repo_excpt(repo_r, - str::form(_("Can't provide file '%s' from repository '%s'"), - loc_r.filename().c_str(), - repo_r.alias().c_str() ) ); - - if ( repo_r.baseUrlsEmpty() ) - { - repo_excpt.remember(RepoException(_("No url in repository."))); - ZYPP_THROW(repo_excpt); - } - - Fetcher fetcher; - fetcher.addCachePath( repo_r.packagesPath() ); - MIL << "Added cache path " << repo_r.packagesPath() << endl; - - // Test whether download destination is writable, if not - // switch into the tmpspace (e.g. bnc#755239, download and - // install srpms as user). - Pathname destinationDir( repo_r.packagesPath() ); - - PathInfo pi( destinationDir ); - if ( ! pi.isExist() ) - { - // try to create it... - assert_dir( destinationDir ); - pi(); - } - if ( geteuid() != 0 && ! pi.userMayW() ) - { - WAR << "Destination dir '" << destinationDir << "' is not user writable, using tmp space." << endl; - destinationDir = getZYpp()->tmpPath() / destinationDir; - assert_dir( destinationDir ); - fetcher.addCachePath( destinationDir ); - MIL << "Added cache path " << destinationDir << endl; - } - - for ( RepoInfo::urls_const_iterator it = repo_r.baseUrlsBegin(); - it != repo_r.baseUrlsEnd(); - /* incremented in the loop */ ) - { - Url url( *it ); - ++it; - try - { - MIL << "Providing file of repo '" << repo_r.alias() - << "' from " << url << endl; - shared_ptr access = _impl->mediaAccessForUrl( url, repo_r ); - - fetcher.enqueue( loc_r ); - - // FIXME: works for packages only - fetcher.start( destinationDir, *access ); - - // reached if no exception has been thrown, so this is the correct file - ManagedFile ret( destinationDir + loc_r.filename() ); - - std::string scheme( url.getScheme() ); - if ( !repo_r.keepPackages() ) - { - ret.setDispose( filesystem::unlink ); - } - - if ( loc_r.checksum().empty() ) - { - // no checksum in metadata - WAR << "No checksum in metadata " << loc_r << endl; - } - else - { - std::ifstream input( ret->asString().c_str() ); - CheckSum retChecksum( loc_r.checksum().type(), input ); - input.close(); - - if ( loc_r.checksum() != retChecksum ) - { - // failed integity check - std::ostringstream err; - err << "File " << ret << " fails integrity check. Expected: [" << loc_r.checksum() << "] Got: ["; - if ( retChecksum.empty() ) - err << "Failed to compute checksum"; - else - err << retChecksum; - err << "]"; - - WAR << err.str() << endl; - - if ( policy_r.failOnChecksumError() ) - ZYPP_THROW( FileCheckException( err.str() ) ); - else - WAR << "NO failOnChecksumError: " << err.str() << endl; - } - } - - MIL << "provideFile at " << ret << endl; - return ret; - } - catch ( const SkipRequestException &e ) - { - ZYPP_CAUGHT( e ); - ZYPP_RETHROW(e); - } - catch ( const AbortRequestException &e ) - { - ZYPP_CAUGHT( e ); - ZYPP_RETHROW(e); - } - catch ( const Exception &e ) - { - ZYPP_CAUGHT( e ); - - repo_excpt.remember(e); - - WAR << "Trying next url" << endl; - continue; - } - } // iteration over urls - - ZYPP_THROW(repo_excpt); - return ManagedFile(); // not reached - } - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/RepoProvideFile.h b/libzypp/zypp/repo/RepoProvideFile.h deleted file mode 100644 index 63628d9..0000000 --- a/libzypp/zypp/repo/RepoProvideFile.h +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/RepoProvideFile.h - * -*/ -#ifndef ZYPP_REPO_REPOPROVIDEFILE_H -#define ZYPP_REPO_REPOPROVIDEFILE_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" -#include "zypp/base/Functional.h" -#include "zypp/RepoInfo.h" -#include "zypp/ManagedFile.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/ProvideFilePolicy.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // provideFile - // - /////////////////////////////////////////////////////////////////// - - /** Provide a file from a Repository. - * Let \a source_r provide the file described by \a loc_r. In case - * \a loc_r contains a checksum, the file is verified. \a policy_r - * provides callback hooks for download progress reporting and behaviour - * on failed checksum verification. - * - * \throws Exception - */ - ManagedFile provideFile( RepoInfo repo_r, - const OnMediaLocation & loc_r, - const ProvideFilePolicy & policy_r = ProvideFilePolicy() ); - - /** - * \short Provides files from different repos - * - * Class that allows to get files from repositories - * It handles automatically setting media verifiers if the - * repo is cached, and reuses media set access opened for - * repositories during its scope, so you can provide - * files from different repositories in different order - * without opening and closing medias all the time - */ - class RepoMediaAccess - { - public: - /** Ctor taking the default \ref ProvideFilePolicy. */ - RepoMediaAccess( const ProvideFilePolicy & defaultPolicy_r = ProvideFilePolicy() ); - ~RepoMediaAccess(); - - /** Provide a file from a Repository. - * Let \a source_r provide the file described by \a loc_r. In case - * \a loc_r contains a checksum, the file is verified. \a policy_r - * provides callback hooks for download progress reporting and behaviour - * on failed checksum verification. - * - * \throws Exception - * \todo Investigate why this needs a non-const Repository as arg. - */ - ManagedFile provideFile( RepoInfo repo_r, - const OnMediaLocation & loc_r, - const ProvideFilePolicy & policy_r ); - - /** \overload Using the current default \ref ProvideFilePolicy. */ - ManagedFile provideFile( RepoInfo repo_r, const OnMediaLocation & loc_r ) - { return provideFile( repo_r, loc_r, defaultPolicy() ); } - - public: - /** Set a new default \ref ProvideFilePolicy. */ - void setDefaultPolicy( const ProvideFilePolicy & policy_r ); - - /** Get the current default \ref ProvideFilePolicy. */ - const ProvideFilePolicy & defaultPolicy() const; - - private: - class Impl; - RW_pointer _impl; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_REPO_REPOPROVIDEFILE_H diff --git a/libzypp/zypp/repo/RepoType.cc b/libzypp/zypp/repo/RepoType.cc deleted file mode 100644 index 390e406..0000000 --- a/libzypp/zypp/repo/RepoType.cc +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include "zypp/base/NamedValue.h" -#include "zypp/repo/RepoException.h" -#include "RepoType.h" - -namespace zypp -{ -namespace repo -{ - /////////////////////////////////////////////////////////////////// - namespace - { - static NamedValue & table() - { - static NamedValue & _t( *new NamedValue ); - if ( _t.empty() ) - { - _t( RepoType::RPMMD_e ) | "rpm-md" | "rpmmd"|"repomd"|"yum"|"up2date"; - _t( RepoType::YAST2_e ) | "yast2" | "yast"|"susetags"; - _t( RepoType::RPMPLAINDIR_e ) | "plaindir"; - _t( RepoType::NONE_e ) | "NONE" | "none"; - } - return _t; - } - } // namespace - /////////////////////////////////////////////////////////////////// - - const RepoType RepoType::RPMMD ( RepoType::RPMMD_e ); - const RepoType RepoType::YAST2 ( RepoType::YAST2_e ); - const RepoType RepoType::RPMPLAINDIR ( RepoType::RPMPLAINDIR_e ); - const RepoType RepoType::NONE ( RepoType::NONE_e ); - - RepoType::RepoType(const std::string & strval_r) - : _type(parse(strval_r)) - {} - - RepoType::Type RepoType::parse( const std::string & strval_r ) - { - RepoType::Type type; - if ( ! table().getValue( str::toLower( strval_r ), type ) ) - { - ZYPP_THROW( RepoUnknownTypeException( "Unknown repository type '" + strval_r + "'") ); - } - return type; - } - - const std::string & RepoType::asString() const - { - return table().getName( _type ); - } - - - } // ns repo -} // ns zypp - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/RepoType.h b/libzypp/zypp/repo/RepoType.h deleted file mode 100644 index 17e2b95..0000000 --- a/libzypp/zypp/repo/RepoType.h +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_TYPE_H_ -#define ZYPP_REPO_TYPE_H_ - -#include -#include - -namespace zypp -{ - namespace repo - { - - /** - * \short Repository type enumeration - * - * Repositories can be from varous types - * ... - */ - struct RepoType - { - static const RepoType RPMMD; - static const RepoType YAST2; - static const RepoType RPMPLAINDIR; - static const RepoType NONE; - - enum Type - { - NONE_e, - RPMMD_e, - YAST2_e, - RPMPLAINDIR_e, - }; - - RepoType() : _type(NONE_e) {} - - RepoType(Type type) : _type(type) {} - - explicit RepoType(const std::string & strval_r); - - Type toEnum() const { return _type; } - - RepoType::Type parse(const std::string & strval_r); - - const std::string & asString() const; - - Type _type; - }; - - - inline std::ostream & operator<<( std::ostream & str, const RepoType & obj ) - { return str << obj.asString(); } - - inline bool operator==(const RepoType & obj1, const RepoType & obj2) - { return obj1._type == obj2._type; } - - inline bool operator!=(const RepoType & obj1, const RepoType & obj2) - { return ! (obj1 == obj2); } - - } // ns repo -} // ns zypp - -#endif - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/RepoVariables.cc b/libzypp/zypp/repo/RepoVariables.cc deleted file mode 100644 index f4edc87..0000000 --- a/libzypp/zypp/repo/RepoVariables.cc +++ /dev/null @@ -1,118 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" - -#include "zypp/ZConfig.h" -#include "zypp/Target.h" -#include "zypp/Arch.h" -#include "zypp/repo/RepoVariables.h" -#include "zypp/base/NonCopyable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - namespace env - { - /** Use faked releasever (e.g. for 'zupper dup' to next distro version */ - inline std::string ZYPP_REPO_RELEASEVER() - { - const char * env = getenv("ZYPP_REPO_RELEASEVER"); - return( env ? env : "" ); - } - } - - /////////////////////////////////////////////////////////////////// - namespace repo - { - /////////////////////////////////////////////////////////////////// - namespace - { - /** \brief Provide lazy initialized repo variables - */ - struct ReplacerData : private zypp::base::NonCopyable - { - const std::string & sysarch() const - { - if ( _sysarch.empty() ) - initArchStr(); - return _sysarch; - } - - const std::string & basearch() const - { - if ( _basearch.empty() ) - initArchStr(); - return _basearch; - } - - const std::string & releasever() const - { - if( _releasever.empty() ) - { - _releasever = env::ZYPP_REPO_RELEASEVER(); - if( _releasever.empty() ) - _releasever = Target::distributionVersion( Pathname()/*guess*/ ); - else - WAR << "ENV overwrites $releasever=" << _releasever << endl; - } - return _releasever; - } - - private: - void initArchStr() const - { - Arch arch( ZConfig::instance().systemArchitecture() ); - _sysarch = arch.asString(); - _basearch = arch.baseArch().asString(); - } - private: - mutable std::string _sysarch; - mutable std::string _basearch; - mutable std::string _releasever; - }; - - /** \brief Replace repo variables on demand - * - * Initialisation of repo variables is delayed until they actually occur in - * a string. - */ - std::string replacer( const std::string & value_r ) - { - static ReplacerData _data; - - std::string ret( value_r ); - // Don't need to capture static (non automatic) _data in lambda - ret = str::replaceAllFun( ret, "$arch", []()-> std::string { return _data.sysarch(); } ); - ret = str::replaceAllFun( ret, "$basearch", []()-> std::string { return _data.basearch(); } ); - ret = str::replaceAllFun( ret, "$releasever", []()-> std::string { return _data.releasever(); } ); - return ret; - } - - } // namespace - /////////////////////////////////////////////////////////////////// - - std::string RepoVariablesStringReplacer::operator()( const std::string & value ) const - { - return replacer( value ); - } - - Url RepoVariablesUrlReplacer::operator()( const Url & value ) const - { - Url newurl( value ); - newurl.setPathData( replacer( value.getPathData() ) ); - newurl.setQueryString( replacer( value.getQueryString() ) ); - return newurl; - } - - } // namespace repo - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/RepoVariables.h b/libzypp/zypp/repo/RepoVariables.h deleted file mode 100644 index a5c7efa..0000000 --- a/libzypp/zypp/repo/RepoVariables.h +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_VARIABLES_H_ -#define ZYPP_REPO_VARIABLES_H_ - -#include -#include "zypp/Url.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace repo - { - - /** - * \short Functor replacing repository variables - * - * Replaces '$arch', '$basearch' and $releasever in a string - * with the global ZYpp values. - * - * \note The $releasever value is overwritten by the environment - * variable \c ZYPP_REPO_RELEASEVER. This might be handy for - * distribution upogrades like this: - * \code - * $ export ZYPP_REPO_RELEASEVER=13.2 - * $ zypper lr -u - * $ zypper dup - * ....upgrades to 13.2... - * \endcode - * (see \ref zypp-envars) - * - * \code - * Example: - * ftp://user:secret@site.net/$arch/ -> ftp://user:secret@site.net/i686/ - * http://site.net/?basearch=$basearch -> http://site.net/?basearch=i386 - * \endcode - */ - struct RepoVariablesStringReplacer : public std::unary_function - { - std::string operator()( const std::string & value_r ) const; - }; - - /** - * \short Functor replacing repository variables - * - * Replaces repository variables in the path and query part of the URL. - * \see RepoVariablesStringReplacer - */ - struct RepoVariablesUrlReplacer : public std::unary_function - { - Url operator()( const Url & url_r ) const; - }; - - } // namespace repo - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif diff --git a/libzypp/zypp/repo/SUSEMediaVerifier.cc b/libzypp/zypp/repo/SUSEMediaVerifier.cc deleted file mode 100644 index 1a91de6..0000000 --- a/libzypp/zypp/repo/SUSEMediaVerifier.cc +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include "zypp/repo/SUSEMediaVerifier.h" - -using namespace std; - -namespace zypp -{ -namespace repo -{ - -SUSEMediaVerifier::SUSEMediaVerifier(const std::string & vendor_r, - const std::string & id_r, - const media::MediaNr media_nr) - : _media_vendor(vendor_r) - , _media_id(id_r) - , _media_nr(media_nr) -{} - -SUSEMediaVerifier::SUSEMediaVerifier( int media_nr, const Pathname &path_r ) - : _media_nr(media_nr) -{ - std::ifstream str(path_r.asString().c_str()); - std::string vendor; - std::string id; - - if ( str ) - { - getline(str, _media_vendor); - getline(str, _media_id); - } - else - { - ZYPP_THROW(Exception("Can't setup media verifier using file: '" - + path_r.asString() + "'")); - } -} - -bool SUSEMediaVerifier::isDesiredMedia(const media::MediaAccessRef &ref) -{ - if (_media_vendor.empty() || _media_id.empty()) - return true; - - Pathname media_file = "/media." + str::numstring(_media_nr) + "/media"; - ref->provideFile (media_file); - media_file = ref->localPath(media_file); - std::ifstream str(media_file.asString().c_str()); - std::string vendor; - std::string id; -#warning check the stream status - getline(str, vendor); - getline(str, id); - - return (vendor == _media_vendor && id == _media_id ); -} - -} -} - diff --git a/libzypp/zypp/repo/SUSEMediaVerifier.h b/libzypp/zypp/repo/SUSEMediaVerifier.h deleted file mode 100644 index b415c33..0000000 --- a/libzypp/zypp/repo/SUSEMediaVerifier.h +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_SUSE_MEDIAVERIFIER_H -#define ZYPP_SUSE_MEDIAVERIFIER_H - -#include "zypp/media/MediaManager.h" -#include "zypp/media/MediaAccess.h" - -namespace zypp -{ - namespace repo - { - - /** - * \short Implementation of the traditional SUSE media verifier - */ - class SUSEMediaVerifier : public zypp::media::MediaVerifierBase - { - public: - /** - * \short create a verifier from attributes - * - * Creates a verifier for the media using - * the attributes - * - * \param vendor_r i.e. "SUSE Linux Products GmbH" - * \param id_r i.e. "20070718164719" - * \param media_nr media number - */ - SUSEMediaVerifier(const std::string & vendor_r, - const std::string & id_r, - const media::MediaNr media_nr = 1); - - /** - * \short creates a verifier from a media file - * - * \param path_r Path to media.1/media kind file - */ - SUSEMediaVerifier( int media_nr, const Pathname &path_r ); - - /** - * \short Check if it is the desider media - * - * Check if the specified attached media contains - * the desired media number (e.g. SLES10 CD1). - * - * Reimplementation of virtual function, will be - * called by the component verifying the media. - */ - virtual bool isDesiredMedia(const media::MediaAccessRef &ref); - - private: - std::string _media_vendor; - std::string _media_id; - media::MediaNr _media_nr; - }; - - } -} -#endif diff --git a/libzypp/zypp/repo/ServiceRepos.cc b/libzypp/zypp/repo/ServiceRepos.cc deleted file mode 100644 index 86d0dc5..0000000 --- a/libzypp/zypp/repo/ServiceRepos.cc +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include "zypp/base/Logger.h" -#include "zypp/repo/ServiceRepos.h" -#include "zypp/repo/RepoException.h" -#include "zypp/media/MediaException.h" -#include "zypp/parser/RepoFileReader.h" -#include "zypp/media/MediaManager.h" -#include "zypp/parser/RepoindexFileReader.h" -#include "zypp/ExternalProgram.h" - -using std::stringstream; -using std::endl; - -namespace zypp -{ -namespace repo -{ - -class ServiceRepos::Impl -{ -public: - Impl() - { - } - - virtual ~Impl() - { - } -}; - -class RIMServiceRepos : public ServiceRepos::Impl -{ -public: - ServiceRepos::ProcessRepo _callback; - - RIMServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ) - : _callback(callback) - { - // repoindex.xml must be fetched always without using cookies (bnc #573897) - Url serviceUrl( service.url() ); - serviceUrl.setQueryParam( "cookies", "0" ); - - // download the repo index file - media::MediaManager mediamanager; - media::MediaAccessId mid = mediamanager.open( serviceUrl ); - mediamanager.attach( mid ); - mediamanager.provideFile( mid, "repo/repoindex.xml" ); - Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" ); - parser::RepoindexFileReader reader(path, _callback); - mediamanager.release( mid ); - mediamanager.close( mid ); - } - - ~RIMServiceRepos() - { - - } -}; - -class PluginServiceRepos : public ServiceRepos::Impl -{ -public: - ServiceRepos::ProcessRepo _callback; - - PluginServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ) - : _callback(callback) - { - Url serviceUrl( service.url() ); - stringstream buffer; - - ExternalProgram::Arguments args; - args.reserve( 3 ); - args.push_back( "/bin/sh" ); - args.push_back( "-c" ); - args.push_back( serviceUrl.getPathName() ); - ExternalProgramWithStderr prog( args ); - prog >> buffer; - - if ( prog.close() != 0 ) - { - // ServicePluginInformalException: - // Ignore this error but we'd like to report it somehow... - std::string errbuffer; - prog.stderrGetUpTo( errbuffer, '\0' ); - ERR << "Capture plugin error:[" << endl << errbuffer << endl << ']' << endl; - ZYPP_THROW( repo::ServicePluginInformalException( service, errbuffer ) ); - } - - parser::RepoFileReader parser(buffer, _callback); - } - - ~PluginServiceRepos() - {} -}; - - -ServiceRepos::ServiceRepos(const ServiceInfo &service, - const ServiceRepos::ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress) - : _impl( (service.type() == ServiceType::PLUGIN) ? (ServiceRepos::Impl *)(new PluginServiceRepos(service, callback, progress)) : (ServiceRepos::Impl *)(new RIMServiceRepos(service, callback, progress))) -{ -} - -ServiceRepos::~ServiceRepos() -{ -} - - -} -} diff --git a/libzypp/zypp/repo/ServiceRepos.h b/libzypp/zypp/repo/ServiceRepos.h deleted file mode 100644 index 66bef82..0000000 --- a/libzypp/zypp/repo/ServiceRepos.h +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_REPO_SERVICE_REPOS -#define ZYPP_REPO_SERVICE_REPOS - -#include "zypp/base/NonCopyable.h" -#include "zypp/ProgressData.h" -#include "zypp/ServiceInfo.h" -#include "zypp/RepoInfo.h" - -namespace zypp -{ - namespace repo - { - /** - * Retrieval of repository list for - * a service - */ - class ServiceRepos : private base::NonCopyable - { - public: - - /** - * Callback definition. - * First parameter is a \ref RepoInfo object with the resource - * second parameter is the resource type. - * - * Return false from the callback to get a \ref AbortRequestException - * to be thrown and the processing to be cancelled. - */ - typedef function< bool( const RepoInfo & )> ProcessRepo; - - ServiceRepos(const ServiceInfo &service, - const ProcessRepo & callback, - const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() ); - ~ServiceRepos(); - - /** Implementation */ - class Impl; - private: - RW_pointer _impl; - }; - } // ns repo -} // ns zypp - -#endif diff --git a/libzypp/zypp/repo/ServiceType.cc b/libzypp/zypp/repo/ServiceType.cc deleted file mode 100644 index d677936..0000000 --- a/libzypp/zypp/repo/ServiceType.cc +++ /dev/null @@ -1,73 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include -#include "zypp/repo/RepoException.h" -#include "ServiceType.h" - -namespace zypp -{ - namespace repo - { - - - static std::map _table; - - const ServiceType ServiceType::RIS(ServiceType::RIS_e); - const ServiceType ServiceType::NONE(ServiceType::NONE_e); - const ServiceType ServiceType::PLUGIN(ServiceType::PLUGIN_e); - - ServiceType::ServiceType(const std::string & strval_r) - : _type(parse(strval_r)) - {} - - ServiceType::Type ServiceType::parse(const std::string & strval_r) - { - if (_table.empty()) - { - // initialize it - _table["ris"] = ServiceType::RIS_e; - _table["RIS"] = ServiceType::RIS_e; - _table["nu"] = ServiceType::RIS_e; - _table["NU"] = ServiceType::RIS_e; - _table["plugin"] = ServiceType::PLUGIN_e; - _table["PLUGIN"] = ServiceType::PLUGIN_e; - _table["NONE"] = _table["none"] = ServiceType::NONE_e; - } - - std::map::const_iterator it - = _table.find(strval_r); - if (it == _table.end()) - { - ZYPP_THROW(RepoUnknownTypeException( - "Unknown service type '" + strval_r + "'")); - } - return it->second; - } - - - const std::string & ServiceType::asString() const - { - static std::map _table; - if ( _table.empty() ) - { - // initialize it - _table[RIS_e] = "ris"; - _table[PLUGIN_e] = "plugin"; - _table[NONE_e] = "NONE"; - } - return _table[_type]; - } - - - } // ns repo -} // ns zypp - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/ServiceType.h b/libzypp/zypp/repo/ServiceType.h deleted file mode 100644 index 51feb1f..0000000 --- a/libzypp/zypp/repo/ServiceType.h +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_SERVICE_TYPE_H_ -#define ZYPP_SERVICE_TYPE_H_ - -#include -#include - -namespace zypp -{ - namespace repo - { - - /** - * \short Service type enumeration - * - * Currently we have only RIS service, but more can come later. - */ - struct ServiceType - { - /** - * Repository Index Service (RIS) - * (formerly known as 'Novell Update' (NU) service) - */ - static const ServiceType RIS; - /** No service set. */ - static const ServiceType NONE; - /** - * Plugin services are scripts installed on - * your system that provide the package manager with - * repositories. - * - * The mechanism used to create this repository list - * is completely up to the script - */ - static const ServiceType PLUGIN; - - enum Type - { - NONE_e, - RIS_e, - PLUGIN_e, - }; - - ServiceType() : _type(NONE_e) {} - - ServiceType(Type type) : _type(type) {} - - explicit ServiceType(const std::string & strval_r); - - Type toEnum() const { return _type; } - - ServiceType::Type parse(const std::string & strval_r); - - const std::string & asString() const; - - Type _type; - }; - - - inline std::ostream & operator<<( std::ostream & str, const ServiceType & obj ) - { return str << obj.asString(); } - - inline bool operator==(const ServiceType & obj1, const ServiceType & obj2) - { return obj1._type == obj2._type; } - - inline bool operator!=(const ServiceType & obj1, const ServiceType & obj2) - { return ! (obj1 == obj2); } - - - } // ns repo -} // ns zypp - -#endif /* ZYPP_SERVICE_TYPE_H_ */ - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/SrcPackageProvider.cc b/libzypp/zypp/repo/SrcPackageProvider.cc deleted file mode 100644 index db977e9..0000000 --- a/libzypp/zypp/repo/SrcPackageProvider.cc +++ /dev/null @@ -1,106 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/SrcPackageProvider.cc - * -*/ -#include -#include - -#include "zypp/repo/SrcPackageProvider.h" -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/SrcPackage.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - typedef std::string (SrcPackage::*inlined)() const; - typedef OnMediaLocation (SrcPackage::*location)() const; - - /** Provide a SrcPackage in a local file. */ - ManagedFile doProvideSrcPackage( repo::RepoMediaAccess & access_r, - const SrcPackage & script_r, - inlined inlined_r, location location_r ) - { - ManagedFile ret; - - // 1st try inlined - std::string inlined( (script_r.*inlined_r)() ); - if ( ! inlined.empty() ) - { - // Take care the TmpFile goes out of scope BEFORE the - // ofstream opens the file again. - ret = ManagedFile( filesystem::TmpFile( filesystem::TmpPath::defaultLocation(), - "zypp-script-"+script_r.name() ), - filesystem::unlink ); - std::ofstream str( ret.value().c_str() ); - str << inlined << endl; - } - else - { - // otherwise try download - OnMediaLocation location( (script_r.*location_r)() ); - if ( ! location.filename().empty() ) - { - ret = access_r.provideFile( script_r.repoInfo(), location ); - } - else - { - // no script - return ManagedFile(); - } - } - - // HERE: got the script - filesystem::chmod( ret, 0700 ); - return ret; - } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SrcPackageProvider::SrcPackageProvider - // METHOD TYPE : Ctor - // - SrcPackageProvider::SrcPackageProvider( repo::RepoMediaAccess & access_r ) - : _access( access_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : SrcPackageProvider::~SrcPackageProvider - // METHOD TYPE : Dtor - // - SrcPackageProvider::~SrcPackageProvider() - {} - - ManagedFile SrcPackageProvider::provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ) const - { - return _access.provideFile( srcPackage_r->repoInfo(), srcPackage_r->location() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/repo/SrcPackageProvider.h b/libzypp/zypp/repo/SrcPackageProvider.h deleted file mode 100644 index e8d98fe..0000000 --- a/libzypp/zypp/repo/SrcPackageProvider.h +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/repo/SrcPackageProvider.h - * -*/ -#ifndef ZYPP_REPO_SRCPACKAGEPROVIDER_H -#define ZYPP_REPO_SRCPACKAGEPROVIDER_H - -#include - -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/repo/RepoProvideFile.h" -#include "zypp/ManagedFile.h" -#include "zypp/ResTraits.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace repo - { ///////////////////////////////////////////////////////////////// - - class RepoMediaAccess; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SrcPackageProvider - // - /** */ - class SrcPackageProvider : private base::NonCopyable - { - public: - /** Ctor */ - SrcPackageProvider( repo::RepoMediaAccess & access_r ); - /** Dtor */ - ~SrcPackageProvider(); - - public: - /** Provide SrcPackage in a local file. */ - ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ) const; - - private: - RepoMediaAccess & _access; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace repo - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_REPO_SRCPACKAGEPROVIDER_H diff --git a/libzypp/zypp/repo/susetags/Downloader.cc b/libzypp/zypp/repo/susetags/Downloader.cc deleted file mode 100644 index c6b1c58..0000000 --- a/libzypp/zypp/repo/susetags/Downloader.cc +++ /dev/null @@ -1,220 +0,0 @@ - -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/base/Regex.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/Fetcher.h" -#include "zypp/Locale.h" -#include "zypp/ZConfig.h" -#include "zypp/repo/MediaInfoDownloader.h" -#include "zypp/repo/susetags/Downloader.h" -#include "zypp/parser/ParseException.h" -#include "zypp/parser/susetags/RepoIndex.h" -#include "zypp/base/UserRequestException.h" - -using namespace std; -using namespace zypp::parser; -using namespace zypp::parser::susetags; - -namespace zypp -{ -namespace repo -{ -namespace susetags -{ - -Downloader::Downloader( const RepoInfo &repoinfo, const Pathname &delta_dir ) - : repo::Downloader(repoinfo), _delta_dir(delta_dir) -{ -} - -RepoStatus Downloader::status( MediaSetAccess &media ) -{ - Pathname content = media.provideFile( repoInfo().path() + "/content"); - // the media.1 is always in the root of the media, not like the content - // file which is in the path() location - Pathname mediafile = media.provideFile( "/media.1/media" ); - - return RepoStatus(content) && RepoStatus(mediafile); -} - -// search old repository file file to run the delta algorithm on -static Pathname search_deltafile( const Pathname &dir, const Pathname &file ) -{ - Pathname deltafile(dir + file.basename()); - if (PathInfo(deltafile).isExist()) - return deltafile; - return Pathname(); -} - - -/** \todo: Downloading/sigcheck of master index shoudl be common in base class */ -void Downloader::download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progress ) -{ - downloadMediaInfo( dest_dir, media ); - - Pathname masterIndex( repoInfo().path() / "/content" ); - defaultDownloadMasterIndex( media, dest_dir, masterIndex ); - - // Content file first to get the repoindex - { - Pathname inputfile( dest_dir / masterIndex ); - ContentFileReader content; - content.setRepoIndexConsumer( bind( &Downloader::consumeIndex, this, _1 ) ); - content.parse( inputfile ); - } - if ( ! _repoindex ) - { - ZYPP_THROW( ParseException( (dest_dir+repoInfo().path()).asString() + ": " + "No repository index in content file." ) ); - } - MIL << "RepoIndex: " << _repoindex << endl; - if ( _repoindex->metaFileChecksums.empty() ) - { - ZYPP_THROW( ParseException( (dest_dir+repoInfo().path()).asString() + ": " + "No metadata checksums in content file." ) ); - } - if ( _repoindex->signingKeys.empty() ) - { - WAR << "No signing keys defined." << endl; - } - - // Prepare parsing - Pathname descr_dir = _repoindex->descrdir; // path below reporoot - //_datadir = _repoIndex->datadir; // path below reporoot - - std::map availablePackageTranslations; - - for_( it, _repoindex->metaFileChecksums.begin(), _repoindex->metaFileChecksums.end() ) - { - // omit unwanted translations - if ( str::hasPrefix( it->first, "packages" ) ) - { - static const str::regex rx_packages( "^packages((.gz)?|(.([^.]*))(.gz)?)$" ); - str::smatch what; - if ( str::regex_match( it->first, what, rx_packages ) ) - { - if ( what[4].empty() // packages(.gz)? - || what[4] == "DU" - || what[4] == "en" ) - { ; /* always downloaded */ } - else if ( what[4] == "FL" ) - { continue; /* never downloaded */ } - else - { - // remember and decide later - availablePackageTranslations[what[4]] = it; - continue; - } - } - else - continue; // discard - } - else if ( it->first == "patterns.pat" - || it->first == "patterns.pat.gz" ) - { - // take all patterns in one go - } - else if ( str::endsWith( it->first, ".pat" ) - || str::endsWith( it->first, ".pat.gz" ) ) - { - - // *** see also zypp/parser/susetags/RepoParser.cc *** - - // omit unwanted patterns, see https://bugzilla.novell.com/show_bug.cgi?id=298716 - // expect "..pat[.gz]", might contain additional dots - // split at dots, take .pat or .pat.gz into account - - std::vector patparts; - unsigned archpos = 2; - // expect "..pat[.gz]", might contain additional dots - unsigned count = str::split( it->first, std::back_inserter(patparts), "." ); - if ( patparts[count-1] == "gz" ) - archpos++; - - if ( count > archpos ) - { - try // might by an invalid architecture - { - Arch patarch( patparts[count-archpos] ); - if ( !patarch.compatibleWith( ZConfig::instance().systemArchitecture() ) ) - { - // discard, if not compatible - MIL << "Discarding pattern " << it->first << endl; - continue; - } - } - catch ( const Exception & excpt ) - { - WAR << "Pattern file name does not contain recognizable architecture: " << it->first << endl; - // keep .pat file if it doesn't contain an recognizable arch - } - } - } - MIL << "adding job " << it->first << endl; - OnMediaLocation location( repoInfo().path() + descr_dir + it->first, 1 ); - location.setChecksum( it->second ); - enqueueDigested(location, FileChecker(), search_deltafile(_delta_dir + descr_dir, it->first)); - } - - // check whether to download more package translations: - { - auto fnc_checkTransaltions( [&]( const Locale & locale_r ) { - for ( Locale toGet( locale_r ); toGet != Locale::noCode; toGet = toGet.fallback() ) - { - auto it( availablePackageTranslations.find( toGet.code() ) ); - if ( it != availablePackageTranslations.end() ) - { - auto mit( it->second ); - MIL << "adding job " << mit->first << endl; - OnMediaLocation location( repoInfo().path() + descr_dir + mit->first, 1 ); - location.setChecksum( mit->second ); - enqueueDigested(location, FileChecker(), search_deltafile(_delta_dir + descr_dir, mit->first)); - break; - } - } - }); - for ( const Locale & it : ZConfig::instance().repoRefreshLocales() ) - { - fnc_checkTransaltions( it ); - } - fnc_checkTransaltions( ZConfig::instance().textLocale() ); - } - - for_( it, _repoindex->mediaFileChecksums.begin(), _repoindex->mediaFileChecksums.end() ) - { - // Repo adopts license files listed in HASH - if ( it->first != "license.tar.gz" ) - continue; - - MIL << "adding job " << it->first << endl; - OnMediaLocation location( repoInfo().path() + it->first, 1 ); - location.setChecksum( it->second ); - enqueueDigested(location, FileChecker(), search_deltafile(_delta_dir, it->first)); - } - - for_( it, _repoindex->signingKeys.begin(),_repoindex->signingKeys.end() ) - { - MIL << "adding job " << it->first << endl; - OnMediaLocation location( repoInfo().path() + it->first, 1 ); - location.setChecksum( it->second ); - enqueueDigested(location); - } - - start( dest_dir, media ); -} - -void Downloader::consumeIndex( const RepoIndex_Ptr & data_r ) -{ - MIL << "Consuming repo index" << endl; - _repoindex = data_r; -} - -}// ns susetags -}// ns source -} // ns zypp diff --git a/libzypp/zypp/repo/susetags/Downloader.h b/libzypp/zypp/repo/susetags/Downloader.h deleted file mode 100644 index 1b4be79..0000000 --- a/libzypp/zypp/repo/susetags/Downloader.h +++ /dev/null @@ -1,76 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_SOURCE_SUSETAGS_DOWNLOADER -#define ZYPP_SOURCE_SUSETAGS_DOWNLOADER - -#include "zypp/Url.h" -#include "zypp/Pathname.h" -#include "zypp/ProgressData.h" -#include "zypp/RepoInfo.h" -#include "zypp/RepoStatus.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/repo/Downloader.h" -#include "zypp/parser/susetags/ContentFileReader.h" - -namespace zypp -{ - namespace repo - { - namespace susetags - { - - /** - * \short Downloader for SUSETags (YaST2) repositories - * Encapsulates all the knowledge of which files have - * to be downloaded to the local disk. - */ - class Downloader : public repo::Downloader - { - public: - /** - * \short Constructor from the repository information - * - * The repository information allows more context to be given - * to the user when something fails. - * - * \param info Repository information - */ - Downloader( const RepoInfo &info, const Pathname &delta_dir = Pathname() ); - - /** - * \short Download metadata to a local directory - * - * \param media Media access to the repository url - * \param dest_dir Local destination directory - * \param progress progress receiver - */ - void download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); - /** - * \short Status of the remote repository - */ - RepoStatus status( MediaSetAccess &media ); - - /** - * Content file parser consumer - */ - void consumeIndex( const parser::susetags::RepoIndex_Ptr & data_r ); - - private: - parser::susetags::RepoIndex_Ptr _repoindex; - Pathname _delta_dir; - }; - - } // ns susetags - } // ns source -} // ns zypp - -#endif diff --git a/libzypp/zypp/repo/yum/Downloader.cc b/libzypp/zypp/repo/yum/Downloader.cc deleted file mode 100644 index a27dd2f..0000000 --- a/libzypp/zypp/repo/yum/Downloader.cc +++ /dev/null @@ -1,147 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include "zypp/base/String.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Function.h" - -#include "zypp/parser/yum/RepomdFileReader.h" -#include "zypp/parser/yum/PatchesFileReader.h" -#include "Downloader.h" -#include "zypp/repo/MediaInfoDownloader.h" -#include "zypp/base/UserRequestException.h" -#include "zypp/parser/xml/Reader.h" - -using namespace std; -using namespace zypp::xml; -using namespace zypp::parser::yum; - -namespace zypp -{ -namespace repo -{ -namespace yum -{ - -Downloader::Downloader( const RepoInfo &repoinfo , const Pathname &delta_dir) - : repo::Downloader(repoinfo), _delta_dir(delta_dir), _media_ptr(0L) -{ -} - - -RepoStatus Downloader::status( MediaSetAccess &media ) -{ - Pathname repomd = media.provideFile( repoInfo().path() + "/repodata/repomd.xml"); - return RepoStatus(repomd); -} - -static OnMediaLocation -loc_with_path_prefix(const OnMediaLocation & loc, - const Pathname & prefix) -{ - if (prefix.empty() || prefix == "/") - return loc; - - OnMediaLocation loc_with_path(loc); - loc_with_path.changeFilename(prefix / loc.filename()); - return loc_with_path; -} - -// search old repository file file to run the delta algorithm on -static Pathname search_deltafile( const Pathname &dir, const Pathname &file ) -{ - Pathname deltafile; - if (!PathInfo(dir).isDir()) - return deltafile; - string base = file.basename(); - size_t hypoff = base.find("-"); - if (hypoff != string::npos) - base.replace(0, hypoff + 1, ""); - size_t basesize = base.size(); - std::list retlist; - if (!filesystem::readdir(retlist, dir, false)) - { - for_( it, retlist.begin(), retlist.end() ) - { - string fn = it->asString(); - if (fn.size() >= basesize && fn.substr(fn.size() - basesize, basesize) == base) - deltafile = *it; - } - } - return deltafile; -} - -bool Downloader::patches_Callback( const OnMediaLocation &loc, - const string &id ) -{ - OnMediaLocation loc_with_path(loc_with_path_prefix(loc, repoInfo().path())); - MIL << id << " : " << loc_with_path << endl; - this->enqueueDigested(loc_with_path, FileChecker(), search_deltafile(_delta_dir + "repodata", loc.filename())); - return true; -} - -bool Downloader::repomd_Callback( const OnMediaLocation &loc, - const ResourceType &dtype ) -{ - OnMediaLocation loc_with_path(loc_with_path_prefix(loc, repoInfo().path())); - MIL << dtype << " : " << loc_with_path << endl; - - //! \todo do this through a ZConfig call so that it is always in sync with parser - // skip other - if ( dtype == ResourceType::OTHER ) - { - MIL << "Skipping other.xml" << endl; - return true; - } - // skip filelists - if ( dtype == ResourceType::FILELISTS ) - { - MIL << "Skipping filelists.xml.gz" << endl; - return true; - } - - this->enqueueDigested(loc_with_path, FileChecker(), search_deltafile(_delta_dir + "repodata", loc.filename())); - - // We got a patches file we need to read, to add patches listed - // there, so we transfer what we have in the queue, and - // queue the patches in the patches callback - if ( dtype == ResourceType::PATCHES ) - { - this->start( _dest_dir, *_media_ptr ); - // now the patches.xml file must exists - PatchesFileReader( _dest_dir + repoInfo().path() + loc.filename(), - bind( &Downloader::patches_Callback, this, _1, _2)); - } - - return true; -} - -/** \todo: Downloading/sigcheck of master index shoudl be common in base class */ -void Downloader::download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progressrcv ) -{ - Pathname masterIndex( repoInfo().path() / "/repodata/repomd.xml" ); - defaultDownloadMasterIndex( media, dest_dir, masterIndex ); - - _media_ptr = (&media); - _dest_dir = dest_dir; - RepomdFileReader( dest_dir / masterIndex, bind( &Downloader::repomd_Callback, this, _1, _2)); - - // ready, go! - start( dest_dir, media ); -} - -}// ns yum -}// ns source -} // ns zypp - - - diff --git a/libzypp/zypp/repo/yum/Downloader.h b/libzypp/zypp/repo/yum/Downloader.h deleted file mode 100644 index f34b42b..0000000 --- a/libzypp/zypp/repo/yum/Downloader.h +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef ZYPP_SOURCE_YUM_DOWNLOADER -#define ZYPP_SOURCE_YUM_DOWNLOADER - -#include "zypp/Url.h" -#include "zypp/Pathname.h" -#include "zypp/Fetcher.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/MediaSetAccess.h" -#include "zypp/ProgressData.h" -#include "zypp/RepoInfo.h" -#include "zypp/RepoStatus.h" -#include "zypp/repo/Downloader.h" -#include "zypp/repo/yum/ResourceType.h" - -namespace zypp -{ - namespace repo - { - namespace yum - { - /** - * \short Downloader for YUM (rpm-nmd) repositories - * Encapsulates all the knowledge of which files have - * to be downloaded to the local disk. - * - * \code - * MediaSetAccess media(url); - * Downloader yum(path); - * yum.download( media, "localdir"); - * \endcode - */ - class Downloader : public repo::Downloader - { - public: - - /** - * \short Constructor from the repository information - * - * The repository information allows more context to be given - * to the user when something fails. - * - * \param info Repository information - */ - Downloader( const RepoInfo &info , const Pathname &delta_dir = Pathname()); - - /** - * \short Download metadata to a local directory - * - * \param media Media access to the repository url - * \param dest_dir Local destination directory - * \param progress progress receiver - */ - void download( MediaSetAccess &media, - const Pathname &dest_dir, - const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); - - /** - * \short Status of the remote repository - */ - RepoStatus status( MediaSetAccess &media ); - - protected: - bool repomd_Callback( const OnMediaLocation &loc, const ResourceType &dtype ); - bool patches_Callback( const OnMediaLocation &loc, const std::string &id ); - private: - Pathname _dest_dir; - Pathname _delta_dir; - std::list _patches_files; - - MediaSetAccess *_media_ptr; - }; - - } // ns yum - } // ns source -} // ns zypp - -#endif diff --git a/libzypp/zypp/repo/yum/ResourceType.cc b/libzypp/zypp/repo/yum/ResourceType.cc deleted file mode 100644 index 650ba9f..0000000 --- a/libzypp/zypp/repo/yum/ResourceType.cc +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#include -#include -#include "zypp/base/Exception.h" -#include "ResourceType.h" - -namespace zypp -{ - namespace repo - { - namespace yum - { - - - static std::map _table; - - const ResourceType ResourceType::NONE(ResourceType::NONE_e); - const ResourceType ResourceType::REPOMD(ResourceType::REPOMD_e); - const ResourceType ResourceType::PRIMARY(ResourceType::PRIMARY_e); - const ResourceType ResourceType::OTHER(ResourceType::OTHER_e); - const ResourceType ResourceType::FILELISTS(ResourceType::FILELISTS_e); - const ResourceType ResourceType::GROUP(ResourceType::GROUP_e); - const ResourceType ResourceType::PATCHES(ResourceType::PATCHES_e); - const ResourceType ResourceType::PATCH(ResourceType::PATCH_e); - const ResourceType ResourceType::PRODUCT(ResourceType::PRODUCT_e); - const ResourceType ResourceType::PATTERNS(ResourceType::PATTERNS_e); - const ResourceType ResourceType::PRIMARY_DB(ResourceType::PRIMARY_DB_e); - const ResourceType ResourceType::OTHER_DB(ResourceType::OTHER_DB_e); - - ResourceType::ResourceType(const std::string & strval_r) - : _type(parse(strval_r)) - {} - - ResourceType::Type ResourceType::parse(const std::string & strval_r) - { - if (_table.empty()) - { - // initialize it - _table["repomd"] = ResourceType::REPOMD_e; - _table["primary"] = ResourceType::PRIMARY_e; - _table["other"] = ResourceType::OTHER_e; - _table["filelists"] = ResourceType::FILELISTS_e; - _table["group"] = ResourceType::GROUP_e; - _table["patches"] = ResourceType::PATCHES_e; - _table["patch"] = ResourceType::PATCH_e; - _table["product"] = ResourceType::PRODUCT_e; - _table["patterns"] = ResourceType::PATTERNS_e; - _table["primary_db"] = ResourceType::PRIMARY_DB_e; - _table["other_db"] = ResourceType::OTHER_DB_e; - _table["NONE"] = _table["none"] = ResourceType::NONE_e; - } - - std::map::const_iterator it - = _table.find(strval_r); - if (it == _table.end()) - { - return ResourceType::NONE_e; - } - return it->second; - } - - - const std::string & ResourceType::asString() const - { - static std::map _table; - if ( _table.empty() ) - { - // initialize it - _table[REPOMD_e] = "repomd"; - _table[PRIMARY_e] = "primary"; - _table[OTHER_e] = "other"; - _table[FILELISTS_e] = "filelists"; - _table[GROUP_e] = "group"; - _table[PATCHES_e] = "patches"; - _table[PATCH_e] = "patch"; - _table[PRODUCT_e] = "product"; - _table[PATTERNS_e] = "patterns"; - _table[OTHER_DB_e] = "other_db"; - _table[PRIMARY_DB_e] = "primary_db"; - _table[NONE_e] = "NONE"; - } - return _table[_type]; - } - - - } // ns yum - } // ns source -} // ns zypp - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/repo/yum/ResourceType.h b/libzypp/zypp/repo/yum/ResourceType.h deleted file mode 100644 index 2d5cf9e..0000000 --- a/libzypp/zypp/repo/yum/ResourceType.h +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -#ifndef YUMRESOURCETYPE_H_ -#define YUMRESOURCETYPE_H_ - -#include -#include - -namespace zypp -{ - namespace repo - { - namespace yum - { - - - /** - * - */ - struct ResourceType - { - static const ResourceType NONE; // unknown - static const ResourceType REPOMD; - static const ResourceType PRIMARY; - static const ResourceType OTHER; - static const ResourceType FILELISTS; - static const ResourceType GROUP; - static const ResourceType PATCHES; // suse extension - static const ResourceType PATCH; // suse extension - static const ResourceType PRODUCT; // suse extension - static const ResourceType PATTERNS; // suse extension - // sqlite caches yum extensions: - static const ResourceType PRIMARY_DB; // yum extension - static const ResourceType OTHER_DB; // yum extension - - enum Type - { - NONE_e, - REPOMD_e, - PRIMARY_e, - OTHER_e, - FILELISTS_e, - GROUP_e, - PATCHES_e, - PATCH_e, - PRODUCT_e, - PATTERNS_e, - PRIMARY_DB_e, - OTHER_DB_e, - }; - - ResourceType(Type type) : _type(type) {} - - explicit ResourceType(const std::string & strval_r); - - Type toEnum() const { return _type; } - - ResourceType::Type parse(const std::string & strval_r); - - const std::string & asString() const; - - Type _type; - }; - - - inline std::ostream & operator<<( std::ostream & str, const ResourceType & obj ) - { return str << obj.asString(); } - - inline bool operator==(const ResourceType & obj1, const ResourceType & obj2) - { return obj1._type == obj2._type; } - - - } // ns yum - } // ns source -} // ns zypp - -#endif /*YUMRESOURCETYPE_H_*/ - -// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/libzypp/zypp/sat/AttrMatcher.h b/libzypp/zypp/sat/AttrMatcher.h deleted file mode 100644 index 7e04922..0000000 --- a/libzypp/zypp/sat/AttrMatcher.h +++ /dev/null @@ -1,30 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/AttrMatcher.h - * -*/ -#ifndef ZYPP_SAT_ATTRMATCHER_H -#define ZYPP_SAT_ATTRMATCHER_H -#warning sat::AttrMatcher was renamed to StrMatcher. Deprecated include of zypp/sat/AttrMatcher.h use zypp/base/StrMatcher.h - -#include "zypp/base/StrMatcher.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace sat - { - typedef StrMatcher AttrMatcher; - - } // namespace sat - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_ATTRMATCHER_H diff --git a/libzypp/zypp/sat/FileConflicts.cc b/libzypp/zypp/sat/FileConflicts.cc deleted file mode 100644 index 2bffaad..0000000 --- a/libzypp/zypp/sat/FileConflicts.cc +++ /dev/null @@ -1,169 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/FileConflicts.cc - */ -#include -#include - -#include "zypp/sat/FileConflicts.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Xml.h" -#include "zypp/CheckSum.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace sat - { - std::string FileConflicts::Conflict::asUserString() const - { - if ( lhsFilename() == rhsFilename() ) - { - static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed - // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2) - N_( "File %1%\n" - " from package\n" - " %2%\n" - " conflicts with file from package\n" - " %3%" ), - // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2) - N_( "File %1%\n" - " from package\n" - " %2%\n" - " conflicts with file from install of\n" - " %3%" ) - },{ - // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2) - N_( "File %1%\n" - " from install of\n" - " %2%\n" - " conflicts with file from package\n" - " %3%" ), - // TranslatorExplanation %1%(filename) %2%(package1) %3%(package2) - N_( "File %1%\n" - " from install of\n" - " %2%\n" - " conflicts with file from install of\n" - " %3%" ) - }}; - return( boost::formatNAC( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] ) - % lhsFilename() - % lhsSolvable().asUserString() - % rhsSolvable().asUserString() - ).str(); - } - else - { - static const char * text[2][2] = {{ // [lhs][rhs] 0 = installed; 1 = to be installed - // TranslatorExplanation %1%(filename1) %2%(package1) %%3%(filename2) 4%(package2) - N_( "File %1%\n" - " from package\n" - " %2%\n" - " conflicts with file\n" - " %3%\n" - " from package\n" - " %4%" ), - // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2) - N_( "File %1%\n" - " from package\n" - " %2%\n" - " conflicts with file\n" - " %3%\n" - " from install of\n" - " %4%" ) - },{ - // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2) - N_( "File %1%\n" - " from install of\n" - " %2%\n" - " conflicts with file\n" - " %3%\n" - " from package\n" - " %4%" ), - // TranslatorExplanation %1%(filename1) %2%(package1) %3%(filename2) %4%(package2) - N_( "File %1%\n" - " from install of\n" - " %2%\n" - " conflicts with file\n" - " %3%\n" - " from install of\n" - " %4%" ) - }}; - return( boost::formatNAC( text[lhsSolvable().isSystem()?0:1][rhsSolvable().isSystem()?0:1] ) - % lhsFilename() - % lhsSolvable().asUserString() - % rhsFilename() - % rhsSolvable().asUserString() - ).str(); - } - } - - std::ostream & operator<<( std::ostream & str, const FileConflicts & obj ) - { return dumpRange( str << "(" << obj.size() << ") ", obj.begin(), obj.end() ); } - - std::ostream & operator<<( std::ostream & str, const FileConflicts::Conflict & obj ) - { - if ( obj.lhsFilename() == obj.rhsFilename() ) - return str << boost::format( "%s:\n %s[%s]\n %s[%s]" ) - % obj.lhsFilename() - % obj.lhsSolvable() - % obj.lhsFilemd5() - % obj.rhsSolvable() - % obj.rhsFilemd5(); - - return str << boost::format( "%s - %s:\n %s[%s]\n %s[%s]" ) - % obj.lhsFilename() - % obj.rhsFilename() - % obj.lhsSolvable() - % obj.lhsFilemd5() - % obj.rhsSolvable() - % obj.rhsFilemd5(); - } - - - std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts & obj ) - { - xmlout::Node guard( str, "fileconflicts", { "size", obj.size() } ); - if ( ! obj.empty() ) - { - *guard << "\n"; - for ( const auto & el : obj ) - dumpAsXmlOn( *guard, el ) << "\n"; - } - return str; - } - - namespace - { - std::ostream & dumpAsXmlHelper( std::ostream & str, const std::string & tag_r, IdString filename_r, IdString md5sum_r, Solvable solv_r ) - { - xmlout::Node guard( str, tag_r ); - *xmlout::Node( *guard, "file" ) << filename_r; - dumpAsXmlOn( *guard, CheckSum( md5sum_r.asString() ) ); - dumpAsXmlOn( *guard, solv_r ); - return str; - } - } - - std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts::Conflict & obj ) - { - xmlout::Node guard( str, "fileconflict" ); - dumpAsXmlHelper( *guard<<"\n", "lhs", obj.lhsFilename(), obj.lhsFilemd5(), obj.lhsSolvable() ); - dumpAsXmlHelper( *guard<<"\n", "rhs", obj.rhsFilename(), obj.rhsFilemd5(), obj.rhsSolvable() ); - return str; - } - - } // namespace sat - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/FileConflicts.h b/libzypp/zypp/sat/FileConflicts.h deleted file mode 100644 index 783d6c8..0000000 --- a/libzypp/zypp/sat/FileConflicts.h +++ /dev/null @@ -1,96 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/FileConflicts.h - */ -#ifndef ZYPP_SAT_FILECONFLICTS_H -#define ZYPP_SAT_FILECONFLICTS_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/sat/Queue.h" -#include "zypp/sat/Solvable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace sat - { - /////////////////////////////////////////////////////////////////// - /// \class FileConflicts - /// \brief Libsolv queue representing file conflicts. - /////////////////////////////////////////////////////////////////// - class FileConflicts : private Queue - { - friend bool operator==( const FileConflicts & lhs, const FileConflicts & rhs ); - static constexpr size_type queueBlockSize = 6; - - public: - /** - * \class Conflict - * \brief A file conflict. - */ - struct Conflict - { - IdString lhsFilename() const { return IdString( _data[0] ); } - Solvable lhsSolvable() const { return Solvable( _data[1] ); } - IdString lhsFilemd5() const { return IdString( _data[2] ); } - - IdString rhsFilename() const { return IdString( _data[3] ); } - Solvable rhsSolvable() const { return Solvable( _data[4] ); } - IdString rhsFilemd5() const { return IdString( _data[5] ); } - - /** Ready to use (translated) string describing the Conflict */ - std::string asUserString() const; - - private: - detail::IdType _data[queueBlockSize]; - }; - - public: - using Queue::size_type; - typedef Conflict value_type; - typedef const value_type* const_iterator; - - using Queue::empty; - size_type size() const { return Queue::size()/queueBlockSize; } - const_iterator begin() const { return reinterpret_cast(Queue::begin()); } - const_iterator end() const { return reinterpret_cast(Queue::end()); } - - public: - using Queue::operator struct ::_Queue *; ///< libsolv backdoor - using Queue::operator const struct ::_Queue *; ///< libsolv backdoor - }; - - /** \relates FileConflicts Stream output */ - std::ostream & operator<<( std::ostream & str, const FileConflicts & obj ); - - /** \relates FileConflicts::Conflict Stream output */ - std::ostream & operator<<( std::ostream & str, const FileConflicts::Conflict & obj ); - - /** \relates FileConflicts XML output */ - std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts & obj ); - - /** \relates FileConflicts::Conflict XML output */ - std::ostream & dumpAsXmlOn( std::ostream & str, const FileConflicts::Conflict & obj ); - - /** \relates FileConflicts */ - inline bool operator==( const FileConflicts & lhs, const FileConflicts & rhs ) - { return static_cast(lhs) == static_cast(rhs); } - - /** \relates FileConflicts */ - inline bool operator!=( const FileConflicts & lhs, const FileConflicts & rhs ) - { return !( lhs == rhs ); } - - } // namespace sat - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_FILECONFLICTS_H diff --git a/libzypp/zypp/sat/LocaleSupport.cc b/libzypp/zypp/sat/LocaleSupport.cc deleted file mode 100644 index c5cab3b..0000000 --- a/libzypp/zypp/sat/LocaleSupport.cc +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/LocaleSupport.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/sat/LocaleSupport.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const LocaleSupport & obj ) - { - return str << obj.locale() << '(' << (obj.isAvailable()?'a':'_') << (obj.isRequested()?'R':'_') << ')'; - } - - /****************************************************************** - ** - ** FUNCTION NAME : dumpOn - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & dumpOn( std::ostream & str, const LocaleSupport & obj ) - { - return dumpRange( str << obj, obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/LocaleSupport.h b/libzypp/zypp/sat/LocaleSupport.h deleted file mode 100644 index af85f4d..0000000 --- a/libzypp/zypp/sat/LocaleSupport.h +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/LocaleSupport.h - * -*/ -#ifndef ZYPP_SAT_LOCALESUPPORT_H -#define ZYPP_SAT_LOCALESUPPORT_H - -#include - -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/SolvIterMixin.h" -#include "zypp/Locale.h" -#include "zypp/Filter.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LocaleSupport - // - /** Convenience methods to manage support for a specific \ref Locale. - * - * \code - * sat::LocaleSupport myLocale( Locale("de") ); - * - * if ( myLocale.isAvailable() ) - * { - * MIL << "Support for locale '" << myLocale.locale() << "' is available." << endl; - * } - * if ( ! myLocale.isRequested() ) - * { - * MIL << "Will enable support for locale '" << myLocale.locale() << "'." << endl; - * myLocale.setRequested( true ); - * } - * MIL << "Packages supporting locale '" << myLocale.locale() << "':" << endl; - * for_( it, myLocale.begin(), myLocale.end() ) - * { - * // iterate over sat::Solvables - * MIL << " " << *it << endl; - * // or get the PoolItems - * DBG << " " << PoolItem(*it) << endl; - * } - * \endcode - * - * \todo If iterator is too slow install a proxy watching the Pool::serial. - */ - class LocaleSupport : public SolvIterMixin > - , protected detail::PoolMember - { - public: - /** Default ctor */ - LocaleSupport() - {} - /** Ctor taking a \ref Locale. */ - LocaleSupport( const Locale & locale_r ) - : _locale( locale_r ) - {} - - public: - /** My \ref Locale */ - const Locale & locale() const - { return _locale; } - - /** Whether there are language specific packages supporting my \ref Locale. */ - bool isAvailable() const - { return Pool(*this).isAvailableLocale( _locale ); } - - /** Whether the solver will automatically select language specific packages for my \ref Locale. */ - bool isRequested() const - { return Pool(*this).isRequestedLocale( _locale ); } - - /** Turn on/off solver support for my \ref Locale.*/ - void setRequested( bool yesno_r ) - { yesno_r ? Pool(*this).addRequestedLocale( _locale ) : Pool(*this).eraseRequestedLocale( _locale ); } - - public: - /** \name Iterate through all \ref sat::Solvables supporting my \ref Locale. */ - //@{ - typedef Solvable_iterator iterator; // from SolvIterMixin - - iterator begin() const - { return Pool(*this).filterBegin( filter::ByLocaleSupport( _locale ) ); } - - iterator end() const - { return Pool(*this).filterEnd( filter::ByLocaleSupport( _locale ) ); } - //@} - - private: - Locale _locale; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates LocaleSupport Stream output */ - std::ostream & operator<<( std::ostream & str, const LocaleSupport & obj ); - - /** \relates LocaleSupport More verbose stream output including dependencies */ - std::ostream & dumpOn( std::ostream & str, const LocaleSupport & obj ); - - /** \relates LocaleSupport */ - inline bool operator==( const LocaleSupport & lhs, const LocaleSupport & rhs ) - { return lhs.locale() == rhs.locale(); } - - /** \relates LocaleSupport */ - inline bool operator!=( const LocaleSupport & lhs, const LocaleSupport & rhs ) - { return lhs.locale() != rhs.locale(); } - - /** \relates LocaleSupport */ - inline bool operator<( const LocaleSupport & lhs, const LocaleSupport & rhs ) - { return lhs.locale() < rhs.locale(); } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_LOCALESUPPORT_H diff --git a/libzypp/zypp/sat/LookupAttr.cc b/libzypp/zypp/sat/LookupAttr.cc deleted file mode 100644 index 627b3e4..0000000 --- a/libzypp/zypp/sat/LookupAttr.cc +++ /dev/null @@ -1,818 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/LookupAttr.cc - * -*/ -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" - -#include "zypp/sat/detail/PoolImpl.h" - -#include "zypp/sat/Pool.h" -#include "zypp/sat/LookupAttr.h" -#include "zypp/base/StrMatcher.h" - -#include "zypp/CheckSum.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - using detail::noSolvableId; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr::Impl - // - /////////////////////////////////////////////////////////////////// - /** - * LookupAttr implememtation. - * - * Repository and Solvable must not be set at the same time! - * - * \note When looking in pool or repo, \ref Solvable \c _solv is - * somewhat abused to store eiter \c Id \c 0 or \c SOLVID_META, which - * indicates whether the dataiterator should look into solvable or - * repository metadata. Remember that all \ref Solvables with an - * \e invalid \c Id, are treated as == Solvable::noSolvable, - * and in a boolean context evaluate to \c false. Thus \c noSolvable - * may have different \c Ids. - */ - class LookupAttr::Impl - { - public: - Impl() - : _parent( SolvAttr::noAttr ) - {} - Impl( SolvAttr attr_r, Location loc_r ) - : _attr( attr_r ), _parent( attr_r.parent() ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId ) - {} - Impl( SolvAttr attr_r, Repository repo_r, Location loc_r ) - : _attr( attr_r ), _parent( attr_r.parent() ), _repo( repo_r ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId ) - {} - Impl( SolvAttr attr_r, Solvable solv_r ) - : _attr( attr_r ), _parent( attr_r.parent() ), _solv( solv_r ) - {} - - public: - SolvAttr attr() const - { return _attr; } - - void setAttr( SolvAttr attr_r ) - { - _attr = attr_r; - SolvAttr p( _attr.parent() ); - if ( p != SolvAttr::noAttr ) - _parent = p; - } - - const StrMatcher & strMatcher() const - { return _strMatcher; } - - void setStrMatcher( const StrMatcher & matcher_r ) - { - matcher_r.compile(); - _strMatcher = matcher_r; - } - - public: - bool pool() const - { return ! (_repo || _solv); } - - void setPool( Location loc_r ) - { - _repo = Repository::noRepository; - _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId ); - } - - Repository repo() const - { return _repo; } - - void setRepo( Repository repo_r, Location loc_r ) - { - _repo = repo_r; - _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId ); - } - - Solvable solvable() const - { return _solv; } - - void setSolvable( Solvable solv_r ) - { - _repo = Repository::noRepository; - _solv = solv_r; - } - - SolvAttr parent() const - { return _parent; } - - void setParent( SolvAttr attr_r ) - { _parent = attr_r; } - - public: - LookupAttr::iterator begin() const - { - if ( _attr == SolvAttr::noAttr || sat::Pool::instance().reposEmpty() ) - return end(); - - detail::RepoIdType whichRepo = detail::noRepoId; // all repos - if ( _solv ) - whichRepo = _solv.repository().id(); - else if ( _repo ) - whichRepo = _repo.id(); - - detail::DIWrap dip( whichRepo, _solv.id(), _attr.id(), _strMatcher.searchstring(), _strMatcher.flags().get() ); - if ( _parent != SolvAttr::noAttr ) - ::dataiterator_prepend_keyname( dip.get(), _parent.id() ); - - return iterator( dip ); // iterator takes over ownership! - } - - LookupAttr::iterator end() const - { return iterator(); } - - private: - SolvAttr _attr; - SolvAttr _parent; - Repository _repo; - Solvable _solv; - StrMatcher _strMatcher; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr - // - /////////////////////////////////////////////////////////////////// - - LookupAttr::LookupAttr() - : _pimpl( new Impl ) - {} - - LookupAttr::LookupAttr( SolvAttr attr_r, Location loc_r ) - : _pimpl( new Impl( attr_r, loc_r ) ) - {} - LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Location loc_r ) - : _pimpl( new Impl( attr_r, loc_r ) ) - { _pimpl->setParent( parent_r ); } - - LookupAttr::LookupAttr( SolvAttr attr_r, Repository repo_r, Location loc_r ) - : _pimpl( new Impl( attr_r, repo_r, loc_r ) ) - {} - LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Repository repo_r, Location loc_r ) - : _pimpl( new Impl( attr_r, repo_r, loc_r ) ) - { _pimpl->setParent( parent_r ); } - - LookupAttr::LookupAttr( SolvAttr attr_r, Solvable solv_r ) - : _pimpl( new Impl( attr_r, solv_r ) ) - {} - LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Solvable solv_r ) - : _pimpl( new Impl( attr_r, solv_r ) ) - { _pimpl->setParent( parent_r ); } - - - /////////////////////////////////////////////////////////////////// - - SolvAttr LookupAttr::attr() const - { return _pimpl->attr(); } - - void LookupAttr::setAttr( SolvAttr attr_r ) - { _pimpl->setAttr( attr_r ); } - - const StrMatcher & LookupAttr::strMatcher() const - { return _pimpl->strMatcher(); } - - void LookupAttr::setStrMatcher( const StrMatcher & matcher_r ) - { _pimpl->setStrMatcher( matcher_r ); } - - /////////////////////////////////////////////////////////////////// - - bool LookupAttr::pool() const - { return _pimpl->pool(); } - - void LookupAttr::setPool( Location loc_r ) - { _pimpl->setPool( loc_r ); } - - Repository LookupAttr::repo() const - { return _pimpl->repo(); } - - void LookupAttr::setRepo( Repository repo_r, Location loc_r ) - { _pimpl->setRepo( repo_r, loc_r ); } - - Solvable LookupAttr::solvable() const - { return _pimpl->solvable(); } - - void LookupAttr::setSolvable( Solvable solv_r ) - { _pimpl->setSolvable( solv_r ); } - - SolvAttr LookupAttr::parent() const - { return _pimpl->parent(); } - - void LookupAttr::setParent( SolvAttr attr_r ) - { _pimpl->setParent( attr_r ); } - - /////////////////////////////////////////////////////////////////// - - LookupAttr::iterator LookupAttr::begin() const - { return _pimpl->begin(); } - - LookupAttr::iterator LookupAttr::end() const - { return _pimpl->end(); } - - bool LookupAttr::empty() const - { return begin() == end(); } - - LookupAttr::size_type LookupAttr::size() const - { - size_type c = 0; - for_( it, begin(), end() ) - ++c; - return c; - } - - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const LookupAttr & obj ) - { - if ( obj.attr() == SolvAttr::noAttr ) - return str << "search nothing"; - - if ( obj.attr() ) - str << "seach " << obj.attr() << " in "; - else - str << "seach ALL in "; - - if ( obj.solvable() ) - return str << obj.solvable(); - if ( obj.repo() ) - return str << obj.repo(); - return str << "pool"; - } - - std::ostream & dumpOn( std::ostream & str, const LookupAttr & obj ) - { - return dumpRange( str << obj, obj.begin(), obj.end() ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupRepoAttr - // - /////////////////////////////////////////////////////////////////// - - LookupRepoAttr::LookupRepoAttr( SolvAttr attr_r, Repository repo_r ) - : LookupAttr( attr_r, repo_r, REPO_ATTR ) - {} - - void LookupRepoAttr::setRepo( Repository repo_r ) - { LookupAttr::setRepo( repo_r, REPO_ATTR ); } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : detail::DIWrap - // - /////////////////////////////////////////////////////////////////// - - namespace detail - { - DIWrap::DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r, - const std::string & mstring_r, int flags_r ) - : _dip( new ::Dataiterator ) - , _mstring( mstring_r ) - { - ::dataiterator_init( _dip, sat::Pool::instance().get(), repoId_r, solvId_r, attrId_r, - _mstring.empty() ? 0 : _mstring.c_str(), flags_r ); - } - - DIWrap::DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r, - const char * mstring_r, int flags_r ) - : _dip( new ::Dataiterator ) - , _mstring( mstring_r ? mstring_r : "" ) - { - ::dataiterator_init( _dip, sat::Pool::instance().get(), repoId_r, solvId_r, attrId_r, - _mstring.empty() ? 0 : _mstring.c_str(), flags_r ); - } - - DIWrap::DIWrap( const DIWrap & rhs ) - : _dip( 0 ) - , _mstring( rhs._mstring ) - { - if ( rhs._dip ) - { - _dip = new ::Dataiterator; - ::dataiterator_init_clone( _dip, rhs._dip ); - ::dataiterator_strdup( _dip ); - } - } - - DIWrap::~DIWrap() - { - if ( _dip ) - { - ::dataiterator_free( _dip ); - delete _dip; - } - } - - std::ostream & operator<<( std::ostream & str, const DIWrap & obj ) - { return str << obj.get(); } - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr::iterator - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // position and moving - /////////////////////////////////////////////////////////////////// - - Repository LookupAttr::iterator::inRepo() const - { return _dip ? Repository( _dip->repo ) : Repository::noRepository; } - - Solvable LookupAttr::iterator::inSolvable() const - { return _dip ? Solvable( _dip->solvid ) : Solvable::noSolvable; } - - SolvAttr LookupAttr::iterator::inSolvAttr() const - { return _dip ? SolvAttr( _dip->key->name ) : SolvAttr::noAttr; } - - void LookupAttr::iterator::nextSkipSolvAttr() - { if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); } - - void LookupAttr::iterator::nextSkipSolvable() - { if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); } - - void LookupAttr::iterator::nextSkipRepo() - { if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); } - - void LookupAttr::iterator::stayInThisSolvable() - { if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } } - - void LookupAttr::iterator::stayInThisRepo() - { if ( _dip ) { _dip.get()->repoid = -1; } } - - /////////////////////////////////////////////////////////////////// - // attr value type test - /////////////////////////////////////////////////////////////////// - - detail::IdType LookupAttr::iterator::solvAttrType() const - { return _dip ? _dip->key->type : detail::noId; } - - bool LookupAttr::iterator::solvAttrNumeric() const - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_U32: - case REPOKEY_TYPE_NUM: - case REPOKEY_TYPE_CONSTANT: - return true; - break; - } - return false; - } - - bool LookupAttr::iterator::solvAttrString() const - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_ID: - case REPOKEY_TYPE_IDARRAY: - case REPOKEY_TYPE_CONSTANTID: - case REPOKEY_TYPE_STR: - case REPOKEY_TYPE_DIRSTRARRAY: - return true; - break; - } - return false; - } - - bool LookupAttr::iterator::solvAttrIdString() const - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_ID: - case REPOKEY_TYPE_IDARRAY: - case REPOKEY_TYPE_CONSTANTID: - return true; - break; - } - return false; - } - - bool LookupAttr::iterator::solvAttrCheckSum() const - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_MD5: - case REPOKEY_TYPE_SHA1: - case REPOKEY_TYPE_SHA256: - return true; - break; - } - return false; - } - - /////////////////////////////////////////////////////////////////// - namespace - { - enum SubType { ST_NONE, // no sub-structure - ST_FLEX, // flexarray - ST_SUB }; // inside sub-structure - SubType subType( const detail::DIWrap & dip ) - { - if ( ! dip ) - return ST_NONE; - if ( dip.get()->key->type == REPOKEY_TYPE_FLEXARRAY ) - return ST_FLEX; - return dip.get()->kv.parent ? ST_SUB : ST_NONE; - } - } - /////////////////////////////////////////////////////////////////// - - bool LookupAttr::iterator::solvAttrSubEntry() const - { return subType( _dip ) != ST_NONE; } - - /////////////////////////////////////////////////////////////////// - // Iterate sub-structures. - /////////////////////////////////////////////////////////////////// - - bool LookupAttr::iterator::subEmpty() const - { return( subBegin() == subEnd() ); } - - LookupAttr::size_type LookupAttr::iterator::subSize() const - { - size_type c = 0; - for_( it, subBegin(), subEnd() ) - ++c; - return c; - } - - LookupAttr::iterator LookupAttr::iterator::subBegin() const - { - SubType subtype( subType( _dip ) ); - if ( subtype == ST_NONE ) - return subEnd(); - // setup the new sub iterator with the remembered position - detail::DIWrap dip( 0, 0, 0 ); - ::dataiterator_clonepos( dip.get(), _dip.get() ); - switch ( subtype ) - { - case ST_NONE: // not reached - break; - case ST_FLEX: - ::dataiterator_seek( dip.get(), DI_SEEK_CHILD|DI_SEEK_STAY ); - break; - case ST_SUB: - ::dataiterator_seek( dip.get(), DI_SEEK_REWIND|DI_SEEK_STAY ); - break; - } - return iterator( dip ); // iterator takes over ownership! - } - - LookupAttr::iterator LookupAttr::iterator::subEnd() const - { - return iterator(); - } - - LookupAttr::iterator LookupAttr::iterator::subFind( SolvAttr attr_r ) const - { - iterator it = subBegin(); - if ( attr_r != sat::SolvAttr::allAttr ) - { - while ( it != subEnd() && it.inSolvAttr() != attr_r ) - ++it; - } - return it; - } - - LookupAttr::iterator LookupAttr::iterator::subFind( const C_Str & attrname_r ) const - { - if ( attrname_r.empty() ) - return subBegin(); - - SubType subtype( subType( _dip ) ); - if ( subtype == ST_NONE ) - return subBegin(); - - std::string subattr( inSolvAttr().asString() ); - if ( subtype == ST_FLEX ) - { - // append ":attrname" - subattr += ":"; - subattr += attrname_r; - } - else - { - // replace "oldname" after ':' with "attrname" - std::string::size_type pos( subattr.rfind( ':' ) ); - if ( pos != std::string::npos ) - { - subattr.erase( pos+1 ); - subattr += attrname_r; - } - else - subattr = attrname_r; // no ':' so replace all. - } - return subFind( SolvAttr( subattr ) ); - } - - /////////////////////////////////////////////////////////////////// - // attr value retrieval - /////////////////////////////////////////////////////////////////// - - int LookupAttr::iterator::asInt() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_U32: - case REPOKEY_TYPE_NUM: - case REPOKEY_TYPE_CONSTANT: - return _dip->kv.num; - break; - } - } - return 0; - } - - unsigned LookupAttr::iterator::asUnsigned() const - { return asInt(); } - - unsigned long long LookupAttr::iterator::asUnsignedLL() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_U32: - case REPOKEY_TYPE_NUM: - case REPOKEY_TYPE_CONSTANT: - return SOLV_KV_NUM64(&_dip->kv); - break; - } - } - return 0; - } - - bool LookupAttr::iterator::asBool() const - { return asInt(); } - - - const char * LookupAttr::iterator::c_str() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_ID: - case REPOKEY_TYPE_IDARRAY: - case REPOKEY_TYPE_CONSTANTID: - if ( _dip->data && _dip->data->localpool ) - return ::stringpool_id2str( &_dip->data->spool, _dip->kv.id ); // in local pool - else - return IdString( _dip->kv.id ).c_str(); // in global pool - break; - - case REPOKEY_TYPE_STR: - return _dip->kv.str; - break; - - case REPOKEY_TYPE_DIRSTRARRAY: - // may or may not be stringified depending on SEARCH_FILES flag - return( _dip->flags & SEARCH_FILES - ? _dip->kv.str - : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) ); - break; - } - } - return 0; - } - - std::string LookupAttr::iterator::asString() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_ID: - case REPOKEY_TYPE_IDARRAY: - case REPOKEY_TYPE_CONSTANTID: - { - detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ); - return ISRELDEP(id) ? Capability( id ).asString() - : IdString( id ).asString(); - } - break; - - case REPOKEY_TYPE_STR: - case REPOKEY_TYPE_DIRSTRARRAY: - { - const char * ret( c_str() ); - return ret ? ret : ""; - } - break; - - case REPOKEY_TYPE_U32: - case REPOKEY_TYPE_NUM: - case REPOKEY_TYPE_CONSTANT: - return str::numstring( asInt() ); - break; - - case REPOKEY_TYPE_MD5: - case REPOKEY_TYPE_SHA1: - case REPOKEY_TYPE_SHA256: - { - return asCheckSum().asString(); - } - break; - - case REPOKEY_TYPE_FLEXARRAY: - { - std::ostringstream str; - str << "{" << endl; - for_( it, subBegin(), subEnd() ) - { - str << " " << it.inSolvAttr() << " = " << it.asString() << endl; - } - str << "}"; - return str.str(); - } - break; - } - } - return std::string(); - } - - IdString LookupAttr::iterator::idStr() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_ID: - case REPOKEY_TYPE_IDARRAY: - case REPOKEY_TYPE_CONSTANTID: - return IdString( ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) ); - break; - } - } - return IdString(); - } - - CheckSum LookupAttr::iterator::asCheckSum() const - { - if ( _dip ) - { - switch ( solvAttrType() ) - { - case REPOKEY_TYPE_MD5: - return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) ); - break; - - case REPOKEY_TYPE_SHA1: - return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) ); - break; - - case REPOKEY_TYPE_SHA256: - return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) ); - break; - } - } - return CheckSum(); - } - - /////////////////////////////////////////////////////////////////// - // internal stuff below - /////////////////////////////////////////////////////////////////// - - LookupAttr::iterator::iterator() - : iterator_adaptor_( 0 ) - {} - - LookupAttr::iterator::iterator( const iterator & rhs ) - : iterator_adaptor_( 0 ) - , _dip( rhs._dip ) - { - base_reference() = _dip.get(); - } - - LookupAttr::iterator::iterator( detail::DIWrap & dip_r ) - : iterator_adaptor_( 0 ) - { - _dip.swap( dip_r ); // take ownership! - base_reference() = _dip.get(); - increment(); - } - - LookupAttr::iterator::~iterator() - {} - - LookupAttr::iterator & LookupAttr::iterator::operator=( const iterator & rhs ) - { - if ( &rhs != this ) - { - _dip = rhs._dip; - base_reference() = _dip.get(); - } - return *this; - } - - /////////////////////////////////////////////////////////////////// - - bool LookupAttr::iterator::dip_equal( const ::_Dataiterator & lhs, const ::_Dataiterator & rhs ) const - { - // Iterator equal is same position in same container. - // Here: same attribute in same solvable. - return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name ); - } - - detail::IdType LookupAttr::iterator::dereference() const - { - return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) - : detail::noId; - } - - void LookupAttr::iterator::increment() - { - if ( _dip ) - { - if ( ! ::dataiterator_step( _dip.get() ) ) - { - _dip.reset(); - base_reference() = 0; - } - else - { - ::dataiterator_strdup( _dip.get() ); - } - } - } - - std::ostream & operator<<( std::ostream & str, const LookupAttr::iterator & obj ) - { - const ::_Dataiterator * dip = obj.get(); - if ( ! dip ) - return str << "EndOfQuery"; - - if ( obj.inSolvable() ) - str << obj.inSolvable(); - else if ( obj.inRepo() ) - str << obj.inRepo(); - - str << '<' << obj.inSolvAttr() << (obj.solvAttrSubEntry() ? ">(*" : ">(") - << IdString(obj.solvAttrType()) << ") = " << obj.asString(); - return str; - } - - template<> CheckSum LookupAttr::iterator::asType() const - { return asCheckSum(); } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -std::ostream & operator<<( std::ostream & str, const ::_Dataiterator * obj ) -{ - str << "::_Dataiterator("; - if ( ! obj ) - { - str << "NULL"; - } - else - { - str << "|" << zypp::Repository(obj->repo); - str << "|" << zypp::sat::Solvable(obj->solvid); - str << "|" << zypp::IdString(obj->key->name); - str << "|" << zypp::IdString(obj->key->type); - str << "|" << obj->repodataid; - str << "|" << obj->repoid; - } - return str << ")"; -} - -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/LookupAttr.h b/libzypp/zypp/sat/LookupAttr.h deleted file mode 100644 index 86500a0..0000000 --- a/libzypp/zypp/sat/LookupAttr.h +++ /dev/null @@ -1,612 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/LookupAttr.h - * -*/ -#ifndef ZYPP_SAT_LOOKUPATTR_H -#define ZYPP_SAT_LOOKUPATTR_H - -extern "C" -{ -struct _Dataiterator; -} -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/DefaultIntegral.h" - -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/SolvAttr.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class CheckSum; - class Match; - class MatchException; - class StrMatcher; - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr - // - /** Lightweight attribute value lookup. - * - * Search for an attribute in \ref Pool, one \ref Repository - * or one \ref Solvable. \ref LookupAttr builds the query, - * \ref LookupAttr::iterator iterates over the result. - * - * Per default \ref LookupAttr looks for attributes associated with - * a \ref Solvable. But you may also pass \ref REPO_ATTR as - * \ref Location argument, to lookup attributes associated with - * the \ref Repository (e.g. DeltaRpm information). - * - * For convenience \see \ref LookupRepoAttr. - * - * Modifying the query will not affect any running - * iterator. - * - * Use \ref SolvAttr::allAttr to search all attributes. - * - * To search for attributes located in a sub-structure (flexarray) - * you also have to pass the sub-structures attribute as parent. - * Passing \ref SolvAttr::allAttr a parent will lookup the attribute - * in \c any sub-structure. Few attributes are known to have a parent - * (\see \ref SolvAttr::parent). Setting those attributes will automatically - * initialize their parent value. - * - * \code - * // Lookup all 'name' attributes: - * sat::LookupAttr q( sat::SolvAttr::name ); - * // Lookup all 'name' attributes within a sub-structure 'data': - * sat::LookupAttr q( sat::SolvAttr::name, sat::SolvAttr::data ); - * // Lookup all 'name' attributes within any sub-structure: - * sat::LookupAttr q( sat::SolvAttr::name, sat::SolvAttr::allAttr ); - * \endcode - * - * \code - * // look for all attributes of one solvable - * void ditest( sat::Solvable slv_r ) - * { - * sat::LookupAttr q( sat::SolvAttr::allAttr, slv_r ); - * MIL << q << ": " << endl; - * for_( it, q.begin(), q.end() ) - * { - * MIL << " " << it.inSolvAttr() << " = " << it.asString() << endl; - * } - * } - * \endcode - * - * \code - * // look for an attribute in the pool. - * sat::LookupAttr q( sat::SolvAttr("susetags:datadir") ); - * MIL << q << ": " << endl; - * for_( it, q.begin(), q.end() ) - * { - * MIL << " " << it << endl; - * } - * \endcode - * - * \code - * // look for a repo attribute in the pool. - * sat::LookupRepoAttr q( sat::SolvAttr::repositoryAddedFileProvides ); - * MIL << q << ": " << endl; - * for_( it, q.begin(), q.end() ) - * { - * MIL << " " << it << endl; - * } - * \endcode - */ - class LookupAttr - { - public: - typedef MatchException Exception; - - public: - typedef unsigned size_type; - - /** Specify the where to look for the attribule. */ - enum Location { - SOLV_ATTR = 0, //!< Search for solvable attributes (default) - REPO_ATTR = -1 //!< Search for repository attributes - }; - - public: - /** Default ctor finds nothing. */ - LookupAttr(); - - /** Lookup \ref SolvAttr in \ref Pool (all repositories). */ - explicit LookupAttr( SolvAttr attr_r, Location = SOLV_ATTR ); - /** \overload SolvAttr within sub-structure \a parent_r. */ - LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Location = SOLV_ATTR ); - - /** Lookup \ref SolvAttr in one\ref Repository. */ - LookupAttr( SolvAttr attr_r, Repository repo_r, Location = SOLV_ATTR ); - /** \overload SolvAttr within sub-structure \a parent_r. */ - LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Repository repo_r, Location = SOLV_ATTR ); - - /** Lookup \ref SolvAttr in one \ref Solvable. */ - LookupAttr( SolvAttr attr_r, Solvable solv_r ); - /** \overload SolvAttr within sub-structure \a parent_r. */ - LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Solvable solv_r ); - - public: - /** \name Search result. */ - //@{ - /** Result iterator. */ - class iterator; - - /** Iterator to the begin of query results. */ - iterator begin() const; - - /** Iterator behind the end of query results. */ - iterator end() const; - - /** Whether the query is empty. */ - bool empty() const; - - /** Ammount of results. - * \note This is not a cheap call. It runs the query. - */ - size_type size() const; - - /** TransformIterator returning an \ref iterator vaue of type \c _ResultT. */ - template class transformIterator; - //@} - - public: - /** \name What to search. */ - //@{ - /** The \ref SolvAttr to search. */ - SolvAttr attr() const; - - /** Set the \ref SolvAttr to search. */ - void setAttr( SolvAttr attr_r ); - //@} - - /** \name Restrict attributes to match a pattern. */ - //@{ - /** The pattern to match. - * You can also evaluate \ref StrMatcher in a boolean context, - * in order to test whether an \ref StrMatcher is set: - * \code - * LookupAttr q; - * if ( q.strMatcher() ) - * ...; // an StrMatcher is set - * \endcode - */ - const StrMatcher & strMatcher() const; - - /** Set the pattern to match. - * \throws MatchException Any of the exceptions thrown by \ref StrMatcher::compile. - */ - void setStrMatcher( const StrMatcher & matcher_r ); - - /** Reset the pattern to match. */ - void resetStrMatcher(); - //@} - - public: - /** \name Where to search. */ - //@{ - /** Whether to search in \ref Pool. */ - bool pool() const; - - /** Set search in \ref Pool (all repositories). */ - void setPool( Location = SOLV_ATTR ); - - /** Whether to search in one \ref Repository. */ - Repository repo() const; - - /** Set search in one \ref Repository. */ - void setRepo( Repository repo_r, Location = SOLV_ATTR ); - - /** Whether to search in one \ref Solvable. */ - Solvable solvable() const; - - /** Set search in one \ref Solvable. */ - void setSolvable( Solvable solv_r ); - - /** Whether to search within a sub-structure (\ref SolvAttr::noAttr if not) */ - SolvAttr parent() const; - - /** Set search within a sub-structure (\ref SolvAttr::noAttr for none) */ - void setParent( SolvAttr attr_r ); - //@} - - private: - class Impl; - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates LookupAttr Stream output. */ - std::ostream & operator<<( std::ostream & str, const LookupAttr & obj ); - - /** \relates LookupAttr Verbose stream output including the query result. */ - std::ostream & dumpOn( std::ostream & str, const LookupAttr & obj ); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupRepoAttr - // - /** Lightweight repository attribute value lookup. - * - * This is just a convenience class that overloads all - * \ref LookupAttr methods which take a \ref LookupAttr::Location - * argument and sets it to \ref REPO_ATTR. - * - * \code - * // look for a repo attribute in the pool: - * sat::LookupAttr p( sat::SolvAttr::repositoryAddedFileProvides, sat::LookupAttr::REPO_ATTR ); - * - * // Equivalent but using LookupRepoAttr: - * sat::LookupRepoAttr q( sat::SolvAttr::repositoryAddedFileProvides ); - * \endcode - * - * \see \ref LookupAttr - */ - class LookupRepoAttr : public LookupAttr - { - public: - /** \copydoc LookupAttr::LookupAttr() */ - LookupRepoAttr() - {} - /** \copydoc LookupAttr::LookupAttr(SolvAttr) */ - explicit LookupRepoAttr( SolvAttr attr_r ) - : LookupAttr( attr_r, REPO_ATTR ) - {} - /** \copydoc LookupAttr::LookupAttr(SolvAttr,Repository) */ - explicit LookupRepoAttr( SolvAttr attr_r, Repository repo_r ); - - public: - /** \copydoc LookupAttr::setPool */ - void setPool() - { LookupAttr::setPool( REPO_ATTR ); } - /** \copydoc LookupAttr::setRepo */ - void setRepo( Repository repo_r ); - private: - // Hide. You can't look inside and outside Solvables at the same time. - using LookupAttr::solvable; - using LookupAttr::setSolvable; - }; - /////////////////////////////////////////////////////////////////// - - namespace detail - { - /** Wrapper around sat \c ::_Dataiterator. - * - * Manages copy and assign, and release of allocated - * resources like datamatcher inside the dataiterator. - * Also maintains a copy of the matchstring in order to - * keep the char* passed to the dataiterator valid. - */ - class DIWrap - { - public: - /** \c NULL \c ::_Dataiterator */ - DIWrap() - : _dip( 0 ) - {} - /** Initializes */ - DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r, - const std::string & mstring_r = std::string(), int flags_r = 0 ); - /** \overload to catch \c NULL \a mstring_r. */ - DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r, - const char * mstring_r, int flags_r = 0 ); - DIWrap( const DIWrap & rhs ); - ~DIWrap(); - public: - void swap( DIWrap & rhs ) - { - if ( &rhs != this ) // prevent self assign! - { - std::swap( _dip, rhs._dip ); - std::swap( _mstring, rhs._mstring ); - } - } - DIWrap & operator=( const DIWrap & rhs ) - { - if ( &rhs != this ) // prevent self assign! - DIWrap( rhs ).swap( *this ); - return *this; - } - void reset() - { DIWrap().swap( *this ); } - public: - /** Evaluate in a boolean context ( _dip != NULL ). */ - explicit operator bool() const - { return _dip; } - - public: - ::_Dataiterator * operator->() const { return _dip; } - ::_Dataiterator * get() const { return _dip; } - const std::string & getstr() const { return _mstring; } - - private: - ::_Dataiterator * _dip; - std::string _mstring; - }; - /** \relates DIWrap Stream output. */ - std::ostream & operator<<( std::ostream & str, const DIWrap & obj ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr::iterator - // - /** Result iterator. - * Extended iterator methods valid only if not @end. - * \note Implementation: Keep iterator_adaptor base and _dip in sync! - */ - class LookupAttr::iterator : public boost::iterator_adaptor< - iterator // Derived - , ::_Dataiterator * // Base - , detail::IdType // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , detail::IdType // Reference - > - { - public: - /** \name Moving fast forward. */ - //@{ - /** On the next call to \ref operator++ advance to the next \ref SolvAttr. */ - void nextSkipSolvAttr(); - - /** On the next call to \ref operator++ advance to the next \ref Solvable. */ - void nextSkipSolvable(); - - /** On the next call to \ref operator++ advance to the next \ref Repository. */ - void nextSkipRepo(); - - /** Immediately advance to the next \ref SolvAttr. */ - void skipSolvAttr() - { nextSkipSolvAttr(); increment(); } - - /** Immediately advance to the next \ref Solvable. */ - void skipSolvable() - { nextSkipSolvable(); increment(); } - - /** Immediately advance to the next \ref Repository. */ - void skipRepo() - { nextSkipRepo(); increment(); } - - /** Stop after all matches in the current \ref Solvable are processed. */ - void stayInThisSolvable(); - - /** Stop after all matches in the current \ref Repository are processed. */ - void stayInThisRepo(); - //@} - - /** \name Current position info. */ - //@{ - /** The current \ref Repository. */ - Repository inRepo() const; - - /** The current \ref Solvable. */ - Solvable inSolvable() const; - - /** The current \ref SolvAttr. */ - SolvAttr inSolvAttr() const; - - /** Whether this points to the end of a query (Iterator is invalid). */ - bool atEnd() const - { return !_dip; } - //@} - - /** \name Test attribute value type. */ - //@{ - /** The current \ref SolvAttr type. */ - detail::IdType solvAttrType() const; - - /** Whether this is a numeric attribute (incl. boolean). */ - bool solvAttrNumeric() const; - - /** Whether this is a string attribute. */ - bool solvAttrString() const; - - /** Whether this string attribute is available as \ref IdString. */ - bool solvAttrIdString() const; - - /** Whether this is a CheckSum attribute.*/ - bool solvAttrCheckSum() const; - - /** Whether this is the entry to a sub-structure (flexarray). - * This is the entry to a sequence of attributes. To - * acces them use \ref subBegin and \ref subEnd. - */ - bool solvAttrSubEntry() const; - //@} - - /** \name Iterate sub-structures. - * - * These are usable iff \ref solvAttrSubEntry is \c true. - * - * \note Unfortunately the underlying libsolv dataiterator as returned - * by \ref subBegin and \ref subFind loses some context when being created. - * Thus it's not possible to invoke \ref subBegin and \ref subFind on an - * iterator that was previously returned by one of those methods. The result - * will be an \c end iterator. For the same reason it is not possible for an - * iterator to leave the sub-structure again. - * - * \code - * // Lookup all "update:reference" entries for a specific solvable - * sat::LookupAttr q( sat::SolvAttr::updateReference, p->satSolvable() ); - * for_( res, q.begin(), q.end() ) - * { - * // List all sub values - * for_( sub, res.subBegin(), res.subEnd() ) - * { - * cout << sub.asString() << endl; - * } - * - * // Directly access c specific value: - * sat::LookupAttr::iterator it( res.subFind( sat::SolvAttr::updateReferenceHref ) ); - * if ( it != res.subEnd() ) - * cout << it.asString() << endl; - * } - * \endcode - */ - //@{ - /** Whether the sub-structure is empty. */ - bool subEmpty() const; - - /** Ammount of attributes in the sub-structure. - * \note This is not a cheap call. It runs the query. - */ - size_type subSize() const; - - /** Iterator to the begin of a sub-structure. - * \see \ref solvAttrSubEntry - */ - iterator subBegin() const; - /** Iterator behind the end of a sub-structure. - * \see \ref solvAttrSubEntry - */ - iterator subEnd() const; - /** Iterator pointing to the first occurance of \ref SolvAttr \a attr_r in sub-structure. - * If \ref sat::SolvAttr::allAttr is passed, \ref subBegin is returned. - * \see \ref solvAttrSubEntry - */ - iterator subFind( SolvAttr attr_r ) const; - /** \overload Extending the current attribute name with by \c ":attrname_r". - * - * This assumes a sub-structur \c "update:reference" has attributes - * like \c "update:reference:type", \c "update:reference:href". - * - * If an empty \c attrname_r is passed, \ref subBegin is returned. - */ - iterator subFind( const C_Str & attrname_r ) const; - //@} - - /** \name Retrieving attribute values. */ - //@{ - /** Conversion to numeric types. */ - int asInt() const; - /** \overload */ - unsigned asUnsigned() const; - /** \overload */ - bool asBool() const; - /** \overload */ - unsigned long long asUnsignedLL() const; - - /** Conversion to string types. */ - const char * c_str() const; - /** \overload - * If used with non-string types, this method tries to create - * some appropriate string representation. - */ - std::string asString() const; - - /** As \ref IdStr. - * This is only done for poolized string types. Large strings like - * summary or descriptions are not available via \ref IdStr, only - * via \ref c_str and \ref asString. - */ - IdString idStr() const; - /** \overload Directly returning the \c Id */ - detail::IdType id() const - { return idStr().id(); } - - /** As \ref CheckSum. */ - CheckSum asCheckSum() const; - - /** Templated return type. - * Per default assumes an Id based type, so try to construct - * it from the Id. - * - * Should be specialized for supported types above. - */ - template _Tp asType() const { return _Tp(id()); } - //@} - - /////////////////////////////////////////////////////////////////// - // internal stuff below - /////////////////////////////////////////////////////////////////// - public: - iterator(); - - iterator( const iterator & rhs ); - - iterator & operator=( const iterator & rhs ); - - ~iterator(); - - public: - /** - * C-tor taking over ownership of the passed \c ::_Dataiterator - * and doing it's first iteration (::dataiterator_step) - */ - iterator( detail::DIWrap & dip_r ); - - private: - friend class boost::iterator_core_access; - - template - bool equal( const boost::iterator_adaptor & rhs ) const - { - return ( bool(base()) == bool(rhs.base()) ) - && ( ! base() || dip_equal( *base(), *rhs.base() ) ); - } - - bool dip_equal( const ::_Dataiterator & lhs, const ::_Dataiterator & rhs ) const; - - detail::IdType dereference() const; - - void increment(); - - public: - /** Expert backdoor. */ - ::_Dataiterator * get() const - { return _dip.get(); } - private: - detail::DIWrap _dip; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates LookupAttr::iterator Stream output. */ - std::ostream & operator<<( std::ostream & str, const LookupAttr::iterator & obj ); - - /////////////////////////////////////////////////////////////////// - - /** \name Helpers and forward declarations from LookupAttrTools.h */ - //@{ - template<> inline int LookupAttr::iterator::asType() const { return asInt(); } - template<> inline unsigned LookupAttr::iterator::asType() const { return asUnsigned(); } - template<> inline unsigned long long LookupAttr::iterator::asType() const { return asUnsignedLL(); } - template<> inline bool LookupAttr::iterator::asType() const { return asBool(); } - template<> inline const char * LookupAttr::iterator::asType() const { return c_str(); } - template<> inline std::string LookupAttr::iterator::asType() const { return asString(); } - template<> inline IdString LookupAttr::iterator::asType() const { return idStr(); } - template<> CheckSum LookupAttr::iterator::asType() const; - - template - class ArrayAttr; - //@} - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -/** \relates LookupAttr::iterator Stream output of the underlying iterator for debug. */ -std::ostream & operator<<( std::ostream & str, const ::_Dataiterator * obj ); - -/** \relates LookupAttr::iterator Stream output of the underlying iterator for debug. */ -inline std::ostream & operator<<( std::ostream & str, const ::_Dataiterator & obj ) -{ return str << &obj; } - -#endif // ZYPP_SAT_LOOKUPATTR_H diff --git a/libzypp/zypp/sat/LookupAttrTools.h b/libzypp/zypp/sat/LookupAttrTools.h deleted file mode 100644 index 800e9c2..0000000 --- a/libzypp/zypp/sat/LookupAttrTools.h +++ /dev/null @@ -1,223 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/LookupAttrTools.h - * -*/ -#ifndef ZYPP_SAT_LOOKUPATTRTOOLS_H -#define ZYPP_SAT_LOOKUPATTRTOOLS_H - -#include "zypp/sat/LookupAttr.h" -#include "zypp/Repository.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : LookupAttr::transformIterator - // - /** TransformIterator returning an \ref iterator value of type \c _ResultT. - * - * The underlying LookupAttr::iterators value is retrieved \ref asType<_AttrT> - * and the returned \ref ResultT is constructed fron that value. - * - * \code - * class Keywords - * { - * public: - * Keywords( sat::Solvable solv_r ) - * : _q( sat::SolvAttr::keywords, solv_r ) - * {} - * - * public: - * typedef sat::LookupAttr::transformIterator iterator; - * - * iterator begin() const { return iterator( _q.begin() ); } - * iterator end() const { return iterator( _q.end() ); } - * - * private: - * sat::LookupAttr _q; - * }; - * \endcode - * - * \see \ref ArrayAttr. - */ - template - class LookupAttr::transformIterator : public boost::iterator_adaptor< - transformIterator<_ResultT,_AttrT> // Derived - , LookupAttr::iterator // Base - , _ResultT // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , _ResultT // Reference - > - { - public: - transformIterator() - {} - - explicit - transformIterator( const LookupAttr::iterator & val_r ) - { this->base_reference() = val_r; } - - public: - - /** \name Moving fast forward. */ - //@{ - /** On the next call to \ref operator++ advance to the next \ref SolvAttr. */ - void nextSkipSolvAttr() - { this->base_reference().nextSkipSolvAttr(); } - - /** On the next call to \ref operator++ advance to the next \ref Solvable. */ - void nextSkipSolvable() - { this->base_reference().nextSkipSolvable(); } - - /** On the next call to \ref operator++ advance to the next \ref Repository. */ - void nextSkipRepo() - { this->base_reference().nextSkipRepo(); } - - /** Immediately advance to the next \ref SolvAttr. */ - void skipSolvAttr() - { this->base_reference().skipSolvAttr(); } - - /** Immediately advance to the next \ref Solvable. */ - void skipSolvable() - { this->base_reference().skipSolvable(); } - - /** Immediately advance to the next \ref Repository. */ - void skipRepo() - { this->base_reference().skipRepo(); } - //@} - - /** \name Current position info. */ - //@{ - /** The current \ref Repository. */ - Repository inRepo() const - { return this->base_reference().inRepo(); } - - /** The current \ref Solvabele. */ - Solvable inSolvable() const - { return this->base_reference().inSolvable(); } - - /** The current \ref SolvAttr. */ - SolvAttr inSolvAttr() const - { return this->base_reference().inSolvAttr(); } - //@} - - private: - friend class boost::iterator_core_access; - - _ResultT dereference() const - { - const LookupAttr::iterator lit( this->base_reference() ); - return _ResultT( lit.asType<_AttrT>() ); - } - }; - /////////////////////////////////////////////////////////////////// - - template - class ArrayAttr; - - template - std::ostream & operator<<( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj ); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ArrayAttr - // - /** \ref LookupAttr::transformIterator based container to retrieve list attributes. - * - * You may pass \ref LookupAttr::REPO_ATTR as \ref LookupAttr::Location argument, - * to lookup attributes associated with the \ref Repository as a whole - * (e.g. repository keywords). - * - * \see \ref LookupAttr for details. - * - * \code - * typedef ArrayAttr Keywords; - * Keywords k( sat::SolvAttr::keywords ); - * dumpRange( MIL << "All Keywords: ", k.begin(), k.end() ) << endl; - * \endcode - * - * \todo Maybe add some way to unify the result. - */ - template - class ArrayAttr - { - friend std::ostream & operator<< <_ResultT,_AttrT>( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj ); - - public: - ArrayAttr() - {} - - ArrayAttr( SolvAttr attr_r, LookupAttr::Location loc_r = LookupAttr::SOLV_ATTR ) - : _q( attr_r, loc_r ) - {} - - ArrayAttr( SolvAttr attr_r, Repository repo_r, LookupAttr::Location loc_r = LookupAttr::SOLV_ATTR ) - : _q( attr_r, repo_r, loc_r ) - {} - - ArrayAttr( SolvAttr attr_r, Solvable solv_r ) - : _q( attr_r, solv_r ) - {} - - public: - typedef LookupAttr::transformIterator<_ResultT,_AttrT> iterator; - typedef LookupAttr::size_type size_type; - - iterator begin() const - { return iterator( _q.begin() ); } - - iterator end() const - { return iterator( _q.end() ); } - - bool empty() const - { return _q.empty(); } - - size_type size() const - { - size_type count = 0; - for_( it, begin(), end() ) - ++count; - return count; - } - - public: - - iterator find( const _ResultT & key_r ) const - { - for_( it, begin(), end() ) - { - if ( *it == key_r ) - return it; - } - return end(); - } - - private: - LookupAttr _q; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates LookupAttr::iterator Stream output. */ - template - inline std::ostream & operator<<( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj ) - { return dumpOn( str, obj._q ); } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_LOOKUPATTRTOOLS_H diff --git a/libzypp/zypp/sat/Map.cc b/libzypp/zypp/sat/Map.cc deleted file mode 100644 index 66afad2..0000000 --- a/libzypp/zypp/sat/Map.cc +++ /dev/null @@ -1,135 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Map.cc - */ -extern "C" -{ -#include -} -#include -#include -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" - -#include "zypp/sat/Map.h" -#include "zypp/sat/Pool.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - template<> - struct ::_Map * rwcowClone( const struct ::_Map * rhs ) - { - struct ::_Map * ret = new ::_Map; - ::map_init_clone( ret, const_cast(rhs) ); - return ret; - } - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - Map::Map() - : _pimpl( new ::_Map ) - { ::map_init( _pimpl.get(), 0 ); } - - Map::Map( size_type size_r ) - : _pimpl( new ::_Map ) - { ::map_init( _pimpl.get(), size_r ); } - - Map::Map( PoolSizeType ) - : _pimpl( new ::_Map ) - { ::map_init( _pimpl.get(), Pool::instance().capacity() ); } - - Map::~Map() - { ::map_free( _pimpl.get() ); } - - bool Map::empty() const - { return( _pimpl->size == 0 ); } - - Map::size_type Map::size() const - { return _pimpl->size << 3; } - - void Map::grow( size_type size_r ) - { ::map_grow( _pimpl.get(), size_r ); } - - void Map::setAll() - { assignAll( true ); } - - void Map::clearAll() - { assignAll( false ); } - - void Map::assignAll( bool val_r ) - { - if ( _pimpl->size ) - ::memset( _pimpl->map, (val_r?-1:0), _pimpl->size ); - } - -#define M_RANGE_CKECK(IDX,LOC) if ( ((IDX) >> 3) >= size_type(_pimpl->size) ) throw std::out_of_range( "zypp::sat::Map::" LOC ) - - void Map::set( size_type idx_r ) - { - M_RANGE_CKECK( idx_r, "set" ); - MAPSET( _pimpl, idx_r ); - } - - void Map::clear( size_type idx_r ) - { - M_RANGE_CKECK( idx_r, "clear" ); - MAPCLR( _pimpl, idx_r ); - } - - void Map::assign( size_type idx_r, bool val_r ) - { - M_RANGE_CKECK( idx_r, "assign" ); - if ( val_r ) - { MAPSET( _pimpl, idx_r ); } - else - { MAPCLR( _pimpl, idx_r ); } - } - - bool Map::test( size_type idx_r ) const - { - M_RANGE_CKECK( idx_r, "test" ); - return MAPTST( _pimpl, idx_r ); - } - - std::string Map::asString( const char on_r, const char off_r ) const - { - if ( empty() ) - return std::string(); - - std::string ret( size(), off_r ); - for_( idx, size_type(0), size() ) - { - if ( test( idx ) ) - ret[idx] = on_r; - } - return ret; - } - - Map::operator struct ::_Map *() // COW: nonconst version can't be inlined - { return _pimpl.get(); } // without exposing struct ::_Map - - bool operator==( const Map & lhs, const Map & rhs ) - { - const struct ::_Map * l = lhs; - const struct ::_Map * r = rhs; - return( l == r || ( l->size == r->size && ::memcmp( l->map, r->map, l->size ) == 0 ) ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/Map.h b/libzypp/zypp/sat/Map.h deleted file mode 100644 index 9eaddea..0000000 --- a/libzypp/zypp/sat/Map.h +++ /dev/null @@ -1,139 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Map.h - */ -#ifndef ZYPP_SAT_MAP_H -#define ZYPP_SAT_MAP_H - -extern "C" -{ - struct _Map; -} -#include -#include - -#include "zypp/base/PtrTypes.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace sat - { - /////////////////////////////////////////////////////////////////// - /// \class Map - /// \brief Libsolv (bit)Map wrapper. - /// - /// \Note Requested sizes are filled up to the next multiple of eight. - /// Libsolv bitmaps are not shrinkable. - /////////////////////////////////////////////////////////////////// - class Map - { - public: - typedef unsigned long size_type; - - /** Type to indicate the bitmap should match the current pools capacity. */ - struct PoolSizeType {}; - /** An object indicating the bitmap should match the current pools capacity. */ - static constexpr PoolSizeType poolSize = PoolSizeType(); - - public: - /** Default ctor: empty Map */ - Map(); - - /** Ctor taking the Map size */ - explicit Map( size_type size_r ); - - /** Ctor creating a Map matching the current pools capacity */ - Map( PoolSizeType ); - - /** Dtor */ - ~Map(); - - public: - /** Whether Map is empty. */ - bool empty() const; - - /** Size of the Map. */ - size_type size() const; - - /** Grow the Map if necessary. */ - void grow( size_type size_r ); - - public: - /** Set all bits. */ - void setAll(); - - /** Clear all bits. */ - void clearAll(); - - /** Assign \c val_r to all bits. */ - void assignAll( bool val_r ); - - /** Set bit \c idx_r. - * \throws std::out_of_range if \a idx_r is out of range - */ - void set( size_type idx_r ); - - /** Clear bit \c idx_r. - * \throws std::out_of_range if \a idx_r is out of range - */ - void clear( size_type idx_r ); - - /** Assign \c val_r to bit \c idx_r. - * \throws std::out_of_range if \a idx_r is out of range - */ - void assign( size_type idx_r, bool val_r ); - - public: - /** Test bit \c idx_r. - * \throws std::out_of_range if \a idx_r is out of range - */ - bool test( size_type idx_r ) const; - - /** Test bit \c idx_r. - * \throws std::out_of_range if \a idx_r is out of range - */ - bool operator[]( size_type idx_r ) const - { return test( idx_r ); } - - public: - /** String representation */ - std::string asString( const char on_r = '1', const char off_r = '0' ) const; - - public: - operator struct ::_Map *(); ///< libsolv backdoor - operator const struct ::_Map *() const ///< libsolv backdoor - { return _pimpl.get(); } - private: - RWCOW_pointer _pimpl; ///< Pointer to implementation - }; - - /** \relates Map Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Map & obj ) - { return str << obj.asString(); } - - /** \relates Map */ - bool operator==( const Map & lhs, const Map & rhs ); - - /** \relates Map */ - inline bool operator!=( const Map & lhs, const Map & rhs ) - { return !( lhs == rhs ); } - - } // namespace sat - /////////////////////////////////////////////////////////////////// - - /** \relates Map Clone function for RWCOW_pointer */ - template<> struct ::_Map * rwcowClone( const struct ::_Map * rhs ); - - typedef sat::Map Bitmap; - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_MAP_H diff --git a/libzypp/zypp/sat/Pool.cc b/libzypp/zypp/sat/Pool.cc deleted file mode 100644 index 35d8621..0000000 --- a/libzypp/zypp/sat/Pool.cc +++ /dev/null @@ -1,250 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Pool.cc - * -*/ - -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Exception.h" - -#include "zypp/AutoDispose.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/sat/Pool.h" -#include "zypp/sat/LookupAttr.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - const std::string & Pool::systemRepoAlias() - { return detail::PoolImpl::systemRepoAlias(); } - - ::_Pool * Pool::get() const - { return myPool().getPool(); } - - Pool::size_type Pool::capacity() const - { return myPool()->nsolvables; } - - const SerialNumber & Pool::serial() const - { return myPool().serial(); } - - void Pool::prepare() const - { return myPool().prepare(); } - - void Pool::prepareForSolving() const - { return myPool().prepareForSolving(); } - - Pathname Pool::rootDir() const - { return myPool().rootDir(); } - - void Pool::rootDir( const Pathname & root_r ) - { return myPool().rootDir( root_r ); } - - bool Pool::reposEmpty() const - { return ! myPool()->urepos; } - - Pool::size_type Pool::reposSize() const - { return myPool()->urepos; } - - Pool::RepositoryIterator Pool::reposBegin() const - { - if ( myPool()->urepos ) - { // repos[0] == NULL - for_( it, myPool()->repos+1, myPool()->repos+myPool()->nrepos ) - if ( *it ) - return RepositoryIterator( it ); - } - return reposEnd(); - } - - Pool::RepositoryIterator Pool::reposEnd() const - { return RepositoryIterator( myPool()->repos+myPool()->nrepos ); } - - bool Pool::solvablesEmpty() const - { - // return myPool()->nsolvables; - // nsolvables is the array size including - // invalid Solvables. - for_( it, reposBegin(), reposEnd() ) - { - if ( ! it->solvablesEmpty() ) - return false; - } - return true; - } - - Pool::size_type Pool::solvablesSize() const - { - // Do not return myPool()->nsolvables; - // nsolvables is the array size including - // invalid Solvables. - size_type ret = 0; - for_( it, reposBegin(), reposEnd() ) - { - ret += it->solvablesSize(); - } - return ret; - } - - Pool::SolvableIterator Pool::solvablesBegin() const - { return SolvableIterator( myPool().getFirstId() ); } - - Pool::SolvableIterator Pool::solvablesEnd() const - { return SolvableIterator(); } - - Repository Pool::reposInsert( const std::string & alias_r ) - { - Repository ret( reposFind( alias_r ) ); - if ( ret ) - return ret; - - ret = Repository( myPool()._createRepo( alias_r ) ); - if ( ret.isSystemRepo() ) - { - // autoprovide (dummy) RepoInfo - RepoInfo info; - info.setAlias( alias_r ); - info.setName( alias_r ); - info.setAutorefresh( true ); - info.setEnabled( true ); - ret.setInfo( info ); - } - return ret; - } - - Repository Pool::reposFind( const std::string & alias_r ) const - { - for_( it, reposBegin(), reposEnd() ) - { - if ( alias_r == it->alias() ) - return *it; - } - return Repository(); - } - - Repository Pool::findSystemRepo() const - { - return Repository( myPool().systemRepo() ); - } - - Repository Pool::systemRepo() - { - if ( myPool().systemRepo() ) - return Repository( myPool().systemRepo() ); - return reposInsert( systemRepoAlias() ); - } - - Repository Pool::addRepoSolv( const Pathname & file_r, const std::string & alias_r ) - { - // Using a temporay repo! (The additional parenthesis are required.) - AutoDispose tmprepo( (Repository::EraseFromPool()) ); - *tmprepo = reposInsert( alias_r ); - tmprepo->addSolv( file_r ); - - // no exceptions so we keep it: - tmprepo.resetDispose(); - return tmprepo; - } - - Repository Pool::addRepoSolv( const Pathname & file_r ) - { return addRepoSolv( file_r, file_r.basename() ); } - - Repository Pool::addRepoSolv( const Pathname & file_r, const RepoInfo & info_r ) - { - Repository ret( addRepoSolv( file_r, info_r.alias() ) ); - ret.setInfo( info_r ); - return ret; - } - - ///////////////////////////////////////////////////////////////// - - Repository Pool::addRepoHelix( const Pathname & file_r, const std::string & alias_r ) - { - // Using a temporay repo! (The additional parenthesis are required.) - AutoDispose tmprepo( (Repository::EraseFromPool()) ); - *tmprepo = reposInsert( alias_r ); - tmprepo->addHelix( file_r ); - - // no exceptions so we keep it: - tmprepo.resetDispose(); - return tmprepo; - } - - Repository Pool::addRepoHelix( const Pathname & file_r ) - { return addRepoHelix( file_r, file_r.basename() ); } - - Repository Pool::addRepoHelix( const Pathname & file_r, const RepoInfo & info_r ) - { - Repository ret( addRepoHelix( file_r, info_r.alias() ) ); - ret.setInfo( info_r ); - return ret; - } - - ///////////////////////////////////////////////////////////////// - - void Pool::setTextLocale( const Locale & locale_r ) - { myPool().setTextLocale( locale_r ); } - - void Pool::setRequestedLocales( const LocaleSet & locales_r ) - { myPool().setRequestedLocales( locales_r ); } - - bool Pool::addRequestedLocale( const Locale & locale_r ) - { return myPool().addRequestedLocale( locale_r ); } - - bool Pool::eraseRequestedLocale( const Locale & locale_r ) - { return myPool().eraseRequestedLocale( locale_r ); } - - const LocaleSet & Pool::getRequestedLocales() const - { return myPool().getRequestedLocales(); } - - bool Pool::isRequestedLocale( const Locale & locale_r ) const - { return myPool().isRequestedLocale( locale_r ); } - - const LocaleSet & Pool::getAvailableLocales() const - { return myPool().getAvailableLocales(); } - - bool Pool::isAvailableLocale( const Locale & locale_r ) const - { return myPool().isAvailableLocale( locale_r ); } - - bool Pool::multiversionEmpty() const { return myPool().multiversionList().empty(); } - size_t Pool::multiversionSize() const { return myPool().multiversionList().size(); } - Pool::MultiversionIterator Pool::multiversionBegin() const { return myPool().multiversionList().begin(); } - Pool::MultiversionIterator Pool::multiversionEnd() const { return myPool().multiversionList().end(); } - bool Pool::isMultiversion( IdString ident_r ) const { return myPool().isMultiversion( ident_r ); } - - Queue Pool::autoInstalled() const { return myPool().autoInstalled(); } - void Pool::setAutoInstalled( const Queue & autoInstalled_r ){ myPool().setAutoInstalled( autoInstalled_r ); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const Pool & obj ) - { - return str << "sat::pool(" << obj.serial() << ")[" - << obj.capacity() << "]{" - << obj.reposSize() << "repos|" - << obj.solvablesSize() << "slov}"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/Pool.h b/libzypp/zypp/sat/Pool.h deleted file mode 100644 index 9a29f33..0000000 --- a/libzypp/zypp/sat/Pool.h +++ /dev/null @@ -1,270 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Pool.h - * -*/ -#ifndef ZYPP_SAT_POOL_H -#define ZYPP_SAT_POOL_H - -#include - -#include "zypp/Pathname.h" - -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/Repository.h" -#include "zypp/sat/WhatProvides.h" -#include "zypp/sat/Queue.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class SerialNumber; - class RepoInfo; - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Pool - // - /** Global sat-pool. - * - * Explicitly shared singleton \ref Pool::instance. - */ - class Pool : protected detail::PoolMember - { - public: - typedef detail::SolvableIterator SolvableIterator; - typedef zypp::detail::RepositoryIterator RepositoryIterator; - typedef detail::size_type size_type; - - public: - /** Singleton ctor. */ - static Pool instance() - { return Pool(); } - - /** Ctor from \ref PoolMember. */ - Pool( const detail::PoolMember & ) - {} - - public: - /** Internal array size for stats only. */ - size_type capacity() const; - - /** Housekeeping data serial number. */ - const SerialNumber & serial() const; - - /** Update housekeeping data if necessary (e.g. whatprovides). */ - void prepare() const; - - /** \ref prepare plus some expensive checks done before solving only. */ - void prepareForSolving() const; - - /** Get rootdir (for file conflicts check) */ - Pathname rootDir() const; - - /** Set rootdir (for file conflicts check) */ - void rootDir( const Pathname & root_r ); - - public: - /** Whether \ref Pool contains repos. */ - bool reposEmpty() const; - - /** Number of repos in \ref Pool. */ - size_type reposSize() const; - - /** Iterator to the first \ref Repository. */ - RepositoryIterator reposBegin() const; - - /** Iterator behind the last \ref Repository. */ - RepositoryIterator reposEnd() const; - - /** Return a \ref Repository named \c alias_r. - * It a such a \ref Repository does not already exist - * a new empty \ref Repository is created. - */ - Repository reposInsert( const std::string & alias_r ); - - /** Find a \ref Repository named \c alias_r. - * Returns \ref norepository if there is no such \ref Repository. - */ - Repository reposFind( const std::string & alias_r ) const; - - /** Remove a \ref Repository named \c alias_r. - * \see \ref Repository::eraseFromPool - */ - void reposErase( const std::string & alias_r ) - { reposFind( alias_r ).eraseFromPool(); } - - public: - /** Reserved system repository alias \c @System. */ - static const std::string & systemRepoAlias(); - - /** Return the system repository if it is on the pool. */ - Repository findSystemRepo() const; - - /** Return the system repository, create it if missing. */ - Repository systemRepo(); - - public: - /** Load \ref Solvables from a solv-file into a \ref Repository named \c name_r. - * In case of an exception the \ref Repository is removed from the \ref Pool. - * \throws Exception if loading the solv-file fails. - * \see \ref Repository::EraseFromPool - */ - Repository addRepoSolv( const Pathname & file_r, const std::string & name_r ); - /** \overload Using the files basename as \ref Repository name. */ - Repository addRepoSolv( const Pathname & file_r ); - /** \overload Using the \ref RepoInfo::alias \ref Repo name. - * Additionally stores the \ref RepoInfo. \See \ref Prool::setInfo. - */ - Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r ); - - public: - /** Load \ref Solvables from a helix-file into a \ref Repository named \c name_r. - * Supports loading of gzip compressed files (.gz). In case of an exception - * the \ref Repository is removed from the \ref Pool. - * \throws Exception if loading the helix-file fails. - * \see \ref Repository::EraseFromPool - */ - Repository addRepoHelix( const Pathname & file_r, const std::string & name_r ); - /** \overload Using the files basename as \ref Repository name. */ - Repository addRepoHelix( const Pathname & file_r ); - /** \overload Using the \ref RepoInfo::alias \ref Repo name. - * Additionally stores the \ref RepoInfo. \See \ref Prool::setInfo. - */ - Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r ); - - public: - /** Whether \ref Pool contains solvables. */ - bool solvablesEmpty() const; - - /** Number of solvables in \ref Pool. */ - size_type solvablesSize() const; - - /** Iterator to the first \ref Solvable. */ - SolvableIterator solvablesBegin() const; - - /** Iterator behind the last \ref Solvable. */ - SolvableIterator solvablesEnd() const; - - public: - /** \name Iterate all Solvables matching a \c _Filter. */ - //@{ - template - filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const - { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); } - - template - filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const - { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); } - //@} - - public: - /** Conainer of all \ref Solvable providing \c cap_r. */ - WhatProvides whatProvides( Capability cap_r ) const - { return WhatProvides( cap_r ); } - - public: - /** \name Requested locales. */ - //@{ - /** Set the default language for retrieving translated texts. - * Updated when calling \ref ZConfig::setTextLocale. - */ - void setTextLocale( const Locale & locale_r ); - - /** Set the requested locales. - * Languages to be supported by the system, e.g. language specific - * packages to be installed. - */ - void setRequestedLocales( const LocaleSet & locales_r ); - - /** Add one \ref Locale to the set of requested locales. - * Return \c true if \c locale_r was newly added to the set. - */ - bool addRequestedLocale( const Locale & locale_r ); - - /** Erase one \ref Locale from the set of requested locales. - * Return \c false if \c locale_r was not found in the set. - */ - bool eraseRequestedLocale( const Locale & locale_r ); - - /** Return the requested locales. - * \see \ref setRequestedLocales - */ - const LocaleSet & getRequestedLocales() const; - - /** Whether this \ref Locale is in the set of requested locales. */ - bool isRequestedLocale( const Locale & locale_r ) const; - - /** Get the set of available locales. - * This is computed from the package data so it actually - * represents all locales packages claim to support. - */ - const LocaleSet & getAvailableLocales() const; - - /** Whether this \ref Locale is in the set of available locales. */ - bool isAvailableLocale( const Locale & locale_r ) const; - //@} - - public: - /** \name Multiversion install. - * Ident list of all packages that can be installed in different version - * at the same time. (\see \ref ZConfig::multiversionSpec) - */ - //@{ - typedef IdStringSet::const_iterator MultiversionIterator; - - bool multiversionEmpty() const; - size_t multiversionSize() const; - MultiversionIterator multiversionBegin() const; - MultiversionIterator multiversionEnd() const; - - bool isMultiversion( IdString ident_r ) const; - //@} - - public: - /** \name Autoinstalled */ - //@{ - /** Get ident list of all autoinstalled solvables. */ - Queue autoInstalled() const; - /** Set ident list of all autoinstalled solvables. */ - void setAutoInstalled( const Queue & autoInstalled_r ); - //@} - - public: - /** Expert backdoor. */ - ::_Pool * get() const; - private: - /** Default ctor */ - Pool() {} - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Pool Stream output */ - std::ostream & operator<<( std::ostream & str, const Pool & obj ); - - /** \relates Pool */ - inline bool operator==( const Pool & lhs, const Pool & rhs ) - { return lhs.get() == rhs.get(); } - - /** \relates Pool */ - inline bool operator!=( const Pool & lhs, const Pool & rhs ) - { return lhs.get() != rhs.get(); } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_POOL_H diff --git a/libzypp/zypp/sat/Queue.cc b/libzypp/zypp/sat/Queue.cc deleted file mode 100644 index 13458ba..0000000 --- a/libzypp/zypp/sat/Queue.cc +++ /dev/null @@ -1,146 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Queue.cc - */ -extern "C" -{ -#include -} -#include -#include "zypp/base/LogTools.h" - -#include "zypp/sat/Queue.h" -#include "zypp/sat/Solvable.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - - template<> - struct ::_Queue * rwcowClone( const struct ::_Queue * rhs ) - { - struct ::_Queue * ret = new ::_Queue; - ::queue_init_clone( ret, const_cast(rhs) ); - return ret; - } - - /////////////////////////////////////////////////////////////////// - namespace sat - { - - Queue::Queue() - : _pimpl( new ::_Queue ) - { ::queue_init( _pimpl.get() ); } - - Queue::~Queue() - { ::queue_free( _pimpl.get() ); } - - bool Queue::empty() const - { return( _pimpl->count == 0 ); } - - Queue::size_type Queue::size() const - { return _pimpl->count; } - - Queue::const_iterator Queue::begin() const - { return _pimpl->elements; } - - Queue::const_iterator Queue::end() const - { return _pimpl->elements + _pimpl->count;} - - Queue::const_iterator Queue::find( value_type val_r ) const - { - for_( it, begin(), end() ) - if ( *it == val_r ) - return it; - return end(); - } - - Queue::value_type Queue::first() const - { - if ( _pimpl->count ) - return *_pimpl->elements; - return 0; - } - - Queue::value_type Queue::last() const - { - if ( _pimpl->count ) - return _pimpl->elements[_pimpl->count-1]; - return 0; - } - -#define M_RANGE_CKECK(IDX,LOC) if ( IDX >= size_type(_pimpl->count) ) throw std::out_of_range( "zypp::sat::Queue::" LOC ) - - const Queue::value_type & Queue::at( size_type idx_r ) const - { M_RANGE_CKECK( idx_r, "at" ); return _pimpl->elements[idx_r]; } - - Queue::value_type & Queue::at( size_type idx_r ) - { M_RANGE_CKECK( idx_r, "at" ); return _pimpl->elements[idx_r]; } - - const Queue::value_type & Queue::operator[]( size_type idx_r ) const - { return _pimpl->elements[idx_r]; } - - Queue::value_type & Queue::operator[]( size_type idx_r ) - { return _pimpl->elements[idx_r]; } - - void Queue::clear() - { ::queue_empty( *this ); } - - void Queue::remove( value_type val_r ) - { - for ( const_iterator it( find( val_r ) ); it != end(); it = find( val_r ) ) - ::queue_delete( _pimpl.get(), it - begin() ); - } - - void Queue::push( value_type val_r ) - { ::queue_push( _pimpl.get(), val_r ); } - - void Queue::pushUnique( value_type val_r ) - { ::queue_pushunique( _pimpl.get(), val_r ); } - - Queue::value_type Queue::pop() - { return ::queue_pop( _pimpl.get() ); } - - void Queue::push_front( value_type val_r ) - { ::queue_unshift( _pimpl.get(), val_r ); } - - Queue::value_type Queue::pop_front() - { return ::queue_shift( _pimpl.get() ); } - - Queue::operator struct ::_Queue *() // COW: nonconst version can't be inlined - { return _pimpl.get(); } // without exposing struct ::_Queue - - std::ostream & operator<<( std::ostream & str, const Queue & obj ) - { return dumpRangeLine( str << "Queue ", obj.begin(), obj.end() ); } - - std::ostream & dumpOn( std::ostream & str, const Queue & obj ) - { - str << "Queue {"; - if ( ! obj.empty() ) - { - str << endl; - for_( it, obj.begin(), obj.end() ) - str << " " << Solvable(*it) << endl; - } - return str << "}"; - } - - bool operator==( const Queue & lhs, const Queue & rhs ) - { - const struct ::_Queue * l = lhs; - const struct ::_Queue * r = rhs; - return( l == r || ( l->count == r->count && ::memcmp( l->elements, r->elements, l->count ) == 0 ) ); - } - - } // namespace sat - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/Queue.h b/libzypp/zypp/sat/Queue.h deleted file mode 100644 index c8563b6..0000000 --- a/libzypp/zypp/sat/Queue.h +++ /dev/null @@ -1,142 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Queue.h - */ -#ifndef ZYPP_SAT_QUEUE_H -#define ZYPP_SAT_QUEUE_H - -extern "C" -{ - struct _Queue; -} -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/sat/detail/PoolMember.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace sat - { - class Queue; - typedef Queue SolvableQueue; ///< Queue with Solvable ids - typedef Queue StringQueue; ///< Queue with String ids - - /////////////////////////////////////////////////////////////////// - /// \class Queue - /// \brief Libsolv Id queue wrapper. - /// \todo template value_type to work with IString and other Id based types - /////////////////////////////////////////////////////////////////// - class Queue - { - public: - typedef unsigned size_type; - typedef detail::IdType value_type; - typedef const value_type* const_iterator; - - public: - /** Default ctor: empty Queue. */ - Queue(); - - /** Dtor */ - ~Queue(); - - bool empty() const; - size_type size() const; - const_iterator begin() const; - const_iterator end() const; - - /** Return iterator to the 1st occurance of \a val_r or \ref end. */ - const_iterator find( value_type val_r ) const; - - /** Return whether the Queue contais at lest one element with value \a val_r. */ - bool contains( value_type val_r ) const - { return( find( val_r ) != end() ); } - - /** Return the 1st Id in the queue or \c 0 if empty. */ - value_type first() const; - - /** Return the last Id in the queue or \c 0 if empty. */ - value_type last() const; - - /** Return the Id at \a idx_r in the queue - * \throws std::out_of_range if \a idx_r is out of range - */ - const value_type & at( size_type idx_r ) const; - - /** Return the Id at \a idx_r in the queue - * \throws std::out_of_range if \a idx_r is out of range - */ - value_type & at( size_type idx_r ); - - /** Return the Id at \a idx_r in the queue (no range check) */ - const value_type & operator[]( size_type idx_r ) const; - - /** Return the Id at \a idx_r in the queue (no range check) */ - value_type & operator[]( size_type idx_r ); - - /** Clear the queue. */ - void clear(); - - /** Remove all occurances of \a val_r from the queue. */ - void remove( value_type val_r ); - - /** Push a value to the end off the Queue. */ - void push( value_type val_r ); - /** \overload */ - void push_back( value_type val_r ) - { push( val_r ); } - - /** Push a value if it's not yet in the Queue. */ - void pushUnique( value_type val_r ); - - /** Pop and return the last Id from the queue or \c 0 if empty. */ - value_type pop(); - /** \overload */ - value_type pop_back() - { return pop(); } - - /** Push a value to the beginning off the Queue. */ - void push_front( value_type val_r ); - - /** Pop and return the 1st Id from the queue or \c 0 if empty. */ - value_type pop_front(); - - public: - operator struct ::_Queue *(); ///< libsolv backdoor - operator const struct ::_Queue *() const ///< libsolv backdoor - { return _pimpl.get(); } - private: - RWCOW_pointer _pimpl; ///< Pointer to implementation - }; - - /** \relates Queue Stream output */ - std::ostream & operator<<( std::ostream & str, const Queue & obj ); - - /** \relates Queue Stream output assuming a Solvable queue. */ - std::ostream & dumpOn( std::ostream & str, const Queue & obj ); - - /** \relates Queue */ - bool operator==( const Queue & lhs, const Queue & rhs ); - - /** \relates Queue */ - inline bool operator!=( const Queue & lhs, const Queue & rhs ) - { return !( lhs == rhs ); } - - } // namespace sat - /////////////////////////////////////////////////////////////////// - - /** \relates Queue Clone function for RWCOW_pointer */ - template<> struct ::_Queue * rwcowClone( const struct ::_Queue * rhs ); - -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_QUEUE_H diff --git a/libzypp/zypp/sat/SolvAttr.cc b/libzypp/zypp/sat/SolvAttr.cc deleted file mode 100644 index 0233959..0000000 --- a/libzypp/zypp/sat/SolvAttr.cc +++ /dev/null @@ -1,176 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/SolvAttr.cc - * -*/ -extern "C" -{ -#include -} - -#include - -#include "zypp/base/String.h" -#include "zypp/sat/SolvAttr.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -namespace sat -{ ///////////////////////////////////////////////////////////////// - - const SolvAttr SolvAttr::allAttr( detail::noId ); - const SolvAttr SolvAttr::noAttr; - -#warning STILL ATTRIBUTES HERE WHICH ARE NOT PROVIDED BY SOLV FILES -// At least the ones that do nat have a solv/knownid. - - const SolvAttr SolvAttr::name ( SOLVABLE_NAME ); - const SolvAttr SolvAttr::edition ( SOLVABLE_EVR ); - const SolvAttr SolvAttr::arch ( SOLVABLE_ARCH ); - const SolvAttr SolvAttr::vendor ( SOLVABLE_VENDOR ); - - const SolvAttr SolvAttr::provides ( SOLVABLE_PROVIDES ); - const SolvAttr SolvAttr::obsoletes ( SOLVABLE_OBSOLETES ); - const SolvAttr SolvAttr::conflicts ( SOLVABLE_CONFLICTS ); - const SolvAttr SolvAttr::requires ( SOLVABLE_REQUIRES ); - const SolvAttr SolvAttr::recommends ( SOLVABLE_RECOMMENDS ); - const SolvAttr SolvAttr::suggests ( SOLVABLE_SUGGESTS ); - const SolvAttr SolvAttr::supplements ( SOLVABLE_SUPPLEMENTS ); - const SolvAttr SolvAttr::enhances ( SOLVABLE_ENHANCES ); - - const SolvAttr SolvAttr::summary ( SOLVABLE_SUMMARY ); // translated - const SolvAttr SolvAttr::description ( SOLVABLE_DESCRIPTION ); // translated - const SolvAttr SolvAttr::insnotify ( SOLVABLE_MESSAGEINS ); // translated - const SolvAttr SolvAttr::delnotify ( SOLVABLE_MESSAGEDEL ); // translated - const SolvAttr SolvAttr::eula ( SOLVABLE_EULA ); // translated - const SolvAttr SolvAttr::cpeid ( SOLVABLE_CPEID ); - const SolvAttr SolvAttr::installtime ( SOLVABLE_INSTALLTIME ); - const SolvAttr SolvAttr::buildtime ( SOLVABLE_BUILDTIME ); - const SolvAttr SolvAttr::installsize ( SOLVABLE_INSTALLSIZE ); - const SolvAttr SolvAttr::downloadsize ( SOLVABLE_DOWNLOADSIZE ); - const SolvAttr SolvAttr::diskusage ( SOLVABLE_DISKUSAGE ); - - //package - const SolvAttr SolvAttr::checksum ( SOLVABLE_CHECKSUM ); - const SolvAttr SolvAttr::medianr ( SOLVABLE_MEDIANR ); - const SolvAttr SolvAttr::mediafile ( SOLVABLE_MEDIAFILE ); - const SolvAttr SolvAttr::mediadir ( SOLVABLE_MEDIADIR ); - const SolvAttr SolvAttr::changelog ( "changelog" ); - const SolvAttr SolvAttr::buildhost ( SOLVABLE_BUILDHOST ); - const SolvAttr SolvAttr::distribution ( SOLVABLE_DISTRIBUTION ); - const SolvAttr SolvAttr::license ( SOLVABLE_LICENSE ); - const SolvAttr SolvAttr::packager ( SOLVABLE_PACKAGER ); - const SolvAttr SolvAttr::group ( SOLVABLE_GROUP ); - const SolvAttr SolvAttr::keywords ( SOLVABLE_KEYWORDS ); - const SolvAttr SolvAttr::sourcesize ( "sourcesize" ); - const SolvAttr SolvAttr::authors ( SOLVABLE_AUTHORS ); - const SolvAttr SolvAttr::filelist ( SOLVABLE_FILELIST ); - const SolvAttr SolvAttr::sourcearch ( SOLVABLE_SOURCEARCH ); - const SolvAttr SolvAttr::sourcename ( SOLVABLE_SOURCENAME ); - const SolvAttr SolvAttr::sourceevr ( SOLVABLE_SOURCEEVR ); - const SolvAttr SolvAttr::headerend ( SOLVABLE_HEADEREND ); - const SolvAttr SolvAttr::url ( SOLVABLE_URL ); - - // patch - const SolvAttr SolvAttr::patchcategory ( SOLVABLE_PATCHCATEGORY ); - const SolvAttr SolvAttr::rebootSuggested ( UPDATE_REBOOT ); - const SolvAttr SolvAttr::restartSuggested ( UPDATE_RESTART ); - const SolvAttr SolvAttr::reloginSuggested ( UPDATE_RELOGIN ); - const SolvAttr SolvAttr::message ( UPDATE_MESSAGE ); - const SolvAttr SolvAttr::severity ( UPDATE_SEVERITY ); - const SolvAttr SolvAttr::updateCollection ( UPDATE_COLLECTION ); - const SolvAttr SolvAttr::updateCollectionName ( UPDATE_COLLECTION_NAME ); - const SolvAttr SolvAttr::updateCollectionEvr ( UPDATE_COLLECTION_EVR ); - const SolvAttr SolvAttr::updateCollectionArch ( UPDATE_COLLECTION_ARCH ); - const SolvAttr SolvAttr::updateCollectionFilename ( UPDATE_COLLECTION_FILENAME ); - const SolvAttr SolvAttr::updateCollectionFlags ( UPDATE_COLLECTION_FLAGS ); - const SolvAttr SolvAttr::updateReference ( UPDATE_REFERENCE ); - const SolvAttr SolvAttr::updateReferenceType ( UPDATE_REFERENCE_TYPE ); - const SolvAttr SolvAttr::updateReferenceHref ( UPDATE_REFERENCE_HREF ); - const SolvAttr SolvAttr::updateReferenceId ( UPDATE_REFERENCE_ID ); - const SolvAttr SolvAttr::updateReferenceTitle ( UPDATE_REFERENCE_TITLE ); - - //pattern - const SolvAttr SolvAttr::isvisible ( SOLVABLE_ISVISIBLE ); - const SolvAttr SolvAttr::icon ( SOLVABLE_ICON ); - const SolvAttr SolvAttr::order ( SOLVABLE_ORDER ); - const SolvAttr SolvAttr::isdefault ( "isdefault" ); - const SolvAttr SolvAttr::category ( SOLVABLE_CATEGORY ); // translated - const SolvAttr SolvAttr::script ( "script" ); - const SolvAttr SolvAttr::includes ( SOLVABLE_INCLUDES ); - const SolvAttr SolvAttr::extends ( SOLVABLE_EXTENDS ); - - // product - const SolvAttr SolvAttr::productReferenceFile ( PRODUCT_REFERENCEFILE ); - const SolvAttr SolvAttr::productProductLine ( PRODUCT_PRODUCTLINE ); - const SolvAttr SolvAttr::productShortlabel ( PRODUCT_SHORTLABEL ); - const SolvAttr SolvAttr::productDistproduct ( PRODUCT_DISTPRODUCT ); - const SolvAttr SolvAttr::productDistversion ( PRODUCT_DISTVERSION ); - const SolvAttr SolvAttr::productType ( PRODUCT_TYPE ); - const SolvAttr SolvAttr::productFlags ( PRODUCT_FLAGS ); - const SolvAttr SolvAttr::productEndOfLife ( PRODUCT_ENDOFLIFE ); - const SolvAttr SolvAttr::productRegisterTarget ( PRODUCT_REGISTER_TARGET ); - const SolvAttr SolvAttr::productRegisterRelease( PRODUCT_REGISTER_RELEASE ); - const SolvAttr SolvAttr::productRegisterFlavor ( PRODUCT_REGISTER_FLAVOR ); - const SolvAttr SolvAttr::productUrl ( PRODUCT_URL ); - const SolvAttr SolvAttr::productUrlType ( PRODUCT_URL_TYPE ); - /** array of repoids, hopefully label s too */ - const SolvAttr SolvAttr::productUpdates ( PRODUCT_UPDATES ); - const SolvAttr SolvAttr::productUpdatesRepoid ( PRODUCT_UPDATES_REPOID ); - - // repository - const SolvAttr SolvAttr::repositoryDeltaInfo ( REPOSITORY_DELTAINFO ); - const SolvAttr SolvAttr::repositoryAddedFileProvides ( REPOSITORY_ADDEDFILEPROVIDES ); - const SolvAttr SolvAttr::repositoryRpmDbCookie ( REPOSITORY_RPMDBCOOKIE ); - const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP ); - const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE ); - /** array of repositoryProductLabel repositoryProductCpeid pairs */ - const SolvAttr SolvAttr::repositoryUpdates ( REPOSITORY_UPDATES ); - /** array of repositoryProductLabel repositoryProductCpeid pairs */ - const SolvAttr SolvAttr::repositoryDistros ( REPOSITORY_DISTROS ); - const SolvAttr SolvAttr::repositoryProductLabel ( REPOSITORY_PRODUCT_LABEL ); - const SolvAttr SolvAttr::repositoryProductCpeid ( REPOSITORY_PRODUCT_CPEID ); - const SolvAttr SolvAttr::repositoryRepoid ( REPOSITORY_REPOID ); - const SolvAttr SolvAttr::repositoryKeywords ( REPOSITORY_KEYWORDS ); - const SolvAttr SolvAttr::repositoryRevision ( REPOSITORY_REVISION ); - const SolvAttr SolvAttr::repositoryToolVersion ( REPOSITORY_TOOLVERSION ); - - - - ///////////////////////////////////////////////////////////////// - - SolvAttr SolvAttr::parent() const - { - switch( id() ) - { - case UPDATE_COLLECTION_NAME: - case UPDATE_COLLECTION_EVR: - case UPDATE_COLLECTION_ARCH: - case UPDATE_COLLECTION_FILENAME: - case UPDATE_COLLECTION_FLAGS: - return updateCollection; - break; - - case UPDATE_REFERENCE_TYPE: - case UPDATE_REFERENCE_HREF: - case UPDATE_REFERENCE_ID: - case UPDATE_REFERENCE_TITLE: - return updateReference; - break; - } - return noAttr; - } - -} // namespace sat - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/SolvAttr.h b/libzypp/zypp/sat/SolvAttr.h deleted file mode 100644 index fed49d8..0000000 --- a/libzypp/zypp/sat/SolvAttr.h +++ /dev/null @@ -1,206 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/SolvAttr.h - * -*/ -#ifndef ZYPP_SAT_SOLVATTR_H -#define ZYPP_SAT_SOLVATTR_H - -#include -#include - -#include "zypp/base/String.h" -#include "zypp/IdStringType.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -namespace sat -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SolvAttr - // - /** Solvable attribute keys. - * - * Attributes associated with individual solvables, - * or with the repository as a whole. - * - * \note If you add well known subsructure attributes, update \ref parent. - * - * \see \ref LookupAttr - */ - class SolvAttr : public IdStringType - { - public: - /** \name Some builtin SolvAttr constants. */ - //@{ - /** Value to request searching all Attributes (0). */ - static const SolvAttr allAttr; - /** Value representing \c noAttr ("")*/ - static const SolvAttr noAttr; - - /** \name special solvable attributes which are part of the ::Solvable struct */ - //@{ - static const SolvAttr name; - static const SolvAttr edition; - static const SolvAttr arch; - static const SolvAttr vendor; - //@} - - /** \name dependency attributes */ - //@{ - static const SolvAttr provides; - static const SolvAttr obsoletes; - static const SolvAttr conflicts; - static const SolvAttr requires; - static const SolvAttr recommends; - static const SolvAttr suggests; - static const SolvAttr supplements; - static const SolvAttr enhances; - - /** \name common */ - //@{ - static const SolvAttr summary; - static const SolvAttr description; - static const SolvAttr insnotify; - static const SolvAttr delnotify; - static const SolvAttr eula; - static const SolvAttr installtime; - static const SolvAttr buildtime; - static const SolvAttr installsize; - static const SolvAttr downloadsize; - static const SolvAttr diskusage; - static const SolvAttr cpeid; - //@} - - /** \name package */ - //@{ - static const SolvAttr checksum; - static const SolvAttr mediadir; - static const SolvAttr medianr; - static const SolvAttr mediafile; - static const SolvAttr changelog; - static const SolvAttr buildhost; - static const SolvAttr distribution; - static const SolvAttr license; - static const SolvAttr packager; - static const SolvAttr group; - static const SolvAttr keywords; - static const SolvAttr sourcesize; - static const SolvAttr authors; - static const SolvAttr filelist; - static const SolvAttr sourcearch; - static const SolvAttr sourcename; - static const SolvAttr sourceevr; - static const SolvAttr headerend; - static const SolvAttr url; - //@} - - /** \name patch */ - //@{ - static const SolvAttr patchcategory; - static const SolvAttr rebootSuggested; - static const SolvAttr restartSuggested; - static const SolvAttr reloginSuggested; - static const SolvAttr message; - static const SolvAttr severity; - static const SolvAttr updateCollection; // SUB-STRUCTURE: - static const SolvAttr updateCollectionName; // name - static const SolvAttr updateCollectionEvr; // evr - static const SolvAttr updateCollectionArch; // arch - static const SolvAttr updateCollectionFilename; // filename - static const SolvAttr updateCollectionFlags; // flags - static const SolvAttr updateReference; // SUB-STRUCTURE: - static const SolvAttr updateReferenceType; // type - static const SolvAttr updateReferenceHref; // href - static const SolvAttr updateReferenceId; // id - static const SolvAttr updateReferenceTitle; // title - //@} - - /** \name pattern */ - //@{ - static const SolvAttr isvisible; - static const SolvAttr icon; - static const SolvAttr order; - static const SolvAttr isdefault; - static const SolvAttr category; - static const SolvAttr script; - static const SolvAttr includes; - static const SolvAttr extends; - //@} - - /** \name product */ - //@{ - static const SolvAttr productReferenceFile; - static const SolvAttr productProductLine; - static const SolvAttr productShortlabel; - static const SolvAttr productDistproduct; - static const SolvAttr productDistversion; - static const SolvAttr productType; - static const SolvAttr productFlags; - static const SolvAttr productEndOfLife; - static const SolvAttr productRegisterTarget; - static const SolvAttr productRegisterRelease; - static const SolvAttr productRegisterFlavor; - static const SolvAttr productUrl; - static const SolvAttr productUrlType; - static const SolvAttr productUpdates; // SUB-STRUCTURE: - static const SolvAttr productUpdatesRepoid; // repoid - //@} - - /** \name repository */ - //@{ - static const SolvAttr repositoryDeltaInfo; - static const SolvAttr repositoryAddedFileProvides; - static const SolvAttr repositoryRpmDbCookie; - static const SolvAttr repositoryTimestamp; - static const SolvAttr repositoryExpire; - static const SolvAttr repositoryUpdates; - static const SolvAttr repositoryDistros; - static const SolvAttr repositoryProductLabel; - static const SolvAttr repositoryProductCpeid; - static const SolvAttr repositoryRepoid; - static const SolvAttr repositoryKeywords; - static const SolvAttr repositoryRevision; - static const SolvAttr repositoryToolVersion; - //@} - - //@} - public: - /** Default ctor: \ref noAttr */ - SolvAttr() {} - - /** Ctor taking kind as string. */ - explicit SolvAttr( sat::detail::IdType id_r ) : _str( id_r ) {} - explicit SolvAttr( const IdString & idstr_r ) : _str( idstr_r ) {} - explicit SolvAttr( const std::string & str_r ) : _str( str_r ) {} - explicit SolvAttr( const char * cstr_r ) : _str( cstr_r ) {} - - /** Return the parent of well know sub-structure attributes (\ref SolvAttr::noAttr if none). - * \li \ref updateCollection - * \li \ref updateReference - */ - SolvAttr parent() const; - - /** Whether this is a well know sub-structure attribute. */ - bool hasParent() const - { return parent() != noAttr; } - - private: - friend class IdStringType; - IdString _str; - }; - - ///////////////////////////////////////////////////////////////// -} // namespace sat -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_sat_SolvAttr_H diff --git a/libzypp/zypp/sat/SolvIterMixin.cc b/libzypp/zypp/sat/SolvIterMixin.cc deleted file mode 100644 index 57bde4a..0000000 --- a/libzypp/zypp/sat/SolvIterMixin.cc +++ /dev/null @@ -1,69 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/SolvIterMixin.cc - * -*/ -//#include -//#include "zypp/base/Logger.h" - -#include "zypp/sat/SolvIterMixin.h" -#include "zypp/sat/Solvable.h" -#include "zypp/ResPoolProxy.h" -#include "zypp/pool/PoolTraits.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - namespace solvitermixin_detail - { - bool UnifyByIdent::operator()( const Solvable & solv_r ) const - { - // Need to use pool::ByIdent because packages and srcpackages have the same id. - return( solv_r && _uset->insert( pool::ByIdent( solv_r ).get() ).second ); - } - } - - /////////////////////////////////////////////////////////////////// - // asSolvable - /////////////////////////////////////////////////////////////////// - Solvable asSolvable::operator()( const PoolItem & pi_r ) const - { - return pi_r.satSolvable(); - } - - Solvable asSolvable::operator()( const ResObject_constPtr & res_r ) const - { - return res_r ? res_r->satSolvable() : Solvable(); - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - Selectable_Ptr asSelectable::operator()( const sat::Solvable & sov_r ) const - { - return ResPool::instance().proxy().lookup( sov_r ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/SolvIterMixin.h b/libzypp/zypp/sat/SolvIterMixin.h deleted file mode 100644 index 811d60e..0000000 --- a/libzypp/zypp/sat/SolvIterMixin.h +++ /dev/null @@ -1,209 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/SolvIterMixin.h - * -*/ -#ifndef ZYPP_SAT_SOLVITERMIXIN_H -#define ZYPP_SAT_SOLVITERMIXIN_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/Tr1hash.h" - -#include "zypp/sat/Solvable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class PoolItem; - class asPoolItem; // transform functor - - namespace ui - { - class asSelectable; // transform functor - } - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - class Solvable; - class asSolvable; // transform functor - - namespace solvitermixin_detail - { - /** Unify by \c ident \c (kind:name). - * Return true on the 1st appearance of a new \c ident. This is - * used in \ref SolvIterMixin when mapping a Solvable iterator - * to a Selectable iterator. - */ - struct UnifyByIdent - { - bool operator()( const Solvable & solv_r ) const; - - typedef std::tr1::unordered_set Uset; - UnifyByIdent() - : _uset( new Uset ) - {} - shared_ptr _uset; - }; - - - } // namespace solvitermixin_detail - - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SolvIterMixin - // - /** Base class providing common iterator types based on a \ref Solvable iterator. - * - * A class deriving from \ref SolvIterMixin must provide two methods - * \c begin and \c end returning iterator over \ref sat::Solvable. - * - * \ref SolvIterMixin will then provide iterators over the corresponding - * \ref PoolItem and \ref ui::Selectable_Ptr. - * - * \ref SolvIterMixin will also provide default implementations for \ref empty - * and \ref size by iterating from \c begin to \c end. In case \c Derived is - * able to provide a more efficient implementation, the methods should be overloaded. - * - * \note You will sometimes face the problem, that when using the \ref PoolItem - * iterator you hit multiple version of the same package, while when using the - * \ref ui::Selectable iterator the information which of the available candidates - * actually matched got lost. In this case class \ref PoolItemBest may help you. - * Use it to pick the best version only. - * - * \code - * namespace detail - * { - * class WhatProvidesIterator; - * } - * - * class WhatProvides : public SolvIterMixin - * { - * public: - * typedef detail::WhatProvidesIterator const_iterator; - * - * // Iterator pointing to the first Solvable. - * const_iterator begin() const; - * - * // Iterator pointing behind the last Solvable. - * const_iterator end() const; - * - * }; - * - * namespace detail - * { - * class WhatProvidesIterator : public boost::iterator_adaptor< - * WhatProvidesIterator // Derived - * , const detail::IdType * // Base - * , const Solvable // Value - * , boost::forward_traversal_tag // CategoryOrTraversal - * , const Solvable // Reference - * > - * { - * ... - * }; - * } - * \endcode - * \ingroup g_CRTP - */ - template - class SolvIterMixin - { - public: - typedef size_t size_type; - - public: - /** \name Convenience methods. - * In case \c Derived is able to provide a more efficient implementation, - * the methods should be overloaded. - */ - //@{ - /** Whether the collection is epmty. */ - bool empty() const - { return( self().begin() == self().end() ); } - - /** Size of the collection. */ - size_type size() const - { size_type s = 0; for_( it, self().begin(), self().end() ) ++s; return s;} - - /** Whether collection contains a specific \ref Solvable. */ - template - bool contains( const _Solv & solv_r ) const - { - Solvable solv( asSolvable()( solv_r ) ); - for_( it, self().begin(), self().end() ) - if ( *it == solv ) - return true; - return false; - } - //@} - - public: - /** \name Iterate as Solvable */ - //@{ - typedef DerivedSolvable_iterator Solvable_iterator; - Solvable_iterator solvableBegin() const - { return self().begin(); } - Solvable_iterator solvableEnd() const - { return self().end(); } - //@} - - /** \name Iterate as PoolItem */ - //@{ - typedef transform_iterator PoolItem_iterator; - PoolItem_iterator poolItemBegin() const - { return make_transform_iterator( solvableBegin(), asPoolItem() ); } - PoolItem_iterator poolItemEnd() const - { return make_transform_iterator( solvableEnd(), asPoolItem() ); } - //@} - - private: - typedef filter_iterator UnifiedSolvable_iterator; - public: - /** \name Iterate ui::Selectable::Ptr */ - //@{ - typedef transform_iterator Selectable_iterator; - Selectable_iterator selectableBegin() const - { return make_transform_iterator( unifiedSolvableBegin(), ui::asSelectable() ); } - Selectable_iterator selectableEnd() const - { return make_transform_iterator( unifiedSolvableEnd(), ui::asSelectable() ); } - //@} - - private: - /** \name Iterate unified Solbvables to be transformed into Selectable. */ - //@{ - UnifiedSolvable_iterator unifiedSolvableBegin() const - { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableBegin(), solvableEnd() ); } - UnifiedSolvable_iterator unifiedSolvableEnd() const - { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableEnd(), solvableEnd() );; } - //@} - private: - const Derived & self() const - { return *static_cast( this ); } - protected: - SolvIterMixin() {} - ~SolvIterMixin() {} - SolvIterMixin(const SolvIterMixin &) {} - void operator=(const SolvIterMixin &) {} - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_SOLVITERMIXIN_H diff --git a/libzypp/zypp/sat/Solvable.cc b/libzypp/zypp/sat/Solvable.cc deleted file mode 100644 index 0e84a0b..0000000 --- a/libzypp/zypp/sat/Solvable.cc +++ /dev/null @@ -1,657 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Solvable.cc - * -*/ -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Exception.h" -#include "zypp/base/Functional.h" -#include "zypp/base/Collector.h" -#include "zypp/base/Xml.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/Pool.h" -#include "zypp/sat/LookupAttr.h" - -#include "zypp/Repository.h" -#include "zypp/OnMediaLocation.h" -#include "zypp/ZConfig.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - namespace - { - void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name ) - { - if ( ! _ident ) - return; - - ResKind explicitKind = ResKind::explicitBuiltin( _ident.c_str() ); - // NOTE: kind package and srcpackage do not have namespaced ident! - if ( ! explicitKind ) - { - _name = _ident; - // No kind defaults to package - if ( !_kind ) - _kind = ResKind::package; - else if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) ) - _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) ); - } - else - { - // strip kind spec from name - _name = IdString( ::strchr( _ident.c_str(), ':' )+1 ); - _kind = explicitKind; - if ( _kind == ResKind::package || _kind == ResKind::srcpackage ) - _ident = _name; - } - return; - } - } - - Solvable::SplitIdent::SplitIdent( IdString ident_r ) - : _ident( ident_r ) - { _doSplit( _ident, _kind, _name ); } - - Solvable::SplitIdent::SplitIdent( const char * ident_r ) - : _ident( ident_r ) - { _doSplit( _ident, _kind, _name ); } - - Solvable::SplitIdent::SplitIdent( const std::string & ident_r ) - : _ident( ident_r ) - { _doSplit( _ident, _kind, _name ); } - - Solvable::SplitIdent::SplitIdent( ResKind kind_r, IdString name_r ) - : _ident( name_r ) - , _kind( kind_r ) - { _doSplit( _ident, _kind, _name ); } - - Solvable::SplitIdent::SplitIdent( ResKind kind_r, const C_Str & name_r ) - : _ident( name_r ) - , _kind( kind_r ) - { _doSplit( _ident, _kind, _name ); } - - ///////////////////////////////////////////////////////////////// - - const Solvable Solvable::noSolvable; - - ///////////////////////////////////////////////////////////////// - - ::_Solvable * Solvable::get() const - { return myPool().getSolvable( _id ); } - -#define NO_SOLVABLE_RETURN( VAL ) \ - ::_Solvable * _solvable( get() ); \ - if ( ! _solvable ) return VAL - - Solvable Solvable::nextInPool() const - { return Solvable( myPool().getNextId( _id ) ); } - - Solvable Solvable::nextInRepo() const - { - NO_SOLVABLE_RETURN( noSolvable ); - for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next ) - { - ::_Solvable * nextS( myPool().getSolvable( next ) ); - if ( nextS && nextS->repo == _solvable->repo ) - { - return Solvable( next ); - } - } - return noSolvable; - } - - Repository Solvable::repository() const - { - NO_SOLVABLE_RETURN( Repository::noRepository ); - return Repository( _solvable->repo ); - } - - bool Solvable::isSystem() const - { - NO_SOLVABLE_RETURN( _id == detail::systemSolvableId ); - return myPool().isSystemRepo( _solvable->repo ); - } - - bool Solvable::onSystemByUser() const - { - return isSystem() && myPool().isOnSystemByUser( ident() ); - } - - IdString Solvable::ident() const - { - NO_SOLVABLE_RETURN( IdString() ); - return IdString( _solvable->name ); - } - - std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const - { - NO_SOLVABLE_RETURN( std::string() ); - const char * s = ::solvable_lookup_str( _solvable, attr.id() ); - return s ? s : std::string(); - } - - std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const - { - NO_SOLVABLE_RETURN( std::string() ); - const char * s = 0; - if ( lang_r == Locale::noCode ) - { - s = ::solvable_lookup_str_poollang( _solvable, attr.id() ); - } - else - { - for ( Locale l( lang_r ); l != Locale::noCode; l = l.fallback() ) - if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.code().c_str(), 0 )) ) - return s; - // here: no matching locale, so use default - s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 ); - } - return s ? s : std::string(); - } - - unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const - { - NO_SOLVABLE_RETURN( 0 ); - return ::solvable_lookup_num( _solvable, attr.id(), 0 ); - } - - bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const - { - NO_SOLVABLE_RETURN( false ); - return ::solvable_lookup_bool( _solvable, attr.id() ); - } - - detail::IdType Solvable::lookupIdAttribute( const SolvAttr & attr ) const - { - NO_SOLVABLE_RETURN( detail::noId ); - return ::solvable_lookup_id( _solvable, attr.id() ); - } - - CheckSum Solvable::lookupCheckSumAttribute( const SolvAttr & attr ) const - { - NO_SOLVABLE_RETURN( CheckSum() ); - detail::IdType chksumtype = 0; - const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype ); - if ( ! s ) - return CheckSum(); - switch ( chksumtype ) - { - case REPOKEY_TYPE_MD5: return CheckSum::md5( s ); - case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s ); - case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s ); - } - return CheckSum( std::string(), s ); // try to autodetect - } - - /////////////////////////////////////////////////////////////////// - namespace - { - inline Pathname lookupDatadirIn( Repository repor_r ) - { - static const sat::SolvAttr susetagsDatadir( "susetags:datadir" ); - Pathname ret; - // First look for repo attribute "susetags:datadir". If not found, - // look into the solvables as Code11 libsolv placed it there. - sat::LookupRepoAttr datadir( susetagsDatadir, repor_r ); - if ( ! datadir.empty() ) - ret = datadir.begin().asString(); - else - { - sat::LookupAttr datadir( susetagsDatadir, repor_r ); - if ( ! datadir.empty() ) - ret = datadir.begin().asString(); - } - return ret; - } - } - /////////////////////////////////////////////////////////////////// - - OnMediaLocation Solvable::lookupLocation() const - { - NO_SOLVABLE_RETURN( OnMediaLocation() ); - // medianumber and path - unsigned medianr; - const char * file = ::solvable_lookup_location( _solvable, &medianr ); - if ( ! file ) - return OnMediaLocation(); - if ( ! medianr ) - medianr = 1; - - OnMediaLocation ret; - - Pathname path; - switch ( repository().info().type().toEnum() ) - { - case repo::RepoType::NONE_e: - { - path = lookupDatadirIn( repository() ); - if ( ! path.empty() ) - repository().info().setProbedType( repo::RepoType::YAST2_e ); - } - break; - - case repo::RepoType::YAST2_e: - { - path = lookupDatadirIn( repository() ); - if ( path.empty() ) - path = "suse"; - } - break; - - default: - break; - } - ret.setLocation ( path/file, medianr ); - ret.setDownloadSize( ByteCount( lookupNumAttribute( SolvAttr::downloadsize ) ) ); - ret.setChecksum ( lookupCheckSumAttribute( SolvAttr::checksum ) ); - // Not needed/available for solvables? - //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) ); - //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) ); - return ret; - } - - ResKind Solvable::kind() const - { - NO_SOLVABLE_RETURN( ResKind() ); - // detect srcpackages by 'arch' - switch ( _solvable->arch ) - { - case ARCH_SRC: - case ARCH_NOSRC: - return ResKind::srcpackage; - break; - } - - // either explicitly prefixed... - const char * ident = IdString( _solvable->name ).c_str(); - ResKind knownKind( ResKind::explicitBuiltin( ident ) ); - if ( knownKind ) - return knownKind; - - // ...or no ':' in package names (hopefully)... - const char * sep = ::strchr( ident, ':' ); - if ( ! sep ) - return ResKind::package; - - // ...or something unknown. - return ResKind( std::string( ident, sep-ident ) ); - } - - bool Solvable::isKind( const ResKind & kind_r ) const - { - NO_SOLVABLE_RETURN( false ); - - // detect srcpackages by 'arch' - switch ( _solvable->arch ) - { - case ARCH_SRC: - case ARCH_NOSRC: - return( kind_r == ResKind::srcpackage ); - break; - } - - // no ':' in package names (hopefully) - const char * ident = IdString( _solvable->name ).c_str(); - if ( kind_r == ResKind::package ) - { - return( ::strchr( ident, ':' ) == 0 ); - } - - // look for a 'kind:' prefix - const char * kind = kind_r.c_str(); - unsigned ksize = ::strlen( kind ); - return( ::strncmp( ident, kind, ksize ) == 0 - && ident[ksize] == ':' ); - } - - std::string Solvable::name() const - { - NO_SOLVABLE_RETURN( std::string() ); - const char * ident = IdString( _solvable->name ).c_str(); - const char * sep = ::strchr( ident, ':' ); - return( sep ? sep+1 : ident ); - } - - Edition Solvable::edition() const - { - NO_SOLVABLE_RETURN( Edition() ); - return Edition( _solvable->evr ); - } - - Arch Solvable::arch() const - { - NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() ); - switch ( _solvable->arch ) - { - case ARCH_SRC: - case ARCH_NOSRC: - return Arch_noarch; //ArchId( ARCH_NOARCH ); - break; - } - return Arch( IdString(_solvable->arch).asString() ); - //return ArchId( _solvable->arch ); - } - - bool Solvable::multiversionInstall() const - { - return myPool().isMultiversion( ident() ); - } - - IdString Solvable::vendor() const - { - NO_SOLVABLE_RETURN( IdString() ); - return IdString( _solvable->vendor ); - } - - Capabilities Solvable::operator[]( Dep which_r ) const - { - switch( which_r.inSwitch() ) - { - case Dep::PROVIDES_e: return provides(); break; - case Dep::REQUIRES_e: return requires(); break; - case Dep::CONFLICTS_e: return conflicts(); break; - case Dep::OBSOLETES_e: return obsoletes(); break; - case Dep::RECOMMENDS_e: return recommends(); break; - case Dep::SUGGESTS_e: return suggests(); break; - case Dep::ENHANCES_e: return enhances(); break; - case Dep::SUPPLEMENTS_e: return supplements(); break; - case Dep::PREREQUIRES_e: return prerequires(); break; - } - return Capabilities(); - } - - inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r ) - { - return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities(); - } - Capabilities Solvable::provides() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides ); - } - Capabilities Solvable::requires() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires ); - } - Capabilities Solvable::conflicts() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts ); - } - Capabilities Solvable::obsoletes() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes ); - } - Capabilities Solvable::recommends() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends ); - } - Capabilities Solvable::suggests() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests ); - } - Capabilities Solvable::enhances() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances ); - } - Capabilities Solvable::supplements() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements ); - } - Capabilities Solvable::prerequires() const - { - NO_SOLVABLE_RETURN( Capabilities() ); - // prerequires are a subset of requires - ::Offset offs = _solvable->requires; - return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker ) - : Capabilities(); - } - - CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const - { - NO_SOLVABLE_RETURN( CapabilitySet() ); - CapabilitySet ret; - Capabilities caps( provides() ); - for_( it, caps.begin(), caps.end() ) - { - CapDetail caprep( it->detail() ); - if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' ) - ret.insert( *it ); - } - return ret; - } - - CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const - { - NO_SOLVABLE_RETURN( CapabilitySet() ); - CapabilitySet ret; - Capabilities caps( provides() ); - for_( it, caps.begin(), caps.end() ) - { - CapDetail caprep( it->detail() ); - if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' ) - { - std::string value( caprep.name().c_str()+namespace_r.size()+1 ); - value[value.size()-1] = '\0'; // erase the trailing ')' - ret.insert( Capability( value, caprep.op(), caprep.ed() ) ); - } - } - return ret; - } - - - std::string Solvable::asString() const - { - NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") ); - return str::form( "%s-%s.%s", - IdString( _solvable->name ).c_str(), - IdString( _solvable->evr ).c_str(), - IdString( _solvable->arch ).c_str() ); - } - - std::string Solvable::asUserString() const\ - { - NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") ); - return str::form( "%s-%s.%s(%s)", - IdString( _solvable->name ).c_str(), - IdString( _solvable->evr ).c_str(), - IdString( _solvable->arch ).c_str(), - repository().asUserString().c_str() ); - } - - bool Solvable::identical( Solvable rhs ) const - { - NO_SOLVABLE_RETURN( ! rhs.get() ); - ::_Solvable * rhssolvable( rhs.get() ); - return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) ); - } - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - /** Expand \ref Capability and call \c fnc_r for each namescpace:language - * dependency. Return #invocations of fnc_r, negative if fnc_r returned - * false to indicate abort. - */ - int invokeOnEachSupportedLocale( Capability cap_r, function fnc_r ) - { - CapDetail detail( cap_r ); - if ( detail.kind() == CapDetail::EXPRESSION ) - { - switch ( detail.capRel() ) - { - case CapDetail::CAP_AND: - case CapDetail::CAP_OR: - // expand - { - int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r ); - if ( res < 0 ) - return res; // negative on abort. - int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r ); - if ( res2 < 0 ) - return -res + res2; // negative on abort. - return res + res2; - } - break; - - case CapDetail::CAP_NAMESPACE: - if ( detail.lhs().id() == NAMESPACE_LANGUAGE ) - { - return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort. - } - break; - - case CapDetail::REL_NONE: - case CapDetail::CAP_WITH: - case CapDetail::CAP_ARCH: - break; // unwanted - } - } - return 0; - } - - /** Expand \ref Capability and call \c fnc_r for each namescpace:language - * dependency. Return #invocations of fnc_r, negative if fnc_r returned - * false to indicate abort. - */ - inline int invokeOnEachSupportedLocale( Capabilities cap_r, function fnc_r ) - { - int cnt = 0; - for_( cit, cap_r.begin(), cap_r.end() ) - { - int res = invokeOnEachSupportedLocale( *cit, fnc_r ); - if ( res < 0 ) - return -cnt + res; // negative on abort. - cnt += res; - } - return cnt; - } - //@} - - // Functor returning false if a Locale is in the set. - struct NoMatchIn - { - NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {} - - bool operator()( const Locale & locale_r ) const - { - return _locales.find( locale_r ) == _locales.end(); - } - - const LocaleSet & _locales; - }; - - } ///////////////////////////////////////////////////////////////// - - bool Solvable::supportsLocales() const - { - // false_c stops on 1st Locale. - return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0; - } - - bool Solvable::supportsLocale( const Locale & locale_r ) const - { - // not_equal_to stops on == Locale. - return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to(), locale_r, _1 ) ) < 0; - } - - bool Solvable::supportsLocale( const LocaleSet & locales_r ) const - { - if ( locales_r.empty() ) - return false; - // NoMatchIn stops if Locale is included. - return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0; - } - - bool Solvable::supportsRequestedLocales() const - { return supportsLocale( myPool().getRequestedLocales() ); } - - void Solvable::getSupportedLocales( LocaleSet & locales_r ) const - { - invokeOnEachSupportedLocale( supplements(), - functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const Solvable & obj ) - { - if ( ! obj ) - return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" ); - - return str << "(" << obj.id() << ")" - << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident() - << '-' << obj.edition() << '.' << obj.arch() << "(" - << obj.repository().alias() << ")"; - } - - /****************************************************************** - ** - ** FUNCTION NAME : dumpOn - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & dumpOn( std::ostream & str, const Solvable & obj ) - { - str << obj; - if ( obj ) - { -#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X] - OUTS(PROVIDES); - OUTS(PREREQUIRES); - OUTS(REQUIRES); - OUTS(CONFLICTS); - OUTS(OBSOLETES); - OUTS(RECOMMENDS); - OUTS(SUGGESTS); - OUTS(ENHANCES); - OUTS(SUPPLEMENTS); -#undef OUTS - } - return str; - } - - std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj ) - { - xmlout::Node guard( str, "solvable" ); - - dumpAsXmlOn( *guard, obj.kind() ); - *xmlout::Node( *guard, "name" ) << obj.name(); - dumpAsXmlOn( *guard, obj.edition() ); - dumpAsXmlOn( *guard, obj.arch() ); - dumpAsXmlOn( *guard, obj.repository() ); - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/Solvable.h b/libzypp/zypp/sat/Solvable.h deleted file mode 100644 index ffefa01..0000000 --- a/libzypp/zypp/sat/Solvable.h +++ /dev/null @@ -1,411 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Solvable.h - * -*/ -#ifndef ZYPP_SAT_SOLVABLE_H -#define ZYPP_SAT_SOLVABLE_H - -#include - -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/SolvAttr.h" -#include "zypp/ResTraits.h" -#include "zypp/IdString.h" -#include "zypp/Edition.h" -#include "zypp/Arch.h" -#include "zypp/Dep.h" -#include "zypp/Capabilities.h" -#include "zypp/Capability.h" -#include "zypp/Locale.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class CheckSum; - class OnMediaLocation; - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Solvable - // - /** A \ref Solvable object within the sat \ref Pool. - * - * \note Unfortunately libsolv combines the objects kind and - * name in a single identifier \c "pattern:kde_multimedia", - * \b except for packages and source packes. They are not prefixed - * by any kind string. Instead the architecture is abused to store - * \c "src" and \c "nosrc" values. - * - * \ref Solvable will hide this inconsistency by treating source - * packages as an own kind of solvable and map their arch to - * \ref Arch_noarch. - */ - class Solvable : protected detail::PoolMember - { - public: - typedef sat::detail::SolvableIdType IdType; - - public: - /** Default ctor creates \ref noSolvable.*/ - Solvable() - : _id( detail::noSolvableId ) {} - - /** \ref PoolImpl ctor. */ - explicit Solvable( IdType id_r ) - : _id( id_r ) {} - - public: - /** Represents no \ref Solvable. */ - static const Solvable noSolvable; - - /** Evaluate \ref Solvable in a boolean context (\c != \c noSolvable). */ - explicit operator bool() const - { return get(); } - - /** Return whether this \ref Solvable belongs to the system repo. - * \note This includes the otherwise hidden systemSolvable. - */ - bool isSystem() const; - - /** Whether this is known to be installed on behalf of a user request. - * \note This is a hint guessed by evaluating an available install history. - * Returns \c false for non-system (uninstalled) solvables, or if no history - * is available. - */ - bool onSystemByUser() const; - - /** The \ref Repository this \ref Solvable belongs to. */ - Repository repository() const; - - public: - - /** \name Attribute lookup. - * \see \ref LookupAttr and \ref ArrayAttr providing a general, more - * query like interface for attribute retrieval. - */ - //@{ - /** - * returns the string attribute value for \ref attr - * or an empty string if it does not exists. - */ - std::string lookupStrAttribute( const SolvAttr & attr ) const; - /** \overload Trying to look up a translated string attribute. - * - * Returns the translation for \c lang_r. - * - * Passing an empty \ref Locale will return the string for the - * current default locale (\see \ref ZConfig::TextLocale), - * \b considering all fallback locales. - * - * Returns an empty string if no translation is available. - */ - std::string lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const; - - /** - * returns the numeric attribute value for \ref attr - * or 0 if it does not exists. - */ - unsigned long long lookupNumAttribute( const SolvAttr & attr ) const; - - /** - * returns the boolean attribute value for \ref attr - * or \c false if it does not exists. - */ - bool lookupBoolAttribute( const SolvAttr & attr ) const; - - /** - * returns the id attribute value for \ref attr - * or \ref detail::noId if it does not exists. - */ - detail::IdType lookupIdAttribute( const SolvAttr & attr ) const; - - /** - * returns the CheckSum attribute value for \ref attr - * or an empty CheckSum if ir does not exist. - */ - CheckSum lookupCheckSumAttribute( const SolvAttr & attr ) const; - - /** - * returns OnMediaLocation data: This is everything we need to - * download e.g. an rpm (path, checksum, downloadsize, etc.). - */ - OnMediaLocation lookupLocation() const; - - //@} - public: - /** The identifier. - * This is the solvables \ref name, \b except for packages and - * source packes, prefixed by it's \ref kind. - */ - IdString ident() const; - - ResKind kind() const; - /** Test whether a Solvable is of a certain \ref ResKind. - * The test is far cheaper than actually retriveing and - * comparing the \ref kind. - */ - bool isKind( const ResKind & kind_r ) const; - /** \overload */ - template - bool isKind() const - { return isKind( resKind<_Res>() ); } - /** \overload Extend the test to a range of \ref ResKind. */ - template - bool isKind( _Iterator begin, _Iterator end ) - { for_( it, begin, end ) if ( isKind( *it ) ) return true; return false; } - - std::string name() const; - Edition edition() const; - Arch arch() const; - - IdString vendor() const; - - /** Whether different versions of this package can be installed at the same time. - * Per default \c false. \see also \ref ZConfig::multiversion. - */ - bool multiversionInstall() const; - - /** String representation "ident-edition.arch" or \c "noSolvable" - * \code - * product:openSUSE-11.1.x86_64 - * autoyast2-2.16.19-0.1.src - * noSolvable - * \endcode - */ - std::string asString() const; - - /** String representation "ident-edition.arch(repo)" or \c "noSolvable" */ - std::string asUserString() const; - - /** Test whether two Solvables have the same content. - * Basically the same name, edition, arch, vendor and buildtime. - */ - bool identical( Solvable rhs ) const; - - /** Test for same name-version-release.arch */ - bool sameNVRA( Solvable rhs ) const - { return( ident() == rhs.ident() && edition() == rhs.edition() && arch() == rhs.arch() ); } - - public: - - /** \name Access to the \ref Solvable dependencies. - * - * \note Prerequires are a subset of requires. - */ - //@{ - Capabilities operator[]( Dep which_r ) const; - - Capabilities provides() const; - Capabilities requires() const; - Capabilities conflicts() const; - Capabilities obsoletes() const; - Capabilities recommends() const; - Capabilities suggests() const; - Capabilities enhances() const; - Capabilities supplements() const; - Capabilities prerequires() const; - - /** Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable. */ - CapabilitySet providesNamespace( const std::string & namespace_r ) const; - - /** Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'. - * Similar to \ref providesNamespace, but the namespace is stripped from the - * dependencies. This is convenient if the namespace denotes packages that - * should be looked up. E.g. the \c weakremover namespace used in a products - * release package denotes the packages that were dropped from the distribution. - * \see \ref Product::droplist - */ - CapabilitySet valuesOfNamespace( const std::string & namespace_r ) const; - //@} - - public: - /** \name Locale support. */ - //@{ - /** Whether this \c Solvable claims to support locales. */ - bool supportsLocales() const; - /** Whether this \c Solvable supports a specific \ref Locale. */ - bool supportsLocale( const Locale & locale_r ) const; - /** Whether this \c Solvable supports at least one of the specified locales. */ - bool supportsLocale( const LocaleSet & locales_r ) const; - /** Whether this \c Solvable supports at least one requested locale. - * \see \ref Pool::setRequestedLocales - */ - bool supportsRequestedLocales() const; - /** Return the supported locales via locales_r. */ - void getSupportedLocales( LocaleSet & locales_r ) const; - /** \overload */ - LocaleSet getSupportedLocales() const - { LocaleSet ret; getSupportedLocales( ret ); return ret; } - //@} - - public: - /** Return next Solvable in \ref Pool (or \ref noSolvable). */ - Solvable nextInPool() const; - /** Return next Solvable in \ref Repo (or \ref noSolvable). */ - Solvable nextInRepo() const; - - /** Helper that splits an identifier into kind and name or vice versa. - * \note In case \c name_r is preceded by a well known kind spec, the - * \c kind_r argument is ignored, and kind is derived from name. - * \see \ref ident - */ - class SplitIdent - { - public: - SplitIdent() {} - SplitIdent( IdString ident_r ); - SplitIdent( const char * ident_r ); - SplitIdent( const std::string & ident_r ); - SplitIdent( ResKind kind_r, IdString name_r ); - SplitIdent( ResKind kind_r, const C_Str & name_r ); - - IdString ident() const { return _ident; } - ResKind kind() const { return _kind; } - IdString name() const { return _name; } - - private: - IdString _ident; - ResKind _kind; - IdString _name; - }; - - public: - /** Expert backdoor. */ - ::_Solvable * get() const; - /** Expert backdoor. */ - IdType id() const { return _id; } - - private: - IdType _id; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Solvable Stream output */ - std::ostream & operator<<( std::ostream & str, const Solvable & obj ); - - /** \relates Solvable More verbose stream output including dependencies */ - std::ostream & dumpOn( std::ostream & str, const Solvable & obj ); - - /** \relates Solvable XML output */ - std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj ); - - /** \relates Solvable */ - inline bool operator==( const Solvable & lhs, const Solvable & rhs ) - { return lhs.get() == rhs.get(); } - - /** \relates Solvable */ - inline bool operator!=( const Solvable & lhs, const Solvable & rhs ) - { return lhs.get() != rhs.get(); } - - /** \relates Solvable */ - inline bool operator<( const Solvable & lhs, const Solvable & rhs ) - { return lhs.get() < rhs.get(); } - - /** \relates Solvable Test for same content. */ - inline bool identical( Solvable lhs, Solvable rhs ) - { return lhs.identical( rhs ); } - - /** \relates Solvable Test for same name version release and arch. */ - inline bool sameNVRA( Solvable lhs, Solvable rhs ) - { return lhs.sameNVRA( rhs ); } - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SolvableIterator - // - /** */ - class SolvableIterator : public boost::iterator_adaptor< - SolvableIterator // Derived - , ::_Solvable* // Base - , const Solvable // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , const Solvable // Reference - > - { - public: - SolvableIterator() - : SolvableIterator::iterator_adaptor_( 0 ) - {} - - explicit SolvableIterator( const Solvable & val_r ) - : SolvableIterator::iterator_adaptor_( 0 ) - { assignVal( val_r ); } - - explicit SolvableIterator( SolvableIdType id_r ) - : SolvableIterator::iterator_adaptor_( 0 ) - { assignVal( Solvable( id_r ) ); } - - private: - friend class boost::iterator_core_access; - - Solvable dereference() const - { return _val; } - - void increment() - { assignVal( _val.nextInPool() ); } - - private: - void assignVal( const Solvable & val_r ) - { _val = val_r; base_reference() = _val.get(); } - - Solvable _val; - }; - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - - /** \relates sat::Solvable Test whether a \ref sat::Solvable is of a certain Kind. */ - template - inline bool isKind( const sat::Solvable & solvable_r ) - { return solvable_r.isKind( ResTraits<_Res>::kind ); } - - class PoolItem; - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - /** To Solvable transform functor. - * \relates Solvable - * \relates sat::SolvIterMixin - */ - struct asSolvable - { - typedef Solvable result_type; - - Solvable operator()( Solvable solv_r ) const - { return solv_r; } - - Solvable operator()( const PoolItem & pi_r ) const; - - Solvable operator()( const ResObject_constPtr & res_r ) const; - }; - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -ZYPP_DEFINE_ID_HASHABLE( ::zypp::sat::Solvable ); - -#endif // ZYPP_SAT_SOLVABLE_H diff --git a/libzypp/zypp/sat/SolvableSet.cc b/libzypp/zypp/sat/SolvableSet.cc deleted file mode 100644 index 2834f3f..0000000 --- a/libzypp/zypp/sat/SolvableSet.cc +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/SolvableSet.cc - * -*/ -#include -#include "zypp/base/LogTools.h" - -#include "zypp/sat/SolvableSet.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const SolvableSet & obj ) - { - return dumpRange( str, obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/SolvableSet.h b/libzypp/zypp/sat/SolvableSet.h deleted file mode 100644 index daa8ebd..0000000 --- a/libzypp/zypp/sat/SolvableSet.h +++ /dev/null @@ -1,112 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/SolvableSet.h - * -*/ -#ifndef ZYPP_SAT_SOLVABLESET_H -#define ZYPP_SAT_SOLVABLESET_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Tr1hash.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/SolvIterMixin.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SolvableSet - // - /** Solvable set wrapper to allow adding additioanal convenience iterators. - */ - class SolvableSet : public SolvIterMixin::const_iterator> - { - friend std::ostream & operator<<( std::ostream & str, const SolvableSet & obj ); - - public: - typedef std::tr1::unordered_set Container; - typedef Container::value_type value_type; - typedef Container::size_type size_type; - typedef Solvable_iterator const_iterator; // from SolvIterMixin - - public: - /** Default ctor */ - SolvableSet() - : _pimpl( new Container ) - {} - - /** Ctor building a set from a range. */ - template - SolvableSet( _InputIterator begin_r, _InputIterator end_r ) - : _pimpl( new Container( begin_r, end_r ) ) - {} - - public: - /** Whether the set is epmty. */ - bool empty() const - { return _pimpl->empty(); } - - /** Size of the set. */ - size_type size() const - { return _pimpl->size(); } - - /** */ - template - bool contains( const _Solv & solv_r ) const - { return( get().find( asSolvable()( solv_r ) ) != end() ); } - - /** Iterator pointing to the first \ref Solvable. */ - const_iterator begin() const - { return _pimpl->begin(); } - - /** Iterator pointing behind the last \ref Solvable. */ - const_iterator end() const - { return _pimpl->end(); } - - public: - - /** Insert a Solvable. - * \return \c true if it was actually inserted, or \c false if already present. - */ - template - bool insert( const _Solv & solv_r ) - { return get().insert( asSolvable()( solv_r ) ).second; } - - public: - /** The set. */ - Container & get() - { return *_pimpl; } - - /** The set. */ - const Container & get() const - { return *_pimpl; } - - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates SolvableSet Stream output */ - std::ostream & operator<<( std::ostream & str, const SolvableSet & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_SOLVABLESET_H diff --git a/libzypp/zypp/sat/Transaction.cc b/libzypp/zypp/sat/Transaction.cc deleted file mode 100644 index 560c7b1..0000000 --- a/libzypp/zypp/sat/Transaction.cc +++ /dev/null @@ -1,471 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Transaction.cc - */ -extern "C" -{ -#include -#include -} -#include -#include "zypp/base/LogTools.h" -#include "zypp/base/SerialNumber.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/Tr1hash.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/sat/Transaction.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/Queue.h" -#include "zypp/sat/Map.h" -#include "zypp/ResPool.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /** Transaction implementation. - * - * \NOTE After commit the @System repo is reloaded. This invalidates - * the ids off all installed items in the transaction, including their - * stepType. Thats why some information (stepType, NVRA) is be stored - * for post mortem access (i.e. tell after commit which NVRA were deleted). - * - */ - struct Transaction::Impl : protected detail::PoolMember - , private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const Impl & obj ); - - public: - typedef std::tr1::unordered_set set_type; - typedef std::tr1::unordered_map map_type; - - struct PostMortem - { - PostMortem() - {} - PostMortem( const sat::Solvable & solv_r ) - : _ident( solv_r.ident() ) - , _edition( solv_r.edition() ) - , _arch( solv_r.arch() ) - {} - - IdString _ident; - Edition _edition; - Arch _arch; - }; - typedef std::tr1::unordered_map pmmap_type; - - public: - Impl() - : _trans( ::transaction_create( nullptr ) ) - { memset( _trans, 0, sizeof(*_trans) ); } - - Impl( LoadFromPoolType ) - : _watcher( myPool().serial() ) - , _trans( nullptr ) - { - Queue decisionq; - for_( it, ResPool::instance().begin(), ResPool::instance().end() ) - { - if ( ! (*it).status().transacts() ) - continue; - sat::Solvable solv( (*it).satSolvable() ); - decisionq.push( solv.isSystem() ? -solv.id() : solv.id() ); - } - Queue noobsq; - for_( it, sat::Pool::instance().multiversionBegin(), sat::Pool::instance().multiversionEnd() ) - { - noobsq.push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE_NAME ); - noobsq.push( it->id() ); - } - Map noobsmap; - ::solver_calculate_noobsmap( myPool().getPool(), noobsq, noobsmap ); - _trans = ::transaction_create_decisionq( myPool().getPool(), decisionq, noobsmap ); - - // NOTE: package/product buddies share the same ResStatus - // so we also link the buddies stepStages. This assumes - // only one buddy is acting during commit (package is installed, - // but no extra operation for the product). - for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count ) - { - sat::Solvable solv( *it ); - // buddy list: - if ( ! solv.isKind() ) - { - PoolItem pi( solv ); - if ( pi.buddy() ) - { - _linkMap[*it] = pi.buddy().id(); - } - } - if ( solv.isSystem() ) - { - // to delete list: - if ( stepType( solv ) == TRANSACTION_ERASE ) - { - _systemErase.insert( *it ); - } - // post mortem data - _pmMap[*it] = solv; - } - } - } - - ~Impl() - { ::transaction_free( _trans ); } - - public: - bool valid() const - { return _watcher.isClean( myPool().serial() ); } - - bool order() - { - if ( ! valid() ) - return false; - if ( empty() ) - return true; -#if 0 - // This is hwo we could implement out own order method. - // As ::transaction already groups by MediaNr, we don't - // need it for ORDER_BY_MEDIANR. - ::transaction_order( _trans, SOLVER_TRANSACTION_KEEP_ORDERDATA ); - detail::IdType chosen = 0; - Queue choices; - - while ( true ) - { - int ret = transaction_order_add_choices( _trans, chosen, choices ); - MIL << ret << ": " << chosen << ": " << choices << endl; - chosen = choices.pop_front(); // pick one out of choices - if ( ! chosen ) - break; - } - return true; -#endif - if ( !_ordered ) - { - ::transaction_order( _trans, 0 ); - _ordered = true; - } - return true; - } - - bool empty() const - { return( _trans->steps.count == 0 ); } - - size_t size() const - { return _trans->steps.count; } - - const_iterator begin( const RW_pointer & self_r ) const - { return const_iterator( self_r, _trans->steps.elements ); } - iterator begin( const RW_pointer & self_r ) - { return iterator( self_r, _trans->steps.elements ); } - - const_iterator end( const RW_pointer & self_r ) const - { return const_iterator( self_r, _trans->steps.elements + _trans->steps.count ); } - iterator end( const RW_pointer & self_r ) - { return iterator( self_r, _trans->steps.elements + _trans->steps.count ); } - - const_iterator find(const RW_pointer & self_r, const sat::Solvable & solv_r ) const - { detail::IdType * it( _find( solv_r ) ); return it ? const_iterator( self_r, it ) : end( self_r ); } - iterator find(const RW_pointer & self_r, const sat::Solvable & solv_r ) - { detail::IdType * it( _find( solv_r ) ); return it ? iterator( self_r, it ) : end( self_r ); } - - public: - int installedResult( Queue & result_r ) const - { return ::transaction_installedresult( _trans, result_r ); } - - StringQueue autoInstalled() const - { return _autoInstalled; } - - void autoInstalled( const StringQueue & queue_r ) - { _autoInstalled = queue_r; } - - public: - StepType stepType( Solvable solv_r ) const - { - if ( ! solv_r ) - { - // post mortem @System solvable - return isIn( _systemErase, solv_r.id() ) ? TRANSACTION_ERASE : TRANSACTION_IGNORE; - } - - switch( ::transaction_type( _trans, solv_r.id(), SOLVER_TRANSACTION_RPM_ONLY ) ) - { - case SOLVER_TRANSACTION_ERASE: return TRANSACTION_ERASE; break; - case SOLVER_TRANSACTION_INSTALL: return TRANSACTION_INSTALL; break; - case SOLVER_TRANSACTION_MULTIINSTALL: return TRANSACTION_MULTIINSTALL; break; - } - return TRANSACTION_IGNORE; - } - - StepStage stepStage( Solvable solv_r ) const - { return stepStage( resolve( solv_r ) ); } - - void stepStage( Solvable solv_r, StepStage newval_r ) - { stepStage( resolve( solv_r ), newval_r ); } - - const PostMortem & pmdata( Solvable solv_r ) const - { - static PostMortem _none; - pmmap_type::const_iterator it( _pmMap.find( solv_r.id() ) ); - return( it == _pmMap.end() ? _none : it->second ); - } - - private: - detail::IdType resolve( const Solvable & solv_r ) const - { - map_type::const_iterator res( _linkMap.find( solv_r.id() ) ); - return( res == _linkMap.end() ? solv_r.id() : res->second ); - } - - bool isIn( const set_type & set_r, detail::IdType sid_r ) const - { return( set_r.find( sid_r ) != set_r.end() ); } - - StepStage stepStage( detail::IdType sid_r ) const - { - if ( isIn( _doneSet, sid_r ) ) - return STEP_DONE; - if ( isIn( _errSet, sid_r ) ) - return STEP_ERROR; - return STEP_TODO; - } - - void stepStage( detail::IdType sid_r, StepStage newval_r ) - { - StepStage stage( stepStage( sid_r ) ); - if ( stage != newval_r ) - { - // reset old stage - if ( stage != STEP_TODO ) - { - (stage == STEP_DONE ? _doneSet : _errSet).erase( sid_r ); - } - if ( newval_r != STEP_TODO ) - { - (newval_r == STEP_DONE ? _doneSet : _errSet).insert( sid_r ); - } - } - } - - private: - detail::IdType * _find( const sat::Solvable & solv_r ) const - { - if ( solv_r && _trans->steps.elements ) - { - for_( it, _trans->steps.elements, _trans->steps.elements + _trans->steps.count ) - { - if ( *it == detail::IdType(solv_r.id()) ) - return it; - } - } - return 0; - } - - private: - SerialNumberWatcher _watcher; - mutable ::Transaction * _trans; - DefaultIntegral _ordered; - // - set_type _doneSet; - set_type _errSet; - map_type _linkMap; // buddy map to adopt buddies StepResult - set_type _systemErase; // @System packages to be eased (otherse are TRANSACTION_IGNORE) - pmmap_type _pmMap; // Post mortem data of deleted @System solvables - - StringQueue _autoInstalled; // ident strings of all packages that would be auto-installed after the transaction is run. - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - }; - - /** \relates Transaction::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Transaction::Impl & obj ) - { - return str << "Transaction: " << obj.size() << " (" << (obj.valid()?"valid":"INVALID") << ")"; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Transaction - // - /////////////////////////////////////////////////////////////////// - - Transaction::Transaction() - : _pimpl( Impl::nullimpl() ) - {} - - Transaction::Transaction( LoadFromPoolType ) - : _pimpl( new Impl( loadFromPool ) ) - {} - - Transaction::~Transaction() - {} - - bool Transaction::valid() const - { return _pimpl->valid(); } - - bool Transaction::order() - { return _pimpl->order(); } - - bool Transaction::empty() const - { return _pimpl->empty(); } - - size_t Transaction::size() const - { return _pimpl->size(); } - - Transaction::const_iterator Transaction::begin() const - { return _pimpl->begin( _pimpl ); } - - Transaction::iterator Transaction::begin() - { return _pimpl->begin( _pimpl ); } - - Transaction::const_iterator Transaction::end() const - { return _pimpl->end( _pimpl ); } - - Transaction::iterator Transaction::end() - { return _pimpl->end( _pimpl ); } - - Transaction::const_iterator Transaction::find( const sat::Solvable & solv_r ) const - { return _pimpl->find( _pimpl, solv_r ); } - - Transaction::iterator Transaction::find( const sat::Solvable & solv_r ) - { return _pimpl->find( _pimpl, solv_r ); } - - int Transaction::installedResult( Queue & result_r ) const - { return _pimpl->installedResult( result_r ); } - - StringQueue Transaction::autoInstalled() const - { return _pimpl->autoInstalled(); } - - void Transaction::autoInstalled( const StringQueue & queue_r ) - { _pimpl->autoInstalled( queue_r ); } - - std::ostream & operator<<( std::ostream & str, const Transaction & obj ) - { return str << *obj._pimpl; } - - std::ostream & dumpOn( std::ostream & str, const Transaction & obj ) - { - for_( it, obj.begin(), obj.end() ) - { - str << *it << endl; - } - return str; - } - - bool operator==( const Transaction & lhs, const Transaction & rhs ) - { return lhs._pimpl == rhs._pimpl; } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Transaction::Step - // - /////////////////////////////////////////////////////////////////// - - Transaction::Step::Step() - {} - - Transaction::StepType Transaction::Step::stepType() const - { return _pimpl->stepType( _solv ); } - - Transaction::StepStage Transaction::Step::stepStage() const - { return _pimpl->stepStage( _solv ); } - - void Transaction::Step::stepStage( StepStage val_r ) - { _pimpl->stepStage( _solv, val_r ); } - - IdString Transaction::Step::ident() const - { return _solv ? _solv.ident() : _pimpl->pmdata(_solv )._ident; } - - Edition Transaction::Step::edition() const - { return _solv ? _solv.edition() : _pimpl->pmdata(_solv )._edition; } - - Arch Transaction::Step::arch() const - { return _solv ? _solv.arch() : _pimpl->pmdata(_solv )._arch; } - - std::ostream & operator<<( std::ostream & str, const Transaction::Step & obj ) - { - str << obj.stepType() << obj.stepStage() << " "; - if ( obj.satSolvable() ) - str << PoolItem( obj.satSolvable() ); - else - str << '[' << obj.ident() << '-' << obj.edition() << '.' << obj.arch() << ']'; - return str; - } - - std::ostream & operator<<( std::ostream & str, Transaction::StepType obj ) - { - switch ( obj ) - { - #define OUTS(E,S) case Transaction::E: return str << #S; break - OUTS( TRANSACTION_IGNORE, [ ] ); - OUTS( TRANSACTION_ERASE, [-] ); - OUTS( TRANSACTION_INSTALL, [+] ); - OUTS( TRANSACTION_MULTIINSTALL, [M] ); - #undef OUTS - } - return str << "[?]"; - } - - std::ostream & operator<<( std::ostream & str, Transaction::StepStage obj ) - { - switch ( obj ) - { - #define OUTS(E,S) case Transaction::E: return str << #S; break - OUTS( STEP_TODO, [__] ); - OUTS( STEP_DONE, [OK] ); - OUTS( STEP_ERROR, [**] ); - #undef OUTS - } - return str << "[??]"; - } - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Transaction::const_iterator/iterator - // - /////////////////////////////////////////////////////////////////// - - Transaction_const_iterator::Transaction_const_iterator() - : Transaction_const_iterator::iterator_adaptor_( 0 ) - {} - - Transaction_const_iterator::Transaction_const_iterator( const Transaction_iterator & iter_r ) - : Transaction_const_iterator::iterator_adaptor_( iter_r.base() ) - , _pimpl( iter_r._pimpl ) - {} - - Transaction_iterator::Transaction_iterator() - : Transaction_iterator::iterator_adaptor_( 0 ) - {} - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/Transaction.h b/libzypp/zypp/sat/Transaction.h deleted file mode 100644 index fcb843f..0000000 --- a/libzypp/zypp/sat/Transaction.h +++ /dev/null @@ -1,405 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/Transaction.h - */ -extern "C" -{ - struct _Transaction; -} -#ifndef ZYPP_SAT_TRANSACTION_H -#define ZYPP_SAT_TRANSACTION_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Flags.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/DefaultIntegral.h" - -#include "zypp/sat/SolvIterMixin.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/Queue.h" - -#include "zypp/PoolItem.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - namespace detail - { - /** Needs to be outside \ref Transaction in order to be usable in SolvIterMixin. */ - class Transaction_iterator; - /** Needs to be outside \ref Transaction in order to be usable in SolvIterMixin. */ - class Transaction_const_iterator; - } - - /** Libsolv transaction wrapper. - * \note Note that Transaction is derived from \ref sat::SolvIterMixin which - * makes PoolItem and Selectable iterators automatically available. - * \note Changing the \ref ResPool content (loading/unloading repositories) - * invalidates all outstanding transaction data. \see \ref valid. - * \note.The transaction may inlude steps of type \ref TRANSACTION_IGNORE which - * do not cause/require any specific action. To skip those informal steps - * when iterating, use the \ref actionBegin /\ref actionEnd methods. - */ - class Transaction : public SolvIterMixin - { - friend std::ostream & operator<<( std::ostream & str, const Transaction & obj ); - friend std::ostream & dumpOn( std::ostream & str, const Transaction & obj ); - friend bool operator==( const Transaction & lhs, const Transaction & rhs ); - - public: - /** Represents a single step within a \ref Transaction. */ - class Step; - - /** Type of (rpm) action to perform in a \ref Step. */ - enum StepType - { - TRANSACTION_IGNORE = 0x00, /**< [ ] Nothing (includes implicit deletes due to obsoletes and non-package actions) */ - TRANSACTION_ERASE = 0x10, /**< [-] Delete item */ - TRANSACTION_INSTALL = 0x20, /**< [+] Install(update) item */ - TRANSACTION_MULTIINSTALL = 0x30 /**< [M] Install(multiversion) item (\see \ref ZConfig::multiversion) */ - }; - - /** \ref Step action result. */ - enum StepStage - { - STEP_TODO = (1 << 0), /**< [__] unprocessed */ - STEP_DONE = (1 << 1), /**< [OK] success */ - STEP_ERROR = (1 << 2), /**< [**] error */ - }; - - ZYPP_DECLARE_FLAGS(StepStages,StepStage); - - public: - struct LoadFromPoolType {}; ///< Ctor arg type - static constexpr LoadFromPoolType loadFromPool = LoadFromPoolType(); - - public: - /** Default ctor: empty transaction. */ - Transaction(); - - /** Ctor loading the default pools transaction. */ - Transaction( LoadFromPoolType ); - - /** Dtor */ - ~Transaction(); - - public: - /** Whether transaction actually contains data and also fits the current pools content. */ - bool valid() const; - - /** Validate object in a boolean context: valid */ - explicit operator bool() const - { return valid(); } - - /** Order transaction steps for commit. - * It's cheap to call it for an aleready ordered \ref Transaction. - * This invalidates outstanding iterators. Returns whether - * \ref Transaction is \ref valid. - */ - bool order(); - - /** Whether the transaction contains any steps. */ - bool empty() const; - - /** Number of steps in transaction steps. */ - size_t size() const; - - typedef detail::Transaction_iterator iterator; - typedef detail::Transaction_const_iterator const_iterator; - - /** Iterator to the first \ref TransactionStep */ - const_iterator begin() const; - /** \overload */ - iterator begin(); - - /** Iterator behind the last \ref TransactionStep */ - const_iterator end() const; - /** \overload */ - iterator end(); - - /** Return iterator pointing to \a solv_r or \ref end. */ - const_iterator find( const sat::Solvable & solv_r ) const; - iterator find( const sat::Solvable & solv_r ); - /** \overload */ - const_iterator find( const ResObject::constPtr & resolvable_r ) const; - iterator find( const ResObject::constPtr & resolvable_r ); - /** \overload */ - const_iterator find( const PoolItem & pi_r ) const; - iterator find( const PoolItem & pi_r ); - - public: - /** \name Iterate action steps (omit TRANSACTION_IGNORE steps). - * - * All these methods allow to pass an optional OR'd combination of - * \ref StepStages as filter. Per default all steps are processed/counted. - * - * \code - * Transaction trans; - * for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() ) - * { - * ... // process all steps not DONE (ERROR and TODO) - * } - * \endcode - */ - //@{ - struct FilterAction; - typedef filter_iterator action_iterator; - - /** Whether the [filtered] transaction contains any steps . */ - bool actionEmpty( StepStages filter_r = StepStages() ) const; - - /** Number of steps in [filtered] transaction steps. */ - size_t actionSize( StepStages filter_r = StepStages() ) const; - - /** Pointer to the 1st action step in [filtered] transaction. */ - action_iterator actionBegin( StepStages filter_r = StepStages() ) const; - - /** Pointer behind the last action step in transaction. */ - action_iterator actionEnd() const; - - //@} - - public: - /** Return all packages that would be installed after the transaction is run. - * The new packages are put at the head of the queue, the number of new - * packages is returned. (wraps libsolv::transaction_installedresult) */ - int installedResult( Queue & result_r ) const; - - /** Return the ident strings of all packages that would be auto-installed after the transaction is run. */ - StringQueue autoInstalled() const; - - /** Set the ident strings of all packages that would be auto-installed after the transaction is run. */ - void autoInstalled( const StringQueue & queue_r ); - - public: - /** Implementation */ - class Impl; - private: - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - - ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Transaction::StepStages); - - /** \relates Transaction Stream output */ - std::ostream & operator<<( std::ostream & str, const Transaction & obj ); - - /** \relates Transaction Verbose stream output */ - std::ostream & dumpOn( std::ostream & str, const Transaction & obj ); - - /** \relates Transaction */ - bool operator==( const Transaction & lhs, const Transaction & rhs ); - - /** \relates Transaction */ - inline bool operator!=( const Transaction & lhs, const Transaction & rhs ) - { return !( lhs == rhs ); } - - - /** A single step within a \ref Transaction. - * - * \note After commit, when the @System repo (rpm database) is reread, all - * @System solvables within the transaction are invalidated (they got deleted). - * Thats why we internally store the NVRA, so you can access \ref ident - * (\see \ref sat::Solvable::ident), \ref edition, \ref arch of a deleted package, - * even if the \ref satSolvable itself is meanwhile invalid. - * - * \see \ref Transaction. - */ - class Transaction::Step - { - friend std::ostream & operator<<( std::ostream & str, const Step & obj ); - - public: - Step(); - Step( const RW_pointer & pimpl_r, detail::IdType id_r ) - : _solv( id_r ) - , _pimpl( pimpl_r ) - {} - - public: - /** Type of action to perform in this step. */ - StepType stepType() const; - - /** Step action result. */ - StepStage stepStage() const; - - /** Set step action result. */ - void stepStage( StepStage val_r ); - - /** Return the corresponding \ref Solvable. - * Returns \ref Solvable::noSolvable if the item is meanwhile deleted and - * was removed from the pool. \see Post mortem acccess to @System solvables. - */ - Solvable satSolvable() const - { return _solv; } - - /** \name Post mortem acccess to @System solvables - * \code - * Transaction::Step step; - * if ( step.satSolvable() ) - * std::cout << step.satSolvable() << endl; - * else - * std::cout << step.ident() << endl; // deleted @System solvable - * \endcode - */ - //@{ - /** \see \ref sat::Solvable::ident. */ - IdString ident() const; - - /** \see \ref sat::Solvable::edition. */ - Edition edition() const; - - /** \see \ref sat::Solvable::arch. */ - Arch arch() const; - //@} - - /** Implicit conversion to \ref Solvable */ - operator const Solvable &() const { return _solv; } - /** \overload nonconst */ - operator Solvable &() { return _solv; } - - private: - Solvable _solv; - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - - /** \relates Transaction::Step Stream output */ - std::ostream & operator<<( std::ostream & str, const Transaction::Step & obj ); - - /** \relates Transaction::StepType Stream output */ - std::ostream & operator<<( std::ostream & str, Transaction::StepType obj ); - - /** \relates Transaction::StepStage Stream output */ - std::ostream & operator<<( std::ostream & str, Transaction::StepStage obj ); - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - /** \ref Transaction iterator. - */ - class Transaction_iterator : public boost::iterator_adaptor< - Transaction_iterator // Derived - , const detail::IdType * // Base - , Transaction::Step // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , Transaction::Step // Reference - > - { - public: - Transaction_iterator(); - Transaction_iterator( const RW_pointer & pimpl_r, base_type id_r ) - : Transaction_iterator::iterator_adaptor_( id_r ) - , _pimpl( pimpl_r ) - {} - - private: - friend class boost::iterator_core_access; - - reference dereference() const - { return Transaction::Step( _pimpl, *base() ); } - - private: - friend class Transaction_const_iterator; - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - - /** \ref Transaction const_iterator. - */ - class Transaction_const_iterator : public boost::iterator_adaptor< - Transaction_const_iterator // Derived - , const detail::IdType * // Base - , const Transaction::Step // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , const Transaction::Step // Reference - > - { - public: - Transaction_const_iterator(); - Transaction_const_iterator( const Transaction_iterator & iter_r ); - Transaction_const_iterator( const RW_pointer & pimpl_r, base_type id_r ) - : Transaction_const_iterator::iterator_adaptor_( id_r ) - , _pimpl( pimpl_r ) - {} - - private: - friend class boost::iterator_core_access; - - reference dereference() const - { return Transaction::Step( _pimpl, *base() ); } - - private: - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - - inline Transaction::const_iterator Transaction::find( const ResObject::constPtr & resolvable_r ) const - { return( resolvable_r ? find( resolvable_r->satSolvable() ) : end() ); } - - inline Transaction::iterator Transaction::find( const ResObject::constPtr & resolvable_r ) - { return( resolvable_r ? find( resolvable_r->satSolvable() ) : end() ); } - - inline Transaction::const_iterator Transaction::find( const PoolItem & pi_r ) const - { return find( pi_r.satSolvable() ); } - - inline Transaction::iterator Transaction::find( const PoolItem & pi_r ) - { return find( pi_r.satSolvable() ); } - - - struct Transaction::FilterAction - { - FilterAction() {} - FilterAction( StepStages filter_r ) : _filter( filter_r ) {} - - bool operator()( const Transaction::Step & step_r ) const - { - if ( step_r.stepType() == Transaction::TRANSACTION_IGNORE ) - return false; // no action - return !_filter || _filter.testFlag( step_r.stepStage() ); - } - - StepStages _filter; - }; - - inline Transaction::action_iterator Transaction::actionBegin( StepStages filter_r ) const - { return make_filter_begin( FilterAction( filter_r ), *this ); } - - inline Transaction::action_iterator Transaction::actionEnd() const - { return make_filter_end( FilterAction(), *this ); } - - inline bool Transaction::actionEmpty( StepStages filter_r ) const - { return( actionBegin( filter_r ) == actionEnd() ); } - - inline size_t Transaction::actionSize( StepStages filter_r ) const - { - size_t cnt = 0; - for_( it, actionBegin( filter_r ), actionEnd() ) - ++cnt; - return cnt; - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_TRANSACTION_H diff --git a/libzypp/zypp/sat/WhatObsoletes.cc b/libzypp/zypp/sat/WhatObsoletes.cc deleted file mode 100644 index 52679fb..0000000 --- a/libzypp/zypp/sat/WhatObsoletes.cc +++ /dev/null @@ -1,176 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/WhatObsoletes.cc - * -*/ -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Tr1hash.h" -#include "zypp/sat/WhatObsoletes.h" -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/PoolItem.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - // Obsoletes may either match against provides, or names. - // Configuration depends on the behaviour of rpm. -#ifdef _RPM_5 - bool obsoleteUsesProvides = true; -#else - bool obsoleteUsesProvides = false; -#endif - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - typedef std::tr1::unordered_set set_type; - typedef std::vector vector_type; - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - WhatObsoletes::WhatObsoletes( Solvable item_r ) - : _begin( 0 ) - { - ctorAdd( item_r ); - ctorDone(); - } - - WhatObsoletes::WhatObsoletes( const PoolItem & item_r ) - : _begin( 0 ) - { - ctorAdd( item_r ); - ctorDone(); - } - - WhatObsoletes::WhatObsoletes( const ResObject::constPtr item_r ) - : _begin( 0 ) - { - if ( item_r ) - { - ctorAdd( item_r->satSolvable() ); - ctorDone(); - } - } - - void WhatObsoletes::ctorAdd( const PoolItem & item_r ) - { ctorAdd( item_r->satSolvable() ); } - - void WhatObsoletes::ctorAdd( ResObject_constPtr item_r ) - { if ( item_r ) ctorAdd( item_r->satSolvable() ); } - - - namespace - { - /** Add item to the set created on demand. */ - inline void addToSet( Solvable item, set_type *& pdata, shared_ptr& _private ) - { - if ( ! pdata ) - { - _private.reset( (pdata = new set_type) ); - } - pdata->insert( item.id() ); - } - } - - void WhatObsoletes::ctorAdd( Solvable item_r ) - { - if ( item_r.multiversionInstall() ) - return; // multiversion (rpm -i) does not evaluate any obsoletes - - if ( obsoleteUsesProvides ) - { - WhatProvides obsoleted( item_r.obsoletes() ); - if ( obsoleted.empty() ) - return; - - // use allocated private data to collect the results - set_type * pdata = ( _private ? reinterpret_cast( _private.get() ) : 0 ); - for_( it, obsoleted.begin(), obsoleted.end() ) - { - if ( it->isSystem() ) - addToSet( *it, pdata, _private ); - } - } - else // Obsoletes match names - { - Capabilities obsoletes( item_r.obsoletes() ); - if ( obsoletes.empty() ) - return; - - // use allocated private data to collect the results - set_type * pdata = ( _private ? reinterpret_cast( _private.get() ) : 0 ); - for_( it, obsoletes.begin(), obsoletes.end() ) - { - // For each obsoletes find providers, but with the same name - IdString ident( it->detail().name() ); - WhatProvides obsoleted( *it ); - for_( iit, obsoleted.begin(), obsoleted.end() ) - { - if ( iit->isSystem() && iit->ident() == ident ) - addToSet( *iit, pdata, _private ); - } - } - } - } - - void WhatObsoletes::ctorDone() - { - if ( _private ) - { - // copy set to vector and terminate _private - set_type * sdata = reinterpret_cast( _private.get() ); - - vector_type * pdata = new vector_type( sdata->begin(), sdata->end() ); - pdata->push_back( sat::detail::noId ); - _begin = &pdata->front(); - - _private.reset( pdata ); - } - } - - WhatObsoletes::size_type WhatObsoletes::size() const - { - if ( ! _begin ) - return 0; - - Capabilities::size_type ret = 0; - for ( const sat::detail::IdType * end = _begin; *end; ++end ) - { - ++ret; - } - return ret; - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const WhatObsoletes & obj ) - { - return dumpRange( str << "(" << obj.size() << ")", obj.begin(), obj.end() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/WhatObsoletes.h b/libzypp/zypp/sat/WhatObsoletes.h deleted file mode 100644 index f34efd7..0000000 --- a/libzypp/zypp/sat/WhatObsoletes.h +++ /dev/null @@ -1,111 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/WhatObsoletes.h - * -*/ -#ifndef ZYPP_SAT_WHATOBSOLETES_H -#define ZYPP_SAT_WHATOBSOLETES_H - -#include -#include - -#include "zypp/sat/WhatProvides.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WhatObsoletes - // - /** Container of \b installed \ref Solvable which would be - * obsoleted by the \ref Solvable passed to the ctor. - * - * \todo Publish obsoleteUsesProvides config option. - */ - class WhatObsoletes : public SolvIterMixin, - protected detail::PoolMember - { - public: - typedef Solvable value_type; - typedef unsigned size_type; - - public: - /** Default ctor */ - WhatObsoletes() - : _begin( 0 ) - {} - - /** Ctor from \ref Solvable. */ - explicit - WhatObsoletes( Solvable item_r ); - - /** Ctor from \ref PoolItem. */ - explicit - WhatObsoletes( const PoolItem & item_r ); - - /** Ctor from \ref ResObject::constPtr. */ - explicit - WhatObsoletes( const ResObject_constPtr item_r ); - - /** Ctor from a range of \ref Solvable, \ref PoolItem or \ref ResObject::constPtr. */ - template - WhatObsoletes( _Iterator begin, _Iterator end ) - : _begin( 0 ) - { - for_( it, begin, end ) - ctorAdd( *it ); - ctorDone(); - } - - public: - /** Whether the container is empty. */ - bool empty() const - { return ! ( _begin && *_begin ); } - - /** Number of solvables inside. */ - size_type size() const; - - public: - typedef detail::WhatProvidesIterator const_iterator; - - /** Iterator pointing to the first \ref Solvable. */ - const_iterator begin() const - { return const_iterator( _begin ); } - - /** Iterator pointing behind the last \ref Solvable. */ - const_iterator end() const - { return const_iterator(); } - - private: - void ctorAdd( const PoolItem & item_r ); - void ctorAdd( ResObject_constPtr item_r ); - void ctorAdd( Solvable item_r ); - void ctorDone(); - - private: - const sat::detail::IdType * _begin; - shared_ptr _private; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates WhatObsoletes Stream output */ - std::ostream & operator<<( std::ostream & str, const WhatObsoletes & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_WHATOBSOLETES_H diff --git a/libzypp/zypp/sat/WhatProvides.cc b/libzypp/zypp/sat/WhatProvides.cc deleted file mode 100644 index 7ee4b7e..0000000 --- a/libzypp/zypp/sat/WhatProvides.cc +++ /dev/null @@ -1,188 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/WhatProvides.cc - * -*/ -#include - -#include "zypp/base/LogTools.h" -#include "zypp/sat/WhatProvides.h" -#include "zypp/sat/detail/PoolImpl.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WhatProvides::Impl - // - /** WhatProvides implementation date. - * Stores the offset into a O terminated Id array. Per default - * libsolvs whatprovidesdata, otherwise private data. - * - * As libsolvs whatprovidesdata might be realocated - * while iterating a result, the iterator takes an - * const IdType *const*. Thats why we explicitly - * provide _private and pass its adress to the iterator, - * even if private data are not reallocated. - */ - class WhatProvides::Impl : protected detail::PoolMember - { - public: - Impl() - : _offset( 0 ), _private( 0 ) - {} - - Impl( unsigned offset_r ) - : _offset( offset_r ), _private( 0 ) - {} - - Impl( const std::tr1::unordered_set & ids_r ) - : _offset( 0 ), _private( 0 ) - { - // use private data to store the result (incl. trailing NULL) - _pdata.reserve( ids_r.size()+1 ); - _pdata.insert( _pdata.begin(), ids_r.begin(), ids_r.end() ); - _pdata.push_back( detail::noId ); - - _private = &_pdata.front(); // ptr to 1st element - } - - public: - unsigned _offset; - const detail::IdType * _private; - - private: - std::vector _pdata; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - /** WhatProvides ctor helper collecting providers from Capabilies. */ - template - void collectProviders( Iterator begin_r, Iterator end_r, std::tr1::unordered_set & collect_r ) - { - for_( it, begin_r, end_r ) - { - WhatProvides providers( *it ); - for_( prv, providers.begin(), providers.end() ) - { - collect_r.insert( prv->id() ); - } - } - } - - ///////////////////////////////////////////////////////////////// - } //namespace - /////////////////////////////////////////////////////////////////// - - WhatProvides::WhatProvides() - {} - - WhatProvides::WhatProvides( Capability cap_r ) - { - unsigned res( myPool().whatProvides( cap_r ) ); - if ( myPool().whatProvidesData( res ) ) - { - _pimpl.reset( new Impl( res ) ); - } - // else: no Impl for empty result. - } - - WhatProvides::WhatProvides( Capabilities caps_r ) - { - std::tr1::unordered_set ids; - collectProviders( caps_r.begin(), caps_r.end(), ids ); - if ( ! ids.empty() ) - { - _pimpl.reset( new Impl( ids ) ); - } - // else: no Impl for empty result. - } - - WhatProvides::WhatProvides( const CapabilitySet & caps_r ) - { - std::tr1::unordered_set ids; - collectProviders( caps_r.begin(), caps_r.end(), ids ); - if ( ! ids.empty() ) - { - _pimpl.reset( new Impl( ids ) ); - } - // else: no Impl for empty result. - } - - bool WhatProvides::empty() const - { - return !_pimpl; // Ctor asserts no Impl for empty result. - } - - WhatProvides::size_type WhatProvides::size() const - { - if ( !_pimpl ) - return 0; - - size_type count = 0; - for_( it, begin(), end() ) - ++count; - return count; - } - - WhatProvides::const_iterator WhatProvides::begin() const - { - if ( !_pimpl ) - return const_iterator(); - - if ( _pimpl->_private ) - return const_iterator( _pimpl->_private ); - - // for libsolvs index use one more indirection, as it might get relocated. - return const_iterator( &myPool().getPool()->whatprovidesdata, _pimpl->_offset ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const WhatProvides & obj ) - { - return dumpRange( str << "(" << obj.size() << ")", obj.begin(), obj.end() ); - } - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const WhatProvidesIterator & obj ) - { - str << str::form( "[%5u]", obj._offset ); - str << str::form( "<%p(%p)>", obj.base_reference(), &obj.base_reference() ); - str << str::form( "<%p(%p)>", obj._baseRef, (obj._baseRef ? *obj._baseRef : 0) ); - return str; - } - - ///////////////////////////////////////////////////////////////// - } //namespace detail - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/WhatProvides.h b/libzypp/zypp/sat/WhatProvides.h deleted file mode 100644 index c57f572..0000000 --- a/libzypp/zypp/sat/WhatProvides.h +++ /dev/null @@ -1,235 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/WhatProvides.h - * -*/ -#ifndef ZYPP_SAT_WHATPROVIDES_H -#define ZYPP_SAT_WHATPROVIDES_H - -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/SolvIterMixin.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - namespace detail - { - class WhatProvidesIterator; - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WhatProvides - // - /** Container of \ref Solvable providing a \ref Capability (read only). - * - * \code - * Capability cap("amarok < 1.13"); - * - * WhatProvides q( cap ); - * Solvable firstMatch; - * - * if ( ! q.empty() ) - * { - * cout << "Found " << q.size() << " matches for " << cap << ":" << endl; - * firstMatch = *q.begin(); - * - * for_( it, q.begin(), q.end() ) - * cout << *it << endl; - * } - * - * if ( firstMatch ) - * { - * WhatProvides req( firstMatch.requires() ); - * if ( ! req.empty() ) - * { - * cout << "Found " << req.size() << " items providing requirements of " << firstMatch << ":" << endl; - * } - * } - * \endcode - * - * \note Note that there are capabilities which are not provided by any \ref Solvable, - * but are system properties. For example: - * \code - * rpmlib(PayloadIsBzip2) <= 3.0.5-1 - * \endcode - * In that case a \ref Solvable::noSolvable is returned, which has \c isSystem set \c true, although - * there should never be a \ref Solvable::noSolvable returned with \c isSystem set \c false. If so, - * please file a bugreport. - * \code - * WhatProvides q( Capability("rpmlib(PayloadIsBzip2) <= 3.0.5-1") ); - * for_( it, q.begin(), q.end() ) - * { - * if ( *it ) - * cout << "Capability is provided by package " << *it << endl; - * else if ( it->isSystem() ) - * cout << "Capability is a system property" << endl; - * else - * ; // never reaching this \c else - * } - * \endcode - */ - class WhatProvides : public SolvIterMixin, - protected detail::PoolMember - { - public: - typedef Solvable value_type; - typedef unsigned size_type; - - public: - /** Default ctor */ - WhatProvides(); - - /** Ctor from \ref Capability. */ - explicit - WhatProvides( Capability cap_r ); - - /** Ctor collecting all providers of capabilities in \c caps_r. */ - explicit - WhatProvides( Capabilities caps_r ); - - /** Ctor collecting all providers of capabilities in \c caps_r. */ - explicit - WhatProvides( const CapabilitySet & caps_r ); - - public: - /** Whether the container is empty. */ - bool empty() const; - - /** Number of solvables inside. */ - size_type size() const; - - public: - typedef detail::WhatProvidesIterator const_iterator; - - /** Iterator pointing to the first \ref Solvable. */ - const_iterator begin() const; - - /** Iterator pointing behind the last \ref Solvable. */ - const_iterator end() const; - - private: - struct Impl; - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates WhatProvides Stream output */ - std::ostream & operator<<( std::ostream & str, const WhatProvides & obj ); - - namespace detail - { - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WhatProvides::const_iterator - // - /** \ref WhatProvides iterator. - * Iterate a NULL terminated sat::detail::IdType array. Ctor gets - * the adress of a pointer to the array, and offset into the array. - * This is needed in case the array gets reallocated. - */ - class WhatProvidesIterator : public boost::iterator_adaptor< - WhatProvidesIterator // Derived - , const detail::IdType * // Base - , const Solvable // Value - , boost::forward_traversal_tag // CategoryOrTraversal - , const Solvable // Reference - > - { - friend std::ostream & operator<<( std::ostream & str, const WhatProvidesIterator & obj ); - public: - WhatProvidesIterator() - : iterator_adaptor_( 0 ), _baseRef( 0 ), _offset( 0 ) - {} - - /** Ctor with pointer to 1st elemment of an array. - * Use otherwise unused base as pointer for _baseRef. - */ - explicit WhatProvidesIterator( const detail::IdType *const base_r, unsigned offset_r = 0 ) - : iterator_adaptor_( base_r ), _baseRef( base_r ? &base_reference() : 0 ), _offset( offset_r ) - {} - - /** Ctor with pointer to pointer to 1st elemment of an array. - * Required for arrays that might be relocated while iterating. - */ - explicit WhatProvidesIterator( const detail::IdType *const* baseRef_r, unsigned offset_r ) - : iterator_adaptor_( 0 ), _baseRef( baseRef_r ), _offset( offset_r ) - {} - - /** Copy-ctor required to keep _baseRef adjusted. */ - WhatProvidesIterator( const WhatProvidesIterator & rhs ) - : iterator_adaptor_( rhs.base_reference() ) - , _baseRef( base_reference() ? &base_reference() : rhs._baseRef ) - , _offset( rhs._offset ) - {} - - /** Assignment operator required to keep _baseRef adjusted. */ - WhatProvidesIterator & operator=( const WhatProvidesIterator & rhs ) - { - if ( this != &rhs ) // no self assign - { - base_reference() = rhs.base_reference(); - _baseRef = ( base_reference() ? &base_reference() : rhs._baseRef ); - _offset = rhs._offset; - } - return *this; - } - - private: - friend class boost::iterator_core_access; - - reference dereference() const - { return Solvable( getId() ); } -#if 0 - template - bool equal( const boost::iterator_adaptor & rhs ) const -#endif - bool equal( const WhatProvidesIterator & rhs ) const - { - if ( ! ( getId() || rhs.getId() ) ) - return true; // both @end - if ( _offset != rhs._offset ) - return false; - if ( base_reference() ) - return( base_reference() == rhs.base_reference() ); - return( _baseRef == rhs._baseRef ); - } - - void increment() - { ++_offset; } - - detail::IdType getId() const - { return _baseRef ? (*_baseRef)[_offset] : detail::noId; } - - private: - const detail::IdType *const* _baseRef; - unsigned _offset; - }; - /////////////////////////////////////////////////////////////////// - } - - inline WhatProvides::const_iterator WhatProvides::end() const - { return const_iterator(); } - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_WHATPROVIDES_H diff --git a/libzypp/zypp/sat/detail/PoolImpl.cc b/libzypp/zypp/sat/detail/PoolImpl.cc deleted file mode 100644 index eb77b4e..0000000 --- a/libzypp/zypp/sat/detail/PoolImpl.cc +++ /dev/null @@ -1,573 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/detail/PoolImpl.cc - * -*/ -#include -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Exception.h" -#include "zypp/base/Measure.h" -#include "zypp/base/WatchFile.h" -#include "zypp/base/Sysconfig.h" -#include "zypp/base/IOStream.h" - -#include "zypp/ZConfig.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/sat/Pool.h" -#include "zypp/Capability.h" -#include "zypp/Locale.h" -#include "zypp/PoolItem.h" - -#include "zypp/target/modalias/Modalias.h" -#include "zypp/media/MediaPriority.h" - -extern "C" -{ -// Workaround libsolv project not providing a common include -// directory. (the -devel package does, but the git repo doesn't). -// #include -int repo_add_helix( ::Repo *repo, FILE *fp, int flags ); -} - -using std::endl; - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool" - -// /////////////////////////////////////////////////////////////////// -namespace zypp -{ - ///////////////////////////////////////////////////////////////// - namespace env - { - /** */ - inline int LIBSOLV_DEBUGMASK() - { - const char * envp = getenv("LIBSOLV_DEBUGMASK"); - return envp ? str::strtonum( envp ) : 0; - } - } // namespace env - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - // MPL checks for satlib constants we redefine to avoid - // includes and defines. - BOOST_MPL_ASSERT_RELATION( noId, ==, STRID_NULL ); - BOOST_MPL_ASSERT_RELATION( emptyId, ==, STRID_EMPTY ); - - BOOST_MPL_ASSERT_RELATION( noSolvableId, ==, ID_NULL ); - BOOST_MPL_ASSERT_RELATION( systemSolvableId, ==, SYSTEMSOLVABLE ); - - BOOST_MPL_ASSERT_RELATION( solvablePrereqMarker, ==, SOLVABLE_PREREQMARKER ); - BOOST_MPL_ASSERT_RELATION( solvableFileMarker, ==, SOLVABLE_FILEMARKER ); - - BOOST_MPL_ASSERT_RELATION( CapDetail::CAP_AND, ==, REL_AND ); - BOOST_MPL_ASSERT_RELATION( CapDetail::CAP_OR, ==, REL_OR ); - BOOST_MPL_ASSERT_RELATION( CapDetail::CAP_WITH, ==, REL_WITH ); - BOOST_MPL_ASSERT_RELATION( CapDetail::CAP_NAMESPACE, ==, REL_NAMESPACE ); - BOOST_MPL_ASSERT_RELATION( CapDetail::CAP_ARCH, ==, REL_ARCH ); - - ///////////////////////////////////////////////////////////////// - - const std::string & PoolImpl::systemRepoAlias() - { - static const std::string _val( "@System" ); - return _val; - } - - const Pathname & sysconfigStoragePath() - { - static const Pathname _val( "/etc/sysconfig/storage" ); - return _val; - } - - - ///////////////////////////////////////////////////////////////// - - static void logSat( struct _Pool *, void *data, int type, const char *logString ) - { - if ( type & (SOLV_FATAL|SOLV_ERROR) ) { - _ERR("libsolv") << logString; - } else if ( type & SOLV_DEBUG_STATS ) { - _DBG("libsolv") << logString; - } else { - _MIL("libsolv") << logString; - } - } - - detail::IdType PoolImpl::nsCallback( struct _Pool *, void * data, detail::IdType lhs, detail::IdType rhs ) - { - // lhs: the namespace identifier, e.g. NAMESPACE:MODALIAS - // rhs: the value, e.g. pci:v0000104Cd0000840[01]sv*sd*bc*sc*i* - // return: 0 if not supportded - // 1 if supported by the system - // -1 AFAIK it's also possible to return a list of solvables that support it, but don't know how. - - static const detail::IdType RET_unsupported = 0; - static const detail::IdType RET_systemProperty = 1; - switch ( lhs ) - { - case NAMESPACE_LANGUAGE: - { - static IdString en( "en" ); - const std::tr1::unordered_set & locale2Solver( reinterpret_cast(data)->_locale2Solver ); - if ( locale2Solver.empty() ) - { - return rhs == en.id() ? RET_systemProperty : RET_unsupported; - } - return locale2Solver.find( IdString(rhs) ) != locale2Solver.end() ? RET_systemProperty : RET_unsupported; - } - break; - - case NAMESPACE_MODALIAS: - { - // modalias strings in capability may be hexencoded because rpm does not allow - // ',', ' ' or other special chars. - return target::Modalias::instance().query( str::hexdecode( IdString(rhs).c_str() ) ) - ? RET_systemProperty - : RET_unsupported; - } - break; - - case NAMESPACE_FILESYSTEM: - { - const std::set & requiredFilesystems( reinterpret_cast(data)->requiredFilesystems() ); - return requiredFilesystems.find( IdString(rhs).asString() ) != requiredFilesystems.end() ? RET_systemProperty : RET_unsupported; - } - break; - - } - - WAR << "Unhandled " << Capability( lhs ) << " vs. " << Capability( rhs ) << endl; - return RET_unsupported; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolMember::myPool - // METHOD TYPE : PoolImpl - // - PoolImpl & PoolMember::myPool() - { - static PoolImpl _global; - return _global; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolImpl::PoolImpl - // METHOD TYPE : Ctor - // - PoolImpl::PoolImpl() - : _pool( ::pool_create() ) - { - MIL << "Creating sat-pool." << endl; - if ( ! _pool ) - { - ZYPP_THROW( Exception( _("Can not create sat-pool.") ) ); - } - // by now we support only a RPM backend - ::pool_setdisttype(_pool, DISTTYPE_RPM ); - - // initialialize logging - if ( env::LIBSOLV_DEBUGMASK() ) - { - ::pool_setdebugmask(_pool, env::LIBSOLV_DEBUGMASK() ); - } - else - { - if ( getenv("ZYPP_LIBSOLV_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") ) - ::pool_setdebuglevel( _pool, 3 ); - else if ( getenv("ZYPP_FULLLOG") ) - ::pool_setdebuglevel( _pool, 2 ); - else - ::pool_setdebugmask(_pool, SOLV_DEBUG_JOB|SOLV_DEBUG_STATS ); - } - - ::pool_setdebugcallback( _pool, logSat, NULL ); - - // set namespace callback - _pool->nscallback = &nsCallback; - _pool->nscallbackdata = (void*)this; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : PoolImpl::~PoolImpl - // METHOD TYPE : Dtor - // - PoolImpl::~PoolImpl() - { - ::pool_free( _pool ); - } - - /////////////////////////////////////////////////////////////////// - - void PoolImpl::setDirty( const char * a1, const char * a2, const char * a3 ) - { - if ( a1 ) - { - if ( a3 ) MIL << a1 << " " << a2 << " " << a3 << endl; - else if ( a2 ) MIL << a1 << " " << a2 << endl; - else MIL << a1 << endl; - } - _serial.setDirty(); // pool content change - _availableLocalesPtr.reset(); // available locales may change - _multiversionListPtr.reset(); // re-evaluate ZConfig::multiversionSpec. - - // invaldate dependency/namespace related indices: - depSetDirty(); - } - - void PoolImpl::depSetDirty( const char * a1, const char * a2, const char * a3 ) - { - if ( a1 ) - { - if ( a3 ) MIL << a1 << " " << a2 << " " << a3 << endl; - else if ( a2 ) MIL << a1 << " " << a2 << endl; - else MIL << a1 << endl; - } - ::pool_freewhatprovides( _pool ); - } - - void PoolImpl::prepare() const - { - if ( _watcher.remember( _serial ) ) - { - // After repo/solvable add/remove: - // set pool architecture - ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() ); - } - if ( ! _pool->whatprovides ) - { - MIL << "pool_createwhatprovides..." << endl; - - ::pool_addfileprovides( _pool ); - ::pool_createwhatprovides( _pool ); - } - if ( ! _pool->languages ) - { - // initial seting - const_cast(this)->setTextLocale( ZConfig::instance().textLocale() ); - } - } - - void PoolImpl::prepareForSolving() const - { - // additional /etc/sysconfig/storage check: - static WatchFile sysconfigFile( sysconfigStoragePath(), WatchFile::NO_INIT ); - if ( sysconfigFile.hasChanged() ) - { - _requiredFilesystemsPtr.reset(); // recreated on demand - const_cast(this)->depSetDirty( "/etc/sysconfig/storage change" ); - } - // finally prepare as usual: - prepare(); - } - - /////////////////////////////////////////////////////////////////// - - ::_Repo * PoolImpl::_createRepo( const std::string & name_r ) - { - setDirty(__FUNCTION__, name_r.c_str() ); - ::_Repo * ret = ::repo_create( _pool, name_r.c_str() ); - if ( ret && name_r == systemRepoAlias() ) - ::pool_set_installed( _pool, ret ); - return ret; - } - - void PoolImpl::_deleteRepo( ::_Repo * repo_r ) - { - setDirty(__FUNCTION__, repo_r->name ); - if ( isSystemRepo( repo_r ) ) - _autoinstalled.clear(); - eraseRepoInfo( repo_r ); - ::repo_free( repo_r, /*reuseids*/false ); - } - - int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r ) - { - setDirty(__FUNCTION__, repo_r->name ); - int ret = ::repo_add_solv( repo_r, file_r, 0 ); - if ( ret == 0 ) - _postRepoAdd( repo_r ); - return ret; - } - - int PoolImpl::_addHelix( ::_Repo * repo_r, FILE * file_r ) - { - setDirty(__FUNCTION__, repo_r->name ); - int ret = ::repo_add_helix( repo_r, file_r, 0 ); - if ( ret == 0 ) - _postRepoAdd( repo_r ); - return 0; - } - - void PoolImpl::_postRepoAdd( ::_Repo * repo_r ) - { - if ( ! isSystemRepo( repo_r ) ) - { - // Filter out unwanted archs - std::set sysids; - { - Arch::CompatSet sysarchs( Arch::compatSet( ZConfig::instance().systemArchitecture() ) ); - for_( it, sysarchs.begin(), sysarchs.end() ) - sysids.insert( it->id() ); - - // unfortunately libsolv treats src/nosrc as architecture: - sysids.insert( ARCH_SRC ); - sysids.insert( ARCH_NOSRC ); - } - - detail::IdType blockBegin = 0; - unsigned blockSize = 0; - for ( detail::IdType i = repo_r->start; i < repo_r->end; ++i ) - { - ::_Solvable * s( _pool->solvables + i ); - if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() ) - { - // Remember an unwanted arch entry: - if ( ! blockBegin ) - blockBegin = i; - ++blockSize; - } - else if ( blockSize ) - { - // Free remembered entries - ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*reuseids*/false ); - blockBegin = blockSize = 0; - } - } - if ( blockSize ) - { - // Free remembered entries - ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*reuseids*/false ); - blockBegin = blockSize = 0; - } - } - } - - detail::SolvableIdType PoolImpl::_addSolvables( ::_Repo * repo_r, unsigned count_r ) - { - setDirty(__FUNCTION__, repo_r->name ); - return ::repo_add_solvable_block( repo_r, count_r ); - } - - void PoolImpl::setRepoInfo( RepoIdType id_r, const RepoInfo & info_r ) - { - ::_Repo * repo( getRepo( id_r ) ); - if ( repo ) - { - bool dirty = false; - - // libsolv priority is based on '<', while yum's repoinfo - // uses 1(highest)->99(lowest). Thus we use -info_r.priority. - if ( repo->priority != int(-info_r.priority()) ) - { - repo->priority = -info_r.priority(); - dirty = true; - } - - // subpriority is used to e.g. prefer http over dvd iff - // both have same priority. - int mediaPriority( media::MediaPriority( info_r.url() ) ); - if ( repo->subpriority != mediaPriority ) - { - repo->subpriority = mediaPriority; - dirty = true; - } - - if ( dirty ) - setDirty(__FUNCTION__, info_r.alias().c_str() ); - } - _repoinfos[id_r] = info_r; - } - - /////////////////////////////////////////////////////////////////// - - // need on demand and id based Locale - void _locale_hack( const LocaleSet & locales_r, - std::tr1::unordered_set & locale2Solver ) - { - std::tr1::unordered_set( 2*locales_r.size() ).swap( locale2Solver ); - for_( it, locales_r.begin(),locales_r.end() ) - { - for ( Locale l( *it ); l != Locale::noCode; l = l.fallback() ) - locale2Solver.insert( IdString( l.code() ) ); - } - MIL << "New Solver Locales: " << locale2Solver << endl; - } - - void PoolImpl::setTextLocale( const Locale & locale_r ) - { - std::vector fallbacklist; - for ( Locale l( locale_r ); l != Locale::noCode; l = l.fallback() ) - { - fallbacklist.push_back( l.code() ); - } - dumpRangeLine( MIL << "pool_set_languages: ", fallbacklist.begin(), fallbacklist.end() ) << endl; - - std::vector fallbacklist_cstr; - for_( it, fallbacklist.begin(), fallbacklist.end() ) - { - fallbacklist_cstr.push_back( it->c_str() ); - } - ::pool_set_languages( _pool, &fallbacklist_cstr.front(), fallbacklist_cstr.size() ); - } - - void PoolImpl::setRequestedLocales( const LocaleSet & locales_r ) - { - depSetDirty( "setRequestedLocales" ); - _requestedLocales = locales_r; - MIL << "New RequestedLocales: " << locales_r << endl; - _locale_hack( _requestedLocales, _locale2Solver ); - } - - bool PoolImpl::addRequestedLocale( const Locale & locale_r ) - { - if ( _requestedLocales.insert( locale_r ).second ) - { - depSetDirty( "addRequestedLocale", locale_r.code().c_str() ); - _locale_hack( _requestedLocales, _locale2Solver ); - return true; - } - return false; - } - - bool PoolImpl::eraseRequestedLocale( const Locale & locale_r ) - { - if ( _requestedLocales.erase( locale_r ) ) - { - depSetDirty( "addRequestedLocale", locale_r.code().c_str() ); - _locale_hack( _requestedLocales, _locale2Solver ); - return true; - } - return false; - } - - static void _getLocaleDeps( Capability cap_r, std::tr1::unordered_set & store_r ) - { - // Collect locales from any 'namespace:language(lang)' dependency - CapDetail detail( cap_r ); - if ( detail.kind() == CapDetail::EXPRESSION ) - { - switch ( detail.capRel() ) - { - case CapDetail::CAP_AND: - case CapDetail::CAP_OR: - // expand - _getLocaleDeps( detail.lhs(), store_r ); - _getLocaleDeps( detail.rhs(), store_r ); - break; - - case CapDetail::CAP_NAMESPACE: - if ( detail.lhs().id() == NAMESPACE_LANGUAGE ) - { - store_r.insert( detail.rhs().id() ); - } - break; - - case CapDetail::REL_NONE: - case CapDetail::CAP_WITH: - case CapDetail::CAP_ARCH: - break; // unwanted - } - } - } - - const LocaleSet & PoolImpl::getAvailableLocales() const - { - if ( !_availableLocalesPtr ) - { - // Collect any 'namespace:language(ja)' dependencies - std::tr1::unordered_set tmp; - Pool pool( Pool::instance() ); - for_( it, pool.solvablesBegin(), pool.solvablesEnd() ) - { - Capabilities cap( it->supplements() ); - for_( cit, cap.begin(), cap.end() ) - { - _getLocaleDeps( *cit, tmp ); - } - } -#warning immediately build LocaleSet as soon as Loale is an Id based type - _availableLocalesPtr.reset( new LocaleSet(tmp.size()) ); - for_( it, tmp.begin(), tmp.end() ) - { - _availableLocalesPtr->insert( Locale( IdString(*it) ) ); - } - } - return *_availableLocalesPtr; - } - - void PoolImpl::multiversionListInit() const - { - _multiversionListPtr.reset( new MultiversionList ); - MultiversionList & multiversionList( *_multiversionListPtr ); - - const std::set & multiversionSpec( ZConfig::instance().multiversionSpec() ); - for_( it, multiversionSpec.begin(), multiversionSpec.end() ) - { - static const std::string prefix( "provides:" ); - if ( str::hasPrefix( *it, prefix ) ) - { - WhatProvides provides( Capability( it->c_str() + prefix.size() ) ); - if ( provides.empty() ) - { - MIL << "Multiversion install not provided (" << *it << ")" << endl; - } - else - { - for_( pit, provides.begin(), provides.end() ) - { - if ( multiversionList.insert( pit->ident() ).second ) - MIL << "Multiversion install " << pit->ident() << " (" << *it << ")" << endl; - } - } - } - else - { - MIL << "Multiversion install " << *it << endl; - multiversionList.insert( IdString( *it ) ); - } - } - } - - const std::set & PoolImpl::requiredFilesystems() const - { - if ( ! _requiredFilesystemsPtr ) - { - _requiredFilesystemsPtr.reset( new std::set ); - std::set & requiredFilesystems( *_requiredFilesystemsPtr ); - str::split( base::sysconfig::read( sysconfigStoragePath() )["USED_FS_LIST"], - std::inserter( requiredFilesystems, requiredFilesystems.end() ) ); - } - return *_requiredFilesystemsPtr; - } - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/sat/detail/PoolImpl.h b/libzypp/zypp/sat/detail/PoolImpl.h deleted file mode 100644 index 8b4035a..0000000 --- a/libzypp/zypp/sat/detail/PoolImpl.h +++ /dev/null @@ -1,320 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/detail/PoolImpl.h - * -*/ -#ifndef ZYPP_SAT_DETAIL_POOLIMPL_H -#define ZYPP_SAT_DETAIL_POOLIMPL_H -extern "C" -{ -#include -#include -#include -#include -#include -} -#include - -#include "zypp/base/Tr1hash.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/SerialNumber.h" -#include "zypp/sat/detail/PoolMember.h" -#include "zypp/sat/Queue.h" -#include "zypp/RepoInfo.h" -#include "zypp/Locale.h" -#include "zypp/Capability.h" -#include "zypp/IdString.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolImpl - // - /** */ - class PoolImpl : private base::NonCopyable - { - public: - /** Default ctor */ - PoolImpl(); - - /** Dtor */ - ~PoolImpl(); - - /** Pointer style access forwarded to sat-pool. */ - ::_Pool * operator->() - { return _pool; } - - public: - /** Serial number changing whenever the content changes. */ - const SerialNumber & serial() const - { return _serial; } - - /** Update housekeeping data (e.g. whatprovides). - * \todo actually requires a watcher. - */ - void prepare() const; - /** \ref prepare plus some expensive checks done before solving only. */ - void prepareForSolving() const; - - private: - /** Invalidate housekeeping data (e.g. whatprovides) if the - * pools content changed. - */ - void setDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 ); - - /** Invalidate housekeeping data (e.g. whatprovides) if dependencies changed. - */ - void depSetDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 ); - - /** Callback to resolve namespace dependencies (language, modalias, filesystem, etc.). */ - static detail::IdType nsCallback( ::_Pool *, void * data, detail::IdType lhs, detail::IdType rhs ); - - public: - /** Reserved system repository alias \c @System. */ - static const std::string & systemRepoAlias(); - - bool isSystemRepo( ::_Repo * repo_r ) const - { return repo_r && _pool->installed == repo_r; } - - ::_Repo * systemRepo() const - { return _pool->installed; } - - /** Get rootdir (for file conflicts check) */ - Pathname rootDir() const - { - const char * rd = ::pool_get_rootdir( _pool ); - return( rd ? rd : "/" ); - } - - /** Set rootdir (for file conflicts check) */ - void rootDir( const Pathname & root_r ) - { - if ( root_r.empty() || root_r == "/" ) - ::pool_set_rootdir( _pool, nullptr ); - else - ::pool_set_rootdir( _pool, root_r.c_str() ); - } - - public: - /** \name Actions invalidating housekeeping data. - * - * All methods expect valid arguments being passed. - */ - //@{ - /** Creating a new repo named \a name_r. */ - ::_Repo * _createRepo( const std::string & name_r ); - - /** Creating a new repo named \a name_r. */ - void _deleteRepo( ::_Repo * repo_r ); - - /** Adding solv file to a repo. - * Except for \c isSystemRepo_r, solvables of incompatible architecture - * are filtered out. - */ - int _addSolv( ::_Repo * repo_r, FILE * file_r ); - - /** Adding helix file to a repo. - * Except for \c isSystemRepo_r, solvables of incompatible architecture - * are filtered out. - */ - int _addHelix( ::_Repo * repo_r, FILE * file_r ); - - /** Adding Solvables to a repo. */ - detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r ); - //@} - - /** Helper postprocessing the repo after adding solv or helix files. */ - void _postRepoAdd( ::_Repo * repo_r ); - - public: - /** a \c valid \ref Solvable has a non NULL repo pointer. */ - bool validSolvable( const ::_Solvable & slv_r ) const - { return slv_r.repo; } - /** \overload Check also for id_r being in range of _pool->solvables. */ - bool validSolvable( SolvableIdType id_r ) const - { return id_r < unsigned(_pool->nsolvables) && validSolvable( _pool->solvables[id_r] ); } - /** \overload Check also for slv_r being in range of _pool->solvables. */ - bool validSolvable( const ::_Solvable * slv_r ) const - { return _pool->solvables <= slv_r && slv_r <= _pool->solvables+_pool->nsolvables && validSolvable( *slv_r ); } - - public: - ::_Pool * getPool() const - { return _pool; } - - /** \todo a quick check whether the repo was meanwhile deleted. */ - ::_Repo * getRepo( RepoIdType id_r ) const - { return id_r; } - - /** Return pointer to the sat-solvable or NULL if it is not valid. - * \see \ref validSolvable. - */ - ::_Solvable * getSolvable( SolvableIdType id_r ) const - { - if ( validSolvable( id_r ) ) - return &_pool->solvables[id_r]; - return 0; - } - - public: - /** Get id of the first valid \ref Solvable. - * This is the next valid after the system solvable. - */ - SolvableIdType getFirstId() const - { return getNextId( 1 ); } - - /** Get id of the next valid \ref Solvable. - * This goes round robbin. At the end it returns \ref noSolvableId. - * Passing \ref noSolvableId it returns the 1st valid \ref Solvable. - * \see \ref validSolvable. - */ - SolvableIdType getNextId( SolvableIdType id_r ) const - { - for( ++id_r; id_r < unsigned(_pool->nsolvables); ++id_r ) - { - if ( validSolvable( _pool->solvables[id_r] ) ) - return id_r; - } - return noSolvableId; - } - - public: - /** */ - const RepoInfo & repoInfo( RepoIdType id_r ) - { return _repoinfos[id_r]; } - /** Also adjust repo priority and subpriority accordingly. */ - void setRepoInfo( RepoIdType id_r, const RepoInfo & info_r ); - /** */ - void eraseRepoInfo( RepoIdType id_r ) - { _repoinfos.erase( id_r ); } - - public: - /** Returns the id stored at \c offset_r in the internal - * whatprovidesdata array. - */ - const sat::detail::IdType whatProvidesData( unsigned offset_r ) - { return _pool->whatprovidesdata[offset_r]; } - - /** Returns offset into the internal whatprovidesdata array. - * Use \ref whatProvidesData to get the stored Id. - */ - unsigned whatProvides( Capability cap_r ) - { prepare(); return ::pool_whatprovides( _pool, cap_r.id() ); } - - public: - /** \name Requested locales. */ - //@{ - void setTextLocale( const Locale & locale_r ); - void setRequestedLocales( const LocaleSet & locales_r ); - bool addRequestedLocale( const Locale & locale_r ); - bool eraseRequestedLocale( const Locale & locale_r ); - - const LocaleSet & getRequestedLocales() const - { return _requestedLocales; } - - bool isRequestedLocale( const Locale & locale_r ) const - { - LocaleSet::const_iterator it( _requestedLocales.find( locale_r ) ); - return it != _requestedLocales.end(); - } - - const LocaleSet & getAvailableLocales() const; - - bool isAvailableLocale( const Locale & locale_r ) const - { - const LocaleSet & avl( getAvailableLocales() ); - LocaleSet::const_iterator it( avl.find( locale_r ) ); - return it != avl.end(); - } - //@} - - public: - /** \name Multiversion install. */ - //@{ - typedef IdStringSet MultiversionList; - - const MultiversionList & multiversionList() const - { - if ( ! _multiversionListPtr ) - multiversionListInit(); - return *_multiversionListPtr; - } - - bool isMultiversion( IdString ident_r ) const - { - const MultiversionList & l( multiversionList() ); - return l.find( ident_r ) != l.end(); - } - //@} - - public: - /** \name Installed on behalf of a user request hint. */ - //@{ - /** Get ident list of all autoinstalled solvables. */ - StringQueue autoInstalled() const - { return _autoinstalled; } - - /** Set ident list of all autoinstalled solvables. */ - void setAutoInstalled( const StringQueue & autoInstalled_r ) - { _autoinstalled = autoInstalled_r; } - - bool isOnSystemByUser( IdString ident_r ) const - { return !_autoinstalled.contains( ident_r.id() ); } - //@} - - public: - /** accessor for etc/sysconfig/storage reading file on demand */ - const std::set & requiredFilesystems() const; - - private: - /** sat-pool. */ - ::_Pool * _pool; - /** Serial number. */ - SerialNumber _serial; - /** Watch serial number. */ - SerialNumberWatcher _watcher; - /** Additional \ref RepoInfo. */ - std::map _repoinfos; - - /** */ - LocaleSet _requestedLocales; - mutable scoped_ptr _availableLocalesPtr; - mutable std::tr1::unordered_set _locale2Solver; - - /** */ - void multiversionListInit() const; - mutable scoped_ptr _multiversionListPtr; - - /** */ - sat::StringQueue _autoinstalled; - - /** filesystems mentioned in /etc/sysconfig/storage */ - mutable scoped_ptr > _requiredFilesystemsPtr; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#define POOL_SETDIRTY -#endif // ZYPP_SAT_DETAIL_POOLIMPL_H diff --git a/libzypp/zypp/sat/detail/PoolMember.h b/libzypp/zypp/sat/detail/PoolMember.h deleted file mode 100644 index 0cd0fdc..0000000 --- a/libzypp/zypp/sat/detail/PoolMember.h +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/sat/detail/PoolMember.h - * -*/ -#ifndef ZYPP_SAT_DETAIL_POOLMEMBER_H -#define ZYPP_SAT_DETAIL_POOLMEMBER_H - -#include "zypp/base/Tr1hash.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/String.h" -#include "zypp/base/Easy.h" - -extern "C" -{ -struct _Solvable; -struct _Repo; -struct _Pool; -} - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - class IdString; - class Capability; - class Capabilities; - class Repository; - class RepoInfo; - - /////////////////////////////////////////////////////////////////// - namespace detail - { - class RepoIterator; - class ByRepository; - } - - /////////////////////////////////////////////////////////////////// - namespace sat - { ///////////////////////////////////////////////////////////////// - - class Pool; - class Solvable; - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - class PoolImpl; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : PoolMember - // - /** Backlink to the associated \ref PoolImpl. - * Simple as we currently use one global PoolImpl. If we change our - * minds this is where we'd store and do the \c Id to \ref PoolImpl - * mapping. - */ - struct PoolMember - { - static PoolImpl & myPool(); - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - /** Generic Id type. */ - typedef int IdType; - static const IdType noId( 0 ); - static const IdType emptyId( 1 ); - - /** Internal ids satlib includes in dependencies. - * MPL check in PoolImpl.cc - */ - static const IdType solvablePrereqMarker( 15 ); - static const IdType solvableFileMarker ( 16 ); - /** Test for internal ids satlib includes in dependencies. */ - inline bool isDepMarkerId( IdType id_r ) - { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); } - - /** Id type to connect \ref Solvable and sat-solvable. - * Indext into solvable array. - */ - typedef unsigned SolvableIdType; - typedef SolvableIdType size_type; - /** Id to denote \ref Solvable::noSolvable. */ - static const SolvableIdType noSolvableId( 0 ); - /** Id to denote the usually hidden \ref Solvable::systemSolvable. */ - static const SolvableIdType systemSolvableId( 1 ); - - /** Id type to connect \ref Repo and sat-repo. */ - typedef ::_Repo * RepoIdType; - /** Id to denote \ref Repo::noRepository. */ - static const RepoIdType noRepoId( 0 ); - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////// - namespace detail - { ///////////////////////////////////////////////////////////////// - - class SolvableIterator; - - ///////////////////////////////////////////////////////////////// - } // namespace detail - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace sat - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_SAT_DETAIL_POOLMEMBER_H diff --git a/libzypp/zypp/solver/detail/Helper.cc b/libzypp/zypp/solver/detail/Helper.cc deleted file mode 100644 index 37a20da..0000000 --- a/libzypp/zypp/solver/detail/Helper.cc +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Helper.cc - * - * Static helpers - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include - -#include "zypp/solver/detail/Helper.h" -#include "zypp/Capabilities.h" -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/VendorAttr.h" -#include "zypp/base/Algorithm.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/RepoInfo.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -ostream & -operator<< (ostream & os, const PoolItemList & itemlist) -{ - for (PoolItemList::const_iterator iter = itemlist.begin(); iter != itemlist.end(); ++iter) { - if (iter != itemlist.begin()) - os << ", "; - os << *iter; - } - return os; -} - - -class LookFor : public resfilter::PoolItemFilterFunctor -{ - public: - PoolItem item; - - bool operator()( PoolItem provider ) - { - item = provider; - return false; // stop here, we found it - } -}; - - -// just find installed item with same kind/name as item - -template -static PoolItem findInstalledByNameAndKind ( _Iter begin, _Iter end, const string & name, const Resolvable::Kind & kind) -{ - LookFor info; - - invokeOnEach(begin, end, - resfilter::ByInstalled (), // ByInstalled - functor::functorRef (info) ); - - _XDEBUG("Helper::findInstalledByNameAndKind (" << name << ", " << kind << ") => " << info.item); - return info.item; - -} - -PoolItem Helper::findInstalledByNameAndKind (const ResPool & pool, const string & name, const Resolvable::Kind & kind) -{ return detail::findInstalledByNameAndKind( pool.byIdentBegin( kind, name ), pool.byIdentEnd( kind, name ), name, kind ); } - -PoolItem Helper::findInstalledItem (const ResPool & pool, PoolItem item) -{ return findInstalledByNameAndKind(pool, item->name(), item->kind() ); } - -PoolItem Helper::findInstalledItem( const std::vector & pool, PoolItem item ) -{ return detail::findInstalledByNameAndKind( pool.begin(), pool.end(), item->name(), item->kind() ); } - - -// just find uninstalled item with same kind/name as item - -PoolItem -Helper::findUninstalledByNameAndKind (const ResPool & pool, const string & name, const Resolvable::Kind & kind) -{ - LookFor info; - - invokeOnEach( pool.byIdentBegin( kind, name ), - pool.byIdentEnd( kind, name ), - resfilter::ByUninstalled(), // ByUninstalled - functor::functorRef (info) ); - - _XDEBUG("Helper::findUninstalledByNameAndKind (" << name << ", " << kind << ") => " << info.item); - return info.item; -} - - -//---------------------------------------------------------------------------- - -class LookForUpdate : public resfilter::PoolItemFilterFunctor -{ - public: - PoolItem uninstalled; - PoolItem installed; - - bool operator()( PoolItem provider ) - { - // is valid - if ( ! provider.resolvable() ) - { - WAR << "Warning: '" << provider << "' not valid" << endl; - return true; - } - - if ( installed.resolvable() ) - { - if ( !VendorAttr::instance().equivalent( installed, provider ) ) - { - MIL << "Discarding '" << provider << "' from vendor '" - << provider->vendor() << "' different to uninstalled '" - << installed->vendor() << "' vendor." << endl; - return true; - } - } - - if ((!uninstalled // none yet - || (uninstalled->edition().compare( provider->edition() ) < 0) // or a better edition - || (uninstalled->arch().compare( provider->arch() ) < 0) ) // or a better architecture - && !provider.status().isLocked() ) // is not locked - { - uninstalled = provider; // store - } - return true; - } -}; - - -// just find best (according to edition) uninstalled item with same kind/name as item -// *DOES* check edition - -template -static PoolItem findUpdateItem( _Iter begin, _Iter end, PoolItem item ) -{ - LookForUpdate info; - info.installed = item; - - invokeOnEach( begin, end, - functor::chain (resfilter::ByUninstalled (), // ByUninstalled - resfilter::byEdition >( item->edition() )), // only look at better editions - functor::functorRef (info) ); - - _XDEBUG("Helper::findUpdateItem(" << item << ") => " << info.uninstalled); - return info.uninstalled; -} - -PoolItem Helper::findUpdateItem (const ResPool & pool, PoolItem item) -{ return detail::findUpdateItem( pool.byIdentBegin( item ), pool.byIdentEnd( item ), item ); } - -PoolItem Helper::findUpdateItem (const std::vector & pool, PoolItem item) -{ return detail::findUpdateItem( pool.begin(), pool.end(), item ); } - - -//---------------------------------------------------------------------------- - -class LookForReinstall : public resfilter::PoolItemFilterFunctor -{ - public: - PoolItem uninstalled; - - bool operator()( PoolItem provider ) - { - if (provider.status().isLocked()) { - return true; // search next - } else { - uninstalled = provider; - return false; // stop here, we found it - } - } -}; - - -PoolItem -Helper::findReinstallItem (const ResPool & pool, PoolItem item) -{ - LookForReinstall info; - - invokeOnEach( pool.byIdentBegin( item ), - pool.byIdentEnd( item ), - functor::chain (resfilter::ByUninstalled (), // ByUninstalled - resfilter::byEdition >( item->edition() )), - functor::functorRef (info) ); - - _XDEBUG("Helper::findReinstallItem(" << item << ") => " << info.uninstalled); - return info.uninstalled; -} - -//---------------------------------------------------------------------------- - -class CheckIfBest : public resfilter::PoolItemFilterFunctor -{ - public: - PoolItem _item; - bool is_best; - - CheckIfBest( PoolItem item ) - : _item( item ) - , is_best( true ) // assume we already have the best - {} - - // check if provider is better. If yes, end the search. - - bool operator()( PoolItem provider ) - { - int archcmp = _item->arch().compare( provider->arch() ); - if (((archcmp < 0) // provider has a better architecture - || ((archcmp == 0) - && (_item->edition().compare( provider->edition() ) < 0))) // or a better edition - && !provider.status().isLocked()) // and is not locked - { - is_best = false; - return false; - } - return true; - } -}; - - -// check if the given item is the best one of the pool - -bool -Helper::isBestUninstalledItem (const ResPool & pool, PoolItem item) -{ - CheckIfBest info( item ); - - invokeOnEach( pool.byIdentBegin( item ), - pool.byIdentEnd( item ), - resfilter::ByUninstalled(), // ByUninstalled - functor::functorRef( info ) ); - - _XDEBUG("Helper::isBestUninstalledItem(" << item << ") => " << info.is_best); - return info.is_best; -} - -std::string -Helper::itemToString (PoolItem item, bool shortVersion) -{ - ostringstream os; - if (!item) return ""; - - if (item->kind() != ResKind::package) - os << item->kind() << ':'; - os << item->name(); - if (!shortVersion) { - os << '-' << item->edition(); - if (item->arch() != "") { - os << '.' << item->arch(); - } - - string alias = item->repoInfo().alias(); - if (!alias.empty() - && alias != "@System") - { - os << '[' << alias << ']'; - } - } - return os.str(); -} - -std::string -Helper::capToString (const Capability & capability) -{ - ostringstream os; - os << capability.asString(); - return os.str(); -} - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/solver/detail/Helper.h b/libzypp/zypp/solver/detail/Helper.h deleted file mode 100644 index 0204a13..0000000 --- a/libzypp/zypp/solver/detail/Helper.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Helper.h - * - * Static helpers - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_HELPER_H -#define ZYPP_SOLVER_DETAIL_HELPER_H - -#include - -#include "zypp/ResPool.h" -#include "zypp/PoolItem.h" -#include "zypp/Capabilities.h" -#include "zypp/base/String.h" -#include "zypp/solver/detail/Types.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : Helper - -class Helper { - public: - - // for name, find installed item which has same name - // does *NOT* check edition - // FIXME: should probably take provides/obsoletes into account for - // renamed upgrades - static PoolItem findInstalledByNameAndKind (const ResPool & pool, const std::string & name, const Resolvable::Kind & kind); - - // for name, find uninstalled item which has same name - static PoolItem findUninstalledByNameAndKind (const ResPool & pool, const std::string & name, const Resolvable::Kind & kind); - - // for item, find installed item which has same name -> calls findInstalledByNameAndKind() - // does *NOT* check edition - // FIXME: should probably take provides/obsoletes into account for - // renamed upgrades - static PoolItem findInstalledItem (const ResPool & pool, PoolItem item); - /** \overload Using ident cache entry. */ - static PoolItem findInstalledItem (const std::vector & pool, PoolItem item); - - // for item, find uninstalled item which has same name and higher edition - static PoolItem findUninstalledItem (const ResPool & pool, PoolItem item); - - // for item, find uninstalled item which has same name and equal edition - static PoolItem findReinstallItem (const ResPool & pool, PoolItem item); - - static PoolItem findUpdateItem (const ResPool & pool, PoolItem item); - /** \overload Using ident cache entry. */ - static PoolItem findUpdateItem (const std::vector & pool, PoolItem item); - - // for item, check if this is the 'best' uninstalled (best arch, best version) item - static bool isBestUninstalledItem (const ResPool & pool, PoolItem item); - - // Human readable item - static std::string itemToString (PoolItem item, bool shortVersion=false); - static std::string capToString (const Capability & capability); - - friend std::ostream& operator<<(std::ostream&, const PoolItemList & itemlist); - -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_HELPER_H diff --git a/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc b/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc deleted file mode 100644 index 5b9880c..0000000 --- a/libzypp/zypp/solver/detail/ProblemSolutionCombi.cc +++ /dev/null @@ -1,122 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" - -#include "zypp/solver/detail/ProblemSolutionCombi.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionCombi); - -//--------------------------------------------------------------------------- - -ProblemSolutionCombi::ProblemSolutionCombi( ResolverProblem_Ptr parent) - : ProblemSolution (parent, "", "") - , actNumber(0) -{ - _description = ""; - _details = ""; -} - -void ProblemSolutionCombi::addSingleAction( Capability capability, const TransactionKind action) -{ - addAction (new TransactionSolutionAction(capability, action)); - actNumber++; -} - -void ProblemSolutionCombi::addSingleAction( PoolItem item, const TransactionKind action) -{ - addAction (new TransactionSolutionAction(item, action)); - actNumber++; -} - -void ProblemSolutionCombi::addSingleAction( SolverQueueItem_Ptr item, const TransactionKind action) -{ - addAction (new TransactionSolutionAction(item, action)); - actNumber++; -} - -void ProblemSolutionCombi::addDescription( const std::string description) -{ - if ( _description.size() == 0 - && _details.size() == 0) { - // first entry - _description = description; - } else { - if ( _description.size() > 0 - && _details.size() == 0) { - // second entry - _details = _description; - _description = _("Following actions will be done:"); - } - // all other - _details += "\n"; - _details += description; - } -} - -void ProblemSolutionCombi::addFrontDescription( const std::string & description ) -{ - if ( _description.size() == 0 - && _details.size() == 0) { - // first entry - _description = description; - } else { - if ( _description.size() > 0 - && _details.size() == 0) { - // second entry - _details = _description; - _description = _("Following actions will be done:"); - } - // all other - std::string tmp( _details ); - _details = description; - _details += "\n"; - _details += tmp; - } -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/ProblemSolutionCombi.h b/libzypp/zypp/solver/detail/ProblemSolutionCombi.h deleted file mode 100644 index 1e9875e..0000000 --- a/libzypp/zypp/solver/detail/ProblemSolutionCombi.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H - -#include -#include "zypp/ProblemSolution.h" -#include "zypp/solver/detail/Types.h" -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution is a combination of different actions. - * e.G. install, delete, keep different resolvables. - * - **/ - class ProblemSolutionCombi : public ProblemSolution - { - protected: - int actNumber; // number of actions - public: - - /** - * Constructor. - **/ - ProblemSolutionCombi( ResolverProblem_Ptr parent ); - /** - * Add a single action of an item - */ - void addSingleAction( PoolItem item, const TransactionKind action); - - /** - * Add a single action of a capability - */ - void addSingleAction( Capability capability, const TransactionKind action); - - /** - * Add a single action of a SolverQueueItem - */ - void addSingleAction( SolverQueueItem_Ptr item, const TransactionKind action); - - /** - * returns the number of actions - */ - int actionCount() { return actNumber;} - - /** - * Set description text (append) - */ - void addDescription( const std::string description); - - /** - * Set description text (prepend) - */ - void addFrontDescription( const std::string & description ); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAINSTALL_H - diff --git a/libzypp/zypp/solver/detail/ProblemSolutionIgnore.cc b/libzypp/zypp/solver/detail/ProblemSolutionIgnore.cc deleted file mode 100644 index 4afeea2..0000000 --- a/libzypp/zypp/solver/detail/ProblemSolutionIgnore.cc +++ /dev/null @@ -1,76 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/ProblemSolutionIgnore.h" -#include "zypp/solver/detail/Helper.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionIgnore); - -//--------------------------------------------------------------------------- - -ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent, - PoolItem item ) - : ProblemSolution (parent, "", "") -{ - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("break %s by ignoring some of its dependencies"), item.satSolvable().asString().c_str() ); - - addAction ( new InjectSolutionAction (item, WEAK)); -} - -ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent, - PoolItemList itemList ) - : ProblemSolution (parent, "", "") -{ - _description = _("generally ignore of some dependecies"); - for (PoolItemList::const_iterator iter = itemList.begin(); - iter != itemList.end(); iter++) { - addAction ( new InjectSolutionAction (*iter, WEAK)); - } -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/ProblemSolutionIgnore.h b/libzypp/zypp/solver/detail/ProblemSolutionIgnore.h deleted file mode 100644 index 3765023..0000000 --- a/libzypp/zypp/solver/detail/ProblemSolutionIgnore.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H - -#include "zypp/solver/detail/Types.h" -#include "zypp/ProblemSolution.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution ignores one or more items by setting his dependencies - * to weak - **/ - class ProblemSolutionIgnore : public ProblemSolution - { - public: - - /** - * Constructor. - **/ - ProblemSolutionIgnore( ResolverProblem_Ptr parent, - PoolItem item ); - ProblemSolutionIgnore( ResolverProblem_Ptr parent, - PoolItemList itemList); - }; - - - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H - diff --git a/libzypp/zypp/solver/detail/Resolver.cc b/libzypp/zypp/solver/detail/Resolver.cc deleted file mode 100644 index 1658e88..0000000 --- a/libzypp/zypp/solver/detail/Resolver.cc +++ /dev/null @@ -1,624 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include - -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/Helper.h" -#include "zypp/solver/detail/Testcase.h" -#include "zypp/solver/detail/SATResolver.h" - -#include "zypp/Capabilities.h" -#include "zypp/ZConfig.h" -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Algorithm.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/sat/Pool.h" -#include "zypp/sat/Solvable.h" -#include "zypp/sat/Transaction.h" -#include "zypp/ResolverProblem.h" - -#define MAXSOLVERRUNS 5 - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(Resolver); - - -//--------------------------------------------------------------------------- - - -std::ostream & Resolver::dumpOn( std::ostream & os ) const -{ - os << "" << endl; - #define OUTS(t) os << " " << #t << ":\t" << t << endl; - OUTS( _forceResolve ); - OUTS( _upgradeMode ); - OUTS( _updateMode ); - OUTS( _verifying ); - OUTS( _onlyRequires ); - OUTS( _allowVendorChange ); - OUTS( _solveSrcPackages ); - OUTS( _cleandepsOnRemove ); - OUTS( _ignoreAlreadyRecommended ); - #undef OUT - return os << ""; -} - - -//--------------------------------------------------------------------------- - -Resolver::Resolver (const ResPool & pool) - : _pool(pool) - , _satResolver(NULL) - , _poolchanged(_pool.serial() ) - , _forceResolve (false) - , _upgradeMode (false) - , _updateMode (false) - , _verifying (false) - , _onlyRequires ( ZConfig::instance().solver_onlyRequires() ) - , _allowVendorChange ( ZConfig::instance().solver_allowVendorChange() ) - , _solveSrcPackages ( false ) - , _cleandepsOnRemove ( ZConfig::instance().solver_cleandepsOnRemove() ) - , _ignoreAlreadyRecommended ( true ) - -{ - sat::Pool satPool( sat::Pool::instance() ); - _satResolver = new SATResolver(_pool, satPool.get()); -} - - -Resolver::~Resolver() -{ - delete _satResolver; -} - -//--------------------------------------------------------------------------- - -void Resolver::setAllowVendorChange( TriBool state_r ) -{ - _allowVendorChange = indeterminate(state_r) ? ZConfig::instance().solver_allowVendorChange() : bool(state_r); -} - -void Resolver::setOnlyRequires( TriBool state_r ) -{ - _onlyRequires = indeterminate(state_r) ? ZConfig::instance().solver_onlyRequires() : bool(state_r); -} - -void Resolver::setCleandepsOnRemove( TriBool state_r ) -{ - _cleandepsOnRemove = indeterminate(state_r) ? ZConfig::instance().solver_cleandepsOnRemove() : bool(state_r); -} - -//--------------------------------------------------------------------------- - -ResPool Resolver::pool() const -{ return _pool; } - -void Resolver::reset( bool keepExtras ) -{ - _verifying = false; - - if (!keepExtras) { - _extra_requires.clear(); - _extra_conflicts.clear(); - } - - _isInstalledBy.clear(); - _installs.clear(); - _satifiedByInstalled.clear(); - _installedSatisfied.clear(); -} - -bool Resolver::doUpgrade() -{ - // Setting Resolver to upgrade mode. SAT solver will do the update - _upgradeMode = true; - return resolvePool(); -} - -void Resolver::doUpdate() -{ - _updateMode = true; - return _satResolver->doUpdate(); -} - -PoolItemList Resolver::problematicUpdateItems() const -{ return _satResolver->problematicUpdateItems(); } - -void Resolver::addExtraRequire( const Capability & capability ) -{ _extra_requires.insert (capability); } - -void Resolver::removeExtraRequire( const Capability & capability ) -{ _extra_requires.erase (capability); } - -void Resolver::addExtraConflict( const Capability & capability ) -{ _extra_conflicts.insert (capability); } - -void Resolver::removeExtraConflict( const Capability & capability ) -{ _extra_conflicts.erase (capability); } - -void Resolver::removeQueueItem( SolverQueueItem_Ptr item ) -{ - bool found = false; - for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin(); - iter != _added_queue_items.end(); iter++) { - if (*iter == item) { - _added_queue_items.remove(*iter); - found = true; - break; - } - } - if (!found) { - _removed_queue_items.push_back (item); - _removed_queue_items.unique (); - } -} - -void Resolver::addQueueItem( SolverQueueItem_Ptr item ) -{ - bool found = false; - for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin(); - iter != _removed_queue_items.end(); iter++) { - if (*iter == item) { - _removed_queue_items.remove(*iter); - found = true; - break; - } - } - if (!found) { - _added_queue_items.push_back (item); - _added_queue_items.unique (); - } -} - -void Resolver::addWeak( const PoolItem & item ) -{ _addWeak.push_back( item ); } - -//--------------------------------------------------------------------------- - -struct UndoTransact : public resfilter::PoolItemFilterFunctor -{ - ResStatus::TransactByValue resStatus; - UndoTransact ( const ResStatus::TransactByValue &status) - :resStatus(status) - { } - - bool operator()( PoolItem item ) // only transacts() items go here - { - item.status().resetTransact( resStatus );// clear any solver/establish transactions - return true; - } -}; - - -struct DoTransact : public resfilter::PoolItemFilterFunctor -{ - ResStatus::TransactByValue resStatus; - DoTransact ( const ResStatus::TransactByValue &status) - :resStatus(status) - { } - - bool operator()( PoolItem item ) // only transacts() items go here - { - item.status().setTransact( true, resStatus ); - return true; - } -}; - - -bool Resolver::verifySystem() -{ - UndoTransact resetting (ResStatus::APPL_HIGH); - - _DEBUG ("Resolver::verifySystem() "); - - _verifying = true; - - invokeOnEach ( _pool.begin(), _pool.end(), - resfilter::ByTransact( ), // Resetting all transcations - functor::functorRef(resetting) ); - - return resolvePool(); -} - - -//---------------------------------------------------------------------------- -// undo - -void Resolver::undo() -{ - UndoTransact info(ResStatus::APPL_LOW); - MIL << "*** undo ***" << endl; - invokeOnEach ( _pool.begin(), _pool.end(), - resfilter::ByTransact( ), // collect transacts from Pool to resolver queue - functor::functorRef(info) ); - // Regard dependencies of the item weak onl - _addWeak.clear(); - - // Additional QueueItems which has to be regarded by the solver - _removed_queue_items.clear(); - _added_queue_items.clear(); - - return; -} - -void Resolver::solverInit() -{ - // Solving with libsolv - static bool poolDumped = false; - MIL << "-------------- Calling SAT Solver -------------------" << endl; - if ( getenv("ZYPP_FULLLOG") ) { - Testcase testcase("/var/log/YaST2/autoTestcase"); - if (!poolDumped) { - testcase.createTestcase (*this, true, false); // dump pool - poolDumped = true; - } else { - testcase.createTestcase (*this, false, false); // write control file only - } - } - - _satResolver->setFixsystem ( isVerifyingMode() ); - _satResolver->setIgnorealreadyrecommended ( ignoreAlreadyRecommended() ); - _satResolver->setOnlyRequires ( onlyRequires() ); - _satResolver->setAllowdowngrade (false); - _satResolver->setAllowarchchange (false); - _satResolver->setAllowvendorchange ( allowVendorChange() ); - _satResolver->setAllowuninstall ( forceResolve() ); - _satResolver->setUpdatesystem (false); - _satResolver->setNoupdateprovide (false); - _satResolver->setDosplitprovides (true); - _satResolver->setSolveSrcPackages ( solveSrcPackages() ); - _satResolver->setCleandepsOnRemove ( cleandepsOnRemove() ); - - _satResolver->setDistupgrade (_upgradeMode); - if (_upgradeMode) { - // may overwrite some settings - _satResolver->setDistupgrade_removeunsupported (false); - } - - // Resetting additional solver information - _isInstalledBy.clear(); - _installs.clear(); - _satifiedByInstalled.clear(); - _installedSatisfied.clear(); -} - -bool Resolver::resolvePool() -{ - solverInit(); - return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak, _upgradeRepos ); -} - -bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue ) -{ - solverInit(); - - // add/remove additional SolverQueueItems - for (SolverQueueItemList::const_iterator iter = _removed_queue_items.begin(); - iter != _removed_queue_items.end(); iter++) { - for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) { - if ( (*iterQueue)->cmp(*iter) == 0) { - MIL << "remove from queue" << *iter; - queue.remove(*iterQueue); - break; - } - } - } - - for (SolverQueueItemList::const_iterator iter = _added_queue_items.begin(); - iter != _added_queue_items.end(); iter++) { - bool found = false; - for (SolverQueueItemList::const_iterator iterQueue = queue.begin(); iterQueue != queue.end(); iterQueue++) { - if ( (*iterQueue)->cmp(*iter) == 0) { - found = true; - break; - } - } - if (!found) { - MIL << "add to queue" << *iter; - queue.push_back(*iter); - } - } - - // The application has to take care to write these solutions back to e.g. selectables in order - // give the user a chance for changing these decisions again. - _removed_queue_items.clear(); - _added_queue_items.clear(); - - return _satResolver->resolveQueue(queue, _addWeak); -} - -sat::Transaction Resolver::getTransaction() -{ - // FIXME: That's an ugly way of pushing autoInstalled into the transaction. - sat::Transaction ret( sat::Transaction::loadFromPool ); - ret.autoInstalled( _satResolver->autoInstalled() ); - return ret; -} - - -//---------------------------------------------------------------------------- -// Getting more information about the solve results - -ResolverProblemList Resolver::problems() const -{ - MIL << "Resolver::problems()" << endl; - return _satResolver->problems(); -} - -void Resolver::applySolutions( const ProblemSolutionList & solutions ) -{ - for_( iter, solutions.begin(), solutions.end() ) - { - ProblemSolution_Ptr solution = *iter; - if ( !solution->apply( *this ) ) - break; - } -} - -void Resolver::collectResolverInfo() -{ - if ( _satResolver - && _isInstalledBy.empty() - && _installs.empty()) { - - // generating new - PoolItemList itemsToInstall = _satResolver->resultItemsToInstall(); - - for (PoolItemList::const_iterator instIter = itemsToInstall.begin(); - instIter != itemsToInstall.end(); instIter++) { - // Requires - for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::REQUIRES).begin(); capIt != (*instIter)->dep (Dep::REQUIRES).end(); ++capIt) - { - sat::WhatProvides possibleProviders(*capIt); - for_( iter, possibleProviders.begin(), possibleProviders.end() ) { - PoolItem provider = ResPool::instance().find( *iter ); - - // searching if this provider will already be installed - bool found = false; - bool alreadySetForInstallation = false; - ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider); - while (pos != _isInstalledBy.end() - && pos->first == provider - && !found) { - alreadySetForInstallation = true; - ItemCapKind capKind = pos->second; - if (capKind.item == *instIter) found = true; - pos++; - } - - if (!found - && provider.status().isToBeInstalled()) { - if (provider.status().isBySolver()) { - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, !alreadySetForInstallation ); - _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy)); - } else { - // no initial installation cause it has been set be e.g. user - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::REQUIRES, false ); - _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy)); - } - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, !alreadySetForInstallation ); - _installs.insert (make_pair( *instIter, capKindisInstalledBy)); - } - - if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::REQUIRES, false ); - _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy)); - - ItemCapKind installedSatisfied( *instIter, *capIt, Dep::REQUIRES, false ); - _installedSatisfied.insert (make_pair( provider, installedSatisfied)); - } - } - } - - if (!(_satResolver->onlyRequires())) { - //Recommends - for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::RECOMMENDS).begin(); capIt != (*instIter)->dep (Dep::RECOMMENDS).end(); ++capIt) - { - sat::WhatProvides possibleProviders(*capIt); - for_( iter, possibleProviders.begin(), possibleProviders.end() ) { - PoolItem provider = ResPool::instance().find( *iter ); - - // searching if this provider will already be installed - bool found = false; - bool alreadySetForInstallation = false; - ItemCapKindMap::const_iterator pos = _isInstalledBy.find(provider); - while (pos != _isInstalledBy.end() - && pos->first == provider - && !found) { - alreadySetForInstallation = true; - ItemCapKind capKind = pos->second; - if (capKind.item == *instIter) found = true; - pos++; - } - - if (!found - && provider.status().isToBeInstalled()) { - if (provider.status().isBySolver()) { - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation ); - _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy)); - } else { - // no initial installation cause it has been set be e.g. user - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::RECOMMENDS, false ); - _isInstalledBy.insert (make_pair( provider, capKindisInstalledBy)); - } - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, !alreadySetForInstallation ); - _installs.insert (make_pair( *instIter, capKindisInstalledBy)); - } - - if (provider.status().staysInstalled()) { // Is already satisfied by an item which is installed - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::RECOMMENDS, false ); - _satifiedByInstalled.insert (make_pair( *instIter, capKindisInstalledBy)); - - ItemCapKind installedSatisfied( *instIter, *capIt, Dep::RECOMMENDS, false ); - _installedSatisfied.insert (make_pair( provider, installedSatisfied)); - } - } - } - - //Supplements - for (Capabilities::const_iterator capIt = (*instIter)->dep (Dep::SUPPLEMENTS).begin(); capIt != (*instIter)->dep (Dep::SUPPLEMENTS).end(); ++capIt) - { - sat::WhatProvides possibleProviders(*capIt); - for_( iter, possibleProviders.begin(), possibleProviders.end() ) { - PoolItem provider = ResPool::instance().find( *iter ); - // searching if this item will already be installed - bool found = false; - bool alreadySetForInstallation = false; - ItemCapKindMap::const_iterator pos = _isInstalledBy.find(*instIter); - while (pos != _isInstalledBy.end() - && pos->first == *instIter - && !found) { - alreadySetForInstallation = true; - ItemCapKind capKind = pos->second; - if (capKind.item == provider) found = true; - pos++; - } - - if (!found - && instIter->status().isToBeInstalled()) { - if (instIter->status().isBySolver()) { - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation ); - _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy)); - } else { - // no initial installation cause it has been set be e.g. user - ItemCapKind capKindisInstalledBy( provider, *capIt, Dep::SUPPLEMENTS, false ); - _isInstalledBy.insert (make_pair( *instIter, capKindisInstalledBy)); - } - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation ); - _installs.insert (make_pair( provider, capKindisInstalledBy)); - } - - if (instIter->status().staysInstalled()) { // Is already satisfied by an item which is installed - ItemCapKind capKindisInstalledBy( *instIter, *capIt, Dep::SUPPLEMENTS, !alreadySetForInstallation ); - _satifiedByInstalled.insert (make_pair( provider, capKindisInstalledBy)); - - ItemCapKind installedSatisfied( provider, *capIt, Dep::SUPPLEMENTS, false ); - _installedSatisfied.insert (make_pair( *instIter, installedSatisfied)); - } - } - } - } - } - } -} - - -ItemCapKindList Resolver::isInstalledBy( const PoolItem & item ) -{ - ItemCapKindList ret; - collectResolverInfo(); - - for (ItemCapKindMap::const_iterator iter = _isInstalledBy.find(item); iter != _isInstalledBy.end();) { - ItemCapKind info = iter->second; - PoolItem iterItem = iter->first; - if (iterItem == item) { - ret.push_back(info); - iter++; - } else { - // exit - iter = _isInstalledBy.end(); - } - } - return ret; -} - -ItemCapKindList Resolver::installs( const PoolItem & item ) -{ - ItemCapKindList ret; - collectResolverInfo(); - - for (ItemCapKindMap::const_iterator iter = _installs.find(item); iter != _installs.end();) { - ItemCapKind info = iter->second; - PoolItem iterItem = iter->first; - if (iterItem == item) { - ret.push_back(info); - iter++; - } else { - // exit - iter = _installs.end(); - } - } - return ret; -} - -ItemCapKindList Resolver::satifiedByInstalled( const PoolItem & item ) -{ - ItemCapKindList ret; - collectResolverInfo(); - - for (ItemCapKindMap::const_iterator iter = _satifiedByInstalled.find(item); iter != _satifiedByInstalled.end();) { - ItemCapKind info = iter->second; - PoolItem iterItem = iter->first; - if (iterItem == item) { - ret.push_back(info); - iter++; - } else { - // exit - iter = _satifiedByInstalled.end(); - } - } - return ret; -} - -ItemCapKindList Resolver::installedSatisfied( const PoolItem & item ) -{ - ItemCapKindList ret; - collectResolverInfo(); - - for (ItemCapKindMap::const_iterator iter = _installedSatisfied.find(item); iter != _installedSatisfied.end();) { - ItemCapKind info = iter->second; - PoolItem iterItem = iter->first; - if (iterItem == item) { - ret.push_back(info); - iter++; - } else { - // exit - iter = _installedSatisfied.end(); - } - } - return ret; -} - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/solver/detail/Resolver.h b/libzypp/zypp/solver/detail/Resolver.h deleted file mode 100644 index 10f140a..0000000 --- a/libzypp/zypp/solver/detail/Resolver.h +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver.h - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_RESOLVER_H -#define ZYPP_SOLVER_DETAIL_RESOLVER_H - -#include -#include -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/ResPool.h" -#include "zypp/TriBool.h" -#include "zypp/base/SerialNumber.h" - -#include "zypp/solver/detail/Types.h" -#include "zypp/solver/detail/SolverQueueItem.h" - -#include "zypp/ProblemTypes.h" -#include "zypp/ResolverProblem.h" -#include "zypp/ProblemSolution.h" -#include "zypp/Capabilities.h" -#include "zypp/Capability.h" - - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - namespace sat - { - class Transaction; - } - - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - class SATResolver; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ItemCapKind - // - /** */ - struct ItemCapKind - { - public: - Capability cap; //Capability which has triggerd this selection - Dep capKind; //Kind of that capability - PoolItem item; //Item which has triggered this selection - bool initialInstallation; //This item has triggered the installation - //Not already fullfilled requierement only. - - ItemCapKind() : capKind(Dep::PROVIDES) {} - ItemCapKind( PoolItem i, Capability c, Dep k, bool initial) - : cap( c ) - , capKind( k ) - , item( i ) - , initialInstallation( initial ) - { } - }; - typedef std::multimap ItemCapKindMap; - typedef std::list ItemCapKindList; - - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : Resolver -/** A mid layer class we should remove - * \todo Merge this and class SATResolver. Logic and date are horribly - * distributed between this and SATResolver. Either SATResolver becomes - * a pure wrapper adapting the libsolv C interface to fit our needs, and - * all the solver logic and problem handling goes here; or completely merge - * both classes. - */ -class Resolver : public base::ReferenceCounted, private base::NonCopyable { - - private: - ResPool _pool; - SATResolver *_satResolver; - SerialNumberWatcher _poolchanged; - - CapabilitySet _extra_requires; - CapabilitySet _extra_conflicts; - std::set _upgradeRepos; - - // Regard dependencies of the item weak onl - PoolItemList _addWeak; - - /** \name Solver flags */ - //@{ - bool _forceResolve; // remove items which are conflicts with others or - // have unfulfilled requirements. - // This behaviour is favourited by ZMD - bool _upgradeMode; // Resolver has been called with doUpgrade - bool _updateMode; // Resolver has been called with doUpdate - bool _verifying; // The system will be checked - bool _onlyRequires; // do install required resolvables only - // no recommended resolvables, language - // packages, hardware packages (modalias) - bool _allowVendorChange; // whether the solver should allow or disallow vendor changes. - bool _solveSrcPackages; // whether to generate solver jobs for selected source packges. - bool _cleandepsOnRemove; // whether removing a package should also remove no longer needed requirements - - bool _ignoreAlreadyRecommended; //ignore recommended packages that have already been recommended by the installed packages - //@} - - // Additional QueueItems which has to be regarded by the solver - // This will be used e.g. by solution actions - solver::detail::SolverQueueItemList _removed_queue_items; - solver::detail::SolverQueueItemList _added_queue_items; - - // Additional information about the solverrun - ItemCapKindMap _isInstalledBy; - ItemCapKindMap _installs; - ItemCapKindMap _satifiedByInstalled; - ItemCapKindMap _installedSatisfied; - - // helpers - void collectResolverInfo(); - - // Unmaintained packages which does not fit to the updated system - // (broken dependencies) will be deleted. - // returns true if solving was successful - bool checkUnmaintainedItems (); - - void solverInit(); - - public: - - Resolver( const ResPool & pool ); - virtual ~Resolver(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - friend std::ostream& operator<<( std::ostream& str, const Resolver & obj ) - { return obj.dumpOn (str); } - - // ---------------------------------- methods - - ResPool pool() const; - void setPool( const ResPool & pool ) { _pool = pool; } - - void addUpgradeRepo( Repository repo_r ) { if ( repo_r && ! repo_r.isSystemRepo() ) _upgradeRepos.insert( repo_r ); } - bool upgradingRepo( Repository repo_r ) const { return( _upgradeRepos.find( repo_r ) != _upgradeRepos.end() ); } - void removeUpgradeRepo( Repository repo_r ) { _upgradeRepos.erase( repo_r ); } - void removeUpgradeRepos() { _upgradeRepos.clear(); } - const std::set & upgradeRepos() const { return _upgradeRepos; } - - void addExtraRequire( const Capability & capability ); - void removeExtraRequire( const Capability & capability ); - void addExtraConflict( const Capability & capability ); - void removeExtraConflict( const Capability & capability ); - - void removeQueueItem( SolverQueueItem_Ptr item ); - void addQueueItem( SolverQueueItem_Ptr item ); - - CapabilitySet extraRequires() const { return _extra_requires; } - CapabilitySet extraConflicts() const { return _extra_conflicts; } - - void addWeak( const PoolItem & item ); - - bool verifySystem(); - bool resolvePool(); - bool resolveQueue( SolverQueueItemList & queue ); - void doUpdate(); - - bool doUpgrade(); - PoolItemList problematicUpdateItems() const; - - /** \name Solver flags */ - //@{ - bool ignoreAlreadyRecommended() const { return _ignoreAlreadyRecommended; } - void setIgnoreAlreadyRecommended( bool yesno_r ) { _ignoreAlreadyRecommended = yesno_r; } - - bool onlyRequires () const { return _onlyRequires; } - void setOnlyRequires( TriBool state_r ); - - bool forceResolve() const { return _forceResolve; } - void setForceResolve( TriBool state_r ) { _forceResolve = indeterminate(state_r) ? false : bool(state_r); } - - bool isUpgradeMode() const { return _upgradeMode; }// Resolver has been called with doUpgrade - void setUpgradeMode( bool yesno_r ) { _upgradeMode = yesno_r; } - - bool isUpdateMode() const { return _updateMode; } // Resolver has been called with doUpdate - - bool isVerifyingMode() const { return _verifying; } // The system will be checked - void setVerifyingMode( TriBool state_r ) { _verifying = indeterminate(state_r) ? false : bool(state_r); } - - bool allowVendorChange() const { return _allowVendorChange; } - void setAllowVendorChange( TriBool state_r ); - - bool solveSrcPackages() const { return _solveSrcPackages; } - void setSolveSrcPackages( TriBool state_r ) { _solveSrcPackages = indeterminate(state_r) ? false : bool(state_r); } - - bool cleandepsOnRemove() const { return _cleandepsOnRemove; } - void setCleandepsOnRemove( TriBool state_r ); - //@} - - ResolverProblemList problems() const; - void applySolutions( const ProblemSolutionList & solutions ); - - // Return the Transaction computed by the last solver run. - sat::Transaction getTransaction(); - - // reset all SOLVER transaction in pool - void undo(); - - void reset( bool keepExtras = false ); - - // Get more information about the solverrun - // Which item will be installed by another item or triggers an item for - // installation - ItemCapKindList isInstalledBy( const PoolItem & item ); - ItemCapKindList installs( const PoolItem & item ); - ItemCapKindList satifiedByInstalled (const PoolItem & item ); - ItemCapKindList installedSatisfied( const PoolItem & item ); - -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_RESOLVER_H diff --git a/libzypp/zypp/solver/detail/SATResolver.cc b/libzypp/zypp/solver/detail/SATResolver.cc deleted file mode 100644 index 82a7e4f..0000000 --- a/libzypp/zypp/solver/detail/SATResolver.cc +++ /dev/null @@ -1,1555 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SATResolver.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -#include -#include -#include -#include -#include -#include -} - -#include "zypp/solver/detail/Helper.h" -#include "zypp/base/String.h" -#include "zypp/Product.h" -#include "zypp/Capability.h" -#include "zypp/ResStatus.h" -#include "zypp/VendorAttr.h" -#include "zypp/base/LogTools.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Algorithm.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/ZConfig.h" -#include "zypp/sat/Pool.h" -#include "zypp/sat/WhatProvides.h" -#include "zypp/sat/WhatObsoletes.h" -#include "zypp/solver/detail/SATResolver.h" -#include "zypp/solver/detail/ProblemSolutionCombi.h" -#include "zypp/solver/detail/ProblemSolutionIgnore.h" -#include "zypp/solver/detail/SolverQueueItemInstall.h" -#include "zypp/solver/detail/SolverQueueItemDelete.h" -#include "zypp/solver/detail/SystemCheck.h" -#include "zypp/sat/Transaction.h" -#include "zypp/sat/Queue.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////////////// - namespace env - { - inline bool HACKENV( const char * var_r, bool default_r ) - { - bool ret = default_r; - const char * val = ::getenv( var_r ); - if ( val ) - { - ret = str::strToBool( val, default_r ); - if ( ret != default_r ) - INT << "HACKENV " << var_r << " = " << ret << endl; - } - return ret; - } - } // namespace env - ///////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SATResolver); - -#define MAYBE_CLEANDEPS (cleandepsOnRemove()?SOLVER_CLEANDEPS:0) - -//--------------------------------------------------------------------------- -// Callbacks for SAT policies -//--------------------------------------------------------------------------- - -int vendorCheck( Pool *pool, Solvable *solvable1, Solvable *solvable2 ) -{ - return VendorAttr::instance().equivalent( IdString(solvable1->vendor), - IdString(solvable2->vendor) ) ? 0 : 1; -} - - -inline std::string itemToString( const PoolItem & item ) -{ - if ( !item ) - return std::string(); - - sat::Solvable slv( item.satSolvable() ); - std::string ret( slv.asString() ); // n-v-r.a - if ( ! slv.isSystem() ) - { - ret += "["; - ret += slv.repository().alias(); - ret += "]"; - } - return ret; -} - -inline PoolItem getPoolItem( Id id_r ) -{ - PoolItem ret( (sat::Solvable( id_r )) ); - if ( !ret && id_r ) - INT << "id " << id_r << " not found in ZYPP pool." << endl; - return ret; -} - -//--------------------------------------------------------------------------- - -std::ostream & -SATResolver::dumpOn( std::ostream & os ) const -{ - os << "" << endl; - if (_solv) { -#define OUTS(X) os << " " << #X << "\t= " << solver_get_flag(_solv, SOLVER_FLAG_##X) << endl - OUTS( ALLOW_DOWNGRADE ); - OUTS( ALLOW_ARCHCHANGE ); - OUTS( ALLOW_VENDORCHANGE ); - OUTS( ALLOW_UNINSTALL ); - OUTS( NO_UPDATEPROVIDE ); - OUTS( SPLITPROVIDES ); - OUTS( IGNORE_RECOMMENDED ); - OUTS( ADD_ALREADY_RECOMMENDED ); - OUTS( NO_INFARCHCHECK ); - OUTS( ALLOW_NAMECHANGE ); - OUTS( KEEP_EXPLICIT_OBSOLETES ); - OUTS( BEST_OBEY_POLICY ); - OUTS( NO_AUTOTARGET ); - OUTS( DUP_ALLOW_DOWNGRADE ); - OUTS( DUP_ALLOW_ARCHCHANGE ); - OUTS( DUP_ALLOW_VENDORCHANGE ); - OUTS( DUP_ALLOW_NAMECHANGE ); - OUTS( KEEP_ORPHANS ); - OUTS( BREAK_ORPHANS ); - OUTS( FOCUS_INSTALLED ); - OUTS( YUM_OBSOLETES ); -#undef OUTS - os << " distupgrade = " << _distupgrade << endl; - os << " distupgrade_removeunsupported = " << _distupgrade_removeunsupported << endl; - os << " solveSrcPackages = " << _solveSrcPackages << endl; - os << " cleandepsOnRemove = " << _cleandepsOnRemove << endl; - os << " fixsystem = " << _fixsystem << endl; - } else { - os << ""; - } - return os << "" << endl; -} - -//--------------------------------------------------------------------------- - -SATResolver::SATResolver (const ResPool & pool, Pool *SATPool) - : _pool (pool) - , _SATPool (SATPool) - , _solv(NULL) - , _fixsystem(false) - , _allowdowngrade(false) - , _allowarchchange(false) - , _allowvendorchange(ZConfig::instance().solver_allowVendorChange()) - , _allowuninstall(false) - , _updatesystem(false) - , _noupdateprovide(false) - , _dosplitprovides(false) - , _onlyRequires(ZConfig::instance().solver_onlyRequires()) - , _ignorealreadyrecommended(true) - , _distupgrade(false) - , _distupgrade_removeunsupported(false) - , _solveSrcPackages(false) - , _cleandepsOnRemove(ZConfig::instance().solver_cleandepsOnRemove()) -{ -} - - -SATResolver::~SATResolver() -{ - solverEnd(); -} - -//--------------------------------------------------------------------------- - -ResPool -SATResolver::pool (void) const -{ - return _pool; -} - -void -SATResolver::resetItemTransaction (PoolItem item) -{ - bool found = false; - for (PoolItemList::const_iterator iter = _items_to_remove.begin(); - iter != _items_to_remove.end(); ++iter) { - if (*iter == item) { - _items_to_remove.remove(*iter); - found = true; - break; - } - } - if (!found) { - for (PoolItemList::const_iterator iter = _items_to_install.begin(); - iter != _items_to_install.end(); ++iter) { - if (*iter == item) { - _items_to_install.remove(*iter); - found = true; - break; - } - } - } - if (!found) { - for (PoolItemList::const_iterator iter = _items_to_keep.begin(); - iter != _items_to_keep.end(); ++iter) { - if (*iter == item) { - _items_to_keep.remove(*iter); - found = true; - break; - } - } - } - if (!found) { - for (PoolItemList::const_iterator iter = _items_to_lock.begin(); - iter != _items_to_lock.end(); ++iter) { - if (*iter == item) { - _items_to_lock.remove(*iter); - found = true; - break; - } - } - } -} - - -void -SATResolver::addPoolItemToInstall (PoolItem item) -{ - resetItemTransaction (item); - _items_to_install.push_back (item); - _items_to_install.unique (); -} - - -void -SATResolver::addPoolItemsToInstallFromList (PoolItemList & rl) -{ - for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) { - addPoolItemToInstall (*iter); - } -} - - -void -SATResolver::addPoolItemToRemove (PoolItem item) -{ - resetItemTransaction (item); - _items_to_remove.push_back (item); - _items_to_remove.unique (); -} - - -void -SATResolver::addPoolItemsToRemoveFromList (PoolItemList & rl) -{ - for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) { - addPoolItemToRemove (*iter); - } -} - -void -SATResolver::addPoolItemToLock (PoolItem item) -{ - resetItemTransaction (item); - _items_to_lock.push_back (item); - _items_to_lock.unique (); -} - -void -SATResolver::addPoolItemToKeep (PoolItem item) -{ - resetItemTransaction (item); - _items_to_keep.push_back (item); - _items_to_keep.unique (); -} - -//--------------------------------------------------------------------------- - -// copy marked item from solution back to pool -// if data != NULL, set as APPL_LOW (from establishPool()) - -static void -SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::TransactByValue causer) -{ - // resetting - item.status().resetTransact (causer); - item.status().resetWeak (); - - bool r; - - // installation/deletion - if (status.isToBeInstalled()) { - r = item.status().setToBeInstalled (causer); - _XDEBUG("SATSolutionToPool install returns " << item << ", " << r); - } - else if (status.isToBeUninstalledDueToUpgrade()) { - r = item.status().setToBeUninstalledDueToUpgrade (causer); - _XDEBUG("SATSolutionToPool upgrade returns " << item << ", " << r); - } - else if (status.isToBeUninstalled()) { - r = item.status().setToBeUninstalled (causer); - _XDEBUG("SATSolutionToPool remove returns " << item << ", " << r); - } - - return; -} - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -// resolvePool -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Helper functions for the ZYPP-Pool -//---------------------------------------------------------------------------- - - -//------------------------------------------------------------------------------------------------------------ -// This function loops over the pool and grabs all items -// It clears all previous bySolver() states also -// -// Every toBeInstalled is passed to zypp::solver:detail::Resolver.addPoolItemToInstall() -// Every toBeUninstalled is passed to zypp::solver:detail::Resolver.addPoolItemToRemove() -// -// Solver results must be written back to the pool. -//------------------------------------------------------------------------------------------------------------ - - -struct SATCollectTransact : public resfilter::PoolItemFilterFunctor -{ - SATResolver & resolver; - - SATCollectTransact (SATResolver & r) - : resolver (r) - { } - - bool operator()( PoolItem item ) // only transacts() items go here - { - ResStatus status = item.status(); - bool by_solver = (status.isBySolver() || status.isByApplLow()); - - if (by_solver) { - item.status().resetTransact( ResStatus::APPL_LOW );// clear any solver/establish transactions - return true; // back out here, dont re-queue former solver result - } - - if ( item.satSolvable().isKind() && ! resolver.solveSrcPackages() ) - { - // Later we may continue on a per source package base. - return true; // dont process this source package. - } - - if (status.isToBeInstalled()) { - resolver.addPoolItemToInstall(item); // -> install! - } - else if (status.isToBeUninstalled()) { - resolver.addPoolItemToRemove(item); // -> remove ! - } - else if (status.isLocked() - && !by_solver) { - resolver.addPoolItemToLock (item); - } - else if (status.isKept() - && !by_solver) { - resolver.addPoolItemToKeep (item); - } - - return true; - } -}; - - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -// solving..... -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - - -class CheckIfUpdate : public resfilter::PoolItemFilterFunctor -{ - public: - bool is_updated; - bool multiversion; - sat::Solvable _installed; - - CheckIfUpdate( sat::Solvable installed_r ) - : is_updated( false ) - , multiversion( installed_r.multiversionInstall() ) - , _installed( installed_r ) - {} - - // check this item will be updated - - bool operator()( PoolItem item ) - { - if ( item.status().isToBeInstalled() ) - { - if ( ! multiversion || sameNVRA( _installed, item ) ) - { - is_updated = true; - return false; - } - } - return true; - } -}; - - -class CollectPseudoInstalled : public resfilter::PoolItemFilterFunctor -{ - public: - Queue *solvableQueue; - - CollectPseudoInstalled( Queue *queue ) - :solvableQueue (queue) - {} - - // collecting PseudoInstalled items - bool operator()( PoolItem item ) - { - if ( traits::isPseudoInstalled( item.satSolvable().kind() ) ) - queue_push( solvableQueue, item.satSolvable().id() ); - return true; - } -}; - -bool -SATResolver::solving(const CapabilitySet & requires_caps, - const CapabilitySet & conflict_caps) -{ - _solv = solver_create( _SATPool ); - ::pool_set_custom_vendorcheck( _SATPool, &vendorCheck ); - if (_fixsystem) { - queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (_updatesystem) { - queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (_distupgrade) { - queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (_distupgrade_removeunsupported) { - queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - solver_set_flag(_solv, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange); - solver_set_flag(_solv, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides); - solver_set_flag(_solv, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide); - solver_set_flag(_solv, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires); - -#define HACKENV(X,D) solver_set_flag(_solv, X, env::HACKENV( #X, D ) ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, true ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, true ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE,true ); - HACKENV( SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, true ); -#undef HACKENV - - sat::Pool::instance().prepareForSolving(); - - // Solve ! - MIL << "Starting solving...." << endl; - MIL << *this; - solver_solve( _solv, &(_jobQueue) ); - MIL << "....Solver end" << endl; - - // copying solution back to zypp pool - //----------------------------------------- - _result_items_to_install.clear(); - _result_items_to_remove.clear(); - - /* solvables to be installed */ - Queue decisionq; - queue_init(&decisionq); - solver_get_decisionqueue(_solv, &decisionq); - for ( int i = 0; i < decisionq.count; ++i ) - { - sat::Solvable slv( decisionq.elements[i] ); - if ( !slv || slv.isSystem() ) - continue; - - PoolItem poolItem( slv ); - SATSolutionToPool (poolItem, ResStatus::toBeInstalled, ResStatus::SOLVER); - _result_items_to_install.push_back (poolItem); - } - queue_free(&decisionq); - - /* solvables to be erased */ - Repository systemRepo( sat::Pool::instance().findSystemRepo() ); // don't create if it does not exist - if ( systemRepo && ! systemRepo.solvablesEmpty() ) - { - bool mustCheckObsoletes = false; - for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() ) - { - if (solver_get_decisionlevel(_solv, it->id()) > 0) - continue; - - // Check if this is an update - CheckIfUpdate info( *it ); - PoolItem poolItem( *it ); - invokeOnEach( _pool.byIdentBegin( poolItem ), - _pool.byIdentEnd( poolItem ), - resfilter::ByUninstalled(), // ByUninstalled - functor::functorRef (info) ); - - if (info.is_updated) { - SATSolutionToPool( poolItem, ResStatus::toBeUninstalledDueToUpgrade, ResStatus::SOLVER ); - } else { - SATSolutionToPool( poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER ); - if ( ! mustCheckObsoletes ) - mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete - } - _result_items_to_remove.push_back (poolItem); - } - if ( mustCheckObsoletes ) - { - sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() ); - for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() ) - { - ResStatus & status( it->status() ); - // WhatObsoletes contains installed items only! - if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() ) - status.setToBeUninstalledDueToObsolete(); - } - } - } - - Queue recommendations; - Queue suggestions; - Queue orphaned; - Queue unneeded; - queue_init(&recommendations); - queue_init(&suggestions); - queue_init(&orphaned); - queue_init(&unneeded); - solver_get_recommendations(_solv, &recommendations, &suggestions, 0); - solver_get_orphaned(_solv, &orphaned); - solver_get_unneeded(_solv, &unneeded, 1); - /* solvables which are recommended */ - for ( int i = 0; i < recommendations.count; ++i ) - { - PoolItem poolItem( getPoolItem( recommendations.elements[i] ) ); - poolItem.status().setRecommended( true ); - } - - /* solvables which are suggested */ - for ( int i = 0; i < suggestions.count; ++i ) - { - PoolItem poolItem( getPoolItem( suggestions.elements[i] ) ); - poolItem.status().setSuggested( true ); - } - - _problem_items.clear(); - /* solvables which are orphaned */ - for ( int i = 0; i < orphaned.count; ++i ) - { - PoolItem poolItem( getPoolItem( orphaned.elements[i] ) ); - poolItem.status().setOrphaned( true ); - _problem_items.push_back( poolItem ); - } - - /* solvables which are unneeded */ - for ( int i = 0; i < unneeded.count; ++i ) - { - PoolItem poolItem( getPoolItem( unneeded.elements[i] ) ); - poolItem.status().setUnneeded( true ); - } - - queue_free(&recommendations); - queue_free(&suggestions); - queue_free(&orphaned); - queue_free(&unneeded); - - /* Write validation state back to pool */ - Queue flags, solvableQueue; - - queue_init(&flags); - queue_init(&solvableQueue); - - CollectPseudoInstalled collectPseudoInstalled(&solvableQueue); - invokeOnEach( _pool.begin(), - _pool.end(), - functor::functorRef (collectPseudoInstalled) ); - solver_trivial_installable(_solv, &solvableQueue, &flags ); - for (int i = 0; i < solvableQueue.count; i++) { - PoolItem item = _pool.find (sat::Solvable(solvableQueue.elements[i])); - item.status().setUndetermined(); - - if (flags.elements[i] == -1) { - item.status().setNonRelevant(); - _XDEBUG("SATSolutionToPool(" << item << " ) nonRelevant !"); - } else if (flags.elements[i] == 1) { - item.status().setSatisfied(); - _XDEBUG("SATSolutionToPool(" << item << " ) satisfied !"); - } else if (flags.elements[i] == 0) { - item.status().setBroken(); - _XDEBUG("SATSolutionToPool(" << item << " ) broken !"); - } - } - queue_free(&(solvableQueue)); - queue_free(&flags); - - - // Solvables which were selected due requirements which have been made by the user will - // be selected by APPL_LOW. We can't use any higher level, because this setting must - // not serve as a request for the next solver run. APPL_LOW is reset before solving. - for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) { - sat::WhatProvides rpmProviders(*iter); - for_( iter2, rpmProviders.begin(), rpmProviders.end() ) { - PoolItem poolItem(*iter2); - if (poolItem.status().isToBeInstalled()) { - MIL << "User requirement " << *iter << " sets " << poolItem << endl; - poolItem.status().setTransactByValue (ResStatus::APPL_LOW); - } - } - } - for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) { - sat::WhatProvides rpmProviders(*iter); - for_( iter2, rpmProviders.begin(), rpmProviders.end() ) { - PoolItem poolItem(*iter2); - if (poolItem.status().isToBeUninstalled()) { - MIL << "User conflict " << *iter << " sets " << poolItem << endl; - poolItem.status().setTransactByValue (ResStatus::APPL_LOW); - } - } - } - - if (solver_problem_count(_solv) > 0 ) - { - ERR << "Solverrun finished with an ERROR" << endl; - return false; - } - - return true; -} - - -void -SATResolver::solverInit(const PoolItemList & weakItems) -{ - SATCollectTransact info (*this); - - MIL << "SATResolver::solverInit()" << endl; - - // remove old stuff - solverEnd(); - - queue_init( &_jobQueue ); - _items_to_install.clear(); - _items_to_remove.clear(); - _items_to_lock.clear(); - _items_to_keep.clear(); - - invokeOnEach ( _pool.begin(), _pool.end(), - functor::functorRef(info) ); - - for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) { - Id id = (*iter)->satSolvable().id(); - if (id == ID_NULL) { - ERR << "Weaken: " << *iter << " not found" << endl; - } - MIL << "Weaken dependencies of " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_WEAKENDEPS | SOLVER_SOLVABLE ); - queue_push( &(_jobQueue), id ); - } - - // Add rules for parallel installable resolvables with different versions - for_( it, sat::Pool::instance().multiversionBegin(), sat::Pool::instance().multiversionEnd() ) - { - queue_push( &(_jobQueue), SOLVER_NOOBSOLETES | SOLVER_SOLVABLE_NAME ); - queue_push( &(_jobQueue), it->id() ); - } - - ::pool_add_userinstalled_jobs(_SATPool, sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED); - - if ( _distupgrade ) - { - if ( ZConfig::instance().solverUpgradeRemoveDroppedPackages() ) - { - MIL << "Checking droplists ..." << endl; - // Dropped packages: look for 'weakremover()' provides - // in dup candidates of installed products. - ResPoolProxy proxy( ResPool::instance().proxy() ); - for_( it, proxy.byKindBegin(), proxy.byKindEnd() ) - { - if ( (*it)->onSystem() ) // (to install) or (not to delete) - { - Product::constPtr prodCand( (*it)->candidateAsKind() ); - if ( ! prodCand ) - continue; // product no longer available - - CapabilitySet droplist( prodCand->droplist() ); - dumpRangeLine( MIL << "Droplist for " << (*it)->candidateObj() << ": " << droplist.size() << " ", droplist.begin(), droplist.end() ) << endl; - for_( cap, droplist.begin(), droplist.end() ) - { - queue_push( &_jobQueue, SOLVER_DROP_ORPHANED | SOLVER_SOLVABLE_NAME ); - queue_push( &_jobQueue, cap->id() ); - } - } - } - } - else - { - MIL << "Droplist processing is disabled." << endl; - } - } -} - -void -SATResolver::solverEnd() -{ - // cleanup - if ( _solv ) - { - solver_free(_solv); - _solv = NULL; - queue_free( &(_jobQueue) ); - } -} - - -bool -SATResolver::resolvePool(const CapabilitySet & requires_caps, - const CapabilitySet & conflict_caps, - const PoolItemList & weakItems, - const std::set & upgradeRepos) -{ - MIL << "SATResolver::resolvePool()" << endl; - - // initialize - solverInit(weakItems); - - for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) { - Id id = (*iter)->satSolvable().id(); - if (id == ID_NULL) { - ERR << "Install: " << *iter << " not found" << endl; - } else { - MIL << "Install " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE ); - queue_push( &(_jobQueue), id ); - } - } - - for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) { - Id id = (*iter)->satSolvable().id(); - if (id == ID_NULL) { - ERR << "Delete: " << *iter << " not found" << endl; - } else { - MIL << "Delete " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), id); - } - } - - for_( iter, upgradeRepos.begin(), upgradeRepos.end() ) - { - queue_push( &(_jobQueue), SOLVER_DISTUPGRADE | SOLVER_SOLVABLE_REPO ); - queue_push( &(_jobQueue), iter->get()->repoid ); - MIL << "Upgrade repo " << *iter << endl; - } - - for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter != requires_caps.end(); iter++) { - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES ); - queue_push( &(_jobQueue), iter->id() ); - MIL << "Requires " << *iter << endl; - } - - for (CapabilitySet::const_iterator iter = conflict_caps.begin(); iter != conflict_caps.end(); iter++) { - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), iter->id() ); - MIL << "Conflicts " << *iter << endl; - } - - // set requirements for a running system - setSystemRequirements(); - - // set locks for the solver - setLocks(); - - // solving - bool ret = solving(requires_caps, conflict_caps); - - (ret?MIL:WAR) << "SATResolver::resolvePool() done. Ret:" << ret << endl; - return ret; -} - - -bool -SATResolver::resolveQueue(const SolverQueueItemList &requestQueue, - const PoolItemList & weakItems) -{ - MIL << "SATResolver::resolvQueue()" << endl; - - // initialize - solverInit(weakItems); - - // generate solver queue - for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) { - (*iter)->addRule(_jobQueue); - } - - // Add addition item status to the resolve-queue cause these can be set by problem resolutions - for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) { - Id id = (*iter)->satSolvable().id(); - if (id == ID_NULL) { - ERR << "Install: " << *iter << " not found" << endl; - } else { - MIL << "Install " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE ); - queue_push( &(_jobQueue), id ); - } - } - for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) { - sat::detail::IdType ident( (*iter)->satSolvable().ident().id() ); - MIL << "Delete " << *iter << ident << endl; - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), ident); - } - - // set requirements for a running system - setSystemRequirements(); - - // set locks for the solver - setLocks(); - - // solving - bool ret = solving(); - - MIL << "SATResolver::resolveQueue() done. Ret:" << ret << endl; - return ret; -} - -/** \todo duplicate code to be joined with \ref solving. */ -void SATResolver::doUpdate() -{ - MIL << "SATResolver::doUpdate()" << endl; - - // initialize - solverInit(PoolItemList()); - - // set requirements for a running system - setSystemRequirements(); - - // set locks for the solver - setLocks(); - - _solv = solver_create( _SATPool ); - ::pool_set_custom_vendorcheck( _SATPool, &vendorCheck ); - if (_fixsystem) { - queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (1) { - queue_push( &(_jobQueue), SOLVER_UPDATE|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (_distupgrade) { - queue_push( &(_jobQueue), SOLVER_DISTUPGRADE|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - if (_distupgrade_removeunsupported) { - queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL); - queue_push( &(_jobQueue), 0 ); - } - solver_set_flag(_solv, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange); - solver_set_flag(_solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange); - solver_set_flag(_solv, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides); - solver_set_flag(_solv, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide); - solver_set_flag(_solv, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires); - - sat::Pool::instance().prepareForSolving(); - - // Solve ! - MIL << "Starting solving for update...." << endl; - MIL << *this; - solver_solve( _solv, &(_jobQueue) ); - MIL << "....Solver end" << endl; - - // copying solution back to zypp pool - //----------------------------------------- - - /* solvables to be installed */ - Queue decisionq; - queue_init(&decisionq); - solver_get_decisionqueue(_solv, &decisionq); - for (int i = 0; i < decisionq.count; i++) - { - Id p; - p = decisionq.elements[i]; - if (p < 0 || !sat::Solvable(p)) - continue; - if (sat::Solvable(p).repository().get() == _solv->pool->installed) - continue; - - PoolItem poolItem = _pool.find (sat::Solvable(p)); - if (poolItem) { - SATSolutionToPool (poolItem, ResStatus::toBeInstalled, ResStatus::SOLVER); - } else { - ERR << "id " << p << " not found in ZYPP pool." << endl; - } - } - queue_free(&decisionq); - - /* solvables to be erased */ - for (int i = _solv->pool->installed->start; i < _solv->pool->installed->start + _solv->pool->installed->nsolvables; i++) - { - if (solver_get_decisionlevel(_solv, i) > 0) - continue; - - PoolItem poolItem( _pool.find( sat::Solvable(i) ) ); - if (poolItem) { - // Check if this is an update - CheckIfUpdate info( (sat::Solvable(i)) ); - invokeOnEach( _pool.byIdentBegin( poolItem ), - _pool.byIdentEnd( poolItem ), - resfilter::ByUninstalled(), // ByUninstalled - functor::functorRef (info) ); - - if (info.is_updated) { - SATSolutionToPool (poolItem, ResStatus::toBeUninstalledDueToUpgrade , ResStatus::SOLVER); - } else { - SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER); - } - } else { - ERR << "id " << i << " not found in ZYPP pool." << endl; - } - } - MIL << "SATResolver::doUpdate() done" << endl; -} - - - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -// error handling -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// helper function -//---------------------------------------------------------------------------- - -struct FindPackage : public resfilter::ResObjectFilterFunctor -{ - ProblemSolutionCombi *problemSolution; - TransactionKind action; - FindPackage (ProblemSolutionCombi *p, const TransactionKind act) - : problemSolution (p) - , action (act) - { - } - - bool operator()( PoolItem p) - { - problemSolution->addSingleAction (p, action); - return true; - } -}; - - -//---------------------------------------------------------------------------- -// Checking if this solvable/item has a buddy which reflect the real -// user visible description of an item -// e.g. The release package has a buddy to the concerning product item. -// This user want's the message "Product foo conflicts with product bar" and -// NOT "package release-foo conflicts with package release-bar" -// (ma: that's why we should map just packages to buddies, not vice versa) -//---------------------------------------------------------------------------- -inline sat::Solvable mapBuddy( const PoolItem & item_r ) -{ - if ( item_r.satSolvable().isKind() ) - { - sat::Solvable buddy = item_r.buddy(); - if ( buddy ) - return buddy; - } - return item_r.satSolvable(); -} -inline sat::Solvable mapBuddy( sat::Solvable item_r ) -{ return mapBuddy( PoolItem( item_r ) ); } - -PoolItem SATResolver::mapItem ( const PoolItem & item ) -{ return PoolItem( mapBuddy( item ) ); } - -sat::Solvable SATResolver::mapSolvable ( const Id & id ) -{ return mapBuddy( sat::Solvable(id) ); } - -string SATResolver::SATprobleminfoString(Id problem, string &detail, Id &ignoreId) -{ - string ret; - Pool *pool = _solv->pool; - Id probr; - Id dep, source, target; - sat::Solvable s, s2; - - ignoreId = 0; - - // FIXME: solver_findallproblemrules to get all rules for this problem - // (the 'most relevabt' one returned by solver_findproblemrule is embedded - probr = solver_findproblemrule(_solv, problem); - switch (solver_ruleinfo(_solv, probr, &source, &target, &dep)) - { - case SOLVER_RULE_DISTUPGRADE: - s = mapSolvable (source); - ret = str::form (_("%s does not belong to a distupgrade repository"), s.asString().c_str()); - break; - case SOLVER_RULE_INFARCH: - s = mapSolvable (source); - ret = str::form (_("%s has inferior architecture"), s.asString().c_str()); - break; - case SOLVER_RULE_UPDATE: - s = mapSolvable (source); - ret = str::form (_("problem with installed package %s"), s.asString().c_str()); - break; - case SOLVER_RULE_JOB: - ret = _("conflicting requests"); - break; - case SOLVER_RULE_RPM: - ret = _("some dependency problem"); - break; - case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP: - ret = str::form (_("nothing provides requested %s"), pool_dep2str(pool, dep)); - detail += _("Have you enabled all requested repositories?"); - break; - case SOLVER_RULE_JOB_UNKNOWN_PACKAGE: - ret = str::form (_("package %s does not exist"), pool_dep2str(pool, dep)); - detail += _("Have you enabled all requested repositories?"); - break; - case SOLVER_RULE_JOB_UNSUPPORTED: - ret = _("unsupported request"); - break; - case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM: - ret = str::form (_("%s is provided by the system and cannot be erased"), pool_dep2str(pool, dep)); - break; - case SOLVER_RULE_RPM_NOT_INSTALLABLE: - s = mapSolvable (source); - ret = str::form (_("%s is not installable"), s.asString().c_str()); - break; - case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP: - ignoreId = source; // for setting weak dependencies - s = mapSolvable (source); - ret = str::form (_("nothing provides %s needed by %s"), pool_dep2str(pool, dep), s.asString().c_str()); - break; - case SOLVER_RULE_RPM_SAME_NAME: - s = mapSolvable (source); - s2 = mapSolvable (target); - ret = str::form (_("cannot install both %s and %s"), s.asString().c_str(), s2.asString().c_str()); - break; - case SOLVER_RULE_RPM_PACKAGE_CONFLICT: - s = mapSolvable (source); - s2 = mapSolvable (target); - ret = str::form (_("%s conflicts with %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str()); - break; - case SOLVER_RULE_RPM_PACKAGE_OBSOLETES: - s = mapSolvable (source); - s2 = mapSolvable (target); - ret = str::form (_("%s obsoletes %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str()); - break; - case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES: - s = mapSolvable (source); - s2 = mapSolvable (target); - ret = str::form (_("installed %s obsoletes %s provided by %s"), s.asString().c_str(), pool_dep2str(pool, dep), s2.asString().c_str()); - break; - case SOLVER_RULE_RPM_SELF_CONFLICT: - s = mapSolvable (source); - ret = str::form (_("solvable %s conflicts with %s provided by itself"), s.asString().c_str(), pool_dep2str(pool, dep)); - break; - case SOLVER_RULE_RPM_PACKAGE_REQUIRES: - ignoreId = source; // for setting weak dependencies - s = mapSolvable (source); - Capability cap(dep); - sat::WhatProvides possibleProviders(cap); - - // check, if a provider will be deleted - typedef list ProviderList; - ProviderList providerlistInstalled, providerlistUninstalled; - for_( iter1, possibleProviders.begin(), possibleProviders.end() ) { - PoolItem provider1 = ResPool::instance().find( *iter1 ); - // find pair of an installed/uninstalled item with the same NVR - bool found = false; - for_( iter2, possibleProviders.begin(), possibleProviders.end() ) { - PoolItem provider2 = ResPool::instance().find( *iter2 ); - if (compareByNVR (provider1.resolvable(),provider2.resolvable()) == 0 - && ( (provider1.status().isInstalled() && provider2.status().isUninstalled()) - || (provider2.status().isInstalled() && provider1.status().isUninstalled()) )) { - found = true; - break; - } - } - if (!found) { - if (provider1.status().isInstalled()) - providerlistInstalled.push_back(provider1); - else - providerlistUninstalled.push_back(provider1); - } - } - - ret = str::form (_("%s requires %s, but this requirement cannot be provided"), s.asString().c_str(), pool_dep2str(pool, dep)); - if (providerlistInstalled.size() > 0) { - detail += _("deleted providers: "); - for (ProviderList::const_iterator iter = providerlistInstalled.begin(); iter != providerlistInstalled.end(); iter++) { - if (iter == providerlistInstalled.begin()) - detail += itemToString( *iter ); - else - detail += "\n " + itemToString( mapItem(*iter) ); - } - } - if (providerlistUninstalled.size() > 0) { - if (detail.size() > 0) - detail += _("\nuninstallable providers: "); - else - detail = _("uninstallable providers: "); - for (ProviderList::const_iterator iter = providerlistUninstalled.begin(); iter != providerlistUninstalled.end(); iter++) { - if (iter == providerlistUninstalled.begin()) - detail += itemToString( *iter ); - else - detail += "\n " + itemToString( mapItem(*iter) ); - } - } - break; - } - - return ret; -} - -ResolverProblemList -SATResolver::problems () -{ - ResolverProblemList resolverProblems; - if (_solv && solver_problem_count(_solv)) { - Pool *pool = _solv->pool; - int pcnt; - Id p, rp, what; - Id problem, solution, element; - sat::Solvable s, sd; - - CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap(); - CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap(); - - MIL << "Encountered problems! Here are the solutions:\n" << endl; - pcnt = 1; - problem = 0; - while ((problem = solver_next_problem(_solv, problem)) != 0) { - MIL << "Problem " << pcnt++ << ":" << endl; - MIL << "====================================" << endl; - string detail; - Id ignoreId; - string whatString = SATprobleminfoString (problem,detail,ignoreId); - MIL << whatString << endl; - MIL << "------------------------------------" << endl; - ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail); - - solution = 0; - while ((solution = solver_next_solution(_solv, problem, solution)) != 0) { - element = 0; - ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi(resolverProblem); - while ((element = solver_next_solutionelement(_solv, problem, solution, element, &p, &rp)) != 0) { - if (p == SOLVER_SOLUTION_JOB) { - /* job, rp is index into job queue */ - what = _jobQueue.elements[rp]; - switch (_jobQueue.elements[rp-1]&(SOLVER_SELECTMASK|SOLVER_JOBMASK)) - { - case SOLVER_INSTALL | SOLVER_SOLVABLE: { - s = mapSolvable (what); - PoolItem poolItem = _pool.find (s); - if (poolItem) { - if (pool->installed && s.get()->repo == pool->installed) { - problemSolution->addSingleAction (poolItem, REMOVE); - string description = str::form (_("remove lock to allow removal of %s"), s.asString().c_str() ); - MIL << description << endl; - problemSolution->addDescription (description); - } else { - problemSolution->addSingleAction (poolItem, KEEP); - string description = str::form (_("do not install %s"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - } else { - ERR << "SOLVER_INSTALL_SOLVABLE: No item found for " << s.asString() << endl; - } - } - break; - case SOLVER_ERASE | SOLVER_SOLVABLE: { - s = mapSolvable (what); - PoolItem poolItem = _pool.find (s); - if (poolItem) { - if (pool->installed && s.get()->repo == pool->installed) { - problemSolution->addSingleAction (poolItem, KEEP); - string description = str::form (_("keep %s"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } else { - problemSolution->addSingleAction (poolItem, UNLOCK); - string description = str::form (_("remove lock to allow installation of %s"), itemToString( poolItem ).c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - } else { - ERR << "SOLVER_ERASE_SOLVABLE: No item found for " << s.asString() << endl; - } - } - break; - case SOLVER_INSTALL | SOLVER_SOLVABLE_NAME: - { - IdString ident( what ); - SolverQueueItemInstall_Ptr install = - new SolverQueueItemInstall(_pool, ident.asString(), false ); - problemSolution->addSingleAction (install, REMOVE_SOLVE_QUEUE_ITEM); - - string description = str::form (_("do not install %s"), ident.c_str() ); - MIL << description << endl; - problemSolution->addDescription (description); - } - break; - case SOLVER_ERASE | SOLVER_SOLVABLE_NAME: - { - // As we do not know, if this request has come from resolvePool or - // resolveQueue we will have to take care for both cases. - IdString ident( what ); - FindPackage info (problemSolution, KEEP); - invokeOnEach( _pool.byIdentBegin( ident ), - _pool.byIdentEnd( ident ), - functor::chain (resfilter::ByInstalled (), // ByInstalled - resfilter::ByTransact ()), // will be deinstalled - functor::functorRef (info) ); - - SolverQueueItemDelete_Ptr del = - new SolverQueueItemDelete(_pool, ident.asString(), false ); - problemSolution->addSingleAction (del, REMOVE_SOLVE_QUEUE_ITEM); - - string description = str::form (_("keep %s"), ident.c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - break; - case SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES: - { - problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_REQUIRE); - string description = ""; - - // Checking if this problem solution would break your system - if (system_requires.find(Capability(what)) != system_requires.end()) { - // Show a better warning - resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() ); - resolverProblem->setDescription(_("This request will break your system!")); - description = _("ignore the warning of a broken system"); - description += string(" (requires:")+pool_dep2str(pool, what)+")"; - MIL << description << endl; - problemSolution->addFrontDescription (description); - } else { - description = str::form (_("do not ask to install a solvable providing %s"), pool_dep2str(pool, what)); - MIL << description << endl; - problemSolution->addDescription (description); - } - } - break; - case SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES: - { - problemSolution->addSingleAction (Capability(what), REMOVE_EXTRA_CONFLICT); - string description = ""; - - // Checking if this problem solution would break your system - if (system_conflicts.find(Capability(what)) != system_conflicts.end()) { - // Show a better warning - resolverProblem->setDetails( resolverProblem->description() + "\n" + resolverProblem->details() ); - resolverProblem->setDescription(_("This request will break your system!")); - description = _("ignore the warning of a broken system"); - description += string(" (conflicts:")+pool_dep2str(pool, what)+")"; - MIL << description << endl; - problemSolution->addFrontDescription (description); - - } else { - description = str::form (_("do not ask to delete all solvables providing %s"), pool_dep2str(pool, what)); - MIL << description << endl; - problemSolution->addDescription (description); - } - } - break; - case SOLVER_UPDATE | SOLVER_SOLVABLE: - { - s = mapSolvable (what); - PoolItem poolItem = _pool.find (s); - if (poolItem) { - if (pool->installed && s.get()->repo == pool->installed) { - problemSolution->addSingleAction (poolItem, KEEP); - string description = str::form (_("do not install most recent version of %s"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } else { - ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE " << poolItem << " is not selected for installation" << endl; - } - } else { - ERR << "SOLVER_INSTALL_SOLVABLE_UPDATE: No item found for " << s.asString() << endl; - } - } - break; - default: - MIL << "- do something different" << endl; - ERR << "No valid solution available" << endl; - break; - } - } else if (p == SOLVER_SOLUTION_INFARCH) { - s = mapSolvable (rp); - PoolItem poolItem = _pool.find (s); - if (pool->installed && s.get()->repo == pool->installed) { - problemSolution->addSingleAction (poolItem, LOCK); - string description = str::form (_("keep %s despite the inferior architecture"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } else { - problemSolution->addSingleAction (poolItem, INSTALL); - string description = str::form (_("install %s despite the inferior architecture"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - } else if (p == SOLVER_SOLUTION_DISTUPGRADE) { - s = mapSolvable (rp); - PoolItem poolItem = _pool.find (s); - if (pool->installed && s.get()->repo == pool->installed) { - problemSolution->addSingleAction (poolItem, LOCK); - string description = str::form (_("keep obsolete %s"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } else { - problemSolution->addSingleAction (poolItem, INSTALL); - string description = str::form (_("install %s from excluded repository"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - } else { - /* policy, replace p with rp */ - s = mapSolvable (p); - PoolItem itemFrom = _pool.find (s); - if (rp) - { - int gotone = 0; - - sd = mapSolvable (rp); - PoolItem itemTo = _pool.find (sd); - if (itemFrom && itemTo) { - problemSolution->addSingleAction (itemTo, INSTALL); - int illegal = policy_is_illegal(_solv, s.get(), sd.get(), 0); - - if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0) - { - string description = str::form (_("downgrade of %s to %s"), s.asString().c_str(), sd.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - gotone = 1; - } - if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0) - { - string description = str::form (_("architecture change of %s to %s"), s.asString().c_str(), sd.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - gotone = 1; - } - if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0) - { - IdString s_vendor( s.vendor() ); - IdString sd_vendor( sd.vendor() ); - string description = str::form (_("install %s (with vendor change)\n %s --> %s") , - sd.asString().c_str(), - ( s_vendor ? s_vendor.c_str() : " (no vendor) " ), - ( sd_vendor ? sd_vendor.c_str() : " (no vendor) " ) ); - MIL << description << endl; - problemSolution->addDescription (description); - gotone = 1; - } - if (!gotone) { - string description = str::form (_("replacement of %s with %s"), s.asString().c_str(), sd.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - } - } else { - ERR << s.asString() << " or " << sd.asString() << " not found" << endl; - } - } - else - { - if (itemFrom) { - string description = str::form (_("deinstallation of %s"), s.asString().c_str()); - MIL << description << endl; - problemSolution->addDescription (description); - problemSolution->addSingleAction (itemFrom, REMOVE); - } - } - } - } - resolverProblem->addSolution (problemSolution, - problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first. - MIL << "------------------------------------" << endl; - } - - if (ignoreId > 0) { - // There is a possibility to ignore this error by setting weak dependencies - PoolItem item = _pool.find (sat::Solvable(ignoreId)); - ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(resolverProblem, item); - resolverProblem->addSolution (problemSolution, - false); // Solutions will be shown at the end - MIL << "ignore some dependencies of " << item << endl; - MIL << "------------------------------------" << endl; - } - - // save problem - resolverProblems.push_back (resolverProblem); - } - } - return resolverProblems; -} - -void -SATResolver::applySolutions (const ProblemSolutionList & solutions) -{ - for (ProblemSolutionList::const_iterator iter = solutions.begin(); - iter != solutions.end(); ++iter) { - ProblemSolution_Ptr solution = *iter; - Resolver dummyResolver(_pool); - if (!solution->apply (dummyResolver)) - break; - } -} - -void SATResolver::setLocks() -{ - for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) { - sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() ); - if (iter->status().isInstalled()) { - MIL << "Lock installed item " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE ); - queue_push( &(_jobQueue), ident ); - } else { - MIL << "Lock NOT installed item " << *iter << endl; - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), ident ); - } - } - - /////////////////////////////////////////////////////////////////// - // Weak locks: Ignore if an item with this name is already installed. - // If it's not installed try to keep it this way using a weak delete - /////////////////////////////////////////////////////////////////// - std::set unifiedByName; - for (PoolItemList::const_iterator iter = _items_to_keep.begin(); iter != _items_to_keep.end(); ++iter) { - IdString ident( (*iter)->satSolvable().ident() ); - if ( unifiedByName.insert( ident ).second ) - { - if ( ! ui::Selectable::get( *iter )->hasInstalledObj() ) - { - MIL << "Keep NOT installed name " << ident << " (" << *iter << ")" << endl; - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), ident.id() ); - } - } - } -} - -void SATResolver::setSystemRequirements() -{ - CapabilitySet system_requires = SystemCheck::instance().requiredSystemCap(); - CapabilitySet system_conflicts = SystemCheck::instance().conflictSystemCap(); - - for (CapabilitySet::const_iterator iter = system_requires.begin(); iter != system_requires.end(); ++iter) { - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES ); - queue_push( &(_jobQueue), iter->id() ); - MIL << "SYSTEM Requires " << *iter << endl; - } - - for (CapabilitySet::const_iterator iter = system_conflicts.begin(); iter != system_conflicts.end(); ++iter) { - queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES | MAYBE_CLEANDEPS ); - queue_push( &(_jobQueue), iter->id() ); - MIL << "SYSTEM Conflicts " << *iter << endl; - } - - // Lock the architecture of the running systems rpm - // package on distupgrade. - if ( _distupgrade && ZConfig::instance().systemRoot() == "/" ) - { - ResPool pool( ResPool::instance() ); - IdString rpm( "rpm" ); - for_( it, pool.byIdentBegin(rpm), pool.byIdentEnd(rpm) ) - { - if ( (*it)->isSystem() ) - { - Capability archrule( (*it)->arch(), rpm.c_str(), Capability::PARSED ); - queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_ESSENTIAL ); - queue_push( &(_jobQueue), archrule.id() ); - - } - } - } -} - -sat::StringQueue SATResolver::autoInstalled() const -{ - sat::StringQueue ret; - if ( _solv ) - ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED ); - return ret; -} - -sat::StringQueue SATResolver::userInstalled() const -{ - sat::StringQueue ret; - if ( _solv ) - ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES ); - return ret; -} - - -/////////////////////////////////////////////////////////////////// -};// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/solver/detail/SATResolver.h b/libzypp/zypp/solver/detail/SATResolver.h deleted file mode 100644 index 2d645da..0000000 --- a/libzypp/zypp/solver/detail/SATResolver.h +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SATResolver.h - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_SAT_RESOLVER_H -#define ZYPP_SOLVER_DETAIL_SAT_RESOLVER_H - -extern "C" -{ -#include -#include -} - -#include -#include -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/ResPool.h" -#include "zypp/base/SerialNumber.h" -#include "zypp/ProblemTypes.h" -#include "zypp/ResolverProblem.h" -#include "zypp/ProblemSolution.h" -#include "zypp/Capability.h" -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - - namespace sat - { - class Transaction; - } - - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SATResolver -/** - * \todo The way solver options are passed as individual booleans from Resolver - * via solver::detail::Resolver to SATResolver is pedestrian and error prone. - * Introdce a dedicated solver option structure which is passed down as a whole. -*/ -class SATResolver : public base::ReferenceCounted, private base::NonCopyable { - - private: - ResPool _pool; - Pool *_SATPool; - Solver *_solv; - Queue _jobQueue; - - // list of problematic items (orphaned) - PoolItemList _problem_items; - - // list populated by calls to addPoolItemTo*() - PoolItemList _items_to_install; - PoolItemList _items_to_remove; - PoolItemList _items_to_lock; - PoolItemList _items_to_keep; - - // solve results - PoolItemList _result_items_to_install; - PoolItemList _result_items_to_remove; - - bool _fixsystem; // repair errors in rpm dependency graph - bool _allowdowngrade; // allow to downgrade installed solvable - bool _allowarchchange; // allow to change architecture of installed solvables - bool _allowvendorchange; // allow to change vendor of installed solvables - bool _allowuninstall; // allow removal of installed solvables - bool _updatesystem; // update - bool _noupdateprovide; // true: update packages needs not to provide old package - bool _dosplitprovides; // true: consider legacy split provides - bool _onlyRequires; // true: consider required packages only - bool _ignorealreadyrecommended; // true: ignore recommended packages that were already recommended by the installed packages - bool _distupgrade; - bool _distupgrade_removeunsupported; - bool _solveSrcPackages; // false: generate no job rule for source packages selected in the pool - bool _cleandepsOnRemove; // whether removing a package should also remove no longer needed requirements - - // ---------------------------------- methods - std::string SATprobleminfoString (Id problem, std::string &detail, Id &ignoreId); - void resetItemTransaction (PoolItem item); - - // Create a SAT solver and reset solver selection in the pool (Collecting - void solverInit(const PoolItemList & weakItems); - // common solver run with the _jobQueue; Save results back to pool - bool solving(const CapabilitySet & requires_caps = CapabilitySet(), - const CapabilitySet & conflict_caps = CapabilitySet()); - // cleanup solver - void solverEnd(); - // set locks for the solver - void setLocks(); - // set requirements for a running system - void setSystemRequirements(); - - // Checking if this solvable/item has a buddy which reflect the real - // user visible description of an item - // e.g. The release package has a buddy to the concerning product item. - // This user want's the message "Product foo conflicts with product bar" and - // NOT "package release-foo conflicts with package release-bar" - // So these functions return the concerning buddy (e.g. product item) - sat::Solvable mapSolvable (const Id &id); - PoolItem mapItem (const PoolItem &item); - - public: - - SATResolver (const ResPool & pool, Pool *SATPool); - virtual ~SATResolver(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - friend std::ostream& operator<<(std::ostream& str, const SATResolver & obj) - { return obj.dumpOn (str); } - - ResPool pool (void) const; - void setPool (const ResPool & pool) { _pool = pool; } - - // solver run with pool selected items - bool resolvePool(const CapabilitySet & requires_caps, - const CapabilitySet & conflict_caps, - const PoolItemList & weakItems, - const std::set & upgradeRepos - ); - // solver run with the given request queue - bool resolveQueue(const SolverQueueItemList &requestQueue, - const PoolItemList & weakItems - ); - // searching for new packages - void doUpdate(); - - ResolverProblemList problems (); - void applySolutions (const ProblemSolutionList &solutions); - - void addPoolItemToInstall (PoolItem item); - void addPoolItemsToInstallFromList (PoolItemList & rl); - - void addPoolItemToLock (PoolItem item); - void addPoolItemToKeep (PoolItem item); - - void addPoolItemToRemove (PoolItem item); - void addPoolItemsToRemoveFromList (PoolItemList & rl); - - bool fixsystem () const {return _fixsystem;} - void setFixsystem ( const bool fixsystem) { _fixsystem = fixsystem;} - - bool ignorealreadyrecommended () const {return _ignorealreadyrecommended;} - void setIgnorealreadyrecommended ( const bool ignorealreadyrecommended) { _ignorealreadyrecommended = ignorealreadyrecommended;} - - bool distupgrade () const {return _distupgrade;} - void setDistupgrade ( const bool distupgrade) { _distupgrade = distupgrade;} - - bool distupgrade_removeunsupported () const {return _distupgrade_removeunsupported;} - void setDistupgrade_removeunsupported ( const bool distupgrade_removeunsupported) { _distupgrade_removeunsupported = distupgrade_removeunsupported;} - - bool allowdowngrade () const {return _allowdowngrade;} - void setAllowdowngrade ( const bool allowdowngrade) { _allowdowngrade = allowdowngrade;} - - bool allowarchchange () const {return _allowarchchange;} - void setAllowarchchange ( const bool allowarchchange) { _allowarchchange = allowarchchange;} - - bool allowvendorchange () const {return _allowvendorchange;} - void setAllowvendorchange ( const bool allowvendorchange) { _allowvendorchange = allowvendorchange;} - - bool allowuninstall () const {return _allowuninstall;} - void setAllowuninstall ( const bool allowuninstall) { _allowuninstall = allowuninstall;} - - bool updatesystem () const {return _updatesystem;} - void setUpdatesystem ( const bool updatesystem) { _updatesystem = updatesystem;} - - bool noupdateprovide () const {return _noupdateprovide;} - void setNoupdateprovide ( const bool noupdateprovide) { _noupdateprovide = noupdateprovide;} - - bool dosplitprovides () const {return _dosplitprovides;} - void setDosplitprovides ( const bool dosplitprovides) { _dosplitprovides = dosplitprovides;} - - bool onlyRequires () const {return _onlyRequires;} - void setOnlyRequires ( const bool onlyRequires) { _onlyRequires = onlyRequires;} - - bool solveSrcPackages() const { return _solveSrcPackages; } - void setSolveSrcPackages( bool state_r ) { _solveSrcPackages = state_r; } - - bool cleandepsOnRemove() const { return _cleandepsOnRemove; } - void setCleandepsOnRemove( bool state_r ) { _cleandepsOnRemove = state_r; } - - PoolItemList problematicUpdateItems( void ) const { return _problem_items; } - - PoolItemList resultItemsToInstall () { return _result_items_to_install; } - PoolItemList resultItemsToRemove () { return _result_items_to_remove; } - PoolItemList problematicUpdateItems() { return _problem_items; } - - sat::StringQueue autoInstalled() const; - sat::StringQueue userInstalled() const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_SAT_RESOLVER_H diff --git a/libzypp/zypp/solver/detail/SolutionAction.cc b/libzypp/zypp/solver/detail/SolutionAction.cc deleted file mode 100644 index 77d3b39..0000000 --- a/libzypp/zypp/solver/detail/SolutionAction.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolutionAction.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/SolutionAction.h" -#include "zypp/Capabilities.h" -#include "zypp/base/Logger.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolutionAction); -IMPL_PTR_TYPE(TransactionSolutionAction); -IMPL_PTR_TYPE(InjectSolutionAction); - -//--------------------------------------------------------------------------- - -SolutionAction::SolutionAction() -{ -} - - -SolutionAction::~SolutionAction() -{ -} - - -//--------------------------------------------------------------------------- - -ostream & -TransactionSolutionAction::dumpOn( ostream& os) const -{ - os << "TransactionSolutionAction: "; - switch (_action) { - case KEEP: os << "Keep " << _item; break; - case INSTALL: os << "Install " << _item; break; - case REMOVE: os << "Remove " << _item; break; - case UNLOCK: os << "Unlock " << _item; break; - case LOCK: os << "Lock " << _item; break; - case REMOVE_EXTRA_REQUIRE: os << "Remove require " << _capability; break; - case REMOVE_EXTRA_CONFLICT: os << "Remove conflict " << _capability; break; - case ADD_SOLVE_QUEUE_ITEM: os << "Add SolveQueueItem " << _solverQueueItem; break; - case REMOVE_SOLVE_QUEUE_ITEM: os << "Remove SolveQueueItem " << _solverQueueItem; break; - } - return os; -} - - -ostream& -operator<<( ostream& os, const SolutionActionList & actionlist) -{ - for (SolutionActionList::const_iterator iter = actionlist.begin(); iter != actionlist.end(); ++iter) { - os << *(*iter); - os << endl; - } - return os; -} - - -ostream& -operator<<( ostream& os, const CSolutionActionList & actionlist) -{ - for (CSolutionActionList::const_iterator iter = actionlist.begin(); iter != actionlist.end(); ++iter) { - os << *(*iter); - os << endl; - } - return os; -} - -//--------------------------------------------------------------------------- - -ostream & -InjectSolutionAction::dumpOn( ostream& os ) const -{ - os << "InjectSolutionAction: "; - switch (_kind) { - case WEAK: os << "Weak"; break; - default: os << "Wrong kind"; break; - } - os << " "; - os << _item; - return os; -} - -//--------------------------------------------------------------------------- - - -ostream & -SolutionAction::dumpOn( std::ostream & os ) const -{ - os << "SolutionAction<"; - os << "not specified"; - os << "> "; - return os; -} - - -bool -TransactionSolutionAction::execute(Resolver & resolver) const -{ - bool ret = true; - switch (action()) { - case KEEP: - _item.status().resetTransact (ResStatus::USER); - ret = _item.status().setTransact (false, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently - break; - case INSTALL: - if (_item.status().isToBeUninstalled()) - ret = _item.status().setTransact (false, ResStatus::USER); - else - _item.status().setToBeInstalled (ResStatus::USER); - break; - case REMOVE: - if (_item.status().isToBeInstalled()) { - _item.status().setTransact (false,ResStatus::USER); - _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again - } else if (_item.status().isInstalled()) - _item.status().setToBeUninstalled (ResStatus::USER); - else - _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again - break; - case UNLOCK: - ret = _item.status().setLock (false, ResStatus::USER); - if (!ret) ERR << "Cannot unlock " << _item << endl; - break; - case LOCK: - _item.status().resetTransact (ResStatus::USER); - ret = _item.status().setLock (true, ResStatus::APPL_HIGH); // APPL_HIGH: Locking should not be saved permanently - if (!ret) ERR << "Cannot lock " << _item << endl; - break; - case REMOVE_EXTRA_REQUIRE: - resolver.removeExtraRequire (_capability); - break; - case REMOVE_EXTRA_CONFLICT: - resolver.removeExtraConflict (_capability); - break; - case ADD_SOLVE_QUEUE_ITEM: - resolver.addQueueItem(_solverQueueItem); - break; - case REMOVE_SOLVE_QUEUE_ITEM: - resolver.removeQueueItem(_solverQueueItem); - break; - default: - ERR << "Wrong TransactionKind" << endl; - ret = false; - } - return ret; -} - -bool -InjectSolutionAction::execute(Resolver & resolver) const -{ - switch (_kind) { - case WEAK: - // set item dependencies to weak - resolver.addWeak (_item); - break; - default: - ERR << "No valid InjectSolutionAction kind found" << endl; - return false; - } - - return true; -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolutionAction.h b/libzypp/zypp/solver/detail/SolutionAction.h deleted file mode 100644 index 84b49db..0000000 --- a/libzypp/zypp/solver/detail/SolutionAction.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Author: Stefan Hundhammer - * - **/ - -#ifndef ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H -#define ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H - -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/PtrTypes.h" - -#include "zypp/Dep.h" -#include "zypp/Capability.h" - -#include "zypp/solver/detail/Types.h" -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Abstract base class for one action of a problem solution. - **/ - class SolutionAction : public base::ReferenceCounted - { - protected: - SolutionAction (); - public: - virtual ~SolutionAction(); - - // ---------------------------------- I/O - virtual std::ostream & dumpOn( std::ostream & str ) const; - friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action) - { return action.dumpOn (str); } - friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist); - friend std::ostream& operator<<(std::ostream & str, const CSolutionActionList & actionlist); - - // ---------------------------------- methods - /** - * Execute this action. - * Returns 'true' on success, 'false' on error. - **/ - virtual bool execute (Resolver & resolver) const = 0; - }; - - - /** - * A problem solution action that performs a transaction - * (installs, removes, keep ...) one resolvable - * (package, patch, pattern, product). - **/ - typedef enum - { - KEEP, - INSTALL, - REMOVE, - UNLOCK, - LOCK, - REMOVE_EXTRA_REQUIRE, - REMOVE_EXTRA_CONFLICT, - ADD_SOLVE_QUEUE_ITEM, - REMOVE_SOLVE_QUEUE_ITEM, - } TransactionKind; - - - class TransactionSolutionAction: public SolutionAction - { - public: - TransactionSolutionAction( PoolItem item, - TransactionKind action ) - : SolutionAction(), - _item( item ), _action( action ) {} - - TransactionSolutionAction( Capability capability, - TransactionKind action ) - : SolutionAction(), - _capability( capability ), _action( action ) {} - - - TransactionSolutionAction( SolverQueueItem_Ptr item, - TransactionKind action ) - : SolutionAction(), - _solverQueueItem( item ), _action( action ) {} - - TransactionSolutionAction( TransactionKind action ) - : SolutionAction(), - _item(), _action( action ) {} - - // ---------------------------------- I/O - virtual std::ostream & dumpOn( std::ostream & str ) const; - friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action) - { return action.dumpOn (str); } - - // ---------------------------------- accessors - - const PoolItem item() const { return _item; } - const Capability capability() const { return _capability; } - TransactionKind action() const { return _action; } - - // ---------------------------------- methods - virtual bool execute(Resolver & resolver) const; - - protected: - - PoolItem _item; - Capability _capability; - SolverQueueItem_Ptr _solverQueueItem; - - const TransactionKind _action; - }; - - - /** - * Type of ignoring; currently only WEAK - **/ - - typedef enum - { - WEAK - } InjectSolutionKind; - - - /** - * A problem solution action that injects an artificial "provides" to - * the pool to satisfy open requirements or remove the conflict of - * concerning resolvable - * - * This is typically used by "ignore" (user override) solutions. - **/ - class InjectSolutionAction: public SolutionAction - { - public: - - InjectSolutionAction( PoolItem item, - const InjectSolutionKind & kind) - : SolutionAction(), - _item( item ), - _kind( kind ) {} - - // ---------------------------------- I/O - virtual std::ostream & dumpOn( std::ostream & str ) const; - friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action) - { return action.dumpOn (str); } - - // ---------------------------------- accessors - const PoolItem item() const { return _item; } - - // ---------------------------------- methods - virtual bool execute(Resolver & resolver) const; - - protected: - PoolItem _item; - const InjectSolutionKind _kind; - }; - - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H - diff --git a/libzypp/zypp/solver/detail/SolverQueueItem.cc b/libzypp/zypp/solver/detail/SolverQueueItem.cc deleted file mode 100644 index 9f3bbe7..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItem.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItem); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItem::dumpOn( std::ostream & os ) const -{ - switch (_type) { - case QUEUE_ITEM_TYPE_UNKNOWN : os << "unknown"; break; - case QUEUE_ITEM_TYPE_UPDATE : os << "update"; break; - case QUEUE_ITEM_TYPE_LOCK : os << "lock"; break; - case QUEUE_ITEM_TYPE_INSTALL : os << "install"; break; - case QUEUE_ITEM_TYPE_DELETE : os << "delete"; break; - case QUEUE_ITEM_TYPE_INSTALL_ONE_OF: os << "install one of"; break; - default: os << "?solverqueueitem?"; break; - } - return os; -} - - -ostream& -operator<<( ostream & os, const SolverQueueItemList & itemlist ) -{ - for (SolverQueueItemList::const_iterator iter = itemlist.begin(); iter != itemlist.end(); ++iter) { - if (iter != itemlist.begin()) - os << "," << endl << "\t"; - os << **iter; - } - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItem::SolverQueueItem (SolverQueueItemType type, const ResPool & pool) - : _type (type) - , _pool (pool) -{ -} - - -SolverQueueItem::~SolverQueueItem() -{ -} - -//--------------------------------------------------------------------------- - -void -SolverQueueItem::copy (const SolverQueueItem *from) -{ -} - - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItem.h b/libzypp/zypp/solver/detail/SolverQueueItem.h deleted file mode 100644 index 296d47a..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItem.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEM_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEM_H - -#include -#include -#include - -#include "zypp/solver/detail/Types.h" -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/ResPool.h" - -extern "C" { - struct _Queue; -} - - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -typedef enum { - QUEUE_ITEM_TYPE_UNKNOWN = 0, - QUEUE_ITEM_TYPE_UPDATE, - QUEUE_ITEM_TYPE_INSTALL, - QUEUE_ITEM_TYPE_DELETE, - QUEUE_ITEM_TYPE_INSTALL_ONE_OF, - QUEUE_ITEM_TYPE_LOCK -} SolverQueueItemType; - - -typedef std::list SolverQueueItemList; - -#define CMP(a,b) (((a) < (b)) - ((b) < (a))) - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItem - -class SolverQueueItem : public base::ReferenceCounted, private base::NonCopyable { - - private: - - SolverQueueItemType _type; - ResPool _pool; - - protected: - - SolverQueueItem (SolverQueueItemType type, const ResPool & pool); - - public: - - virtual ~SolverQueueItem(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItem & obj) - { return obj.dumpOn (str); } - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemList & itemlist); - - // ---------------------------------- accessors - - ResPool pool (void) const { return _pool; } - - // ---------------------------------- methods - - void copy (const SolverQueueItem *from); - - bool isDelete (void) const { return _type == QUEUE_ITEM_TYPE_DELETE; } - bool isInstall (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL; } - bool isUpdate (void) const { return _type == QUEUE_ITEM_TYPE_UPDATE; } - bool isLock (void) const { return _type == QUEUE_ITEM_TYPE_LOCK; } - bool isInstallOneOf (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL_ONE_OF; } - - - virtual SolverQueueItem_Ptr copy (void) const = 0; - virtual bool addRule (_Queue & q) =0 ; - virtual int cmp (SolverQueueItem_constPtr item) const = 0; - int compare (SolverQueueItem_constPtr item) const { return CMP(_type, item->_type); } - -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEM_H diff --git a/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc b/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc deleted file mode 100644 index edbb618..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/IdString.h" -#include "zypp/Resolver.h" -#include "zypp/solver/detail/SolverQueueItemDelete.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItemDelete); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItemDelete::dumpOn( std::ostream & os ) const -{ - os << "[" << (_soft?"Soft":"") << "Delete: " - << _name << "]"; - - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItemDelete::SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft) - : SolverQueueItem (QUEUE_ITEM_TYPE_DELETE, pool) - , _name (name) - , _soft (soft) -{ -} - - -SolverQueueItemDelete::~SolverQueueItemDelete() -{ -} - -//--------------------------------------------------------------------------- - -bool SolverQueueItemDelete::addRule (_Queue & q) -{ -#define MAYBE_CLEANDEPS (pool().resolver().cleandepsOnRemove()?SOLVER_CLEANDEPS:0) - - ::Id id = IdString(_name).id(); - if (_soft) { - queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | SOLVER_WEAK | MAYBE_CLEANDEPS ); - } else { - queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE_NAME | MAYBE_CLEANDEPS ); - } - queue_push( &(q), id); - - MIL << "Delete " << _name << (_soft ? "(soft)" : "") - << " with SAT-Pool: " << id << endl; - return true; -} - -SolverQueueItem_Ptr -SolverQueueItemDelete::copy (void) const -{ - SolverQueueItemDelete_Ptr new_delete = new SolverQueueItemDelete (pool(), _name); - new_delete->SolverQueueItem::copy(this); - - new_delete->_soft = _soft; - return new_delete; -} - -int -SolverQueueItemDelete::cmp (SolverQueueItem_constPtr item) const -{ - int cmp = this->compare (item); - if (cmp != 0) - return cmp; - SolverQueueItemDelete_constPtr del = dynamic_pointer_cast(item); - if (_name != del->_name) { - return _name.compare(del->_name); - } - return 0; -} - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItemDelete.h b/libzypp/zypp/solver/detail/SolverQueueItemDelete.h deleted file mode 100644 index 3770ada..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemDelete.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H - -#include -#include - -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItemDelete - -class SolverQueueItemDelete : public SolverQueueItem { - - private: - - std::string _name; - bool _soft; // if triggered by a soft requirement (a recommends) - - public: - - SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft = false); - virtual ~SolverQueueItemDelete(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemDelete & obj) - { return obj.dumpOn (str); } - - // ---------------------------------- accessors - - bool isSoft (void) const { return _soft; } - - // ---------------------------------- methods - - virtual bool addRule (_Queue & q); - virtual SolverQueueItem_Ptr copy (void) const; - virtual int cmp (SolverQueueItem_constPtr item) const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H diff --git a/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc b/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc deleted file mode 100644 index 19b5d11..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/IdString.h" -#include "zypp/IdStringType.h" -#include "zypp/solver/detail/SolverQueueItemInstall.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItemInstall); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItemInstall::dumpOn( std::ostream & os ) const -{ - os << "[" << (_soft?"Soft":"") << "Install: " - << _name - << "]"; - - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft) - : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool) - , _name (name) - , _soft (soft) -{ -} - - -SolverQueueItemInstall::~SolverQueueItemInstall() -{ -} - -//--------------------------------------------------------------------------- - -bool SolverQueueItemInstall::addRule (_Queue & q) -{ - ::Id id = IdString(_name).id(); - if (_soft) { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_WEAK ); - } else { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME ); - } - queue_push( &(q), id); - - MIL << "Install " << _name << (_soft ? "(soft)" : "") - << " with SAT-PoolID: " << id << endl; - return true; -} - -SolverQueueItem_Ptr -SolverQueueItemInstall::copy (void) const -{ - SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name); - new_install->SolverQueueItem::copy(this); - - new_install->_soft = _soft; - return new_install; -} - -int -SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const -{ - int cmp = this->compare (item); - if (cmp != 0) - return cmp; - SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast(item); - if (_name != ins->_name) { - return _name.compare(ins->_name); - } - return 0; -} - - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItemInstall.h b/libzypp/zypp/solver/detail/SolverQueueItemInstall.h deleted file mode 100644 index 9d5df4f..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemInstall.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H - -#include -#include - -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItemInstall - -class SolverQueueItemInstall : public SolverQueueItem { - - private: - - std::string _name; - bool _soft; // if triggered by a soft requirement (a recommends) - - public: - - SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft = false); - virtual ~SolverQueueItemInstall(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstall & obj) - { return obj.dumpOn (str); } - - // ---------------------------------- accessors - - bool isSoft (void) const { return _soft; } - - // ---------------------------------- methods - - virtual bool addRule (_Queue & q); - virtual SolverQueueItem_Ptr copy (void) const; - virtual int cmp (SolverQueueItem_constPtr item) const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H diff --git a/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.cc b/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.cc deleted file mode 100644 index e13e69c..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/SolverQueueItemInstallOneOf.h" -#include "zypp/sat/Pool.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItemInstallOneOf); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const -{ - os << "[" << (_soft?"Soft":"") << "InstallOneOf: "; - for (PoolItemList::const_iterator iter = _oneOfList.begin(); - iter != _oneOfList.end(); - iter++) - os << *iter; - os << "]"; - - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, - bool soft) - : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool) - , _oneOfList (itemList) - , _soft (soft) -{ -} - - -SolverQueueItemInstallOneOf::~SolverQueueItemInstallOneOf() -{ -} - -//--------------------------------------------------------------------------- - -bool SolverQueueItemInstallOneOf::addRule (_Queue & q) -{ - bool ret = true; - MIL << "Install one of " << (_soft ? "(soft):" : ":")<< endl; - Queue qs; - - if (_soft) { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF | SOLVER_WEAK); - } else { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_ONE_OF ); - } - - queue_init(&qs); - for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) { - Id id = (*iter)->satSolvable().id(); - if (id == ID_NULL) { - ERR << *iter << " not found" << endl; - ret = false; - } else { - MIL << " candidate:" << *iter << " with the SAT-Pool ID: " << id << endl; - queue_push( &(qs), id ); - } - } - sat::Pool satPool( sat::Pool::instance() ); - queue_push( &(q), pool_queuetowhatprovides(satPool.get(), &qs)); - queue_free(&qs); - - return ret; -} - -SolverQueueItem_Ptr -SolverQueueItemInstallOneOf::copy (void) const -{ - SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList); - new_installOneOf->SolverQueueItem::copy(this); - new_installOneOf->_soft = _soft; - - return new_installOneOf; -} - -int -SolverQueueItemInstallOneOf::cmp (SolverQueueItem_constPtr item) const -{ - int cmp = this->compare (item); - if (cmp != 0) - return cmp; - SolverQueueItemInstallOneOf_constPtr install = dynamic_pointer_cast(item); - - return (_oneOfList == install->_oneOfList) ? 0 : -1; // more evaluation would be not useful -} - - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.h b/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.h deleted file mode 100644 index bd1f502..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemInstallOneOf.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H - -#include -#include - -#include "zypp/solver/detail/SolverQueueItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItemInstallOneOf - -class SolverQueueItemInstallOneOf : public SolverQueueItem { - - public: - typedef std::list PoolItemList; - - private: - - PoolItemList _oneOfList; // List of candidates - bool _soft; // if triggered by a soft requirement (a recommends) - - public: - - SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false); - virtual ~SolverQueueItemInstallOneOf(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstallOneOf & obj) - { return obj.dumpOn (str); } - - // ---------------------------------- accessors - - bool isSoft (void) const { return _soft; } - - // ---------------------------------- methods - - virtual bool addRule (_Queue & q); - virtual SolverQueueItem_Ptr copy (void) const; - virtual int cmp (SolverQueueItem_constPtr item) const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H diff --git a/libzypp/zypp/solver/detail/SolverQueueItemLock.cc b/libzypp/zypp/solver/detail/SolverQueueItemLock.cc deleted file mode 100644 index e1c9473..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemLock.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/SolverQueueItemLock.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItemLock); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItemLock::dumpOn( std::ostream & os ) const -{ - os << "[" << (_soft?"Soft":"") << "Lock: " << - _item << "]"; - - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItemLock::SolverQueueItemLock (const ResPool & pool, - const PoolItem & item, bool soft) - : SolverQueueItem (QUEUE_ITEM_TYPE_LOCK, pool) - , _item (item) - , _soft (soft) -{ -} - - -SolverQueueItemLock::~SolverQueueItemLock() -{ -} - -//--------------------------------------------------------------------------- - -bool SolverQueueItemLock::addRule (_Queue & q) -{ - ::Id id = _item.satSolvable().id(); - if (id == ID_NULL) { - ERR << "Lock : " << _item << " not found" << endl; - return false; - } - MIL << "Lock " << _item << " with the SAT-Pool ID: " << id << endl; - if (_item.status().isInstalled()) { - if (_soft) { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE | SOLVER_WEAK ); - } else { - queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE ); - } - } else { - if (_soft) { - queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE | SOLVER_WEAK ); - } else { - queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE ); - } - } - queue_push( &(q), id ); - return true; -} - -SolverQueueItem_Ptr -SolverQueueItemLock::copy (void) const -{ - SolverQueueItemLock_Ptr new_lock = new SolverQueueItemLock (pool(), _item); - new_lock->SolverQueueItem::copy(this); - - new_lock->_soft = _soft; - return new_lock; -} - -int -SolverQueueItemLock::cmp (SolverQueueItem_constPtr item) const -{ - int cmp = this->compare (item); - if (cmp != 0) - return cmp; - SolverQueueItemLock_constPtr lock = dynamic_pointer_cast(item); - return compareByNVRA (_item.resolvable(), lock->_item.resolvable()); -} - - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItemLock.h b/libzypp/zypp/solver/detail/SolverQueueItemLock.h deleted file mode 100644 index 55f5104..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemLock.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H - -#include -#include - -#include "zypp/solver/detail/SolverQueueItem.h" -#include "zypp/PoolItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItemLock - -class SolverQueueItemLock : public SolverQueueItem { - - private: - - PoolItem _item; // the item to-be-locked - bool _soft; // if triggered by a soft requirement (a recommends) - - public: - - SolverQueueItemLock (const ResPool & pool, const PoolItem & item, bool soft = false); - virtual ~SolverQueueItemLock(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemLock & obj) - { return obj.dumpOn (str); } - - // ---------------------------------- accessors - - bool isSoft (void) const { return _soft; } - - // ---------------------------------- methods - - virtual bool addRule (_Queue & q); - virtual SolverQueueItem_Ptr copy (void) const; - virtual int cmp (SolverQueueItem_constPtr item) const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H diff --git a/libzypp/zypp/solver/detail/SolverQueueItemUpdate.cc b/libzypp/zypp/solver/detail/SolverQueueItemUpdate.cc deleted file mode 100644 index aedeb6e..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemUpdate.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* SolverQueueItem.cc - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ -extern "C" -{ -#include -} - -#include "zypp/base/Logger.h" -#include "zypp/solver/detail/SolverQueueItemUpdate.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -using namespace std; - -IMPL_PTR_TYPE(SolverQueueItemUpdate); - -//--------------------------------------------------------------------------- - -std::ostream & -SolverQueueItemUpdate::dumpOn( std::ostream & os ) const -{ - os << "[" << (_soft?"Soft":"") << "Update: " << - _item << "]"; - - return os; -} - -//--------------------------------------------------------------------------- - -SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool, - const PoolItem & item, bool soft) - : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool) - , _item (item) - , _soft (soft) -{ -} - - -SolverQueueItemUpdate::~SolverQueueItemUpdate() -{ -} - -//--------------------------------------------------------------------------- - -bool SolverQueueItemUpdate::addRule (_Queue & q) -{ - ::Id id = _item.satSolvable().id(); - if (id == ID_NULL) { - ERR << "Update explicit: " << _item << " not found" << endl; - return false; - } - MIL << "Update explicit " << _item << " with the SAT-Pool ID: " << id << endl; - queue_push( &(q), SOLVER_UPDATE | SOLVER_SOLVABLE ); - queue_push( &(q), id ); - return true; -} - -SolverQueueItem_Ptr -SolverQueueItemUpdate::copy (void) const -{ - SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item); - new_update->SolverQueueItem::copy(this); - - new_update->_soft = _soft; - return new_update; -} - -int -SolverQueueItemUpdate::cmp (SolverQueueItem_constPtr item) const -{ - int cmp = this->compare (item); - if (cmp != 0) - return cmp; - SolverQueueItemUpdate_constPtr update = dynamic_pointer_cast(item); - return compareByNVRA (_item.resolvable(), update->_item.resolvable()); -} - - -//--------------------------------------------------------------------------- - - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SolverQueueItemUpdate.h b/libzypp/zypp/solver/detail/SolverQueueItemUpdate.h deleted file mode 100644 index ff00306..0000000 --- a/libzypp/zypp/solver/detail/SolverQueueItemUpdate.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* QueueItem.h - * - * Copyright (C) 2008 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H -#define ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H - -#include -#include - -#include "zypp/solver/detail/SolverQueueItem.h" -#include "zypp/PoolItem.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : SolverQueueItemUpdate - -class SolverQueueItemUpdate : public SolverQueueItem { - - private: - - PoolItem _item; // the item to-be-updated - bool _soft; // if triggered by a soft requirement (a recommends) - - public: - - SolverQueueItemUpdate (const ResPool & pool, const PoolItem & item, bool soft = false); - virtual ~SolverQueueItemUpdate(); - - // ---------------------------------- I/O - - virtual std::ostream & dumpOn( std::ostream & str ) const; - - friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemUpdate & obj) - { return obj.dumpOn (str); } - - // ---------------------------------- accessors - - bool isSoft (void) const { return _soft; } - - // ---------------------------------- methods - - virtual bool addRule (_Queue & q); - virtual SolverQueueItem_Ptr copy (void) const; - virtual int cmp (SolverQueueItem_constPtr item) const; -}; - -/////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H diff --git a/libzypp/zypp/solver/detail/SystemCheck.cc b/libzypp/zypp/solver/detail/SystemCheck.cc deleted file mode 100644 index 3bc58cc..0000000 --- a/libzypp/zypp/solver/detail/SystemCheck.cc +++ /dev/null @@ -1,170 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/solver/detail/SystemCheck.cc - * -*/ -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/ZYppFactory.h" -#include "zypp/ZConfig.h" -#include "zypp/Pathname.h" -#include "zypp/PathInfo.h" -#include "zypp/solver/detail/SystemCheck.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - Pathname _file = ""; - Pathname _dir = ""; - CapabilitySet _require; - CapabilitySet _conflict; - - typedef vector CapList; - - const SystemCheck & SystemCheck::instance() - { - static SystemCheck _val; - return _val; - } - - - SystemCheck::SystemCheck() { - if (_file.empty()) { - _file = ZConfig::instance().solver_checkSystemFile(); - loadFile(_file); - } - if (_dir.empty()) { - _dir = ZConfig::instance().solver_checkSystemFileDir(); - loadFiles(); - } - } - - bool SystemCheck::setFile(const Pathname & file) const{ - MIL << "Setting checkFile to : " << file << endl; - _file = file; - loadFile(_file); - return true; - } - - bool SystemCheck::setDir(const Pathname & dir) const { - MIL << "Setting checkFile directory to : " << dir << endl; - loadFile(_file); - _dir = dir; - loadFiles(); - return true; - } - - const Pathname & SystemCheck::file() { - return _file; - } - - const Pathname & SystemCheck::dir() { - return _dir; - } - - const CapabilitySet & SystemCheck::requiredSystemCap() const{ - return _require; - } - - const CapabilitySet & SystemCheck::conflictSystemCap() const{ - return _conflict; - } - - bool SystemCheck::loadFile(Pathname & file, bool reset_caps) const{ - Target_Ptr trg( getZYpp()->getTarget() ); - if ( trg ) - file = trg->assertRootPrefix( file ); - - PathInfo pi( file ); - if ( ! pi.isFile() ) { - WAR << "Can't read " << file << " " << pi << endl; - return false; - } - - if (reset_caps) { - _require.clear(); - _conflict.clear(); - } - - std::ifstream infile( file.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) { - std::string l( str::trim(*in) ); - if ( ! l.empty() && l[0] != '#' ) - { - CapList capList; - str::split( l, back_inserter(capList), ":" ); - if (capList.size() == 2 ) { - CapList::iterator it = capList.begin(); - if (*it == "requires") { - _require.insert(Capability(*(it+1))); - } else if (*it == "conflicts") { - _conflict.insert(Capability(*(it+1))); - } else { - ERR << "Wrong parameter: " << l << endl; - } - } else { - ERR << "Wrong line: " << l << endl; - } - } - } - MIL << "Read " << pi << endl; - return true; - } - - bool SystemCheck::loadFiles() const { - - filesystem::dirForEach(_dir, - [this](const Pathname & dir_r, const char *const & name_r)->bool - { - const std::string wanted = ".check"; - Pathname pth = dir_r/name_r; - if (pth.extension() != wanted) { - MIL << "Skipping " << pth << " (not a *.check file)" << endl; - return true; - } - else { - MIL << "Reading " << pth << endl; - return loadFile(pth, false /* do not reset caps */); - } - }); - return true; - } - - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const SystemCheck & obj ) - { - str << _file << endl; - str << "requires" << endl; - for (CapabilitySet::const_iterator it = _require.begin(); it != _require.end(); ++it) - str << " " << *it << endl; - - str << "conflicts" << endl; - for (CapabilitySet::const_iterator it = _conflict.begin(); it != _conflict.end(); ++it) - str << " " << *it << endl; - - return str; - } - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/SystemCheck.h b/libzypp/zypp/solver/detail/SystemCheck.h deleted file mode 100644 index 41cdd3d..0000000 --- a/libzypp/zypp/solver/detail/SystemCheck.h +++ /dev/null @@ -1,77 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/SystemCheck.h - * -*/ -#ifndef ZYPP_TARGET_SYSTEMCHECK_H -#define ZYPP_TARGET_SYSTEMCHECK_H - -#include - -#include "zypp/base/NonCopyable.h" -#include "zypp/Capability.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SystemCheck - // - /** Save and restore locale set from file. - */ - class SystemCheck : private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const SystemCheck & obj ); - - public: - - /** Singleton */ - static const SystemCheck & instance(); - - /** Return the file path. */ - const Pathname & file(); - - /** Return the directory path. */ - const Pathname & dir(); - - /** Set configuration file of system requirements - * Should be used for testcase only - */ - bool setFile(const Pathname & file) const; - - /** Set configuration directory for files of system - * requirements. - * Should be used for testcase only - */ - bool setDir(const Pathname & dir) const; - - /** Returns a list of required system capabilities. - */ - const CapabilitySet & requiredSystemCap() const; - - /** Returns a list of conflicting system capabilities. - */ - const CapabilitySet & conflictSystemCap() const; - - private: - /** Ctor taking the file to read. */ - SystemCheck(); - bool loadFile(Pathname &file, bool reset_caps = true) const; - bool loadFiles() const; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates SystemCheck Stream output */ - std::ostream & operator<<( std::ostream & str, const SystemCheck & obj ); - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_SYSTEMCHECK_H diff --git a/libzypp/zypp/solver/detail/Testcase.cc b/libzypp/zypp/solver/detail/Testcase.cc deleted file mode 100644 index c25ebab..0000000 --- a/libzypp/zypp/solver/detail/Testcase.cc +++ /dev/null @@ -1,607 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/solver/detail/Testcase.cc - * -*/ -#include -#include -#include -#include - -#include "zypp/solver/detail/Testcase.h" -#include "zypp/base/Logger.h" -#include "zypp/base/LogControl.h" -#include "zypp/base/GzStream.h" -#include "zypp/base/String.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/ReferenceCounted.h" - -#include "zypp/parser/xml/XmlEscape.h" - -#include "zypp/ZConfig.h" -#include "zypp/PathInfo.h" -#include "zypp/ResPool.h" -#include "zypp/Repository.h" -#include "zypp/target/modalias/Modalias.h" - -#include "zypp/sat/detail/PoolImpl.h" -#include "zypp/solver/detail/SystemCheck.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -#define TAB "\t" -#define TAB2 "\t\t" - -using namespace std; -using namespace zypp::str; - -//--------------------------------------------------------------------------- - -inline std::string xml_escape( const std::string &text ) -{ - return zypp::xml::escape(text); -} - -inline std::string xml_tag_enclose( const std::string &text, const std::string &tag, bool escape = false ) -{ - string result; - result += "<" + tag + ">"; - - if ( escape) - result += xml_escape(text); - else - result += text; - - result += ""; - return result; -} - -template -std::string helixXML( const T &obj ); //undefined - -template<> -std::string helixXML( const Edition &edition ) -{ - stringstream str; - str << xml_tag_enclose(edition.version(), "version"); - if (!edition.release().empty()) - str << xml_tag_enclose(edition.release(), "release"); - if (edition.epoch() != Edition::noepoch) - str << xml_tag_enclose(numstring(edition.epoch()), "epoch"); - return str.str(); -} - -template<> -std::string helixXML( const Arch &arch ) -{ - stringstream str; - str << xml_tag_enclose(arch.asString(), "arch"); - return str.str(); -} - -template<> -std::string helixXML( const Capability &cap ) -{ - stringstream str; - CapDetail detail = cap.detail(); - if (detail.isSimple()) { - if (detail.isVersioned()) { - str << "" << endl; - } else { - str << "" << endl; - } - } else if (detail.isExpression()) { - if (detail.capRel() == CapDetail::CAP_AND - && detail.lhs().detail().isNamed() - && detail.rhs().detail().isNamed()) { - // packageand dependency - str << "" << endl; - } else if (detail.capRel() == CapDetail::CAP_NAMESPACE - && detail.lhs().id() == NAMESPACE_OTHERPROVIDERS) { - str << "" << endl; - } else { - // modalias ? - IdString packageName; - if (detail.capRel() == CapDetail::CAP_AND) { - packageName = IdString(detail.lhs().id()); - detail = detail.rhs().detail(); - } - if (detail.capRel() == CapDetail::CAP_NAMESPACE - && detail.lhs().id() == NAMESPACE_MODALIAS) { - str << "" << endl; - } else { - str << "" << endl; - } - } - } else { - str << "" << endl; - } - - return str.str(); -} - -template<> -std::string helixXML( const Capabilities &caps ) -{ - stringstream str; - Capabilities::const_iterator it = caps.begin(); - str << endl; - for ( ; it != caps.end(); ++it) - { - str << TAB2 << helixXML((*it)); - } - str << TAB; - return str.str(); -} - -template<> -std::string helixXML( const CapabilitySet &caps ) -{ - stringstream str; - CapabilitySet::const_iterator it = caps.begin(); - str << endl; - for ( ; it != caps.end(); ++it) - { - str << TAB2 << helixXML((*it)); - } - str << TAB; - return str.str(); -} - -inline string helixXML( const Resolvable::constPtr &obj, Dep deptag_r ) -{ - stringstream out; - Capabilities caps( obj->dep(deptag_r) ); - if ( ! caps.empty() ) - out << TAB << xml_tag_enclose(helixXML(caps), deptag_r.asString()) << endl; - return out.str(); -} - -std::string helixXML( const PoolItem &item ) -{ - const Resolvable::constPtr resolvable = item.resolvable(); - stringstream str; - str << "<" << toLower (resolvable->kind().asString()) << ">" << endl; - str << TAB << xml_tag_enclose (resolvable->name(), "name", true) << endl; - str << TAB << xml_tag_enclose (item->vendor(), "vendor", true) << endl; - str << TAB << xml_tag_enclose (item->buildtime().asSeconds(), "buildtime", true) << endl; - if ( isKind(resolvable) ) { - str << TAB << "" << endl << TAB << "" << endl; - str << TAB2 << helixXML (resolvable->arch()) << endl; - str << TAB2 << helixXML (resolvable->edition()) << endl; - str << TAB << "" << endl << TAB << "" << endl; - } else { - str << TAB << helixXML (resolvable->arch()) << endl; - str << TAB << helixXML (resolvable->edition()) << endl; - } - str << helixXML( resolvable, Dep::PROVIDES); - str << helixXML( resolvable, Dep::PREREQUIRES); - str << helixXML( resolvable, Dep::CONFLICTS); - str << helixXML( resolvable, Dep::OBSOLETES); - str << helixXML( resolvable, Dep::REQUIRES); - str << helixXML( resolvable, Dep::RECOMMENDS); - str << helixXML( resolvable, Dep::ENHANCES); - str << helixXML( resolvable, Dep::SUPPLEMENTS); - str << helixXML( resolvable, Dep::SUGGESTS); - - str << "kind().asString()) << ">" << endl; - return str.str(); -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : HelixResolvable -/** - * Creates a file in helix format which includes all available - * or installed packages,patches,selections..... - **/ -class HelixResolvable : public base::ReferenceCounted, private base::NonCopyable{ - - private: - std::string dumpFile; // Path of the generated testcase - ofgzstream *file; - - public: - HelixResolvable (const std::string & path); - ~HelixResolvable (); - - void addResolvable (const PoolItem item) - { *file << helixXML (item); } - - std::string filename () - { return dumpFile; } -}; - -DEFINE_PTR_TYPE(HelixResolvable); -IMPL_PTR_TYPE(HelixResolvable); - -typedef std::map RepositoryTable; - -HelixResolvable::HelixResolvable(const std::string & path) - :dumpFile (path) -{ - file = new ofgzstream(path.c_str()); - if (!file) { - ZYPP_THROW (Exception( "Can't open " + path ) ); - } - - *file << "" << endl; -} - -HelixResolvable::~HelixResolvable() -{ - *file << "" << endl; - delete(file); -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : HelixControl -/** - * Creates a file in helix format which contains all controll - * action of a testcase ( file is known as *-test.xml) - **/ -class HelixControl { - - private: - std::string dumpFile; // Path of the generated testcase - std::ofstream *file; - - public: - HelixControl (const std::string & controlPath, - const RepositoryTable & sourceTable, - const Arch & systemArchitecture, - const LocaleSet &languages, - const target::Modalias::ModaliasList & modaliasList, - const std::set & multiversionSpec, - const std::string & systemPath, - const bool forceResolve, - const bool onlyRequires, - const bool ignorealreadyrecommended); - HelixControl (); - ~HelixControl (); - - void installResolvable (const ResObject::constPtr &resObject, - const ResStatus &status); - void lockResolvable (const ResObject::constPtr &resObject, - const ResStatus &status); - void keepResolvable (const ResObject::constPtr &resObject, - const ResStatus &status); - void deleteResolvable (const ResObject::constPtr &resObject, - const ResStatus &status); - void addDependencies (const CapabilitySet &capRequire, const CapabilitySet &capConflict); - void addUpgradeRepos( const std::set & upgradeRepos_r ); - - void distupgrade (); - void verifySystem (); - void update (); - - std::string filename () { return dumpFile; } -}; - -HelixControl::HelixControl(const std::string & controlPath, - const RepositoryTable & repoTable, - const Arch & systemArchitecture, - const LocaleSet &languages, - const target::Modalias::ModaliasList & modaliasList, - const std::set & multiversionSpec, - const std::string & systemPath, - const bool forceResolve, - const bool onlyRequires, - const bool ignorealreadyrecommended) - :dumpFile (controlPath) -{ - file = new ofstream(controlPath.c_str()); - if (!file) { - ZYPP_THROW (Exception( "Can't open " + controlPath ) ); - } - - *file << "" << endl - << "" << endl - << "" << endl - << "" << endl - << TAB << "" << endl << endl; - for ( RepositoryTable::const_iterator it = repoTable.begin(); - it != repoTable.end(); ++it ) { - RepoInfo repo = it->first.info(); - *file << TAB << "" << endl; - - *file << TAB << "first.id()) - << "-package.xml.gz\" name=\"" << repo.alias() << "\"" - << " priority=\"" << repo.priority() - << "\" />" << endl << endl; - } - - for (LocaleSet::const_iterator iter = languages.begin(); iter != languages.end(); iter++) { - *file << TAB << "code() - << "\" />" << endl; - } - - for_( it, modaliasList.begin(), modaliasList.end() ) { - *file << TAB << "" << endl; - } - - for_( it, multiversionSpec.begin(), multiversionSpec.end() ) { - *file << TAB << "" << endl; - } - - if (forceResolve) - *file << TAB << "" << endl; - if (onlyRequires) - *file << TAB << "" << endl; - if (ignorealreadyrecommended) - *file << TAB << "" << endl; - - *file << "" << endl - << "" << endl; -} - -HelixControl::HelixControl() - :dumpFile ("/var/log/YaST2/solverTestcase/solver-test.xml") -{ - HelixControl (dumpFile); -} - -HelixControl::~HelixControl() -{ - *file << "" << endl - << "" << endl; - delete(file); -} - -void HelixControl::installResolvable(const ResObject::constPtr &resObject, - const ResStatus &status) -{ - *file << "repoInfo().alias() << "\" kind=\"" << toLower (resObject->kind().asString()) << "\"" - << " name=\"" << resObject->name() << "\"" << " arch=\"" << resObject->arch().asString() << "\"" - << " version=\"" << resObject->edition().version() << "\"" << " release=\"" << resObject->edition().release() << "\"" - << " status=\"" << status << "\"" - << "/>" << endl; -} - -void HelixControl::lockResolvable(const ResObject::constPtr &resObject, - const ResStatus &status) -{ - *file << "repoInfo().alias() << "\" kind=\"" << toLower (resObject->kind().asString()) << "\"" - << " name=\"" << resObject->name() << "\"" << " arch=\"" << resObject->arch().asString() << "\"" - << " version=\"" << resObject->edition().version() << "\"" << " release=\"" << resObject->edition().release() << "\"" - << " status=\"" << status << "\"" - << "/>" << endl; -} - -void HelixControl::keepResolvable(const ResObject::constPtr &resObject, - const ResStatus &status) -{ - *file << "repoInfo().alias() << "\" kind=\"" << toLower (resObject->kind().asString()) << "\"" - << " name=\"" << resObject->name() << "\"" << " arch=\"" << resObject->arch().asString() << "\"" - << " version=\"" << resObject->edition().version() << "\"" << " release=\"" << resObject->edition().release() << "\"" - << " status=\"" << status << "\"" - << "/>" << endl; -} - -void HelixControl::deleteResolvable(const ResObject::constPtr &resObject, - const ResStatus &status) -{ - *file << "kind().asString()) << "\"" - << " name=\"" << resObject->name() << "\"" - << " status=\"" << status << "\"" - << "/>" << endl; -} - -void HelixControl::addDependencies (const CapabilitySet & capRequire, const CapabilitySet & capConflict) -{ - for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) { - *file << "asString() << "\"" << "/>" << endl; - } - for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) { - *file << "asString() << "\"" << "/>" << endl; - } -} - -void HelixControl::addUpgradeRepos( const std::set & upgradeRepos_r ) -{ - for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() ) - { - *file << "alias() << "\"/>" << endl; - } -} - -void HelixControl::distupgrade() -{ - *file << "" << endl; -} - -void HelixControl::verifySystem() -{ - *file << "" << endl; -} - -void HelixControl::update() -{ - *file << "" << endl; -} - -//--------------------------------------------------------------------------- - -Testcase::Testcase() - :dumpPath("/var/log/YaST2/solverTestcase") -{} - -Testcase::Testcase(const std::string & path) - :dumpPath(path) -{} - -Testcase::~Testcase() -{} - -bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver) -{ - PathInfo path (dumpPath); - - if ( !path.isExist() ) { - if (zypp::filesystem::assert_dir (dumpPath)!=0) { - ERR << "Cannot create directory " << dumpPath << endl; - return false; - } - } else { - if (!path.isDir()) { - ERR << dumpPath << " is not a directory." << endl; - return false; - } - // remove old stuff if pool will be dump - if (dumpPool) - zypp::filesystem::clean_dir (dumpPath); - } - - if (runSolver) { - zypp::base::LogControl::TmpLineWriter tempRedirect; - zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" ); - zypp::base::LogControl::TmpExcessive excessive; - - resolver.resolvePool(); - } - - ResPool pool = resolver.pool(); - RepositoryTable repoTable; - PoolItemList items_to_install; - PoolItemList items_to_remove; - PoolItemList items_locked; - PoolItemList items_keep; - HelixResolvable_Ptr system = NULL; - - if (dumpPool) - system = new HelixResolvable(dumpPath + "/solver-system.xml.gz"); - - for ( ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it ) - { - Resolvable::constPtr res = it->resolvable(); - - if ( system && it->status().isInstalled() ) { - // system channel - system->addResolvable (*it); - } else { - // repo channels - Repository repo = it->resolvable()->satSolvable().repository(); - if (dumpPool) { - if (repoTable.find (repo) == repoTable.end()) { - repoTable[repo] = new HelixResolvable(dumpPath + "/" - + str::numstring((long)repo.id()) - + "-package.xml.gz"); - } - repoTable[repo]->addResolvable (*it); - } - } - - if ( it->status().isToBeInstalled() - && !(it->status().isBySolver())) { - items_to_install.push_back (*it); - } - if ( it->status().isKept() - && !(it->status().isBySolver())) { - items_keep.push_back (*it); - } - if ( it->status().isToBeUninstalled() - && !(it->status().isBySolver())) { - items_to_remove.push_back (*it); - } - if ( it->status().isLocked() - && !(it->status().isBySolver())) { - items_locked.push_back (*it); - } - } - - // writing control file "*-test.xml" - HelixControl control (dumpPath + "/solver-test.xml", - repoTable, - ZConfig::instance().systemArchitecture(), - pool.getRequestedLocales(), - target::Modalias::instance().modaliasList(), - ZConfig::instance().multiversionSpec(), - "solver-system.xml.gz", - resolver.forceResolve(), - resolver.onlyRequires(), - resolver.ignoreAlreadyRecommended() ); - - for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) { - control.installResolvable (iter->resolvable(), iter->status()); - } - - for (PoolItemList::const_iterator iter = items_locked.begin(); iter != items_locked.end(); iter++) { - control.lockResolvable (iter->resolvable(), iter->status()); - } - - for (PoolItemList::const_iterator iter = items_keep.begin(); iter != items_keep.end(); iter++) { - control.keepResolvable (iter->resolvable(), iter->status()); - } - - for (PoolItemList::const_iterator iter = items_to_remove.begin(); iter != items_to_remove.end(); iter++) { - control.deleteResolvable (iter->resolvable(), iter->status()); - } - - control.addDependencies (resolver.extraRequires(), resolver.extraConflicts()); - control.addDependencies (SystemCheck::instance().requiredSystemCap(), - SystemCheck::instance().conflictSystemCap()); - control.addUpgradeRepos( resolver.upgradeRepos() ); - - if (resolver.isUpgradeMode()) - control.distupgrade (); - if (resolver.isUpdateMode()) - control.update(); - if (resolver.isVerifyingMode()) - control.verifySystem(); - - return true; -} - - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/solver/detail/Testcase.h b/libzypp/zypp/solver/detail/Testcase.h deleted file mode 100644 index 16ceb9b..0000000 --- a/libzypp/zypp/solver/detail/Testcase.h +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/solver/detail/Testcase.h - * -*/ - -#ifndef ZYPP_SOLVER_DETAIL_TESTCASE_H -#define ZYPP_SOLVER_DETAIL_TESTCASE_H - -#include -#include "zypp/solver/detail/Resolver.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Testcase - /** - * Generating a testcase of the current pool and solver state. - **/ - class Testcase - { - private: - std::string dumpPath; // Path of the generated testcase - - public: - Testcase(); - Testcase( const std::string & path ); - ~Testcase(); - - bool createTestcase( Resolver & resolver, bool dumpPool = true, bool runSolver = true ); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_TESTCASE_H diff --git a/libzypp/zypp/solver/detail/Types.h b/libzypp/zypp/solver/detail/Types.h deleted file mode 100644 index e50f351..0000000 --- a/libzypp/zypp/solver/detail/Types.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Types.h - * - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_TYPES_H -#define ZYPP_SOLVER_DETAIL_TYPES_H - -#include -#include -#include -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Functional.h" - -#include "zypp/PoolItem.h" - -#define _DEBUG(x) DBG << x << std::endl; -#define _XDEBUG(x) do { if (base::logger::isExcessive()) XXX << x << std::endl;} while (0) -//#define _DEBUG(x) - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -typedef std::list PoolItemList; -typedef std::set PoolItemSet; - -DEFINE_PTR_TYPE(Resolver); - -DEFINE_PTR_TYPE(SolutionAction); -typedef std::list SolutionActionList; -typedef std::list CSolutionActionList; -DEFINE_PTR_TYPE(TransactionSolutionAction); -DEFINE_PTR_TYPE(InjectSolutionAction); -DEFINE_PTR_TYPE(SolverQueueItem); -DEFINE_PTR_TYPE(SolverQueueItemUpdate); -DEFINE_PTR_TYPE(SolverQueueItemDelete); -DEFINE_PTR_TYPE(SolverQueueItemInstall); -DEFINE_PTR_TYPE(SolverQueueItemInstallOneOf); -DEFINE_PTR_TYPE(SolverQueueItemLock); - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_TYPES_H diff --git a/libzypp/zypp/solver/libzypp_solver.h b/libzypp/zypp/solver/libzypp_solver.h deleted file mode 100644 index 2c864ed..0000000 --- a/libzypp/zypp/solver/libzypp_solver.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* libzypp.h - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_LIBZYPP_H -#define ZYPP_SOLVER_DETAIL_LIBZYPP_H - -#include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/ResolverContext.h" -#include "zypp/solver/detail/ResolverProblem.h" -#include "zypp/solver/detail/ProblemSolution.h" -#include "zypp/solver/detail/SolutionAction.h" - -#endif // ZYPP_SOLVER_DETAIL_LIBZYPP_H diff --git a/libzypp/zypp/target/CommitPackageCache.cc b/libzypp/zypp/target/CommitPackageCache.cc deleted file mode 100644 index 07a51c4..0000000 --- a/libzypp/zypp/target/CommitPackageCache.cc +++ /dev/null @@ -1,154 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCache.cc - * -*/ -#include -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" - -#include "zypp/target/CommitPackageCache.h" -#include "zypp/target/CommitPackageCacheImpl.h" -#include "zypp/target/CommitPackageCacheReadAhead.h" - -using std::endl; - -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/repo/PackageProvider.h" -#include "zypp/repo/DeltaCandidates.h" -#include "zypp/ResPool.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace { - /////////////////////////////////////////////////////////////////// - /// \class QueryInstalledEditionHelper - /// \short Helper for PackageProvider queries during download. - /////////////////////////////////////////////////////////////////// - struct QueryInstalledEditionHelper - { - bool operator()( const std::string & name_r, const Edition & ed_r, const Arch & arch_r ) const - { - rpm::librpmDb::db_const_iterator it; - for ( it.findByName( name_r ); *it; ++it ) - { - if ( arch_r == it->tag_arch() - && ( ed_r == Edition::noedition || ed_r == it->tag_edition() ) ) - { - return true; - } - } - return false; - } - }; - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // class RepoProvidePackage - // - /////////////////////////////////////////////////////////////////// - - struct RepoProvidePackage::Impl - { - repo::RepoMediaAccess _access; - std::list _repos; - repo::PackageProviderPolicy _packageProviderPolicy; - }; - - RepoProvidePackage::RepoProvidePackage() - : _impl( new Impl ) - { - const ResPool & pool( ResPool::instance() ); - _impl->_repos.insert( _impl->_repos.begin(), pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd() ); - _impl->_packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() ); - } - - RepoProvidePackage::~RepoProvidePackage() - {} - - ManagedFile RepoProvidePackage::operator()( const PoolItem & pi, bool fromCache_r ) - { - Package::constPtr p = asKind(pi.resolvable()); - if ( fromCache_r ) - { - repo::PackageProvider pkgProvider( _impl->_access, p, repo::DeltaCandidates(), _impl->_packageProviderPolicy ); - return pkgProvider.providePackageFromCache(); - } - else - { - repo::DeltaCandidates deltas( _impl->_repos, p->name() ); - repo::PackageProvider pkgProvider( _impl->_access, p, deltas, _impl->_packageProviderPolicy ); - return pkgProvider.providePackage(); - } - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : CommitPackageCache - // - /////////////////////////////////////////////////////////////////// - - CommitPackageCache::CommitPackageCache( Impl * pimpl_r ) - : _pimpl( pimpl_r ) - { - assert( _pimpl ); - } - - CommitPackageCache::CommitPackageCache( const Pathname & rootDir_r, - const PackageProvider & packageProvider_r ) - { - if ( getenv("ZYPP_COMMIT_NO_PACKAGE_CACHE") ) - { - MIL << "$ZYPP_COMMIT_NO_PACKAGE_CACHE is set." << endl; - _pimpl.reset( new Impl( packageProvider_r ) ); // no cache - } - else - { - _pimpl.reset( new CommitPackageCacheReadAhead( rootDir_r, packageProvider_r ) ); - } - assert( _pimpl ); - } - - CommitPackageCache::~CommitPackageCache() - {} - - void CommitPackageCache::setCommitList( std::vector commitList_r ) - { _pimpl->setCommitList( commitList_r ); } - - ManagedFile CommitPackageCache::get( const PoolItem & citem_r ) - { return _pimpl->get( citem_r ); } - - bool CommitPackageCache::preloaded() const - { return _pimpl->preloaded(); } - - void CommitPackageCache::preloaded( bool newval_r ) - { _pimpl->preloaded( newval_r ); } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj ) - { return str << *obj._pimpl; } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/CommitPackageCache.h b/libzypp/zypp/target/CommitPackageCache.h deleted file mode 100644 index 2cf6220..0000000 --- a/libzypp/zypp/target/CommitPackageCache.h +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCache.h - * -*/ -#ifndef ZYPP_TARGET_COMMITPACKAGECACHE_H -#define ZYPP_TARGET_COMMITPACKAGECACHE_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Function.h" - -#include "zypp/PoolItem.h" -#include "zypp/Pathname.h" -#include "zypp/ManagedFile.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class RepoProvidePackage - /// \short Default PackageProvider for \ref CommitPackageCache - /// - /// \p pool_r \ref ResPool used to get candidates - /// \p pi item to be commited - /////////////////////////////////////////////////////////////////// - class RepoProvidePackage - { - public: - RepoProvidePackage(); - ~RepoProvidePackage(); - - /** Provide package optionally fron cache only. */ - ManagedFile operator()( const PoolItem & pi, bool fromCache_r ); - - private: - struct Impl; - RW_pointer _impl; - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : CommitPackageCache - // - /** Target::commit helper optimizing package provision. - */ - class CommitPackageCache - { - friend std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj ); - - public: - typedef function PackageProvider; - - public: - /** Ctor */ - CommitPackageCache( const Pathname & rootDir_r, - const PackageProvider & packageProvider_r = RepoProvidePackage() ); - - /** Dtor */ - ~CommitPackageCache(); - - public: - /** Download(commit) sequence of solvables to compute read ahead. */ - void setCommitList( std::vector commitList_r ); - /** \overload */ - template - void setCommitList( _Iterator begin_r, _Iterator end_r ) - { setCommitList( std::vector( begin_r, end_r ) ); } - - /** Provide a package. */ - ManagedFile get( const PoolItem & citem_r ); - /** \overload */ - ManagedFile get( sat::Solvable citem_r ) - { return get( PoolItem(citem_r) ); } - - /** Whether preloaded hint is set. - * If preloaded the cache tries to avoid trigering the infoInCache CB, - * based on the assumption this was already done when preloading the cache. - */ - bool preloaded() const; - /** Set preloaded hint. */ - void preloaded( bool newval_r ); - - public: - /** Implementation. */ - class Impl; - /** Ctor taking an implementation. */ - explicit CommitPackageCache( Impl * pimpl_r ); - private: - /** Pointer to implementation. */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates CommitPackageCache Stream output */ - std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_COMMITPACKAGECACHE_H diff --git a/libzypp/zypp/target/CommitPackageCacheImpl.cc b/libzypp/zypp/target/CommitPackageCacheImpl.cc deleted file mode 100644 index 9beda5a..0000000 --- a/libzypp/zypp/target/CommitPackageCacheImpl.cc +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCacheImpl.cc - * -*/ -#include -#include "zypp/base/Logger.h" - -#include "zypp/target/CommitPackageCacheImpl.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/CommitPackageCacheImpl.h b/libzypp/zypp/target/CommitPackageCacheImpl.h deleted file mode 100644 index c7ac702..0000000 --- a/libzypp/zypp/target/CommitPackageCacheImpl.h +++ /dev/null @@ -1,121 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCacheImpl.h - * -*/ -#ifndef ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H -#define ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" - -#include "zypp/target/CommitPackageCache.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : CommitPackageCache::Impl - // - /** Base for CommitPackageCache implementations (implements no chache). - * - * All packages are directly retrieved from the source via the - * PackageProvider passed to the ctor. The PackageProvider is expected - * to throw or return an empty ManagedFile if the package can't be provided. - */ - class CommitPackageCache::Impl - { - public: - typedef CommitPackageCache::PackageProvider PackageProvider; - - public: - Impl( const PackageProvider & packageProvider_r ) - : _packageProvider( packageProvider_r ) - {} - - virtual ~Impl() - {} - - public: - /** Provide the package. - * Derived classes overload this. - */ - virtual ManagedFile get( const PoolItem & citem_r ) - { - return sourceProvidePackage( citem_r ); - } - - void setCommitList( std::vector commitList_r ) - { _commitList = commitList_r; } - - const std::vector & commitList() const - { return _commitList; } - - bool preloaded() const - { return _preloaded; } - - void preloaded( bool newval_r ) - { _preloaded = newval_r; } - - protected: - /** Let the Source provide the package. */ - virtual ManagedFile sourceProvidePackage( const PoolItem & pi ) const - { - if ( ! _packageProvider ) - { - ZYPP_THROW( Exception("No package provider configured.") ); - } - - ManagedFile ret( _packageProvider( pi, /*cached only*/false ) ); - if ( ret.value().empty() ) - { - ZYPP_THROW( Exception("Package provider failed.") ); - } - - return ret; - } - - /** Let the Source provide an already cached package. */ - virtual ManagedFile sourceProvideCachedPackage( const PoolItem & pi ) const - { - if ( ! _packageProvider ) - { - ZYPP_THROW( Exception("No package provider configured.") ); - } - - return _packageProvider( pi, /*cached only*/true ); - } - - private: - std::vector _commitList; - PackageProvider _packageProvider; - DefaultIntegral _preloaded; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates CommitPackageCache::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const CommitPackageCache::Impl & obj ) - { - return str << "CommitPackageCache::Impl"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_COMMITPACKAGECACHEIMPL_H diff --git a/libzypp/zypp/target/CommitPackageCacheReadAhead.cc b/libzypp/zypp/target/CommitPackageCacheReadAhead.cc deleted file mode 100644 index 826f5d2..0000000 --- a/libzypp/zypp/target/CommitPackageCacheReadAhead.cc +++ /dev/null @@ -1,188 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCacheReadAhead.cc - * -*/ -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/PathInfo.h" -#include "zypp/RepoInfo.h" -#include "zypp/Package.h" -#include "zypp/target/CommitPackageCacheReadAhead.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : IMediaKey - // - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const IMediaKey & obj ) - { - return str << "[S" << obj._repo.id() << ":" << obj._mediaNr << "]" - << " " << obj._repo.info().alias(); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : CommitPackageCacheReadAhead - // - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : CommitPackageCacheReadAhead::CommitPackageCacheReadAhead - // METHOD TYPE : Ctor - // - CommitPackageCacheReadAhead::CommitPackageCacheReadAhead( const Pathname & /*rootDir_r*/, - const PackageProvider & packageProvider_r ) - : CommitPackageCache::Impl( packageProvider_r ) - //, _rootDir( rootDir_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : CommitPackageCacheReadAhead::onInteractiveMedia - // METHOD TYPE : bool - // - bool CommitPackageCacheReadAhead::onInteractiveMedia( const PoolItem & pi ) const - { - if ( pi->mediaNr() == 0 ) // no media access at all - return false; - if ( pi->repoInfo().baseUrlsEmpty() ) - return false; // no Url - should actually not happen - std::string scheme( pi->repoInfo().baseUrlsBegin()->getScheme() ); - return ( scheme == "dvd" || scheme == "cd" ); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : CommitPackageCacheReadAhead::cacheLastInteractive - // METHOD TYPE : void - // - void CommitPackageCacheReadAhead::cacheLastInteractive( const PoolItem & citem_r ) - { - // Fill cache errors are never proagated. - try - { - doCacheLastInteractive( citem_r ); - } - catch ( const Exception & excpt_r ) - { - ZYPP_CAUGHT( excpt_r ); - WAR << "Failed to cache " << _lastInteractive << endl; - } - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : CommitPackageCacheReadAhead::doCacheLastInteractive - // METHOD TYPE : void - // - void CommitPackageCacheReadAhead::doCacheLastInteractive( const PoolItem & citem_r ) - { - unsigned addToCache = 0; - bool sawCitem = false; - - // Collect all remaining packages to install from - // _lastInteractive media. (just the PoolItem data) - for_( it, commitList().begin(), commitList().end() ) - { - PoolItem pi( *it ); - if ( ! sawCitem ) - { - if ( pi == citem_r ) - sawCitem = true; - continue; - } - if ( IMediaKey( pi ) == _lastInteractive - && pi.status().isToBeInstalled() - && isKind(pi.resolvable()) ) - { - if ( ! pi->asKind()->isCached() ) - { - ManagedFile fromSource( sourceProvidePackage( pi ) ); - if ( fromSource->empty() ) - { - ERR << "Copy to cache failed on " << fromSource << endl; - ZYPP_THROW( Exception("Copy to cache failed.") ); - } - fromSource.resetDispose(); // keep the package file in the cache - ++addToCache; - } - } - } - - if ( addToCache ) - MIL << "Cached " << _lastInteractive << ": " << addToCache << " items." << endl; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : CommitPackageCacheReadAhead::get - // METHOD TYPE : ManagedFile - // - ManagedFile CommitPackageCacheReadAhead::get( const PoolItem & citem_r ) - { - ManagedFile ret; - if ( preloaded() ) - { - // Check whether it's cached. - ManagedFile ret( sourceProvideCachedPackage( citem_r ) ); - if ( ! ret->empty() ) - return ret; - } - // else: we head for sourceProvidePackage(), even if the package - // was cached. The actual difference is that sourceProvidePackage - // will trigger the infoInCache CB that informs the application. - // Once the cache is preloaded we try to avoid this CB. - - - // Preload cache if a CD/DVD change is pending to avoid - // switching back and forth... - if ( onInteractiveMedia( citem_r ) ) - { - ret = sourceProvideCachedPackage( citem_r ); - if ( ! ret->empty() ) - return ret; - - IMediaKey current( citem_r ); - if ( current != _lastInteractive ) - { - if ( _lastInteractive != IMediaKey() ) - { - cacheLastInteractive( citem_r ); - } - - DBG << "Interactive change [" << ++_dbgChanges << "] from " << _lastInteractive << " to " << current << endl; - _lastInteractive = current; - } - } - - // Provide and return the file from media. - return sourceProvidePackage( citem_r ); - } - - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/CommitPackageCacheReadAhead.h b/libzypp/zypp/target/CommitPackageCacheReadAhead.h deleted file mode 100644 index 9ba707a..0000000 --- a/libzypp/zypp/target/CommitPackageCacheReadAhead.h +++ /dev/null @@ -1,121 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/CommitPackageCacheReadAhead.h - * -*/ -#ifndef ZYPP_TARGET_COMMITPACKAGECACHEREADAHEAD_H -#define ZYPP_TARGET_COMMITPACKAGECACHEREADAHEAD_H - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" -#include "zypp/base/DefaultIntegral.h" -#include "zypp/Repository.h" -#include "zypp/TmpPath.h" -#include "zypp/target/CommitPackageCacheImpl.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : IMediaKey - // - /** Helper storing a source id and media number. */ - struct IMediaKey - { - IMediaKey() - {} - - explicit - IMediaKey( const PoolItem & obj_r ) - : _repo( obj_r->repository() ) - , _mediaNr( obj_r->mediaNr() ) - {} - - explicit - IMediaKey( const ResObject::constPtr & obj_r ) - : _repo( obj_r->repository() ) - , _mediaNr( obj_r->mediaNr() ) - {} - - IMediaKey( const Repository & repo, unsigned mediaNr_r ) - : _repo( repo ) - , _mediaNr( mediaNr_r ) - {} - - bool operator==( const IMediaKey & rhs ) const - { return( _repo == rhs._repo && _mediaNr == rhs._mediaNr ); } - - bool operator!=( const IMediaKey & rhs ) const - { return ! operator==( rhs ); } - - bool operator<( const IMediaKey & rhs ) const - { - return( _repo.id() < rhs._repo.id() - || ( _repo.id() == rhs._repo.id() - && _mediaNr < rhs._mediaNr ) ); - } - - Repository _repo; - DefaultIntegral _mediaNr; - }; - /////////////////////////////////////////////////////////////////// - - std::ostream & operator<<( std::ostream & str, const IMediaKey & obj ); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : CommitPackageCacheReadAhead - // - /** */ - class CommitPackageCacheReadAhead : public CommitPackageCache::Impl - { - public: - CommitPackageCacheReadAhead( const Pathname & /*rootDir_r*/, - const PackageProvider & packageProvider_r ); - - public: - /** Provide the package. Either from Source or from cache. */ - virtual ManagedFile get( const PoolItem & citem_r ); - - private: - /** Return whether \a pi is located on a CD/DVD */ - bool onInteractiveMedia( const PoolItem & pi ) const; - - private: - /** Fill the cache. - * Called before changing from one interactive media to another. - * Performs the read ahead of packages trying to avoid the necessity - * of switching back to the current media later. - */ - void cacheLastInteractive( const PoolItem & citem_r ); - - /** cacheLastInteractive helper . */ - void doCacheLastInteractive( const PoolItem & citem_r ); - - private: - DefaultIntegral _dbgChanges; - IMediaKey _lastInteractive; - //Pathname _rootDir; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_COMMITPACKAGECACHEREADAHEAD_H diff --git a/libzypp/zypp/target/HardLocksFile.cc b/libzypp/zypp/target/HardLocksFile.cc deleted file mode 100644 index fbfd5a8..0000000 --- a/libzypp/zypp/target/HardLocksFile.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/HardLocksFile.cc - * -*/ -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/Date.h" - -#include "zypp/target/HardLocksFile.h" -#include "zypp/PoolQueryUtil.tcc" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - void HardLocksFile::load( const Pathname & file_r, Data & data_r ) - { - PathInfo pi( file_r ); - if ( ! pi.isFile() ) - { - WAR << "Can't read " << pi << endl; - return; - } - - readPoolQueriesFromFile( file_r, std::back_inserter( data_r ) ); - - MIL << "Read " << pi << endl; - } - - void HardLocksFile::store( const Pathname & file_r, const Data & data_r ) - { - filesystem::TmpFile tmp( filesystem::TmpFile::makeSibling( file_r ) ); - filesystem::chmod( tmp.path(), 0644 ); - - writePoolQueriesToFile( tmp.path(), data_r.begin(), data_r.end() ); - - if ( true ) // by now: no error info from writePoolQueriesToFile - { - filesystem::rename( tmp.path(), file_r ); - MIL << "Wrote " << PathInfo(file_r) << endl; - } - else - { - ERR << "Can't write " << PathInfo(tmp.path()) << endl; - } - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const HardLocksFile & obj ) - { - str << obj.file() << ' '; - if ( obj._dataPtr ) - str << obj.data(); - else - str << "(unloaded)"; - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/HardLocksFile.h b/libzypp/zypp/target/HardLocksFile.h deleted file mode 100644 index 70f9e9e..0000000 --- a/libzypp/zypp/target/HardLocksFile.h +++ /dev/null @@ -1,122 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/HardLocksFile.h - * -*/ -#ifndef ZYPP_TARGET_HARDLOCKSFILE_H -#define ZYPP_TARGET_HARDLOCKSFILE_H - -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/Pathname.h" -#include "zypp/pool/PoolTraits.h" -#include "zypp/PoolQuery.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : HardLocksFile - // - /** Save and restore hardlocks. - */ - class HardLocksFile - { - friend std::ostream & operator<<( std::ostream & str, const HardLocksFile & obj ); - public: - - typedef pool::PoolTraits::HardLockQueries Data; - - public: - /** Ctor taking the file to read/write. */ - HardLocksFile( const Pathname & file_r ) - : _file( file_r ) - {} - - /** Return the file path. */ - const Pathname & file() const - { return _file; } - - /** Return the data. - * The file is read once on demand. Returns empty \ref Data if - * the file does not exist or is not readable. - */ - const Data & data() const - { - if ( !_dataPtr ) - { - _dataPtr.reset( new Data ); - Data & mydata( *_dataPtr ); - load( _file, mydata ); - } - return *_dataPtr; - } - - /** Store new \ref Data. - * Write the new \ref Data to file, unless we know it - * did not change. The directory containing file must - * exist. - */ - void setData( const Data & data_r ) - { - if ( !_dataPtr ) - _dataPtr.reset( new Data ); - - if ( differs( *_dataPtr, data_r ) ) - { - store( _file, data_r ); - *_dataPtr = data_r; - } - } - - private: - /** Helper testing whether two \ref Data differ. */ - bool differs( const Data & lhs, const Data & rhs ) const - { - if ( lhs.size() != rhs.size() ) - return true; - // Complete diff is too expensive and not necessary here. - // Just check for the same sequence of items. - Data::const_iterator rit = rhs.begin(); - for_( it, lhs.begin(), lhs.end() ) - { - if ( *it != *rit ) - return true; - ++rit; - } - return false; - } - /** Read \ref Data from \c file_r. */ - static void load( const Pathname & file_r, Data & data_r ); - /** Write \ref Data to \c file_r. */ - static void store( const Pathname & file_r, const Data & data_r ); - - private: - Pathname _file; - mutable scoped_ptr _dataPtr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates HardLocksFile Stream output */ - std::ostream & operator<<( std::ostream & str, const HardLocksFile & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_HARDLOCKSFILE_H diff --git a/libzypp/zypp/target/RequestedLocalesFile.cc b/libzypp/zypp/target/RequestedLocalesFile.cc deleted file mode 100644 index 3c27e5a..0000000 --- a/libzypp/zypp/target/RequestedLocalesFile.cc +++ /dev/null @@ -1,95 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/RequestedLocalesFile.cc - * -*/ -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/Date.h" - -#include "zypp/target/RequestedLocalesFile.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - void RequestedLocalesFile::load( const Pathname & file_r, LocaleSet & locales_r ) - { - PathInfo pi( file_r ); - if ( ! pi.isFile() ) - { - WAR << "Can't read " << pi << endl; - return; - } - std::ifstream infile( file_r.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) - { - std::string l( str::trim(*in) ); - if ( ! l.empty() && l[0] != '#' ) - { - locales_r.insert( Locale(l) ); - } - } - MIL << "Read " << pi << endl; - } - - void RequestedLocalesFile::store( const Pathname & file_r, const LocaleSet & locales_r ) - { - filesystem::TmpFile tmp( filesystem::TmpFile::makeSibling( file_r ) ); - filesystem::chmod( tmp.path(), 0644 ); - - std::ofstream outs( tmp.path().c_str() ); - outs << "# zypp::RequestedLocales generated " << Date::now() << endl; - dumpRange( outs, locales_r.begin(), locales_r.end(), "#", "\n", "\n", "\n", "#\n" ); - outs.close(); - - if ( outs.good() ) - { - filesystem::rename( tmp.path(), file_r ); - MIL << "Wrote " << PathInfo(file_r) << endl; - } - else - { - ERR << "Can't write " << PathInfo(tmp.path()) << endl; - } - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj ) - { - str << obj.file() << ' '; - if ( obj._localesPtr ) - str << obj.locales(); - else - str << "(unloaded)"; - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/RequestedLocalesFile.h b/libzypp/zypp/target/RequestedLocalesFile.h deleted file mode 100644 index bbefe95..0000000 --- a/libzypp/zypp/target/RequestedLocalesFile.h +++ /dev/null @@ -1,113 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/RequestedLocalesFile.h - * -*/ -#ifndef ZYPP_TARGET_REQUESTEDLOCALESFILE_H -#define ZYPP_TARGET_REQUESTEDLOCALESFILE_H - -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/Pathname.h" -#include "zypp/Locale.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RequestedLocalesFile - // - /** Save and restore locale set from file. - */ - class RequestedLocalesFile - { - friend std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj ); - - public: - /** Ctor taking the file to read/write. */ - RequestedLocalesFile( const Pathname & file_r ) - : _file( file_r ) - {} - - /** Return the file path. */ - const Pathname & file() const - { return _file; } - - /** Return the loacale set. - * The file is read once on demand. returns an empty set if - * the file does not exist or is not readable. - */ - const LocaleSet & locales() const - { - if ( !_localesPtr ) - { - _localesPtr.reset( new LocaleSet ); - LocaleSet & ls( *_localesPtr ); - load( _file, ls ); - } - return *_localesPtr; - } - - /** Store a new locale set. - * Write the new localeset to file, unless we know it - * did not change. The directory containing file must exist. - */ - void setLocales( const LocaleSet & locales_r ) - { - if ( !_localesPtr ) - _localesPtr.reset( new LocaleSet ); - - if ( differs( *_localesPtr, locales_r ) ) - { - store( _file, locales_r ); - *_localesPtr = locales_r; - } - } - - private: - /** Helper testing whether two \ref LocaleSet differ. */ - bool differs( const LocaleSet & lhs, const LocaleSet & rhs ) const - { - if ( lhs.size() != rhs.size() ) - return true; - for_( it, lhs.begin(), lhs.end() ) - { - if ( rhs.find( *it ) == rhs.end() ) - return true; - } - return false; - } - /** Read \ref LocaleSet from \c file_r. */ - static void load( const Pathname & file_r, LocaleSet & locales_r ); - /** Write \ref LocaleSet to \c file_r. */ - static void store( const Pathname & file_r, const LocaleSet & locales_r ); - - private: - Pathname _file; - mutable scoped_ptr _localesPtr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RequestedLocalesFile Stream output */ - std::ostream & operator<<( std::ostream & str, const RequestedLocalesFile & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_REQUESTEDLOCALESFILE_H diff --git a/libzypp/zypp/target/RpmPostTransCollector.cc b/libzypp/zypp/target/RpmPostTransCollector.cc deleted file mode 100644 index 14ceab8..0000000 --- a/libzypp/zypp/target/RpmPostTransCollector.cc +++ /dev/null @@ -1,202 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/RpmPostTransCollector.cc - */ -#include -#include -#include "zypp/base/LogTools.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/target/RpmPostTransCollector.h" - -#include "zypp/TmpPath.h" -#include "zypp/PathInfo.h" -#include "zypp/HistoryLog.h" -#include "zypp/ZYppCallbacks.h" -#include "zypp/ExternalProgram.h" -#include "zypp/target/rpm/RpmHeader.h" - - -using std::endl; -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::posttrans" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace target - { - - /////////////////////////////////////////////////////////////////// - /// \class RpmPostTransCollector::Impl - /// \brief RpmPostTransCollector implementation. - /////////////////////////////////////////////////////////////////// - class RpmPostTransCollector::Impl : private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const Impl & obj ); - friend std::ostream & dumpOn( std::ostream & str, const Impl & obj ); - public: - Impl( const Pathname & root_r ) - : _root( root_r ) - {} - - ~Impl() - { if ( !_scripts.empty() ) discardScripts(); } - - /** Extract and remember a packages %posttrans script for later execution. */ - bool collectScriptFromPackage( ManagedFile rpmPackage_r ) - { - rpm::RpmHeader::constPtr pkg( rpm::RpmHeader::readPackage( rpmPackage_r, rpm::RpmHeader::NOVERIFY ) ); - - std::string prog( pkg->tag_posttransprog() ); - if ( prog.empty() || prog == "" ) // by now leave lua to rpm - return false; - - filesystem::TmpFile script( tmpDir(), rpmPackage_r->basename() ); - filesystem::addmod( script.path(), 0500 ); - script.autoCleanup( false ); // no autodelete; within a tmpdir - { - std::ofstream out( script.path().c_str() ); - out << "# " << pkg->tag_posttransprog() << endl - << pkg->tag_posttrans() << endl; - } - _scripts.push_back( script.path().basename() ); - MIL << "COLLECT posttrans: " << PathInfo( script.path() ) << endl; - //DBG << "PROG: " << pkg->tag_posttransprog() << endl; - //DBG << "SCRPT: " << pkg->tag_posttrans() << endl; - return true; - } - - /** Execute te remembered scripts. */ - void executeScripts() - { - if ( _scripts.empty() ) - return; - - HistoryLog historylog; - - Pathname noRootScriptDir( filesystem::TmpDir::defaultLocation() / tmpDir().basename() ); - - for ( auto && script : _scripts ) - { - MIL << "EXECUTE posttrans: " << script << endl; - ExternalProgram prog( (noRootScriptDir/script).asString(), ExternalProgram::Stderr_To_Stdout, false, -1, true, _root ); - - str::Str collect; - for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() ) - { - DBG << line; - collect << " " << line; - } - int ret = prog.close(); - const std::string & scriptmsg( collect ); - - if ( ret != 0 || ! scriptmsg.empty() ) - { - const std::string & pkgident( script.substr( 0, script.size()-6 ) ); // strip tmp file suffix - - if ( ! scriptmsg.empty() ) - { - str::Str msg; - msg << "Output of " << pkgident << " %posttrans script:\n" << scriptmsg; - historylog.comment( msg, true /*timestamp*/); - JobReport::info( msg ); - } - - if ( ret != 0 ) - { - str::Str msg; - msg << pkgident << " %posttrans script failed (returned " << ret << ")"; - WAR << msg << endl; - historylog.comment( msg, true /*timestamp*/); - JobReport::warning( msg ); - } - } - } - _scripts.clear(); - } - - /** Discard all remembered scrips. */ - void discardScripts() - { - if ( _scripts.empty() ) - return; - - HistoryLog historylog; - - str::Str msg; - msg << "%posttrans scripts skipped while aborting:\n"; - for ( auto && script : _scripts ) - { - const std::string & pkgident( script.substr( 0, script.size()-6 ) ); // strip tmp file suffix - WAR << "UNEXECUTED posttrans: " << script << endl; - msg << " " << pkgident << "\n"; - } - - historylog.comment( msg, true /*timestamp*/); - JobReport::warning( msg ); - - _scripts.clear(); - } - - private: - /** Lazy create tmpdir on demand. */ - Pathname tmpDir() - { - if ( !_ptrTmpdir ) _ptrTmpdir.reset( new filesystem::TmpDir( _root / filesystem::TmpDir::defaultLocation(), "posttrans" ) ); - DBG << _ptrTmpdir->path() << endl; - return _ptrTmpdir->path(); - } - - private: - Pathname _root; - std::list _scripts; - boost::scoped_ptr _ptrTmpdir; - }; - - /** \relates RpmPostTransCollector::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const RpmPostTransCollector::Impl & obj ) - { return str << "RpmPostTransCollector::Impl"; } - - /** \relates RpmPostTransCollector::Impl Verbose stream output */ - inline std::ostream & dumpOn( std::ostream & str, const RpmPostTransCollector::Impl & obj ) - { return str << obj; } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : RpmPostTransCollector - // - /////////////////////////////////////////////////////////////////// - - RpmPostTransCollector::RpmPostTransCollector( const Pathname & root_r ) - : _pimpl( new Impl( root_r ) ) - {} - - RpmPostTransCollector::~RpmPostTransCollector() - {} - - bool RpmPostTransCollector::collectScriptFromPackage( ManagedFile rpmPackage_r ) - { return _pimpl->collectScriptFromPackage( rpmPackage_r ); } - - void RpmPostTransCollector::executeScripts() - { return _pimpl->executeScripts(); } - - void RpmPostTransCollector::discardScripts() - { return _pimpl->discardScripts(); } - - std::ostream & operator<<( std::ostream & str, const RpmPostTransCollector & obj ) - { return str << *obj._pimpl; } - - std::ostream & dumpOn( std::ostream & str, const RpmPostTransCollector & obj ) - { return dumpOn( str, *obj._pimpl ); } - - } // namespace target - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/RpmPostTransCollector.h b/libzypp/zypp/target/RpmPostTransCollector.h deleted file mode 100644 index de0de60..0000000 --- a/libzypp/zypp/target/RpmPostTransCollector.h +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/RpmPostTransCollector.h - */ -#ifndef ZYPP_TARGET_RPMPOSTTRANSCOLLECTOR_H -#define ZYPP_TARGET_RPMPOSTTRANSCOLLECTOR_H - -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/ManagedFile.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace target - { - /////////////////////////////////////////////////////////////////// - /// \class RpmPostTransCollector - /// \brief Extract and remember %posttrans scripts for later execution - /// \todo Maybe embedd this into the TransactionSteps. - /////////////////////////////////////////////////////////////////// - class RpmPostTransCollector - { - friend std::ostream & operator<<( std::ostream & str, const RpmPostTransCollector & obj ); - friend std::ostream & dumpOn( std::ostream & str, const RpmPostTransCollector & obj ); - - public: - /** Default ctor */ - RpmPostTransCollector( const Pathname & root_r ); - - /** Dtor */ - ~RpmPostTransCollector(); - - public: - /** Extract and remember a packages %posttrans script for later execution. - * \return whether a script was collected. - */ - bool collectScriptFromPackage( ManagedFile rpmPackage_r ); - - /** Execute te remembered scripts. */ - void executeScripts(); - - /** Discard all remembered scrips. */ - void discardScripts(); - - public: - class Impl; ///< Implementation class. - private: - RW_pointer _pimpl; ///< Pointer to implementation. - }; - - /** \relates RpmPostTransCollector Stream output */ - std::ostream & operator<<( std::ostream & str, const RpmPostTransCollector & obj ); - - /** \relates RpmPostTransCollector Verbose stream output */ - std::ostream & dumOn( std::ostream & str, const RpmPostTransCollector & obj ); - - } // namespace target - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_RPMPOSTTRANSCOLLECTOR_H diff --git a/libzypp/zypp/target/SolvIdentFile.cc b/libzypp/zypp/target/SolvIdentFile.cc deleted file mode 100644 index f09074a..0000000 --- a/libzypp/zypp/target/SolvIdentFile.cc +++ /dev/null @@ -1,95 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/SolvIdentFile.cc - * -*/ -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/String.h" - -#include "zypp/PathInfo.h" -#include "zypp/TmpPath.h" -#include "zypp/Date.h" - -#include "zypp/target/SolvIdentFile.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - void SolvIdentFile::load( const Pathname & file_r, Data & data_r ) - { - PathInfo pi( file_r ); - if ( ! pi.isFile() ) - { - WAR << "Can't read " << pi << endl; - return; - } - std::ifstream infile( file_r.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) - { - std::string l( str::trim(*in) ); - if ( ! l.empty() && l[0] != '#' ) - { - data_r.insert( IdString(l) ); - } - } - MIL << "Read " << pi << endl; - } - - void SolvIdentFile::store( const Pathname & file_r, const Data & data_r ) - { - filesystem::TmpFile tmp( filesystem::TmpFile::makeSibling( file_r ) ); - filesystem::chmod( tmp.path(), 0644 ); - - std::ofstream outs( tmp.path().c_str() ); - outs << "# " << file_r.basename() << " generated " << Date::now() << endl; - dumpRange( outs, data_r.begin(), data_r.end(), "#", "\n", "\n", "\n", "#\n" ); - outs.close(); - - if ( outs.good() ) - { - filesystem::rename( tmp.path(), file_r ); - MIL << "Wrote " << PathInfo(file_r) << endl; - } - else - { - ERR << "Can't write " << PathInfo(tmp.path()) << endl; - } - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const SolvIdentFile & obj ) - { - str << obj.file() << ' '; - if ( obj._dataPtr ) - str << obj.data(); - else - str << "(unloaded)"; - return str; - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/SolvIdentFile.h b/libzypp/zypp/target/SolvIdentFile.h deleted file mode 100644 index b44e2dd..0000000 --- a/libzypp/zypp/target/SolvIdentFile.h +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/SolvIdentFile.h - * -*/ -#ifndef ZYPP_TARGET_SOLVIDENTFILE_H -#define ZYPP_TARGET_SOLVIDENTFILE_H - -#include - -#include "zypp/base/PtrTypes.h" - -#include "zypp/IdString.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - /// \class SolvIdentFile - /// \short Save and restore a list of solvable names (ident IdString) - /////////////////////////////////////////////////////////////////// - class SolvIdentFile - { - friend std::ostream & operator<<( std::ostream & str, const SolvIdentFile & obj ); - public: - typedef std::tr1::unordered_set Data; - - public: - /** Ctor taking the file to read/write. */ - SolvIdentFile( const Pathname & file_r ) - : _file( file_r ) - {} - - /** Return the file path. */ - const Pathname & file() const - { return _file; } - - /** Return the data. - * The file is read once on demand. Returns empty \ref Data if - * the file does not exist or is not readable. - */ - const Data & data() const - { - if ( !_dataPtr ) - { - _dataPtr.reset( new Data ); - Data & mydata( *_dataPtr ); - load( _file, mydata ); - } - return *_dataPtr; - } - - /** Store new \ref Data. - * Write the new \ref Data to file, unless we know it - * did not change. The directory containing file must - * exist. - */ - void setData( const Data & data_r ) - { - if ( !_dataPtr ) - _dataPtr.reset( new Data ); - - if ( differs( *_dataPtr, data_r ) ) - { - store( _file, data_r ); - *_dataPtr = data_r; - } - } - - private: - /** Helper testing whether two \ref Data differ. */ - bool differs( const Data & lhs, const Data & rhs ) const - { - - if ( lhs.size() != rhs.size() ) - return true; - for_( it, lhs.begin(), lhs.end() ) - { - if ( rhs.find( *it ) == rhs.end() ) - return true; - } - return false; - } - /** Read \ref Data from \c file_r. */ - static void load( const Pathname & file_r, Data & data_r ); - /** Write \ref Data to \c file_r. */ - static void store( const Pathname & file_r, const Data & data_r ); - - private: - Pathname _file; - mutable scoped_ptr _dataPtr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates SolvIdentFile Stream output */ - std::ostream & operator<<( std::ostream & str, const SolvIdentFile & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_SOLVIDENTFILE_H diff --git a/libzypp/zypp/target/TargetCallbackReceiver.cc b/libzypp/zypp/target/TargetCallbackReceiver.cc deleted file mode 100644 index 2f53a4f..0000000 --- a/libzypp/zypp/target/TargetCallbackReceiver.cc +++ /dev/null @@ -1,194 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetCallbackReceiver.cc - * -*/ -#include - -#include "zypp/target/TargetCallbackReceiver.h" - -#include "zypp/target/rpm/RpmCallbacks.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - RpmInstallPackageReceiver::RpmInstallPackageReceiver (Resolvable::constPtr res) - : callback::ReceiveReport () - , _resolvable (res) - , _level( target::rpm::InstallResolvableReport::RPM ) - , _abort (false) - { - } - - RpmInstallPackageReceiver::~RpmInstallPackageReceiver () - { - } - - void RpmInstallPackageReceiver::reportbegin() - { - } - - void RpmInstallPackageReceiver::reportend() - { - } - - /** Start the operation */ - void RpmInstallPackageReceiver::start( const Pathname & name ) - { - _report->start( _resolvable ); - _abort = false; - } - - /** - * Inform about progress - * Return true on abort - */ - bool RpmInstallPackageReceiver::progress( unsigned percent ) - { - _abort = ! _report->progress( percent, _resolvable ); - return _abort; - } - - rpm::RpmInstallReport::Action - RpmInstallPackageReceiver::problem( Exception & excpt_r ) - { - rpm::InstallResolvableReport::Action user = - _report->problem( _resolvable - , rpm::InstallResolvableReport::INVALID - , excpt_r.asUserHistory() - , _level - ); - - switch (user) { - case rpm::InstallResolvableReport::RETRY: - return rpm::RpmInstallReport::RETRY; - case rpm::InstallResolvableReport::ABORT: - _abort = true; - return rpm::RpmInstallReport::ABORT; - case rpm::InstallResolvableReport::IGNORE: - return rpm::RpmInstallReport::IGNORE; - } - - return rpm::RpmInstallReport::problem( excpt_r ); - } - - void RpmInstallPackageReceiver::finishInfo( const std::string & info_r ) - { - _finishInfo = info_r; - } - - /** Finish operation in case of success */ - void RpmInstallPackageReceiver::finish() - { - _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, _finishInfo, _level ); - } - - /** Finish operation in case of success */ - void RpmInstallPackageReceiver::finish( Exception & excpt_r ) - { - _report->finish( _resolvable, rpm::InstallResolvableReport::INVALID, std::string(), _level ); - } - - void RpmInstallPackageReceiver::tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r ) - { - _level = level_r; - } - - - ///////////////////////////////////////////////////////////////// - /// RpmRemovePackageReceiver - ///////////////////////////////////////////////////////////////// - - RpmRemovePackageReceiver::RpmRemovePackageReceiver (Resolvable::constPtr res) - : callback::ReceiveReport () - , _resolvable (res) - , _abort(false) - { - } - - RpmRemovePackageReceiver::~RpmRemovePackageReceiver () - { - } - - void RpmRemovePackageReceiver::reportbegin() - { - } - - void RpmRemovePackageReceiver::reportend() - { - } - - /** Start the operation */ - void RpmRemovePackageReceiver::start( const std::string & name ) - { - _report->start( _resolvable ); - _abort = false; - } - - /** - * Inform about progress - * Return true on abort - */ - bool RpmRemovePackageReceiver::progress( unsigned percent ) - { - _abort = ! _report->progress( percent, _resolvable ); - return _abort; - } - - rpm::RpmRemoveReport::Action - RpmRemovePackageReceiver::problem( Exception & excpt_r ) - { - rpm::RemoveResolvableReport::Action user = - _report->problem( _resolvable - , rpm::RemoveResolvableReport::INVALID - , excpt_r.asUserHistory() - ); - - switch (user) { - case rpm::RemoveResolvableReport::RETRY: - return rpm::RpmRemoveReport::RETRY; - case rpm::RemoveResolvableReport::ABORT: - _abort = true; - return rpm::RpmRemoveReport::ABORT; - case rpm::RemoveResolvableReport::IGNORE: - return rpm::RpmRemoveReport::IGNORE; - } - - return rpm::RpmRemoveReport::problem( excpt_r ); - } - - void RpmRemovePackageReceiver::finishInfo( const std::string & info_r ) - { - _finishInfo = info_r; - } - - /** Finish operation in case of success */ - void RpmRemovePackageReceiver::finish() - { - _report->progress( 100, _resolvable ); - _report->finish( _resolvable, rpm::RemoveResolvableReport::NO_ERROR, _finishInfo ); - } - - /** Finish operation in case of success */ - void RpmRemovePackageReceiver::finish( Exception & excpt_r ) - { - _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/TargetCallbackReceiver.h b/libzypp/zypp/target/TargetCallbackReceiver.h deleted file mode 100644 index 8b435bc..0000000 --- a/libzypp/zypp/target/TargetCallbackReceiver.h +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetCallbackReceiver.h - * -*/ -#ifndef ZYPP_TARGET_TARGETCALLBACKRECEIVER_H -#define ZYPP_TARGET_TARGETCALLBACKRECEIVER_H - -#include "zypp/ZYppCallbacks.h" -#include "zypp/target/rpm/RpmCallbacks.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - class RpmInstallPackageReceiver - : public callback::ReceiveReport - { - callback::SendReport _report; - Resolvable::constPtr _resolvable; - target::rpm::InstallResolvableReport::RpmLevel _level; - bool _abort; - std::string _finishInfo; - - public: - - RpmInstallPackageReceiver (Resolvable::constPtr res); - virtual ~RpmInstallPackageReceiver (); - - virtual void reportbegin(); - - virtual void reportend(); - - /** Start the operation */ - virtual void start( const Pathname & name ); - - void tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r ); - - bool aborted() const { return _abort; } - - /** - * Inform about progress - * Return true on abort - */ - virtual bool progress( unsigned percent ); - - /** inform user about a problem */ - virtual rpm::RpmInstallReport::Action problem( Exception & excpt_r ); - - /** Additional rpm output to be reported in \ref finish in case of success. */ - virtual void finishInfo( const std::string & info_r ); - - /** Finish operation in case of success */ - virtual void finish(); - - /** Finish operatin in case of fail, report fail exception */ - virtual void finish( Exception & excpt_r ); - }; - - class RpmRemovePackageReceiver - : public callback::ReceiveReport - { - callback::SendReport _report; - Resolvable::constPtr _resolvable; - bool _abort; - std::string _finishInfo; - - public: - - RpmRemovePackageReceiver (Resolvable::constPtr res); - virtual ~RpmRemovePackageReceiver (); - - virtual void reportbegin(); - - virtual void reportend(); - - /** Start the operation */ - virtual void start( const std::string & name ); - - /** - * Inform about progress - * Return true on abort - */ - virtual bool progress( unsigned percent ); - - /** - * Returns true if removing is aborted during progress - */ - bool aborted() const { return _abort; } - - /** inform user about a problem */ - virtual rpm::RpmRemoveReport::Action problem( Exception & excpt_r ); - - /** Additional rpm output to be reported in \ref finish in case of success. */ - virtual void finishInfo( const std::string & info_r ); - - /** Finish operation in case of success */ - virtual void finish(); - - /** Finish operatin in case of fail, report fail exception */ - virtual void finish( Exception & excpt_r ); - }; - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_TARGETCALLBACKRECEIVER_H diff --git a/libzypp/zypp/target/TargetException.cc b/libzypp/zypp/target/TargetException.cc deleted file mode 100644 index 341da74..0000000 --- a/libzypp/zypp/target/TargetException.cc +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetException.cc - * -*/ - -#include -#include - -#include "zypp/target/TargetException.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - namespace target { - ///////////////////////////////////////////////////////////////// - - std::ostream & TargetAbortedException::dumpOn( std::ostream & str ) const - { - return str << "Installation aborted by user" << endl; - } - - - ///////////////////////////////////////////////////////////////// - } // namespace target -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/TargetException.h b/libzypp/zypp/target/TargetException.h deleted file mode 100644 index 39ec002..0000000 --- a/libzypp/zypp/target/TargetException.h +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetException.h - * -*/ -#ifndef ZYPP_TARGET_TARGETEXCEPTION_H -#define ZYPP_TARGET_TARGETEXCEPTION_H - -#include - -#include - -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - namespace target { - /////////////////////////////////////////////////////////////// - // - // CLASS NAME : TargetException - /** Just inherits Exception to separate target exceptions - * - **/ - class TargetException : public Exception - { - public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - TargetException() - : Exception( "Target Exception" ) - {} - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - TargetException( const std::string & msg_r ) - : Exception( msg_r ) - {} - /** Dtor. */ - virtual ~TargetException() throw() {}; - }; - - class TargetAbortedException : public TargetException - { - public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - TargetAbortedException( const std::string & msg_r ) - : TargetException( msg_r ) - {} - /** Dtor. */ - virtual ~TargetAbortedException() throw() {}; - protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; - private: - }; - - - ///////////////////////////////////////////////////////////////// - } // namespace target -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_TARGETEXCEPTION_H diff --git a/libzypp/zypp/target/TargetImpl.cc b/libzypp/zypp/target/TargetImpl.cc deleted file mode 100644 index 89506ed..0000000 --- a/libzypp/zypp/target/TargetImpl.cc +++ /dev/null @@ -1,1976 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetImpl.cc - * -*/ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Exception.h" -#include "zypp/base/Iterator.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/Functional.h" -#include "zypp/base/UserRequestException.h" -#include "zypp/base/Json.h" - -#include "zypp/ZConfig.h" -#include "zypp/ZYppFactory.h" - -#include "zypp/PoolItem.h" -#include "zypp/ResObjects.h" -#include "zypp/Url.h" -#include "zypp/TmpPath.h" -#include "zypp/RepoStatus.h" -#include "zypp/ExternalProgram.h" -#include "zypp/Repository.h" - -#include "zypp/ResFilters.h" -#include "zypp/HistoryLog.h" -#include "zypp/target/TargetImpl.h" -#include "zypp/target/TargetCallbackReceiver.h" -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/CommitPackageCache.h" -#include "zypp/target/RpmPostTransCollector.h" - -#include "zypp/parser/ProductFileReader.h" - -#include "zypp/solver/detail/Testcase.h" - -#include "zypp/repo/SrcPackageProvider.h" - -#include "zypp/sat/Pool.h" -#include "zypp/sat/Transaction.h" - -#include "zypp/PluginScript.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace json - { - // Lazy via template specialisation / should switch to overloading - - template<> - inline std::string toJSON( const ZYppCommitResult::TransactionStepList & steps_r ) - { - using sat::Transaction; - json::Array ret; - - for ( const Transaction::Step & step : steps_r ) - // ignore implicit deletes due to obsoletes and non-package actions - if ( step.stepType() != Transaction::TRANSACTION_IGNORE ) - ret.add( step ); - - return ret.asJSON(); - } - - /** See \ref commitbegin on page \ref plugin-commit for the specs. */ - template<> - inline std::string toJSON( const sat::Transaction::Step & step_r ) - { - static const std::string strType( "type" ); - static const std::string strStage( "stage" ); - static const std::string strSolvable( "solvable" ); - - static const std::string strTypeDel( "-" ); - static const std::string strTypeIns( "+" ); - static const std::string strTypeMul( "M" ); - - static const std::string strStageDone( "ok" ); - static const std::string strStageFailed( "err" ); - - static const std::string strSolvableN( "n" ); - static const std::string strSolvableE( "e" ); - static const std::string strSolvableV( "v" ); - static const std::string strSolvableR( "r" ); - static const std::string strSolvableA( "a" ); - - using sat::Transaction; - json::Object ret; - - switch ( step_r.stepType() ) - { - case Transaction::TRANSACTION_IGNORE: /*empty*/ break; - case Transaction::TRANSACTION_ERASE: ret.add( strType, strTypeDel ); break; - case Transaction::TRANSACTION_INSTALL: ret.add( strType, strTypeIns ); break; - case Transaction::TRANSACTION_MULTIINSTALL: ret.add( strType, strTypeMul ); break; - } - - switch ( step_r.stepStage() ) - { - case Transaction::STEP_TODO: /*empty*/ break; - case Transaction::STEP_DONE: ret.add( strStage, strStageDone ); break; - case Transaction::STEP_ERROR: ret.add( strStage, strStageFailed ); break; - } - - { - IdString ident; - Edition ed; - Arch arch; - if ( sat::Solvable solv = step_r.satSolvable() ) - { - ident = solv.ident(); - ed = solv.edition(); - arch = solv.arch(); - } - else - { - // deleted package; post mortem data stored in Transaction::Step - ident = step_r.ident(); - ed = step_r.edition(); - arch = step_r.arch(); - } - - json::Object s { - { strSolvableN, ident.asString() }, - { strSolvableV, ed.version() }, - { strSolvableR, ed.release() }, - { strSolvableA, arch.asString() } - }; - if ( Edition::epoch_t epoch = ed.epoch() ) - s.add( strSolvableE, epoch ); - - ret.add( strSolvable, s ); - } - - return ret.asJSON(); - } - } // namespace json - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace target - { - /////////////////////////////////////////////////////////////////// - namespace - { - SolvIdentFile::Data getUserInstalledFromHistory( const Pathname & historyFile_r ) - { - SolvIdentFile::Data onSystemByUserList; - // go and parse it: 'who' must constain an '@', then it was installed by user request. - // 2009-09-29 07:25:19|install|lirc-remotes|0.8.5-3.2|x86_64|root@opensuse|InstallationImage|a204211eb0... - std::ifstream infile( historyFile_r.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) - { - const char * ch( (*in).c_str() ); - // start with year - if ( *ch < '1' || '9' < *ch ) - continue; - const char * sep1 = ::strchr( ch, '|' ); // | after date - if ( !sep1 ) - continue; - ++sep1; - // if logs an install or delete - bool installs = true; - if ( ::strncmp( sep1, "install|", 8 ) ) - { - if ( ::strncmp( sep1, "remove |", 8 ) ) - continue; // no install and no remove - else - installs = false; // remove - } - sep1 += 8; // | after what - // get the package name - const char * sep2 = ::strchr( sep1, '|' ); // | after name - if ( !sep2 || sep1 == sep2 ) - continue; - (*in)[sep2-ch] = '\0'; - IdString pkg( sep1 ); - // we're done, if a delete - if ( !installs ) - { - onSystemByUserList.erase( pkg ); - continue; - } - // now guess whether user installed or not (3rd next field contains 'user@host') - if ( (sep1 = ::strchr( sep2+1, '|' )) // | after version - && (sep1 = ::strchr( sep1+1, '|' )) // | after arch - && (sep2 = ::strchr( sep1+1, '|' )) ) // | after who - { - (*in)[sep2-ch] = '\0'; - if ( ::strchr( sep1+1, '@' ) ) - { - // by user - onSystemByUserList.insert( pkg ); - continue; - } - } - } - MIL << "onSystemByUserList found: " << onSystemByUserList.size() << endl; - return onSystemByUserList; - } - } // namespace - /////////////////////////////////////////////////////////////////// - - /** Helper for commit plugin execution. - * \ingroup g_RAII - */ - class CommitPlugins : private base::NonCopyable - { - public: - /** Default ctor: Empty plugin list */ - CommitPlugins() - {} - - /** Dtor: Send PLUGINEND message and close plugins. */ - ~CommitPlugins() - { - if ( ! _scripts.empty() ) - send( PluginFrame( "PLUGINEND" ) ); - // ~PluginScript will disconnect all remaining plugins! - } - - /** Whether no plugins are waiting */ - bool empty() const - { return _scripts.empty(); } - - - /** Send \ref PluginFrame to all open plugins. - * Failed plugins are removed from the execution list. - */ - void send( const PluginFrame & frame_r ) - { - DBG << "+++++++++++++++ send " << frame_r << endl; - for ( auto it = _scripts.begin(); it != _scripts.end(); ) - { - doSend( *it, frame_r ); - if ( it->isOpen() ) - ++it; - else - it = _scripts.erase( it ); - } - DBG << "--------------- send " << frame_r << endl; - } - - /** Find and launch plugins sending PLUGINSTART message. - * - * If \a path_r is a directory all executable files whithin are - * expected to be plugins. Otherwise \a path_r must point to an - * executable plugin. - */ - void load( const Pathname & path_r ) - { - PathInfo pi( path_r ); - DBG << "+++++++++++++++ load " << pi << endl; - if ( pi.isDir() ) - { - std::list entries; - if ( filesystem::readdir( entries, pi.path(), false ) != 0 ) - { - WAR << "Plugin dir is not readable: " << pi << endl; - return; - } - for_( it, entries.begin(), entries.end() ) - { - PathInfo pii( *it ); - if ( pii.isFile() && pii.userMayRX() ) - doLoad( pii ); - } - } - else if ( pi.isFile() ) - { - if ( pi.userMayRX() ) - doLoad( pi ); - else - WAR << "Plugin file is not executable: " << pi << endl; - } - else - { - WAR << "Plugin path is neither dir nor file: " << pi << endl; - } - DBG << "--------------- load " << pi << endl; - } - - private: - /** Send \ref PluginFrame and expect valid answer (ACK|_ENOMETHOD). - * Upon invalid answer or error, close the plugin. and remove it from the - * execution list. - * \returns the received \ref PluginFrame (empty Frame upon Exception) - */ - PluginFrame doSend( PluginScript & script_r, const PluginFrame & frame_r ) - { - PluginFrame ret; - - try { - script_r.send( frame_r ); - ret = script_r.receive(); - } - catch( const zypp::Exception & e ) - { ZYPP_CAUGHT(e); } - - if ( ! ( ret.isAckCommand() || ret.isEnomethodCommand() ) ) - { - WAR << "Bad plugin response from " << script_r << endl; - WAR << dump(ret) << endl; - script_r.close(); - } - - return ret; - } - - /** Launch a plugin sending PLUGINSTART message. */ - void doLoad( const PathInfo & pi_r ) - { - MIL << "Load plugin: " << pi_r << endl; - try { - PluginScript plugin( pi_r.path() ); - plugin.open(); - - PluginFrame frame( "PLUGINBEGIN" ); - if ( ZConfig::instance().hasUserData() ) - frame.setHeader( "userdata", ZConfig::instance().userData() ); - - doSend( plugin, frame ); // closes on error - if ( plugin.isOpen() ) - _scripts.push_back( plugin ); - } - catch( const zypp::Exception & e ) - { - WAR << "Failed to load plugin " << pi_r << endl; - } - } - - private: - std::list _scripts; - }; - - void testCommitPlugins( const Pathname & path_r ) // for testing only - { - USR << "+++++" << endl; - { - CommitPlugins pl; - pl.load( path_r ); - USR << "=====" << endl; - } - USR << "-----" << endl; - } - - /////////////////////////////////////////////////////////////////// - namespace - { - inline PluginFrame transactionPluginFrame( const std::string & command_r, ZYppCommitResult::TransactionStepList & steps_r ) - { - return PluginFrame( command_r, json::Object { - { "TransactionStepList", steps_r } - }.asJSON() ); - } - } // namespace - /////////////////////////////////////////////////////////////////// - - /** \internal Manage writing a new testcase when doing an upgrade. */ - void writeUpgradeTestcase() - { - unsigned toKeep( ZConfig::instance().solver_upgradeTestcasesToKeep() ); - MIL << "Testcases to keep: " << toKeep << endl; - if ( !toKeep ) - return; - Target_Ptr target( getZYpp()->getTarget() ); - if ( ! target ) - { - WAR << "No Target no Testcase!" << endl; - return; - } - - std::string stem( "updateTestcase" ); - Pathname dir( target->assertRootPrefix("/var/log/") ); - Pathname next( dir / Date::now().form( stem+"-%Y-%m-%d-%H-%M-%S" ) ); - - { - std::list content; - filesystem::readdir( content, dir, /*dots*/false ); - std::set cases; - for_( c, content.begin(), content.end() ) - { - if ( str::startsWith( *c, stem ) ) - cases.insert( *c ); - } - if ( cases.size() >= toKeep ) - { - unsigned toDel = cases.size() - toKeep + 1; // +1 for the new one - for_( c, cases.begin(), cases.end() ) - { - filesystem::recursive_rmdir( dir/(*c) ); - if ( ! --toDel ) - break; - } - } - } - - MIL << "Write new testcase " << next << endl; - getZYpp()->resolver()->createSolverTestcase( next.asString(), false/*no solving*/ ); - } - - /////////////////////////////////////////////////////////////////// - namespace - { ///////////////////////////////////////////////////////////////// - - /** Execute script and report against report_r. - * Return \c std::pair to indicate if - * execution was successfull (first = true), or the desired - * \c PatchScriptReport::Action in case execution failed - * (first = false). - * - * \note The packager is responsible for setting the correct permissions - * of the script. If the script is not executable it is reported as an - * error. We must not modify the permessions. - */ - std::pair doExecuteScript( const Pathname & root_r, - const Pathname & script_r, - callback::SendReport & report_r ) - { - MIL << "Execute script " << PathInfo(Pathname::assertprefix( root_r,script_r)) << endl; - - HistoryLog historylog; - historylog.comment(script_r.asString() + _(" executed"), /*timestamp*/true); - ExternalProgram prog( script_r.asString(), ExternalProgram::Stderr_To_Stdout, false, -1, true, root_r ); - - for ( std::string output = prog.receiveLine(); output.length(); output = prog.receiveLine() ) - { - historylog.comment(output); - if ( ! report_r->progress( PatchScriptReport::OUTPUT, output ) ) - { - WAR << "User request to abort script " << script_r << endl; - prog.kill(); - // the rest is handled by exit code evaluation - // in case the script has meanwhile finished. - } - } - - std::pair ret( std::make_pair( false, PatchScriptReport::ABORT ) ); - - if ( prog.close() != 0 ) - { - ret.second = report_r->problem( prog.execError() ); - WAR << "ACTION" << ret.second << "(" << prog.execError() << ")" << endl; - std::ostringstream sstr; - sstr << script_r << _(" execution failed") << " (" << prog.execError() << ")" << endl; - historylog.comment(sstr.str(), /*timestamp*/true); - return ret; - } - - report_r->finish(); - ret.first = true; - return ret; - } - - /** Execute script and report against report_r. - * Return \c false if user requested \c ABORT. - */ - bool executeScript( const Pathname & root_r, - const Pathname & script_r, - callback::SendReport & report_r ) - { - std::pair action( std::make_pair( false, PatchScriptReport::ABORT ) ); - - do { - action = doExecuteScript( root_r, script_r, report_r ); - if ( action.first ) - return true; // success - - switch ( action.second ) - { - case PatchScriptReport::ABORT: - WAR << "User request to abort at script " << script_r << endl; - return false; // requested abort. - break; - - case PatchScriptReport::IGNORE: - WAR << "User request to skip script " << script_r << endl; - return true; // requested skip. - break; - - case PatchScriptReport::RETRY: - break; // again - } - } while ( action.second == PatchScriptReport::RETRY ); - - // THIS is not intended to be reached: - INT << "Abort on unknown ACTION request " << action.second << " returned" << endl; - return false; // abort. - } - - /** Look for update scripts named 'name-version-release-*' and - * execute them. Return \c false if \c ABORT was requested. - * - * \see http://en.opensuse.org/Software_Management/Code11/Scripts_and_Messages - */ - bool RunUpdateScripts( const Pathname & root_r, - const Pathname & scriptsPath_r, - const std::vector & checkPackages_r, - bool aborting_r ) - { - if ( checkPackages_r.empty() ) - return true; // no installed packages to check - - MIL << "Looking for new update scripts in (" << root_r << ")" << scriptsPath_r << endl; - Pathname scriptsDir( Pathname::assertprefix( root_r, scriptsPath_r ) ); - if ( ! PathInfo( scriptsDir ).isDir() ) - return true; // no script dir - - std::list scripts; - filesystem::readdir( scripts, scriptsDir, /*dots*/false ); - if ( scripts.empty() ) - return true; // no scripts in script dir - - // Now collect and execute all matching scripts. - // On ABORT: at least log all outstanding scripts. - // - "name-version-release" - // - "name-version-release-*" - bool abort = false; - std::map unify; // scripts - for_( it, checkPackages_r.begin(), checkPackages_r.end() ) - { - std::string prefix( str::form( "%s-%s", it->name().c_str(), it->edition().c_str() ) ); - for_( sit, scripts.begin(), scripts.end() ) - { - if ( ! str::hasPrefix( *sit, prefix ) ) - continue; - - if ( (*sit)[prefix.size()] != '\0' && (*sit)[prefix.size()] != '-' ) - continue; // if not exact match it had to continue with '-' - - PathInfo script( scriptsDir / *sit ); - Pathname localPath( scriptsPath_r/(*sit) ); // without root prefix - std::string unifytag; // must not stay empty - - if ( script.isFile() ) - { - // Assert it's set executable, unify by md5sum. - filesystem::addmod( script.path(), 0500 ); - unifytag = filesystem::md5sum( script.path() ); - } - else if ( ! script.isExist() ) - { - // Might be a dangling symlink, might be ok if we are in - // instsys (absolute symlink within the system below /mnt). - // readlink will tell.... - unifytag = filesystem::readlink( script.path() ).asString(); - } - - if ( unifytag.empty() ) - continue; - - // Unify scripts - if ( unify[unifytag].empty() ) - { - unify[unifytag] = localPath; - } - else - { - // translators: We may find the same script content in files with different names. - // Only the first occurence is executed, subsequent ones are skipped. It's a one-line - // message for a log file. Preferably start translation with "%s" - std::string msg( str::form(_("%s already executed as %s)"), localPath.asString().c_str(), unify[unifytag].c_str() ) ); - MIL << "Skip update script: " << msg << endl; - HistoryLog().comment( msg, /*timestamp*/true ); - continue; - } - - if ( abort || aborting_r ) - { - WAR << "Aborting: Skip update script " << *sit << endl; - HistoryLog().comment( - localPath.asString() + _(" execution skipped while aborting"), - /*timestamp*/true); - } - else - { - MIL << "Found update script " << *sit << endl; - callback::SendReport report; - report->start( make( *it ), script.path() ); - - if ( ! executeScript( root_r, localPath, report ) ) // script path without root prefix! - abort = true; // requested abort. - } - } - } - return !abort; - } - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// - - inline void copyTo( std::ostream & out_r, const Pathname & file_r ) - { - std::ifstream infile( file_r.c_str() ); - for( iostr::EachLine in( infile ); in; in.next() ) - { - out_r << *in << endl; - } - } - - inline std::string notificationCmdSubst( const std::string & cmd_r, const UpdateNotificationFile & notification_r ) - { - std::string ret( cmd_r ); -#define SUBST_IF(PAT,VAL) if ( ret.find( PAT ) != std::string::npos ) ret = str::gsub( ret, PAT, VAL ) - SUBST_IF( "%p", notification_r.solvable().asString() ); - SUBST_IF( "%P", notification_r.file().asString() ); -#undef SUBST_IF - return ret; - } - - void sendNotification( const Pathname & root_r, - const UpdateNotifications & notifications_r ) - { - if ( notifications_r.empty() ) - return; - - std::string cmdspec( ZConfig::instance().updateMessagesNotify() ); - MIL << "Notification command is '" << cmdspec << "'" << endl; - if ( cmdspec.empty() ) - return; - - std::string::size_type pos( cmdspec.find( '|' ) ); - if ( pos == std::string::npos ) - { - ERR << "Can't send Notification: Missing 'format |' in command spec." << endl; - HistoryLog().comment( str::Str() << _("Error sending update message notification."), /*timestamp*/true ); - return; - } - - std::string formatStr( str::toLower( str::trim( cmdspec.substr( 0, pos ) ) ) ); - std::string commandStr( str::trim( cmdspec.substr( pos + 1 ) ) ); - - enum Format { UNKNOWN, NONE, SINGLE, DIGEST, BULK }; - Format format = UNKNOWN; - if ( formatStr == "none" ) - format = NONE; - else if ( formatStr == "single" ) - format = SINGLE; - else if ( formatStr == "digest" ) - format = DIGEST; - else if ( formatStr == "bulk" ) - format = BULK; - else - { - ERR << "Can't send Notification: Unknown format '" << formatStr << " |' in command spec." << endl; - HistoryLog().comment( str::Str() << _("Error sending update message notification."), /*timestamp*/true ); - return; - } - - // Take care: commands are ececuted chroot(root_r). The message file - // pathnames in notifications_r are local to root_r. For physical access - // to the file they need to be prefixed. - - if ( format == NONE || format == SINGLE ) - { - for_( it, notifications_r.begin(), notifications_r.end() ) - { - std::vector command; - if ( format == SINGLE ) - command.push_back( "<"+Pathname::assertprefix( root_r, it->file() ).asString() ); - str::splitEscaped( notificationCmdSubst( commandStr, *it ), std::back_inserter( command ) ); - - ExternalProgram prog( command, ExternalProgram::Stderr_To_Stdout, false, -1, true, root_r ); - if ( true ) // Wait for feedback - { - for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() ) - { - DBG << line; - } - int ret = prog.close(); - if ( ret != 0 ) - { - ERR << "Notification command returned with error (" << ret << ")." << endl; - HistoryLog().comment( str::Str() << _("Error sending update message notification."), /*timestamp*/true ); - return; - } - } - } - } - else if ( format == DIGEST || format == BULK ) - { - filesystem::TmpFile tmpfile; - ofstream out( tmpfile.path().c_str() ); - for_( it, notifications_r.begin(), notifications_r.end() ) - { - if ( format == DIGEST ) - { - out << it->file() << endl; - } - else if ( format == BULK ) - { - copyTo( out << '\f', Pathname::assertprefix( root_r, it->file() ) ); - } - } - - std::vector command; - command.push_back( "<"+tmpfile.path().asString() ); // redirect input - str::splitEscaped( notificationCmdSubst( commandStr, *notifications_r.begin() ), std::back_inserter( command ) ); - - ExternalProgram prog( command, ExternalProgram::Stderr_To_Stdout, false, -1, true, root_r ); - if ( true ) // Wait for feedback otherwise the TmpFile goes out of scope. - { - for( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() ) - { - DBG << line; - } - int ret = prog.close(); - if ( ret != 0 ) - { - ERR << "Notification command returned with error (" << ret << ")." << endl; - HistoryLog().comment( str::Str() << _("Error sending update message notification."), /*timestamp*/true ); - return; - } - } - } - else - { - INT << "Can't send Notification: Missing handler for 'format |' in command spec." << endl; - HistoryLog().comment( str::Str() << _("Error sending update message notification."), /*timestamp*/true ); - return; - } - } - - - /** Look for update messages named 'name-version-release-*' and - * send notification according to \ref ZConfig::updateMessagesNotify. - * - * \see http://en.opensuse.org/Software_Management/Code11/Scripts_and_Messages - */ - void RunUpdateMessages( const Pathname & root_r, - const Pathname & messagesPath_r, - const std::vector & checkPackages_r, - ZYppCommitResult & result_r ) - { - if ( checkPackages_r.empty() ) - return; // no installed packages to check - - MIL << "Looking for new update messages in (" << root_r << ")" << messagesPath_r << endl; - Pathname messagesDir( Pathname::assertprefix( root_r, messagesPath_r ) ); - if ( ! PathInfo( messagesDir ).isDir() ) - return; // no messages dir - - std::list messages; - filesystem::readdir( messages, messagesDir, /*dots*/false ); - if ( messages.empty() ) - return; // no messages in message dir - - // Now collect all matching messages in result and send them - // - "name-version-release" - // - "name-version-release-*" - HistoryLog historylog; - for_( it, checkPackages_r.begin(), checkPackages_r.end() ) - { - std::string prefix( str::form( "%s-%s", it->name().c_str(), it->edition().c_str() ) ); - for_( sit, messages.begin(), messages.end() ) - { - if ( ! str::hasPrefix( *sit, prefix ) ) - continue; - - if ( (*sit)[prefix.size()] != '\0' && (*sit)[prefix.size()] != '-' ) - continue; // if not exact match it had to continue with '-' - - PathInfo message( messagesDir / *sit ); - if ( ! message.isFile() || message.size() == 0 ) - continue; - - MIL << "Found update message " << *sit << endl; - Pathname localPath( messagesPath_r/(*sit) ); // without root prefix - result_r.rUpdateMessages().push_back( UpdateNotificationFile( *it, localPath ) ); - historylog.comment( str::Str() << _("New update message") << " " << localPath, /*timestamp*/true ); - } - } - sendNotification( root_r, result_r.updateMessages() ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace - /////////////////////////////////////////////////////////////////// - - void XRunUpdateMessages( const Pathname & root_r, - const Pathname & messagesPath_r, - const std::vector & checkPackages_r, - ZYppCommitResult & result_r ) - { RunUpdateMessages( root_r, messagesPath_r, checkPackages_r, result_r ); } - - /////////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(TargetImpl); - - TargetImpl_Ptr TargetImpl::_nullimpl; - - /** Null implementation */ - TargetImpl_Ptr TargetImpl::nullimpl() - { - if (_nullimpl == 0) - _nullimpl = new TargetImpl; - return _nullimpl; - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TargetImpl::TargetImpl - // METHOD TYPE : Ctor - // - TargetImpl::TargetImpl( const Pathname & root_r, bool doRebuild_r ) - : _root( root_r ) - , _requestedLocalesFile( home() / "RequestedLocales" ) - , _autoInstalledFile( home() / "AutoInstalled" ) - , _hardLocksFile( Pathname::assertprefix( _root, ZConfig::instance().locksFile() ) ) - { - _rpm.initDatabase( root_r, Pathname(), doRebuild_r ); - - HistoryLog::setRoot(_root); - - createAnonymousId(); - - MIL << "Initialized target on " << _root << endl; - } - - /** - * generates a random id using uuidgen - */ - static std::string generateRandomId() - { - std::ifstream uuidprovider( "/proc/sys/kernel/random/uuid" ); - return iostr::getline( uuidprovider ); - } - - /** - * updates the content of \p filename - * if \p condition is true, setting the content - * the the value returned by \p value - */ - void updateFileContent( const Pathname &filename, - boost::function condition, - boost::function value ) - { - string val = value(); - // if the value is empty, then just dont - // do anything, regardless of the condition - if ( val.empty() ) - return; - - if ( condition() ) - { - MIL << "updating '" << filename << "' content." << endl; - - // if the file does not exist we need to generate the uuid file - - std::ofstream filestr; - // make sure the path exists - filesystem::assert_dir( filename.dirname() ); - filestr.open( filename.c_str() ); - - if ( filestr.good() ) - { - filestr << val; - filestr.close(); - } - else - { - // FIXME, should we ignore the error? - ZYPP_THROW(Exception("Can't openfile '" + filename.asString() + "' for writing")); - } - } - } - - /** helper functor */ - static bool fileMissing( const Pathname &pathname ) - { - return ! PathInfo(pathname).isExist(); - } - - void TargetImpl::createAnonymousId() const - { - - // create the anonymous unique id - // this value is used for statistics - Pathname idpath( home() / "AnonymousUniqueId"); - - try - { - updateFileContent( idpath, - boost::bind(fileMissing, idpath), - generateRandomId ); - } - catch ( const Exception &e ) - { - WAR << "Can't create anonymous id file" << endl; - } - - } - - void TargetImpl::createLastDistributionFlavorCache() const - { - // create the anonymous unique id - // this value is used for statistics - Pathname flavorpath( home() / "LastDistributionFlavor"); - - // is there a product - Product::constPtr p = baseProduct(); - if ( ! p ) - { - WAR << "No base product, I won't create flavor cache" << endl; - return; - } - - string flavor = p->flavor(); - - try - { - - updateFileContent( flavorpath, - // only if flavor is not empty - functor::Constant( ! flavor.empty() ), - functor::Constant(flavor) ); - } - catch ( const Exception &e ) - { - WAR << "Can't create flavor cache" << endl; - return; - } - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : TargetImpl::~TargetImpl - // METHOD TYPE : Dtor - // - TargetImpl::~TargetImpl() - { - _rpm.closeDatabase(); - MIL << "Targets closed" << endl; - } - - /////////////////////////////////////////////////////////////////// - // - // solv file handling - // - /////////////////////////////////////////////////////////////////// - - Pathname TargetImpl::defaultSolvfilesPath() const - { - return Pathname::assertprefix( _root, ZConfig::instance().repoSolvfilesPath() / sat::Pool::instance().systemRepoAlias() ); - } - - void TargetImpl::clearCache() - { - Pathname base = solvfilesPath(); - filesystem::recursive_rmdir( base ); - } - - bool TargetImpl::buildCache() - { - Pathname base = solvfilesPath(); - Pathname rpmsolv = base/"solv"; - Pathname rpmsolvcookie = base/"cookie"; - - bool build_rpm_solv = true; - // lets see if the rpm solv cache exists - - RepoStatus rpmstatus( RepoStatus(_root/"var/lib/rpm/Name") && RepoStatus(_root/"etc/products.d") ); - - bool solvexisted = PathInfo(rpmsolv).isExist(); - if ( solvexisted ) - { - // see the status of the cache - PathInfo cookie( rpmsolvcookie ); - MIL << "Read cookie: " << cookie << endl; - if ( cookie.isExist() ) - { - RepoStatus status = RepoStatus::fromCookieFile(rpmsolvcookie); - // now compare it with the rpm database - if ( status == rpmstatus ) - build_rpm_solv = false; - MIL << "Read cookie: " << rpmsolvcookie << " says: " - << (build_rpm_solv ? "outdated" : "uptodate") << endl; - } - } - - if ( build_rpm_solv ) - { - // if the solvfile dir does not exist yet, we better create it - filesystem::assert_dir( base ); - - Pathname oldSolvFile( solvexisted ? rpmsolv : Pathname() ); // to speedup rpmdb2solv - - filesystem::TmpFile tmpsolv( filesystem::TmpFile::makeSibling( rpmsolv ) ); - if ( !tmpsolv ) - { - // Can't create temporary solv file, usually due to insufficient permission - // (user query while @System solv needs refresh). If so, try switching - // to a location within zypps temp. space (will be cleaned at application end). - - bool switchingToTmpSolvfile = false; - Exception ex("Failed to cache rpm database."); - ex.remember(str::form("Cannot create temporary file under %s.", base.c_str())); - - if ( ! solvfilesPathIsTemp() ) - { - base = getZYpp()->tmpPath() / sat::Pool::instance().systemRepoAlias(); - rpmsolv = base/"solv"; - rpmsolvcookie = base/"cookie"; - - filesystem::assert_dir( base ); - tmpsolv = filesystem::TmpFile::makeSibling( rpmsolv ); - - if ( tmpsolv ) - { - WAR << "Using a temporary solv file at " << base << endl; - switchingToTmpSolvfile = true; - _tmpSolvfilesPath = base; - } - else - { - ex.remember(str::form("Cannot create temporary file under %s.", base.c_str())); - } - } - - if ( ! switchingToTmpSolvfile ) - { - ZYPP_THROW(ex); - } - } - - // Take care we unlink the solvfile on exception - ManagedFile guard( base, filesystem::recursive_rmdir ); - - std::ostringstream cmd; - cmd << "rpmdb2solv"; - if ( ! _root.empty() ) - cmd << " -r '" << _root << "'"; - cmd << " -X"; // autogenerate pattern/product/... from -package - cmd << " -A"; // autogenerate application pseudo packages - cmd << " -p '" << Pathname::assertprefix( _root, "/etc/products.d" ) << "'"; - - if ( ! oldSolvFile.empty() ) - cmd << " '" << oldSolvFile << "'"; - - cmd << " > '" << tmpsolv.path() << "'"; - - MIL << "Executing: " << cmd << endl; - ExternalProgram prog( cmd.str(), ExternalProgram::Stderr_To_Stdout ); - - cmd << endl; - for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) { - WAR << " " << output; - cmd << " " << output; - } - - int ret = prog.close(); - if ( ret != 0 ) - { - Exception ex(str::form("Failed to cache rpm database (%d).", ret)); - ex.remember( cmd.str() ); - ZYPP_THROW(ex); - } - - ret = filesystem::rename( tmpsolv, rpmsolv ); - if ( ret != 0 ) - ZYPP_THROW(Exception("Failed to move cache to final destination")); - // if this fails, don't bother throwing exceptions - filesystem::chmod( rpmsolv, 0644 ); - - rpmstatus.saveToCookieFile(rpmsolvcookie); - - // We keep it. - guard.resetDispose(); - - // Finally send notification to plugins - // NOTE: quick hack looking for spacewalk plugin only - { - Pathname script( Pathname::assertprefix( _root, ZConfig::instance().pluginsPath()/"system/spacewalk" ) ); - if ( PathInfo( script ).isX() ) - try { - PluginScript spacewalk( script ); - spacewalk.open(); - - PluginFrame notify( "PACKAGESETCHANGED" ); - spacewalk.send( notify ); - - PluginFrame ret( spacewalk.receive() ); - MIL << ret << endl; - if ( ret.command() == "ERROR" ) - ret.writeTo( WAR ) << endl; - } - catch ( const Exception & excpt ) - { - WAR << excpt.asUserHistory() << endl; - } - } - } - return build_rpm_solv; - } - - void TargetImpl::reload() - { - load( false ); - } - - void TargetImpl::unload() - { - Repository system( sat::Pool::instance().findSystemRepo() ); - if ( system ) - system.eraseFromPool(); - } - - void TargetImpl::load( bool force ) - { - bool newCache = buildCache(); - MIL << "New cache built: " << (newCache?"true":"false") << - ", force loading: " << (force?"true":"false") << endl; - - // now add the repos to the pool - sat::Pool satpool( sat::Pool::instance() ); - Pathname rpmsolv( solvfilesPath() / "solv" ); - MIL << "adding " << rpmsolv << " to pool(" << satpool.systemRepoAlias() << ")" << endl; - - // Providing an empty system repo, unload any old content - Repository system( sat::Pool::instance().findSystemRepo() ); - - if ( system && ! system.solvablesEmpty() ) - { - if ( newCache || force ) - { - system.eraseFromPool(); // invalidates system - } - else - { - return; // nothing to do - } - } - - if ( ! system ) - { - system = satpool.systemRepo(); - } - - try - { - MIL << "adding " << rpmsolv << " to system" << endl; - system.addSolv( rpmsolv ); - } - catch ( const Exception & exp ) - { - ZYPP_CAUGHT( exp ); - MIL << "Try to handle exception by rebuilding the solv-file" << endl; - clearCache(); - buildCache(); - - system.addSolv( rpmsolv ); - } - sat::Pool::instance().rootDir( _root ); - - // (Re)Load the requested locales et al. - // If the requested locales are empty, we leave the pool untouched - // to avoid undoing changes the application applied. We expect this - // to happen on a bare metal installation only. An already existing - // target should be loaded before its settings are changed. - { - const LocaleSet & requestedLocales( _requestedLocalesFile.locales() ); - if ( ! requestedLocales.empty() ) - { - satpool.setRequestedLocales( requestedLocales ); - } - } - { - if ( ! PathInfo( _autoInstalledFile.file() ).isExist() ) - { - // Initialize from history, if it does not exist - Pathname historyFile( Pathname::assertprefix( _root, ZConfig::instance().historyLogFile() ) ); - if ( PathInfo( historyFile ).isExist() ) - { - SolvIdentFile::Data onSystemByUser( getUserInstalledFromHistory( historyFile ) ); - SolvIdentFile::Data onSystemByAuto; - for_( it, system.solvablesBegin(), system.solvablesEnd() ) - { - IdString ident( (*it).ident() ); - if ( onSystemByUser.find( ident ) == onSystemByUser.end() ) - onSystemByAuto.insert( ident ); - } - _autoInstalledFile.setData( onSystemByAuto ); - } - // on the fly removed any obsolete SoftLocks file - filesystem::unlink( home() / "SoftLocks" ); - } - // read from AutoInstalled file - sat::StringQueue q; - for ( const auto & idstr : _autoInstalledFile.data() ) - q.push( idstr.id() ); - satpool.setAutoInstalled( q ); - } - if ( ZConfig::instance().apply_locks_file() ) - { - const HardLocksFile::Data & hardLocks( _hardLocksFile.data() ); - if ( ! hardLocks.empty() ) - { - ResPool::instance().setHardLockQueries( hardLocks ); - } - } - - // now that the target is loaded, we can cache the flavor - createLastDistributionFlavorCache(); - - MIL << "Target loaded: " << system.solvablesSize() << " resolvables" << endl; - } - - /////////////////////////////////////////////////////////////////// - // - // COMMIT - // - /////////////////////////////////////////////////////////////////// - ZYppCommitResult TargetImpl::commit( ResPool pool_r, const ZYppCommitPolicy & policy_rX ) - { - // ----------------------------------------------------------------- // - ZYppCommitPolicy policy_r( policy_rX ); - - // Fake outstanding YCP fix: Honour restriction to media 1 - // at installation, but install all remaining packages if post-boot. - if ( policy_r.restrictToMedia() > 1 ) - policy_r.allMedia(); - - if ( policy_r.downloadMode() == DownloadDefault ) { - if ( root() == "/" ) - policy_r.downloadMode(DownloadInHeaps); - else - policy_r.downloadMode(DownloadAsNeeded); - } - // DownloadOnly implies dry-run. - else if ( policy_r.downloadMode() == DownloadOnly ) - policy_r.dryRun( true ); - // ----------------------------------------------------------------- // - - MIL << "TargetImpl::commit(, " << policy_r << ")" << endl; - - /////////////////////////////////////////////////////////////////// - // Compute transaction: - /////////////////////////////////////////////////////////////////// - ZYppCommitResult result( root() ); - result.rTransaction() = pool_r.resolver().getTransaction(); - result.rTransaction().order(); - // steps: this is our todo-list - ZYppCommitResult::TransactionStepList & steps( result.rTransactionStepList() ); - if ( policy_r.restrictToMedia() ) - { - // Collect until the 1st package from an unwanted media occurs. - // Further collection could violate install order. - MIL << "Restrict to media number " << policy_r.restrictToMedia() << endl; - for_( it, result.transaction().begin(), result.transaction().end() ) - { - if ( makeResObject( *it )->mediaNr() > 1 ) - break; - steps.push_back( *it ); - } - } - else - { - result.rTransactionStepList().insert( steps.end(), result.transaction().begin(), result.transaction().end() ); - } - MIL << "Todo: " << result << endl; - - /////////////////////////////////////////////////////////////////// - // Prepare execution of commit plugins: - /////////////////////////////////////////////////////////////////// - CommitPlugins commitPlugins; - if ( root() == "/" && ! policy_r.dryRun() ) - { - Pathname plugindir( Pathname::assertprefix( _root, ZConfig::instance().pluginsPath()/"commit" ) ); - commitPlugins.load( plugindir ); - } - if ( ! commitPlugins.empty() ) - commitPlugins.send( transactionPluginFrame( "COMMITBEGIN", steps ) ); - - /////////////////////////////////////////////////////////////////// - // Write out a testcase if we're in dist upgrade mode. - /////////////////////////////////////////////////////////////////// - if ( getZYpp()->resolver()->upgradeMode() ) - { - if ( ! policy_r.dryRun() ) - { - writeUpgradeTestcase(); - } - else - { - DBG << "dryRun: Not writing upgrade testcase." << endl; - } - } - - /////////////////////////////////////////////////////////////////// - // Store non-package data: - /////////////////////////////////////////////////////////////////// - if ( ! policy_r.dryRun() ) - { - filesystem::assert_dir( home() ); - // requested locales - _requestedLocalesFile.setLocales( pool_r.getRequestedLocales() ); - // autoinstalled - { - SolvIdentFile::Data newdata; - for ( sat::Queue::value_type id : result.rTransaction().autoInstalled() ) - newdata.insert( IdString(id) ); - _autoInstalledFile.setData( newdata ); - } - // hard locks - if ( ZConfig::instance().apply_locks_file() ) - { - HardLocksFile::Data newdata; - pool_r.getHardLockQueries( newdata ); - _hardLocksFile.setData( newdata ); - } - } - else - { - DBG << "dryRun: Not stroring non-package data." << endl; - } - - /////////////////////////////////////////////////////////////////// - // First collect and display all messages - // associated with patches to be installed. - /////////////////////////////////////////////////////////////////// - if ( ! policy_r.dryRun() ) - { - for_( it, steps.begin(), steps.end() ) - { - if ( ! it->satSolvable().isKind() ) - continue; - - PoolItem pi( *it ); - if ( ! pi.status().isToBeInstalled() ) - continue; - - Patch::constPtr patch( asKind(pi.resolvable()) ); - if ( ! patch ||patch->message().empty() ) - continue; - - MIL << "Show message for " << patch << endl; - callback::SendReport report; - if ( ! report->show( patch ) ) - { - WAR << "commit aborted by the user" << endl; - ZYPP_THROW( TargetAbortedException( N_("Installation has been aborted as directed.") ) ); - } - } - } - else - { - DBG << "dryRun: Not checking patch messages." << endl; - } - - /////////////////////////////////////////////////////////////////// - // Remove/install packages. - /////////////////////////////////////////////////////////////////// - DBG << "commit log file is set to: " << HistoryLog::fname() << endl; - if ( ! policy_r.dryRun() || policy_r.downloadMode() == DownloadOnly ) - { - // Prepare the package cache. Pass all items requiring download. - CommitPackageCache packageCache( root() ); - packageCache.setCommitList( steps.begin(), steps.end() ); - - bool miss = false; - if ( policy_r.downloadMode() != DownloadAsNeeded ) - { - // Preload the cache. Until now this means pre-loading all packages. - // Once DownloadInHeaps is fully implemented, this will change and - // we may actually have more than one heap. - for_( it, steps.begin(), steps.end() ) - { - switch ( it->stepType() ) - { - case sat::Transaction::TRANSACTION_INSTALL: - case sat::Transaction::TRANSACTION_MULTIINSTALL: - // proceed: only install actionas may require download. - break; - - default: - // next: no download for or non-packages and delete actions. - continue; - break; - } - - PoolItem pi( *it ); - if ( pi->isKind() || pi->isKind() ) - { - ManagedFile localfile; - try - { - // TODO: unify packageCache.get for Package and SrcPackage - if ( pi->isKind() ) - { - localfile = packageCache.get( pi ); - } - else if ( pi->isKind() ) - { - repo::RepoMediaAccess access; - repo::SrcPackageProvider prov( access ); - localfile = prov.provideSrcPackage( pi->asKind() ); - } - else - { - INT << "Don't know howto cache: Neither Package nor SrcPackage: " << pi << endl; - continue; - } - localfile.resetDispose(); // keep the package file in the cache - } - catch ( const AbortRequestException & exp ) - { - it->stepStage( sat::Transaction::STEP_ERROR ); - miss = true; - WAR << "commit cache preload aborted by the user" << endl; - ZYPP_THROW( TargetAbortedException( N_("Installation has been aborted as directed.") ) ); - break; - } - catch ( const SkipRequestException & exp ) - { - ZYPP_CAUGHT( exp ); - it->stepStage( sat::Transaction::STEP_ERROR ); - miss = true; - WAR << "Skipping cache preload package " << pi->asKind() << " in commit" << endl; - continue; - } - catch ( const Exception & exp ) - { - // bnc #395704: missing catch causes abort. - // TODO see if packageCache fails to handle errors correctly. - ZYPP_CAUGHT( exp ); - it->stepStage( sat::Transaction::STEP_ERROR ); - miss = true; - INT << "Unexpected Error: Skipping cache preload package " << pi->asKind() << " in commit" << endl; - continue; - } - } - } - packageCache.preloaded( true ); // try to avoid duplicate infoInCache CBs in commit - } - - if ( miss ) - { - ERR << "Some packages could not be provided. Aborting commit."<< endl; - } - else - { - if ( ! policy_r.dryRun() ) - { - // if cache is preloaded, check for file conflicts - commitFindFileConflicts( policy_r, result ); - commit( policy_r, packageCache, result ); - } - else - { - DBG << "dryRun/downloadOnly: Not installing/deleting anything." << endl; - } - } - } - else - { - DBG << "dryRun: Not downloading/installing/deleting anything." << endl; - } - - /////////////////////////////////////////////////////////////////// - // Send result to commit plugins: - /////////////////////////////////////////////////////////////////// - if ( ! commitPlugins.empty() ) - commitPlugins.send( transactionPluginFrame( "COMMITEND", steps ) ); - - /////////////////////////////////////////////////////////////////// - // Try to rebuild solv file while rpm database is still in cache - /////////////////////////////////////////////////////////////////// - if ( ! policy_r.dryRun() ) - { - buildCache(); - } - - MIL << "TargetImpl::commit(, " << policy_r << ") returns: " << result << endl; - return result; - } - - /////////////////////////////////////////////////////////////////// - // - // COMMIT internal - // - /////////////////////////////////////////////////////////////////// - void TargetImpl::commit( const ZYppCommitPolicy & policy_r, - CommitPackageCache & packageCache_r, - ZYppCommitResult & result_r ) - { - // steps: this is our todo-list - ZYppCommitResult::TransactionStepList & steps( result_r.rTransactionStepList() ); - MIL << "TargetImpl::commit(" << policy_r << ")" << steps.size() << endl; - - bool abort = false; - RpmPostTransCollector postTransCollector( _root ); - std::vector successfullyInstalledPackages; - TargetImpl::PoolItemList remaining; - - for_( step, steps.begin(), steps.end() ) - { - PoolItem citem( *step ); - if ( step->stepType() == sat::Transaction::TRANSACTION_IGNORE ) - { - if ( citem->isKind() ) - { - // for packages this means being obsoleted (by rpm) - // thius no additional action is needed. - step->stepStage( sat::Transaction::STEP_DONE ); - continue; - } - } - - if ( citem->isKind() ) - { - Package::constPtr p = citem->asKind(); - if ( citem.status().isToBeInstalled() ) - { - ManagedFile localfile; - try - { - localfile = packageCache_r.get( citem ); - } - catch ( const AbortRequestException &e ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - step->stepStage( sat::Transaction::STEP_ERROR ); - break; - } - catch ( const SkipRequestException &e ) - { - ZYPP_CAUGHT( e ); - WAR << "Skipping package " << p << " in commit" << endl; - step->stepStage( sat::Transaction::STEP_ERROR ); - continue; - } - catch ( const Exception &e ) - { - // bnc #395704: missing catch causes abort. - // TODO see if packageCache fails to handle errors correctly. - ZYPP_CAUGHT( e ); - INT << "Unexpected Error: Skipping package " << p << " in commit" << endl; - step->stepStage( sat::Transaction::STEP_ERROR ); - continue; - } - -#warning Exception handling - // create a installation progress report proxy - RpmInstallPackageReceiver progress( citem.resolvable() ); - progress.connect(); // disconnected on destruction. - - bool success = false; - rpm::RpmInstFlags flags( policy_r.rpmInstFlags() & rpm::RPMINST_JUSTDB ); - // Why force and nodeps? - // - // Because zypp builds the transaction and the resolver asserts that - // everything is fine. - // We use rpm just to unpack and register the package in the database. - // We do this step by step, so rpm is not aware of the bigger context. - // So we turn off rpms internal checks, because we do it inside zypp. - flags |= rpm::RPMINST_NODEPS; - flags |= rpm::RPMINST_FORCE; - // - if (p->multiversionInstall()) flags |= rpm::RPMINST_NOUPGRADE; - if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST; - if (policy_r.rpmExcludeDocs()) flags |= rpm::RPMINST_EXCLUDEDOCS; - if (policy_r.rpmNoSignature()) flags |= rpm::RPMINST_NOSIGNATURE; - - try - { - progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE ); - if ( postTransCollector.collectScriptFromPackage( localfile ) ) - flags |= rpm::RPMINST_NOPOSTTRANS; - rpm().installPackage( localfile, flags ); - HistoryLog().install(citem); - - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - localfile.resetDispose(); // keep the package file in the cache - abort = true; - step->stepStage( sat::Transaction::STEP_ERROR ); - break; - } - else - { - success = true; - step->stepStage( sat::Transaction::STEP_DONE ); - } - } - catch ( Exception & excpt_r ) - { - ZYPP_CAUGHT(excpt_r); - localfile.resetDispose(); // keep the package file in the cache - - if ( policy_r.dryRun() ) - { - WAR << "dry run failed" << endl; - step->stepStage( sat::Transaction::STEP_ERROR ); - break; - } - // else - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - } - else - { - WAR << "Install failed" << endl; - } - step->stepStage( sat::Transaction::STEP_ERROR ); - break; // stop - } - - if ( success && !policy_r.dryRun() ) - { - citem.status().resetTransact( ResStatus::USER ); - successfullyInstalledPackages.push_back( citem.satSolvable() ); - step->stepStage( sat::Transaction::STEP_DONE ); - } - } - else - { - RpmRemovePackageReceiver progress( citem.resolvable() ); - progress.connect(); // disconnected on destruction. - - bool success = false; - rpm::RpmInstFlags flags( policy_r.rpmInstFlags() & rpm::RPMINST_JUSTDB ); - flags |= rpm::RPMINST_NODEPS; - if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST; - try - { - rpm().removePackage( p, flags ); - HistoryLog().remove(citem); - - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - step->stepStage( sat::Transaction::STEP_ERROR ); - break; - } - else - { - success = true; - step->stepStage( sat::Transaction::STEP_DONE ); - } - } - catch (Exception & excpt_r) - { - ZYPP_CAUGHT( excpt_r ); - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - step->stepStage( sat::Transaction::STEP_ERROR ); - break; - } - // else - WAR << "removal of " << p << " failed"; - step->stepStage( sat::Transaction::STEP_ERROR ); - } - if ( success && !policy_r.dryRun() ) - { - citem.status().resetTransact( ResStatus::USER ); - step->stepStage( sat::Transaction::STEP_DONE ); - } - } - } - else if ( ! policy_r.dryRun() ) // other resolvables (non-Package) - { - // Status is changed as the buddy package buddy - // gets installed/deleted. Handle non-buddies only. - if ( ! citem.buddy() ) - { - if ( citem->isKind() ) - { - Product::constPtr p = citem->asKind(); - if ( citem.status().isToBeInstalled() ) - { - ERR << "Can't install orphan product without release-package! " << citem << endl; - } - else - { - // Deleting the corresponding product entry is all we con do. - // So the product will no longer be visible as installed. - std::string referenceFilename( p->referenceFilename() ); - if ( referenceFilename.empty() ) - { - ERR << "Can't remove orphan product without 'referenceFilename'! " << citem << endl; - } - else - { - PathInfo referenceFile( Pathname::assertprefix( _root, Pathname( "/etc/products.d" ) ) / referenceFilename ); - if ( ! referenceFile.isFile() || filesystem::unlink( referenceFile.path() ) != 0 ) - { - ERR << "Delete orphan product failed: " << referenceFile << endl; - } - } - } - } - else if ( citem->isKind() && citem.status().isToBeInstalled() ) - { - // SrcPackage is install-only - SrcPackage::constPtr p = citem->asKind(); - installSrcPackage( p ); - } - - citem.status().resetTransact( ResStatus::USER ); - step->stepStage( sat::Transaction::STEP_DONE ); - } - - } // other resolvables - - } // for - - // process all remembered posttrans scripts. - if ( !abort ) - postTransCollector.executeScripts(); - else - postTransCollector.discardScripts(); - - // Check presence of update scripts/messages. If aborting, - // at least log omitted scripts. - if ( ! successfullyInstalledPackages.empty() ) - { - if ( ! RunUpdateScripts( _root, ZConfig::instance().update_scriptsPath(), - successfullyInstalledPackages, abort ) ) - { - WAR << "Commit aborted by the user" << endl; - abort = true; - } - // send messages after scripts in case some script generates output, - // that should be kept in t %ghost message file. - RunUpdateMessages( _root, ZConfig::instance().update_messagesPath(), - successfullyInstalledPackages, - result_r ); - } - - if ( abort ) - { - ZYPP_THROW( TargetAbortedException( N_("Installation has been aborted as directed.") ) ); - } - } - - /////////////////////////////////////////////////////////////////// - - rpm::RpmDb & TargetImpl::rpm() - { - return _rpm; - } - - bool TargetImpl::providesFile (const std::string & path_str, const std::string & name_str) const - { - return _rpm.hasFile(path_str, name_str); - } - - - Date TargetImpl::timestamp() const - { - return _rpm.timestamp(); - } - - /////////////////////////////////////////////////////////////////// - namespace - { - parser::ProductFileData baseproductdata( const Pathname & root_r ) - { - parser::ProductFileData ret; - PathInfo baseproduct( Pathname::assertprefix( root_r, "/etc/products.d/baseproduct" ) ); - - if ( baseproduct.isFile() ) - { - try - { - ret = parser::ProductFileReader::scanFile( baseproduct.path() ); - } - catch ( const Exception & excpt ) - { - ZYPP_CAUGHT( excpt ); - } - } - else if ( PathInfo( Pathname::assertprefix( root_r, "/etc/products.d" ) ).isDir() ) - { - ERR << "baseproduct symlink is dangling or missing: " << baseproduct << endl; - } - return ret; - } - - inline Pathname staticGuessRoot( const Pathname & root_r ) - { - if ( root_r.empty() ) - { - // empty root: use existing Target or assume "/" - Pathname ret ( ZConfig::instance().systemRoot() ); - if ( ret.empty() ) - return Pathname("/"); - return ret; - } - return root_r; - } - - inline std::string firstNonEmptyLineIn( const Pathname & file_r ) - { - std::ifstream idfile( file_r.c_str() ); - for( iostr::EachLine in( idfile ); in; in.next() ) - { - std::string line( str::trim( *in ) ); - if ( ! line.empty() ) - return line; - } - return std::string(); - } - } // namescpace - /////////////////////////////////////////////////////////////////// - - Product::constPtr TargetImpl::baseProduct() const - { - ResPool pool(ResPool::instance()); - for_( it, pool.byKindBegin(), pool.byKindEnd() ) - { - Product::constPtr p = (*it)->asKind(); - if ( p->isTargetDistribution() ) - return p; - } - return nullptr; - } - - LocaleSet TargetImpl::requestedLocales( const Pathname & root_r ) - { - const Pathname needroot( staticGuessRoot(root_r) ); - const Target_constPtr target( getZYpp()->getTarget() ); - if ( target && target->root() == needroot ) - return target->requestedLocales(); - return RequestedLocalesFile( home(needroot) / "RequestedLocales" ).locales(); - } - - std::string TargetImpl::targetDistribution() const - { return baseproductdata( _root ).registerTarget(); } - // static version: - std::string TargetImpl::targetDistribution( const Pathname & root_r ) - { return baseproductdata( staticGuessRoot(root_r) ).registerTarget(); } - - std::string TargetImpl::targetDistributionRelease() const - { return baseproductdata( _root ).registerRelease(); } - // static version: - std::string TargetImpl::targetDistributionRelease( const Pathname & root_r ) - { return baseproductdata( staticGuessRoot(root_r) ).registerRelease();} - - std::string TargetImpl::targetDistributionFlavor() const - { return baseproductdata( _root ).registerFlavor(); } - // static version: - std::string TargetImpl::targetDistributionFlavor( const Pathname & root_r ) - { return baseproductdata( staticGuessRoot(root_r) ).registerFlavor();} - - Target::DistributionLabel TargetImpl::distributionLabel() const - { - Target::DistributionLabel ret; - parser::ProductFileData pdata( baseproductdata( _root ) ); - ret.shortName = pdata.shortName(); - ret.summary = pdata.summary(); - return ret; - } - // static version: - Target::DistributionLabel TargetImpl::distributionLabel( const Pathname & root_r ) - { - Target::DistributionLabel ret; - parser::ProductFileData pdata( baseproductdata( staticGuessRoot(root_r) ) ); - ret.shortName = pdata.shortName(); - ret.summary = pdata.summary(); - return ret; - } - - std::string TargetImpl::distributionVersion() const - { - if ( _distributionVersion.empty() ) - { - _distributionVersion = TargetImpl::distributionVersion(root()); - if ( !_distributionVersion.empty() ) - MIL << "Remember distributionVersion = '" << _distributionVersion << "'" << endl; - } - return _distributionVersion; - } - // static version - std::string TargetImpl::distributionVersion( const Pathname & root_r ) - { - std::string distributionVersion = baseproductdata( staticGuessRoot(root_r) ).edition().version(); - if ( distributionVersion.empty() ) - { - // ...But the baseproduct method is not expected to work on RedHat derivatives. - // On RHEL, Fedora and others the "product version" is determined by the first package - // providing 'redhat-release'. This value is not hardcoded in YUM and can be configured - // with the $distroverpkg variable. - scoped_ptr tmprpmdb; - if ( ZConfig::instance().systemRoot() == Pathname() ) - { - try - { - tmprpmdb.reset( new rpm::RpmDb ); - tmprpmdb->initDatabase( /*default ctor uses / but no additional keyring exports */ ); - } - catch( ... ) - { - return ""; - } - } - rpm::librpmDb::db_const_iterator it; - if ( it.findByProvides( ZConfig::instance().distroverpkg() ) ) - distributionVersion = it->tag_version(); - } - return distributionVersion; - } - - - std::string TargetImpl::distributionFlavor() const - { - return firstNonEmptyLineIn( home() / "LastDistributionFlavor" ); - } - // static version: - std::string TargetImpl::distributionFlavor( const Pathname & root_r ) - { - return firstNonEmptyLineIn( staticGuessRoot(root_r) / "/var/lib/zypp/LastDistributionFlavor" ); - } - - /////////////////////////////////////////////////////////////////// - - std::string TargetImpl::anonymousUniqueId() const - { - return firstNonEmptyLineIn( home() / "AnonymousUniqueId" ); - } - // static version: - std::string TargetImpl::anonymousUniqueId( const Pathname & root_r ) - { - return firstNonEmptyLineIn( staticGuessRoot(root_r) / "/var/lib/zypp/AnonymousUniqueId" ); - } - - /////////////////////////////////////////////////////////////////// - - void TargetImpl::installSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - { - // provide on local disk - ManagedFile localfile = provideSrcPackage(srcPackage_r); - // install it - rpm().installPackage ( localfile ); - } - - ManagedFile TargetImpl::provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - { - // provide on local disk - repo::RepoMediaAccess access_r; - repo::SrcPackageProvider prov( access_r ); - return prov.provideSrcPackage( srcPackage_r ); - } - //////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/TargetImpl.commitFindFileConflicts.cc b/libzypp/zypp/target/TargetImpl.commitFindFileConflicts.cc deleted file mode 100644 index 399567c..0000000 --- a/libzypp/zypp/target/TargetImpl.commitFindFileConflicts.cc +++ /dev/null @@ -1,172 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetImpl.commitFindFileConflicts.cc - */ -extern "C" -{ -#include -#include -#include -#include -#include -#include -#include -} -#include -#include -#include - -#include "zypp/base/LogTools.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Exception.h" -#include "zypp/base/UserRequestException.h" - -#include "zypp/sat/Queue.h" -#include "zypp/sat/FileConflicts.h" -#include "zypp/sat/Pool.h" - -#include "zypp/target/TargetImpl.h" -#include "zypp/target/CommitPackageCache.h" - -#include "zypp/ZYppCallbacks.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace target - { - /////////////////////////////////////////////////////////////////// - namespace - { - /** libsolv::pool_findfileconflicts callback providing package header. */ - struct FileConflictsCB - { - FileConflictsCB( ::_Pool * pool_r, ProgressData & progress_r ) - : _progress( progress_r ) - , _state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free ) - {} - - void * operator()( ::_Pool * pool_r, sat::detail::IdType id_r ) - { - void * ret = lookup( id_r ); - - // report progress on 1st visit only, ticks later - // (there may be up to 3 visits) - if ( _visited.find( id_r ) == _visited.end() ) - { - //DBG << "FCCB: " << sat::Solvable( id_r ) << " " << ret << endl; - _visited.insert( id_r ); - if ( ! ret && sat::Solvable( id_r ).isKind() ) // only packages have filelists - _noFilelist.push( id_r ); - _progress.incr(); - } - else - { - _progress.tick(); - } - return ret; - } - - const sat::Queue & noFilelist() const - { return _noFilelist; } - - static void * invoke( ::_Pool * pool_r, sat::detail::IdType id_r, void * cbdata_r ) - { return (*reinterpret_cast(cbdata_r))( pool_r, id_r ); } - - private: - void * lookup( sat::detail::IdType id_r ) - { - sat::Solvable solv( id_r ); - if ( solv.isSystem() ) - { - Solvable * s = solv.get(); - if ( ! s->repo->rpmdbid ) - return nullptr; - sat::detail::IdType rpmdbid = s->repo->rpmdbid[id_r - s->repo->start]; - if ( ! rpmdbid ) - return nullptr; - return ::rpm_byrpmdbid( _state, rpmdbid ); - } - else - { - Package::Ptr pkg( make( solv ) ); - if ( ! pkg ) - return nullptr; - Pathname localfile( pkg->cachedLocation() ); - if ( localfile.empty() ) - return nullptr; - AutoDispose fp( ::fopen( localfile.c_str(), "re" ), ::fclose ); - return ::rpm_byfp( _state, fp, localfile.c_str() ); - } - } - - private: - ProgressData & _progress; - AutoDispose _state; - std::unordered_set _visited; - sat::Queue _noFilelist; - }; - - } // namespace - /////////////////////////////////////////////////////////////////// - - void TargetImpl::commitFindFileConflicts( const ZYppCommitPolicy & policy_r, ZYppCommitResult & result_r ) - { - sat::Queue todo; - sat::FileConflicts conflicts; - int newpkgs = result_r.transaction().installedResult( todo ); - MIL << "Checking for file conflicts in " << newpkgs << " new packages..." << endl; - if ( ! newpkgs ) - return; - - try { - callback::SendReport report; - ProgressData progress( todo.size() ); - if ( ! report->start( progress ) ) - ZYPP_THROW( AbortRequestException() ); - - FileConflictsCB cb( sat::Pool::instance().get(), progress ); - // lambda receives progress trigger and translates into report - auto sendProgress = [&]( const ProgressData & progress_r )->bool { - if ( ! report->progress( progress_r, cb.noFilelist() ) ) - ZYPP_THROW( AbortRequestException() ); - return true; - }; - progress.sendTo( sendProgress ); - - unsigned count = - ::pool_findfileconflicts( sat::Pool::instance().get(), - todo, - newpkgs, - conflicts, - FINDFILECONFLICTS_USE_SOLVABLEFILELIST | FINDFILECONFLICTS_CHECK_DIRALIASING | FINDFILECONFLICTS_USE_ROOTDIR, - &FileConflictsCB::invoke, - &cb ); - progress.toMax(); - progress.noSend(); - - (count?WAR:MIL) << "Found " << count << " file conflicts." << endl; - if ( ! report->result( progress, cb.noFilelist(), conflicts ) ) - ZYPP_THROW( AbortRequestException() ); - } - catch ( const AbortRequestException & e ) - { - TargetAbortedException excpt( N_("Installation has been aborted as directed.") ); - excpt.remember( e ); - ZYPP_THROW( excpt ); - } - } - - } // namespace target - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/TargetImpl.h b/libzypp/zypp/target/TargetImpl.h deleted file mode 100644 index 0b6c015..0000000 --- a/libzypp/zypp/target/TargetImpl.h +++ /dev/null @@ -1,243 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/TargetImpl.h - * -*/ -#ifndef ZYPP_TARGET_TARGETIMPL_H -#define ZYPP_TARGET_TARGETIMPL_H - -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/PoolItem.h" -#include "zypp/ZYppCommit.h" - -#include "zypp/Pathname.h" -#include "zypp/media/MediaAccess.h" -#include "zypp/Target.h" -#include "zypp/target/rpm/RpmDb.h" -#include "zypp/target/TargetException.h" -#include "zypp/target/RequestedLocalesFile.h" -#include "zypp/target/SolvIdentFile.h" -#include "zypp/target/HardLocksFile.h" -#include "zypp/ManagedFile.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - DEFINE_PTR_TYPE(TargetImpl); - class CommitPackageCache; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : TargetImpl - // - /** Base class for concrete Target implementations. - * - * Constructed by \ref TargetFactory. Public access via \ref Target - * interface. - */ - class TargetImpl : public base::ReferenceCounted, private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const TargetImpl & obj ); - - public: - /** list of pool items */ - typedef std::list PoolItemList; - - /** set of pool items */ - typedef std::set PoolItemSet; - - public: - /** Ctor. */ - TargetImpl(const Pathname & root_r = "/", bool doRebuild_r = false ); - /** Dtor. */ - virtual ~TargetImpl(); - - /** Null implementation */ - static TargetImpl_Ptr nullimpl(); - - /** - * generates the unique anonymous id which is called - * when creating the target - */ - void createAnonymousId() const; - - /** - * generates a cache of the last product flavor - */ - void createLastDistributionFlavorCache() const; - - /** \name Solv file handling. - * If target solv file is outdated, but (non-root-)user has - * no permission to create it at the default location, we - * use a temporary one. - */ - //@{ - private: - /** The systems default solv file location. */ - Pathname defaultSolvfilesPath() const; - - /** The solv file location actually in use (default or temp). */ - Pathname solvfilesPath() const - { return solvfilesPathIsTemp() ? _tmpSolvfilesPath : defaultSolvfilesPath(); } - - /** Whether we're using a temp. solvfile. */ - bool solvfilesPathIsTemp() const - { return ! _tmpSolvfilesPath.empty(); } - - Pathname _tmpSolvfilesPath; - - public: - void load( bool force = true ); - - void unload(); - - void reload(); - - void clearCache(); - - bool buildCache(); - //@} - - public: - - /** The root set for this target */ - Pathname root() const - { return _root; } - - /** The directory to store things. */ - Pathname home() const - { return home( _root ); } - - static Pathname home( const Pathname & root_r ) - { return root_r / "/var/lib/zypp"; } - - /** Commit changes in the pool */ - ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r ); - - /** Install a source package on the Target. */ - void installSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - /** Provides a source package on the Target. */ - ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - /** Overload to realize stream output. */ - virtual std::ostream & dumpOn( std::ostream & str ) const - { - return str << "TargetImpl"; - } - - /** The RPM database */ - rpm::RpmDb & rpm(); - - /** If the package is installed and provides the file - Needed to evaluate split provides during Resolver::Upgrade() */ - bool providesFile (const std::string & path_str, const std::string & name_str) const; - - /** Return name of package owning \a path_str - * or empty string if no installed package owns \a path_str. */ - std::string whoOwnsFile (const std::string & path_str) const - { return _rpm.whoOwnsFile (path_str); } - - /** return the last modification date of the target */ - Date timestamp() const; - - /** \copydoc Target::baseProduct() */ - Product::constPtr baseProduct() const; - - /** \copydoc Target::requestedLocales() */ - LocaleSet requestedLocales() const - { return _requestedLocalesFile.locales(); } - /** \overload */ - static LocaleSet requestedLocales( const Pathname & root_r ); - - /** \copydoc Target::targetDistribution() */ - std::string targetDistribution() const; - /** \overload */ - static std::string targetDistribution( const Pathname & root_r ); - - /** \copydoc Target::targetDistributionRelease()*/ - std::string targetDistributionRelease() const; - /** \overload */ - static std::string targetDistributionRelease( const Pathname & root_r ); - - /** \copydoc Target::targetDistributionFlavor()*/ - std::string targetDistributionFlavor() const; - /** \overload */ - static std::string targetDistributionFlavor( const Pathname & root_r ); - - /** \copydoc Target::distributionVersion()*/ - Target::DistributionLabel distributionLabel() const; - /** \overload */ - static Target::DistributionLabel distributionLabel( const Pathname & root_r ); - - /** \copydoc Target::distributionVersion()*/ - std::string distributionVersion() const; - /** \overload */ - static std::string distributionVersion( const Pathname & root_r ); - - /** \copydoc Target::distributionFlavor() */ - std::string distributionFlavor() const; - /** \overload */ - static std::string distributionFlavor( const Pathname & root_r ); - - /** \copydoc Target::anonymousUniqueId() */ - std::string anonymousUniqueId() const; - /** \overload */ - static std::string anonymousUniqueId( const Pathname & root_r ); - - private: - /** Commit ordered changes (internal helper) */ - void commit( const ZYppCommitPolicy & policy_r, - CommitPackageCache & packageCache_r, - ZYppCommitResult & result_r ); - - /** Commit helper checking for file conflicts after download. */ - void commitFindFileConflicts( const ZYppCommitPolicy & policy_r, ZYppCommitResult & result_r ); - protected: - /** Path to the target */ - Pathname _root; - /** RPM database */ - rpm::RpmDb _rpm; - /** Requested Locales database */ - RequestedLocalesFile _requestedLocalesFile; - /** user/auto installed database */ - SolvIdentFile _autoInstalledFile; - /** Hard-Locks database */ - HardLocksFile _hardLocksFile; - /** Cache distributionVersion */ - mutable std::string _distributionVersion; - - private: - /** Null implementation */ - static TargetImpl_Ptr _nullimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates TargetImpl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj ) - { - return obj.dumpOn( str ); - } - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_TARGETIMPL_H diff --git a/libzypp/zypp/target/hal/HalContext.cc b/libzypp/zypp/target/hal/HalContext.cc deleted file mode 100644 index e9f49de..0000000 --- a/libzypp/zypp/target/hal/HalContext.cc +++ /dev/null @@ -1,1255 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/hal/HalContext.cc - * - * \brief Hardware abstaction layer library wrapper implementation. - */ -#include "zypp/target/hal/HalException.h" -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace target - { ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - namespace hal - { //////////////////////////////////////////////////////////////// - NoHalException::NoHalException() - : Exception(_("Sorry, but this version of libzypp was built without HAL support.")) - {} - //////////////////////////////////////////////////////////////// - } // namespace hal - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - } // namespace target - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#ifndef NO_HAL // disables zypp's HAL dependency - -#include "zypp/target/hal/HalContext.h" -#include "zypp/thread/Mutex.h" -#include "zypp/thread/MutexLock.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" - -#include -#include - -#include - -using namespace std; - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace target - { ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - namespace hal - { //////////////////////////////////////////////////////////////// - - using zypp::thread::Mutex; - using zypp::thread::MutexLock; - - //////////////////////////////////////////////////////////////// - namespace // anonymous - { ////////////////////////////////////////////////////////////// - - - ////////////////////////////////////////////////////////////// - // STATIC - /** - ** hmm... currently a global one.. - */ - static Mutex g_Mutex; - - - ////////////////////////////////////////////////////////////// - /** - * Internal hal (dbus ) error helper class. - */ - class HalError - { - public: - DBusError error; - - HalError() { dbus_error_init(&error); } - ~HalError() { dbus_error_free(&error); } - - inline bool isSet() const - { - return dbus_error_is_set(&error); - } - - inline HalException halException(const std::string &msg = std::string()) const - { - if( isSet() && error.name != NULL && error.message != NULL) { - return HalException(error.name, error.message); - } - else if( !msg.empty()) { - return HalException(msg); - } - else { - return HalException(); - } - } - }; - - - // ----------------------------------------------------------- - inline void - VERIFY_CONTEXT(const zypp::RW_pointer &h) - { - if( !h) - { - ZYPP_THROW(HalException(_("HalContext not connected"))); - } - } - - // ----------------------------------------------------------- - inline void - VERIFY_DRIVE(const zypp::RW_pointer &d) - { - if( !d) - { - ZYPP_THROW(HalException(_("HalDrive not initialized"))); - } - } - - // ----------------------------------------------------------- - inline void - VERIFY_VOLUME(const zypp::RW_pointer &v) - { - if( !v) - { - ZYPP_THROW(HalException(_("HalVolume not initialized"))); - } - } - - ////////////////////////////////////////////////////////////// - } // anonymous - //////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////// - std::ostream & - HalException::dumpOn( std::ostream & str ) const - { - if(!e_name.empty() && !e_msg.empty()) - return str << msg() << ": " << e_msg << " (" << e_name << ")"; - else if(!e_msg.empty()) - return str << msg() << ": " << e_msg; - else - return str << msg(); - } - - //////////////////////////////////////////////////////////////// - class HalContext_Impl - { - public: - HalContext_Impl(); - ~HalContext_Impl(); - - DBusConnection *conn; - LibHalContext *hctx; - bool pcon; // private connection - }; - - - //////////////////////////////////////////////////////////////// - class HalDrive_Impl - { - public: - zypp::RW_pointer hal; - LibHalDrive *drv; - - HalDrive_Impl() - : hal(), drv(NULL) - { - } - - HalDrive_Impl(const zypp::RW_pointer &r, - LibHalDrive *d) - : hal(r), drv(d) - { - } - - ~HalDrive_Impl() - { - if( drv) - libhal_drive_free(drv); - } - }; - - - //////////////////////////////////////////////////////////////// - class HalVolume_Impl - { - public: - LibHalVolume *vol; - - HalVolume_Impl(LibHalVolume *v=NULL) - : vol(v) - { - } - - ~HalVolume_Impl() - { - if( vol) - libhal_volume_free(vol); - } - }; - - - //////////////////////////////////////////////////////////////// - HalContext_Impl::HalContext_Impl() - : conn(NULL) - , hctx(NULL) - , pcon(false) // we allways use shared connections at the moment - { - HalError err; - - if( pcon) - conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err.error); - else - conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err.error); - if( !conn) { - ZYPP_THROW(err.halException( - _("Unable to create dbus connection") - )); - } - - hctx = libhal_ctx_new(); - if( !hctx) - { - if( pcon) - dbus_connection_close(conn); - dbus_connection_unref(conn); - conn = NULL; - - ZYPP_THROW(HalException( - _("libhal_ctx_new: Can't create libhal context") - )); - } - - if( !libhal_ctx_set_dbus_connection(hctx, conn)) - { - libhal_ctx_free(hctx); - hctx = NULL; - - if( pcon) - dbus_connection_close(conn); - dbus_connection_unref(conn); - conn = NULL; - - ZYPP_THROW(HalException( - _("libhal_set_dbus_connection: Can't set dbus connection") - )); - } - - if( !libhal_ctx_init(hctx, &err.error)) - { - libhal_ctx_free(hctx); - hctx = NULL; - - if( pcon) - dbus_connection_close(conn); - dbus_connection_unref(conn); - conn = NULL; - - ZYPP_THROW(err.halException( - _("Unable to initalize HAL context -- hald not running?") - )); - } - } - - // ------------------------------------------------------------- - HalContext_Impl::~HalContext_Impl() - { - if( hctx) - { - HalError err; - libhal_ctx_shutdown(hctx, &err.error); - libhal_ctx_free( hctx); - } - if( conn) - { - if( pcon) - dbus_connection_close(conn); - dbus_connection_unref(conn); - } - } - - - //////////////////////////////////////////////////////////////// - HalContext::HalContext(bool autoconnect) - : h_impl( NULL) - { - MutexLock lock(g_Mutex); - - if( autoconnect) - h_impl.reset( new HalContext_Impl()); - } - - // ------------------------------------------------------------- - HalContext::HalContext(const HalContext &context) - : h_impl( NULL) - { - MutexLock lock(g_Mutex); - - zypp::RW_pointer(context.h_impl).swap(h_impl); - } - - // ------------------------------------------------------------- - HalContext::~HalContext() - { - MutexLock lock(g_Mutex); - - h_impl.reset(); - } - - // -------------------------------------------------------------- - HalContext & - HalContext::operator=(const HalContext &context) - { - MutexLock lock(g_Mutex); - - if( this == &context) - return *this; - - zypp::RW_pointer(context.h_impl).swap(h_impl); - return *this; - } - - // -------------------------------------------------------------- - HalContext::operator HalContext::bool_type() const - { - MutexLock lock(g_Mutex); - - return h_impl; - } - - // -------------------------------------------------------------- - void - HalContext::connect() - { - MutexLock lock(g_Mutex); - - if( !h_impl) - h_impl.reset( new HalContext_Impl()); - } - - // -------------------------------------------------------------- - std::vector - HalContext::getAllDevices() const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - char **names; - int count = 0; - - names = libhal_get_all_devices( h_impl->hctx, &count, &err.error); - if( !names) - { - ZYPP_THROW(err.halException()); - } - - std::vector ret(names, names + count); - libhal_free_string_array(names); - return ret; - } - - // -------------------------------------------------------------- - HalDrive - HalContext::getDriveFromUDI(const std::string &udi) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - LibHalDrive *drv = libhal_drive_from_udi(h_impl->hctx, udi.c_str()); - if( drv != NULL) - return HalDrive(new HalDrive_Impl( h_impl, drv)); - else - return HalDrive(); - } - - // -------------------------------------------------------------- - HalVolume - HalContext::getVolumeFromUDI(const std::string &udi) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - LibHalVolume *vol = libhal_volume_from_udi(h_impl->hctx, udi.c_str()); - if( vol) - return HalVolume( new HalVolume_Impl(vol)); - else - return HalVolume(); - } - - // -------------------------------------------------------------- - HalVolume - HalContext::getVolumeFromDeviceFile(const std::string &device_file) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - LibHalVolume *vol = libhal_volume_from_device_file(h_impl->hctx, - device_file.c_str()); - if( vol) - return HalVolume( new HalVolume_Impl(vol)); - else - return HalVolume(); - } - - // -------------------------------------------------------------- - std::vector - HalContext::findDevicesByCapability(const std::string &capability) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - char **names; - int count = 0; - - names = libhal_find_device_by_capability(h_impl->hctx, - capability.c_str(), - &count, &err.error); - if( !names) - { - ZYPP_THROW(err.halException()); - } - - std::vector ret(names, names + count); - libhal_free_string_array(names); - return ret; - } - - // -------------------------------------------------------------- - bool - HalContext::getDevicePropertyBool (const std::string &udi, - const std::string &key) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_get_property_bool (h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( err.isSet()) - { - ZYPP_THROW(err.halException()); - } - return ret; - } - - // -------------------------------------------------------------- - int32_t - HalContext::getDevicePropertyInt32 (const std::string &udi, - const std::string &key) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_int32_t ret; - - ret = libhal_device_get_property_int (h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( err.isSet()) - { - ZYPP_THROW(err.halException()); - } - return ret; - } - - // -------------------------------------------------------------- - uint64_t - HalContext::getDevicePropertyUInt64(const std::string &udi, - const std::string &key) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_uint64_t ret; - - ret = libhal_device_get_property_uint64(h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( err.isSet()) - { - ZYPP_THROW(err.halException()); - } - return ret; - } - - // -------------------------------------------------------------- - double - HalContext::getDevicePropertyDouble(const std::string &udi, - const std::string &key) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - double ret; - - ret = libhal_device_get_property_bool (h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( err.isSet()) - { - ZYPP_THROW(err.halException()); - } - return ret; - } - - - // -------------------------------------------------------------- - std::string - HalContext::getDevicePropertyString(const std::string &udi, - const std::string &key) const - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - std::string ret; - char *ptr; - - ptr = libhal_device_get_property_string(h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( err.isSet()) - { - ZYPP_THROW(err.halException()); - } - if( ptr != NULL) - { - ret = ptr; - free(ptr); - } - return ret; - } - - // -------------------------------------------------------------- - void - HalContext::setDevicePropertyBool (const std::string &udi, - const std::string &key, - bool value) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_set_property_bool (h_impl->hctx, - udi.c_str(), - key.c_str(), - value ? 1 : 0, - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - // -------------------------------------------------------------- - void - HalContext::setDevicePropertyInt32 (const std::string &udi, - const std::string &key, - int32_t value) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_set_property_int (h_impl->hctx, - udi.c_str(), - key.c_str(), - value, - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - // -------------------------------------------------------------- - void - HalContext::setDevicePropertyUInt64(const std::string &udi, - const std::string &key, - uint64_t value) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_set_property_uint64(h_impl->hctx, - udi.c_str(), - key.c_str(), - value, - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - // -------------------------------------------------------------- - void - HalContext::setDevicePropertyDouble(const std::string &udi, - const std::string &key, - double value) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_set_property_double(h_impl->hctx, - udi.c_str(), - key.c_str(), - value, - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - // -------------------------------------------------------------- - void - HalContext::setDevicePropertyString(const std::string &udi, - const std::string &key, - const std::string &value) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_set_property_string(h_impl->hctx, - udi.c_str(), - key.c_str(), - value.c_str(), - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - // -------------------------------------------------------------- - void - HalContext::removeDeviceProperty(const std::string &udi, - const std::string &key) - { - MutexLock lock(g_Mutex); - VERIFY_CONTEXT(h_impl); - - HalError err; - dbus_bool_t ret; - - ret = libhal_device_remove_property(h_impl->hctx, - udi.c_str(), - key.c_str(), - &err.error); - if( !ret) - { - ZYPP_THROW(err.halException()); - } - } - - //////////////////////////////////////////////////////////////// - HalDrive::HalDrive() - : d_impl( NULL) - { - } - - // -------------------------------------------------------------- - HalDrive::HalDrive(HalDrive_Impl *impl) - : d_impl( NULL) - { - MutexLock lock(g_Mutex); - - d_impl.reset(impl); - } - - // -------------------------------------------------------------- - HalDrive::HalDrive(const HalDrive &drive) - : d_impl( NULL) - { - MutexLock lock(g_Mutex); - - zypp::RW_pointer(drive.d_impl).swap(d_impl); - } - - // -------------------------------------------------------------- - HalDrive::~HalDrive() - { - MutexLock lock(g_Mutex); - - d_impl.reset(); - } - - // -------------------------------------------------------------- - HalDrive & - HalDrive::operator=(const HalDrive &drive) - { - MutexLock lock(g_Mutex); - - if( this == &drive) - return *this; - - zypp::RW_pointer(drive.d_impl).swap(d_impl); - return *this; - } - - // -------------------------------------------------------------- - HalDrive::operator HalDrive::bool_type() const - { - MutexLock lock(g_Mutex); - - return d_impl; - } - - // -------------------------------------------------------------- - std::string - HalDrive::getUDI() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - const char *ptr = libhal_drive_get_udi(d_impl->drv); - return std::string(ptr ? ptr : ""); - } - - // -------------------------------------------------------------- - std::string - HalDrive::getTypeName() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - const char *ptr = libhal_drive_get_type_textual(d_impl->drv); - return std::string(ptr ? ptr : ""); - } - - // -------------------------------------------------------------- - std::string - HalDrive::getDeviceFile() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - return std::string(libhal_drive_get_device_file(d_impl->drv)); - } - - // -------------------------------------------------------------- - unsigned int - HalDrive::getDeviceMajor() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - return libhal_drive_get_device_major(d_impl->drv); - } - - // -------------------------------------------------------------- - unsigned int - HalDrive::getDeviceMinor() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - return libhal_drive_get_device_minor(d_impl->drv); - } - - // -------------------------------------------------------------- - bool - HalDrive::usesRemovableMedia() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - return libhal_drive_uses_removable_media(d_impl->drv); - } - - // -------------------------------------------------------------- - std::vector - HalDrive::getCdromCapabilityNames() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - std::vector ret; - LibHalDriveCdromCaps caps; - - /* - ** FIXME: there is no textual variant :-( - ** using property key names... - */ - caps = libhal_drive_get_cdrom_caps(d_impl->drv); - - if(caps & LIBHAL_DRIVE_CDROM_CAPS_CDROM) - ret.push_back("cdrom"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_CDR) - ret.push_back("cdr"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_CDRW) - ret.push_back("cdrw"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRAM) - ret.push_back("dvdram"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDROM) - ret.push_back("dvd"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDR) - ret.push_back("dvdr"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRW) - ret.push_back("dvdrw"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR) - ret.push_back("dvdplusr"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW) - ret.push_back("dvdplusrw"); - if(caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL) - ret.push_back("dvdplusrdl"); - - return ret; - -#if 0 - if( libhal_drive_get_type(d_impl->drv) != LIBHAL_DRIVE_TYPE_CDROM) - ZYPP_THROW(HalException(_("Not a CDROM drive"))); - - /* - ** FIXME: we use property keys matching - ** "storage.cdrom.cd*" - ** "storage.cdrom.dvd*" - ** but this may print other bool keys, - ** that are not CDROM caps. - */ - LibHalPropertySet *props; - HalError err; - - props = libhal_device_get_all_properties(d_impl->hal->hctx, - getUDI().c_str(), - &err.error); - if( !props) - ZYPP_THROW(err.halException()); - - std::vector ret(1, getTypeName()); - std::string key; - std::string dvd("storage.cdrom.dvd"); - std::string cd ("storage.cdrom.cd"); - - LibHalPropertySetIterator it; - for(libhal_psi_init(&it, props); - libhal_psi_has_more(&it); - libhal_psi_next(&it)) - { - if( libhal_psi_get_type(&it) == LIBHAL_PROPERTY_TYPE_BOOLEAN && - libhal_psi_get_bool(&it)) - { - key = libhal_psi_get_key(&it); - if( key.compare(0, cd.size(), cd) == 0) - { - ret.push_back(key.substr(sizeof("storage.cdrom.")-1)); - } - else - if( key.compare(0, dvd.size(), dvd) == 0) - { - ret.push_back(key.substr(sizeof("storage.cdrom.")-1)); - } - } - } - libhal_free_property_set(props); - - return ret; -#endif - } - - // -------------------------------------------------------------- - std::vector - HalDrive::findAllVolumes() const - { - MutexLock lock(g_Mutex); - VERIFY_DRIVE(d_impl); - - char **names; - int count = 0; - - names = libhal_drive_find_all_volumes(d_impl->hal->hctx, - d_impl->drv, - &count); - - std::vector ret; - ret.assign(names, names + count); - libhal_free_string_array(names); - return ret; - } - - - //////////////////////////////////////////////////////////////// - HalVolume::HalVolume() - : v_impl( NULL) - {} - - HalVolume::HalVolume(HalVolume_Impl *impl) - : v_impl( NULL) - { - MutexLock lock(g_Mutex); - - v_impl.reset(impl); - } - - // -------------------------------------------------------------- - HalVolume::HalVolume(const HalVolume &volume) - : v_impl( NULL) - { - MutexLock lock(g_Mutex); - - zypp::RW_pointer(volume.v_impl).swap(v_impl); - } - - // -------------------------------------------------------------- - HalVolume::~HalVolume() - { - MutexLock lock(g_Mutex); - - v_impl.reset(); - } - - // -------------------------------------------------------------- - HalVolume & - HalVolume::operator=(const HalVolume &volume) - { - MutexLock lock(g_Mutex); - - if( this == &volume) - return *this; - - zypp::RW_pointer(volume.v_impl).swap(v_impl); - return *this; - } - - // -------------------------------------------------------------- - HalVolume::operator HalVolume::bool_type() const - { - MutexLock lock(g_Mutex); - - return v_impl; - } - - // -------------------------------------------------------------- - std::string - HalVolume::getUDI() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - const char *ptr = libhal_volume_get_udi(v_impl->vol); - return std::string(ptr ? ptr : ""); - } - - // -------------------------------------------------------------- - std::string - HalVolume::getDeviceFile() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return std::string(libhal_volume_get_device_file(v_impl->vol)); - } - - // -------------------------------------------------------------- - unsigned int - HalVolume::getDeviceMajor() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return libhal_volume_get_device_major(v_impl->vol); - } - - // -------------------------------------------------------------- - unsigned int - HalVolume::getDeviceMinor() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return libhal_volume_get_device_minor(v_impl->vol); - } - - // -------------------------------------------------------------- - bool - HalVolume::isDisc() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return libhal_volume_is_disc(v_impl->vol); - } - - // -------------------------------------------------------------- - bool - HalVolume::isPartition() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return libhal_volume_is_partition(v_impl->vol); - } - - // -------------------------------------------------------------- - bool - HalVolume::isMounted() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return libhal_volume_is_mounted(v_impl->vol); - } - - // -------------------------------------------------------------- - std::string - HalVolume::getFSType() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - return std::string( libhal_volume_get_fstype(v_impl->vol)); - } - - // -------------------------------------------------------------- - std::string - HalVolume::getFSUsage() const - { - MutexLock lock(g_Mutex); - VERIFY_VOLUME(v_impl); - - LibHalVolumeUsage usage( libhal_volume_get_fsusage(v_impl->vol)); - std::string ret; - switch( usage) - { - case LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM: - ret = "filesystem"; - break; - case LIBHAL_VOLUME_USAGE_PARTITION_TABLE: - ret = "partitiontable"; - break; - case LIBHAL_VOLUME_USAGE_RAID_MEMBER: - return "raid"; - break; - case LIBHAL_VOLUME_USAGE_CRYPTO: - ret = "crypto"; - break; - case LIBHAL_VOLUME_USAGE_UNKNOWN: - default: - break; - } - return ret; - } - - // -------------------------------------------------------------- - std::string - HalVolume::getMountPoint() const - { - VERIFY_VOLUME(v_impl); - - return std::string( libhal_volume_get_mount_point(v_impl->vol)); - } - - - //////////////////////////////////////////////////////////////// - } // namespace hal - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - } // namespace target - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// -#else // NO_HAL -#include "zypp/target/hal/HalContext.h" -#include "zypp/target/hal/HalException.h" -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace target - { ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - namespace hal - { //////////////////////////////////////////////////////////////// - - std::ostream & - HalException::dumpOn( std::ostream & str ) const - { return str; } - - // -------------------------------------------------------------- - class HalContext_Impl - {}; - class HalDrive_Impl - {}; - class HalVolume_Impl - {}; - - // -------------------------------------------------------------- - HalContext::HalContext(bool) - { ZYPP_THROW( NoHalException() ); } - HalContext::~HalContext() - {} - HalContext & - HalContext::operator=(const HalContext &) - { return *this; } - HalContext::operator HalContext::bool_type() const - { return 0; } - void - HalContext::connect() - {} - std::vector - HalContext::getAllDevices() const - { return std::vector(); } - HalDrive - HalContext::getDriveFromUDI(const std::string &) const - { return HalDrive(); } - HalVolume - HalContext::getVolumeFromUDI(const std::string &) const - { return HalVolume(); } - HalVolume - HalContext::getVolumeFromDeviceFile(const std::string &) const - { return HalVolume(); } - std::vector - HalContext::findDevicesByCapability(const std::string &) const - { return std::vector(); } - bool - HalContext::getDevicePropertyBool(const std::string &, const std::string &) const - { return false; } - void - HalContext::setDevicePropertyBool (const std::string &, const std::string &, bool value) - {} - void - HalContext::removeDeviceProperty(const std::string &, const std::string &) - {} - std::string - HalContext::getDevicePropertyString(const std::string &, const std::string &) const - { return ""; } - // -------------------------------------------------------------- - HalDrive::HalDrive() - { ZYPP_THROW( NoHalException() ); } - HalDrive::~HalDrive() - {} - HalDrive & - HalDrive::operator=(const HalDrive &) - { return *this; } - HalDrive::operator HalDrive::bool_type() const - { return 0; } - std::string - HalDrive::getUDI() const - { return std::string(); } - std::string - HalDrive::getTypeName() const - { return std::string(); } - std::string - HalDrive::getDeviceFile() const - { return std::string(); } - unsigned int - HalDrive::getDeviceMinor() const - { return 0; } - unsigned int - HalDrive::getDeviceMajor() const - { return 0; } - bool - HalDrive::usesRemovableMedia() const - { return false; } - std::vector - HalDrive::getCdromCapabilityNames() const - { return std::vector(); } - std::vector - HalDrive::findAllVolumes() const - { return std::vector(); } - - // -------------------------------------------------------------- - HalVolume::HalVolume() - { ZYPP_THROW( NoHalException() ); } - HalVolume::~HalVolume() - {} - HalVolume & - HalVolume::operator=(const HalVolume &) - { return *this; } - HalVolume::operator HalVolume::bool_type() const - { return 0; } - std::string - HalVolume::getUDI() const - { return std::string(); } - std::string - HalVolume::getDeviceFile() const - { return std::string(); } - unsigned int - HalVolume::getDeviceMinor() const - { return 0; } - unsigned int - HalVolume::getDeviceMajor() const - { return 0; } - bool - HalVolume::isDisc() const - { return false; } - bool - HalVolume::isPartition() const - { return false; } - bool - HalVolume::isMounted() const - { return false; } - std::string - HalVolume::getFSType() const - { return std::string(); } - std::string - HalVolume::getFSUsage() const - { return std::string(); } - std::string - HalVolume::getMountPoint() const - { return std::string(); } - - //////////////////////////////////////////////////////////////// - } // namespace hal - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - } // namespace target - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// -#endif // NO_HAL - -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/target/hal/HalContext.h b/libzypp/zypp/target/hal/HalContext.h deleted file mode 100644 index d32a26a..0000000 --- a/libzypp/zypp/target/hal/HalContext.h +++ /dev/null @@ -1,346 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/hal/HalContext.h - * - * \brief Hardware abstaction layer library wrapper. - */ -#ifndef ZYPP_TARGET_HAL_HALCONTEXT_H -#define ZYPP_TARGET_HAL_HALCONTEXT_H - -#include "zypp/target/hal/HalException.h" -#include "zypp/base/PtrTypes.h" -#include -#include -#include - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace target - { ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - namespace hal - { //////////////////////////////////////////////////////////////// - - - // ------------------------------------------------------------- - /** @{ - * Forward declarations. - */ - class HalDrive; - class HalVolume; - - class HalDrive_Impl; - class HalVolume_Impl; - class HalContext_Impl; - /** }@ */ - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : HalContext - // - /** Hardware abstaction layer context. - * - * Hal context wrapper. It manages the dbus connection and is - * the entry point to query drives, volumes and other information. - * - * @todo: wrap more functions. - */ - class HalContext - { - public: - typedef - zypp::RW_pointer::unspecified_bool_type bool_type; - - HalContext(bool autoconnect=false); - HalContext(const HalContext &context); - ~HalContext(); - - HalContext& - operator=(const HalContext &context); - - /** - * Verifies if the context is initialized. - */ - operator bool_type() const; - - /** - */ - void - connect(); - - /** - * Retrieve UDI's of all devices. - * \return Vector with device UDI's. - */ - std::vector - getAllDevices() const; - - /** - * Construct a HalDrive object for the specified UDI. - * \param The \p udi of the drive. - * \return The HalDrive object. - */ - HalDrive - getDriveFromUDI(const std::string &udi) const; - - /** - * Construct a HalVolume object for the specified UDI. - * \param The \p udi of the volume. - * \return The HalVolume object. - */ - HalVolume - getVolumeFromUDI(const std::string &udi) const; - - HalVolume - getVolumeFromDeviceFile(const std::string &device_file) const; - - /** - * Retrieve UDI's of all devices with a capability. - * \param The \p capability name - * \return Vector with device UDI's. - */ - std::vector - findDevicesByCapability(const std::string &capability) const; - - bool - getDevicePropertyBool (const std::string &udi, - const std::string &key) const; - - int32_t - getDevicePropertyInt32 (const std::string &udi, - const std::string &key) const; - - uint64_t - getDevicePropertyUInt64(const std::string &udi, - const std::string &key) const; - - double - getDevicePropertyDouble(const std::string &udi, - const std::string &key) const; - - std::string - getDevicePropertyString(const std::string &udi, - const std::string &key) const; - - void - setDevicePropertyBool (const std::string &udi, - const std::string &key, - bool value); - - void - setDevicePropertyInt32 (const std::string &udi, - const std::string &key, - int32_t value); - - void - setDevicePropertyUInt64(const std::string &udi, - const std::string &key, - uint64_t value); - - void - setDevicePropertyDouble(const std::string &udi, - const std::string &key, - double value); - - void - setDevicePropertyString(const std::string &udi, - const std::string &key, - const std::string &value); - - void - removeDeviceProperty(const std::string &udi, - const std::string &key); - - private: - - zypp::RW_pointer h_impl; - }; - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : HalDrive - // - /** Hardware abstaction layer storage drive object. - * - * @todo: wrap more functions. - */ - class HalDrive - { - public: - typedef - zypp::RW_pointer::unspecified_bool_type bool_type; - - HalDrive(); - HalDrive(const HalDrive &drive); - ~HalDrive(); - - HalDrive& - operator=(const HalDrive &drive); - - operator bool_type() const; - - std::string - getUDI() const; - - std::string - getTypeName() const; - - /** - * \return The drive's device file name. - */ - std::string - getDeviceFile() const; - - /** - * \return The drive's device file major number. - */ - unsigned int - getDeviceMajor() const; - - /** - * \return The drive's device minor number. - */ - unsigned int - getDeviceMinor() const; - - /** - * \return True, if drive uses removable media. - */ - bool - usesRemovableMedia() const; - - /* - ** Returns the media type names supported by the drive. - ** - ** Since hal does not implement a textual form here, we - ** are using the drive type and property names from - ** "storage.cdrom.*" namespace: - ** cdrom, cdr, cdrw, dvd, dvdr, dvdrw, dvdram, - ** dvdplusr, dvdplusrw, dvdplusrdl - ** - ** FIXME: Should we provide own LibHalDriveCdromCaps? - */ - std::vector - getCdromCapabilityNames() const; - - /** - * Retrieve UDI's of all volumes of this drive. - * \return Vector with volume UDI's. - */ - std::vector - findAllVolumes() const; - - private: - friend class HalContext; - - HalDrive(HalDrive_Impl *impl); - - zypp::RW_pointer d_impl; - }; - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : HalVolume - // - /** Hardware abstaction layer storage volume object. - * - * @todo: wrap more functions. - */ - class HalVolume - { - public: - typedef - zypp::RW_pointer::unspecified_bool_type bool_type; - - HalVolume(); - HalVolume(const HalVolume &volume); - ~HalVolume(); - - HalVolume& - operator=(const HalVolume &volume); - - operator bool_type() const; - - std::string - getUDI() const; - - /** - * \return The Volume drive's device file name. - */ - std::string - getDeviceFile() const; - - /** - * \return The Volume drive's device major number. - */ - unsigned int - getDeviceMajor() const; - - /** - * \return The Volume drive's device minor number. - */ - unsigned int - getDeviceMinor() const; - - bool - isDisc() const; - - bool - isPartition() const; - - bool - isMounted() const; - - /** - * \return The filesystem name on the volume. - */ - std::string - getFSType() const; - - /** - * \return The filesystem usage purpose. - */ - std::string - getFSUsage() const; - - /** - * \return The mount point of the volume. - */ - std::string - getMountPoint() const; - - private: - friend class HalContext; - friend class HalDrive; - HalVolume(HalVolume_Impl *impl); - - zypp::RW_pointer v_impl; - }; - - - //////////////////////////////////////////////////////////////// - } // namespace hal - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - } // namespace target - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_TARGET_HAL_HALCONTEXT_H - -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/target/hal/HalException.h b/libzypp/zypp/target/hal/HalException.h deleted file mode 100644 index 6d9e05a..0000000 --- a/libzypp/zypp/target/hal/HalException.h +++ /dev/null @@ -1,116 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/hal/HalException.h - * - * \brief Hardware abstaction layer library wrapper. - */ -#ifndef ZYPP_TARGET_HAL_HALEXCEPTION_H -#define ZYPP_TARGET_HAL_HALEXCEPTION_H - -#include "zypp/base/Exception.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace target - { ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - namespace hal - { //////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : HalException - // - /** Hardware abstaction layer exception. - * Just inherits Exception to separate hal exceptions. - */ - class HalException: public zypp::Exception - { - public: - /** Default constructor. - * Use \ref ZYPP_THROW to throw exceptions. - */ - HalException() - : zypp::Exception(_("Hal Exception")) - {} - - /** Constructor taking complete hal error message. - * This constructor is used to generate custom error - * messages, in case, that no DBUS error is avaliable. - * Use \ref ZYPP_THROW to throw exceptions. - */ - HalException(const std::string &msg_r) - : zypp::Exception(_("Hal Exception")) - , e_name() - , e_msg(msg_r) - {} - - /** Constructor taking HAL (DBUS) error message components. - * Use \ref ZYPP_THROW to throw exceptions. - */ - HalException(const std::string &err_name, const std::string &err_msg) - : zypp::Exception(_("Hal Exception")) - , e_name(err_name) - , e_msg(err_msg) - {} - - /** Destructor. - */ - virtual ~HalException() throw() {}; - - /** - * \return The HAL (DBUS) error name component. - */ - const std::string & errorName() const - { - return e_name; - } - - /** - * \return The HAL (DBUS) error message component. - */ - const std::string & errorMessage() const - { - return e_msg; - } - - protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; - - private: - std::string e_name; - std::string e_msg; - }; - - /** Exception thrown if we were built without hal support (-DNO_HAL). - */ - struct NoHalException: public Exception - { NoHalException(); }; - - //////////////////////////////////////////////////////////////// - } // namespace hal - ////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////// - } // namespace target - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_TARGET_HAL_HALEXCEPTION_H - -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/target/modalias/Modalias.cc b/libzypp/zypp/target/modalias/Modalias.cc deleted file mode 100644 index 8533a28..0000000 --- a/libzypp/zypp/target/modalias/Modalias.cc +++ /dev/null @@ -1,220 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/modalias/Modalias.cc - * -*/ -extern "C" -{ -#include -} - -#include -#include -#include - -#undef ZYPP_BASE_LOGGER_LOGGROUP -#define ZYPP_BASE_LOGGER_LOGGROUP "MODALIAS" - -#include "zypp/base/LogTools.h" -#include "zypp/base/IOStream.h" -#include "zypp/base/InputStream.h" -#include "zypp/AutoDispose.h" -#include "zypp/PathInfo.h" - -#include "zypp/target/modalias/Modalias.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ - /////////////////////////////////////////////////////////////////// - namespace target - { - /////////////////////////////////////////////////////////////////// - namespace - { - /** Filter subtrees known to contain no modalias files */ - inline bool isBlackListed( const Pathname & dir_r, const char * file_r ) - { -#define PATH_IS( D, F ) ( ::strcmp( file_r, F ) == 0 && ::strcmp( dir_r.c_str(), D ) == 0 ) - switch ( file_r[0] ) - { - case 'm': - return PATH_IS( "/sys/devices/system", "memory" ); // bnc#824110: huge tree for systems with large RAM - break; - } - return false; -#undef PATH_IS - } - - /** Recursively scan for modalias files and scan them to \a arg. */ - void foreach_file_recursive( const Pathname & dir_r, Modalias::ModaliasList & arg ) - { - AutoDispose dir( ::opendir( dir_r.c_str() ), ::closedir ); - if ( ! dir ) - return; - - struct dirent * dirent = NULL; - while ( (dirent = ::readdir(dir)) != NULL ) - { - if ( dirent->d_name[0] == '.' ) - continue; - - if ( isBlackListed( dir_r, dirent->d_name ) ) - continue; - - PathInfo pi( dir_r / dirent->d_name, PathInfo::LSTAT ); - - if ( pi.isDir() ) - { - foreach_file_recursive( pi.path(), arg ); - } - else if ( pi.isFile() && ::strcmp( dirent->d_name, "modalias" ) == 0 ) - { - // read modalias line from file - std::ifstream str( pi.path().c_str() ); - std::string line( iostr::getline( str ) ); - if ( ! line.empty() ) - arg.push_back( line ); - } - } - } - } // namespace - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Modalias::Impl - // - /** Modalias implementation. */ - struct Modalias::Impl - { - /** Ctor. */ - Impl() - { - const char * dir = getenv("ZYPP_MODALIAS_SYSFS"); - if ( dir ) - { - PathInfo pi( dir ); - if ( pi.isFile() ) - { - // Debug/testcases: - // find /sys/ -type f -name modalias -print0 | xargs -0 cat >/tmp/modaliases - // ZYPP_MODALIAS_SYSFS=/tmp/modaliases - DBG << "Using $ZYPP_MODALIAS_SYSFS modalias file: " << dir << endl; - iostr::forEachLine( InputStream( pi.path() ), - [&]( int num_r, std::string line_r )->bool - { - this->_modaliases.push_back( line_r ); - return true; - } ); - return; - } - DBG << "Using $ZYPP_MODALIAS_SYSFS: " << dir << endl; - } - else - { - dir = "/sys"; - DBG << "Using /sys directory." << endl; - } - - foreach_file_recursive( dir, _modaliases ); - } - - /** Dtor. */ - ~Impl() - {} - - /* - * Check if a device on the system matches a modalias PATTERN. - * - * Returns NULL if no matching device is found, and the modalias - * of the first matching device otherwise. (More than one device - * may match a given pattern.) - * - * On a system that has the following device, - * - * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00 - * - * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*") will - * return a non-NULL value. - */ - bool query( const char * cap_r ) const - { - if ( cap_r && *cap_r ) - { - for_( it, _modaliases.begin(), _modaliases.end() ) - { - if ( fnmatch( cap_r, (*it).c_str(), 0 ) == 0 ) - return true; - } - } - return false; - } - - public: - ModaliasList _modaliases; - - public: - /** Offer default Impl. */ - static shared_ptr nullimpl() - { - static shared_ptr _nullimpl( new Impl ); - return _nullimpl; - } - - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Modalias::Impl Stream output - * And maybe std::ostream & operator<< Modalias::Impl below too. - * return libhal version or something like that. - */ - inline std::ostream & operator<<( std::ostream & str, const Modalias::Impl & obj ) - { - return dumpRange( str << "Modaliases: (" << obj._modaliases.size() << ") ", obj._modaliases.begin(), obj._modaliases.end() ); - } - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Modalias - // - /////////////////////////////////////////////////////////////////// - - Modalias::Modalias() - : _pimpl( Impl::nullimpl() ) - {} - - Modalias::~Modalias() - {} - - Modalias & Modalias::instance() - { - static Modalias _singleton; - return _singleton; - } - - bool Modalias::query( const char * cap_r ) const - { return _pimpl->query( cap_r ); } - - const Modalias::ModaliasList & Modalias::modaliasList() const - { return _pimpl->_modaliases; } - - void Modalias::modaliasList( ModaliasList newlist_r ) - { _pimpl->_modaliases.swap( newlist_r ); } - - std::ostream & operator<<( std::ostream & str, const Modalias & obj ) - { return str << *obj._pimpl; } - - } // namespace target - /////////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - diff --git a/libzypp/zypp/target/modalias/Modalias.h b/libzypp/zypp/target/modalias/Modalias.h deleted file mode 100644 index eb446af..0000000 --- a/libzypp/zypp/target/modalias/Modalias.h +++ /dev/null @@ -1,101 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/modalias/Modalias.h - * -*/ -#ifndef ZYPP_TARGET_MODALIAS_MODALIAS_H -#define ZYPP_TARGET_MODALIAS_MODALIAS_H - -#include -#include -#include - -#include "zypp/base/PtrTypes.h" -#include "zypp/IdString.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Modalias - // - /** Hardware abstaction layer singleton. - */ - class Modalias - { - friend std::ostream & operator<<( std::ostream & str, const Modalias & obj ); - - public: - /** Implementation */ - class Impl; - - public: - typedef std::vector ModaliasList; - - /** Singleton access. */ - static Modalias & instance(); - - /** Dtor */ - ~Modalias(); - - public: - - /** Checks if a device on the system matches a modalias pattern. - * - * Returns \c false if no matching device is found, and the modalias - * of the first matching device otherwise. (More than one device - * may match a given pattern.) - * - * On a system that has the following device, - * \code - * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00 - * \endcode - * the following query will return \c true: - * \code - * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*") - * \endcode - */ - bool query( IdString cap_r ) const - { return query( cap_r.c_str() ); } - /** \overload */ - bool query( const char * cap_r ) const; - /** \overload */ - bool query( const std::string & cap_r ) const - { return query( cap_r.c_str() ); } - - /** List of modaliases found on system */ - const ModaliasList & modaliasList() const; - - /** Manually set list of modaliases to use */ - void modaliasList( ModaliasList newlist_r ); - - private: - /** Singleton ctor. */ - Modalias(); - - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Modalias Stream output */ - std::ostream & operator<<( std::ostream & str, const Modalias & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_MODALIAS_MODALIAS_H diff --git a/libzypp/zypp/target/rpm/BinHeader.cc b/libzypp/zypp/target/rpm/BinHeader.cc deleted file mode 100644 index 2133278..0000000 --- a/libzypp/zypp/target/rpm/BinHeader.cc +++ /dev/null @@ -1,418 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/BinHeader.cc - * -*/ -#include "librpm.h" -extern "C" -{ -#ifdef _RPM_5 -#undef RPM_NULL_TYPE -#define RPM_NULL_TYPE rpmTagType(0) -typedef rpmuint32_t rpm_count_t; -#else -#ifdef _RPM_4_4 -typedef int32_t rpm_count_t; -#endif -#endif -} - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/NonCopyable.h" - -#include "zypp/target/rpm/BinHeader.h" - -using namespace std; - -#undef Y2LOG -#define Y2LOG "BinHeader" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - - /** Helper for header data retieval. - * With \c _RPM_4_X use \c ::headerGet; with older \c _RPM_4_4 - * use the meanwhile deprecated \c ::headerGetEntry. - * \ingroup g_RAII - */ - struct HeaderEntryGetter : private base::NonCopyable - { - public: - HeaderEntryGetter( const Header & h_r, rpmTag & tag_r ); - ~HeaderEntryGetter(); - rpmTagType type(); - rpm_count_t cnt(); - void * val(); - private: -#ifdef _RPM_4_X - ::rpmtd _rpmtd; -#else - rpmTagType _type; - rpm_count_t _cnt; - void * _val; -#endif //_RPM_4_X - }; - -#ifdef _RPM_4_X - inline HeaderEntryGetter::HeaderEntryGetter( const Header & h_r, rpmTag & tag_r ) - : _rpmtd( ::rpmtdNew() ) - { ::headerGet( h_r, tag_r, _rpmtd, HEADERGET_DEFAULT ); } - inline HeaderEntryGetter::~HeaderEntryGetter() - { ::rpmtdFreeData( _rpmtd ); ::rpmtdFree( _rpmtd ); } - inline rpmTagType HeaderEntryGetter::type() { return rpmtdType( _rpmtd ); } - inline rpm_count_t HeaderEntryGetter::cnt() { return _rpmtd->count; } - inline void * HeaderEntryGetter::val() { return _rpmtd->data; } -#else - inline HeaderEntryGetter::HeaderEntryGetter( const Header & h_r, rpmTag & tag_r ) - : _type( RPM_NULL_TYPE ) - , _cnt( 0 ) - , _val( 0 ) - { ::headerGetEntry( h_r, tag_r, hTYP_t(&_type), &_val, &_cnt ); } - inline HeaderEntryGetter::~HeaderEntryGetter() - { if ( _val && _type == RPM_STRING_ARRAY_TYPE ) free( _val ); } - inline rpmTagType HeaderEntryGetter::type() { return _type; } - inline rpm_count_t HeaderEntryGetter::cnt() { return _cnt; } - inline void * HeaderEntryGetter::val() { return _val; } -#endif //_RPM_4_X - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader::intList -// -/////////////////////////////////////////////////////////////////// - -unsigned BinHeader::intList::set( void * val_r, unsigned cnt_r, rpmTagType type_r ) -{ - _type = type_r; // remember the type! - if ( val_r ) - switch ( _type ) - { -#if RPM_CHAR_TYPE != RPM_INT8_TYPE - case RPM_CHAR_TYPE: - std::vector( (char*)val_r, ((char*)val_r)+cnt_r ).swap( _data ); - break; -#endif - case RPM_INT8_TYPE: - std::vector( (int8_t*)val_r, ((int8_t*)val_r)+cnt_r ).swap( _data ); - break; - case RPM_INT16_TYPE: - std::vector( (int16_t*)val_r, ((int16_t*)val_r)+cnt_r ).swap( _data ); - break; - case RPM_INT32_TYPE: - std::vector( (int32_t*)val_r, ((int32_t*)val_r)+cnt_r ).swap( _data ); - break; -#ifdef _RPM_4_X - case RPM_INT64_TYPE: - std::vector( (int64_t*)val_r, ((int64_t*)val_r)+cnt_r ).swap( _data ); - break; -#endif - default: - std::vector( cnt_r, 0L ).swap( _data ); - break; - } - else - _data.clear(); - return _data.size(); -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader::stringList -// -/////////////////////////////////////////////////////////////////// - -unsigned BinHeader::stringList::set( char ** val_r, unsigned cnt_r ) -{ - if ( val_r ) - std::vector( val_r, val_r+cnt_r ).swap( _data ); - else - _data.clear(); - return _data.size(); -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader -// -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::BinHeader -// METHOD TYPE : Constructor -// -BinHeader::BinHeader( Header h_r ) - : _h( h_r ) -{ - if ( _h ) - { - headerLink( _h ); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::BinHeader -// METHOD TYPE : Constructor -// -BinHeader::BinHeader( BinHeader::Ptr & rhs ) -{ - INT << "INJECT from " << rhs; - if ( ! (rhs && rhs->_h) ) - { - _h = 0; - } - else - { - _h = rhs->_h; // ::headerLink already done in rhs - rhs->_h = 0; - } - INT << ": " << *this << " (" << rhs << ")" << endl; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::~BinHeader -// METHOD TYPE : Destructor -// -BinHeader::~BinHeader() -{ - if ( _h ) - { - headerFree( _h ); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::assertHeader -// METHOD TYPE : void -// -bool BinHeader::assertHeader() -{ - if ( !_h ) - { - _h = ::headerNew(); - if ( !_h ) - { - INT << "OOPS: NULL HEADER created!" << endl; - return false; - } - } - return true; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::has_tag -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool BinHeader::has_tag( tag tag_r ) const -{ - return( !empty() && ::headerIsEntry( _h, tag_r ) ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::int_list -// METHOD TYPE : unsigned -// -// DESCRIPTION : -// -unsigned BinHeader::int_list( tag tag_r, intList & lst_r ) const -{ - if ( !empty() ) - { - HeaderEntryGetter headerget( _h, tag_r ); - - if ( headerget.val() ) - { - switch ( headerget.type() ) - { - case RPM_NULL_TYPE: - return lst_r.set( 0, 0, headerget.type() ); -#if RPM_CHAR_TYPE != RPM_INT8_TYPE - case RPM_CHAR_TYPE: -#endif - case RPM_INT8_TYPE: - case RPM_INT16_TYPE: - case RPM_INT32_TYPE: -#ifdef _RPM_4_X - case RPM_INT64_TYPE: -#endif - return lst_r.set( headerget.val(), headerget.cnt(), headerget.type() ); - - default: - INT << "RPM_TAG MISSMATCH: RPM_INTxx_TYPE " << tag_r << " got type " << headerget.type() << endl; - } - } - } - return lst_r.set( 0, 0, RPM_NULL_TYPE ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::string_list -// METHOD TYPE : unsigned -// -// DESCRIPTION : -// -unsigned BinHeader::string_list( tag tag_r, stringList & lst_r ) const -{ - if ( !empty() ) - { - HeaderEntryGetter headerget( _h, tag_r ); - - if ( headerget.val() ) - { - switch ( headerget.type() ) - { - case RPM_NULL_TYPE: - return lst_r.set( 0, 0 ); - case RPM_STRING_ARRAY_TYPE: - return lst_r.set( (char**)headerget.val(), headerget.cnt() ); - - default: - INT << "RPM_TAG MISSMATCH: RPM_STRING_ARRAY_TYPE " << tag_r << " got type " << headerget.type() << endl; - } - } - } - return lst_r.set( 0, 0 ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::int_val -// METHOD TYPE : int -// -// DESCRIPTION : -// -int BinHeader::int_val( tag tag_r ) const -{ - if ( !empty() ) - { - HeaderEntryGetter headerget( _h, tag_r ); - - if ( headerget.val() ) - { - switch ( headerget.type() ) - { - case RPM_NULL_TYPE: - return 0; -#if RPM_CHAR_TYPE != RPM_INT8_TYPE - case RPM_CHAR_TYPE: - return *((char*)headerget.val()); -#endif - case RPM_INT8_TYPE: - return *((int8_t*)headerget.val()); - case RPM_INT16_TYPE: - return *((int16_t*)headerget.val()); - case RPM_INT32_TYPE: - return *((int32_t*)headerget.val()); -#ifdef _RPM_4_X - case RPM_INT64_TYPE: - return *((int64_t*)headerget.val()); -#endif - - default: - INT << "RPM_TAG MISSMATCH: RPM_INTxx_TYPE " << tag_r << " got type " << headerget.type() << endl; - } - } - } - return 0; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::string_val -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string BinHeader::string_val( tag tag_r ) const -{ - if ( !empty() ) - { - HeaderEntryGetter headerget( _h, tag_r ); - - if ( headerget.val() ) - { - switch ( headerget.type() ) - { - case RPM_NULL_TYPE: - return ""; - case RPM_STRING_TYPE: - return (char*)headerget.val(); - - default: - INT << "RPM_TAG MISSMATCH: RPM_STRING_TYPE " << tag_r << " got type " << headerget.type() << endl; - } - } - } - return ""; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::stringList_val -// METHOD TYPE : std::list -// -// DESCRIPTION : -// -std::list BinHeader::stringList_val( tag tag_r ) const -{ - std::list ret; - - if ( !empty() ) - { - stringList lines; - unsigned count = string_list( tag_r, lines ); - for ( unsigned i = 0; i < count; ++i ) - { - ret.push_back( lines[i] ); - } - } - return ret; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : BinHeader::dumpOn -// METHOD TYPE : ostream & -// -// DESCRIPTION : -// -ostream & BinHeader::dumpOn( ostream & str ) const -{ - ReferenceCounted::dumpOn( str ); - return str << '{' << (void*)_h << '}'; -} - -} // namespace rpm -} // namespace target -} // namespace zypp diff --git a/libzypp/zypp/target/rpm/BinHeader.h b/libzypp/zypp/target/rpm/BinHeader.h deleted file mode 100644 index 1dc636c..0000000 --- a/libzypp/zypp/target/rpm/BinHeader.h +++ /dev/null @@ -1,168 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/BinHeader.h - * -*/ -#ifndef ZYPP_TARGET_RPM_BINHEADER_H -#define ZYPP_TARGET_RPM_BINHEADER_H - -extern "C" -{ -#include -} - -#include -#include -#include -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/target/rpm/librpm.h" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader -/** - * - **/ -class BinHeader : public base::ReferenceCounted, private base::NonCopyable -{ - -public: - - typedef intrusive_ptr Ptr; - - typedef intrusive_ptr constPtr; - - typedef rpmTag tag; - - class intList; - - class stringList; - -private: - - Header _h; - - bool assertHeader(); - -public: - - BinHeader( Header h_r = 0 ); - - /** - * Dangerous!<\B> This one takes the header out of rhs - * and leaves rhs empty. - **/ - BinHeader( BinHeader::Ptr & rhs ); - - virtual ~BinHeader(); - -public: - - bool empty() const - { - return( _h == NULL ); - } - - bool has_tag( tag tag_r ) const; - - unsigned int_list( tag tag_r, intList & lst_r ) const; - - unsigned string_list( tag tag_r, stringList & lst_r ) const; - - int int_val( tag tag_r ) const; - - std::string string_val( tag tag_r ) const; - -public: - - std::list stringList_val( tag tag_r ) const; - -public: - - virtual std::ostream & dumpOn( std::ostream & str ) const; -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader::intList -/** - * - **/ -class BinHeader::intList : private base::NonCopyable -{ - public: - intList() - : _type( RPM_NULL_TYPE ) - {} - - bool empty() const - { return _data.empty(); } - - unsigned size() const - { return _data.size(); } - - long operator[]( const unsigned idx_r ) const - { return idx_r < _data.size() ? _data[idx_r] : 0; } - - private: - friend class BinHeader; - unsigned set( void * val_r, unsigned cnt_r, rpmTagType type_r ); - - private: - std::vector _data; - rpmTagType _type; -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : BinHeader::stringList -/** - * - **/ -class BinHeader::stringList : private base::NonCopyable -{ - public: - bool empty() const - { return _data.empty(); } - - unsigned size() const - { return _data.size(); } - - std::string operator[]( const unsigned idx_r ) const - { return idx_r < _data.size() ? _data[idx_r] : std::string(); } - - private: - friend class BinHeader; - unsigned set( char ** val_r, unsigned cnt_r ); - - private: - std::vector _data; -}; - -/////////////////////////////////////////////////////////////////// - -} // namespace rpm -} // namespace target -} // namespace zypp - -#endif // ZYPP_TARGET_RPM_BINHEADER_H diff --git a/libzypp/zypp/target/rpm/RpmCallbacks.cc b/libzypp/zypp/target/rpm/RpmCallbacks.cc deleted file mode 100644 index 691ded3..0000000 --- a/libzypp/zypp/target/rpm/RpmCallbacks.cc +++ /dev/null @@ -1,17 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmCallbacks.cc - * -*/ - -#include - -#include "zypp/target/rpm/RpmCallbacks.h" - -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/rpm/RpmCallbacks.h b/libzypp/zypp/target/rpm/RpmCallbacks.h deleted file mode 100644 index 6fd0071..0000000 --- a/libzypp/zypp/target/rpm/RpmCallbacks.h +++ /dev/null @@ -1,109 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmCallbacks.h - * -*/ - -#ifndef ZYPP_TARGET_RPM_RPMCALLBACKS_H -#define ZYPP_TARGET_RPM_RPMCALLBACKS_H - -#include - -#include "zypp/Url.h" -#include "zypp/Callback.h" -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - -/////////////////////////////////////////////////////////////////// -// Reporting progress of package removing -/////////////////////////////////////////////////////////////////// -struct RpmRemoveReport : public callback::ReportBase -{ - - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore - }; - - /** Start the operation */ - virtual void start( const std::string & name ) - {} - /** - * Inform about progress - * Return true on abort - */ - virtual bool progress( unsigned percent ) - { return false; } - - virtual Action problem( Exception & excpt_r ) - { return ABORT; } - - /** Additional rpm output to be reported in \ref finish in case of success. */ - virtual void finishInfo( const std::string & info_r ) - {} - - /** Finish operation in case of success */ - virtual void finish() - {} - /** Finish operation in case of fail, report fail exception */ - virtual void finish( Exception & excpt_r ) - {} -}; - -/////////////////////////////////////////////////////////////////// -// Reporting progress of package installation -/////////////////////////////////////////////////////////////////// -struct RpmInstallReport : public callback::ReportBase -{ - - enum Action { - ABORT, // abort and return error - RETRY, // retry - IGNORE // ignore - }; - - /** Start the operation */ - virtual void start( const Pathname & name ) - {} - /** - * Inform about progress - * Return false on abort - */ - virtual bool progress( unsigned percent ) - { return true; } - - /** Additional rpm output to be reported in \ref finish in case of success. */ - virtual void finishInfo( const std::string & info_r ) - {} - - /** Finish operation in case of success */ - virtual void finish() - {} - - virtual Action problem( Exception & excpt_r ) - { return ABORT; } - - /** Finish operation in case of fail, report fail exception */ - virtual void finish( Exception & excpt_r ) - {} -}; - -} // namespace rpm -} // namespace target -} // namespace zypp - -#endif // ZYPP_TARGET_RPM_RPMCALLBACKS_H diff --git a/libzypp/zypp/target/rpm/RpmDb.cc b/libzypp/zypp/target/rpm/RpmDb.cc deleted file mode 100644 index 67b47e1..0000000 --- a/libzypp/zypp/target/rpm/RpmDb.cc +++ /dev/null @@ -1,2284 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmDb.cc - * -*/ -#include "librpm.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" - -#include "zypp/Date.h" -#include "zypp/Pathname.h" -#include "zypp/PathInfo.h" -#include "zypp/PublicKey.h" - -#include "zypp/target/rpm/RpmDb.h" -#include "zypp/target/rpm/RpmCallbacks.h" - -#include "zypp/HistoryLog.h" -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/rpm/RpmException.h" -#include "zypp/TmpPath.h" -#include "zypp/KeyRing.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ZConfig.h" - -using namespace std; -using namespace zypp::filesystem; - -#define WARNINGMAILPATH "/var/log/YaST2/" -#define FILEFORBACKUPFILES "YaSTBackupModifiedFiles" -#define MAXRPMMESSAGELINES 10000 - -#define WORKAROUNDRPMPWDBUG - -namespace zypp -{ - namespace zypp_readonly_hack - { - bool IGotIt(); // in readonly-mode - } -namespace target -{ -namespace rpm -{ -namespace -{ -#if 1 // No more need to escape whitespace since rpm-4.4.2.3 -const char* quoteInFilename_m = "\'\""; -#else -const char* quoteInFilename_m = " \t\'\""; -#endif -inline string rpmQuoteFilename( const Pathname & path_r ) -{ - string path( path_r.asString() ); - for ( string::size_type pos = path.find_first_of( quoteInFilename_m ); - pos != string::npos; - pos = path.find_first_of( quoteInFilename_m, pos ) ) - { - path.insert( pos, "\\" ); - pos += 2; // skip '\\' and the quoted char. - } - return path; -} - - - /** Workaround bnc#827609 - rpm needs a readable pwd so we - * chdir to /. Turn realtive pathnames into absolute ones - * by prepending cwd so rpm still finds them - */ - inline Pathname workaroundRpmPwdBug( Pathname path_r ) - { -#if defined(WORKAROUNDRPMPWDBUG) - if ( path_r.relative() ) - { - // try to prepend cwd - AutoDispose cwd( ::get_current_dir_name(), ::free ); - if ( cwd ) - return Pathname( cwd ) / path_r; - WAR << "Can't get cwd!" << endl; - } -#endif - return path_r; // no problem with absolute pathnames - } -} - -struct KeyRingSignalReceiver : callback::ReceiveReport -{ - KeyRingSignalReceiver(RpmDb &rpmdb) : _rpmdb(rpmdb) - { - connect(); - } - - ~KeyRingSignalReceiver() - { - disconnect(); - } - - virtual void trustedKeyAdded( const PublicKey &key ) - { - MIL << "trusted key added to zypp Keyring. Importing" << endl; - // now import the key in rpm - try - { - _rpmdb.importPubkey( key ); - } - catch (RpmException &e) - { - ERR << "Could not import key " << key.id() << " (" << key.name() << " from " << key.path() << " in rpm database" << endl; - } - } - - virtual void trustedKeyRemoved( const PublicKey &key ) - { - MIL << "Trusted key removed from zypp Keyring. Removing..." << endl; - - // remove the key from rpm - try - { - _rpmdb.removePubkey( key ); - } - catch (RpmException &e) - { - ERR << "Could not remove key " << key.id() << " (" << key.name() << ") from rpm database" << endl; - } - } - - RpmDb &_rpmdb; -}; - -static shared_ptr sKeyRingReceiver; - -unsigned diffFiles(const string file1, const string file2, string& out, int maxlines) -{ - const char* argv[] = - { - "diff", - "-u", - file1.c_str(), - file2.c_str(), - NULL - }; - ExternalProgram prog(argv,ExternalProgram::Discard_Stderr, false, -1, true); - - //if(!prog) - //return 2; - - string line; - int count = 0; - for (line = prog.receiveLine(), count=0; - !line.empty(); - line = prog.receiveLine(), count++ ) - { - if (maxlines<0?true:countempty(); - if ( dbEmpty ) - { - MIL << "Empty rpm4 database " << dbInfo.dbV4() << endl; - } - - if ( dbInfo.hasDbV3() ) - { - MIL << "Found rpm3 database " << dbInfo.dbV3() << endl; - - if ( dbEmpty ) - { - extern void convertV3toV4( const Pathname & v3db_r, const librpmDb::constPtr & v4db_r ); - convertV3toV4( dbInfo.dbV3().path(), dbptr ); - - // create a backup copy - int res = filesystem::copy( dbInfo.dbV3().path(), dbInfo.dbV3ToV4().path() ); - if ( res ) - { - WAR << "Backup converted rpm3 database failed: error(" << res << ")" << endl; - } - else - { - dbInfo.restat(); - if ( dbInfo.hasDbV3ToV4() ) - { - MIL << "Backup converted rpm3 database: " << dbInfo.dbV3ToV4() << endl; - dbsi_set( info_r, DbSI_HAVE_V3TOV4 | DbSI_MADE_V3TOV4 ); - } - } - - } - else - { - - WAR << "Non empty rpm3 and rpm4 database found: using rpm4" << endl; - // set DbSI_MODIFIED_V4 as it's not a temporary which can be removed. - dbsi_set( info_r, DbSI_MODIFIED_V4 ); - - } - - DBG << "Convert state: " << info_r << ": " << stringPath( root_r, dbPath_r ); - librpmDb::dumpState( DBG ) << endl; - } - - if ( dbInfo.hasDbV3ToV4() ) - { - MIL << "Rpm3 database backup: " << dbInfo.dbV3ToV4() << endl; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::removeV4 -// METHOD TYPE : void -// -void RpmDb::removeV4( const Pathname & dbdir_r, bool v3backup_r ) -{ - const char * v3backup = "packages.rpm3"; - const char * master = "Packages"; - const char * index[] = - { - "Basenames", - "Conflictname", - "Depends", - "Dirnames", - "Filemd5s", - "Group", - "Installtid", - "Name", - "Providename", - "Provideversion", - "Pubkeys", - "Requirename", - "Requireversion", - "Sha1header", - "Sigmd5", - "Triggername", - // last entry! - NULL - }; - - PathInfo pi( dbdir_r ); - if ( ! pi.isDir() ) - { - ERR << "Can't remove rpm4 database in non directory: " << dbdir_r << endl; - return; - } - - for ( const char ** f = index; *f; ++f ) - { - pi( dbdir_r + *f ); - if ( pi.isFile() ) - { - filesystem::unlink( pi.path() ); - } - } - - pi( dbdir_r + master ); - if ( pi.isFile() ) - { - MIL << "Removing rpm4 database " << pi << endl; - filesystem::unlink( pi.path() ); - } - - if ( v3backup_r ) - { - pi( dbdir_r + v3backup ); - if ( pi.isFile() ) - { - MIL << "Removing converted rpm3 database backup " << pi << endl; - filesystem::unlink( pi.path() ); - } - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::removeV3 -// METHOD TYPE : void -// -void RpmDb::removeV3( const Pathname & dbdir_r, bool v3backup_r ) -{ - const char * master = "packages.rpm"; - const char * index[] = - { - "conflictsindex.rpm", - "fileindex.rpm", - "groupindex.rpm", - "nameindex.rpm", - "providesindex.rpm", - "requiredby.rpm", - "triggerindex.rpm", - // last entry! - NULL - }; - - PathInfo pi( dbdir_r ); - if ( ! pi.isDir() ) - { - ERR << "Can't remove rpm3 database in non directory: " << dbdir_r << endl; - return; - } - - for ( const char ** f = index; *f; ++f ) - { - pi( dbdir_r + *f ); - if ( pi.isFile() ) - { - filesystem::unlink( pi.path() ); - } - } - -#warning CHECK: compare vs existing v3 backup. notify root - pi( dbdir_r + master ); - if ( pi.isFile() ) - { - Pathname m( pi.path() ); - if ( v3backup_r ) - { - // backup was already created - filesystem::unlink( m ); - Pathname b( m.extend( "3" ) ); - pi( b ); // stat backup - } - else - { - Pathname b( m.extend( ".deleted" ) ); - pi( b ); - if ( pi.isFile() ) - { - // rempve existing backup - filesystem::unlink( b ); - } - filesystem::rename( m, b ); - pi( b ); // stat backup - } - MIL << "(Re)moved rpm3 database to " << pi << endl; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::modifyDatabase -// METHOD TYPE : void -// -void RpmDb::modifyDatabase() -{ - if ( ! initialized() ) - return; - - // tag database as modified - dbsi_set( _dbStateInfo, DbSI_MODIFIED_V4 ); - - // Move outdated rpm3 database beside. - if ( dbsi_has( _dbStateInfo, DbSI_HAVE_V3 ) ) - { - MIL << "Update mode: Delayed cleanup: state " << _dbStateInfo << endl; - removeV3( _root + _dbPath, dbsi_has( _dbStateInfo, DbSI_MADE_V3TOV4 ) ); - dbsi_clr( _dbStateInfo, DbSI_HAVE_V3 ); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::closeDatabase -// METHOD TYPE : PMError -// -void RpmDb::closeDatabase() -{ - if ( ! initialized() ) - { - return; - } - - MIL << "Calling closeDatabase: " << *this << endl; - - /////////////////////////////////////////////////////////////////// - // Block further database access - /////////////////////////////////////////////////////////////////// - librpmDb::blockAccess(); - - /////////////////////////////////////////////////////////////////// - // Check fate if old version database still present - /////////////////////////////////////////////////////////////////// - if ( dbsi_has( _dbStateInfo, DbSI_HAVE_V3 ) ) - { - MIL << "Update mode: Delayed cleanup: state " << _dbStateInfo << endl; - if ( dbsi_has( _dbStateInfo, DbSI_MODIFIED_V4 ) ) - { - // Move outdated rpm3 database beside. - removeV3( _root + _dbPath, dbsi_has( _dbStateInfo, DbSI_MADE_V3TOV4 ) ); - } - else - { - // Remove unmodified rpm4 database - removeV4( _root + _dbPath, dbsi_has( _dbStateInfo, DbSI_MADE_V3TOV4 ) ); - } - } - - /////////////////////////////////////////////////////////////////// - // Uninit - /////////////////////////////////////////////////////////////////// - _root = _dbPath = Pathname(); - _dbStateInfo = DbSI_NO_INIT; - - MIL << "closeDatabase: " << *this << endl; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::rebuildDatabase -// METHOD TYPE : PMError -// -void RpmDb::rebuildDatabase() -{ - callback::SendReport report; - - report->start( root() + dbPath() ); - - try - { - doRebuildDatabase(report); - } - catch (RpmException & excpt_r) - { - report->finish(root() + dbPath(), RebuildDBReport::FAILED, excpt_r.asUserHistory()); - ZYPP_RETHROW(excpt_r); - } - report->finish(root() + dbPath(), RebuildDBReport::NO_ERROR, ""); -} - -void RpmDb::doRebuildDatabase(callback::SendReport & report) -{ - FAILIFNOTINITIALIZED; - - MIL << "RpmDb::rebuildDatabase" << *this << endl; - // FIXME Timecount _t( "RpmDb::rebuildDatabase" ); - - PathInfo dbMaster( root() + dbPath() + "Packages" ); - PathInfo dbMasterBackup( dbMaster.path().extend( ".y2backup" ) ); - - // run rpm - RpmArgVec opts; - opts.push_back("--rebuilddb"); - opts.push_back("-vv"); - - // don't call modifyDatabase because it would remove the old - // rpm3 database, if the current database is a temporary one. - run_rpm (opts, ExternalProgram::Stderr_To_Stdout); - - // progress report: watch this file growing - PathInfo newMaster( root() - + dbPath().extend( str::form( "rebuilddb.%d", - process?process->getpid():0) ) - + "Packages" ); - - string line; - string errmsg; - - while ( systemReadLine( line ) ) - { - if ( newMaster() ) - { // file is removed at the end of rebuild. - // current size should be upper limit for new db - if ( ! report->progress( (100 * newMaster.size()) / dbMaster.size(), root() + dbPath()) ) - { - WAR << "User requested abort." << endl; - systemKill(); - filesystem::recursive_rmdir( newMaster.path().dirname() ); - } - } - - if ( line.compare( 0, 2, "D:" ) ) - { - errmsg += line + '\n'; - // report.notify( line ); - WAR << line << endl; - } - } - - int rpm_status = systemStatus(); - - if ( rpm_status != 0 ) - { - //TranslatorExplanation after semicolon is error message - ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ") + - (errmsg.empty() ? error_message: errmsg)))); - } - else - { - report->progress( 100, root() + dbPath() ); // 100% - } -} - -/////////////////////////////////////////////////////////////////// -namespace -{ - /** \ref RpmDb::syncTrustedKeys helper - * Compute which keys need to be exprted to / imported from the zypp keyring. - * Return result via argument list. - */ - void computeKeyRingSync( std::set & rpmKeys_r, std::list & zyppKeys_r ) - { - /////////////////////////////////////////////////////////////////// - // Remember latest release and where it ocurred - struct Key - { - Key() - : _inRpmKeys( nullptr ) - , _inZyppKeys( nullptr ) - {} - - void updateIf( const Edition & rpmKey_r ) - { - std::string keyRelease( rpmKey_r.release() ); - int comp = _release.compare( keyRelease ); - if ( comp < 0 ) - { - // update to newer release - _release.swap( keyRelease ); - _inRpmKeys = &rpmKey_r; - _inZyppKeys = nullptr; - if ( !keyRelease.empty() ) - DBG << "Old key in R: gpg-pubkey-" << rpmKey_r.version() << "-" << keyRelease << endl; - } - else if ( comp == 0 ) - { - // stay with this release - if ( ! _inRpmKeys ) - _inRpmKeys = &rpmKey_r; - } - // else: this is an old release - else - DBG << "Old key in R: gpg-pubkey-" << rpmKey_r.version() << "-" << keyRelease << endl; - } - - void updateIf( const PublicKeyData & zyppKey_r ) - { - std::string keyRelease( zyppKey_r.gpgPubkeyRelease() ); - int comp = _release.compare( keyRelease ); - if ( comp < 0 ) - { - // update to newer release - _release.swap( keyRelease ); - _inRpmKeys = nullptr; - _inZyppKeys = &zyppKey_r; - if ( !keyRelease.empty() ) - DBG << "Old key in Z: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl; - } - else if ( comp == 0 ) - { - // stay with this release - if ( ! _inZyppKeys ) - _inZyppKeys = &zyppKey_r; - } - // else: this is an old release - else - DBG << "Old key in Z: gpg-pubkey-" << zyppKey_r.gpgPubkeyVersion() << "-" << keyRelease << endl; - } - - std::string _release; - const Edition * _inRpmKeys; - const PublicKeyData * _inZyppKeys; - }; - /////////////////////////////////////////////////////////////////// - - // collect keys by ID(version) and latest creation(release) - std::map _keymap; - - for_( it, rpmKeys_r.begin(), rpmKeys_r.end() ) - { - _keymap[(*it).version()].updateIf( *it ); - } - - for_( it, zyppKeys_r.begin(), zyppKeys_r.end() ) - { - _keymap[(*it).gpgPubkeyVersion()].updateIf( *it ); - } - - // compute missing keys - std::set rpmKeys; - std::list zyppKeys; - for_( it, _keymap.begin(), _keymap.end() ) - { - DBG << "gpg-pubkey-" << (*it).first << "-" << (*it).second._release << " " - << ( (*it).second._inRpmKeys ? "R" : "_" ) - << ( (*it).second._inZyppKeys ? "Z" : "_" ) << endl; - if ( ! (*it).second._inRpmKeys ) - { - zyppKeys.push_back( *(*it).second._inZyppKeys ); - } - if ( ! (*it).second._inZyppKeys ) - { - rpmKeys.insert( *(*it).second._inRpmKeys ); - } - } - rpmKeys_r.swap( rpmKeys ); - zyppKeys_r.swap( zyppKeys ); - } -} // namespace -/////////////////////////////////////////////////////////////////// - -void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r ) -{ - MIL << "Going to sync trusted keys..." << endl; - std::set rpmKeys( pubkeyEditions() ); - std::list zyppKeys( getZYpp()->keyRing()->trustedPublicKeyData() ); - computeKeyRingSync( rpmKeys, zyppKeys ); - MIL << (mode_r & SYNC_TO_KEYRING ? "" : "(skip) ") << "Rpm keys to export into zypp trusted keyring: " << rpmKeys.size() << endl; - MIL << (mode_r & SYNC_FROM_KEYRING ? "" : "(skip) ") << "Zypp trusted keys to import into rpm database: " << zyppKeys.size() << endl; - - /////////////////////////////////////////////////////////////////// - if ( (mode_r & SYNC_TO_KEYRING) && ! rpmKeys.empty() ) - { - // export to zypp keyring - MIL << "Exporting rpm keyring into zypp trusted keyring" < tempDisconnect; - librpmDb::db_const_iterator keepDbOpen; // just to keep a ref. - - TmpFile tmpfile( getZYpp()->tmpPath() ); - { - ofstream tmpos( tmpfile.path().c_str() ); - for_( it, rpmKeys.begin(), rpmKeys.end() ) - { - // we export the rpm key into a file - RpmHeader::constPtr result; - getData( string("gpg-pubkey"), *it, result ); - tmpos << result->tag_description() << endl; - } - } - try - { - getZYpp()->keyRing()->multiKeyImport( tmpfile.path(), true /*trusted*/); - } - catch (Exception &e) - { - ERR << "Could not import keys into in zypp keyring" << endl; - } - } - - /////////////////////////////////////////////////////////////////// - if ( (mode_r & SYNC_FROM_KEYRING) && ! zyppKeys.empty() ) - { - // import from zypp keyring - MIL << "Importing zypp trusted keyring" << std::endl; - for_( it, zyppKeys.begin(), zyppKeys.end() ) - { - try - { - importPubkey( getZYpp()->keyRing()->exportTrustedPublicKey( *it ) ); - } - catch ( const RpmException & exp ) - { - ZYPP_CAUGHT( exp ); - } - } - } - MIL << "Trusted keys synced." << endl; -} - -void RpmDb::importZyppKeyRingTrustedKeys() -{ syncTrustedKeys( SYNC_FROM_KEYRING ); } - -void RpmDb::exportTrustedKeysInZyppKeyRing() -{ syncTrustedKeys( SYNC_TO_KEYRING ); } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::importPubkey -// METHOD TYPE : PMError -// -void RpmDb::importPubkey( const PublicKey & pubkey_r ) -{ - FAILIFNOTINITIALIZED; - - // bnc#828672: On the fly key import in READONLY - if ( zypp_readonly_hack::IGotIt() ) - { - WAR << "Key " << pubkey_r << " can not be imported. (READONLY MODE)" << endl; - return; - } - - // check if the key is already in the rpm database - Edition keyEd( pubkey_r.gpgPubkeyVersion(), pubkey_r.gpgPubkeyRelease() ); - set rpmKeys = pubkeyEditions(); - bool hasOldkeys = false; - - for_( it, rpmKeys.begin(), rpmKeys.end() ) - { - if ( keyEd == *it ) // quick test (Edition is IdStringType!) - { - MIL << "Key " << pubkey_r << " is already in the rpm trusted keyring. (skip import)" << endl; - return; - } - - if ( keyEd.version() != (*it).version() ) - continue; // different key ID (version) - - if ( keyEd.release() < (*it).release() ) - { - MIL << "Key " << pubkey_r << " is older than one in the rpm trusted keyring. (skip import)" << endl; - return; - } - else - { - hasOldkeys = true; - } - } - MIL << "Key " << pubkey_r << " will be imported into the rpm trusted keyring." << (hasOldkeys?"(update)":"(new)") << endl; - - if ( hasOldkeys ) - { - // We must explicitly delete old key IDs first (all releases, - // that's why we don't call removePubkey here). - std::string keyName( "gpg-pubkey-" + keyEd.version() ); - RpmArgVec opts; - opts.push_back ( "-e" ); - opts.push_back ( "--allmatches" ); - opts.push_back ( "--" ); - opts.push_back ( keyName.c_str() ); - // don't call modifyDatabase because it would remove the old - // rpm3 database, if the current database is a temporary one. - run_rpm( opts, ExternalProgram::Stderr_To_Stdout ); - - string line; - while ( systemReadLine( line ) ) - { - ( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl; - } - - if ( systemStatus() != 0 ) - { - ERR << "Failed to remove key " << pubkey_r << " from RPM trusted keyring (ignored)" << endl; - } - else - { - MIL << "Key " << pubkey_r << " has been removed from RPM trusted keyring" << endl; - } - } - - // import the new key - RpmArgVec opts; - opts.push_back ( "--import" ); - opts.push_back ( "--" ); - opts.push_back ( pubkey_r.path().asString().c_str() ); - - // don't call modifyDatabase because it would remove the old - // rpm3 database, if the current database is a temporary one. - run_rpm( opts, ExternalProgram::Stderr_To_Stdout ); - - string line; - while ( systemReadLine( line ) ) - { - ( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl; - } - - if ( systemStatus() != 0 ) - { - //TranslatorExplanation first %s is file name, second is error message - ZYPP_THROW(RpmSubprocessException(boost::str(boost::format( - _("Failed to import public key from file %s: %s")) - % pubkey_r.asString() % error_message))); - } - else - { - MIL << "Key " << pubkey_r << " imported in rpm trusted keyring." << endl; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::removePubkey -// METHOD TYPE : PMError -// -void RpmDb::removePubkey( const PublicKey & pubkey_r ) -{ - FAILIFNOTINITIALIZED; - - // check if the key is in the rpm database and just - // return if it does not. - set rpm_keys = pubkeyEditions(); - set::const_iterator found_edition = rpm_keys.end(); - std::string pubkeyVersion( pubkey_r.gpgPubkeyVersion() ); - - for_( it, rpm_keys.begin(), rpm_keys.end() ) - { - if ( (*it).version() == pubkeyVersion ) - { - found_edition = it; - break; - } - } - - // the key does not exist, cannot be removed - if (found_edition == rpm_keys.end()) - { - WAR << "Key " << pubkey_r.id() << " is not in rpm db" << endl; - return; - } - - string rpm_name("gpg-pubkey-" + found_edition->asString()); - - RpmArgVec opts; - opts.push_back ( "-e" ); - opts.push_back ( "--" ); - opts.push_back ( rpm_name.c_str() ); - - // don't call modifyDatabase because it would remove the old - // rpm3 database, if the current database is a temporary one. - run_rpm( opts, ExternalProgram::Stderr_To_Stdout ); - - string line; - while ( systemReadLine( line ) ) - { - if ( line.substr( 0, 6 ) == "error:" ) - { - WAR << line << endl; - } - else - { - DBG << line << endl; - } - } - - int rpm_status = systemStatus(); - - if ( rpm_status != 0 ) - { - //TranslatorExplanation first %s is key name, second is error message - ZYPP_THROW(RpmSubprocessException(boost::str(boost::format( - _("Failed to remove public key %s: %s")) % pubkey_r.asString() - % error_message))); - } - else - { - MIL << "Key " << pubkey_r << " has been removed from RPM trusted keyring" << endl; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::pubkeys -// METHOD TYPE : set -// -list RpmDb::pubkeys() const -{ - list ret; - - librpmDb::db_const_iterator it; - for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it ) - { - Edition edition = it->tag_edition(); - if (edition != Edition::noedition) - { - // we export the rpm key into a file - RpmHeader::constPtr result; - getData( string("gpg-pubkey"), edition, result ); - TmpFile file(getZYpp()->tmpPath()); - ofstream os; - try - { - os.open(file.path().asString().c_str()); - // dump rpm key into the tmp file - os << result->tag_description(); - //MIL << "-----------------------------------------------" << endl; - //MIL << result->tag_description() < RpmDb::pubkeyEditions() const - { - set ret; - - librpmDb::db_const_iterator it; - for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it ) - { - Edition edition = it->tag_edition(); - if (edition != Edition::noedition) - ret.insert( edition ); - } - return ret; - } - - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::fileList -// METHOD TYPE : bool -// -// DESCRIPTION : -// -list -RpmDb::fileList( const string & name_r, const Edition & edition_r ) const -{ - list result; - - librpmDb::db_const_iterator it; - bool found; - if (edition_r == Edition::noedition) - { - found = it.findPackage( name_r ); - } - else - { - found = it.findPackage( name_r, edition_r ); - } - if (!found) - return result; - - return result; -} - - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasFile -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasFile( const string & file_r, const string & name_r ) const -{ - librpmDb::db_const_iterator it; - bool res; - do - { - res = it.findByFile( file_r ); - if (!res) break; - if (!name_r.empty()) - { - res = (it->tag_name() == name_r); - } - ++it; - } - while (res && *it); - return res; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::whoOwnsFile -// METHOD TYPE : string -// -// DESCRIPTION : -// -string RpmDb::whoOwnsFile( const string & file_r) const -{ - librpmDb::db_const_iterator it; - if (it.findByFile( file_r )) - { - return it->tag_name(); - } - return ""; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasProvides -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasProvides( const string & tag_r ) const -{ - librpmDb::db_const_iterator it; - return it.findByProvides( tag_r ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasRequiredBy -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasRequiredBy( const string & tag_r ) const -{ - librpmDb::db_const_iterator it; - return it.findByRequiredBy( tag_r ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasConflicts -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasConflicts( const string & tag_r ) const -{ - librpmDb::db_const_iterator it; - return it.findByConflicts( tag_r ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasPackage -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasPackage( const string & name_r ) const -{ - librpmDb::db_const_iterator it; - return it.findPackage( name_r ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::hasPackage -// METHOD TYPE : bool -// -// DESCRIPTION : -// -bool RpmDb::hasPackage( const string & name_r, const Edition & ed_r ) const -{ - librpmDb::db_const_iterator it; - return it.findPackage( name_r, ed_r ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::getData -// METHOD TYPE : PMError -// -// DESCRIPTION : -// -void RpmDb::getData( const string & name_r, - RpmHeader::constPtr & result_r ) const -{ - librpmDb::db_const_iterator it; - it.findPackage( name_r ); - result_r = *it; - if (it.dbError()) - ZYPP_THROW(*(it.dbError())); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::getData -// METHOD TYPE : void -// -// DESCRIPTION : -// -void RpmDb::getData( const string & name_r, const Edition & ed_r, - RpmHeader::constPtr & result_r ) const -{ - librpmDb::db_const_iterator it; - it.findPackage( name_r, ed_r ); - result_r = *it; - if (it.dbError()) - ZYPP_THROW(*(it.dbError())); -} - -/////////////////////////////////////////////////////////////////// -// -// METHOD NAME : RpmDb::checkPackage -// METHOD TYPE : RpmDb::checkPackageResult -// -RpmDb::checkPackageResult RpmDb::checkPackage( const Pathname & path_r ) -{ - PathInfo file( path_r ); - if ( ! file.isFile() ) - { - ERR << "Not a file: " << file << endl; - return CHK_ERROR; - } - - FD_t fd = ::Fopen( file.asString().c_str(), "r.ufdio" ); - if ( fd == 0 || ::Ferror(fd) ) - { - ERR << "Can't open file for reading: " << file << " (" << ::Fstrerror(fd) << ")" << endl; - if ( fd ) - ::Fclose( fd ); - return CHK_ERROR; - } - - rpmts ts = ::rpmtsCreate(); - ::rpmtsSetRootDir( ts, root().asString().c_str() ); - ::rpmtsSetVSFlags( ts, RPMVSF_DEFAULT ); - int res = ::rpmReadPackageFile( ts, fd, path_r.asString().c_str(), NULL ); - ts = rpmtsFree(ts); - - ::Fclose( fd ); - - switch ( res ) - { - case RPMRC_OK: - return CHK_OK; - break; - case RPMRC_NOTFOUND: - WAR << "Signature is unknown type. " << file << endl; - return CHK_NOTFOUND; - break; - case RPMRC_FAIL: - WAR << "Signature does not verify. " << file << endl; - return CHK_FAIL; - break; - case RPMRC_NOTTRUSTED: - WAR << "Signature is OK, but key is not trusted. " << file << endl; - return CHK_NOTTRUSTED; - break; - case RPMRC_NOKEY: - WAR << "Public key is unavailable. " << file << endl; - return CHK_NOKEY; - break; - } - ERR << "Error reading header." << file << endl; - return CHK_ERROR; -} - -// determine changed files of installed package -bool -RpmDb::queryChangedFiles(FileList & fileList, const string& packageName) -{ - bool ok = true; - - fileList.clear(); - - if ( ! initialized() ) return false; - - RpmArgVec opts; - - opts.push_back ("-V"); - opts.push_back ("--nodeps"); - opts.push_back ("--noscripts"); - opts.push_back ("--nomd5"); - opts.push_back ("--"); - opts.push_back (packageName.c_str()); - - run_rpm (opts, ExternalProgram::Discard_Stderr); - - if ( process == NULL ) - return false; - - /* from rpm manpage - 5 MD5 sum - S File size - L Symlink - T Mtime - D Device - U User - G Group - M Mode (includes permissions and file type) - */ - - string line; - while (systemReadLine(line)) - { - if (line.length() > 12 && - (line[0] == 'S' || line[0] == 's' || - (line[0] == '.' && line[7] == 'T'))) - { - // file has been changed - string filename; - - filename.assign(line, 11, line.length() - 11); - fileList.insert(filename); - } - } - - systemStatus(); - // exit code ignored, rpm returns 1 no matter if package is installed or - // not - - return ok; -} - - - -/****************************************************************/ -/* private member-functions */ -/****************************************************************/ - -/*--------------------------------------------------------------*/ -/* Run rpm with the specified arguments, handling stderr */ -/* as specified by disp */ -/*--------------------------------------------------------------*/ -void -RpmDb::run_rpm (const RpmArgVec& opts, - ExternalProgram::Stderr_Disposition disp) -{ - if ( process ) - { - delete process; - process = NULL; - } - exit_code = -1; - - if ( ! initialized() ) - { - ZYPP_THROW(RpmDbNotOpenException()); - } - - RpmArgVec args; - - // always set root and dbpath -#if defined(WORKAROUNDRPMPWDBUG) - args.push_back("#/"); // chdir to / to workaround bnc#819354 -#endif - args.push_back("rpm"); - args.push_back("--root"); - args.push_back(_root.asString().c_str()); - args.push_back("--dbpath"); - args.push_back(_dbPath.asString().c_str()); - - const char* argv[args.size() + opts.size() + 1]; - - const char** p = argv; - p = copy (args.begin (), args.end (), p); - p = copy (opts.begin (), opts.end (), p); - *p = 0; - - // Invalidate all outstanding database handles in case - // the database gets modified. - librpmDb::dbRelease( true ); - - // Launch the program with default locale - process = new ExternalProgram(argv, disp, false, -1, true); - return; -} - -/*--------------------------------------------------------------*/ -/* Read a line from the rpm process */ -/*--------------------------------------------------------------*/ -bool RpmDb::systemReadLine( string & line ) -{ - line.erase(); - - if ( process == NULL ) - return false; - - if ( process->inputFile() ) - { - process->setBlocking( false ); - FILE * inputfile = process->inputFile(); - int inputfileFd = ::fileno( inputfile ); - do - { - /* Watch inputFile to see when it has input. */ - fd_set rfds; - FD_ZERO( &rfds ); - FD_SET( inputfileFd, &rfds ); - - /* Wait up to 5 seconds. */ - struct timeval tv; - tv.tv_sec = 5; - tv.tv_usec = 0; - - int retval = select( inputfileFd+1, &rfds, NULL, NULL, &tv ); - - if ( retval == -1 ) - { - ERR << "select error: " << strerror(errno) << endl; - if ( errno != EINTR ) - return false; - } - else if ( retval ) - { - // Data is available now. - static size_t linebuffer_size = 0; // static because getline allocs - static char * linebuffer = 0; // and reallocs if buffer is too small - ssize_t nread = getline( &linebuffer, &linebuffer_size, inputfile ); - if ( nread == -1 ) - { - if ( ::feof( inputfile ) ) - return line.size(); // in case of pending output - } - else - { - if ( nread > 0 ) - { - if ( linebuffer[nread-1] == '\n' ) - --nread; - line += string( linebuffer, nread ); - } - - if ( ! ::ferror( inputfile ) || ::feof( inputfile ) ) - return true; // complete line - } - clearerr( inputfile ); - } - else - { - // No data within time. - if ( ! process->running() ) - return false; - } - } while ( true ); - } - - return false; -} - -/*--------------------------------------------------------------*/ -/* Return the exit status of the rpm process, closing the */ -/* connection if not already done */ -/*--------------------------------------------------------------*/ -int -RpmDb::systemStatus() -{ - if ( process == NULL ) - return -1; - - exit_code = process->close(); - if (exit_code == 0) - error_message = ""; - else - error_message = process->execError(); - process->kill(); - delete process; - process = 0; - - // DBG << "exit code " << exit_code << endl; - - return exit_code; -} - -/*--------------------------------------------------------------*/ -/* Forcably kill the rpm process */ -/*--------------------------------------------------------------*/ -void -RpmDb::systemKill() -{ - if (process) process->kill(); -} - - -// generate diff mails for config files -void RpmDb::processConfigFiles(const string& line, const string& name, const char* typemsg, const char* difffailmsg, const char* diffgenmsg) -{ - string msg = line.substr(9); - string::size_type pos1 = string::npos; - string::size_type pos2 = string::npos; - string file1s, file2s; - Pathname file1; - Pathname file2; - - pos1 = msg.find (typemsg); - for (;;) - { - if ( pos1 == string::npos ) - break; - - pos2 = pos1 + strlen (typemsg); - - if (pos2 >= msg.length() ) - break; - - file1 = msg.substr (0, pos1); - file2 = msg.substr (pos2); - - file1s = file1.asString(); - file2s = file2.asString(); - - if (!_root.empty() && _root != "/") - { - file1 = _root + file1; - file2 = _root + file2; - } - - string out; - int ret = diffFiles (file1.asString(), file2.asString(), out, 25); - if (ret) - { - Pathname file = _root + WARNINGMAILPATH; - if (filesystem::assert_dir(file) != 0) - { - ERR << "Could not create " << file.asString() << endl; - break; - } - file += Date(Date::now()).form("config_diff_%Y_%m_%d.log"); - ofstream notify(file.asString().c_str(), ios::out|ios::app); - if (!notify) - { - ERR << "Could not open " << file << endl; - break; - } - - // Translator: %s = name of an rpm package. A list of diffs follows - // this message. - notify << str::form(_("Changed configuration files for %s:"), name.c_str()) << endl; - if (ret>1) - { - ERR << "diff failed" << endl; - notify << str::form(difffailmsg, - file1s.c_str(), file2s.c_str()) << endl; - } - else - { - notify << str::form(diffgenmsg, - file1s.c_str(), file2s.c_str()) << endl; - - // remove root for the viewer's pleasure (#38240) - if (!_root.empty() && _root != "/") - { - if (out.substr(0,4) == "--- ") - { - out.replace(4, file1.asString().length(), file1s); - } - string::size_type pos = out.find("\n+++ "); - if (pos != string::npos) - { - out.replace(pos+5, file2.asString().length(), file2s); - } - } - notify << out << endl; - } - notify.close(); - notify.open("/var/lib/update-messages/yast2-packagemanager.rpmdb.configfiles"); - notify.close(); - } - else - { - WAR << "rpm created " << file2 << " but it is not different from " << file2 << endl; - } - break; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::installPackage -// METHOD TYPE : PMError -// -void RpmDb::installPackage( const Pathname & filename, RpmInstFlags flags ) -{ - callback::SendReport report; - - report->start(filename); - - do - try - { - doInstallPackage(filename, flags, report); - report->finish(); - break; - } - catch (RpmException & excpt_r) - { - RpmInstallReport::Action user = report->problem( excpt_r ); - - if ( user == RpmInstallReport::ABORT ) - { - report->finish( excpt_r ); - ZYPP_RETHROW(excpt_r); - } - else if ( user == RpmInstallReport::IGNORE ) - { - break; - } - } - while (true); -} - -void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, callback::SendReport & report ) -{ - FAILIFNOTINITIALIZED; - HistoryLog historylog; - - MIL << "RpmDb::installPackage(" << filename << "," << flags << ")" << endl; - - - // backup - if ( _packagebackups ) - { - // FIXME report->progress( pd.init( -2, 100 ) ); // allow 1% for backup creation. - if ( ! backupPackage( filename ) ) - { - ERR << "backup of " << filename.asString() << " failed" << endl; - } - // FIXME status handling - report->progress( 0 ); // allow 1% for backup creation. - } - - // run rpm - RpmArgVec opts; - if (flags & RPMINST_NOUPGRADE) - opts.push_back("-i"); - else - opts.push_back("-U"); - - opts.push_back("--percent"); - opts.push_back("--noglob"); - - // ZConfig defines cross-arch installation - if ( ! ZConfig::instance().systemArchitecture().compatibleWith( ZConfig::instance().defaultSystemArchitecture() ) ) - opts.push_back("--ignorearch"); - - if (flags & RPMINST_NODIGEST) - opts.push_back("--nodigest"); - if (flags & RPMINST_NOSIGNATURE) - opts.push_back("--nosignature"); - if (flags & RPMINST_EXCLUDEDOCS) - opts.push_back ("--excludedocs"); - if (flags & RPMINST_NOSCRIPTS) - opts.push_back ("--noscripts"); - if (flags & RPMINST_FORCE) - opts.push_back ("--force"); - if (flags & RPMINST_NODEPS) - opts.push_back ("--nodeps"); - if (flags & RPMINST_IGNORESIZE) - opts.push_back ("--ignoresize"); - if (flags & RPMINST_JUSTDB) - opts.push_back ("--justdb"); - if (flags & RPMINST_TEST) - opts.push_back ("--test"); - if (flags & RPMINST_NOPOSTTRANS) - opts.push_back ("--noposttrans"); - - opts.push_back("--"); - - // rpm requires additional quoting of special chars: - string quotedFilename( rpmQuoteFilename( workaroundRpmPwdBug( filename ) ) ); - opts.push_back ( quotedFilename.c_str() ); - - modifyDatabase(); // BEFORE run_rpm - run_rpm( opts, ExternalProgram::Stderr_To_Stdout ); - - string line; - string rpmmsg; - vector configwarnings; - - unsigned linecnt = 0; - while (systemReadLine(line)) - { - if ( linecnt < MAXRPMMESSAGELINES ) - ++linecnt; - else - continue; - - if (line.substr(0,2)=="%%") - { - int percent; - sscanf (line.c_str () + 2, "%d", &percent); - report->progress( percent ); - } - else - rpmmsg += line+'\n'; - - if ( line.substr(0,8) == "warning:" ) - { - configwarnings.push_back(line); - } - } - if ( linecnt > MAXRPMMESSAGELINES ) - rpmmsg += "[truncated]\n"; - - int rpm_status = systemStatus(); - - // evaluate result - for (vector::iterator it = configwarnings.begin(); - it != configwarnings.end(); ++it) - { - processConfigFiles(*it, Pathname::basename(filename), " saved as ", - // %s = filenames - _("rpm saved %s as %s, but it was impossible to determine the difference"), - // %s = filenames - _("rpm saved %s as %s.\nHere are the first 25 lines of difference:\n")); - processConfigFiles(*it, Pathname::basename(filename), " created as ", - // %s = filenames - _("rpm created %s as %s, but it was impossible to determine the difference"), - // %s = filenames - _("rpm created %s as %s.\nHere are the first 25 lines of difference:\n")); - } - - if ( rpm_status != 0 ) - { - historylog.comment( - str::form("%s install failed", Pathname::basename(filename).c_str()), - true /*timestamp*/); - ostringstream sstr; - sstr << "rpm output:" << endl << rpmmsg << endl; - historylog.comment(sstr.str()); - // TranslatorExplanation the colon is followed by an error message - ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) + - (rpmmsg.empty() ? error_message : rpmmsg))); - } - else if ( ! rpmmsg.empty() ) - { - historylog.comment( - str::form("%s installed ok", Pathname::basename(filename).c_str()), - true /*timestamp*/); - ostringstream sstr; - sstr << "Additional rpm output:" << endl << rpmmsg << endl; - historylog.comment(sstr.str()); - - // report additional rpm output in finish - // TranslatorExplanation Text is followed by a ':' and the actual output. - report->finishInfo(str::form( "%s:\n%s\n", _("Additional rpm output"), rpmmsg.c_str() )); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::removePackage -// METHOD TYPE : PMError -// -void RpmDb::removePackage( Package::constPtr package, RpmInstFlags flags ) -{ - // 'rpm -e' does not like epochs - return removePackage( package->name() - + "-" + package->edition().version() - + "-" + package->edition().release() - + "." + package->arch().asString(), flags ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::removePackage -// METHOD TYPE : PMError -// -void RpmDb::removePackage( const string & name_r, RpmInstFlags flags ) -{ - callback::SendReport report; - - report->start( name_r ); - - do - try - { - doRemovePackage(name_r, flags, report); - report->finish(); - break; - } - catch (RpmException & excpt_r) - { - RpmRemoveReport::Action user = report->problem( excpt_r ); - - if ( user == RpmRemoveReport::ABORT ) - { - report->finish( excpt_r ); - ZYPP_RETHROW(excpt_r); - } - else if ( user == RpmRemoveReport::IGNORE ) - { - break; - } - } - while (true); -} - - -void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback::SendReport & report ) -{ - FAILIFNOTINITIALIZED; - HistoryLog historylog; - - MIL << "RpmDb::doRemovePackage(" << name_r << "," << flags << ")" << endl; - - // backup - if ( _packagebackups ) - { - // FIXME solve this status report somehow - // report->progress( pd.init( -2, 100 ) ); // allow 1% for backup creation. - if ( ! backupPackage( name_r ) ) - { - ERR << "backup of " << name_r << " failed" << endl; - } - report->progress( 0 ); - } - else - { - report->progress( 100 ); - } - - // run rpm - RpmArgVec opts; - opts.push_back("-e"); - opts.push_back("--allmatches"); - - if (flags & RPMINST_NOSCRIPTS) - opts.push_back("--noscripts"); - if (flags & RPMINST_NODEPS) - opts.push_back("--nodeps"); - if (flags & RPMINST_JUSTDB) - opts.push_back("--justdb"); - if (flags & RPMINST_TEST) - opts.push_back ("--test"); - if (flags & RPMINST_FORCE) - { - WAR << "IGNORE OPTION: 'rpm -e' does not support '--force'" << endl; - } - - opts.push_back("--"); - opts.push_back(name_r.c_str()); - - modifyDatabase(); // BEFORE run_rpm - run_rpm (opts, ExternalProgram::Stderr_To_Stdout); - - string line; - string rpmmsg; - - // got no progress from command, so we fake it: - // 5 - command started - // 50 - command completed - // 100 if no error - report->progress( 5 ); - unsigned linecnt = 0; - while (systemReadLine(line)) - { - if ( linecnt < MAXRPMMESSAGELINES ) - ++linecnt; - else - continue; - rpmmsg += line+'\n'; - } - if ( linecnt > MAXRPMMESSAGELINES ) - rpmmsg += "[truncated]\n"; - report->progress( 50 ); - int rpm_status = systemStatus(); - - if ( rpm_status != 0 ) - { - historylog.comment( - str::form("%s remove failed", name_r.c_str()), true /*timestamp*/); - ostringstream sstr; - sstr << "rpm output:" << endl << rpmmsg << endl; - historylog.comment(sstr.str()); - // TranslatorExplanation the colon is followed by an error message - ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) + - (rpmmsg.empty() ? error_message: rpmmsg))); - } - else if ( ! rpmmsg.empty() ) - { - historylog.comment( - str::form("%s removed ok", name_r.c_str()), true /*timestamp*/); - - ostringstream sstr; - sstr << "Additional rpm output:" << endl << rpmmsg << endl; - historylog.comment(sstr.str()); - - // report additional rpm output in finish - // TranslatorExplanation Text is followed by a ':' and the actual output. - report->finishInfo(str::form( "%s:\n%s\n", _("Additional rpm output"), rpmmsg.c_str() )); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::backupPackage -// METHOD TYPE : bool -// -bool RpmDb::backupPackage( const Pathname & filename ) -{ - RpmHeader::constPtr h( RpmHeader::readPackage( filename, RpmHeader::NOSIGNATURE ) ); - if ( ! h ) - return false; - - return backupPackage( h->tag_name() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmDb::backupPackage -// METHOD TYPE : bool -// -bool RpmDb::backupPackage(const string& packageName) -{ - HistoryLog progresslog; - bool ret = true; - Pathname backupFilename; - Pathname filestobackupfile = _root+_backuppath+FILEFORBACKUPFILES; - - if (_backuppath.empty()) - { - INT << "_backuppath empty" << endl; - return false; - } - - FileList fileList; - - if (!queryChangedFiles(fileList, packageName)) - { - ERR << "Error while getting changed files for package " << - packageName << endl; - return false; - } - - if (fileList.size() <= 0) - { - DBG << "package " << packageName << " not changed -> no backup" << endl; - return true; - } - - if (filesystem::assert_dir(_root + _backuppath) != 0) - { - return false; - } - - { - // build up archive name - time_t currentTime = time(0); - struct tm *currentLocalTime = localtime(¤tTime); - - int date = (currentLocalTime->tm_year + 1900) * 10000 - + (currentLocalTime->tm_mon + 1) * 100 - + currentLocalTime->tm_mday; - - int num = 0; - do - { - backupFilename = _root + _backuppath - + str::form("%s-%d-%d.tar.gz",packageName.c_str(), date, num); - - } - while ( PathInfo(backupFilename).isExist() && num++ < 1000); - - PathInfo pi(filestobackupfile); - if (pi.isExist() && !pi.isFile()) - { - ERR << filestobackupfile.asString() << " already exists and is no file" << endl; - return false; - } - - ofstream fp ( filestobackupfile.asString().c_str(), ios::out|ios::trunc ); - - if (!fp) - { - ERR << "could not open " << filestobackupfile.asString() << endl; - return false; - } - - for (FileList::const_iterator cit = fileList.begin(); - cit != fileList.end(); ++cit) - { - string name = *cit; - if ( name[0] == '/' ) - { - // remove slash, file must be relative to -C parameter of tar - name = name.substr( 1 ); - } - DBG << "saving file "<< name << endl; - fp << name << endl; - } - fp.close(); - - const char* const argv[] = - { - "tar", - "-czhP", - "-C", - _root.asString().c_str(), - "--ignore-failed-read", - "-f", - backupFilename.asString().c_str(), - "-T", - filestobackupfile.asString().c_str(), - NULL - }; - - // execute tar in inst-sys (we dont know if there is a tar below _root !) - ExternalProgram tar(argv, ExternalProgram::Stderr_To_Stdout, false, -1, true); - - string tarmsg; - - // TODO: its probably possible to start tar with -v and watch it adding - // files to report progress - for (string output = tar.receiveLine(); output.length() ;output = tar.receiveLine()) - { - tarmsg+=output; - } - - int ret = tar.close(); - - if ( ret != 0) - { - ERR << "tar failed: " << tarmsg << endl; - ret = false; - } - else - { - MIL << "tar backup ok" << endl; - progresslog.comment( - str::form(_("created backup %s"), backupFilename.asString().c_str()) - , /*timestamp*/true); - } - - filesystem::unlink(filestobackupfile); - } - - return ret; -} - -void RpmDb::setBackupPath(const Pathname& path) -{ - _backuppath = path; -} - -} // namespace rpm -} // namespace target -} // namespace zypp diff --git a/libzypp/zypp/target/rpm/RpmDb.h b/libzypp/zypp/target/rpm/RpmDb.h deleted file mode 100644 index 956ba25..0000000 --- a/libzypp/zypp/target/rpm/RpmDb.h +++ /dev/null @@ -1,546 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmDb.h - * -*/ - -// -*- C++ -*- - -#ifndef ZYPP_TARGET_RPM_RPMDB_H -#define ZYPP_TARGET_RPM_RPMDB_H - -#include -#include -#include -#include - -#include "zypp/Pathname.h" -#include "zypp/ExternalProgram.h" - -#include "zypp/Package.h" -#include "zypp/KeyRing.h" - -#include "zypp/target/rpm/RpmFlags.h" -#include "zypp/target/rpm/RpmHeader.h" -#include "zypp/target/rpm/RpmCallbacks.h" -#include "zypp/ZYppCallbacks.h" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : RpmDb -/** - * @short Interface to the rpm program - **/ -class RpmDb : public base::ReferenceCounted, private base::NonCopyable -{ -public: - - /** - * Default error class - **/ - typedef class InstTargetError Error; - - /////////////////////////////////////////////////////////////////// - // - // INITALISATION - // - /////////////////////////////////////////////////////////////////// -private: - - enum DbStateInfoBits { - DbSI_NO_INIT = 0x0000, - DbSI_HAVE_V4 = 0x0001, - DbSI_MADE_V4 = 0x0002, - DbSI_MODIFIED_V4 = 0x0004, - DbSI_HAVE_V3 = 0x0008, - DbSI_HAVE_V3TOV4 = 0x0010, - DbSI_MADE_V3TOV4 = 0x0020 - }; - - friend std::ostream & operator<<( std::ostream & str, const DbStateInfoBits & obj ); - - void dbsi_set( DbStateInfoBits & val_r, const unsigned & bits_r ) const - { - val_r = (DbStateInfoBits)(val_r | bits_r); - } - void dbsi_clr( DbStateInfoBits & val_r, const unsigned & bits_r ) const - { - val_r = (DbStateInfoBits)(val_r & ~bits_r); - } - bool dbsi_has( const DbStateInfoBits & val_r, const unsigned & bits_r ) const - { - return( (val_r & bits_r) == bits_r ); - } - - /** - * Internal state info - **/ - DbStateInfoBits _dbStateInfo; - - /** - * Root directory for all operations. - **/ - Pathname _root; - - /** - * Directory that contains the rpmdb. - **/ - Pathname _dbPath; - - /** - * Internal helper for @ref initDatabase. - * - * \throws RpmException - * - **/ - void internal_initDatabase( const Pathname & root_r, const Pathname & dbPath_r, - DbStateInfoBits & info_r ); - - /** - * Remove the rpm4 database in dbdir_r and optionally any backup created - * on conversion. - **/ - static void removeV4( const Pathname & dbdir_r, bool v3backup_r ); - - /** - * Remove the rpm3 database in dbdir_r. Create a backup copy named - * packages.rpm3 if it does not already exist. - **/ - static void removeV3( const Pathname & dbdir_r, bool v3backup_r ); - - /** - * Called before the database is modified by installPackage/removePackage. - * Invalidates Packages list and moves away any old database. - **/ - void modifyDatabase(); - -public: - - /** - * Constructor. There's no rpmdb access until @ref initDatabase - * was called. - **/ - RpmDb(); - - /** - * Destructor. - **/ - ~RpmDb(); - - /** - * timestamp of the rpm database (last modification) - */ - Date timestamp() const; - - /** - * @return Root directory for all operations (empty if not initialized). - **/ - const Pathname & root() const - { - return _root; - } - - /** - * @return Directory that contains the rpmdb (empty if not initialized). - **/ - const Pathname & dbPath() const - { - return _dbPath; - } - - /** - * @return Whether we are initialized. - **/ - bool initialized() const - { - return( ! _root.empty() ); - } - - /** - * Prepare access to the rpm database. Optional arguments may denote the - * root directory for all operations and the directory (below root) that - * contains the rpmdb (usg. you won't need to set this). - * - * On empty Pathnames the default is used: - *
-   *     root:   /
-   *     dbPath: /var/lib/rpm
-   * 
- * - * Calling initDatabase a second time with different arguments will return - * an error but leave the database in it's original state. - * - * Converting an old batabase is done if necessary. On update: The converted - * database will be removed by @ref closeDatabase, if it was not modified - * (no packages were installed or deleted). Otherwise the new database - * is kept, and the old one is removed. - * - * If the database alredy exists and \c doRebuild_r is true, \ref rebuildDatabase - * is called. - * - * \throws RpmException - * - **/ - void initDatabase( Pathname root_r = Pathname(), - Pathname dbPath_r = Pathname(), - bool doRebuild_r = false ); - - /** - * Block further access to the rpm database and go back to uninitialized - * state. On update: Decides what to do with any converted database - * (see @ref initDatabase). - * - * \throws RpmException - * - **/ - void closeDatabase(); - - /** - * Rebuild the rpm database (rpm --rebuilddb). - * - * \throws RpmException - * - **/ - void rebuildDatabase(); - - /** - * Import ascii armored public key in file pubkey_r. - * - * \throws RpmException - * - **/ - void importPubkey( const PublicKey & pubkey_r ); - - /** - * Remove a public key from the rpm database - * - * \throws RpmException - * - **/ - void removePubkey( const PublicKey & pubkey_r ); - - /** - * Return the long ids of all installed public keys. - **/ - std::list pubkeys() const; - - /** - * Return the edition of all installed public keys. - **/ - std::set pubkeyEditions() const; - - /////////////////////////////////////////////////////////////////// - // - // Direct RPM database retrieval via librpm. - // - /////////////////////////////////////////////////////////////////// -public: - - /** - * return complete file list for installed package name_r (in FileInfo.filename) - * if edition_r != Edition::noedition, check for exact edition - * if full==true, fill all attributes of FileInfo - **/ - std::list fileList( const std::string & name_r, const Edition & edition_r ) const; - - /** - * Return true if at least one package owns a certain file (name_r empty) - * Return true if package name_r owns file file_r (name_r nonempty). - **/ - bool hasFile( const std::string & file_r, const std::string & name_r = "" ) const; - - /** - * Return name of package owning file - * or empty string if no installed package owns file - **/ - std::string whoOwnsFile( const std::string & file_r ) const; - - /** - * Return true if at least one package provides a certain tag. - **/ - bool hasProvides( const std::string & tag_r ) const; - - /** - * Return true if at least one package requires a certain tag. - **/ - bool hasRequiredBy( const std::string & tag_r ) const; - - /** - * Return true if at least one package conflicts with a certain tag. - **/ - bool hasConflicts( const std::string & tag_r ) const; - - /** - * Return true if package is installed. - **/ - bool hasPackage( const std::string & name_r ) const; - - /** - * Return true if package is installed in a certain edition. - **/ - bool hasPackage( const std::string & name_r, const Edition & ed_r ) const; - - /** - * Get an installed packages data from rpmdb. Package is - * identified by name. Data returned via result are NULL, - * if packge is not installed (PMError is not set), or RPM database - * could not be read (PMError is set). - * - * \throws RpmException - * - * FIXME this and following comment - * - **/ - void getData( const std::string & name_r, - RpmHeader::constPtr & result_r ) const; - - /** - * Get an installed packages data from rpmdb. Package is - * identified by name and edition. Data returned via result are NULL, - * if packge is not installed (PMError is not set), or RPM database - * could not be read (PMError is set). - * - * \throws RpmException - * - **/ - void getData( const std::string & name_r, const Edition & ed_r, - RpmHeader::constPtr & result_r ) const; - - /////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////// -public: - /** Sync mode for \ref syncTrustedKeys */ - enum SyncTrustedKeyBits - { - SYNC_TO_KEYRING = 1<<0, //! export rpm trusted keys into zypp trusted keyring - SYNC_FROM_KEYRING = 1<<1, //! import zypp trusted keys into rpm database. - SYNC_BOTH = SYNC_TO_KEYRING | SYNC_FROM_KEYRING - }; - /** - * Sync trusted keys stored in rpm database and zypp trusted keyring. - */ - void syncTrustedKeys( SyncTrustedKeyBits mode_r = SYNC_BOTH ); - /** - * iterates through zypp keyring and import all non existant keys - * into rpm keyring - */ - void importZyppKeyRingTrustedKeys(); - /** - * insert all rpm trusted keys into zypp trusted keyring - */ - void exportTrustedKeysInZyppKeyRing(); - -private: - /** - * The connection to the rpm process. - */ - ExternalProgram *process; - - typedef std::vector RpmArgVec; - - /** - * Run rpm with the specified arguments and handle stderr. - * @param n_opts The number of arguments - * @param options Array of the arguments, @ref n_opts elements - * @param stderr_disp How to handle stderr, merged with stdout by default - * - * \throws RpmException - * - **/ - void run_rpm( const RpmArgVec& options, - ExternalProgram::Stderr_Disposition stderr_disp = - ExternalProgram::Stderr_To_Stdout); - - - /** - * Read a line from the general rpm query - */ - bool systemReadLine(std::string &line); - - /** - * Return the exit status of the general rpm process, - * closing the connection if not already done. - */ - int systemStatus(); - - /** - * Forcably kill the system process - */ - void systemKill(); - - /** - * The exit code of the rpm process, or -1 if not yet known. - */ - int exit_code; - - /** - * Error message from running rpm as external program. - * Use only if something fail. - */ - std::string error_message; - - /** /var/adm/backup */ - Pathname _backuppath; - - /** create package backups? */ - bool _packagebackups; - - /** whether <_root>/ was already created */ - bool _warndirexists; - - /** - * handle rpm messages like "/etc/testrc saved as /etc/testrc.rpmorig" - * - * @param line rpm output starting with warning: - * @param name name of package, appears in subject line - * @param typemsg " saved as " or " created as " - * @param difffailmsg what to put into mail if diff failed, must contain two %s for the two files - * @param diffgenmsg what to put into mail if diff succeeded, must contain two %s for the two files - * */ - void processConfigFiles(const std::string& line, - const std::string& name, - const char* typemsg, - const char* difffailmsg, - const char* diffgenmsg); - - -public: - - typedef std::set FileList; - - /** - * checkPackage result - * @see checkPackage - * */ - enum checkPackageResult - { - CHK_OK = 0, /*!< Signature is OK. */ - CHK_NOTFOUND = 1, /*!< Signature is unknown type. */ - CHK_FAIL = 2, /*!< Signature does not verify. */ - CHK_NOTTRUSTED = 3, /*!< Signature is OK, but key is not trusted. */ - CHK_NOKEY = 4, /*!< Public key is unavailable. */ - CHK_ERROR = 5 /*!< File does not exist or can't be opened. */ - }; - - /** - * Check signature of rpm file on disk. - * - * @param filename which file to check - * - * @return checkPackageResult - */ - checkPackageResult checkPackage( const Pathname & path_r ); - - /** install rpm package - * - * @param filename file to install - * @param flags which rpm options to use - * - * @return success - * - * \throws RpmException - * - * */ - void installPackage ( const Pathname & filename, RpmInstFlags flags = RPMINST_NONE ); - - /** remove rpm package - * - * @param name_r Name of the rpm package to remove. - * @param iflags which rpm options to use - * - * @return success - * - * \throws RpmException - * - * */ - void removePackage( const std::string & name_r, RpmInstFlags flags = RPMINST_NONE ); - void removePackage( Package::constPtr package, RpmInstFlags flags = RPMINST_NONE ); - - /** - * get backup dir for rpm config files - * - * */ - Pathname getBackupPath (void) - { - return _backuppath; - } - - /** - * create tar.gz of all changed files in a Package - * - * @param packageName name of the Package to backup - * - * @see setBackupPath - * */ - bool backupPackage(const std::string& packageName); - - /** - * queries file for name and then calls above backupPackage - * function. For convenience. - * - * @param filename rpm file that is about to be installed - * */ - bool backupPackage(const Pathname& filename); - - /** - * set path where package backups are stored - * - * @see backupPackage - * */ - void setBackupPath(const Pathname& path); - - /** - * whether to create package backups during install or - * removal - * - * @param yes true or false - * */ - void createPackageBackups(bool yes) - { - _packagebackups = yes; - } - - /** - * determine which files of an installed package have been - * modified. - * - * @param fileList (output) where to store modified files - * @param packageName name of package to query - * - * @return false if package couln't be queried for some - * reason - * */ - bool queryChangedFiles(FileList & fileList, const std::string& packageName); - -public: - - /** - * Dump debug info. - **/ - virtual std::ostream & dumpOn( std::ostream & str ) const; - -protected: - void doRemovePackage( const std::string & name_r, RpmInstFlags flags, callback::SendReport & report ); - void doInstallPackage( const Pathname & filename, RpmInstFlags flags, callback::SendReport & report ); - void doRebuildDatabase(callback::SendReport & report); -}; - -} // namespace rpm -} // namespace target -} // namespace zypp - -#endif // ZYPP_TARGET_RPM_RPMDB_H diff --git a/libzypp/zypp/target/rpm/RpmException.cc b/libzypp/zypp/target/rpm/RpmException.cc deleted file mode 100644 index 90a29be..0000000 --- a/libzypp/zypp/target/rpm/RpmException.cc +++ /dev/null @@ -1,84 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmException.cc - * -*/ - -#include -#include - -#include "zypp/target/rpm/RpmException.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -namespace target -{ -///////////////////////////////////////////////////////////////// -namespace rpm -{ -///////////////////////////////////////////////////////////////// - -std::ostream & RpmInvalidRootException::dumpOn( std::ostream & str ) const -{ - return str << "Illegal root " << _root - << " or dbPath " << _dbpath << endl; -} - -std::ostream & RpmAccessBlockedException::dumpOn( std::ostream & str ) const -{ - return str << "Access is blocked: Root: " << _root - << " dbPath: " << _dbpath << endl; -} - -std::ostream & RpmSubprocessException::dumpOn( std::ostream & str ) const -{ - return str << "Subprocess failed. Error: " << _errmsg << endl; -} - -std::ostream & RpmInitException::dumpOn( std::ostream & str) const -{ - return str << "Failed to initialize database: Root: " << _root - << " dbPath: " << _dbpath << endl; -} - -std::ostream & RpmDbOpenException::dumpOn( std::ostream & str) const -{ - return str << "Failed to open database: Root: " << _root - << " dbPath: " << _dbpath << endl; -} - -std::ostream & RpmDbAlreadyOpenException::dumpOn( std::ostream & str) const -{ - return str << "Can't switch to " << _new_root << " " << _new_dbpath - << " while accessing " << _old_root << " " << _old_dbpath << endl; -} - -std::ostream & RpmDbNotOpenException::dumpOn( std::ostream & str) const -{ - return str << "RPM database not open" << endl; -} - -std::ostream & RpmDbConvertException::dumpOn( std::ostream & str) const -{ - return str << "RPM database conversion failed" << endl; -} - -std::ostream & RpmNullDatabaseException::dumpOn( std::ostream & str) const -{ - return str << "NULL rpmV4 database passed as argument!" << endl; -} - -///////////////////////////////////////////////////////////////// -} // namespace rpm -} // namespace target -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/target/rpm/RpmException.h b/libzypp/zypp/target/rpm/RpmException.h deleted file mode 100644 index 9f9284c..0000000 --- a/libzypp/zypp/target/rpm/RpmException.h +++ /dev/null @@ -1,249 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmException.h - * -*/ -#ifndef ZYPP_TARGET_RPM_RPMEXCEPTION_H -#define ZYPP_TARGET_RPM_RPMEXCEPTION_H - -#include - -#include - -#include "zypp/base/Exception.h" -#include "zypp/Pathname.h" -#include "zypp/Url.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -namespace target -{ -/////////////////////////////////////////////////////////////// -namespace rpm -{ -/////////////////////////////////////////////////////////////// -// -// CLASS NAME : RpmException -/** Just inherits Exception to separate media exceptions - * - **/ -class RpmException : public Exception -{ -public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - RpmException() - : Exception( "Rpm Exception" ) - {} - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - RpmException( const std::string & msg_r ) - : Exception( msg_r ) - {} - /** Dtor. */ - virtual ~RpmException() throw() - {}; -}; - -class GlobalRpmInitException : public RpmException -{ -public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - GlobalRpmInitException() - : RpmException("Global RPM initialization failed") - {} - /** Dtor. */ - virtual ~GlobalRpmInitException() throw() - {}; -private: -}; - -class RpmInvalidRootException : public RpmException -{ -public: - /** Ctor taking message. - * Use \ref ZYPP_THROW to throw exceptions. - */ - RpmInvalidRootException( const Pathname & root_r, - const Pathname & dbpath_r ) - : RpmException() - , _root(root_r.asString()) - , _dbpath(dbpath_r.asString()) - {} - /** Dtor. */ - virtual ~RpmInvalidRootException() throw() - {}; - std::string root() const - { - return _root; - } - std::string dbpath() const - { - return _dbpath; - } -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _root; - std::string _dbpath; -}; - -class RpmAccessBlockedException : public RpmException -{ -public: - RpmAccessBlockedException( const Pathname & root_r, - const Pathname & dbpath_r ) - : RpmException() - , _root(root_r.asString()) - , _dbpath(dbpath_r.asString()) - {} - virtual ~RpmAccessBlockedException() throw() - {}; - std::string root() const - { - return _root; - } - std::string dbpath() const - { - return _dbpath; - } -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _root; - std::string _dbpath; -}; - -class RpmSubprocessException : public RpmException -{ -public: - RpmSubprocessException(const std::string & errmsg_r) - : RpmException() - , _errmsg(errmsg_r) - {} - virtual ~RpmSubprocessException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _errmsg; -}; - -class RpmInitException : public RpmException -{ -public: - RpmInitException(const Pathname & root_r, - const Pathname & dbpath_r) - : RpmException() - , _root(root_r.asString()) - , _dbpath(dbpath_r.asString()) - {} - virtual ~RpmInitException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _root; - std::string _dbpath; -}; - -class RpmDbOpenException : public RpmException -{ -public: - RpmDbOpenException(const Pathname & root_r, - const Pathname & dbpath_r) - : RpmException() - , _root(root_r.asString()) - , _dbpath(dbpath_r.asString()) - {} - virtual ~RpmDbOpenException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _root; - std::string _dbpath; -}; - -class RpmDbAlreadyOpenException : public RpmException -{ -public: - RpmDbAlreadyOpenException(const Pathname & old_root_r, - const Pathname & old_dbpath_r, - const Pathname & new_root_r, - const Pathname & new_dbpath_r) - : RpmException() - , _old_root(old_root_r.asString()) - , _old_dbpath(old_dbpath_r.asString()) - , _new_root(new_root_r.asString()) - , _new_dbpath(new_dbpath_r.asString()) - {} - virtual ~RpmDbAlreadyOpenException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: - std::string _old_root; - std::string _old_dbpath; - std::string _new_root; - std::string _new_dbpath; -}; - -class RpmDbNotOpenException : public RpmException -{ -public: - RpmDbNotOpenException() - : RpmException() - {} - virtual ~RpmDbNotOpenException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: -}; - -class RpmDbConvertException : public RpmException -{ -public: - RpmDbConvertException() - : RpmException() - {} - virtual ~RpmDbConvertException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: -}; - -class RpmNullDatabaseException : public RpmException -{ -public: - RpmNullDatabaseException() - : RpmException() - {} - virtual ~RpmNullDatabaseException() throw() - {}; -protected: - virtual std::ostream & dumpOn( std::ostream & str ) const; -private: -}; - - - -///////////////////////////////////////////////////////////////// -} // namespace rpm -} // namespace target -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_RPM_RPMEXCEPTION_H diff --git a/libzypp/zypp/target/rpm/RpmFlags.h b/libzypp/zypp/target/rpm/RpmFlags.h deleted file mode 100644 index f24a676..0000000 --- a/libzypp/zypp/target/rpm/RpmFlags.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmFlags.h - * -*/ -#ifndef ZYPP_TARGET_RPM_RPMFLAGS_H -#define ZYPP_TARGET_RPM_RPMFLAGS_H - -#include - -#include "zypp/base/Flags.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace target - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace rpm - { ///////////////////////////////////////////////////////////////// - - /** - * Bits representing rpm installation options. - * - * Use \ref RpmInstFlags as a type-safe way of - * storing OR-combinations. - * - * @see RpmDb::installPackage(), RpmDb::removePackage(), - */ - enum RpmInstFlag - { - RPMINST_NONE = 0x0000, - RPMINST_EXCLUDEDOCS= 0x0001, - RPMINST_NOSCRIPTS = 0x0002, - RPMINST_FORCE = 0x0004, - RPMINST_NODEPS = 0x0008, - RPMINST_IGNORESIZE = 0x0010, - RPMINST_JUSTDB = 0x0020, - RPMINST_NODIGEST = 0x0040, - RPMINST_NOSIGNATURE= 0x0080, - RPMINST_NOUPGRADE = 0x0100, - RPMINST_TEST = 0x0200, - RPMINST_NOPOSTTRANS= 0x0400 - }; - - /** \relates RpmInstFlag Type-safe way of storing OR-combinations. */ - ZYPP_DECLARE_FLAGS_AND_OPERATORS( RpmInstFlags, RpmInstFlag ); - - ///////////////////////////////////////////////////////////////// - } // namespace rpm - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace target - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_TARGET_RPM_RPMFLAGS_H diff --git a/libzypp/zypp/target/rpm/RpmHeader.cc b/libzypp/zypp/target/rpm/RpmHeader.cc deleted file mode 100644 index e4327e5..0000000 --- a/libzypp/zypp/target/rpm/RpmHeader.cc +++ /dev/null @@ -1,1019 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmHeader.cc - * -*/ -#include "librpm.h" -#ifdef _RPM_4_4 -#include -#else -//////////////////////////////////////////////////////////////////// -// unameToUid and gnameToGid are shamelessly stolen from rpm-4.4. -// (rpmio/ugid.c) Those functions were dropped in RPM_4_7 -extern "C" -{ -#include -#include -} -/* unameToUid(), uidTouname() and the group variants are really poorly - implemented. They really ought to use hash tables. I just made the - guess that most files would be owned by root or the same person/group - who owned the last file. Those two values are cached, everything else - is looked up via getpw() and getgr() functions. If this performs - too poorly I'll have to implement it properly :-( */ - -int unameToUid(const char * thisUname, uid_t * uid) -{ -/*@only@*/ static char * lastUname = NULL; - static size_t lastUnameLen = 0; - static size_t lastUnameAlloced; - static uid_t lastUid; - struct passwd * pwent; - size_t thisUnameLen; - - if (!thisUname) { - lastUnameLen = 0; - return -1; - } else if (strcmp(thisUname, "root") == 0) { -/*@-boundswrite@*/ - *uid = 0; -/*@=boundswrite@*/ - return 0; - } - - thisUnameLen = strlen(thisUname); - if (lastUname == NULL || thisUnameLen != lastUnameLen || - strcmp(thisUname, lastUname) != 0) - { - if (lastUnameAlloced < thisUnameLen + 1) { - lastUnameAlloced = thisUnameLen + 10; - lastUname = (char *)realloc(lastUname, lastUnameAlloced); /* XXX memory leak */ - } -/*@-boundswrite@*/ - strcpy(lastUname, thisUname); -/*@=boundswrite@*/ - - pwent = getpwnam(thisUname); - if (pwent == NULL) { - /*@-internalglobs@*/ /* FIX: shrug */ - endpwent(); - /*@=internalglobs@*/ - pwent = getpwnam(thisUname); - if (pwent == NULL) return -1; - } - - lastUid = pwent->pw_uid; - } - -/*@-boundswrite@*/ - *uid = lastUid; -/*@=boundswrite@*/ - - return 0; -} - -int gnameToGid(const char * thisGname, gid_t * gid) -{ -/*@only@*/ static char * lastGname = NULL; - static size_t lastGnameLen = 0; - static size_t lastGnameAlloced; - static gid_t lastGid; - size_t thisGnameLen; - struct group * grent; - - if (thisGname == NULL) { - lastGnameLen = 0; - return -1; - } else if (strcmp(thisGname, "root") == 0) { -/*@-boundswrite@*/ - *gid = 0; -/*@=boundswrite@*/ - return 0; - } - - thisGnameLen = strlen(thisGname); - if (lastGname == NULL || thisGnameLen != lastGnameLen || - strcmp(thisGname, lastGname) != 0) - { - if (lastGnameAlloced < thisGnameLen + 1) { - lastGnameAlloced = thisGnameLen + 10; - lastGname = (char *)realloc(lastGname, lastGnameAlloced); /* XXX memory leak */ - } -/*@-boundswrite@*/ - strcpy(lastGname, thisGname); -/*@=boundswrite@*/ - - grent = getgrnam(thisGname); - if (grent == NULL) { - /*@-internalglobs@*/ /* FIX: shrug */ - endgrent(); - /*@=internalglobs@*/ - grent = getgrnam(thisGname); - if (grent == NULL) { - /* XXX The filesystem package needs group/lock w/o getgrnam. */ - if (strcmp(thisGname, "lock") == 0) { -/*@-boundswrite@*/ - *gid = lastGid = 54; -/*@=boundswrite@*/ - return 0; - } else - if (strcmp(thisGname, "mail") == 0) { -/*@-boundswrite@*/ - *gid = lastGid = 12; -/*@=boundswrite@*/ - return 0; - } else - return -1; - } - } - lastGid = grent->gr_gid; - } - -/*@-boundswrite@*/ - *gid = lastGid; -/*@=boundswrite@*/ - - return 0; -} -//////////////////////////////////////////////////////////////////// -#endif - -#include -#include -#include -#include - -#include "zypp/base/Easy.h" -#include "zypp/base/Logger.h" -#include "zypp/base/Exception.h" - -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/rpm/RpmHeader.h" -#include "zypp/Package.h" -#include "zypp/PathInfo.h" - -using std::endl; - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::RpmHeader -// METHOD TYPE : Constructor -// -// DESCRIPTION : -// -RpmHeader::RpmHeader( Header h_r ) - : BinHeader( h_r ) -{} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::RpmHeader -// METHOD TYPE : Constructor -// -RpmHeader::RpmHeader( BinHeader::Ptr & rhs ) - : BinHeader( rhs ) -{} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::~RpmHeader -// METHOD TYPE : Destructor -// -// DESCRIPTION : -// -RpmHeader::~RpmHeader() -{} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::readPackage -// METHOD TYPE : constRpmHeaderPtr -// -RpmHeader::constPtr RpmHeader::readPackage( const Pathname & path_r, - VERIFICATION verification_r ) -{ - PathInfo file( path_r ); - if ( ! file.isFile() ) - { - ERR << "Not a file: " << file << endl; - return (RpmHeader*)0; - } - - FD_t fd = ::Fopen( file.asString().c_str(), "r.ufdio" ); - if ( fd == 0 || ::Ferror(fd) ) - { - ERR << "Can't open file for reading: " << file << " (" << ::Fstrerror(fd) << ")" << endl; - if ( fd ) - ::Fclose( fd ); - return (RpmHeader*)0; - } - - librpmDb::globalInit(); - rpmts ts = ::rpmtsCreate(); - unsigned vsflag = RPMVSF_DEFAULT; - if ( verification_r & NODIGEST ) - vsflag |= _RPMVSF_NODIGESTS; - if ( verification_r & NOSIGNATURE ) - vsflag |= _RPMVSF_NOSIGNATURES; - ::rpmtsSetVSFlags( ts, rpmVSFlags(vsflag) ); - - Header nh = 0; - int res = ::rpmReadPackageFile( ts, fd, path_r.asString().c_str(), &nh ); - - ts = rpmtsFree(ts); - - ::Fclose( fd ); - - if ( ! nh ) - { - WAR << "Error reading header from " << path_r << " error(" << res << ")" << endl; - return (RpmHeader*)0; - } - - RpmHeader::constPtr h( new RpmHeader( nh ) ); - headerFree( nh ); // clear the reference set in ReadPackageFile - - MIL << h << " from " << path_r << endl; - return h; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::dumpOn -// METHOD TYPE : std::ostream & -// -// DESCRIPTION : -// -std::ostream & RpmHeader::dumpOn( std::ostream & str ) const -{ - return BinHeader::dumpOn( str ) << '{' << tag_name() << "-" - << (tag_epoch()==0?"":(tag_epoch()+":")) - << tag_version() - << (tag_release().empty()?"":(std::string("-")+tag_release())) - << ( isSrc() ? ".src}" : "}"); -} - - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::isSrc -// METHOD TYPE : bool -// -bool RpmHeader::isSrc() const -{ - return has_tag( RPMTAG_SOURCEPACKAGE ); -} - -bool RpmHeader::isNosrc() const -{ - return has_tag( RPMTAG_SOURCEPACKAGE ) && ( has_tag( RPMTAG_NOSOURCE ) || has_tag( RPMTAG_NOPATCH ) ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_name -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_name() const -{ - return string_val( RPMTAG_NAME ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_epoch -// METHOD TYPE : Edition::epoch_t -// -// DESCRIPTION : -// -Edition::epoch_t RpmHeader::tag_epoch() const -{ - return int_val ( RPMTAG_EPOCH ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_version -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_version() const -{ - return string_val ( RPMTAG_VERSION ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_release -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_release() const -{ - return string_val( RPMTAG_RELEASE ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_edition -// METHOD TYPE : Edition -// -// DESCRIPTION : -// -Edition RpmHeader::tag_edition () const -{ - return Edition( tag_version(), tag_release(), tag_epoch() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_arch -// METHOD TYPE : Arch -// -// DESCRIPTION : -// -Arch RpmHeader::tag_arch() const -{ - return Arch( string_val( RPMTAG_ARCH ) ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_installtime -// METHOD TYPE : Date -// -// DESCRIPTION : -// -Date RpmHeader::tag_installtime() const -{ - return int_val( RPMTAG_INSTALLTIME ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_buildtime -// METHOD TYPE : Date -// -// DESCRIPTION : -// -Date RpmHeader::tag_buildtime() const -{ - return int_val( RPMTAG_BUILDTIME ); -} -#warning CHECK IF FILE REQUIRES HANDLING IS OBSOLETE -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::PkgRelList_val -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::PkgRelList_val( tag tag_r, bool pre, std::set * freq_r ) const - { - CapabilitySet ret; - - rpmTag kindFlags = rpmTag(0); - rpmTag kindVersion = rpmTag(0); - - switch ( tag_r ) - { - case RPMTAG_REQUIRENAME: - kindFlags = RPMTAG_REQUIREFLAGS; - kindVersion = RPMTAG_REQUIREVERSION; - break; - case RPMTAG_PROVIDENAME: - kindFlags = RPMTAG_PROVIDEFLAGS; - kindVersion = RPMTAG_PROVIDEVERSION; - break; - case RPMTAG_OBSOLETENAME: - kindFlags = RPMTAG_OBSOLETEFLAGS; - kindVersion = RPMTAG_OBSOLETEVERSION; - break; - case RPMTAG_CONFLICTNAME: - kindFlags = RPMTAG_CONFLICTFLAGS; - kindVersion = RPMTAG_CONFLICTVERSION; - break; -#ifdef RPMTAG_OLDSUGGESTS - case RPMTAG_OLDENHANCESNAME: - kindFlags = RPMTAG_OLDENHANCESFLAGS; - kindVersion = RPMTAG_OLDENHANCESVERSION; - break; - case RPMTAG_OLDSUGGESTSNAME: - kindFlags = RPMTAG_OLDSUGGESTSFLAGS; - kindVersion = RPMTAG_OLDSUGGESTSVERSION; - break; - case RPMTAG_RECOMMENDNAME: - kindFlags = RPMTAG_RECOMMENDFLAGS; - kindVersion = RPMTAG_RECOMMENDVERSION; - break; - case RPMTAG_SUPPLEMENTNAME: - kindFlags = RPMTAG_SUPPLEMENTFLAGS; - kindVersion = RPMTAG_SUPPLEMENTVERSION; - break; - case RPMTAG_SUGGESTNAME: - kindFlags = RPMTAG_SUGGESTFLAGS; - kindVersion = RPMTAG_SUGGESTVERSION; - break; - case RPMTAG_ENHANCENAME: - kindFlags = RPMTAG_ENHANCEFLAGS; - kindVersion = RPMTAG_ENHANCEVERSION; - break; -#else - case RPMTAG_ENHANCESNAME: - kindFlags = RPMTAG_ENHANCESFLAGS; - kindVersion = RPMTAG_ENHANCESVERSION; - break; - case RPMTAG_SUGGESTSNAME: - kindFlags = RPMTAG_SUGGESTSFLAGS; - kindVersion = RPMTAG_SUGGESTSVERSION; - break; -#endif - default: - INT << "Illegal RPMTAG_dependencyNAME " << tag_r << endl; - return ret; - break; - } - - stringList names; - unsigned count = string_list( tag_r, names ); - if ( !count ) - return ret; - - intList flags; - int_list( kindFlags, flags ); - - stringList versions; - string_list( kindVersion, versions ); - - for ( unsigned i = 0; i < count; ++i ) - { - - std::string n( names[i] ); - - Rel op = Rel::ANY; - int32_t f = flags[i]; - std::string v = versions[i]; - - if ( n[0] == '/' ) - { - if ( freq_r ) - { - freq_r->insert( n ); - } - } - else - { - if ( v.size() ) - { - switch ( f & RPMSENSE_SENSEMASK ) - { - case RPMSENSE_LESS: - op = Rel::LT; - break; - case RPMSENSE_LESS|RPMSENSE_EQUAL: - op = Rel::LE; - break; - case RPMSENSE_GREATER: - op = Rel::GT; - break; - case RPMSENSE_GREATER|RPMSENSE_EQUAL: - op = Rel::GE; - break; - case RPMSENSE_EQUAL: - op = Rel::EQ; - break; - } - } - } - if ((pre && (f & RPMSENSE_PREREQ)) - || ((! pre) && !(f & RPMSENSE_PREREQ))) - { - try - { - ret.insert( Capability( n, op, Edition(v) ) ); - } - catch (Exception & excpt_r) - { - ZYPP_CAUGHT(excpt_r); - WAR << "Invalid capability: " << n << " " << op << " " - << v << endl; - } - } - } - - return ret; - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_provides -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_provides( std::set * freq_r ) const - { - return PkgRelList_val( RPMTAG_PROVIDENAME, false, freq_r ); - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_requires -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_requires( std::set * freq_r ) const - { - return PkgRelList_val( RPMTAG_REQUIRENAME, false, freq_r ); - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_requires -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_prerequires( std::set * freq_r ) const - { - return PkgRelList_val( RPMTAG_REQUIRENAME, true, freq_r ); - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_conflicts -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_conflicts( std::set * freq_r ) const - { - return PkgRelList_val( RPMTAG_CONFLICTNAME, false, freq_r ); - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_obsoletes -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_obsoletes( std::set * freq_r ) const - { - return PkgRelList_val( RPMTAG_OBSOLETENAME, false, freq_r ); - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_enhances -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_enhances( std::set * freq_r ) const - { -#ifdef RPMTAG_OLDSUGGESTS - return PkgRelList_val( RPMTAG_ENHANCENAME, false, freq_r ); -#else - return PkgRelList_val( RPMTAG_ENHANCESNAME, false, freq_r ); -#endif - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_suggests -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_suggests( std::set * freq_r ) const - { -#ifdef RPMTAG_OLDSUGGESTS - return PkgRelList_val( RPMTAG_SUGGESTNAME, false, freq_r ); -#else - return PkgRelList_val( RPMTAG_SUGGESTSNAME, false, freq_r ); -#endif - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_supplements -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_supplements( std::set * freq_r ) const - { -#ifdef RPMTAG_OLDSUGGESTS - return PkgRelList_val( RPMTAG_SUPPLEMENTNAME, false, freq_r ); -#else - return CapabilitySet(); -#endif - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_recommends -// METHOD TYPE : CapabilitySet -// -// DESCRIPTION : -// -CapabilitySet RpmHeader::tag_recommends( std::set * freq_r ) const - { -#ifdef RPMTAG_OLDSUGGESTS - return PkgRelList_val( RPMTAG_RECOMMENDNAME, false, freq_r ); -#else - return CapabilitySet(); -#endif - } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_size -// METHOD TYPE : ByteCount -// -// DESCRIPTION : -// -ByteCount RpmHeader::tag_size() const -{ - return int_val( RPMTAG_SIZE ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_archivesize -// METHOD TYPE : ByteCount -// -// DESCRIPTION : -// -ByteCount RpmHeader::tag_archivesize() const -{ - return int_val( RPMTAG_ARCHIVESIZE ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_summary -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_summary() const -{ - return string_val( RPMTAG_SUMMARY ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_description -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_description() const -{ - return string_val( RPMTAG_DESCRIPTION ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_group -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_group() const -{ - return string_val( RPMTAG_GROUP ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_vendor -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_vendor() const -{ - return string_val( RPMTAG_VENDOR ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_distribution -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_distribution() const -{ - return string_val( RPMTAG_DISTRIBUTION ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_license -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_license() const -{ - return string_val( RPMTAG_LICENSE ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_buildhost -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_buildhost() const -{ - return string_val( RPMTAG_BUILDHOST ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_packager -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_packager() const -{ - return string_val( RPMTAG_PACKAGER ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_url -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_url() const -{ - return string_val( RPMTAG_URL ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_os -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_os() const -{ - return string_val( RPMTAG_OS ); - -} - -std::string RpmHeader::tag_prein() const -{ return string_val( RPMTAG_PREIN ); } - -std::string RpmHeader::tag_preinprog() const -{ return string_val( RPMTAG_PREINPROG ); } - -std::string RpmHeader::tag_postin() const -{ return string_val( RPMTAG_POSTIN ); } - -std::string RpmHeader::tag_postinprog() const -{ return string_val( RPMTAG_POSTINPROG ); } - -std::string RpmHeader::tag_preun() const -{ return string_val( RPMTAG_PREUN ); } - -std::string RpmHeader::tag_preunprog() const -{ return string_val( RPMTAG_PREUNPROG ); } - -std::string RpmHeader::tag_postun() const -{ return string_val( RPMTAG_POSTUN ); } - -std::string RpmHeader::tag_postunprog() const -{ return string_val( RPMTAG_POSTUNPROG ); } - -std::string RpmHeader::tag_pretrans() const -{ return string_val( RPMTAG_PRETRANS ); } - -std::string RpmHeader::tag_pretransprog() const -{ return string_val( RPMTAG_PRETRANSPROG ); } - -std::string RpmHeader::tag_posttrans() const -{ return string_val( RPMTAG_POSTTRANS ); } - -std::string RpmHeader::tag_posttransprog() const -{ return string_val( RPMTAG_POSTTRANSPROG ); } - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_sourcerpm -// METHOD TYPE : std::string -// -// DESCRIPTION : -// -std::string RpmHeader::tag_sourcerpm() const -{ - return string_val( RPMTAG_SOURCERPM ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_filenames -// METHOD TYPE : std::list -// -// DESCRIPTION : -// -std::list RpmHeader::tag_filenames() const -{ - std::list ret; - - stringList basenames; - if ( string_list( RPMTAG_BASENAMES, basenames ) ) - { - stringList dirnames; - string_list( RPMTAG_DIRNAMES, dirnames ); - intList dirindexes; - int_list( RPMTAG_DIRINDEXES, dirindexes ); - for ( unsigned i = 0; i < basenames.size(); ++ i ) - { - ret.push_back( dirnames[dirindexes[i]] + basenames[i] ); - } - } - - return ret; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_fileinfos -// METHOD TYPE : std::list -// -// DESCRIPTION : -// -std::list RpmHeader::tag_fileinfos() const -{ - std::list ret; - - stringList basenames; - if ( string_list( RPMTAG_BASENAMES, basenames ) ) - { - stringList dirnames; - string_list( RPMTAG_DIRNAMES, dirnames ); - intList dirindexes; - int_list( RPMTAG_DIRINDEXES, dirindexes ); - intList filesizes; - int_list( RPMTAG_FILESIZES, filesizes ); - stringList md5sums; - string_list( RPMTAG_FILEMD5S, md5sums ); - stringList usernames; - string_list( RPMTAG_FILEUSERNAME, usernames ); - stringList groupnames; - string_list( RPMTAG_FILEGROUPNAME, groupnames ); - intList uids; - int_list( RPMTAG_FILEUIDS, uids ); - intList gids; - int_list( RPMTAG_FILEGIDS, gids ); - intList filemodes; - int_list( RPMTAG_FILEMODES, filemodes ); - intList filemtimes; - int_list( RPMTAG_FILEMTIMES, filemtimes ); - intList fileflags; - int_list( RPMTAG_FILEFLAGS, fileflags ); - stringList filelinks; - string_list( RPMTAG_FILELINKTOS, filelinks ); - - for ( unsigned i = 0; i < basenames.size(); ++ i ) - { - uid_t uid; - if (uids.empty()) - { - uid = unameToUid( usernames[i].c_str(), &uid ); - } - else - { - uid =uids[i]; - } - - gid_t gid; - if (gids.empty()) - { - gid = gnameToGid( groupnames[i].c_str(), &gid ); - } - else - { - gid = gids[i]; - } - - FileInfo info = { - dirnames[dirindexes[i]] + basenames[i], - filesizes[i], - md5sums[i], - uid, - gid, - mode_t(filemodes[i]), - filemtimes[i], - bool(fileflags[i] & RPMFILE_GHOST), - filelinks[i] - }; - - ret.push_back( info ); - } - } - - return ret; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : RpmHeader::tag_changelog -// METHOD TYPE : Changelog -// -// DESCRIPTION : -// -Changelog RpmHeader::tag_changelog() const -{ - Changelog ret; - - intList times; - if ( int_list( RPMTAG_CHANGELOGTIME, times ) ) - { - stringList names; - string_list( RPMTAG_CHANGELOGNAME, names ); - stringList texts; - string_list( RPMTAG_CHANGELOGTEXT, texts ); - for ( unsigned i = 0; i < times.size(); ++ i ) - { - ret.push_back( ChangelogEntry( times[i], names[i], texts[i] ) ); - } - } - - return ret; -} - -} // namespace rpm -} // namespace target -} // namespace zypp diff --git a/libzypp/zypp/target/rpm/RpmHeader.h b/libzypp/zypp/target/rpm/RpmHeader.h deleted file mode 100644 index 697b2cb..0000000 --- a/libzypp/zypp/target/rpm/RpmHeader.h +++ /dev/null @@ -1,206 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/RpmHeader.h - * -*/ -#ifndef ZYPP_TARGET_RPM_RPMHEADER_H -#define ZYPP_TARGET_RPM_RPMHEADER_H - -#include -#include - -#include "zypp/target/rpm/BinHeader.h" - -#include "zypp/Package.h" -#include "zypp/Changelog.h" -#include "zypp/Pathname.h" - - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - -struct FileInfo -{ - Pathname filename; - ByteCount size; - std::string md5sum; - uid_t uid; - gid_t gid; - mode_t mode; - time_t mtime; - bool ghost; - Pathname link_target; -}; - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : RpmHeader -/** - * @short Wrapper class for rpm header struct. - * - * RpmHeader provides methods to query the content - * of a rpm header struct retrieved from the RPM database or by reading - * the rpm header of a package on disk. - * - * The rpm header contains all data associated with a package. So you - * probabely do not want to permanently store too many of them. - * - * NEVER create RpmHeader from a NULL Header! - **/ -class RpmHeader : public BinHeader -{ -public: - typedef intrusive_ptr Ptr; - typedef intrusive_ptr constPtr; - -private: - - CapabilitySet PkgRelList_val( tag tag_r, bool pre, std::set * freq_r = 0 ) const; - -public: - - /** - * - **/ - RpmHeader( Header h_r = 0 ); - - /** - * Dangerous!<\B> This one takes the header out of rhs - * and leaves rhs empty. - **/ - RpmHeader( BinHeader::Ptr & rhs ); - - virtual ~RpmHeader(); - - bool isSrc() const; //< Either 'src' or 'nosrc' - bool isNosrc() const; //< Only 'nosrc' - -public: - - std::string tag_name() const; - Edition::epoch_t tag_epoch() const; - std::string tag_version() const; - std::string tag_release() const; - Edition tag_edition() const; - Arch tag_arch() const; - - Date tag_installtime() const; - Date tag_buildtime() const; - - /** - * If freq_r is not NULL, file dependencies found are inserted. - **/ - CapabilitySet tag_provides ( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_requires ( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_prerequires ( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_conflicts( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_obsoletes( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_enhances( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_suggests( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_supplements( std::set * freq_r = 0 ) const; - /** - * @see #tag_provides - **/ - CapabilitySet tag_recommends( std::set * freq_r = 0 ) const; - - ByteCount tag_size() const; - ByteCount tag_archivesize() const; - - std::string tag_summary() const; - std::string tag_description() const; - std::string tag_group() const; - std::string tag_vendor() const; - std::string tag_distribution() const; - std::string tag_license() const; - std::string tag_buildhost() const; - std::string tag_packager() const; - std::string tag_url() const; - std::string tag_os() const; - std::string tag_prein() const; - std::string tag_preinprog() const; - std::string tag_postin() const; - std::string tag_postinprog() const; - std::string tag_preun() const; - std::string tag_preunprog() const; - std::string tag_postun() const; - std::string tag_postunprog() const; - std::string tag_pretrans() const; - std::string tag_pretransprog() const; - std::string tag_posttrans() const; - std::string tag_posttransprog()const; - std::string tag_sourcerpm() const; - - /** just the list of names */ - std::list tag_filenames() const; - - /** - * complete information about the files - * (extended version of tag_filenames()) - */ - std::list tag_fileinfos() const; - - Changelog tag_changelog() const; - -public: - - virtual std::ostream & dumpOn( std::ostream & str ) const; - -public: - - /** - * Digest and signature verification flags - **/ - enum VERIFICATION - { - VERIFY = 0x0000, - NODIGEST = (1<<0), - NOSIGNATURE = (1<<1), - NOVERIFY = 0xffff - }; - - /** - * Get an accessible packages data from disk. - * Returns NULL on any error. - **/ - static RpmHeader::constPtr readPackage( const Pathname & path, - VERIFICATION verification = VERIFY ); -}; - -/////////////////////////////////////////////////////////////////// -} // namespace rpm -} // namespace target -} // namespace zypp - -#endif // ZYPP_TARGET_RPM_RPMHEADER_H - diff --git a/libzypp/zypp/target/rpm/librpm.h b/libzypp/zypp/target/rpm/librpm.h deleted file mode 100644 index 17e801d..0000000 --- a/libzypp/zypp/target/rpm/librpm.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/librpm.h - * -*/ -#ifndef ZYPP_TARGET_RPM_LIBRPM_H -#define ZYPP_TARGET_RPM_LIBRPM_H - -#ifdef _RPM_5 -// needs to be outside 'extern "C"' -#include -#endif // _RPM_5 - -extern "C" -{ -#ifdef _RPM_5 -#include -#else -#include -#endif // _RPM_5 - -#include -#include -#include -#include -#include -} - -#endif // ZYPP_TARGET_RPM_LIBRPM_H diff --git a/libzypp/zypp/target/rpm/librpmDb.cc b/libzypp/zypp/target/rpm/librpmDb.cc deleted file mode 100644 index cc419dd..0000000 --- a/libzypp/zypp/target/rpm/librpmDb.cc +++ /dev/null @@ -1,932 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/librpmDb.cc - * -*/ -#include "librpm.h" - -#include - -#include "zypp/base/Logger.h" -#include "zypp/PathInfo.h" -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/rpm/RpmHeader.h" -#include "zypp/target/rpm/RpmException.h" - -using namespace std; - -namespace zypp -{ -namespace target -{ -namespace rpm -{ -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::D -/** - * @short librpmDb internal database handle - **/ -class librpmDb::D -{ - D & operator=( const D & ); // NO ASSIGNMENT! - D ( const D & ); // NO COPY! -public: - - const Pathname _root; // root directory for all operations - const Pathname _dbPath; // directory (below root) that contains the rpmdb - rpmts _ts; // transaction handle, includes database - shared_ptr _error; // database error - - friend ostream & operator<<( ostream & str, const D & obj ) - { - str << "{" << obj._error << "(" << obj._root << ")" << obj._dbPath << "}"; - return str; - } - - D( const Pathname & root_r, const Pathname & dbPath_r, bool readonly_r ) - : _root ( root_r ) - , _dbPath( dbPath_r ) - , _ts ( 0 ) - { - _error.reset(); - // set %_dbpath macro - ::addMacro( NULL, "_dbpath", NULL, _dbPath.asString().c_str(), RMIL_CMDLINE ); - - _ts = ::rpmtsCreate(); - ::rpmtsSetRootDir( _ts, _root.c_str() ); - - // check whether to create a new db - PathInfo master( _root + _dbPath + "Packages" ); - if ( ! master.isFile() ) - { - // init database - if ( filesystem::assert_dir(_root + _dbPath) != 0 ) - { - ERR << "Could not create dbpath " << (_root + _dbPath).asString() << endl; - _error = shared_ptr(new RpmInitException(_root, _dbPath)); - ZYPP_THROW(*_error); - } - int res = ::rpmtsInitDB( _ts, 0644 ); - if ( res ) - { - ERR << "rpmdbInit error(" << res << "): " << *this << endl; - _error = shared_ptr(new RpmInitException(_root, _dbPath)); - rpmtsFree(_ts); - ZYPP_THROW(*_error); - } - } - - // open database - int res = ::rpmtsOpenDB( _ts, (readonly_r ? O_RDONLY : O_RDWR )); - if ( res ) - { - ERR << "rpmdbOpen error(" << res << "): " << *this << endl; - _error = shared_ptr(new RpmDbOpenException(_root, _dbPath)); - rpmtsFree(_ts); - ZYPP_THROW(*_error); - return; - } - - DBG << "DBACCESS " << *this << endl; - } - - ~D() - { - if ( _ts ) - { - ::rpmtsFree(_ts); - } - } -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb (ststic interface) -// -/////////////////////////////////////////////////////////////////// - -Pathname librpmDb::_defaultRoot ( "/" ); -Pathname librpmDb::_defaultDbPath( "/var/lib/rpm" ); -librpmDb::constPtr librpmDb::_defaultDb; -bool librpmDb::_dbBlocked ( true ); - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::globalInit -// METHOD TYPE : bool -// -bool librpmDb::globalInit() -{ - static bool initialized = false; - - if ( initialized ) - return true; - - int rc = ::rpmReadConfigFiles( NULL, NULL ); - if ( rc ) - { - ERR << "rpmReadConfigFiles returned " << rc << endl; - return false; - } - - initialized = true; // Necessary to be able to use exand(). - -#define OUTVAL(n) << " (" #n ":" << expand( "%{" #n "}" ) << ")" - MIL << "librpm init done:" - OUTVAL(_target) - OUTVAL(_dbpath) - << endl; -#undef OUTVAL - return initialized; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::expand -// METHOD TYPE : std::string -// -std::string librpmDb::expand( const std::string & macro_r ) -{ - if ( ! globalInit() ) - return macro_r; // unexpanded - - char * val = ::rpmExpand( macro_r.c_str(), NULL ); - if ( !val ) - return ""; - - string ret( val ); - free( val ); - return ret; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::newLibrpmDb -// METHOD TYPE : librpmDb * -// -librpmDb * librpmDb::newLibrpmDb( Pathname root_r, Pathname dbPath_r, bool readonly_r ) -{ - // check arguments - if ( ! (root_r.absolute() && dbPath_r.absolute()) ) - { - ZYPP_THROW(RpmInvalidRootException(root_r, dbPath_r)); - } - - // initialize librpm - if ( ! globalInit() ) - { - ZYPP_THROW(GlobalRpmInitException()); - } - - // open rpmdb - librpmDb * ret = 0; - try - { - ret = new librpmDb( root_r, dbPath_r, readonly_r ); - } - catch (const RpmException & excpt_r) - { - ZYPP_CAUGHT(excpt_r); - delete ret; - ret = 0; - ZYPP_RETHROW(excpt_r); - } - return ret; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dbAccess -// METHOD TYPE : PMError -// -void librpmDb::dbAccess( const Pathname & root_r, const Pathname & dbPath_r ) -{ - // check arguments - if ( ! (root_r.absolute() && dbPath_r.absolute()) ) - { - ZYPP_THROW(RpmInvalidRootException(root_r, dbPath_r)); - } - - if ( _defaultDb ) - { - // already accessing a database: switching is not allowed. - if ( _defaultRoot == root_r && _defaultDbPath == dbPath_r ) - return; - else - { - ZYPP_THROW(RpmDbAlreadyOpenException(_defaultRoot, _defaultDbPath, root_r, dbPath_r)); - } - } - - // got no database: we could switch to a new one (even if blocked!) - _defaultRoot = root_r; - _defaultDbPath = dbPath_r; - MIL << "Set new database location: " << stringPath( _defaultRoot, _defaultDbPath ) << endl; - - return dbAccess(); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dbAccess -// METHOD TYPE : PMError -// -void librpmDb::dbAccess() -{ - if ( _dbBlocked ) - { - ZYPP_THROW(RpmAccessBlockedException(_defaultRoot, _defaultDbPath)); - } - - if ( !_defaultDb ) - { - // get access - _defaultDb = newLibrpmDb( _defaultRoot, _defaultDbPath, /*readonly*/true ); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dbAccess -// METHOD TYPE : PMError -// -void librpmDb::dbAccess( librpmDb::constPtr & ptr_r ) -{ - try - { - dbAccess(); - } - catch (const RpmException & excpt_r) - { - ZYPP_CAUGHT(excpt_r); - ptr_r = 0; - ZYPP_RETHROW(excpt_r); - } - ptr_r = _defaultDb; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dbRelease -// METHOD TYPE : unsigned -// -unsigned librpmDb::dbRelease( bool force_r ) -{ - if ( !_defaultDb ) - { - return 0; - } - - unsigned outstanding = _defaultDb->refCount() - 1; // refCount can't be 0 - - switch ( outstanding ) - { - default: - if ( !force_r ) - { - DBG << "dbRelease: keep access, outstanding " << outstanding << endl; - break; - } - // else fall through: - case 0: - DBG << "dbRelease: release" << (force_r && outstanding ? "(forced)" : "") - << ", outstanding " << outstanding << endl; - - _defaultDb->_d._error = shared_ptr(new RpmAccessBlockedException(_defaultDb->_d._root, _defaultDb->_d._dbPath)); - // tag handle invalid - _defaultDb = 0; - break; - } - - return outstanding; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::blockAccess -// METHOD TYPE : unsigned -// -unsigned librpmDb::blockAccess() -{ - MIL << "Block access" << endl; - _dbBlocked = true; - return dbRelease( /*force*/true ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::unblockAccess -// METHOD TYPE : void -// -void librpmDb::unblockAccess() -{ - MIL << "Unblock access" << endl; - _dbBlocked = false; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dumpState -// METHOD TYPE : ostream & -// -ostream & librpmDb::dumpState( ostream & str ) -{ - if ( !_defaultDb ) - { - return str << "[librpmDb " << (_dbBlocked?"BLOCKED":"CLOSED") << " " << stringPath( _defaultRoot, _defaultDbPath ) << "]"; - } - return str << "[" << _defaultDb << "]"; -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb (internal database handle interface (nonstatic)) -// -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::librpmDb -// METHOD TYPE : Constructor -// -// DESCRIPTION : -// -librpmDb::librpmDb( const Pathname & root_r, const Pathname & dbPath_r, bool readonly_r ) - : _d( * new D( root_r, dbPath_r, readonly_r ) ) -{} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::~librpmDb -// METHOD TYPE : Destructor -// -// DESCRIPTION : -// -librpmDb::~librpmDb() -{ - delete &_d; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::unref_to -// METHOD TYPE : void -// -void librpmDb::unref_to( unsigned refCount_r ) const -{ - if ( refCount_r == 1 ) - { - dbRelease(); - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::root -// METHOD TYPE : const Pathname & -// -const Pathname & librpmDb::root() const -{ - return _d._root; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dbPath -// METHOD TYPE : const Pathname & -// -const Pathname & librpmDb::dbPath() const -{ - return _d._dbPath; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::error -// METHOD TYPE : PMError -// -shared_ptr librpmDb::error() const -{ - return _d._error; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::empty -// METHOD TYPE : bool -// -bool librpmDb::empty() const -{ - return( valid() && ! *db_const_iterator( this ) ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::size -// METHOD TYPE : unsigned -// -unsigned librpmDb::size() const -{ - unsigned count = 0; - if ( valid() ) - { - db_const_iterator it( this ); - for ( db_const_iterator it( this ); *it; ++it ) - ++count; - } - return count; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dont_call_it -// METHOD TYPE : void * -// -void * librpmDb::dont_call_it() const -{ - return rpmtsGetRdb(_d._ts); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::dumpOn -// METHOD TYPE : ostream & -// -// DESCRIPTION : -// -ostream & librpmDb::dumpOn( ostream & str ) const -{ - ReferenceCounted::dumpOn( str ) << _d; - return str; -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::DbDirInfo -// -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::DbDirInfo::DbDirInfo -// METHOD TYPE : Constructor -// -librpmDb::DbDirInfo::DbDirInfo( const Pathname & root_r, const Pathname & dbPath_r ) - : _root( root_r ) - , _dbPath( dbPath_r ) -{ - // check and adjust arguments - if ( ! (root_r.absolute() && dbPath_r.absolute()) ) - { - ERR << "Relative path for root(" << _root << ") or dbPath(" << _dbPath << ")" << endl; - } - else - { - _dbDir ( _root + _dbPath ); - _dbV4 ( _dbDir.path() + "Packages" ); - _dbV3 ( _dbDir.path() + "packages.rpm" ); - _dbV3ToV4( _dbDir.path() + "packages.rpm3" ); - DBG << *this << endl; - } -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::DbDirInfo::update -// METHOD TYPE : void -// -void librpmDb::DbDirInfo::restat() -{ - _dbDir(); - _dbV4(); - _dbV3(); - _dbV3ToV4(); - DBG << *this << endl; -} - -/****************************************************************** -** -** -** FUNCTION NAME : operator<< -** FUNCTION TYPE : std::ostream & -*/ -std::ostream & operator<<( std::ostream & str, const librpmDb::DbDirInfo & obj ) -{ - if ( obj.illegalArgs() ) - { - str << "ILLEGAL: '(" << obj.root() << ")" << obj.dbPath() << "'"; - } - else - { - str << "'(" << obj.root() << ")" << obj.dbPath() << "':" << endl; - str << " Dir: " << obj._dbDir << endl; - str << " V4: " << obj._dbV4 << endl; - str << " V3: " << obj._dbV3 << endl; - str << " V3ToV4: " << obj._dbV3ToV4; - } - return str; -} - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::db_const_iterator::D -/** - * - **/ -class librpmDb::db_const_iterator::D -{ - D & operator=( const D & ); // NO ASSIGNMENT! - D ( const D & ); // NO COPY! -public: - - librpmDb::constPtr _dbptr; - shared_ptr _dberr; - - RpmHeader::constPtr _hptr; - rpmdbMatchIterator _mi; - - D( librpmDb::constPtr dbptr_r ) - : _dbptr( dbptr_r ) - , _mi( 0 ) - { - if ( !_dbptr ) - { - try - { - librpmDb::dbAccess( _dbptr ); - } - catch (const RpmException & excpt_r) - { - ZYPP_CAUGHT(excpt_r); - } - if ( !_dbptr ) - { - WAR << "No database access: " << _dberr << endl; - } - } - else - { - destroy(); // Checks whether _dbptr still valid - } - } - - ~D() - { - if ( _mi ) - { - ::rpmdbFreeIterator( _mi ); - } - } - - /** - * Let iterator access a dbindex file. Call @ref advance to access the - * 1st element (if present). - **/ - bool create( int rpmtag, const void * keyp = NULL, size_t keylen = 0 ) - { - destroy(); - if ( ! _dbptr ) - return false; - _mi = ::rpmtsInitIterator( _dbptr->_d._ts, rpmTag(rpmtag), keyp, keylen ); - return _mi; - } - - /** - * Destroy iterator. Invalidates _dbptr, if database was blocked meanwile. - * Always returns false. - **/ - bool destroy() - { - if ( _mi ) - { - _mi = ::rpmdbFreeIterator( _mi ); - _hptr = 0; - } - if ( _dbptr && _dbptr->error() ) - { - _dberr = _dbptr->error(); - WAR << "Lost database access: " << _dberr << endl; - _dbptr = 0; - } - return false; - } - - /** - * Advance to the first/next header in iterator. Destroys iterator if - * no more headers available. - **/ - bool advance() - { - if ( !_mi ) - return false; - Header h = ::rpmdbNextIterator( _mi ); - if ( ! h ) - { - destroy(); - return false; - } - _hptr = new RpmHeader( h ); - return true; - } - - /** - * Access a dbindex file and advance to the 1st header. - **/ - bool init( int rpmtag, const void * keyp = NULL, size_t keylen = 0 ) - { - if ( ! create( rpmtag, keyp, keylen ) ) - return false; - return advance(); - } - - /** - * Create an itertator that contains the database entry located at - * off_r, and advance to the 1st header. - **/ - bool set( int off_r ) - { - if ( ! create( RPMDBI_PACKAGES ) ) - return false; -#warning TESTCASE: rpmdbAppendIterator and (non)sequential access? -#ifdef RPMFILEITERMAX // since rpm.4.12 - ::rpmdbAppendIterator( _mi, (const unsigned *)&off_r, 1 ); -#else - ::rpmdbAppendIterator( _mi, &off_r, 1 ); -#endif - return advance(); - } - - unsigned offset() - { - return( _mi ? ::rpmdbGetIteratorOffset( _mi ) : 0 ); - } - - int size() - { - if ( !_mi ) - return 0; - int ret = ::rpmdbGetIteratorCount( _mi ); -#warning TESTCASE: rpmdbGetIteratorCount returns 0 on sequential access? - return( ret ? ret : -1 ); // -1: sequential access - } -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::Ptr::db_const_iterator -// -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::db_iterator -// METHOD TYPE : Constructor -// -librpmDb::db_const_iterator::db_const_iterator( librpmDb::constPtr dbptr_r ) - : _d( * new D( dbptr_r ) ) -{ - findAll(); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::~db_const_iterator -// METHOD TYPE : Destructor -// -librpmDb::db_const_iterator::~db_const_iterator() -{ - delete &_d; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::operator++ -// METHOD TYPE : void -// -void librpmDb::db_const_iterator::operator++() -{ - _d.advance(); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::dbHdrNum -// METHOD TYPE : unsigned -// -unsigned librpmDb::db_const_iterator::dbHdrNum() const -{ - return _d.offset(); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::operator* -// METHOD TYPE : const RpmHeader::constPtr & -// -const RpmHeader::constPtr & librpmDb::db_const_iterator::operator*() const -{ - return _d._hptr; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::dbError -// METHOD TYPE : PMError -// -shared_ptr librpmDb::db_const_iterator::dbError() const -{ - if ( _d._dbptr ) - return _d._dbptr->error(); - - return _d._dberr; -} - -/****************************************************************** -** -** -** FUNCTION NAME : operator<< -** FUNCTION TYPE : ostream & -*/ -ostream & operator<<( ostream & str, const librpmDb::db_const_iterator & obj ) -{ - str << "db_const_iterator(" << obj._d._dbptr - << " Size:" << obj._d.size() - << " HdrNum:" << obj._d.offset() - << ")"; - return str; -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findAll -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findAll() -{ - return _d.init( RPMDBI_PACKAGES ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findByFile -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findByFile( const std::string & file_r ) -{ - return _d.init( RPMTAG_BASENAMES, file_r.c_str() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findByProvides -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findByProvides( const std::string & tag_r ) -{ - return _d.init( RPMTAG_PROVIDENAME, tag_r.c_str() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findByRequiredBy -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findByRequiredBy( const std::string & tag_r ) -{ - return _d.init( RPMTAG_REQUIRENAME, tag_r.c_str() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findByConflicts -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findByConflicts( const std::string & tag_r ) -{ - return _d.init( RPMTAG_CONFLICTNAME, tag_r.c_str() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::findByName -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findByName( const string & name_r ) -{ - return _d.init( RPMTAG_NAME, name_r.c_str() ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findPackage -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findPackage( const string & name_r ) -{ - if ( ! _d.init( RPMTAG_NAME, name_r.c_str() ) ) - return false; - - if ( _d.size() == 1 ) - return true; - - // check installtime on multiple entries - int match = 0; - time_t itime = 0; - for ( ; operator*(); operator++() ) - { - if ( operator*()->tag_installtime() > itime ) - { - match = _d.offset(); - itime = operator*()->tag_installtime(); - } - } - - return _d.set( match ); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findPackage -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findPackage( const std::string & name_r, const Edition & ed_r ) -{ - if ( ! _d.init( RPMTAG_NAME, name_r.c_str() ) ) - return false; - - for ( ; operator*(); operator++() ) - { - if ( ed_r == operator*()->tag_edition() ) - { - int match = _d.offset(); - return _d.set( match ); - } - } - - return _d.destroy(); -} - -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : librpmDb::db_const_iterator::findPackage -// METHOD TYPE : bool -// -bool librpmDb::db_const_iterator::findPackage( const Package::constPtr & which_r ) -{ - if ( ! which_r ) - return _d.destroy(); - - return findPackage( which_r->name(), which_r->edition() ); -} - -} // namespace rpm -} // namespace target -} // namespace zypp diff --git a/libzypp/zypp/target/rpm/librpmDb.cv3.cc b/libzypp/zypp/target/rpm/librpmDb.cv3.cc deleted file mode 100644 index 185f7af..0000000 --- a/libzypp/zypp/target/rpm/librpmDb.cv3.cc +++ /dev/null @@ -1,750 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/librpmDb.cv3.cc - * - */ -#if 0 -#include "librpm.h" -extern "C" -{ -#ifdef _RPM_5 -typedef rpmuint32_t rpm_count_t; -#define HGEPtr_t void * -#define headerGetEntryMinMemory headerGetEntry -#define headerNVR(h,n,v,r) headerNEVRA(h,n,NULL,v,r,NULL) -#else -#ifdef _RPM_4_4 -typedef int32_t rpm_count_t; -#define HGEPtr_t const void * -#endif -#endif -} - -#include - -#include "zypp/base/Logger.h" - -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/rpm/RpmCallbacks.h" -#include "zypp/ZYppCallbacks.h" - -#define xmalloc malloc -#define xstrdup strdup - -extern "C" -{ -#include - -#define FA_MAGIC 0x02050920 - - struct faFileHeader - { - unsigned int magic; - unsigned int firstFree; - }; - - struct faHeader - { - unsigned int size; - unsigned int freeNext; /* offset of the next free block, 0 if none */ - unsigned int freePrev; - unsigned int isFree; - - /* note that the u16's appear last for alignment/space reasons */ - }; -} - -namespace zypp -{ -namespace target -{ -namespace rpm -{ -static int fadFileSize; - -static ssize_t Pread(FD_t fd, void * buf, size_t count, off_t offset) -{ - if (Fseek(fd, offset, SEEK_SET) < 0) - return -1; - return Fread(buf, sizeof(char), count, fd); -} - -static FD_t fadOpen(const char * path) -{ - struct faFileHeader newHdr; - FD_t fd; - struct stat stb; - - fd = Fopen(path, "r.fdio"); - if (!fd || Ferror(fd)) - return NULL; - - if (fstat(Fileno(fd), &stb)) - { - Fclose(fd); - return NULL; - } - fadFileSize = stb.st_size; - - /* is this file brand new? */ - if (fadFileSize == 0) - { - Fclose(fd); - return NULL; - } - if (Pread(fd, &newHdr, sizeof(newHdr), 0) != sizeof(newHdr)) - { - Fclose(fd); - return NULL; - } - if (newHdr.magic != FA_MAGIC) - { - Fclose(fd); - return NULL; - } - /*@-refcounttrans@*/ return fd /*@=refcounttrans@*/ ; -} - -static int fadNextOffset(FD_t fd, unsigned int lastOffset) -{ - struct faHeader header; - int offset; - - offset = (lastOffset) - ? (lastOffset - sizeof(header)) - : sizeof(struct faFileHeader); - - if (offset >= fadFileSize) - return 0; - - if (Pread(fd, &header, sizeof(header), offset) != sizeof(header)) - return 0; - - if (!lastOffset && !header.isFree) - return (offset + sizeof(header)); - - do - { - offset += header.size; - - if (Pread(fd, &header, sizeof(header), offset) != sizeof(header)) - return 0; - - if (!header.isFree) break; - } - while (offset < fadFileSize && header.isFree); - - if (offset < fadFileSize) - { - /* Sanity check this to make sure we're not going in loops */ - offset += sizeof(header); - - if (offset < 0 || (unsigned)offset <= lastOffset) return -1; - - return offset; - } - else - return 0; -} - -static int fadFirstOffset(FD_t fd) -{ - return fadNextOffset(fd, 0); -} - -/*@-boundsread@*/ -static int dncmp(const void * a, const void * b) -/*@*/ -{ - const char *const * first = (const char *const *)a; - const char *const * second = (const char *const *)b; - return strcmp(*first, *second); -} -/*@=boundsread@*/ - -/*@-bounds@*/ -#ifndef _RPM_4_X -static void compressFilelist(Header h) -/*@*/ -{ - char ** fileNames; - const char ** dirNames; - const char ** baseNames; - int_32 * dirIndexes; - rpmTagType fnt; - rpm_count_t count; - int xx; - int dirIndex = -1; - - /* - * This assumes the file list is already sorted, and begins with a - * single '/'. That assumption isn't critical, but it makes things go - * a bit faster. - */ - - if (headerIsEntry(h, RPMTAG_DIRNAMES)) - { - xx = headerRemoveEntry(h, RPMTAG_OLDFILENAMES); - return; /* Already converted. */ - } - - HGEPtr_t hgePtr = NULL; - if (!headerGetEntryMinMemory(h, RPMTAG_OLDFILENAMES, hTYP_t(&fnt), &hgePtr, &count)) - return; /* no file list */ - fileNames = (char **)hgePtr; - if (fileNames == NULL || count <= 0) - return; - - dirNames = (const char **)alloca(sizeof(*dirNames) * count); /* worst case */ - baseNames = (const char **)alloca(sizeof(*dirNames) * count); - dirIndexes = (int_32 *)alloca(sizeof(*dirIndexes) * count); - - if (fileNames[0][0] != '/') - { - /* HACK. Source RPM, so just do things differently */ - dirIndex = 0; - dirNames[dirIndex] = ""; - for (rpm_count_t i = 0; i < count; i++) - { - dirIndexes[i] = dirIndex; - baseNames[i] = fileNames[i]; - } - goto exit; - } - - /*@-branchstate@*/ - for (rpm_count_t i = 0; i < count; i++) - { - const char ** needle; - char savechar; - char * baseName; - int len; - - if (fileNames[i] == NULL) /* XXX can't happen */ - continue; - baseName = strrchr(fileNames[i], '/') + 1; - len = baseName - fileNames[i]; - needle = dirNames; - savechar = *baseName; - *baseName = '\0'; - /*@-compdef@*/ - if (dirIndex < 0 || - (needle = (const char **)bsearch(&fileNames[i], dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) - { - char *s = (char *)alloca(len + 1); - memcpy(s, fileNames[i], len + 1); - s[len] = '\0'; - dirIndexes[i] = ++dirIndex; - dirNames[dirIndex] = s; - } - else - dirIndexes[i] = needle - dirNames; - /*@=compdef@*/ - - *baseName = savechar; - baseNames[i] = baseName; - } - /*@=branchstate@*/ - -exit: - if (count > 0) - { - xx = headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, dirIndexes, count); - xx = headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE, - baseNames, count); - xx = headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE, - dirNames, dirIndex + 1); - } - - fileNames = (char**)headerFreeData(fileNames, fnt); - - xx = headerRemoveEntry(h, RPMTAG_OLDFILENAMES); -} -/*@=bounds@*/ - -/* - * Up to rpm 3.0.4, packages implicitly provided their own name-version-release. - * Retrofit an explicit "Provides: name = epoch:version-release". - */ -void providePackageNVR(Header h) -{ - const char *name, *version, *release; - HGEPtr_t hgePtr = NULL; - int_32 * epoch; - const char *pEVR; - char *p; - int_32 pFlags = RPMSENSE_EQUAL; - const char ** provides = NULL; - const char ** providesEVR = NULL; - rpmTagType pnt, pvt; - int_32 * provideFlags = NULL; - rpm_count_t providesCount; - int xx; - int bingo = 1; - - /* Generate provides for this package name-version-release. */ - xx = headerNVR(h, &name, &version, &release); - if (!(name && version && release)) - return; - pEVR = p = (char *)alloca(21 + strlen(version) + 1 + strlen(release) + 1); - *p = '\0'; - if (headerGetEntryMinMemory(h, RPMTAG_EPOCH, NULL, &hgePtr, NULL)) - { - epoch = (int_32 *)hgePtr; - sprintf(p, "%d:", *epoch); - while (*p != '\0') - p++; - } - (void) stpcpy( stpcpy( stpcpy(p, version) , "-") , release); - - /* - * Rpm prior to 3.0.3 does not have versioned provides. - * If no provides at all are available, we can just add. - */ - if (!headerGetEntryMinMemory(h, RPMTAG_PROVIDENAME, hTYP_t(&pnt), &hgePtr, &providesCount)) - goto exit; - provides = (const char **)hgePtr; - - /* - * Otherwise, fill in entries on legacy packages. - */ - if (!headerGetEntryMinMemory(h, RPMTAG_PROVIDEVERSION, hTYP_t(&pvt), &hgePtr, NULL)) - { - providesEVR = (const char **)hgePtr; - for (rpm_count_t i = 0; i < providesCount; i++) - { - const char * vdummy = ""; - int_32 fdummy = RPMSENSE_ANY; - xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE, - &vdummy, 1); - xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE, - &fdummy, 1); - } - goto exit; - } - - xx = headerGetEntryMinMemory(h, RPMTAG_PROVIDEFLAGS, NULL, &hgePtr, NULL); - provideFlags = (int_32 *)hgePtr; - - /*@-nullderef@*/ /* LCL: providesEVR is not NULL */ - if (provides && providesEVR && provideFlags) - for (rpm_count_t i = 0; i < providesCount; i++) - { - if (!(provides[i] && providesEVR[i])) - continue; - if (!(provideFlags[i] == RPMSENSE_EQUAL && - !strcmp(name, provides[i]) && !strcmp(pEVR, providesEVR[i]))) - continue; - bingo = 0; - break; - } - /*@=nullderef@*/ - -exit: - provides = (const char **)headerFreeData(provides, pnt); - providesEVR = (const char **)headerFreeData(providesEVR, pvt); - - if (bingo) - { - xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE, - &name, 1); - xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE, - &pFlags, 1); - xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE, - &pEVR, 1); - } -} -#else -static void compressFilelist(Header h) -{ - struct rpmtd_s fileNames; - char ** dirNames; - const char ** baseNames; - uint32_t * dirIndexes; - rpm_count_t count; - int xx, i; - int dirIndex = -1; - - /* - * This assumes the file list is already sorted, and begins with a - * single '/'. That assumption isn't critical, but it makes things go - * a bit faster. - */ - - if (headerIsEntry(h, RPMTAG_DIRNAMES)) { - xx = headerDel(h, RPMTAG_OLDFILENAMES); - return; /* Already converted. */ - } - - if (!headerGet(h, RPMTAG_OLDFILENAMES, &fileNames, HEADERGET_MINMEM)) - return; - count = rpmtdCount(&fileNames); - if (count < 1) - return; - - dirNames = (char**)malloc(sizeof(*dirNames) * count); /* worst case */ - baseNames = (const char**)malloc(sizeof(*dirNames) * count); - dirIndexes = (uint32_t*)malloc(sizeof(*dirIndexes) * count); - - /* HACK. Source RPM, so just do things differently */ - { const char *fn = rpmtdGetString(&fileNames); - if (fn && *fn != '/') { - dirIndex = 0; - dirNames[dirIndex] = xstrdup(""); - while ((i = rpmtdNext(&fileNames)) >= 0) { - dirIndexes[i] = dirIndex; - baseNames[i] = rpmtdGetString(&fileNames); - } - goto exit; - } - } - - while ((i = rpmtdNext(&fileNames)) >= 0) { - char ** needle; - char savechar; - char * baseName; - size_t len; - const char *filename = rpmtdGetString(&fileNames); - - if (filename == NULL) /* XXX can't happen */ - continue; - baseName = strrchr((char*)filename, '/') + 1; - len = baseName - filename; - needle = dirNames; - savechar = *baseName; - *baseName = '\0'; - if (dirIndex < 0 || - (needle = (char**)bsearch(&filename, dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) { - char *s = (char*)malloc(len + 1); - rstrlcpy(s, filename, len + 1); - dirIndexes[i] = ++dirIndex; - dirNames[dirIndex] = s; - } else - dirIndexes[i] = needle - dirNames; - - *baseName = savechar; - baseNames[i] = baseName; - } - -exit: - if (count > 0) { - headerPutUint32(h, RPMTAG_DIRINDEXES, dirIndexes, count); - headerPutStringArray(h, RPMTAG_BASENAMES, baseNames, count); - headerPutStringArray(h, RPMTAG_DIRNAMES, - (const char **) dirNames, dirIndex + 1); - } - - rpmtdFreeData(&fileNames); - for (i = 0; i <= dirIndex; i++) { - free(dirNames[i]); - } - free(dirNames); - free(baseNames); - free(dirIndexes); - - xx = headerDel(h, RPMTAG_OLDFILENAMES); -} - -/* - * Up to rpm 3.0.4, packages implicitly provided their own name-version-release. - * Retrofit an explicit "Provides: name = epoch:version-release. - */ -static void providePackageNVR(Header h) -{ - const char *name; - char *pEVR; - rpmsenseFlags pFlags = RPMSENSE_EQUAL; - int bingo = 1; - struct rpmtd_s pnames; - rpmds hds, nvrds; - - /* Generate provides for this package name-version-release. */ - pEVR = headerGetEVR(h, &name); - if (!(name && pEVR)) - return; - - /* - * Rpm prior to 3.0.3 does not have versioned provides. - * If no provides at all are available, we can just add. - */ - if (!headerGet(h, RPMTAG_PROVIDENAME, &pnames, HEADERGET_MINMEM)) { - goto exit; - } - - /* - * Otherwise, fill in entries on legacy packages. - */ - if (!headerIsEntry(h, RPMTAG_PROVIDEVERSION)) { - while (rpmtdNext(&pnames) >= 0) { - uint32_t fdummy = RPMSENSE_ANY; - - headerPutString(h, RPMTAG_PROVIDEVERSION, ""); - headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &fdummy, 1); - } - goto exit; - } - - /* see if we already have this provide */ - hds = rpmdsNew(h, RPMTAG_PROVIDENAME, 0); - nvrds = rpmdsSingle(RPMTAG_PROVIDENAME, name, pEVR, pFlags); - if (rpmdsFind(hds, nvrds) >= 0) { - bingo = 0; - } - rpmdsFree(hds); - rpmdsFree(nvrds); - -exit: - if (bingo) { - const char *evr = pEVR; - uint32_t fdummy = pFlags; - headerPutString(h, RPMTAG_PROVIDENAME, name); - headerPutString(h, RPMTAG_PROVIDEVERSION, evr); - headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &fdummy, 1); - } - rpmtdFreeData(&pnames); - free(pEVR); -} - -#endif - -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - -using namespace std; - -#undef Y2LOG -#define Y2LOG "librpmDb" - -/****************************************************************** -** -** -** FUNCTION NAME : internal_convertV3toV4 -** FUNCTION TYPE : int -*/ -void internal_convertV3toV4( const Pathname & v3db_r, const librpmDb::constPtr & v4db_r, - callback::SendReport & report ) -{ -// Timecount _t( "convert V3 to V4" ); - MIL << "Convert rpm3 database to rpm4" << endl; - - // Check arguments - FD_t fd = fadOpen( v3db_r.asString().c_str() ); - if ( fd == 0 ) - { - Fclose( fd ); - ZYPP_THROW(RpmDbOpenException(Pathname("/"), v3db_r)); - } - - if ( ! v4db_r ) - { - Fclose( fd ); - INT << "NULL rpmV4 database passed as argument!" << endl; - ZYPP_THROW(RpmNullDatabaseException()); - } - - shared_ptr err = v4db_r->error(); - if ( err ) - { - Fclose( fd ); - INT << "Can't access rpmV4 database " << v4db_r << endl; - ZYPP_THROW(*err); - } - - // open rpmV4 database for writing. v4db_r is ok so librpm should - // be properly initialized. - rpmdb db = 0; - string rootstr( v4db_r->root().asString() ); - const char * root = ( rootstr == "/" ? NULL : rootstr.c_str() ); - - int res = ::rpmdbOpen( root, &db, O_RDWR, 0644 ); - if ( res || ! db ) - { - if ( db ) - { - ::rpmdbClose( db ); - } - Fclose( fd ); - ZYPP_THROW(RpmDbOpenException(root, v4db_r->dbPath())); - } - - // Check ammount of packages to process. - int max = 0; - for ( int offset = fadFirstOffset(fd); offset; offset = fadNextOffset(fd, offset) ) - { - ++max; - } - MIL << "Packages in rpmV3 database " << v3db_r << ": " << max << endl; - - unsigned failed = 0; - unsigned ignored = 0; - unsigned alreadyInV4 = 0; - report->progress( (100 * (failed + ignored + alreadyInV4) / max), v3db_r ); - - if ( !max ) - { - Fclose( fd ); - ::rpmdbClose( db ); - return; - } - - // Start conversion. -#warning Add CBSuggest handling if needed, also on lines below -// CBSuggest proceed; - bool proceed = true; - for ( int offset = fadFirstOffset(fd); offset && proceed /*!= CBSuggest::CANCEL*/; - offset = fadNextOffset(fd, offset), - report->progress( (100 * (failed + ignored + alreadyInV4) / max), v3db_r ) ) - { - - // have to use lseek instead of Fseek because headerRead - // uses low level IO - if ( lseek( Fileno( fd ), (off_t)offset, SEEK_SET ) == -1 ) - { - ostream * reportAs = &(ERR); - /* proceed = report->dbReadError( offset ); - if ( proceed == CBSuggest::SKIP ) { - // ignore this error - ++ignored; - reportAs = &(WAR << "IGNORED: "); - } else {*/ - // PROCEED will fail after conversion; CANCEL immediately stop loop - ++failed; -// } - (*reportAs) << "rpmV3 database entry: Can't seek to offset " << offset << " (errno " << errno << ")" << endl; - continue; - } - Header h = headerRead(fd, HEADER_MAGIC_NO); - if ( ! h ) - { - ostream * reportAs = &(ERR); - /* proceed = report->dbReadError( offset ); - if ( proceed == CBSuggest::SKIP ) { - // ignore this error - ++ignored; - reportAs = &(WAR << "IGNORED: "); - } else {*/ - // PROCEED will fail after conversion; CANCEL immediately stop loop - ++failed; -// } - (*reportAs) << "rpmV3 database entry: No header at offset " << offset << endl; - continue; - } - compressFilelist(h); - providePackageNVR(h); - const char *name = 0; - const char *version = 0; - const char *release = 0; - headerNVR(h, &name, &version, &release); - string nrv( string(name) + "-" + version + "-" + release ); - rpmdbMatchIterator mi = rpmdbInitIterator(db, RPMTAG_NAME, name, 0); - rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT, version); - rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_DEFAULT, release); - if (rpmdbNextIterator(mi)) - { -// report.dbInV4( nrv ); - WAR << "SKIP: rpmV3 database entry: " << nrv << " is already in rpmV4 database" << endl; - rpmdbFreeIterator(mi); - headerFree(h); - ++alreadyInV4; - continue; - } - rpmdbFreeIterator(mi); -#ifdef _RPM_5 - if (rpmdbAdd(db, -1, h, 0)) -#else - if (rpmdbAdd(db, -1, h, 0, 0)) -#endif - { -// report.dbWriteError( nrv ); - proceed = false;//CBSuggest::CANCEL; // immediately stop loop - ++failed; - ERR << "rpmV4 database error: could not add " << nrv << " to rpmV4 database" << endl; - headerFree(h); - continue; - } - headerFree(h); - } - - Fclose(fd); - ::rpmdbClose(db); - - if ( failed ) - { - ERR << "Convert rpm3 database to rpm4: Aborted after " - << alreadyInV4 << " package(s) and " << (failed+ignored) << " error(s)." - << endl; - ZYPP_THROW(RpmDbConvertException()); - } - else - { - MIL << "Convert rpm3 database to rpm4: " << max << " package(s) processed"; - if ( alreadyInV4 ) - { - MIL << "; " << alreadyInV4 << " already present in rpmV4 database"; - } - if ( ignored ) - { - MIL << "; IGNORED: " << ignored << " unconverted due to error"; - } - MIL << endl; - } -} -#endif - -#include - -#include "zypp/base/Logger.h" - -#include "zypp/target/rpm/librpmDb.h" -#include "zypp/target/rpm/RpmCallbacks.h" -#include "zypp/ZYppCallbacks.h" - -using namespace std; - -#undef Y2LOG -#define Y2LOG "librpmDb" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ -/****************************************************************** -* -* -* FUNCTION NAME : convertV3toV4 -* -* \throws RpmException -* -*/ -void convertV3toV4( const Pathname & v3db_r, const librpmDb::constPtr & v4db_r ) -{ - // report - callback::SendReport report; - report->start(v3db_r); - try - { - // Does no longer work with rpm 4.9. - // internal_convertV3toV4( v3db_r, v4db_r, report ); - INT << "Unsupported: Convert rpm3 database to rpm4" << endl; - ZYPP_THROW(RpmDbOpenException(Pathname("/"), v3db_r)); - } - catch (RpmException & excpt_r) - { - report->finish(v3db_r, ConvertDBReport::FAILED,excpt_r.asUserString()); - ZYPP_RETHROW(excpt_r); - } - report->finish(v3db_r, ConvertDBReport::NO_ERROR, ""); -} - -} // namespace rpm -} // namespace target -} // namespace zypp diff --git a/libzypp/zypp/target/rpm/librpmDb.h b/libzypp/zypp/target/rpm/librpmDb.h deleted file mode 100644 index 50dfc81..0000000 --- a/libzypp/zypp/target/rpm/librpmDb.h +++ /dev/null @@ -1,627 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/target/rpm/librpmDb.h - * -*/ -#ifndef librpmDb_h -#define librpmDb_h - -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/PathInfo.h" -#include "zypp/Package.h" -#include "zypp/target/rpm/RpmHeader.h" -#include "zypp/target/rpm/RpmException.h" - -namespace zypp -{ -namespace target -{ -namespace rpm -{ - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb -/** - * @short Manage access to librpm database. - **/ -class librpmDb : public base::ReferenceCounted, private base::NonCopyable -{ -public: - typedef intrusive_ptr Ptr; - typedef intrusive_ptr constPtr; -private: - /** - * INTENTIONALLY UNDEFINED<\B> because of bug in Ptr classes - * which allows implicit conversion from librpmDb::Ptr to - * librpmDb::constPtr. Currently we don't want to provide non const - * handles, as the database is opened READONLY. - * - * \throws RpmException - * - **/ - static void dbAccess( librpmDb::Ptr & ptr_r ); - -public: - - /////////////////////////////////////////////////////////////////// - // - // static interface - // - /////////////////////////////////////////////////////////////////// -private: - - /** - * Current root directory for all operations. - * (initialy /) - **/ - static Pathname _defaultRoot; - - /** - * Current directory (below root) that contains the rpmdb. - * (initialy /var/lib/rpm) - **/ - static Pathname _defaultDbPath; - - /** - * Current rpmdb handle. - **/ - static librpmDb::constPtr _defaultDb; - - /** - * Whether access is blocked (no _defaultDb will be available). - **/ - static bool _dbBlocked; - - /** - * For internal use. Pointer returned should immediately be - * wrapped into librpmDb::Ptr. - * - * \throws RpmException - * - **/ - static librpmDb * newLibrpmDb( Pathname root_r, Pathname dbPath_r, bool readonly_r ); - - /** - * Access the database at the current default location. If necessary - * (eg. after @ref dbRelease), the database is opened. This just creates - * the internal handle. Once the handle is passed to e.g. some - * @ref db_const_iterator, the database will be closed if the last - * outstanding reference goes out of scope. If no external reference is - * created, you'll have to explicitly call @ref dbRelease to close the - * database. - * - * \throws RpmException - * - **/ - static void dbAccess(); - -public: - - /** - * Initialize lib librpm (read configfiles etc.). It's called - * on demand but you may call it anytime. - * - * @return Whether librpm is initialized. - **/ - static bool globalInit(); - - /** - * @return librpm macro expansion. - **/ - static std::string expand( const std::string & macro_r ); - - /** - * @return String '(root_r)sub_r' used in debug output. - **/ - static std::string stringPath( const Pathname & root_r, const Pathname & sub_r ) - { - return std::string( "'(" ) + root_r.asString() + ")" + sub_r.asString() + "'"; - } - -public: - - /** - * @return Current root directory for all operations. - **/ - static const Pathname & defaultRoot() - { - return _defaultRoot; - } - - /** - * @return Current directory (below root) that contains the rpmdb. - **/ - static const Pathname & defaultDbPath() - { - return _defaultDbPath; - } - - /** - * Adjust access to the given database location, making it the new - * default location on success. No relative Pathnames are allowed. - * - * It's not possible to access a database while access is blocked - * (see @ref blockAccess), but valid Pathnames provided will be stored - * as new default location. - * - * It's not allowed to switch to another location while a database - * is accessed. Use @ref dbRelease to force releasing the database first. - * - * \throws RpmException - * - **/ - static void dbAccess( const Pathname & root_r, const Pathname & dbPath_r ); - - /** - * Same as &ref dbAccess(), but returns the database handle if - * avaialble, otherwise NULL. This creates an external reference, thus - * it should not be used longer than necessary. Be prepared that the - * handle might become invalid (see @ref dbRelease) later. - * - * \throws RpmException - * - **/ - static void dbAccess( librpmDb::constPtr & ptr_r ); - - /** - * If there are no outstanding references to the database (e.g. by @ref db_const_iterator), - * the database is closed. Subsequent calls to @ref dbAccess may however - * open the database again. - * - * If forced, the internal reference is dropped and it will look like - * the database was closed. But physically the database will be closed - * after all outstanding references are gone. - * - * @return The number of outstandig references to the database, 0 if - * if database was physically closed. - **/ - static unsigned dbRelease( bool force_r = false ); - - /** - * Blocks further access to rpmdb. Basically the same as @ref dbRelease( true ), - * but subsequent calls to @ref dbAccess will fail returning E_RpmDB_access_blocked. - * - * @return The number of outstandig references to the database, 0 if - * if database was physically closed. - **/ - static unsigned blockAccess(); - - /** - * Allow access to rpmdb e.g. after @ref blockAccess. Subsequent calls to - * @ref dbAccess will perform. - * - * NOTE: Initially we're in blocked mode. So you must call @ref unblockAccess - * unblockAccess at least once. Othwise nothing will happen. - * - * @return The number of outstandig references to the database, 0 if - * if database was physically closed. - **/ - static void unblockAccess(); - - /** - * @return Whether database access is blocked. - **/ - static bool isBlocked() - { - return _dbBlocked; - } - - /** - * Dump debug info. - **/ - static std::ostream & dumpState( std::ostream & str ); - -public: - - /** - * Collect info about what kind of rpmdb seems to be present by - * looking at paths and filenames. - **/ - class DbDirInfo; - - /** - * Subclass to retrieve database content. - **/ - class db_const_iterator; - -private: - /////////////////////////////////////////////////////////////////// - // - // internal database handle interface (nonstatic) - // - /////////////////////////////////////////////////////////////////// - - /** - * Hides librpm specific data - **/ - class D; - D & _d; - -protected: - - /** - * Private constructor! librpmDb objects are to be created via - * static interface only. - **/ - librpmDb( const Pathname & root_r, const Pathname & dbPath_r, bool readonly_r ); - - /** - * Trigger from @ref Rep, after refCount was decreased. - **/ - virtual void unref_to( unsigned refCount_r ) const; - -public: - - /** - * Destructor. Closes rpmdb. - **/ - virtual ~librpmDb(); - - /** - * @return This handles root directory for all operations. - **/ - const Pathname & root() const; - - /** - * @return This handles directory that contains the rpmdb. - **/ - const Pathname & dbPath() const; - - /** - * Return any database error. Usg. if the database was - * blocked by calling @ref dbRelease(true) or @ref blockAccess. - **/ - shared_ptr error() const; - - /** - * @return Whether handle is valid. - **/ - bool valid() const - { - return( ! error() ); - } - - /** - * @return True if handle is valid and database is empty. - **/ - bool empty() const; - - /** - * @return Number of entries in the database (0 if not valid). - **/ - unsigned size() const; - -public: - - /** - * Dont call it ;) It's for development and testing only. - **/ - void * dont_call_it() const; - - /** - * Dump debug info. - **/ - virtual std::ostream & dumpOn( std::ostream & str ) const; -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::DbDirInfo -/** - * Collect info about what kind of rpmdb seems to be present by - * looking at paths and filenames. - **/ -class librpmDb::DbDirInfo -{ - friend std::ostream & operator<<( std::ostream & str, const DbDirInfo & obj ); - -private: - - /** - * Root directory for all operations. - **/ - Pathname _root; - - /** - * Directory that contains the rpmdb. - **/ - Pathname _dbPath; - - /** - * database directory (unset on illegal constructor arguments) - **/ - PathInfo _dbDir; - - /** - * rpmV4 database (_dbDir/Packages) - **/ - PathInfo _dbV4; - - /** - * rpmV3 database (_dbDir/packages.rpm) - **/ - PathInfo _dbV3; - - /** - * rpmV3 database backup created on conversion to rpmV4 (_dbDir/packages.rpm3) - **/ - PathInfo _dbV3ToV4; - -public: - - /** - * For Constructor arguments see @ref accessPath. On illegal - * arguments @ref _dbDir is unset. - **/ - DbDirInfo( const Pathname & root_r, const Pathname & dbPath_r ); - -public: - - /** - * Root directory for all operations. - **/ - const Pathname & root() const - { - return _root; - } - - /** - * Directory that contains the rpmdb. - **/ - const Pathname & dbPath() const - { - return _dbPath; - } - - /** - * database directory (unset on illegal constructor arguments) - **/ - const PathInfo & dbDir() const - { - return _dbDir; - } - - /** - * rpmV4 database (_dbDir/Packages) - **/ - const PathInfo & dbV4() const - { - return _dbV4; - } - - /** - * rpmV3 database (_dbDir/packages.rpm) - **/ - const PathInfo & dbV3() const - { - return _dbV3; - } - - /** - * rpmV3 database backup created on conversion to rpmV4 (_dbDir/packages.rpm3) - **/ - const PathInfo & dbV3ToV4() const - { - return _dbV3ToV4; - } - -public: - - /** - * Restat all paths - **/ - void restat(); - -public: - - /** - * Whether constructor arguments were illegal. - **/ - bool illegalArgs() const - { - return _dbDir.path().empty(); - } - - /** - * Whether constructor arguments were llegal and dbDir either - * is a directory or may be created (path does not exist). - **/ - bool usableArgs() const - { - return _dbDir.isDir() || ! ( _dbDir.path().empty() || _dbDir.isExist() ); - } - - /** - * Whether dbDir directory exists. - **/ - bool hasDbDir() const - { - return _dbDir.isDir(); - } - - /** - * Whether dbV4 file exists. - **/ - bool hasDbV4() const - { - return _dbV4.isFile(); - } - - /** - * Whether dbV3 file exists. - **/ - bool hasDbV3() const - { - return _dbV3.isFile(); - } - - /** - * Whether dbV3ToV4 file exists. - **/ - bool hasDbV3ToV4() const - { - return _dbV3ToV4.isFile(); - } -}; - -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// CLASS NAME : librpmDb::db_const_iterator -/** - * @short Subclass to retrieve database content. - * - * - **/ -class librpmDb::db_const_iterator -{ - db_const_iterator & operator=( const db_const_iterator & ); // NO ASSIGNMENT! - db_const_iterator ( const db_const_iterator & ); // NO COPY! - friend std::ostream & operator<<( std::ostream & str, const db_const_iterator & obj ); - friend class librpmDb; - -private: - - /** - * Hides librpm specific data - **/ - class D; - D & _d; - -public: - - /** - * Constructor. Iterator is initialized to @ref findAll. - * The default form accesses librpmDb's default database. - * Explicitly providing a database handle should not be - * neccesary, except for testing. - **/ - db_const_iterator( librpmDb::constPtr dbptr_r = 0 ); - - /** - * Destructor. - **/ - ~db_const_iterator(); - - /** - * Return any database error. - * - * NOTE: If the database gets blocked (see @ref dbRelease) - * dbError will immediately report this, but an already running - * iteration will proceed to its end. Then the database is dropped. - **/ - shared_ptr dbError() const; - - /** - * Advance to next RpmHeader::constPtr. - **/ - void operator++(); - - /** - * Returns the current headers index in database, - * 0 if no header. - **/ - unsigned dbHdrNum() const; - - /** - * Returns the current RpmHeader::constPtr or - * NULL, if no more entries available. - **/ - const RpmHeader::constPtr & operator*() const; - - /** - * Forwards to the current RpmHeader::constPtr. - **/ - const RpmHeader::constPtr & operator->() const - { - return operator*(); - } - -public: - - /** - * Reset to iterate all packages. Returns true if iterator - * contains at least one entry. - * - * NOTE: No entry (false) migt be returned due to a - * meanwhile blocked database (see @ref dbRelease). Use - * @ref dbError to check this. - **/ - bool findAll(); - - /** - * Reset to iterate all packages that own a certain file. - **/ - bool findByFile( const std::string & file_r ); - - /** - * Reset to iterate all packages that provide a certain tag. - **/ - bool findByProvides( const std::string & tag_r ); - - /** - * Reset to iterate all packages that require a certain tag. - **/ - bool findByRequiredBy( const std::string & tag_r ); - - /** - * Reset to iterate all packages that conflict with a certain tag. - **/ - bool findByConflicts( const std::string & tag_r ); - - /** - * Reset to iterate all packages with a certain name. - * - * NOTE: Multiple entries for one package installed - * in different versions are possible but not desired. Usually - * you'll want to use @ref findPackage instead. - * - * findByName is needed to retrieve pseudo packages like - * 'gpg-pubkey', which in fact exist in multiple instances. - **/ - bool findByName( const std::string & name_r ); - -public: - - /** - * Find package by name. - * - * Multiple entries for one package installed in different versions - * are possible but not desired. If so, the last package installed - * is returned. - **/ - bool findPackage( const std::string & name_r ); - - /** - * Find package by name and edition. - * Commonly used by PMRpmPackageDataProvider. - **/ - bool findPackage( const std::string & name_r, const Edition & ed_r ); - - /** - * Abbr. for findPackage( which_r->name(), which_r->edition() ); - **/ - bool findPackage( const Package::constPtr & which_r ); -}; - -/////////////////////////////////////////////////////////////////// -} //namespace rpm -} //namespace target -} // namespace zypp - -#endif // librpmDb_h - diff --git a/libzypp/zypp/thread/Mutex.cc b/libzypp/zypp/thread/Mutex.cc deleted file mode 100644 index 7862d6b..0000000 --- a/libzypp/zypp/thread/Mutex.cc +++ /dev/null @@ -1,108 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/thread/Mutex.cc - */ -#include "zypp/thread/Mutex.h" -#include "zypp/thread/MutexException.h" -#include "zypp/base/Gettext.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace thread - { ////////////////////////////////////////////////////////////////// - - // ------------------------------------------------------------- - Mutex::Mutex() - { - pthread_mutexattr_t attr; - - int ret = pthread_mutexattr_init(&attr); - if( ret != 0) - { - ZYPP_THROW_ERRNO_MSG(zypp::thread::MutexException, - _("Can't initialize mutex attributes")); - } - - ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - if( ret != 0) - { - ZYPP_THROW_ERRNO_MSG(MutexException, - _("Can't set recursive mutex attribute")); - } - - ret = pthread_mutex_init(&m_mutex, &attr); - if( ret != 0) - { - ZYPP_THROW_ERRNO_MSG(MutexException, - _("Can't initialize recursive mutex")); - } - } - - // ------------------------------------------------------------- - Mutex::~Mutex() - { - if( pthread_mutex_destroy(&m_mutex) != 0 && errno == EBUSY) - { - // try to unlock and to destroy again... - if( pthread_mutex_unlock(&m_mutex) == 0) - { - pthread_mutex_destroy(&m_mutex); - } - /* - else - { - ZYPP_THROW_ERRNO_MSG(MutexException, - _("Can't destroy mutex owned by another thread")); - } - */ - } - } - - // ------------------------------------------------------------- - void Mutex::lock() - { - if( pthread_mutex_lock(&m_mutex) != 0) - { - ZYPP_THROW_ERRNO_MSG(MutexException, - _("Can't acquire the mutex lock")); - } - } - - // ------------------------------------------------------------- - void Mutex::unlock() - { - if( pthread_mutex_unlock(&m_mutex) != 0) - { - ZYPP_THROW_ERRNO_MSG(MutexException, - _("Can't release the mutex lock")); - } - } - - // ------------------------------------------------------------- - bool Mutex::trylock() - { - return (pthread_mutex_trylock(&m_mutex) == 0); - } - - - ////////////////////////////////////////////////////////////////// - } // namespace thread - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/thread/Mutex.h b/libzypp/zypp/thread/Mutex.h deleted file mode 100644 index 285f83a..0000000 --- a/libzypp/zypp/thread/Mutex.h +++ /dev/null @@ -1,96 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/thread/Mutex.h - */ -#ifndef ZYPP_THREAD_MUTEX_H -#define ZYPP_THREAD_MUTEX_H - -#include "zypp/base/NonCopyable.h" -#include "zypp/thread/MutexException.h" -#include - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace thread - { ////////////////////////////////////////////////////////////////// - - - typedef pthread_mutex_t RecursiveMutex_t; - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : Mutex - // - /** A recursive Mutex. - */ - class Mutex: public zypp::base::NonCopyable - { - public: - /** Create a new recursive Mutex object. - * \throws MutexException on initialization failure. - */ - Mutex(); - - /** Destroys this Mutex object. - */ - ~Mutex(); - - /** Acquire ownership of this Mutex object. - * This call will block if another thread has ownership of - * this Mutex. When it returns, the current thread is the - * owner of this Mutex object. - * - * In the same thread, this recursive mutex can be acquired - * multiple times. - * - * \throws MutexException if the maximum number of recursive - * locks for mutex has been exceeded. - */ - void lock(); - - /** Release ownership of this Mutex object. - * If another thread is waiting to acquire the ownership of - * this mutex it will stop blocking and acquire ownership - * when this call returns. - * - * \throws MutexException if the current thread does not - * own the mutex. - */ - void unlock(); - - /** Try to acquire ownership of this Mutex object. - * This call will return false if another thread has ownership - * of this Mutex or the maximum number of recursive locks for - * mutex has been exceeded. - * When it returns true, the current thread is the owner of - * this Mutex object. - * - * \return true, if ownership was acquired. - */ - bool trylock(); - - private: - RecursiveMutex_t m_mutex; - }; - - - ////////////////////////////////////////////////////////////////// - } // namespace thread - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_THREAD_MUTEX_H -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/thread/MutexException.h b/libzypp/zypp/thread/MutexException.h deleted file mode 100644 index f7355c1..0000000 --- a/libzypp/zypp/thread/MutexException.h +++ /dev/null @@ -1,60 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/thread/MutexException.h - * -*/ -#ifndef ZYPP_THREAD_MUTEXEXCEPTION_H -#define ZYPP_THREAD_MUTEXEXCEPTION_H - -#include "zypp/base/Exception.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace thread - { ////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////// - // - // CLASS NAME : MutexException - // - /** Exception type thrown on mutex errors. - */ - class MutexException: public zypp::Exception - { - public: - MutexException() - : zypp::Exception( ::zypp::Exception::strErrno(errno)) - {} - - MutexException(const std::string &msg) - : zypp::Exception( msg) - {} - - virtual ~MutexException() throw() - {} - }; - - - ////////////////////////////////////////////////////////////////// - } // namespace thread - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_THREAD_MUTEXEXCEPTION_H -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/thread/MutexLock.h b/libzypp/zypp/thread/MutexLock.h deleted file mode 100644 index e8871d0..0000000 --- a/libzypp/zypp/thread/MutexLock.h +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/thread/MutexLock.h - * -*/ -#ifndef ZYPP_THREAD_MUTEXLOCK_H -#define ZYPP_THREAD_MUTEXLOCK_H - -#include "zypp/thread/Mutex.h" -#include - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace thread - { ////////////////////////////////////////////////////////////////// - - - // ------------------------------------------------------------- - class MutexLock - { - public: - explicit MutexLock(Mutex &mutex, bool init_locked=true) - : m_mutex(&mutex) - , m_locked(false) - { - if(init_locked) - lock(); - } - - MutexLock(const MutexLock &ref) - : m_mutex( ref.m_mutex) - , m_locked(ref.m_locked) - { - ref.m_locked = false; - } - - ~MutexLock() - { - try - { - if( m_locked) - unlock(); - } - catch( ... ) - { - // don't let exceptions escape - } - } - - void lock() - { - assert(m_locked == false); - m_mutex->lock(); - m_locked = true; - } - - void unlock() - { - assert(m_locked == true); - m_mutex->unlock(); - m_locked = false; - } - - bool trylock() - { - assert(m_locked == false); - m_locked = m_mutex->trylock(); - return m_locked; - } - - bool locked() - { - return m_locked; - } - - private: - Mutex *m_mutex; - mutable bool m_locked; - //friend class Condition; - }; - - - ////////////////////////////////////////////////////////////////// - } // namespace thread - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_THREAD_MUTEXLOCK_H -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/thread/Once.h b/libzypp/zypp/thread/Once.h deleted file mode 100644 index 036cf58..0000000 --- a/libzypp/zypp/thread/Once.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/thread/Once.h - * -*/ -#ifndef ZYPP_THREAD_ONCE_H -#define ZYPP_THREAD_ONCE_H - -#include - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - namespace thread - { ////////////////////////////////////////////////////////////////// - - - /** The initialization value for OnceFlag variables. */ - #define ZYPP_ONCE_INIT PTHREAD_ONCE_INIT - - - /** The OnceFlag variable type. - */ - typedef pthread_once_t OnceFlag; - - - /** - * Call once function. - * - * The purpose of callOnce is to ensure that a piece of initialization - * code is executed at most once. - * The OnceFlag \p flag has to point to a static or extern variable, - * that was statically initialized to ZYPP_ONCE_INIT. - * - * The first time callOnce is called with a given \p onceFlag argument, - * it calls \p fuct with no argument and changes the value of \p flag - * to indicate that the function has been run. - * Subsequent calls with the same once flag does nothing. - */ - void callOnce(OnceFlag& flag, void (*func)()); - - inline void callOnce(OnceFlag& flag, void (*func)()) - { - pthread_once(&flag, func); - } - - ////////////////////////////////////////////////////////////////// - } // namespace thread - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_THREAD_ONCE_H -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/ui/SelFilters.h b/libzypp/zypp/ui/SelFilters.h deleted file mode 100644 index 2fcdfc7..0000000 --- a/libzypp/zypp/ui/SelFilters.h +++ /dev/null @@ -1,96 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/SelFilters.h - * -*/ -#ifndef ZYPP_UI_SELFILTERS_H -#define ZYPP_UI_SELFILTERS_H - -#include - -#include "zypp/base/Functional.h" -#include "zypp/ui/Selectable.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace selfilter - { ///////////////////////////////////////////////////////////////// - - typedef std::unary_function SelectableFilterFunctor; - - /** */ - struct ByKind : public SelectableFilterFunctor - { - ByKind( const ResObject::Kind & kind_r ) - : _kind( kind_r ) - {} - - bool operator()( const Selectable::constPtr & obj ) const - { - return obj && obj->kind() == _kind; - } - - ResObject::Kind _kind; - }; - - /** */ - struct ByName : public SelectableFilterFunctor - { - ByName( const std::string & name_r ) - : _name( name_r ) - {} - - bool operator()( const ui::Selectable::constPtr & obj ) const - { return obj && obj->name() == _name; } - - std::string _name; - }; - - /** */ - struct ByHasInstalledObj : public SelectableFilterFunctor - { - bool operator()( const ui::Selectable::constPtr & obj ) const - { return obj && !obj->installedEmpty(); } - }; - - /** */ - struct ByHasCandidateObj : public SelectableFilterFunctor - { - bool operator()( const ui::Selectable::constPtr & obj ) const - { return obj && obj->hasCandidateObj(); } - }; - - struct ByStatus : public SelectableFilterFunctor - /** */ - { - ByStatus( Status status_r ) - : _status( status_r ) - {} - - bool operator()( const ui::Selectable::constPtr & obj ) const - { return obj && obj->status() == _status; } - - Status _status; - }; - - ///////////////////////////////////////////////////////////////// - } // namespace selfilter - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_UI_SELFILTERS_H diff --git a/libzypp/zypp/ui/Selectable.cc b/libzypp/zypp/ui/Selectable.cc deleted file mode 100644 index 6c87fc1..0000000 --- a/libzypp/zypp/ui/Selectable.cc +++ /dev/null @@ -1,299 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/Selectable.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/ui/Selectable.h" -#include "zypp/ui/SelectableImpl.h" -#include "zypp/ResPool.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - IMPL_PTR_TYPE(Selectable); - - Selectable::Ptr Selectable::get( const pool::ByIdent & ident_r ) - { return ResPool::instance().proxy().lookup( ident_r ); } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Selectable::Selectable - // METHOD TYPE : Ctor - // - Selectable::Selectable( Impl_Ptr pimpl_r ) - : _pimpl( pimpl_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Selectable::~Selectable - // METHOD TYPE : Dtor - // - Selectable::~Selectable() - {} - - /////////////////////////////////////////////////////////////////// - // - // Forward to implementation. - // Restrict PoolItems to ResObject::constPtr! - // - /////////////////////////////////////////////////////////////////// - - IdString Selectable::ident() const - { return _pimpl->ident(); } - - ResObject::Kind Selectable::kind() const - { return _pimpl->kind(); } - - const std::string & Selectable::name() const - { return _pimpl->name(); } - - Status Selectable::status() const - { return _pimpl->status(); } - - bool Selectable::setStatus( Status state_r, ResStatus::TransactByValue causer_r ) - { return _pimpl->setStatus( state_r, causer_r ); } - - PoolItem Selectable::installedObj() const - { return _pimpl->installedObj(); } - - PoolItem Selectable::candidateObj() const - { return _pimpl->candidateObj(); } - - PoolItem Selectable::candidateObjFrom( Repository repo_r ) const - { return _pimpl->candidateObjFrom( repo_r ); } - - PoolItem Selectable::updateCandidateObj() const - { return _pimpl->updateCandidateObj(); } - - PoolItem Selectable::highestAvailableVersionObj() const - { return _pimpl->highestAvailableVersionObj(); } - - bool Selectable::identicalAvailable( const PoolItem & rhs ) const - { return _pimpl->identicalAvailable( rhs ); } - - bool Selectable::identicalInstalled( const PoolItem & rhs ) const - { return _pimpl->identicalInstalled( rhs ); } - - PoolItem Selectable::identicalAvailableObj( const PoolItem & rhs ) const - { return _pimpl->identicalAvailableObj( rhs ); } - - PoolItem Selectable::identicalInstalledObj( const PoolItem & rhs ) const - { return _pimpl->identicalInstalledObj( rhs ); } - - PoolItem Selectable::setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ) - { return _pimpl->setCandidate( newCandidate_r, causer_r ); } - - PoolItem Selectable::setCandidate( ResObject::constPtr newCandidate_r, ResStatus::TransactByValue causer_r ) - { return _pimpl->setCandidate( PoolItem( newCandidate_r ), causer_r ); } - - bool Selectable::setOnSystem( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ) - { - if ( identicalInstalled( newCandidate_r ) ) - return setFate( UNMODIFIED, causer_r ); - return setCandidate( newCandidate_r, causer_r ) && setFate( TO_INSTALL, causer_r ); - } - - PoolItem Selectable::theObj() const - { return _pimpl->theObj(); } - - //////////////////////////////////////////////////////////////////////// - - bool Selectable::availableEmpty() const - { return _pimpl->availableEmpty(); } - - Selectable::available_size_type Selectable::availableSize() const - { return _pimpl->availableSize(); } - - Selectable::available_iterator Selectable::availableBegin() const - { return _pimpl->availableBegin(); } - - Selectable::available_iterator Selectable::availableEnd() const - { return _pimpl->availableEnd(); } - - //////////////////////////////////////////////////////////////////////// - - bool Selectable::installedEmpty() const - { return _pimpl->installedEmpty(); } - - Selectable::installed_size_type Selectable::installedSize() const - { return _pimpl->installedSize(); } - - Selectable::installed_iterator Selectable::installedBegin() const - { return _pimpl->installedBegin(); } - - Selectable::installed_iterator Selectable::installedEnd() const - { return _pimpl->installedEnd(); } - - //////////////////////////////////////////////////////////////////////// - - bool Selectable::picklistEmpty() const - { return _pimpl->picklistEmpty(); } - - Selectable::picklist_size_type Selectable::picklistSize() const - { return _pimpl->picklistSize(); } - - Selectable::picklist_iterator Selectable::picklistBegin() const - { return _pimpl->picklistBegin(); } - - Selectable::picklist_iterator Selectable::picklistEnd() const - { return _pimpl->picklistEnd(); } - - //////////////////////////////////////////////////////////////////////// - - bool Selectable::isUnmaintained() const - { return _pimpl->isUnmaintained(); } - - bool Selectable::multiversionInstall() const - { return _pimpl->multiversionInstall(); } - - bool Selectable::pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ) - { return _pimpl->pickInstall( pi_r, causer_r, yesno_r ); } - - bool Selectable::pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ) - { return _pimpl->pickDelete( pi_r, causer_r, yesno_r ); } - - Status Selectable::pickStatus( const PoolItem & pi_r ) const - { return _pimpl->pickStatus( pi_r ); } - - bool Selectable::setPickStatus( const PoolItem & pi_r, Status state_r, ResStatus::TransactByValue causer_r ) - { return _pimpl->setPickStatus( pi_r, state_r, causer_r ); } - - //////////////////////////////////////////////////////////////////////// - - bool Selectable::isUndetermined() const - { return _pimpl->isUndetermined(); } - - bool Selectable::isRelevant() const - { return _pimpl->isRelevant(); } - - bool Selectable::isSatisfied() const - { return _pimpl->isSatisfied(); } - - bool Selectable::isBroken() const - { return _pimpl->isBroken(); } - - bool Selectable::isNeeded() const - { - return fate() == TO_INSTALL || ( ! locked() && isBroken() ); - } - - bool Selectable::isUnwanted() const - { - return locked() && isBroken() ; - } - - ResStatus::TransactByValue Selectable::modifiedBy() const - { return _pimpl->modifiedBy(); } - - bool Selectable::hasLicenceConfirmed() const - { return _pimpl->hasLicenceConfirmed(); } - - void Selectable::setLicenceConfirmed( bool val_r ) - { _pimpl->setLicenceConfirmed( val_r ); } - - - Selectable::Fate Selectable::fate() const - { - switch ( status() ) { - case S_Update: - case S_Install: - case S_AutoUpdate: - case S_AutoInstall: - return TO_INSTALL; - break; - - case S_Del: - case S_AutoDel: - return TO_DELETE; - break; - - case S_Protected: - case S_Taboo: - case S_KeepInstalled: - case S_NoInst: - break; - } - return UNMODIFIED; - }; - - bool Selectable::setFate( Fate fate_r, ResStatus::TransactByValue causer_r ) - { - switch ( fate_r ) - { - case TO_INSTALL: - return setStatus( hasInstalledObj() ? S_Update : S_Install, causer_r ); - break; - - case TO_DELETE: - return setStatus( S_Del, causer_r ); - break; - - case UNMODIFIED: - switch ( status() ) { - case S_Protected: - case S_Taboo: - return true; - break; - default: - return setStatus( hasInstalledObj() ? S_KeepInstalled : S_NoInst, causer_r ); - break; - } - break; - } - return false; - } - - bool Selectable::setInstalled( ResStatus::TransactByValue causer_r ) - { - return( hasInstalledObj() || setStatus( S_Install, causer_r ) ); - } - - bool Selectable::setUpToDate( ResStatus::TransactByValue causer_r ) - { - if ( ! hasInstalledObj() ) - return setStatus( S_Install, causer_r ); - - PoolItem cand( candidateObj() ); - if ( ! cand ) - return true; - - return( installedObj()->edition() >= cand->edition() - || setStatus( S_Update, causer_r ) ); - } - - bool Selectable::setDeleted( ResStatus::TransactByValue causer_r ) - { - return( ! hasInstalledObj() || setStatus( S_Del, causer_r ) ); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const Selectable & obj ) - { return str << *(obj._pimpl); } - - std::ostream & dumpOn( std::ostream & str, const Selectable & obj ) - { return dumpOn( str, *(obj._pimpl) ); } - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ui/Selectable.h b/libzypp/zypp/ui/Selectable.h deleted file mode 100644 index 3743e96..0000000 --- a/libzypp/zypp/ui/Selectable.h +++ /dev/null @@ -1,536 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/Selectable.h - * -*/ -#ifndef ZYPP_UI_SELECTABLE_H -#define ZYPP_UI_SELECTABLE_H - -#include - -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Iterator.h" - -#include "zypp/ui/SelectableTraits.h" -#include "zypp/ui/Status.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - DEFINE_PTR_TYPE(Selectable); - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Selectable - // - /** Collects PoolItems of same kind and name. - * - * Selectable is a status wrapper. The ui::Status is calculated - * from (and transated to) \ref PoolItems individual \ref ResStatus - * values. - * - * Available objects are sorted according the solver policies, 'best' - * packages first (e.g. by repository priority, then Arch, then Edition). - * - * Installed objects are sorted according the installation date, newer install - * time first. - */ - class Selectable : public base::ReferenceCounted, private base::NonCopyable - { - friend std::ostream & operator<<( std::ostream & str, const Selectable & obj ); - friend std::ostream & dumpOn( std::ostream & str, const Selectable & obj ); - - public: - typedef intrusive_ptr Ptr; - typedef intrusive_ptr constPtr; - - /** Iterates over ResObject::constPtr */ - typedef SelectableTraits::available_iterator available_iterator; - typedef SelectableTraits::available_size_type available_size_type; - - typedef SelectableTraits::installed_iterator installed_iterator; - typedef SelectableTraits::installed_size_type installed_size_type; - - typedef SelectableTraits::picklist_iterator picklist_iterator; - typedef SelectableTraits::picklist_size_type picklist_size_type; - - public: - /** \name Static ctor substitues picking the item from the pool. - * \code - * Selectable::Ptr item; - * item = Selectable::get( "amarok ); // package amamrok - * item = Selectable::get( ResKind::patch, "amarok ); // patch amamrok - * item = Selectable::get( IdString( "patch:amarok" ); // patch amamrok - * \endcode - */ - //@{ - /** Get the \ref Selctable */ - static Ptr get( const pool::ByIdent & ident_r ); - - /** Get the \ref Selctable by it's \c sat-identifyer. */ - static Ptr get( IdString ident_r ) - { return get( pool::ByIdent( ident_r ) ); } - - /** Get the \ref Selctable by \c kind and \c name. */ - static Ptr get( ResKind kind_r, const std::string & name_r ) - { return get( pool::ByIdent( kind_r, name_r ) ); } - - /** Get the \c Package \ref Selctable by \c name. */ - static Ptr get( const std::string & name_r ) - { return get( pool::ByIdent( ResKind::package, name_r ) ); } - - /** Get the \ref Selctable containing a specific \ref sat::Solvable. */ - static Ptr get( const sat::Solvable & solv_r ) - { return get( pool::ByIdent( solv_r ) ); } - - /** Get the \ref Selctable containing a specific \ref ResObject. */ - static Ptr get( const ResObject::constPtr & resolvable_r ) - { return resolvable_r ? get( resolvable_r->satSolvable() ) : Ptr(); } - - /** Get the \ref Selctable containing a specific \ref PoolItem. */ - static Ptr get( const PoolItem & pi_r ) - { return get( pi_r.satSolvable() ); } - //@} - - public: - /** The identifier. - * This is the solvables \ref name, \b except for packages and - * source packes, prefixed by it's \ref kind. - * \see \ref sat::Solvable. - */ - IdString ident() const; - - /** The ResObjects kind. */ - ResObject::Kind kind() const; - - /** The ResObjects name. */ - const std::string & name() const; - - /** The last Installed object. */ - PoolItem installedObj() const; - - /** The 'best' or 'most interesting' among all available objects. - * One that is, or is likely to be, chosen for installation, unless - * it violated any solver policy (see \ref updateCandidateObj). - */ - PoolItem candidateObj() const; - - /** The best candidate provided by a specific \ref Repository, if there is one. - * In contrary to \ref candidateObj, this may return no item even if - * there are available objects. This simply means the \ref Repository - * does not provide this object. - */ - PoolItem candidateObjFrom( Repository repo_r ) const; - - /** The best candidate for update, if there is one. - * In contrary to \ref candidateObj, this may return no item even if - * there are available objects. This simply means the best object is - * already installed, and all available objects violate at least one - * update policy. - */ - PoolItem updateCandidateObj() const; - - /** Simply the highest available version, ignoring priorities and policies. - * It's doubtful whether solely looking at the version makes a good - * candidate, but apps ask for it. Beware that different vendors may - * use different (uncomparable) version schemata. - */ - PoolItem highestAvailableVersionObj() const; - - /** \c True if \a rhs is installed and one with the same content is available. - * Basically the same name, edition, arch, vendor and buildtime. - * \see \ref sat::Solvable::identical - */ - bool identicalAvailable( const PoolItem & rhs ) const; - - /** \c True if \a rhs has the same content as an installed one. - * Basically the same name, edition, arch, vendor and buildtime. - * \see \ref sat::Solvable::identical - */ - bool identicalInstalled( const PoolItem & rhs ) const; - - /** \c True if the \ref candidateObj is installed (same content). - * \see \ref identicalInstalled. - */ - bool identicalInstalledCandidate() const - { return identicalInstalled( candidateObj() ); } - - /** \c True if the \ref updateCandidateObj is installed (same content). - * \see \ref identicalInstalled. - */ - bool identicalInstalledUpdateCandidate() const - { return identicalInstalled( updateCandidateObj() ); } - - /** Return an available Object with the same content as \c rhs. - * Basically the same name, edition, arch, vendor and buildtime. - * \see \ref sat::Solvable::identical - */ - PoolItem identicalAvailableObj( const PoolItem & rhs ) const; - - /** \Return an installed Object with the same content as \c rhs. - * Basically the same name, edition, arch, vendor and buildtime. - * \see \ref sat::Solvable::identical - */ - PoolItem identicalInstalledObj( const PoolItem & rhs ) const; - - /** Return the \ref installedObj resolvable casted to a specific kind. - * \code - * Selectable mySelectable; - * Package::constPtr p( mySelectable.installedAsKind() ); - * \endcode - */ - template - typename ResTraits<_Res>::constPtrType installedAsKind() const - { return asKind<_Res>( candidateObj() ); } - - /** Return the \ref candidateObj resolvable casted to a specific kind. - * \code - * Selectable mySelectable; - * Package::constPtr p( mySelectable.candidateAsKind() ); - * \endcode - */ - template - typename ResTraits<_Res>::constPtrType candidateAsKind() const - { return asKind<_Res>( candidateObj() ); } - - /** Set a candidate (out of available objects). - * \return The new candidate, or NULL if choice was invalid - * (NULL or not among availableObjs). An invalid choice - * selects the default candidate. - * In case the causer is not \c ResStatus::USER the operation - * may also fail if there are insufficient permissions to change - * a transacting candidate. - */ - PoolItem setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - /** \overload */ - PoolItem setCandidate( ResObject::constPtr newCandidate_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Arrange the specified candidate (out of available objects) to be on system after commit. - * If the specified candidate is not already installed (\ref identicalInstalled), - * and the \a causer_r has sufficient permisssion, then \a newCandidate_r is set as the new - * candidate (\ref setCandidate) and selected for installation. - * \returns \c True if \a newCandidate_r is already installed or successfully selected for installation. - */ - bool setOnSystem( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** An object you could use as pars pro toto. - * - * \return the \ref candidateObj, or ,if no available objects - * exist, the \ref installedObj. - */ - PoolItem theObj() const; - - //////////////////////////////////////////////////////////////////////// - - /** \name Available objects iterators. - * Oredered according to solver policy. 'Best' first. - */ - //@{ - bool availableEmpty() const; - available_size_type availableSize() const; - available_iterator availableBegin() const; - available_iterator availableEnd() const; - //@} - - //////////////////////////////////////////////////////////////////////// - - /** \name Installed objects iterators. - * Ordered by install time. Latest first. - */ - //@{ - bool installedEmpty() const; - installed_size_type installedSize() const; - installed_iterator installedBegin() const; - installed_iterator installedEnd() const; - //} - - //////////////////////////////////////////////////////////////////////// - - /** \name picklist iterators. - * This is basically the available items list prepended by those - * installed items, that are nolonger \ref identicalAvailable. - */ - //@{ - bool picklistEmpty() const; - picklist_size_type picklistSize() const; - picklist_iterator picklistBegin() const; - picklist_iterator picklistEnd() const; - //} - - //////////////////////////////////////////////////////////////////////// - - public: - /** \name Query for objects within this Selectable. - */ - //@{ - /** True if either installed or candidate object is present */ - bool hasObject() const - { return (! installedEmpty()) || candidateObj(); } - - /** True if installed object is present. */ - bool hasInstalledObj() const - { return ! installedEmpty(); } - - /** True if candidate object is present. */ - bool hasCandidateObj() const - { return bool(candidateObj()); } - - /** True if installed and candidate object is present */ - bool hasBothObjects() const - { return (! installedEmpty()) && candidateObj(); } - - /** True if installed object is present but no candidate. */ - bool hasInstalledObjOnly() const - { return (! installedEmpty()) && ! candidateObj(); } - - /** True if candidate object is present but no installed. */ - bool hasCandidateObjOnly() const - { return ( installedEmpty() ) && candidateObj(); } - //@} - - /** - * True if this package has no replacement from - * the available repositories - */ - bool isUnmaintained() const; - - /** \name Multiversion install. - * - * Using \ref pickInstall or \ref pickDelete with non-multiversionInstall items - * is possible, but additional constraints will apply. E.g. selecting one item for - * install will deselect any other. - */ - //@{ - /** Whether different versions of this package can be installed at the same time. - * Per default \c false. \see also \ref ZConfig::multiversion. - */ - bool multiversionInstall() const; - - /** Select a specific available item for installation. - */ - bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER, bool yesno_r = true ); - - /** Deselect a specific available item from installation. - */ - bool pickNoInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER ) - { return pickInstall( pi_r, causer_r, false ); } - - /** Select a specific installed item for deletion. - */ - bool pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER, bool yesno_r = true ); - - /** Deselect a specific installed item from deletion. - */ - bool pickNoDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER ) - { return pickDelete( pi_r, causer_r, false ); } - - /** Compute the \ref ui::Status for an individual PoolItem. - * This just takes into account the item and any identical - * installed (or available) one. - * \code - * Assume there are 3 identical 'foo-1.1 (vendor A)' items, - * one 'foo-2.1 (vendor A)' and one ''foo-1.1 (vendor B)': - * - * installed: . foo-1.1 (vendor A) -> S_KeepInstalled - * available: foo-2.1 (vendor A) (repo 1) -> S_NoInst - * . foo-1.1 (vendor A) (repo 1) -> S_KeepInstalled - * . foo-1.1 (vendor A) (repo 2) -> S_KeepInstalled - * foo-1.1 (vendor B) (repo 3) -> S_NoInst - * - * After 'foo-1.1 (vendor A) (repo 1)' was selected to be installed: - * - * installed: . foo-1.1 (vendor A) -> S_Update - * available: foo-2.1 (vendor A) (repo 1) -> S_NoInst - * I foo-1.1 (vendor A) (repo 1) -> S_Update - * . foo-1.1 (vendor A) (repo 2) -> S_KeepInstalled - * foo-1.1 (vendor B) (repo 3) -> S_NoInst - * \endcode - * \see \ref sat::Solvable::identical - */ - Status pickStatus( const PoolItem & pi_r ) const; - - /** Assign a new status to a specific item. */ - bool setPickStatus( const PoolItem & pi_r, Status state_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - //@} - - /** \name Classification of available patches (pseudo installed items). - * A patch is either \c not \c relevant, \c satisfied or \c broken. - * The same applies to other pseudo installed kinds. - * \see \ref traits::isPseudoInstalled - */ - //@{ - /** Returns true for packages, because packages are not - * classified by the solver. - */ - bool isUndetermined() const; - - /** Returns true if the patch is relevant which means that at least - * one package of the patch is installed. - */ - bool isRelevant() const; - - /** Whether a relevant patchs requirements are met. */ - bool isSatisfied() const; - - /** Whether a relevant patchs requirements are broken. */ - bool isBroken() const; - - /** This includes \c unlocked broken patches, as well as those already - * selected to be installed. This is because already selected - * patches will be classified as \c satisfied. \c Locked but broken - * patches will be classified as \ref isUnwanted. - */ - bool isNeeded() const; - - /** Broken (needed) but locked patches. */ - bool isUnwanted() const; - //@} - - public: - /** \name Query and maip objects fate in case of commit. - */ - //@{ - enum Fate { - TO_DELETE = -1, - UNMODIFIED = 0, - TO_INSTALL = 1 - }; - /** */ - Fate fate() const; - - /** True if neither to delete or to install */ - bool unmodified() const - { return fate() == UNMODIFIED; } - - /** True if locked (subclass of unmodified). */ - bool locked() const - { Status st( status() ); return( st == S_Protected || st == S_Taboo ); } - - /** True if either to delete or to install */ - bool toModify() const - { return fate() != UNMODIFIED; } - - /** True if to delete */ - bool toDelete() const - { return fate() == TO_DELETE; } - - /** True if to install */ - bool toInstall() const - { return fate() == TO_INSTALL; } - - /** True if would be on system after commit. */ - bool onSystem() const - { return( ( hasInstalledObj() && !toDelete() ) - ||( hasCandidateObj() && toInstall() ) ); } - - /** True if would be off system after commit. */ - bool offSystem() const - { return ! onSystem(); } - - /** */ - bool setFate( Fate fate_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Set the item to be installed (new- or re-install). */ - bool setToInstall( ResStatus::TransactByValue causer_r = ResStatus::USER ) - { return setFate( TO_INSTALL, causer_r ); } - - /** Take care the item gets installed if it is not. */ - bool setInstalled( ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Take care the item gets installed if it is not, or is older. */ - bool setUpToDate( ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Set the item to be deleted (must be installed). */ - bool setToDelete( ResStatus::TransactByValue causer_r = ResStatus::USER ) - { return setFate( TO_DELETE, causer_r ); } - - /** Take care the item gets deleted if it is installed. */ - bool setDeleted( ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Set the item to stay unmodified. */ - bool unset( ResStatus::TransactByValue causer_r = ResStatus::USER ) - { return setFate( UNMODIFIED, causer_r ); } - //@} - - public: - /** - * \name Special inteface for Y2UI. - * \note This interface acts on \ref ResStatus::USER level. - * The \ref Status enum, and allowed state transitions are - * tightly related to the Y2UI. - */ - //@{ - /** Return the current Status */ - Status status() const; - - /** - * Try to set a new Status. - * Returns \c false if the transitions is not allowed. - */ - bool setStatus( Status state_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - - /** Return who caused the modification. */ - ResStatus::TransactByValue modifiedBy() const; - - /** Return value of LicenceConfirmed bit. */ - bool hasLicenceConfirmed() const; - - /** Set LicenceConfirmed bit. */ - void setLicenceConfirmed( bool val_r = true ); - //@} - - public: - /** Implementation */ - class Impl; - typedef shared_ptr Impl_Ptr; - /** Default ctor */ - Selectable( Impl_Ptr pimpl_r ); - private: - /** Dtor */ - ~Selectable(); - private: - /** Pointer to implementation */ - RW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Selectable Stream output */ - std::ostream & operator<<( std::ostream & str, const Selectable & obj ); - - /** \relates Selectable More verbose stream output */ - std::ostream & dumpOn( std::ostream & str, const Selectable & obj ); - - /** Solvable to Selectable transform functor. - * \relates Selectable - * \relates sat::SolvIterMixin - */ - struct asSelectable - { - typedef Selectable_Ptr result_type; - - Selectable_Ptr operator()( const sat::Solvable & solv_r ) const; - - Selectable_Ptr operator()( const PoolItem & pi_r ) const - { return operator()( pi_r.satSolvable() ); } - }; - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_UI_SELECTABLE_H diff --git a/libzypp/zypp/ui/SelectableImpl.cc b/libzypp/zypp/ui/SelectableImpl.cc deleted file mode 100644 index ebcfc31..0000000 --- a/libzypp/zypp/ui/SelectableImpl.cc +++ /dev/null @@ -1,621 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/SelectableImpl.cc - * -*/ -#include -//#include "zypp/base/Logger.h" - -#include "zypp/ui/SelectableImpl.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - /** Simple ResStatus backup stack. - * \ref restore simply rewinds all remembered status. - */ - class StatusBackup - { - public: - typedef ResStatus::TransactByValue Causer; - - public: - /** Backup status. */ - ResStatus & backup( ResStatus & status_r ) - { - _backup.push_back( status_r ); - return status_r; - } - /** \overload */ - ResStatus & backup( const PoolItem & pi_r ) - { return backup( pi_r.status() ); } - - /** Backup status. */ - ResStatus & operator()( ResStatus & status_r ) - { return backup( status_r ); } - /** \overload */ - ResStatus & operator()( const PoolItem & pi_r ) - { return backup( pi_r.status() ); } - - /** Restore all status. */ - bool restore() - { - for_( rit, _backup.rbegin(), _backup.rend() ) - rit->replay(); - return false; // restore is done on error - return restore(); - } - - public: - /** lowlevel \c ResStatus::setTransact */ - bool setTransact( const PoolItem & pi_r, bool yesno_r, Causer causer_r ) - { return backup( pi_r ).setTransact( yesno_r, causer_r ); } - - /** lowlevel \c ResStatus::setLock */ - bool setLock( const PoolItem & pi_r, bool yesno_r, Causer causer_r ) - { return backup( pi_r ).setLock( yesno_r, causer_r ); } - - /** lowlevel \c ResStatus::setTransact(true). */ - bool setTransactTrue( const PoolItem & pi_r, Causer causer_r ) - { return setTransact( pi_r, true, causer_r ); } - - /** lowlevel \c ResStatus::setTransact(false). */ - bool setTransactFalse( const PoolItem & pi_r, Causer causer_r ) - { return setTransact( pi_r, false, causer_r ); } - - public: - /** highevel set transact (force unlock). */ - bool transact( const PoolItem & pi_r, Causer causer_r ) - { - ResStatus & status( backup( pi_r ) ); - if ( ! status.setLock( false, causer_r ) ) return false; - if ( ! status.setTransact( true, causer_r ) ) return false; - return true; - } - - /** highlevel set locked. */ - bool lock( const PoolItem & pi_r, Causer causer_r ) - { - ResStatus & status( backup( pi_r ) ); - if ( ! status.setTransact( false, causer_r ) ) return false; - if ( ! status.setLock( true, causer_r ) ) return false; - return true; - } - - /** highlevel unlock (also unsets transact). */ - bool unlock( const PoolItem & pi_r, Causer causer_r ) - { - ResStatus & status( backup( pi_r ) ); - if ( ! status.setTransact( false, causer_r ) ) return false; - if ( ! status.setLock( false, causer_r ) ) return false; - return true; - } - - /** Highlevel action. */ - typedef bool (StatusBackup::*Action)( const PoolItem &, Causer ); - - /** Highlevel action on range of items. */ - template - bool forEach( _Iter begin_r, _Iter end_r, Action action_r, Causer causer_r ) - { - for_( it, begin_r, end_r ) - if ( ! (this->*action_r)( *it, causer_r ) ) - return false; - return true; - } - - private: - std::vector _backup; - }; - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : StatusHelper - // - /** \todo Unify status and pickStatus. - */ - struct StatusHelper - { - StatusHelper( const Selectable::Impl & impl, ResStatus::TransactByValue causer_r ) - : _impl( impl ) - , inst( impl.installedObj() ) - , cand( impl.candidateObj() ) - , causer( causer_r ) - {} - - typedef Selectable::Impl::available_const_iterator available_const_iterator; - - // - // Queries - // - bool hasInstalled() const - { return bool(inst); } - - bool hasCandidate() const - { return bool(cand); } - - bool hasInstalledOnly() const - { return inst && !cand; } - - bool hasCandidateOnly() const - { return cand && !inst; } - - bool hasBoth() const - { return inst && cand; } - - /** \name Topevel methods must restore status on failure. */ - //@{ - bool setInstall() - { - if ( cand ) - { - if ( inst ) { - for_( it, _impl.installedBegin(), _impl.installedEnd() ) - { - ResStatus & inststatus( backup( it->status() ) ); - if ( ! inststatus.setTransact( false, causer ) ) return restore(); - if ( ! inststatus.setLock ( false, causer ) ) return restore(); - if ( ! cand->multiversionInstall() ) - { - // This is what the solver most probabely will do. - // If we are wrong the solver will correct it. But - // this way we will get a better disk usage result, - // even if no autosolving is on. - inststatus.setTransact( true, ResStatus::SOLVER ); - } - } - } - if ( ! unlockCandidates() ) return restore(); - ResStatus & candstatus( backup( cand.status() ) ); - if ( ! candstatus.setTransact( true, causer ) ) return restore(); - return true; - } - return false; - } - - bool setDelete() - { - if ( inst ) - { - if ( ! resetTransactingCandidates() ) return restore(); - for_( it, _impl.installedBegin(), _impl.installedEnd() ) - { - ResStatus & inststatus( backup( it->status() ) ); - if ( ! inststatus.setLock( false, causer ) ) return restore(); - if ( ! inststatus.setTransact( true, causer ) ) return restore(); - } - return true; - } - return false; - } - - bool unset() - { - if ( inst ) - { - for_( it, _impl.installedBegin(), _impl.installedEnd() ) - { - ResStatus & inststatus( backup( it->status() ) ); - if ( ! inststatus.setTransact( false, causer ) ) return restore(); - if ( ! inststatus.setLock( false, causer ) ) return restore(); - } - } - if ( ! unlockCandidates() ) return restore(); - return true; - } - - bool setProtected() - { - if ( causer != ResStatus::USER ) // by user only - return false; - - if ( inst ) { - resetTransactingCandidates(); - for_( it, _impl.installedBegin(), _impl.installedEnd() ) - { - it->status().setTransact( false, causer ); - it->status().setLock( true, causer ); - } - return true; - } else - return false; - } - - bool setTaboo() - { - if ( causer != ResStatus::USER ) // by user only - return false; - - if ( cand ) { - lockCandidates(); - return true; - } else - return false; - } - //@} - - private: - /** \name Helper methods backup status but do not replay. */ - //@{ - bool resetTransactingCandidates() - { - for_( it, _impl.availableBegin(), _impl.availableEnd() ) - { - ResStatus & status( backup( (*it).status() ) ); - if ( ! status.setTransact( false, causer ) ) return false; - } - return true; - } - bool unlockCandidates() - { - for_( it, _impl.availableBegin(), _impl.availableEnd() ) - { - ResStatus & status( backup( (*it).status() ) ); - if ( ! status.setTransact( false, causer ) ) return false; - if ( ! status.setLock( false, causer ) ) return false; - } - return true; - } - bool lockCandidates() - { - for_( it, _impl.availableBegin(), _impl.availableEnd() ) - { - ResStatus & status( backup( (*it).status() ) ); - if ( ! status.setTransact( false, causer ) ) return false; - if ( ! status.setLock( true, causer ) ) return false; - } - return true; - } - //@} - - private: - const Selectable::Impl & _impl; - PoolItem inst; - PoolItem cand; - ResStatus::TransactByValue causer; - - private: - bool restore() { return backup.restore(); } - StatusBackup backup; - }; - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Selectable::Impl - // - /////////////////////////////////////////////////////////////////// - - Status Selectable::Impl::status() const - { - PoolItem cand( candidateObj() ); - if ( cand && cand.status().transacts() ) - { - if ( cand.status().isByUser() ) - return( installedObj() ? S_Update : S_Install ); - else - return( installedObj() ? S_AutoUpdate : S_AutoInstall ); - } - - if ( installedObj() && installedObj().status().transacts() ) - { - return( installedObj().status().isByUser() ? S_Del : S_AutoDel ); - } - - if ( installedObj() && allInstalledLocked() ) - return S_Protected; - - if ( !installedObj() && allCandidatesLocked() ) - return S_Taboo; - - // KEEP state: - if ( installedObj() ) - return S_KeepInstalled; - // Report pseudo installed items as installed, if they are satisfied. - if ( traits::isPseudoInstalled( kind() ) - && cand.status().isSatisfied() ) // no installed, so we must have candidate - return S_KeepInstalled; - - return S_NoInst; - } - - bool Selectable::Impl::setStatus( Status state_r, ResStatus::TransactByValue causer_r ) - { - StatusHelper self( *this, causer_r ); - - switch ( state_r ) - { - case S_Protected: - return self.setProtected(); - case S_Taboo: - return self.setTaboo(); - case S_AutoDel: - case S_AutoInstall: - case S_AutoUpdate: - // Auto level is SOLVER level. UI may query, but not - // set at this level. - break; - - case S_Del: - return self.setDelete(); - break; - - case S_Install: - return self.hasCandidateOnly() && self.setInstall(); - break; - - case S_Update: - return self.hasBoth() && self.setInstall(); - break; - - case S_KeepInstalled: - return self.hasInstalled() && self.unset(); - break; - - case S_NoInst: - return !self.hasInstalled() && self.unset(); - break; - } - - return false; - } - - PoolItem Selectable::Impl::setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ) - { - PoolItem newCandidate; - - if ( newCandidate_r ) // must be in available list - { - for_( it, availableBegin(), availableEnd() ) - { - if ( *it == newCandidate_r ) - { - newCandidate = *it; - break; - } - } - } - - if ( newCandidate ) - { - PoolItem trans( transactingCandidate() ); - if ( trans && trans != newCandidate ) - { - // adjust transact to the new cancidate - if ( trans.status().maySetTransact( false, causer_r ) - && newCandidate.status().maySetTransact( true, causer_r ) ) - { - trans.status().setTransact( false, causer_r ); - newCandidate.status().setTransact( true, causer_r ); - } - else - { - // No permission to change a transacting candidate. - // Leave _candidate untouched and return NULL. - return PoolItem(); - } - } - } - - return _candidate = newCandidate; - } - - /////////////////////////////////////////////////////////////////// - - bool Selectable::Impl::pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ) - { - if ( identicalInstalled( pi_r ) ) - return setPickStatus( pi_r, ( yesno_r ? S_Update : S_KeepInstalled ), causer_r ); - return setPickStatus( pi_r, ( yesno_r ? S_Install : S_NoInst ), causer_r ); - } - - bool Selectable::Impl::pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ) - { - return setPickStatus( pi_r, ( yesno_r ? S_Del : S_KeepInstalled ), causer_r ); - } - - bool Selectable::Impl::setPickStatus( const PoolItem & pi_r, Status state_r, ResStatus::TransactByValue causer_r ) - { - if ( pi_r.satSolvable().ident() != ident() ) - return false; // not my PoolItem - - if ( ! multiversionInstall() ) - return false; // We're not yet ready for this. - // TODO: Without multiversionInstall take care at most ONE available is set - // to install. Upon install ALL installed get deleted. Only upon deletetion - // one might pick individual versions (but more than one would be an error here). - - StatusBackup backup; - std::vector i; - std::vector a; - - for_( it, installedBegin(), installedEnd() ) - if ( identical( *it, pi_r ) ) - i.push_back( *it ); - for_( it, availableBegin(), availableEnd() ) - if ( identical( *it, pi_r ) ) - a.push_back( *it ); - - switch ( state_r ) - { - case S_Protected: - if ( causer_r == ResStatus::USER && ! i.empty() ) - { - if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::lock, causer_r ) ) return backup.restore(); - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::setTransactFalse, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_Taboo: - if ( causer_r == ResStatus::USER && ! a.empty() ) - { - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::lock, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_AutoDel: - case S_AutoInstall: - case S_AutoUpdate: - // Auto level is SOLVER level. UI may query, but not - // set at this level. - break; - - case S_Del: - if ( ! i.empty() ) - { - if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::transact, causer_r ) ) return backup.restore(); - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::setTransactFalse, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_Install: - if ( i.empty() && ! a.empty() ) - { - // maybe unlock candidate only? - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r ); // status already backed up above - if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_Update: - if ( ! i.empty() && ! a.empty() ) - { - if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::setTransactTrue, ResStatus::SOLVER ) ) return backup.restore(); - // maybe unlock candidate only? - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - const PoolItem & cand( pi_r.status().isInstalled() ? *a.begin() : pi_r ); // status already backed up above - if ( ! cand.status().setTransact( true, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_KeepInstalled: - if ( ! i.empty() ) - { - if ( ! backup.forEach( i.begin(), i.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - return true; - } - break; - - case S_NoInst: - if ( i.empty() ) - { - if ( ! backup.forEach( a.begin(), a.end(), &StatusBackup::unlock, causer_r ) ) return backup.restore(); - return true; - } - break; - } - return false; - } - - Status Selectable::Impl::pickStatus( const PoolItem & pi_r ) const - { - if ( pi_r.satSolvable().ident() != ident() ) - return Status(-1); // not my PoolItem - - std::vector i; - std::vector a; - PoolItem ti; - PoolItem ta; - - for_( it, installedBegin(), installedEnd() ) - if ( identical( *it, pi_r ) ) - { - i.push_back( *it ); - if ( ! ti && it->status().transacts() ) - ti = *it; - } - - for_( it, availableBegin(), availableEnd() ) - if ( identical( *it, pi_r ) ) - { - a.push_back( *it ); - if ( ! ta && it->status().transacts() ) - ta = *it; - } - - if ( ta ) - { - if ( ta.status().isByUser() ) - return( i.empty() ? S_Install : S_Update ); - else - return( i.empty() ? S_AutoInstall : S_AutoUpdate ); - } - - if ( ti ) - { - return( ti.status().isByUser() ? S_Del : S_AutoDel ); - } - - for_( it, i.begin(), i.end() ) - if ( it->status().isLocked() ) - return S_Protected; - - if ( i.empty() ) - { - bool allALocked = true; - for_( it, a.begin(), a.end() ) - if ( ! it->status().isLocked() ) - { - allALocked = false; - break; - } - if ( allALocked ) - return S_Taboo; - } - - // KEEP state: - if ( ! i.empty() ) - return S_KeepInstalled; - // Report pseudo installed items as installed, if they are satisfied. - if ( traits::isPseudoInstalled( kind() ) - && ( ta ? ta : *a.begin() ).status().isSatisfied() ) // no installed, so we must have candidate - return S_KeepInstalled; - - return S_NoInst; - } - - /////////////////////////////////////////////////////////////////// - - ResStatus::TransactByValue Selectable::Impl::modifiedBy() const - { - PoolItem cand( candidateObj() ); - if ( cand && cand.status().transacts() ) - return cand.status().getTransactByValue(); - - if ( installedObj() && installedObj().status().transacts() ) - return installedObj().status().getTransactByValue(); - - if ( cand ) - return cand.status().getTransactByValue(); - - if ( installedObj() ) - return installedObj().status().getTransactByValue(); - - return ResStatus::SOLVER; - } - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ui/SelectableImpl.h b/libzypp/zypp/ui/SelectableImpl.h deleted file mode 100644 index 4bafbf0..0000000 --- a/libzypp/zypp/ui/SelectableImpl.h +++ /dev/null @@ -1,524 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/SelectableImpl.h - * -*/ -#ifndef ZYPP_UI_SELECTABLEIMPL_H -#define ZYPP_UI_SELECTABLEIMPL_H - -#include -#include "zypp/base/LogTools.h" - -#include "zypp/base/PtrTypes.h" - -#include "zypp/ResPool.h" -#include "zypp/Resolver.h" -#include "zypp/ui/Selectable.h" -#include "zypp/ui/SelectableTraits.h" - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : Selectable::Impl - // - /** Selectable implementation. - * \note Implementation is based in PoolItem, just the Selectable - * inteface restricts them to ResObject::constPtr. - */ - struct Selectable::Impl - { - public: - - typedef SelectableTraits::AvailableItemSet AvailableItemSet; - typedef SelectableTraits::available_iterator available_iterator; - typedef SelectableTraits::available_const_iterator available_const_iterator; - typedef SelectableTraits::available_size_type available_size_type; - - typedef SelectableTraits::InstalledItemSet InstalledItemSet; - typedef SelectableTraits::installed_iterator installed_iterator; - typedef SelectableTraits::installed_const_iterator installed_const_iterator; - typedef SelectableTraits::installed_size_type installed_size_type; - - typedef SelectableTraits::PickList PickList; - - public: - template - Impl( const ResObject::Kind & kind_r, - const std::string & name_r, - _Iterator begin_r, - _Iterator end_r ) - : _ident( sat::Solvable::SplitIdent( kind_r, name_r ).ident() ) - , _kind( kind_r ) - , _name( name_r ) - { - for_( it, begin_r, end_r ) - { - if ( it->status().isInstalled() ) - _installedItems.insert( *it ); - else - _availableItems.insert( *it ); - } - } - - public: - /** */ - IdString ident() const - { return _ident; } - - /** */ - ResObject::Kind kind() const - { return _kind; } - - /** */ - const std::string & name() const - { return _name; } - - /** */ - Status status() const; - - /** */ - bool setStatus( Status state_r, ResStatus::TransactByValue causer_r ); - - /** Installed object (transacting ot highest version). */ - PoolItem installedObj() const - { - if ( installedEmpty() ) - return PoolItem(); - PoolItem ret( transactingInstalled() ); - return ret ? ret : *_installedItems.begin(); - } - - /** Best among available objects. - * The transacting candidate or the one scheduled to receive - * the transact bit. - */ - PoolItem candidateObj() const - { - PoolItem ret( transactingCandidate() ); - if ( ret ) - return ret; - return _candidate ? _candidate : defaultCandidate(); - } - - /** Set a userCandidate (out of available objects). - * \return The new userCandidate or NULL if choice was invalid - * (not among availableObjs). - */ - PoolItem setCandidate( const PoolItem & newCandidate_r, ResStatus::TransactByValue causer_r ); - - /** The best candidate provided by a specific \ref Repository, if there is one. - * In contrary to \ref candidateObj, this may return no item even if - * there are available objects. This simply means the \ref Repository - * does not provide this object. - */ - PoolItem candidateObjFrom( Repository repo_r ) const - { - for_( it, availableBegin(), availableEnd() ) - { - if ( (*it)->repository() == repo_r ) - return *it; - } - return PoolItem(); - } - - /** The best candidate for update, if there is one. - * In contrary to \ref candidateObj, this may return no item even if - * there are available objects. This simply means the best object is - * already installed, and all available objects violate at least one - * update policy. - */ - PoolItem updateCandidateObj() const - { - PoolItem defaultCand( defaultCandidate() ); - - // multiversionInstall: This returns the candidate for the last - // instance installed. Actually we'd need a list here. - - if ( installedEmpty() || ! defaultCand ) - return defaultCand; - // Here: installed and defaultCand are non NULL and it's not a - // multiversion install. - - PoolItem installed( installedObj() ); - // check vendor change - if ( ! ( ResPool::instance().resolver().allowVendorChange() - || VendorAttr::instance().equivalent( defaultCand->vendor(), installed->vendor() ) ) ) - return PoolItem(); - - // check arch change (arch noarch changes are allowed) - if ( defaultCand->arch() != installed->arch() - && ! ( defaultCand->arch() == Arch_noarch || installed->arch() == Arch_noarch ) ) - return PoolItem(); - - // check greater edition - if ( defaultCand->edition() <= installed->edition() ) - return PoolItem(); - - return defaultCand; - } - - /** \copydoc Selectable::highestAvailableVersionObj()const */ - PoolItem highestAvailableVersionObj() const - { - PoolItem ret; - for_( it, availableBegin(), availableEnd() ) - { - if ( !ret || (*it).satSolvable().edition() > ret.satSolvable().edition() ) - ret = *it; - } - return ret; - } - - /** \copydoc Selectable::identicalAvailable( const PoolItem & )const */ - bool identicalAvailable( const PoolItem & rhs ) const - { return bool(identicalAvailableObj( rhs )); } - - /** \copydoc Selectable::identicalInstalled( const PoolItem & )const */ - bool identicalInstalled( const PoolItem & rhs ) const - { return bool(identicalInstalledObj( rhs )); } - - /** \copydoc Selectable::identicalAvailableObj( const PoolItem & rhs ) const */ - PoolItem identicalAvailableObj( const PoolItem & rhs ) const - { - if ( !availableEmpty() && rhs ) - { - for_( it, _availableItems.begin(), _availableItems.end() ) - { - if ( identical( *it, rhs ) ) - return *it; - } - } - return PoolItem(); - } - - /** \copydoc Selectable::identicalInstalledObj( const PoolItem & rhs ) const */ - PoolItem identicalInstalledObj( const PoolItem & rhs ) const - { - if ( !installedEmpty() && rhs ) - { - for_( it, _installedItems.begin(), _installedItems.end() ) - { - if ( identical( *it, rhs ) ) - return *it; - } - } - return PoolItem(); - } - - /** Best among all objects. */ - PoolItem theObj() const - { - PoolItem ret( candidateObj() ); - if ( ret ) - return ret; - return installedObj(); - } - - //////////////////////////////////////////////////////////////////////// - - bool availableEmpty() const - { return _availableItems.empty(); } - - available_size_type availableSize() const - { return _availableItems.size(); } - - available_const_iterator availableBegin() const - { return _availableItems.begin(); } - - available_const_iterator availableEnd() const - { return _availableItems.end(); } - - //////////////////////////////////////////////////////////////////////// - - bool installedEmpty() const - { return _installedItems.empty(); } - - installed_size_type installedSize() const - { return _installedItems.size(); } - - installed_iterator installedBegin() const - { return _installedItems.begin(); } - - installed_iterator installedEnd() const - { return _installedItems.end(); } - - //////////////////////////////////////////////////////////////////////// - - const PickList & picklist() const - { - if ( ! _picklistPtr ) - { - _picklistPtr.reset( new PickList ); - // installed without identical avaialble first: - for_( it, _installedItems.begin(), _installedItems.end() ) - { - if ( ! identicalAvailable( *it ) ) - _picklistPtr->push_back( *it ); - } - _picklistPtr->insert( _picklistPtr->end(), availableBegin(), availableEnd() ); - } - return *_picklistPtr; - } - - bool picklistEmpty() const - { return picklist().empty(); } - - picklist_size_type picklistSize() const - { return picklist().size(); } - - picklist_iterator picklistBegin() const - { return picklist().begin(); } - - picklist_iterator picklistEnd() const - { return picklist().end(); } - - //////////////////////////////////////////////////////////////////////// - - bool isUnmaintained() const - { return availableEmpty(); } - - bool multiversionInstall() const - { return sat::Pool::instance().isMultiversion( ident() ); } - - bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ); - - bool pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ); - - Status pickStatus( const PoolItem & pi_r ) const; - - bool setPickStatus( const PoolItem & pi_r, Status state_r, ResStatus::TransactByValue causer_r ); - - //////////////////////////////////////////////////////////////////////// - - bool isUndetermined() const - { - PoolItem cand( candidateObj() ); - return ! cand || cand.isUndetermined(); - } - bool isRelevant() const - { - PoolItem cand( candidateObj() ); - return cand && cand.isRelevant(); - } - bool isSatisfied() const - { - PoolItem cand( candidateObj() ); - return cand && cand.isSatisfied(); - } - bool isBroken() const - { - PoolItem cand( candidateObj() ); - return cand && cand.isBroken(); - } - - /** Return who caused the modification. */ - ResStatus::TransactByValue modifiedBy() const; - - /** Return value of LicenceConfirmed bit. */ - bool hasLicenceConfirmed() const - { return candidateObj() && candidateObj().status().isLicenceConfirmed(); } - - /** Set LicenceConfirmed bit. */ - void setLicenceConfirmed( bool val_r ) - { if ( candidateObj() ) candidateObj().status().setLicenceConfirmed( val_r ); } - - private: - PoolItem transactingInstalled() const - { - for_( it, installedBegin(), installedEnd() ) - { - if ( (*it).status().transacts() ) - return (*it); - } - return PoolItem(); - } - - PoolItem transactingCandidate() const - { - for_( it, availableBegin(), availableEnd() ) - { - if ( (*it).status().transacts() ) - return (*it); - } - return PoolItem(); - } - - PoolItem defaultCandidate() const - { - if ( ! installedEmpty() ) - { - // prefer the installed objects arch and vendor - bool solver_allowVendorChange( ResPool::instance().resolver().allowVendorChange() ); - for ( installed_const_iterator iit = installedBegin(); - iit != installedEnd(); ++iit ) - { - PoolItem sameArch; // in case there's no same vendor at least stay with same arch. - for ( available_const_iterator it = availableBegin(); - it != availableEnd(); ++it ) - { - // 'same arch' includes allowed changes to/from noarch. - if ( (*iit)->arch() == (*it)->arch() || (*iit)->arch() == Arch_noarch || (*it)->arch() == Arch_noarch ) - { - if ( ! solver_allowVendorChange ) - { - if ( VendorAttr::instance().equivalent( (*iit), (*it) ) ) - return *it; - else if ( ! sameArch ) // remember best same arch in case no same vendor found - sameArch = *it; - } - else // same arch is sufficient - return *it; - } - } - if ( sameArch ) - return sameArch; - } - } - if ( _availableItems.empty() ) - return PoolItem(); - - return *_availableItems.begin(); - } - - bool allCandidatesLocked() const - { - for ( available_const_iterator it = availableBegin(); - it != availableEnd(); ++it ) - { - if ( ! (*it).status().isLocked() ) - return false; - } - return( ! _availableItems.empty() ); - } - - bool allInstalledLocked() const - { - for ( installed_const_iterator it = installedBegin(); - it != installedEnd(); ++it ) - { - if ( ! (*it).status().isLocked() ) - return false; - } - return( ! _installedItems.empty() ); - } - - - private: - const IdString _ident; - const ResObject::Kind _kind; - const std::string _name; - InstalledItemSet _installedItems; - AvailableItemSet _availableItems; - //! The object selected by setCandidateObj() method. - PoolItem _candidate; - //! lazy initialized picklist - mutable scoped_ptr _picklistPtr; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates Selectable::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Selectable::Impl & obj ) - { - return str << '[' << obj.kind() << ']' << obj.name() << ": " << obj.status() - << " (I " << obj.installedSize() << ")" - << " (A " << obj.availableSize() << ")" - << obj.candidateObj(); - } - - /** \relates Selectable::Impl Stream output */ - inline std::ostream & dumpOn( std::ostream & str, const Selectable::Impl & obj ) - { - str << '[' << obj.kind() << ']' << obj.name() << ": " << obj.status() - << ( obj.multiversionInstall() ? " (multiversion)" : "") << endl; - - if ( obj.installedEmpty() ) - str << " (I 0) {}" << endl << " "; - else - { - PoolItem icand( obj.installedObj() ); - str << " (I " << obj.installedSize() << ") {" << endl; - for_( it, obj.installedBegin(), obj.installedEnd() ) - { - char t = ' '; - if ( *it == icand ) - { - t = 'i'; - } - str << " " << t << " " << *it << endl; - } - str << "} "; - } - - if ( obj.availableEmpty() ) - { - str << "(A 0) {}" << endl << " "; - } - else - { - PoolItem cand( obj.candidateObj() ); - PoolItem up( obj.updateCandidateObj() ); - str << "(A " << obj.availableSize() << ") {" << endl; - for_( it, obj.availableBegin(), obj.availableEnd() ) - { - char t = ' '; - if ( *it == cand ) - { - t = *it == up ? 'C' : 'c'; - } - else if ( *it == up ) - { - t = 'u'; - } - str << " " << t << " " << *it << endl; - } - str << "} "; - } - - if ( obj.picklistEmpty() ) - { - str << "(P 0) {}"; - } - else - { - PoolItem cand( obj.candidateObj() ); - PoolItem up( obj.updateCandidateObj() ); - str << "(P " << obj.picklistSize() << ") {" << endl; - for_( it, obj.picklistBegin(), obj.picklistEnd() ) - { - char t = ' '; - if ( *it == cand ) - { - t = *it == up ? 'C' : 'c'; - } - else if ( *it == up ) - { - t = 'u'; - } - str << " " << t << " " << *it << "\t" << obj.pickStatus( *it ) << endl; - } - str << "} "; - } - - return str; - } - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_UI_SELECTABLEIMPL_H diff --git a/libzypp/zypp/ui/SelectableTraits.h b/libzypp/zypp/ui/SelectableTraits.h deleted file mode 100644 index 9ad8102..0000000 --- a/libzypp/zypp/ui/SelectableTraits.h +++ /dev/null @@ -1,130 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/SelectableTraits.h - * -*/ -#ifndef ZYPP_UI_SELECTABLETRAITS_H -#define ZYPP_UI_SELECTABLETRAITS_H - -#include -#include - -#include "zypp/base/Iterator.h" -#include "zypp/PoolItem.h" -#include "zypp/pool/ByIdent.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : SelectableTraits - // - /** */ - struct SelectableTraits - { - /** Oder on AvailableItemSet. - * \li repository priority - * \li best Arch (arch/noarch changes are ok) - * \li best Edition - * \li ResObject::constPtr as fallback. - */ - struct AVOrder : public std::binary_function - { - // NOTE: operator() provides LESS semantics to order the set. - // So LESS means 'prior in set'. We want 'better' archs and - // 'better' editions at the beginning of the set. So we return - // TRUE if (lhs > rhs)! - // - bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const - { - int lprio = lhs->satSolvable().repository().satInternalPriority(); - int rprio = rhs->satSolvable().repository().satInternalPriority(); - if ( lprio != rprio ) - return( lprio > rprio ); - - // arch/noarch changes are ok. - if ( lhs->arch() != Arch_noarch && rhs->arch() != Arch_noarch ) - { - int res = lhs->arch().compare( rhs->arch() ); - if ( res ) - return res > 0; - } - - int res = lhs->edition().compare( rhs->edition() ); - if ( res ) - return res > 0; - - lprio = lhs->satSolvable().repository().satInternalSubPriority(); - rprio = rhs->satSolvable().repository().satInternalSubPriority(); - if ( lprio != rprio ) - return( lprio > rprio ); - - // no more criteria, still equal: sort by id - return lhs.satSolvable().id() < rhs.satSolvable().id(); - } - }; - - /** Oder on InstalledItemSet. - * \li best Arch - * \li best Edition - * \li newer install time - * \li ResObject::constPtr as fallback. - */ - struct IOrder : public std::binary_function - { - // NOTE: operator() provides LESS semantics to order the set. - // So LESS means 'prior in set'. We want 'newer' install time - // at the beginning of the set. - // - bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const - { - int res = lhs->arch().compare( rhs->arch() ); - if ( res ) - return res > 0; - res = lhs->edition().compare( rhs->edition() ); - if ( res ) - return res > 0; - Date ldate = lhs->installtime(); - Date rdate = rhs->installtime(); - if ( ldate != rdate ) - return( ldate > rdate ); - - // no more criteria, still equal: sort by id - return lhs.satSolvable().id() < rhs.satSolvable().id(); - } - }; - - typedef std::set AvailableItemSet; - typedef AvailableItemSet::iterator available_iterator; - typedef AvailableItemSet::const_iterator available_const_iterator; - typedef AvailableItemSet::size_type available_size_type; - - typedef std::set InstalledItemSet; - typedef AvailableItemSet::iterator installed_iterator; - typedef AvailableItemSet::const_iterator installed_const_iterator; - typedef AvailableItemSet::size_type installed_size_type; - - typedef std::vector PickList; - typedef PickList::const_iterator picklist_iterator; - typedef PickList::size_type picklist_size_type; - }; - /////////////////////////////////////////////////////////////////// - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_UI_SELECTABLETRAITS_H diff --git a/libzypp/zypp/ui/Status.cc b/libzypp/zypp/ui/Status.cc deleted file mode 100644 index cff70a2..0000000 --- a/libzypp/zypp/ui/Status.cc +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/Status.cc - * -*/ -#include - -#include "zypp/base/Logger.h" - -#include "zypp/ui/Status.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - /****************************************************************** - ** - ** FUNCTION NAME : asString - ** FUNCTION TYPE : std::string - */ - std::string asString( const Status & obj ) - { - switch ( obj ) { -#define ENUM_OUT(V) case V: return #V; break - - ENUM_OUT( S_Protected ); - ENUM_OUT( S_Taboo ); - ENUM_OUT( S_Del ); - ENUM_OUT( S_Install ); - ENUM_OUT( S_Update ); - ENUM_OUT( S_AutoDel ); - ENUM_OUT( S_AutoInstall ); - ENUM_OUT( S_AutoUpdate ); - ENUM_OUT( S_NoInst ); - ENUM_OUT( S_KeepInstalled ); - -#undef ENUM_OUT - } - - INT << "Unknown ui::Status " << (unsigned)obj << std::endl; - return "Status(UNKNOWN)"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ui/Status.h b/libzypp/zypp/ui/Status.h deleted file mode 100644 index 9d5d061..0000000 --- a/libzypp/zypp/ui/Status.h +++ /dev/null @@ -1,68 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/ui/Status.h - * -*/ -#ifndef ZYPP_UI_STATUS_H -#define ZYPP_UI_STATUS_H - -#include -#include - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace ui - { ///////////////////////////////////////////////////////////////// - - /** UI status - * Status values calculated by \ref Selectable. - - * \note The \ref Status enum, and it's use within \ref Selectabe - * is tightly related to the Y2UI. It might be not verry usefull - * outside the Y2UI. - * - * \todo make it an EnumerationClass - */ - enum Status - { - S_Protected, // Keep this unmodified ( have installedObj && S_Protected ) - S_Taboo, // Keep this unmodified ( have no installedObj && S_Taboo) - // requested by user: - S_Del, // delete installedObj ( clears S_Protected if set ) - S_Update, // install candidateObj ( have installedObj, clears S_Protected if set ) - S_Install, // install candidateObj ( have no installedObj, clears S_Taboo if set ) - // not requested by user: - S_AutoDel, // delete installedObj - S_AutoUpdate, // install candidateObj ( have installedObj ) - S_AutoInstall, // install candidateObj ( have no installedObj ) - // no modification: - S_KeepInstalled, // no modification ( have installedObj && !S_Protected, clears S_Protected if set ) - S_NoInst, // no modification ( have no installedObj && !S_Taboo, clears S_Taboo if set ) - }; - - /////////////////////////////////////////////////////////////////// - - /** \relates Status Enum value as string. */ - std::string asString( const Status & obj ); - - /////////////////////////////////////////////////////////////////// - - /** \relates Status Stream output */ - inline std::ostream & operator<<( std::ostream & str, const Status & obj ) - { return str << asString( obj ); } - - ///////////////////////////////////////////////////////////////// - } // namespace ui - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_UI_STATUS_H diff --git a/libzypp/zypp/ui/UserWantedPackages.cc b/libzypp/zypp/ui/UserWantedPackages.cc deleted file mode 100644 index 7e92856..0000000 --- a/libzypp/zypp/ui/UserWantedPackages.cc +++ /dev/null @@ -1,161 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/ui/UserWantedPackages.cc - * - * \author Stefan Hundhammer - * - */ -#include -#include "zypp/base/Logger.h" - -#include "zypp/ui/UserWantedPackages.h" - -#include "zypp/base/PtrTypes.h" -#include "zypp/ui/Selectable.h" - -#include "zypp/ResObjects.h" -#include "zypp/ZYppFactory.h" -#include "zypp/ResPoolProxy.h" - - -using std::string; -using std::set; -using std::endl; - - -namespace zypp -{ - namespace ui - { - typedef ResPoolProxy::const_iterator PoolProxyIterator; - - static inline ResPoolProxy poolProxy() { return getZYpp()->poolProxy(); } - - template PoolProxyIterator poolProxyBegin() { return poolProxy().byKindBegin(); } - template PoolProxyIterator poolProxyEnd() { return poolProxy().byKindEnd(); } - - static inline PoolProxyIterator pkgBegin() { return poolProxyBegin(); } - static inline PoolProxyIterator pkgEnd() { return poolProxyEnd(); } - -// static inline PoolProxyIterator langBegin() { return poolProxyBegin(); } -// static inline PoolProxyIterator langEnd() { return poolProxyEnd(); } - - static inline PoolProxyIterator patchesBegin() { return poolProxyBegin(); } - static inline PoolProxyIterator patchesEnd() { return poolProxyEnd(); } - - template bool contains( const std::set & container, T search ) - { - return container.find( search ) != container.end(); - } - - - - static void addDirectlySelectedPackages ( set & pkgNames ); - template void addPkgSetPackages( set & pkgNames ); - - static void addPatternPackages ( set & pkgNames ); - static void addPatchPackages ( set & pkgNames ); - - - - set userWantedPackageNames() - { - set pkgNames; - - DBG << "Collecting packages the user explicitly asked for" << endl; - - addDirectlySelectedPackages ( pkgNames ); - addPatternPackages ( pkgNames ); - addPatchPackages ( pkgNames ); - - return pkgNames; - } - - - - static void addDirectlySelectedPackages( set & pkgNames ) - { - for ( PoolProxyIterator it = pkgBegin(); - it != pkgEnd(); - ++it ) - { - // Add all packages the user wanted to transact directly, - // no matter what the transaction is (install, update, delete) - - if ( (*it)->toModify() && (*it)->modifiedBy() == ResStatus::USER ) - { - DBG << "Explicit user transaction on pkg \"" << (*it)->name() << "\"" << endl; - - pkgNames.insert( (*it)->name() ); - } - } - } - - - - static void addPatternPackages( set & pkgNames ) - { - addPkgSetPackages( pkgNames ); - } - - - /** - * Template to handle Patterns - **/ - template void addPkgSetPackages( set & pkgNames ) - { - for ( PoolProxyIterator it = poolProxyBegin(); - it != poolProxyEnd(); - ++it ) - { - // Take all pkg sets (patterns) into account that - // will be transacted, no matter if the user explicitly asked - // for that pkg set or if the patterns is required by another - // pkg set of the same class - - typename PkgSet_T::constPtr pkgSet = dynamic_pointer_cast( (*it)->theObj() ? (*it)->theObj().resolvable() : 0L ); - - if ( pkgSet && (*it)->toModify() ) - { - DBG << (*it)->theObj()->kind().asString() - << " will be transacted: \"" << pkgSet->name() << "\"" << endl; - -#warning NEEDS FIX - set setPkgs;// = pkgSet->install_packages(); - pkgNames.insert( setPkgs.begin(), setPkgs.end() ); - } - } - } - - - static void addPatchPackages( set & pkgNames ) - { - for ( PoolProxyIterator patch_it = patchesBegin(); - patch_it != patchesEnd(); - ++patch_it ) - { - Patch::constPtr patch = dynamic_pointer_cast( (*patch_it)->theObj() ? (*patch_it)->theObj().resolvable() : 0 ); - - if ( patch && (*patch_it)->toModify() ) - { - DBG << "Patch will be transacted: \"" << patch->name() - << "\" - \"" << patch->summary() << "\"" << endl; - - Patch::Contents contents( patch->contents() ); - for_( it, contents.begin(), contents.end() ) - { - pkgNames.insert( it->name() ); - } - } - } - } - - } // namespace ui -} // namespace zypp diff --git a/libzypp/zypp/ui/UserWantedPackages.h b/libzypp/zypp/ui/UserWantedPackages.h deleted file mode 100644 index 6f8709a..0000000 --- a/libzypp/zypp/ui/UserWantedPackages.h +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/ui/UserWantedPackages.h - * - * \author Stefan Hundhammer - * - */ -#ifndef USER_WANTED_PACKAGES_H -#define USER_WANTED_PACKAGES_H - -#include -#include - -namespace zypp -{ - namespace ui - { - /** - * This returns a set of package names the user explicitly wanted to - * transact ( to install, to update, or to delete) for any of the - * following reasons: - * - * - The user wanted to transact the pkg directly - * - * - Pkg is part of a pattern the user wanted to transact - * - Pkg is part of a language the user wanted to transact - * (? No more transacting Languages) - * - Pkg is part of a patch the user wanted to transact - * - * - Pkg is part of a pattern that is required by a pattern the - * user wanted to transact - **/ - std::set userWantedPackageNames(); - - } // namespace ui -} // namespace zypp - -#endif // USER_WANTED_PACKAGES_H diff --git a/libzypp/zypp/url/UrlBase.cc b/libzypp/zypp/url/UrlBase.cc deleted file mode 100644 index 5238d52..0000000 --- a/libzypp/zypp/url/UrlBase.cc +++ /dev/null @@ -1,1380 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/url/UrlBase.cc - */ -#include "zypp/url/UrlBase.h" -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Regex.h" - -#include -#include -#include -#include -#include -#include - -#include - -// in the Estonian locale, a-z excludes t, for example. #302525 -// http://en.wikipedia.org/wiki/Estonian_alphabet -#define a_zA_Z "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - -// --------------------------------------------------------------- -/* -** authority = //[user [:password] @ ] host [:port] -** -** host = hostname | IPv4 | "[" IPv6-IP "]" | "[v...]" -*/ -#define RX_VALID_SCHEME "^[" a_zA_Z "][" a_zA_Z "0-9\\.+-]*$" - -#define RX_VALID_PORT "^[0-9]{1,5}$" - -#define RX_VALID_HOSTNAME "^[[:alnum:]]+([\\.-][[:alnum:]]+)*$" - -#define RX_VALID_HOSTIPV4 \ - "^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$" - -#define RX_VALID_HOSTIPV6 \ - "^\\[[:a-fA-F0-9]+(:[0-9]{1,3}(\\.[0-9]{1,3}){3})?\\]$" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace url - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - /* - ** URL asString() view option constants: - */ - const ViewOption ViewOption::WITH_SCHEME = 0x0001; - const ViewOption ViewOption::WITH_USERNAME = 0x0002; - const ViewOption ViewOption::WITH_PASSWORD = 0x0004; - const ViewOption ViewOption::WITH_HOST = 0x0008; - const ViewOption ViewOption::WITH_PORT = 0x0010; - const ViewOption ViewOption::WITH_PATH_NAME = 0x0020; - const ViewOption ViewOption::WITH_PATH_PARAMS = 0x0040; - const ViewOption ViewOption::WITH_QUERY_STR = 0x0080; - const ViewOption ViewOption::WITH_FRAGMENT = 0x0100; - const ViewOption ViewOption::EMPTY_AUTHORITY = 0x0200; - const ViewOption ViewOption::EMPTY_PATH_NAME = 0x0400; - const ViewOption ViewOption::EMPTY_PATH_PARAMS = 0x0800; - const ViewOption ViewOption::EMPTY_QUERY_STR = 0x1000; - const ViewOption ViewOption::EMPTY_FRAGMENT = 0x2000; - const ViewOption ViewOption::DEFAULTS = 0x07bb; - /* - const ViewOption ViewOption::DEFAULTS = - ViewOption::WITH_SCHEME + - ViewOption::WITH_USERNAME + - ViewOption::WITH_HOST + - ViewOption::WITH_PORT + - ViewOption::WITH_PATH_NAME + - ViewOption::WITH_QUERY_STR + - ViewOption::WITH_FRAGMENT + - ViewOption::EMPTY_AUTHORITY + - ViewOption::EMPTY_PATH_NAME; - */ - - // --------------------------------------------------------------- - ViewOption::ViewOption() - : opt(0x07bb) - {} - - // --------------------------------------------------------------- - ViewOption::ViewOption(int option) - : opt(option) - {} - - - // --------------------------------------------------------------- - /* - ** Behaviour configuration variables. - */ - typedef std::map< std::string, std::string > UrlConfig; - - - // --------------------------------------------------------------- - /** - * \brief Internal data used by UrlBase. - */ - class UrlBaseData - { - public: - UrlBaseData() - {} - - UrlBaseData(const UrlConfig &conf) - : config(conf) - {} - - UrlConfig config; - ViewOptions vopts; - - std::string scheme; - std::string user; - std::string pass; - std::string host; - std::string port; - std::string pathname; - std::string pathparams; - std::string querystr; - std::string fragment; - }; - - - // --------------------------------------------------------------- - /* - ** Anonymous/internal utility namespace: - */ - namespace // anonymous - { - - // ------------------------------------------------------------- - inline void - checkUrlData(const std::string &data, - const std::string &name, - const std::string ®x, - bool show=true) - { - if( regx.empty() || regx == "^$") - { - ZYPP_THROW(UrlNotAllowedException( - str::form(_("Url scheme does not allow a %s"), name.c_str()) - )); - } - else - { - bool valid = false; - try - { - str::regex rex(regx); - valid = str::regex_match(data, rex); - } - catch( ... ) - {} - - if( !valid) - { - if( show) - { - ZYPP_THROW(UrlBadComponentException( - str::form(_("Invalid %s component '%s'"), - name.c_str(), data.c_str()) - )); - } - else - { - ZYPP_THROW(UrlBadComponentException( - str::form(_("Invalid %s component"), name.c_str()) - )); - } - } - } - } - - } // namespace - - - // --------------------------------------------------------------- - UrlBase::~UrlBase() - { - delete m_data; - m_data = NULL; - } - - - // --------------------------------------------------------------- - UrlBase::UrlBase() - : m_data( new UrlBaseData()) - { - configure(); - } - - - // --------------------------------------------------------------- - UrlBase::UrlBase(const UrlBase &url) - : m_data( new UrlBaseData( *(url.m_data))) - { - } - - - // --------------------------------------------------------------- - UrlBase::UrlBase(const std::string &scheme, - const std::string &authority, - const std::string &pathdata, - const std::string &querystr, - const std::string &fragment) - : m_data( new UrlBaseData()) - { - configure(); - init(scheme, authority, pathdata, querystr, fragment); - } - - - // --------------------------------------------------------------- - void - UrlBase::init(const std::string &scheme, - const std::string &authority, - const std::string &pathdata, - const std::string &querystr, - const std::string &fragment) - { - if ( scheme.empty() && *pathdata.c_str() == '/' ) - setScheme("file"); - else - setScheme(scheme); - - setAuthority(authority); - setPathData(pathdata); - setQueryString(querystr); - setFragment(fragment, zypp::url::E_ENCODED); - } - - - // --------------------------------------------------------------- - void - UrlBase::configure() - { - config("sep_pathparams", ";"); - config("psep_pathparam", ","); - config("vsep_pathparam", "="); - - config("psep_querystr", "&"); - config("vsep_querystr", "="); - - config("safe_username", "~!$&'()*+=,;"); - config("safe_password", "~!$&'()*+=,:;"); - config("safe_hostname", "[:]"); - config("safe_pathname", "~!$&'()*+=,:@/"); - config("safe_pathparams", "~!$&'()*+=,:;@/"); - config("safe_querystr", "~!$&'()*+=,:;@/?"); - config("safe_fragment", "~!$&'()*+=,:;@/?"); - - // y=yes (allowed) - // n=no (disallowed, exception if !empty) - config("with_authority", "y"); - config("with_port", "y"); - - // y=yes (required but don't throw if empty) - // n=no (not required, ignore if empty) - // m=mandatory (exception if empty) - config("require_host", "n"); - config("require_pathname","n"); - - // y=yes (encode 2. slash even if authority present) - // n=no (don't encode 2. slash if authority present) - config("path_encode_slash2", "n"); - - config("rx_username", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,;~\\._-]|%[a-fA-F0-9]{2})+$"); - config("rx_password", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,:;~\\._-]|%[a-fA-F0-9]{2})+$"); - - config("rx_pathname", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,:@/~\\._-]|%[a-fA-F0-9]{2})+$"); - config("rx_pathparams", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,:;@/~\\._-]|%[a-fA-F0-9]{2})+$"); - - config("rx_querystr", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,:;@/?~\\._-]|%[a-fA-F0-9]{2})+$"); - config("rx_fragment", "^([" a_zA_Z "0-9!$&'\\(\\)*+=,:;@/?~\\._-]|%[a-fA-F0-9]{2})+$"); - } - - - // --------------------------------------------------------------- - void - UrlBase::config(const std::string &opt, const std::string &val) - { - m_data->config[opt] = val; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::config(const std::string &opt) const - { - UrlConfig::const_iterator v( m_data->config.find(opt)); - if( v != m_data->config.end()) - return v->second; - else - return std::string(); - } - - - // --------------------------------------------------------------- - ViewOptions - UrlBase::getViewOptions() const - { - return m_data->vopts; - } - - - // --------------------------------------------------------------- - void - UrlBase::setViewOptions(const ViewOptions &vopts) - { - m_data->vopts = vopts; - } - - - // --------------------------------------------------------------- - void - UrlBase::clear() - { - zypp::url::UrlConfig config(m_data->config); - zypp::url::ViewOptions vopts(m_data->vopts); - *m_data = UrlBaseData(); - m_data->config = config; - m_data->vopts = vopts; - } - - - // --------------------------------------------------------------- - UrlBase * - UrlBase::clone() const - { - return new UrlBase(*this); - } - - - // --------------------------------------------------------------- - zypp::url::UrlSchemes - UrlBase::getKnownSchemes() const - { - return UrlSchemes(); - } - - - // --------------------------------------------------------------- - bool - UrlBase::isKnownScheme(const std::string &scheme) const - { - std::string lscheme( str::toLower(scheme)); - UrlSchemes schemes( getKnownSchemes()); - UrlSchemes::const_iterator s; - - for(s=schemes.begin(); s!=schemes.end(); ++s) - { - if( lscheme == str::toLower(*s)) - return true; - } - return false; - } - - - // --------------------------------------------------------------- - bool - UrlBase::isValidScheme(const std::string &scheme) const - { - bool valid = false; - try - { - str::regex rex(RX_VALID_SCHEME); - valid = str::regex_match(scheme, rex); - } - catch( ... ) - {} - - if(valid) - { - std::string lscheme( str::toLower(scheme)); - UrlSchemes schemes( getKnownSchemes()); - - if( schemes.empty()) - return true; - - UrlSchemes::const_iterator s; - for(s=schemes.begin(); s!=schemes.end(); ++s) - { - if( lscheme == str::toLower(*s)) - return true; - } - } - return false; - } - - - // --------------------------------------------------------------- - bool - UrlBase::isValid() const - { - /* - ** scheme is the only mandatory component - ** for all url's and is already verified, - ** (except for empty Url instances), so - ** Url with empty scheme is never valid. - */ - if( getScheme().empty()) - return false; - - std::string host( getHost(zypp::url::E_ENCODED)); - if( host.empty() && config("require_host") != "n") - return false; - - std::string path( getPathName(zypp::url::E_ENCODED)); - if( path.empty() && config("require_pathname") != "n") - return false; - - /* - ** path has to begin with "/" if authority avaliable - ** if host is set after the pathname, we can't throw - */ - if( !host.empty() && !path.empty() && path.at(0) != '/') - return false; - - return true; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::asString() const - { - return asString(getViewOptions()); - } - - - // --------------------------------------------------------------- - std::string - UrlBase::asString(const zypp::url::ViewOptions &opts) const - { - std::string url; - UrlBaseData tmp; - - if( opts.has(ViewOptions::WITH_SCHEME)) - { - tmp.scheme = getScheme(); - if( !tmp.scheme.empty()) - { - url += tmp.scheme + ":"; - - if( opts.has(ViewOptions::WITH_HOST)) - { - tmp.host = getHost(zypp::url::E_ENCODED); - if( !tmp.host.empty()) - { - url += "//"; - - if( opts.has(ViewOptions::WITH_USERNAME)) - { - tmp.user = getUsername(zypp::url::E_ENCODED); - if( !tmp.user.empty()) - { - url += tmp.user; - - if( opts.has(ViewOptions::WITH_PASSWORD)) - { - tmp.pass = getPassword(zypp::url::E_ENCODED); - if( !tmp.pass.empty()) - { - url += ":" + tmp.pass; - } - } - url += "@"; - } - } - - url += tmp.host; - - if( opts.has(ViewOptions::WITH_PORT)) - { - tmp.port = getPort(); - if( !tmp.port.empty()) - { - url += ":" + tmp.port; - } - } - } - else if( opts.has(ViewOptions::EMPTY_AUTHORITY)) - { - url += "//"; - } - } - else if( opts.has(ViewOptions::EMPTY_AUTHORITY)) - { - url += "//"; - } - } - } - - if( opts.has(ViewOptions::WITH_PATH_NAME)) - { - tmp.pathname = getPathName(zypp::url::E_ENCODED); - if( !tmp.pathname.empty()) - { - if(url.find("/") != std::string::npos) - { - // Url contains authority (that may be empty), - // we may need a rewrite of the encoded path. - tmp.pathname = cleanupPathName(tmp.pathname, true); - if(tmp.pathname.at(0) != '/') - { - url += "/"; - } - } - url += tmp.pathname; - - if( opts.has(ViewOptions::WITH_PATH_PARAMS)) - { - tmp.pathparams = getPathParams(); - if( !tmp.pathparams.empty()) - { - url += ";" + tmp.pathparams; - } - else if( opts.has(ViewOptions::EMPTY_PATH_PARAMS)) - { - url += ";"; - } - } - } - else if( opts.has(ViewOptions::EMPTY_PATH_NAME) - && url.find("/") != std::string::npos) - { - url += "/"; - if( opts.has(ViewOptions::EMPTY_PATH_PARAMS)) - { - url += ";"; - } - } - } - - if( opts.has(ViewOptions::WITH_QUERY_STR)) - { - tmp.querystr = getQueryString(); - if( !tmp.querystr.empty()) - { - url += "?" + tmp.querystr; - } - else if( opts.has(ViewOptions::EMPTY_QUERY_STR)) - { - url += "?"; - } - } - - if( opts.has(ViewOptions::WITH_FRAGMENT)) - { - tmp.fragment = getFragment(zypp::url::E_ENCODED); - if( !tmp.fragment.empty()) - { - url += "#" + tmp.fragment; - } - else if( opts.has(ViewOptions::EMPTY_FRAGMENT)) - { - url += "#"; - } - } - - return url; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getScheme() const - { - return m_data->scheme; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getAuthority() const - { - std::string str; - if( !getHost(zypp::url::E_ENCODED).empty()) - { - if( !getUsername(zypp::url::E_ENCODED).empty()) - { - str = getUsername(zypp::url::E_ENCODED); - if( !getPassword(zypp::url::E_ENCODED).empty()) - { - str += ":" + getPassword(zypp::url::E_ENCODED); - } - str += "@"; - } - - str += getHost(zypp::url::E_ENCODED); - if( !getPort().empty()) - { - str += ":" + getPort(); - } - } - return str; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPathData() const - { - return getPathName(zypp::url::E_ENCODED) + - config("sep_pathparams") + - getPathParams(); - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getQueryString() const - { - return m_data->querystr; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getFragment(EEncoding eflag) const - { - if(eflag == zypp::url::E_DECODED) - return zypp::url::decode(m_data->fragment); - else - return m_data->fragment; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getUsername(EEncoding eflag) const - { - if(eflag == zypp::url::E_DECODED) - return zypp::url::decode(m_data->user); - else - return m_data->user; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPassword(EEncoding eflag) const - { - if(eflag == zypp::url::E_DECODED) - return zypp::url::decode(m_data->pass); - else - return m_data->pass; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getHost(EEncoding eflag) const - { - if(eflag == zypp::url::E_DECODED) - return zypp::url::decode(m_data->host); - else - return m_data->host; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPort() const - { - return m_data->port; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPathName(EEncoding eflag) const - { - if(eflag == zypp::url::E_DECODED) - return zypp::url::decode(m_data->pathname); - else - return cleanupPathName(m_data->pathname); - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPathParams() const - { - return m_data->pathparams; - } - - - // --------------------------------------------------------------- - zypp::url::ParamVec - UrlBase::getPathParamsVec() const - { - zypp::url::ParamVec pvec; - if( config("psep_pathparam").empty()) - { - pvec.push_back(getPathParams()); - } - else - { - zypp::url::split( - pvec, - getPathParams(), - config("psep_pathparam") - ); - } - return pvec; - } - - - // --------------------------------------------------------------- - zypp::url::ParamMap - UrlBase::getPathParamsMap(EEncoding eflag) const - { - if( config("psep_pathparam").empty() || - config("vsep_pathparam").empty()) - { - ZYPP_THROW(UrlNotSupportedException( - "Path parameter parsing not supported for this URL" - )); - } - zypp::url::ParamMap pmap; - zypp::url::split( - pmap, - getPathParams(), - config("psep_pathparam"), - config("vsep_pathparam"), - eflag - ); - return pmap; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getPathParam(const std::string ¶m, EEncoding eflag) const - { - zypp::url::ParamMap pmap( getPathParamsMap( eflag)); - zypp::url::ParamMap::const_iterator i( pmap.find(param)); - - return i != pmap.end() ? i->second : std::string(); - } - - - // --------------------------------------------------------------- - zypp::url::ParamVec - UrlBase::getQueryStringVec() const - { - zypp::url::ParamVec pvec; - if( config("psep_querystr").empty()) - { - pvec.push_back(getQueryString()); - } - else - { - zypp::url::split( - pvec, - getQueryString(), - config("psep_querystr") - ); - } - return pvec; - } - - - // --------------------------------------------------------------- - zypp::url::ParamMap - UrlBase::getQueryStringMap(EEncoding eflag) const - { - if( config("psep_querystr").empty() || - config("vsep_querystr").empty()) - { - ZYPP_THROW(UrlNotSupportedException( - _("Query string parsing not supported for this URL") - )); - } - zypp::url::ParamMap pmap; - zypp::url::split( - pmap, - getQueryString(), - config("psep_querystr"), - config("vsep_querystr"), - eflag - ); - return pmap; - } - - - // --------------------------------------------------------------- - std::string - UrlBase::getQueryParam(const std::string ¶m, EEncoding eflag) const - { - zypp::url::ParamMap pmap( getQueryStringMap( eflag)); - zypp::url::ParamMap::const_iterator i( pmap.find(param)); - - return i != pmap.end() ? i->second : std::string(); - } - - - // --------------------------------------------------------------- - void - UrlBase::setScheme(const std::string &scheme) - { - if( isValidScheme(scheme)) - { - m_data->scheme = str::toLower(scheme); - } - else - if( scheme.empty()) - { - ZYPP_THROW(UrlBadComponentException( - _("Url scheme is a required component") - )); - } - else - { - ZYPP_THROW(UrlBadComponentException( - str::form(_("Invalid Url scheme '%s'"), scheme.c_str()) - )); - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setAuthority(const std::string &authority) - { - std::string s = authority; - std::string::size_type p,q; - - std::string username, password, host, port; - - if ((p=s.find('@')) != std::string::npos) - { - q = s.find(':'); - if (q != std::string::npos && q < p) - { - setUsername(s.substr(0, q), zypp::url::E_ENCODED); - setPassword(s.substr(q+1, p-q-1), zypp::url::E_ENCODED); - } - else - setUsername(s.substr(0, p), zypp::url::E_ENCODED); - s = s.substr(p+1); - } - if ((p = s.rfind(':')) != std::string::npos && ( (q = s.rfind(']')) == std::string::npos || q < p) ) - { - setHost(s.substr(0, p)); - setPort(s.substr(p+1)); - } - else - setHost(s); - } - - // --------------------------------------------------------------- - void - UrlBase::setPathData(const std::string &pathdata) - { - size_t pos = std::string::npos; - std::string sep(config("sep_pathparams")); - - if( !sep.empty()) - pos = pathdata.find(sep); - - if( pos != std::string::npos) - { - setPathName(pathdata.substr(0, pos), - zypp::url::E_ENCODED); - setPathParams(pathdata.substr(pos + 1)); - } - else - { - setPathName(pathdata, - zypp::url::E_ENCODED); - setPathParams(""); - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setQueryString(const std::string &querystr) - { - if( querystr.empty()) - { - m_data->querystr = querystr; - } - else - { - checkUrlData(querystr, "query string", config("rx_querystr")); - - m_data->querystr = querystr; - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setFragment(const std::string &fragment, - EEncoding eflag) - { - if( fragment.empty()) - { - m_data->fragment = fragment; - } - else - { - if(eflag == zypp::url::E_ENCODED) - { - checkUrlData(fragment, "fragment", config("rx_fragment")); - - m_data->fragment = fragment; - } - else - { - m_data->fragment = zypp::url::encode( - fragment, config("safe_fragment") - ); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setUsername(const std::string &user, - EEncoding eflag) - { - if( user.empty()) - { - m_data->user = user; - } - else - { - if( config("with_authority") != "y") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme does not allow a username") - )); - } - - if(eflag == zypp::url::E_ENCODED) - { - checkUrlData(user, "username", config("rx_username")); - - m_data->user = user; - } - else - { - m_data->user = zypp::url::encode( - user, config("safe_username") - ); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setPassword(const std::string &pass, - EEncoding eflag) - { - if( pass.empty()) - { - m_data->pass = pass; - } - else - { - if( config("with_authority") != "y") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme does not allow a password") - )); - } - - if(eflag == zypp::url::E_ENCODED) - { - checkUrlData(pass, "password", config("rx_password"), false); - - m_data->pass = pass; - } - else - { - m_data->pass = zypp::url::encode( - pass, config("safe_password") - ); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setHost(const std::string &host) - { - if( host.empty()) - { - if(config("require_host") == "m") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme requires a host component") - )); - } - m_data->host = host; - } - else - { - if( config("with_authority") != "y") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme does not allow a host component") - )); - } - - if( isValidHost(host)) - { - std::string temp; - - // always decode in case isValidHost() - // is reimplemented and supports also - // the [v ... ] notation. - if( host.at(0) == '[') - { - temp = str::toUpper(zypp::url::decode(host)); - } - else - { - temp = str::toLower(zypp::url::decode(host)); - } - - m_data->host = zypp::url::encode( - temp, config("safe_hostname") - ); - } - else - { - ZYPP_THROW(UrlBadComponentException( - str::form(_("Invalid host component '%s'"), host.c_str()) - )); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setPort(const std::string &port) - { - if( port.empty()) - { - m_data->port = port; - } - else - { - if( config("with_authority") != "y" || - config("with_port") != "y") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme does not allow a port") - )); - } - - if( isValidPort(port)) - { - m_data->port = port; - } - else - { - ZYPP_THROW(UrlBadComponentException( - str::form(_("Invalid port component '%s'"), port.c_str()) - )); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setPathName(const std::string &path, - EEncoding eflag) - { - if( path.empty()) - { - if(config("require_pathname") == "m") - { - ZYPP_THROW(UrlNotAllowedException( - _("Url scheme requires path name") - )); - } - m_data->pathname = path; - } - else - { - if(eflag == zypp::url::E_ENCODED) - { - checkUrlData(path, "path name", config("rx_pathname")); - - if( !getHost(zypp::url::E_ENCODED).empty()) - { - // has to begin with a "/". For consistency with - // setPathName while the host is empty, we allow - // it in encoded ("%2f") form - cleanupPathName() - // will fix / decode the first slash if needed. - if(!(path.at(0) == '/' || (path.size() >= 3 && - str::toLower(path.substr(0, 3)) == "%2f"))) - { - ZYPP_THROW(UrlNotAllowedException( - _("Relative path not allowed if authority exists") - )); - } - } - - m_data->pathname = cleanupPathName(path); - } - else // zypp::url::E_DECODED - { - if( !getHost(zypp::url::E_ENCODED).empty()) - { - if(path.at(0) != '/') - { - ZYPP_THROW(UrlNotAllowedException( - _("Relative path not allowed if authority exists") - )); - } - } - - m_data->pathname = cleanupPathName( - zypp::url::encode( - path, config("safe_pathname") - ) - ); - } - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setPathParams(const std::string ¶ms) - { - if( params.empty()) - { - m_data->pathparams = params; - } - else - { - checkUrlData(params, "path parameters", config("rx_pathparams")); - - m_data->pathparams = params; - } - } - - - // --------------------------------------------------------------- - void - UrlBase::setPathParamsVec(const zypp::url::ParamVec &pvec) - { - setPathParams( - zypp::url::join( - pvec, - config("psep_pathparam") - ) - ); - } - - - // --------------------------------------------------------------- - void - UrlBase::setPathParamsMap(const zypp::url::ParamMap &pmap) - { - if( config("psep_pathparam").empty() || - config("vsep_pathparam").empty()) - { - ZYPP_THROW(UrlNotSupportedException( - "Path Parameter parsing not supported for this URL" - )); - } - setPathParams( - zypp::url::join( - pmap, - config("psep_pathparam"), - config("vsep_pathparam"), - config("safe_pathparams") - ) - ); - } - - - // --------------------------------------------------------------- - void - UrlBase::setPathParam(const std::string ¶m, const std::string &value) - { - zypp::url::ParamMap pmap( getPathParamsMap(zypp::url::E_DECODED)); - pmap[param] = value; - setPathParamsMap(pmap); - } - - - // --------------------------------------------------------------- - void - UrlBase::setQueryStringVec(const zypp::url::ParamVec &pvec) - { - setQueryString( - zypp::url::join( - pvec, - config("psep_querystr") - ) - ); - } - - - // --------------------------------------------------------------- - void - UrlBase::setQueryStringMap(const zypp::url::ParamMap &pmap) - { - if( config("psep_querystr").empty() || - config("vsep_querystr").empty()) - { - ZYPP_THROW(UrlNotSupportedException( - _("Query string parsing not supported for this URL") - )); - } - setQueryString( - zypp::url::join( - pmap, - config("psep_querystr"), - config("vsep_querystr"), - config("safe_querystr") - ) - ); - } - - // --------------------------------------------------------------- - void - UrlBase::setQueryParam(const std::string ¶m, const std::string &value) - { - zypp::url::ParamMap pmap( getQueryStringMap(zypp::url::E_DECODED)); - pmap[param] = value; - setQueryStringMap(pmap); - } - - // --------------------------------------------------------------- - void - UrlBase::delQueryParam(const std::string ¶m) - { - zypp::url::ParamMap pmap( getQueryStringMap(zypp::url::E_DECODED)); - pmap.erase(param); - setQueryStringMap(pmap); - } - - - // --------------------------------------------------------------- - std::string - UrlBase::cleanupPathName(const std::string &path) const - { - bool authority = !getHost(zypp::url::E_ENCODED).empty(); - return cleanupPathName(path, authority); - } - - // --------------------------------------------------------------- - std::string - UrlBase::cleanupPathName(const std::string &path, bool authority) const - { - std::string copy( path); - - // decode the first slash if it is encoded ... - if(copy.size() >= 3 && copy.at(0) != '/' && - str::toLower(copy.substr(0, 3)) == "%2f") - { - copy.replace(0, 3, "/"); - } - - // if path begins with a double slash ("//"); encode the second - // slash [minimal and IMO sufficient] before the first path - // segment, to fulfill the path-absolute rule of RFC 3986 - // disallowing a "//" if no authority is present. - if( authority) - { - // - // rewrite of "//" to "/%2f" not required, use config - // - if(config("path_encode_slash2") == "y") - { - // rewrite "//" ==> "/%2f" - if(copy.size() >= 2 && copy.at(0) == '/' && copy.at(1) == '/') - { - copy.replace(1, 1, "%2F"); - } - } - else - { - // rewrite "/%2f" ==> "//" - if(copy.size() >= 4 && copy.at(0) == '/' && - str::toLower(copy.substr(1, 4)) == "%2f") - { - copy.replace(1, 4, "/"); - } - } - } - else - { - // rewrite of "//" to "/%2f" is required (no authority) - if(copy.size() >= 2 && copy.at(0) == '/' && copy.at(1) == '/') - { - copy.replace(1, 1, "%2F"); - } - } - return copy; - } - - - // --------------------------------------------------------------- - bool - UrlBase::isValidHost(const std::string &host) const - { - try - { - str::regex regx(RX_VALID_HOSTIPV6); - if( str::regex_match(host, regx)) - { - struct in6_addr ip; - std::string temp( host.substr(1, host.size()-2)); - - return inet_pton(AF_INET6, temp.c_str(), &ip) > 0; - } - else - { - // matches also IPv4 dotted-decimal adresses... - std::string temp( zypp::url::decode(host)); - str::regex regx(RX_VALID_HOSTNAME); - return str::regex_match(temp, regx); - } - } - catch( ... ) - {} - - return false; - } - - - // --------------------------------------------------------------- - bool - UrlBase::isValidPort(const std::string &port) const - { - try - { - str::regex regx(RX_VALID_PORT); - if( str::regex_match(port, regx)) - { - long pnum = str::strtonum(port); - return ( pnum >= 1 && pnum <= USHRT_MAX); - } - } - catch( ... ) - {} - return false; - } - - - ////////////////////////////////////////////////////////////////// - } // namespace url - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/url/UrlBase.h b/libzypp/zypp/url/UrlBase.h deleted file mode 100644 index e22486b..0000000 --- a/libzypp/zypp/url/UrlBase.h +++ /dev/null @@ -1,1098 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/url/UrlBase.h - */ -#ifndef ZYPP_URL_URLBASE_H -#define ZYPP_URL_URLBASE_H - -#include "zypp/url/UrlUtils.h" -#include "zypp/base/PtrTypes.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace url - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - /** - * Url::asString() view options. - * - * A instance of this class represents a bit-wise combination - * of view option constants. - * - * It provides ViewOption::operator+() and ViewOption::operator-() - * to modify a view option combination and a ViewOption::has() - * method, to check if a specified option is enabled or not. - */ - struct ViewOption - { - /** @{ */ - /** - * Option to include scheme name in the URL string. - * - * Disabling this option causes, that the URL string - * contains the path, query and fragment components - * only, for example just "/foo/bar.txt". - * - * This option is \b enabled by default. - */ - static const ViewOption WITH_SCHEME; - /** - * Option to include username in the URL string. - * - * This option depends on a enabled WITH_SCHEME and - * WITH_HOST options and is \b enabled by default. - */ - static const ViewOption WITH_USERNAME; - /** - * Option to include password in the URL string. - * - * This option depends on a enabled WITH_SCHEME, - * WITH_HOST and WITH_USERNAME options and is - * \b disabled by default, causing to hide the - * password in the URL authority. - */ - static const ViewOption WITH_PASSWORD; - /** - * Option to include hostname in the URL string. - * - * This option depends on a enabled WITH_SCHEME - * option and is \b enabled by default. - */ - static const ViewOption WITH_HOST; - /** - * Option to include port number in the URL string. - * - * This option depends on a enabled WITH_SCHEME and - * WITH_HOST options and is \b enabled by default. - */ - static const ViewOption WITH_PORT; - /** - * Option to include path name in the URL string. - * - * This option is \b enabled by default. - */ - static const ViewOption WITH_PATH_NAME; - /** - * Option to include path parameters in the URL string. - * - * This option depends on a enabled WITH_PATH_NAME - * option and is \b disabled by default, causing to - * hide the path parameters. - */ - static const ViewOption WITH_PATH_PARAMS; - /** - * Option to include query string in the URL string. - * - * This option is \b enabled by default. - */ - static const ViewOption WITH_QUERY_STR; - /** - * Option to include fragment string in the URL string. - * - * This option is \b enabled by default. - */ - static const ViewOption WITH_FRAGMENT; - /** @} */ - - /** @{ */ - /** - * Explicitely include the URL authority separator "//". - * - * It causes, that the URL string includes an empty URL - * authority, for example: - * "file:///foo.txt" instead of just "file:/foo.txt". - * - * This option depends on a enabled WITH_SCHEME view - * option and is enabled by default. - */ - static const ViewOption EMPTY_AUTHORITY; - /** - * Explicitely include the "/" path character. - * - * It causes, that a "/" is added to the Url if the path - * name is empty, for example: - * - * "http://localhost/" instead of just "http://localhost". - * - * This option depends on a enabled WITH_PATH_NAME view - * option and is enabled by default. - */ - static const ViewOption EMPTY_PATH_NAME; - /** - * Explicitely include the path parameters separator ";". - * - * It causes, that the URL allways contains the ";" path - * parameters separator. - * - * This option depends on a enabled EMPTY_PATH_NAME view - * option and is disabled by default. - */ - static const ViewOption EMPTY_PATH_PARAMS; - /** - * Explicitely include the query string separator "?". - * - * It causes, that if the query string is requested using - * the WITH_QUERY_STR option, the URL allways contains the - * "?" query string separator, even if the query string is - * empty. - * This option depends on a enabled WITH_QUERY_STR view - * option and is disabled by default. - */ - static const ViewOption EMPTY_QUERY_STR; - /** - * Explicitely include the fragment string separator "#". - * - * It causes, that if the fragment string is requested using - * the WITH_FRAGMENT option, the URL allways contains the "#" - * fragment string separator, even if the fragment string is - * empty. - * This option depends on a enabled WITH_FRAGMENT view - * option and is disabled by default. - */ - static const ViewOption EMPTY_FRAGMENT; - /** @} */ - - /** @{ */ - /** - * Default combination of view options. - * - * By default, following view options are enabled: - * WITH_SCHEME, WITH_USERNAME, WITH_HOST, - * WITH_PORT, WITH_PATH_NAME, WITH_QUERY_STR, - * WITH_FRAGMENT, EMPTY_AUTHORITY, EMPTY_PATH_NAME. - */ - static const ViewOption DEFAULTS; - /** @} */ - - - /** - * Create instance with default combination of view options. - */ - ViewOption(); - - - /** - * Adds \p l and \p r to a new option combination. - * - * @return The new option combination. - */ - friend inline ViewOption - operator + (const ViewOption &l, const ViewOption &r) - { - return ViewOption(l.opt | r.opt); - } - - /** - * Substract \p r from \p l to a new option combination. - * - * @return The new option combination. - */ - friend inline ViewOption - operator - (const ViewOption &l, const ViewOption &r) - { - return ViewOption(l.opt & ~r.opt); - } - - /** - * Assign specified option combination \p o to the current object. - * - * \param o The option or option combination to make a copy of. - * \return A reference to this option combination. - */ - inline ViewOption & - operator = (const ViewOption &o) - { - opt = o.opt; return *this; - } - - /** - * Check if specified option \p o is set in the current object. - * \param o A view option constant. - * \return True, if specified option \p o is - * set/enabled in the instance. - */ - inline bool - has(const ViewOption &o) const - { - return o.opt & opt; - } - - private: - ViewOption(int option); - int opt; - }; - - - // --------------------------------------------------------------- - /** - * ViewOptions is just an alias for ViewOption. - */ - typedef ViewOption ViewOptions; - - - // --------------------------------------------------------------- - /** - * Vector of URL scheme names. - */ - typedef std::vector UrlSchemes; - - - // --------------------------------------------------------------- - /** - * Forward declaration of internal UrlBase data. - */ - class UrlBaseData; - - - // --------------------------------------------------------------- - /** - * \brief Generic Url base class. - * - * The UrlBase class implements default behaviour for URL - * manipulations and a base for implementation of scheme- - * specialized URL's for the Url class. - * - */ - class UrlBase - { - public: - - virtual - ~UrlBase(); - - UrlBase(); - - /** - * Create a new Url object as copy of the given one. - * \param url The Url object to make a copy of. - */ - UrlBase(const UrlBase &url); - - /** - * \brief Construct new object and initializes it with - * specified URL components. - * - * \param scheme The scheme name. - * \param authority The encoded authority component data. - * \param pathdata The encoded path component data. - * \param querystr The encoded query string component. - * \param fragment The encoded fragment string component. - * \throws UrlNotAllowedException if one of the components - * is not allowed for the scheme. - * \throws UrlBadComponentException if one of the components - * contains an invalid character. - */ - UrlBase(const std::string &scheme, - const std::string &authority, - const std::string &pathdata, - const std::string &querystr, - const std::string &fragment); - - - // ----------------- - /** - * \brief Clears all data in the object. - */ - virtual void - clear(); - - /** - * Returns pointer to a copy of the current object. - * - * Should be reimplemented by all derived object using - * the copy constructor of the derived class, e.g.: - * \code - * return new MyUrlDerivedFromUrlBase(*this); - * \endcode - * - * \return A pointer to a copy of the current object. - */ - virtual UrlBase * - clone() const; - - /** - * \brief Initializes current object with new URL components. - * - * \param scheme The scheme name. - * \param authority The encoded authority component data. - * \param pathdata The encoded path component data. - * \param querystr The encoded query string component. - * \param fragment The encoded fragment string component. - * \throws UrlNotAllowedException if one of the components - * is not allowed in the scheme. - * \throws UrlBadComponentException if one of the components - * contains an invalid character. - */ - virtual void - init(const std::string &scheme, - const std::string &authority, - const std::string &pathdata, - const std::string &querystr, - const std::string &fragment); - - - // ----------------- - /** - * \brief Returns scheme names known by this object. - * - * This method is used in the isValidScheme() method and - * is intended to be reimplemented by derived classes to - * return the scheme names it implements (is restricted - * or compatible to). - * - * For example, if your derived class implements special - * features of LDAP URL's, this method may return "ldap" - * and "ldaps" scheme names. - * - * The UrlBase class returns an empty vector, that signals - * that it is useable with all URL's. - * - * \return A vector with scheme names known by this object. - */ - virtual UrlSchemes - getKnownSchemes() const; - - /** - * \brief Returns if scheme name is known to this object. - * \return True, if scheme name is known to this object. - */ - virtual bool - isKnownScheme(const std::string &scheme) const; - - - /** - * \brief Verifies specified scheme name. - * - * Verifies the generic syntax of the specified \p scheme name - * and if it is contained in the current object's list of known - * schemes (see getKnownSchemes()) if the list is not empty (as - * in the UrlBase class). - * - * \param scheme The scheme name to verify. - * \return True, if generic scheme name syntax is valid and - * the scheme name is known to the current object. - */ - virtual bool - isValidScheme(const std::string &scheme) const; - - /** - * \brief Verifies the Url. - * - * Verifies if the current object contains a non-empty scheme - * name. Additional semantical URL checks may be performed by - * derived UrlBase-objects. - * - * \return True, if the Url seems to be valid. - */ - virtual bool - isValid() const; - - - // ----------------- - /** - * Returns a default string representation of the Url object. - * - * By default, a password in the URL will be hidden. - * - * \return A default string representation of the Url object. - */ - virtual std::string - asString() const; - - /** - * Returns a string representation of the Url object. - * - * To include a password in the resulting Url string, use: - * \code - * url.asString(url.getViewOptions() + - * url::ViewOptions::WITH_PASSWORD); - * \endcode - * - * \param opts A combination of view options. - * \return A string representation of the Url object. - */ - virtual std::string - asString(const zypp::url::ViewOptions &opts) const; - - - // ----------------- - /** - * Returns the scheme name of the URL. - * \return Scheme name of the current Url object. - */ - virtual std::string - getScheme() const; - - - // ----------------- - /** - * Returns the encoded authority component of the URL. - * - * The returned authority string does not contain the leading - * "//" separator characters, but just its "user:pass@host:port" - * content only. - * - * \return The encoded authority component string. - */ - virtual std::string - getAuthority() const; - - /** - * Returns the username from the URL authority. - * \param eflag Flag if the usename should be percent-decoded or not. - * \return The username sub-component from the URL authority. - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getUsername(EEncoding eflag) const; - - /** - * Returns the password from the URL authority. - * \param eflag Flag if the password should be percent-decoded or not. - * \return The password sub-component from the URL authority. - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getPassword(EEncoding eflag) const; - - /** - * Returns the hostname or IP from the URL authority. - * - * In case the Url contains an IPv6 number, it is be surrounded - * by "[" and "]" characters, for example "[::1]" for an IPv6 - * localhost address. - * - * \param eflag Flag if the host should be percent-decoded or not. - * \return The host sub-component from the URL authority. - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getHost(EEncoding eflag) const; - - /** - * Returns the port number from the URL authority. - * \return The port sub-component from the URL authority. - */ - virtual std::string - getPort() const; - - - // ----------------- - /** - * Returns the encoded path component of the URL. - * - * The path data contains the path name, optionally - * followed by path parameters separated with a ";" - * character, for example "/foo/bar;version=1.1". - * - * \return The encoded path component of the URL. - */ - virtual std::string - getPathData() const; - - /** - * Returns the path name from the URL. - * \param eflag Flag if the path should be decoded or not. - * \return The path name sub-component without path parameters - * from path data component of the URL. - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getPathName(EEncoding eflag) const; - - /** - * Returns the encoded path parameters from the URL. - * \return The encoded path parameters from the URL. - */ - virtual std::string - getPathParams() const; - - /** - * Returns a vector with encoded path parameter substrings. - * - * The default path parameter separator is the \c ',' character. - * A schema specific object may overide the default separators. - * - * For example, the path parameters string "foo=1,bar=2" is splited - * by default into a vector containing the substrings "foo=1" and - * "bar=2". - * - * \return The encoded path parameters vector. - */ - virtual zypp::url::ParamVec - getPathParamsVec() const; - - /** - * Returns a string map with path parameter keys and values. - * - * The default path parameter separator is the \c ',' character, - * the default key/value separator for the path parameters is - * the \c '=' character. - * A schema specific object may overide the default separators. - * - * For example, the path parameters string "foo=1,bar=2" is splited - * into a map containing "foo" = "1" and "bar" = "2" by default. - * - * \param eflag Flag if the path parameter keys and values should - * be decoded or not. - * \return The path parameters key and values as a string map. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual zypp::url::ParamMap - getPathParamsMap(EEncoding eflag) const; - - /** - * Return the value for the specified path parameter. - * - * For example, if the path parameters string is "foo=1,bar=2" - * the method will return the substring "1" for the param key - * "foo" and "2" for the param key "bar". - * - * \param param The path parameter key. - * \param eflag Flag if the path parameter keys and values should - * be decoded or not. - * \return The value for the path parameter key or empty string. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getPathParam(const std::string ¶m, EEncoding eflag) const; - - - // ----------------- - /** - * Returns the encoded query string component of the URL. - * - * The query string is returned without first "?" (separator) - * character. Further "?" characters as in e.g. LDAP URL's - * remains in the returned string. - * - * \return The encoded query string component of the URL. - */ - virtual std::string - getQueryString() const; - - /** - * Returns a vector with query string parameter substrings. - * - * The default query string parameter separator is the \c '&' - * character. - * A schema specific object may overide the default separators. - * - * For example, the query string "foo=1&bar=2" is splited by - * default into a vector containing the substrings "foo=1" and - * "bar=2". - * - * \return The query string splited into a vector of substrings. - */ - virtual zypp::url::ParamVec - getQueryStringVec() const; - - /** - * Returns a string map with query parameter and their values. - * - * The default query string parameter separator is the \c ',' - * character, the default key/value separator the \c '=' character. - * A schema specific object may overide the default separators. - * - * For example, the query string "foo=1&bar=2" is splited by - * default into a map containing "foo" = "1" and "bar" = "2". - * - * \param eflag Flag if the query string keys and values should - * be decoded or not. - * \return The query string as a key/value string map. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual zypp::url::ParamMap - getQueryStringMap(EEncoding eflag) const; - - /** - * Return the value for the specified query parameter. - * - * For example, if the query string is "foo=1,bar=2" the method - * will return the substring "1" for the param key "foo" and - * "2" for the param key "bar". - * - * \param param The query parameter key. - * \param eflag Flag if the query parameter keys and values should - * be decoded or not. - * \return The value for the query parameter key or empty string. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getQueryParam(const std::string ¶m, EEncoding eflag) const; - - - // ----------------- - /** - * Returns the encoded fragment component of the URL. - * \param eflag Flag if the fragment should be percent-decoded or not. - * \return The encoded fragment component of the URL. - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual std::string - getFragment(EEncoding eflag) const; - - - // ----------------- - /** - * \brief Set the scheme name in the URL. - * \param scheme The new scheme name. - * \throws UrlBadComponentException if the \p scheme - * contains an invalid character or is empty. - */ - virtual void - setScheme(const std::string &scheme); - - - // ----------------- - /** - * \brief Set the authority component in the URL. - * - * The \p authority string shoud not contain any leading - * "//" separator characters (just "user:pass@host:port"). - * - * \param authority The authority component string. - * \throws UrlNotAllowedException if the \p authority - * has to be empty in for the current scheme. - * \throws UrlBadComponentException if the \p authority - * contains an invalid character. - * \throws UrlParsingException if \p authority parsing fails. - */ - virtual void - setAuthority(const std::string &authority); - - /** - * \brief Set the username in the URL authority. - * \param user The new username. - * \param eflag If the \p username is encoded or not. - * \throws UrlNotAllowedException if the \p user - * has to be empty in for the current scheme. - * \throws UrlBadComponentException if the \p user - * contains an invalid character. - */ - virtual void - setUsername(const std::string &user, - EEncoding eflag); - - /** - * \brief Set the password in the URL authority. - * \param pass The new password. - * \param eflag If the \p password is encoded or not. - * \throws UrlNotAllowedException if the \p pass - * has to be empty in for the current scheme. - * \throws UrlBadComponentException if the \p pass - * contains an invalid character. - */ - virtual void - setPassword(const std::string &pass, - EEncoding eflag); - - /** - * \brief Set the hostname or IP in the URL authority. - * - * The \p host parameter may contain a hostname, an IPv4 address - * in dotted-decimal form or an IPv6 address literal encapsulated - * within square brackets (RFC3513, Sect. 2.2). - * - * A hostname may contain national alphanumeric UTF8 characters - * (letters other than ASCII a-zA-Z), that will be encoded. - * This function allows to specify both, a encoded or decoded - * hostname. - * - * Other IP literals in "[v ... ]" square bracket format are not - * supported by the implementation in UrlBase class. - * - * \param host The new hostname or IP address. - * \throws UrlNotAllowedException if the \p host - * has to be empty in for the current scheme. - * \throws UrlBadComponentException if the \p host is invalid. - */ - virtual void - setHost(const std::string &host); - - /** - * \brief Set the port number in the URL authority. - * \param port The new port number. - * \throws UrlNotAllowedException if the \p port - * has to be empty in for the current scheme. - * \throws UrlBadComponentException if the \p port is invalid. - */ - virtual void - setPort(const std::string &port); - - - // ----------------- - /** - * \brief Set the path data component in the URL. - * - * By default, the \p pathdata string may include path - * parameters separated by the ";" separator character. - * - * \param pathdata The encoded path data component string. - * \throws UrlBadComponentException if the \p pathdata - * contains an invalid character. - */ - virtual void - setPathData(const std::string &pathdata); - - /** - * \brief Set the path name. - * \param path The new path name. - * \param eflag If the \p path name is encoded or not. - * \throws UrlBadComponentException if the \p path name - * contains an invalid character. - */ - virtual void - setPathName(const std::string &path, - EEncoding eflag); - - /** - * \brief Set the path parameters. - * \param params The new encoded path parameter string. - * \throws UrlBadComponentException if the path \p params - * contains an invalid character. - */ - virtual void - setPathParams(const std::string ¶ms); - - /** - * \brief Set the path parameters. - * \param pvec The vector with encoded path parameters. - * \throws UrlBadComponentException if the \p pvec - * contains an invalid character. - */ - virtual void - setPathParamsVec(const zypp::url::ParamVec &pvec); - - /** - * \brief Set the path parameters. - * \param pmap The map with decoded path parameters. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - */ - virtual void - setPathParamsMap(const zypp::url::ParamMap &pmap); - - /** - * \brief Set or add value for the specified path parameter. - * \param param The decoded path parameter name. - * \param value The decoded path parameter value. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual void - setPathParam(const std::string ¶m, const std::string &value); - - - // ----------------- - /** - * \brief Set the query string in the URL. - * - * The \p querystr string parameter is supposed - * to not to contain the "?" URL query separator - * character (use just a "foo=bar&x=22" instead - * of "?foo=bar&x=22"). - * - * \param querystr The new encoded query string. - * \throws UrlBadComponentException if the \p querystr - * contains an invalid character. - */ - virtual void - setQueryString(const std::string &querystr); - - /** - * \brief Set the query parameters. - * \param qvec The vector with encoded query parameters. - * \throws UrlBadComponentException if the \p qvec - * contains an invalid character. - */ - virtual void - setQueryStringVec(const zypp::url::ParamVec &qvec); - - /** - * \brief Set the query parameters. - * \param qmap The map with decoded query parameters. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - */ - virtual void - setQueryStringMap(const zypp::url::ParamMap &qmap); - - /** - * \brief Set or add value for the specified query parameter. - * \param param The decoded query parameter name. - * \param value The decoded query parameter value. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual void - setQueryParam(const std::string ¶m, const std::string &value); - - /** - * \brief remove the specified query parameter. - * \param param The decoded query parameter name. - * \throws UrlNotSupportedException if parameter parsing - * is not supported for a URL (scheme). - * \throws UrlDecodingException if the decoded result string - * would contain a '\\0' character. - */ - virtual void - delQueryParam(const std::string ¶m); - - - // ----------------- - /** - * \brief Set the fragment string in the URL. - * \param fragment The new fragment string. - * \param eflag If the \p fragment is encoded or not. - * \throws UrlBadComponentException if the \p querystr - * contains an invalid character. - */ - virtual void - setFragment(const std::string &fragment, - EEncoding eflag); - - - // ----------------- - /** - * Configures behaviour of the instance. - * - * This method is called in UrlBase constructors before - * any URL components are applied. - * Derived classes may reimplement this method to change - * the behaviour of the object. - * Use the config() methods to query and change them. - * - * The UrlBase class uses following config variables: - * - * - Common path parameter separators: - * - \a \c sep_pathparams \c ";" - * Separator used to split path parameters from path name. - * Setting it to empty string disables splitting of path - * name and path parameters. Set also rx_pathparams to an - * empty string. - * - \a \c psep_pathparam \c "," - * Separator between path parameters. - * - \a \c vsep_pathparam \c "=" - * Separator between key and value of a path parameter. - * . - * . - * - * - Common query string separators: - * - \a \c psep_querystr \c "&" - * Separator between query string parameters. - * - \a \c vsep_querystr \c "=" - * Separator between key and value of a query parameter. - * . - * . - * - * - Characters in URL components, that are safe without - * URL percent-encoding (see zypp::url::encode()). - * - \a safe_username - * - \a safe_password - * - \a safe_hostname - * - \a safe_pathname - * - \a safe_pathparams - * - \a safe_querystr - * - \a safe_fragment - * . - * . - * - * - Regular expressions used to verify encoded URL - * components and their sub-components: - * - \a rx_username - * - \a rx_password - * - \a rx_pathname - * - \a rx_pathparams - * - \a rx_querystr - * - \a rx_fragment - * . - * . - */ - virtual void - configure(); - - - /** - * Get the value of a UrlBase configuration variable. - * - * See configure() method for names an purpose of the - * configuration variables used in UrlBase class. - * - * \param opt The name of the configuration variable. - * \return The value of the specified variable - * or empty string. - */ - std::string - config(const std::string &opt) const; - - /** - * Set the value of a UrlBase configuration variable. - * - * See configure() method for names an purpose of the - * configuration variables used in UrlBase class. - * - * \param opt The name of the configuration variable. - * \param val The new value for the configuration variable. - */ - void - config(const std::string &opt, const std::string &val); - - - /** - * Return the view options of the current object. - * - * This method is used to query the view options - * used by the asString() method. - * - * \return The current view option combination. - */ - ViewOptions - getViewOptions() const; - - /** - * Change the view options of the current object. - * - * This method is used to change the view options - * used by the asString() method. - * - * \param vopts New view options combination. - */ - void - setViewOptions(const ViewOptions &vopts); - - - protected: - /** - * Utility method to cleanup an encoded path name. - * - * By default, this method makes sure, that the first slash - * in the path is not encoded, and that the second slash - * before the first path segment, is encoded (to "%2F"). - * It modifies the path in the url, for example: - * "ftp://host//aaa//bbb" to "ftp://host/%2Faaa//bbb" - * or as encoded path only also "%2f/name" to "/%2fname". - * - * This operation is required to fulfill the path-absolute - * rule of RFC3986, if there is no authority. It avoids the - * missinterpretation of the path as an authority separator. - * - * It is not required if there is an authority ("//" behind - * the "scheme:"), that is in the path-abempty rule, but it - * is used e.g. in ftp url's defined by RFC1738. - * - * We apply this operation in both cases (for all paths), - * but if \p authority is true, the encoding of the second - * slash depends on the schema configuration (for ftp only). - * - * \param path The encoded path name to cleanup. - * \param authority Whether the url contains authority or not. - * \return A modified encoded path. - */ - virtual std::string - cleanupPathName(const std::string &path, bool authority) const; - - /** - * Utility method to cleanup an encoded path name. - * - * This variant of the method checks if the host component - * in the url is empty or not to differentiate if there is - * an authority. - * - * \param path The encoded path name to cleanup. - * \return A modified encoded path. - */ - virtual std::string - cleanupPathName(const std::string &path) const; - - /** - * \brief Verifies specified host or IP. - * - * It verifies, if the specified \p host parameter contains - * a hostname, an IPv4 address in dotted-decimal form or an - * IPv6 address literal encapsulated within square brackets - * (RFC3513, Sect. 2.2). - * - * A hostname in the \p host parameter, may contain national - * alphanumeric UTF8 characters (letters other than ASCII - * a-zA-Z) and allows to specify both, a encoded or decoded - * hostname. - * - * This function does not perform any hostname lookups and - * supports only IPv6 addresses in "[ ... ]" notation. The - * "[v ... ]" square bracket format is not supported by - * this implementation. - * - * \param host The host name or IP to verify. - * \return True, if host seems to be valid. - */ - virtual bool - isValidHost(const std::string &host) const; - - /** - * \brief Verifies specified port number. - * - * \param port The port number to verify. - * \return True, if port number is valid. - */ - virtual bool - isValidPort(const std::string &port) const; - - private: - UrlBaseData *m_data; - }; - - - // --------------------------------------------------------------- - /** - * \brief Copy-On-Write Url reference. - */ - typedef RWCOW_pointer UrlRef; - - - ////////////////////////////////////////////////////////////////// - } // namespace url - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif /* ZYPP_URL_URLBASE_H */ -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/url/UrlException.h b/libzypp/zypp/url/UrlException.h deleted file mode 100644 index f29de69..0000000 --- a/libzypp/zypp/url/UrlException.h +++ /dev/null @@ -1,150 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/url/UrlException.h - */ -#ifndef ZYPP_URL_URLEXCEPTION_H -#define ZYPP_URL_URLEXCEPTION_H - -#include "zypp/base/Exception.h" - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace url - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - /** - * Base class for all URL exceptions. - */ - class UrlException: public zypp::Exception - { - public: - UrlException() - : zypp::Exception("Url exception") - {} - - UrlException(const std::string &msg) - : zypp::Exception(msg) - {} - - virtual ~UrlException() throw() {}; - }; - - // --------------------------------------------------------------- - /** - * Thrown if the encoded string contains a NUL byte (%00). - */ - class UrlDecodingException: public UrlException - { - public: - UrlDecodingException() - : UrlException("Url NUL decoding exception") - {} - - UrlDecodingException(const std::string &msg) - : UrlException(msg) - {} - - virtual ~UrlDecodingException() throw() {}; - }; - - // --------------------------------------------------------------- - /** - * Thrown if the url or a component can't be parsed at all. - */ - class UrlParsingException: public UrlException - { - public: - UrlParsingException() - : UrlException("Url parsing failure exception") - {} - - UrlParsingException(const std::string &msg) - : UrlException(msg) - {} - - virtual ~UrlParsingException() throw() {}; - }; - - // --------------------------------------------------------------- - /** - * Thrown if a url component is invalid. - */ - class UrlBadComponentException: public UrlException - { - public: - UrlBadComponentException() - : UrlException("Url bad component exception") - {} - - UrlBadComponentException(const std::string &msg) - : UrlException(msg) - {} - - virtual ~UrlBadComponentException() throw() {}; - }; - - - // --------------------------------------------------------------- - /** - * Thrown if scheme does not allow a component. - */ - class UrlNotAllowedException: public UrlException - { - public: - UrlNotAllowedException() - : UrlException("Url not allowed component exception") - {} - - UrlNotAllowedException(const std::string &msg) - : UrlException(msg) - {} - - virtual ~UrlNotAllowedException() throw() {}; - }; - - - // --------------------------------------------------------------- - /** - * Thrown if a feature e.g. parsing of a component - * is not supported for the url/scheme. - */ - class UrlNotSupportedException: public UrlException - { - public: - UrlNotSupportedException() - : UrlException("Url parsing unsupported exception") - {} - - UrlNotSupportedException(const std::string &msg) - : UrlException(msg) - {} - - virtual ~UrlNotSupportedException() throw() {}; - }; - - - ////////////////////////////////////////////////////////////////// - } // namespace url - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif /* ZYPP_URL_URLEXCEPTION_H */ -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/url/UrlUtils.cc b/libzypp/zypp/url/UrlUtils.cc deleted file mode 100644 index 76822f1..0000000 --- a/libzypp/zypp/url/UrlUtils.cc +++ /dev/null @@ -1,326 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/url/UrlUtils.cc - */ -#include "zypp/base/Gettext.h" -#include "zypp/base/String.h" -#include "zypp/url/UrlUtils.h" - -#include // strtol -#include // isxdigit -#include - - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - namespace url - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - std::string - encode(const std::string &str, const std::string &safe, - EEncoding eflag) - { - std::string skip("ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789.~_-"); - std::string more(":/?#[]@!$&'()*+,;="); - size_t beg, pos, len; - std::string out; - - for(size_t i=0; i beg) - { - out.append(str, beg, pos - beg); - } - - if( eflag == E_ENCODED && - pos + 2 < len && - str.at(pos) == '%' && - std::isxdigit(str.at(pos + 1)) && - std::isxdigit(str.at(pos + 2))) - { - out.append(str, pos, 3); - beg = pos + 3; - } - else - { - out.append( encode_octet( str.at(pos))); - beg = pos + 1; - } - } - else - { - out.append(str, beg, len - beg); - beg = len; - } - } - return out; - } - - - // --------------------------------------------------------------- - std::string - decode(const std::string &str, bool allowNUL) - { - size_t pos, end, len; - std::string out(str); - - len = out.length(); - pos = end = 0; - while(pos < len) - { - out[end] = out[pos]; - if( pos + 2 < len && out.at(pos) == '%') - { - int c = decode_octet(out.c_str() + pos + 1); - switch(c) - { - case -1: - // not a hex noted octet... - break; - - case 0: - // is a %00 octet allowed ? - if( !allowNUL) - { - ZYPP_THROW(UrlDecodingException( - _("Encoded string contains a NUL byte") - )); - } - default: - // other octets are fine... - out[end] = c; - pos += 2; - break; - } - } - pos++; - end++; - } - if( end < pos) - out.erase(end); - return out; - } - - - // --------------------------------------------------------------- - std::string - encode_octet(const unsigned char c) - { - static const unsigned char tab[] = "0123456789ABCDEF"; - unsigned char out[4]; - - out[0] = '%'; - out[1] = tab[0x0f & (c >> 4)]; - out[2] = tab[0x0f & c]; - out[3] = '\0'; - - //snprintf(out, sizeof(out), "%%%02X", c); - return std::string((char *)out); - } - - - // --------------------------------------------------------------- - int - decode_octet(const char *hex) - { - if(hex && std::isxdigit(hex[0]) && std::isxdigit(hex[1])) - { - char x[3] = { hex[0], hex[1], '\0'}; - return 0xff & ::strtol(x, NULL, 16); - } - else - { - return -1; - } - } - - - // --------------------------------------------------------------- - void - split(ParamVec &pvec, - const std::string &pstr, - const std::string &psep) - { - size_t beg, pos, len; - if( psep.empty()) - { - ZYPP_THROW(UrlNotSupportedException( - _("Invalid parameter array split separator character") - )); - } - - len = pstr.length(); - beg = 0; - - while( beg < len) - { - pos = pstr.find(psep, beg); - if(pos != std::string::npos) - { - pvec.push_back( pstr.substr(beg, pos - beg)); - beg = pos + 1; - } - else - { - pvec.push_back( pstr.substr(beg, len - beg)); - beg = len; - } - } - } - - - // --------------------------------------------------------------- - void - split(ParamMap &pmap, - const std::string &str, - const std::string &psep, - const std::string &vsep, - EEncoding eflag) - { - ParamVec pvec; - ParamVec::const_iterator pitr; - std::string k, v; - size_t pos; - - if( psep.empty() || vsep.empty()) - { - ZYPP_THROW(UrlNotSupportedException( - _("Invalid parameter map split separator character") - )); - } - - split(pvec, str, psep); - - for( pitr = pvec.begin(); pitr != pvec.end(); ++pitr) - { - pos = pitr->find(vsep); - if(pos != std::string::npos) - { - if( eflag == E_DECODED) - { - k = url::decode(pitr->substr(0, pos)); - v = url::decode(pitr->substr(pos + 1)); - pmap[ k ] = v; - } - else - { - k = pitr->substr(0, pos); - v = pitr->substr(pos + 1); - pmap[ k ] = v; - } - } - else - { - if( eflag == E_DECODED) - { - pmap[ url::decode(*pitr) ] = ""; - } - else - { - pmap[ *pitr ] = ""; - } - } - } - } - - - // --------------------------------------------------------------- - std::string - join(const ParamVec &pvec, - const std::string &psep) - { - std::string str; - ParamVec::const_iterator i( pvec.begin()); - - if( i != pvec.end()) - { - str = *i; - while( ++i != pvec.end()) - { - str += psep + *i; - } - } - - return str; - } - - - // --------------------------------------------------------------- - std::string - join(const ParamMap &pmap, - const std::string &psep, - const std::string &vsep, - const std::string &safe) - { - if( psep.empty() || vsep.empty()) - { - ZYPP_THROW(UrlNotSupportedException( - _("Invalid parameter array join separator character") - )); - } - - std::string join_safe; - for(std::string::size_type i=0; ifirst, join_safe); - if( !i->second.empty()) - str += vsep + encode(i->second, join_safe); - - while( ++i != pmap.end()) - { - str += psep + encode(i->first, join_safe); - if( !i->second.empty()) - str += vsep + encode(i->second, join_safe); - } - } - - return str; - } - - - ////////////////////////////////////////////////////////////////// - } // namespace url - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/url/UrlUtils.h b/libzypp/zypp/url/UrlUtils.h deleted file mode 100644 index 5189a57..0000000 --- a/libzypp/zypp/url/UrlUtils.h +++ /dev/null @@ -1,261 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** - * \file zypp/url/UrlUtils.h - */ -#ifndef ZYPP_URL_URLUTILS_H -#define ZYPP_URL_URLUTILS_H - -#include "zypp/url/UrlException.h" - -#include -#include -#include - -/** Characters that are safe for URL without percent-encoding. */ -#define URL_SAFE_CHARS ":/?#[]@!$&'()*+,;=" - -////////////////////////////////////////////////////////////////////// -namespace zypp -{ //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// - /** Url details namespace. */ - namespace url - { ////////////////////////////////////////////////////////////////// - - - // --------------------------------------------------------------- - /** A parameter vector container. - * A string vector containing splited PathParam- or Query-String. - * Each string in the vector is allways URL percent encoded and - * usually contains a "key=value" pair. - */ - typedef std::vector < std::string > ParamVec; - - - /** A parameter map container. - * A map containing key and value pairs parsed from a PathParam- - * or Query-String. - */ - typedef std::map < std::string, std::string > ParamMap; - - - /** Encoding flags. - */ - typedef enum { - E_ENCODED, //!< Flag to request encoded string(s). - E_DECODED //!< Flag to request decoded string(s). - } EEncoding; - - - // --------------------------------------------------------------- - /** Encodes a string using URL percent encoding. - * - * By default, all characters except of "a-zA-Z0-9_.-" will be encoded. - * Additional characters from the set ":/?#[]@!$&'()*+,;=", that are - * safe for a URL compoent without encoding, can be specified in the - * \p safe argument. - * - * If the \p eflag parameter is set to E_ENCODED, then already encoded - * substrings will be detected and not encoded a second time. - * - * The following function call will encode the "@" character as "%40", - * but skip encoding of the "%" character, because the \p eflag is set - * to E_ENCODED and "%ba" is detected as a valid encoded character. - * \code - * zypp::url::encode("foo%bar@localhost", "", E_ENCODED); - * \endcode - * With \p eflag set to E_DECODED, the "%" character would be encoded - * as well. The complete encoded string would be "foo%25bar%40localhost". - * - * \param str A string to encode (binary data). - * \param safe Characters safe to skip in encoding, - * e.g. "/" for path names. - * \param eflag If to detect and skip already encoded substrings. - * \return A percent encoded string. - */ - std::string - encode(const std::string &str, const std::string &safe = "", - EEncoding eflag = E_DECODED); - - - // --------------------------------------------------------------- - /** Decodes a URL percent encoded string. - * Replaces all occurences of \c "%" in the \p str string - * with the character encoded using the two hexadecimal digits that - * follows the "%" character. - * - * For example, the encoded string "%40%3F%3D%26%25" will be decoded - * to "@?=&%". - * - * \param str A string to decode. - * \param allowNUL A flag, if \c "%00" (encoded \c '\\0') - * is allowed or not. - * \return A decoded strig (may contain binary data). - * \throws UrlDecodingException if \p allowNUL is false and - * a encoded NUL byte (\c "%00") was found in \p str. - */ - std::string - decode(const std::string &str, bool allowNUL = false); - - - // --------------------------------------------------------------- - /** Encode one character. - * - * Encode the specified character \p c into its \c "%" - * representation. - * - * \param c A character to encode. - * \return A percent encoded representation of the character, - * e.g. %20 for a ' ' (space). - */ - std::string - encode_octet(const unsigned char c); - - - // --------------------------------------------------------------- - /** Decode one character. - * - * Decode the \p hex parameter pointing to (at least) two hexadecimal - * digits into its character value and return it. - * - * Example: - * \code - * char *str = "%40"; - * char *pct = strchr(str, '%'); - * int chr = pct ? decode_octet(pct+1) : -1; - * // chr is set to the '@' ASCII character now. - * \endcode - * - * \param hex Pointer to two hex characters representing - * the character value in percent-encoded strings. - * \return The value (0-255) encoded in the \p hex characters or -1 - * if \p hex does not point to two hexadecimal characters. - */ - int - decode_octet(const char *hex); - - - // --------------------------------------------------------------- - /** Split into a parameter vector. - * - * Splits a parameter string \p pstr into substrings using \p psep - * as separator and appends the resulting substrings to \p pvec. - * - * Usual parameter separators are \c '&' for Query- and \c ',' for - * PathParam-Strings. - * - * \param pvec Reference to a result parameter vector. - * \param pstr Reference to the PathParam- or Query-String to split. - * \param psep Parameter separator character to split at. - * \throws UrlNotSupportedException if \p psep separator is empty. - */ - void - split(ParamVec &pvec, - const std::string &pstr, - const std::string &psep); - - - // --------------------------------------------------------------- - /** Split into a parameter map. - * - * Splits a parameter string \p pstr into substrings using \p psep as - * separator and then, each substring into key and value pair using - * \p vsep as separator between parameter key and value and adds them - * to the parameter map \p pmap. - * - * If a parameter substring doesn't contain any value separator \p vsep, - * the substring is used as a parameter key and value is set to an empty - * string. - * - * Usual parameter separators are \c '&' for Query- and \c ',' for - * PathParam-Strings. A usual parameter-value separator is \c '=' for - * both, Query- and PathParam-Strings. - * - * If the encoding flag \p eflag is set to \p E_DECODED, then the key - * and values are dedcoded before they are stored in the map. - * - * \param pmap Reference to a result parameter map. - * \param pstr Reference to the PathParam- or Query-String to split. - * \param psep Separator character to split key-value pairs. - * \param vsep Separator character to split key and value. - * \param eflag Flag if the key and value strings should be URL percent - * decoded before they're stored in the map. - * \throws UrlNotSupportedException if \p psep or \p vsep separator - * is empty. - */ - void - split(ParamMap &pmap, - const std::string &pstr, - const std::string &psep, - const std::string &vsep, - EEncoding eflag = E_ENCODED); - - - // --------------------------------------------------------------- - /** Join parameter vector to a string. - * - * Creates a string containing all substrings from the \p pvec separated - * by \p psep separator character. The substrings in \p pvec should be - * already URL percent encoded and should't contain \p psep characters. - * - * Usual parameter separators are \c '&' for Query- and \c ',' for - * PathParam-Strings. - * - * \param pvec Reference to encoded parameter vector. - * \param psep Parameter separator character to use. - * \return A parameter string. - */ - std::string - join(const ParamVec &pvec, - const std::string &psep); - - - // --------------------------------------------------------------- - /** Join parameter map to a string. - * - * Creates a string containing all parameter key-value pairs from the - * parameter map \p pmap, that will be joined using the \p psep character - * and the parameter key is separated from the parameter value using the - * \p vsep character. Both, key and value will be automatically encoded. - * - * Usual parameter separators are \c '&' for Query- and \c ',' for - * PathParam-Strings. A usual parameter-value separator is \c '=' for - * both, Query- and PathParam-Strings. - * - * See encode() function from details about the \p safe characters. - * - * \param pmap Reference to a parameter map. - * \param psep Separator character to use between key-value pairs. - * \param vsep Separator character to use between keys and values. - * \param safe List of characters to accept without encoding. - * \return A URL percent-encoded parameter string. - * \throws UrlNotSupportedException if \p psep or \p vsep separator - * is empty. - */ - std::string - join(const ParamMap &pmap, - const std::string &psep, - const std::string &vsep, - const std::string &safe); - - - ////////////////////////////////////////////////////////////////// - } // namespace url - //////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////// -} // namespace zypp -////////////////////////////////////////////////////////////////////// - -#endif /* ZYPP_URL_URLUTILS_H */ -/* -** vim: set ts=2 sts=2 sw=2 ai et: -*/ diff --git a/libzypp/zypp/ws/WebpinResult.cc b/libzypp/zypp/ws/WebpinResult.cc deleted file mode 100644 index 07b5277..0000000 --- a/libzypp/zypp/ws/WebpinResult.cc +++ /dev/null @@ -1,166 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/WebpinResult.cc - * -*/ -#include - -#include "zypp/base/Logger.h" -#include "zypp/ws/WebpinResult.h" - -using namespace std; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -namespace ws -{ - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : WebpinResult::Impl - // - /** WebpinResult implementation. */ - struct WebpinResult::Impl - { - Impl() - : priority(0) - {} - - ~Impl() - { - //MIL << std::endl; - } - public: - std::string name; - Edition edition; - CheckSum checksum; - Url repourl; - string summary; - string distro; - int priority; - - private: - friend Impl * rwcowClone( const Impl * rhs ); - /** clone for RWCOW_pointer */ - Impl * clone() const - { return new Impl( *this ); } - }; - - /** \relates WebpinResult::Impl Stream output */ - inline std::ostream & operator<<( std::ostream & str, const WebpinResult::Impl & obj ) - { - return str << "WebpinResult::Impl"; - } - - WebpinResult::WebpinResult() - : _pimpl( new Impl() ) - {} - - WebpinResult::~WebpinResult() - { - //MIL << std::endl; - } - - WebpinResult & WebpinResult::setName( const std::string &name ) - { - _pimpl->name = name; - return *this; - } - - std::string WebpinResult::name() const - { - return _pimpl->name; - } - - - zypp::Url WebpinResult::repositoryUrl() const - { - return _pimpl->repourl; - } - - WebpinResult & WebpinResult::setRepositoryUrl( const zypp::Url &url ) - { - _pimpl->repourl = url; - return *this; - } - - WebpinResult & WebpinResult::setDistribution( const std::string &distro ) - { - _pimpl->distro = distro; - return *this; - } - - std::string WebpinResult::distribution() const - { - return _pimpl->distro; - } - - WebpinResult & WebpinResult::setSummary( const std::string &summary ) - { - _pimpl->summary = summary; - return *this; - } - - std::string WebpinResult::summary() const - { - return _pimpl->summary; - } - - WebpinResult & WebpinResult::setPriority( int priority ) - { - _pimpl->priority = priority; - return *this; - } - - int WebpinResult::priority() const - { - return _pimpl->priority; - } - - - WebpinResult & WebpinResult::setEdition( const Edition &edition ) - { - _pimpl->edition = edition; - return *this; - } - - Edition WebpinResult::edition() const - { - return _pimpl->edition; - } - - WebpinResult & WebpinResult::setChecksum( const CheckSum &checksum ) - { - _pimpl->checksum = checksum; - return *this; - } - - CheckSum WebpinResult::checksum() const - { - return _pimpl->checksum; - } - - - std::ostream & WebpinResult::dumpOn( std::ostream & str ) const - { - str << "- name : " << name() << std::endl; - return str; - } - - std::ostream & operator<<( std::ostream & str, const WebpinResult & obj ) - { - return obj.dumpOn(str); - } - -} // namespace ws - - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/ws/WebpinResult.h b/libzypp/zypp/ws/WebpinResult.h deleted file mode 100644 index 16d309b..0000000 --- a/libzypp/zypp/ws/WebpinResult.h +++ /dev/null @@ -1,147 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/WebpinResult.h - * -*/ -#ifndef ZYPP_WEBPINRESULT_H -#define ZYPP_WEBPINRESULT_H - -#include -#include -#include -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Iterator.h" -#include "zypp/APIConfig.h" - -#include "zypp/CheckSum.h" -#include "zypp/Edition.h" -#include "zypp/Pathname.h" -#include "zypp/Url.h" -#include "zypp/repo/RepoType.h" -#include "zypp/repo/RepoVariables.h" - -namespace zypp -{ -namespace ws -{ - /** - * \short Represents a result from - * http://api.opensuse-community.org/searchservice/Search - * web service - * - */ - class WebpinResult - { - friend std::ostream & operator<<( std::ostream & str, const WebpinResult & obj ); - - public: - WebpinResult(); - ~WebpinResult(); - - /** - * package name - */ - std::string name() const; - - /** - * set the package name \see name - * \param name - */ - WebpinResult & setName( const std::string &name ); - - /** - * package edition - */ - zypp::Edition edition() const; - - /** - * set the package edition \see edition - * \param edition - */ - WebpinResult & setEdition( const zypp::Edition &name ); - - /** - * repository's url - * The url of the repository where this package - * is located - */ - zypp::Url repositoryUrl() const; - - /** - * set the repository url where this package comes from - * \see repositoryUrl - * \param url - */ - WebpinResult & setRepositoryUrl( const zypp::Url &url ); - - /** - * package priority - */ - int priority() const; - - /** - * set the package priority \see priority - * \param priority - */ - WebpinResult & setPriority( int priority ); - - - /** - * package summary - */ - std::string summary() const; - - /** - * set the package summary \see summary - * \param summary - */ - WebpinResult & setSummary( const std::string &summary ); - - /** - * package distribution - * Example: openSUSE 10.3 - */ - std::string distribution() const; - - /** - * set the package distribution \see distribution - * \param distribution - */ - WebpinResult & setDistribution( const std::string &distribution ); - - /** - * package checksum - * Example: a md5sum or sha1sum - */ - zypp::CheckSum checksum() const; - - /** - * set the package checksum \see checksum - * \param checksum - */ - WebpinResult & setChecksum( const zypp::CheckSum &checksum ); - - - std::ostream & dumpOn( std::ostream & str ) const; - - class Impl; - private: - /** Pointer to implementation */ - RWCOW_pointer _pimpl; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates RepoInfo Stream output */ - std::ostream & operator<<( std::ostream & str, const WebpinResult & obj ); - -} // namespace ws -} // namespace zypp - - -#endif // ZYPP_WEBPINRESULT_H diff --git a/libzypp/zypp/zypp_detail/ZYppImpl.cc b/libzypp/zypp/zypp_detail/ZYppImpl.cc deleted file mode 100644 index f0023e7..0000000 --- a/libzypp/zypp/zypp_detail/ZYppImpl.cc +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/zypp_detail/ZYppImpl.cc - * -*/ - -#include -#include "zypp/TmpPath.h" -#include "zypp/base/Logger.h" -#include "zypp/base/String.h" - -#include "zypp/zypp_detail/ZYppImpl.h" -#include "zypp/solver/detail/Helper.h" -#include "zypp/target/TargetImpl.h" -#include "zypp/ZYpp.h" -#include "zypp/DiskUsageCounter.h" -#include "zypp/ZConfig.h" -#include "zypp/sat/Pool.h" -#include "zypp/PoolItem.h" - -#include "zypp/ZYppCallbacks.h" // JobReport::instance - -using std::endl; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - - callback::SendReport & JobReport::instance() - { - static callback::SendReport _report; - return _report; - } - - /////////////////////////////////////////////////////////////////// - namespace zypp_detail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYppImpl::ZYppImpl - // METHOD TYPE : Constructor - // - ZYppImpl::ZYppImpl() - : _target(0) - , _resolver( new Resolver( ResPool::instance()) ) - { - ZConfig::instance().about( MIL ); - MIL << "Initializing keyring..." << std::endl; - _keyring = new KeyRing(tmpPath()); - } - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : ZYppImpl::~ZYppImpl - // METHOD TYPE : Destructor - // - ZYppImpl::~ZYppImpl() - {} - - //------------------------------------------------------------------------ - // add/remove resolvables - - DiskUsageCounter::MountPointSet ZYppImpl::diskUsage() - { - if ( ! _disk_usage ) - { - setPartitions( DiskUsageCounter::detectMountPoints() ); - } - return _disk_usage->disk_usage(pool()); - } - - void ZYppImpl::setPartitions(const DiskUsageCounter::MountPointSet &mp) - { - _disk_usage.reset(new DiskUsageCounter()); - _disk_usage->setMountPoints(mp); - } - - DiskUsageCounter::MountPointSet ZYppImpl::getPartitions() const - { - if (_disk_usage) - return _disk_usage->getMountPoints(); - else - return DiskUsageCounter::detectMountPoints(); - } - - //------------------------------------------------------------------------ - // target - - Target_Ptr ZYppImpl::target() const - { - if (! _target) - ZYPP_THROW(Exception("Target not initialized.")); - return _target; - } - - void ZYppImpl::initializeTarget( const Pathname & root, bool doRebuild_r ) - { - MIL << "initTarget( " << root << (doRebuild_r?", rebuilddb":"") << ")" << endl; - if (_target) { - if (_target->root() == root) { - MIL << "Repeated call to initializeTarget()" << endl; - return; - } - - _target->unload(); - - } - _target = new Target( root, doRebuild_r ); - _target->buildCache(); - } - - void ZYppImpl::finishTarget() - { - if (_target) - _target->unload(); - - _target = 0; - } - - //------------------------------------------------------------------------ - // commit - - /** \todo Remove workflow from target, lot's of it could be done here, - * and target used for transact. */ - ZYppCommitResult ZYppImpl::commit( const ZYppCommitPolicy & policy_r ) - { - setenv( "ZYPP_IS_RUNNING", str::numstring(getpid()).c_str(), 1 ); - - if ( getenv("ZYPP_TESTSUITE_FAKE_ARCH") ) - { - ZYPP_THROW( Exception("ZYPP_TESTSUITE_FAKE_ARCH set. Commit not allowed and disabled.") ); - } - - MIL << "Attempt to commit (" << policy_r << ")" << endl; - if (! _target) - ZYPP_THROW( Exception("Target not initialized.") ); - - ZYppCommitResult res = _target->_pimpl->commit( pool(), policy_r ); - - if (! policy_r.dryRun() ) - { - if ( policy_r.syncPoolAfterCommit() ) - { - // reload new status from target - DBG << "reloading " << sat::Pool::instance().systemRepoAlias() << " repo to pool" << endl; - _target->load(); - } - else - { - DBG << "unloading " << sat::Pool::instance().systemRepoAlias() << " repo from pool" << endl; - _target->unload(); - } - } - - MIL << "Commit (" << policy_r << ") returned: " - << res << endl; - return res; - } - - void ZYppImpl::installSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - { - if (! _target) - ZYPP_THROW( Exception("Target not initialized.") ); - _target->_pimpl->installSrcPackage( srcPackage_r ); - } - - ManagedFile ZYppImpl::provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ) - { - if (! _target) - ZYPP_THROW( Exception("Target not initialized.") ); - return _target->_pimpl->provideSrcPackage( srcPackage_r ); - } - - //------------------------------------------------------------------------ - // target store path - - Pathname ZYppImpl::homePath() const - { return _home_path.empty() ? Pathname("/var/lib/zypp") : _home_path; } - - void ZYppImpl::setHomePath( const Pathname & path ) - { _home_path = path; } - - Pathname ZYppImpl::tmpPath() const - { - static TmpDir zypp_tmp_dir( TmpPath::defaultLocation(), "zypp." ); - return zypp_tmp_dir.path(); - } - - /****************************************************************** - ** - ** FUNCTION NAME : operator<< - ** FUNCTION TYPE : std::ostream & - */ - std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj ) - { - return str << "ZYppImpl"; - } - - ///////////////////////////////////////////////////////////////// - } // namespace zypp_detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// diff --git a/libzypp/zypp/zypp_detail/ZYppImpl.h b/libzypp/zypp/zypp_detail/ZYppImpl.h deleted file mode 100644 index fc70cfa..0000000 --- a/libzypp/zypp/zypp_detail/ZYppImpl.h +++ /dev/null @@ -1,137 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/zypp_detail/ZYppImpl.h - * -*/ -#ifndef ZYPP_ZYPP_DETAIL_ZYPPIMPL_H -#define ZYPP_ZYPP_DETAIL_ZYPPIMPL_H - -#include - -#include "zypp/TmpPath.h" -#include "zypp/Target.h" -#include "zypp/Resolver.h" -#include "zypp/KeyRing.h" -#include "zypp/ZYppCommit.h" -#include "zypp/ResTraits.h" -#include "zypp/DiskUsageCounter.h" -#include "zypp/ManagedFile.h" - -using namespace zypp::filesystem; - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace zypp_detail - { ///////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : ZYppImpl - // - /** */ - class ZYppImpl - { - friend std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj ); - - public: - /** Default ctor */ - ZYppImpl(); - /** Dtor */ - ~ZYppImpl(); - - public: - /** */ - ResPool pool() const - { return ResPool::instance(); } - - ResPoolProxy poolProxy() const - { return ResPool::instance().proxy(); } - - /** */ - KeyRing_Ptr keyRing() const - { return _keyring; } - - - Resolver_Ptr resolver() const - { return _resolver; } - - public: - /** \todo Signal locale change. */ - /** - * \throws Exception - */ - Target_Ptr target() const; - - /** Same as \ref target but returns NULL if target is not - * initialized, instead of throwing. - */ - Target_Ptr getTarget() const - { return _target; } - - /** - * \throws Exception - * true, just init the target, dont populate store or pool - */ - void initializeTarget( const Pathname & root, bool doRebuild_r ); - - /** - * \throws Exception - */ - void finishTarget(); - - /** Commit changes and transactions. */ - ZYppCommitResult commit( const ZYppCommitPolicy & policy_r ); - - /** Install a source package on the Target. */ - void installSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - /** Install a source package on the Target. */ - ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r ); - - public: - /** Get the path where zypp related plugins store persistent data and caches */ - Pathname homePath() const; - - /** Get the path where zypp related plugins store tmp data */ - Pathname tmpPath() const; - - /** set the home, if you need to change it */ - void setHomePath( const Pathname & path ); - - public: - DiskUsageCounter::MountPointSet diskUsage(); - void setPartitions(const DiskUsageCounter::MountPointSet &mp); - DiskUsageCounter::MountPointSet getPartitions() const; - - private: - /** */ - Target_Ptr _target; - /** */ - Resolver_Ptr _resolver; - - KeyRing_Ptr _keyring; - /** */ - Pathname _home_path; - /** defined mount points, used for disk usage counting */ - shared_ptr _disk_usage; - }; - /////////////////////////////////////////////////////////////////// - - /** \relates ZYppImpl Stream output */ - std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj ); - - ///////////////////////////////////////////////////////////////// - } // namespace zypp_detail - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -#endif // ZYPP_ZYPP_DETAIL_ZYPPIMPL_H diff --git a/libzypp/zypp/zypp_detail/ZYppReadOnlyHack.h b/libzypp/zypp/zypp_detail/ZYppReadOnlyHack.h deleted file mode 100644 index c6426e0..0000000 --- a/libzypp/zypp/zypp_detail/ZYppReadOnlyHack.h +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ -/** \file zypp/zypp_detail/ZYppReadOnlyHack.h - * -*/ - -#ifndef ZYPP_ZYPP_DETAIL_ZYPPREADONLYHACK_H -#define ZYPP_ZYPP_DETAIL_ZYPPREADONLYHACK_H -#warning ZYPP_ZYPP_DETAIL_ZYPPREADONLYHACK_H - -#include "zypp/APIConfig.h" - -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace zypp_readonly_hack - { ///////////////////////////////////////////////////////////////// - - void IWantIt() ZYPP_DEPRECATED; - - ///////////////////////////////////////////////////////////////// - } // namespace zypp_readonly_hack - /////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// - -#endif // ZYPP_ZYPP_DETAIL_ZYPPREADONLYHACK_H diff --git a/rpm/0002-Revert-Collect-and-execute-posttrans-scripts-delayed.patch b/rpm/0002-Revert-Collect-and-execute-posttrans-scripts-delayed.patch deleted file mode 100644 index 945badc..0000000 --- a/rpm/0002-Revert-Collect-and-execute-posttrans-scripts-delayed.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 09a9767a6919a986f3ac1add444a6760007d5d78 Mon Sep 17 00:00:00 2001 -From: Thomas Perl -Date: Wed, 27 May 2015 19:05:22 +0200 -Subject: [PATCH] Revert "Collect and execute %posttrans scripts delayed - (Fate#313506)" - -This temporarily reverts commit 40f1e5737baa7082850925573fdd2b45d91deade. - -The reason is that the old RPM doesn't have the --noposttrans flag (as already -established). This was added in this commit: - - https://github.com/rpm-software-management/rpm/commit/23e82afcbc8a9ddde13f0d20c75a549196920139 - -The commit in libzypp that introduced usage of this is the following: - - https://github.com/openSUSE/libzypp/commit/40f1e5737baa7082850925573fdd2b45d91deade - -Following the breadcrumbs (Fate#313506) with a Google search from there leads us to: - - https://bugzilla.novell.com/show_bug.cgi?id=786318 - -So basically libzypp uses this to move the posttrans scriptlets to after the -transaction has finished. - -As a stopgap measure, we revert that patch in our newer libzypp package to -avoid that specific error. Once the new RPM is integrated, we can remove the -revert and get the right posttrans behavior. ---- - zypp/target/TargetImpl.cc | 10 ---------- - 1 file changed, 10 deletions(-) - -diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc -index 89506ed..cd15cbc 100644 ---- a/zypp/target/TargetImpl.cc -+++ b/zypp/target/TargetImpl.cc -@@ -45,7 +45,6 @@ - #include "zypp/target/TargetCallbackReceiver.h" - #include "zypp/target/rpm/librpmDb.h" - #include "zypp/target/CommitPackageCache.h" --#include "zypp/target/RpmPostTransCollector.h" - - #include "zypp/parser/ProductFileReader.h" - -@@ -1508,7 +1507,6 @@ namespace zypp - MIL << "TargetImpl::commit(" << policy_r << ")" << steps.size() << endl; - - bool abort = false; -- RpmPostTransCollector postTransCollector( _root ); - std::vector successfullyInstalledPackages; - TargetImpl::PoolItemList remaining; - -@@ -1585,8 +1583,6 @@ namespace zypp - try - { - progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE ); -- if ( postTransCollector.collectScriptFromPackage( localfile ) ) -- flags |= rpm::RPMINST_NOPOSTTRANS; - rpm().installPackage( localfile, flags ); - HistoryLog().install(citem); - -@@ -1731,12 +1727,6 @@ namespace zypp - - } // for - -- // process all remembered posttrans scripts. -- if ( !abort ) -- postTransCollector.executeScripts(); -- else -- postTransCollector.discardScripts(); -- - // Check presence of update scripts/messages. If aborting, - // at least log omitted scripts. - if ( ! successfullyInstalledPackages.empty() ) --- -2.1.4 -