]> Frank Brehm's Git Trees - pixelpark/python-packaging.git/commitdiff
Adding gitlab/build-python-packages.yaml and gitlab/build-template-python.yaml
authorFrank Brehm <frank@brehm-online.com>
Thu, 29 Dec 2022 15:13:53 +0000 (16:13 +0100)
committerFrank Brehm <frank@brehm-online.com>
Thu, 29 Dec 2022 15:13:53 +0000 (16:13 +0100)
gitlab/build-python-packages.yaml [new file with mode: 0644]
gitlab/build-template-python.yaml [new file with mode: 0644]
gitlab/python-tests.yaml

diff --git a/gitlab/build-python-packages.yaml b/gitlab/build-python-packages.yaml
new file mode 100644 (file)
index 0000000..64b146e
--- /dev/null
@@ -0,0 +1,39 @@
+---
+
+include:
+  - local: /gitlab/build-template-python.yaml
+
+# ---------------------------
+build CentOS 7 with Python 3.6:
+  variables:
+    EL_MAJOR_VERSION: '7'
+    YUM: yum
+    PYTHON_VERSION_DOT: '3.6'
+    PYTHON_VERSION_NODOT: '36'
+  extends:
+    - 'setup-build-environment'
+  image: centos:7
+
+# ---------------------------
+build CentOS 8 with Python 3.8:
+  variables:
+    EL_MAJOR_VERSION: '8'
+    YUM: dnf
+    PYTHON_VERSION_DOT: '3.8'
+    PYTHON_VERSION_NODOT: '38'
+  extends:
+    - 'setup-build-environment'
+  image: dokken/centos-stream-8
+
+# ---------------------------
+build CentOS 9 with Python 3:
+  variables:
+    EL_MAJOR_VERSION: '9'
+    YUM: dnf
+    PYTHON_VERSION_DOT: '3'
+    PYTHON_VERSION_NODOT: '3'
+  extends:
+    - 'setup-build-environment'
+  image: dokken/centos-stream-9
+
+# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list
diff --git a/gitlab/build-template-python.yaml b/gitlab/build-template-python.yaml
new file mode 100644 (file)
index 0000000..95ffb97
--- /dev/null
@@ -0,0 +1,222 @@
+---
+
+variables:
+  BUILD_PACKAGES: 'gnupg2 rpm-build gettext help2man'
+  EL_MAJOR_VERSION: 9
+  PKG_NAME: 'some_python_package'
+  PYTHON_ADDITIONAL_PACKAGES: ''
+  PYTHON_PACKAGES_EL7: >
+    python36 python36-six python36-pip python36-devel python3-setuptools
+    python36-babel python36-pytz
+  PYTHON_PACKAGES_EL8: >
+    python38 python38-six python38-pip python38-devel python38-setuptools
+    platform-python-devel python38-babel python38-pytz
+  PYTHON_PACKAGES_EL9: >
+    python3 python3-six python3-pip python3-devel python3-setuptools
+    python3-babel python3-pytz
+  PYTHON_VERSION_DOT: '3'
+  PYTHON_VERSION_NODOT: '3'
+  SRC_SPEC_FILE: 'template.spec'
+  TEST_LOCALES: 'en_US.UTF-8 de_DE.UTF-8'
+  TGT_SPEC_FILE: "${PKG_NAME}.spec"
+  USED_CHARSET: 'utf8'
+  USED_LC: 'en_US.utf8'
+  USED_LOCALE: 'en_US'
+  YUM: 'dnf'
+  YUM_REPO_HOST: 'repo02.pixelpark.com'
+  YUM_REPO_DIR_HTTP: '/Linux/yum/pixelpark'
+
+#---------------------------
+.setup-build-environment:
+  stage: build
+  rules:
+    - if: '$CI_COMMIT_TAG'
+    - if: $CI_COMMIT_BRANCH == "master"
+    - if: $CI_COMMIT_BRANCH == "main"
+    - if: $CI_COMMIT_BRANCH == "test"
+    - if: $CI_COMMIT_BRANCH =~ /test-.*/
+    - if: $CI_COMMIT_BRANCH =~ /build.*/
+    - if: $CI_COMMIT_BRANCH == "develop"
+  tags:
+    - docker
+  cache:
+    key: ${CI_JOB_NAME}
+    paths:
+      - .rpm-version
+  artifacts:
+    name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
+    paths:
+      - rpmdir/RPMS/*/*.rpm
+      - rpmdir/SRPMS/*.src.rpm
+    expire_in: '1 week'
+  before_script:
+    - ls -lA --color=always /etc/yum.repos.d
+    - |
+      repo_file="/etc/yum.repos.d/CentOS-Stream-PowerTools.repo"
+      if [[ -f "${repo_file}" ]] ; then
+          echo
+          echo "Enabling CentOS 8 PowerTools ..."
+          sed -i -e 's/enabled=.*/enabled=1/' "${repo_file}"
+          echo "Content of ${repo_file}:"
+          cat "${repo_file}"
+      fi
+    - ${YUM} clean all
+    - ${YUM} makecache
+    - |
+      echo "All locales"
+      locale -a
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):install_locales[collapsed=true]\r\e[0KConfiguring and installing locales ..."
+      if [[ -n "${TEST_LOCALES}" ]] ; then
+          if echo "${TEST_LOCALES}" | grep -w 'en_US.UTF-8' >/dev/null ; then
+              USED_LOCALES="${TEST_LOCALES}"
+          else
+              USED_LOCALES="en_US.UTF-8 ${TEST_LOCALES}"
+          fi
+      else
+          USED_LOCALES="en_US.UTF-8"
+      fi
+      if [[ "${EL_MAJOR_VERSION}" == "7" ]] ; then
+          echo "Used locale: '${USED_LOCALE}.${USED_CHARSET}'"
+          localedef --charmap UTF-8 --inputfile "${USED_LOCALE}" "${USED_LC}"
+          for locale in ${TEST_LOCALES} ; do
+              my_locale=$( echo "${locale}" | cut -d. -f1 )
+              if [[ "${my_locale}" == "${USED_LOCALE}" ]] ; then
+                  continue
+              fi
+              my_lc="${my_locale}.${USED_CHARSET}"
+              echo "My lc: '${my_lc}'"
+              localedef --charmap UTF-8 --inputfile "${my_locale}" "${my_lc}"
+          done
+      else
+          packages="glibc-all-langpacks"
+          for locale in ${TEST_LOCALES} ; do
+              my_locale=$( echo "${locale}" | cut -d. -f1 )
+              if [[ "${my_locale}" =~ ^en_GB|pt_BR|zh_CN|zh_TW$ ]] ; then
+                  lang="${my_locale}"
+              else
+                  lang=$( echo "${my_locale}" | cut -d_ -f1 )
+              fi
+              langpack="langpacks-${lang}"
+              if echo "${packages}" | grep -w "${langpack}" >/dev/null ; then
+                  :
+              else
+                  packages+=" ${langpack}"
+              fi
+          done
+          echo "Packages to install: ${packages}"
+          ${YUM} --assumeyes install ${packages}
+      fi
+      echo -e "\e[0Ksection_end:$( date +%s ):install_locales\r\e[0K"
+    - |
+      echo "All locales"
+      locale -a
+      echo
+      echo "locales:"
+      locale
+    - |
+      echo
+      echo "Exporting LC_ALL ..."
+      export LC_ALL="${USED_LC}"
+      export LANG="${USED_LC}"
+      echo
+      echo "locales:"
+      locale
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):install_epel[collapsed=true]\r\e[0KInstalling epel-release ..."
+      ${YUM} --assumeyes install epel-release
+      echo -e "\e[0Ksection_end:$( date +%s ):install_epel\r\e[0K"
+    - |
+      echo "Adding Pixelpark YUM repo ..."
+      echo "[pixelpark]"                                                                > /etc/yum.repos.d/pixelpark.repo
+      echo "name=pixelpark"                                                            >> /etc/yum.repos.d/pixelpark.repo
+      echo "baseurl=https://${YUM_REPO_HOST}${YUM_REPO_DIR_HTTP}/${EL_MAJOR_VERSION}/" >> /etc/yum.repos.d/pixelpark.repo
+      echo "enabled=1"                                                                 >> /etc/yum.repos.d/pixelpark.repo
+      echo "gpgcheck=0"                                                                >> /etc/yum.repos.d/pixelpark.repo
+      echo "gpgkey=https://${YUM_REPO_HOST}/gpg/pixelpark.gpg"                         >> /etc/yum.repos.d/pixelpark.repo
+      echo                                                                             >> /etc/yum.repos.d/pixelpark.repo
+      echo
+      echo "Generated /etc/yum.repos.d/pixelpark.repo:"
+      cat /etc/yum.repos.d/pixelpark.repo
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):yum_make_cache[collapsed=true]\r\e[0KExecuting: ${YUM} makecache ..."
+      ${YUM} makecache
+      echo -e "\e[0Ksection_end:$( date +%s ):yum_make_cache\r\e[0K"
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):yum_upgrade[collapsed=true]\r\e[0KExecuting: ${YUM} upgrade ..."
+      ${YUM} --assumeyes upgrade
+      echo -e "\e[0Ksection_end:$( date +%s ):yum_upgrade\r\e[0K"
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):update_tzdata[collapsed=true]\r\e[0KExecuting: Installing or upgrading TZdata ..."
+      echo -e "\e[0Ksection_end:$( date +%s ):update_tzdata\r\e[0K"
+      if rpm -qa | grep '^tzdata-' >/dev/null ; then
+        echo "Reinstalling tzdata ..."
+        echo "Executing: ${YUM} --assumeyes reinstall tzdata || true"
+        ${YUM} --assumeyes reinstall tzdata || true
+      else
+        echo "Installing tzdata ..."
+        echo "Executing: ${YUM} --assumeyes install tzdata || true"
+        ${YUM} --assumeyes install tzdata || true
+      fi
+      echo
+      echo "Timezone database:"
+      ls -l --color=always /usr/share/zoneinfo/zone.tab
+    - |
+      echo -e "\e[0Ksection_start:$( date +%s ):install_additional[collapsed=true]\r\e[0KExecuting: Installing additional packages ..."
+      install_packages="${BUILD_PACKAGES}"
+      if [[ "${EL_MAJOR_VERSION}" == "7" ]] ; then
+          install_packages+=" ${PYTHON_PACKAGES_EL7}"
+      elif [[ "${EL_MAJOR_VERSION}" == "8" ]] ; then
+          install_packages+=" ${PYTHON_PACKAGES_EL8}"
+      elif [[ "${EL_MAJOR_VERSION}" == "9" ]] ; then
+          install_packages+=" ${PYTHON_PACKAGES_EL9}"
+      fi
+      if [[ -n "${PYTHON_ADDITIONAL_PACKAGES}" ]] ; then
+          for pkg in ${PYTHON_ADDITIONAL_PACKAGES} ; do
+              pkg=$( echo "${pkg}" | sed -e "s/^python3[0-9]-/python${PYTHON_VERSION_NODOT}-/" )
+              install_packages+=" ${pkg}"
+          done
+      fi
+      echo "Additonal packages to install: ${install_packages}"
+      ${YUM} --assumeyes install ${install_packages}
+      echo -e "\e[0Ksection_end:$( date +%s ):install_additional\r\e[0K"
+    - |
+      echo
+      echo "Python binaries:"
+      ls -l --color=always /bin/python* /bin/pip* || true
+    - pip3 list --format columns
+  script:
+    - mkdir -pv rpmdir
+    - mkdir -pv rpmdir/SOURCES
+    - |
+      echo
+      echo "Generating manpages ..."
+      PKG_VERSION=$( ./get-rpm-version )
+      SRC_BASE="python${PYTHON_VERSION_NODOT}_${PKG_NAME}-${PKG_VERSION}"
+      SRC_DIR="rpmdir/SOURCES/${SRC_BASE}"
+      echo "Sources directory: '${SRC_DIR}'"
+      mkdir -pv "${SRC_DIR}"
+      echo
+      man_section=1
+      man_dir="${SRC_DIR}/usr/share/man/man${man_section}"
+      if [[ -d bin ]] ; then
+          for script in bin/* ; do
+              if [[ ! -x "${script}" ]] ; then
+                  continue
+              fi
+              if [[ ! -d "${man_dir}" ]] ; then
+                  mkdir -pv "${man_dir}"
+              fi
+              script_base=$( basename "${script}" )
+              man_file="${man_dir}/${script_base}.${man_section}"
+              echo "  * ${script_base}.${man_section}"
+              cmd="help2man --no-info --no-discard-stderr"
+              cmd+=" --version-string \"${PKG_VERSION}\""
+              cmd+=" --section ${man_section}"
+              cmd+=" \"${script}\" | gzip -v9"
+              echo "      Executing: ${cmd} > \"${man_file}.gz\""
+              eval ${cmd} > "${man_file}.gz"
+          done
+      fi
+
+# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list
index 75b7cd80f9a653b99e7b9fa67d824b73b8ccab41..cd3cf392e5a6f9b5750af859798114fbda052504 100644 (file)
@@ -4,9 +4,6 @@ include:
   - local: /gitlab/python-setup-template.yaml
   - local: /gitlab/python-test-template.yaml
 
-variables:
-  UHU: 'in gitlab/python-tests.yaml'
-
 # ---------------------------
 test Python 3.6:
   extends: