Go to file
Petr Písař 96de93313d build: Fix searching libdnf header files
Previously, a search path for in-source libdnf header files was listed
in the middle of paths for other dependencies. That caused swig to
generate bindings from system header files, possible incompatible with
the in-source library, leading to a build failure like this:

    cd /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python && /usr/bin/cmake -E env SWIG_LIB=/usr/share/swig/4.3.1 /usr/bin/swig -python -DSWIGWORDSIZE64 -DLIBDNF_UNSTABLE_API -outdir /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python -c++ -interface _repo -I/usr/include/gio-unix-2.0 -I/usr/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/json-c -I/usr/include/libxml2 -I/home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0 -I/home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/libdnf/utils -I/usr/include/python3.14 -o /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_repo.dir/repoPYTHON_wrap.cxx /home/test/fedora/ libdnf/libdnf-0.74.0-build/libdnf-0.74.0/bindings/swig/repo.i
    [...]
    /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx: In function ‘PyObject* _wrap_ConfigMain_usr_drift_protected_paths(PyObject*, PyObject*)’:
    /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:23913:54: error: ‘class libdnf::ConfigMain’ has no member named ‘usr_drift_protected_paths’
    23913 |       result = (libdnf::OptionStringList *) &(arg1)->usr_drift_protected_paths();
	  |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes the header search path order by placing both paths to
the in-source header files at the very first place.

Resolve: #1716
2025-07-23 14:45:48 +02:00
.copr copr: Add Copr build files 2025-01-31 17:47:42 -05:00
.github ci: Remove "DNF CI" workflow 2025-06-12 21:40:07 +00:00
.tito Initialized to use tito. 2017-05-05 10:17:20 +02:00
bindings ConfigParser: make splitReleasever public 2025-02-03 15:23:27 +01:00
cmake PGP: Use new librepo PGP API, remove gpgme dependency 2023-08-17 08:48:35 +02:00
data/tests C API: test shell-style variable expressions 2025-02-10 09:30:23 +01:00
docs Release 0.74.0 2025-03-06 16:45:00 -05:00
etc Add a dnf sanitizers wrapper to /etc/profile.d 2020-11-12 18:40:12 +01:00
libdnf Remove unused functions with a bug 2025-06-20 06:24:48 +02:00
plugins example_plugin: Add check after malloc allocation 2023-01-02 10:10:30 +01:00
po Update ko.po 2024-12-18 15:22:22 +01:00
python/hawkey subject-py: Fix memory leak 2024-03-27 10:43:23 +01:00
tests Verify `fopen` return value otherwise we could crash 2025-06-20 06:24:48 +02:00
.clang-format [swdb]: style - use clang-format for swdb sources 2017-10-19 13:51:33 +02:00
.git-commit-template Introduce changelog metadata in commit messages 2020-07-30 13:30:29 +02:00
.gitignore Avoid multilib file conflict in config.h (RhBug:1918818) 2021-01-26 02:52:19 -05:00
.packit.yaml packit: get the copr-build version from specfile 2025-06-17 17:35:03 -04:00
.pre-commit-config.yaml Add pre-commit checks 2023-11-30 12:59:55 +01:00
AUTHORS Mention myself in AUTHORS 2021-04-07 11:23:28 +02:00
CMakeLists.txt build: Fix searching libdnf header files 2025-07-23 14:45:48 +02:00
COPYING Add initial project files 2014-03-28 08:59:27 +00:00
README.md README: Repurpose warning to direct to libdnf5 2025-04-28 10:41:27 +02:00
VERSION.cmake Bump version to 0.75.0 2025-05-29 14:10:32 +02:00
libdnf.spec spec: Consistently use CMake RPM macros 2025-07-21 22:00:11 -04:00

README.md

libdnf

This library provides a high level package-manager. It's core library of dnf, PackageKit and rpm-ostree. It's replacement for deprecated hawkey library which it contains inside and uses librepo under the hood.

⚠️ ⚠️ ⚠️ Note that DNF4 and libdnf are superseded by DNF5 and libdnf5. DNF5 is the default package manager in Fedora as of Fedora 41. New projects should integrate with libdnf5 instead. ⚠️ ⚠️ ⚠️

License

LGPLv2+

Building for Fedora

To install build requirements, run following command:

dnf install check-devel cmake cppunit-devel gcc gcc-c++ glib2-devel gtk-doc json-c-devel libmodulemd-devel librepo-devel libsolv-devel libsolv-tools make python2-devel python3-devel python2-sphinx python3-sphinx python2-breathe python3-breathe rpm-devel sqlite-devel swig libsmartcols-devel

From the checkout dir:

mkdir build
cd build/
cmake .. -DPYTHON_DESIRED=3
make

Building the documentation, from the build/ directory::

make doc

Building RPMs:

tito build --rpm --test

Tests

All unit tests should pass after the build finishes:

cd build
make test

There are two parts of unit tests: unit tests in C and unit tests in Python. To run the C part of the tests manually, from hawkey checkout::

build/tests/test_main tests/repos/

To manually execute the Python tests, from libdnf git checkout directory::

PYTHONPATH=`readlink -f ./build/src/python/` python3 -m unittest discover -bt python/hawkey/tests/ -s python/hawkey/tests/tests/

The PYTHONPATH is unfortunately needed as the Python test suite needs to know where to import the built hawkey modules.

Contribution

Here's the most direct way to get your work merged into the project.

  1. Fork the project

  2. Clone down your fork

  3. Implement your feature or bug fix and commit changes

  4. If the change fixes a bug at Red Hat bugzilla, or if it is important to the end user, add the following block to the commit message:

    = changelog =
    msg:           message to be included in the changelog
    type:          one of: bugfix/enhancement/security (this field is required when message is present)
    resolves:      URLs to bugs or issues resolved by this commit (can be specified multiple times)
    related:       URLs to any related bugs or issues (can be specified multiple times)
    
    • For example::

      = changelog =
      msg: Do not close the database if it wasn't opened
      type: bugfix
      resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1761976
      
    • For your convenience, you can also use git commit template by running the following command in the top-level directory of this project:

      git config commit.template ./.git-commit-template
      
  5. In a separate commit, add your name and email under Libdnf CONTRIBUTORS section in the authors file as a reward for your generosity

  6. Push the branch to your fork

  7. Send a pull request for your branch

Please do not create pull requests with translation (.po) file improvements. Fix the translation on Fedora Weblate <https://translate.fedoraproject.org/projects/dnf/>_ instead.

Documentation

See the hawkey documentation page.

Information internal to the hawkey development is maintained on a github wiki.

Useful links

Bug database: