Merge pull request #222 in FS/freeswitch from feature/FS-7373-add-ability-to-specify-custom-source.list to master

* commit '4738da1325f408665f6111f4c72b644c4fb95cfe':
  When using the debian/utils.sh script to build FreeSWITCH packages, add the ability to pass -T[path to custom sources path] and -K[custom keyfile path] options to build the FS packages with a custom sources and keyring path.
This commit is contained in:
William King 2015-03-16 11:44:11 -05:00
commit b32abaadd9
1 changed files with 30 additions and 9 deletions

39
debian/util.sh vendored
View File

@ -274,26 +274,30 @@ get_sources () {
while read type path distro components; do while read type path distro components; do
test "$type" = deb || continue test "$type" = deb || continue
printf "$type $path $tgt_distro $components\n" printf "$type $path $tgt_distro $components\n"
done < /etc/apt/sources.list done < "$2"
} }
get_mirrors () { get_mirrors () {
get_sources "$1" | tr '\n' '|' | head -c-1; echo file=${2-/etc/apt/sources.list}
announce "Using apt sources file: $file"
get_sources "$1" "$file" | tr '\n' '|' | head -c-1; echo
} }
build_debs () { build_debs () {
{ {
set -e set -e
local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts="" local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts=""
local keep_pbuilder_config=false local keep_pbuilder_config=false keyring="" custom_keyring=""
local use_system_sources=false local use_system_sources=false
while getopts 'Bbdkt' o "$@"; do while getopts 'BbdK:kT:t' o "$@"; do
case "$o" in case "$o" in
B) cow_build_opts="--debbuildopts '-B'";; B) cow_build_opts="--debbuildopts '-B'";;
b) cow_build_opts="--debbuildopts '-b'";; b) cow_build_opts="--debbuildopts '-b'";;
d) debug_hook=true;; d) debug_hook=true;;
k) keep_pbuilder_config=true;; k) keep_pbuilder_config=true;;
t) use_system_sources=true;; K) custom_keyring="$OPTARG";;
t) use_system_sources=true; custom_sources_file="/etc/apt/sources.list";;
T) use_custom_sources=true; custom_sources_file="$OPTARG";;
esac esac
done done
shift $(($OPTIND-1)) shift $(($OPTIND-1))
@ -309,6 +313,12 @@ build_debs () {
[ -x "$(which cowbuilder)" ] \ [ -x "$(which cowbuilder)" ] \
|| err "package cowbuilder isn't installed" || err "package cowbuilder isn't installed"
local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow
if [ -e "$custom_keyring" ]; then
keyring="$custom_keyring"
else
keyring="$(mktemp /tmp/keyringXXXXXXXX.asc)"
apt-key exportall > "$keyring"
fi
cow () { cow () {
if ! $use_system_sources; then if ! $use_system_sources; then
cowbuilder "$@" \ cowbuilder "$@" \
@ -316,17 +326,18 @@ build_debs () {
--architecture $arch \ --architecture $arch \
--basepath $cow_img --basepath $cow_img
else else
local keyring="$(mktemp /tmp/keyringXXXXXXXX.asc)"
apt-key exportall > "$keyring"
cowbuilder "$@" \ cowbuilder "$@" \
--distribution $distro \ --distribution $distro \
--architecture $arch \ --architecture $arch \
--basepath $cow_img \ --basepath $cow_img \
--keyring "$keyring" \ --keyring "$keyring" \
--othermirror "$(get_mirrors $distro)" --othermirror "$(get_mirrors $distro $custom_sources_file)"
rm -f $keyring
fi fi
} }
if [ ! -e "$custom_keyring" ]; then
# Cleanup script created temporary file
rm -f $keyring
fi
if ! [ -d $cow_img ]; then if ! [ -d $cow_img ]; then
announce "Creating base $distro-$arch image..." announce "Creating base $distro-$arch image..."
local x=30 local x=30
@ -466,6 +477,9 @@ commands:
-i Auto install build deps on host system -i Auto install build deps on host system
-j Build debs in parallel -j Build debs in parallel
-k Don't override pbuilder image configurations -k Don't override pbuilder image configurations
-K [/path/to/keyring.asc]
Use custom keyring file for sources.list in build environment
in the format of: apt-key exportall > /path/to/file.asc
-l <modules> -l <modules>
-m [ quicktest | non-dfsg ] -m [ quicktest | non-dfsg ]
Choose custom list of modules to build Choose custom list of modules to build
@ -477,6 +491,8 @@ commands:
-s [ paranoid | reckless ] -s [ paranoid | reckless ]
Set FS bootstrap/build -j flags Set FS bootstrap/build -j flags
-t Use system /etc/apt/sources.list in build environment -t Use system /etc/apt/sources.list in build environment
-T [/path/to/sources.list]
Use custom /etc/apt/sources.list in build environment
-u <suite-postfix> -u <suite-postfix>
Specify a custom suite postfix Specify a custom suite postfix
-v Set version -v Set version
@ -490,7 +506,12 @@ commands:
-b Binary-only build -b Binary-only build
-d Enable cowbuilder debug hook -d Enable cowbuilder debug hook
-k Don't override pbuilder image configurations -k Don't override pbuilder image configurations
-K [/path/to/keyring.asc]
Use custom keyring file for sources.list in build environment
in the format of: apt-key exportall > /path/to/file.asc
-t Use system /etc/apt/sources.list in build environment -t Use system /etc/apt/sources.list in build environment
-T [/path/to/sources.list]
Use custom /etc/apt/sources.list in build environment
create-dbg-pkgs create-dbg-pkgs