Import a new project template

This commit is contained in:
Daniel Mach 2020-03-06 08:30:09 +01:00 committed by Nicola Sella
commit 5bb316d367
79 changed files with 5539 additions and 0 deletions

195
.clang-format Normal file
View File

@ -0,0 +1,195 @@
---
Language: Cpp
BasedOnStyle: Google
Standard: Cpp11
# Characters per line
ColumnLimit: 120
# Do not wrap comments according to ColumnLimit
ReflowComments: false
# Indentation
IndentWidth: 4
AccessModifierOffset: -4
UseTab: false
# Keep up to 2 empty lines
MaxEmptyLinesToKeep: 2
# sort and group includes: c++, system, project
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
# C++ Standard Library headers
- Regex: '<[[:alnum:]_-]+>'
Priority: 5
# system libraries
- Regex: '<.+>'
Priority: 4
# project includes - libdnf absolute paths
- Regex: '"libdnf/.+"'
Priority: 3
# project includes - libdnf-cli absolute paths
- Regex: '"libdnf-cli/.+"'
Priority: 2
# project includes
- Regex: '".+"'
Priority: 1
# Always break after an open bracket, if the parameters don't fit on a single line, e.g.:
#
# someLongFunction(
# argument1, argument2);
#
AlignAfterOpenBracket: AlwaysBreak
# Forbid simple braced statements on a single line.
#
# Allowed:
# if (a) {
# return;
# }
#
# Forbidden:
# if (a) { return; }
#
AllowShortBlocksOnASingleLine: false
# Forbid short case labels on a single line.
#
# Allowed:
# switch (a) {
# case 1:
# x = 1;
# break;
# }
#
# Forbidden:
# switch (a) {
# case 1: x = 1; break;
# case 2: return;
# }
#
AllowShortCaseLabelsOnASingleLine: false
# Allow only single line methods defined inside a class.
#
# Allowed:
# class Foo {
# void f() { foo(); }
# };
# void f() {
# foo();
# }
#
# Forbidden:
# void f() { foo(); }
AllowShortFunctionsOnASingleLine: Inline
# Forbid if statements on a single line.
#
# Allowed:
# if (a)
# return ;
# else {
# return;
# }
#
# Forbidden:
# if (a) return;
# else
# return;
#
AllowShortIfStatementsOnASingleLine: Never
# Forbid loops on a single line.
#
# Allowed:
# while (i < 1) {
# i--;
# }
#
# Forbidden:
# while (i < 1) i--;
#
AllowShortLoopsOnASingleLine: false
# Force middle pointer alignment.
#
# Examples:
# char * str;
# const std::string & str;
#
DerivePointerAlignment: false
PointerAlignment: Middle
# Allow only one argument/parameter per line.
#
# Allowed:
# void f(int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
#
# Forbidden:
# void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
#
BinPackArguments: false
BinPackParameters: false
# If the function declaration doesn't fit on a line, put all parameters on the next line.
#
# Allowed:
# void myFunction(
# int a, int b, int c, int d, int e);
#
# Forbidden:
# void myFunction(int a,
# int b,
# int c,
# int d,
# int e);
#
AllowAllParametersOfDeclarationOnNextLine: true
# Allow only per line constructor intitializers.
#
# Allowed:
# MyClass::MyClass()
# : member0(0)
# , member1(2)
#
# Forbidden:
# MyClass::MyClass() :
# member0(0), member1(2)
#
AllowAllConstructorInitializersOnNextLine: false
BreakConstructorInitializers: BeforeComma
# Align consecutive C/C++ preprocessor macros.
#
# Example:
# #define SHORT_NAME 42
# #define LONGER_NAME 0x007f
# #define EVEN_LONGER_NAME (2)
# #define foo(x) (x * x)
# #define bar(y, z) (y + z)
#
AlignConsecutiveMacros: true
...

31
.clang-tidy Normal file
View File

@ -0,0 +1,31 @@
---
Checks: '*,readability-*,-google-runtime-references,-modernize-use-trailing-return-type,-hicpp-signed-bitwise,-fuchsia*,-modernize-use-nodiscard'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: '0'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: '1'
- key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
value: '1'
- key: readability-inconsistent-declaration-parameter-name.Strict
value: '1'
...

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
build/*
__pycache__
*.log
*.src.rpm
*.tar.gz

84
AUTHORS.md Normal file
View File

@ -0,0 +1,84 @@
The current Red Hat's Software Management / DNF team
====================================================
Aleš Matěj <amatej@redhat.com>
Daniel Mach <dmach@redhat.com>
Jaroslav Mracek <jmracek@redhat.com>
Jaroslav Rohel <jrohel@redhat.com>
Lukáš Hrázký <lhrazky@redhat.com>
Marek Blaha <mblaha@redhat.com>
Nicola Sella <nsella@redhat.com>
Pavla Kratochvilova <pkratoch@redhat.com>
All contributors to libdnf (incl. hawkey and libhif)
====================================================
Adam Williamson <awilliam@redhat.com>
Ales Kozumplik <kozumplik@gmail.com>
Aleš Matěj <amatej@redhat.com>
Benjamin Kircher <benjamin.kircher@gmail.com>
Bernhard Rosenkränzer <bero@lindev.ch>
Colin Walters <walters@verbum.org>
Corentin Noël <corentin@elementary.io>
Dan Callaghan <dcallagh@redhat.com>
Dan Horák <dan@danny.cz>
Daniel Mach <dmach@redhat.com>
Eduard Čuba <cuba.edo@gmail.com>
Elan Ruusamäe <glen@delfi.ee>
Giuseppe Scrivano <gscrivan@redhat.com>
Christian Brunner <chb@muc.de>
Courtney Pacheco <cpacheco@redhat.com>
Igor Gnatenko <i.gnatenko.brain@gmail.com>
iliana weller <iweller@amazon.com>
James Cassell <code@james.cassell.me>
Jan Pazdziora <jpazdziora@redhat.com>
Jan Silhan <jsilhan@redhat.com>
Jaroslav Mracek <jmracek@redhat.com>
Jaroslav Rohel <jrohel@redhat.com>
Jeff Law <law@redhat.com>
Jens Petersen <juhpetersen@gmail.com>
Jonathan Dieter <jdieter@gmail.com>
Jonathan Lebon <jlebon@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
Jo Shields <directhex@apebox.org>
Kalev Lember <klember@redhat.com>
Kevin Howell <khowell@redhat.com>
Kevin Kofler <kevin.kofler@chello.at>
Khem Raj <raj.khem@gmail.com>
Lukáš Hrázký <lhrazky@redhat.com>
Lumir Balhar <lbalhar@redhat.com>
Marek Blaha <mblaha@redhat.com>
Marius Vollmer <mvollmer@redhat.com>
Martin Hatina <mhatina@redhat.com>
Martin Sehnoutka <msehnout@redhat.com>
Matthew Barnes <mbarnes@redhat.com>
Mihai Moldovan <ionic@ionic.de>
Michael Mraka <michael.mraka@redhat.com>
Michael Schroeder <mls@suse.de>
Michal Domonkos <mdomonko@redhat.com>
Michal Luscon <mluscon@redhat.com>
Michal Minar <miminar@redhat.com>
Michal Ruprich <mruprich@redhat.com>
Michal Toman <mtoman@fedoraproject.org>
Neal Gompa <ngompa13@gmail.com>
Nils Philippsen <nils@redhat.com>
Panu Matilainen <pmatilai@redhat.com>
Pat Riehecky <riehecky@fnal.gov>
Pavla Kratochvilova <pkratoch@redhat.com>
Peter Hjalmarsson <kanelxake@gmail.com>
Peter Robinson <pbrobinson@gmail.com>
Petr Viktorin <pviktori@redhat.com>
Radek Holy <rholy@redhat.com>
Rafael Fonseca <rdossant@redhat.com>
Richard Hughes <richard@hughsie.com>
Ruixin <peter.bao@mail.utoronto.ca>
Scott Tsai <scottt.tw@gmail.com>
Tomas Mlcoch <tmlcoch@redhat.com>
Tomasz Kłoczko <kloczko.tomasz@gmail.com>
Tyrone Abdy <tabdy@redhat.com>
Valentina Mukhamedzhanova <vmukhame@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
Vít Ondruch <vondruch@redhat.com>
Yavor Atanasov <yavor.k.atanasov@gmail.com>
Yuri Chornoivan <yurchor@ukr.net>
Zdeněk Pavlas <zpavlas@redhat.com>
Zhang Xianwei <zhang.xianwei8@zte.com.cn>

106
CMakeLists.txt Normal file
View File

@ -0,0 +1,106 @@
message("Running CMake on libdnf...")
cmake_minimum_required(VERSION 3.5)
include(VERSION.cmake)
project(libdnf LANGUAGES CXX VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
cmake_policy(VERSION ${CMAKE_VERSION})
message("Building ${PROJECT_NAME} version ${PROJECT_VERSION}")
if(DEFINED PACKAGE_VERSION)
if(NOT ${PACKAGE_VERSION} STREQUAL ${PROJECT_VERSION})
message(FATAL_ERROR "Variables PROJECT_VERSION and PACKAGE_VERSION differ. Make sure the versions in VERSION.cmake and the value provided via -DPACKAGE_VERSION are in sync.")
endif()
endif()
# build options - components (sub-packages)
option(WITH_DNFDAEMON_CLIENT "Build command-line interface for dnfdaemon" ON)
option(WITH_DNFDAEMON_SERVER "Build package management service with a DBus interface" ON)
option(WITH_LIBDNF_CLI "Build library for working with a terminal in a command-line package manager" ON)
option(WITH_MICRODNF "Build microdnf command-line package manager" ON)
# build options - features
option(WITH_COMPS "Build with comps groups and environments support" ON)
option(WITH_MODULEMD "Build with modulemd modules support" ON)
option(WITH_ZCHUNK "Build with zchunk delta compression support" ON)
# build options - documentation
option(WITH_HTML "Build HTML documentation" ON)
option(WITH_MAN "Build man pages" ON)
# build options - tests
option(WITH_TESTS "Build tests" ON)
# build options - debugging
option(WITH_SANITIZERS "Build with address, leak and undefined sanitizers (DEBUG ONLY)" OFF)
# build options - bindings
option(WITH_GO "Build Go bindings" ON)
option(WITH_PERL5 "Build Perl 5 bindings" ON)
option(WITH_PYTHON3 "Build Python 3 bindings" ON)
option(WITH_RUBY "Build Ruby bindings" ON)
# includes
include(GNUInstallDirs)
# common dependencies
find_package(PkgConfig REQUIRED)
# C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# warnings
add_compile_options(-Wall -Wextra -Werror)
add_compile_options(-Wcast-align -Wformat-nonliteral -Wmissing-format-attribute -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wwrite-strings)
# not sure about the conversion warnings being errors; review later
add_compile_options(-Wconversion)
# linker options
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# clang doesn't support this option
add_compile_options(-Wl,--as-needed)
endif()
if(WITH_SANITIZERS)
message(WARNING "Building with sanitizers enabled!")
set(SANITIZER_FLAGS "-fsanitize=address -fsanitize=leak -fsanitize=undefined")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# requires: compiler-rt package on Fedora
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -static-libsan")
else()
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -static-libasan -static-liblsan -static-libubsan")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_FLAGS}")
endif()
include_directories("${PROJECT_SOURCE_DIR}/include")
# libdnf
add_subdirectory("include")
add_subdirectory("libdnf")
add_subdirectory("libdnf-cli")
add_subdirectory("doc")
add_subdirectory("bindings")
# dnfdaemon
add_subdirectory("dnfdaemon-server")
add_subdirectory("dnfdaemon-client")
# microdnf
add_subdirectory("microdnf")
# tests
enable_testing()
add_subdirectory("test")

70
CODING_STYLE.md Normal file
View File

@ -0,0 +1,70 @@
Coding style
============
Character case:
* Types: CamelCase
* Classes: CamelCase
* Functions: snake_case
* Variables: snake_case
* Arguments: snake_case
* Constants: UPPER_CASE
File system hierarchy:
* Directories: lower_case, avoid separators if possible
* Files: snake_case.{cpp,hpp}
C++ coding style:
* Use clang-format and clang-tidy to check your coding style before you submit a pull request
* -std=c++17
* Indent by 4 spaces
* 120 characters per line
* Includes grouped and alphabetically ordered within each group
* project
* project - "libdnf-cli/" absolute paths
* project - "libdnf/" absolute paths
* 3rd party
* standard library
* Project includes must use full path in the project or plain file name (includes in the same directory)
* Use C++ style comments: ``//``
* Use three forward slashes for docstrings: ``///``
* Use templates and lambdas only if really necessary
* Use ``// clang-format off|on`` if auto-formatted code is not readable
* See .clang-format for more details and examples
Python coding style:
* 120 characters per line
* Follow pep8
Project layout
==============
```
<top directory>
+-- bindings # everything related to SWIG bindings goes here
| +-- <language> # go, perl5, python3, ruby
| | +-- libdnf # language specific bindings for libdnf
| | +-- libdnf_cli # language specific bindings for libdnf-cli
| +-- libdnf # SWIG *.i files for libdnf
| +-- libdnf_cli # SWIG *.i files for libdnf-cli
+-- doc # documentation
+-- include # public headers
| +-- libdnf # libdnf public C++ headers
| +-- libdnf-cli # libdnf-cli public C++ headers
+-- libdnf # libdnf code and private headers (core libdnf functionality)
| +-- <module> #
+-- libdnf-cli # libdnf-cli code and private headers (argument parser, progressbars, tables, ...)
| +-- <module> #
+-- dnfdaemon-client # command line client for dnfdaemon-server
+-- dnfdaemon-server # DBus package manager service
+-- microdnf # microdnf command line package manager
+-- test # tests; similar layout to the bindings
```

24
COPYING.md Normal file
View File

@ -0,0 +1,24 @@
Copying
=======
Libdnf is covered under two separate licenses: GPLv2+ and LGPLv2.1+.
GPLv2+
------
The entire code base may be distributed under the terms of the
GNU General Public License version 2 and any later version (GPLv2+).
The complete text of the license is available in the gpl-2.0.txt file.
LGPLv2.1+
---------
Alternatively, all of the source code in 'libdnf', 'libdnf-cli', 'include'
and 'bindings' subdirectories of the libdnf source code distribution as well
as any code derived from that code may instead be distributed under the
GNU Lesser General Public License version 2.1 and any later version (LGPLv2.1+),
at the choice of the distributor.
The complete text of the license is available in the lgpl-2.1.txt file.
This alternative is provided to enable applications to be linked against
the libdnf and libdnf-cli libraries and their bindings to other programming
languages without forcing such applications to be distributed under the GPL.

37
DCO Normal file
View File

@ -0,0 +1,37 @@
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

92
README.md Normal file
View File

@ -0,0 +1,92 @@
libdnf
======
* Libdnf is a package management library.
* It's a backed of [DNF](https://github.com/rpm-software-management/dnf) package manager.
* Supported content types are:
* RPM packages
* repomd repositories
* modulemd modules
* comps - categories, environments and groups
* updateinfo
:warning: **The current (dnf-5-devel) branch is subject of a major rewrite. The API/ABI is currently unstable** :warning:
Documentation
=============
* For HTML documentation see https://libdnf.readthedocs.io/
* The header files are documented because documentation is mainly generated from them
Reporting issues
================
* [Red Hat Bugzilla](https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=libdnf) is the preferred way of filing issues. [[backlog](https://bugzilla.redhat.com/buglist.cgi?bug_status=__open__&product=Fedora&component=libdnf)]
* [GitHub issues](https://github.com/rpm-software-management/libdnf/issues/new) are also accepted. [[backlog](https://github.com/rpm-software-management/libdnf/issues)]
Contributing
============
* By contributing to this project you agree to the Developer Certificate of Origin (DCO).
This document is a simple statement that you, as a contributor,
have the legal right to submit the contribution. See the [DCO](DCO) file for details.
* All contributions to this project are licensed under [LGPLv2.1+](lgpl-2.1.txt) or [GPLv2+](gpl-2.0.txt).
See the [License](#license) section for details.
Writing patches
---------------
* Please follow the [coding style](CODING_STYLE.md)
* When a patch is ready, submit a pull request
* It is a good practice to write documentation and unit tests as part of the patches
Building
--------
To install build requirements, run::
$ dnf builddep libdnf.spec --define '_with_sanitizers 1' [--define '_without_<option> 1 ...]
To build code, run::
$ mkdir build
$ cd build
$ cmake .. -DWITH_SANITIZERS=ON [-DWITH_<OPTION>=<ON|OFF> ...]
$ make -j4
To build rpms from git, run::
$ export PREFIX=$(rpmspec libdnf.spec -q --srpm --qf '%{name}-%{version}'); git archive --format=tar.gz --prefix=$PREFIX/ HEAD > $PREFIX.tar.gz
$ rpmbuild -ba --define "_sourcedir $(pwd)" libdnf.spec [--with=<option>|--without=<option> ...]
Testing
-------
To run the tests, follow the steps to build the code and then run::
# from the 'build' directory
$ CTEST_OUTPUT_ON_FAILURE=1 make test
As an alternative, tests can be executed in a verbose mode::
# from the 'build' directory
$ make test ARGS='-V'
Translating
-----------
TBD
License
=======
* The libraries is licensed under [LGPLv2.1+](lgpl-2.1.txt)
* The standalone programs that are part of this project are licensed under [GPLv2+](gpl-2.0.txt)
* See [COPYING](COPYING.md) for more details

3
VERSION.cmake Normal file
View File

@ -0,0 +1,3 @@
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 0)

52
bindings/CMakeLists.txt Normal file
View File

@ -0,0 +1,52 @@
if(NOT (WITH_GO OR WITH_PERL5 OR WITH_PYTHON3 OR WITH_RUBY))
return()
endif()
message("Building bindings")
find_package(SWIG REQUIRED)
include(UseSWIG)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# using 64bit architecture
set(CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE64")
endif()
include_directories(${CMAKE_SOURCE_DIR}/include)
# SWIG is flooding logs with warnings we can't fix -> turn them off
set(SWIG_COMPILE_OPTIONS
-Wno-cast-align
-Wno-conversion
-Wno-deprecated-copy
-Wno-deprecated-declarations
-Wno-missing-declarations
-Wno-missing-field-initializers
-Wno-sign-compare
-Wno-strict-aliasing
-Wno-unused-function
-Wno-unused-parameter
)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SWIG_COMPILE_OPTIONS ${SWIG_COMPILE_OPTIONS} -Wno-catch-value)
endif()
# list of all modules that will be included in libdnf bindings
list(APPEND SWIG_LIBDNF_MODULES base)
# list of all modules that will be included in libdnf-cli bindings
list(APPEND SWIG_LIBDNF_CLI_MODULES progressbar)
add_subdirectory(go)
add_subdirectory(perl5)
add_subdirectory(python3)
add_subdirectory(ruby)

View File

@ -0,0 +1,23 @@
if(NOT WITH_GO)
return()
endif()
message("Building bindings for go")
function(add_go_module LIBRARY_NAME MODULE_NAME)
set(TARGET_NAME "go_${MODULE_NAME}")
set_source_files_properties(../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTIES CPLUSPLUS ON)
set(CMAKE_SWIG_FLAGS -module ${TARGET_NAME} -cgo -intgosize 64 -package libdnf)
swig_add_library(${TARGET_NAME} LANGUAGE go SOURCES ../../${LIBRARY_NAME}/${MODULE_NAME}.i)
set_property(TARGET ${TARGET_NAME} PROPERTY OUTPUT_NAME ${MODULE_NAME})
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})
string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
endfunction()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,6 @@
message("Building bindings for go: libdnf")
foreach(MODULE_NAME ${SWIG_LIBDNF_MODULES})
add_go_module(libdnf ${MODULE_NAME})
endforeach()

View File

@ -0,0 +1,11 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
message("Building bindings for go: libdnf_cli")
foreach(MODULE_NAME ${SWIG_LIBDNF_CLI_MODULES})
add_go_module(libdnf_cli ${MODULE_NAME})
endforeach()

14
bindings/libdnf/base.i Normal file
View File

@ -0,0 +1,14 @@
%module base
%include <exception.i>
%include <std_string.i>
%{
// make SWIG wrap following headers
// #include "libdnf/base/base.hpp"
%}
#define CV __perl_CV
// %include "libdnf/base/base.hpp"

View File

@ -0,0 +1,14 @@
%module progressbar
%include <exception.i>
%include <std_string.i>
%{
// make SWIG wrap following headers
// #include "libdnf-cli/progressbar.hpp"
%}
#define CV __perl_CV
// %include "libdnf-cli/progressbar.hpp"

View File

@ -0,0 +1,65 @@
if(NOT WITH_PERL5)
return()
endif()
message("Building bindings for perl5")
find_package(Perl REQUIRED)
find_package(PerlLibs REQUIRED)
# Preprocessor flags (cppflags) are already included in compiler flags
# (ccflags). Except a path to perl.h that is recorded nowhere.
include_directories(${PERL_INCLUDE_PATH})
perl_get_info(PERL_CFLAGS "ccflags")
separate_arguments(PERL_CFLAGS)
# remove options unused by clang
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(REMOVE_ITEM PERL_CFLAGS -fstack-clash-protection)
list(REMOVE_ITEM PERL_CFLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1)
list(REMOVE_ITEM PERL_CFLAGS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1)
endif()
add_compile_options(${PERL_CFLAGS})
perl_get_info(PERL_LDFLAGS "ccdlflags")
separate_arguments(PERL_LDFLAGS)
add_link_options(${PERL_LDFLAGS})
set(PERL_INSTALLDIRS "site" CACHE STRING
"Perl installation directory identifier: core, vendor, site (default is site)"
)
if(PERL_INSTALLDIRS STREQUAL "core")
set(PERL_INSTALL_PATH "${PERL_ARCHLIB}")
elseif(PERL_INSTALLDIRS STREQUAL "vendor")
set(PERL_INSTALL_PATH "${PERL_VENDORARCH}")
elseif(PERL_INSTALLDIRS STREQUAL "site")
set(PERL_INSTALL_PATH "${PERL_SITEARCH}")
else()
message(FATAL_ERROR "Uknown PERL_INSTALLDIRS value: ${PERL_INSTALLDIRS}")
endif()
message(STATUS "Perl5 files will be installed to ${PERL_INSTALL_PATH}")
function(add_perl5_module LIBRARY_NAME MODULE_NAME)
set(TARGET_NAME "perl5_${MODULE_NAME}")
set_source_files_properties(../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTIES CPLUSPLUS ON)
set_property(SOURCE ../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTY SWIG_MODULE_NAME ${LIBRARY_NAME}::${MODULE_NAME})
swig_add_library(${TARGET_NAME} LANGUAGE perl SOURCES ../../${LIBRARY_NAME}/${MODULE_NAME}.i)
set_property(TARGET ${TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY "../auto/${LIBRARY_NAME}/${MODULE_NAME}")
set_property(TARGET ${TARGET_NAME} PROPERTY OUTPUT_NAME ${MODULE_NAME})
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})
string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION "${PERL_INSTALL_PATH}/auto/${LIBRARY_NAME}/${MODULE_NAME}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.pm" DESTINATION "${PERL_INSTALL_PATH}/${LIBRARY_NAME}")
endfunction()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,6 @@
message("Building bindings for perl5: libdnf")
foreach(MODULE_NAME ${SWIG_LIBDNF_MODULES})
add_perl5_module(libdnf ${MODULE_NAME})
endforeach()

View File

@ -0,0 +1,11 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
message("Building bindings for perl5: libdnf_cli")
foreach(MODULE_NAME ${SWIG_LIBDNF_CLI_MODULES})
add_perl5_module(libdnf_cli ${MODULE_NAME})
endforeach()

View File

@ -0,0 +1,31 @@
if(NOT WITH_PYTHON3)
return()
endif()
message("Building bindings for python3")
find_package(Python3 REQUIRED)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
function(add_python3_module LIBRARY_NAME MODULE_NAME)
set(TARGET_NAME "python3_${MODULE_NAME}")
set_source_files_properties(../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTIES CPLUSPLUS ON)
swig_add_library(${TARGET_NAME} LANGUAGE python SOURCES ../../${LIBRARY_NAME}/${MODULE_NAME}.i)
set_property(TARGET ${TARGET_NAME} PROPERTY OUTPUT_NAME ${MODULE_NAME})
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})
string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${PYTHON_LIBRARIES})
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${Python3_SITEARCH}/${LIBRARY_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py DESTINATION ${Python3_SITEARCH}/${LIBRARY_NAME})
endfunction()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

1
bindings/python3/libdnf/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__init__.py

View File

@ -0,0 +1,11 @@
message("Building bindings for python3: libdnf")
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py)
foreach(MODULE_NAME ${SWIG_LIBDNF_MODULES})
add_python3_module(libdnf ${MODULE_NAME})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "from . import ${MODULE_NAME}\n")
endforeach()
install(FILES __init__.py DESTINATION ${Python3_SITEARCH}/libdnf)

View File

@ -0,0 +1 @@
__init__.py

View File

@ -0,0 +1,16 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
message("Building bindings for python3: libdnf_cli")
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py)
foreach(MODULE_NAME ${SWIG_LIBDNF_CLI_MODULES})
add_python3_module(libdnf_cli ${MODULE_NAME})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "from . import ${MODULE_NAME}\n")
endforeach()
install(FILES __init__.py DESTINATION ${Python3_SITEARCH}/libdnf_cli)

View File

@ -0,0 +1,31 @@
if(NOT WITH_RUBY)
return()
endif()
message("Building bindings for ruby")
find_package(Ruby REQUIRED)
include_directories(${RUBY_INCLUDE_DIRS})
function(add_ruby_module LIBRARY_NAME MODULE_NAME)
set(TARGET_NAME "ruby_${MODULE_NAME}")
set_source_files_properties(../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTIES CPLUSPLUS ON)
set_property(SOURCE ../../${LIBRARY_NAME}/${MODULE_NAME}.i PROPERTY SWIG_MODULE_NAME ${MODULE_NAME})
set(CMAKE_SWIG_FLAGS -module ${MODULE_NAME} -ruby)
swig_add_library(${TARGET_NAME} LANGUAGE ruby SOURCES ../../${LIBRARY_NAME}/${MODULE_NAME}.i)
set_property(TARGET ${TARGET_NAME} PROPERTY OUTPUT_NAME ${MODULE_NAME})
target_compile_options(${TARGET_NAME} PUBLIC ${SWIG_COMPILE_OPTIONS})
string(REPLACE "_" "-" C_LIBRARY_NAME ${LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${RUBY_LIBRARIES})
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION "${RUBY_VENDORARCH_DIR}/${LIBRARY_NAME}")
endfunction()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,6 @@
message("Building bindings for ruby: libdnf")
foreach(MODULE_NAME ${SWIG_LIBDNF_MODULES})
add_ruby_module(libdnf ${MODULE_NAME})
endforeach()

View File

@ -0,0 +1,11 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
message("Building bindings for ruby: libdnf_cli")
foreach(MODULE_NAME ${SWIG_LIBDNF_CLI_MODULES})
add_ruby_module(libdnf_cli ${MODULE_NAME})
endforeach()

24
clang-format-changed Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# run clang-format on new and modified files
# apply the changes immediately
TOPDIR=$(dirname $(readlink -f $0))
# get upstream branch (incl. remote)
UPSTREAM_BRANCH=`git rev-parse --abbrev-ref --symbolic-full-name @{u}`
# list all changed files
CHANGED_FILES=`git diff --name-only "$UPSTREAM_BRANCH" | egrep '\.(c|cpp|h|hpp)$'`
# list all untracked files
UNTRACKED_FILES=`git ls-files --others --exclude-standard | egrep '\.(c|cpp|h|hpp)$'`
for FILE in $CHANGED_FILES $UNTRACKED_FILES; do
echo "Formatting $FILE..."
clang-format -i "$FILE"
done

31
clang-tidy-changed Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# run clang-tidy on new and modified files
# print the result and store it in clang-tidy-changed.log
TOPDIR=$(dirname $(readlink -f $0))
LOG="$TOPDIR/clang-tidy-changed.log"
# get upstream branch (incl. remote)
UPSTREAM_BRANCH=`git rev-parse --abbrev-ref --symbolic-full-name @{u}`
# list all changed files
CHANGED_FILES=`git diff --name-only "$UPSTREAM_BRANCH" | egrep '\.(c|cpp|h|hpp)$'`
# list all untracked files
UNTRACKED_FILES=`git ls-files --others --exclude-standard | egrep '\.(c|cpp|h|hpp)$'`
echo -n > "$LOG"
for FILE in $CHANGED_FILES $UNTRACKED_FILES; do
echo "Checking $FILE..."
CHECKS=""
if [[ "$FILE" == "test/"* ]]; then
# exclude several checks failing due to cppunit
CHECKS="-llvm-header-guard,-readability-convert-member-functions-to-static,-cppcoreguidelines-owning-memory,-cert-err58-cpp"
fi
clang-tidy "$FILE" -checks="$CHECKS" -- -std=c++17 -I"$TOPDIR/include" | tee -a "$LOG"
done

View File

@ -0,0 +1,9 @@
if(NOT WITH_DNFDAEMON_CLIENT)
return()
endif()
file(GLOB_RECURSE DNFDAEMON_CLIENT_SOURCES *.cpp)
add_executable(dnfdaemon-client main.cpp ${DNFDAEMON_CLIENT_SOURCES})
target_link_libraries(dnfdaemon-client PUBLIC libdnf libdnf-cli)
install(TARGETS dnfdaemon-client RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

23
dnfdaemon-client/main.cpp Normal file
View File

@ -0,0 +1,23 @@
/*
Copyright (C) 2020 Red Hat, Inc.
This file is part of dnfdaemon-client: https://github.com/rpm-software-management/libdnf/
Dnfdaemon-client is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Dnfdaemon-client 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 dnfdaemon-client. If not, see <https://www.gnu.org/licenses/>.
*/
int main() {
return 0;
}

View File

@ -0,0 +1,9 @@
if(NOT WITH_DNFDAEMON_SERVER)
return()
endif()
file(GLOB_RECURSE DNFDAEMON_SERVER_SOURCES *.cpp)
add_executable(dnfdaemon-server main.cpp ${DNFDAEMON_SERVER_SOURCES})
target_link_libraries(dnfdaemon-server PUBLIC libdnf libdnf-cli)
install(TARGETS dnfdaemon-server RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

23
dnfdaemon-server/main.cpp Normal file
View File

@ -0,0 +1,23 @@
/*
Copyright (C) 2020 Red Hat, Inc.
This file is part of dnfdaemon-server: https://github.com/rpm-software-management/libdnf/
Dnfdaemon-server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Dnfdaemon-server 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 dnfdaemon-server. If not, see <https://www.gnu.org/licenses/>.
*/
int main() {
return 0;
}

49
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
add_custom_target(doc)
add_custom_target(doxygen
doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMENT "Building doxygen xml files"
)
if(WITH_HTML)
add_custom_target(doc-html
sphinx-build -c ${CMAKE_CURRENT_BINARY_DIR} -b html
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/_build
COMMENT "Building html documentation"
)
add_dependencies(doc doc-html)
add_dependencies(doc-html doxygen)
#install(FILES ${HTML_FILES} )
endif()
if(WITH_MAN)
add_custom_target(doc-man
sphinx-build -c ${CMAKE_CURRENT_BINARY_DIR} -b man
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/_build
COMMENT "Building man documentation"
)
add_dependencies(doc doc-man)
if(WITH_DNFDAEMON_CLIENT)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/_build/dnfdaemon-client.8 DESTINATION share/man/man8)
endif()
if(WITH_DNFDAEMON_SERVER)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/_build/dnfdaemon-server.8 DESTINATION share/man/man8)
endif()
if(WITH_MICRODNF)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/_build/microdnf.8 DESTINATION share/man/man8)
endif()
endif()

2546
doc/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

20
doc/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

70
doc/conf.py.in Normal file
View File

@ -0,0 +1,70 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'libdnf'
copyright = '2020, Red Hat'
author = 'RPM Software Management <rpm-ecosystem@lists.rpm.org>'
AUTHORS=['See AUTHORS.md in libdnf source distribution.']
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'breathe'
]
breathe_projects = {'libdnf': '@CMAKE_CURRENT_BINARY_DIR@/xml/'}
breathe_default_project = 'libdnf'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
#html_theme = 'default'
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('microdnf.8', 'microdnf', 'Microdnf Command-line Package Manager', AUTHORS, 8),
('dnfdaemon_client.8', 'dnfdaemon-client', 'Command-line interface for dnfdaemon', AUTHORS, 8),
('dnfdaemon_server.8', 'dnfdaemon-server', 'Package management service with a DBus interface', AUTHORS, 8),
]

6
doc/cpp_base.rst Normal file
View File

@ -0,0 +1,6 @@
libdnf
======
.. doxygennamespace:: libdnf
:content-only:
:members:

6
doc/cpp_comps.rst Normal file
View File

@ -0,0 +1,6 @@
libdnf::comps
=============
.. doxygennamespace:: libdnf::comps
:content-only:
:members:

6
doc/cpp_module.rst Normal file
View File

@ -0,0 +1,6 @@
libdnf::module
==============
.. doxygennamespace:: libdnf::module
:content-only:
:members:

6
doc/cpp_repo.rst Normal file
View File

@ -0,0 +1,6 @@
libdnf::repo
============
.. doxygennamespace:: libdnf::repo
:content-only:
:members:

6
doc/cpp_rpm.rst Normal file
View File

@ -0,0 +1,6 @@
libdnf::rpm
===========
.. doxygennamespace:: libdnf::rpm
:content-only:
:members:

View File

@ -0,0 +1,32 @@
..
Copyright (C) 2020 Red Hat, Inc.
This file is part of dnfdaemon-client: https://github.com/rpm-software-management/libdnf/
Dnfdaemon-client is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Dnfdaemon-client 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 dnfdaemon-client. If not, see <https://www.gnu.org/licenses/>.
######################################
Command-line interface for dnfdaemon
######################################
Synopsis
========
``dnfdaemon-client [options] <command> [<args>...]``
Description
===========

View File

@ -0,0 +1,32 @@
..
Copyright (C) 2020 Red Hat, Inc.
This file is part of dnfdaemon-server: https://github.com/rpm-software-management/libdnf/
Dnfdaemon-server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Dnfdaemon-server 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 dnfdaemon-server. If not, see <https://www.gnu.org/licenses/>.
##################################################
Package management service with a DBus interface
##################################################
Synopsis
========
``systemctl start dnfdaemon-server``
Description
===========

30
doc/index.rst Normal file
View File

@ -0,0 +1,30 @@
.. libdnf documentation master file, created by
sphinx-quickstart on Thu Oct 10 14:04:49 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to libdnf's documentation!
==================================
.. toctree::
:maxdepth: 2
:caption: C++ API:
cpp_base
cpp_comps
cpp_module
cpp_repo
cpp_rpm
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Example API Reference
=====================

32
doc/microdnf.8.rst Normal file
View File

@ -0,0 +1,32 @@
..
Copyright (C) 2020 Red Hat, Inc.
This file is part of microdnf: https://github.com/rpm-software-management/libdnf/
Microdnf is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Microdnf 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 microdnf. If not, see <https://www.gnu.org/licenses/>.
#######################################
Microdnf Command-line Package Manager
#######################################
Synopsis
========
``microdnf [options] <command> [<args>...]``
Description
===========

339
gpl-2.0.txt Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

2
include/CMakeLists.txt Normal file
View File

@ -0,0 +1,2 @@
add_subdirectory("libdnf")
add_subdirectory("libdnf-cli")

View File

@ -0,0 +1,7 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
file(GLOB_RECURSE LIBDNF_CLI_HEADERS *.hpp)
install(FILES ${LIBDNF_CLI_HEADERS} DESTINATION include/libdnf-cli)

View File

View File

@ -0,0 +1,2 @@
file(GLOB_RECURSE LIBDNF_HEADERS *.hpp)
install(FILES ${LIBDNF_HEADERS} DESTINATION include/libdnf)

View File

502
lgpl-2.1.txt Normal file
View File

@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

43
libdnf-cli/CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
# use any sources found under the current directory
file(GLOB_RECURSE LIBDNF_CLI_SOURCES *.cpp)
# gather all pkg-config requires and write them to a .pc file later
list(APPEND LIBDNF_CLI_PC_REQUIRES)
list(APPEND LIBDNF_CLI_PC_REQUIRES_PRIVATE)
# build libdnf-cli.so
add_library(libdnf-cli SHARED ${LIBDNF_CLI_SOURCES})
set(DNF_CLI_SO_VERSION 0)
set_target_properties(libdnf-cli PROPERTIES OUTPUT_NAME "dnf-cli")
set_target_properties(libdnf-cli PROPERTIES SOVERSION ${DNF_CLI_SO_VERSION})
# required by clang
target_link_libraries(libdnf-cli stdc++)
# install libdnf-cli.so
install(TARGETS libdnf-cli LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
# link libraries and set pkg-config requires
pkg_check_modules(SMARTCOLS REQUIRED smartcols)
list(APPEND LIBDNF_CLI_PC_REQUIRES_PRIVATE "${SMARTCOLS_MODULE_NAME}")
target_link_libraries(libdnf-cli ${SMARTCOLS_LIBRARIES})
# sort the pkg-config requires and concatenate them into a string
list(SORT LIBDNF_CLI_PC_REQUIRES)
list(JOIN LIBDNF_CLI_PC_REQUIRES ", " LIBDNF_CLI_PC_REQUIRES_STRING)
list(SORT LIBDNF_CLI_PC_REQUIRES_PRIVATE)
list(JOIN LIBDNF_CLI_PC_REQUIRES_PRIVATE ", " LIBDNF_CLI_PC_REQUIRES_PRIVATE_STRING)
# create a .pc file
configure_file("libdnf-cli.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/libdnf-cli.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdnf-cli.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)

0
libdnf-cli/dummy.cpp Normal file
View File

View File

@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/include
Name: libdnf-cli
Description: Library for working with a terminal in a command-line package manager
Version: @PROGRAM_VERSION@
Requires: @LIBDNF_CLI_PC_REQUIRES_STRING@
Requires.private: @LIBDNF_CLI_PC_REQUIRES_PRIVATE_STRING@
Libs: -L${libdir} -ldnf-cli
Cflags: -I${includedir}

392
libdnf.spec Normal file
View File

@ -0,0 +1,392 @@
Name: libdnf
Version: 1.0.0
Release: 1%{?dist}
Summary: Package management library
License: LGPLv2.1+
URL: https://github.com/rpm-software-management/libdnf
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# ========== build options ==========
%bcond_without dnfdaemon_client
%bcond_without dnfdaemon_server
%bcond_without libdnf_cli
%bcond_without microdnf
%bcond_without comps
%bcond_without modulemd
%bcond_without zchunk
%bcond_with html
%bcond_without man
%bcond_without go
%bcond_without perl5
%bcond_without python3
%bcond_without ruby
%bcond_with sanitizers
%bcond_without tests
# ========== versions of dependencies ==========
%global libmodulemd_version 2.5.0
%global librepo_version 1.11.0
%global libsolv_version 0.7.7
%global swig_version 3.0.12
%global zchunk_version 0.9.11
# ========== build requires ==========
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: pkgconfig(check)
%if ! %{with tests_disabled}
BuildRequires: pkgconfig(cppunit)
%endif
BuildRequires: pkgconfig(gpgme)
BuildRequires: pkgconfig(json-c)
%if %{with comps}
BuildRequires: pkgconfig(libcomps)
%endif
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(librepo) >= %{librepo_version}
BuildRequires: pkgconfig(libsolv) >= %{libsolv_version}
BuildRequires: pkgconfig(libsolvext) >= %{libsolv_version}
%if %{with modulemd}
BuildRequires: pkgconfig(modulemd-2.0) >= %{libmodulemd_version}
%endif
BuildRequires: pkgconfig(rpm) >= 4.11.0
BuildRequires: pkgconfig(sqlite3)
%if %{with zchunk}
BuildRequires: pkgconfig(zck) >= %{zchunk_version}
%endif
BuildRequires: python3dist(sphinx)
%if %{with sanitizers}
BuildRequires: libasan-static
BuildRequires: liblsan-static
BuildRequires: libubsan-static
%endif
# ========== libdnf ==========
#Requires: libmodulemd{?_isa} >= {libmodulemd_version}
Requires: libsolv%{?_isa} >= %{libsolv_version}
Requires: librepo%{?_isa} >= %{librepo_version}
%description
Package management library
%files
%{_libdir}/libdnf.so.*
%license lgpl-2.1.txt
# ========== libdnf-cli ==========
%if %{with libdnf_cli}
%package -n libdnf-cli
Summary: Library for working with a terminal in a command-line package manager
BuildRequires: pkgconfig(smartcols)
%description -n libdnf-cli
Library for working with a terminal in a command-line package manager.
%files -n libdnf-cli
%{_libdir}/libdnf-cli.so.*
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== libdnf-devel ==========
%package devel
Summary: Development files for libdnf
Requires: libdnf%{?_isa} = %{version}-%{release}
Requires: libsolv-devel%{?_isa} >= %{libsolv_version}
%description devel
Development files for libdnf.
%files devel
%{_includedir}/libdnf/
%{_libdir}/libdnf.so
%{_libdir}/pkgconfig/libdnf.pc
%license COPYING.md
%license lgpl-2.1.txt
# ========== libdnf-cli-devel ==========
%package cli-devel
Summary: Development files for libdnf-cli
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
%description cli-devel
Development files for libdnf-cli.
%files cli-devel
%{_includedir}/libdnf-cli/
%{_libdir}/libdnf-cli.so
%{_libdir}/pkgconfig/libdnf-cli.pc
%license COPYING.md
%license lgpl-2.1.txt
# ========== perl5-libdnf ==========
%if %{with perl5}
%package -n perl5-libdnf
Summary: Perl 5 for the libdnf library.
Provides: perl(libdnf) = %{version}-%{release}
Requires: libdnf%{?_isa} = %{version}-%{release}
BuildRequires: perl-devel
BuildRequires: swig >= %{swig_version}
%if ! %{with tests_disabled}
BuildRequires: perl(strict)
BuildRequires: perl(Test::More)
BuildRequires: perl(warnings)
%endif
%description -n perl5-libdnf
Perl 5 bindings for the libdnf library.
%files -n perl5-libdnf
%{perl_vendorarch}/libdnf
%{perl_vendorarch}/auto/libdnf
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== perl5-libdnf-cli ==========
%if %{with perl5} && %{with libdnf_cli}
%package -n perl5-libdnf-cli
Summary: Perl 5 for the libdnf-cli library.
Provides: perl(libdnf_cli) = %{version}-%{release}
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
BuildRequires: perl-devel
BuildRequires: swig >= %{swig_version}
%if ! %{with tests_disabled}
BuildRequires: perl(strict)
BuildRequires: perl(Test::More)
BuildRequires: perl(warnings)
%endif
%description -n perl5-libdnf-cli
Perl 5 bindings for the libdnf-cli library.
%files -n perl5-libdnf-cli
%{perl_vendorarch}/libdnf_cli
%{perl_vendorarch}/auto/libdnf_cli
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== python3-libdnf ==========
%if %{with python3}
%package -n python3-libdnf
%{?python_provide:%python_provide python3-libdnf}
Summary: Python 3 bindings for the libdnf library.
Requires: libdnf%{?_isa} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: swig >= %{swig_version}
%description -n python3-libdnf
Python 3 bindings for the libdnf library.
%files -n python3-libdnf
%{python3_sitearch}/libdnf/
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== python3-libdnf-cli ==========
%if %{with python3} && %{with libdnf_cli}
%package -n python3-libdnf-cli
%{?python_provide:%python_provide python3-libdnf-cli}
Summary: Python 3 bindings for the libdnf-cli library.
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: swig >= %{swig_version}
%description -n python3-libdnf-cli
Python 3 bindings for the libdnf-cli library.
%files -n python3-libdnf-cli
%{python3_sitearch}/libdnf_cli/
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== ruby-libdnf ==========
%if %{with ruby}
%package -n ruby-libdnf
Summary: Ruby bindings for the libdnf library.
Provides: ruby(libdnf) = %{version}-%{release}
Requires: libdnf%{?_isa} = %{version}-%{release}
Requires: ruby(release)
BuildRequires: pkgconfig(ruby)
BuildRequires: swig >= %{swig_version}
%description -n ruby-libdnf
Ruby bindings for the libdnf library.
%files -n ruby-libdnf
%{ruby_vendorarchdir}/libdnf/
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== ruby-libdnf-cli ==========
%if %{with ruby} && %{with libdnf_cli}
%package -n ruby-libdnf-cli
Summary: Ruby bindings for the libdnf-cli library.
Provides: ruby(libdnf_cli) = %{version}-%{release}
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(ruby)
BuildRequires: swig >= %{swig_version}
%description -n ruby-libdnf-cli
Ruby bindings for the libdnf-cli library.
%files -n ruby-libdnf-cli
%{ruby_vendorarchdir}/libdnf_cli/
%license COPYING.md
%license lgpl-2.1.txt
%endif
# ========== dnfdaemon-client ==========
%if %{with dnfdaemon_client}
%package -n dnfdaemon-client
Summary: Command-line interface for dnfdaemon-server
License: GPLv2+
Requires: libdnf%{?_isa} = %{version}-%{release}
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
%description -n dnfdaemon-client
Command-line interface for dnfdaemon-server
%files -n dnfdaemon-client
%{_bindir}/dnfdaemon-client
%license COPYING.md
%license gpl-2.0.txt
%{_mandir}/man8/dnfdaemon-client.8.gz
%endif
# ========== dnfdaemon-server ==========
%if %{with dnfdaemon_server}
%package -n dnfdaemon-server
Summary: Package management service with a DBus interface
License: GPLv2+
Requires: libdnf%{?_isa} = %{version}-%{release}
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
Requires: dnf-data
%description -n dnfdaemon-server
Package management service with a DBus interface
%files -n dnfdaemon-server
%{_bindir}/dnfdaemon-server
%license COPYING.md
%license gpl-2.0.txt
%{_mandir}/man8/dnfdaemon-server.8.gz
%endif
# ========== microdnf ==========
%if %{with microdnf}
%package -n microdnf
Summary: Package management service with a DBus interface
License: GPLv2+
Requires: libdnf%{?_isa} = %{version}-%{release}
Requires: libdnf-cli%{?_isa} = %{version}-%{release}
Requires: dnf-data
%description -n microdnf
Package management service with a DBus interface
%files -n microdnf
%{_bindir}/microdnf
%license COPYING.md
%license gpl-2.0.txt
%{_mandir}/man8/microdnf.8.gz
%endif
# ========== unpack, build, check & install ==========
%prep
%autosetup -p1
%build
%cmake \
-DPACKAGE_VERSION=%{version} \
-DPERL_INSTALLDIRS=vendor \
\
-DWITH_DNFDAEMON_CLIENT=%{?with_dnfdaemon_client:ON}%{!?with_dnfdaemon_client:OFF} \
-DWITH_DNFDAEMON_SERVER=%{?with_dnfdaemon_server:ON}%{!?with_dnfdaemon_server:OFF} \
-DWITH_LIBDNF_CLI=%{?with_libdnf_cli:ON}%{!?with_libdnf_cli:OFF} \
-DWITH_MICRODNF=%{?with_microdnf:ON}%{!?with_microdnf:OFF} \
\
-DWITH_COMPS=%{?with_comps:ON}%{!?with_comps:OFF} \
-DWITH_MODULEMD=%{?with_modulemd:ON}%{!?with_modulemd:OFF} \
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
\
-DWITH_HTML=%{?with_html:ON}%{!?with_html:OFF} \
-DWITH_MAN=%{?with_man:ON}%{!?with_man:OFF} \
\
-DWITH_GO=%{?with_go:ON}%{!?with_go:OFF} \
-DWITH_PERL5=%{?with_perl5:ON}%{!?with_perl5:OFF} \
-DWITH_PYTHON3=%{?with_python3:ON}%{!?with_python3:OFF} \
-DWITH_RUBY=%{?with_ruby:ON}%{!?with_ruby:OFF} \
\
-DWITH_SANITIZERS=%{?with_sanitizers:ON}%{!?with_sanitizers:OFF} \
-DWITH_TESTS=%{?with_tests:ON}%{!?with_tests:OFF}
%make_build
%if %{with man}
make doc-man
%endif
%check
%if %{with tests}
make ARGS="-V" test
%endif
%install
%make_install
#find_lang {name}
%ldconfig_scriptlets
%changelog

52
libdnf/CMakeLists.txt Normal file
View File

@ -0,0 +1,52 @@
# use any sources found under the current directory
file(GLOB_RECURSE LIBDNF_SOURCES *.cpp)
# gather all pkg-config requires and write them to a .pc file later
list(APPEND LIBDNF_PC_REQUIRES)
list(APPEND LIBDNF_PC_REQUIRES_PRIVATE)
# build libdnf.so
add_library(libdnf SHARED ${LIBDNF_SOURCES})
set(DNF_SO_VERSION 2)
set_target_properties(libdnf PROPERTIES OUTPUT_NAME "dnf")
set_target_properties(libdnf PROPERTIES SOVERSION ${DNF_SO_VERSION})
# required by clang
target_link_libraries(libdnf stdc++)
# install libdnf.so
install(TARGETS libdnf LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
# link libraries and set pkg-config requires
pkg_check_modules(LIBSOLV REQUIRED libsolv>=0.7.7)
list(APPEND LIBDNF_PC_REQUIRES "${LIBSOLV_MODULE_NAME}")
target_link_libraries(libdnf ${LIBSOLV_LIBRARIES})
pkg_check_modules(LIBSOLVEXT REQUIRED libsolvext>=0.7.7)
list(APPEND LIBDNF_PC_REQUIRES_PRIVATE "${LIBSOLVEXT_MODULE_NAME}")
target_link_libraries(libdnf ${LIBSOLVEXT_LIBRARIES})
pkg_check_modules(RPM REQUIRED rpm>=4.11.0)
list(APPEND LIBDNF_PC_REQUIRES "${RPM_MODULE_NAME}")
target_link_libraries(libdnf ${RPM_LIBRARIES})
if(WITH_COMPS)
pkg_check_modules(LIBCOMPS REQUIRED libcomps)
list(APPEND LIBDNF_PC_REQUIRES_PRIVATE "${LIBCOMPS_MODULE_NAME}")
target_link_libraries(libdnf ${LIBCOMPS_LIBRARIES})
endif()
# sort the pkg-config requires and concatenate them into a string
list(SORT LIBDNF_PC_REQUIRES)
list(JOIN LIBDNF_PC_REQUIRES ", " LIBDNF_PC_REQUIRES_STRING)
list(SORT LIBDNF_PC_REQUIRES_PRIVATE)
list(JOIN LIBDNF_PC_REQUIRES_PRIVATE ", " LIBDNF_PC_REQUIRES_PRIVATE_STRING)
# create a .pc file
configure_file("libdnf.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/libdnf.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdnf.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)

0
libdnf/dummy.cpp Normal file
View File

11
libdnf/libdnf.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/include
Name: libdnf
Description: Package management library
Version: @PROGRAM_VERSION@
Requires: @LIBDNF_PC_REQUIRES_STRING@
Requires.private: @LIBDNF_PC_REQUIRES_PRIVATE_STRING@
Libs: -L${libdir} -ldnf
Cflags: -I${includedir}

9
microdnf/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
if(NOT WITH_MICRODNF)
return()
endif()
file(GLOB_RECURSE MICRODNF_SOURCES *.cpp)
add_executable(microdnf main.cpp ${DNFDAEMON_CLIENT_SOURCES})
target_link_libraries(microdnf PUBLIC libdnf libdnf-cli)
install(TARGETS microdnf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

23
microdnf/main.cpp Normal file
View File

@ -0,0 +1,23 @@
/*
Copyright (C) 2020 Red Hat, Inc.
This file is part of microdnf: https://github.com/rpm-software-management/libdnf/
Microdnf is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Microdnf 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 microdnf. If not, see <https://www.gnu.org/licenses/>.
*/
int main() {
return 0;
}

20
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,20 @@
if(NOT WITH_TESTS)
return()
endif()
message("Building tests")
# libdnf
add_subdirectory(libdnf)
add_subdirectory(libdnf-cli)
# bindings
add_subdirectory(go)
add_subdirectory(perl5)
add_subdirectory(python3)
add_subdirectory(ruby)
# components
add_subdirectory(dnfdaemon-server)

View File

@ -0,0 +1,25 @@
if(NOT WITH_DNFDAEMON_SERVER)
return()
endif()
pkg_check_modules(CPPUNIT REQUIRED cppunit)
# use any sources found under the current directory
file(GLOB_RECURSE TEST_DNFDAEMON_SERVER_SOURCES *.cpp)
set(TEST_DNFDAEMON_SERVER_SOURCES
${TEST_DNFDAEMON_SERVER_SOURCES}
# share the test runner code with libdnf
${CMAKE_CURRENT_SOURCE_DIR}/../libdnf/run_tests.cpp
)
add_executable(run_tests_dnfdaemon_server ${TEST_DNFDAEMON_SERVER_SOURCES})
target_link_directories(run_tests_dnfdaemon_server PUBLIC ${CMAKE_BINARY_DIR}/libdnf ${CMAKE_BINARY_DIR}/libdnf-cli)
target_link_libraries(run_tests_dnfdaemon_server stdc++ libdnf libdnf-cli cppunit)
add_test(NAME test_dnfdaemon_server COMMAND ${CMAKE_CURRENT_BINARY_DIR}/run_tests_dnfdaemon_server DEPENDS run_tests_dnfdaemon_server COMMENT "Running dnfdaemon-server tests...")

7
test/go/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
if(NOT WITH_GO)
return()
endif()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

View File

@ -0,0 +1,3 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()

View File

@ -0,0 +1,25 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
pkg_check_modules(CPPUNIT REQUIRED cppunit)
# use any sources found under the current directory
file(GLOB_RECURSE TEST_LIBDNF_SOURCES *.cpp)
set(TEST_LIBDNF_CLI_SOURCES
${TEST_LIBDNF_CLI_SOURCES}
# share the test runner code with libdnf
${CMAKE_CURRENT_SOURCE_DIR}/../libdnf/run_tests.cpp
)
add_executable(run_tests_cli ${TEST_LIBDNF_CLI_SOURCES})
target_link_directories(run_tests_cli PUBLIC ${CMAKE_BINARY_DIR}/libdnf)
target_link_libraries(run_tests_cli stdc++ libdnf cppunit)
add_test(NAME test_libdnf_cli COMMAND ${CMAKE_CURRENT_BINARY_DIR}/run_tests_cli DEPENDS run_tests_cli COMMENT "Running libdnf-cli C++ tests...")

View File

@ -0,0 +1,13 @@
pkg_check_modules(CPPUNIT REQUIRED cppunit)
# use any sources found under the current directory
file(GLOB_RECURSE TEST_LIBDNF_SOURCES *.cpp)
add_executable(run_tests ${TEST_LIBDNF_SOURCES})
target_link_directories(run_tests PUBLIC ${CMAKE_BINARY_DIR}/libdnf)
target_link_libraries(run_tests stdc++ libdnf cppunit)
add_test(NAME test_libdnf COMMAND ${CMAKE_CURRENT_BINARY_DIR}/run_tests DEPENDS run_tests COMMENT "Running libdnf C++ tests...")

31
test/libdnf/run_tests.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
int main() {
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}

29
test/perl5/CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
if(NOT WITH_PERL5)
return()
endif()
find_package(Perl REQUIRED)
foreach(MODULE "strict" "Test::More" "warnings")
message(STATUS "Checking for ${MODULE} Perl module")
execute_process(
COMMAND "${PERL_EXECUTABLE}" -e "require ${MODULE}"
RESULT_VARIABLE EXIT_CODE
)
if(EXIT_CODE GREATER 0)
message(FATAL_ERROR "${MODULE} Perl module needed for tests was not found")
endif()
endforeach()
macro(add_perl_test)
add_test(
NAME "test_perl5_${ARGV0}_${ARGV1}"
COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_BINARY_DIR}/bindings/perl5" "${ARGV1}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endmacro()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,7 @@
# use any tests found under the current directory
file(GLOB_RECURSE PERL5_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.t)
foreach(FILE ${PERL5_TESTS})
add_perl_test(libdnf "${FILE}")
endforeach()

View File

@ -0,0 +1,12 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
# use any tests found under the current directory
file(GLOB_RECURSE PERL5_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.t)
foreach(FILE ${PERL5_TESTS})
add_perl_test(libdnf_cli "${FILE}")
endforeach()

View File

@ -0,0 +1,10 @@
if(NOT WITH_PYTHON3)
return()
endif()
find_package(Python3 REQUIRED)
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,2 @@
add_test(NAME test_python3_libdnf COMMAND ${Python3_EXECUTABLE} -m unittest WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TEST test_python3_libdnf PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python3")

View File

@ -0,0 +1,7 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
add_test(NAME test_python3_libdnf_cli COMMAND ${Python3_EXECUTABLE} -m unittest WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TEST test_python3_libdnf_cli PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python3")

19
test/ruby/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
if(NOT WITH_RUBY)
return()
endif()
find_package(Ruby REQUIRED)
macro(add_ruby_test)
add_test(
NAME "test_ruby_${ARGV0}_${ARGV1}"
COMMAND "${RUBY_EXECUTABLE}" "-I${CMAKE_BINARY_DIR}/bindings/ruby" "${ARGV1}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endmacro()
add_subdirectory(libdnf)
add_subdirectory(libdnf_cli)

View File

@ -0,0 +1,7 @@
# use any tests found under the current directory
file(GLOB_RECURSE RUBY_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rb)
foreach(FILE ${RUBY_TESTS})
add_ruby_test(libdnf "${FILE}")
endforeach()

View File

@ -0,0 +1,12 @@
if(NOT WITH_LIBDNF_CLI)
return()
endif()
# use any tests found under the current directory
file(GLOB_RECURSE RUBY_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rb)
foreach(FILE ${RUBY_TESTS})
add_ruby_test(libdnf_cli "${FILE}")
endforeach()