mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-13 18:04:49 +00:00
Merge pull request #2043 from telegramdesktop/auchri/fix_travis
Fix travis
This commit is contained in:
commit
0e66288a69
@ -17,6 +17,7 @@ arch:
|
||||
|
||||
- git
|
||||
- patch
|
||||
- dee-fixed
|
||||
- libunity
|
||||
- libappindicator-gtk2
|
||||
|
||||
@ -44,4 +45,4 @@ before_install:
|
||||
- .travis/check.sh
|
||||
|
||||
script:
|
||||
- .travis/arch.sh
|
||||
- .travis/arch.sh
|
||||
|
@ -21,14 +21,16 @@
|
||||
|
||||
ARCH_TRAVIS_MIRROR=${ARCH_TRAVIS_MIRROR:-"https://lug.mtu.edu/archlinux"}
|
||||
ARCH_TRAVIS_ARCH_ISO=${ARCH_TRAVIS_ARCH_ISO:-"$(date +%Y.%m).01"}
|
||||
ARCH_TRAVIS_ARCH=${ARCH_TRAVIS_ARCH:-"x86_64"}
|
||||
mirror_entry='Server = '$ARCH_TRAVIS_MIRROR'/\$repo/os/\$arch'
|
||||
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-x86_64.tar.gz"
|
||||
default_root="root.x86_64"
|
||||
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
|
||||
default_root="root.${ARCH_TRAVIS_ARCH}"
|
||||
ARCH_TRAVIS_CHROOT=${ARCH_TRAVIS_CHROOT:-"$default_root"}
|
||||
user="travis"
|
||||
user_home="/home/$user"
|
||||
user_build_dir="/build"
|
||||
user_uid=$UID
|
||||
user_build_dir=$(pwd)
|
||||
uid=$UID
|
||||
gid=$GID
|
||||
|
||||
if [ -n "$CC" ]; then
|
||||
# store travis CC
|
||||
@ -56,7 +58,7 @@ setup_chroot() {
|
||||
# if it fails, try arch iso form the previous month
|
||||
if [ $ret -gt 0 ]; then
|
||||
ARCH_TRAVIS_ARCH_ISO="$(date +%Y.%m -d "-1 month").01"
|
||||
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-x86_64.tar.gz"
|
||||
archive="archlinux-bootstrap-$ARCH_TRAVIS_ARCH_ISO-${ARCH_TRAVIS_ARCH}.tar.gz"
|
||||
as_normal "curl -O $ARCH_TRAVIS_MIRROR/iso/$ARCH_TRAVIS_ARCH_ISO/$archive"
|
||||
fi
|
||||
fi
|
||||
@ -102,13 +104,13 @@ setup_chroot() {
|
||||
chroot_as_root "locale-gen"
|
||||
|
||||
# setup non-root user
|
||||
chroot_as_root "useradd -u $user_uid -m -s /bin/bash $user"
|
||||
chroot_as_root "useradd -u $uid -m -s /bin/bash $user"
|
||||
|
||||
# disable password for sudo users
|
||||
as_root "echo \"$user ALL=(ALL) NOPASSWD: ALL\" >> $ARCH_TRAVIS_CHROOT/etc/sudoers.d/$user"
|
||||
|
||||
# Add build dir
|
||||
chroot_as_root "mkdir $user_build_dir && chown $user $user_build_dir"
|
||||
chroot_as_root "mkdir -p $user_build_dir && chown $user $user_build_dir"
|
||||
|
||||
# bind $TRAVIS_BUILD_DIR to chroot build dir
|
||||
sudo mount --bind $TRAVIS_BUILD_DIR $ARCH_TRAVIS_CHROOT$user_build_dir
|
||||
@ -157,14 +159,22 @@ as_root() {
|
||||
# run command in chroot as root
|
||||
chroot_as_root() {
|
||||
local str="$@"
|
||||
run sudo_wrapper chroot $ARCH_TRAVIS_CHROOT /bin/bash -c "$str"
|
||||
run sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
|
||||
$ARCH_TRAVIS_CHROOT /bin/bash -c "$str"
|
||||
}
|
||||
|
||||
# execute command in chroot as normal user
|
||||
_chroot_as_normal() {
|
||||
local str="$@"
|
||||
sudo_wrapper setarch $ARCH_TRAVIS_ARCH chroot \
|
||||
--userspec=$uid:$uid $ARCH_TRAVIS_CHROOT /bin/bash \
|
||||
-c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $str"
|
||||
}
|
||||
|
||||
# run command in chroot as normal user
|
||||
chroot_as_normal() {
|
||||
local str="$@"
|
||||
run sudo_wrapper chroot --userspec=$user:$user $ARCH_TRAVIS_CHROOT /bin/bash \
|
||||
-c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $str"
|
||||
run _chroot_as_normal "$str"
|
||||
}
|
||||
|
||||
# run command
|
||||
@ -182,7 +192,7 @@ run() {
|
||||
run_build_script() {
|
||||
local cmd="$@"
|
||||
echo "$ $cmd"
|
||||
sudo_wrapper chroot --userspec=$user:$user $ARCH_TRAVIS_CHROOT /bin/bash -c "export HOME=$user_home USER=$user TRAVIS_BUILD_DIR=$user_build_dir && cd $user_build_dir && $cmd"
|
||||
_chroot_as_normal "$cmd"
|
||||
local ret=$?
|
||||
|
||||
if [ $ret -gt 0 ]; then
|
||||
@ -193,18 +203,23 @@ run_build_script() {
|
||||
|
||||
# setup pacaur
|
||||
setup_pacaur() {
|
||||
local cowerarchive="cower.tar.gz"
|
||||
local aururl="https://aur.archlinux.org/cgit/aur.git/snapshot/"
|
||||
# install cower
|
||||
as_normal "curl -O $aururl/$cowerarchive"
|
||||
as_normal "tar xf $cowerarchive"
|
||||
chroot_as_normal "cd cower && makepkg -is --skippgpcheck --noconfirm"
|
||||
as_root "rm -r cower"
|
||||
as_normal "rm $cowerarchive"
|
||||
# install pacaur
|
||||
chroot_as_normal "cower -dd pacaur"
|
||||
chroot_as_normal "cd pacaur && makepkg -is --noconfirm"
|
||||
chroot_as_normal "rm -rf pacaur"
|
||||
# Check if pacaur is available in the added repos
|
||||
if _chroot_as_normal "pacman -Si pacaur &> /dev/null"; then
|
||||
chroot_as_root "pacman -S --noconfirm pacaur"
|
||||
else
|
||||
local cowerarchive="cower.tar.gz"
|
||||
local aururl="https://aur.archlinux.org/cgit/aur.git/snapshot/"
|
||||
# install cower
|
||||
as_normal "curl -O $aururl/$cowerarchive"
|
||||
as_normal "tar xf $cowerarchive"
|
||||
chroot_as_normal "cd cower && makepkg -is --skippgpcheck --noconfirm"
|
||||
as_root "rm -r cower"
|
||||
as_normal "rm $cowerarchive"
|
||||
# install pacaur
|
||||
chroot_as_normal "cower -dd pacaur"
|
||||
chroot_as_normal "cd pacaur && makepkg -is --noconfirm"
|
||||
chroot_as_normal "rm -rf pacaur"
|
||||
fi
|
||||
}
|
||||
|
||||
# install package through pacaur
|
||||
@ -231,7 +246,7 @@ travis_yml() {
|
||||
}
|
||||
|
||||
read_config() {
|
||||
old_ifs=$IFS
|
||||
local old_ifs=$IFS
|
||||
IFS=$'\n'
|
||||
CONFIG_BUILD_SCRIPTS=($(travis_yml arch script))
|
||||
CONFIG_PACKAGES=($(travis_yml arch packages))
|
||||
|
Loading…
Reference in New Issue
Block a user