Skip to content

Commit

Permalink
Updated building/packaging logic for ALPINE
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeshi Nakatani committed Mar 1, 2023
1 parent 5f9edd9 commit 7a2cadb
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 55 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Mon, Oct 31 2022
# REVISION: 1.2
# REVISION: 1.3
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#==============================================================
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/docker_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Tue, Aug 3 2021
# REVISION: 1.0
# REVISION: 1.1
#

#----------------------------------------------------------
Expand All @@ -37,16 +37,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#==========================================================
Expand Down
1 change: 1 addition & 0 deletions buildutils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ EXTRA_DIST =make_variables.sh \
debian_build.sh \
debian_build_copy.conf \
rpm_build.sh \
alpine_build.sh \
k2hdkc.install \
k2hdkc.service \
k2hdkc-service-helper \
Expand Down
57 changes: 46 additions & 11 deletions buildutils/alpine_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Jan 13 2023
# REVISION:
# REVISION: 1.2
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand All @@ -62,6 +64,9 @@ APKBUILD_FILE="${APK_TOPDIR}/APKBUILD"
APKBUILD_CONFIG_DIR="${HOME}/.abuild"
MAKE_VARIABLES_TOOL="${SRCTOP}/buildutils/make_variables.sh"

PRGNAME_NOEXT=$(echo "${PRGNAME}" | sed -e 's/[\.].*$//g' | tr -d '\n')
EXTRA_COPY_FILES_CONF="${MYSCRIPTDIR}/${PRGNAME_NOEXT}_copy.conf"

#---------------------------------------------------------------
# Utility functions
#---------------------------------------------------------------
Expand Down Expand Up @@ -378,6 +383,36 @@ else
echo ""
fi

#---------------------------------------------------------------
# Copy extra files
#---------------------------------------------------------------
# [NOTE]
# If you have files to copy under "<package build to pdirectory>/apk_build" directory
# (includes in your package), you can prepare "buildutils/alpine_build_copy.conf"
# file and lists target files int it.
# The file names in this configuration file list with relative paths from the source
# top directory.
# ex) src/myfile
# lib/mylib
#
if [ -f "${EXTRA_COPY_FILES_CONF}" ]; then
echo "[TITLE] Copy extra files"

EXTRA_COPY_FILES=$(sed -e 's/#.*$//g' -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e '/^$/d' "${EXTRA_COPY_FILES_CONF}")
for _extra_file in ${EXTRA_COPY_FILES}; do
if [ ! -f "${SRCTOP}/${_extra_file}" ]; then
echo "[ERROR] Not found ${SRCTOP}/${_extra_file} file for extra copy." 1>&2
exit 1
fi
if ! cp -p "${SRCTOP}/${_extra_file}" "${APK_TOPDIR}"; then
echo "[ERROR] Failed to copy ${SRCTOP}/${_extra_file} file to ${APK_TOPDIR}." 1>&2
exit 1
fi
done

echo "[SUCCEED] Copied extra files"
fi

#---------------------------------------------------------------
# Create APKBUILD file
#---------------------------------------------------------------
Expand Down
24 changes: 13 additions & 11 deletions buildutils/debian_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Apr 13 2018
# REVISION:
# REVISION: 1.1
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand Down
24 changes: 13 additions & 11 deletions buildutils/rpm_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Thu, Nov 22 2018
# REVISION:
# REVISION: 1.1
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand Down
2 changes: 2 additions & 0 deletions tests/k2hdkclinetool.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ echo ######################################################
echo ### FILL
echo ###
fill fill-key fill-value 5
sleep 5
print fill-key-1
print fill-key-2
print fill-key-3
Expand All @@ -145,6 +146,7 @@ rm fill-key-4
rm fill-key-5

fillsub fill-parent fill-key fill-value 5
sleep 10
print fill-parent
print fill-key-1
print fill-key-2
Expand Down
8 changes: 8 additions & 0 deletions tests/k2hdkclinetool.log
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
> echo ###
###
> fill fill-key fill-value 5
> sleep 5
> print fill-key-1
"fill-key-1" => "fill-value"
> print fill-key-2
Expand All @@ -218,6 +219,7 @@
> rm fill-key-4
> rm fill-key-5
> fillsub fill-parent fill-key fill-value 5
> sleep 10
> print fill-parent
"fill-parent" => value is not found
subkey: "fill-key-0", "fill-key-1", "fill-key-2", "fill-key-3", "fill-key-4"
Expand Down Expand Up @@ -630,6 +632,7 @@ SUCCEED
> echo ###
###
> fill fill-key fill-value 5
> sleep 5
> print fill-key-1
"fill-key-1" => "fill-value"
> print fill-key-2
Expand All @@ -646,6 +649,7 @@ SUCCEED
> rm fill-key-4
> rm fill-key-5
> fillsub fill-parent fill-key fill-value 5
> sleep 10
> print fill-parent
"fill-parent" => value is not found
subkey: "fill-key-0", "fill-key-1", "fill-key-2", "fill-key-3", "fill-key-4"
Expand Down Expand Up @@ -1058,6 +1062,7 @@ SUCCEED
> echo ###
###
> fill fill-key fill-value 5
> sleep 5
> print fill-key-1
"fill-key-1" => "fill-value"
> print fill-key-2
Expand All @@ -1074,6 +1079,7 @@ SUCCEED
> rm fill-key-4
> rm fill-key-5
> fillsub fill-parent fill-key fill-value 5
> sleep 10
> print fill-parent
"fill-parent" => value is not found
subkey: "fill-key-0", "fill-key-1", "fill-key-2", "fill-key-3", "fill-key-4"
Expand Down Expand Up @@ -1486,6 +1492,7 @@ SUCCEED
> echo ###
###
> fill fill-key fill-value 5
> sleep 5
> print fill-key-1
"fill-key-1" => "fill-value"
> print fill-key-2
Expand All @@ -1502,6 +1509,7 @@ SUCCEED
> rm fill-key-4
> rm fill-key-5
> fillsub fill-parent fill-key fill-value 5
> sleep 10
> print fill-parent
"fill-parent" => value is not found
subkey: "fill-key-0", "fill-key-1", "fill-key-2", "fill-key-3", "fill-key-4"
Expand Down
5 changes: 5 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ cleanup_files()
rm -f "${LINETOOL_CPP_LOGFILE}"
rm -f "${SUB_SHELLGROUP_ERROR_FILE}"

#
# Cleanup temporary files in /var/lib/antpickax
#
rm -rf /var/lib/antpickax/.fullock /var/lib/antpickax/.k2h* /var/lib/antpickax/*

return 0
}

Expand Down

0 comments on commit 7a2cadb

Please sign in to comment.