Continuation of the review that introduced describe-json
This commit introduces two new targets: describe-csv and db.
The former hast he bulk of the work, the later is a convenience.
describe-csv:
It works from the root of the ports directory and from any category.
It creates a csv-compliant output.
For convenience, we might want the first line to be the names of the fields.
This is useful if we want to to load the data into an SQLite database.
We can achieve this with the WITH_CSV_HEADER option:
make -DWITH_CSV_HEADER describe-csv | sqlite3 mydb.db ".mode csv" ".import /dev/stdin ports"
db:
This target acts as a shortcut for the previous command. It can only be invoked
from the ports tree root directory. It will create an SQLite database from the
csv output and write the result to the file indicated by the PORTSDB variable
or to the database ports.db by default, e.g.:
PORTSDB=mydb.db make db
It uses the new Tools/make-ports-db.sh script.
It takes 23 minutes in a fresh booted system with the ports tree in the following disk model:
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 ada0: <TOSHIBA HDWD120 MX4OACF0> ATA8-ACS SATA 3.x device ada0: Serial Number X8V1JUJCS ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada0: Command Queueing enabled ada0: 1907729MB (3907029168 512 byte sectors)