diff --git a/.gitignore b/.gitignore index af5c03a05..b2e167e7b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist .coverage *.extracted *.pyc +**/*.egg-info \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 90f3cfa66..8b7410ab3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,13 @@ addons: apt: update: true install: + - export PYTHON=$(which python3) - ./deps.sh --yes - - pip install coverage - - ./setup.py install -script: ./setup.py test -cache: pip + - sudo -E $PYTHON -mpip install coverage + - sudo -E $PYTHON ./setup.py install +script: + - export PYTHON=$(which python3) + - sudo -E $PYTHON ./setup.py test jobs: include: - stage: test diff --git a/deps.sh b/deps.sh index 959566080..cbd821cd9 100755 --- a/deps.sh +++ b/deps.sh @@ -8,7 +8,9 @@ else YES=0 fi +set -eu set -o nounset +set -x if ! which lsb_release > /dev/null then @@ -60,35 +62,36 @@ fi PYTHON3_APT_CANDIDATES="" PYTHON3_YUM_CANDIDATES="" YUM_CANDIDATES="git gcc gcc-c++ make openssl-devel qtwebkit-devel qt-devel gzip bzip2 tar arj p7zip p7zip-plugins cabextract squashfs-tools zlib zlib-devel lzo lzo-devel xz xz-compat-libs xz-libs xz-devel xz-lzma-compat python-backports-lzma lzip pyliblzma perl-Compress-Raw-Lzma lzop srecord" -PIP_COMMANDS="pip3" +PYTHON="$(which python3)" # Check for root privileges if [ $UID -eq 0 ] then + echo "UID is 0, sudo not required" SUDO="" else - SUDO="sudo" + SUDO="sudo -E" REQUIRED_UTILS="sudo $REQUIRED_UTILS" fi function install_yaffshiv { - git clone https://github.com/devttys0/yaffshiv - (cd yaffshiv && $SUDO python3 setup.py install) + git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/yaffshiv + (cd yaffshiv && $SUDO $PYTHON setup.py install) $SUDO rm -rf yaffshiv } function install_sasquatch { - git clone https://github.com/devttys0/sasquatch + git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch (cd sasquatch && $SUDO ./build.sh) $SUDO rm -rf sasquatch } function install_jefferson { - git clone https://github.com/sviehb/jefferson - (cd jefferson && $SUDO pip3 install -r requirements.txt && $SUDO python3 setup.py install) + git clone --quiet --depth 1 --branch "master" https://github.com/sviehb/jefferson + (cd jefferson && $SUDO $PYTHON -mpip install -r requirements.txt && $SUDO $PYTHON setup.py install) $SUDO rm -rf jefferson } @@ -110,7 +113,7 @@ function install_cramfstools INSTALL_LOCATION=/usr/local/bin # https://github.com/torvalds/linux/blob/master/fs/cramfs/README#L106 - git clone https://github.com/npitre/cramfs-tools + git clone --quiet --depth 1 --branch "master" https://github.com/npitre/cramfs-tools # There is no "make install" (cd cramfs-tools \ && make \ @@ -123,19 +126,15 @@ function install_cramfstools function install_ubireader { - git clone https://github.com/jrspruitt/ubi_reader - (cd ubi_reader && $SUDO python3 setup.py install) + git clone --quiet --depth 1 --branch "master" https://github.com/jrspruitt/ubi_reader + (cd ubi_reader && $SUDO $PYTHON setup.py install) $SUDO rm -rf ubi_reader } function install_pip_package { PACKAGE="$1" - - for PIP_COMMAND in $PIP_COMMANDS - do - $SUDO $PIP_COMMAND install $PACKAGE - done + $SUDO $PYTHON -mpip install $PACKAGE } function find_path @@ -240,14 +239,6 @@ then exit 1 fi -# Check to see if we should install modules for python3 as well -find_path python3 -if [ $? -eq 0 ] -then - PKG_CANDIDATES="$PKG_CANDIDATES $PKG_PYTHON3_CANDIDATES" - PIP_COMMANDS="pip3 $PIP_COMMANDS" -fi - # Do the install(s) cd /tmp $SUDO $PKGCMD $PKGCMD_OPTS $PKG_CANDIDATES