dnf: add support for python2
[pti/rtp.git] / meta-stx / recipes-devtools / dnf / dnf_4.1.0.bbappend
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 DEPENDS += "\
17     python-native \
18     "
19
20 EXTRA_OECMAKE_PY2 = " \
21     -DWITH_MAN=0 \
22     -DPYTHON_INSTALL_DIR=${libdir}/python2.7/site-packages \
23     -DPYTHON_DESIRED:FILEPATH=${STAGING_BINDIR_NATIVE}/python-native/python \
24     "
25
26 RDEPENDS_${PN}_class-target += " \
27     python-codecs \
28     python-compression \
29     python-core \
30     python-curses \
31     python-distutils \
32     python-email \
33     python-fcntl \
34     python-iniparse \
35     python-json \
36     python-logging \
37     python-misc \
38     python-netclient \
39     python-pygpgme \
40     python-pyliblzma \
41     python-shell \
42     python-sqlite3 \
43     python-threading \
44     python2-rpm \
45     "
46
47 do_configure_append() {
48         rm -rf ${B}/build-py2
49         mkdir -p ${B}/build-py2
50         cd ${B}/build-py2
51
52         cmake \
53           ${OECMAKE_GENERATOR_ARGS} \
54           $oecmake_sitefile \
55           ${OECMAKE_SOURCEPATH} \
56           -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
57           -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
58           -DCMAKE_INSTALL_SO_NO_EXE=0 \
59           -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
60           -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
61           ${EXTRA_OECMAKE_PY2} \
62           -Wno-dev
63 }
64
65 cmake_runcmake_build_py2() {
66         bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}/build-py2' "$@" -- ${EXTRA_OECMAKE_BUILD}
67         eval ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}/build-py2' "$@" -- ${EXTRA_OECMAKE_BUILD}
68 }
69
70 do_compile_append() {
71         cd ${B}/build-py2
72         cmake_runcmake_build_py2 --target ${OECMAKE_TARGET_COMPILE}
73 }
74
75 do_install_append() {
76         cd ${B}/build-py2
77         DESTDIR='${D}' cmake_runcmake_build_py2 --target ${OECMAKE_TARGET_INSTALL}
78
79         # add a symlink for yum
80         lnr ${D}/${bindir}/dnf-2 ${D}/${bindir}/yum
81 }
82