2. First I thought something like this: alpm_download_packages(alpm_list_t *packages, ...) This seems the easiest to implement (cut from sync_commit). However, if we want transaction-independent function, we should do pmsyncpkg_t -> pmpkg_t conversion always. (Ugly) 3. Then I started to like the following: alpm_download_package(pmpkg_t *package) We have a problem with this, in this case if we want to keep the current "download all packages then check all integrity" order we should make something like alpm_check_integrity public (no, too complicated). Alternatively, we could check_integrity in download_package. This is also logical, but changes the current behaviour (order).
I don't understand why you need to do ugly conversions for 2 but not for 3.
2. you have to build/free a new list 3. you can call on "spkg->pkg" for each sync package This is not much difference, indeed. Btw, almost all alpm functions require pmpkg_t*, resolvedeps, checkdeps, checkconflicts... So "build/free a new list" is already done in many places.
I am definitely not proud of this hardwired sync_prepare computing. About on-demand access, is that possible? As you said, these two fields depend on the filecache. How do you detect that the filecache has changed?
I assume that filecache is modified via alpm. (This is partly true, because -Sc is implemented in the front-end!) This is closer to reality than the current hardwired stuff.
So even if you have some on-demand access to both fields, I believe you still need to update them each time the filecache is affected. Maybe this is doable if each functions causing write to the filecache also update these two fields. So maybe a download(pkg) function could handle that?
Yes I thought that download function should handle that. I thought about a very primitive delta_path handling as a starting point. (If all delta downloads were successful, clear delta_path, if one of them was unsuccessful, set delta_path (and download_size) to "not computed")
And I guess that function should take care of delta too : if an old package is present in filecache, then compute delta path, download delta files, and apply them. Otherwise just download the package?
I may mixed many things here, and I may misunderstand something (this delta stuff made things quite complicated in sync.c)
I agree, this complicates things quite a lot for no benefit (at least for now).
And it is difficult to test them... I still don't know what to do;-) I even don't know whether you support the primary "goal": cleaner trans_commit. Bye