diff options
author | Mirko Vogt <mirko@openwrt.org> | 2012-04-24 12:56:18 +0000 |
---|---|---|
committer | Mirko Vogt <mirko@openwrt.org> | 2012-04-24 12:56:18 +0000 |
commit | 4ef95be3d1a6270f931fb1af8625f90c3d9d7cf2 (patch) | |
tree | 1f29b475c73a4a52a36bc5415e6933fd6b8f8f4c /scripts/feeds | |
parent | 6ed5cf8f22d977818c794d558d63f68b0e9d12ae (diff) | |
download | master-187ad058-4ef95be3d1a6270f931fb1af8625f90c3d9d7cf2.tar.gz master-187ad058-4ef95be3d1a6270f931fb1af8625f90c3d9d7cf2.tar.bz2 master-187ad058-4ef95be3d1a6270f931fb1af8625f90c3d9d7cf2.zip |
[scripts/feeds] include revisions of feeds when listing them
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31467 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts/feeds')
-rwxr-xr-x | scripts/feeds | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/scripts/feeds b/scripts/feeds index a9b2eb980a..b423d8ee1a 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -105,22 +105,27 @@ my %update_method = ( 'src-svn' => { 'init' => "svn checkout '%s' '%s'", 'update' => "svn update", - 'controldir' => ".svn"}, + 'controldir' => ".svn", + 'revision' => "svn info | grep 'Revision' | cut -d ' ' -f 2 | tr -d '\n'"}, 'src-cpy' => { 'init' => "cp -Rf '%s' '%s'", - 'update' => ""}, + 'update' => "", + 'revision' => "echo -n 'local'"}, 'src-link' => { 'init' => "ln -s '%s' '%s'", - 'update' => ""}, + 'update' => "", + 'revision' => "echo -n 'local'"}, 'src-git' => { - 'init' => "git clone --depth 1 '%s' '%s'", - 'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'", + 'init' => "git clone '%s' '%s'", + 'init_branch' => "git clone --branch '%s' '%s' '%s'", 'update' => "git pull", - 'controldir' => ".git"}, + 'controldir' => ".git", + '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'", - 'update' => "git svn rebase", - 'controldir' => ".git"}, + 'init' => "git svn clone -r HEAD '%s' '%s'", + 'update' => "git svn rebase", + 'controldir' => ".git", + 'revision' => "git show --abbrev-commit HEAD | head -n 1 | cut -d ' ' -f 2 | tr -d '\n'"}, 'src-bzr' => { 'init' => "bzr checkout --lightweight '%s' '%s'", 'update' => "bzr update", @@ -249,14 +254,31 @@ sub list_feed { sub list { my %opts; - getopts('r:sh', \%opts); + getopts('r:d:sh', \%opts); if ($opts{h}) { usage(); return 0; } if ($opts{s}) { foreach my $feed (@feeds) { - printf "\%-32s\tURL: %s\n", $feed->[1], join(", ", @{$feed->[2]}); + my $localpath = "./feeds/$feed->[1]"; + my $m = $update_method{$feed->[0]}; + my $revision; + if( !$m->{'revision'} ) { + $revision = "X"; + } + elsif( $m->{'controldir'} && -d "$localpath/$m->{'controldir'}" ) { + $revision = `cd '$localpath'; $m->{'revision'}`; + } + else { + $revision = "local"; + } + if ($opts{d}) { + printf "%s%s%s%s%s%s%s\n", $feed->[1], $opts{d}, $feed->[0], $opts{d}, $revision, $opts{d}, join(", ", @{$feed->[2]}); + } + else { + printf "\%-8s \%-8s \%-8s \%s\n", $feed->[1], $feed->[0], $revision, join(", ", @{$feed->[2]}); + } } return 0; } @@ -564,10 +586,11 @@ sub usage() { Usage: $0 <command> [options] Commands: - list [options]: List feeds and their content + list [options]: List feeds, their content and revisions (if installed) Options: - -s : List of feed names and their URL. - -r <feedname>: List packages of specified feed. + -s : List of feed names and their URL. + -r <feedname>: List packages of specified feed. + -d <delimiter>: Use specified delimiter to distinguish rows (default: spaces) install [options] <package>: Install a package Options: |