Commit Graph

1350 Commits

Author SHA1 Message Date
Colin Walters
c8744beb17 Update libgsystem
And while we're here, also update the TODO slightly.
2013-09-11 08:28:09 -04:00
Colin Walters
27b46cb45c libostree: Fix compiler warning 2013-09-10 12:25:13 -04:00
Colin Walters
4f236ebc1b checkout: Add g_prefix_error() around more failures
So we can debug what's going wrong more easily.
2013-09-10 12:21:04 -04:00
Jasper St. Pierre
fb1e140dba repo: Make the optimization for reusing checksums clearer
The code here is a bit hard to understand, so make it clearer by cleaning
up the flow control and adding some comments.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-09 23:00:41 -04:00
Jasper St. Pierre
223bccf2f6 repo: Make read_commit spit out a resolved commit ref as well
read_commit resolves the ref to a commit, and a lot of consumers want
the resolved commit for their own purposes; this prevents them from
calling resolve_rev themselves.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-09 22:58:39 -04:00
Jasper St. Pierre
6b4ef97c18 repo-libarchive: Apply commit modifiers to libarchive archives as well
And document the libarchive methods as well, so we can pass a NULL
commit modifier.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-09 22:51:43 -04:00
Jasper St. Pierre
c7f9fc9c63 repo: Change the pairs of checksums to instead be based on OstreeRepoFiles
We want an OstreeRepoFile to be the way to reference a "filesystem
tree" that's stored in the repo, which is a combination of a DIR_TREE
and a DIR_META. The idea is that once you write an mtree to the repo
using ostree_repo_write_mtree, it becomes serialized and you get an
OstreeRepoFile in return.

Change any APIs that care about DIR_TREE / DIR_META checksums to care
about OstreeRepoFiles instead, which right now is mostly is
ostree_repo_write_commit.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-09 22:51:33 -04:00
Jasper St. Pierre
33db74d0ce repo-file: Base OstreeRepoFile on trees instead of commits
We want an OstreeRepoFile to be the way to represent a filesystem tree
inside an ostree repository. In order to do this, we need to drop the
commit from an OstreeRepoFile, and make that go to callers.

Switch all current users of ostree_repo_file_new_root to
ostree_repo_read_commit, and make the actual constructor private.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-09 22:31:59 -04:00
Colin Walters
ac2d61dd51 core: Add detached metadata, readd metadata to commits
Previously I thought we'd have to ditch the current commit
format to avoid a{sv} due to

See https://bugzilla.gnome.org/show_bug.cgi?id=673012

But I realized that we don't really have to care about
unpacking/repacking commit objects, so let's just re-expose the
existing metadata a{sv} in commits in the API.

Also, add support for "detached" metadata that can be updated at any
time post-commit.  This is specifically designed for GPG signatures.

https://bugzilla.gnome.org/show_bug.cgi?id=707379
2013-09-09 17:01:32 -04:00
Colin Walters
b4b700c163 Update libgsystem
Now with new shiny implementation of gs_shutil_rm_rf().
2013-09-09 16:06:51 -04:00
Vivek Dasmohapatra
f802822034 pull: ref the thread default main context during init, unref in cleanup
...get_thread_default returns NULL when the thread default is also the global
default, so this only shows up when running in a thread (eg g_task_run_in_thread)
2013-09-09 12:06:01 -04:00
Colin Walters
3ff4b1874c core: Use openat() for reading bare file objects too
...unless we want xattrs, in which case we have to fallback to path
lookup due to lack of llistxattrat().

This looks nicer in strace.
2013-09-08 19:31:44 -04:00
Colin Walters
a071a3ec3a core: Delete unused OstreeRepoFile API
Was just unused, and it was using further API i want to remove.
2013-09-08 16:49:21 -04:00
Colin Walters
d863ef5838 repo: Delete leftover repo/pending dir
This is a relic from long ago when we were trying to stage objects
before finally committing them all in one go in the pull code.

We're no longer doing that, so stop trying to make the directory.
This also fixes trying to use ostree as non-root to read the
root-owned repo, since we'd fail to create the pending dir.
2013-09-08 15:04:35 -04:00
Colin Walters
33e589c018 core: Use at-relative functions for checking out tree copies too
For the cases where we can't hardlink, use at-relative walking of the
path where possible.  We still don't have lsetxattrat, so we also need
to deal with pathnames, but that is now only for symlinks.

Again, the advantages of this are a lot less malloc() of pathnames in
ostree, and much less time spent traversing paths inside the kernel.

https://bugzilla.gnome.org/show_bug.cgi?id=707733
2013-09-08 14:42:50 -04:00
Colin Walters
0c2ea54e68 core: Make ostree_set_xattrs() private
Nothing external uses it.  We keep ostree_get_xattrs_for_file() public
because it's convenient for external consumers to get xattrs in
exactly the format we desire.

https://bugzilla.gnome.org/show_bug.cgi?id=707733
2013-09-08 14:41:51 -04:00
Colin Walters
27c3e7884e core: Make write_object() a bit more efficient
Do as many operations as we can using the original file descriptor
while we have it open, rather than writing, closing, then reopening.

This necessitated very explicitly special casing symbolic links,
mainly due to the lack of lsetxattrat().

https://bugzilla.gnome.org/show_bug.cgi?id=707733
2013-09-08 14:40:52 -04:00
Colin Walters
9846fb27fd core: Use linkat() for hardlink checkouts too
Clean up how we deal with the uncompressed object cache; we now use
openat()/linkat() and such just like we do for the main objects/.

Use linkat() between the objects and the destination, if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=707733
2013-09-08 14:40:09 -04:00
Jasper St. Pierre
db148cc9ba repo: Make the body parameter to ostree_repo_commit optional
https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-08 11:50:51 -04:00
Jasper St. Pierre
1f8db2a873 repo: Drop the branch parameter from ostree_repo_commit
It's unused. Make users explicitly write a ref if they want this;
high-level convenience API will be introduced later.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-08 11:50:51 -04:00
Jasper St. Pierre
f49ed9e74d builtin-commit: Don't parse the parent's GVariant by hand
Instead, use OstreeRepoFile as a handle for the parent commit.
We need to add an accessor for the metadata checksum, as that
hasn't been exposed before.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-08 11:50:51 -04:00
Jasper St. Pierre
8ac0f99ed6 repo-file: s/content_checksum/contents_checksum/
This is what we call it everywhere else, so just be consistent.
It also lines up with metadata_checksum better.

https://bugzilla.gnome.org/show_bug.cgi?id=707727
2013-09-08 11:50:51 -04:00
Colin Walters
75225166da repo: Fix file descriptor leak from previous commit
I keep forgetting mmap doesn't take ownership of the fd.
2013-09-08 10:41:18 -04:00
Colin Walters
5a685ff989 core: Use at-relative lookups for archive-z2 content
We can't quite do it for bare repositories yet because we need to have
a way to go from struct stat -> GFileInfo, and that's buried in gio's
private GLocalFile class.
2013-09-07 10:10:21 -04:00
Colin Walters
d2c6e19278 core: Use at-relative lookups for metadata reading
Just use openat() for locating variants, rather than doing the lstat()
+ open().  This also drops several malloc+object allocations from the
lookup path.
2013-09-07 05:03:48 -04:00
Colin Walters
b97249d4f9 core: Use at-relative lookup for locating objects too
Add new internal API to both fstatat() and write a pathname for the
given object.  Use it in commit, and also wrapped in the old
GFile-based API.

This is more efficient.
2013-09-07 04:47:40 -04:00
Colin Walters
a7c0992d94 core: Add malloc-free API for objects, use *at functions for storing
This is more efficient; we avoid malloc of a number of pathname +
GFile objects, plus the kernel doesn't have to traverse the repo path
again.
2013-09-07 04:18:41 -04:00
Jasper St. Pierre
2506e8fb26 repo: Make commit_transaction introspectable 2013-09-07 01:46:50 -04:00
Jasper St. Pierre
3dcff0b2c4 Fix build
Before I pushed the "move code to a different file" commit, I rebased,
but forgot to test the build. Sorry.
2013-09-06 20:47:13 -04:00
Jasper St. Pierre
91d3b90c9f Move ref writing to be transaction-based
Rather than having separate write_ref calls, make clients start a
transaction, add some refs, and then commit it. While this doesn't
make it 100% atomic, it makes it easier for us to use an atomic
model, and it means we don't do as much I/O updating the summary
file and such.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:31:12 -04:00
Jasper St. Pierre
bd2948e964 repo: Move the scanning hardlinks optimization out of prepare_transaction
This is just a terrible API to have. Make the scanning a separate method,
and document it as an optimization.
2013-09-06 20:31:12 -04:00
Jasper St. Pierre
f84504a8c4 repo: Make abort_transaction silently succeed if we're not in a transaction
This helps callers out a lot, and means we can always call abort_transaction
at the end of a function.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:31:12 -04:00
Jasper St. Pierre
ef61724269 repo: Move the transaction stats to a separate struct
This is much easier for callers to handle, and simplifies
the API a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:31:12 -04:00
Jasper St. Pierre
5082e1d8e9 repo: Rename "stage" to "write" in the API
An earlier version of this API acted like git in that some objects
would be staged in a temporary directory which would be then committed
in one go by moving files around. The API doesn't match most users
expectations though, as while the stage is nice as a high-level API
it isn't really suited for low-level APIs.

While the stage was removed, the APIs were never renamed. Rename
them now so that they match expectations.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:31:12 -04:00
Jasper St. Pierre
c817217ad8 repo: Move commit code to another file
ostree-repo.c is a bit too big, and most of the commit code is
fairly standalone.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:31:11 -04:00
Jasper St. Pierre
89f4817bdf repo: Make prepare_transaction introspectable
We need to document the out pointer as an out pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:28:42 -04:00
Jasper St. Pierre
b36e61f813 repo: Make OSTreeCommitModifier introspectable
Callbacks need GDestroyNotifies to be usable from bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:28:42 -04:00
Jasper St. Pierre
f5f7fe5e9a repo: Make the ordering consistent between abort/complete_transaction
This just makes the functions nicer to stare at.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
2013-09-06 20:28:42 -04:00
Colin Walters
4dcf1a4282 core: When using hardlinks, always use linkat() for destination
This avoids repeatedly traversing the target pathname, and is just
more efficient.

Part of a prelude to using fd-relative API for the source object path
too.
2013-09-06 18:45:41 -04:00
Colin Walters
2b61caa2fe core: Use fd-relative creation for tmp/
Update libgsystem submodule for a bugfix.

This is both more efficient from a kernel perspective, and avoids us
calling gs_file_get_path_cached() on tmp_dir constantly, which
triggered another bug due to lack of locking.
2013-09-06 18:45:16 -04:00
Jasper St. Pierre
249add9c94 Update .gitignore 2013-09-05 18:18:54 -04:00
Jasper St. Pierre
93a611ff6d Update docs 2013-09-05 17:59:02 -04:00
Jasper St. Pierre
02adfc8c03 repo: Rename ostree_repo_check to ostree_repo_open
As it more clearly describes what the function does: load the
repo from disk and initialize it.

At the same time, add a cancellable parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=707582
2013-09-05 14:07:03 -04:00
Jasper St. Pierre
57d285f619 repo: Move the 'init' builtin command to a public API, ostree_repo_create
This continues the goal of making more of ostree accessible by API,
rather than forking out to subprocesses.

https://bugzilla.gnome.org/show_bug.cgi?id=707582
2013-09-05 14:07:03 -04:00
Jasper St. Pierre
eb6f017ef8 repo: Use constructed, not constructor
It's simpler to do this after the object is constructed, rather
than in the middle of construction.

https://bugzilla.gnome.org/show_bug.cgi?id=707582
2013-09-05 13:54:36 -04:00
Jasper St. Pierre
33f232f76c Update .gitignore 2013-09-05 00:21:05 -04:00
Colin Walters
8a59f6561c main: Call setlocale()
While we're not translating anything right now, we should still
setlocale() so that our output is formatted as command line users will
expect.
2013-09-04 16:45:51 -04:00
Colin Walters
1ae83002b5 core: Delete unused prototype 2013-09-04 08:22:13 -04:00
Colin Walters
eeb1f9e07b core: Delete unused ostree_create_temp_dir() API
Nothing was using it.  Poof.  Gone!
2013-09-04 08:18:45 -04:00
Colin Walters
36815f52b5 libostree: Move file creation APIs out of core, into checkout.c
Since this was the only user, let's not have generic code to go from
OSTree representation -> filesystem here.  It should live in checkout.
2013-09-04 08:17:42 -04:00