diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-11-02 20:43:22 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-11-13 12:15:23 +0000 |
commit | d7399bd56c8fc7c58af79ef91dc67382cc23eb47 (patch) | |
tree | 40b56eb43f211fbe6bd79d70bc61018e2dcb5751 /meta/classes | |
parent | a1d93ee3260d8161c7ae14674e01b516b952dea9 (diff) | |
download | poky-d7399bd56c8fc7c58af79ef91dc67382cc23eb47.tar.gz |
base.bbclass: Rework staging function to use a DESTDIR style configuration based on the data from the do_install step. This falls back to any standard do_stage function if defined, see the mailing list for more info.
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/base.bbclass | 68 | ||||
-rw-r--r-- | meta/classes/packaged-staging.bbclass | 53 |
2 files changed, 70 insertions, 51 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index b536f92e48..086a6d05d0 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -976,15 +976,22 @@ sysroot_stage_dirs() { | |||
976 | sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} | 976 | sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} |
977 | } | 977 | } |
978 | 978 | ||
979 | |||
980 | sysroot_stage_all() { | 979 | sysroot_stage_all() { |
981 | sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} | 980 | sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} |
982 | } | 981 | } |
983 | 982 | ||
984 | 983 | def is_legacy_staging(d): | |
985 | base_do_stage () { | 984 | stagefunc = bb.data.getVar('do_stage', d, True) |
986 | : | 985 | legacy = True |
987 | } | 986 | if stagefunc is None: |
987 | legacy = False | ||
988 | elif stagefunc.strip() == "autotools_stage_all": | ||
989 | legacy = False | ||
990 | elif stagefunc.strip() == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": | ||
991 | legacy = False | ||
992 | if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": | ||
993 | legacy = True | ||
994 | return legacy | ||
988 | 995 | ||
989 | do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ | 996 | do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ |
990 | ${STAGING_DIR_TARGET}/${includedir} \ | 997 | ${STAGING_DIR_TARGET}/${includedir} \ |
@@ -996,19 +1003,60 @@ do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGE | |||
996 | # Could be compile but populate_staging and do_install shouldn't run at the same time | 1003 | # Could be compile but populate_staging and do_install shouldn't run at the same time |
997 | addtask populate_staging after do_install | 1004 | addtask populate_staging after do_install |
998 | 1005 | ||
1006 | PSTAGING_ACTIVE = "0" | ||
999 | SYSROOT_PREPROCESS_FUNCS ?= "" | 1007 | SYSROOT_PREPROCESS_FUNCS ?= "" |
1000 | SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" | 1008 | SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" |
1001 | SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" | 1009 | SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" |
1002 | 1010 | ||
1011 | python populate_staging_prehook () { | ||
1012 | return | ||
1013 | } | ||
1014 | |||
1015 | python populate_staging_posthook () { | ||
1016 | return | ||
1017 | } | ||
1018 | |||
1019 | packagedstageing_fastpath () { | ||
1020 | : | ||
1021 | } | ||
1022 | |||
1003 | python do_populate_staging () { | 1023 | python do_populate_staging () { |
1004 | # | 1024 | # |
1005 | # Only run do_stage if its not the empty default above | 1025 | # if do_stage exists, we're legacy. In that case run the do_stage, |
1026 | # modify the SYSROOT_DESTDIR variable and then run the staging preprocess | ||
1027 | # functions against staging directly. | ||
1006 | # | 1028 | # |
1007 | stagefunc = bb.data.getVar('do_stage', d, 1).strip() | 1029 | # Otherwise setup a destdir, copy the results from do_install |
1008 | if stagefunc != "base_do_stage": | 1030 | # and run the staging preprocess against that |
1031 | # | ||
1032 | pstageactive = (bb.data.getVar("PSTAGING_ACTIVE", d, True) == "1") | ||
1033 | lockfile = bb.data.getVar("SYSROOT_LOCK", d, True) | ||
1034 | stagefunc = bb.data.getVar('do_stage', d, True) | ||
1035 | legacy = is_legacy_staging(d) | ||
1036 | if legacy: | ||
1037 | bb.data.setVar("SYSROOT_DESTDIR", "", d) | ||
1038 | bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) | ||
1039 | lock = bb.utils.lockfile(lockfile) | ||
1009 | bb.build.exec_func('do_stage', d) | 1040 | bb.build.exec_func('do_stage', d) |
1041 | bb.build.exec_func('populate_staging_prehook', d) | ||
1042 | for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): | ||
1043 | bb.build.exec_func(f, d) | ||
1044 | bb.build.exec_func('populate_staging_posthook', d) | ||
1045 | bb.utils.unlockfile(lock) | ||
1046 | else: | ||
1047 | dest = bb.data.getVar('D', d, True) | ||
1048 | sysrootdest = bb.data.expand('${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}', d) | ||
1049 | bb.mkdirhier(sysrootdest) | ||
1050 | |||
1051 | bb.build.exec_func("sysroot_stage_all", d) | ||
1052 | #os.system('cp -pPR %s/* %s/' % (dest, sysrootdest)) | ||
1010 | for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): | 1053 | for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): |
1011 | bb.build.exec_func(f, d) | 1054 | bb.build.exec_func(f, d) |
1055 | bb.build.exec_func("packagedstageing_fastpath", d) | ||
1056 | |||
1057 | lock = bb.utils.lockfile(lockfile) | ||
1058 | os.system('cp -pPR %s/* /' % (sysrootdest)) | ||
1059 | bb.utils.unlockfile(lock) | ||
1012 | } | 1060 | } |
1013 | 1061 | ||
1014 | addtask install after do_compile | 1062 | addtask install after do_compile |
@@ -1149,6 +1197,8 @@ def base_after_parse(d): | |||
1149 | 1197 | ||
1150 | python () { | 1198 | python () { |
1151 | base_after_parse(d) | 1199 | base_after_parse(d) |
1200 | if is_legacy_staging(d): | ||
1201 | bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) | ||
1152 | } | 1202 | } |
1153 | 1203 | ||
1154 | def check_app_exists(app, d): | 1204 | def check_app_exists(app, d): |
@@ -1175,7 +1225,7 @@ inherit patch | |||
1175 | # Move to autotools.bbclass? | 1225 | # Move to autotools.bbclass? |
1176 | inherit siteinfo | 1226 | inherit siteinfo |
1177 | 1227 | ||
1178 | EXPORT_FUNCTIONS do_setscene do_clean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall | 1228 | EXPORT_FUNCTIONS do_setscene do_clean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_rebuild do_fetchall |
1179 | 1229 | ||
1180 | MIRRORS[func] = "0" | 1230 | MIRRORS[func] = "0" |
1181 | MIRRORS () { | 1231 | MIRRORS () { |
diff --git a/meta/classes/packaged-staging.bbclass b/meta/classes/packaged-staging.bbclass index 6df13876c2..44f657a2c0 100644 --- a/meta/classes/packaged-staging.bbclass +++ b/meta/classes/packaged-staging.bbclass | |||
@@ -63,29 +63,6 @@ python () { | |||
63 | bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d) | 63 | bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d) |
64 | 64 | ||
65 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) | 65 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) |
66 | |||
67 | # | ||
68 | # Here we notice if the staging function is one of our standard staging | ||
69 | # routines. If it is, we can remvoe the need to lock staging and take | ||
70 | # timestamps which gives a nice speedup | ||
71 | # | ||
72 | fastpath = False | ||
73 | stagefunc = bb.data.getVar('do_stage', d, 1).strip() | ||
74 | if stagefunc == "autotools_stage_all": | ||
75 | fastpath = True | ||
76 | elif stagefunc == "base_do_stage": | ||
77 | fastpath = True | ||
78 | elif stagefunc == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": | ||
79 | fastpath = True | ||
80 | if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": | ||
81 | fastpath = False | ||
82 | if fastpath: | ||
83 | #bb.note("Optimised for staging: " + bb.data.getVar('FILE', d, 1)) | ||
84 | bb.data.setVar("PSTAGING_NEEDSTAMP", "0", d) | ||
85 | bb.data.setVar("STAGE_TEMP_PREFIX", "${WORKDIR}/temp-staging-pstage", d) | ||
86 | else: | ||
87 | #bb.note("Can optimise staging better: " + bb.data.getVar('FILE', d, 1)) | ||
88 | bb.data.setVar("PSTAGING_NEEDSTAMP", "1", d) | ||
89 | else: | 66 | else: |
90 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) | 67 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) |
91 | } | 68 | } |
@@ -320,30 +297,22 @@ populate_staging_postamble () { | |||
320 | fi | 297 | fi |
321 | } | 298 | } |
322 | 299 | ||
323 | autotools_staging_pstage () { | 300 | packagedstageing_fastpath () { |
324 | mkdir -p ${PSTAGE_TMPDIR_STAGE}/staging/ | 301 | if [ "$PSTAGING_ACTIVE" = "1" ]; then |
325 | cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/staging/ || /bin/true | 302 | mkdir -p ${PSTAGE_TMPDIR_STAGE}/staging/ |
326 | cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${STAGING_DIR}/ || /bin/true | 303 | mkdir -p ${PSTAGE_TMPDIR_STAGE}/cross/ |
304 | cp -fpPR ${SYSROOT_DESTDIR}/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/staging/ || /bin/true | ||
305 | cp -fpPR ${SYSROOT_DESTDIR}/${CROSS_DIR}/* ${PSTAGE_TMPDIR_STAGE}/cross/ || /bin/true | ||
306 | fi | ||
327 | } | 307 | } |
328 | 308 | ||
329 | do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}" | 309 | do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}" |
330 | python do_populate_staging_prepend() { | 310 | python populate_staging_prehook() { |
331 | needstamp = bb.data.getVar("PSTAGING_NEEDSTAMP", d, 1) | 311 | bb.build.exec_func("populate_staging_preamble", d) |
332 | pstageactive = bb.data.getVar("PSTAGING_ACTIVE", d, True) | ||
333 | lock = bb.data.expand("${SYSROOT_LOCK}", d) | ||
334 | if needstamp == "1": | ||
335 | stamplock = bb.utils.lockfile(lock) | ||
336 | bb.build.exec_func("populate_staging_preamble", d) | ||
337 | } | 312 | } |
338 | 313 | ||
339 | python do_populate_staging_append() { | 314 | python populate_staging_posthook() { |
340 | if needstamp == "1": | 315 | bb.build.exec_func("populate_staging_postamble", d) |
341 | bb.build.exec_func("populate_staging_postamble", d) | ||
342 | bb.utils.unlockfile(stamplock) | ||
343 | elif pstageactive == "1": | ||
344 | stamplock = bb.utils.lockfile(lock) | ||
345 | bb.build.exec_func("autotools_staging_pstage", d) | ||
346 | bb.utils.unlockfile(stamplock) | ||
347 | } | 316 | } |
348 | 317 | ||
349 | 318 | ||