From 524427c4555e2c4a9e81992d60a6ad01e7903fc8 Mon Sep 17 00:00:00 2001 From: MizuhaHimuraki Date: Thu, 17 Jun 2021 14:32:48 +0800 Subject: [PATCH] update os compatibility list (#105) * update os compatibility list fix #56 * Update README.md Co-authored-by: Amber Zhang <42762957+Amber1990Zhang@users.noreply.github.com> --- README-CN.md | 47 +++++++++++++++++++++++++++++++ README.md | 38 +++++++++++++++++++++++-- build.sh | 2 +- deps/3rd/dep_create.sh | 64 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 146 insertions(+), 5 deletions(-) diff --git a/README-CN.md b/README-CN.md index 6eebd91034..5e558dec29 100644 --- a/README-CN.md +++ b/README-CN.md @@ -36,8 +36,55 @@ OceanBase 数据库支持支付宝的全部核心业务,以及银行、保险 OceanBase 数据库使用 [MulanPubL - 2.0](https://license.coscl.org.cn/MulanPubL-2.0/index.html) 许可证。您可以免费复制及使用源代码。当您修改或分发源代码时,请遵守木兰协议。 +## 兼容性列表 + +| 操作系统 | 版本 | 架构 | 编译 | 包部署 | 编译部署 | mysqltest | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- | +| CentOS | 7.2,8.3 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Debian | 9.8,10.9 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Fedora | 33 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| MacOS | any | x86_64 | ❌ | ❌ | ❌ | ❌ | +| openSUSE | 15.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| OpenAnolis | 8.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| SUSE | 15.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Ubuntu | 16.04,18.04,20.04 | x86_64 | ✅ | ✅ | ✅ | ✅ | + ## 如何构建 +### 前置准备 + +在构建前您需要确认您的机器已经安装必要的软件 + +#### Fedora 系列 (包括 CentOS,Fedora,OpenAnolis,RedHat 等) +```sh +yum install git wget rpm* cpio make glibc-devel glibc-headers binutils +``` + +#### Debian 系列 (包括 Debian,ubuntu 等) +```sh +apt-get install git wget rpm rpm2cpio cpio make build-essential binutils +``` + +#### SUSE 系列 (包括 SUSE,openSUSE 等) +```sh +zypper install git wget rpm cpio make glibc-devel binutils +``` + +### debug 模式 +```bash +bash build.sh debug --init --make +``` + +### release 模式 +```bash +bash build.sh release --init --make +``` + +### 构建 rpm 软件包 +```bash +bash build.sh rpm --init && cd build_rpm && make -j16 rpm +``` + 详细信息,参考 [使用源码构建 OceanBase 数据库](https://open.oceanbase.com/docs/community/oceanbase-database/V3.1.0/get-the-oceanbase-database-by-using-source-code)。 ## 如何贡献 diff --git a/README.md b/README.md index ac1f946c4b..757cf0c3ff 100644 --- a/README.md +++ b/README.md @@ -36,20 +36,52 @@ Refer to the [Get Started guide](https://open.oceanbase.com/quickStart) (Simplif OceanBase Database is under [MulanPubL - 2.0](https://license.coscl.org.cn/MulanPubL-2.0/index.html) license. You can freely copy and use the source code. When you modify or distribute the source code, please obey the MulanPubL - 2.0 license. +## OS compatibility list + +| OS | Ver. | Arch | Compilable | Package Deployable | Compiled Binary Deployable | Mysqltest Passed | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- | +| CentOS | 7.2,8.3 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Debian | 9.8,10.9 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Fedora | 33 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| MacOS | any | x86_64 | ❌ | ❌ | ❌ | ❌ | +| openSUSE | 15.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| OpenAnolis | 8.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| SUSE | 15.2 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| Ubuntu | 16.04,18.04,20.04 | x86_64 | ✅ | ✅ | ✅ | ✅ | + ## How to build -### debug mode +### Preparation + +Before building, you need to confirm that your device has installed the necessary software. + +#### Fedora based (, including CentOS, Fedora, OpenAnolis, RedHat, etc.) ```sh +yum install git wget rpm* cpio make glibc-devel glibc-headers binutils +``` + +#### Debian based (, including Debian, Ubuntu, etc.) +```sh +apt-get install git wget rpm rpm2cpio cpio make build-essential binutils +``` + +#### SUSE based (, including SUSE, openSUSE, etc.) +```sh +zypper install git wget rpm cpio make glibc-devel binutils +``` + +### debug mode +```bash bash build.sh debug --init --make ``` ### release mode -```sh +```bash bash build.sh release --init --make ``` ### rpm packages -```sh +```bash bash build.sh rpm --init && cd build_rpm && make -j16 rpm ``` diff --git a/build.sh b/build.sh index 934d2f2990..2d405a6818 100755 --- a/build.sh +++ b/build.sh @@ -86,7 +86,7 @@ function prepare_build_dir # dep_create function do_init { - (cd $TOPDIR/deps/3rd && sh dep_create.sh) + (cd $TOPDIR/deps/3rd && bash dep_create.sh) } # make build directory && cmake && make (if need) diff --git a/deps/3rd/dep_create.sh b/deps/3rd/dep_create.sh index feaaf52b87..7b9c314948 100644 --- a/deps/3rd/dep_create.sh +++ b/deps/3rd/dep_create.sh @@ -5,8 +5,70 @@ unalias -a PWD="$(cd $(dirname $0); pwd)" -OS_RELEASE="$(grep -Po '(?<=release )\d' /etc/redhat-release)" || exit 1 OS_ARCH="$(uname -p)" || exit 1 +OS_RELEASE="0" + +if [[ ! -f /etc/os-release ]]; then + echo "[ERROR] os release info not found" 1>&2 && exit 1 +fi + +source /etc/os-release || exit 1 + +PNAME=${PRETTY_NAME:-${NAME} ${VERSION}} + +function compat_centos8() { + echo "[NOTICE] '$PNAME' is compatible with CentOS 8, use el8 dependencies list" + OS_RELEASE=8 +} + +function compat_centos7() { + echo "[NOTICE] '$PNAME' is compatible with CentOS 7, use el7 dependencies list" + OS_RELEASE=7 +} + +function not_supported() { + echo "[ERROR] '$PNAME' is not supported yet." +} + +function version_ge() { + test "$(awk -v v1=$VERSION_ID -v v2=$1 'BEGIN{print(v1>=v2)?"1":"0"}' 2>/dev/null)" == "1" +} + +function get_os_release() { + case "$ID" in + alios) + version_ge "8.0" && compat_centos8 && return + version_ge "7.2" && compat_centos7 && return + ;; + anolis) + version_ge "8.0" && compat_centos8 && return + version_ge "7.0" && compat_centos7 && return + ;; + ubuntu) + version_ge "16.04" && compat_centos7 && return + ;; + centos) + version_ge "8.0" && OS_RELEASE=8 && return + version_ge "7.0" && OS_RELEASE=7 && return + ;; + debian) + version_ge "9" && compat_centos7 && return + ;; + fedora) + version_ge "33" && compat_centos7 && return + ;; + opensuse-leap) + version_ge "15" && compat_centos7 && return + ;; + #suse + sles) + version_ge "15" && compat_centos7 && return + ;; + esac + not_supported && return 1 +} + +get_os_release || exit 1 OS_TAG="el$OS_RELEASE.$OS_ARCH" DEP_FILE="oceanbase.${OS_TAG}.deps" -- GitLab