Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Coder
code-server
提交
6a692487
C
code-server
项目概览
镜像
/
Coder
/
code-server
2022-09-21 03:15:05同步失败
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
6a692487
编写于
9月 16, 2021
作者:
J
Joe Previte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add test for get_nfpm_arch
上级
0609a1b2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
22 deletion
+52
-22
ci/build/arch-override.json
ci/build/arch-override.json
+0
-8
ci/build/build-lib.sh
ci/build/build-lib.sh
+28
-0
ci/build/build-packages.sh
ci/build/build-packages.sh
+3
-14
test/scripts/build-lib.bats
test/scripts/build-lib.bats
+21
-0
未找到文件。
ci/build/arch-override.json
已删除
100644 → 0
浏览文件 @
0609a1b2
{
"rpm"
:
{
"armv7l"
:
"armhfp"
},
"deb"
:
{
"armv7l"
:
"armhf"
}
}
ci/build/build-lib.sh
0 → 100755
浏览文件 @
6a692487
#!/usr/bin/env bash
# This is a library which contains functions used inside ci/build
#
# We separated it into it's own file so that we could easily unit test
# these functions and helpers.
# On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis),
# different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp).
# This function returns the overriden arch on platforms
# with alternate labels, or the same arch otherwise.
get_nfpm_arch
()
{
local
PKG_FORMAT
=
"
${
1
:-}
"
local
ARCH
=
"
${
2
:-}
"
case
"
$ARCH
"
in
armv7l
)
if
[
"
$PKG_FORMAT
"
=
"deb"
]
;
then
echo
armhf
elif
[
"
$PKG_FORMAT
"
=
"rpm"
]
;
then
echo
armhfp
fi
;;
*
)
echo
"
$ARCH
"
;;
esac
}
ci/build/build-packages.sh
浏览文件 @
6a692487
...
...
@@ -7,6 +7,7 @@ set -euo pipefail
main
()
{
cd
"
$(
dirname
"
${
0
}
"
)
/../.."
source
./ci/lib.sh
source
./ci/build/build-lib.sh
# Allow us to override architecture
# we use this for our Linux ARM64 cross compile builds
...
...
@@ -43,18 +44,6 @@ release_gcp() {
cp
"./release-packages/
$release_name
.tar.gz"
"./release-gcp/latest/
$OS
-
$ARCH
.tar.gz"
}
# On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis),
# different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp).
# This function parses arch-override.json and returns the overriden arch on platforms
# with alternate labels, or the same arch otherwise.
get_nfpm_arch
()
{
if
jq
-re
".
${
PKG_FORMAT
}
.
${
ARCH
}
"
./ci/build/arch-override.json
>
/dev/null
;
then
jq
-re
".
${
PKG_FORMAT
}
.
${
ARCH
}
"
./ci/build/arch-override.json
else
echo
"
$ARCH
"
fi
}
# Generates deb and rpm packages.
release_nfpm
()
{
local
nfpm_config
...
...
@@ -62,14 +51,14 @@ release_nfpm() {
export
NFPM_ARCH
PKG_FORMAT
=
"deb"
NFPM_ARCH
=
"
$(
get_nfpm_arch
)
"
NFPM_ARCH
=
"
$(
get_nfpm_arch
$PKG_FORMAT
"
$ARCH
"
)
"
nfpm_config
=
"
$(
envsubst < ./ci/build/nfpm.yaml
)
"
echo
"Building deb"
echo
"
$nfpm_config
"
|
head
--lines
=
4
nfpm pkg
-f
<
(
echo
"
$nfpm_config
"
)
--target
"release-packages/code-server_
${
VERSION
}
_
${
NFPM_ARCH
}
.deb"
PKG_FORMAT
=
"rpm"
NFPM_ARCH
=
"
$(
get_nfpm_arch
)
"
NFPM_ARCH
=
"
$(
get_nfpm_arch
$PKG_FORMAT
"
$ARCH
"
)
"
nfpm_config
=
"
$(
envsubst < ./ci/build/nfpm.yaml
)
"
echo
"Building rpm"
echo
"
$nfpm_config
"
|
head
--lines
=
4
...
...
test/scripts/build-lib.bats
0 → 100644
浏览文件 @
6a692487
#!/usr/bin/env bats
SCRIPT_NAME="build-lib.sh"
SCRIPT="$BATS_TEST_DIRNAME/../../ci/build/$SCRIPT_NAME"
source "$SCRIPT"
@test "get_nfpm_arch should return armhfp for rpm on armv7l" {
run get_nfpm_arch rpm armv7l
[ "$output" = "armhfp" ]
}
@test "get_nfpm_arch should return armhf for deb on armv7l" {
run get_nfpm_arch deb armv7l
[ "$output" = "armhf" ]
}
@test "get_nfpm_arch should return arch if no arch override exists " {
run get_nfpm_arch deb i386
[ "$output" = "i386" ]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录