9 #define MYALLPERMS 07777
11 #if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX)
12 #include <pcreposix.h>
17 #define _RPMIOB_INTERNAL
22 #define _RPMSX_INTERNAL
28 #define _RPMTAG_INTERNAL
29 #define _RPMFI_INTERNAL
32 #define _RPMTE_INTERNAL
47 #define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
48 #define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
50 #define MAXDOCDIR 1024
72 #define fl_dev fl_st.st_dev
73 #define fl_ino fl_st.st_ino
74 #define fl_mode fl_st.st_mode
75 #define fl_nlink fl_st.st_nlink
76 #define fl_uid fl_st.st_uid
77 #define fl_gid fl_st.st_gid
78 #define fl_rdev fl_st.st_rdev
79 #define fl_size fl_st.st_size
80 #define fl_mtime fl_st.st_mtime
207 static void dumpAttrRec(
const char *
msg,
AttrRec ar)
213 fprintf(stderr,
"(%s, %s, %s, %s)\n",
230 static char *olds =
NULL;
239 s += strspn(s, delim);
248 s = strchr(token,
'"');
250 s = strpbrk(token, delim);
256 olds = strchr(token,
'\0');
286 for (i = 0; i < he->
c; i++) {
287 xx = currentTime - mtime[
i];
288 if (xx < 0) xx = -
xx;
293 mtime =
_free(mtime);
337 unsigned *resultVerify;
339 unsigned verifyFlags;
342 if ((p = strstr(buf, (name =
"%verify"))) !=
NULL) {
345 }
else if ((p = strstr(buf, (name =
"%defverify"))) !=
NULL) {
351 for (pe = p; (size_t)(pe-p) < strlen(name); pe++)
364 for (p = pe; *pe && *pe !=
')'; pe++)
383 for (p = q; *p !=
'\0'; p = pe) {
396 verifyFlags |= vfa->
flag;
412 *resultVerify = negated ? ~(verifyFlags) : verifyFlags;
427 #define isAttrDefault(_ars) ((_ars)[0] == '-' && (_ars)[1] == '\0')
440 const char * errstr =
NULL;
444 if ((p = strstr(buf, (name =
"%dev"))) ==
NULL)
447 for (pe = p; (size_t)(pe-p) < strlen(name); pe++)
458 for (p = pe; *pe && *pe !=
')'; pe++)
485 for (pe = p; *pe &&
xisdigit(*pe); pe++)
503 for (pe = p; *pe &&
xisdigit(*pe); pe++)
547 if ((p = strstr(buf, (name =
"%attr"))) !=
NULL) {
550 }
else if ((p = strstr(buf, (name =
"%defattr"))) !=
NULL) {
556 for (pe = p; (size_t)(pe-p) < strlen(name); pe++)
569 for (p = pe; *pe && *pe !=
')'; pe++)
572 if (ret_ar == &(fl->
def_ar)) {
578 _(
"Non-white space follows %s(): %s\n"), name, q);
609 if (*p !=
'\0' && ret_ar == &(fl->
def_ar)) {
615 if (!(ar->ar_fmodestr && ar->ar_user && ar->ar_group) || *p !=
'\0') {
624 x = sscanf(ar->ar_fmodestr,
"%o", &ui);
625 if ((x == 0) || (ar->ar_fmode & ~
MYALLPERMS)) {
632 ar->ar_fmodestr =
NULL;
636 x = sscanf(ar->ar_dmodestr,
"%o", &ui);
637 if ((x == 0) || (ar->ar_dmode & ~
MYALLPERMS)) {
644 ar->ar_dmodestr =
NULL;
672 if ((p = strstr(buf, (name =
"%config"))) ==
NULL)
678 for (pe = p; (size_t)(pe-p) < strlen(name); pe++)
686 for (p = pe; *pe && *pe !=
')'; pe++)
702 for (p = q; *p !=
'\0'; p = pe) {
710 if (!
strcmp(p,
"missingok")) {
712 }
else if (!
strcmp(p,
"noreplace")) {
726 static int langCmp(
const void * ap,
const void * bp)
729 return strcmp(*(
const char **)ap, *(
const char **)bp);
745 while ((p = strstr(buf, (name =
"%lang"))) !=
NULL) {
747 for (pe = p; (size_t)(pe-p) < strlen(name); pe++)
759 for (pe = p; *pe && *pe !=
')'; pe++)
776 for (p = q; *p !=
'\0'; p = pe) {
788 if (np < 1 || (np == 1 && *p !=
'C') || np >= 32) {
790 _(
"Unusual locale length: \"%.*s\" in %%lang(%s)\n"),
798 for (i = 0; i < fl->
nLangs; i++) {
814 if (*pe ==
',') pe++;
831 static int initialized = 0;
832 static int hasRegex = 0;
833 static regex_t compiledPatt;
834 static char buf[BUFSIZ];
836 regmatch_t matches[2];
842 if (!(patt && *patt !=
'\0'))
844 else if (regcomp(&compiledPatt, patt, REG_EXTENDED))
853 memset(matches, 0,
sizeof(matches));
854 if (! hasRegex || regexec(&compiledPatt, fileName, 2, matches, REG_NOTEOL))
858 s = fileName + matches[1].rm_eo - 1;
859 x = (
int)matches[1].rm_eo - (
int)matches[1].rm_so;
887 {
"%spec", 0, RPMFILE_SPEC },
918 char specialDocBuf[BUFSIZ];
921 specialDocBuf[0] =
'\0';
927 if (!
strcmp(s,
"%docdir")) {
946 #if defined(__LCLINT__)
952 for (vfa = virtualFileAttributes; vfa->
attribute !=
NULL; vfa++) {
984 strcat(specialDocBuf,
" ");
985 strcat(specialDocBuf, s);
991 const char * sfn =
NULL;
996 _(
"File must begin with \"/\": %s\n"), s);
1014 _(
"Can't mix special %%doc with other forms: %s\n"),
1015 (*fileName ? *fileName :
""));
1023 static char *_docdir_fmt =
NULL;
1024 static int oneshot = 0;
1025 const char *ddir, *fmt, *errstr;
1028 if (!(_docdir_fmt && *_docdir_fmt))
1029 _docdir_fmt =
_free(_docdir_fmt);
1032 if (_docdir_fmt ==
NULL)
1033 _docdir_fmt =
xstrdup(
"%{NAME}-%{VERSION}");
1058 mkdir_p =
rpmExpand(
"%{?__mkdir_p}%{!?__mkdir_p:mkdir -p}",
NULL);
1060 mkdir_p =
xstrdup(
"mkdir -p");
1062 mkdir_p =
_free(mkdir_p);
1080 if (compress_doc && *compress_doc !=
'%')
1082 compress_doc =
_free(compress_doc);
1096 const char *a =
NULL;
1098 const char *
b =
NULL;
1115 k = strlen(fileName);
1118 if (l < k && strncmp(fileName, fl->
docDirs[x], l) == 0 && fileName[l] ==
'/')
1138 if (!(S_ISREG(ilp->fl_mode) && ilp->fl_nlink > 1))
1145 if (!S_ISREG(jlp->fl_mode))
1147 if (ilp->fl_nlink != jlp->fl_nlink)
1149 if (ilp->fl_ino != jlp->fl_ino)
1151 if (ilp->fl_dev != jlp->fl_dev)
1161 static int dncmp(
const void * a,
const void *
b)
1164 const char ** aurlp = (
const char **)a;
1165 const char ** burlp = (
const char **)b;
1182 const char ** fileNames;
1184 const char ** dirNames;
1185 const char ** baseNames;
1206 fileNames = he->
p.
argv;
1208 if (!xx || fileNames ==
NULL || count <= 0)
1211 dirNames =
alloca(
sizeof(*dirNames) * count);
1212 baseNames =
alloca(
sizeof(*dirNames) * count);
1213 dirIndexes =
alloca(
sizeof(*dirIndexes) * count);
1219 dirNames[dirIndex] =
"";
1220 for (i = 0; i <
count; i++) {
1221 dirIndexes[
i] = dirIndex;
1222 baseNames[
i] = fileNames[
i];
1227 for (i = 0; i <
count; i++) {
1228 const char ** needle;
1233 if (fileNames[i] ==
NULL)
1235 baseName = strrchr(fileNames[i],
'/') + 1;
1236 len = baseName - fileNames[
i];
1238 savechar = *baseName;
1242 (needle = bsearch(&fileNames[i], dirNames, dirIndex + 1,
sizeof(dirNames[0]),
dncmp)) ==
NULL) {
1244 memcpy(s, fileNames[i], len + 1);
1246 dirIndexes[
i] = ++dirIndex;
1247 dirNames[dirIndex] =
s;
1249 dirIndexes[
i] = needle - dirNames;
1252 *baseName = savechar;
1253 baseNames[
i] = baseName;
1260 he->
p.
ui32p = dirIndexes;
1266 he->
p.
argv = baseNames;
1272 he->
p.
argv = dirNames;
1273 he->
c = dirIndex + 1;
1277 fileNames =
_free(fileNames);
1289 static int oneshot = 0;
1301 dalgo = (isSrc ? source_file_dalgo : binary_file_dalgo);
1336 return ((S_ISREG(flp->fl_mode) && S_ISREG(tlp->fl_mode)) &&
1337 ((flp->fl_nlink > 1) && (flp->fl_nlink == tlp->fl_nlink)) &&
1338 (flp->fl_ino == tlp->fl_ino) &&
1339 (flp->fl_dev == tlp->fl_dev));
1345 for (ilp = fl->
fileList; ilp < flp; ilp++) {
1374 int _addDotSlash = !isSrc;
1385 memset(buf, 0,
sizeof(buf));
1396 skipLen += strlen(fl->
prefix);
1399 for (i = 0, flp = fl->
fileList; i < fl->fileListRecsUsed; i++, flp++) {
1414 int terminate =
rpmExpandNumeric(
"%{?_files_listed_twice_terminate_build}");
1423 if (S_ISDIR(flp->fl_mode)) {
1426 flp[1].fl_mode = flp->fl_mode;
1430 flp[1].fl_mode = flp->fl_mode;
1437 flp[1].fl_uid = flp->fl_uid;
1445 flp[1].fl_gid = flp->fl_gid;
1464 apathlen += (strlen(apath) - skipLen + (_addDotSlash ? 3 : 1));
1467 dpathlen += (strlen(flp->
diskURL) + 2);
1470 if (S_ISREG(flp->fl_mode)) {
1471 if (flp->fl_nlink == 1 || !
seenHardLink(fl, flp, &fileid)) {
1533 { dev_t _dev = flp->fl_rdev;
1545 { dev_t _dev = flp->fl_dev;
1557 { ino_t _ino = flp->fl_ino;
1583 if (S_ISREG(flp->fl_mode)) {
1584 unsigned dflags = 0x01;
1585 #define _mask (RPMVERIFY_FDIGEST|RPMVERIFY_HMAC)
1619 const char * buildRoot;
1622 if (buf[0] ==
'/' &&
strcmp(buildRoot,
"/") &&
1623 !strncmp(buf, buildRoot, strlen(buildRoot))) {
1625 _(
"Symlink points to BuildRoot: %s -> %s\n"),
1656 if (S_ISDIR(flp->fl_mode))
1693 {
static int scareMem = 0;
1698 if (fi ==
NULL)
return;
1705 fi->dnl =
_free(fi->dnl);
1706 fi->bnl =
_free(fi->bnl);
1707 if (!scareMem) fi->dil =
_free(fi->dil);
1710 fi->dnl =
xmalloc(fi->fc *
sizeof(*fi->dnl) + dpathlen + 1);
1711 d = (
char *)(fi->dnl + fi->fc);
1714 fi->bnl =
xmalloc(fi->fc * (
sizeof(*fi->bnl) +
sizeof(*fi->dil)));
1716 fi->dil = (!scareMem)
1717 ?
xcalloc(
sizeof(*fi->dil), fi->fc)
1722 fi->apath =
xmalloc(fi->fc *
sizeof(*fi->apath) + apathlen + 1);
1723 a = (
char *)(fi->apath + fi->fc);
1726 fi->actions =
_free(fi->actions);
1727 fi->actions =
xcalloc(
sizeof(*fi->actions), fi->fc);
1728 fi->fmapflags =
xcalloc(
sizeof(*fi->fmapflags), fi->fc);
1733 fi->fuser =
_free(fi->fuser);
1734 fi->fgroup =
_free(fi->fgroup);
1737 if (fi->dil !=
NULL)
1738 for (i = 0, flp = fl->
fileList; (
unsigned)i < fi->fc; i++, flp++) {
1753 size_t fnlen = strlen(flp->
diskURL);
1754 if (fnlen > fi->fnlen) {
1764 fi->dnl[fi->dil[
i]] = d;
1769 for (b = d; b > fi->dnl[fi->dil[
i]] && *b !=
'/'; b--)
1783 a =
stpcpy(a, (apath + skipLen));
1826 fileList =
_free(fileList);
1848 struct stat * statp)
1858 const char *fileURL =
fn;
1859 struct stat statbuf;
1863 const char *fileUname;
1864 const char *fileGname;
1879 {
const char *fileName;
1883 fileURL += (fileName - fileURL);
1886 const char *
s = fileURL +
nb;
1887 char *
t = (
char *) fileURL;
1888 (
void) memmove(t, s, nb);
1900 if (*fileURL ==
'\0')
1905 const char *prefixTest;
1906 const char *prefixPtr = fl->
prefix;
1909 while (*prefixPtr && *prefixTest && (*prefixTest == *prefixPtr)) {
1913 if (*prefixPtr || (*prefixTest && *prefixTest !=
'/')) {
1922 if (statp ==
NULL) {
1924 memset(statp, 0,
sizeof(*statp));
1926 time_t now = time(
NULL);
1929 statp->st_nlink = 1;
1932 statp->st_dev = statp->st_rdev;
1933 statp->st_mode = (fl->
devtype ==
'b' ? S_IFBLK : S_IFCHR);
1935 statp->st_atime = now;
1936 statp->st_mtime = now;
1937 statp->st_ctime = now;
1938 }
else if (
Lstat(diskURL, statp)) {
1951 if ((! fl->
isDir) && S_ISDIR(statp->st_mode)) {
1958 fileMode = statp->st_mode;
1959 fileUid = statp->st_uid;
1960 fileGid = statp->st_gid;
1981 if (fileUname ==
NULL)
1983 if (fileGname ==
NULL)
1996 flp->
fl_st = *statp;
1997 flp->fl_mode = fileMode;
1998 flp->fl_uid = fileUid;
1999 flp->fl_gid = fileGid;
2003 flp->
uname = fileUname;
2004 flp->
gname = fileGname;
2010 for (i = 0; i < fl->
nLangs; i++)
2014 for (i = 0; i < fl->
nLangs; i++) {
2016 if (i) *ncl++ =
'|';
2057 ftsSet[0] = (
char *) diskURL;
2114 const char * buildURL =
"%{_builddir}/%{?buildsubdir}/";
2116 const char * apkt =
NULL;
2138 if ((xx =
pgpReadPkts(fn, &pkt, (
size_t *)&pktlen)) <= 0) {
2150 if (!(xx == 0 && iob !=
NULL)) {
2154 apkt = (
const char *) iob->b;
2191 const char * fileURL)
2200 const char *diskURL =
NULL;
2207 {
const char * fileName;
2209 if (*fileName !=
'/') {
2240 xx =
rpmGlob(diskURL, &argc, &argv);
2241 if (xx == 0 && argc >= 1) {
2242 for (i = 0; i < argc; i++) {
2244 argv[
i] =
_free(argv[i]);
2263 diskURL =
_free(diskURL);
2272 int installSpecialDoc,
int test)
2283 const char *fileName;
2286 AttrRec specialDocAttrRec = &arbuf;
2287 char *specialDoc =
NULL;
2294 char *saveptr =
NULL;
2297 char *token = strtok_r(filesFiles,
",", &saveptr);
2305 if (*token ==
'/') {
2314 fd =
Fopen(ffn,
"r.fpio");
2318 _(
"Could not open %%files file %s: %s\n"),
2321 filesFiles =
_free(filesFiles);
2328 while (fgets(buf, (
int)
sizeof(buf), f)) {
2332 filesFiles =
_free(filesFiles);
2339 }
while((token = strtok_r(
NULL,
",", &saveptr)) !=
NULL);
2340 filesFiles =
_free(filesFiles);
2344 memset(&fl, 0,
sizeof(fl));
2381 #if defined(RPM_VENDOR_OPENPKG)
2405 for (fp = files; *fp !=
NULL; fp++) {
2413 strncpy(buf, s,
sizeof(buf)-1);
2414 buf[
sizeof(
buf)-1] =
'\0';
2434 for (i = 0; i < fl.
nLangs; i++)
2460 if (fileName ==
NULL)
2465 specialDoc =
_free(specialDoc);
2466 specialDoc =
xstrdup(fileName);
2485 if (installSpecialDoc) {
2486 int _missing_doc_files_terminate_build =
2491 if (rc !=
RPMRC_OK && _missing_doc_files_terminate_build)
2509 for (i = 0; i < fl.
nLangs; i++)
2524 specialDoc =
_free(specialDoc);
2535 "PartialHardlinkSets",
"4.0.4-1");
2553 for (i = 0; i < fl.
nLangs; i++)
2572 static rpmTag classTag = 0xffffffff;
2576 if (classTag == 0xffffffff)
2610 #if defined(RPM_VENDOR_OPENPKG)
2637 for (i = 0; i < spec->
nfoo; i++) {
2638 const char * str = spec->
foo[
i].str;
2665 he->
p.
argv = (
const char **) &s;
2690 #
if defined(RPM_VENDOR_OPENPKG)
2753 rpmiob sourceFiles, *sfp = &sourceFiles;
2760 char _srcdefattr_buf[BUFSIZ];
2768 memset(&fl, 0,
sizeof(fl));
2769 if (_srcdefattr && *_srcdefattr) {
2770 xx =
snprintf(_srcdefattr_buf,
sizeof(_srcdefattr_buf),
"%%defattr %s", _srcdefattr);
2771 _srcdefattr_buf[
sizeof(_srcdefattr_buf)-1] =
'\0';
2787 for (fp = files; *fp !=
NULL; fp++) {
2788 const char * diskURL, *diskPath;
2800 if (*diskURL ==
'!') {
2808 diskPath = strrchr(diskPath,
'/');
2819 diskURL, strerror(
errno));
2823 #if defined(RPM_VENDOR_OPENPKG) || defined(RPM_VENDOR_MANDRIVA)
2826 flp->fl_mode &= S_IFMT;
2858 _srcdefattr =
_free(_srcdefattr);
2873 static const char * av_ckfile[] = {
"%{?__check_files}",
NULL };
2916 rc =
rpmfcExec(av_ckfile, fileList, &iob_stdout, 0);
2921 int _unpackaged_files_terminate_build =
2926 if ((*t !=
'\0') && (*t !=
'\n')) {
2927 rc = (_unpackaged_files_terminate_build) ? 1 : 0;
2929 _(
"Installed (but unpackaged) file(s) found:\n%s"), t);
2943 size_t buildrootL,
int _duplicate_files_terminate_build)
2949 const char *fn1, *fn2;
2973 const char *N1, *N2;
2982 _(
"File(s) packaged into both %s and %s:\n%s"),
2999 int _duplicate_files_terminate_build)
3014 if (fi1 ==
NULL)
continue;
3016 for (pkg2 = pkg1->
next; pkg2; pkg2 = pkg2->
next) {
3022 if (fi2 ==
NULL)
continue;
3024 n +=
fiIntersect(fi1, fi2, buildrootL, _duplicate_files_terminate_build);
3042 char * fifn = (
char *)
xmalloc(pkg->
fi->fnlen + 1);
3044 for(j = 0; j < pkg->
fi->fc; j++) {
3045 const char * dn =
NULL;
3047 strcpy(
stpcpy(fifn, dn), pkg->
fi->bnl[j]);
3071 char **unpackaged =
NULL;
3092 while ((p = strchr(p + 1,
'/'))) {
3093 if (p - fn < buildrootL)
3105 while ((p = strchr(p + 1,
'/'))) {
3113 for (j = 0; j <
n; j++)
3114 if (
strcmp(fn, unpackaged[j]) == 0) {
3122 unpackaged =
xrealloc(unpackaged,
sizeof(*unpackaged) * (n + 1));
3123 unpackaged[n++] =
xstrdup(fn);
3137 for (i = 0; i <
n; i++) {
3139 list =
rpmiobAppend(list, unpackaged[i]+buildrootL, 1);
3140 unpackaged[
i] =
_free(unpackaged[i]);
3142 unpackaged =
_free(unpackaged);
3145 _(
"Unpackaged subdir(s) in %s:\n%s"),
3181 size_t buildrootL = strlen(buildroot);
3183 buildroot =
_free(buildroot);
3224 int _duplicate_files_terminate_build =
3226 int _unpackaged_subdirs_terminate_build =
3231 _duplicate_files_terminate_build)
3234 _unpackaged_subdirs_terminate_build)
const char * getSourceDir(rpmfileAttrs attr)
Return the macro directory location from source file flags.
int headerMacrosUnload(Header h)
Define per-header macros.
static rpmRC processMetadataFile(Package pkg, FileList fl, const char *fileURL, rpmTag tag)
Add a pubkey/policy/icon to a binary package.
qsort(mc->macroTable, mc->firstFree, sizeof(mc->macroTable[0]), compareMacroName)
int rpmfiSetHeader(rpmfi fi, Header h)
Link a header to a file info set.
void handleComments(char *s)
Truncate comment lines.
rpmRC doScript(Spec spec, int what, const char *name, rpmiob iob, int test)
Run a build script, assembled from spec file scriptlet section.
static rpmRC parseForAttr(char *buf, FileList fl)
Parse attr and defattr from file manifest.
FTS * Fts_open(char *const *argv, int options, int(*compar)(const FTSENT **, const FTSENT **))
Create a handle for file hierarchy traversal.
rpmlog(RPMLOG_ERR,"%s\n", buf)
struct rpmte_s * rpmte
An element of a transaction set, i.e.
static char * strtokWithQuotes(char *s, const char *delim)
Strip quotes from strtok(3) string.
enum urltype_e urltype
Supported URL types.
enum specdFlags_e specdFlags
Structures used for an "rpmte" transaction element.
char * xstrdup(const char *str)
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
const char * getGnameS(const char *gname)
Return cached group name.
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
static char *size_t nb
fgets(3) analogue that reads \ continuations.
Package file tree walk data.
rpmsx rpmsxFree(rpmsx sx)
Destroy a SELinux wrapper.
const char * getUname(uid_t uid)
Return cached user name from user id.
int Stat(const char *path, struct stat *st)
stat(2) clone.
static rpmRC genCpioListAndHeader(FileList fl, rpmfi *fip, Header h, int isSrc)
Add file entries to header.
size_t rpmfiFNMaxLen(rpmfi fi)
Return maximum file name length from file info set.
void * rpmfiFNBF(rpmfi fi)
Return FN Bloom filter from file info set.
rpmfi rpmfiFree(rpmfi fi)
Destroy a file info set.
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
unsigned short rpmuint16_t
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
int dodigest(int dalgo, const char *fn, unsigned char *digest, unsigned dflags, size_t *fsizep)
Return digest and size of a file.
static int pkgUnpackagedSubdirs(Package pkg, size_t buildrootL, int _unpackaged_subdirs_terminate_build)
static int checkDuplicateFiles(Spec spec, size_t buildrootL, int _duplicate_files_terminate_build)
Check if the same files are packaged into a few sub-packages.
rpmfi rpmfiNew(const void *_ts, Header h, rpmTag tagN, int flags)
Create and load a file info set.
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
struct FileList_s * FileList
Package file tree walk data.
int processSourceFiles(Spec spec)
Post-build processing for source package.
static rpmRC recurseDir(FileList fl, const char *diskURL)
Add directory (and all of its files) to the package manifest.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
static rpmRC processPackageFiles(Spec spec, Package pkg, int installSpecialDoc, int test)
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
rpmTag tagValue(const char *tagstr)
Return tag value from name.
int rpmiobSlurp(const char *fn, rpmiob *iobp)
pgpArmor pgpReadPkts(const char *fn, rpmuint8_t **pkt, size_t *pktlen)
Parse armored OpenPGP packets from a file.
static int seenHardLink(FileList fl, FileListRec flp, ino_t *fileid)
static int dncmp(const void *a, const void *b)
specdFlags currentSpecdFlags
static int fiIntersect(rpmfi fi1, rpmfi fi2, size_t buildrootL, int _duplicate_files_terminate_build)
enum rpmRC_e rpmRC
RPM return codes.
memset(_r, 0, sizeof(*_r))
int rpmGlob(const char *patterns, int *argcPtr, const char ***argvPtr)
Return URL path(s) from a (URL prefixed) pattern glob.
static rpmRC processBinaryFile(Package pkg, FileList fl, const char *fileURL)
Add a file to a binary package.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
void * xcalloc(size_t nmemb, size_t size)
assert(key->size==sizeof(hdrNum))
static int isHardLink(FileListRec flp, FileListRec tlp)
static rpmuint32_t getDigestAlgo(Header h, int isSrc)
int initSourceHeader(Spec spec, rpmiob *sfp)
Create and initialize header for source package.
struct AttrRec_s * AttrRec
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
rpmuint16_t rpmfiFMode(rpmfi fi)
Return current file mode from file info set.
int Lstat(const char *path, struct stat *st)
lstat(2) clone.
static int packagedDir(Package pkg, const char *d)
const char ** currentLangs
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
int rpmfcExec(ARGV_t av, rpmiob iob_stdin, rpmiob *iob_stdoutp, int failnonzero)
static VFA_t verifyAttrs[]
int Glob_pattern_p(const char *pattern, int quote)
glob_pattern_p(3) clone.
int headerMacrosLoad(Header h)
Define per-header macros.
rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test)
Post-build processing for binary package(s).
static void compressFilelist(Header h)
Convert absolute path tag to (dirname,basename,dirindex) tags.
The FD_t File Handle data structure.
const char * rpmGenPath(const char *urlroot, const char *urlmdir, const char *urlfile)
Merge 3 args into path, any or all of which may be a url.
static rpmRC parseForVerify(char *buf, FileList fl)
Parse verify and defverify from file manifest.
The structure used to store values parsed from a spec file.
FTSENT * Fts_read(FTS *sp)
Return next node in the file hierarchy traversal.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
static VFA_t virtualFileAttributes[]
char * pgpArmorWrap(rpmuint8_t atype, const unsigned char *s, size_t ns)
Wrap a OpenPGP packets in ascii armor for transport.
int Fclose(FD_t fd)
fclose(3) clone.
static rpmRC parseForSimple(Spec spec, Package pkg, char *buf, FileList fl, const char **fileName)
Parse simple attributes (e.g.
static rpmRC parseForConfig(char *buf, FileList fl)
Parse config from file manifest.
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
static int checkUnpackagedSubdirs(Spec spec, size_t buildrootL, int _unpackaged_subdirs_terminate_build)
Check for unpackaged subdirectories.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
static int compareFileListRecs(const void *ap, const void *bp)
Routines to read and write packages.
static int isDoc(FileList fl, const char *fileName)
Test if file is located in a docdir.
static rpmRC parseForLang(char *buf, FileList fl)
Parse lang from file manifest.
int Readlink(const char *path, char *buf, size_t bufsiz)
readlink(2) clone.
static void nullAttrRec(AttrRec ar)
#define isAttrDefault(_ars)
static int langCmp(const void *ap, const void *bp)
int Ferror(FD_t fd)
ferror(3) clone.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
return strcmp(ame->name, bme->name)
static int xisdigit(int c)
const char * docDirs[1024]
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
static int snprintf(char *buf, int nb, const char *fmt,...)
This is the only module users of librpmbuild should need to include.
int xstrcasecmp(const char *s1, const char *s2)
Locale insensitive strcasecmp(3).
rpmfi rpmfiLink(rpmfi fi, const char *msg)
Reference a file info set instance.
struct FileListRec_s * FileListRec
char * stpcpy(char *dest, const char *src)
static void timeCheck(int tc, Header h)
static FileListRec freeFileList(FileListRec fileList, int count)
static void freeAttrRec(AttrRec ar)
rpmRC processScriptFiles(Spec spec, Package pkg)
Append files (if any) to scriptlet tags.
static void dupAttrRec(const AttrRec oar, AttrRec nar)
rpmsx rpmsxNew(const char *fn, unsigned int flags)
Create and load a SELinux wrapper.
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
static void * fdGetFp(FD_t fd)
int Fts_close(FTS *sp)
Destroy a file hierarchy traversal handle.
const char * getUnameS(const char *uname)
Return cached user name.
int expandMacros(void *spec, MacroContext mc, char *sbuf, size_t slen)
Expand macro into buffer.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
rpmuint32_t hashFunctionString(rpmuint32_t h, const void *data, size_t size)
Return hash value of a string.
char * buf
Parse (and execute) macro undefinition.
File state machine to handle archive I/O and system call's.
static PyObject *unsigned char * pkt
The structure used to store values for a package.
int
Save source and expand field into target.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
static int checkUnpackagedFiles(Spec spec)
Check for unpackaged files against what's in the build root.
rpmRC rpmfcGenerateDepends(void *_spec, void *_pkg)
Generate package dependencies.
const char * getGname(gid_t gid)
Return cached group name from group id.
unsigned currentVerifyFlags
static int checkHardLinks(FileList fl)
Verify that file attributes scope over hardlinks correctly.
static rpmRC parseForDev(char *buf, FileList fl)
Parse dev from file manifest.
const char * rpmsxMatch(rpmsx sx, const char *fn, mode_t mode)
Return security context for a file.
static int parseForRegexLang(const char *fileName, char **lang)
int rpmlibNeedsFeature(Header h, const char *feature, const char *featureEVR)
Add rpmlib feature dependency.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
static struct AttrRec_s root_ar
const char * buildRootURL
void providePackageNVR(Header h)
Retrofit an explicit Provides: N = E:V-R dependency into package headers.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
static int addFile(FileList fl, const char *diskURL, struct stat *statp)
Add a file to the package manifest.