[OpenWrt-Devel] [PATCH] scripts: allow pinning of SVN feeds

Nate Hardison natehardison at gmail.com
Wed Aug 20 21:34:28 EDT 2014


Previously, Git feeds could be pinned to a particular commit using
URL^commit notation. This patch provides the same functionality for
SVN-based feeds, using URL at revision notation. Just like pinned Git
feeds, pinned SVN feeds do not update when ./scripts/feeds update is
run.

Signed-off-by: Nate Hardison <natehardison at gmail.com>
---
 scripts/feeds | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/feeds b/scripts/feeds
index 26c2de0..1589bff 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -105,7 +105,8 @@ sub update_index($)
 
 my %update_method = (
 	'src-svn' => {
-		'init'		=> "svn checkout '%s' '%s'",
+		'init'	    	=> "svn checkout '%s' '%s'",
+		'init_revision'	=> "svn checkout -r '%s' '%s' '%s'",
 		'update'	=> "svn update",
 		'controldir'	=> ".svn",
 		'revision'	=> "svn info | grep 'Revision' | cut -d ' ' -f 2 | tr -d '\n'"},
@@ -126,6 +127,7 @@ my %update_method = (
 		'revision'	=> "git show --abbrev-commit HEAD | head -n 1 | cut -d ' ' -f 2 | tr -d '\n'"},
 	'src-gitsvn' => {
 		'init'	=> "git svn clone -r HEAD '%s' '%s'",
+		'init_revision'	=> "git svn clone -r '%s' '%s' '%s'",
 		'update'	=> "git svn rebase",
 		'controldir'	=> ".git",
 		'revision'	=> "git show --abbrev-commit HEAD | head -n 1 | cut -d ' ' -f 2 | tr -d '\n'"},
@@ -158,6 +160,7 @@ sub update_feed_via($$$$) {
 	$safepath =~ s/'/'\\''/;
 	my ($base_branch, $branch) = split(/;/, $src, 2);
 	my ($base_commit, $commit) = split(/\^/, $src, 2);
+	my ($base_revision, $revision) = split(/@/, $src, 2);
 
 	if( $relocate || !$m->{'update'} || !-d "$localpath/$m->{'controldir'}" ) {
 		system("rm -rf '$safepath'");
@@ -165,11 +168,15 @@ sub update_feed_via($$$$) {
 			system(sprintf($m->{'init_branch'}, $branch, $base_branch, $safepath)) == 0 or return 1;
 		} elsif ($m->{'init_commit'} and $commit) {
 			system(sprintf($m->{'init_commit'}, $base_commit, $safepath, $safepath, $commit, $commit)) == 0 or return 1;
+		} elsif ($m->{'init_revision'} and $revision) {
+			system(sprintf($m->{'init_revision'}, $revision, $base_revision, $safepath)) == 0 or return 1;
 		} else {
 			system(sprintf($m->{'init'}, $src, $safepath)) == 0 or return 1;
 		}
 	} elsif ($m->{'init_commit'} and $commit) {
 		# in case git hash has been provided don't update the feed
+	} elsif ($m->{'init_revision'} and $revision) {
+		# in case svn revision has been provided don't update the feed
 	} else {
 		system("cd '$safepath'; $m->{'update'}") == 0 or return 1;
 	}
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list