Commit Graph

2198 Commits

Author SHA1 Message Date
Colin Walters 2f878afc02 doc: Note that refs --delete does not prune 2015-09-28 15:49:38 -04:00
Matthew Barnes 0b795785dd pull: Recover from missing commits in recursive pulls
When traversing parents, do not fail on a missing commit.  We may
be pulling from a partial repository that ends in a dangling parent
reference.
2015-09-25 11:07:28 -04:00
Colin Walters bab6503b69 sysroot: Cleanup refs and prune even on last undeployment
I was working on a different test, and ended up being very confused at
the behavior where removing the last deployment didn't remove the last
`ostree/X/X/X` ref pointing to its commit.

There's no reason to special case the last undeployment AFAIK, and the
existing code handles this.
2015-09-24 12:25:23 -04:00
Matthew Barnes e21188a245 fetcher: Track outstanding requests with a table
Track outstanding HTTP requests in a table for easier debugging.

Also fixes a bug discussed in https://bugzilla.gnome.org/755224
where the outstanding request counter was not decremented in the
event of an error, which could result in the fetcher hitting its
max request limit and locking up.

The bug is fixed by removing the request struct from the table in
pending_uri_free(), which is always called regardless of error,
so the outstanding request count is always accurate.
2015-09-24 10:01:01 -04:00
Matthew Barnes 771075d319 fetcher: Rework reference counting
Have OstreeFetcherPendingURI be the GTask's task_data and pass the GTask
around in queues and callback closures.  The reference counting before
was a little confusing and this helps clarify it, at least to me.

OstreeFetcherPendingURI no longer needs its own reference count.
2015-09-23 19:52:42 -04:00
Matthew Barnes 330a99c40b fetcher: Convert from GSimpleAsyncResult to GTask
Obsessive compulsive cleanup.
2015-09-23 19:52:10 -04:00
Matthew Barnes df4865e395 fetcher: Remove message_to_request table
Does not appear to be needed, no lookups on the table.
2015-09-23 13:50:50 -04:00
Colin Walters bb14a336c2 Release 2015.9 2015-09-23 12:10:22 -04:00
Gatis Paeglis 1181833e79 Remove unused variables 2015-09-23 08:39:01 -04:00
Leandro Santiago c61151d650 Mutable is a keyword in C++11
This fix allows including OSTree on C++ projects.
2015-09-23 08:29:35 -04:00
Matthew Barnes ed86160975 pull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY
https://bugzilla.gnome.org/755224
2015-09-22 15:16:42 -04:00
Matthew Barnes 203d6ea65e repo: Fix build without libsoup
Had a rare situation where I had no libsoup development files, so I
took the opportunity to fix the build errors.  Ugly, but works now.

Would be nice if libsoup could be a hard dependency since we rarely
ever test a configuration without it.
2015-09-21 16:31:02 -04:00
Matthew Barnes 055b3aac32 reset: Simplify argument checking logic 2015-09-17 12:29:14 -04:00
Matthew Barnes 3267267115 libglnx: Update from master
Pick up PATH change for glnx_libcontainer_run_chroot_private().
2015-09-16 14:19:05 -04:00
Matthew Barnes 36d65b3cfc deploy: Do not prune repository
To support deploying older commits:

  ostree pull <remote> <checksum>
  ostree admin deploy <checksum>

Prior to this, the deploy command garbage collected <checksum> since
there's no ref pointing to it, and then ostree_sysroot_deploy_tree()
fails because it can't find the <checksum> commit.

https://bugzilla.gnome.org/732526
2015-09-16 09:23:37 -04:00
Matthew Barnes b0bd16ec11 sysroot: Add ostree_sysroot_prepare_cleanup()
New public function works like ostree_sysroot_cleanup() EXCEPT FOR
pruning the repository.

Under the hood, add _ostree_sysroot_piecemeal_cleanup() which takes
flags to better control what files are cleaned up.  Both public cleanup
functions are now wrappers for _ostree_sysroot_piecemeal_cleanup() with
different flags.
2015-09-16 09:23:37 -04:00
Alexander Larsson fd6c572c42 _ostree_static_delta_part_validate: Take a stream instead of a file as arg
This is only called in one place, and we have already opened the file there,
no need to open it twice.
2015-09-13 22:25:21 -04:00
Colin Walters 27fcf68e7c tests: Add a test for static-delta apply-offline
Obviously it was broken...
2015-09-13 22:23:56 -04:00
Alexander Larsson 1ee4007a75 offline delta apply: Handle the version field
It seems the format changed and this code was not updated.
2015-09-13 22:23:56 -04:00
Matthew Barnes 2233d443e7 commit: Clarify reasoning for "commit-update-summary" default
In case anyone else gets the idea of changing the default for archive-z2
repos.  Should have the rationale captured in the source code somewhere.
2015-09-11 13:19:01 -04:00
Giuseppe Scrivano bddb25f79e pull: honor gpg-verify-summary=false when a summary signature is present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-09-10 08:59:01 -04:00
Colin Walters 84fe2ffb2b pull: Go back to using one main context
xdg-app was hanging for me with v2015.8, but worked with v2015.7.
I narrowed things down to the GMainLoop/context commit, in which
we started pushing a temporary main context for synchronous
requests internally.

That's never really going to work with libsoup - there needs
to be a single main context which works on the socket.  Furthermore,
clients couldn't get progress messages that way.

For *other* internal uses where we added APIs that talk to the remote
repo, we cleanly push a temporary main context.

(Note that I kind of snuck in a change here around the GError handling
 in pulls that isn't strictly related but came up in testing)
2015-09-01 14:39:24 -04:00
Colin Walters ef56321354 pull: Only fetch all refs if we're mirroring
I noticed xdg-app was looping trying to fetch 1427 refs.  We
don't want to do that unless asked to.

(And also, we need to make static delta requests async)
2015-08-31 22:59:08 -04:00
Colin Walters 0110183675 fetcher: Use 0666 (-umask) for temporary files
There's no reason to keep them hidden.  I have a hard policy that
OSTree should *not* be used to carry secrets.  Things like host ssh
private keys should be set up out of band by an OS-external
configuration mechanism such as kickstart, cloud-init, etc.

We also assume that hiding binaries is not very useful as most
attackers would be able to find them on the Internet or (for
subscribed content) acting as a customer.

This fixes a bug with mirroring because we changed to take the
unmodified upstream objects rather than uncompress <-> recompress.

https://bugzilla.gnome.org/show_bug.cgi?id=748959
2015-08-27 11:36:48 -04:00
Colin Walters 5a4b87b168 Release 2015.8 2015-08-26 16:54:20 -04:00
John Hiesey 153f092d51 static-delta: assert on non-regular files
Now that the computed similar objects are all regular files,
get_unpacked_unlinked_content should never be called on any other
object type. Assert that this is true instead of silently succeeding.
2015-08-26 16:25:28 -04:00
John Hiesey 43d045309c static-delta: Ignore symlinks when computing similar objects
_ostree_delta_compute_similar_objects should not output symlinks.
Previously, a symlink in the "from" commit could be matched to a
real file in the "to" commit, since nothing was filtering symlinks
on the "from" side. This led to failures running the bzdiff
algorithm.
2015-08-26 16:25:28 -04:00
Dan Nicholson 4f57aa5b15 tests: Build test-lzma with LZMA flags
test-lzma builds a copy of the compressor and decompressor directly, so
the compiler needs access to the LZMA headers and the linker needs to
link the program with liblzma.
2015-08-26 15:20:42 -04:00
Jasper St. Pierre 8e8bfa8708 Update .gitignore 2015-08-26 12:16:29 -07:00
Jasper St. Pierre 20647edcbf repo-pull: Add a queue for scanning
On systems with slow disks, the recursive scanning of directories can
be expensive -- it takes upwards of 2 minutes on our systems. This can
block the main loop for such a long time that it allows the download to
time out...

As such, move all the scanning of objects to a queue, processed from
an idle, to make sure that we don't block the main loop when scanning.

https://bugzilla.gnome.org/show_bug.cgi?id=753336
2015-08-26 12:15:38 -07:00
Giuseppe Scrivano 863f5d8598 tests: Add tests for rollsum 2015-08-25 09:27:56 -04:00
Colin Walters b89326ac41 rollsum: Fix assertion for CRC matches
It's possible for two blocks to have the same CRC but different
length.  Rather than asserting, treat them as not matching.
2015-08-25 09:26:22 -04:00
Giuseppe Scrivano 9b9f4b04b4 tests: rename test-rollsum to test-rollsum-cli
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-08-24 11:07:36 +02:00
Colin Walters 9f3d586993 pull: Stop using GMainLoop
First of all, what we were doing with having GMainLoop in the internal
APIs is wrong.  Synchronous APIs should always create their own main
context and not iterate the caller's.  Doing the latter creates
potential for evil reentrancy issues.  Sync API should block, async
API is for not blocking.

Now that's out of the way, fix the pull code to do the clean

```
while (termination_condition (state))
  g_main_context_iteration (mainctx, TRUE);
```

model for looping.  This is a lot easier to understand and ultimately
more reliable than having other code call `g_main_loop_quit()`, as the
loop condition is in exactly one place.

We can also remove the idle source which only fired once.

Note we have to add a hack here to discard the synchronous session and
create a new one which we only use async.

https://bugzilla.gnome.org/show_bug.cgi?id=753336
2015-08-13 22:02:00 -04:00
Colin Walters 5c20ea920e sysroot: Add an unload() API
This will be used by gnome-continuous at least to drop the reference
to the fd so that unmounting can proceed.  See
https://git.gnome.org/browse/gnome-continuous/commit/?id=95e9910ea288d302509ca667e0d190dd89377dd5
2015-08-13 12:43:14 -04:00
Giuseppe Scrivano 3861b79efd tests: add tests for LZMA compressor and decompressor
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-08-12 07:55:50 +02:00
Jasper St. Pierre 3c152fb38b Update .gitignore
https://bugzilla.gnome.org/show_bug.cgi?id=753336
2015-08-08 21:53:43 -04:00
Giuseppe Scrivano 75cdbb8e82 tests: skip tests using gjs/parallel if they are not installed
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes #131
2015-08-05 10:58:00 -04:00
Giuseppe Scrivano 8b9effea56 tests: add tests for --disable-bsdiff and --max-bsdiff-size
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-29 17:34:21 -04:00
Colin Walters cd6eac2ce9 README: Attempt to flesh out more, start moving docs from wiki
I'd like to migrate content from the GNOME wiki, as frankly the wiki
is crap.  Markdown in git is better in every way.

Start by fleshing out the README.md to be more useful.
2015-07-28 18:39:43 -04:00
Jasper St. Pierre 8034a3842b Update .gitignore
https://bugzilla.gnome.org/show_bug.cgi?id=752950
2015-07-28 14:23:02 -04:00
Cosimo Cecchi a5f266f25d repo: don't forget to abort the transaction when failed
ostree_repo_prepare_transaction() should always be matched with a call
to either ostree_repo_commit_transaction() or
ostree_repo_abort_transaction().

Since ostree_repo_pull_with_options() does not call
ostree_repo_abort_transaction() on errors, the OstreeRepo instance will
hit an assertion when it's re-used later for another attempt, such as
when the update is driven by an external component through libostree and
network temporarily goes down.

This commit simply always calls ostree_repo_abort_transaction() in the
exit path of ostree_repo_pull_with_options(), since the function is safe
to call even when we're not in a transaction, and that matches e.g. what
ostree-sysroot-cleanup.c does.
2015-07-28 11:35:42 -04:00
Cosimo Cecchi 939a7aebfb repo: fix an incorrect comment 2015-07-28 11:35:33 -04:00
Giuseppe Scrivano b7063ed1ae static-delta: add max-bsdiff-size option
It allows to specify the maximum size for input files to attempt
bsdiff compression for.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-28 13:02:27 +02:00
Giuseppe Scrivano cac92f62c4 static-delta: do not fail compilation with big files
Just skip the bsdiff compression instead of failing the operation.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-28 12:28:25 +02:00
Giuseppe Scrivano 11ba9056ea pull: new option --commit-metadata-only
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-24 12:43:35 -04:00
Giuseppe Scrivano 56f0ae6a4a repo: new function _ostree_preload_metadata_file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-24 12:37:42 -04:00
Giuseppe Scrivano 783e83c62c repo: merge repo_remote_fetch_summary_{metalink,url}
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-24 12:37:42 -04:00
Giuseppe Scrivano 133fb5ffdc libostree: new API ostree_repo_remote_list_refs
The new API permits to query a remote repository summary file and
retrieve the list of available refs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-24 12:37:42 -04:00
Giuseppe Scrivano a917c96976 tests: do not commit from the working directory
It fixes this problem:

```
error: Not a regular file or symlink: S.gpg-agent
```

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-21 10:02:30 -04:00