Add multifile support to elf dependency generation
Multifile dependency generation is a huge performance boost when there are multiple files of the same type. The Elf dependency generator is not a particularly heavy in its startup so benefits less from this than interpreted languages will. On my laptop coreutils requires generation goes from circa 0.8s to 0.08s, something like Python/Perl interpreted generators the difference would be much much bigger. Of course, no reason not to improve performance when it comes this easy, and serves as an example for other generators.
This commit is contained in:
parent
d3dbe17b2e
commit
08ae4ee23e
|
@ -1,4 +1,5 @@
|
|||
%__elf_provides %{_rpmconfigdir}/elfdeps --provides
|
||||
%__elf_requires %{_rpmconfigdir}/elfdeps --requires
|
||||
%__elf_provides %{_rpmconfigdir}/elfdeps --provides --multifile
|
||||
%__elf_requires %{_rpmconfigdir}/elfdeps --requires --multifile
|
||||
%__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$
|
||||
%__elf_exclude_path ^/lib/modules/.*\.ko?(\.[[:alnum:]]*)$
|
||||
%__elf_protocol multifile
|
||||
|
|
|
@ -16,6 +16,7 @@ int soname_only = 0;
|
|||
int fake_soname = 1;
|
||||
int filter_soname = 1;
|
||||
int require_interp = 0;
|
||||
int multifile = 0;
|
||||
|
||||
typedef struct elfInfo_s {
|
||||
Elf *elf;
|
||||
|
@ -332,8 +333,12 @@ static int processFile(const char *fn, int dtype)
|
|||
|
||||
rc = 0;
|
||||
/* dump the requested dependencies for this file */
|
||||
for (ARGV_t dep = dtype ? ei->requires : ei->provides; dep && *dep; dep++) {
|
||||
fprintf(stdout, "%s\n", *dep);
|
||||
ARGV_t dep = dtype ? ei->requires : ei->provides;
|
||||
if (dep && *dep) {
|
||||
if (multifile)
|
||||
fprintf(stdout, ";%s\n", fn);
|
||||
for (; dep && *dep; dep++)
|
||||
fprintf(stdout, "%s\n", *dep);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
@ -363,6 +368,7 @@ int main(int argc, char *argv[])
|
|||
{ "no-fake-soname", 0, POPT_ARG_VAL, &fake_soname, 0, NULL, NULL },
|
||||
{ "no-filter-soname", 0, POPT_ARG_VAL, &filter_soname, 0, NULL, NULL },
|
||||
{ "require-interp", 0, POPT_ARG_VAL, &require_interp, -1, NULL, NULL },
|
||||
{ "multifile", 'm', POPT_ARG_VAL, &multifile, -1, NULL, NULL },
|
||||
POPT_AUTOHELP
|
||||
POPT_TABLEEND
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue