Skip to content

Commit

Permalink
add --installtodir option
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverkurth committed Jul 18, 2023
1 parent 6119e53 commit 323dbd1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,18 @@ TDNFOpenHandle(
pTdnf->pArgs->pszInstallRoot);
BAIL_ON_TDNF_ERROR(dwError);

if(!pArgs->nAllDeps)
{
if(!pArgs->nAllDeps) {
dwError = SolvReadInstalledRpms(pSack->pPool->installed, pszCacheDir);
BAIL_ON_TDNF_LIBSOLV_ERROR(dwError);
} else if (pArgs->nInstallToDir) {
if (pArgs->nDownloadOnly && !IsNullOrEmptyString(pArgs->pszDownloadDir)) {
dwError = SolvReadRpmsFromDirectory(pSack->pPool->installed, pArgs->pszDownloadDir);
BAIL_ON_TDNF_ERROR(dwError);
} else {
pr_err("--installtodir requires --downloadonly and --downloaddir");
dwError = ERROR_TDNF_INVALID_PARAMETER;
BAIL_ON_TDNF_ERROR(dwError);
}
}

dwError = TDNFLoadRepoData(
Expand Down
1 change: 1 addition & 0 deletions client/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ TDNFCloneCmdArgs(
pCmdArgs->nSkipBroken = pCmdArgsIn->nSkipBroken;
pCmdArgs->nSource = pCmdArgsIn->nSource;
pCmdArgs->nBuildDeps = pCmdArgsIn->nBuildDeps;
pCmdArgs->nInstallToDir = pCmdArgsIn->nInstallToDir;

pCmdArgs->nArgc = pCmdArgsIn->nArgc;
pCmdArgs->ppszArgv = pCmdArgsIn->ppszArgv;
Expand Down
1 change: 1 addition & 0 deletions include/tdnftypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ typedef struct _TDNF_CMD_ARGS
int nSkipBroken;
int nSource;
int nBuildDeps;
int nInstallToDir;
char* pszDownloadDir; //directory for download, if nDownloadOnly is set
char* pszInstallRoot; //set install root
char* pszConfFile; //set conf file location
Expand Down
2 changes: 2 additions & 0 deletions tools/cli/lib/parseargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static struct option pstOptions[] =
{"exclude", required_argument, 0, 0}, //--exclude
{"help", no_argument, 0, 'h'}, //-h --help
{"installroot", required_argument, 0, 'i'}, //--installroot
{"installtodir", no_argument, &_opt.nInstallToDir, 1},
{"json", no_argument, &_opt.nJsonOutput, 1},
{"noautoremove", no_argument, &_opt.nNoAutoRemove, 1},
{"nodeps", no_argument, &_opt.nNoDeps, 1},
Expand Down Expand Up @@ -355,6 +356,7 @@ TDNFCopyOptions(
pArgs->nSkipBroken = pOptionArgs->nSkipBroken;
pArgs->nSource = pOptionArgs->nSource;
pArgs->nBuildDeps = pOptionArgs->nBuildDeps;
pArgs->nInstallToDir = pOptionArgs->nInstallToDir;

cleanup:
return dwError;
Expand Down

0 comments on commit 323dbd1

Please sign in to comment.