4 Commits
v3.0 ... v3.2.1

Author SHA1 Message Date
fbt
a450ff9708 use aur4 by default 2015-06-22 13:31:03 +03:00
fbt
dd0d7f7902 support AUR 4 2015-06-10 14:15:52 +03:00
fbt
840ab9254c export instead of checkout 2015-05-22 17:53:16 +03:00
fbt
b2dc6c01d7 ughx2 2015-02-25 16:30:32 +03:00
2 changed files with 43 additions and 18 deletions

View File

@@ -2,15 +2,15 @@ prm
---
A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
Usage: prm [flags] <package>
Flags:
-h Show this message.
-s Search for <package>.
-S Search only in the sync db. Implies -s.
-A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies.
-f Force downloading package sources even if they are already present in the working directory.
-w <dir> Set the working directory.
Usage: prm [flags] <package>
Flags:
-h Show this message.
-s Search for <package>.
-S Search only in the sync db. Implies -s.
-A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies.
-f Force downloading package sources even if they are already present in the working directory.
-w <dir> Set the working directory.
You can override any value in the script in \$HOME/.config/prm.rc.sh
By default prm downloads the sources into the current directory. Controlled by `$cfg_workdir`.

43
prm
View File

@@ -6,8 +6,9 @@
_self="${0##*/}"
cfg_workdir="$PWD"
cfg_aur_url='https://aur.archlinux.org'
cfg_aur_api="${cfg_aur_url}/rpc.php"
# Version 4 by default.
cfg_aur_version='4'
err() { printf "$@" >&2; }
@@ -66,12 +67,18 @@ aur.get() {
read -r pkg_aur_info
{
read -r pkg_base
read -r tarball_path
} < <(
jshon -e results -e PackageBase -u -p -e URLPath -u <<< "$pkg_aur_info"
)
# A temporary hack till AUR4 becomes the main version
if (( cfg_aur_version == 4 )); then
read -r pkg_base < <( jshon -e results -e PackageBase -u <<< "$pkg_aur_info" )
tarball_path="/cgit/aur.git/snapshot/${pkg_base}.tar.gz"
else
{
read -r pkg_base
read -r tarball_path
} < <(
jshon -e results -e PackageBase -u -p -e URLPath -u <<< "$pkg_aur_info"
)
fi
(( flag_force )) || {
[[ -d "${cfg_workdir}/${pkg_base}" ]] && {
@@ -131,7 +138,7 @@ abs.get() {
svn_repo='packages';;
esac
svn checkout "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
svn export "svn://svn.archlinux.org/${svn_repo}/${1}/trunk" "${cfg_workdir}/${1}"
}
set_argv() {
@@ -188,6 +195,14 @@ main() {
action='search'
flag_search_syncdb=1;;
(-V)
cfg_aur_version="$2"
shift;;
(-u)
cfg_aur_url="$2"
shift;;
(-d)
if [[ "$action" == 'get' ]]; then
flag_get_deps=1
@@ -217,6 +232,16 @@ main() {
unset flag_search_aur flag_search_syncdb
}
if [[ -z "$cfg_aur_url" ]]; then
if (( cfg_aur_version == 3 )); then
cfg_aur_url="https://aur.archlinux.org"
else
cfg_aur_url="https://aur4.archlinux.org"
fi
fi
cfg_aur_api="${cfg_aur_url}/rpc.php"
[[ "$action" ]] || {
usage
return 1