[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dragora package management

From: Matias Fonzo
Subject: Re: Dragora package management
Date: Tue, 12 May 2020 22:15:16 -0300
User-agent: Roundcube Webmail/1.3.8

Asunto: Dragora package management
Fecha: 2020-05-12 14:23
Remitente: Michael Siegel <address@hidden>
Destinatario: Matias Fonzo <address@hidden>

I've been looking into the Graft guide again but have decided to put it
aside for now and concentrate on getting the website generator done.

That's fine.

There are two reasons for this: One, there are many issues with that
guide and I just don't have the energy at the moment to write them all
down and think about how to fix them. Two, Graft seems very complicated
to me.

The second reason has me worry a bit. I've talked to an old Unix guy I
know from Devuan (though he's not a Devuan developer) about Graft and he
thought the same: Graft seems to be extremely complex. None of us has
read the code, though. (I don't even know Perl.)

If you mean complicated from the point of view of addressing this particular program, yes, it may be complicated or even frustrating. That's what happened to me years ago when I looked to the graft for first time.

I think that to understand this kind of program as Graft or as GNU Stow, you have to address the concept or concepts behind it. These concepts belong to the 1990s (not that old is bad) but rather to have a package structure using the same file system as a database - instead of an internal database or files containing an installation log, this has its advantages.

Once this is understood, using Graft is quite simple:

graft -i <directory> to link a "package" directory under the target directory. graft -d <directory> to unlink a "package" directory from the target directory.

It's a form of organization. Distributions like Dragora (version 3), Nix or GNU Guix uses these concepts. Of course in Dragora it's more bare or "primitive".

Now, when I look at the current package management situation in Dragora,
I see there's a supposedly very complex Perl script (ca. 1700 SLOC) as
the backend to a POSIX sh script (ca. 1000 SLOC). And on top of that,
there will be qire, written in Fennel (ca. 800 SLOC) and compiled to Lua.

I'm beginning to think that this might not be a solid approach. I mean,
sure, package management is quite a complex task. But I have a feeling
that the way it is being implemented in Dragora currently (again, not
judging the code, only the concept) results in something that is more
complex than the solution to the actual problem would require.

What do you think?

As you say, package management is a complex task. For that reason I have tried to keep Qi as "small as possible" in the sense of achieving an instruction that can do the basics, which is: install, remove, or upgrade software packages. In addition to build packages through recipes. I see Qi as a package manager that does the basics plus some additions.

Considering that it has 1000 lines of source code for everything I think is okay. Out of those 1000 lines only a portion or some portions of that code is used at run-time (when a mode is invoked); you also have to take into account the style of the code - for example, writing like this:

    test "$var" = value && do this ...

is not the same as:

    if test "$var" = value
        do this ...

which is more formal and clear.

Both aspects apply to both Qi and Graft, which try to have line breaks, new lines, formal code (this adds up to the SLOC count) and good comments (if possible). In the case of Graft, it could be "smaller" since it offers compatibility with GNU Stow.

Learning and using Qi can prevent you from learning Graft itself. But learning Graft gives you a finer grain for handling packages and it helps you to understand Qi better.

I don't think the amount of lines of code is alarming in Qi (currently), nor in Graft, because for link management it is complicated, and I consider that only Perl is quite suitable for this task. To compare a little we can look in the Alpine Linux abuild script[1], this is the "light" version of makepkg (from ArchLinux):

[1] https://git.alpinelinux.org/abuild/tree/abuild.in

It has a total of 2733 lines (including code, new lines, comments, etc.). I haven't looked, but I don't want to imagine the current lines from the original makepkg at ArchLinux. And this is "only" to proceed with the instructions from a build script or recipe...

I know that writing Qi in /bin/sh has its limitations, but for what it does I think it does pretty well. Tomorrow I'll see about rewriting it in C or Perl, for that I lack time for learning.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]