|
|
@ -0,0 +1,78 @@ |
|
|
|
#!/bin/sh |
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
# |
|
|
|
# Filename: bin/sde-update-manifest |
|
|
|
# Copyright (C) 2010 The OpenSDE Project |
|
|
|
# |
|
|
|
# More information can be found in the files COPYING and README. |
|
|
|
# |
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
|
|
# it under the terms of the GNU General Public License as published by |
|
|
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
|
|
# GNU General Public License can be found in the file COPYING. |
|
|
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
|
|
|
|
[ -n "$SDEROOT" ] || |
|
|
|
export SDEROOT="$(cd "${0%/*}/.."; pwd -P)" |
|
|
|
|
|
|
|
. "$SDEROOT/lib/libsde.in" |
|
|
|
|
|
|
|
MANIFEST="$SDEROOT/etc/manifest.ini" |
|
|
|
|
|
|
|
manifest_update_git() { |
|
|
|
local dir="$SDEROOT/$1" dirname="$1" GIT_DIR="$SDEROOT/$1/.git" |
|
|
|
local repo="$2" branch="$3" |
|
|
|
|
|
|
|
if [ -d "$GIT_DIR" ]; then |
|
|
|
local cur=$(GIT_DIR="$GIT_DIR" git branch | grep ^* | cut -c3-) |
|
|
|
local remote0=$(GIT_DIR="$GIT_DIR" git config --get "branch.$cur.remote") |
|
|
|
local branch0=$(GIT_DIR="$GIT_DIR" git config --get "branch.$cur.merge" | cut -d/ -f3-) |
|
|
|
local repo0=$(GIT_DIR="$GIT_DIR" git config --get "remote.$remote0.url") |
|
|
|
if [ "${repo#git+}" != "${repo0#git+}" ]; then |
|
|
|
echo_warning "$dirname: repo mismatch ($repo vs. $repo0)" |
|
|
|
elif [ "$branch" != "$branch0" ]; then |
|
|
|
echo_warning "$dirname: branch mismatch ($branch vs. $branch0)" |
|
|
|
else |
|
|
|
echo_info "$dirname: updating..." |
|
|
|
(cd "$dir"; git pull --rebase) |
|
|
|
fi |
|
|
|
else |
|
|
|
echo_info "$dirname: cloning $repo ($branch)" |
|
|
|
git clone "$repo" "$dir" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
manifest_update_svn() { |
|
|
|
local dir="$SDEROOT/$1" dirname="$1" repo="$2" path="$3" branch="$4" |
|
|
|
local url="$repo$path" |
|
|
|
if [ "$branch" = "trunk" ]; then |
|
|
|
url="$url/$branch" |
|
|
|
else |
|
|
|
url="$url/branches/$branch" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -d "$dir/.svn" ]; then |
|
|
|
echo_warning "$dirname: already exists" |
|
|
|
else |
|
|
|
echo_info "$1 <- $url" |
|
|
|
svn co "$url" "$dir" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
manifest_update_custom() { |
|
|
|
local dir="$1" repo="$3" arg1="$3" arg2="$4" |
|
|
|
echo_info "$1 <-? $repo ($arg1, $arg2)" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while read d r a0 a1 x; do |
|
|
|
case "${r%%:*}" in |
|
|
|
git|git+ssh) manifest_update_git "$d" "$r" "$a0" |
|
|
|
;; |
|
|
|
svn|svn+ssh) manifest_update_svn "$d" "$r" "$a0" "$a1" |
|
|
|
;; |
|
|
|
*) manifest_update_custom "$d" "$r" "$a0" "$a1" |
|
|
|
;; |
|
|
|
esac |
|
|
|
done < "$MANIFEST.scan" |