overlord/snapstate, wrappers: manpages!#8079
overlord/snapstate, wrappers: manpages!#8079chipaca wants to merge 1 commit intocanonical:masterfrom
Conversation
This is a rough draft of a first pass at manpages support. This works by creating a `man` directory next to the snappy `bin` directory (i.e. a `/snap/man` to go with `/snap/bin`, in Ubuntu); if the latter is on your `$PATH`, then man will pick up manpages that are in the former. Right now it only sets things up for files that start with the snap name. A second pass would be to add also support for aliases. Also it only considers files, whereas often manpages will be symlinks. We should support manpages symlinking to other things as long as they are in the same snap, at least. --- It works! But needs a few things before being production-ready: * more and better unit tests * a spread test but I'm stopping here. Hopefully this is enough...
zyga
left a comment
There was a problem hiding this comment.
I have personal desire and use case for this. I'll pick it up (even if it has to be in my weekend spare time).
| ) | ||
|
|
||
| func AddSnapManpages(s *snap.Info) error { | ||
| snapManRoot := filepath.Join(s.MountDir(), "meta", "man") |
There was a problem hiding this comment.
Will we have automation in snapcraft to popualte this? i.e. what's the plan (if any) to keep the man-pages in the snapcraft parts and this dir in sync ?
| @@ -218,6 +228,19 @@ apps: | |||
|
|
|||
| info := snaptest.MockSnap(c, yaml, &snap.SideInfo{Revision: snap.R(11)}) | |||
There was a problem hiding this comment.
There's a snapstest.MockSnapWithFiles helper now.
| SnapRollbackDir = filepath.Join(rootdir, snappyDir, "rollback") | ||
|
|
||
| SnapBinariesDir = filepath.Join(SnapMountDir, "bin") | ||
| SnapManpagesDir = filepath.Join(SnapMountDir, "man") |
There was a problem hiding this comment.
A random, thought, should we block installation of snaps named bin and man like we do for system ?
There was a problem hiding this comment.
CC @jdstrand for review tools. I think we should do a separate pass of checks in snapd though.
| snapManRoot := filepath.Join(s.MountDir(), "meta", "man") | ||
| inSnapPrefix := s.SnapName() + "." | ||
| onDiskPrefix := s.InstanceName() + "." | ||
| return filepath.Walk(snapManRoot, func(path string, info os.FileInfo, err error) error { |
There was a problem hiding this comment.
As I understand the first if is suppose to handle the case when there's no man directory inside snap meta, but as a side effect it swallows up all errors. I think it'd be better to have:
if !osutil.DirExists(snapManRoot) {
return nil
}
return filepath.Walk(snapManRoot, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
...
}
| err := syscall.Unlink(path) | ||
| for err == nil { | ||
| path = filepath.Dir(path) | ||
| if path == stop { |
There was a problem hiding this comment.
Are we sure that stop wa filepath.Clean()'ed?
|
Hi guys, passing by just to remind you this is a very welcomed feature. Could you, please, start working on it again? |
|
:-( |
|
Hey snapcraft people 👋🏻, because it is the time of the year where teams start planning the Roadmap for the next Cycle, I want to kindly ask: Can you add this issue to the Roadmap of the next cycle? I totally understand that there are probably always pressing issues to fix and you are busy, but I think this is a low hanging fruit that would make snaps so much better. Having inaccessible documentation is bad UX. To give some argumentative munition against other issues during planning discussions:
|
The upstream OVS and OVN projeccts provide detailed documentation
in their manpages. It would be a shame to deprieve the user of
this documentation.
There have been efforts to bring man page support to the snap
infrastructure [0][1], but it has unfortunately not come to
fruition. We need to bring the required components ourself.
Example to view the OVN Architecture documentation:
microovn.man ovn-architecture
0: https://forum.snapcraft.io/t/support-for-man-pages/2299
1: canonical/snapd#8079
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
The upstream OVS and OVN projeccts provide detailed documentation
in their manpages. It would be a shame to deprieve the user of
this documentation.
There have been efforts to bring man page support to the snap
infrastructure [0][1], but it has unfortunately not come to
fruition. We need to bring the required components ourself.
Example to view the OVN Architecture documentation:
microovn.man ovn-architecture
0: https://forum.snapcraft.io/t/support-for-man-pages/2299
1: canonical/snapd#8079
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
|
Hello, is there any updates on this topic (man page support) in 2023 ? |
|
Hey snapcraft people 👋🏻, is there any updates on this issue for this cycle? |

This is a rough draft of a first pass at manpages support.
This works by creating a
mandirectory next to the snappybindirectory (i.e. a
/snap/manto go with/snap/bin, in Ubuntu); ifthe latter is on your
$PATH, then man will pick up manpages that arein the former.
Right now it only sets things up for files that start with the snap
name. A second pass would be to add also support for aliases. Also it
only considers files, whereas often manpages will be symlinks. We
should support manpages symlinking to other things as long as they are
in the same snap, at least.
It works! But needs a few things before being production-ready:
but I'm stopping here. Hopefully this is enough...