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

Re: Installing package *NOT* in repository

On Tue, Aug 21, 2018 at 02:48:25PM +0200, tomas@tuxteam.de wrote:
> On Tue, Aug 21, 2018 at 08:02:02AM -0400, Gene Heskett wrote:
> > Odd, maybe apt does not look in $PATH?

(That wouldn't be "odd".  That would be "normal".)

> There's no reason to assume that, unless when looking for an executable
> (i.e. those things which tend to live in /bin and /usr/bin).
> Actually, dpkg's man page mentions $PATH, but only for searching
> executables, which is to be expected. Not for searching packages.
> To me, it would be a surprise.

Y'know what, I'm getting sick of apt having this feature and not
documenting it anywhere.  So I decided to do an "apt-get source apt"
and try to find it in the freakin' code.

Unfortunately, it is written in C++.  It is a nightmare.  Totally

I managed to find the file apt-1.4.8/cmdline/apt.cc which looks like
the starting point for the "apt" command line tool.  So, yay?  We can
start here, right?  Hah!

The "obvious" thing that I found was this:

      // package stuff
      {"install", &DoInstall, _("install packages")},

So, if we pass the command "install", it should call this function named
"DoInstall", right?  So all we have to do is find the function named
"DoInstall" somewhere in the source code, and read that, and it will
tell us what the "install" command does.  Right?

Wrong.  Because it's an unmaintinable C++ nightmare.

Oh, but, here's main() and in main() we see this call:

   auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);

So, we can just find the function named "ParseCommandLine" and read THAT,
and surely THAT would have to tell us how it parses the command line
arguments, right?  RIGHT?!

Wrong.  Because it's an unreadable C++ nightmare.

I also tried looking for "strchr" (thinking, "somewhere there HAS to be
a check to see whether the argument string contains a slash character,
right?").  I found a few of them, but none seemed relevant.

I even tried doing searches for "'/'" (that is, the three-character
literal string '/') in a few places, but no luck with that either.

Oh, you know what else?  Here in the top-level directory there's this
file named README.md and it says:

  APT uses cmake.

At that point, I just gave up.  cmake is the WORST.  As near as I
can tell, it exists for only one reason: to make development hellish.
As soon as I saw that this project uses cmake, I literally gave up,
wrote this screed, and deleted the source directory.

Someone else can try to find the god damned argument parsing code.
Which should be in the god damned main() function.  But isn't.

Reply to: