Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obdeploy
提交
f3550636
O
obdeploy
项目概览
oceanbase
/
obdeploy
1 年多 前同步成功
通知
7
Star
73
Fork
132
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obdeploy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f3550636
编写于
7月 13, 2022
作者:
F
frf12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v1.4.0
上级
af46c220
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
27 deletion
+22
-27
_arch.py
_arch.py
+22
-27
未找到文件。
_arch.py
浏览文件 @
f3550636
# coding: utf-8
# OceanBase Deploy.
# Copyright (C) 2021 OceanBase
#
# This file is part of OceanBase Deploy.
#
# OceanBase Deploy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OceanBase Deploy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OceanBase Deploy. If not, see <https://www.gnu.org/licenses/>.
import
os
import
ctypes
import
struct
...
...
@@ -23,12 +6,13 @@ import struct
_ppc64_native_is_best
=
True
# dict mapping arch -> ( multicompat, best personality, biarch personality )
multilibArches
=
{
"x86_64"
:
(
"athlon"
,
"x86_64"
,
"athlon"
),
"sparc64v"
:
(
"sparcv9v"
,
"sparcv9v"
,
"sparc64v"
),
"sparc64"
:
(
"sparcv9"
,
"sparcv9"
,
"sparc64"
),
"ppc64"
:
(
"ppc"
,
"ppc"
,
"ppc64"
),
"s390x"
:
(
"s390"
,
"s390x"
,
"s390"
),
}
multilibArches
=
{
"x86_64"
:
(
"athlon"
,
"x86_64"
,
"athlon"
),
"sparc64v"
:
(
"sparcv9v"
,
"sparcv9v"
,
"sparc64v"
),
"sparc64"
:
(
"sparcv9"
,
"sparcv9"
,
"sparc64"
),
"ppc64"
:
(
"ppc"
,
"ppc"
,
"ppc64"
),
"s390x"
:
(
"s390"
,
"s390x"
,
"s390"
),
}
if
_ppc64_native_is_best
:
multilibArches
[
"ppc64"
]
=
(
"ppc"
,
"ppc64"
,
"ppc64"
)
...
...
@@ -103,14 +87,15 @@ arches = {
#itanium
"ia64"
:
"noarch"
,
}
}
# Will contain information parsed from /proc/self/auxv via _parse_auxv().
# Should move into rpm really.
_aux_vector
=
{
"platform"
:
""
,
"hwcap"
:
0
,
}
}
def
_try_read_cpuinfo
():
""" Try to read /proc/cpuinfo ... if we can't ignore errors (ie. proc not
...
...
@@ -120,6 +105,7 @@ def _try_read_cpuinfo():
except
:
return
[]
def
_parse_auxv
():
""" Read /proc/self/auxv and parse it into global dict for easier access
later on, very similar to what rpm does. """
...
...
@@ -146,6 +132,7 @@ def _parse_auxv():
_aux_vector
[
"hwcap"
]
=
at_val
offset
=
offset
+
fmtlen
def
getCanonX86Arch
(
arch
):
#
if
arch
==
"i586"
:
...
...
@@ -171,6 +158,7 @@ def getCanonX86Arch(arch):
return
arch
def
getCanonARMArch
(
arch
):
# the %{_target_arch} macro in rpm will let us know the abi we are using
try
:
...
...
@@ -182,6 +170,7 @@ def getCanonARMArch(arch):
pass
return
arch
def
getCanonPPCArch
(
arch
):
# FIXME: should I do better handling for mac, etc?
if
arch
!=
"ppc64"
:
...
...
@@ -212,6 +201,7 @@ def getCanonPPCArch(arch):
return
"ppc64iseries"
return
arch
def
getCanonSPARCArch
(
arch
):
# Deal with sun4v, sun4u, sun4m cases
SPARCtype
=
None
...
...
@@ -253,7 +243,8 @@ def getCanonX86_64Arch(arch):
if
vendor
.
find
(
"GenuineIntel"
)
!=
-
1
:
return
"ia32e"
return
arch
def
getCanonArch
(
skipRpmPlatform
=
0
):
if
not
skipRpmPlatform
and
os
.
access
(
"/etc/rpm/platform"
,
os
.
R_OK
):
try
:
...
...
@@ -282,8 +273,10 @@ def getCanonArch(skipRpmPlatform = 0):
return
getCanonX86_64Arch
(
arch
)
return
arch
canonArch
=
getCanonArch
()
def
isMultiLibArch
(
arch
=
None
):
"""returns true if arch is a multilib arch, false if not"""
if
arch
is
None
:
...
...
@@ -300,6 +293,7 @@ def isMultiLibArch(arch=None):
return
0
def
getBaseArch
(
myarch
=
None
):
"""returns 'base' arch for myarch, if specified, or canonArch if not.
base arch is the arch before noarch in the arches dict if myarch is not
...
...
@@ -338,7 +332,8 @@ def getBaseArch(myarch=None):
value
=
arches
[
basearch
]
return
basearch
def
getArchList
(
thisarch
=
None
):
# this returns a list of archs that are compatible with arch given
if
not
thisarch
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录