1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
diff -p -up rpm-4.10.0/build/parsePrep.c.2006 rpm-4.10.0/build/parsePrep.c
--- rpm-4.10.0/build/parsePrep.c.2006 2012-05-22 10:53:51.000000000 +0000
+++ rpm-4.10.0/build/parsePrep.c 2012-06-15 09:17:31.945151263 +0000
@@ -138,7 +138,10 @@ static char *doUntar(rpmSpec spec, uint3
char *fn = NULL;
char *buf = NULL;
char *tar = NULL;
- const char *taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
+ char taropts[8];
+ char *t;
+ char *rubygemopts = NULL;
+ int rubygem = 0;
struct Source *sp;
rpmCompressedMagic compressed = COMPRESSED_NOT;
@@ -158,6 +161,25 @@ static char *doUntar(rpmSpec spec, uint3
fn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+ t = strrchr(sp->source, '.');
+ if(t && !strcasecmp(t, ".gem"))
+ rubygem = 1;
+
+ t = stpcpy(taropts, "-x");
+ if(rpmIsVerbose() && !quietly)
+ t = stpcpy(t, "vv");
+ if(rubygem)
+ t = stpcpy(t, "m");
+ t = stpcpy(t, "f");
+
+ if (rubygem) {
+ rasprintf(&rubygemopts,
+ "\n"
+ "if [ -f data.tar.gz ]; then\n"
+ " tar %s data.tar.gz\n"
+ "fi", taropts);
+ }
+
/* XXX On non-build parse's, file cannot be stat'd or read */
if (!(spec->flags & RPMSPEC_FORCE) && (rpmFileIsCompressed(fn, &compressed) || checkOwners(fn))) {
goto exit;
@@ -204,7 +226,7 @@ static char *doUntar(rpmSpec spec, uint3
"STATUS=$?\n"
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
- "fi", zipper, fn, tar, taropts);
+ "fi%s", zipper, fn, tar, taropts, rubygem ? rubygemopts : "");
} else {
rasprintf(&buf, "%s '%s'\n"
"STATUS=$?\n"
@@ -214,7 +236,7 @@ static char *doUntar(rpmSpec spec, uint3
}
free(zipper);
} else {
- rasprintf(&buf, "%s %s %s", tar, taropts, fn);
+ rasprintf(&buf, "%s %s %s%s", tar, taropts, fn, rubygem ? rubygemopts : "");
}
exit:
@@ -316,6 +338,20 @@ static int doSetupMacro(rpmSpec spec, co
free(buf);
}
+ /* check if source is a ruby gem */
+ { struct Source *sp;
+ for (sp = spec->sources; sp != NULL; sp = sp->next) {
+ if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == 0)) {
+ break;
+ }
+ }
+ if (sp != NULL) {
+ char *t = strrchr(sp->source, '.');
+ if(t && !strcasecmp(t, ".gem"))
+ createDir = 1;
+ }
+ }
+
/* if necessary, create and cd into the proper dir */
if (createDir) {
buf = rpmExpand("%{__mkdir_p} ", spec->buildSubdir, "\n",
|