Commit Graph

2377 Commits

Author SHA1 Message Date
Alexander Larsson
78f14555c8 deltas: Verify checksums in apply-offline unless skip_validate is TRUE 2015-11-10 08:56:14 +01:00
Alexander Larsson
7a4fb1b2f1 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.
2015-11-10 08:56:14 +01:00
Alexander Larsson
3fa3e12e02 static-delta apply-offline: Don't skip validation
This makes no sense, at least by default.
2015-11-10 08:56:13 +01:00
Alexander Larsson
e418acb31b delta: Ensure the from commit exists when applying static delta 2015-11-10 08:56:13 +01:00
Alexander Larsson
eaa678eaa4 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.
2015-11-10 08:56:13 +01:00
Alexander Larsson
ee70ffbbcb Add tests for inline static deltas 2015-11-10 08:56:13 +01:00
Alexander Larsson
ccb77d3bd8 static-deltas generate: Add --inline option to CLI tool 2015-11-10 08:56:12 +01:00
Alexander Larsson
11a79220e2 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.
2015-11-10 08:56:12 +01:00
Alexander Larsson
30768a979f generate-static-delta: Support min-fallback-size 0 to disable fallbacks 2015-11-10 08:56:12 +01:00
Colin Walters
efdb4d8f44 docs: Note not to put private keys in /usr/share/ostree
https://bugzilla.gnome.org/show_bug.cgi?id=757524
2015-11-07 21:15:20 -05:00
Giuseppe Scrivano
438e21e858 tests: add tests for prune and tombstones commits
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-11-03 09:53:38 +01:00
Giuseppe Scrivano
29c425e742 fsck: add argument --add-tombstones
It is used to create tombstones for missing commits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-11-03 09:53:38 +01:00
Giuseppe Scrivano
646fe139e6 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>
2015-11-03 09:53:38 +01:00
Giuseppe Scrivano
76c5cc07db 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 0b795785dd).

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>
2015-11-03 09:53:38 +01:00
Giuseppe Scrivano
048c27588a 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>
2015-11-03 09:53:38 +01:00
Colin Walters
7bf138b036 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
2015-10-30 17:11:09 -04:00
Colin Walters
723705b803 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
2015-10-25 11:46:41 -04:00
John Hiesey
70c07a6338 static-delta: Fix annotation on ostree_repo_list_static_delta_names
out_deltas should be (transfer-container)
2015-10-21 21:09:23 -04:00
Daniel Drake
598530daf4 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
2015-10-15 21:36:21 -04:00
Matthew Barnes
2210a79bfa 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.
2015-10-13 12:34:57 -04:00
Matthew Barnes
39b732ffaa 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.
2015-10-13 12:34:56 -04:00
Matthew Barnes
41ab26356c upgrader: Add ostree_sysroot_upgrader_dup_origin()
Convenience function returns a copy of the origin file, useful when
modifying it.
2015-10-13 12:34:56 -04:00
Giuseppe Scrivano
442dcec43b tests: fix LZMA test to really compress/decompress
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-10-13 15:24:09 +02:00
Gatis Paeglis
b69a88b111 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
2015-10-12 10:22:12 -04:00
Leandro Santiago
5e98820b57 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.
2015-10-10 16:45:27 -04:00
John Hiesey
60e5529ba0 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
2015-10-10 10:38:01 -04:00
John Hiesey
f2b4a9e107 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
2015-10-10 10:31:10 -04:00
John Hiesey
dd35e1b9cd 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
2015-10-10 10:27:17 -04:00
Colin Walters
b6e2eaf212 tests: Add a test for pull+deploy of specific "bare" commit
This is the "pull an older version" that's now supported since
36d65b3cfc

https://github.com/GNOME/ostree/pull/145
2015-10-07 15:20:38 -04:00
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