summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-15 16:59:45 +0100
committerdavidovski <david@davidovski.xyz>2022-05-15 16:59:45 +0100
commit6c0a60888bba8086701ffe87d42ff69a5fd83bc4 (patch)
treef128bf0ac16f7d80cbb3153999c18a8853d1aa5b
parent4490f4dbdb9685481070da9dacb9b27f84aad8aa (diff)
added add_from_main
-rw-r--r--xi_profile.sh18
-rw-r--r--xibuild.sh25
2 files changed, 31 insertions, 12 deletions
diff --git a/xi_profile.sh b/xi_profile.sh
index 78bd6f4..5fb89a5 100644
--- a/xi_profile.sh
+++ b/xi_profile.sh
@@ -23,19 +23,35 @@ apply_patches () {
done
}
+add_from_main () {
+ for pattern in $@; do
+ printf "moving $pattern..."
+ for file in $(find ./xipkg/ -path "./xipkg/*/$pattern" ); do
+ printf "$file "
+ filename=${file#./xipkg/$PKG_NAME}
+ mkdir -p $PKG_DEST/${pattern%/*}
+ mv $file $PKG_DEST/${filename}
+ done
+ printf "\n"
+ done
+}
+
PKG_NAME=$1
cd $2
export BUILD_ROOT=$(realpath $2)
+echo "Build file for $1, to build at root $2"
+
builds="$(ls *.xibuild | grep -v "$PKG_NAME.xibuild")"
for xibuild in $PKG_NAME.xibuild $(ls *.xibuild | grep -v "$PKG_NAME.xibuild"); do
+ cd $2
SUBPKG_NAME=$(basename $xibuild .xibuild)
mkdir -p ./xipkg/$SUBPKG_NAME
export PKG_DEST=$(realpath ./xipkg/$SUBPKG_NAME)
echo "to install to $PKG_DEST"
- echo "============$PKG_NAME============="
+ echo "============$SUBPKG_NAME============="
# read only the static variables fromt the primary
. ./$PKG_NAME.xibuild
diff --git a/xibuild.sh b/xibuild.sh
index d9853de..84e134b 100644
--- a/xibuild.sh
+++ b/xibuild.sh
@@ -9,7 +9,6 @@ textout=/dev/null
src_dir="$(pwd)"
out_dir="$(pwd)"
-key_file=""
xibuild_dir="/var/lib/xibuild"
build_dir="$xibuild_dir/build"
export_dir="$xibuild_dir/build/xipkg"
@@ -96,9 +95,9 @@ fetch_source () {
xibuild_fetch () {
cd $root/$build_dir
[ ! -z "$SOURCE" ] && fetch_source $SOURCE $BRANCH
- [ ! -z "$ADDITIONAL" ] && for url in "$ADDITIONAL"; do
+ for url in $ADDITIONAL; do
case $url in
- http*|ftp*) curl -SsL $url> $root/$build_dir/$(basename $url);;
+ http*|ftp*) fetch_source $url;;
esac
done
cp -r $src_dir/* $root/$build_dir/
@@ -109,7 +108,7 @@ xibuild_build () {
mkdir -p $root/$export_dir
[ "$root" = "/" ] && {
- $build_dir/xi_profile.sh $NAME $build_dir || return 1
+ sh $build_dir/xi_profile.sh $NAME $build_dir || return 1
} || {
xichroot "$root" "$build_dir/xi_profile.sh $NAME $build_dir" || return 1
} 2>&1
@@ -136,12 +135,14 @@ xibuild_package () {
cd $root/$export_dir/$pkg
[ "$(ls -1 $root/$export_dir/$pkg | wc -l)" = "0" ] && {
printf "package $pkg is empty\n"
- [ ! -z ${SOURCE}] && return 1
+ [ ! -z ${SOURCE} ] && return 1
} || {
- tar -C $root/$export_dir/$pkg -czf $out_dir/$pkg.xipkg ./
+ tar -C $root/$export_dir/$pkg -cJf $out_dir/$pkg.xipkg ./
}
done
- cp -r $src_dir/*.xibuild $out_dir/
+ for buildfile in $(find $src_dir -name "$src_dir/*.xibuild"); do
+ cp $buildfile $out_dir/
+ done
}
xibuild_describe () {
@@ -210,7 +211,9 @@ done
shift $((OPTIND-1))
-tasks="prepare fetch build strip package describe sign"
+tasks="prepare fetch build strip package describe"
+
+[ "$key_file" ] && tasks="$tasks sign"
[ "$#" = "1" ] && {
[ -d "$1" ] && {
@@ -224,7 +227,7 @@ logfile="$out_dir/build.log"
NAME=$(basename $(realpath "$src_dir"))
[ -f "$src_dir/$NAME.xibuild" ] || {
- printf "${RED}could not find $NAME.xibuild!\n"
+ printf "${RED}could not find $src_dir/$NAME.xibuild!\n"
exit 1
}
@@ -233,8 +236,8 @@ build_package () {
printf "${BLUE}${NAME}\n"
for task in $tasks; do
- printf "${BLUE}${TABCHAR}$task "
- xibuild_$task >> $logfile && printf "${GREEN}${CHECKMARK}\n" || return 1
+ printf "${BLUE}${TABCHAR}$task "
+ xibuild_$task >> $logfile && printf "${GREEN}${CHECKMARK}\n" || return 1
done
}