fixed rpmExpand usage
This commit is contained in:
parent
8fe647ebd6
commit
4086557633
@ -205,7 +205,7 @@ fprintf(stderr, "*** addMacros\n");
|
||||
}
|
||||
}
|
||||
|
||||
buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
|
||||
buildCmd = rpmExpand("%{?___build_cmd}", " ", buildScript, NULL);
|
||||
(void) poptParseArgvString(buildCmd, &argc, &argv);
|
||||
|
||||
rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
|
||||
|
@ -811,9 +811,9 @@ static int parseForRegexLang(const char * fileName, /*@out@*/ char ** lang)
|
||||
const char *s;
|
||||
|
||||
if (! initialized) {
|
||||
const char *patt = rpmExpand("%{_langpatt}", NULL);
|
||||
const char *patt = rpmExpand("%{?_langpatt}", NULL);
|
||||
int rc = 0;
|
||||
if (!(patt && *patt != '%'))
|
||||
if (!(patt && *patt))
|
||||
rc = 1;
|
||||
else if (regcomp(&compiledPatt, patt, REG_EXTENDED))
|
||||
rc = -1;
|
||||
@ -855,8 +855,8 @@ static int parseForRegexMultiLib(const char *fileName)
|
||||
int rc = 0;
|
||||
|
||||
initialized = 1;
|
||||
patt = rpmExpand("%{_multilibpatt}", NULL);
|
||||
if (!(patt && *patt != '%'))
|
||||
patt = rpmExpand("%{?_multilibpatt}", NULL);
|
||||
if (!(patt && *patt))
|
||||
rc = 1;
|
||||
else if (regcomp(&compiledPatt, patt, REG_EXTENDED | REG_NOSUB))
|
||||
rc = -1;
|
||||
@ -2640,7 +2640,7 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
|
||||
|
||||
Fclose(xfd);
|
||||
|
||||
runCmd = rpmExpand( "%{___build_cmd}", " ", runScript, 0 );
|
||||
runCmd = rpmExpand( "%{?___build_cmd}", " ", runScript, 0 );
|
||||
|
||||
poptParseArgvString(runCmd, &argc, &argv);
|
||||
|
||||
@ -2900,7 +2900,7 @@ static int checkFiles(Spec spec, StringBuf fileList, int fileListLen)
|
||||
|
||||
Fclose(xfd);
|
||||
|
||||
runCmd = rpmExpand( "%{___build_cmd}", " ", runScript, 0 );
|
||||
runCmd = rpmExpand( "%{?___build_cmd}", " ", runScript, 0 );
|
||||
|
||||
if (!((rc = poptParseArgvString(runCmd, &ac, (const char ***)&av)) == 0
|
||||
&& ac > 0 && av != NULL))
|
||||
|
@ -725,7 +725,7 @@ int packageBinaries(Spec spec)
|
||||
|
||||
providePackageNVR(pkg->header);
|
||||
|
||||
{ const char * optflags = rpmExpand("%{optflags}", NULL);
|
||||
{ const char * optflags = rpmExpand("%{?optflags}", NULL);
|
||||
(void) headerAddEntry(pkg->header, RPMTAG_OPTFLAGS, RPM_STRING_TYPE,
|
||||
optflags, 1);
|
||||
optflags = _free(optflags);
|
||||
|
@ -1027,8 +1027,8 @@ int rpmRollback(struct rpmInstallArguments_s * ia, const char ** argv)
|
||||
niids = 0;
|
||||
}
|
||||
|
||||
{ const char * globstr = rpmExpand("%{_repackage_dir}/*.rpm", NULL);
|
||||
if (globstr == NULL || *globstr == '%') {
|
||||
{ const char * globstr = rpmExpand("%{?_repackage_dir}/*.rpm", NULL);
|
||||
if (globstr == NULL || !strcmp(globstr, "/*.rpm")) {
|
||||
globstr = _free(globstr);
|
||||
rc = -1;
|
||||
goto exit;
|
||||
|
@ -1081,13 +1081,13 @@ static void defaultMachine(/*@out@*/ const char ** arch,
|
||||
while (!gotDefaults) {
|
||||
if (!rpmPlatform(platform)) {
|
||||
const char * s;
|
||||
s = rpmExpand("%{_host_cpu}", NULL);
|
||||
s = rpmExpand("%{?_host_cpu}", NULL);
|
||||
if (s) {
|
||||
strncpy(un.machine, s, sizeof(un.machine));
|
||||
un.machine[sizeof(un.machine)-1] = '\0';
|
||||
s = _free(s);
|
||||
}
|
||||
s = rpmExpand("%{_host_os}", NULL);
|
||||
s = rpmExpand("%{?_host_os}", NULL);
|
||||
if (s) {
|
||||
strncpy(un.sysname, s, sizeof(un.sysname));
|
||||
un.sysname[sizeof(un.sysname)-1] = '\0';
|
||||
@ -1843,8 +1843,8 @@ int rpmReadConfigFiles(const char * file, const char * target)
|
||||
/*@=nullstate@*/
|
||||
|
||||
/* Finally set target platform */
|
||||
{ const char *cpu = rpmExpand("%{_target_cpu}", NULL);
|
||||
const char *os = rpmExpand("%{_target_os}", NULL);
|
||||
{ const char *cpu = rpmExpand("%{?_target_cpu}", NULL);
|
||||
const char *os = rpmExpand("%{?_target_os}", NULL);
|
||||
rpmSetMachine(cpu, os);
|
||||
cpu = _free(cpu);
|
||||
os = _free(os);
|
||||
|
@ -1267,14 +1267,14 @@ static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
|
||||
if (!noDocs)
|
||||
noDocs = rpmExpandNumeric("%{?_excludedocs}");
|
||||
|
||||
{ const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
|
||||
if (tmpPath && *tmpPath != '%')
|
||||
{ const char *tmpPath = rpmExpand("%{?_netsharedpath}", NULL);
|
||||
if (tmpPath && *tmpPath)
|
||||
netsharedPaths = splitString(tmpPath, strlen(tmpPath), ':');
|
||||
tmpPath = _free(tmpPath);
|
||||
}
|
||||
|
||||
s = rpmExpand("%{_install_langs}", NULL);
|
||||
if (!(s && *s != '%'))
|
||||
s = rpmExpand("%{?_install_langs}", NULL);
|
||||
if (!(s && *s))
|
||||
s = _free(s);
|
||||
if (s) {
|
||||
languages = (const char **) splitString(s, strlen(s), ':');
|
||||
|
@ -890,8 +890,8 @@ static inline int parseYesNo( const char *s )
|
||||
|
||||
static int wait_for_lock (void)
|
||||
{
|
||||
const char *str = rpmExpand ("%{_wait_for_lock}", NULL);
|
||||
int val = (str && *str != '%') ? parseYesNo (str) : 1;
|
||||
const char *str = rpmExpand ("%{?_wait_for_lock}", NULL);
|
||||
int val = (str && *str) ? parseYesNo (str) : 1;
|
||||
str = _free (str);
|
||||
|
||||
return val;
|
||||
|
@ -359,16 +359,16 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
|
||||
char dbiTagMacro[128];
|
||||
char * dbOpts;
|
||||
|
||||
sprintf(dbiTagMacro, "%%{_dbi_config_%s}", tagName(rpmtag));
|
||||
sprintf(dbiTagMacro, "%%{?_dbi_config_%s}", tagName(rpmtag));
|
||||
/*@-nullpass@*/
|
||||
dbOpts = rpmExpand(dbiTagMacro, NULL);
|
||||
/*@=nullpass@*/
|
||||
if (!(dbOpts && *dbOpts && *dbOpts != '%')) {
|
||||
if (!(dbOpts && *dbOpts)) {
|
||||
dbOpts = _free(dbOpts);
|
||||
/*@-nullpass@*/
|
||||
dbOpts = rpmExpand("%{_dbi_config}", NULL);
|
||||
dbOpts = rpmExpand("%{?_dbi_config}", NULL);
|
||||
/*@=nullpass@*/
|
||||
if (!(dbOpts && *dbOpts && *dbOpts != '%')) {
|
||||
if (!(dbOpts && *dbOpts)) {
|
||||
/*@-nullpass@*/
|
||||
dbOpts = rpmExpand(db3_config_default, NULL);
|
||||
/*@=nullpass@*/
|
||||
|
@ -126,9 +126,9 @@ static void dbiTagsInit(void)
|
||||
int rpmtag;
|
||||
|
||||
/*@-nullpass@*/
|
||||
dbiTagStr = rpmExpand("%{_dbi_tags}", NULL);
|
||||
dbiTagStr = rpmExpand("%{?_dbi_tags}", NULL);
|
||||
/*@=nullpass@*/
|
||||
if (!(dbiTagStr && *dbiTagStr && *dbiTagStr != '%')) {
|
||||
if (!(dbiTagStr && *dbiTagStr)) {
|
||||
dbiTagStr = _free(dbiTagStr);
|
||||
dbiTagStr = xstrdup(_dbiTagStr_default);
|
||||
}
|
||||
|
16
rpmio/url.c
16
rpmio/url.c
@ -268,8 +268,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
|
||||
}
|
||||
|
||||
if (u->proxyh == NULL) {
|
||||
const char *proxy = rpmExpand("%{_ftpproxy}", NULL);
|
||||
if (proxy && *proxy != '%') {
|
||||
const char *proxy = rpmExpand("%{?_ftpproxy}", NULL);
|
||||
if (proxy && *proxy) {
|
||||
/*@observer@*/ const char * host = (u->host ? u->host : "");
|
||||
const char *uu = (u->user ? u->user : "anonymous");
|
||||
char *nu = xmalloc(strlen(uu) + sizeof("@") + strlen(host));
|
||||
@ -281,8 +281,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
|
||||
}
|
||||
|
||||
if (u->proxyp < 0) {
|
||||
const char *proxy = rpmExpand("%{_ftpport}", NULL);
|
||||
if (proxy && *proxy != '%') {
|
||||
const char *proxy = rpmExpand("%{?_ftpport}", NULL);
|
||||
if (proxy && *proxy) {
|
||||
char *end;
|
||||
int port = strtol(proxy, &end, 0);
|
||||
if (!(end && *end == '\0')) {
|
||||
@ -300,15 +300,15 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
|
||||
if (u->urltype == URL_IS_HTTP) {
|
||||
|
||||
if (u->proxyh == NULL) {
|
||||
const char *proxy = rpmExpand("%{_httpproxy}", NULL);
|
||||
if (proxy && *proxy != '%')
|
||||
const char *proxy = rpmExpand("%{?_httpproxy}", NULL);
|
||||
if (proxy && *proxy)
|
||||
u->proxyh = xstrdup(proxy);
|
||||
proxy = _free(proxy);
|
||||
}
|
||||
|
||||
if (u->proxyp < 0) {
|
||||
const char *proxy = rpmExpand("%{_httpport}", NULL);
|
||||
if (proxy && *proxy != '%') {
|
||||
const char *proxy = rpmExpand("%{?_httpport}", NULL);
|
||||
if (proxy && *proxy) {
|
||||
char *end;
|
||||
int port = strtol(proxy, &end, 0);
|
||||
if (!(end && *end == '\0')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user