[pacman-dev] [PATCH] pacman: don't nuke local repos with -Sc

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Jun 24 12:31:30 UTC 2021


On 06/24/21 at 12:58pm, Morgan Adamiec wrote:
> 
> 
> On 24/06/2021 12:51, Allan McRae wrote:
> > On 24/6/21 9:33 pm, Morgan Adamiec wrote:
> >>
> >>
> >> On 24/06/2021 09:25, Allan McRae wrote:
> >>> On 24/6/21 6:19 pm, Morgan Adamiec wrote:
> >>>>
> >>>>
> >>>> On 24/06/2021 06:38, Allan McRae wrote:
> >>>>> On 15/6/21 5:11 am, morganamilo wrote:
> >>>>>> When using a local repo as a cachedir  pacman -Scc or pacman -Sc
> >>>>>> without KeepCurrent will delete the repo database and packages
> >>>>>> resulting in a lost database and non functional pacman.
> >>>>>>
> >>>>>> So special case file:/// repos in cache to not get nuked and foce
> >>>>>> KeepCurrent on.
> >>>>>> ---
> >>>>>
> >>>>> This behaviour change is undocumented.
> >>>>>
> >>>>> I don't think we should do this for -Scc.  That is explicitly asking all
> >>>>> package files in cache directories to be removed, so that is what you get.
> >>>>>
> >>>>> I also am leaning towards this behaviour for -Sc being unexpected (even
> >>>>> if documented).  Pacman's job is really not to manage complex cache
> >>>>> set-ups and I'm not convinced this should be supported.
> >>>>>
> >>>>> Allan
> >>>>>
> >>>>
> >>>>
> >>>> I want this to go ahead, especially with -Scc. Otherwise -Scc can end up
> >>>> losing you your .db file, breaking pacman, the local repo's .db and all
> >>>> the build packages.
> >>>>
> >>>> This use case is not complex in my opinion. It's just adding one line to
> >>>> your pacman.conf to stop every single package being duplicated.
> >>>>
> >>>> If you're still against this do you have any alternative solutions in
> >>>> mind to handle this?
> >>>>
> >>>
> >>> Not using -Scc.   Why would you use that and expect it not to delete
> >>> packages?
> >>>
> >>> A
> >>>
> >>
> >> Because I want everything deleted in the main /var/cache/pacman/pkg dir.
> >>
> > 
> > Pacman asks what to do for each cache directory and you could say yes to
> > removing files from /var/cache/pacman/pkg/ and no for other cache
> > directories.   So that already achieves what you are doing without
> > adding a special case to the codebase.
> > 
> > Pacman's job is not to be a specialised cache cleaning utility.  Hence
> > why the suggestion of adding the ability to select how many versions of
> > each package is kept was implemented in paccache.
> > 
> > Allan
> > 
> 
> Yes, that does work but then you have to be careful about what to wipe
> and can't automate it. I would agree if it wasn't for the case
> accidentally deleting that dir loses you your repo.
> 
> I believe as a workaround aurutils bind mounts the repo into cache as
> readonly.
> 
> Would you be more accepting of it straight up just skipping any
> cachedirs that happen to be a local repo and not inspect it at all?

-1.  -Sc/-Scc are destructive operations.  There are a variety of
weird cache setups where they could be more destructive than intended.
People with weird cache setups really probably just shouldn't use
them.


More information about the pacman-dev mailing list