FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Development

 
 
LinkBack Thread Tools
 
Old 04-01-2011, 09:35 PM
Dan McGee
 
Default commitpkg: make repo/server selection more modular

This gets rid of the ever-expanding conditional we had before and
replaces it with two case statements.

The first handles the command name. If it ends with 'pkg', we treat the
entire first part of the reponame, unless of course 'commitpkg' was
called directly. This allows one to add new symlinks such as
'gnome-unstablepkg'.

The second handles the server. Well-known repositories are listed and
passed to the appropriate server. All unusual repos are assumed to live
on gerolde and sent that direction.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
commitpkg | 55 ++++++++++++++++++++++++-------------------------------
1 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/commitpkg b/commitpkg
index dfc2bd1..009c777 100755
--- a/commitpkg
+++ b/commitpkg
@@ -51,38 +51,31 @@ fi
. PKGBUILD
pkgbase=${pkgbase:-$pkgname}

-# set up repo-specific opts depending on how we were called
-server='gerolde.archlinux.org'
-if [ "$cmd" == 'extrapkg' ]; then
- repo='extra'
-elif [ "$cmd" == 'corepkg' ]; then
- repo='core'
-elif [ "$cmd" == 'testingpkg' ]; then
- repo='testing'
-elif [ "$cmd" == 'stagingpkg' ]; then
- repo='staging'
-elif [ "$cmd" == 'communitypkg' ]; then
- repo='community'
- server='aur.archlinux.org'
-elif [ "$cmd" == 'community-testingpkg' ]; then
- repo='community-testing'
- server='aur.archlinux.org'
-elif [ "$cmd" == 'community-stagingpkg' ]; then
- repo='community-staging'
- server='aur.archlinux.org'
-elif [ "$cmd" == 'multilibpkg' ]; then
- repo='multilib'
- server='aur.archlinux.org'
-elif [ "$cmd" == 'multilib-testingpkg' ]; then
- repo='multilib-testing'
- server='aur.archlinux.org'
-else
- if [ $# -eq 0 ]; then
+case "$cmd" in
+ commitpkg)
+ if [ $# -eq 0 ]; then
+ abort 'usage: commitpkg <reponame> [-l limit] [commit message]'
+ fi
+ repo="$1"
+ shift
+ ;;
+ *pkg)
+ repo="${cmd%pkg}"
+ ;;
+ *)
abort 'usage: commitpkg <reponame> [-l limit] [commit message]'
- fi
- repo="$1"
- shift
-fi
+ ;;
+esac
+
+case "$repo" in
+ core|extra|testing|staging)
+ server='gerolde.archlinux.org' ;;
+ community*|multilib*)
+ server='aur.archlinux.org' ;;
+ *)
+ server='gerolde.archlinux.org'
+ echo "Non-standard repository $repo in use, defaulting to server $server" ;;
+esac

# check if all local source files are under version control
for s in ${source[@]}; do
--
1.7.4.2
 

Thread Tools




All times are GMT. The time now is 05:57 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org