makedeb


blesh-git 0.4.0devel3.r1618.26aaf87-2


Line editor for Bash that adds syntax highlighting, vim-mode, autosuggestions, and more

Click here to go back to the commit logs for blesh-git.

Commit:


Hash: 75374241b32230bb2d3b95569d7e2660cf510996

Message: Fixed installation failure and architecture, added support for updates with tap and mpm helpers, tested on Debian 11

Diff


diff --git a/.SRCINFO b/.SRCINFO
index 921c0fa..66aa62e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,9 @@
 pkgbase = blesh-git
 	pkgdesc = Line editor for Bash that adds syntax highlighting, vim-mode, autosuggestions, and more
-	pkgver = 0.4.0devel3.r1564.a034c91
-	pkgrel = 1
+	pkgver = 0.4.0devel3.r1618.26aaf87
+	pkgrel = 2
 	url = https://github.com/akinomyoga/ble.sh
-	arch = x86_64
+	arch = any
 	license = BSD
 	makedepends = bash
 	makedepends = gawk
@@ -11,13 +11,12 @@ pkgbase = blesh-git
 	makedepends = make
 	makedepends = git
 	depends = bash
-	depends = gawk
 	depends = sed
 	source = git+https://github.com/akinomyoga/ble.sh
 	source = git+https://github.com/akinomyoga/blesh-contrib
 	source = .update-check.sh
 	md5sums = SKIP
 	md5sums = SKIP
-	md5sums = de4c76f01912a7b66445529b7dd007b1
+	md5sums = cec7ee39591c75a7d595d0c88a047bdd
 
 pkgname = blesh-git
diff --git a/.update-check.sh b/.update-check.sh
index 49c9aa1..44337e9 100755
--- a/.update-check.sh
+++ b/.update-check.sh
@@ -1,31 +1,84 @@
 #!/bin/bash
-# Maintainer: yaroslav2424 <julia.schweinz@mailfence.com>
+# Maintainer: yaroslav2424 <julia.schweinz at mailfence dot com>
 # Contributor: capezotte (oc1024 at Github)
 # Contributor: Seto (huresche at GitHub)
 # Contributor: Koichi Murase (akinomyoga at GitHub)
 
-echo "Is this getting called"
+_ble_base_package_type=MPR
 
-_ble_base_package_type=DUR
-
-function ble/base/package:DUR/version_check {
-	LC_ALL=C apt show blesh-git | sed -n 's/^Version[[:space:]]*:[[:space:]]*//p'
+function ble/base/package:MPR/version_check {
+	LC_ALL=C apt show blesh-git 2>/dev/null | sed -n 's/^Version[[:space:]]*:[[:space:]]*//p'
 }
 
-function ble/base/package:DUR/update {
+function ble/base/package:MPR/update {
 	local PKGNAME="blesh-git"
 	local PRE_VERSION POST_VERSION
-	PRE_VERSION="$(ble/base/package:DUR/version_check)"
-	local makedeb_exit
-		LOCALR="$HOME/.cache/blesh/package"
+	PRE_VERSION="$(ble/base/package:MPR/version_check)"
+	local helper_exit
+	# Try to use MPR helper
+		(
+			available=(); default_helper='';
+			for helper in tap mpm; do
+				ble/bin#has "$helper" || continue
+				ble/array#push available "$helper"
+				[[ ! $default_helper && $_ble_base_repository == */"$helper"* ]] && default_helper=$helper
+			done
+
+			if ((${#available[@]})); then
+				ble/array#push available "built-in (experimental)"
+				if [[ $default_helper ]]; then
+					# Bring the default to the beginning of the list
+					ble/array#remove available "$default_helper"
+					ble/array#unshift available "$default_helper"
+				fi
+
+				local PS3="Which MPR helper to use? [${default_helper:+d: $default_helper (default), }x: cancel]? "
+
+				OPERATION='install';
+				select helper in "${available[@]}"; do
+					# Check if default was set 
+					[[ ${helper:=$REPLY} = [dD] || $REPLY = default ]] && helper="$default_helper"
+
+					case $helper in
+						(tap)
+							builtin printf "Selected helper: $helper\n"
+							builtin printf "Package will be built from the MPR repo\n"
+							exec "$helper" "$OPERATION" "$PKGNAME"
+							break;;
+						(mpm)
+							builtin printf "Selected helper: $helper\n"
+							builtin printf "Package will be built from the AUR repo\n"
+							exec "$helper" "$OPERATION" "$PKGNAME"
+							break;;
+						('built-in (experimental)')
+							ble/util/print 'Using built-in AUR helper.'
+							exit 3 ;;
+						([xX]|exit|[cC]|cancel)
+							ble/util/print >&2 'Canceled by the user.'
+							exit 1 ;;
+					esac
+					# Did not exec into a helper
+					ble/util/print >&2 'MPR helper failed.'
+					exit 1
+				done
+     		else
+				ble/util/print >&2 'MPR helper not found, using built-in.'
+				exit 3
+			fi
+		)
+		helper_exit="$?"
+   
+    if ((helper_exit == 3)); then
+		#Try to build from scratch
+		local LOCALR="$HOME/.cache/blesh/package"
 		(
 			ble/util/print "Trying set up a build environment at $LOCALR"
-			DURREPO="https://dur.hunterwittenborn.com/packages/${PKGNAME}.git"
+			MPRREPO="https://mpr.hunterwittenborn.com/${PKGNAME}.git"
 
 			set -ex
 			[[ -w "${LOCALR%/*}" ]]
 			mkdir -p "$LOCALR" && builtin cd "$LOCALR"
-			git clone "$DURREPO" || [ "$(builtin cd "$PKGNAME" && git remote get-url origin)" = "$DURREPO" ]
+			git clone "$MPRREPO" || [ "$(builtin cd "$PKGNAME" && git remote get-url origin)" = "$MPRREPO" ]
 			builtin cd "$PKGNAME"
 			# Discard changes made by makepkg
 			git reset --hard HEAD
@@ -34,19 +87,21 @@ function ble/base/package:DUR/update {
 			exec makedeb PKGBUILD
 		)
 		makedeb_exit="$?"
+		if ((makedeb_exit==0)); then
+			ble/util/print "Asking for installation (sudo dpkg -i "$LOCALR/$PKGNAME"/blesh*.deb):"
+			builtin cd "$LOCALR/$PKGNAME" && sudo dpkg -i "$(find -name '*.deb')" # Not the best way to get it, but still unsure which other characters get modified in the .deb name (like - to _)
+			makepkg --printsrcinfo > .SRCINFO
+		else
+			ble/util/print "There was an issue generating the .deb package, exiting..."
+		fi
+	fi
 
-	POST_VERSION="$(ble/base/package:DUR/version_check)"
+	POST_VERSION="$(ble/base/package:MPR/version_check)"
 
-	if ((makedeb_exit==0)); then
+	if ((helper_exit==0)); then
 		[ "$PRE_VERSION" = "$POST_VERSION" ] && return 6
-		ble/util/print "Asking for installation:"
-		builtin cd "$LOCALR/$PKGNAME" && sudo dpkg -i $(find -name '*.deb') # Not the best way to get it, but still unsure which other characters get modified in the .deb name (like - to _)
-		makepkg --printsrcinfo > .SRCINFO
 		return 0
-	else
-		ble/util/print "There was an issue generating the .deb package, exiting..."
 	fi
 	# Just return 1 if we reached this point
 	return 1
 }
-
diff --git a/PKGBUILD b/PKGBUILD
index 6a5c543..de4d785 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,4 @@
-# Maintainer: yaroslav2424 <julia.schweinz@mailfence.com>
+# Maintainer: yaroslav2424 <julia.schweinz at mailfence dot com>
 # Contributor: capezotte (oc1024 at GitHub)
 # Contributor: Seto (huresche at GitHub)
 # Contributor: Koichi Murase (akinomyoga at GitHub)
@@ -6,18 +6,17 @@
 pkgname=blesh-git
 _pkgname=ble.sh
 pkgdesc="Line editor for Bash that adds syntax highlighting, vim-mode, autosuggestions, and more"
-pkgver=0.4.0devel3.r1564.a034c91
-pkgrel=1
+pkgver=0.4.0devel3.r1618.26aaf87
+pkgrel=2
 license=(BSD)
 url='https://github.com/akinomyoga/ble.sh'
 depends=(bash sed)
 makedepends=(bash gawk sed make git)
-arch=('x86_64')
-#arch=(any) # Had trouble with tar not uncompressing the archive cause it was renaming as '_all', fix it later
+arch=(any)
 source=("git+$url" "git+${url/%.sh/sh-contrib}" '.update-check.sh')
 md5sums=('SKIP'
 		'SKIP'
-		'de4c76f01912a7b66445529b7dd007b1')
+		'cec7ee39591c75a7d595d0c88a047bdd')
 
 pkgver() {
 	cd "$_pkgname"
@@ -33,6 +32,7 @@ prepare() {
 }
 
 package() {
+	# Makes ble-update call an MPR helper
 	install -Dm755 .update-check.sh "$pkgdir"/usr/share/blesh/lib/_package.sh
 	cd "$_pkgname"
 	make install DESTDIR="$pkgdir" PREFIX=/usr