querying the registry for installed files

René J.V. Bertin rjvbertin at gmail.com
Mon Oct 31 01:20:28 PDT 2016


On Friday October 28 2016 21:34:32 Vincent Habchi wrote:

Hi,

>> sqlite> WITH i AS (SELECT id FROM files WHERE path LIKE exp GROUP BY id) SELECT name FROM ports, i WHERE ports.id = i.id;

This works great, and as expected *much* faster than any other method one could think of currently. Ideally one would find a means to input standard regexps for the pattern. And I'd probably also want to print some more information about the results to avoid printing just the port name as many times as you have versions/variants installed.  But that could also be achieved by running the output through uniq (or sort -u) and then into `port installed`).

%> /opt/local/bin/sqlite3 /opt/local/var/macports/registry/registry.db 
SQLite version 3.14.2 2016-09-12 18:50:49
Enter ".help" for usage hints.
sqlite> WITH i AS (SELECT id FROM files WHERE path LIKE '%reator%' GROUP BY id) SELECT name FROM ports, i WHERE ports.id = i.id;
db48
qt5-creator-devel
qt5-creator
py34-pyqt5
qt5-kde-devel-zz-docs
kf5-breeze-icons
kf5-kio
kf5-kdelibs4support
kf5-kdevelop-devel
qt5-kde-devel
qt5-kde-devel
kf5-kio
kf5-kdelibs4support
kf5-breeze-icons
kf5-kdevelop-devel
kf5-marble
kf5-kio-extras
kf5-kdevelop-devel
kf5-okteta
kf5-kdevelop-devel

>Oh, if you want the files, a simple
>
>SELECT path FROM ports WHERE path LIKE exp; 

This however does not work:

%> /opt/local/bin/sqlite3 /opt/local/var/macports/registry/registry.db
SQLite version 3.14.2 2016-09-12 18:50:49
Enter ".help" for usage hints.
sqlite> SELECT path FROM ports WHERE path LIKE '%reator%';
Error: no such column: path

R.


More information about the macports-dev mailing list