From a75bc61e1645ac343d9d96fea5c817597352fb54 Mon Sep 17 00:00:00 2001
From: Pea Nut <peanut2@systemli.org>
Date: Mon, 13 Jan 2025 10:48:41 +0100
Subject: [PATCH 1/2] [CI] Use current working directory when building Arch
 Linux package

Previously always latest main branch was used.
---
 .gitlab-ci.yml     | 11 ++++++-----
 ArchLinux/PKGBUILD |  3 ++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fdcec06b..64799047 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -49,15 +49,16 @@ build_Arch_Linux_package:
     - "pacman -Suy base-devel --noconfirm"
     - "useradd non_root"
     - "echo 'non_root ALL=NOPASSWD: ALL' >> /etc/sudoers"
-    - "mkdir /home/non_root"
-    - "cp -r Makefile ArchLinux/ /home/non_root"
+    - "mkdir -p /home/non_root/build"
+    - "cp -r . /home/non_root/build"
     - "chown -R non_root:non_root /home/non_root"
   script:
     # makepkg does not run as root, but it needs sudo to install dependencies
-    - "cd /home/non_root && sudo -u non_root make package_arch"
-    - "cd /home/non_root && pacman -U ArchLinux/*tar.zst --noconfirm"
+    - "cat /etc/issue"
+    - "cd /home/non_root/build && sudo -u non_root make package_arch"
+    - "cd /home/non_root/build && pacman -U ArchLinux/*tar.zst --noconfirm"
     # artifacts must be relative to the working directory (e.g. /builds/leap/bitmask-vpn)
-    - "cp /home/non_root/ArchLinux/*.tar.zst $CI_PROJECT_DIR"
+    - "cp /home/non_root/build/ArchLinux/*.tar.zst $CI_PROJECT_DIR"
   artifacts:
     paths:
       - '*.tar.zst'
diff --git a/ArchLinux/PKGBUILD b/ArchLinux/PKGBUILD
index bd8680a1..782aa3d2 100644
--- a/ArchLinux/PKGBUILD
+++ b/ArchLinux/PKGBUILD
@@ -9,7 +9,8 @@ license=("GPL-3.0-only")
 url="https://0xacab.org/leap/bitmask-vpn"
 conflicts=('riseup-vpn' 'riseup-vpn-git')
 
-source=("git+$url.git")
+#source=("git+$url.git")
+source=("bitmask-vpn::git+file://$(pwd)/../")
 sha256sums=('SKIP')
 
 # qt6-tools has /usr/lib/qt6/bin/lrelease
-- 
GitLab


From be8fa973b97663954f2c9832f8b4a70831d24f54 Mon Sep 17 00:00:00 2001
From: Pea Nut <peanut2@systemli.org>
Date: Mon, 16 Dec 2024 10:19:37 +0100
Subject: [PATCH 2/2] [makefile] Fix failing check to verify we're on Arch

Use /etc/os-release instead of /etc/issue in the Makefile, see:
https://0xacab.org/leap/bitmask-vpn/-/merge_requests/271#note_1232050
---
 .gitlab-ci.yml | 1 -
 Makefile       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 64799047..803924b1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,7 +54,6 @@ build_Arch_Linux_package:
     - "chown -R non_root:non_root /home/non_root"
   script:
     # makepkg does not run as root, but it needs sudo to install dependencies
-    - "cat /etc/issue"
     - "cd /home/non_root/build && sudo -u non_root make package_arch"
     - "cd /home/non_root/build && pacman -U ArchLinux/*tar.zst --noconfirm"
     # artifacts must be relative to the working directory (e.g. /builds/leap/bitmask-vpn)
diff --git a/Makefile b/Makefile
index 13e8a63b..740c983f 100644
--- a/Makefile
+++ b/Makefile
@@ -444,7 +444,7 @@ package_deb:
 	@${MAKE} -C build/${PROVIDER} pkg_deb
 
 package_arch:
-	grep -q "Arch Linux" /etc/issue || (echo "Arch Linux system is required to build the Arch Linux package" && exit 1)
+	grep -q "Arch Linux" /etc/os-release || (echo "Arch Linux system is required to build the Arch Linux package" && exit 1)
 	# at least the makepkg binary is mandatory, makepkg is part pacman package
 	(cd ArchLinux && makepkg --syncdeps --noconfirm)
 
-- 
GitLab