diff options
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
| -rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index e8ddf2c761..51b616bad7 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
| @@ -516,13 +516,24 @@ class Git(FetchMethod): | |||
| 516 | def unpack(self, ud, destdir, d): | 516 | def unpack(self, ud, destdir, d): |
| 517 | """ unpack the downloaded src to destdir""" | 517 | """ unpack the downloaded src to destdir""" |
| 518 | 518 | ||
| 519 | subdir = ud.parm.get("subpath", "") | 519 | subdir = ud.parm.get("subdir") |
| 520 | if subdir != "": | 520 | subpath = ud.parm.get("subpath") |
| 521 | readpathspec = ":%s" % subdir | 521 | readpathspec = "" |
| 522 | def_destsuffix = "%s/" % os.path.basename(subdir.rstrip('/')) | 522 | def_destsuffix = "git/" |
| 523 | else: | 523 | |
| 524 | readpathspec = "" | 524 | if subpath: |
| 525 | def_destsuffix = "git/" | 525 | readpathspec = ":%s" % subpath |
| 526 | def_destsuffix = "%s/" % os.path.basename(subpath.rstrip('/')) | ||
| 527 | |||
| 528 | if subdir: | ||
| 529 | # If 'subdir' param exists, create a dir and use it as destination for unpack cmd | ||
| 530 | if os.path.isabs(subdir): | ||
| 531 | if not os.path.realpath(subdir).startswith(os.path.realpath(destdir)): | ||
| 532 | raise bb.fetch2.UnpackError("subdir argument isn't a subdirectory of unpack root %s" % destdir, ud.url) | ||
| 533 | destdir = subdir | ||
| 534 | else: | ||
| 535 | destdir = os.path.join(destdir, subdir) | ||
| 536 | def_destsuffix = "" | ||
| 526 | 537 | ||
| 527 | destsuffix = ud.parm.get("destsuffix", def_destsuffix) | 538 | destsuffix = ud.parm.get("destsuffix", def_destsuffix) |
| 528 | destdir = ud.destdir = os.path.join(destdir, destsuffix) | 539 | destdir = ud.destdir = os.path.join(destdir, destsuffix) |
| @@ -569,7 +580,7 @@ class Git(FetchMethod): | |||
| 569 | bb.note("Repository %s has LFS content but it is not being fetched" % (repourl)) | 580 | bb.note("Repository %s has LFS content but it is not being fetched" % (repourl)) |
| 570 | 581 | ||
| 571 | if not ud.nocheckout: | 582 | if not ud.nocheckout: |
| 572 | if subdir != "": | 583 | if subpath: |
| 573 | runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d, | 584 | runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d, |
| 574 | workdir=destdir) | 585 | workdir=destdir) |
| 575 | runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d, workdir=destdir) | 586 | runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d, workdir=destdir) |
