Compare commits

...

2 Commits

Author SHA1 Message Date
Ulf Wiger
18daaaa0d7 Merge branch 'uw-zompify' of https://git.qpq.swiss/QPQ-AG/gmconfig into uw-zompify 2025-05-12 23:28:04 +02:00
Ulf Wiger
4ee669ebba process plain args, update zompify.sh 2025-05-12 23:26:35 +02:00
2 changed files with 37 additions and 7 deletions

View File

@ -2,10 +2,10 @@
{type,app}. {type,app}.
{modules,[]}. {modules,[]}.
{prefix,"gmconfig"}. {prefix,"gmconfig"}.
{desc,"Configuration management support"}.
{author,"Ulf Wiger"}. {author,"Ulf Wiger"}.
{package_id,{"uwiger","gmconfig",{0,1,0}}}. {desc,"Configuration management support"}.
{deps,[{"uwiger","setup",{2,2,3}}]}. {package_id,{"uwiger","gmconfig",{0,1,2}}}.
{deps,[{"uwiger","setup",{2,2,4}}]}.
{key_name,none}. {key_name,none}.
{a_email,"ulf@wiger.net"}. {a_email,"ulf@wiger.net"}.
{c_email,"ulf@wiger.net"}. {c_email,"ulf@wiger.net"}.

View File

@ -2,11 +2,41 @@
set -e set -e
APP=$(basename "$PWD") APP=$(basename "$PWD")
SRC="_build/default/lib/$APP" SRC="_build/default/lib/$APP"
DST="$PWD/_build/zomp/lib/$APP" DST="$PWD/_build/zomp/lib/$APP"
IGNORE_FILE="zomp.ignore"
mkdir -p "$DST" mkdir -p "$DST"
find "$SRC" -type l ! -exec test -e {} \; -delete
cp -aR -L "$SRC/." "$DST/" # Remove broken symlinks
find "$SRC" -type l ! -exec test -e {} \; -delete || true
# Build ignore matcher
IGNORE_TEMP=$(mktemp)
trap "rm -f $IGNORE_TEMP" EXIT
# Expand globs in zomp.ignore to patterns suitable for grep
if [ -e "$IGNORE_FILE" ]; then
grep -v '^\s*#' "$IGNORE_FILE" | sed 's#/#\\/#g' | sed 's/\./\\./g' | sed 's/\*/.*/g' > "$IGNORE_TEMP"
fi
# Copy Git-tracked and Zomp-allowed files
git ls-files -z | while IFS= read -r -d '' file; do
# Skip if ignored
echo "$file" | grep -Eq -f "$IGNORE_TEMP" && continue
# Only copy if file exists in the build dir
if [ -e "$SRC/$file" ]; then
mkdir -p "$DST/$(dirname "$file")"
cp -a "$SRC/$file" "$DST/$file"
fi
done
rm "$IGNORE_TEMP"
# Copy metadata
cp "$PWD/zomp.meta" "$DST/" cp "$PWD/zomp.meta" "$DST/"
cp "$PWD/Emakefile" "$DST" cp "$PWD/Emakefile" "$DST/"
rm "$DST"/ebin/*.beam
# Clean up beam files just in case
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true