x86上安装diskimage-builder(二)

安装好python2.7

[root@host-10-10-18-131 ~]# ln -s /usr/bin/python2.7  /usr/bin/python
[root@host-10-10-18-131 ~]# ln -s /usr/bin/pip2.7  /usr/bin/pip
[root@host-10-10-18-131 ~]# pip install virtualenv
[root@host-10-10-18-131 ~]# mkdir dib-env
[root@host-10-10-18-131 ~]# virtualenv -p /usr/bin/python2.7 dib-env
created virtual environment CPython2.7.17.final.0-64 in 487ms
  creator CPython2Posix(dest=/root/dib-env, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==20.1.1, setuptools==44.1.1, wheel==0.34.2
  activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator
[root@host-10-10-18-131 ~]# 
[root@host-10-10-18-131 ~]# source dib-env/bin/activate
(dib-env) [root@host-10-10-18-131 ~]# pip install diskimage-builder   -i https://mirrors.aliyun.com/pypi/simple/
(dib-env) [root@host-10-10-18-131 ~]# pip install ironic-python-agent-builder
(dib-env) [root@host-10-10-18-131 ~]# cd dib-env/
(dib-env) [root@host-10-10-18-131 dib-env]# find ./ -name ironic-python-agent-ramdisk
./share/ironic-python-agent-builder/dib/ironic-python-agent-ramdisk
(dib-env) [root@host-10-10-18-131 dib-env]# cd ./share/ironic-python-agent-builder/dib/
(dib-env) [root@host-10-10-18-131 dib]# pwd
/root/dib-env/share/ironic-python-agent-builder/dib
(dib-env) [root@host-10-10-18-131 dib]# cd -
/root/dib-env
(dib-env) [root@host-10-10-18-131 dib-env]# 
(dib-env) [root@host-10-10-18-131 dib-env]# export ELEMENTS_PATH=/root/dib-env/share/ironic-python-agent-builder/dib
(dib-env) [root@host-10-10-18-131 dib-env]# env DIB_DEBUG_TRACE=3 DIB_RELEASE=7  disk-image-create ironic-python-agent-ramdisk  centos  -o ironic-deploy -a x86_64
 ERROR: Package 'ironic-python-agent' requires a different Python: 2.7.5 not in '>=3.6'

https://bugs.launchpad.net/tripleo/+bug/1869161

(dib-env) [root@host-10-10-18-131 dib-env]# pip install http://mirror.mtl01.inap.opendev.org/pypifiles/packages/31/f2/8ced1e395a1b69042d764ca0014ee977a5cbaf8f152bb1de4550093a0ef3/python-heatclient-2.0.0.tar.gz
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting http://mirror.mtl01.inap.opendev.org/pypifiles/packages/31/f2/8ced1e395a1b69042d764ca0014ee977a5cbaf8f152bb1de4550093a0ef3/python-heatclient-2.0.0.tar.gz
  Downloading http://mirror.mtl01.inap.opendev.org/pypifiles/packages/31/f2/8ced1e395a1b69042d764ca0014ee977a5cbaf8f152bb1de4550093a0ef3/python-heatclient-2.0.0.tar.gz (172 kB)
     |████████████████████████████████| 172 kB 145 kB/s 
ERROR: Package 'python-heatclient' requires a different Python: 2.7.17 not in '>=3.6'
(dib-env) [root@host-10-10-18-131 dib-env]# 
2020-06-24 07:47:58.467 | /opt/ironic-python-agent/lib/python2.7/site-packages/pip/_internal/commands/install.py:243: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
2020-06-24 07:47:58.467 |   cmdoptions.check_install_build_global(options)
2020-06-24 07:47:58.493 | sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
2020-06-24 07:47:59.159 | Ignoring pycrypto: markers 'python_version == "3.6"' don't match your environment
2020-06-24 07:47:59.435 | Ignoring salt: markers 'python_version == "3.6"' don't match your environment
2020-06-24 07:47:59.564 | Ignoring dataclasses: markers 'python_version == "3.6"' don't match your environment
2020-06-24 07:47:59.648 | Ignoring importlib-resources: markers 'python_version == "3.6"' don't match your environment
2020-06-24 07:47:59.814 | DEPRECATION: Location-changing options found in --install-option: ['--install-scripts'] from command line. This configuration may cause unexpected behavior and is unsupported. pip 20.2 will remove support for this functionality. A possible replacement is using pip-level options like --user, --prefix, --root, and --target. You can find discussion regarding this at https://github.com/pypa/pip/issues/7309.
2020-06-24 07:47:59.866 | Processing /tmp/ironic-python-agent
2020-06-24 07:48:03.725 | ERROR: Package 'ironic-python-agent' requires a different Python: 2.7.5 not in '>=3.6'
2020-06-24 07:48:03.869 | ++ diskimage_builder/lib/img-functions:run_in_target:60                             :   check_break after-error run_in_target bash
2020-06-24 07:48:03.876 | ++ diskimage_builder/lib/common-functions:check_break:143                           :   egrep -e '(,|^)after-error(,|$)' -q
2020-06-24 07:48:03.876 | ++ diskimage_builder/lib/common-functions:check_break:143 

 安装好python 2.7.5

[root@localhost ~]# python -V
Python 2.7.5
[root@localhost ~]# pip -V
pip 20.1.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@localhost ~]# env DIB_DEBUG_TRACE=3 DIB_RELEASE=7 DIB_PYTHON_VERSION=2 DIB_PYTHON=python2 disk-image-create ironic-python-agent-ramdisk  centos  -o ironic-deploy -a x86_64

export ARCH=x86_64
ironic-python-agent-builder -o x86-ipa --release 7 centos

 ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install

 安装python2.7.5

[root@localhost ~]# pip show ironic-python-agent-builder
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Name: ironic-python-agent-builder
Version: 2.0.0
Summary: Tools and scripts to build Ironic Python Agent
Home-page: https://docs.openstack.org/ironic-python-agent-builder/latest/
Author: OpenStack
Author-email: openstack-discuss@lists.openstack.org
License: UNKNOWN
Location: /usr/lib/python2.7/site-packages
Requires: diskimage-builder
Required-by: 
[root@localhost ~]# cd /usr/lib/python2.7/site-packages/ironic-python-agent-builder
-bash: cd: /usr/lib/python2.7/site-packages/ironic-python-agent-builder: No such file or directory
[root@localhost ~]# cd /usr/lib/python2.7/site-packages/ironic_python_agent_builder
[root@localhost ironic_python_agent_builder]# ls
__init__.py  __init__.pyc
[root@localhost ironic_python_agent_builder]# whereis ironic-python-agent-builder
ironic-python-agent-builder: /usr/bin/ironic-python-agent-builder /usr/share/ironic-python-agent-builder
[root@localhost ironic_python_agent_builder]# cd /usr/share/ironic-python-agent-builder
[root@localhost ironic-python-agent-builder]# ls
dib
[root@localhost ironic-python-agent-builder]# fin
 yum install -y git
[root@host-10-10-18-131 /]# find ./ -name CentOS-7-x86_64-GenericCloud.qcow2.xz
./root/.cache/image-create/CentOS-7-x86_64-GenericCloud.qcow2.xz
chroot /tmp/tmp.sA2gMCOgvI/mnt bin/tar --xattrs '--xattrs-include=*' --xattrs-exclude=security.selinux -cz .

/requirements

git --git-dir=/root/.cache/image-create/source-repositories/requirements_a738fd998f6cf7006cce357bd1411f213ca05cd6/.git fetch -q --prune --update-head-ok https://opendev.org/openstack/requirements
/root/.cache/image-create/source-repositories/requirements_a738fd998f6cf7006cce357bd1411f213ca05cd6

[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/
ironic_agent_e50a8037ee39f9c90c6bf36bda2f594b0cf55085
ironic_python_agent_e50a8037ee39f9c90c6bf36bda2f594b0cf55085
pip_and_virtualenv_50bbba586670cca2803e23f614374b482e595f6a
repositories_flock
requirements_a738fd998f6cf7006cce357bd1411f213ca05cd6
[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/ironic_agent_e50a8037ee39f9c90c6bf36bda2f594b0cf55085/
bindep.txt        imagebuild           lower-constraints.txt    README.rst        setup.cfg              tools
CONTRIBUTING.rst  ironic_python_agent  plugin-requirements.txt  releasenotes      setup.py               tox.ini
doc               LICENSE              proxy.sh                 requirements.txt  test-requirements.txt  zuul.d
[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/ironic_python_agent_e50a8037ee39f9c90c6bf36bda2f594b0cf55085/
bindep.txt        imagebuild           lower-constraints.txt    README.rst        setup.cfg              tools
CONTRIBUTING.rst  ironic_python_agent  plugin-requirements.txt  releasenotes      setup.py               tox.ini
doc               LICENSE              proxy.sh                 requirements.txt  test-requirements.txt  zuul.d
[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/pip_and_virtualenv_50bbba586670cca2803e23f614374b482e595f6a 
/root/.cache/image-create/source-repositories/pip_and_virtualenv_50bbba586670cca2803e23f614374b482e595f6a
[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/re
repositories_flock                                     requirements_a738fd998f6cf7006cce357bd1411f213ca05cd6/
[root@host-10-10-18-131 ~]# ls /root/.cache/image-create/source-repositories/requirements_a738fd998f6cf7006cce357bd1411f213ca05cd6/
babel-test     doc                      playbooks         setup.cfg              tox.ini
bindep.txt     global-requirements.txt  projects.txt      setup.py               update.py
blacklist.txt  MANIFEST.in              README.rst        test-requirements.txt  upper-constraints.txt
detail.py      openstack_requirements   requirements.txt  tools                  upper-constraints-xfails.txt
[root@host-10-10-18-131 ~]# 
env DIB_DEBUG_TRACE=3 DIB_RELEASE=7 DIB_PYTHON_VERSION=2 DIB_PYTHON=python2 disk-image-create ironic-python-agent-ramdisk  centos  -o ironic-deploy -a x86_64

原文地址:https://www.cnblogs.com/dream397/p/13187717.html