[pacman-dev] [PATCH] Add new SharedPkgCache option.

Xavier shiningxc at gmail.com
Tue Mar 11 08:49:26 EDT 2008


On Mon, Mar 10, 2008 at 07:44:23PM -0500, Dan McGee wrote:
> OK, after thinking about this, how about something like
> 
> CleanPackages = Installed (default if nothing specified, look at localdb)
> CleanPackages = UpToDate ('shared package cache', look at syncdb)
> 
> Problem is those specs are reverse from how they sound- we are keeping
> and not cleaning what was specified.
> 
> I'm saying do it this way rather than a boolean option so when some
> smart guy on the list comes up with a date-based cleaning solution or
> something, we can also accommodate for that.
> 
> Hmm:
> CleanMethod = {KeepInstalled, KeepCurrent, KeepRecent} ?
> 

That sounds nicer, but this makes the implementation more complicated.
Firstly, we now need some error handling when the specified method doesn't
exist.
And secondly, we can't just store a boolean anymore. So either we store the
string directly, and then it's a pita if we need to do the string comparisons
several times, especially with the insensitive comparison mess.
Or we could just use an integer, but then it's not clear what it means. So I
added the following enum in conf.h :
+/* clean method */
+enum {
+       PM_CLEAN_KEEPINST = 0, /* default */
+       PM_CLEAN_KEEPCUR
+};

But I still find your way better especially because the names are much
clearer, and it's also extensible indeed.
So I will attach the updated patch, but it will need to be reviewed more
carefully with the above two slight issues. :)




More information about the pacman-dev mailing list