Skip to content

Commit

Permalink
[CI][linux] Build DEB package flow
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
  • Loading branch information
AenBleidd committed Jul 2, 2023
1 parent dc85ad4 commit d285cb9
Show file tree
Hide file tree
Showing 15 changed files with 438 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/debrepo/aptly.bullseye.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {},
"enableMetricsEndpoint": false,
"logLevel": "debug",
"logLevel": "info",
"logFormat": "default",
"serveInAPIMode": false
}
2 changes: 1 addition & 1 deletion .github/workflows/debrepo/aptly.buster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {},
"enableMetricsEndpoint": false,
"logLevel": "debug",
"logLevel": "info",
"logFormat": "default",
"serveInAPIMode": false
}
2 changes: 1 addition & 1 deletion .github/workflows/debrepo/aptly.focal.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {},
"enableMetricsEndpoint": false,
"logLevel": "debug",
"logLevel": "info",
"logFormat": "default",
"serveInAPIMode": false
}
2 changes: 1 addition & 1 deletion .github/workflows/debrepo/aptly.jammy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {},
"enableMetricsEndpoint": false,
"logLevel": "debug",
"logLevel": "info",
"logFormat": "default",
"serveInAPIMode": false
}
8 changes: 4 additions & 4 deletions .github/workflows/debrepo/package_depends.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ function exit_usage() {

case "$1_$2" in
# ubuntu distros
"jammy_linux_client-vcpkg")
"jammy_linux_client")
echo "libc6,libxss1 (>= 1.2.3)"
;;
"focal_linux_client-vcpkg")
"focal_linux_client")
echo "libc6,libxss1 (>= 1.2.3)"
;;

# debian distros
"bullseye_linux_client-vcpkg")
"bullseye_linux_client")
echo "libc6,libxss1 (>= 1.2.3)"
;;
"buster_linux_client-vcpkg")
"buster_linux_client")
echo "libc6,libxss1 (>= 1.2.3)"
;;

Expand Down
28 changes: 8 additions & 20 deletions .github/workflows/debrepo/package_prepare.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ function prepare_manager() {

ROOT=$(pwd)

OS="$1" # distro for which the prepare is done
FULLPKG="$2" # full name of the package
PKG="$3" # name of the artifact
BASEPKG="$4" # name of the artifact type
FULLPKG="$1" # full name of the package
BASEPKG="$2" # name of the artifact type

# validity check
case "$BASEPKG" in
"linux_client-vcpkg")
"linux_client")
;;
"linux_manager-without-webview")
"linux_manager")
;;

*) echo "ERROR: Unknown package preparation requested"
Expand All @@ -87,21 +85,11 @@ exit_on_fail
pushd "$ROOT/$FULLPKG"
exit_on_fail

stat "${ROOT}/pkgs/$PKG.zip"
exit_on_fail

# unpack the github artifact
7z x "${ROOT}/pkgs/$PKG.zip"
exit_on_fail

stat "${BASEPKG}.7z"
stat "${ROOT}/pkgs/${BASEPKG}.7z"
exit_on_fail

# unpack the boinc archive
7z x "${BASEPKG}.7z"
exit_on_fail

rm -f "${BASEPKG}.7z"
7z x "${ROOT}/pkgs/${BASEPKG}.7z"
exit_on_fail

find .
Expand All @@ -112,10 +100,10 @@ exit_on_fail

# specialized prepare
case "$BASEPKG" in
"linux_client-vcpkg")
"linux_client")
prepare_client
;;
"linux_manager-without-webview")
"linux_manager")
prepare_manager
;;
*) echo "ERROR: Unknown package preparation requested"
Expand Down
Empty file modified .github/workflows/debrepo/repo_remove.sh
100644 → 100755
Empty file.
40 changes: 39 additions & 1 deletion .github/workflows/debrepo/repo_update.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash

# support functions
function exit_on_fail() {
Expand Down Expand Up @@ -115,6 +115,44 @@ if [[ "$IS_MIRROR" -eq "0" ]]; then
aptly -config=$CONF_FILE repo import boinc-$TYPE-mirror boinc-$TYPE "Name"
exit_on_fail "Failed to import the remote mirror into local"

# keep only 3 last versions of each package before adding new ones
packets=$(aptly -config=$CONF_FILE repo search boinc-$TYPE | grep -o '[^[:space:]]*_\([[:digit:]]*\.\)\{2\}[[:digit:]]*-\([[:digit:]]*_\)[^[:space:]]*' | sort -t '_' -k 2 -V | uniq)
declare -A split_lists
packets_list=()
while IFS= read -r line; do
packets_list+=("$line")
done <<< "$packets"
for item in "${packets_list[@]}"; do
prefix="${item%%_*}" # Extract the prefix (text before the first underscore)
split_lists["$prefix"]+="$item"$'\n' # Append the item to the corresponding prefix's list
done

for prefix in "${!split_lists[@]}"; do
echo "List for prefix: $prefix"
echo "${split_lists[$prefix]}"
count=$(echo "${split_lists[$prefix]}" | wc -l)
number=$(expr $count - 1)
echo "count=$number"
i=0
exceed=$(expr $number - 3)
if (( exceed > 0)); then
values_list=()
while IFS= read -r line; do
values_list+=("$line")
done <<< "${split_lists[$prefix]}"
for value in "${values_list}"; do
if (( i < exceed )); then
echo "E: $value"
i=$((i+1))
aptly -config=$CONF_FILE repo remove boinc-$TYPE $value
exit_on_fail "Failed to remove the package"
else
break
fi
done
fi
done

# creates the snapshot of the old situation
aptly -config=$CONF_FILE snapshot create old-boinc-$TYPE-snap from repo boinc-$TYPE
exit_on_fail "Failed to create old snapshot of the local repo"
Expand Down
Loading

0 comments on commit d285cb9

Please sign in to comment.