Auto-Detection of Build Dependencies, Gsoc 2019

Clemens Lang cal at macports.org
Tue Mar 19 20:26:34 UTC 2019


Hi,

On Sun, Mar 10, 2019 at 09:46:32AM -0700, Marcus Calhoun-Lopez wrote:
> I am responding to this message on the developer mailing list in case
> anyone else has more insight than I.
> 
> A minor point: you may want to avoid the word “trace” in this context
> since trace has another meaning in MacPorts [1,2,3].

That depends. For our idea "Auto-detection of build dependencies", trace
mode was indeed intended as the method of implementation. I'll try to
reply inline below in the original mail.

> > On Mar 10, 2019, at 6:30 AM, Arghya Bhattacharya <arghya.b at research.iiit.ac.in> wrote:
> >
> > [...]
> >
> > I looked up the way MacPorts currently "traces" the installation
> > process but couldn't really get a hang of it. Could you provide an
> > insight into how the trace mode works? That would be helpful in the
> > way I'm going to identify the build dependencies for this project.

Trace mode uses DYLD_INSERT_LIBRARIES (similar to LD_PRELOAD on Linux,
which is easier to google) to inject a library into every process during
a build and intercepts all libc functions related to file handling. For
each file access, it connects to a service via a Unix socket, sends the
filename to the socket and receives an answer indicating whether the
port that is currently being compiled should have access to this file.

There are a couple of static rules (which wouldn't change for this task)
and a dynamic component that checks which port installed the file that
the installation is trying to access. At the moment, we allow requests
if the currently built port depends on the port that provides the file
and deny access otherwise.

This task would change this behavior (optionally, using a flag) to not
deny access, but record the fact that files were used from a particular
port. After the installation finished, MacPorts base would then use this
list of files and ports providing these files to figure out which
dependencies were used while compiling a port.


HTH,
-- 
Clemens


More information about the macports-dev mailing list