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


Loading…
Cancel
Save