sudo apt-get install --force-yes -y cmake git build-essential pkg-config gettext libavahi-client-dev libssl-dev zlib1g-dev wget bzip2 git-core liburiparser-dev libdvbcsa-dev python3 python3-requests debhelper ccache lsb-release
DEBIAN_FRONTEND=noninteractive apt-get install --force-yes -y libpcre3-dev || DEBIAN_FRONTEND=noninteractive apt-get install --force-yes -y libpcre2-dev
AUTOBUILD_CONFIGURE_EXTRA=--enable-ccache\ --enable-ffmpeg_static\ --enable-hdhomerun_static\ --python=python3 ./Autobuild.sh -p raspios
+ support/cloudsmith.sh -n -p raspios -f '../tvheadend*.deb'
- uses: actions/upload-artifact@v3
with:
name: Tvheadend-deb
git config --global --add safe.directory /home/runner/work/tvheadend/tvheadend || true
AUTOBUILD_CONFIGURE_EXTRA=--enable-ccache\ --enable-ffmpeg_static\ --enable-hdhomerun_static\ --python=python3 ./Autobuild.sh
cp ../tvheadend*.deb /artifacts/
+ support/cloudsmith.sh -n -f '../tvheadend*.deb'
- uses: actions/upload-artifact@v3
with:
name: Tvheadend-deb
name: Tvheadend-deb
path: tvheadend*.deb
if-no-files-found: error
+ - name: upload-cloudsmith
+ run: support/cloudsmith.sh -n -f 'tvheadend*.deb'
build-rpm-native:
runs-on: ubuntu-latest
name: Tvheadend-RPM
path: tvheadend*.rpm
if-no-files-found: error
+ # - name: upload-cloudsmith
+ # run: support/cloudsmith.sh -n -f 'tvheadend*.rpm'
OSPREFIX=""
OS=""
FILE=""
+DRYRUN="0"
-while getopts "t:p:f:" OPTION
+while getopts "t:p:f:n" OPTION
do
- case $OPTION in
- t)
- TARGET="$OPTARG"
- ;;
- p)
- OSPREFIX="$OPTARG"
- ;;
- f)
- FILE="$OPTARG"
- ;;
- esac
+ case $OPTION in
+ t)
+ TARGET="$OPTARG"
+ ;;
+ p)
+ OSPREFIX="$OPTARG"
+ ;;
+ f)
+ FILE="$OPTARG"
+ ;;
+ n)
+ DRYRUN="1"
+ ;;
+ esac
done
if [[ -z $FILE ]]; then
case $OSPREFIX$TARGET in
bookworm|bullseye|buster|sid|stretch|jessie|trixie)
OS="debian";;
- bionic|focal|jammy|kinetic|impish|trusty|xenial)
+ trusty|xenial|bionic|focal|impish|jammy|kinetic|lunar|mantic)
OS="ubuntu";;
raspios*)
OS="raspbian";;
export LANG=C.UTF-8
export DEBIAN_FRONTEND=noninteractive
+# Since Python 3.11, this flag is required to install pip packages globally
+export PIP_BREAK_SYSTEM_PACKAGES=1
+
apt install --force-yes -y python3.7 || true
-# Function to initialize pip using ensurepip and upgrade if necessary
-initialize_pip() {
- # Use ensurepip to bootstrap pip if available
- python3 -m ensurepip || true
+# Use ensurepip to bootstrap pip if available, else install from apt
+python3 -m ensurepip || apt install --force-yes -y python3-pip || apt install --force-yes -y python-pip
- PYTHON_VERSION=$(python3 -c 'import platform; print(platform.python_version())')
- MAJOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f1)
- MINOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f2)
+# Get the major and minor version of the installed Python
+python_version=$(python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')
- if [[ $MAJOR_VERSION -eq 3 ]] && [[ $MINOR_VERSION -ge 6 ]]; then
- # For Python 3.6 and above, upgrade pip to the latest version
- python3 -m pip install --upgrade pip
- fi
-}
-
-# Initialize and upgrade pip
-initialize_pip
+# Compare versions and upgrade pip accordingly
+if [[ "$python_version" == "3.3" ]]; then
+ python3 -m pip install --upgrade 'pip<10.0.2' 'colorama==0.4.1' 'urllib3==1.22'
+elif [[ "$python_version" == "3.4" ]]; then
+ python3 -m pip install --ignore-installed --upgrade 'pip<19.2' 'colorama==0.4.1' 'urllib3==1.24.3' 'requests==2.21.0' 'six==1.16.0' 'certifi==2021.10.8'
+elif [[ "$python_version" == "3.5" ]]; then
+ python3 -m pip install --upgrade 'pip<20.4'
+elif [[ "$python_version" == "3.6" ]]; then
+ python3 -m pip install --upgrade 'pip<22.0'
+else
+ # For Python 3.7 and above, install the latest version of pip
+ python3 -m pip install --upgrade pip
+fi
pip3 install --upgrade cloudsmith-cli || pip install --upgrade cloudsmith-cli || pip2 install --upgrade cloudsmith-cli
+python3 /usr/local/bin/cloudsmith --version || python /usr/local/bin/cloudsmith --version || cloudsmith --version
FILEARRAY=($FILE)
for package in "${FILEARRAY[@]}"; do
- python3 /usr/local/bin/cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package || python /usr/local/bin/cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package || cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package
+ if [ $DRYRUN = "1" ]; then
+ echo "DRYRUN MODE: Skip pushing tvheadend/tvheadend/$OS/$TARGET $package"
+ else
+ python3 /usr/local/bin/cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package || python /usr/local/bin/cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package || cloudsmith push deb "tvheadend/tvheadend/$OS/$TARGET" $package
+ fi
done