[packagekit] Adding a new INFO enumerated type?

Richard Hughes hughsient at gmail.com
Wed Apr 23 03:10:29 PDT 2008


Currently we have this:

typedef enum {
	PK_INFO_ENUM_INSTALLED			= 1 << 0,
	PK_INFO_ENUM_AVAILABLE			= 1 << 1,
...
} PkInfoEnum;

INSTALLED means "on my hard drive"
AVAILABLE means "on the server, and not on the hard drive"

So when we filter with installed, we just show INSTALLED, and ~installed
we just show AVAILABLE. When there is no filter we just show both.

Now, as onestep pointed out on IRC, you can't re-install packages, as
you don't know whether the INSTALLED package is on the server, or just
installed from local media. Now, personally I never need to reinstall
packages, but I know other systems like synaptic support it, and I don't
want the API in PK to actively /prevent/ it.

So, what I'm suggesting is we either allow PkInfoEnum to be passed as a
bitfield (and fix up all the breakages from functions that expect it to
have a single value) or to add another INFO enum.

I'm erring on the latter, and doing something like this:

typedef enum {
	PK_INFO_ENUM_LOCAL = 1 << 0,
	PK_INFO_ENUM_AVAILABLE = 1 << 1,
	PK_INFO_ENUM_REMOTE = 1 << 2,
...
} PkInfoEnum;

LOCAL means "on my hard drive, not available on the server"
AVAILABLE means "on the server, and on the hard drive"
REMOTE means "on the server, and not on the hard drive"

With this scheme, the installed filter would match on LOCAL and
AVAILABLE, and ~installed would match on REMOTE. No filter would match
all three. (note: a regression/slowdown would be requiring network
access to do installed searching, as we need to know if a package is
still in the repo...)

LOCAL packages would have a remove action, AVAILABLE would have remove,
and re-install action and remote would have install action.

But then again maybe a bitfield might be best. Feedback required.
Thanks.

Richard.





More information about the PackageKit mailing list