summaryrefslogtreecommitdiff
path: root/build/parsePrep.c
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2015-11-05 14:29:21 +0100
committerFlorian Festi <ffesti@redhat.com>2015-11-12 10:51:30 +0100
commit89d1dd0a7c63c7497d334e9f240ce7e36ca89434 (patch)
tree0a04c5e6fd27bfafe95f8569abf20a5dc1b64b62 /build/parsePrep.c
parent9c36ca411332d2718eca339e867561c39abc256b (diff)
downloadrpm-89d1dd0a7c63c7497d334e9f240ce7e36ca89434.tar.gz
Add RubyGems support.
Allow to expand RubyGems .gem file using regular %setup macro and in addition generate also associated .gemspec file.
Diffstat (limited to 'build/parsePrep.c')
-rw-r--r--build/parsePrep.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c
index b94aad244..64477e7aa 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -170,6 +170,7 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
if (compressed != COMPRESSED_NOT) {
char *zipper, *t = NULL;
int needtar = 1;
+ int needgemspec = 0;
switch (compressed) {
case COMPRESSED_NOT: /* XXX can't happen */
@@ -200,6 +201,11 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
t = "%{__7zip} x";
needtar = 0;
break;
+ case COMPRESSED_GEM:
+ t = "%{__gem} unpack";
+ needtar = 0;
+ needgemspec = 1;
+ break;
}
zipper = rpmGetPath(t, NULL);
if (needtar) {
@@ -208,6 +214,22 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi", zipper, fn, tar, taropts);
+ } else if (needgemspec) {
+ char *gem = rpmGetPath("%{__gem}", NULL);
+ char *gemspec = NULL;
+ char gemnameversion[strlen(sp->source) - 3];
+
+ rstrlcpy(gemnameversion, sp->source, strlen(sp->source) - 3);
+ gemspec = rpmGetPath("%{_builddir}/", gemnameversion, ".gemspec", NULL);
+
+ rasprintf(&buf, "%s '%s' && %s spec '%s' --ruby > '%s'\n"
+ "STATUS=$?\n"
+ "if [ $STATUS -ne 0 ]; then\n"
+ " exit $STATUS\n"
+ "fi", zipper, fn, gem, fn, gemspec);
+
+ free(gemspec);
+ free(gem);
} else {
rasprintf(&buf, "%s '%s'\n"
"STATUS=$?\n"