233fa144598777c6a9c20bbd5c4348e64a0bb276
[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 = "The RPM package management system"
17 #DESCRIPTION = "The RPM Package Manager (RPM) is a powerful command line driven \
18 #package management system capable of installing, uninstalling, \
19 #verifying, querying, and updating software packages. Each software \
20 #package consists of an archive of files along with information about \
21 #the package like its version, a description, etc."
22
23 #SUMMARY_${PN}-dev = "Development files for manipulating RPM packages"
24 #DESCRIPTION_${PN}-dev = "This package contains the RPM C library and header files. These \
25 #development files will simplify the process of writing programs that \
26 #manipulate RPM packages and databases. These files are intended to \
27 #simplify the process of creating graphical package managers or any \
28 #other tools that need an intimate knowledge of RPM packages in order \
29 #to function."
30
31 SUMMARY_python2-rpm = "Python bindings for apps which will manupulate RPM packages"
32 DESCRIPTION_python2-rpm = "The python2-rpm package contains a module that permits applications \
33 written in the Python programming language to use the interface \
34 supplied by the RPM Package Manager libraries."
35
36 HOMEPAGE = "http://www.rpm.org"
37
38 # libraries are also LGPL - how to express this?
39 LICENSE = "GPL-2.0"
40 LIC_FILES_CHKSUM = "file://COPYING;md5=c0bf017c0fd1920e6158a333acabfd4a"
41
42 SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
43            file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \
44            file://0001-Do-not-read-config-files-from-HOME.patch \
45            file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
46            file://0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch \
47            file://0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch \
48            file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \
49            file://0001-Fix-build-with-musl-C-library.patch \
50            file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \
51            file://0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch \
52            file://0001-Split-binary-package-building-into-a-separate-functi.patch \
53            file://0002-Run-binary-package-creation-via-thread-pools.patch \
54            file://0003-rpmstrpool.c-make-operations-over-string-pools-threa.patch \
55            file://0004-build-pack.c-remove-static-local-variables-from-buil.patch \
56            file://0001-perl-disable-auto-reqs.patch \
57            file://0001-rpm-rpmio.c-restrict-virtual-memory-usage-if-limit-s.patch \
58            "
59
60 PE = "1"
61 SRCREV = "753f6941dc32e94047b7cfe713ddd604a810b4db"
62
63 S = "${WORKDIR}/git"
64
65 DEPENDS = "nss libarchive db file popt xz bzip2 dbus elfutils python"
66 DEPENDS_append_class-native = " file-replacement-native bzip2-replacement-native"
67
68 inherit autotools gettext pkgconfig pythonnative
69 export PYTHON_ABI
70
71 # OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe
72 EXTRA_AUTORECONF_append = " --exclude=gnu-configize"
73
74 EXTRA_OECONF_append = " --without-lua --enable-python"
75 EXTRA_OECONF_append_libc-musl = " --disable-nls"
76
77 # --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
78 #
79 # --localstatedir prevents rpm from writing its database to native sysroot when building images
80 #
81 # Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via session dbus even when plugins support is enabled.
82 # Also disable plugins by default for native.
83 EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
84 EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
85
86 BBCLASSEXTEND = "native nativesdk"
87
88 PACKAGECONFIG ??= ""
89 PACKAGECONFIG[imaevm] = "--with-imaevm,,ima-evm-utils"
90
91 ASNEEDED = ""
92
93 # Direct rpm-native to read configuration from our sysroot, not the one it was compiled in
94 # libmagic also has sysroot path contamination, so override it
95
96 #WRAPPER_TOOLS = " \
97 #   ${bindir}/rpm \
98 #   ${bindir}/rpm2archive \
99 #   ${bindir}/rpm2cpio \
100 #   ${bindir}/rpmbuild \
101 #   ${bindir}/rpmdb \
102 #   ${bindir}/rpmgraph \
103 #   ${bindir}/rpmkeys \
104 #   ${bindir}/rpmsign \
105 #   ${bindir}/rpmspec \
106 #   ${libdir}/rpm/rpmdeps \
107 #"
108
109 #do_install_append_class-native() {
110 #        for tool in ${WRAPPER_TOOLS}; do
111 #                create_wrapper ${D}$tool \
112 #                        RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
113 #                        RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
114 #                        MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
115 #                        RPM_NO_CHROOT_FOR_SCRIPTS=1
116 #        done
117 #}
118
119 #do_install_append_class-nativesdk() {
120 #        for tool in ${WRAPPER_TOOLS}; do
121 #                create_wrapper ${D}$tool \
122 #                        RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm \
123 #                        RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \
124 #                        MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc \
125 #                        RPM_NO_CHROOT_FOR_SCRIPTS=1
126 #        done
127 #
128 #        rm -rf ${D}/var
129 #}
130
131 # Rpm's make install creates var/tmp which clashes with base-files packaging
132 #do_install_append_class-target() {
133 #    rm -rf ${D}/var
134 #}
135
136 do_compile_append () {
137         cd python
138         cp -r ../../git/python/* ./
139         python setup.py build
140 }
141
142 do_install_append () {
143         sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
144             ${D}/${libdir}/rpm/macros
145
146         sed -i -e 's|/usr/bin/python|${USRBINPATH}/env ${PYTHON_PN}|' \
147             ${D}${libdir}/rpm/pythondistdeps.py \
148             ${D}${libdir}/rpm/python-macro-helper
149
150         # remove all contents except python2-rpm
151         rm -r ${D}/var
152         rm -r ${D}/usr/share
153         rm -r ${D}/usr/include
154         rm -r ${D}/usr/lib/librpm*
155         rm -r ${D}/usr/lib/pkgconfig
156         # rm -r ${D}/usr/src
157         rm -r ${D}/usr/lib/rpm
158         rm -r ${D}/usr/lib/rpm-plugins
159         # rm -r ${D}/usr/lib/.debug
160         rm -r ${D}/usr/bin
161
162         cd python
163         python setup.py install \
164                 --root=${D} --prefix=/usr \
165                 --install-lib=${PYTHON_SITEPACKAGES_DIR}/ --install-data=${datadir}
166 }
167
168 #FILES_${PN} += "${libdir}/rpm-plugins/*.so \
169 #                ${libdir}/rpm \
170 #               "
171
172 #FILES_${PN}-dev += "${libdir}/rpm-plugins/*.la \
173 #                    "
174
175 PACKAGES = "python2-rpm rpm2-dbg"
176 PROVIDES = "python2-rpm rpm2-dbg"
177 FILES_python2-rpm = " \
178         ${PYTHON_SITEPACKAGES_DIR}/rpm/ \
179         ${PYTHON_SITEPACKAGES_DIR}/rpm-${PV}-py${PYTHON_BASEVERSION}.egg-info \
180         "
181
182 # rpm 5.x was packaging the rpm build tools separately
183 #RPROVIDES_${PN} += "rpm-build"
184
185 RDEPENDS_${PN} = "bash perl python-core"
186 RDEPENDS_python2-rpm = "rpm"
187 DEPENDS_python2-rpm = "rpm"
188 # PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
189
190 # Do not specify a sysroot when compiling on a target.
191 #rpm_package_preprocess () {
192 #       sed -i -e 's:--sysroot[^ ]*::g' \
193 #           ${PKGD}/${libdir}/rpm/macros
194 #}
195