Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 257260

Summary: Portage should provide some means to disable dir file removal in subdirs of /usr/share/info
Product: Portage Development Reporter: Ulrich Müller <ulm>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement CC: emacs, pms
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=416875
https://bugs.gentoo.org/show_bug.cgi?id=899898
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 335925    
Attachments: Patch that is implementing the functionality
Updated patch, accepting any file matching .keepinfodir*

Description Ulrich Müller gentoo-dev 2009-02-01 17:43:57 UTC
There is a problem with GNU Info file installation of Emacs and the way Portage handles Info "dir" files. Let me first describe the current behaviour of both, and what we currently have implemented as workaround in ebuilds:

Emacs ebuilds install their Info files in subdirectories /usr/share/info/emacs-${SLOT}. The upstream package contains a pre-made "dir" file with specific ordering of menu entries. No other package will install any Info file in this Emacs specific directory (so normally the "dir" file can be static). One of the Info dirs is later added to INFOPATH by the Emacs eselect module, by setting the variable in /etc/env.d/50emacs.

Portage (in "prepinfo") compresses all files in /usr/share/info and its subdirectories (a wanted feature), but also removes the "dir" files from all subdirs. Later the "dir" files are regenerated, but only in the subdirs that are listed in INFOPATH.

So at this point any /usr/share/info/emacs-${SLOT} directory may:
a) not contain a "dir" file at all (if the subdir was not in INFOPATH), or
b) contain a regenerated "dir" where the original ordering of entries is lost.

Our current workaround in app-editors/emacs is to call a function "emacs-infodir-rebuild" from pkg_post{inst,rm} that will regenerate the dir file, in order to avoid case a) at least. However, this leaves us with two problems:
- Upstream's ordering of menu entries is lost.
- The "dir" file is an orphan that is not owned by the installed Emacs package.


I don't see any way how we could solve the problem at the ebuild level (please correct me if I'm missing something).

So, would it be somehow be possible to tell Portage "don't ever touch this dir file"?
Comment 1 Ulrich Müller gentoo-dev 2010-08-29 08:57:51 UTC
A possible solution would be use an (empty) .keepinfodir file as a marker that tells portage that the dir file should be left alone.

AFAICS, a test for this would then be needed in prepinfo and in chk_updated_info_files.
Comment 2 Ulrich Müller gentoo-dev 2010-09-03 17:35:40 UTC
Created attachment 245890 [details, diff]
Patch that is implementing the functionality
Comment 3 Zac Medico gentoo-dev 2010-09-03 17:50:56 UTC
(In reply to comment #2)
> Created an attachment (id=245890) [details]

I think the reason that keepdir() uses a filename pattern like .keep_${CATEGORY}_${PN}-${SLOT} is to avoid file collisions, and it's handy to be able to see owners of the '.keep' files in the filenames (and makes the reference count plain to see).

Should we do the same for '.keepinfodir' files?
Comment 4 Ulrich Müller gentoo-dev 2010-09-03 18:28:11 UTC
(In reply to comment #3)
> I think the reason that keepdir() uses a filename pattern like
> .keep_${CATEGORY}_${PN}-${SLOT} is to avoid file collisions,

I don't think that this is an issue here:
- In cases where the ".keepinfodir" files would collide, already the "dir"
  files would collide.
- Keeping the Info dir file makes no sense in directories where more than one
  package will install Info files.

> and it's handy to be able to see owners of the '.keep' files in the
> filenames (and makes the reference count plain to see).

> Should we do the same for '.keepinfodir' files?

Do we need a special command ("keepinfodir"? "skipinfodir"?) for creating the file if we use such a complicated filename pattern?
Comment 5 Zac Medico gentoo-dev 2010-09-03 21:37:54 UTC
(In reply to comment #4)
> Do we need a special command ("keepinfodir"? "skipinfodir"?) for creating the
> file if we use such a complicated filename pattern?

Well now that you mention it, I notice there isn't one. I guess the alternative is for ebuilds to be aware of the '.keepinfodir' concept and to create them manually? Maybe there's some other obvious way that I've missed?
Comment 6 Ulrich Müller gentoo-dev 2010-09-04 23:01:19 UTC
Created attachment 246057 [details, diff]
Updated patch, accepting any file matching .keepinfodir*
Comment 7 Zac Medico gentoo-dev 2010-09-04 23:26:47 UTC
(In reply to comment #6)
> Created an attachment (id=246057) [details]
> Updated patch, accepting any file matching .keepinfodir*

That looks good to me.
Comment 8 Ulrich Müller gentoo-dev 2010-10-13 21:58:11 UTC
That has been included in portage-2.1.9.1. Can this bug be closed?
Comment 9 Zac Medico gentoo-dev 2010-10-14 00:13:41 UTC
Yes, it's fixed now.