Added some support for bzip2. Still needs configure and lib-rpmrc.in stuff.
CVS patchset: 1983
CVS date: 1998/02/03 15:11:23
(use --relocate <oldpath>=<newpath>, i.e. --relocate /usr=/foo)
- added --badreloc flag to force RPM to relocate files which packages
haven't advertised as relocateable
+ - fix return code on failed uncompresses in %prep
+ - preliminary handling of bzip2 compressed files
2.4.99 -> 2.4.100:
- fixed handling of --rebuild and --recompile
{
char *field = spec->line;
char *end;
+ char **array;
int multiToken = 0;
- int num, rc;
+ int num, rc, len;
/* Find the start of the "field" and strip trailing space */
while ((*field) && (*field != ':')) {
break;
case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field);
+ headerGetEntry(pkg->header, tag, NULL, (void **)&array, &num);
+ while (num--) {
+ len = strlen(array[num]);
+ if (array[num][len - 1] == '/') {
+ rpmError(RPMERR_BADSPEC,
+ "line %d: Prefixes must not end with \"/\": %s",
+ spec->lineNum, spec->line);
+ FREE(array);
+ return RPMERR_BADSPEC;
+ }
+ }
+ FREE(array);
break;
case RPMTAG_DOCDIR:
SINGLE_TOKEN_ONLY;
static int checkOwners(char *file);
static char *doUntar(Spec spec, int c, int quietly);
+#define COMPRESSED_NOT 0
+#define COMPRESSED_OTHER 1
+#define COMPRESSED_BZIP2 2
+
int parsePrep(Spec spec)
{
int nextPart, res;
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi",
- rpmGetVar(RPMVAR_GZIPBIN), file, taropts);
+ (compressed == COMPRESSED_BZIP2) ?
+ rpmGetVar(RPMVAR_GZIPBIN) : rpmGetVar(RPMVAR_BZIP2BIN),
+ file, taropts);
} else {
sprintf(buf, "tar %s %s", taropts, file);
}
sprintf(buf,
"echo \"Patch #%d:\"\n"
"%s -dc %s | patch -p%d %s -s\n"
- "if [ $? -ne 0 ]; then\n"
- " exit $?\n"
+ "STATUS=$?\n"
+ "if [ $STATUS -ne 0 ]; then\n"
+ " exit $STATUS\n"
"fi",
- c, rpmGetVar(RPMVAR_GZIPBIN), file, strip, args);
+ c,
+ (compressed == COMPRESSED_BZIP2) ?
+ rpmGetVar(RPMVAR_GZIPBIN) : rpmGetVar(RPMVAR_BZIP2BIN),
+ file, strip, args);
} else {
sprintf(buf,
"echo \"Patch #%d:\"\n"
int fd;
unsigned char magic[4];
- *compressed = 0;
+ *compressed = COMPRESSED_NOT;
if (!(fd = open(file, O_RDONLY))) {
return 1;
((magic[0] == 0120) && (magic[1] == 0113) &&
(magic[2] == 0003) && (magic[3] == 0004)) /* pkzip */
) {
- *compressed = 1;
+ *compressed = COMPRESSED_OTHER;
+ } else if ((magic[0] == 'B') && (magic[1] == 'Z')) {
+ *compressed = COMPRESSED_BZIP2;
}
return 0;
#define RPMVAR_PROVIDES 38
#define RPMVAR_BUILDSHELL 39
#define RPMVAR_INSTCHANGELOG 40
+#define RPMVAR_BZIP2BIN 41
-#define RPMVAR_NUM 41 /* number of RPMVAR entries */
+#define RPMVAR_NUM 42 /* number of RPMVAR entries */
char * rpmGetVar(int var);
int rpmGetBooleanVar(int var);
{ "builddir", RPMVAR_BUILDDIR, 0, 0 },
{ "buildroot", RPMVAR_BUILDROOT, 0, 0 },
{ "buildshell", RPMVAR_BUILDSHELL, 0, 0 },
+ { "bzip2bin", RPMVAR_BZIP2BIN, 0, 1 },
{ "dbpath", RPMVAR_DBPATH, 0, 1 },
{ "defaultdocdir", RPMVAR_DEFAULTDOCDIR, 0, 0 },
{ "distribution", RPMVAR_DISTRIBUTION, 0, 0 },