diff options
author | Stefan Koch <stefan-koch@siemens.com> | 2025-05-27 11:59:02 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-28 12:37:02 +0100 |
commit | f5ae37fbd86c1328ebd81166573fbad3028abe5b (patch) | |
tree | c2873ba66480ac650f454d0e5e4056bb77b202d2 /bitbake | |
parent | 0e9ce41a1cc0e1158f84d5c5c08cf23b5c161155 (diff) | |
download | poky-f5ae37fbd86c1328ebd81166573fbad3028abe5b.tar.gz |
bitbake: fetch2: Ensure a valid symlink in `PREMIRRORS` case when using shallow cloning
- Since `ud.path` contains in that case the `PREMIRRORS` prefix path,
this change ensures that a correct symlink is set up.
(Bitbake rev: 37ed18e45aa17406162efc5ee3ddb2d6b33d07b9)
Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 7 |
2 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 8504678dff..0ad987c596 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -1117,7 +1117,10 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): | |||
1117 | origud.method.build_mirror_data(origud, ld) | 1117 | origud.method.build_mirror_data(origud, ld) |
1118 | return origud.localpath | 1118 | return origud.localpath |
1119 | # Otherwise the result is a local file:// and we symlink to it | 1119 | # Otherwise the result is a local file:// and we symlink to it |
1120 | ensure_symlink(ud.localpath, origud.localpath) | 1120 | # This may also be a link to a shallow archive |
1121 | # When using shallow mode, add a symlink to the original fullshallow | ||
1122 | # path to ensure a valid symlink even in the `PREMIRRORS` case | ||
1123 | origud.method.update_mirror_links(ud, origud) | ||
1121 | update_stamp(origud, ld) | 1124 | update_stamp(origud, ld) |
1122 | return ud.localpath | 1125 | return ud.localpath |
1123 | 1126 | ||
@@ -1653,6 +1656,11 @@ class FetchMethod(object): | |||
1653 | except FileExistsError: | 1656 | except FileExistsError: |
1654 | pass | 1657 | pass |
1655 | 1658 | ||
1659 | def update_mirror_links(self, ud, origud): | ||
1660 | # For local file:// results, create a symlink to them | ||
1661 | # This may also be a link to a shallow archive | ||
1662 | self.ensure_symlink(ud.localpath, origud.localpath) | ||
1663 | |||
1656 | def try_premirror(self, urldata, d): | 1664 | def try_premirror(self, urldata, d): |
1657 | """ | 1665 | """ |
1658 | Should premirrors be used? | 1666 | Should premirrors be used? |
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 784a45bda2..55dd084abc 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -348,6 +348,13 @@ class Git(FetchMethod): | |||
348 | def tarball_need_update(self, ud): | 348 | def tarball_need_update(self, ud): |
349 | return ud.write_tarballs and not os.path.exists(ud.fullmirror) | 349 | return ud.write_tarballs and not os.path.exists(ud.fullmirror) |
350 | 350 | ||
351 | def update_mirror_links(self, ud, origud): | ||
352 | super().update_mirror_links(ud, origud) | ||
353 | # When using shallow mode, add a symlink to the original fullshallow | ||
354 | # path to ensure a valid symlink even in the `PREMIRRORS` case | ||
355 | if ud.shallow and not os.path.exists(origud.fullshallow): | ||
356 | self.ensure_symlink(ud.localpath, origud.fullshallow) | ||
357 | |||
351 | def try_premirror(self, ud, d): | 358 | def try_premirror(self, ud, d): |
352 | # If we don't do this, updating an existing checkout with only premirrors | 359 | # If we don't do this, updating an existing checkout with only premirrors |
353 | # is not possible | 360 | # is not possible |