summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorroot <devnull@localhost>1996-10-30 02:30:01 +0000
committerroot <devnull@localhost>1996-10-30 02:30:01 +0000
commitae2878694cc575240f0cecddca856f58e501453c (patch)
tree2833e2e5c7ec974a77f81d2e286fa0bdc61e84a2 /build
parent02f638f9e098e7b8f1d3de62867638b1ecb2be34 (diff)
downloadrpm-ae2878694cc575240f0cecddca856f58e501453c.tar.gz
rpm-ae2878694cc575240f0cecddca856f58e501453c.tar.bz2
rpm-ae2878694cc575240f0cecddca856f58e501453c.zip
add %patch -E
CVS patchset: 1132 CVS date: 1996/10/30 02:30:01
Diffstat (limited to 'build')
-rw-r--r--build/build.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/build/build.c b/build/build.c
index 9daca7af2..d5ac52e70 100644
--- a/build/build.c
+++ b/build/build.c
@@ -38,7 +38,8 @@ int execPart(Spec s, char *sb, char *name, int builddir, int test);
static int doSetupMacro(Spec spec, StringBuf sb, char *line);
static int doPatchMacro(Spec spec, StringBuf sb, char *line);
static char *do_untar(Spec spec, int c);
-static char *do_patch(Spec spec, int c, int strip, char *dashb, int reverse);
+static char *do_patch(Spec spec, int c, int strip, char *dashb,
+ int reverse, int removeEmpties);
int isCompressed(char *file);
static void doSweep(Spec s);
static int doRmSource(Spec s);
@@ -417,7 +418,8 @@ static char *do_untar(Spec spec, int c)
return buf;
}
-static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
+static char *do_patch(Spec spec, int c, int strip, char *db,
+ int reverse, int removeEmpties)
{
static char buf[1024];
char file[1024];
@@ -449,6 +451,9 @@ static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
if (reverse) {
strcat(args, " -R");
}
+ if (removeEmpties) {
+ strcat(args, " -E");
+ }
if (isCompressed(file)) {
sprintf(buf,
@@ -470,13 +475,13 @@ static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
static int doPatchMacro(Spec spec, StringBuf sb, char *line)
{
char *opt_b;
- int opt_P, opt_p, opt_R;
+ int opt_P, opt_p, opt_R, opt_E;
char *s, *s1;
char buf[1024];
int patch_nums[1024]; /* XXX - we can only handle 1024 patches! */
int patch_index, x;
- opt_P = opt_p = opt_R = 0;
+ opt_P = opt_p = opt_R = opt_E = 0;
opt_b = NULL;
patch_index = 0;
@@ -493,6 +498,8 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
opt_P = 1;
} else if (!strcmp(s, "-R")) {
opt_R = 1;
+ } else if (!strcmp(s, "-E")) {
+ opt_E = 1;
} else if (!strcmp(s, "-b")) {
/* orig suffix */
opt_b = strtok(NULL, " \t\n");
@@ -536,7 +543,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
/* All args processed */
if (! opt_P) {
- s = do_patch(spec, 0, opt_p, opt_b, opt_R);
+ s = do_patch(spec, 0, opt_p, opt_b, opt_R, opt_E);
if (! s) {
return 1;
}
@@ -545,7 +552,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
x = 0;
while (x < patch_index) {
- s = do_patch(spec, patch_nums[x], opt_p, opt_b, opt_R);
+ s = do_patch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
if (! s) {
return 1;
}