1 diff -urpa rpm-4.5.orig/build/parsePrep.c rpm-4.5/build/parsePrep.c
2 --- rpm-4.5.orig/build/parsePrep.c 2007-11-08 00:26:48.000000000 +0000
3 +++ rpm-4.5/build/parsePrep.c 2018-02-23 11:51:54.161446282 +0000
4 @@ -189,11 +189,13 @@ static const char *doUntar(Spec spec, in
6 const char *fn, *Lurlfn;
7 static char buf[BUFSIZ];
12 rpmCompressedMagic compressed = COMPRESSED_NOT;
17 for (sp = spec->sources; sp != NULL; sp = sp->next) {
18 if ((sp->flags & RPMFILE_SOURCE) && (sp->num == c)) {
19 @@ -205,8 +207,18 @@ static const char *doUntar(Spec spec, in
23 + t = strrchr(sp->source, '.');
24 + if(t && !strcasecmp(t, ".gem"))
27 + t = stpcpy(taropts, "-x");
28 /*@-internalglobs@*/ /* FIX: shrug */
29 - taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
30 + if(rpmIsVerbose() && !quietly)
31 + t = stpcpy(t, "vv");
38 Lurlfn = rpmGenPath(NULL, "%{_sourcedir}/", sp->source);
39 @@ -233,6 +245,12 @@ static const char *doUntar(Spec spec, in
40 /*@notreached@*/ break;
43 + tar = rpmGetPath("%{?__tar}", NULL);
44 + if (!(tar && *tar != '\0')) {
46 + tar = xstrdup("tar");
49 if (compressed != COMPRESSED_NOT) {
52 @@ -267,8 +285,13 @@ static const char *doUntar(Spec spec, in
57 - t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -");
59 + t = stpcpy(t, " | ");
62 + t = stpcpy(t, taropts);
63 + t = stpcpy(t, " -");
68 @@ -277,11 +300,24 @@ static const char *doUntar(Spec spec, in
72 - t = stpcpy( stpcpy(buf, "tar "), taropts);
73 + t = stpcpy(buf, tar);
75 + t = stpcpy(t, taropts);
81 + "if [ -f data.tar.gz ]; then\n"
83 + t = stpcpy(t, taropts);
91 Lurlfn = _free(Lurlfn);
94 @@ -390,6 +426,20 @@ static int doSetupMacro(Spec spec, char
95 appendLineStringBuf(spec->prep, buf);
98 + /* check if source is a ruby gem */
99 + { struct Source *sp;
100 + for (sp = spec->sources; sp != NULL; sp = sp->next) {
101 + if ((sp->flags & RPMFILE_SOURCE) && (sp->num == 0)) {
106 + char *t = strrchr(sp->source, '.');
107 + if(t && !strcasecmp(t, ".gem"))
112 /* if necessary, create and cd into the proper dir */
114 sprintf(buf, MKDIR_P " '%s'\ncd '%s'",