omniti-labs/omnios-build — pull request #46 by lotheac (2014-11-14 08:55:47+00:00)
Title: faster build dependency check

Previously the check for build dependencies was O(n), since it called pkg info for each dependency. This patch makes it O(1), and additionally installs all missing dependencies with only one question if running interactively.

Excerpt from interactive build with patch, some missing dependencies but some installed:

===== Build started at Fri Nov 14 10:44:33 EET 2014 =====
Package name: niksula/perl5/Mail-SpamAssassin
Selected flavor: None (use -f to specify a flavor)
Selected build arch: both
Extra dependency: None (use -d to specify a version)
Verifying dependencies

pkg list: no packages matching 'pkg:/niksula/perl5/Mail-DKIM, pkg:/niksula/perl5/DB_File, pkg:/niksula/perl5/IO-Socket-INET6, pkg:/niksula/perl5/Net-DNS' installed
--- Build dependencies unsatisfied Install/Abort? (i/a) i

and from the build log:

Verifying dependencies
Running: pfexec pkg install pkg:/niksula/runtime/perl@5.20 pkg:/niksula/runtime/perl@5.20 pkg:/niksula/perl5/HTML-Parser pkg:/niksula/perl5/NetAddr-IP pkg:/niksula/perl5/Mail-DKIM pkg:/niksula/perl5/Net-DNS pkg:/niksula/perl5/Digest-SHA1 pkg:/niksula/perl5/DB_File pkg:/niksula/perl5/Encode-Detect pkg:/niksula/perl5/HTTP-Date pkg:/niksula/perl5/IO-Socket-INET6 security/gnupg
Packages to install: 4
Create boot environment: No
Create backup boot environment: No

Download: niksula/perl5/Mail-DKIM ... Done
Download: niksula/perl5/DB_File ... Done
Download: niksula/perl5/IO-Socket-INET6 ... Done
Download: niksula/perl5/Net-DNS ... Done
Install Phase ... Done
Package State Update Phase ... Done
Image State Update Phase ... Done
Reading Existing Index ... Done
Indexing Packages ... Done