scripts/feeds: add support for git feeds with submodules

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2018-04-25 11:31:48 +02:00
parent 67aec988c4
commit 41ab276fe4

View File

@ -133,6 +133,7 @@ my %update_method = (
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff", 'update' => "git pull --ff",
'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git", 'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, 'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-git-full' => { 'src-git-full' => {
@ -141,6 +142,7 @@ my %update_method = (
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff", 'update' => "git pull --ff",
'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git", 'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, 'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-gitsvn' => { 'src-gitsvn' => {
@ -197,6 +199,10 @@ sub update_feed_via($$$$$) {
} }
system("cd '$safepath'; $update_cmd") == 0 or return 1; system("cd '$safepath'; $update_cmd") == 0 or return 1;
} }
if ($m->{'post_update'}) {
my $cmd = $m->{'post_update'};
system("cd '$safepath'; $cmd") == 0 or return 1;
}
return 0; return 0;
} }