diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-20 16:57:28 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-25 12:49:52 +0000 |
| commit | ba91179519f2673ef803872baf2064281af37028 (patch) | |
| tree | b2dff16cfc5105901d5a55230b1938750a27c588 /bitbake | |
| parent | 4f238aa9079516dd3c390e25be1df89af028809a (diff) | |
| download | poky-ba91179519f2673ef803872baf2064281af37028.tar.gz | |
bitbake: fetch2: Fix BB_FETCH_PREMIRRORONLY network disabling
When using BB_FETCH_PREMIRRORONLY we write to the datastore to disable the network.
This change needs to be undo when handling later urls, so operate on a copy of the
datastore to allow this.
Reported by Julian Haller <julian.haller@philips.com>
(Bitbake rev: 67a5ede8ae92ed7dcad29fd0dcfd62c6640b10b2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index bd87f18be2..93fe012ec3 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -1835,25 +1835,28 @@ class Fetch(object): | |||
| 1835 | logger.debug(str(e)) | 1835 | logger.debug(str(e)) |
| 1836 | done = False | 1836 | done = False |
| 1837 | 1837 | ||
| 1838 | d = self.d | ||
| 1838 | if premirroronly: | 1839 | if premirroronly: |
| 1839 | self.d.setVar("BB_NO_NETWORK", "1") | 1840 | # Only disable the network in a copy |
| 1841 | d = bb.data.createCopy(self.d) | ||
| 1842 | d.setVar("BB_NO_NETWORK", "1") | ||
| 1840 | 1843 | ||
| 1841 | firsterr = None | 1844 | firsterr = None |
| 1842 | verified_stamp = False | 1845 | verified_stamp = False |
| 1843 | if done: | 1846 | if done: |
| 1844 | verified_stamp = m.verify_donestamp(ud, self.d) | 1847 | verified_stamp = m.verify_donestamp(ud, d) |
| 1845 | if not done and (not verified_stamp or m.need_update(ud, self.d)): | 1848 | if not done and (not verified_stamp or m.need_update(ud, d)): |
| 1846 | try: | 1849 | try: |
| 1847 | if not trusted_network(self.d, ud.url): | 1850 | if not trusted_network(d, ud.url): |
| 1848 | raise UntrustedUrl(ud.url) | 1851 | raise UntrustedUrl(ud.url) |
| 1849 | logger.debug("Trying Upstream") | 1852 | logger.debug("Trying Upstream") |
| 1850 | m.download(ud, self.d) | 1853 | m.download(ud, d) |
| 1851 | if hasattr(m, "build_mirror_data"): | 1854 | if hasattr(m, "build_mirror_data"): |
| 1852 | m.build_mirror_data(ud, self.d) | 1855 | m.build_mirror_data(ud, d) |
| 1853 | done = True | 1856 | done = True |
| 1854 | # early checksum verify, so that if checksum mismatched, | 1857 | # early checksum verify, so that if checksum mismatched, |
| 1855 | # fetcher still have chance to fetch from mirror | 1858 | # fetcher still have chance to fetch from mirror |
| 1856 | m.update_donestamp(ud, self.d) | 1859 | m.update_donestamp(ud, d) |
| 1857 | 1860 | ||
| 1858 | except bb.fetch2.NetworkAccess: | 1861 | except bb.fetch2.NetworkAccess: |
| 1859 | raise | 1862 | raise |
| @@ -1872,17 +1875,17 @@ class Fetch(object): | |||
| 1872 | firsterr = e | 1875 | firsterr = e |
| 1873 | # Remove any incomplete fetch | 1876 | # Remove any incomplete fetch |
| 1874 | if not verified_stamp and m.cleanup_upon_failure(): | 1877 | if not verified_stamp and m.cleanup_upon_failure(): |
| 1875 | m.clean(ud, self.d) | 1878 | m.clean(ud, d) |
| 1876 | logger.debug("Trying MIRRORS") | 1879 | logger.debug("Trying MIRRORS") |
| 1877 | mirrors = mirror_from_string(self.d.getVar('MIRRORS')) | 1880 | mirrors = mirror_from_string(d.getVar('MIRRORS')) |
| 1878 | done = m.try_mirrors(self, ud, self.d, mirrors) | 1881 | done = m.try_mirrors(self, ud, d, mirrors) |
| 1879 | 1882 | ||
| 1880 | if not done or not m.done(ud, self.d): | 1883 | if not done or not m.done(ud, d): |
| 1881 | if firsterr: | 1884 | if firsterr: |
| 1882 | logger.error(str(firsterr)) | 1885 | logger.error(str(firsterr)) |
| 1883 | raise FetchError("Unable to fetch URL from any source.", u) | 1886 | raise FetchError("Unable to fetch URL from any source.", u) |
| 1884 | 1887 | ||
| 1885 | m.update_donestamp(ud, self.d) | 1888 | m.update_donestamp(ud, d) |
| 1886 | 1889 | ||
| 1887 | except IOError as e: | 1890 | except IOError as e: |
| 1888 | if e.errno in [errno.ESTALE]: | 1891 | if e.errno in [errno.ESTALE]: |
