Skip to content

Commit

Permalink
Merge pull request #486 from oliverkurth/stable-3.5
Browse files Browse the repository at this point in the history
bump version to 3.5.8
  • Loading branch information
oliverkurth authored Jul 16, 2024
2 parents 3e9d007 + ebd15f4 commit fc845f1
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)

project(tdnf VERSION 3.5.7 LANGUAGES C)
project(tdnf VERSION 3.5.8 LANGUAGES C)
set(VERSION ${PROJECT_VERSION})
set(PROJECT_YEAR 2024)

Expand Down
7 changes: 7 additions & 0 deletions client/repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ TDNFInitRepo(
dwError = ERROR_TDNF_INVALID_PARAMETER;
BAIL_ON_TDNF_ERROR(dwError);
}

/* tdnf (and dnf) have an opposite sense of priority, therefore negate it.
tdnf/dnf: lower value prefered
libsolv: higher value prefered
*/
pRepo->priority = -pRepoData->nPriority;

pSolvRepoInfo->pRepo = pRepo;
pSolvRepoInfo->pszRepoCacheDir = pszRepoCacheDir;
pRepo->appdata = pSolvRepoInfo;
Expand Down
60 changes: 60 additions & 0 deletions pytests/tests/test_priority.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# Copyright (C) 2024 Broadcom, Inc. All Rights Reserved.
#
# Licensed under the GNU General Public License v2 (the "License");
# you may not use this file except in compliance with the License. The terms
# of the License are located in the COPYING file of this distribution.
#

import os
import shutil
import pytest

REPODIR = "/root/priority/repo"
REPONAME = "priority-test"
REPOFILENAME = f"{REPONAME}.repo"


@pytest.fixture(scope='function', autouse=True)
def setup_test(utils):

os.makedirs(REPODIR, exist_ok=True)

yield
teardown_test(utils)


def teardown_test(utils):
if os.path.isdir(REPODIR):
shutil.rmtree(REPODIR)
filename = os.path.join(utils.config['repo_path'], "yum.repos.d", REPOFILENAME)
if os.path.isfile(filename):
os.remove(filename)


def test_priority(utils):
pkgname = utils.config['mulversion_pkgname']
pkgname_low = pkgname + "=" + utils.config['mulversion_lower']
ret = utils.run(["tdnf",
"-y", "--nogpgcheck",
"--downloadonly", f"--downloaddir={REPODIR}",
"install", pkgname_low],
)
assert ret['retval'] == 0

ret = utils.run(["createrepo", "."], cwd=REPODIR)
assert ret['retval'] == 0

filename = os.path.join(utils.config['repo_path'], "yum.repos.d", REPOFILENAME)
baseurl = "file://{}".format(REPODIR)

utils.create_repoconf(filename, baseurl, REPONAME)
utils.edit_config({'priority': "25"}, repo=REPONAME)

ret = utils.run(["tdnf",
"-y", "--nogpgcheck",
"install", pkgname],
cwd=REPODIR)
assert ret['retval'] == 0

utils.check_package(pkgname, version=utils.config['mulversion_lower'])
1 change: 1 addition & 0 deletions tdnf.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ BuildRequires: curl-devel
BuildRequires: libxml2-devel
BuildRequires: zlib-devel
BuildRequires: systemd
BuildRequires: sqlite-devel

#metalink plugin
BuildRequires: libxml2-devel
Expand Down
1 change: 1 addition & 0 deletions tools/cli/lib/installcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ JDPkgList(
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Arch", pPkgInfo->pszArch));
CHECK_JD_RC(jd_map_add_fmt(jd_pkg, "Evr", "%s-%s", pPkgInfo->pszVersion, pPkgInfo->pszRelease));
CHECK_JD_RC(jd_map_add_int(jd_pkg, "InstallSize", pPkgInfo->dwInstallSizeBytes));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Repo", pPkgInfo->pszRepoName));

CHECK_JD_RC(jd_list_add_child(jd_list, jd_pkg));
JD_SAFE_DESTROY(jd_pkg);
Expand Down

0 comments on commit fc845f1

Please sign in to comment.