Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
0bab77bf
提交
0bab77bf
authored
5月 28, 2012
作者:
Travis Cross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debian: refactor and improve build utilities
上级
15a67097
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
146 行增加
和
128 行删除
+146
-128
util.sh
debian/util.sh
+146
-128
没有找到文件。
debian/util.sh
浏览文件 @
0bab77bf
...
@@ -6,6 +6,9 @@ set -e
...
@@ -6,6 +6,9 @@ set -e
ddir
=
"."
ddir
=
"."
[
-n
"
${
0
%/*
}
"
]
&&
ddir
=
"
${
0
%/*
}
"
[
-n
"
${
0
%/*
}
"
]
&&
ddir
=
"
${
0
%/*
}
"
cd
$ddir
/../
#### lib
err
()
{
err
()
{
echo
"
$0
error:
$1
"
>
&2
echo
"
$0
error:
$1
"
>
&2
...
@@ -31,6 +34,35 @@ xread () {
...
@@ -31,6 +34,35 @@ xread () {
return
$ret
return
$ret
}
}
mk_dver
()
{
echo
"
$1
"
|
sed
-e
's/-/~/g'
;
}
mk_uver
()
{
echo
"
$1
"
|
sed
-e
's/-.*$//'
-e
's/~/-/'
;
}
dsc_source
()
{
dpkg-parsechangelog |
grep
'^Source:'
|
awk
'{print $2}'
;
}
dsc_ver
()
{
dpkg-parsechangelog |
grep
'^Version:'
|
awk
'{print $2}'
;
}
up_ver
()
{
mk_uver
"
$(
dsc_ver
)
"
;
}
dsc_base
()
{
echo
"
$(
dsc_source
)
_
$(
dsc_ver
)
"
;
}
up_base
()
{
echo
"
$(
dsc_source
)
-
$(
up_ver
)
"
;
}
find_distro
()
{
case
"
$1
"
in
experimental
)
echo
"sid"
;;
unstable
)
echo
"sid"
;;
testing
)
echo
"wheezy"
;;
stable
)
echo
"squeeze"
;;
*
)
echo
"
$1
"
;;
esac
}
find_suite
()
{
case
"
$1
"
in
sid
)
echo
"unstable"
;;
wheezy
)
echo
"testing"
;;
squeeze
)
echo
"stable"
;;
*
)
echo
"
$1
"
;;
esac
}
#### debian/rules helpers
create_dbg_pkgs
()
{
create_dbg_pkgs
()
{
for
x
in
$ddir
/
*
;
do
for
x
in
$ddir
/
*
;
do
test
!
-d
$x
&&
continue
test
!
-d
$x
&&
continue
...
@@ -56,166 +88,152 @@ cwget () {
...
@@ -56,166 +88,152 @@ cwget () {
}
}
getlib
()
{
getlib
()
{
local
sd
=
"
$1
"
url
=
"
$2
"
f
=
"
${
2
##*/
}
"
local
url
=
"
$1
"
f
=
"
${
1
##*/
}
"
(
cd
$sd
/libs
\
cwget
"
$url
"
&&
cwget
"
$url
"
\
tar
-xv
--no-same-owner
--no-same-permissions
-f
"
$f
"
&&
tar
-xv
--no-same-owner
--no-same-permissions
-f
"
$f
"
\
rm
-f
"
$f
"
&&
mkdir
-p
$f
&&
touch
$f
/.download-stamp
&&
rm
-f
"
$f
"
\
&&
mkdir
-p
$f
)
}
}
getlibs
()
{
getlibs
()
{
local
sd
=
"
$1
"
# get pinned libraries
# get pinned libraries
getlib
$sd
http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz
getlib http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz
getlib
$sd
http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz
getlib http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz
getlib http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz
getlib http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2
getlib http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2
getlib
$sd
http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz
getlib http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz
getlib http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
getlib http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz
getlib http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz
getlib http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz
getlib http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz
getlib
$sd
http://download.zeromq.org/zeromq-2.1.9.tar.gz
\
getlib http://download.zeromq.org/zeromq-2.1.9.tar.gz
\
||
getlib
$sd
http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz
||
getlib http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz
getlib http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz
getlib http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
getlib http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
getlib
$sd
http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz
getlib http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz
# cleanup mongo
# cleanup mongo
(
(
cd
$sd
/libs/
mongo-cxx-driver-v1.8
cd
mongo-cxx-driver-v1.8
rm
-rf
config.log .sconf_temp
*
Test
*
Example
rm
-rf
config.log .sconf_temp
*
Test
*
Example
find
.
-name
"*.o"
-exec
rm
-f
{}
\;
find
.
-name
"*.o"
-exec
rm
-f
{}
\;
)
)
}
}
get_current_version
()
{
check_repo_clean
()
{
cat
$ddir
/changelog
\
git diff-index
--quiet
--cached
HEAD
\
|
grep
-e
'^freeswitch '
\
||
err
"uncommitted changes present"
|
awk
'{print $2}'
\
git diff-files
--quiet
\
|
sed
-e
's/[()]//g'
-e
's/-.*//'
||
err
"unclean working tree"
}
git diff-index
--quiet
HEAD
\
||
err
"unclean repository"
_create_orig
()
{
!
git ls-files
--other
--error-unmatch
.
>
/dev/null 2>&1
\
.
$ddir
/../scripts/ci/common.sh
||
err
"untracked files or build products present"
eval
$(
parse_version
"
$(
get_current_version
)
"
)
local
destdir
=
"
$1
"
xz_level
=
"
$2
"
n
=
freeswitch
local
d
=
${
n
}
-
${
dver
}
f
=
${
n
}
_
${
dver
}
local
sd
=
${
ddir
}
/sdeb/
$d
[
-n
"
$destdir
"
]
||
destdir
=
$ddir
/../../
mkdir
-p
$sd
tar
-c
-C
$ddir
/../
\
--exclude
=
.git
\
--exclude
=
debian
\
--exclude
=
freeswitch.xcodeproj
\
--exclude
=
fscomm
\
--exclude
=
htdocs
\
--exclude
=
w32
\
--exclude
=
web
\
-vf
-
.
|
tar
-x
-C
$sd
-vf
-
(
cd
$sd
&&
set_fs_ver
"
$gver
"
"
$gmajor
"
"
$gminor
"
"
$gmicro
"
"
$grev
"
)
getlibs
$sd
tar
-c
-C
$ddir
/sdeb
-vf
$ddir
/sdeb/
$f
.orig.tar
$d
xz -
${
xz_level
}
v
$ddir
/sdeb/
$f
.orig.tar
mv
$ddir
/sdeb/
$f
.orig.tar.xz
$destdir
rm
-rf
$ddir
/sdeb
}
}
create_orig
()
{
create_orig
()
{
local
xz_level
=
"6"
local
OPTIND OPTARG
while
getopts
'dz:'
o
;
do
local
uver
=
""
bundle_deps
=
false
zl
=
9e
while
getopts
'bnv:z:'
o
"
$@
"
;
do
case
"
$o
"
in
case
"
$o
"
in
d
)
set
-vx
;;
b
)
bundle_deps
=
true
;;
z
)
xz_level
=
"
$OPTARG
"
;;
n
)
uver
=
"nightly"
;;
v
)
uver
=
"
$OPTARG
"
;;
z
)
zl
=
"
$OPTARG
"
;;
esac
esac
done
done
shift
$((
$OPTIND
-
1
))
shift
$((
$OPTIND
-
1
))
_create_orig
"
$1
"
"
$xz_level
"
[
-z
"
$uver
"
]
||
[
"
$uver
"
=
"nightly"
]
\
&&
uver
=
"
$(
cat
build/next-release.txt
)
-n
$(
date
+%Y%m%dT%H%M%SZ
)
"
local
treeish
=
"
$1
"
dver
=
"
$(
mk_dver
"
$uver
"
)
"
local
orig
=
"../freeswitch_
$dver
.orig.tar.xz"
[
-n
"
$treeish
"
]
||
treeish
=
"HEAD"
check_repo_clean
git reset
--hard
"
$treeish
"
mv
.gitattributes .gitattributes.orig
grep
.gitattributes.orig
\
-e
'\bdebian-ignore\b'
\
-e
'\bdfsg-nonfree\b'
\
|
while
xread l
;
do
echo
"
$l
export-ignore"
>>
.gitattributes
done
if
$bundle_deps
;
then
(
cd
libs
&&
getlibs
)
git add
-f
libs
fi
./build/set-fs-version.sh
"
$uver
"
&&
git add configure.in
git commit
--allow-empty
-m
"nightly v
$uver
"
git archive
-v
\
--worktree-attributes
\
--format
=
tar
\
--prefix
=
freeswitch-
$uver
/
\
HEAD
\
| xz
-c
-
${
zl
}
v
>
$orig
mv
.gitattributes.orig .gitattributes
git reset
--hard
HEAD^
&&
git clean
-fdx
echo
$orig
}
}
create_dsc
()
{
create_dsc
()
{
.
$ddir
/../scripts/ci/common.sh
local
distro
=
"
$(
find_distro
$1
)
"
orig
=
"
$2
"
local
xz_level
=
"6"
local
suite
=
"
$(
find_suite
$distro
)
"
while
getopts
'dz:'
o
;
do
local
orig_ver
=
"
$(
echo
"
$orig
"
|
sed
-e
's/^.*_//'
-e
's/\.orig\.tar.*$//'
)
"
case
"
$o
"
in
local
dver
=
"
${
orig_ver
}
-1~
${
distro
}
+1"
d
)
set
-vx
;;
[
-x
"
$(
which dch
)
"
]
\
z
)
xz_level
=
"
$OPTARG
"
;;
||
err
"package devscripts isn't installed"
esac
(
cd
debian
&&
./bootstrap.sh
-c
$distro
)
done
dch
-b
-m
-v
"
$dver
"
--force-distribution
-D
"
$suite
"
"Nightly build."
shift
$((
$OPTIND
-
1
))
git add debian/changelog
&&
git commit
-m
"nightly v
$orig_ver
"
eval
$(
parse_version
"
$(
get_current_version
)
"
)
dpkg-source
-i
.
*
-Zxz
-z9
-b
.
local
destdir
=
"
$1
"
n
=
freeswitch
dpkg-genchanges
-S
>
../
$(
dsc_base
)
_source.changes
local
d
=
${
n
}
-
${
dver
}
f
=
${
n
}
_
${
dver
}
local
dsc
=
"../
$(
dsc_base
)
.dsc"
[
-n
"
$destdir
"
]
||
destdir
=
$ddir
/../../
git reset
--hard
HEAD^
&&
git clean
-fdx
[
-f
$destdir
/
$f
.orig.tar.xz
]
\
echo
$dsc
||
_create_orig
"
$1
"
"
${
xz_level
}
"
(
ddir
=
$(
pwd
)
/
$ddir
cd
$destdir
mkdir
-p
$f
cp
-a
$ddir
$f
dpkg-source
-b
-i
.
*
-Zxz
-z9
$f
)
}
}
build_
nightly_for
()
{
build_
debs
()
{
set
-e
local
distro
=
"
$(
find_distro
$1
)
"
dsc
=
"
$2
"
arch
=
"
$3
"
local
branch
=
"
$1
"
if
[
-z
"
$distro
"
]
||
[
"
$distro
"
=
"auto"
]
;
then
local
distro
=
"
$2
"
suite
=
""
if
!
(
echo
"
$dsc
"
|
grep
-e
'-[0-9]*~[a-z]*+[0-9]*'
)
;
then
case
$distro
in
err
"no distro specified or found"
experimental
)
distro
=
"sid"
suite
=
"experimental"
;;
fi
sid
)
suite
=
"unstable"
;;
local
x
=
"
$(
echo
$dsc
|
sed
-e
's/^[^-]*-[0-9]*~//'
-e
's/+[^+]*$//'
)
"
wheezy
)
suite
=
"testing"
;;
distro
=
"
$(
find_distro
$x
)
"
squeeze
)
suite
=
"stable"
;;
fi
esac
[
-n
"
$arch
"
]
||
arch
=
"
$(
dpkg-architecture |
grep
'^DEB_BUILD_ARCH='
|
cut
-d
'='
-f2
)
"
[
-x
"
$(
which cowbuilder
)
"
]
\
[
-x
"
$(
which cowbuilder
)
"
]
\
||
err
"Error: package cowbuilder isn't installed"
||
err
"package cowbuilder isn't installed"
[
-x
"
$(
which dch
)
"
]
\
local
cow_img
=
/var/cache/pbuilder/base-
$distro
-
$arch
.cow
||
err
"Error: package devscripts isn't installed"
cow
()
{
[
-x
"
$(
which git-buildpackage
)
"
]
\
cowbuilder
"
$@
"
\
||
err
"Error: package git-buildpackage isn't installed"
ulimit
-n
200000
||
true
if
!
[
-d
/var/cache/pbuilder/base-
$distro
.cow
]
;
then
announce
"Creating base
$distro
image..."
cowbuilder
--create
\
--distribution
$distro
\
--distribution
$distro
\
--basepath
/var/cache/pbuilder/base-
$distro
.cow
--architecture
$arch
\
--basepath
$cow_img
}
if
!
[
-d
$cow_img
]
;
then
announce
"Creating base
$distro
-
$arch
image..."
cow
--create
fi
fi
announce
"Updating base
$distro
image..."
announce
"Updating base
$distro
-
$arch
image..."
cowbuilder
--update
\
cow
--update
--distribution
$distro
\
announce
"Building
$distro
-
$arch
DEBs from
$dsc
..."
--basepath
/var/cache/pbuilder/base-
$distro
.cow
cow
--build
$dsc
local
ver
=
"
$(
cat
build/next-release.txt |
sed
-e
's/-/~/g'
)
~n
$(
date
+%Y%m%dT%H%M%SZ
)
-1~
${
distro
}
+1"
echo
${
dsc
}
_
${
arch
}
.changes
echo
"Building v
$ver
for
$distro
based on
$branch
"
cd
$ddir
/../
announce
"Building v
$ver
..."
git clean
-fdx
git reset
--hard
$branch
./build/set-fs-version.sh
"
$ver
"
git add configure.in
&&
git commit
--allow-empty
-m
"nightly v
$ver
"
(
cd
debian
&&
./bootstrap.sh
-c
$distro
)
dch
-b
-m
-v
"
$ver
"
--force-distribution
-D
"
$suite
"
"Nightly build."
git-buildpackage
-us
-uc
\
--git-verbose
\
--git-pbuilder
--git-dist
=
$distro
\
--git-compression
=
xz
--git-compression-level
=
9ev
git reset
--hard
HEAD^
}
}
build_nightly
()
{
while
getopts
'd'
o
"
$@
"
;
do
local
branch
=
"
$1
"
;
shift
case
"
$o
"
in
for
distro
in
"
$@
"
;
do
d
)
set
-vx
;;
build_nightly_for
"
$branch
"
"
$distro
"
esac
done
done
}
shift
$((
$OPTIND
-
1
))
cmd
=
"
$1
"
cmd
=
"
$1
"
shift
shift
case
"
$cmd
"
in
case
"
$cmd
"
in
build-nightly
)
build_nightly
"
$@
"
;;
archive-orig
)
archive_orig
"
$@
"
;;
build-debs
)
build_debs
"
$@
"
;;
create-dbg-pkgs
)
create_dbg_pkgs
;;
create-dbg-pkgs
)
create_dbg_pkgs
;;
create-dsc
)
create_dsc
"
$@
"
;;
create-dsc
)
create_dsc
"
$@
"
;;
create-orig
)
create_orig
"
$@
"
;;
create-orig
)
create_orig
"
$@
"
;;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论