You are not logged in.

#1 2016-07-19 17:49:57

JasonX
Member
Registered: 2016-02-28
Posts: 7

Is it possible to query pacman from code?

Hello

I want to make an app that, for example, lists all packages no longer required as dependencies, and shows them in a grid. So

pacman -Qdt

Is it possible to call pacman from code? Lets say from C++.

Offline

#2 2016-07-19 18:00:04

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Is it possible to query pacman from code?

Yes.

popen is a really low level way of doing this natively.  Other solutions are offered by glib and valla


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-07-19 18:08:55

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: Is it possible to query pacman from code?

Or just use libalpm...

Offline

#4 2016-07-19 20:54:14

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Is it possible to query pacman from code?

There's also a Python binding for libalpm named pyalpm.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2016-07-26 15:40:19

JasonX
Member
Registered: 2016-02-28
Posts: 7

Re: Is it possible to query pacman from code?

ewaller wrote:

Yes.

popen is a really low level way of doing this natively.  Other solutions are offered by glib and valla



Popen is exactly what I wanted, Thanks!

Offline

Board footer

Powered by FluxBB