Commit Graph

665 Commits

Author SHA1 Message Date
Matthew Barnes
434a967ab1 daemon: Add "invocation" property to TransactionClass
Move as much as possible out of transaction_new() for the benefit of
subclasses.  The GDBusMethodInvocation property for setting up D-Bus
properties and name watching in the constructed() method.
2015-09-09 22:00:05 -04:00
Matthew Barnes
36c87fb483 daemon: Add a Start() method to transactions
Turns out we do still need a Start() method after all.  Not for lack
of trying, but I can't get away from the client and server doing some
sort of handshake at the beginning to avoid either raciness on the
client side or artificial delays on the server side.

I don't particularly like the "start" signal I've added -- I'd much
prefer subclassing -- but I'm trying to keep the changes incremental.
2015-09-09 22:00:05 -04:00
Matthew Barnes
029a3e5924 daemon: Prepare TransactionClass for subclassing
Expose the instance and class structures, move instance members to a
private structure.  This is also towards having the TransactionClass
follow a template pattern.
2015-09-09 22:00:05 -04:00
Matthew Barnes
a0db1c705f daemon: Have Transaction objects handle sysroot locking
Also, the Transaction holds an OstreeSysroot reference for its duration,
which is convenient for callbacks.
2015-09-09 22:00:05 -04:00
Matthew Barnes
1934d631c0 daemon: Implement GInitableIface in transactions
Towards having the Transaction wrapper class follow a template pattern.
2015-09-09 22:00:05 -04:00
Matthew Barnes
cfc52adfea daemon: Catch systemd journal messages by redirecting stdout
libostree logs messages to systemd's journal and also to stdout.
Redirect our own stdout back to ourselves so we can capture those
messages and pass them on to clients.  Admittedly hokey but avoids
hacking libostree directly (for now).
2015-09-09 22:00:05 -04:00
Matthew Barnes
f1973d7557 daemon: Add ProgressEnd signal to Transaction interface
The ProgressEnd signal indicates to clients there will be no more
DownloadProgress or SignatureProgress signals in the transaction,
and any further Message signals should be output as separate lines
instead of replacing the previous progress message.

In other words, it's just a way of driving GSConsole remotely.
2015-09-09 22:00:05 -04:00
Matthew Barnes
7b8c67fc6a app: Tweak transaction DBus helper function
Take an RPMOSTreeSysroot object instead of a GDBusConnection in
rpmostree_transaction_get_response_sync().  Makes the API slightly
more convenient.
2015-09-09 22:00:05 -04:00
Matthew Barnes
d54f25a9e4 app: Collect D-Bus CLI options into main.c
In the style of ostree's CLI, add some option parsing flags

    RPM_OSTREE_BUILTIN_FLAG_NONE
    RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD

and extend rpmostree_option_context_parse() to handle the --sysroot and
--peer options and return an OstreeSysroot proxy object (unless the flag
RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD is passed).
2015-09-09 22:00:05 -04:00
Matthew Barnes
c57cc38c6e app: Extract GDBusConnection from GDBusProxy
Remove another redundant "out" parameter from DBus helper functions.
Use g_dbus_proxy_get_connection() if the connection object is needed.
2015-09-09 22:00:05 -04:00
Matthew Barnes
7190f7b351 app: Detect peer connection from GDBusConnection
If g_dbus_connection_get_unique_name() returns a name, we're connected
to a message bus.  Otherwise we're connected directly to a peer.

Remove redundant "out" parameters from DBus helper functions.
2015-09-09 22:00:05 -04:00
Matthew Barnes
b6691cbdca daemon: Rework transactions
A few changes:

- Modify the D-Bus API to include a Finish() method instead of a Start()
  method, the idea being the client calls Finish() to obtain the final
  status and optional message once the transaction indicates it's done.
  Calling Finish() also removes the transaction object from the bus.

- Introduce Transaction class as a thin wrapper for RPMOSTreeTransaction.
  Stores the status info for Finish(), detects when the caller's bus name
  vanishes, and emits various status signals to TransactionMonitor.

- Introduce TransactionMonitor as a factory class for Transactions that
  also handles book keeping chores like tracking the active Transaction.
  The Sysroot and OS interfaces share a TransactionMonitor instance.
2015-09-09 22:00:05 -04:00
Matthew Barnes
463d3676ea daemon: Miscellaneous cleanups 2015-09-09 22:00:05 -04:00
Matthew Barnes
a4be570c62 docs: Add generated D-Bus interfaces 2015-09-09 22:00:04 -04:00
Matthew Barnes
915b78e2aa daemon: Startup modifications 2015-09-09 22:00:04 -04:00
petervo
23cfdf29b6 daemon: Track active transaction 2015-09-09 22:00:04 -04:00
petervo
f525730187 daemon: Make parts of cli use the daemon 2015-09-09 22:00:04 -04:00
petervo
0114507865 daemon: Start implementing transaction methods 2015-09-09 22:00:04 -04:00
petervo
075d6bdad0 daemon: Implement package diff methods 2015-09-09 22:00:04 -04:00
petervo
a140c26200 daemon: OS properties and property updates 2015-09-09 22:00:04 -04:00
Matthew Barnes
c6548ace61 daemon: Half-implement the Upgrade() command
This isn't finished yet but it shows the direction I'm going and some
issues I'm encountering.

The CLI layer has 3 different versions of upgrade now:

  1) If --check-diff is given, execute it locally regardless of sysroot.
     I'm not convinced this variation needs to be executed in the daemon,
     but if it does we need a separate D-Bus method since it produces
     different results.

  2) Else if --sysroot is not "/", execute it locally.  I don't think
     the daemon currently indicates what sysroot it's operating on, and
     even if it did I'm not sure the CLI should be talking to anything
     but the "/" daemon.

  3) Else if --sysroot is "/", defer to the daemon.

Obviously there's a lot of unwanted code duplication going on here.
I'd like to factor out the common parts and put them in libpriv for
reuse, but I'm also trying to preserve the CLI behavior and all the
various g_print() calls are causing a problem.

I was toying with the idea of adding a "message" signal to
OstreeAsyncProgress for miscellanous status messages.  Those signals
could then be handled by either printing the message to stdout or
transmitting it over D-Bus via the Transaction object.

Some of those g_print() messages could then be moved directly into
the common libpriv functions and handed off to OstreeAsyncProgress.
2015-09-09 22:00:04 -04:00
Matthew Barnes
0b89d54bb0 daemon: Add GetOS() method to Sysroot interface
Returns the object path for the given OS name.

This can be done entirely client side, but it requires connecting to
the object manager interface, requesting all the objects and sifting
through them to find the one with a matching Name property.

For some use cases this method is just more convenient.
2015-09-09 22:00:04 -04:00
Matthew Barnes
b4db4a1621 daemon: Some D-Bus API tweaks
Trying to get the Update() method working end-to-end, and figuring out
all the status reporting around it.
2015-09-09 22:00:04 -04:00
Matthew Barnes
89e41eb8db daemon: Integrate download progress into new_transaction() 2015-09-09 22:00:04 -04:00
Matthew Barnes
84dbd934b5 daemon: Add callback stubs for OS methods 2015-09-09 22:00:04 -04:00
petervo
d332175bb3 daemon: Ensure os names are relative to deploy dir 2015-09-09 22:00:04 -04:00
petervo
19fde3a50a daemon: Start of sysroot interface implementation 2015-09-09 22:00:04 -04:00
petervo
8b283656b6 daemon: Dbus setup
Brings in auth, errors and path building functions
2015-09-09 22:00:04 -04:00
petervo
94efc7bb77 daemon: Publishing and unpublishing interfaces 2015-09-09 22:00:04 -04:00
petervo
950fcf7a99 daemon: deployment utils
Adds a gvariant representation of a deployment
2015-09-09 22:00:04 -04:00
Matthew Barnes
c2e19fb39e daemon: Add deployment_generate_id() to utils 2015-09-09 22:00:04 -04:00
Matthew Barnes
8f5993e220 daemon: Add factory function for Transaction objects
Creates, configures and exports an RPMOSTreeTransaction object from a
GDBusMethodInvocation.  The interface is exported relative to the object
path on which the D-Bus method was called.
2015-09-09 22:00:04 -04:00
Matthew Barnes
0774249b81 daemon: Add "Method" property to Transaction object 2015-09-09 22:00:04 -04:00
Matthew Barnes
d6a48feb7a daemon: Handle bus name acquisition in main.c 2015-09-09 22:00:04 -04:00
Matthew Barnes
2f5057a022 daemon: Make the Daemon instance global in main.c
Just easier than passing it around to callbacks.
2015-09-09 22:00:04 -04:00
Colin Walters
a435dea27a daemon: Flesh out new API
Peter, Matthew and I talked for a while and came up with this.
2015-09-09 22:00:04 -04:00
petervo
c0d15a66ad daemon: Start of work on daemon 2015-09-09 22:00:04 -04:00
Colin Walters
a18e85cad1 libtest: Use exit code 77 for root-requiring tests run as non-root
This is the "standard" introduced by Automake and used by g-d-t-r.
2015-09-08 12:20:28 -04:00
Colin Walters
da88e60241 spec: Drop no longer needed config arguments 2015-08-31 17:21:51 -04:00
Colin Walters
8d2787640a Release 2015.9 2015-08-26 12:21:43 -04:00
Colin Walters
60ed86228f compose: Don't do container stuff if we're in a container already
This helps avoid some failures.  See:
fbdb15cd95
2015-08-24 16:16:52 -04:00
Matthew Barnes
fb7e491dfe Bump GIO requirement to 2.40 to match ostree 2015-08-14 12:22:45 -04:00
Colin Walters
07310f4f1d Merge pull request #164 from cgwalters/composetree-requires-root
compose: Require being run as root
2015-08-03 16:11:12 -04:00
Colin Walters
2b4a90c39d Merge pull request #165 from cgwalters/cacheage
compose: Fix "too old" error for "old" file:/// repos
2015-08-03 16:10:54 -04:00
Colin Walters
53ab54db8c libglnx: Bump to pull in rhel6 container fix 2015-07-28 16:43:12 -04:00
Colin Walters
6daf713d8e compose: Fix "too old" error for "old" file:/// repos
Bodhi points rpm-ostree at the "gold" Fedora repo via `file:///`, and
libhif is brokenly checking the mtime on `file://` repos.

Work around that here by just ignoring cache ages, because at present
we don't actually cache really - we drop the RPMs in the tempdir.

(Long term having actual caching of the RPMs would be nice, but
 we can revisit this when we get there)

Closes #156
2015-07-24 16:28:52 -04:00
Colin Walters
5f8fdc7940 compose: Require being run as root
Someday we'll enhance RPM; see
https://github.com/rpm-software-management/rpm/issues/8

But anyways right now at least a few people have tried,
and we get all the way past downloading packages and then bomb
out when doing the actual transaction with a useless error
message.

So let's be up front about this.
2015-07-23 22:14:54 -04:00
Colin Walters
ebb5dbce6e Merge pull request #163 from cgwalters/repos-notfound
compose: Error out if specified repositories aren't found
2015-07-22 18:43:11 -04:00
Colin Walters
536cec3a53 compose: Error out if specified repositories aren't found
This is being friendly for configuration errors.  The failure mode
here of not finding repos and silently continuing was quite bad.
2015-07-22 16:46:09 -04:00
Colin Walters
e60a5900d3 Merge pull request #161 from miabbott/cmd_order
Sort subcommands alphabetically
2015-07-15 15:04:56 -04:00