On 7/14/07, Andrew Fyfe <andrew@neptune-one.net> wrote:
Dan McGee wrote:
Ok, I've been slaving away at this for a while and libalpm/add.c is finally getting a bit more manageable. Showing a patch is worthless because it is huge and is much harder to follow due to the refactoring stuff. Instead I've attached a drop-in add.c that compiles cleanly with no other changes needed. I'm looking for some feedback on this.
Some highlights: 1. All pactests still pass, so no regressions on that front. 2. *Much* cleaner layout. add_commit has now been split across four functions (upgrade_remove, extract_single_file, commit_single_pkg, and _alpm_add_commit). 3. No more super functions. The heaviest function (extract_single_file) now weighs in at 350 lines, and a lot of that is comments. 4. Most of what Andrew started to do in his 7484 patch has been brought into this. However, I rewrote it a bit for clarity (at least I thought so). We may need a bit more meat added to this section.
Comments/concerns/questions appreciated. I still want to cleanup the huge if(needbackup) section a bit, that is still quite long but hard to refactor.
-Dan
------------------------------------------------------------------------
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev A HUGE improvement :) The only thing missing is the directory permission checks and warning (see the latest patch on my FS7484 branch).
I'm not too keen on having to add that strmode function just for this- I think we can get away with printing numeric style modes, such as 4777, 0644, etc. I should add some warning stuff in there though when permissions differ. Did we make a call yet on whether we should change the permissions to those of the installing package, or leave it for the user to do?
I've got a couple of ideas on how pacman should install a package, your break up of add_commit matches up fairly close to what I was planning. With the exception of the backup code, I'm thinking that all the conflict checks and checks introduced for FS7484 should be done before we start adding/removing files from the users system. But this is a post 3.1 task :)
Remember that all this conflict checking stuff does in fact get done before this add_commit code runs, so we could do all this then as well. It shouldn't be too hard to drop it in, although that will entail doing a second run though the archive unless we extract once to /tmp and copy later. My biggest worry about extracting to /tmp would be filling it up for those that use a tmpfs and are installing a very large package (some things in AUR, openoffice, etc). -Dan