From: Marcin Krol Date: Fri, 23 Feb 2018 11:59:58 +0000 (+0000) Subject: - backported from PLD rpm 5.x changes required to build from .gem sources X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=121ce9a6ea5282c651883e86ab212c39c6e09784;p=packages%2Frpm.git - backported from PLD rpm 5.x changes required to build from .gem sources --- diff --git a/rpm-ruby-gem-build.patch b/rpm-ruby-gem-build.patch new file mode 100644 index 0000000..a0c2006 --- /dev/null +++ b/rpm-ruby-gem-build.patch @@ -0,0 +1,114 @@ +diff -urpa rpm-4.5.orig/build/parsePrep.c rpm-4.5/build/parsePrep.c +--- rpm-4.5.orig/build/parsePrep.c 2007-11-08 00:26:48.000000000 +0000 ++++ rpm-4.5/build/parsePrep.c 2018-02-23 11:51:54.161446282 +0000 +@@ -189,11 +189,13 @@ static const char *doUntar(Spec spec, in + { + 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)) { +@@ -205,8 +207,18 @@ static const char *doUntar(Spec spec, in + return NULL; + } + ++ t = strrchr(sp->source, '.'); ++ if(t && !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@*/ + + Lurlfn = rpmGenPath(NULL, "%{_sourcedir}/", sp->source); +@@ -233,6 +245,12 @@ static const char *doUntar(Spec spec, in + /*@notreached@*/ break; + } + ++ tar = rpmGetPath("%{?__tar}", NULL); ++ if (!(tar && *tar != '\0')) { ++ tar = _free(tar); ++ tar = xstrdup("tar"); ++ } ++ + if (compressed != COMPRESSED_NOT) { + const char *zipper; + int needtar = 1; +@@ -267,8 +285,13 @@ static const char *doUntar(Spec spec, in + *t++ = '\''; + t = stpcpy(t, fn); + *t++ = '\''; +- if (needtar) +- t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -"); ++ if (needtar) { ++ t = stpcpy(t, " | "); ++ t = stpcpy(t, tar); ++ t = stpcpy(t, " "); ++ t = stpcpy(t, taropts); ++ t = stpcpy(t, " -"); ++ } + t = stpcpy(t, + "\n" + "STATUS=$?\n" +@@ -277,11 +300,24 @@ static const char *doUntar(Spec spec, in + "fi"); + } else { + buf[0] = '\0'; +- t = stpcpy( stpcpy(buf, "tar "), taropts); ++ t = stpcpy(buf, tar); ++ t = stpcpy(t, " "); ++ 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); + Lurlfn = _free(Lurlfn); + return buf; + } +@@ -390,6 +426,20 @@ static int doSetupMacro(Spec spec, char + appendLineStringBuf(spec->prep, buf); + } + ++ /* 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 = strrchr(sp->source, '.'); ++ if(t && !strcasecmp(t, ".gem")) ++ createDir = 1; ++ } ++ } ++ + /* if necessary, create and cd into the proper dir */ + if (createDir) { + sprintf(buf, MKDIR_P " '%s'\ncd '%s'", diff --git a/rpm.spec b/rpm.spec index edfc4e6..c2f5b38 100644 --- a/rpm.spec +++ b/rpm.spec @@ -42,7 +42,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 4.5 -Release: 81 +Release: 82 License: LGPL Group: Base Source0: %{name}-%{version}.tar.gz @@ -171,8 +171,9 @@ Patch108: %{name}-changelog_order_check_nonfatal.patch Patch109: %{name}-installplatform.patch Patch110: %{name}-xz.patch Patch111: %{name}-shrink.patch -Patch112: %{name}-rubyprov.patch -Patch113: notrans.patch +Patch112: notrans.patch +Patch113: %{name}-rubyprov.patch +Patch114: %{name}-ruby-gem-build.patch URL: http://rpm5.org/ BuildRequires: autoconf >= 2.57 BuildRequires: automake >= 1.4 @@ -813,6 +814,7 @@ install %{SOURCE13} scripts/perl.prov %patch111 -p1 %patch112 -p1 %patch113 -p1 +%patch114 -p1 mv -f po/{sr,sr@Latn}.po rm -rf sqlite zlib popt