From e0caa9a9c2514050786cf8838aabbe08688d0860 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 1 Nov 2019 00:35:33 +0100 Subject: [PATCH] Add useful links to packages --- includes/header.php | 1 + repo/generate-repo-page.sh | 54 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/includes/header.php b/includes/header.php index 1fd7459..0c5978b 100644 --- a/includes/header.php +++ b/includes/header.php @@ -119,6 +119,7 @@ if (false && $PAGE_TYPE != "PASTE" && $PAGE_TYPE != "DONATIONS" && $PAGE_TYPE != flex-direction: row; margin: 15px; width: 485px; + line-height: 1.25em; /* max-width: calc(92% / 3 - 32px); */ } .repository-package > div:first-child { diff --git a/repo/generate-repo-page.sh b/repo/generate-repo-page.sh index 569caeb..f4b2cb9 100755 --- a/repo/generate-repo-page.sh +++ b/repo/generate-repo-page.sh @@ -18,6 +18,7 @@ PACKAGES_SEPARATE_DATA=("hybridreverb2") PACKAGES_BASE_URL="http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/" rm -f Packages.gz Packages +mkdir -p pool-cache wget -q http://ppa.launchpad.net/kxstudio-debian/${REPO_TARGET}/ubuntu/dists/bionic/main/binary-amd64/Packages.gz gzip -d Packages.gz @@ -68,6 +69,38 @@ function has_separate_data_package() { return 1 } +function get_homepage() { + local SOURCE="${1}" + local VERSION="${2}" + local SRC_FILENAME="${SOURCE}_$(echo ${VERSION} | sed 's/:/./').dsc" + local SRC_LETTER=$(echo "${SOURCE}" | head -c 1) + if [ ! -f "pool-cache/${SRC_FILENAME}" ]; then + wget -q -O "pool-cache/${SRC_FILENAME}" "${PACKAGES_BASE_URL}/pool/main/${SRC_LETTER}/${SOURCE}/${SRC_FILENAME}" + if [ $? != 0 ]; then + rm -f "pool-cache/${SRC_FILENAME}" + return 1 + fi + fi + cat "pool-cache/${SRC_FILENAME}" | awk 'sub("Homepage: ","")' + return 0 +} + +function get_vcs_page() { + local SOURCE="${1}" + local VERSION="${2}" + local SRC_FILENAME="${SOURCE}_$(echo ${VERSION} | sed 's/:/./').dsc" + local SRC_LETTER=$(echo "${SOURCE}" | head -c 1) + if [ ! -f "pool-cache/${SRC_FILENAME}" ]; then + wget -q -O "pool-cache/${SRC_FILENAME}" "${PACKAGES_BASE_URL}/pool/main/${SRC_LETTER}/${SOURCE}/${SRC_FILENAME}" + if [ $? != 0 ]; then + rm -f "pool-cache/${SRC_FILENAME}" + return 1 + fi + fi + cat "pool-cache/${SRC_FILENAME}" | awk 'sub("Kxstudio-Vcs: ","")' + return 0 +} + for PACKAGE in ${PACKAGES[@]}; do if is_blacklisted ${PACKAGE} || echo "${PACKAGE}" | grep -q -- "-static"; then continue @@ -90,7 +123,14 @@ for PACKAGE in ${PACKAGES[@]}; do PACKAGE_DESCRIPTION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Description: ","")') PACKAGE_PROVIDES=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Provides: ","")') PACKAGE_SIZE=$(echo "${PACKAGE_DETAILS}" | grep -v "Installed-Size:" | awk 'sub("Size: ","")') - PACKAGE_VERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2 | cut -d '-' -f 1) + PACKAGE_RVERSION=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Version: ","")' | cut -d ':' -f 2) + PACKAGE_VERSION=$(echo "${PACKAGE_RVERSION}" | cut -d '-' -f 1) + PACKAGE_SOURCE=$(echo "${PACKAGE_DETAILS}" | awk 'sub("Source: ","")') + if [ -z "${PACKAGE_SOURCE}" ]; then + PACKAGE_SOURCE="${PACKAGE}" + fi + PACKAGE_HOMEPAGE=$(get_homepage "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}") + PACKAGE_VCS_PAGE=$(get_vcs_page "${PACKAGE_SOURCE}" "${PACKAGE_RVERSION}") if echo "${PACKAGE_FILENAME}" | grep -q "carla-bridge-win64_"; then PACKAGE="carla-bridge-win" @@ -119,8 +159,18 @@ for PACKAGE in ${PACKAGES[@]}; do echo "
" echo "" echo "" + if [ -n "${PACKAGE_HOMEPAGE}" ] || [ -n "${PACKAGE_VCS_PAGE}" ]; then + echo "" + fi echo "" - echo "
Package Name:${PACKAGE}
Description:${PACKAGE_DESCRIPTION}
Useful links:" + if [ -n "${PACKAGE_HOMEPAGE}" ]; then + echo "Homepage  " + fi + if [ -n "${PACKAGE_VCS_PAGE}" ]; then + echo "VCS  " + fi + echo "
Version:${PACKAGE_VERSION}
Expected size:" + echo "
Package size:" if [ ${PACKAGE_SIZE} -gt 999999 ]; then echo "$((${PACKAGE_SIZE} / 1024 / 1024))Mb" else