summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 13:54:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-24 11:52:27 +0100
commit2245a94bb87ec1e13c542f2074d4b9e531ffeaf1 (patch)
tree8485ba0b021aa380b21693a53340ff85b1e414f0 /meta/classes/package.bbclass
parent6d66b574090dbfa17f840e45c9920895c4e2784a (diff)
downloadpoky-2245a94bb87ec1e13c542f2074d4b9e531ffeaf1.tar.gz
package: Rework PACKAGELOCK based upon sstate for do_packagedata
I think this lock dates from before we had sstate for do_packagedata. Since WORKDIR is recipe specific and we write into WORKDIR, we no longer need any write locks in the do_packagedata code itself, its handled by the sstate task lock for the final copy in at the end. The final write lock can be simply removed. The only time we need read locking is when actually reading data from the shared directory. We can therefore reduce the window the lock is held significantly as well, hence improving the speed of packagedata tasks running in parallel. (From OE-Core rev: f7106cdf2190d9ec59132a1cb2bb431d653cd9c5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass23
1 files changed, 9 insertions, 14 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 07bc37879c..6f7015d912 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1411,9 +1411,6 @@ fi
1411 pkgdest = d.getVar('PKGDEST') 1411 pkgdest = d.getVar('PKGDEST')
1412 pkgdatadir = d.getVar('PKGDESTWORK') 1412 pkgdatadir = d.getVar('PKGDESTWORK')
1413 1413
1414 # Take shared lock since we're only reading, not writing
1415 lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
1416
1417 data_file = pkgdatadir + d.expand("/${PN}" ) 1414 data_file = pkgdatadir + d.expand("/${PN}" )
1418 f = open(data_file, 'w') 1415 f = open(data_file, 'w')
1419 f.write("PACKAGES: %s\n" % packages) 1416 f.write("PACKAGES: %s\n" % packages)
@@ -1518,7 +1515,6 @@ fi
1518 if bb.data.inherits_class('allarch', d) and not bb.data.inherits_class('packagegroup', d): 1515 if bb.data.inherits_class('allarch', d) and not bb.data.inherits_class('packagegroup', d):
1519 write_extra_runtime_pkgs(global_variants, packages, pkgdatadir) 1516 write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
1520 1517
1521 bb.utils.unlockfile(lf)
1522} 1518}
1523emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides" 1519emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides"
1524 1520
@@ -1629,9 +1625,6 @@ python package_do_shlibs() {
1629 1625
1630 shlibswork_dir = d.getVar('SHLIBSWORKDIR') 1626 shlibswork_dir = d.getVar('SHLIBSWORKDIR')
1631 1627
1632 # Take shared lock since we're only reading, not writing
1633 lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
1634
1635 def linux_so(file, needed, sonames, renames, pkgver): 1628 def linux_so(file, needed, sonames, renames, pkgver):
1636 needs_ldconfig = False 1629 needs_ldconfig = False
1637 ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') 1630 ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
@@ -1744,7 +1737,11 @@ python package_do_shlibs() {
1744 use_ldconfig = bb.utils.contains('DISTRO_FEATURES', 'ldconfig', True, False, d) 1737 use_ldconfig = bb.utils.contains('DISTRO_FEATURES', 'ldconfig', True, False, d)
1745 1738
1746 needed = {} 1739 needed = {}
1740
1741 # Take shared lock since we're only reading, not writing
1742 lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
1747 shlib_provider = oe.package.read_shlib_providers(d) 1743 shlib_provider = oe.package.read_shlib_providers(d)
1744 bb.utils.unlockfile(lf)
1748 1745
1749 for pkg in shlib_pkgs: 1746 for pkg in shlib_pkgs:
1750 private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or "" 1747 private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or ""
@@ -1800,8 +1797,6 @@ python package_do_shlibs() {
1800 d.setVar('pkg_postinst_%s' % pkg, postinst) 1797 d.setVar('pkg_postinst_%s' % pkg, postinst)
1801 bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames)) 1798 bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
1802 1799
1803 bb.utils.unlockfile(lf)
1804
1805 assumed_libs = d.getVar('ASSUME_SHLIBS') 1800 assumed_libs = d.getVar('ASSUME_SHLIBS')
1806 if assumed_libs: 1801 if assumed_libs:
1807 libdir = d.getVar("libdir") 1802 libdir = d.getVar("libdir")
@@ -1914,9 +1909,6 @@ python package_do_pkgconfig () {
1914 if hdr == 'Requires': 1909 if hdr == 'Requires':
1915 pkgconfig_needed[pkg] += exp.replace(',', ' ').split() 1910 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
1916 1911
1917 # Take shared lock since we're only reading, not writing
1918 lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
1919
1920 for pkg in packages.split(): 1912 for pkg in packages.split():
1921 pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist") 1913 pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
1922 if pkgconfig_provided[pkg] != []: 1914 if pkgconfig_provided[pkg] != []:
@@ -1925,6 +1917,9 @@ python package_do_pkgconfig () {
1925 f.write('%s\n' % p) 1917 f.write('%s\n' % p)
1926 f.close() 1918 f.close()
1927 1919
1920 # Take shared lock since we're only reading, not writing
1921 lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
1922
1928 # Go from least to most specific since the last one found wins 1923 # Go from least to most specific since the last one found wins
1929 for dir in reversed(shlibs_dirs): 1924 for dir in reversed(shlibs_dirs):
1930 if not os.path.exists(dir): 1925 if not os.path.exists(dir):
@@ -1940,6 +1935,8 @@ python package_do_pkgconfig () {
1940 for l in lines: 1935 for l in lines:
1941 pkgconfig_provided[pkg].append(l.rstrip()) 1936 pkgconfig_provided[pkg].append(l.rstrip())
1942 1937
1938 bb.utils.unlockfile(lf)
1939
1943 for pkg in packages.split(): 1940 for pkg in packages.split():
1944 deps = [] 1941 deps = []
1945 for n in pkgconfig_needed[pkg]: 1942 for n in pkgconfig_needed[pkg]:
@@ -1957,8 +1954,6 @@ python package_do_pkgconfig () {
1957 for dep in deps: 1954 for dep in deps:
1958 fd.write(dep + '\n') 1955 fd.write(dep + '\n')
1959 fd.close() 1956 fd.close()
1960
1961 bb.utils.unlockfile(lf)
1962} 1957}
1963 1958
1964def read_libdep_files(d): 1959def read_libdep_files(d):