From 4b93a8c0a6574c3bd42315d474baccd8ba6bc8fc Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Sun, 22 Aug 2021 01:55:06 +0300 Subject: [PATCH] getsource: Arch Linux ARM support --- tools/PKGBUILD | 8 +++---- tools/getsource.sh | 56 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/tools/PKGBUILD b/tools/PKGBUILD index 7646865..4974311 100644 --- a/tools/PKGBUILD +++ b/tools/PKGBUILD @@ -71,15 +71,15 @@ sha256sums=('891d763f852d3a61216a384a15ca01c57178d3a5fea8aa858de0643998e9ba58' 'c96b43cc49e6872cdd3b6e51cb490ca8ea2d990f2c3545bed106a21df86648eb' '3bfac88603fe0f19383bc8b1ca7e2bc6795a90e851eaefd0758d515edd916100' '3cf521359e473256a52e2a9fbcbfa3f0d39f42befa2d9a79cb7c51372f925c7b' - '43c15b4b18e6c43cab34fe905d2751525a505830e7c6e7286cedb7dfb408f815' - '4031b9ffb038ba16dcf188dde3f45af4cd0efff647c1926b7a172a6262ec6bf6' - '9993d81f56f526ab8813b268d5b3d3424f4950c05b2fc03c106d71788f043c0a' + '8ed38b8f9020280a29999a524f1ad6fb1145d4f00827df45b256bf5eb5a450a1' + '1424ad779f5f673c01ac2845f5e3749b7c7b47dfdaa173bd45c4e866dfa4da22' + '7493ff8f2321b04fab6c4b743a15708d9aca4383ce0c934c6ed4d091f1dfd76f' '6290400b493a6e498ffe4a457274c3c4da4de60f5f3043cb36d08c9ca29cce63' '4a9693bdc1d6a10e54266bf7b3d440e926d66c61ef6d18774a2db951aa4dd478' '8bbcb61e6283bda4988468271cbaee0d7c537342a095466b4ea309bcb782eaf2' 'ca1aae07f32fd9ba2a05ffa107d1ac97638578c9926359b323be56d911b54c17' '845c3f8c0069d7938f800fe6c2e473fd1359c0fd17a5c37cbd89bbcb89c10ae7' - 'd3adffd099f5a3018b29cfb3899e5ba8ffe9d3584be5579b0edeae0818684e4d' + '7aaceffb2da0d56c00c0900f202ab3593bd8ce246c894303765875262ed3c606' 'ae13b022053b6a3d2977fac8fbf036b09dfcf107c20f9c97577a573cecc01de0' '434aa1eed4088f9bf86cef1f186b6444166e9d8367d4666a79d5c9edcf8dac2e' 'e5b8a59bcaa430f28bdd6503d4e34e57e44e429000c046d16caddcaa0fa5a30f' diff --git a/tools/getsource.sh b/tools/getsource.sh index ef9af37..8211a57 100755 --- a/tools/getsource.sh +++ b/tools/getsource.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# getsource - Get build files from official Arch Linux repositories and AUR repositories +# getsource - Get build files from Arch Linux official, AUR & ARM repositories # # Copyright (C) 2021 Pekka Helenius # @@ -16,9 +16,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - -##################################### - +# # TODO: Add support for wider range of processor architectures # TODO: Add directory support (e.g. getsource wine ~/winesource) # TODO: create subdir for source files automatically to the current main dir @@ -61,7 +59,7 @@ ARCHIVEFORMATS=( ################################## -DBS_TO_CHECK=('arch' 'aur' 'arch_deepscan') +DBS_TO_CHECK=('arch' 'aur' 'arm' 'arch_deepscan') ARCH_DATABASES=( 'core' @@ -70,6 +68,14 @@ ARCH_DATABASES=( 'community-testing' ) +ARM_DATABASES=( + 'alarm' + 'aur' + 'community' + 'core' + 'extra' +) + # TODO # Fetch from pacman.conf CUSTOM_DATABASES=() @@ -79,6 +85,10 @@ ARCH_GITBASES=( 'archlinux/svntogit-community' ) +ARM_GITBASES=( + 'archlinuxarm/PKGBUILDs' +) + ################################## function get_url() { @@ -87,6 +97,8 @@ function get_url() { return 1 } +################################## + function fetch_database() { case "${1}" in @@ -119,6 +131,7 @@ function fetch_database() { done return 1 ;; + aur) local ISSNAPSHOT DOMAINURL="https://aur.archlinux.org" @@ -132,9 +145,36 @@ function fetch_database() { fi return 1 ;; + + arm) + GITBASES=(${ARM_GITBASES[@]}) + DATABASES=(${ARM_DATABASES[@]}) + DOMAINURL="https://github.com" + REPOMSG="Using Arch Linux ARM repositories" + + for GITBASE in ${GITBASES[@]}; do + for DATABASE in ${DATABASES[@]}; do + BASEURL="${DOMAINURL}/${GITBASE}/tree/master/${DATABASE}/${PACKAGE}" + + if get_url "${BASEURL}" "${URLFILE}"; then + FILENAMES=() + + 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 + DOMAINURL="https://raw.githubusercontent.com" + download_sourcefiles && return 0 + fi + done + done + return 1 + ;; + arch_deepscan) arch_repos_deepscan ;; + esac [[ -f "${URLFILE}" ]] || return 1 @@ -153,12 +193,12 @@ function arch_repos_deepscan() { if [[ -f "${URLFILE}" ]]; then msg "$(gettext "Selecting another package name:")" PACKAGE=$(grep "Source Files" "${URLFILE}" | sed "s/.*href=[\"'].*packages\///g; s/[\"'].*//g") - warning "$(gettext "Package name is %s.")" "$PACKAGE" + warning "$(gettext "Package name is %s")" "${PACKAGE}" rm -rf "${URLFILE}" fetch_database arch ${ARCH_GITBASES[@]} download_sourcefiles else - error "$(gettext "Couldn't find package %s.")" "$PACKAGE" + error "$(gettext "Couldn't find package %s")" "${PACKAGE}" exit 1 fi @@ -192,7 +232,7 @@ function download_sourcefiles() { fi if [[ $? -eq 0 ]]; then - msg "$(gettext "Source files for %s downloaded".)" "$PACKAGE" + msg "$(gettext "Source files for %s downloaded")" "${PACKAGE}" return 0 fi