ostree.git
10 years agolibostree: add new API ostree_repo_write_commit_with_time
Giuseppe Scrivano [Mon, 9 Nov 2015 10:16:55 +0000 (10:16 +0000)]
libostree: add new API ostree_repo_write_commit_with_time

It extends ostree_repo_write_commit as it permits to override the
commit timestamp.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree: do not print the usage on each G_IO_ERROR_NOT_SUPPORTED
Giuseppe Scrivano [Fri, 6 Nov 2015 11:06:26 +0000 (12:06 +0100)]
ostree: do not print the usage on each G_IO_ERROR_NOT_SUPPORTED

It may have a different meaning, and the usage screen is not helpful.

Print the usage screen only when the command is not found.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: make slightly clearer when failing for missing xattrs support
Giuseppe Scrivano [Fri, 6 Nov 2015 10:47:15 +0000 (11:47 +0100)]
pull: make slightly clearer when failing for missing xattrs support

It is not clear why pull fails on tmpfs.  The additional message might
be helpful.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add --keep-younger-than=DATE
Giuseppe Scrivano [Fri, 6 Nov 2015 08:50:17 +0000 (09:50 +0100)]
prune: add --keep-younger-than=DATE

The format used for DATE is "%Y-%m-%d %H:%M:%S %z"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add test for ostree prune --delete-commit
Giuseppe Scrivano [Thu, 5 Nov 2015 12:34:00 +0000 (13:34 +0100)]
tests: add test for ostree prune --delete-commit

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agofsck: create a tombstone when the parent is missing
Giuseppe Scrivano [Thu, 5 Nov 2015 14:18:39 +0000 (15:18 +0100)]
fsck: create a tombstone when the parent is missing

Change the previous logic that a tombstone commit was created when
a partialcommit is found.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add --delete-commit
Giuseppe Scrivano [Thu, 5 Nov 2015 12:28:37 +0000 (13:28 +0100)]
prune: add --delete-commit

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: Fix a couple compiler warnings
Matthew Barnes [Thu, 12 Nov 2015 19:32:07 +0000 (14:32 -0500)]
libostree: Fix a couple compiler warnings

10 years agodeltas: Support including detached metadata in static deltas
Alexander Larsson [Mon, 19 Oct 2015 08:10:50 +0000 (10:10 +0200)]
deltas: Support including detached metadata in static deltas

This is very useful for the inline-parts case, as you can then include
detached signatures in a single file representing the commit.

It is not as important for the generic pull case, as the detached
metadata is only a single small file. Additionally the detached
metadata is not content referenced and may change after the static
delta file was created, so we need to pull the latest version anyway.

10 years agopull: Verify checksums from static deltas unless gpg signed summary
Alexander Larsson [Mon, 19 Oct 2015 07:23:52 +0000 (09:23 +0200)]
pull: Verify checksums from static deltas unless gpg signed summary

Otherwise untrusted repos can lie about the commit ids.

10 years agodeltas: Support passing filename to ostree_repo_static_delta_execute_offline
Alexander Larsson [Fri, 16 Oct 2015 10:54:01 +0000 (12:54 +0200)]
deltas: Support passing filename to ostree_repo_static_delta_execute_offline

If you pass a diriectory it will look for the "superblock" child, otherwise
it will use the file as the superblock. I need this in xdg-app to be able
to install any filename as a bundle.

10 years agodeltas: Support passing filename to delta generator
Alexander Larsson [Fri, 16 Oct 2015 09:06:25 +0000 (11:06 +0200)]
deltas: Support passing filename to delta generator

10 years agodeltas: Make min-fallback-size 0 actually disable fallbacks
Alexander Larsson [Fri, 16 Oct 2015 09:03:53 +0000 (11:03 +0200)]
deltas: Make min-fallback-size 0 actually disable fallbacks

This is what the docs specify.

10 years agodeltas: Verify checksums in apply-offline unless skip_validate is TRUE
Alexander Larsson [Thu, 15 Oct 2015 17:36:30 +0000 (19:36 +0200)]
deltas: Verify checksums in apply-offline unless skip_validate is TRUE

10 years agoAdd _ostree_repo_open|commit_untrusted_content_bare
Alexander Larsson [Thu, 15 Oct 2015 17:34:04 +0000 (19:34 +0200)]
Add _ostree_repo_open|commit_untrusted_content_bare

Also renames OstreeRepoTrustedContentBareCommit to
OstreeRepoContentBareCommit so that it can be used by both.

This will be needed when we introduce checksum verification of objects
in static deltas.

10 years agostatic-delta apply-offline: Don't skip validation
Alexander Larsson [Thu, 15 Oct 2015 17:31:13 +0000 (19:31 +0200)]
static-delta apply-offline: Don't skip validation

This makes no sense, at least by default.

10 years agodelta: Ensure the from commit exists when applying static delta
Alexander Larsson [Thu, 15 Oct 2015 14:59:49 +0000 (16:59 +0200)]
delta: Ensure the from commit exists when applying static delta

10 years agodeltas: Make apply-offline only read the parts once
Alexander Larsson [Thu, 15 Oct 2015 13:54:35 +0000 (15:54 +0200)]
deltas: Make apply-offline only read the parts once

No need to read() the file for the checksum if we then directly mmap it.
Instead we just mmap it initially and checksum from that.

10 years agoAdd tests for inline static deltas
Alexander Larsson [Thu, 15 Oct 2015 08:46:16 +0000 (10:46 +0200)]
Add tests for inline static deltas

10 years agostatic-deltas generate: Add --inline option to CLI tool
Alexander Larsson [Thu, 10 Sep 2015 18:54:43 +0000 (20:54 +0200)]
static-deltas generate: Add --inline option to CLI tool

10 years agostatic deltas: Add support for inline-parts
Alexander Larsson [Thu, 10 Sep 2015 18:52:54 +0000 (20:52 +0200)]
static deltas: Add support for inline-parts

In this mode the parts are stored in the metadata of the main delta
superblock file.  This can be useful if you want a single-file delta
for easy transport, or for http in the case the delta is very small.

10 years agogenerate-static-delta: Support min-fallback-size 0 to disable fallbacks
Alexander Larsson [Thu, 10 Sep 2015 18:15:14 +0000 (20:15 +0200)]
generate-static-delta: Support min-fallback-size 0 to disable fallbacks

10 years agodocs: Note not to put private keys in /usr/share/ostree
Colin Walters [Sun, 8 Nov 2015 02:15:20 +0000 (21:15 -0500)]
docs: Note not to put private keys in /usr/share/ostree

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

10 years agotests: add tests for prune and tombstones commits
Giuseppe Scrivano [Wed, 28 Oct 2015 13:24:35 +0000 (14:24 +0100)]
tests: add tests for prune and tombstones commits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agofsck: add argument --add-tombstones
Giuseppe Scrivano [Wed, 28 Oct 2015 13:23:35 +0000 (14:23 +0100)]
fsck: add argument --add-tombstones

It is used to create tombstones for missing commits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: create a tombstone commit when deleting a commit
Giuseppe Scrivano [Wed, 28 Oct 2015 11:10:27 +0000 (12:10 +0100)]
repo: create a tombstone commit when deleting a commit

When a commit is deleted and the repo is configured to use tombstone
commits, create one.  Delete the tombstone file only if the commit is
pulled again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: add support for tombstone commits
Giuseppe Scrivano [Wed, 28 Oct 2015 09:07:51 +0000 (10:07 +0100)]
pull: add support for tombstone commits

Add a new object type: OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT that is
used when a commit was intentionally removed.

If the remote repository doesn't use tombstone commits, do not fail on
a missing commit (change 0b795785dd81cd1e8c2c5960f0959740bce72a51).

When the remote repository uses tombstones, if a commit cannot be
found, check if the tombstone file is present and fail if it is not
present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocore: use OSTREE_OBJECT_TYPE_LAST instead of OSTREE_OBJECT_TYPE_COMMIT
Giuseppe Scrivano [Wed, 28 Oct 2015 08:39:46 +0000 (09:39 +0100)]
core: use OSTREE_OBJECT_TYPE_LAST instead of OSTREE_OBJECT_TYPE_COMMIT

OSTREE_OBJECT_TYPE_LAST holds the value of the last element in the enum.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoinit-fs: Explicitly set /tmp to 01777
Colin Walters [Fri, 30 Oct 2015 21:10:23 +0000 (17:10 -0400)]
init-fs: Explicitly set /tmp to 01777

I think most people were using tmpfs-on-tmp and so didn't hit this.

See https://bugzilla.redhat.com/show_bug.cgi?id=1276775

10 years agosysroot: Write symlinks before calling fsync(), then rename after
Colin Walters [Tue, 13 Oct 2015 01:33:23 +0000 (21:33 -0400)]
sysroot: Write symlinks before calling fsync(), then rename after

There might be a race here in that we create new symlink files *after*
calling `syncfs`, and they are not guaranteed to end up on disk.

Rework the code so that we create symlinks before, and then only
rename them after (and `fsync()` the directory for good measure).

Additional-fixes-by: Giuseppe Scrivano <gscrivan@redhat.com>
Tested-by: Giuseppe Scrivano <gscrivan@redhat.com>
This still needs verification that we're fixing a real bug; but I'm
fairly confident this won't make the fsync situation worse.

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

10 years agostatic-delta: Fix annotation on ostree_repo_list_static_delta_names
John Hiesey [Wed, 21 Oct 2015 21:40:01 +0000 (14:40 -0700)]
static-delta: Fix annotation on ostree_repo_list_static_delta_names

out_deltas should be (transfer-container)

10 years agoprepare-root: set up /boot bind-mount for single partition systems
Daniel Drake [Tue, 21 Jul 2015 14:04:34 +0000 (08:04 -0600)]
prepare-root: set up /boot bind-mount for single partition systems

When booting from a system with /boot on the main partition, set up
an appropriate bind mount during boot. The ostree runtime binary
expects to be able to access the bootloader configs at /boot.

See: https://mail.gnome.org/archives/ostree-list/2015-July/msg00015.html

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

10 years agoupgrade: Add --override-commit=CHECKSUM option
Matthew Barnes [Tue, 6 Oct 2015 15:33:18 +0000 (11:33 -0400)]
upgrade: Add --override-commit=CHECKSUM option

Adds an entry to the origin file to force the OstreeSysrootUpgrader to
pull and deploy the given checksum.

  [origin]
  override-commit=CHECKSUM

If the option is not given, any such entry is explicitly removed from
the origin file to ensure we upgrade to the latest available commit.

10 years agoupgrader: Allow overriding the commit to pull
Matthew Barnes [Thu, 1 Oct 2015 23:02:11 +0000 (19:02 -0400)]
upgrader: Allow overriding the commit to pull

Upgrader now looks for an "override-commit" key in the origin file
with a commit checksum, which causes the upgrader to pull and deploy
the specified commit rather than the latest available commit on the
origin refspec.

10 years agoupgrader: Add ostree_sysroot_upgrader_dup_origin()
Matthew Barnes [Tue, 6 Oct 2015 15:24:23 +0000 (11:24 -0400)]
upgrader: Add ostree_sysroot_upgrader_dup_origin()

Convenience function returns a copy of the origin file, useful when
modifying it.

10 years agotests: fix LZMA test to really compress/decompress
Giuseppe Scrivano [Tue, 13 Oct 2015 10:40:09 +0000 (12:40 +0200)]
tests: fix LZMA test to really compress/decompress

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoDon't require /boot/uEnv.txt for u-boot support
Gatis Paeglis [Tue, 6 Oct 2015 21:43:25 +0000 (23:43 +0200)]
Don't require /boot/uEnv.txt for u-boot support

The current code checks if /boot/uEnv.txt is a symlink to
decice if sysroot requires u-boot support. Why this is bad:

There are 2 ways to provide a custom env to u-boot from user space:

1) A compiled binary that is sourced from u-boot.
2) A text file (usually /uEnv.txt) that is imported into env from u-boot.

The current OSTree u-boot integration code was designed with the 1st
case in mind.

Many bootscripts provided by an embedded device vendors expect
to find uEnv.txt in the top level directory, it is often hardcoded
when building u-boot and is difficult to change later on. Or in other
cases it is stored in read-only memory so changing it would require
re-flushing boot loader with a new env. So the issue here is that
OSTree's and vendor uEnv.txt want to exist and the same path and OSTree
would throw away any changes added to /uEnv.txt by user on the next
upgrade/deploy.

This patch "hides" away the OSTree's env file loader/uEnv.txt from users
who are used to edditing uEnv.txt at the top level directory. Now to add
OSTree support on such boards you can simply add a custom logic in uEnv.txt
that loads ostree env from /loader/uEnv.txt

This change is backward compatible with the previous ostree releases and
solves the issue described in:

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

10 years agocommit: Improve variable name
Leandro Santiago [Fri, 9 Oct 2015 09:19:54 +0000 (11:19 +0200)]
commit: Improve variable name

Using `commit_subject` instead of `arg` is clearer as it can refer to
a directory, archive or ref.

This is just an aesthetic change in the source code, having no impact
anywhere else.

10 years agostatic-delta: Set error on bsdiff failure
John Hiesey [Fri, 2 Oct 2015 00:26:47 +0000 (17:26 -0700)]
static-delta: Set error on bsdiff failure

bsdiff can fail when generating static deltas, particularly if
not enough memory is available. Set error properly when this happens.

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

10 years agostatic-delta: Don't run bspatch when output object already exists
John Hiesey [Wed, 7 Oct 2015 21:43:13 +0000 (14:43 -0700)]
static-delta: Don't run bspatch when output object already exists

There is already a check that the destination object does not
exist in all other cases when processing an incoming static delta.
However, the bspatch case would still try to run and fail. Add
an analogous check to that case as well.

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

10 years agostatic-delta: Handle LZMA_BUF_ERROR returned by zlib
John Hiesey [Wed, 7 Oct 2015 20:30:33 +0000 (13:30 -0700)]
static-delta: Handle LZMA_BUF_ERROR returned by zlib

zlib can return LZMA_BUF_ERROR, which indicates that either
the input or output buffer has size zero. This case should cause
the correct error to be passed back from g_converter_convert
to expand the relevant buffer. Since this error is ambiguous
as to which buffer is too small, an explicit check on the
output buffer size is added as well.

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

10 years agotests: Add a test for pull+deploy of specific "bare" commit
Colin Walters [Wed, 23 Sep 2015 19:03:48 +0000 (15:03 -0400)]
tests: Add a test for pull+deploy of specific "bare" commit

This is the "pull an older version" that's now supported since
36d65b3cfcc9557552314d112493516437d6fcd4

https://github.com/GNOME/ostree/pull/145

10 years agodoc: Note that refs --delete does not prune
Colin Walters [Mon, 28 Sep 2015 19:49:12 +0000 (15:49 -0400)]
doc: Note that refs --delete does not prune

10 years agopull: Recover from missing commits in recursive pulls
Matthew Barnes [Thu, 24 Sep 2015 14:43:56 +0000 (10:43 -0400)]
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.

10 years agosysroot: Cleanup refs and prune even on last undeployment
Colin Walters [Thu, 24 Sep 2015 15:00:54 +0000 (11:00 -0400)]
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.

10 years agofetcher: Track outstanding requests with a table
Matthew Barnes [Wed, 23 Sep 2015 23:28:47 +0000 (19:28 -0400)]
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.

10 years agofetcher: Rework reference counting
Matthew Barnes [Wed, 23 Sep 2015 21:11:51 +0000 (17:11 -0400)]
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.

10 years agofetcher: Convert from GSimpleAsyncResult to GTask
Matthew Barnes [Wed, 23 Sep 2015 19:41:24 +0000 (15:41 -0400)]
fetcher: Convert from GSimpleAsyncResult to GTask

Obsessive compulsive cleanup.

10 years agofetcher: Remove message_to_request table
Matthew Barnes [Wed, 23 Sep 2015 17:24:41 +0000 (13:24 -0400)]
fetcher: Remove message_to_request table

Does not appear to be needed, no lookups on the table.

10 years agoRelease 2015.9
Colin Walters [Wed, 23 Sep 2015 16:10:22 +0000 (12:10 -0400)]
Release 2015.9

10 years agoRemove unused variables
Gatis Paeglis [Wed, 23 Sep 2015 10:46:06 +0000 (12:46 +0200)]
Remove unused variables

10 years agoMutable is a keyword in C++11
Leandro Santiago [Tue, 22 Sep 2015 11:52:29 +0000 (13:52 +0200)]
Mutable is a keyword in C++11

This fix allows including OSTree on C++ projects.

10 years agopull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY
Matthew Barnes [Mon, 21 Sep 2015 13:36:00 +0000 (09:36 -0400)]
pull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY

https://bugzilla.gnome.org/755224

10 years agorepo: Fix build without libsoup
Matthew Barnes [Mon, 21 Sep 2015 20:11:40 +0000 (16:11 -0400)]
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.

10 years agoreset: Simplify argument checking logic
Matthew Barnes [Thu, 17 Sep 2015 16:25:37 +0000 (12:25 -0400)]
reset: Simplify argument checking logic

10 years agolibglnx: Update from master
Matthew Barnes [Wed, 16 Sep 2015 18:19:05 +0000 (14:19 -0400)]
libglnx: Update from master

Pick up PATH change for glnx_libcontainer_run_chroot_private().

10 years agodeploy: Do not prune repository
Matthew Barnes [Tue, 15 Sep 2015 18:40:18 +0000 (14:40 -0400)]
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

10 years agosysroot: Add ostree_sysroot_prepare_cleanup()
Matthew Barnes [Wed, 9 Sep 2015 18:50:14 +0000 (14:50 -0400)]
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.

10 years ago_ostree_static_delta_part_validate: Take a stream instead of a file as arg
Alexander Larsson [Thu, 10 Sep 2015 18:16:52 +0000 (20:16 +0200)]
_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.

10 years agotests: Add a test for static-delta apply-offline
Colin Walters [Mon, 14 Sep 2015 01:35:10 +0000 (21:35 -0400)]
tests: Add a test for static-delta apply-offline

Obviously it was broken...

10 years agooffline delta apply: Handle the version field
Alexander Larsson [Thu, 10 Sep 2015 17:42:28 +0000 (19:42 +0200)]
offline delta apply: Handle the version field

It seems the format changed and this code was not updated.

10 years agocommit: Clarify reasoning for "commit-update-summary" default
Matthew Barnes [Fri, 11 Sep 2015 17:15:58 +0000 (13:15 -0400)]
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.

10 years agopull: honor gpg-verify-summary=false when a summary signature is present
Giuseppe Scrivano [Thu, 10 Sep 2015 08:16:47 +0000 (10:16 +0200)]
pull: honor gpg-verify-summary=false when a summary signature is present

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: Go back to using one main context
Colin Walters [Tue, 1 Sep 2015 02:37:37 +0000 (22:37 -0400)]
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)

10 years agopull: Only fetch all refs if we're mirroring
Colin Walters [Tue, 1 Sep 2015 02:54:04 +0000 (22:54 -0400)]
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)

10 years agofetcher: Use 0666 (-umask) for temporary files
Colin Walters [Wed, 26 Aug 2015 19:41:39 +0000 (15:41 -0400)]
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

10 years agoRelease 2015.8
Colin Walters [Wed, 26 Aug 2015 20:54:20 +0000 (16:54 -0400)]
Release 2015.8

10 years agostatic-delta: assert on non-regular files
John Hiesey [Wed, 26 Aug 2015 19:11:38 +0000 (12:11 -0700)]
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.

10 years agostatic-delta: Ignore symlinks when computing similar objects
John Hiesey [Wed, 26 Aug 2015 01:15:53 +0000 (18:15 -0700)]
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.

10 years agotests: Build test-lzma with LZMA flags
Dan Nicholson [Wed, 26 Aug 2015 16:54:31 +0000 (09:54 -0700)]
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.

10 years agoUpdate .gitignore
Jasper St. Pierre [Wed, 26 Aug 2015 19:16:29 +0000 (12:16 -0700)]
Update .gitignore

10 years agorepo-pull: Add a queue for scanning
Jasper St. Pierre [Thu, 6 Aug 2015 22:45:21 +0000 (15:45 -0700)]
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

10 years agotests: Add tests for rollsum
Giuseppe Scrivano [Tue, 25 Aug 2015 13:27:56 +0000 (09:27 -0400)]
tests: Add tests for rollsum

10 years agorollsum: Fix assertion for CRC matches
Colin Walters [Tue, 25 Aug 2015 13:26:22 +0000 (09:26 -0400)]
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.

10 years agotests: rename test-rollsum to test-rollsum-cli
Giuseppe Scrivano [Fri, 14 Aug 2015 06:43:44 +0000 (08:43 +0200)]
tests: rename test-rollsum to test-rollsum-cli

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: Stop using GMainLoop
Colin Walters [Wed, 12 Aug 2015 21:03:52 +0000 (17:03 -0400)]
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

10 years agosysroot: Add an unload() API
Colin Walters [Thu, 13 Aug 2015 16:43:14 +0000 (12:43 -0400)]
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

10 years agotests: add tests for LZMA compressor and decompressor
Giuseppe Scrivano [Tue, 11 Aug 2015 09:26:14 +0000 (11:26 +0200)]
tests: add tests for LZMA compressor and decompressor

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoUpdate .gitignore
Jasper St. Pierre [Thu, 6 Aug 2015 23:18:06 +0000 (16:18 -0700)]
Update .gitignore

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

10 years agotests: skip tests using gjs/parallel if they are not installed
Giuseppe Scrivano [Wed, 5 Aug 2015 14:51:30 +0000 (16:51 +0200)]
tests: skip tests using gjs/parallel if they are not installed

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes #131

10 years agotests: add tests for --disable-bsdiff and --max-bsdiff-size
Giuseppe Scrivano [Wed, 29 Jul 2015 08:26:27 +0000 (10:26 +0200)]
tests: add tests for --disable-bsdiff and --max-bsdiff-size

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoREADME: Attempt to flesh out more, start moving docs from wiki
Colin Walters [Tue, 28 Jul 2015 22:38:47 +0000 (18:38 -0400)]
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.

10 years agoUpdate .gitignore
Jasper St. Pierre [Fri, 1 May 2015 21:53:42 +0000 (14:53 -0700)]
Update .gitignore

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

10 years agorepo: don't forget to abort the transaction when failed
Cosimo Cecchi [Tue, 28 Jul 2015 00:17:26 +0000 (17:17 -0700)]
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.

10 years agorepo: fix an incorrect comment
Cosimo Cecchi [Tue, 28 Jul 2015 00:15:21 +0000 (17:15 -0700)]
repo: fix an incorrect comment

10 years agostatic-delta: add max-bsdiff-size option
Giuseppe Scrivano [Tue, 28 Jul 2015 10:39:36 +0000 (12:39 +0200)]
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>
10 years agostatic-delta: do not fail compilation with big files
Giuseppe Scrivano [Tue, 28 Jul 2015 10:28:25 +0000 (12:28 +0200)]
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>
10 years agopull: new option --commit-metadata-only
Giuseppe Scrivano [Fri, 24 Jul 2015 09:26:57 +0000 (11:26 +0200)]
pull: new option --commit-metadata-only

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: new function _ostree_preload_metadata_file
Giuseppe Scrivano [Thu, 23 Jul 2015 11:34:58 +0000 (13:34 +0200)]
repo: new function _ostree_preload_metadata_file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: merge repo_remote_fetch_summary_{metalink,url}
Giuseppe Scrivano [Thu, 23 Jul 2015 10:56:30 +0000 (12:56 +0200)]
repo: merge repo_remote_fetch_summary_{metalink,url}

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: new API ostree_repo_remote_list_refs
Giuseppe Scrivano [Wed, 22 Jul 2015 10:16:51 +0000 (12:16 +0200)]
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>
10 years agotests: do not commit from the working directory
Giuseppe Scrivano [Tue, 21 Jul 2015 13:41:39 +0000 (15:41 +0200)]
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>
10 years agotests: Export OSTREE_SYSROOT in setup_os_repository
Matthew Barnes [Tue, 14 Jul 2015 17:30:05 +0000 (13:30 -0400)]
tests: Export OSTREE_SYSROOT in setup_os_repository

Eliminates the need for constantly passing --sysroot=sysroot, but
also makes ostree place remote configs for sysroot/ostree/repo in
sysroot/etc/ostree/remotes.d where they should have been all along.

10 years agomain: Fix UID check based on sysroot path
Matthew Barnes [Tue, 14 Jul 2015 17:14:02 +0000 (13:14 -0400)]
main: Fix UID check based on sysroot path

This is another place where we were hard-coding a default.  Create the
OstreeSysroot first and THEN check if its path is the root directory.

10 years agorepo: Fix location of remote configs for system repos
Matthew Barnes [Mon, 13 Jul 2015 22:02:07 +0000 (18:02 -0400)]
repo: Fix location of remote configs for system repos

Need to respect the repo's system root directory instead of assuming the
compile-time $(sysconfdir).

10 years agosysroot: Pass the internal repo a system root path
Matthew Barnes [Mon, 13 Jul 2015 21:15:03 +0000 (17:15 -0400)]
sysroot: Pass the internal repo a system root path

10 years agorepo: Add a "sysroot-path" property
Matthew Barnes [Mon, 13 Jul 2015 21:12:18 +0000 (17:12 -0400)]
repo: Add a "sysroot-path" property

Adds ostree_repo_new_for_sysroot_path() to specify a system root path.
OstreeRepo otherwise uses _ostree_get_default_sysroot_path().

10 years agosysroot: Use _ostree_get_default_sysroot_path()
Matthew Barnes [Tue, 14 Jul 2015 16:02:46 +0000 (12:02 -0400)]
sysroot: Use _ostree_get_default_sysroot_path()

Instead of hard-coding the root directory as default.

10 years agocore: Add _ostree_get_default_sysroot_path()
Matthew Barnes [Tue, 14 Jul 2015 15:58:00 +0000 (11:58 -0400)]
core: Add _ostree_get_default_sysroot_path()

Returns a GFile for the default system root, which is usually the root
directory unless overridden by the OSTREE_SYSROOT environment variable
(which is mainly intended for testing).

10 years agopull: Plug a memory leak
Colin Walters [Tue, 30 Jun 2015 01:57:29 +0000 (21:57 -0400)]
pull: Plug a memory leak