Skip to content

Commit

Permalink
chore(packages): update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab CI committed May 20, 2024
1 parent a32bcfc commit eded735
Show file tree
Hide file tree
Showing 33 changed files with 187 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .ci/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ REDIS_SSH_HOST=builds.garudalinux.org
REDIS_SSH_PORT=400
REDIS_SSH_USER=package-deployer
REPO_NAME=garuda
CI_HUMAN_REVIEW=false
CI_HUMAN_REVIEW=true
TEMPLATE_ENABLE_UPDATES=false
26 changes: 17 additions & 9 deletions .ci/create-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
set -euo pipefail

# $1: pkgbase
# $2: Go one commit further back

source .ci/util.shlib

if [ -z "${ACCESS_TOKEN:-}" ]; then
UTIL_PRINT_ERROR "ACCESS_TOKEN is not set. Please set it to a valid access token to use human review or disable CI_HUMAN_REVIEW."
Expand Down Expand Up @@ -119,27 +122,27 @@ function manage_branch() {
local target_branch="$2"
local pkgbase="$3"

git stash
git stash -q
if git show-ref --quiet "origin/$branch"; then
git switch "$branch"
git checkout stash -- "$pkgbase"
git switch -q "$branch"
git checkout -q stash -- "$pkgbase"
# Branch already exists, let's see if it's up to date
# Also check if previous parent commit is no longer ancestor of target_branch
if ! git diff --staged --exit-code --quiet || ! git merge-base --is-ancestor HEAD^ "origin/$target_branch"; then
# Not up to date
git reset --hard "origin/$target_branch"
git checkout stash -- "$pkgbase"
git reset -q --hard "origin/$target_branch"
git checkout stash -q -- "$pkgbase"
git commit -q -m "chore($1): PKGBUILD modified"
git push --force-with-lease origin "$CHANGE_BRANCH"
fi
else
# Branch does not exist, let's create it
git switch -C "$branch" "origin/$target_branch"
git checkout stash -- "$pkgbase"
git switch -q -C "$branch" "origin/$target_branch"
git checkout stash -q -- "$pkgbase"
git commit -q -m "chore($1): PKGBUILD modified"
git push --force-with-lease origin "$CHANGE_BRANCH"
fi
git stash drop
git stash drop -q
}

PKGBASE="$1"
Expand All @@ -156,6 +159,11 @@ fi
ORIGINAL_REF="$(git rev-parse HEAD)"
CHANGE_BRANCH="update-$PKGBASE"

if [ "$2" == "true" ]; then
# Go one commit further back
git -c advice.detachedHead=false checkout -q HEAD^
fi

manage_branch "$CHANGE_BRANCH" "$TARGET_BRANCH" "$PKGBASE"

if [ -v GITLAB_CI ]; then
Expand All @@ -168,4 +176,4 @@ else
fi

# Switch back to the original branch
git -c advice.detachedHead=false checkout "$ORIGINAL_REF"
git -c advice.detachedHead=false checkout -q "$ORIGINAL_REF"
54 changes: 46 additions & 8 deletions .ci/on-schedule.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -x
set -euo pipefail

# This script is triggered by a scheduled pipeline
Expand Down Expand Up @@ -51,6 +52,31 @@ MODIFIED_PACKAGES=()
DELETE_BRANCHES=()
UTIL_GET_PACKAGES PACKAGES
COMMIT="${COMMIT:-false}"
PUSH=false

# Manage the .state worktree to confine the state of packages to a separate branch
# The goal is to keep the commit history clean
function manage_state() {
if git show-ref --quiet "origin/state"; then
git worktree add .state origin/state --detach
fi
git worktree add .newstate -B state --orphan
}

# Check if the current commit is already an automatic commit
# If it is, check if we should overwrite it
function manage_commit() {
if [ -v CI_OVERWRITE_COMMITS ] && [ "$CI_OVERWRITE_COMMITS" == "true" ]; then
local COMMIT_MSG=""
local REGEX="^chore\(packages\): update packages( \[skip ci\])?$"
if COMMIT_MSG="$(git log -1 --pretty=%s)"; then
if [[ "$COMMIT_MSG" =~ $REGEX ]]; then
# Signal that we should not only append to the commit, but also force push the branch
COMMIT=force
fi
fi
fi
}

# Loop through all packages to do optimized aur RPC calls
# $1 = Output associative array
Expand Down Expand Up @@ -137,7 +163,7 @@ function update_via_git() {

if package_changed "$TMPDIR/aur-pulls/$pkgbase" "$pkgbase"; then
if [ -v CI_HUMAN_REVIEW ] && [ "$CI_HUMAN_REVIEW" == "true" ] && package_major_change "$TMPDIR/aur-pulls/$pkgbase" "$pkgbase"; then
UTIL_PRINT_INFO "$pkgbase: Major change detected in."
UTIL_PRINT_INFO "$pkgbase: Major change detected."
VARIABLES_VIA_GIT[CI_REQUIRES_REVIEW]=true
fi
# Rsync: delete files in the destination that are not in the source. Exclude deleting .CI, exclude copying .git
Expand Down Expand Up @@ -281,6 +307,12 @@ function update_vcs() {
fi
}

# Create .state and .newstate worktrees
manage_state

# Reduce history pollution from automatic commits
manage_commit

# Collect last modified timestamps from AUR in an efficient way
collect_aur_timestamps AUR_TIMESTAMPS

Expand All @@ -293,26 +325,28 @@ fi
for package in "${PACKAGES[@]}"; do
unset VARIABLES
declare -A VARIABLES
UTIL_READ_MANAGED_PACAKGE "$package" VARIABLES || VARIABLES[CI_NO_CONFIG]=true
UTIL_READ_MANAGED_PACAKGE "$package" VARIABLES || true
update_pkgbuild VARIABLES
update_vcs VARIABLES
UTIL_LOAD_CUSTOM_HOOK "./${package}" "./${package}/.CI/update.sh"
if [ ! -v VARIABLES[CI_NO_CONFIG] ]; then
UTIL_WRITE_KNOWN_VARIABLES_TO_FILE "./${package}/.CI/config" VARIABLES
fi
UTIL_WRITE_MANAGED_PACKAGE "$package" VARIABLES

if ! git diff --exit-code --quiet; then
if [[ -v VARIABLES[CI_REQUIRES_REVIEW] ]] && [ "${VARIABLES[CI_REQUIRES_REVIEW]}" == "true" ]; then
# The updated state of the package will still be written to the state branch, even if the main content goes onto the PR branch
# This is okay, because merging the PR branch will trigger a build, so that behavior is expected and prevents a double execution
.ci/create-pr.sh "$package"
PUSH=true
else
git add .
git add "$package"
if [ "$COMMIT" == "false" ]; then
COMMIT=true
[ -v GITLAB_CI ] && git commit -q -m "chore(packages): update packages"
[ -v GITHUB_ACTIONS ] && git commit -q -m "chore(packages): update packages [skip ci]"
else
git commit -q --amend --no-edit
fi
PUSH=true
MODIFIED_PACKAGES+=("$package")
if [ -v CI_HUMAN_REVIEW ] && [ "$CI_HUMAN_REVIEW" == "true" ] && git show-ref --quiet "origin/update-$package"; then
DELETE_BRANCHES+=("update-$package")
Expand All @@ -321,17 +355,21 @@ for package in "${PACKAGES[@]}"; do
fi
done

git -C .newstate add -A
git -C .newstate commit -q -m "chore(state): update state" --allow-empty

if [ ${#MODIFIED_PACKAGES[@]} -ne 0 ]; then
.ci/schedule-packages.sh schedule "${MODIFIED_PACKAGES[@]}"
.ci/manage-aur.sh "${MODIFIED_PACKAGES[@]}"
fi

if [ "$COMMIT" = true ]; then
if [ "$PUSH" = true ]; then
git tag -f scheduled
git_push_args=()
for branch in "${DELETE_BRANCHES[@]}"; do
git_push_args+=(":$branch")
done
[ -v GITLAB_CI ] && git_push_args+=("-o" "ci.skip")
git push --atomic origin HEAD:main +refs/tags/scheduled "${git_push_args[@]}"
[ "$COMMIT" == "force" ] && git_push_args+=("--force-with-lease=main")
git push --atomic origin HEAD:main +refs/tags/scheduled +state "${git_push_args[@]}"
fi
1 change: 1 addition & 0 deletions .ci/schedule-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function generate_deptree() {
fi
deptree+="$i:$PKGNAMES:$DEPS"
done
echo "$deptree"
}

if [ "$COMMAND" == "schedule" ]; then
Expand Down
55 changes: 37 additions & 18 deletions .ci/util.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# shellcheck disable=2034

KNOWN_VARIABLE_LIST=(CI_PKGBUILD_SOURCE CI_GIT_COMMIT CI_PKGBUILD_TIMESTAMP CI_PACKAGE_BUMP CI_ON_TRIGGER CI_MANAGE_AUR)
declare -A KNOWN_CONFIG_LIST=([BUILD_REPO]="chaotic-aur" [GIT_AUTHOR_EMAIL]="[email protected]" [GIT_AUTHOR_NAME]="chaotic-aur" [REDIS_SSH_HOST]="localhost" [REDIS_SSH_PORT]="22" [REDIS_SSH_USER]="redis" [REDIS_PORT]="6379" [REPO_NAME]="chaotic-aur" [CI_HUMAN_REVIEW]="false" [TEMPLATE_REPO]="https://github.com/chaotic-cx/chaotic-repository-template" [TEMPLATE_ENABLE_UPDATES]="true" [CI_MANAGE_AUR]="false")
KNOWN_STATE_VARIABLE_LIST=(CI_GIT_COMMIT CI_PKGBUILD_TIMESTAMP)
declare -A KNOWN_CONFIG_LIST=([BUILD_REPO]="chaotic-aur" [GIT_AUTHOR_EMAIL]="[email protected]" [GIT_AUTHOR_NAME]="chaotic-aur" [REDIS_SSH_HOST]="localhost" [REDIS_SSH_PORT]="22" [REDIS_SSH_USER]="redis" [REDIS_PORT]="6379" [REPO_NAME]="chaotic-aur" [CI_HUMAN_REVIEW]="true" [TEMPLATE_REPO]="https://github.com/chaotic-cx/chaotic-repository-template" [TEMPLATE_ENABLE_UPDATES]="true" [CI_MANAGE_AUR]="false" [CI_OVERWRITE_COMMITS]="true")

EXCLUDE_FILES=(.CI .git .gitignore)

Expand All @@ -13,28 +14,27 @@ function UTIL_GET_PACKAGES() {
mapfile -t GET_PACKAGES_ARRAY < <(find . -mindepth 1 -maxdepth 1 -type d -not -path '*/.*' -printf '%P\n')
}

function UTIL_PRUNE_UNKNOWN_VARIABLES() {
set -euo pipefail
local -n PRUNE_VARIABLES=${1:-VARIABLES}
local -n PRUNE_VARIABLES_KNOWN=${2:-KNOWN_VARIABLE_LIST}
for key in "${!PRUNE_VARIABLES[@]}"; do
if [[ ! " ${PRUNE_VARIABLES_KNOWN[*]} " == *" ${key} "* ]]; then
unset "PRUNE_VARIABLES[$key]"
fi
done
}

function UTIL_READ_VARIABLES_FROM_FILE() {
# $1: File to read variables from
# $2: Output associative array
# $3: array of known variables
function UTIL_READ_KNOWN_VARIABLES_FROM_FILE() {
set -euo pipefail
local file=$1
local -n READ_ASSOC_ARRAY=${2:-VARIABLES}
if [ -v 3 ]; then
local -n READ_KNOWN_ARRAY=${3}
fi
while IFS= read -r line || [ -n "$line" ]; do
if [[ "$line" =~ ^[[:space:]]*([a-zA-Z0-9_]+)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$ ]]; then
# Make sure the key is in the known variable list
if [[ -v READ_KNOWN_ARRAY[@] ]] && [[ " ${READ_KNOWN_ARRAY[*]} " != *" ${BASH_REMATCH[1]} "* ]]; then
continue
fi
READ_ASSOC_ARRAY["${BASH_REMATCH[1]}"]="${BASH_REMATCH[2]}"
fi
done < "$file"
}

function UTIL_WRITE_VARIABLES_TO_FILE() {
set -euo pipefail
local file=$1
Expand Down Expand Up @@ -70,22 +70,42 @@ function UTIL_WRITE_KNOWN_VARIABLES_TO_FILE() {
function UTIL_READ_MANAGED_PACAKGE() {
set -euo pipefail
local target_file="./${1}/.CI/config"
local target_state_file="./.state/${1}"
local ret=1
local -n READ_MANAGED_ASSOC_ARRAY=${2:-VARIABLES}
if [ -f "$target_file" ]; then
UTIL_READ_VARIABLES_FROM_FILE "$target_file" READ_MANAGED_ASSOC_ARRAY
UTIL_READ_KNOWN_VARIABLES_FROM_FILE "$target_file" READ_MANAGED_ASSOC_ARRAY KNOWN_VARIABLE_LIST
# Check if any variable at all was read
if [ ${#READ_MANAGED_ASSOC_ARRAY[@]} -ne 0 ]; then
UTIL_PRUNE_UNKNOWN_VARIABLES READ_MANAGED_ASSOC_ARRAY
ret=0
else
READ_MANAGED_ASSOC_ARRAY[CI_NO_CONFIG]=true
fi
else
READ_MANAGED_ASSOC_ARRAY[CI_NO_CONFIG]=true
fi

# This file might or might not exist depending on the current state of the application
if [ -f "$target_state_file" ]; then
UTIL_READ_KNOWN_VARIABLES_FROM_FILE "$target_state_file" READ_MANAGED_ASSOC_ARRAY KNOWN_STATE_VARIABLE_LIST
fi

# shellcheck disable=2153
READ_MANAGED_ASSOC_ARRAY[PKGBASE]="$1"
return $ret
}

function UTIL_WRITE_MANAGED_PACKAGE() {
set -euo pipefail
local target_file="./${1}/.CI/config"
local target_state_file="./.newstate/${1}"
local -n WRITE_MANAGED_ASSOC_ARRAY=${2:-VARIABLES}
if [[ ! -v WRITE_MANAGED_ASSOC_ARRAY[CI_NO_CONFIG] ]]; then
UTIL_WRITE_KNOWN_VARIABLES_TO_FILE "$target_file" WRITE_MANAGED_ASSOC_ARRAY KNOWN_VARIABLE_LIST
fi
UTIL_WRITE_KNOWN_VARIABLES_TO_FILE "$target_state_file" WRITE_MANAGED_ASSOC_ARRAY KNOWN_STATE_VARIABLE_LIST
}

# Extract both the normal url and the fragment
function UTIL_GET_URI_PARTS() {
set -euo pipefail
Expand Down Expand Up @@ -248,8 +268,7 @@ function UTIL_READ_CONFIG_FILE() {
set -euo pipefail
local -a UTIL_READ_CONFIG_FILE_KNOWN_VARIABLES=("${!KNOWN_CONFIG_LIST[@]}")
declare -A UTIL_READ_CONFIG_FILE_ARRAY
UTIL_READ_VARIABLES_FROM_FILE ".ci/config" UTIL_READ_CONFIG_FILE_ARRAY
UTIL_PRUNE_UNKNOWN_VARIABLES UTIL_READ_CONFIG_FILE_ARRAY UTIL_READ_CONFIG_FILE_KNOWN_VARIABLES
UTIL_READ_KNOWN_VARIABLES_FROM_FILE ".ci/config" UTIL_READ_CONFIG_FILE_ARRAY UTIL_READ_CONFIG_FILE_KNOWN_VARIABLES

# Set all variables as global variables
for key in "${!UTIL_READ_CONFIG_FILE_ARRAY[@]}"; do
Expand Down Expand Up @@ -297,4 +316,4 @@ function UTIL_PRINT_ERROR() {
function UTIL_PRINT_INFO() {
set -euo pipefail
printf '\e[1;34mInfo:\e[0m %s\n' "$1"
}
}
2 changes: 1 addition & 1 deletion alacritty-git/.CI/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CI_PKGBUILD_TIMESTAMP=1703994102
CI_PKGBUILD_SOURCE=aur
CI_GIT_COMMIT=4c0c368e7ac8233b3fca848a25b42f0875a2494b
CI_GIT_COMMIT=38fed9a7c233e11e5f62433298235281fc3de885
2 changes: 1 addition & 1 deletion btrfs-assistant-git/.CI/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CI_PKGBUILD_TIMESTAMP=1705267394
CI_PKGBUILD_SOURCE=aur
CI_GIT_COMMIT=2373f4f3c8a2a42074ea644b016caaabfcc3b89c
CI_GIT_COMMIT=a8267fade8e9d7dcea83dc944ab7930a21793c14
4 changes: 2 additions & 2 deletions cachyos-ananicy-rules-git/.CI/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CI_PKGBUILD_TIMESTAMP=1697091397
CI_PKGBUILD_TIMESTAMP=1714387300
CI_PKGBUILD_SOURCE=aur
CI_GIT_COMMIT=83b9755993e39d3e46578bdef27180d37618c6b4
CI_GIT_COMMIT=1826cf45201770e20fea2e7bebfc2a5001074703
2 changes: 1 addition & 1 deletion candy-icons-git/.CI/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CI_PKGBUILD_TIMESTAMP=1622479548
CI_PKGBUILD_SOURCE=aur
CI_GIT_COMMIT=252601a26feed3e19f5cde6c3dfc1ac35086e49c
CI_GIT_COMMIT=aa610abb1ae6d8113a9446012275143592b91ef3
4 changes: 2 additions & 2 deletions garuda-hyprland-settings/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgbase = garuda-hyprland-settings
pkgdesc = Garuda Linux Hyprland settings
pkgver = 0.4.103
pkgver = 0.4.127
pkgrel = 1
url = https://gitlab.com/garuda-linux/themes-and-settings/settings/garuda-hyprland-settings
install = garuda-hyprland-settings.install
Expand All @@ -19,7 +19,7 @@ pkgbase = garuda-hyprland-settings
depends = qt5ct
provides = garuda-desktop-settings
conflicts = garuda-desktop-settings
source = https://gitlab.com/garuda-linux/themes-and-settings/settings/garuda-hyprland-settings/-/archive/1b2647c0a37331335a9fe4cd54359bc84f4dc7df/garuda-hyprland-settings-1b2647c0a37331335a9fe4cd54359bc84f4dc7df.tar.gz
source = https://gitlab.com/garuda-linux/themes-and-settings/settings/garuda-hyprland-settings/-/archive/73b8af0e4c59f840e2c73769db36b7d6d63a3028/garuda-hyprland-settings-73b8af0e4c59f840e2c73769db36b7d6d63a3028.tar.gz
sha256sums = SKIP

pkgname = garuda-hyprland-settings
4 changes: 2 additions & 2 deletions garuda-hyprland-settings/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Co-Maintainer: Ankur <forum dot garudalinux dot org slash u slash ankur slash summary>

pkgname=garuda-hyprland-settings
pkgver="0.4.103"
_commit='1b2647c0a37331335a9fe4cd54359bc84f4dc7df'
pkgver="0.4.127"
_commit='73b8af0e4c59f840e2c73769db36b7d6d63a3028'
pkgrel=1
arch=('any')
license=('GPL')
Expand Down
2 changes: 1 addition & 1 deletion jamesdsp/.CI/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CI_PKGBUILD_TIMESTAMP=1705793787
CI_PKGBUILD_TIMESTAMP=1711910807
CI_PKGBUILD_SOURCE=aur
3 changes: 0 additions & 3 deletions jamesdsp/.SRCINFO
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ pkgbase = jamesdsp
conflicts = jdsp4linux
conflicts = jdsp4linux-gui
conflicts = gst-plugin-jamesdsp
replaces = jdsp4linux
replaces = jdsp4linux-gui
replaces = gst-plugin-jamesdsp
options = !strip
source = git+https://github.com/Audio4Linux/JDSP4Linux.git#commit=30a30aa5ce90f97ea2c93bc372c0a67c8e3c54c8
source = git+https://github.com/ThePBone/GraphicEQWidget.git
Expand Down
3 changes: 1 addition & 2 deletions jamesdsp/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ pkgname=jamesdsp
_app_id=me.timschneeberger.jdsp4linux
pkgver=2.7.0
pkgrel=1
pkgdesc="An audio effect processor for PipeWire clientss"
pkgdesc="An audio effect processor for PipeWire clients"
arch=('x86_64')
url="https://github.com/Audio4Linux/JDSP4Linux"
license=('GPL-3.0-or-later')
depends=('glibmm' 'hicolor-icon-theme' 'libarchive' 'libpipewire' 'qt6-svg')
makedepends=('git')
conflicts=('jdsp4linux' 'jdsp4linux-gui' 'gst-plugin-jamesdsp')
replaces=('jdsp4linux' 'jdsp4linux-gui' 'gst-plugin-jamesdsp')
options=('!strip')
_commit=30a30aa5ce90f97ea2c93bc372c0a67c8e3c54c8 # tags/2.7.0^0
source=("git+https://github.com/Audio4Linux/JDSP4Linux.git#commit=$_commit"
Expand Down
2 changes: 1 addition & 1 deletion pamac-aur/.CI/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CI_PKGBUILD_TIMESTAMP=1702886397
CI_PKGBUILD_TIMESTAMP=1711792164
CI_PKGBUILD_SOURCE=aur
Loading

0 comments on commit eded735

Please sign in to comment.