summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVedant K2021-06-17 17:36:58 +0530
committerVedant K2021-06-17 17:36:58 +0530
commitd573c4185e3f7b7025248e7eec619e64dcb4bcfd (patch)
tree115594e1055ae5e8b2a28daa87330db6f6658430
parent1219edf4995ebcc144a2e45eb7cf9548e94efa68 (diff)
downloadaur-d573c4185e3f7b7025248e7eec619e64dcb4bcfd.tar.gz
0.4.1
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD4
-rwxr-xr-xupdate-version182
3 files changed, 187 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 540b2a8b0289..94fda8876e9d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = yeet
pkgdesc = A minimalistic pacman wrapper written in bash
- pkgver = 0.4.0
+ pkgver = 0.4.1
pkgrel = 3
url = https://github.com/gamemaker1/yeet
install = yeet.install
@@ -10,7 +10,7 @@ pkgbase = yeet
depends = package-query
depends = pacman
optdepends = ranger: for editing build files
- source = yeet-0.4.0.tar.gz::https://github.com/gamemaker1/yeet/archive/v0.4.0.tar.gz
- sha256sums = fdc43f90b309bf91bb2b18e8cd5457e15993d519a58efb49f6b3bf9bba6eefe6
+ source = yeet-0.4.1.tar.gz::https://github.com/gamemaker1/yeet/archive/v0.4.1.tar.gz
+ sha256sums = 92ac6d575fb221679b326516a7ad7e3b40fb691837c07a210a1dcb445e5c5d4f
pkgname = yeet
diff --git a/PKGBUILD b/PKGBUILD
index afae21c1b3ee..7faf3278338d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>
pkgname=yeet
-pkgver=0.4.0
+pkgver=0.4.1
pkgrel=3
epoch=
pkgdesc="A minimalistic pacman wrapper written in bash"
@@ -14,7 +14,7 @@ makedepends=()
optdepends=('ranger: for editing build files')
install=yeet.install
source=("$pkgname-$pkgver.tar.gz::https://github.com/gamemaker1/yeet/archive/v$pkgver.tar.gz")
-sha256sums=('fdc43f90b309bf91bb2b18e8cd5457e15993d519a58efb49f6b3bf9bba6eefe6')
+sha256sums=('92ac6d575fb221679b326516a7ad7e3b40fb691837c07a210a1dcb445e5c5d4f')
package() {
install -Dm775 "$srcdir/$pkgname-$pkgver/source/yeet" "$pkgdir/usr/bin/yeet"
diff --git a/update-version b/update-version
new file mode 100755
index 000000000000..6adc305fc7b1
--- /dev/null
+++ b/update-version
@@ -0,0 +1,182 @@
+#!/bin/bash
+
+## UPDATE VERSION SCRIPT
+## ---------------------
+
+# Update the version and hash in the PKGBUILD and upload it
+
+## CREDITS
+# ASCII art using the figlet CLI from AUR (https://aur.archlinux.org/packages/figlet) and the pagga font from the figlet-fonts-extra package from AUR (https://aur.archlinux.org/packages/figlet-fonts-extra_)
+
+## DEPENDENCIES
+# git
+# pacman
+# namcap
+# base-devel (group)
+
+## SETUP
+# Unalias everything to prevent weirdness
+unalias -a
+# Fail and exit when the first error occurs
+set -e
+# Enable globs
+shopt -s nullglob
+# For debbuging
+#set -xv
+
+## UTILITY
+# Print messages in colour
+# Green text
+function printg {
+ echo -e "\e[1;32m$*\e[0m"
+}
+# Blue text
+function printb {
+ echo -e "\e[1;34m$*\e[0m"
+}
+# Magenta text
+function printm {
+ echo -e "\e[1;35m$*\e[0m"
+}
+# Yellow text
+function printw {
+ echo -e "\e[1;33m$*\e[0m"
+}
+# Red text
+function printr {
+ echo -e "\e[1;31m$*\e[0m"
+}
+# Join elements of an array (taken from SO - https://stackoverflow.com/a/17841619; thank you to the answerer)
+function join_by {
+ local d=${1-} f=${2-}
+ if shift 2; then
+ printf %s "$f" "${@/#/$d}"
+ fi
+}
+# Print the logo
+function print_logo {
+ printw ""
+ printw "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"
+ printw "░█▀▄░█░█░█▄█░█▀█░░░█░█░█▀▀░█▀▄░█▀▀░▀█▀░█▀█░█▀█░"
+ printw "░█▀▄░█░█░█░█░█▀▀░░░▀▄▀░█▀▀░█▀▄░▀▀█░░█░░█░█░█░█░"
+ printw "░▀▀░░▀▀▀░▀░▀░▀░░░░░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░"
+ printw "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"
+ printw ""
+}
+
+## CONFIG
+# Set variables
+[[ -z "$PKGBUILD_PATH" ]] && export PKGBUILD_PATH=./PKGBUILD
+[[ -z "$SRCINFO_PATH" ]] && export SRCINFO_PATH=./.SRCINFO
+[[ -z "$INSTALL_HOOKS_PATH" ]] && export INSTALL_HOOKS_PATH=./yeet.install
+
+[[ -z "$TEMP_DIR" ]] && mkdir -p /tmp/pkgupdate/ && export TEMP_DIR=/tmp/pkgupdate/
+
+[[ -z "$PACMAN_BIN" ]] && export PACMAN_BIN=/usr/bin/pacman
+[[ -z "$SUDO_BIN" ]] && export SUDO_BIN=/usr/bin/sudo
+
+[[ -z "$GIT_MESSAGE" ]] && export GIT_MESSAGE="$1"
+[[ -z "$GIT_FILES" ]] && export GIT_FILES="$PKGBUILD_PATH $SRC_INFO_PATH $INSTALL_HOOKS_PATH"
+
+# Source the PKGBUILD so we can access its fields
+source "$PKGBUILD_PATH"
+
+## UI
+# Print the logo
+print_logo
+
+## MAIN
+# Update the version first
+printm "==> Bump version"
+if [[ -z "$1" ]]; then
+ printr "ERR No new version specified; aborting"
+ exit 1
+else
+ printb "==> Updating version to $1"
+ new_version="$1"
+ # Replace it with the new version
+ sed -i "s/pkgver=.*/pkgver=$new_version/g" "$PKGBUILD_PATH"
+fi
+
+# Update the pkgrel next (if needed)
+printm "==> Bump PKGREL"
+if [[ -z "$2" ]]; then
+ printw "==> No PKGREL specified, skipping"
+else
+ printb "==> Updating PKGREL to $2"
+ new_rel="$2"
+ # Replace the old pkgrel with the new pkgrel
+ sed -i "s/pkgrel=.*/pkgrel=$new_rel/g" "$PKGBUILD_PATH"
+fi
+
+printm "==> Update checksums"
+# Now download the sources and get their SHA256SUMS
+printb "==> Retrieving sources and generating SHA256 checksums..."
+# First make a tmp directory for the files
+mkdir -p ""$TEMP_DIR""
+# Array of generated checksums
+generated_checksums=()
+# Then retrieve them
+for source_file_or_url in "${source[@]}"; do
+ # Ensure they are files to be downloaded, not local ones
+ if echo $source_file_or_url | grep -q '::' ; then
+ # Parse the URL and file
+ source_url=$(echo $source_file_or_url | awk -F '::' '{ print $2 }')
+ source_file=$(echo $source_file_or_url | awk -F '::' '{ print $1 }')
+ # Get the file
+ printb "==> Found source $source_file; retrieving from $source_url using cURL"
+ curl -L -o "$TEMP_DIR/$source_file" "$source_url"
+ printg "==> Succesfully retrieved $source_file!"
+ # Generate the checksum
+ printb "==> Generating SHA256 checksum for $source_file..."
+ sha256_checksum=$(sha256sum ""$TEMP_DIR"$source_file" | awk '{ print $1 }')
+ generated_checksums+=($sha256_checksum)
+ printg "==> Checksum generated: $sha256_checksum"
+ else
+ # It is a local file, generate a checksum
+ source_file=$source_file_or_url
+ printg "==> Found local source file $source_file"
+ # Generate the checksum
+ printb "==> Generating SHA256 checksum for $source_file..."
+ sha256_checksum=$(sha256sum "$TEMP_DIR/$source_file" | awk '{ print $1 }')
+ generated_checksums+=($sha256_checksum)
+ printg "==> Checksum generated: $sha256_checksum"
+ fi
+done
+# Replace the checksums in the file
+sed -i "s/sha256sums=.*/sha256sums=('$(join_by ' ' $generated_checksums)')/g" "$PKGBUILD_PATH"
+printg "==> Updated checksums succesfully!"
+
+# Print out .SRCINFO
+printm "==> Update .SRCINFO"
+printb "==> Updating .SRCINFO..."
+cp "$SRCINFO_PATH" "$TEMP_DIR/.SRCINFO.bak"
+makepkg --printsrcinfo > "$SRCINFO_PATH"
+printg "==> Updated .SRCINFO succesfully!"
+
+# Run checks
+# - `namcap` should pass
+# - `makepkg` should exit succesfully
+printm "==> Run checks (namcap, makepkg)"
+# Run namcap
+printb "==> Running namcap..."
+namcap_output=$(namcap "$PKGBUILD_PATH")
+if [[ -z $namcap_output ]]; then
+ printg "==> namcap successful!"
+else
+ printr "ERR namcap check failed: $namcap_output"
+fi
+# Run makepkg
+printb "==> Running makepkg..."
+BUILDDIR="$TEMP_DIR" makepkg -p "$PKGBUILD_PATH"
+printg "==> makepkg successful!"
+
+# Pushing to git
+printm "==> Push to AUR"
+# Run git add, commit, push
+git add $GIT_FILES
+git commit -m "$GIT_MESSAGE"
+git push
+
+# We're done!
+printg "==> Succesfully updated package!" \ No newline at end of file