diff --git a/client/api.c b/client/api.c index ad602020..5c879264 100644 --- a/client/api.c +++ b/client/api.c @@ -468,6 +468,20 @@ TDNFClean( /* remove the top level repo cache dir if it's not empty */ dwError = TDNFRepoRemoveCacheDir(pTdnf, pRepo); + if (dwError == ERROR_TDNF_SYSTEM_BASE + ENOTEMPTY) + { + /* if we did a 'clean all' the directory should be empty now. If + not we either missed something or someone other than us + put a file there, so warn about it, but don't bail out. + If we did clean just one part it's not expected to be empty + unless the other parts were already cleaned. + */ + if (nCleanType == CLEANTYPE_ALL) + { + pr_err("Cache directory for %s not removed because it's not empty.\n", pRepo->pszId); + } + dwError = 0; + } BAIL_ON_TDNF_ERROR(dwError); pr_info("\n"); diff --git a/client/repolist.c b/client/repolist.c index 5935e9be..6ffc254f 100644 --- a/client/repolist.c +++ b/client/repolist.c @@ -645,42 +645,38 @@ TDNFRepoListFinalize( } /* Now that the overrides are applied, replace config vars - for the repos that are enabled. */ + for all repos. */ for(pRepo = pTdnf->pRepos; pRepo; pRepo = pRepo->pNext) { -// if(pRepo->nEnabled) - if (1) + if(pRepo->pszName) { - if(pRepo->pszName) - { - dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszName); - BAIL_ON_TDNF_ERROR(dwError); - } - if(pRepo->pszBaseUrl) - { - dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszBaseUrl); - BAIL_ON_TDNF_ERROR(dwError); - } - if(pRepo->pszMetaLink) - { - dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszMetaLink); - BAIL_ON_TDNF_ERROR(dwError); - } - - if (pRepo->pszMetaLink) - { - dwError = SolvCreateRepoCacheName(pRepo->pszId, - pRepo->pszMetaLink, - &pRepo->pszCacheName); - } - else if (pRepo->pszBaseUrl) - { - dwError = SolvCreateRepoCacheName(pRepo->pszId, - pRepo->pszBaseUrl, - &pRepo->pszCacheName); - } + dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszName); + BAIL_ON_TDNF_ERROR(dwError); + } + if(pRepo->pszBaseUrl) + { + dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszBaseUrl); + BAIL_ON_TDNF_ERROR(dwError); + } + if(pRepo->pszMetaLink) + { + dwError = TDNFConfigReplaceVars(pTdnf, &pRepo->pszMetaLink); BAIL_ON_TDNF_ERROR(dwError); } + + if (pRepo->pszMetaLink) + { + dwError = SolvCreateRepoCacheName(pRepo->pszId, + pRepo->pszMetaLink, + &pRepo->pszCacheName); + } + else if (pRepo->pszBaseUrl) + { + dwError = SolvCreateRepoCacheName(pRepo->pszId, + pRepo->pszBaseUrl, + &pRepo->pszCacheName); + } + BAIL_ON_TDNF_ERROR(dwError); } cleanup: return dwError; diff --git a/client/repoutils.c b/client/repoutils.c index c00a4607..f501ccab 100644 --- a/client/repoutils.c +++ b/client/repoutils.c @@ -247,13 +247,10 @@ TDNFRepoRemoveCacheDir( &pszRepoCacheDir); BAIL_ON_TDNF_ERROR(dwError); - if (rmdir(pszRepoCacheDir) != 0) + if (rmdir(pszRepoCacheDir) != 0 && errno != ENOENT) { - /* ignore ENOTEMPTY, let's keep the dir if it's not empty */ - if (errno != ENOENT && errno != ENOTEMPTY) - { - BAIL_ON_TDNF_ERROR(errno); - } + dwError = errno; + BAIL_ON_TDNF_SYSTEM_ERROR(dwError); } cleanup: