Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/package.inc.sh
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-03-11 21:16:32 -0500
committerDave Reisner <dreisner@archlinux.org>2017-03-12 09:45:41 -0400
commit82951aafc58d0ea4529387bd180d28a664506743 (patch)
tree6c2a289ead565689b39584bd6a3218ee0d5a7554 /package.inc.sh
parent291ebc3c5ff22c62b035a457b750de226724ceac (diff)
add ls-files subcommand, allow showing files other than PKGBUILD
Diffstat (limited to 'package.inc.sh')
-rw-r--r--package.inc.sh28
1 files changed, 19 insertions, 9 deletions
diff --git a/package.inc.sh b/package.inc.sh
index 14bede9..9ff4e7c 100644
--- a/package.inc.sh
+++ b/package.inc.sh
@@ -1,6 +1,5 @@
package_init() {
- local pkgname=$1
- local do_update=1
+ local do_update=1 pkgname=$1
if [[ $1 = -n ]]; then
do_update=0
@@ -63,8 +62,8 @@ package_log() {
git log "${logargs[@]}" "$remote/packages/$pkgname" -- trunk/
}
-package_show_pkgbuild() {
- local pkgname=$1 remote repo subtree
+package_show_file() {
+ local pkgname=$1 file=${2:-PKGBUILD} remote repo subtree
if [[ $pkgname = */* ]]; then
IFS=/ read -r repo pkgname <<<"$pkgname"
@@ -72,13 +71,23 @@ package_show_pkgbuild() {
package_init "$pkgname" remote || return
- if [[ $repo ]]; then
- subtree=repos/$repo-$OPT_ARCH
- else
- subtree=trunk
+ if [[ $file != */* ]]; then
+ if [[ $repo ]]; then
+ subtree=repos/$repo-$OPT_ARCH/
+ else
+ subtree=trunk/
+ fi
fi
- git show "remotes/$remote/packages/$pkgname:$subtree"/PKGBUILD
+ git show "remotes/$remote/packages/$pkgname:$subtree$file"
+}
+
+package_list_files() {
+ local pkgname=$1 remote
+
+ package_init "$pkgname" remote || return
+
+ git ls-tree -r --name-only "remotes/$remote/packages/$pkgname" "trunk" | sed 's,^trunk/,,'
}
package_export() {
@@ -107,6 +116,7 @@ package_export() {
fi
if (( ! OPT_FORCE )); then
+ # shellcheck disable=SC2154
mkdir "$startdir/$pkgname" || return 1
fi