}
}
-export TOPDIR
+export TOPDIR=$(cd "$TOPDIR"; pwd)
+export PATH="$TOPDIR/staging_dir/host/bin:$PATH"
eval $(
"$MAKE" --no-print-directory -C "$(dirname "$MAKEFILE")" \
exit 1
}
+GIT_FIXES="$(
+ IFS=$', \t\n'
+ for issue in $(
+ git -C "$TEMP_GIT_DIR" log \
+ --format="%b" \
+ "$PKG_SOURCE_VERSION..$COMMIT" \
+ | sed -rne 's%^Fixes:(([ ,]*([[:alnum:]_]*#[0-9]+|https?://[^[:space:]]+))+)$%\1%p'
+ ); do
+ case "$issue" in
+ http://*|https://*)
+ echo "$issue"
+ ;;
+ GH#[0-9]*|openwrt#[0-9]*)
+ echo "https://github.com/openwrt/openwrt/issues/${issue#*#}"
+ ;;
+ FS#[0-9]*)
+ echo "https://bugs.openwrt.org/?task_id=${issue#FS#}"
+ ;;
+ [a-zA-Z0-9_]*#[0-9]*)
+ echo "https://github.com/openwrt/${issue%#*}/issues/${issue#*#}"
+ ;;
+ '#'[0-9]*)
+ case "$PKG_SOURCE_URL" in
+ *://github.com/*)
+ repourl=${PKG_SOURCE_URL%/}
+ repourl=${repourl%.git}
+ echo "${repourl}/issues/${issue#\#}"
+ ;;
+ *://git.openwrt.org/project/*)
+ project=${PKG_SOURCE_URL#*://git.openwrt.org/project/}
+ project=${project%.git}
+ echo "https://github.com/openwrt/${project}/issues/${issue#\#}"
+ ;;
+ esac
+ ;;
+ esac
+ done \
+ | sort --version-sort \
+ | uniq \
+ | sed -e 's#^#Fixes: #'
+)"
+
sed -i -r \
-e "/PKG_SOURCE_VERSION/s#\<$PKG_SOURCE_VERSION\>#${GIT_DATE_COMMIT#* }#" \
-e "/PKG_SOURCE_DATE/s#\<$PKG_SOURCE_DATE\>#${GIT_DATE_COMMIT% *}#" \
var.PKG_SOURCE
)
-"$MAKE" -C "$(dirname "$MAKEFILE")" download || {
+"$MAKE" -C "$(dirname "$MAKEFILE")" download CONFIG_SRC_TREE_OVERRIDE= || {
echo "Unable to download and pack updated Git sources." >&2
exit 1
}
--signoff --no-edit \
--message "$PKG_NAME: update to Git $COMMIT (${GIT_DATE_COMMIT% *})" \
--message "$GIT_LOG" \
+ ${GIT_FIXES:+--message "$GIT_FIXES"} \
"$(basename "$MAKEFILE")"
"$MAKE" --no-print-directory -C "$(dirname "$MAKEFILE")" check || {