r24652 - in /scripts/KGB/client: KGB_sendcommit post-commit

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Aug 27 11:29:05 UTC 2008


Author: dmn
Date: Wed Aug 27 11:29:02 2008
New Revision: 24652

URL: http://svn.debian.org/wsvn/?sc=1&rev=24652
Log:
KGB_sendcommit: use --options and support --conf file; proxy is deduced from URI (unless specified)

Using a configuration file is preferred, as the password won't appear in `ps'

Modified:
    scripts/KGB/client/KGB_sendcommit
    scripts/KGB/client/post-commit

Modified: scripts/KGB/client/KGB_sendcommit
URL: http://svn.debian.org/wsvn/scripts/KGB/client/KGB_sendcommit?rev=24652&op=diff
==============================================================================
--- scripts/KGB/client/KGB_sendcommit (original)
+++ scripts/KGB/client/KGB_sendcommit Wed Aug 27 11:29:02 2008
@@ -27,13 +27,41 @@
 use SVN::Repos;
 use SVN::Core;
 use SOAP::Lite;
+use Getopt::Long;
+use YAML ();
 
-#my $pool = SVN::Pool->new_default;
-#my $uri = "http://asterix.decidir.net:9999/";
-#my $proxy = "http://asterix.decidir.net:9999/?session=KGB";
+my( $conf_file, $uri, $proxy, $repo_id, $password );
+GetOptions(
+    'conf=s'    => \$conf_file,
+    'uri=s'     => \$uri,
+    'proxy=s'   => \$proxy,
+    'repo-id=s' => \$repo_id,
+    'pass=s'    => \$password,
+) or exit 1;
 
-my($uri, $proxy, $repoid, $password, $path, $rev) = @ARGV;
-die "$0 URI proxy repoid password path [revision]\n" unless($repoid and $path);
+my($path, $rev) = @ARGV;
+
+if( $conf_file )
+{
+    my $conf = YAML::LoadFile($conf_file)
+        or die "Error loading config from $conf_file\n";
+
+    $uri      ||= $conf->{uri};
+    $proxy    ||= $conf->{proxy};
+    $repo_id  ||= $conf->{'repo-id'};
+    $password ||= $conf->{'password'};
+}
+
+die "uri not given\n" unless $uri;
+
+$proxy ||= "$uri?session=KGB";
+
+die "proxy not given\n" unless $proxy;
+die "repo-id not given\n" unless $repo_id;
+die "password not given\n" unless $password;
+
+die "SVN path and revision must be given as arguments\n"
+    unless $path and $rev;
 
 my $repo = SVN::Repos::open($path);
 my $fs = $repo->fs or die $!;
@@ -70,15 +98,15 @@
 	});
 
 # v1 protocol
-my $checksum = sha1_hex($repoid, $rev, @changed, $log, $aut, $password);
+my $checksum = sha1_hex($repo_id, $rev, @changed, $log, $aut, $password);
 
 my $res = $s->commit([1,
-		$repoid, $checksum, SOAP::Data->type(int => $rev),
+		$repo_id, $checksum, SOAP::Data->type(int => $rev),
 		[ map({SOAP::Data->type(string => $_)} @changed) ],
 		SOAP::Data->type(string => $log),
 		SOAP::Data->type(string => $aut)]);
 #my $res = $s->commit([
-#		$repoid, $password, SOAP::Data->type(int => $rev),
+#		$repo_id, $password, SOAP::Data->type(int => $rev),
 #		[ map({SOAP::Data->type(string => $_)} @changed) ],
 #		SOAP::Data->type(string => $log),
 #		SOAP::Data->type(string => $aut)]);

Modified: scripts/KGB/client/post-commit
URL: http://svn.debian.org/wsvn/scripts/KGB/client/post-commit?rev=24652&op=diff
==============================================================================
--- scripts/KGB/client/post-commit (original)
+++ scripts/KGB/client/post-commit Wed Aug 27 11:29:02 2008
@@ -25,9 +25,9 @@
 
 BOT="`dirname "$0"`"/KGB/client/KGB_sendcommit
 URI="http://localhost:9999/"
-PROXY="$URI?service=KGB"
 
 REPO_ID="`echo "$REPOS" | sed 's/-/_/g; s#^.*\(/srv/svn.debian.org\|\)/svn/\(.\+\)$#\2#; s#/*$##'`"
-PASSWORD=""
+PASSWORD="secret"
 
-"$BOT" "$URI" "$PROXY" "$REPO_ID" "$PASSWORD" "$REPOS" "$REV"
+#"$BOT" --uri "$URI" --repo-id "$REPO_ID" --password "$PASSWORD" "$REPOS" "$REV"
+"$BOT" --conf /path/to/client.conf "$REPOS" "$REV"




More information about the Pkg-perl-cvs-commits mailing list