Author
Topic: tce-load's recursive_scan (Read 507 times)

I'm currently trying to improve tce-load, and I don't know why recursive_scan is doing what it is doing. (recursive_scan is the AWK function on line 162)It goes to great lengths to output each extension, and then its extensions, even if the child extension is already outputted.I think its inefficient, because the two places where recursive_scan is used ignore duplicates. (in tce-load, IDK about elsewhere, like maybe the apps GUI)Anybody know why recursive_scan does what it does the way it does? My instinct is that it is a remnant of tce-load revisions past.Thanks in advance.

From my understanding ...The logic is to print the dep file of an extension once.At the End of the recursive_scan function, it calls itself with what's inside the dep file.It can be shrink down to something like this:

The PRINTED variable keeps track of whether a certain package has been outputted, but is reset each record. This means that if we tce-load two packages with a common dependancyj perhaps jwm & flwm, both of them will have the common dependancy listed by the output function, and then the duplicates will be filtered out by the tce-load bash scripting.It seems to me that the recursive_scan would be better off being simplified to the following (meta code):(capitals means its an array)

Code: newbielink:javascript:void(0); [nonactive]

function scan(EXT,extcount){ for(idx=1;idx<=extcount;idx++ //Remove Duplicates PRINTED[EXT[idx]]=1 print(EXT[idx]) foreach(dep in depfile){ if(PRINTED[dep]!=1){ EXT[++extcount]=dep } } }}This would only output each extension once, guaranteed by the PRINTED dictionary (equivelant to the output function's PRINTED dictionary in the current recursive_scan)For the appbrowser, it could also be a small modification to make it print out repeated dependancies, but not repeated dependancy's dependancy's.

Code: newbielink:javascript:void(0); [nonactive]

foreach(dep in depfile){ if(PRINTED[dep]!=1){would become

Code: newbielink:javascript:void(0); [nonactive]

if(PRINTED[EXT[idx]]!=1){ foreach(dep in depfile){Reasoning behind only printing out repeated dependancy's but not recursing on them is because of things like libX11, which prints out

Code: newbielink:javascript:void(0); [nonactive]

libX11.tcz libxcb.tcz libXau.tcz libXdmcp.tczunderneath every package requiring libX11, instead of printing that out once at the top, and then cutting it down to "libX11.tcz" and no more for the rest.I'm assuming that when appsbrowser downloads a deptree from the repo (not .dep, the dependancies tab.), that the deptree was generated once by a version of recursive_scan.