Skip to content

Commit

Permalink
Merge pull request #483 from oliverkurth/stable-3.5
Browse files Browse the repository at this point in the history
port PR# 482 (epoch fix) and bump version to 3.5.7
  • Loading branch information
oliverkurth committed Jun 24, 2024
2 parents e1f4e0a + 1572670 commit 3e9d007
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 32 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)

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

# Ensure correct directory paths are used for installation
include(GNUInstallDirs)
Expand Down
21 changes: 7 additions & 14 deletions client/packageutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,15 @@ TDNFPopulatePkgInfoArray(
dwError = SolvGetPackageId(pPkgList, dwPkgIndex, &dwPkgId);
BAIL_ON_TDNF_ERROR(dwError);

dwError = SolvGetPkgNameFromId(pSack, dwPkgId, &pPkgInfo->pszName);
BAIL_ON_TDNF_ERROR(dwError);

dwError = SolvGetPkgArchFromId(pSack, dwPkgId, &pPkgInfo->pszArch);
BAIL_ON_TDNF_ERROR(dwError);

dwError = SolvGetPkgVersionFromId(
pSack,
dwPkgId,
&pPkgInfo->pszVersion);
BAIL_ON_TDNF_ERROR(dwError);

dwError = SolvGetPkgReleaseFromId(
dwError = SolvGetNevraFromId(
pSack,
dwPkgId,
&pPkgInfo->pszRelease);
&pPkgInfo->dwEpoch,
&pPkgInfo->pszName,
&pPkgInfo->pszVersion,
&pPkgInfo->pszRelease,
&pPkgInfo->pszArch,
&pPkgInfo->pszEVR);
BAIL_ON_TDNF_ERROR(dwError);

dwError = SolvGetPkgRepoNameFromId(
Expand Down
4 changes: 3 additions & 1 deletion pytests/tests/test_checksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import shutil
import filecmp
import glob
import platform
import pytest

WORKDIR = '/root/repofrompath/workdir'
ARCH = platform.machine()


@pytest.fixture(scope='module', autouse=True)
Expand Down Expand Up @@ -69,7 +71,7 @@ def test_install_package_with_incorrect_sha512_checksum(utils):
reponame = 'photon-test-sha512'
synced_dir = os.path.join(workdir, reponame)
rpm_dir = os.path.join(synced_dir, 'RPMS')
rpm_dir = os.path.join(rpm_dir, 'x86_64')
rpm_dir = os.path.join(rpm_dir, ARCH)

enable_and_create_repo(utils)
copy_rpm(rpm_dir, 'tdnf-test-one', 'tdnf-test-two')
Expand Down
24 changes: 9 additions & 15 deletions tools/cli/lib/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ TDNFCliListPackagesPrint(

CHECK_JD_RC(jd_map_add_string(jd_pkg, "Name", pPkg->pszName));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Arch", pPkg->pszArch));
CHECK_JD_RC(jd_map_add_fmt(jd_pkg, "Evr", "%s-%s", pPkg->pszVersion, pPkg->pszRelease));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Evr", pPkg->pszEVR));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Repo", pPkg->pszRepoName));

CHECK_JD_RC(jd_list_add_child(jd, jd_pkg));
Expand Down Expand Up @@ -183,13 +183,8 @@ TDNFCliListPackagesPrint(
}

memset(szVersionAndRelease, 0, MAX_COL_LEN);
if(snprintf(
szVersionAndRelease,
MAX_COL_LEN,
"%s-%s ",
pPkg->pszVersion,
pPkg->pszRelease) < 0)
{
if (snprintf(szVersionAndRelease, MAX_COL_LEN, "%s ",
pPkg->pszEVR) < 0) {
dwError = errno;
BAIL_ON_CLI_ERROR(dwError);
}
Expand Down Expand Up @@ -313,7 +308,7 @@ TDNFCliInfoCommand(

CHECK_JD_RC(jd_map_add_string(jd_pkg, "Name", pPkg->pszName));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Arch", pPkg->pszArch));
CHECK_JD_RC(jd_map_add_fmt(jd_pkg, "Evr", "%s-%s", pPkg->pszVersion, pPkg->pszRelease));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Evr", pPkg->pszEVR));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Repo", pPkg->pszRepoName));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Url", pPkg->pszURL));
CHECK_JD_RC(jd_map_add_int(jd_pkg, "InstallSize", pPkg->dwInstallSizeBytes));
Expand Down Expand Up @@ -607,7 +602,7 @@ TDNFCliProvidesCommand(

CHECK_JD_RC(jd_map_add_string(jd_pkg, "Name", pPkg->pszName));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Arch", pPkg->pszArch));
CHECK_JD_RC(jd_map_add_fmt(jd_pkg, "Evr", "%s-%s", pPkg->pszVersion, pPkg->pszRelease));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Evr", pPkg->pszEVR));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Summary", pPkg->pszSummary));

CHECK_JD_RC(jd_list_add_child(jd, jd_pkg));
Expand All @@ -620,10 +615,9 @@ TDNFCliProvidesCommand(
{
for(pPkg = pPkgInfos; pPkg; pPkg = pPkg->pNext)
{
pr_crit("%s-%s-%s.%s : %s\n",
pr_crit("%s-%s.%s : %s\n",
pPkg->pszName,
pPkg->pszVersion,
pPkg->pszRelease,
pPkg->pszEVR,
pPkg->pszArch,
pPkg->pszSummary);
pr_crit("Repo\t : %s\n", pPkg->pszRepoName);
Expand Down Expand Up @@ -725,7 +719,7 @@ TDNFCliRepoQueryCommand(

CHECK_JD_RC(jd_map_add_string(jd_pkg, "Name", pPkgInfo->pszName));
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_string(jd_pkg, "Evr", pPkgInfo->pszEVR));
CHECK_JD_RC(jd_map_add_string(jd_pkg, "Repo", pPkgInfo->pszRepoName));

if (pPkgInfo->ppszFileList)
Expand Down Expand Up @@ -947,7 +941,7 @@ TDNFCliCheckUpdateCommand(
{
pPkg = &pPkgInfo[dwIndex];
pr_crit("%*s\r", 80, pPkg->pszRepoName);
pr_crit("%*s-%s\r", 50, pPkg->pszVersion, pPkg->pszRelease);
pr_crit("%%s\r", 50, pPkg->pszEVR);
pr_crit("%s.%s", pPkg->pszName, pPkg->pszArch);
pr_crit("\n");
}
Expand Down
6 changes: 6 additions & 0 deletions tools/cli/lib/parseargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ TDNFCliParseArgs(

while (optind < argc)
{
if (argv[optind][0] == 0) {
pr_err("argument is empty string\n");
dwError = ERROR_TDNF_INVALID_PARAMETER;
BAIL_ON_CLI_ERROR(dwError);
}

dwError = TDNFAllocateString(
argv[optind++],
&pCmdArgs->ppszCmds[nIndex++]);
Expand Down

0 comments on commit 3e9d007

Please sign in to comment.