From 9f1ae258ce1fc33b2f6197558ddeca5d500e90e2 Mon Sep 17 00:00:00 2001 From: Seppia Date: Mon, 7 Jun 2021 15:07:43 +0200 Subject: New zst format and new cleanbuild function Updated to add support for the new zst format that makepkg uses for packages and added a new cleanbuild funtion which simply performs a clean action before beginning to build the package. --- repofish | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/repofish b/repofish index e601f03..da0597c 100755 --- a/repofish +++ b/repofish @@ -69,11 +69,11 @@ clean_packages() { declare -a pkg=("${!1}") echo -e '\033[1;34m:: \033[1;37mCleaning following packages: '"${pkg[@]}"'\033[m' for i in "${pkg[@]}"; do - find ${SRC_PATH}/$i -type f -iname "*$i*.pkg.tar.xz" -exec rm {} \; + find ${SRC_PATH}/$i -type f -iname "*$i*.pkg.tar.zst" -exec rm {} \; done else echo -e '\033[1;34m:: \033[1;37mCleaning all packages\033[m' - find ${SRC_PATH} -type f -iname "*.pkg.tar.xz" -exec rm {} \; + find ${SRC_PATH} -type f -iname "*.pkg.tar.zst" -exec rm {} \; fi } @@ -159,13 +159,13 @@ update_repo() { declare -a pkg=("${!1}") echo -e '\033[1;34m:: \033[1;37mUpdating following packages in local repository: '"${pkg[@]}"'\033[m' for i in "${pkg[@]}"; do - find ${SRC_PATH}/$i -type f -iname "*$i*pkg.tar.xz" -exec cp {} ${REPO_PATH}/${ARCH}/ \; - repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*$i*.pkg.tar.xz + find ${SRC_PATH}/$i -type f -iname "*$i*pkg.tar.zst" -exec cp {} ${REPO_PATH}/${ARCH}/ \; + repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*$i*.pkg.tar.zst done else echo -e '\033[1;34m:: \033[1;37mUpdating all packages in local repository\033[m' - find ${SRC_PATH} -type f -iname "*pkg.tar.xz" -exec cp {} ${REPO_PATH}/${ARCH}/ \; - repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*.pkg.tar.xz + find ${SRC_PATH} -type f -iname "*pkg.tar.zst" -exec cp {} ${REPO_PATH}/${ARCH}/ \; + repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*.pkg.tar.zst fi } @@ -174,11 +174,11 @@ archive_repo_packages() { declare -a pkg=("${!1}") echo -e '\033[1;34m:: \033[1;37mArchiving following packages in local repository: '"${pkg[@]}"'\033[m' for i in "${pkg[@]}"; do - find ${REPO_PATH}/${ARCH}/ -type f -iname "*$i*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \; + find ${REPO_PATH}/${ARCH}/ -type f -iname "*$i*pkg.tar.zst" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \; done else echo -e '\033[1;34m:: \033[1;37mArchiving all packages in local repository\033[m' - find ${REPO_PATH}/${ARCH}/ -type f -iname "*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \; + find ${REPO_PATH}/${ARCH}/ -type f -iname "*pkg.tar.zst" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \; fi } @@ -221,6 +221,7 @@ print_help() { echo ' build builds the packages' echo ' check check PKGBUILD' echo ' clean cleans the packages' + echo ' cleanbuild cleans the packages anf then builds them' echo ' clone (url) clones git package repository' echo ' help prints this help' echo ' install builds and installs the package' @@ -346,6 +347,19 @@ elif [ "$1" == 'build' ]; then else build_packages fi +elif [ "$1" == 'cleanbuild' ]; then + if [ "$2" != '' ]; then + N=2 + while [ "${!N}" != '' ]; do + packages[$((N-2))]=${!N} + let N=N+1 + done + clean_packages packages[@] + build_packages packages[@] + else + clean_packages + build_packages + fi elif [ "$1" == 'upgrade' ]; then if [ "$2" != '' ]; then N=2 -- cgit v1.2.3