Browse Source

getsource: fix file URL pattern match in HTML data

master
Pekka Helenius 2 years ago
parent
commit
803f462592
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      tools/getsource.sh

+ 6
- 2
tools/getsource.sh View File

@ -117,11 +117,13 @@ function fetch_database() {
for GITBASE in ${GITBASES[@]}; do
BASEURL="${DOMAINURL}/${GITBASE}/tree/packages/${PACKAGE}/trunk"
BASEURL_RELATIVE_FILES="/${GITBASE}/blob/packages/${PACKAGE}/trunk"
if get_url "${BASEURL}" "${URLFILE}"; then
FILENAMES=()
FILEHREFS=( $(grep -oP "(?=${BASEURL_RELATIVE_FILES}).*?(?=\"\>)" "${URLFILE}" | sed 's/blob//') )
FILEHREFS=( $(grep -oP '(?<=data-pjax).*?(?=\<\/a)' "${URLFILE}" | sed -r "s/.*href=[\"|'](.*)[\"|']>.*/\1/; s/\/blob//g" | grep trunk) )
for i in ${FILEHREFS[@]}; do
FILENAMES+=( $(echo "${i}" | sed 's/.*\///g') )
done
@ -155,11 +157,13 @@ function fetch_database() {
for GITBASE in ${GITBASES[@]}; do
for DATABASE in ${DATABASES[@]}; do
BASEURL="${DOMAINURL}/${GITBASE}/tree/master/${DATABASE}/${PACKAGE}"
BASEURL_RELATIVE_FILES="/${GITBASE}/blob/master/${DATABASE}/${PACKAGE}"
if get_url "${BASEURL}" "${URLFILE}"; then
FILENAMES=()
FILEHREFS=( $(grep -oP "(?=${BASEURL_RELATIVE_FILES}).*?(?=\"\>)" "${URLFILE}" | sed 's/blob//') )
FILEHREFS=( $(grep -oP '(?<=data-pjax).*?(?=\<\/a)' "${URLFILE}" | sed -r "s/.*href=[\"|'](.*)[\"|']>.*/\1/; s/\/blob//g" | grep ${PACKAGE}) )
for i in ${FILEHREFS[@]}; do
FILENAMES+=( $(echo "${i}" | sed 's/.*\///g') )
done


Loading…
Cancel
Save