allow custom parallel number in deb packaging (#147)

This commit is contained in:
Cyano Hao 2023-10-20 11:07:56 +08:00 committed by GitHub
parent fd95b49270
commit 9a9455cee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -265,23 +265,25 @@ Extra requirements for Windows host:
```bash ```bash
DOCKER=docker # or podman DOCKER=docker # or podman
SOURCE_DIR=/build/RedPanda-CPP # source directory *in container* SOURCE_DIR=/build/RedPanda-CPP # source directory *in container*
JOBS=$(nproc) # reduce it for multiple builds at same time
MIRROR=mirrors.kernel.org # leave empty for default mirror MIRROR=mirrors.kernel.org # leave empty for default mirror
PLATFORM=linux/amd64 # or linux/386, linux/arm64/v8, linux/arm/v7, linux/riscv64 PLATFORM=linux/amd64 # or linux/386, linux/arm64/v8, linux/arm/v7, linux/riscv64
IMAGE=debian:12 # or Ubuntu (e.g. ubuntu:22.04) IMAGE=debian:12 # or Ubuntu (e.g. ubuntu:22.04)
$DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
``` ```
* Windows host: * Windows host:
```ps1 ```ps1
$DOCKER = "docker" # or "podman" $DOCKER = "docker" # or "podman"
$SOURCE_DIR = "/build/RedPanda-CPP" # source directory *in container* $SOURCE_DIR = "/build/RedPanda-CPP" # source directory *in container*
$JOBS = $Env:NUMBER_OF_PROCESSORS # reduce it for multiple builds at same time
$MIRROR = "mirrors.kernel.org" # leave empty for default mirror $MIRROR = "mirrors.kernel.org" # leave empty for default mirror
$PLATFORM = "linux/amd64" # or "linux/386", "linux/arm64/v8", "linux/arm/v7", "linux/riscv64" $PLATFORM = "linux/amd64" # or "linux/386", "linux/arm64/v8", "linux/arm/v7", "linux/riscv64"
$IMAGE = "debian:12" # or Ubuntu (e.g. "ubuntu:22.04") $IMAGE = "debian:12" # or Ubuntu (e.g. "ubuntu:22.04")
& $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
``` ```
### Manual Install ### Manual Install

View File

@ -265,23 +265,25 @@ Windows 宿主的额外要求:
```bash ```bash
DOCKER=docker # 或 podman DOCKER=docker # 或 podman
SOURCE_DIR=/build/RedPanda-CPP # *容器内*的源代码路径 SOURCE_DIR=/build/RedPanda-CPP # *容器内*的源代码路径
JOBS=$(nproc) # 同时构建多个包时可降低并行数
MIRROR=mirrors.ustc.edu.cn # 留空以使用默认的镜像站 MIRROR=mirrors.ustc.edu.cn # 留空以使用默认的镜像站
PLATFORM=linux/amd64 # 或 linux/386、linux/arm64/v8、linux/arm/v7、linux/riscv64 PLATFORM=linux/amd64 # 或 linux/386、linux/arm64/v8、linux/arm/v7、linux/riscv64
IMAGE=debian:12 # 或 Ubuntu如 ubuntu:22.04 IMAGE=debian:12 # 或 Ubuntu如 ubuntu:22.04
$DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
``` ```
* Windows 宿主: * Windows 宿主:
```ps1 ```ps1
$DOCKER = "docker" # 或 "podman" $DOCKER = "docker" # 或 "podman"
$SOURCE_DIR = "/build/RedPanda-CPP" # *容器内*的源代码路径 $SOURCE_DIR = "/build/RedPanda-CPP" # *容器内*的源代码路径
$JOBS = $Env:NUMBER_OF_PROCESSORS # 同时构建多个包时可降低并行数
$MIRROR = "mirrors.ustc.edu.cn" # 留空以使用默认的镜像站 $MIRROR = "mirrors.ustc.edu.cn" # 留空以使用默认的镜像站
$PLATFORM = "linux/amd64" # 或 "linux/386"、"linux/arm64/v8"、"linux/arm/v7"、"linux/riscv64" $PLATFORM = "linux/amd64" # 或 "linux/386"、"linux/arm64/v8"、"linux/arm/v7"、"linux/riscv64"
$IMAGE = "debian:12" # 或 Ubuntu如 "ubuntu:22.04" $IMAGE = "debian:12" # 或 Ubuntu如 "ubuntu:22.04"
& $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh
``` ```
### 手动安装 ### 手动安装

View File

@ -5,6 +5,7 @@ set -xe
TMP_FOLDER=/build/redpanda-build TMP_FOLDER=/build/redpanda-build
DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2- | tr -d '"') DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2- | tr -d '"')
VERSION_ID=$(grep ^VERSION_ID= /etc/os-release | cut -d= -f2- | tr -d '"') VERSION_ID=$(grep ^VERSION_ID= /etc/os-release | cut -d= -f2- | tr -d '"')
[[ -z $JOBS ]] && JOBS=$(nproc)
# install deps # install deps
default_repositories=( default_repositories=(
@ -50,7 +51,7 @@ cp Red_Panda_CPP.pro $TMP_FOLDER
# build # build
cd $TMP_FOLDER cd $TMP_FOLDER
dpkg-buildpackage -us -uc dpkg-buildpackage -us -uc -j$JOBS
# copy back to host # copy back to host
cd .. cd ..