Date: Friday, November 22, 2019 @ 16:26:05
  Author: anatolik
Revision: 531965

rpm-tools: add RedHat package manager tools

Added:
  rpm-tools/
  rpm-tools/repos/
  rpm-tools/trunk/
  rpm-tools/trunk/PKGBUILD
  rpm-tools/trunk/rpm-tools.install
  rpm-tools/trunk/rpmextract.sh
  rpm-tools/trunk/rpmlib-filesystem-check.patch

-------------------------------+
 PKGBUILD                      |   75 ++++++++++++++++++++++++
 rpm-tools.install             |    8 ++
 rpmextract.sh                 |    6 +
 rpmlib-filesystem-check.patch |  125 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 214 insertions(+)

Added: rpm-tools/trunk/PKGBUILD
===================================================================
--- rpm-tools/trunk/PKGBUILD                            (rev 0)
+++ rpm-tools/trunk/PKGBUILD    2019-11-22 16:26:05 UTC (rev 531965)
@@ -0,0 +1,75 @@
+# Maintainer: Anatol Pomozov <anatol pomozov at gmail>
+# Contributor: Johannes Dewender  arch at JonnyJD dot net
+# Contributor: Konrad <konrad AT knauber DOT name>
+# Contributor: Luka Perkov <archlinux <at> lukaperkov <dOt> net>
+# Contributor: Fernando M <f <at> beford.net>
+# Author: Wintershade <Wintershade AT google mail DOT com>
+
+pkgname=rpm-tools
+pkgver=4.15.1
+pkgrel=1
+pkgdesc="RPM Package Manager - RPM.org fork, used in major RPM distros"
+arch=('x86_64')
+url='http://www.rpm.org/'
+license=('GPL2')
+depends=('lua' 'file' 'nss' 'popt' 'elfutils' 'libarchive' 'libcap')
+makedepends=('python2' 'python' 'pkg-config' 'lmdb')
+optdepends=('lmdb: systemd inhibit plugin')
+conflicts=('rpm' 'rpmextract')
+options=('!libtool')
+provides=("rpm=${pkgver}" 'rpmextract=1.0-4' 'rpm-org')
+install=rpm-tools.install
+
+_pkgver_major="${pkgver%%.*}"
+_pkgver_major_rem="${pkgver#*.}"
+_pkgver_minor="${_pkgver_major_rem%%.*}"
+_base_pkgver=$_pkgver_major.$_pkgver_minor.x
+
+source=(http://ftp.rpm.org/releases/rpm-$_base_pkgver/rpm-$pkgver.tar.bz2
+       rpmextract.sh
+        rpmlib-filesystem-check.patch)
+sha256sums=('ddef45f9601cd12042edfc9b6e37efcca32814e1e0f4bb8682d08144a3e2d230'
+            '3e5bf450d4628366ba35469ec0530a99cd09ab2616a3d261a3f68270f481f777'
+            'bd0e6dbd458f990268c60324190c6825b234647ecdde08296d2b453dc4bce27a')
+
+prepare() {
+       cd rpm-${pkgver}
+       patch -p1 < ../rpmlib-filesystem-check.patch
+}
+
+build() {
+       cd rpm-${pkgver}
+
+       ./configure \
+               --prefix=/usr  \
+               --sysconfdir=/etc  \
+               --localstatedir=/var \
+               --enable-python \
+               --with-external-db \
+               --with-lua \
+               --with-cap \
+               CPPFLAGS="`pkg-config --cflags nss`" \
+               PYTHON=python2
+       make
+}
+
+package() {
+       cd rpm-${pkgver}
+       make prefix=${pkgdir}/usr localstatedir=${pkgdir}/var install
+       rmdir ${pkgdir}/var/tmp
+       rmdir ${pkgdir}/var
+       # rpmextract using bsdtar, needs libarchive
+       install -m755 ${srcdir}/rpmextract.sh ${pkgdir}/usr/bin/
+
+       # move rpm from /bin to /usr/bin
+       rm ${pkgdir}/usr/bin/rpm{query,verify}
+       cd ${pkgdir}/usr/bin
+       ln -s rpm rpmquery
+       ln -s rpm rpmverify
+
+       # also install python 3 files
+       # building with python 3 files as default doesn't seem to work
+       cd ${srcdir}/rpm-${pkgver}
+       cd python
+       python setup.py install --root="$pkgdir/" --optimize=1
+}


Property changes on: rpm-tools/trunk/PKGBUILD
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: rpm-tools/trunk/rpm-tools.install
===================================================================
--- rpm-tools/trunk/rpm-tools.install                           (rev 0)
+++ rpm-tools/trunk/rpm-tools.install   2019-11-22 16:26:05 UTC (rev 531965)
@@ -0,0 +1,8 @@
+post_install() {
+   echo "    rpm-tools installs RedHat package manager for you."
+   echo "    It is useful for those who wants to create/modify RPM files."
+   echo "    But do not use rpm-tools to install RedHat packages at your 
ArchLinux machine."
+   echo "    It will break your system!"
+   echo "    You will need to go back to Arch wiki and read the installation 
guide again."
+   echo "    You've been warned!"
+}

Added: rpm-tools/trunk/rpmextract.sh
===================================================================
--- rpm-tools/trunk/rpmextract.sh                               (rev 0)
+++ rpm-tools/trunk/rpmextract.sh       2019-11-22 16:26:05 UTC (rev 531965)
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ "$1" = "" -o ! -e "$1" ]; then
+    echo "no package supplied" 1>&2
+   exit 1
+fi
+bsdtar xf $1

Added: rpm-tools/trunk/rpmlib-filesystem-check.patch
===================================================================
--- rpm-tools/trunk/rpmlib-filesystem-check.patch                               
(rev 0)
+++ rpm-tools/trunk/rpmlib-filesystem-check.patch       2019-11-22 16:26:05 UTC 
(rev 531965)
@@ -0,0 +1,125 @@
+diff -up rpm-4.10.90.git11978/lib/depends.c.rpmlib-filesystem-check 
rpm-4.10.90.git11978/lib/depends.c
+--- rpm-4.10.90.git11978/lib/depends.c.rpmlib-filesystem-check 2012-11-01 
09:40:26.000000000 +0200
++++ rpm-4.10.90.git11978/lib/depends.c 2012-11-05 10:53:42.294733695 +0200
+@@ -589,6 +589,109 @@ static int rpmdbProvides(rpmts ts, depCa
+     return rc;
+ }
+ 
++/*
++ * Temporary support for live-conversion of the filesystem hierarchy
++ *   mailto: k...@redhat.com, har...@redhat.com
++ *   https://fedoraproject.org/wiki/Features/UsrMove
++ *
++ *   X-CheckUnifiedSystemdir:
++ *     /bin, /sbin, /lib, /lib64 --> /usr
++ *
++ *   X-CheckUnifiedBindir:
++ *     /usr/sbin -> /usr/bin
++ *
++ *   X-CheckMultiArchLibdir:
++ *     /usr/lib64 /usr/lib/<platform tuple> (e.g. x86_64-linux-gnu)
++ *
++ * This code is not needed for new installations, it can be removed after
++ * updates from older systems are no longer supported: Fedora 19 / RHEL 8.
++ */
++
++static int CheckLink(const char *dir, const char *root)
++{
++    char *d = NULL;
++    struct stat sbuf;
++    int rc = 0;
++
++    if (!root)
++      root = "/";
++
++    rasprintf(&d, "%s%s", root, dir);
++    if (!d) {
++      rc = -1;
++      goto exit;
++    }
++
++    /* directory or symlink does not exist, all is fine */
++    if (lstat(d, &sbuf) < 0) {
++      rc = 1;
++      goto exit;
++    }
++
++    /* if it is a symlink, all is fine */
++    if (S_ISLNK(sbuf.st_mode))
++      rc = 1;
++
++exit:
++    free(d);
++    return rc;
++}
++
++static int CheckFilesystemHierarchy(rpmds * dsp, const char *root)
++{
++    static const char *dirs[] = { "bin", "sbin", "lib", "lib64" };
++    int check;
++    int i;
++    rpmds ds;
++    rpmstrPool pool = rpmdsPool(*dsp);
++    int rc = 0;
++
++    for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) {
++      check = CheckLink(dirs[i], root);
++      if (check < 0) {
++          rc = -1;
++          goto exit;
++      }
++
++      if (check == 0)
++          goto exit;
++    }
++    ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
++                       "rpmlib(X-CheckUnifiedSystemdir)", "1",
++                       RPMSENSE_EQUAL);
++    rpmdsMerge(dsp, ds);
++    rpmdsFree(ds);
++
++    check = CheckLink("usr/lib64", root);
++    if (check < 0) {
++        rc = -1;
++        goto exit;
++    }
++    if (check > 0) {
++      ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
++                           "rpmlib(X-CheckMultiArchLibdir)", "1",
++                           RPMSENSE_EQUAL);
++      rpmdsMerge(dsp, ds);
++      rpmdsFree(ds);
++    }
++
++    check = CheckLink("usr/sbin", root);
++    if (check < 0) {
++      rc = -1;
++      goto exit;
++    }
++    if (check > 0) {
++      ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
++                           "rpmlib(X-CheckUnifiedBindir)", "1",
++                           RPMSENSE_EQUAL);
++      rpmdsMerge(dsp, ds);
++      rpmdsFree(ds);
++    }
++
++exit:
++    return rc;
++}
++
+ /**
+  * Check dep for an unsatisfied dependency.
+  * @param ts          transaction set
+@@ -612,8 +715,10 @@ retry:
+      * Check those dependencies now.
+      */
+     if (dsflags & RPMSENSE_RPMLIB) {
+-      if (tsmem->rpmlib == NULL)
++      if (tsmem->rpmlib == NULL) {
+           rpmdsRpmlibPool(rpmtsPool(ts), &(tsmem->rpmlib), NULL);
++          CheckFilesystemHierarchy(&(tsmem->rpmlib), rpmtsRootDir(ts));
++      }
+       
+       if (tsmem->rpmlib != NULL && rpmdsSearch(tsmem->rpmlib, dep) >= 0) {
+           rpmdsNotify(dep, "(rpmlib provides)", rc);

Reply via email to