[Frugalware-darcs] pacman-tools: repoman: initial git support

VMiklos vmiklos at frugalware.org
Sat Jun 30 18:39:50 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman-tools;a=darcs_commitdiff;h=20070630012011-e2957-8e4f229079ae9d5d9209cd659a7aa521074cbdd5.gz;

[repoman: initial git support
VMiklos <vmiklos at frugalware.org>**20070630012011
 - not well tested
 - srcdel(), update() needs fixing
] {
hunk ./repoman 46
-	if [ -f "$fst_root/$reponame/_darcs/prefs/defaultrepo" ]; then
-		server="`cat $fst_root/$reponame/_darcs/prefs/defaultrepo`"
+	if [ "$_F_makepkg_scm" = "git" ]; then
+		_server=`GIT_DIR=$fst_root/$reponame/.git git config --get remote.origin.url 2>/dev/null`
+		if echo $_server |grep -q :[^/]; then
+			server=$_server
+		fi
+	else
+		if [ -f "$fst_root/$reponame/_darcs/prefs/defaultrepo" ]; then
+			server="`cat $fst_root/$reponame/_darcs/prefs/defaultrepo`"
+		fi
hunk ./repoman 56
-        if echo $server |grep -q :; then
+        if echo $server |grep -q :[^/]; then
hunk ./repoman 64
-_get_root()
+get_root()
hunk ./repoman 66
-	local i=`pwd`
+	local i
+	if [ "$_F_makepkg_scm" = "git" ]; then
+		i=`git rev-parse --git-dir 2>/dev/null`
+		echo `dirname $i`
+	else
+	i=`pwd`
hunk ./repoman 82
+	fi
+}
+
+_set_lockname()
+{
+	if [ "$_F_makepkg_scm" = "git" ]; then
+		lock=".git/lock"
+	else
+		lock="_darcs/lock"
+	fi
hunk ./repoman 111
-		ssh $host "cd $path; if [ ! -e _darcs/lock ]; then $sudo rm $rmopts $path/$i; else echo \"Couldn't get lock.\"; fi"
+		_set_lockname
+		ssh $host "cd $path; if [ ! -e $lock ]; then $sudo rm $rmopts $path/$i; else echo \"Couldn't get lock.\"; fi"
hunk ./repoman 202
+	_set_lockname
hunk ./repoman 204
-if [ ! -e _darcs/rlock ]; then \
-	touch _darcs/rlock; \
+if [ ! -e $lock ]; then \
+	touch $lock; \
hunk ./repoman 212
-	cd $path; rm _darcs/rlock; \
+	cd $path; rm $lock; \
hunk ./repoman 244
+	if [ "$_F_makepkg_scm" = "git" ]; then
+		echo -e "$pkgname-$pkgver-$pkgrel-$arch
+$@" | git commit -a -F - .
+	else
hunk ./repoman 253
+	fi
hunk ./repoman 268
-		darcs what -s .
-		ask "darcs record --edit-long-comment -m '$pkgname-$pkgver-$pkgrel-$arch' ."
+		if [ "$_F_makepkg_scm" = "git" ]; then
+			dg what -s .
+			ask "dg record --edit-long-comment -m '$pkgname-$pkgver-$pkgrel-$arch' ."
+		else
+			darcs what -s .
+			ask "darcs record --edit-long-comment -m '$pkgname-$pkgver-$pkgrel-$arch' ."
+		fi
hunk ./repoman 352
-	cmd="darcs push --match 'name $modpkgname'"
+	if [ "$_F_makepkg_scm" = "git" ]; then
+		cmd="dg push"
+	else
+		cmd="darcs push --match 'name $modpkgname'"
+	fi
hunk ./repoman 528
+if [ "$_F_makepkg_scm" = "git" ]; then
+# Checking for git.
+which git >/dev/null 2>&1
+if [ $? != 0 ]; then
+	echo "ERROR: Can't find git. You can install it with pacman-g2 -S git."
+	exit 1
+fi
+else
hunk ./repoman 539
-	echo "ERROR: Can't find darcs. You can install it with pacman -S darcs."
+	echo "ERROR: Can't find darcs. You can install it with pacman-g2 -S darcs."
hunk ./repoman 542
+fi
}


More information about the Frugalware-darcs mailing list