[arch-projects] [devtools] [PATCH 1/3] commitpkg: Fix usage message
Remove the no longer used "reponame" argument from the usage message. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commitpkg b/commitpkg index 1275615..244581f 100755 --- a/commitpkg +++ b/commitpkg @@ -54,7 +54,7 @@ pkgbase=${pkgbase:-$pkgname} case "$cmd" in commitpkg) if [ $# -eq 0 ]; then - abort 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' + abort 'usage: commitpkg [-l limit] [-a arch] [commit message]' fi repo="$1" shift @@ -63,7 +63,7 @@ case "$cmd" in repo="${cmd%pkg}" ;; *) - abort 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' + abort 'usage: commitpkg [-l limit] [-a arch] [commit message]' ;; esac -- 1.7.6
Point out that we allow passing more than two packages here. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archco | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/archco b/archco index 3a153a7..31134f4 100755 --- a/archco +++ b/archco @@ -3,7 +3,7 @@ scriptname=${0##*/} if [ "$1" = '' ]; then - echo 'Usage: '$scriptname' <package name> [<package name>]' + echo 'Usage: '$scriptname' <package name>...' exit 1 fi -- 1.7.6
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- Makefile | 2 + zsh_completion | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 0 deletions(-) create mode 100644 zsh_completion diff --git a/Makefile b/Makefile index 17f1aa6..0db3008 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ install: for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools + install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco uninstall: @@ -68,6 +69,7 @@ uninstall: for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done rm $(DESTDIR)/etc/bash_completion.d/devtools + rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm -f $(DESTDIR)$(PREFIX)/bin/communityco dist: diff --git a/zsh_completion b/zsh_completion new file mode 100644 index 0000000..29c9657 --- /dev/null +++ b/zsh_completion @@ -0,0 +1,82 @@ +#compdef archbuild archco archrelease archrm commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-i686-build=archbuild extra-x86_64-build=archbuild testing-i686-build=archbuild testing-x86_64-build=archbuild staging-i686-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild + +_arch=(i686 x86_64 any) + +_tags=( + core-i686 core-x86_64 core-any + extra-i686 extra-x86_64 extra-any + multilib-i686 multilib-x86_64 multilib-any + community-i686 community-x86_64 community-any + staging-i686 staging-x86_64 staging-any + testing-i686 testing-x86_64 testing-any + multilib-testing-i686 multilib-testing-x86_64 multilib-testing-any + community-staging-i686 community-staging-x86_64 community-staging-any + community-testing-i686 community-testing-x86_64 community-testing-any +) + +_archbuild_args=( + '-c[Recreate the chroot before building]' + '-r[Create chroots in this directory]:base_dir:_files -/' +) + +_archco_args=( + '*:packages:_devtools_completions_installed_packages' +) + +_archrelease_args=( + "1:arch:($_tags[*])" +) + +_archrm_args=( + '1:path:_files -/' +) + +_commitpkg_args=( + "-a[Release to a specific architecture only]:arch:($_arch[*])" + '-l[Set bandwidth limit]:limit' + '1:commit_msg' +) + +_finddeps_args=( + '1:packages:_devtools_completions_installed_packages' +) + +_makechrootpkg_args=( + '-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"' + '-c[Clean the chroot before building]' + '-d[Add the package to a local db at /repo after building]' + '-h[Display usage]' + '-l[The directory to use as the working copy]:copy_dir:_files -/' + '-r[The chroot dir to use]:chroot_dir:_files -/' + '-u[Update the working copy of the chroot before building]' +) + +_mkarchroot_args=( + '-r[Run a program within the context of the chroot]:app' + '-u[Update the chroot via pacman]' + '-f[Force overwrite of files in the working-dir]' + '-C[Location of a pacman config file]:pacman_config:_files' + '-M[Location of a makepkg config file]:makepkg_config:_files' + '-n[Do not copy config files into the chroot]' + '-c[Set pacman cache]:pacman_cache:_files -/' + '-h[Display usage]' +) + +_rebuildpkgs_args=( + '1:chroot_dir:_files -/' + '*:packages:_devtools_completions_installed_packages' +) + +_devtools_completions_installed_packages() { + local -a cmd packages packages_long + packages_long=(/var/lib/pacman/local/*(/)) + packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} ) + compadd "$@" -a packages +} + +_devtools() { + local argname="_${service}_args[@]" + _arguments -s "${(P)argname}" +} + +_devtools -- 1.7.6
On Fri, 19 Aug 2011 08:52:22 +0200, Lukas Fleischer wrote:
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- Makefile | 2 + zsh_completion | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 0 deletions(-) create mode 100644 zsh_completion
diff --git a/Makefile b/Makefile index 17f1aa6..0db3008 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ install: for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools + install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco
uninstall: @@ -68,6 +69,7 @@ uninstall: for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done rm $(DESTDIR)/etc/bash_completion.d/devtools + rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm -f $(DESTDIR)$(PREFIX)/bin/communityco
dist: diff --git a/zsh_completion b/zsh_completion new file mode 100644 index 0000000..29c9657 --- /dev/null +++ b/zsh_completion @@ -0,0 +1,82 @@ +#compdef archbuild archco archrelease archrm commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-i686-build=archbuild extra-x86_64-build=archbuild testing-i686-build=archbuild testing-x86_64-build=archbuild staging-i686-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild
I think communityco is missing here.
+_arch=(i686 x86_64 any) + +_tags=( + core-i686 core-x86_64 core-any + extra-i686 extra-x86_64 extra-any + multilib-i686 multilib-x86_64 multilib-any + community-i686 community-x86_64 community-any + staging-i686 staging-x86_64 staging-any + testing-i686 testing-x86_64 testing-any + multilib-testing-i686 multilib-testing-x86_64 multilib-testing-any + community-staging-i686 community-staging-x86_64 community-staging-any + community-testing-i686 community-testing-x86_64 community-testing-any +) + +_archbuild_args=( + '-c[Recreate the chroot before building]' + '-r[Create chroots in this directory]:base_dir:_files -/' +) + +_archco_args=( + '*:packages:_devtools_completions_installed_packages' +)
We should do the same as bash completion does here. Call pacman -Slq; still not perfect but better than just complete to already installed packages.
+_archrelease_args=( + "1:arch:($_tags[*])" +) + +_archrm_args=( + '1:path:_files -/' +) + +_commitpkg_args=( + "-a[Release to a specific architecture only]:arch:($_arch[*])" + '-l[Set bandwidth limit]:limit' + '1:commit_msg' +) + +_finddeps_args=( + '1:packages:_devtools_completions_installed_packages' +) + +_makechrootpkg_args=( + '-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"' + '-c[Clean the chroot before building]' + '-d[Add the package to a local db at /repo after building]' + '-h[Display usage]' + '-l[The directory to use as the working copy]:copy_dir:_files -/' + '-r[The chroot dir to use]:chroot_dir:_files -/' + '-u[Update the working copy of the chroot before building]' +) + +_mkarchroot_args=( + '-r[Run a program within the context of the chroot]:app' + '-u[Update the chroot via pacman]' + '-f[Force overwrite of files in the working-dir]' + '-C[Location of a pacman config file]:pacman_config:_files' + '-M[Location of a makepkg config file]:makepkg_config:_files' + '-n[Do not copy config files into the chroot]' + '-c[Set pacman cache]:pacman_cache:_files -/' + '-h[Display usage]' +) + +_rebuildpkgs_args=( + '1:chroot_dir:_files -/' + '*:packages:_devtools_completions_installed_packages' +) + +_devtools_completions_installed_packages() { + local -a cmd packages packages_long + packages_long=(/var/lib/pacman/local/*(/)) + packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} ) + compadd "$@" -a packages +} + +_devtools() { + local argname="_${service}_args[@]" + _arguments -s "${(P)argname}" +} + +_devtools
-- Pierre Schmitz, https://users.archlinux.de/~pierre
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- * Contains alias for communityco. * archco and communityco now invoke _*_all_packages() (which calls `pacman -Slq`) instead of _*_installed_packages(). * I merged the archrelease fix up into this one. * Some minor cleanups. Makefile | 2 + zsh_completion | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 0 deletions(-) create mode 100644 zsh_completion diff --git a/Makefile b/Makefile index 17f1aa6..0db3008 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ install: for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools + install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco uninstall: @@ -68,6 +69,7 @@ uninstall: for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done rm $(DESTDIR)/etc/bash_completion.d/devtools + rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm -f $(DESTDIR)$(PREFIX)/bin/communityco dist: diff --git a/zsh_completion b/zsh_completion new file mode 100644 index 0000000..b1d7d05 --- /dev/null +++ b/zsh_completion @@ -0,0 +1,81 @@ +#compdef archbuild archco archrelease archrm commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-i686-build=archbuild extra-x86_64-build=archbuild testing-i686-build=archbuild testing-x86_64-build=archbuild staging-i686-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild communityco=archco + +_arch=(i686 x86_64 any) + +_tags=( + core-i686 core-x86_64 core-any + extra-i686 extra-x86_64 extra-any + multilib-i686 multilib-x86_64 multilib-any + staging-i686 staging-x86_64 staging-any + testing-i686 testing-x86_64 testing-any + multilib-testing-i686 multilib-testing-x86_64 multilib-testing-any + community-i686 community-x86_64 community-any + community-staging-i686 community-staging-x86_64 community-staging-any + community-testing-i686 community-testing-x86_64 community-testing-any +) + +_archbuild_args=( + '-c[Recreate the chroot before building]' + '-r[Create chroots in this directory]:base_dir:_files -/' +) + +_archco_args=( + '*:packages:_devtools_completions_all_packages' +) + +_archrelease_args=( + "*:arch:($_tags[*])" +) + +_archrm_args=( + '1:path:_files -/' +) + +_commitpkg_args=( + "-a[Release to a specific architecture only]:arch:($_arch[*])" + '-l[Set bandwidth limit]:limit' + '1:commit_msg' +) + +_finddeps_args=( + '1:packages:_devtools_completions_installed_packages' +) + +_makechrootpkg_args=( + '-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"' + '-c[Clean the chroot before building]' + '-d[Add the package to a local db at /repo after building]' + '-h[Display usage]' + '-l[The directory to use as the working copy]:copy_dir:_files -/' + '-r[The chroot dir to use]:chroot_dir:_files -/' + '-u[Update the working copy of the chroot before building]' +) + +_mkarchroot_args=( + '-r[Run a program within the context of the chroot]:app' + '-u[Update the chroot via pacman]' + '-f[Force overwrite of files in the working-dir]' + '-C[Location of a pacman config file]:pacman_config:_files' + '-M[Location of a makepkg config file]:makepkg_config:_files' + '-n[Do not copy config files into the chroot]' + '-c[Set pacman cache]:pacman_cache:_files -/' + '-h[Display usage]' +) + +_rebuildpkgs_args=( + '1:chroot_dir:_files -/' + '*:packages:_devtools_completions_installed_packages' +) + +_devtools_completions_all_packages() { + typeset -U packages + packages=($(_call_program packages pacman -Sql)) + compadd - "${(@)packages}" +} + +_devtools() { + local argname="_${service}_args[@]" + _arguments -s "${(P)argname}" +} + +_devtools -- 1.7.6
On Fri, Aug 19, 2011 at 1:52 AM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
Remove the no longer used "reponame" argument from the usage message. Since when? commitpkg still requires an argument if called as 'commitpkg'; it does not if called as 'communitypkg', 'extrapkg', etc. So this commit seems totally bogus to me...
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/commitpkg b/commitpkg index 1275615..244581f 100755 --- a/commitpkg +++ b/commitpkg @@ -54,7 +54,7 @@ pkgbase=${pkgbase:-$pkgname} case "$cmd" in commitpkg) if [ $# -eq 0 ]; then - abort 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' + abort 'usage: commitpkg [-l limit] [-a arch] [commit message]' fi repo="$1" shift @@ -63,7 +63,7 @@ case "$cmd" in repo="${cmd%pkg}" ;; *) - abort 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' + abort 'usage: commitpkg [-l limit] [-a arch] [commit message]' ;; esac
-- 1.7.6
On Fri, Aug 19, 2011 at 06:54:29AM -0500, Dan McGee wrote:
On Fri, Aug 19, 2011 at 1:52 AM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
Remove the no longer used "reponame" argument from the usage message. Since when? commitpkg still requires an argument if called as 'commitpkg'; it does not if called as 'communitypkg', 'extrapkg', etc. So this commit seems totally bogus to me...
You've got me there. I completely overlooked the first matching pattern in the case statement here and somehow assumed that this was removed during some refactoring.
participants (3)
-
Dan McGee
-
Lukas Fleischer
-
Pierre Schmitz