[network-manager-applet/th/tmp: 1/2] gitlab-ci: move logic from gitlab-ci.yml to script and install external libnma-1.8.28



commit 240da3ea68caa9eac516d5c2bd993c0eb7cc58be
Author: Thomas Haller <thaller redhat com>
Date:   Sat Mar 7 10:03:53 2020 +0100

    gitlab-ci: move logic from gitlab-ci.yml to script and install external libnma-1.8.28
    
    I think a plain shell script makes it easier to implement the build
    steps. It's easier to read and to extend.
    
    Also, the gitlab-ci script tried to install libnma from rawhide.
    However, while the libnma-1.8.26 package is currently built in koji,
    it is still (for some reasons) not available for installation. The
    build step would still install libnma-1.8.24 (which was still bundled
    with applet). Aside that, there are currently other issues in rawhide
    that prevent this from working.
    
    This only worked accidentally, because the network-manager-applet build
    does not yet explicitly require a new libnma package. However, in practice
    it does already, because when building against libnma-2.8.24, the
    "org.gnome.nm-applet.gschema.xml" is missing. Next we are going to explicitly
    require libnma-1.8.28, so this wouldn't work anymore.
    
    Instead I did a scratch build of libnma-1.8.28 in koji. Adjust the
    build steps and install the package. This is a temporary solution,
    that helps to boot strap the update to an unbundled libnma-1.8.28.

 .gitlab-ci.yml       | 166 ++++++++++-----------------------------------------
 scripts/gitlab-ci.sh |  94 +++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+), 134 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ecbda96e..ec762a73 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,64 +4,28 @@
 # If things don't seem to work, this can help:
 # https://gitlab.gnome.org/GNOME/network-manager-applet/-/ci/lint
 
-.fedora_minimal: &fedora_minimal
-  before_script:
-    - dnf -y install
-      file
-      findutils
-      gcc
-      libtool
-      desktop-file-utils
-      gettext-devel
-      glib2-devel
-      gtk3-devel
-      libgudev1-devel
-      libnotify-devel
-      libsecret-devel
-      NetworkManager-libnm-devel
-      pkgconfig
-      /usr/bin/autopoint
-      fedora-repos-rawhide
-    - dnf -y install --nogpgcheck --enablerepo=rawhide
-      libnma-devel
-
-.fedora_full: &fedora_full
-  before_script:
-    - dnf -y install
-      file
-      findutils
-      gcc
-      libtool
-      desktop-file-utils
-      gettext-devel
-      glib2-devel
-      gtk3-devel
-      libgudev1-devel
-      libnotify-devel
-      libsecret-devel
-      NetworkManager-libnm-devel
-      pkgconfig
-      /usr/bin/autopoint
-      redhat-rpm-config
-      jansson-devel
-      ModemManager-glib-devel
-      libselinux-devel
-      fedora-repos-rawhide
-    - dnf -y install --nogpgcheck --enablerepo=rawhide
-      libnma-devel
-
 .dist: &dist
   dependencies:
     - fedora30_dist
-  variables:
-    GIT_STRATEGY: none
 
-.fedora_meson_minimal: &fedora_meson_minimal
-  <<: *fedora_minimal
+fedora30_dist:
+  image: fedora:30
+  stage: build
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full autotools
+  script:
+    - sh autogen.sh
+    - make -j$(nproc) distcheck
+  artifacts:
+    paths:
+      - "*.xz"
+
+fedora_meson_minimal:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_minimal meson
   script:
     - tar xJf network-manager-applet-*.tar.xz
-    - dnf -y install meson
     - meson
       -Dwwan=false
       -Dselinux=false
@@ -74,12 +38,15 @@
     - ninja -v -C build test
     - ninja -v -C build install
     - ninja -v -C build uninstall
+  image: fedora:latest
+  stage: test
+  when: manual
 
-.fedora_meson_full: &fedora_meson_full
-  <<: *fedora_full
+fedora_meson_full:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full meson
   script:
-    - dnf -y install meson
     - tar xJf network-manager-applet-*.tar.xz
     - meson
       -Dwwan=true
@@ -93,12 +60,14 @@
     - ninja -v -C build test
     - ninja -v -C build install
     - ninja -v -C build uninstall
+  image: fedora:latest
+  stage: test
 
-.fedora_autotools_minimal: &fedora_autotools_minimal
-  <<: *fedora_minimal
+fedora_autotools_minimal:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_minimal make
   script:
-    - dnf -y install make
     - tar xJf network-manager-applet-*.tar.xz
     - cd network-manager-applet-*/
     - ./configure
@@ -115,12 +84,15 @@
     - make -j$(nproc) check
     - make -j$(nproc) install
     - make -j$(nproc) uninstall
+  image: fedora:latest
+  stage: test
+  when: manual
 
-.fedora_autotools_full: &fedora_autotools_full
-  <<: *fedora_full
+fedora_autotools_full:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full make
   script:
-    - dnf -y install make
     - tar xJf network-manager-applet-*.tar.xz
     - cd network-manager-applet-*/
     - ./configure
@@ -136,79 +108,5 @@
     - make -j$(nproc) check
     - make -j$(nproc) install
     - make -j$(nproc) uninstall
-
-fedora30_dist:
-  <<: *fedora_full
-  image: fedora:30
-  stage: build
-  script:
-    - dnf -y install
-      autoconf automake make
-    - sh autogen.sh
-    - make -j$(nproc) distcheck
-  artifacts:
-    paths:
-      - "*.xz"
-
-fedora_meson_minimal:
-  <<: *fedora_meson_minimal
   image: fedora:latest
   stage: test
-
-fedora_meson_full:
-  <<: *fedora_meson_full
-  image: fedora:latest
-  stage: test
-
-fedora_autotools_minimal:
-  <<: *fedora_autotools_minimal
-  image: fedora:latest
-  stage: test
-
-fedora_autotools_full:
-  <<: *fedora_autotools_full
-  image: fedora:latest
-  stage: test
-
-#centos7:
-#  <<: *dist
-#  before_script:
-#    - yum -y install
-#      file
-#      findutils
-#      gcc
-#      libtool
-#      desktop-file-utils
-#      gettext-devel
-#      glib2-devel
-#      gtk3-devel
-#      intltool
-#      libgudev1-devel
-#      libnotify-devel
-#      libsecret-devel
-#      NetworkManager-libnm-devel
-#      pkgconfig
-#      /usr/bin/autopoint
-#      redhat-rpm-config
-#      jansson-devel
-#      ModemManager-glib-devel
-#      libselinux-devel
-#      make
-#  script:
-#    - tar xJf network-manager-applet-*.tar.xz
-#    - cd network-manager-applet-*/
-#    - ./configure
-#      --disable-silent-rules
-#      --with-more-asserts=yes
-#      --enable-nls
-#      --enable-schemas-compile
-#      --enable-more-warnings
-#      --with-wwan
-#      --with-selinux
-#      --with-team
-#    - make -j$(nproc)
-#    - make -j$(nproc) check
-#    - make -j$(nproc) install
-#    - make -j$(nproc) uninstall
-#  image: centos:7
-#  stage: test
diff --git a/scripts/gitlab-ci.sh b/scripts/gitlab-ci.sh
new file mode 100755
index 00000000..566eb1e4
--- /dev/null
+++ b/scripts/gitlab-ci.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+die() {
+    echo ">>> FAIL: $@"
+    exit 1
+}
+
+is_in_set() {
+    local v="$1"
+    shift
+    for w ; do
+        [[ "$v" == "$w" ]] && return 0
+    done
+    return 1
+}
+
+fedora_pkg_minimal() {
+    echo \
+        /usr/bin/autopoint \
+        NetworkManager-libnm-devel \
+        desktop-file-utils \
+        fedora-repos-rawhide \
+        file \
+        findutils \
+        gcc \
+        gettext-devel \
+        glib2-devel \
+        gtk3-devel \
+        libgudev1-devel \
+        libnotify-devel \
+        libsecret-devel \
+        libtool \
+        pkgconfig \
+        #
+}
+
+fedora_pkg_full() {
+    echo \
+        $(fedora_pkg_minimal) \
+        redhat-rpm-config \
+        jansson-devel \
+        ModemManager-glib-devel \
+        libselinux-devel \
+        #
+}
+
+fedora_pkg_build() {
+    case "$1" in
+        autotools)
+            echo autoconf automake make
+            ;;
+        make)
+            echo make
+            ;;
+        meson)
+            echo meson
+            ;;
+        "")
+            ;;
+        *)
+            die "Unknown build option \"$1\""
+            ;;
+    esac
+}
+
+fedora_install_libnma() {
+    pushd /etc/yum.repos.d
+        local 
URL='https://gitlab.gnome.org/thaller/network-manager-applet/-/raw/e9d885749b281e86fb92421e73e1564b233141b4/nm-applet-prebuilt-rpms.tgz'
+        $CMD curl "$URL" --output ./nm-applet-prebuilt-rpms.tgz
+        $CMD tar -xvzf ./nm-applet-prebuilt-rpms.tgz
+        $CMD dnf -y install --enablerepo=nm-applet-prebuilt-rpms libnma-devel
+    popd
+}
+
+fedora_install_minimal() {
+    $CMD dnf -y install $(fedora_pkg_minimal) $(fedora_pkg_build "$1")
+    fedora_install_libnma
+}
+
+fedora_install_full() {
+    $CMD dnf -y install $(fedora_pkg_full) $(fedora_pkg_build "$1")
+    fedora_install_libnma
+}
+
+
+set -xe
+
+if is_in_set "$1" fedora_install_minimal fedora_install_full ; then
+    is_in_set "$2" autotools make meson || die "invalid argument \$2 (\"$2\")"
+    "$1" "$2"
+    exit 0
+fi
+
+die "Unknown command \"$1\""


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]