Changeset 38172


Ignore:
Timestamp:
2013-09-25T15:02:55+02:00 (4 years ago)
Author:
luka
Message:

feeds: enable cloning of specific git commit

Following syntax should be used to enable this feature:

src-git custom git://openwrt/custom-feed^SHA_COMMIT_ID

Signed-off-by: Luka Perkov <luka@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/feeds

    r37884 r38172  
    120120                'init'          => "git clone --depth 1 '%s' '%s'", 
    121121                'init_branch'   => "git clone --depth 1 --branch '%s' '%s' '%s'", 
     122                'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", 
    122123                'update'        => "git pull --ff", 
    123124                'controldir'    => ".git", 
     
    155156        my $safepath = $localpath; 
    156157        $safepath =~ s/'/'\\''/; 
    157         my ($base, $branch) = split(/;/, $src, 2); 
     158        my ($base_branch, $branch) = split(/;/, $src, 2); 
     159        my ($base_commit, $commit) = split(/\^/, $src, 2); 
    158160 
    159161        if( $relocate || !$m->{'update'} || !-d "$localpath/$m->{'controldir'}" ) { 
    160162                system("rm -rf '$safepath'"); 
    161163                if ($m->{'init_branch'} and $branch) { 
    162                         system(sprintf($m->{'init_branch'}, $branch, $base, $safepath)) == 0 or return 1; 
     164                        system(sprintf($m->{'init_branch'}, $branch, $base_branch, $safepath)) == 0 or return 1; 
     165                } elsif ($m->{'init_commit'} and $commit) { 
     166                        system(sprintf($m->{'init_commit'}, $base_commit, $safepath, $safepath, $commit, $commit)) == 0 or return 1; 
    163167                } else { 
    164168                        system(sprintf($m->{'init'}, $src, $safepath)) == 0 or return 1; 
    165169                } 
     170        } elsif ($m->{'init_commit'} and $commit) { 
     171                # in case git hash has been provided don't update the feed 
    166172        } else { 
    167173                system("cd '$safepath'; $m->{'update'}") == 0 or return 1; 
Note: See TracChangeset for help on using the changeset viewer.