Commit 9699821f authored by Michal Čihař's avatar Michal Čihař

Imported Upstream version 4.11.2

parent 2b8c3ad6
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,7 @@ librpmbuild_la_SOURCES = \
parsePolicies.c policies.c \
rpmbuild_internal.h rpmbuild_misc.h
librpmbuild_la_LDFLAGS = -version-info 5:0:2
librpmbuild_la_LDFLAGS = -version-info 5:1:2
librpmbuild_la_LIBADD = \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmio/librpmio.la \
......
# Makefile.in generated by automake 1.12.2 from Makefile.am.
# Makefile.in generated by automake 1.13.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -17,23 +17,51 @@
# Makefile for rpmbuild library.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
......@@ -53,8 +81,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = build
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
......@@ -157,6 +185,23 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
......@@ -400,7 +445,7 @@ librpmbuild_la_SOURCES = \
parsePolicies.c policies.c \
rpmbuild_internal.h rpmbuild_misc.h
librpmbuild_la_LDFLAGS = -version-info 5:0:2
librpmbuild_la_LDFLAGS = -version-info 5:1:2
librpmbuild_la_LIBADD = \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmio/librpmio.la \
......@@ -442,6 +487,7 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-usrlibLTLIBRARIES: $(usrlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(usrlib_LTLIBRARIES)'; test -n "$(usrlibdir)" || list=; \
......@@ -476,6 +522,7 @@ clean-usrlibLTLIBRARIES:
echo rm -f $${locs}; \
rm -f $${locs}; \
}
librpmbuild.la: $(librpmbuild_la_OBJECTS) $(librpmbuild_la_DEPENDENCIES) $(EXTRA_librpmbuild_la_DEPENDENCIES)
$(AM_V_CCLD)$(librpmbuild_la_LINK) -rpath $(usrlibdir) $(librpmbuild_la_OBJECTS) $(librpmbuild_la_LIBADD) $(LIBS)
......@@ -535,26 +582,15 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
......@@ -566,15 +602,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
......@@ -583,9 +615,10 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
......@@ -741,9 +774,9 @@ uninstall-am: uninstall-usrlibLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-usrlibLTLIBRARIES cscopelist ctags \
distclean distclean-compile distclean-generic \
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-usrlibLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
......@@ -753,7 +786,7 @@ uninstall-am: uninstall-usrlibLTLIBRARIES
install-usrlibLTLIBRARIES installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-usrlibLTLIBRARIES
......
This diff is collapsed.
......@@ -8,6 +8,7 @@
#include <errno.h>
#include <netdb.h>
#include <time.h>
#include <sys/wait.h>
#include <rpm/rpmlib.h> /* RPMSIGTAG*, rpmReadPackageFile */
#include <rpm/rpmfileutil.h>
......@@ -255,7 +256,6 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
int xx;
rpmRC rc = RPMRC_OK;
struct rpmtd_s td;
rpmTagVal sizetag;
rpmTagVal payloadtag;
if (pkgidp)
......@@ -375,13 +375,11 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
* such a package.
*/
if (pkg->cpioArchiveSize < UINT32_MAX) {
sizetag = RPMSIGTAG_SIZE;
payloadtag = RPMSIGTAG_PAYLOADSIZE;
} else {
sizetag = RPMSIGTAG_LONGSIZE;
payloadtag = RPMSIGTAG_LONGARCHIVESIZE;
}
(void) rpmGenDigest(sig, sigtarget, sizetag);
(void) rpmGenDigest(sig, sigtarget, RPMSIGTAG_SIZE);
(void) rpmGenDigest(sig, sigtarget, RPMSIGTAG_MD5);
if (SHA1) {
......
......@@ -22,6 +22,8 @@
#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;}
#define WHITELIST_NAME ".-_+%{}"
/**
*/
static const rpmTagVal copyTagsDuringParse[] = {
......@@ -667,7 +669,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
switch (tag) {
case RPMTAG_NAME:
SINGLE_TOKEN_ONLY;
if (rpmCharCheck(spec, field, strlen(field), ".-_+%{}"))
if (rpmCharCheck(spec, field, strlen(field), WHITELIST_NAME))
goto exit;
headerPutString(pkg->header, tag, field);
/* Main pkg name is unknown at the start, populate as soon as we can */
......@@ -983,6 +985,9 @@ int parsePreamble(rpmSpec spec, int initialPackage)
spec->line);
goto exit;
}
if (rpmCharCheck(spec, name, strlen(name), WHITELIST_NAME))
goto exit;
if (!lookupPackage(spec, name, flag, NULL)) {
rpmlog(RPMLOG_ERR, _("Package already exists: %s\n"), spec->line);
......
......@@ -35,11 +35,21 @@ const char * token;
#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;}
static int checkSep(const char *s, char c, char **emsg)
{
const char *sep = strchr(s, c);
if (sep && strchr(sep + 1, c)) {
rasprintf(emsg, "Invalid version (double separator '%c'): %s", c, s);
return 1;
}
return 0;
}
rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
int index, rpmsenseFlags tagflags)
{
const char *r, *re, *v, *ve;
const char *emsg = NULL;
char *emsg = NULL;
char * N = NULL, * EVR = NULL;
rpmTagVal nametag = RPMTAG_NOT_FOUND;
rpmsenseFlags Flags;
......@@ -106,7 +116,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
* the spec's encoding so we only check what we can: plain ascii.
*/
if (isascii(r[0]) && !(risalnum(r[0]) || r[0] == '_' || r[0] == '/')) {
emsg = _("Dependency tokens must begin with alpha-numeric, '_' or '/'");
rasprintf(&emsg, _("Dependency tokens must begin with alpha-numeric, '_' or '/'"));
goto exit;
}
......@@ -131,7 +141,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
continue;
if (r[0] == '/') {
emsg = _("Versioned file name not permitted");
rasprintf(&emsg, _("Versioned file name not permitted"));
goto exit;
}
......@@ -148,18 +158,23 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
if (Flags & RPMSENSE_SENSEMASK) {
if (*v == '\0' || ve == v) {
emsg = _("Version required");
rasprintf(&emsg, _("Version required"));
goto exit;
}
EVR = xmalloc((ve-v) + 1);
rstrlcpy(EVR, v, (ve-v) + 1);
if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}~")) goto exit;
/* While ':' and '-' are valid, only one of each is valid. */
if (checkSep(EVR, '-', &emsg) || checkSep(EVR, ':', &emsg))
goto exit;
re = ve; /* ==> next token after EVR string starts here */
} else
EVR = NULL;
if (addReqProv(pkg, nametag, N, EVR, Flags, index)) {
emsg = _("invalid dependency");
rasprintf(&emsg, _("invalid dependency"));
goto exit;
}
......@@ -178,6 +193,7 @@ exit:
rpmlog(RPMLOG_ERR, _("line %d: %s: %s\n"),
spec->lineNum, emsg, spec->line);
}
free(emsg);
}
free(N);
free(EVR);
......
......@@ -56,6 +56,7 @@ struct rpmfc_s {
rpmstrPool cdict; /*!< file class dictionary */
rpmstrPool ddict; /*!< file depends dictionary */
rpmstrPool pool; /*!< general purpose string storage */
rpmds provides; /*!< (no. provides) package provides */
rpmds requires; /*!< (no. requires) package requires */
};
......@@ -162,16 +163,17 @@ static int rpmfcExpandAppend(ARGV_t * argvp, ARGV_const_t av)
return 0;
}
static rpmds rpmdsSingleNS(rpmTagVal tagN, const char *namespace,
static rpmds rpmdsSingleNS(rpmstrPool pool,
rpmTagVal tagN, const char *namespace,
const char * N, const char * EVR, rpmsenseFlags Flags)
{
rpmds ds = NULL;
if (namespace) {
char *NSN = rpmExpand(namespace, "(", N, ")", NULL);
ds = rpmdsSingle(tagN, NSN, EVR, Flags);
ds = rpmdsSinglePool(pool, tagN, NSN, EVR, Flags);
free(NSN);
} else {
ds = rpmdsSingle(tagN, N, EVR, Flags);
ds = rpmdsSinglePool(pool, tagN, N, EVR, Flags);
}
return ds;
}
......@@ -423,7 +425,7 @@ static ARGV_t runCmd(const char *nsdep, const char *depname,
appendLineStringBuf(sb_stdin, fn);
if (rpmfcExec(av, sb_stdin, &sb_stdout, 0, buildRoot) == 0) {
argvSplit(&output, getStringBuf(sb_stdout), " \t\n\r");
argvSplit(&output, getStringBuf(sb_stdout), "\n\r");
}
argvFree(av);
......@@ -435,6 +437,46 @@ static ARGV_t runCmd(const char *nsdep, const char *depname,
return output;
}
static const char *parseDep(char **depav, int depac,
const char **N, const char **EVR, rpmsenseFlags *Flags)
{
const char *err = NULL;
switch (depac) {
case 1: /* only a name */
*N = depav[0];
*EVR = "";
break;
case 3: /* name, range and version */
for (const char *s = depav[1]; *s; s++) {
switch(*s) {
default:
err = _("bad operator");
break;
case '=':
*Flags |= RPMSENSE_EQUAL;
break;
case '<':
*Flags |= RPMSENSE_LESS;
break;
case '>':
*Flags |= RPMSENSE_GREATER;
break;
}
}
if (!err) {
*N = depav[0];
*EVR = depav[2];
}
break;
default:
err = _("bad format");
break;
}
return err;
}
/**
* Run per-interpreter dependency helper.
* @param fc file classifier
......@@ -443,7 +485,7 @@ static ARGV_t runCmd(const char *nsdep, const char *depname,
* @param depsp fc->provides or fc->requires
* @param dsContext RPMSENSE_FIND_PROVIDES or RPMSENSE_FIND_REQUIRES
* @param tagN RPMTAG_PROVIDENAME or RPMTAG_REQUIRENAME
* @return 0
* @return 0 on success
*/
static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname,
rpmds *depsp, rpmsenseFlags dsContext, rpmTagVal tagN)
......@@ -452,6 +494,7 @@ static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname,
const char * fn = fc->fn[fc->ix];
char *namespace = NULL;
int pac;
int rc = 0;
regex_t *exclude = NULL;
regex_t *exclude_from = NULL;
......@@ -469,40 +512,36 @@ static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname,
exclude = rpmfcAttrReg(depname, NULL, "exclude");
for (int i = 0; i < pac; i++) {
rpmds ds = NULL;
const char *N = pav[i];
const char *EVR = "";
char ** depav = NULL;
int xx, depac = 0;
const char *N = NULL;
const char *EVR = NULL;
const char *err = NULL;
rpmsenseFlags Flags = dsContext;
if (pav[i+1] && strchr("=<>", *pav[i+1])) {
i++;
for (const char *s = pav[i]; *s; s++) {
switch(*s) {
default:
break;
case '=':
Flags |= RPMSENSE_EQUAL;
break;
case '<':
Flags |= RPMSENSE_LESS;
break;
case '>':
Flags |= RPMSENSE_GREATER;
break;
}
}
i++;
EVR = pav[i];
}
ds = rpmdsSingleNS(tagN, namespace, N, EVR, Flags);
if ((xx = poptParseArgvString(pav[i], &depac, (const char ***)&depav)))
err = poptStrerror(xx);
if (!err)
err = parseDep(depav, depac, &N, &EVR, &Flags);
if (!err) {
rpmds ds = rpmdsSingleNS(fc->pool, tagN, namespace, N, EVR, Flags);
/* Add to package and file dependencies unless filtered */
if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0) {
(void) rpmdsMerge(depsp, ds);
rpmfcAddFileDep(fc->ddict, fc->ix, ds, tagN == RPMTAG_PROVIDENAME ? 'P' : 'R');
/* Add to package and file dependencies unless filtered */
if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0) {
(void) rpmdsMerge(depsp, ds);
rpmfcAddFileDep(fc->ddict, fc->ix, ds,
tagN == RPMTAG_PROVIDENAME ? 'P' : 'R');
}
rpmdsFree(ds);
} else {
rpmlog(RPMLOG_ERR, _("invalid dependency (%s): %s\n"),
err, pav[i]);
rc++;
}
rpmdsFree(ds);