Contributed by mbalmer on from the know-your-ports dept.
There's a new port called sqlports in the tree. It's an sqlite database containing most information related to ports in the ports tree.
It's already useful as it is, by using a tool called sqlitebrowser which is also part of the ports tree.
But I expect that enterprising people will run with this and build all kind of interesting dynamic web pages that could present and organize this information.
Some examples
Assuming you've got this database installed, and you're looking at it in sqlitebrowser.- How many ports seem to use perl
SELECT COUNT(PKGPATH) FROM Ports WHERE CONFIGURE_STYLE LIKE '%perl%'
- All ports in the graphics category
SELECT DISTINCT PKGPATH FROM Categories WHERE VALUE='graphics'
- Ports that need GMAKE, but not LIBTOOL
SELECT DISTINCT PKGPATH FROM Ports WHERE USE_GMAKE=1 AND USE_LIBTOOL IS NULL
How it works
There's a new introspection mechanism in the ports tree, the target dumpvars
that dumps most variables value to standard output (think of that as an extended describe
but not for human consumption.
The output from dumpvars
is fed into infrastructure/package/mksqlitedb
, a perl script which turns this information into some main table, and does some extra processing for relevant variables (simple object-oriented structure, containing a variable name/class mapping, and using TemplateMethod to handle all kind of variables.
sqlports
port is just the glue that invokes those mechanisms correctly and packages the result.
Design Considerations
People used to mysql or postgresql may wonder about the use of sqlite. Several reasons for that.
- No heavy-weight setup. sqlite uses plain old text files.
- Wide-spread support. All relevant languages have sqlite bindings these days.
- Efficient storage. No need to know how big any field will grow.
I expect that some people will want to create postgresql/mysql
databases anyways, and that they will send me relevant changes to adapt mksqlports
(Comments are closed)
By Jon (85.226.126.231) on
Comments
By Anonymous Coward (207.237.33.34) on
and the target is "dump-vars" not "dumpvars"
Comments
By Anonymous Coward (85.178.68.100) on
>
> and the target is "dump-vars" not "dumpvars"
SQL? Well... lets wait for XML-Stuff wich is the next step in adding much more complexity. ;)
And then we need a PHP-Frontend... and a C++-Application in the background. :-)
Comments
By Anonymous Coward (69.70.207.240) on
> >
> > and the target is "dump-vars" not "dumpvars"
>
> SQL? Well... lets wait for XML-Stuff wich is the next step in adding much more complexity. ;)
>
> And then we need a PHP-Frontend... and a C++-Application in the background. :-)
So what are you waiting for? :-)
By Anonymous Coward (87.78.124.220) on
> >
> > and the target is "dump-vars" not "dumpvars"
>
> SQL? Well... lets wait for XML-Stuff wich is the next step in adding much more complexity. ;)
>
> And then we need a PHP-Frontend... and a C++-Application in the background. :-)
imo sqlite is the best choice for this dataset. changing the storage options is just a diff away.
what to do with the information is secondary.
personaly i use the information to expand my ports build env. great to give the information addicted more to consume..
btw: thx marc! great work.
By corentin (81.56.152.193) on
> >
> > and the target is "dump-vars" not "dumpvars"
>
> SQL? Well... lets wait for XML-Stuff wich is the next step in adding much more complexity. ;)
SQL sucks; querying a database directly in C or Perl is obviously much less complex, right?
The set of requirements is complex (i.e. the ability to do powerful queries on the database), not the implementation (which uses technologies designed for such a task).
By Marc Espie (213.41.185.88) espie@openbsd.org on
- this is infrastructure work. You can reuse dump-vars to do whatever
you want with the variable values. The mksqlitedb script was written over one afternoon. It is very simple work. There's no point in not reusing existing tools.
- Yes, you could store that information into any kind of data structure. After all, you don't create anything that's new. All that info is already in the ports tree.
- We do not intend the ports tree to become dependent upon this tool. This is just simple information that can be used to do other things. Like a web site. I could probably make a simple web site out of this database and HTML::Mason in one day or two. It's really that simple. And there are people out there who will have fun doing this kind of thing.
In all, there is no point in coming up with a smarter design for this. The tools are out there. Why code it again in C or perl ? Again, we're not talking about a basic tool, but about presentation stuff for end-users. Who cares if you need to install sqlite ? It's real fast to compile, and it even has a nice license (public domain).
By Marc Espie (213.41.185.88) espie@openbsd.org on
>
> and the target is "dump-vars" not "dumpvars"
Yes to both. Those are details.
What I meant is, SQLite databases are plain files, not complex
database structures, with holes, directories or devoted partitions.
By Anonymous Coward (69.243.48.238) on