Commit Graph

2318 Commits

Author SHA1 Message Date
Joaquim Rocha
6821ca1029 build: Link ostree with libarchive
libarchive (when available) is being used in ot-builtin-export.c so it
is necessary to link ostree with it.

https://bugzilla.gnome.org/show_bug.cgi?id=762457
2016-02-22 11:22:24 -05:00
Colin Walters
4beb5f4eaf pull: Add a --dry-run option for static deltas
One of the design goals with deltas was not just wire efficiency,
but also having all the data up front about how much data would
be transferred before starting.

Let's expose that better by adding a `dry-run` option to the pull API.
This requires static deltas to be useful.  Basically we simply call
the progress callback once with the data from the superblock.
2016-02-19 15:21:13 -05:00
Colin Walters
f2c5ecb996 pull: Add require-static-deltas pull option
For a production release repository, most OS vendors would want
to just always use static deltas.  Add the ability for the pulls to
require it.

(I think I'll also add a summary key for this actually in addition,
 so the repo manager can force it too)
2016-02-19 15:21:13 -05:00
Jonathan Lebon
eba7df0da9 ostree-sysroot: add debug option to help testing
If ostree is run in a test setup where it operates as root in a tmp
directory, it might cause issues to flag the deployments as immutable.
The test harness might simply be doing an `rm -rf` (effectively the case
for gnome-desktop-testing-runner), which will then fail.

We add a new debug option to the ostree_sysroot object using GLib's
GDebugKey functionality to allow our tests to communicate to ostree that
we don't want immutable deployments.
2016-02-19 11:58:08 -05:00
Colin Walters
3a555114bc repo: Add ostree_repo_import_archive_to_mtree
This is a more flexible version of the previous
ostree_repo_write_archive_to_mtree() which took a file reference.
This has an extensible options structure, and in particular
now supports `ignore_unsupported_content`.

I plan to use this for importing Docker images which contain device
nodes.  (There's no reason for container images to have those, so
we'll just ignore them).

Also here, just like the export variant, the caller is responsible for
setting up libarchive.
2016-02-19 08:54:04 -05:00
Colin Walters
b08b1abccd Rename libarchive write API to "export", matching command line
I was going to add new API for importing, and it was really confusing
that what I think of now as import and export both had "write" in the
name.  It's just clearer to talk about the direction.

At the same time, include `Export` in the options structure.

This isn't an ABI break as the API isn't in a release.
2016-02-19 08:54:04 -05:00
Colin Walters
707c14aeeb manual: Note that the bare-user mode exists 2016-02-18 18:21:32 -05:00
Colin Walters
d3eee15f84 rofiles-fuse: Fix truncate call to not use O_CREAT
I was getting a compilation error with the GCC hardening flags which
look for a missing mode with `O_CREAT`.  The right fix here is to drop
`O_CREAT`, as truncate() should throw `ENOENT` if the file doesn't
exist.
2016-02-17 11:06:53 -05:00
Colin Walters
2c2fd658ee packaging: Add a fuse subpackage
For rofiles-fuse.  Eventually what we should really do is split out
the shared library from the binaries?  A minimal system shouldn't need
rofiles-fuse, it's mainly for doing layered packages and that sort of
thing.
2016-02-17 11:06:53 -05:00
Colin Walters
baaf7450da Support Docker-style whiteouts
This is to enable importing Docker layers as ostree commits, then
checking them out in a union.

The prototype work for this is in:
https://github.com/cgwalters/dlayer-ostree

Though it will likely ultimately end up in:
https://github.com/projectatomic/atomic
2016-02-16 10:54:59 -05:00
Colin Walters
c18193bd19 man/ostree-export.xml: Add to git
Forgot to `git add`.
2016-02-15 06:39:49 -05:00
Colin Walters
f0b6b358cd manual-tests: New static-delta-generate-crosscheck.sh
I wanted to test static deltas vs a repo with "real" content
in it from Fedora Atomic.
2016-02-14 10:28:17 -05:00
Colin Walters
42c60effbe pull: Support specifying exact commit to pull via branch@commit
I don't know why we didn't do this a long time ago.  This extends the
pull API to allow grabbing a specific commit, and will set the branch
to it.  There's some support for this in the deploy engine, but there
are a lot of reasons to support it for raw pulls (such as subset
mirroring cases).

In fact I'm thinking we should also have the override-version logic
here too.

NOTE: One thing I debated here is inventing a new syntax on the
command line.  Git doesn't seem to have this functionality (probably
because it'd be rarely used). The '@' character at least doesn't
conflict with anything.

Anyways, I wanted this for some other test cases.  Without this,
writing tests that go between different commits is more awkward as one
must generate the content in one repo, then pull downstream, then
generate more content, then pull again.  But now I can just keep track
of commit IDs and do exactly what I want without synchronizing the
tests.
2016-02-14 10:12:26 -05:00
Colin Walters
355f8438ef Add an export builtin, and API to write to libarchive
At the moment I'm looking at using rpm-ostree to manage RPM inputs
which can then be converted into Docker images.  It's most convenient
if we can stream directly out of libostree rather than doing a
checkout + tar combination.

There are also backup/debugging etc. reasons to implement `export` as
well.
2016-02-14 09:53:01 -05:00
Colin Walters
e9ccdd2d00 Import rofiles-fuse
While it's not strictly tied to OSTree, let's move
https://github.com/cgwalters/rofiles-fuse in here because:

 - It's *very* useful in concert with OSTree
 - It's tiny
 - We can reuse OSTree's test, documentation, etc. infrastructure

One thing to consider also is that at some point we could experiment
with writing a FUSE filesystem for OSTree.  This could internalize a
better equivalent of `--link-checkout-speedup`, but on the other hand,
the cost of walking filesystem trees for these types of operations is
really quite small.

But if we did decide to do more FUSE things in OSTree, this is a step
towards that too.
2016-02-10 13:11:25 +01:00
Matthew Barnes
5adafd7674 fetcher: Fix hung GTlsInteraction
The GTlsInteraction instance must be created in the session thread
so it uses the correct GMainContext.
2016-02-09 00:58:17 +00:00
Colin Walters
0481389afd lib: Expand ostree static-delta show to show part stats
Now we display stats on the individual parts, such as the blob size
and the number of each type of opcode.  Most interesting to me is
things like how many bsdiff opcodes there are vs new objects, etc.
2016-02-08 14:46:13 +01:00
Colin Walters
56fc249d08 lib: Create an internal static delta parsing/opening function
We had code to deal with opening/checksumming/decompressing static
deltas in a few places.  I'd like to teach `ostree static-delta show`
how to display more information, and this will allow it to just use
`_ostree_static_delta_part_open()` too.
2016-02-08 14:46:13 +01:00
Colin Walters
8702ec7b3e build: Remove --disable-static-deltas option
I'm confident now we can declare them stable.
2016-02-08 14:46:13 +01:00
Colin Walters
0c15c9d6dd README.md: Update to link to Read The Docs, describe a bit better 2016-02-08 14:35:24 +01:00
Colin Walters
371856b6e4 docs-md: Delete (obsoleted by docs/)
This was just a prototype start at markdown docs that I never picked
back up.  Now that we have the Markdown/mkdocs done, delete this.
2016-02-08 14:24:24 +01:00
Giuseppe Scrivano
b0163d6182 build: 'make clean' removes parse-datetime.c
and fix make dist while at it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-02-07 14:56:21 +01:00
Colin Walters
ba272008a7 packaging: Sync spec file with Fedora 2016-02-03 10:22:01 -05:00
Colin Walters
98d5f6e3db static-delta: Add show subcommand
Right now though, almost all of the details of deltas are private, so
we can't do the "honest thing" and have the command line just use the
shared library.

Eventually some of this should appear in the API, but for now add
command line which is useful for debugging.
2016-01-28 15:38:09 -05:00
Colin Walters
944b3abab1 build: Hoist man conditional higher
So we actually build with `--disable-man`.
2016-01-28 15:34:38 -05:00
Colin Walters
fa9e547e09 lib: Add a #define OSTREE_SHA256_DIGEST_LEN 32
And use it internally.  This way it's a bit less magical.
2016-01-28 15:24:16 -05:00
Colin Walters
c74ea8b075 build: Add --disable-man
Gnome Continuous doesn't have docbook, so copy what we do for glib.
2016-01-28 15:22:10 -05:00
Colin Walters
ca57ec4aa5 repo: Port -refs.c to openat()
I'd like to incrementally convert all of `ostree-repo*.c` to
fd-relative usage, so that we can sanely introduce
`ostree_repo_new_at()` which doesn't involve GFile.

This one is medium risk, but passes the test suite.
2016-01-28 14:57:13 -05:00
Colin Walters
5bab946b80 apidoc: Remove unnecessary srcdir != builddir workaround
It seems to be fine with `gtk-doc-1.19-3.el7.noarch`, so let's drop
this workaround, as it causes `make` warnings.
2016-01-28 09:31:37 -05:00
Colin Walters
64ebe2b82a Rewrite manual in mkdocs
I don't much like Docbook (and am considering converting the man pages
too), but let's start with the manual.

I looked at various documentation generators (there are a lot), and
I had a few requirements:

 - Markdown
 - Packaged in Fedora
 - Suitable for upload to a static webserver

`mkdocs` seems to fit the bill.
2016-01-28 09:31:37 -05:00
Colin Walters
32c360b5a0 build: Rename doc/ -> apidoc/
This is preparation for introducing a `mkdocs` manual under `doc/`
which should be significantly more useful for the world at large than
the minimal manual that exists there now.
2016-01-28 09:31:34 -05:00
Colin Walters
313b4720e8 build: Move man pages into man/
This is preparation for having 3 separate doc build systems (whee):

 - xsltproc for the man pages
 - gtk-doc for the API docs
 - mkdocs for a real manual
2016-01-28 09:31:34 -05:00
Colin Walters
5ebe43859d tests: Use "bash strict mode"
I noticed in the static deltas tests, there were some tests that
should have been under `-o pipefail` to ensure we properly propagate
errors.

There were a few places where we were referencing undefined variables.

Overall, this is clearly a good idea IMO.
2016-01-27 11:44:10 -05:00
Colin Walters
3d2322db7a grub2: Don't delete grub2.cfg.old file we just copied
The original intention here was that we'd keey around a copy of the
file so that grub2 could eventually learn how to do atomic updates by
checking for a "fully written" marker in the *new* file, and if it
didn't exist, falling back to grub2.cfg.old.

I haven't yet proposed that upstream, but we might as well stop
deleting the file since it's useful as a backup at least.

Reported-by: Gatis Paeglis
2016-01-27 10:46:12 -05:00
Colin Walters
91a1f91440 refs: Add a missing goto out for error handling
If the `refs/remotes` directory doesn't exist, we'd trip an assertion.
2016-01-26 16:48:37 -05:00
Colin Walters
cd0a9d3435 Add a checkout option to skip fsync
This is a better followup to dc9239dd7b
since I wanted to do fsync-less checkouts in rpm-ostree too, and
replicating the "turn off fsync temporarily" was in retrospect just a
hack.

We can simply add a boolean to the checkout options.

https://github.com/GNOME/ostree/pull/172
2016-01-26 15:39:46 -05:00
Giuseppe Scrivano
a13b56f91c diff: do not traverse parent commits
The object count displayed included also the number of parent
commits.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-01-20 08:59:10 +01:00
Colin Walters
dc9239dd7b sysroot: Don't individually fsync dirs in checkout, rely on syncfs
Originally, a lot of the `fsync()` calls here were added for the
wrong reason - I was chasing a bug that ended up being the extlinux
bootloader not parsing 64 bit ext4 filesystems.  But since it looked
like corruption, I tried adding a lot more `fsync()` calls.

All we should have to do is use `syncfs()`.  If that doesn't work,
it's a kernel bug.

I'm making this change because skipping the individual fsyncs can be a
major performance win - it's easier for the FS to optimize, we do more
in parallel, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=757117
2016-01-13 13:15:08 -05:00
Colin Walters
46c3fc5d76 repo: Note global transaction resume is legacy
See docs for details.

https://github.com/GNOME/ostree/pull/169
2016-01-13 13:09:20 -05:00
Colin Walters
587fc5a5a1 Release 2016.1 2016-01-12 08:55:06 -05:00
Colin Walters
5929ce9e0e repo: Add APIs for devino optimization between checkout -> commit
A fast way to generate new OSTree content using an existing
tree is to checkout (as hard links), add/replace files, then
call `ostree_repo_scan_hardlinks()`, then commit.

But `ostree_repo_scan_hardlinks()` scans the entire repo, which
can be slow if you have a lot of content.

All we really need is a mapping of (device,inode) -> checksum
just for the objects we checked out, then use that mapping
for commits.

This patch adds API so that callers can create a mapping via
`ostree_repo_devino_cache_new()`, then pass it to
`ostree_repo_checkout_tree_at()` which will populate it, and then
`ostree_repo_write_directory_to_mtree()` can consume it.

I plan to use this in rpm-ostree for package layering work.

Notes:
 - The old `ostree_repo_scan_hardlinks()` API still works.
 - I tweaked the cache to be a set with the checksum colocated with
   the key, to avoid a separate malloc block per entry.

https://github.com/GNOME/ostree/pull/167
2016-01-07 14:19:12 -05:00
Colin Walters
21fbc16bc3 repo: Expose dfd-relative mtree writes as public API
For use in rpm-ostree.  We already had all of the internals for this.
2016-01-05 17:43:08 -05:00
Jonathan Lebon
5e7ed2dd8b grub2_generate: load sysroot before using it
The logic for checking which bootversion to use tries to access
sysroot->bootversion if the user didn't specify an explicit bootversion
on the command-line nor through the env var. However, at that point, the
sysroot object is not yet initialized, so it will always return 0, even
when it's 1.

This would cause e.g. `grub2-mkconfig` to have no output for the BLS
entries whenever the entries were under `/boot/loader.1`.

Related: RHBZ1293986
2015-12-24 12:41:22 -05:00
Matthew Barnes
1f1bfbf711 fetcher: Lazily create tmp directory
The tmp directory is lazily created for each fetcher instance, since
it may require superuser permissions and some instances only need
_ostree_fetcher_request_uri_to_membuf() which keeps everything in
memory buffers.
2015-12-19 09:21:22 -05:00
Colin Walters
1810de2b51 deploy: Change large parts to be fd-relative, drop fsync
This is a continuation of earlier work to drop the individual fsync on
files/directories in favor of relying on `syncfs()` for speed.

As part of that cleanup, I'm porting it to be fd-relative.

I feel relatively confident about this change given that this area of
the code has notable test suite coverage, although that code runs as
non-root.
2015-12-19 08:24:51 -05:00
Colin Walters
3a4f90cf8e bootconfig: Add ostree_bootconfig_parser_write_at
This fd-relative API will be used by later libostree porting in the
deploy code path.
2015-12-19 08:24:51 -05:00
Colin Walters
506a891e36 deploy: Find kernel/initramfs consistently from filesystem
I'm porting the deployment code to be fd-relative, but part of the
logic was using `GFile` to talk to `OstreeRepoFile` to determine the
"bootcsum" (boot config checksum) before checking out the file tree.

We can avoid having both code paths by checking out the tree first,
then looking at it on the filesystem.
2015-12-19 08:24:51 -05:00
Giuseppe Scrivano
6f96571679 tests: add tests for prune --static-deltas-only
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-12-18 11:21:58 +01:00
Giuseppe Scrivano
44c6197b0a prune: add new flag --static-deltas-only
When specified, only the static deltas files are pruned.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-12-18 11:21:57 +01:00
Giuseppe Scrivano
6b1e495a7a repo: new function ostree_repo_prune_static_deltas
Extract existing code from ostree_repo_prune and add an argument COMMIT,
that controls which commit purge.  If not set, the old behavior is kept.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-12-18 11:21:57 +01:00