aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-03-29 22:59:32 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2018-03-29 22:59:32 +0200
commita43d1466feade70030587bc4407708364d15cbc8 (patch)
tree304a3d8152500ce2b3609fc678822d2a7fd0a6d1
parent7dfce788e87960eaacb226418b48324f582f6a14 (diff)
Make split packages work
Also, add a few things TODO.
-rwxr-xr-xauria.sh56
1 files changed, 49 insertions, 7 deletions
diff --git a/auria.sh b/auria.sh
index e232e14..c924d36 100755
--- a/auria.sh
+++ b/auria.sh
@@ -36,12 +36,11 @@
# depends (or similar).
# PROBLEM: The AUR RPC does not search for provides (e.g. dictd-foldoc).
# PROBLEM/NOPROBLEM: Things may change while downloading things (e.g. deps).
-# TODO/PROBLEM: makepkg -i does not work for split packages.
# TODO: Fix update_all
# `- Do not update if AUR version and local version match.
# TODO: search: append (group) [installed{ :verstring}] if applicable
-# - group not easily available;
-# - installed is probably time consuming - alpm could be used.
+# `- group not easily available;
+# `- installed is probably time consuming - alpm could be used.
# TODO: Use guess_devel.
# TODO: Differentiate errors and failures in return codes (mostly done).
# TODO: Conflicts.
@@ -59,6 +58,11 @@
# `- --needed should no longer be necessary, once update_all is fixed.
# TODO: Handle failures of single packages in update_all.
# `- Alternatively, offer a variable skip_updates[] or so.
+# TODO: Options, e.g. to only build or to selectively update.
+# `- Might be (partially) solved by passing args to makepkg.
+# TODO: Do not attempt to build an already built packages. Or else makepkg
+# unhappily fails.
+# `- Alternatively, use makepkg's -f option.
# CONSIDER: Use makepkg_options=(--cleanbuild --syncdeps) as default.
# CONSIDER: (repo_deps) array vs. (newline separated string)
# CONSIDER: (repo_deps) (space vs. newline) separated string
@@ -69,7 +73,8 @@
# CONSIDER: Newlines.
# CONSIDER: Differentiate dep and build-dep.
# `- Option to remove build-deps after installation.
-# CONSIDER: counter in install_list()
+# CONSIDER: Counter in install_list()
+# CONSIDER: Check for matching architecture before attempting to build.
# Q?: When to set retstr to ''.
# IDEA: (print_restriction) consider to use sed.
#
@@ -82,6 +87,8 @@ typeset global_conffile=/etc/auria_conf.sh
typeset local_conffile="$HOME/.config/auria_conf.sh"
typeset git_dir="$HOME/aur"
typeset -a makepkg_options=()
+typeset pkgext=.pkg.tar.xz # Should be the same as PKGEXT in `makepkg.conf'.
+typeset arch="$(uname -m)"
typeset color=false
typeset editor=ed
typeset diff_program=diff
@@ -241,7 +248,8 @@ function install_full
# interactive (<- present_files).
function install_list
{
- local pkgbase old_pkgbase_exists
+ local pkgbase old_pkgbase_exists pkgver pkgrel epoch pkg_arch version \
+ package
for pkg in "${aur_pkgorder[@]}"
do
@@ -270,11 +278,45 @@ function install_list
ask y "Continue" || return 0
fi
+ # Build package.
+ # makepkg's -i flag cannot handle split packages, hence installing has
+ # to be done separately.
+ makepkg --syncdeps "${makepkg_options[@]}" || return 2
+ echo
+
+ # Get version and other data (version may have changed due to pkgver()).
+ makepkg --printsrcinfo > "${tmp}/srcinfo"
+ pkgver="$(grep -E '^\s*pkgver' "${tmp}/srcinfo" | sed -E 's/^.*=\s*//')"
+ pkgrel="$(grep -E '^\s*pkgrel' "${tmp}/srcinfo" | sed -E 's/^.*=\s*//')"
+ epoch="$( grep -E '^\s*epoch' "${tmp}/srcinfo" | sed -E 's/^.*=\s*//')"
+
+ # Get the package's architecture.
+ # If neither any nor $arch were supported, makepkg would've failed
+ # (unless makepkg is configured to build for a different architecture
+ # than $arch, which should not be the case).
+ if grep -qE '^\s*arch\s*=\s*any$' < "${tmp}/srcinfo"
+ then
+ pkg_arch=any
+ else
+ pkg_arch="$arch"
+ fi
+
+ # Compose the package's version.
+ if test -n "$epoch"
+ then
+ version="${epoch}:${pkgver}-${pkgrel}"
+ else
+ version="${pkgver}-${pkgrel}"
+ fi
+
+ # Install package.
+ inform "Install built package..."
+ package="${pkg}-${version}-${pkg_arch}${pkgext}"
if [[ "${aur_itype[$pkg]}" == dep ]]
then
- makepkg "${makepkg_options[@]}" -si --asdeps || return 2
+ sudo pacman -U --asdeps "$package" || return 2
else
- makepkg "${makepkg_options[@]}" -si --needed || return 2
+ sudo pacman -U --needed "$package" || return 2
fi
echo