From d77d29fd37a35f38547a05e15350f91c4e94fe5e Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 5 Oct 2014 19:26:55 +0200 Subject: [PATCH] webbuild: support adding BASE_URL to search result links --- etc/autodist/config | 3 ++- webbuild/webbuild-cgi | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/etc/autodist/config b/etc/autodist/config index d7dda86..091b974 100644 --- a/etc/autodist/config +++ b/etc/autodist/config @@ -1,7 +1,8 @@ # Global configuration file for autodist # AUTODIST_ARCHS=(i586 x86_64 arm) -REPS_BASE_URL=http://www.openmamba.org/pub/openmamba +SITE_BASE_URL=http://www.openmamba.org +REPS_BASE_URL=${SITE_BASE_URL}/pub/openmamba LOCAL_REPS_BASE_DIR=/var/ftp/pub/openmamba SEND_SERVER=devel-autodist #WEBBUILD_URL=http://localhost/cgi-bin/webbuild diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index 272d7f7..32e4177 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -467,7 +467,8 @@ if [ "$REQUEST" = "repsearch" ]; then echo -n "
Search results for \"$REPSEARCHTEXT\":
" # echo -n "
"
    curl -s "${WEBBUILD_DISTROQUERY_URL}?query=$REPSEARCHTEXT&search_milestone2=true&search_devel=true\
-&search_i586=true&search_x86_64=true&search_arm=true&search_sources=true&query_compact=true&replyplain=true"
+&search_i586=true&search_x86_64=true&search_arm=true&search_sources=true&query_compact=true&replyplain=true" | \
+   sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
 #   $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i ${REPSEARCHTEXT/-/\-}" | \
 #      parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
 #      sed "s|\(.*(source).*\)|\1|;
@@ -1149,7 +1150,8 @@ if [ "$MAINTAINERMODE" = "true" ]; then
             curl -s $REPS_BASE_URL/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
             curl -s $REPS_BASE_URL/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
          fi
-         cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a href=|a target=new href=|g"
+         cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a \(href=.\)/|a target=new \1${SITE_BASE_URL}/|g"
+
          echo -n "
Log:
"
          cat $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
          echo -n "
"