be41c8b8799c0a42ea3f0f106973a8054af2a2cb
[pti/rtp.git] / meta-stx / recipes-devtools / rpm / rpm2_4.14.2.bb
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 SUMMARY_python2-rpm = "Python bindings for apps which will manupulate RPM packages"
17 DESCRIPTION_python2-rpm = "The python2-rpm package contains a module that permits applications \
18 written in the Python programming language to use the interface \
19 supplied by the RPM Package Manager libraries."
20
21 HOMEPAGE = "http://www.rpm.org"
22
23 # libraries are also LGPL - how to express this?
24 LICENSE = "GPL-2.0"
25 LIC_FILES_CHKSUM = "file://COPYING;md5=c0bf017c0fd1920e6158a333acabfd4a"
26
27 SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
28            file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \
29            file://0001-Do-not-read-config-files-from-HOME.patch \
30            file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
31            file://0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch \
32            file://0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch \
33            file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \
34            file://0001-Fix-build-with-musl-C-library.patch \
35            file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \
36            file://0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch \
37            file://0001-Split-binary-package-building-into-a-separate-functi.patch \
38            file://0002-Run-binary-package-creation-via-thread-pools.patch \
39            file://0003-rpmstrpool.c-make-operations-over-string-pools-threa.patch \
40            file://0004-build-pack.c-remove-static-local-variables-from-buil.patch \
41            file://0001-perl-disable-auto-reqs.patch \
42            file://0001-rpm-rpmio.c-restrict-virtual-memory-usage-if-limit-s.patch \
43            "
44
45 PE = "1"
46 SRCREV = "753f6941dc32e94047b7cfe713ddd604a810b4db"
47
48 S = "${WORKDIR}/git"
49
50 DEPENDS = "nss libarchive db file popt xz bzip2 dbus elfutils python"
51 DEPENDS_append_class-native = " file-replacement-native bzip2-replacement-native"
52
53 inherit autotools gettext pkgconfig pythonnative
54 export PYTHON_ABI
55
56 # OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe
57 EXTRA_AUTORECONF_append = " --exclude=gnu-configize"
58
59 EXTRA_OECONF_append = " --without-lua --enable-python"
60 EXTRA_OECONF_append_libc-musl = " --disable-nls"
61
62 # --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
63 #
64 # --localstatedir prevents rpm from writing its database to native sysroot when building images
65 #
66 # Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via session dbus even when plugins support is enabled.
67 # Also disable plugins by default for native.
68 EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
69 EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
70
71 BBCLASSEXTEND = "native nativesdk"
72
73 PACKAGECONFIG ??= ""
74 PACKAGECONFIG[imaevm] = "--with-imaevm,,ima-evm-utils"
75
76 ASNEEDED = ""
77
78 do_compile_append () {
79         cd python
80         cp -r ../../git/python/* ./
81         python setup.py build
82 }
83
84 do_install_append () {
85         sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
86             ${D}/${libdir}/rpm/macros
87
88         sed -i -e 's|/usr/bin/python|${USRBINPATH}/env ${PYTHON_PN}|' \
89             ${D}${libdir}/rpm/pythondistdeps.py \
90             ${D}${libdir}/rpm/python-macro-helper
91
92         # remove all contents except python2-rpm
93         rm -r ${D}/var
94         rm -r ${D}/usr/share
95         rm -r ${D}/usr/include
96         rm -r ${D}/usr/lib/librpm*
97         rm -r ${D}/usr/lib/pkgconfig
98         # rm -r ${D}/usr/src
99         rm -r ${D}/usr/lib/rpm
100         rm -r ${D}/usr/lib/rpm-plugins
101         # rm -r ${D}/usr/lib/.debug
102         rm -r ${D}/usr/bin
103
104         cd python
105         python setup.py install \
106                 --root=${D} --prefix=/usr \
107                 --install-lib=${PYTHON_SITEPACKAGES_DIR}/ --install-data=${datadir}
108 }
109
110 PACKAGES = "python2-rpm rpm2-dbg"
111 PROVIDES = "python2-rpm rpm2-dbg"
112 FILES_python2-rpm = " \
113         ${PYTHON_SITEPACKAGES_DIR}/rpm/ \
114         ${PYTHON_SITEPACKAGES_DIR}/rpm-${PV}-py${PYTHON_BASEVERSION}.egg-info \
115         "
116
117 # rpm 5.x was packaging the rpm build tools separately
118 #RPROVIDES_${PN} += "rpm-build"
119
120 RDEPENDS_${PN} = "bash perl python-core"
121 RDEPENDS_python2-rpm = "rpm"
122 DEPENDS_python2-rpm = "rpm"