On Fri, 26 Mar 2021 at 20:58, Marco d'Itri <m...@linux.it> wrote:
>
> On Mar 26, Dimitri John Ledkov <x...@ubuntu.com> wrote:
>
> > Is it possible to rewrite the code to only use perl-base? without the
> > full perl?
> Probably it would not be too hard to reimplement what File::Find::Rule
> does and remove these dependencies. Maybe by running find(1).
>

It actually is kind of nice, and I don't think that's the largest culprit.

> > Or maybe even pure dash or C?
> Hard to believe.
>

I mean a boy can dream right?! =)

> > Can we vendor the needed perl bits, and then remove them from disk if
> > the conversion was successful?
> I am not sure how much space this would save, do you want to try? Add:
>
> use lib "/usr/lib/usrmerge/lib/";
>
> and then start copying the dependencies to the directory until it
> works... (Also, there is App::FatPacker.)
>
> I do not know about Ubuntu, but I do not think that a self-modifying
> package would be be following Debian policy.
>

I ran strace to try to figure out which files are used from
perl-modules, which are not from perl-base. I think it's just this:

openat(AT_FDCWD, "/usr/share/perl/5.32/Fatal.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/File/Find.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/Tie/RefHash.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/autodie.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/autodie/Scope/Guard.pm",
O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/autodie/Scope/GuardStack.pm",
O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/autodie/Util.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl/5.32/if.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl5/File/Find/Rule.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl5/Number/Compare.pm", O_RDONLY|O_CLOEXEC)
openat(AT_FDCWD, "/usr/share/perl5/Text/Glob.pm", O_RDONLY|O_CLOEXEC)

I don't know what is the correct process to follow here. For example,
could the 5.32 things be promoted from modules to perl-base?

Not sure why "if.pm" is used.

I will see if I can vendor all of the above and thus make usrmerge be
installable with just perl-base. Probably as an Ubuntu only change,
cause yeah vendoring things like that sounds like embedded copies of
code against the Debian Policy.

> > Can we add a usrmerge-completed package, which is empty, but ensures
> > in preinst that the system is usrmerged? That way in minimal
> > containers said package will be preinstalled by default
> > satifying/providing usrmerge.
> Sure: since you apparently have a design in mind, could you provide
> a rough patch?
> Which packages do you think would depend on it?
>

In Ubuntu we use metapackages, hence in Ubuntu to ensure that all
systems upon upgrade are converted. I wanted to make ubuntu-minimal to
depend on usrmerge. However, that exploded the size of the minimal
tarballs/containers with just apt & dpkg and nothing else.

I was thinking to have a package called: usrmerged

Which Conflicts/Replaces/Provides: usrmerge, is empty, has no deps,
and in the preinst tests that the system is usrmerged. That way
ubuntu-minimal would be able to depend on usrmerge | usrmerged => with
fresh installs having no extra deps, whilst systems that try to
upgrade will eventually install usrmerge.

> > At the moment, I'm trying to make usrmerge required such that systems
> > that upgrade get it installed, but it is becomming problematic on the
> > minimal containers. Especially, since after installation its no longer
> > needed.
> I am all for improving Debian and Ubuntu to make them optimal for
> building tiny containers, but I am not sure that it is a good idea to
> do this by spending time adding complexity and bugs to usrmerge which is
> not even supposed to be installed on them since it is only needed for
> the one time conversion.

Yeah that. I'm now experimenting with makeing ubuntu-minimal recommend
usrmerge; such that it gets installed on upgrades, but not on fresh
installs (which are usrmerged anyway). Maybe that will be good enough
and will then require no minimization surgery to usrmerge.

-- 
Regards,

Dimitri.

Reply via email to