Compare commits

..

No commits in common. "82734470d2d35096b2bd3a8b0e2fc28dff031c91" and "1310c2f6f1b151bce5689ce74c83989cb2c3735f" have entirely different histories.

19 changed files with 28 additions and 67 deletions

6
.gitignore vendored
View file

@ -1,8 +1,8 @@
/secrets.env /secrets.env
/packages/*/*/* /packages/*/*
!/packages/*/*/DEBBUILD !/packages/*/DEBBUILD
!/packages/*/*/materials !/packages/*/materials
!/script/* !/script/*
!/makedeb !/makedeb

View file

@ -2,25 +2,28 @@ steps:
- name: build_all - name: build_all
image: debian-pack:0.4 image: debian-pack:0.4
secrets: secrets:
- WEBDAV_PASS
- WEBDAV_USER - WEBDAV_USER
environment: - WEBDAV_PASS
- WEBDAV_UPLOAD_TARGET=https://dufs.leafee98.com/apt/income - WEBDAV_HOST
- APT_BASE=https://dufs.leafee98.com/apt - WEBDAV_REPOPATH
commands: commands:
- rm -f /tmp/apt-file-exists-cache.json - rm -f /tmp/apt-file-exists-cache.json
- ./script/build.sh - hook_str="$(realpath ./script/package_exists.py)
--filename {}
--cache-file /tmp/apt-file-exists-cache.json
--package-arch amd64
--apt-base https://dufs.leafee98.com/apt/"
- ./script/build_all.sh
--makedeb-path makedeb/makedeb --makedeb-path makedeb/makedeb
--package-exists-hook " --package-exists-hook "$hook_str"
$(realpath ./script/package_exists.py) --upload-to-webdav "https://dufs.leafee98.com/apt/income"
--filename {}
--cache-file /tmp/apt-file-exists-cache.json
--package-arch amd64
--apt-base $APT_BASE
"
--upload-to-webdav "$WEBDAV_UPLOAD_TARGET"
--webdav-user "$WEBDAV_USER" --webdav-user "$WEBDAV_USER"
--webdav-pass "$WEBDAV_PASS" --webdav-pass "$WEBDAV_PASS"
--package-dir packages/bin --package packages/apt-repo-updater
--package-dir packages/leafee98 --package packages/dufs-bin
--package packages/filebrowser-bin
--package packages/forgejo-bin
--package packages/neovim-bin
--package packages/plik-bin
--package packages/static-deployer-git

@ -1 +1 @@
Subproject commit 9aedecc62e9585ba1d9b88efe083b52105e0947f Subproject commit 3065562dab1aa1fffc8e0fe3b8885acc93e3c9ad

View file

@ -14,9 +14,8 @@ function msg_warn {
function usage { function usage {
echo "$_PROGRAM_NAME:" echo "$_PROGRAM_NAME:"
echo " --package <dir-name> add a dir to build, can use multi times" echo " --package <dir-name> add a dir to build, allow use it multi times"
echo " --package-dir <dir> all dir in this directory is a package," echo " --package-dir <dir> all dir in this directory is a package"
echo " can use multi times"
echo " --makedeb-path <path> specify the path of makedeb" echo " --makedeb-path <path> specify the path of makedeb"
echo " --upload-to-webdav https://webdav_host/path/dir" echo " --upload-to-webdav https://webdav_host/path/dir"
echo " upload built file to a webdav server" echo " upload built file to a webdav server"
@ -47,13 +46,8 @@ function run_hook {
local exe_str="$1" local exe_str="$1"
local place_holder="$2" local place_holder="$2"
local package_name="$3" local package_name="$3"
local log_exe_str="${4-}"
local final_exe_str="${exe_str/$place_holder/$package_name}" local final_exe_str="${exe_str/$place_holder/$package_name}"
echo $final_exe_str
if [[ -n "${log_exe_str}" ]] ; then
msg_info "Running: $final_exe_str"
fi
$final_exe_str $final_exe_str
} }
@ -83,12 +77,7 @@ while (( "$#" >= 1 )); do
--upload-to-webdav) UPLOAD_TO_WEBDAV="$2" ; shift ;; --upload-to-webdav) UPLOAD_TO_WEBDAV="$2" ; shift ;;
--webdav-user) WEBDAV_USER="$2" ; shift ;; --webdav-user) WEBDAV_USER="$2" ; shift ;;
--webdav-pass) WEBDAV_PASS="$2" ; shift ;; --webdav-pass) WEBDAV_PASS="$2" ; shift ;;
--package-exists-hook) --package-exists-hook) PACKAGE_EXISTS_HOOK="$2" ; shift ;;
PACKAGE_EXISTS_HOOK="$2"
# strip white space, see https://stackoverflow.com/a/3352015
PACKAGE_EXISTS_HOOK="${PACKAGE_EXISTS_HOOK#"${PACKAGE_EXISTS_HOOK%%[![:space:]]*}"}"
PACKAGE_EXISTS_HOOK="${PACKAGE_EXISTS_HOOK%"${PACKAGE_EXISTS_HOOK##*[![:space:]]}"}"
shift ;;
--) --)
shift shift
MAKEDEB_ARGS=("$@") MAKEDEB_ARGS=("$@")
@ -110,7 +99,7 @@ else
MAKEDEB_PATH="$(realpath "$MAKEDEB_PATH")" MAKEDEB_PATH="$(realpath "$MAKEDEB_PATH")"
fi fi
if [[ -n "${PACKAGE_DIR-}" && "${#PACKAGE_DIR}" -gt 0 ]] ; then if [[ -n ${PACKAGE_DIR-} && "${#PACKAGE_DIR}" -gt 0 ]] ; then
for p in "${PACKAGE_DIR[@]}" ; do for p in "${PACKAGE_DIR[@]}" ; do
for f in "$p"/* ; do for f in "$p"/* ; do
_PACKGES_TO_BUILD+=("$f") _PACKGES_TO_BUILD+=("$f")
@ -125,10 +114,6 @@ if [[ "${#_PACKGES_TO_BUILD[@]}" -eq 0 ]] ; then
msg_info "No package to build, exiting..." msg_info "No package to build, exiting..."
fi fi
if [[ -n "$PACKAGE_EXISTS_HOOK" ]] ; then
msg_info "hook for checking if package exists: $PACKAGE_EXISTS_HOOK"
fi
for package in "${_PACKGES_TO_BUILD[@]}" ; do for package in "${_PACKGES_TO_BUILD[@]}" ; do
( (
msg_info "$_DELIMITER" msg_info "$_DELIMITER"
@ -145,8 +130,7 @@ for package in "${_PACKGES_TO_BUILD[@]}" ; do
if [[ -n "${PACKAGE_EXISTS_HOOK}" ]] ; then if [[ -n "${PACKAGE_EXISTS_HOOK}" ]] ; then
ret=0 ret=0
msg_info "Checking if package $package_name exists..." run_hook "$PACKAGE_EXISTS_HOOK" "{}" "$package_name" || ret="$?"
run_hook "$PACKAGE_EXISTS_HOOK" "{}" "$package_name" log_exe_str || ret="$?"
if [[ $ret -eq 0 ]] ; then if [[ $ret -eq 0 ]] ; then
msg_info "Package ${package_name} already built, skip" msg_info "Package ${package_name} already built, skip"
@ -154,8 +138,6 @@ for package in "${_PACKGES_TO_BUILD[@]}" ; do
fi fi
fi fi
msg_info "Start building..."
"$MAKEDEB_PATH" --noextract "${MAKEDEB_ARGS[@]}" && ret=$? || ret=$? "$MAKEDEB_PATH" --noextract "${MAKEDEB_ARGS[@]}" && ret=$? || ret=$?
if [[ $ret -ne 0 ]] ; then if [[ $ret -ne 0 ]] ; then
msg_warn "Error occurred when running makedeb, skip this package" msg_warn "Error occurred when running makedeb, skip this package"

View file

@ -1,24 +0,0 @@
#!/usr/bin/env bash
WEBDAV_UPLOAD_TARGET=https://dufs.leafee98.com/apt/income
APT_BASE=https://dufs.leafee98.com/apt
./script/build.sh \
--makedeb-path makedeb/makedeb \
--package-exists-hook "
$(realpath ./script/package_exists.py)
--filename {}
--cache-file /tmp/apt-file-exists-cache.json
--package-arch amd64
--apt-base $APT_BASE \
"\
--package-dir packages/bin \
--package-dir packages/leafee98 \
--package-dir packages/git \
--package-dir packages/normal \
-- \
-f
# --upload-to-webdav "$WEBDAV_UPLOAD_TARGET" \
# --webdav-user "$WEBDAV_USER" \
# --webdav-pass "$WEBDAV_PASS" \