aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-11-19 15:28:47 +0000
committerNicolas Vigier <boklm@mageia.org>2011-11-19 15:28:47 +0000
commitdddbb516aa2fd19e8646b36ae00f1b989e3ef6f9 (patch)
treed8f36fd3e18166d57c77fae646db09c70e735c54
parent6da1614aac84cddcace534fdeb3aa1e0601056f0 (diff)
downloadrepoctl-dddbb516aa2fd19e8646b36ae00f1b989e3ef6f9.tar
repoctl-dddbb516aa2fd19e8646b36ae00f1b989e3ef6f9.tar.gz
repoctl-dddbb516aa2fd19e8646b36ae00f1b989e3ef6f9.tar.bz2
repoctl-dddbb516aa2fd19e8646b36ae00f1b989e3ef6f9.tar.xz
repoctl-dddbb516aa2fd19e8646b36ae00f1b989e3ef6f9.zip
add getrepolock/rmrepolock commands
-rwxr-xr-xrepoctl59
1 files changed, 59 insertions, 0 deletions
diff --git a/repoctl b/repoctl
index 023fa06..9e49b82 100755
--- a/repoctl
+++ b/repoctl
@@ -51,6 +51,17 @@ Example :
repoctl lspkg --srcrepo 1/core/updates_testing --srcpkg emacs
EOF
;;
+ repolock)
+ cat <<EOF
+Usage: getrepolock|rmrepolock --srcrepo distribution/section/sectionrepo
+
+Get or release lock on a repository.
+
+Warning: one process should not try to get a lock on more than one
+repository at the same time. It is however possible to lock all
+repositories of a distribution using getdistrolock/rmdistrolock.
+
+EOF
esac
}
@@ -186,6 +197,46 @@ function lspkg()
}
+function repolock()
+{
+ args=$(getopt -o h -l srcrepo:,help,get,rm -- "$@")
+ [ $? -ne 0 ] && usage_cmd repolock && exit 1
+ eval set -- "$args"
+ [ $# -lt 1 ] && exit 1
+ while [ $# -gt 0 ]
+ do
+ case $1 in
+ -h|--help)
+ usage_cmd repolock
+ exit 0
+ ;;
+ --srcrepo)
+ IFS='/' read -ra srcrepo <<< "$2"
+ shift;shift;;
+ --get)
+ command=get_repo_lock
+ shift;;
+ --rm)
+ command=rm_repo_lock
+ shift;;
+ --)
+ shift;break;;
+ -*)
+ usage
+ exit 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+ if [ -z "$srcrepo" ]
+ then
+ usage_cmd repolock
+ fi
+ $command "${srcrepo[0]}" "${srcrepo[1]}" "${srcrepo[2]}"
+}
+
function usage()
{
cat <<EOF
@@ -222,6 +273,14 @@ case "$1" in
shift
lspkg $@
;;
+ getrepolock)
+ shift
+ repolock --get $@
+ ;;
+ rmrepolock)
+ shift
+ repolock --rm $@
+ ;;
*)
usage
exit 1