RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Per Øyvind Karlsen Root: /v/rpm/cvs Email: pkarl...@rpm5.org Module: rpm Date: 18-Oct-2010 13:27:13 Branch: HEAD Handle: 2010101811271200 Modified files: rpm CHANGES rpm/build parsePrep.c rpm/macros ruby.in Log: ditch %gem_unpack macro and make %setup automatically handle ruby gem extraction in stead. Summary: Revision Changes Path 1.3478 +2 -0 rpm/CHANGES 2.131 +37 -2 rpm/build/parsePrep.c 1.4 +0 -5 rpm/macros/ruby.in ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3477 -r1.3478 CHANGES --- rpm/CHANGES 18 Oct 2010 05:46:19 -0000 1.3477 +++ rpm/CHANGES 18 Oct 2010 11:27:12 -0000 1.3478 @@ -1,4 +1,6 @@ 5.3.4 -> 5.4a1: + proyvind: ditch %gem_unpack macro and make %setup automatically handle + ruby gem extraction in stead. - jbj: sqlite: fix: permit building without sqlite, <db51/dbsql.h> instead. - jbj: beecrypt: fix: polluted builds due to my brain fart. revert. - jbj: popt: permit builds with --with-popt=internal all over again. todo++. @@ . patch -p0 <<'@@ .' Index: rpm/build/parsePrep.c ============================================================================ $ cvs diff -u -r2.130 -r2.131 parsePrep.c --- rpm/build/parsePrep.c 16 Mar 2009 21:06:44 -0000 2.130 +++ rpm/build/parsePrep.c 18 Oct 2010 11:27:12 -0000 2.131 @@ -218,12 +218,13 @@ { const char *fn, *Lurlfn; static char buf[BUFSIZ]; - char *taropts; + char taropts[8]; char *t = NULL; struct Source *sp; rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; const char *tar; + int rubygem = 0; for (sp = spec->sources; sp != NULL; sp = sp->next) { if ((sp->flags & RPMFILE_SOURCE) && (sp->num == c)) { @@ -235,8 +236,18 @@ return NULL; } + t = rindex(sp->source, '.'); + if(!strcasecmp(t, ".gem")) + rubygem = 1; + + t = stpcpy(taropts, "-x"); /*...@-internalglobs@*/ /* FIX: shrug */ - taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf"); + if(rpmIsVerbose() && !quietly) + t = stpcpy(t, "vv"); + if(rubygem) + t = stpcpy(t, "m"); + + t = stpcpy(t, "f"); /*...@=internalglobs@*/ #if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */ @@ -350,6 +361,16 @@ t = stpcpy(t, taropts); *t++ = ' '; t = stpcpy(t, fn); + if(rubygem) { + t = stpcpy(t, + "\n" + "if [ -f data.tar.gz ]; then\n" + " tar "); + t = stpcpy(t, taropts); + t = stpcpy(t, + " data.tar.gz\n" + "fi"); + } } tar = _free(tar); @@ -465,6 +486,20 @@ spec->prep = rpmiobAppend(spec->prep, buf, 1); } + /* check if source is a ruby gem */ + { struct Source *sp; + for (sp = spec->sources; sp != NULL; sp = sp->next) { + if ((sp->flags & RPMFILE_SOURCE) && (sp->num == 0)) { + break; + } + } + if (sp != NULL) { + char *t = rindex(sp->source, '.'); + if(!strcasecmp(t, ".gem")) + createDir = 1; + } + } + /* if necessary, create and cd into the proper dir */ if (createDir) { char *mkdir_p; @@ . patch -p0 <<'@@ .' Index: rpm/macros/ruby.in ============================================================================ $ cvs diff -u -r1.3 -r1.4 ruby.in --- rpm/macros/ruby.in 16 Oct 2010 21:56:34 -0000 1.3 +++ rpm/macros/ruby.in 18 Oct 2010 11:27:12 -0000 1.4 @@ -22,11 +22,6 @@ %ruby_gemdir %(%{__ruby} -rrbconfig -e 'include Config; print CONFIG["rubylibdir"].sub(CONFIG["ruby_version"], "gems/#{CONFIG["ruby_version"]}")') %ruby_ridir %(%{__ruby} -rrbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"])') -%gem_unpack(n:a:) \ - %{expand: %%global __tar tar -m} \ -%setup -q -c -T -a0 %{-n:-n %{-n*}} %{-a:-a %{-a*}} \ -%{__tar}zxf data.tar.gz - %__gem_helper %{_usrlibrpm}/gem_helper.rb %gem_build(f:j:) \ @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org