diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-11 16:37:27 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-17 08:52:28 +0000 |
commit | 1a45c29ff13f6e78b9428336f813d0c3e0fd980a (patch) | |
tree | a723108d4783559eb983e94854fc4a0fbd042a94 | |
parent | 878de40a501089048cffdc867b2ae1ad8a2ec9e5 (diff) | |
download | poky-1a45c29ff13f6e78b9428336f813d0c3e0fd980a.tar.gz |
bitbake: build/siggen: Rework stamps functions
The current method of passing either a task's datastore, or
dataCaches and a filename into the stamp functions is rather
horrible.
Due to the different contexts, fixing this is hard but we do control
the bitbake side of the API usage so we can migrate those to use other
functions and then only support a datastore in the public bb.build API
which is only called from task context in OE-Core.
(Bitbake rev: c79ecec580e4c2a141ae483ec0f6448f70593dcf)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/build.py | 149 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 25 | ||||
-rw-r--r-- | bitbake/lib/bb/siggen.py | 57 |
4 files changed, 109 insertions, 124 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 5ac191647c..5a1727116a 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -772,44 +772,7 @@ def exec_task(fn, task, d, profile = False): | |||
772 | event.fire(failedevent, d) | 772 | event.fire(failedevent, d) |
773 | return 1 | 773 | return 1 |
774 | 774 | ||
775 | def stamp_internal(taskname, d, file_name, baseonly=False, noextra=False): | 775 | def _get_cleanmask(taskname, mcfn): |
776 | """ | ||
777 | Internal stamp helper function | ||
778 | Makes sure the stamp directory exists | ||
779 | Returns the stamp path+filename | ||
780 | |||
781 | In the bitbake core, d can be a CacheData and file_name will be set. | ||
782 | When called in task context, d will be a data store, file_name will not be set | ||
783 | """ | ||
784 | taskflagname = taskname | ||
785 | if taskname.endswith("_setscene"): | ||
786 | taskflagname = taskname.replace("_setscene", "") | ||
787 | |||
788 | if file_name: | ||
789 | stamp = d.stamp[file_name] | ||
790 | extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" | ||
791 | else: | ||
792 | stamp = d.getVar('STAMP') | ||
793 | file_name = d.getVar('BB_FILENAME') | ||
794 | extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info') or "" | ||
795 | |||
796 | if baseonly: | ||
797 | return stamp | ||
798 | if noextra: | ||
799 | extrainfo = "" | ||
800 | |||
801 | if not stamp: | ||
802 | return | ||
803 | |||
804 | stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo) | ||
805 | |||
806 | stampdir = os.path.dirname(stamp) | ||
807 | if cached_mtime_noerror(stampdir) == 0: | ||
808 | bb.utils.mkdirhier(stampdir) | ||
809 | |||
810 | return stamp | ||
811 | |||
812 | def stamp_cleanmask_internal(taskname, d, file_name): | ||
813 | """ | 776 | """ |
814 | Internal stamp helper function to generate stamp cleaning mask | 777 | Internal stamp helper function to generate stamp cleaning mask |
815 | Returns the stamp path+filename | 778 | Returns the stamp path+filename |
@@ -817,27 +780,14 @@ def stamp_cleanmask_internal(taskname, d, file_name): | |||
817 | In the bitbake core, d can be a CacheData and file_name will be set. | 780 | In the bitbake core, d can be a CacheData and file_name will be set. |
818 | When called in task context, d will be a data store, file_name will not be set | 781 | When called in task context, d will be a data store, file_name will not be set |
819 | """ | 782 | """ |
820 | taskflagname = taskname | 783 | cleanmask = bb.parse.siggen.stampcleanmask_mcfn(taskname, mcfn) |
821 | if taskname.endswith("_setscene"): | 784 | taskflagname = taskname.replace("_setscene", "") |
822 | taskflagname = taskname.replace("_setscene", "") | 785 | if cleanmask: |
823 | 786 | return [cleanmask, cleanmask.replace(taskflagname, taskflagname + "_setscene")] | |
824 | if file_name: | 787 | return [] |
825 | stamp = d.stampclean[file_name] | 788 | |
826 | extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" | 789 | def clean_stamp_mcfn(task, mcfn): |
827 | else: | 790 | cleanmask = _get_cleanmask(task, mcfn) |
828 | stamp = d.getVar('STAMPCLEAN') | ||
829 | file_name = d.getVar('BB_FILENAME') | ||
830 | extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info') or "" | ||
831 | |||
832 | if not stamp: | ||
833 | return [] | ||
834 | |||
835 | cleanmask = bb.parse.siggen.stampcleanmask(stamp, file_name, taskname, extrainfo) | ||
836 | |||
837 | return [cleanmask, cleanmask.replace(taskflagname, taskflagname + "_setscene")] | ||
838 | |||
839 | def clean_stamp(task, d, file_name = None): | ||
840 | cleanmask = stamp_cleanmask_internal(task, d, file_name) | ||
841 | for mask in cleanmask: | 791 | for mask in cleanmask: |
842 | for name in glob.glob(mask): | 792 | for name in glob.glob(mask): |
843 | # Preserve sigdata files in the stamps directory | 793 | # Preserve sigdata files in the stamps directory |
@@ -847,33 +797,46 @@ def clean_stamp(task, d, file_name = None): | |||
847 | if name.endswith('.taint'): | 797 | if name.endswith('.taint'): |
848 | continue | 798 | continue |
849 | os.unlink(name) | 799 | os.unlink(name) |
850 | return | ||
851 | 800 | ||
852 | def make_stamp(task, d, file_name = None): | 801 | def clean_stamp(task, d): |
802 | mcfn = d.getVar('BB_FILENAME') | ||
803 | clean_stamp_mcfn(task, mcfn) | ||
804 | |||
805 | def make_stamp_mcfn(task, mcfn): | ||
806 | |||
807 | basestamp = bb.parse.siggen.stampfile_mcfn(task, mcfn) | ||
808 | |||
809 | stampdir = os.path.dirname(basestamp) | ||
810 | if cached_mtime_noerror(stampdir) == 0: | ||
811 | bb.utils.mkdirhier(stampdir) | ||
812 | |||
813 | clean_stamp_mcfn(task, mcfn) | ||
814 | |||
815 | # Remove the file and recreate to force timestamp | ||
816 | # change on broken NFS filesystems | ||
817 | if basestamp: | ||
818 | bb.utils.remove(basestamp) | ||
819 | open(basestamp, "w").close() | ||
820 | |||
821 | def make_stamp(task, d): | ||
853 | """ | 822 | """ |
854 | Creates/updates a stamp for a given task | 823 | Creates/updates a stamp for a given task |
855 | (d can be a data dict or dataCache) | ||
856 | """ | 824 | """ |
857 | clean_stamp(task, d, file_name) | 825 | mcfn = d.getVar('BB_FILENAME') |
858 | 826 | ||
859 | stamp = stamp_internal(task, d, file_name) | 827 | make_stamp_mcfn(task, mcfn) |
860 | # Remove the file and recreate to force timestamp | ||
861 | # change on broken NFS filesystems | ||
862 | if stamp: | ||
863 | bb.utils.remove(stamp) | ||
864 | open(stamp, "w").close() | ||
865 | 828 | ||
866 | # If we're in task context, write out a signature file for each task | 829 | # If we're in task context, write out a signature file for each task |
867 | # as it completes | 830 | # as it completes |
868 | if not task.endswith("_setscene") and not file_name: | 831 | if not task.endswith("_setscene"): |
869 | stampbase = stamp_internal(task, d, None, True) | 832 | stampbase = bb.parse.siggen.stampfile_base(mcfn) |
870 | file_name = d.getVar('BB_FILENAME') | 833 | bb.parse.siggen.dump_sigtask(mcfn, task, stampbase, True) |
871 | bb.parse.siggen.dump_sigtask(file_name, task, stampbase, True) | 834 | |
872 | 835 | ||
873 | def find_stale_stamps(task, d, file_name=None): | 836 | def find_stale_stamps(task, mcfn): |
874 | current = stamp_internal(task, d, file_name) | 837 | current = bb.parse.siggen.stampfile_mcfn(task, mcfn) |
875 | current2 = stamp_internal(task + "_setscene", d, file_name) | 838 | current2 = bb.parse.siggen.stampfile_mcfn(task + "_setscene", mcfn) |
876 | cleanmask = stamp_cleanmask_internal(task, d, file_name) | 839 | cleanmask = _get_cleanmask(task, mcfn) |
877 | found = [] | 840 | found = [] |
878 | for mask in cleanmask: | 841 | for mask in cleanmask: |
879 | for name in glob.glob(mask): | 842 | for name in glob.glob(mask): |
@@ -887,38 +850,14 @@ def find_stale_stamps(task, d, file_name=None): | |||
887 | found.append(name) | 850 | found.append(name) |
888 | return found | 851 | return found |
889 | 852 | ||
890 | def del_stamp(task, d, file_name = None): | 853 | def write_taint(task, d): |
891 | """ | ||
892 | Removes a stamp for a given task | ||
893 | (d can be a data dict or dataCache) | ||
894 | """ | ||
895 | stamp = stamp_internal(task, d, file_name) | ||
896 | bb.utils.remove(stamp) | ||
897 | |||
898 | def write_taint(task, d, file_name = None): | ||
899 | """ | 854 | """ |
900 | Creates a "taint" file which will force the specified task and its | 855 | Creates a "taint" file which will force the specified task and its |
901 | dependents to be re-run the next time by influencing the value of its | 856 | dependents to be re-run the next time by influencing the value of its |
902 | taskhash. | 857 | taskhash. |
903 | (d can be a data dict or dataCache) | ||
904 | """ | ||
905 | import uuid | ||
906 | if file_name: | ||
907 | taintfn = d.stamp[file_name] + '.' + task + '.taint' | ||
908 | else: | ||
909 | taintfn = d.getVar('STAMP') + '.' + task + '.taint' | ||
910 | bb.utils.mkdirhier(os.path.dirname(taintfn)) | ||
911 | # The specific content of the taint file is not really important, | ||
912 | # we just need it to be random, so a random UUID is used | ||
913 | with open(taintfn, 'w') as taintf: | ||
914 | taintf.write(str(uuid.uuid4())) | ||
915 | |||
916 | def stampfile(taskname, d, file_name = None, noextra=False): | ||
917 | """ | ||
918 | Return the stamp for a given task | ||
919 | (d can be a data dict or dataCache) | ||
920 | """ | 858 | """ |
921 | return stamp_internal(taskname, d, file_name, noextra=noextra) | 859 | mcfn = d.getVar('BB_FILENAME') |
860 | bb.parse.siggen.invalidate_task(task, mcfn) | ||
922 | 861 | ||
923 | def add_tasks(tasklist, d): | 862 | def add_tasks(tasklist, d): |
924 | task_deps = d.getVar('_task_deps', False) | 863 | task_deps = d.getVar('_task_deps', False) |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index ac7ac20c04..d96afcc669 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1453,7 +1453,7 @@ class BBCooker: | |||
1453 | # Invalidate task for target if force mode active | 1453 | # Invalidate task for target if force mode active |
1454 | if self.configuration.force: | 1454 | if self.configuration.force: |
1455 | logger.verbose("Invalidate task %s, %s", task, fn) | 1455 | logger.verbose("Invalidate task %s, %s", task, fn) |
1456 | bb.parse.siggen.invalidate_task(task, self.recipecaches[mc], fn) | 1456 | bb.parse.siggen.invalidate_task(task, fn) |
1457 | 1457 | ||
1458 | # Setup taskdata structure | 1458 | # Setup taskdata structure |
1459 | taskdata = {} | 1459 | taskdata = {} |
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 61cb9f4c95..b9dd830b31 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -155,7 +155,7 @@ class RunQueueScheduler(object): | |||
155 | self.stamps = {} | 155 | self.stamps = {} |
156 | for tid in self.rqdata.runtaskentries: | 156 | for tid in self.rqdata.runtaskentries: |
157 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) | 157 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) |
158 | self.stamps[tid] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) | 158 | self.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) |
159 | if tid in self.rq.runq_buildable: | 159 | if tid in self.rq.runq_buildable: |
160 | self.buildable.append(tid) | 160 | self.buildable.append(tid) |
161 | 161 | ||
@@ -937,7 +937,7 @@ class RunQueueData: | |||
937 | bb.debug(1, "Task %s is marked nostamp, cannot invalidate this task" % taskname) | 937 | bb.debug(1, "Task %s is marked nostamp, cannot invalidate this task" % taskname) |
938 | else: | 938 | else: |
939 | logger.verbose("Invalidate task %s, %s", taskname, fn) | 939 | logger.verbose("Invalidate task %s, %s", taskname, fn) |
940 | bb.parse.siggen.invalidate_task(taskname, self.dataCaches[mc], taskfn) | 940 | bb.parse.siggen.invalidate_task(taskname, taskfn) |
941 | 941 | ||
942 | self.target_tids = [] | 942 | self.target_tids = [] |
943 | for (mc, target, task, fn) in self.targets: | 943 | for (mc, target, task, fn) in self.targets: |
@@ -1398,7 +1398,7 @@ class RunQueue: | |||
1398 | if taskname is None: | 1398 | if taskname is None: |
1399 | taskname = tn | 1399 | taskname = tn |
1400 | 1400 | ||
1401 | stampfile = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn) | 1401 | stampfile = bb.parse.siggen.stampfile_mcfn(taskname, taskfn) |
1402 | 1402 | ||
1403 | # If the stamp is missing, it's not current | 1403 | # If the stamp is missing, it's not current |
1404 | if not os.access(stampfile, os.F_OK): | 1404 | if not os.access(stampfile, os.F_OK): |
@@ -1421,8 +1421,8 @@ class RunQueue: | |||
1421 | for dep in self.rqdata.runtaskentries[tid].depends: | 1421 | for dep in self.rqdata.runtaskentries[tid].depends: |
1422 | if iscurrent: | 1422 | if iscurrent: |
1423 | (mc2, fn2, taskname2, taskfn2) = split_tid_mcfn(dep) | 1423 | (mc2, fn2, taskname2, taskfn2) = split_tid_mcfn(dep) |
1424 | stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCaches[mc2], taskfn2) | 1424 | stampfile2 = bb.parse.siggen.stampfile_mcfn(taskname2, taskfn2) |
1425 | stampfile3 = bb.build.stampfile(taskname2 + "_setscene", self.rqdata.dataCaches[mc2], taskfn2) | 1425 | stampfile3 = bb.parse.siggen.stampfile_mcfn(taskname2 + "_setscene", taskfn2) |
1426 | t2 = get_timestamp(stampfile2) | 1426 | t2 = get_timestamp(stampfile2) |
1427 | t3 = get_timestamp(stampfile3) | 1427 | t3 = get_timestamp(stampfile3) |
1428 | if t3 and not t2: | 1428 | if t3 and not t2: |
@@ -2164,7 +2164,7 @@ class RunQueueExecute: | |||
2164 | self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps(runtask) + b"</runtask>") | 2164 | self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps(runtask) + b"</runtask>") |
2165 | self.rq.worker[mc].process.stdin.flush() | 2165 | self.rq.worker[mc].process.stdin.flush() |
2166 | 2166 | ||
2167 | self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) | 2167 | self.build_stamps[task] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) |
2168 | self.build_stamps2.append(self.build_stamps[task]) | 2168 | self.build_stamps2.append(self.build_stamps[task]) |
2169 | self.sq_running.add(task) | 2169 | self.sq_running.add(task) |
2170 | self.sq_live.add(task) | 2170 | self.sq_live.add(task) |
@@ -2224,7 +2224,7 @@ class RunQueueExecute: | |||
2224 | self.runq_running.add(task) | 2224 | self.runq_running.add(task) |
2225 | self.stats.taskActive() | 2225 | self.stats.taskActive() |
2226 | if not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce): | 2226 | if not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce): |
2227 | bb.build.make_stamp(taskname, self.rqdata.dataCaches[mc], taskfn) | 2227 | bb.build.make_stamp_mcfn(taskname, taskfn) |
2228 | self.task_complete(task) | 2228 | self.task_complete(task) |
2229 | return True | 2229 | return True |
2230 | else: | 2230 | else: |
@@ -2263,7 +2263,7 @@ class RunQueueExecute: | |||
2263 | self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps(runtask) + b"</runtask>") | 2263 | self.rq.worker[mc].process.stdin.write(b"<runtask>" + pickle.dumps(runtask) + b"</runtask>") |
2264 | self.rq.worker[mc].process.stdin.flush() | 2264 | self.rq.worker[mc].process.stdin.flush() |
2265 | 2265 | ||
2266 | self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) | 2266 | self.build_stamps[task] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) |
2267 | self.build_stamps2.append(self.build_stamps[task]) | 2267 | self.build_stamps2.append(self.build_stamps[task]) |
2268 | self.runq_running.add(task) | 2268 | self.runq_running.add(task) |
2269 | self.stats.taskActive() | 2269 | self.stats.taskActive() |
@@ -2520,7 +2520,7 @@ class RunQueueExecute: | |||
2520 | self.scenequeue_notneeded.remove(tid) | 2520 | self.scenequeue_notneeded.remove(tid) |
2521 | 2521 | ||
2522 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) | 2522 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) |
2523 | self.sqdata.stamps[tid] = bb.build.stampfile(taskname + "_setscene", self.rqdata.dataCaches[mc], taskfn, noextra=True) | 2523 | self.sqdata.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) |
2524 | 2524 | ||
2525 | if tid in self.stampcache: | 2525 | if tid in self.stampcache: |
2526 | del self.stampcache[tid] | 2526 | del self.stampcache[tid] |
@@ -2836,7 +2836,8 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): | |||
2836 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) | 2836 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) |
2837 | realtid = tid + "_setscene" | 2837 | realtid = tid + "_setscene" |
2838 | idepends = rqdata.taskData[mc].taskentries[realtid].idepends | 2838 | idepends = rqdata.taskData[mc].taskentries[realtid].idepends |
2839 | sqdata.stamps[tid] = bb.build.stampfile(taskname + "_setscene", rqdata.dataCaches[mc], taskfn, noextra=True) | 2839 | sqdata.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) |
2840 | |||
2840 | for (depname, idependtask) in idepends: | 2841 | for (depname, idependtask) in idepends: |
2841 | 2842 | ||
2842 | if depname not in rqdata.taskData[mc].build_targets: | 2843 | if depname not in rqdata.taskData[mc].build_targets: |
@@ -2915,7 +2916,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): | |||
2915 | found = {} | 2916 | found = {} |
2916 | for tid in rqdata.runq_setscene_tids: | 2917 | for tid in rqdata.runq_setscene_tids: |
2917 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) | 2918 | (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) |
2918 | stamps = bb.build.find_stale_stamps(taskname, rqdata.dataCaches[mc], taskfn) | 2919 | stamps = bb.build.find_stale_stamps(taskname, taskfn) |
2919 | if stamps: | 2920 | if stamps: |
2920 | if mc not in found: | 2921 | if mc not in found: |
2921 | found[mc] = {} | 2922 | found[mc] = {} |
@@ -2931,7 +2932,7 @@ def check_setscene_stamps(tid, rqdata, rq, stampcache, noexecstamp=False): | |||
2931 | taskdep = rqdata.dataCaches[mc].task_deps[taskfn] | 2932 | taskdep = rqdata.dataCaches[mc].task_deps[taskfn] |
2932 | 2933 | ||
2933 | if 'noexec' in taskdep and taskname in taskdep['noexec']: | 2934 | if 'noexec' in taskdep and taskname in taskdep['noexec']: |
2934 | bb.build.make_stamp(taskname + "_setscene", rqdata.dataCaches[mc], taskfn) | 2935 | bb.build.make_stamp_mcfn(taskname + "_setscene", taskfn) |
2935 | return True, False | 2936 | return True, False |
2936 | 2937 | ||
2937 | if rq.check_stamp_task(tid, taskname + "_setscene", cache=stampcache): | 2938 | if rq.check_stamp_task(tid, taskname + "_setscene", cache=stampcache): |
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index a63e37d22f..513f3811a1 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -106,17 +106,51 @@ class SignatureGenerator(object): | |||
106 | """Write/update the file checksum cache onto disk""" | 106 | """Write/update the file checksum cache onto disk""" |
107 | return | 107 | return |
108 | 108 | ||
109 | def stampfile_base(self, mcfn): | ||
110 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
111 | return self.datacaches[mc].stamp[mcfn] | ||
112 | |||
113 | def stampfile_mcfn(self, taskname, mcfn, extrainfo=True): | ||
114 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
115 | stamp = self.datacaches[mc].stamp[mcfn] | ||
116 | if not stamp: | ||
117 | return | ||
118 | |||
119 | stamp_extrainfo = "" | ||
120 | if extrainfo: | ||
121 | taskflagname = taskname | ||
122 | if taskname.endswith("_setscene"): | ||
123 | taskflagname = taskname.replace("_setscene", "") | ||
124 | stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" | ||
125 | |||
126 | return self.stampfile(stamp, mcfn, taskname, stamp_extrainfo) | ||
127 | |||
109 | def stampfile(self, stampbase, file_name, taskname, extrainfo): | 128 | def stampfile(self, stampbase, file_name, taskname, extrainfo): |
110 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') | 129 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') |
111 | 130 | ||
131 | def stampcleanmask_mcfn(self, taskname, mcfn): | ||
132 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
133 | stamp = self.datacaches[mc].stamp[mcfn] | ||
134 | if not stamp: | ||
135 | return [] | ||
136 | |||
137 | taskflagname = taskname | ||
138 | if taskname.endswith("_setscene"): | ||
139 | taskflagname = taskname.replace("_setscene", "") | ||
140 | stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" | ||
141 | |||
142 | return self.stampcleanmask(stamp, mcfn, taskname, stamp_extrainfo) | ||
143 | |||
112 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): | 144 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): |
113 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') | 145 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') |
114 | 146 | ||
115 | def dump_sigtask(self, fn, task, stampbase, runtime): | 147 | def dump_sigtask(self, fn, task, stampbase, runtime): |
116 | return | 148 | return |
117 | 149 | ||
118 | def invalidate_task(self, task, d, fn): | 150 | def invalidate_task(self, task, mcfn): |
119 | bb.build.del_stamp(task, d, fn) | 151 | mc = bb.runqueue.mc_from_tid(mcfn) |
152 | stamp = self.datacaches[mc].stamp[mcfn] | ||
153 | bb.utils.remove(stamp) | ||
120 | 154 | ||
121 | def dump_sigs(self, dataCache, options): | 155 | def dump_sigs(self, dataCache, options): |
122 | return | 156 | return |
@@ -448,9 +482,20 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): | |||
448 | def stampcleanmask(self, stampbase, fn, taskname, extrainfo): | 482 | def stampcleanmask(self, stampbase, fn, taskname, extrainfo): |
449 | return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) | 483 | return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) |
450 | 484 | ||
451 | def invalidate_task(self, task, d, fn): | 485 | def invalidate_task(self, task, mcfn): |
452 | bb.note("Tainting hash to force rebuild of task %s, %s" % (fn, task)) | 486 | bb.note("Tainting hash to force rebuild of task %s, %s" % (mcfn, task)) |
453 | bb.build.write_taint(task, d, fn) | 487 | |
488 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
489 | stamp = self.datacaches[mc].stamp[mcfn] | ||
490 | |||
491 | taintfn = stamp + '.' + task + '.taint' | ||
492 | |||
493 | import uuid | ||
494 | bb.utils.mkdirhier(os.path.dirname(taintfn)) | ||
495 | # The specific content of the taint file is not really important, | ||
496 | # we just need it to be random, so a random UUID is used | ||
497 | with open(taintfn, 'w') as taintf: | ||
498 | taintf.write(str(uuid.uuid4())) | ||
454 | 499 | ||
455 | class SignatureGeneratorUniHashMixIn(object): | 500 | class SignatureGeneratorUniHashMixIn(object): |
456 | def __init__(self, data): | 501 | def __init__(self, data): |
@@ -693,7 +738,7 @@ def dump_this_task(outfile, d): | |||
693 | import bb.parse | 738 | import bb.parse |
694 | fn = d.getVar("BB_FILENAME") | 739 | fn = d.getVar("BB_FILENAME") |
695 | task = "do_" + d.getVar("BB_CURRENTTASK") | 740 | task = "do_" + d.getVar("BB_CURRENTTASK") |
696 | referencestamp = bb.build.stamp_internal(task, d, None, True) | 741 | referencestamp = bb.parse.siggen.stampfile_base(fn) |
697 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) | 742 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) |
698 | 743 | ||
699 | def init_colors(enable_color): | 744 | def init_colors(enable_color): |