Skip to content
Snippets Groups Projects
Verified Commit b9becf3f authored by Karel Koci's avatar Karel Koci :metal:
Browse files

lists: Fix repository generation and overall cleanup

Script should still be run in OpenWRT directory but at the same time
because lists templates are no longer part of it can reach different
directory as a source.
Also removed hack for automatic generation of repositories and replaced
with better implementation in m4 it self.
parent 9dcd610c
No related merge requests found
......@@ -397,7 +397,7 @@ gen_lists() {
_report "Generating package lists for updater"
[ -n "${TARGET_BOARD}" ] || _die "You need to specify target board!"
mkdir -p bin/packages/lists
"${SRC_DIR}"/helpers/generate_userlists.sh --model "${TARGET_BOARD}" --branch "${PUBLISH_BRANCH}" --src "${SRC_DIR}" bin/packages/lists
"${SRC_DIR}"/helpers/generate_userlists.sh --model "${TARGET_BOARD}" --branch "${PUBLISH_BRANCH}" --src "${SRC_DIR}/lists" bin/packages/lists
}
build_help=" Builds everything"
......
......@@ -2,7 +2,8 @@
set -e
MINIMAL=false
SRC_DIR="$(pwd)"
LISTS_DIR=
OUTPUT_PATH=
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
......@@ -13,12 +14,12 @@ while [ $# -gt 0 ]; do
echo " --help, -h"
echo " Prints this help text."
echo " --model (turris|omnia|mox)"
echo " Target Turris model. Currently only turris or omnia are supported."
echo " Target Turris model."
echo " --branch BRANCH"
echo " Target branch for which this userlist is generated."
echo " --minimal"
echo " Generate userlists for minimal branch. (This adds nightly as a fallback branch)"
echo " --src"
echo " --src PATH"
echo " Source directory with list to process"
exit
;;
......@@ -39,10 +40,15 @@ while [ $# -gt 0 ]; do
;;
--src)
shift
SRC_DIR="$(cd "$1"; pwd)"
LISTS_DIR="$1"
;;
*)
OUTPUT_PATH="$1"
if [ -z "$OUTPUT_PATH" ]; then
OUTPUT_PATH="$1"
else
echo "Unknown option: $1"
exit 1
fi
;;
esac
shift
......@@ -52,7 +58,6 @@ done
echo "You have to specify output path." >&2
exit 1
}
OUTPUT_PATH="$(cd "$OUTPUT_PATH"; pwd)"
[ -z "$BOARD" ] && {
echo "Missing --model option." >&2
exit 1
......@@ -61,24 +66,23 @@ OUTPUT_PATH="$(cd "$OUTPUT_PATH"; pwd)"
echo "Missing --branch option." >&2
exit 1
}
[ -d "$SRC_DIR" ] || {
echo "$0 have to be run in Turris OS root directory." >&2
[ -d "$LISTS_DIR" ] || {
echo "Valid --src directory has to be specified" >&2
exit 1
}
[ -f Makefile -a -f feeds.conf ] || {
echo "This script has to be run in OpenWRT build directory" >&2
exit 1
}
mkdir -p $OUTPUT_PATH
M4ARGS="--include=lists -D _INCLUDE_=lists/ -D _BRANCH_=$BRANCH -D _BOARD_=$BOARD"
M4ARGS="--include=$LISTS_DIR -D _INCLUDE_=$LISTS_DIR/ -D _BRANCH_=$BRANCH -D _BOARD_=$BOARD"
$MINIMAL && M4ARGS="$M4ARGS -D _BRANCH_FALLBACK_=nightly"
sed -i 's|subdirs = {"base"[^}]*}|subdirs = {"core" , "base" '"$(
cat "$SRC_DIR"/feeds.conf | sed 's|#.*||' | grep '.' | sed 's|src-git \([^[:blank:]]*\) .*|, "\1"|' | tr '\n' ' '
)}|" "$SRC_DIR/lists/repository.m4"
cd "$SRC_DIR"
for f in $(find lists -name '*.lua.m4'); do
m4 $M4ARGS $f > "$OUTPUT_PATH/$(basename $f | sed s/\.m4$//)"
for f in $(find "$LISTS_DIR" -name '*.lua.m4'); do
m4 $M4ARGS $f > "$OUTPUT_PATH/$(basename "$f" | sed s/\.m4$//)"
done
for f in $(find lists -name '*.lua'); do
cp $f "$OUTPUT_PATH/$(basename $f)"
for f in $(find "$LISTS_DIR" -name '*.lua'); do
cp $f "$OUTPUT_PATH/$(basename "$f")"
done
......@@ -3,8 +3,7 @@ dnl We expect this to be include in base.lua just after utils.m4
divert(-1)
# This is definition of subrepositories
# TODO generate this dynamically from feed.conf.default
pushdef(`SUBDIRS',``subdirs = {"base", "turrispackages", "php", "hardware", "lucics", "packages", "routing", "management", "telephony", "printing"}'')
pushdef(`SUBDIRS',`subdirs = {"base", "core" esyscmd(`awk "/src-git/{printf \", \\\"%s\\\"\", \$'`2}" feeds.conf')}')
divert(0)dnl
dnl
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment