Skip to content

Commit

Permalink
repo init
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-robot-pre authored and hnwyllmm committed Dec 4, 2023
0 parents commit 9bbcd3d
Show file tree
Hide file tree
Showing 85 changed files with 4,631 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
image: ['centos:8', 'centos:7']
runs-on: ubuntu-20.04
container: ${{ matrix.image }}
steps:
- uses: actions/checkout@v3

- name: Init centos8
shell: bash
if: ${{ startsWith(matrix.image, 'centos:8') }}
run: |
sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
- name: Install centos environment
shell: bash
run: |
yum update -y
yum install -y git wget rpm* cpio make glibc-devel glibc-headers binutils m4 rpm-build
- name: Build
shell: bash
run: cd rpm && bash ./build_all.sh
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## What is ob-deps

Ob-deps is a repository for building dependency packages of [oceanbase](https://github.com/oceanbase/oceanbase).

## Quick start

### Prerequisite

Some tools and dependencies are needed for building these packages. The xxx-build.sh has solved some compilation dependencies. However, considering different build environments, please install the corresponding dependencies on your own build environment according to the prompts.

Oceanbase Efficiency Team provides dockerfile for centos7 & centos8. The xxx-build.dockerfile in /base-images has installed some simple environment dependencies, which may be helpful for you.

### Building

```bash
cd rpm
bash xxx-build.sh
```

### Others

Pkg 'devdeps-oblogmsg' has been opened source in GitHub https://github.com/oceanbase/oblogmsg ;
The used version in OceanBase 'devdeps-oblogmsg-1.0-52022113019.el7.aarch64.rpm' was complied from this [commit](https://github.com/oceanbase/oblogmsg/commit/20588139cc7774c533450729bb60a2ad33b4e0d4).
28 changes: 28 additions & 0 deletions base-images/centos7-build.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM centos:7.9.2009
ENV TZ=UTC-8
ADD ob_build /usr/bin/
ADD python-env-activate.sh /usr/bin/py-env-activate
RUN yum install -y wget && wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && \
yum -y install libffi-devel bzip2-devel readline readline-devel jq which bison ncurses-devel libaio-0.3.109-13.el7 autoconf automake libtool perl-CPAN gettext-devel perl-devel openssl-devel zlib-devel curl-devel python-devel xz-devel \
expat-devel asciidoc xmlto rpm-build cmake make gcc gcc-c++ python-pip python36 python3-devel && yum clean all
# install git
RUN wget http://github.com/git/git/archive/v2.32.0.tar.gz && \
tar -xvf v2.32.0.tar.gz && \
rm -f v2.32.0.tar.gz && \
cd git-* && \
make configure && \
./configure --prefix=/usr && \
make -j16 && \
make install
RUN pip install --upgrade pip==19.3.1 && pip install pyinstaller==3.6
# install conda
RUN wget https://github.com/conda-forge/miniforge/releases/download/22.9.0-2/Mambaforge-22.9.0-2-Linux-`uname -m`.sh -P /tmp/
RUN bash /tmp/Mambaforge-22.9.0-2-Linux-`uname -m`.sh -b -p /opt/conda && rm -rf /tmp/Mambaforge-22.9.0-2-Linux-`uname -m`.sh
RUN ln -s /opt/conda/bin/conda /usr/bin/conda && conda init && conda create -n py38 python=3.8 && eval "$(conda shell.bash hook)" && conda activate py38 && \
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && pip install wheel && pip install pyinstaller
RUN conda config --set auto_activate_base false
# install nodejs and yarn
RUN curl –sL https://rpm.nodesource.com/setup_16.x | bash -
RUN yum install -y nodejs && yum clean all

RUN npm i yarn tyarn -g
32 changes: 32 additions & 0 deletions base-images/centos8-build.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM centos:8.3.2011
ENV TZ=UTC-8
ADD ob_build /usr/bin/
ADD python-env-activate.sh /usr/bin/py-env-activate
RUN rm -rf /etc/yum.repos.d/* && curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
RUN yum -y install epel-release && \
yum -y install libffi-devel bzip2-devel readline readline-devel jq which ncurses-devel bison openssh-clients libaio-0.3.112-1.el8 autoconf automake libtool wget perl-CPAN gettext-devel perl-devel \
openssl-devel zlib-devel curl-devel expat-devel asciidoc xmlto rpm-build cmake libarchive make gcc gcc-c++ xz-devel \
python2 python2-pip python2-devel python36 python36-devel python38-devel && yum clean all

# install git
RUN wget http://github.com/git/git/archive/v2.32.0.tar.gz && \
tar -xvf v2.32.0.tar.gz && \
rm -f v2.32.0.tar.gz && \
cd git-* && \
make configure && \
./configure --prefix=/usr && \
make -j16 && \
make install

RUN ln -s /usr/bin/python2 /usr/bin/python && ln -s /usr/bin/pip2 /usr/bin/pip && pip install --upgrade pip==19.3.1 && pip install pyinstaller==3.6
# install conda
RUN wget https://github.com/conda-forge/miniforge/releases/download/22.9.0-2/Mambaforge-22.9.0-2-Linux-`uname -m`.sh -P /tmp/
RUN bash /tmp/Mambaforge-22.9.0-2-Linux-`uname -m`.sh -b -p /opt/conda && rm -rf /tmp/Mambaforge-22.9.0-2-Linux-`uname -m`.sh
RUN ln -s /opt/conda/bin/conda /usr/bin/conda && conda init && conda create -n py38 python=3.8 && eval "$(conda shell.bash hook)" && conda activate py38 && \
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && pip install wheel && pip install pyinstaller
RUN conda config --set auto_activate_base false
# install nodejs and yarn
RUN curl –sL https://rpm.nodesource.com/setup_16.x | bash -
RUN yum install -y nodejs && yum clean all

RUN npm i yarn tyarn -g
72 changes: 72 additions & 0 deletions base-images/ob_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
set -x
set -e

if [ $# -lt 4 ]; then
echo "no enough parameters. Please provide project_name, version and release."
exit 1
fi

# Get system release
os_release=$(grep -Po '(?<=^ID=")[^"]*' /etc/os-release)

set +e
source /etc/profile
set -e

project_dir=$1
project_name=$2
version=$3
release=$4
rpm_work_dir=${5:-rpm}
ob_build_script=${project_name}-build.sh
ob_build_spec=${project_name}.spec
ob_build_deps=${project_name}.deps
cur_dir=`pwd`
echo "cur dir: $cur_dir"
# check rpm work dir
if [ ! -d "${cur_dir}/${rpm_work_dir}" ]; then
echo "rpm work dir (${rpm_work_dir}) missing! Please create ${rpm_work_dir} in source code dir and place the packaging related files in the ${rpm_work_dir} dir."
exit 1
fi

# trigger building
echo "trigger building, current dir: "
pwd
cd $rpm_work_dir
ABS_PATH=`pwd`

if [[ x"$os_release" == x"alios" && x"$AONE_COMPATIBLE_AUTO_DEP_CREATE" == x"on" ]]; then
if [ -e "$ob_build_deps" ]; then
echo "execute dep_create for alios"
dep_create $ob_build_deps
echo "execute sw for alios"
sw
fi
fi

if [ -e "$ob_build_script" ]; then
bash $ob_build_script $project_dir $project_name $version $release
elif [ -e "$ob_build_spec" ]; then
if [[ x"$os_release" == x"alios" ]]; then
rpm_create $ob_build_spec -v $version -r $release
else
TOP_DIR=".rpm_create"
RPM_MACROS=$HOME/.rpmmacros
if [ -e $RPM_MACROS ]; then
mv -f $RPM_MACROS $RPM_MACROS.bak
fi

# prepare rpm build dirs
mkdir -p $TOP_DIR/BUILD
mkdir -p $TOP_DIR/RPMS
mkdir -p $TOP_DIR/SRPMS

echo "%_topdir $ABS_PATH/$TOP_DIR" > $RPM_MACROS
rpmbuild -bb $ob_build_spec
find $TOP_DIR/ -name "*.rpm" -exec mv {} . 2>/dev/null \;
fi
else
echo "packaging files missing! Please provide $ob_build_script or $ob_build_spec"
exit 1
fi
6 changes: 6 additions & 0 deletions base-images/python-env-activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eval "$(conda shell.bash hook)"
if [[ -z $1 ]]; then
echo "Please input proper python env"
exit 1
fi
conda activate $1
21 changes: 21 additions & 0 deletions cos_diff.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 635f506..07f3fd6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,7 @@ aux_source_directory(cos_c_sdk SRC_LIST)

add_library(${CMAKE_PROJECT_NAME} SHARED ${SRC_LIST})
add_library(${CMAKE_PROJECT_NAME}_static STATIC ${SRC_LIST})
+target_compile_options(${CMAKE_PROJECT_NAME}_static PRIVATE -fvisibility=hidden -Wno-unused-parameter -Wno-type-limits)

set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VERSION ${CMAKE_VERSION} SOVERSION ${CMAKE_VERSION})

@@ -121,4 +122,4 @@ INSTALL(FILES
cos_c_sdk/cos_xml.h
DESTINATION include/cos_c_sdk)

-add_subdirectory(cos_c_sdk_test)
+#add_subdirectory(cos_c_sdk_test)
--
2.17.0

Loading

0 comments on commit 9bbcd3d

Please sign in to comment.