[Notes] [Git][BuildStream/buildstream][bst-1.2] 2 commits: plugins/sources/git.py: Avoid downloading unused submodules



Title: GitLab

Tristan Van Berkom pushed to branch bst-1.2 at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/plugins/sources/git.py
    ... ... @@ -421,13 +421,7 @@ class GitSource(Source):
    421 421
             with self.timed_activity("Staging {}".format(self.mirror.url), silent_nested=True):
    
    422 422
                 self.mirror.stage(directory)
    
    423 423
                 for mirror in self.submodules:
    
    424
    -                if mirror.path in self.submodule_checkout_overrides:
    
    425
    -                    checkout = self.submodule_checkout_overrides[mirror.path]
    
    426
    -                else:
    
    427
    -                    checkout = self.checkout_submodules
    
    428
    -
    
    429
    -                if checkout:
    
    430
    -                    mirror.stage(directory)
    
    424
    +                mirror.stage(directory)
    
    431 425
     
    
    432 426
         def get_source_fetchers(self):
    
    433 427
             yield self.mirror
    
    ... ... @@ -465,6 +459,10 @@ class GitSource(Source):
    465 459
             #
    
    466 460
             for path, url in self.mirror.submodule_list():
    
    467 461
     
    
    462
    +            # Completely ignore submodules which are disabled for checkout
    
    463
    +            if self.ignore_submodule(path):
    
    464
    +                continue
    
    465
    +
    
    468 466
                 # Allow configuration to override the upstream
    
    469 467
                 # location of the submodules.
    
    470 468
                 override_url = self.submodule_overrides.get(path)
    
    ... ... @@ -478,6 +476,16 @@ class GitSource(Source):
    478 476
     
    
    479 477
             self.submodules = submodules
    
    480 478
     
    
    479
    +    # Checks whether the plugin configuration has explicitly
    
    480
    +    # configured this submodule to be ignored
    
    481
    +    def ignore_submodule(self, path):
    
    482
    +        try:
    
    483
    +            checkout = self.submodule_checkout_overrides[path]
    
    484
    +        except KeyError:
    
    485
    +            checkout = self.checkout_submodules
    
    486
    +
    
    487
    +        return not checkout
    
    488
    +
    
    481 489
     
    
    482 490
     # Plugin entry point
    
    483 491
     def setup():
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]