ostree.git
9 years agogpg: Use gpg_strerror_r for threadsafety
Colin Walters [Mon, 22 Feb 2016 21:50:28 +0000 (16:50 -0500)]
gpg: Use gpg_strerror_r for threadsafety

These APIs are rather painful...this is why GError exists.

9 years agobuild: Use threadsafe GPGME
Alexander Larsson [Mon, 22 Feb 2016 20:04:38 +0000 (15:04 -0500)]
build: Use threadsafe GPGME

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

9 years agolibarchive: Make autocreate_parents imply autocreating root dir
Colin Walters [Mon, 22 Feb 2016 16:18:30 +0000 (11:18 -0500)]
libarchive: Make autocreate_parents imply autocreating root dir

Some Docker layers are just metadata in the `layer.json`.  If one is
mapping Docker layers to OSTree commits, one needs to create a dummy
root directory, because OSTree doesn't support metadata-only commits.

Let's just push that logic down here because it's easier than special
casing it in higher levels.

9 years agodocs: Add a new formats section, move static deltas in there
Colin Walters [Mon, 22 Feb 2016 19:06:20 +0000 (14:06 -0500)]
docs: Add a new formats section, move static deltas in there

The `src/libostree/README-deltas.md` was rather hidden - let's move
this into the manual.

9 years agobuild: Link ostree with libarchive
Joaquim Rocha [Mon, 22 Feb 2016 14:02:47 +0000 (15:02 +0100)]
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

9 years agopull: Add a --dry-run option for static deltas
Colin Walters [Fri, 19 Feb 2016 17:28:07 +0000 (12:28 -0500)]
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.

9 years agopull: Add require-static-deltas pull option
Colin Walters [Fri, 19 Feb 2016 13:43:35 +0000 (08:43 -0500)]
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)

9 years agoostree-sysroot: add debug option to help testing
Jonathan Lebon [Fri, 19 Feb 2016 16:58:08 +0000 (11:58 -0500)]
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.

9 years agorepo: Add ostree_repo_import_archive_to_mtree
Colin Walters [Thu, 18 Feb 2016 21:49:30 +0000 (16:49 -0500)]
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.

9 years agoRename libarchive write API to "export", matching command line
Colin Walters [Thu, 18 Feb 2016 16:25:57 +0000 (11:25 -0500)]
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.

9 years agomanual: Note that the bare-user mode exists
Colin Walters [Thu, 18 Feb 2016 23:21:32 +0000 (18:21 -0500)]
manual: Note that the bare-user mode exists

9 years agorofiles-fuse: Fix truncate call to not use O_CREAT
Colin Walters [Wed, 17 Feb 2016 16:01:21 +0000 (11:01 -0500)]
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.

9 years agopackaging: Add a fuse subpackage
Colin Walters [Wed, 17 Feb 2016 15:37:08 +0000 (10:37 -0500)]
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.

9 years agoSupport Docker-style whiteouts
Colin Walters [Sun, 14 Feb 2016 16:57:59 +0000 (11:57 -0500)]
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

9 years agoman/ostree-export.xml: Add to git
Colin Walters [Mon, 15 Feb 2016 11:39:49 +0000 (06:39 -0500)]
man/ostree-export.xml: Add to git

Forgot to `git add`.

9 years agomanual-tests: New static-delta-generate-crosscheck.sh
Colin Walters [Fri, 12 Feb 2016 17:41:15 +0000 (12:41 -0500)]
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.

9 years agopull: Support specifying exact commit to pull via branch@commit
Colin Walters [Thu, 11 Feb 2016 18:28:03 +0000 (13:28 -0500)]
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.

9 years agoAdd an `export` builtin, and API to write to libarchive
Colin Walters [Thu, 28 Jan 2016 19:41:27 +0000 (14:41 -0500)]
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.

9 years agoImport rofiles-fuse
Colin Walters [Wed, 10 Feb 2016 11:42:54 +0000 (12:42 +0100)]
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.

9 years agofetcher: Fix hung GTlsInteraction
Matthew Barnes [Tue, 9 Feb 2016 00:58:17 +0000 (00:58 +0000)]
fetcher: Fix hung GTlsInteraction

The GTlsInteraction instance must be created in the session thread
so it uses the correct GMainContext.

9 years agolib: Expand `ostree static-delta show` to show part stats
Colin Walters [Sat, 6 Feb 2016 16:04:53 +0000 (17:04 +0100)]
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.

9 years agolib: Create an internal static delta parsing/opening function
Colin Walters [Sat, 6 Feb 2016 12:56:19 +0000 (13:56 +0100)]
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.

9 years agobuild: Remove --disable-static-deltas option
Colin Walters [Wed, 27 Jan 2016 16:06:30 +0000 (11:06 -0500)]
build: Remove --disable-static-deltas option

I'm confident now we can declare them stable.

9 years agoREADME.md: Update to link to Read The Docs, describe a bit better
Colin Walters [Mon, 8 Feb 2016 13:35:09 +0000 (14:35 +0100)]
README.md: Update to link to Read The Docs, describe a bit better

9 years agodocs-md: Delete (obsoleted by docs/)
Colin Walters [Mon, 8 Feb 2016 13:24:24 +0000 (14:24 +0100)]
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.

9 years agobuild: 'make clean' removes parse-datetime.c
Giuseppe Scrivano [Fri, 29 Jan 2016 10:02:17 +0000 (11:02 +0100)]
build: 'make clean' removes parse-datetime.c

and fix make dist while at it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
9 years agopackaging: Sync spec file with Fedora
Colin Walters [Wed, 3 Feb 2016 15:22:01 +0000 (10:22 -0500)]
packaging: Sync spec file with Fedora

9 years agostatic-delta: Add `show` subcommand
Colin Walters [Thu, 28 Jan 2016 03:02:36 +0000 (22:02 -0500)]
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.

9 years agobuild: Hoist man conditional higher
Colin Walters [Thu, 28 Jan 2016 20:34:38 +0000 (15:34 -0500)]
build: Hoist man conditional higher

So we actually build with `--disable-man`.

9 years agolib: Add a #define OSTREE_SHA256_DIGEST_LEN 32
Colin Walters [Thu, 28 Jan 2016 19:53:38 +0000 (14:53 -0500)]
lib: Add a #define OSTREE_SHA256_DIGEST_LEN 32

And use it internally.  This way it's a bit less magical.

9 years agobuild: Add --disable-man
Colin Walters [Thu, 28 Jan 2016 20:22:10 +0000 (15:22 -0500)]
build: Add --disable-man

Gnome Continuous doesn't have docbook, so copy what we do for glib.

9 years agorepo: Port -refs.c to openat()
Colin Walters [Wed, 27 Jan 2016 02:34:31 +0000 (21:34 -0500)]
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.

9 years agoapidoc: Remove unnecessary srcdir != builddir workaround
Colin Walters [Thu, 28 Jan 2016 14:30:16 +0000 (09:30 -0500)]
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.

9 years agoRewrite manual in mkdocs
Colin Walters [Wed, 27 Jan 2016 21:56:16 +0000 (16:56 -0500)]
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.

9 years agobuild: Rename doc/ -> apidoc/
Colin Walters [Wed, 27 Jan 2016 18:29:21 +0000 (13:29 -0500)]
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.

9 years agobuild: Move man pages into man/
Colin Walters [Wed, 27 Jan 2016 17:51:07 +0000 (12:51 -0500)]
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

9 years agotests: Use "bash strict mode"
Colin Walters [Wed, 27 Jan 2016 16:44:10 +0000 (11:44 -0500)]
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.

9 years agogrub2: Don't delete grub2.cfg.old file we just copied
Colin Walters [Wed, 27 Jan 2016 15:43:57 +0000 (10:43 -0500)]
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
9 years agorefs: Add a missing `goto out` for error handling
Colin Walters [Tue, 26 Jan 2016 21:48:37 +0000 (16:48 -0500)]
refs: Add a missing `goto out` for error handling

If the `refs/remotes` directory doesn't exist, we'd trip an assertion.

9 years agoAdd a checkout option to skip fsync
Colin Walters [Sat, 23 Jan 2016 20:07:55 +0000 (15:07 -0500)]
Add a checkout option to skip fsync

This is a better followup to dc9239dd7b09ef5e104309b4dbf0e136889da274
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

9 years agodiff: do not traverse parent commits
Giuseppe Scrivano [Fri, 15 Jan 2016 09:24:08 +0000 (10:24 +0100)]
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>
9 years agosysroot: Don't individually fsync dirs in checkout, rely on syncfs
Colin Walters [Wed, 13 Jan 2016 15:15:21 +0000 (10:15 -0500)]
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

9 years agorepo: Note global transaction resume is legacy
Colin Walters [Wed, 13 Jan 2016 15:34:32 +0000 (10:34 -0500)]
repo: Note global transaction resume is legacy

See docs for details.

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

9 years agoRelease 2016.1
Colin Walters [Tue, 12 Jan 2016 13:55:06 +0000 (08:55 -0500)]
Release 2016.1

9 years agorepo: Add APIs for devino optimization between checkout -> commit
Colin Walters [Tue, 5 Jan 2016 14:13:54 +0000 (09:13 -0500)]
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

9 years agorepo: Expose dfd-relative mtree writes as public API
Colin Walters [Mon, 4 Jan 2016 22:51:56 +0000 (17:51 -0500)]
repo: Expose dfd-relative mtree writes as public API

For use in rpm-ostree.  We already had all of the internals for this.

9 years agogrub2_generate: load sysroot before using it
Jonathan Lebon [Thu, 24 Dec 2015 16:54:54 +0000 (11:54 -0500)]
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

10 years agofetcher: Lazily create tmp directory
Matthew Barnes [Fri, 18 Dec 2015 15:50:08 +0000 (10:50 -0500)]
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.

10 years agodeploy: Change large parts to be fd-relative, drop fsync
Colin Walters [Mon, 20 Apr 2015 19:51:24 +0000 (15:51 -0400)]
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.

10 years agobootconfig: Add ostree_bootconfig_parser_write_at
Colin Walters [Tue, 21 Apr 2015 02:23:39 +0000 (22:23 -0400)]
bootconfig: Add ostree_bootconfig_parser_write_at

This fd-relative API will be used by later libostree porting in the
deploy code path.

10 years agodeploy: Find kernel/initramfs consistently from filesystem
Colin Walters [Tue, 21 Apr 2015 02:02:14 +0000 (22:02 -0400)]
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.

10 years agotests: add tests for prune --static-deltas-only
Giuseppe Scrivano [Tue, 15 Dec 2015 10:52:24 +0000 (11:52 +0100)]
tests: add tests for prune --static-deltas-only

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add new flag --static-deltas-only
Giuseppe Scrivano [Tue, 15 Dec 2015 10:32:05 +0000 (11:32 +0100)]
prune: add new flag --static-deltas-only

When specified, only the static deltas files are pruned.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: new function ostree_repo_prune_static_deltas
Giuseppe Scrivano [Tue, 15 Dec 2015 09:32:25 +0000 (10:32 +0100)]
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>
10 years agoremote: Add "ostree remote summary" command
Matthew Barnes [Wed, 16 Dec 2015 23:55:28 +0000 (18:55 -0500)]
remote: Add "ostree remote summary" command

Downloads and prints a remote summary file and any signatures in an
easy-to-read format, or alternatively with the --raw option, prints
the summary GVariant data directly.

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

10 years agorepo: Add ostree_repo_verify_summary()
Matthew Barnes [Wed, 16 Dec 2015 23:53:57 +0000 (18:53 -0500)]
repo: Add ostree_repo_verify_summary()

Verifies signatures on a summary -- both taken as GBytes inputs -- and
returns an OstreeGpgVerifyResult.

10 years agobuild: Fix srcdir != builddir
Colin Walters [Mon, 14 Dec 2015 19:19:35 +0000 (14:19 -0500)]
build: Fix srcdir != builddir

Caught by GContinuous.  Also change the file writes to be atomic,
otherwise we're not Ctrl-c safe.

10 years agopull: Push a temporary main context for sync requests
Matthew Barnes [Sat, 14 Nov 2015 01:37:13 +0000 (20:37 -0500)]
pull: Push a temporary main context for sync requests

Given the previous commit, which isolates SoupSession in a separate
thread, it should be safe to start pushing a temporary main context
for synchronous requests again.

This partially reverts 84fe2ff, which partially reverted 9f3d586.

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

10 years agofetcher: Move the SoupSession to a separate thread
Matthew Barnes [Fri, 13 Nov 2015 20:44:20 +0000 (15:44 -0500)]
fetcher: Move the SoupSession to a separate thread

Move the SoupSession to a separate thread with its own isolated main
context and main loop.  All interaction with the SoupSession occurs
by way of idle sources attached to the session's main context, which
execute on the session's thread.

This should solve the problem of running an asynchronous fetch request
synchronously by pushing a new thread-default main context and iterating
a main loop until the request completes.  Prior to this, the new thread-
default main context would interfere with the SoupSession's own async
processing.

10 years agofetcher: Add "config-flags" construct-only property
Matthew Barnes [Tue, 10 Nov 2015 00:04:42 +0000 (19:04 -0500)]
fetcher: Add "config-flags" construct-only property

A lot of effort here just to avoid touching SoupSession directly in
ostree_fetcher_new().  The reason will become apparent in subsequent
commits.

Note this introduces generated enum/flags GTypes using glib-mkenums.
I could have just made the property type as plain integer, but doing
properties right will henceforth be easier now that the automake-fu
is established.

10 years agorepo: Allocate a tmpdir for each OstreeFetcher to isolate concurrent downloads
Alexander Larsson [Fri, 11 Dec 2015 18:30:20 +0000 (19:30 +0100)]
repo: Allocate a tmpdir for each OstreeFetcher to isolate concurrent downloads

This way two pulls will not use the same tmpdir and accidentally
overwrite each other. However, consecutive OstreeFetchers will reuse
the tmpdirs, so that we can properly resume downloading large objects.

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

10 years agorepo: Use per-transaction staging dir
Alexander Larsson [Fri, 11 Dec 2015 14:48:29 +0000 (15:48 +0100)]
repo: Use per-transaction staging dir

Concurrent pulls break since we're sharing the staging directory for
all transactions in the repo. This makes us use a per-transaction directory.

However, in order for resumes to work we first look for existing
staging directories and try to aquire an exclusive lock for them. If
we can't find any staging directory or they are all already locked,
then we create a new one.

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

10 years agorepo: Add _ostree_repo_allocate_tmpdir helper
Alexander Larsson [Fri, 11 Dec 2015 17:43:05 +0000 (18:43 +0100)]
repo: Add _ostree_repo_allocate_tmpdir helper

This creates a subdirectory of the tmp dir with a selected prefix,
and takes a lockfile to ensure that nobody else is using the same directory.
However, if a directory with the same prefix already exists and is
not locked that is used instead.

The later is useful if you want to support some kind of resumed operation
on the tmpdir.

touch reused dirs

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

10 years agoUpdate to latest libglnx
Alexander Larsson [Mon, 14 Dec 2015 07:37:17 +0000 (08:37 +0100)]
Update to latest libglnx

10 years agobuild: Also add a configure check for YACC/bison
Colin Walters [Mon, 7 Dec 2015 15:39:37 +0000 (10:39 -0500)]
build: Also add a configure check for YACC/bison

So we error out more nicely if not found.

10 years agobuild: Delete generated parse-datetime.c file, use AM_V_GEN
Colin Walters [Mon, 7 Dec 2015 15:33:23 +0000 (10:33 -0500)]
build: Delete generated parse-datetime.c file, use AM_V_GEN

Bison is a well known external dependency, so just require it.
Including the generated content in git means it may or may not
be regenerated based randomly on timestamps, etc.

Also use `$(AM_V_GEN)` so we get prettier output.

10 years agocmdline: Fatally error if the timestamp in a commit is invalid
Colin Walters [Fri, 4 Dec 2015 16:14:25 +0000 (11:14 -0500)]
cmdline: Fatally error if the timestamp in a commit is invalid

Previously we were just ignoring this, which hid a bug in
an earlier commit that generated them.

Also change the `commit` program to use both APIs - this
involves extra code, but not too much.

This way, reverting the fix with this on top caused the test suite to
fail.  Adding an active test for this would need a custom test program
using the C API, or adding a cmdline flag to the client, neither of
which quite seemed worth it.

10 years agotests: add missing ${CMD_PREFIX}
Giuseppe Scrivano [Wed, 25 Nov 2015 13:18:39 +0000 (14:18 +0100)]
tests: add missing ${CMD_PREFIX}

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoparse-datetime: use the module from gnulib
Giuseppe Scrivano [Wed, 25 Nov 2015 09:37:21 +0000 (10:37 +0100)]
parse-datetime: use the module from gnulib

Use the parse-datetime module from gnulib, and adapt it to not require
other modules as portability is not really an issue for us.

DATE can be specified in different formats, such as: "-1 week", "last
monday", "1 week ago".

Include the generated .c file in the repository so to not add another
dependency to Bison.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoRelease 2015.11
Colin Walters [Fri, 4 Dec 2015 14:53:03 +0000 (09:53 -0500)]
Release 2015.11

10 years agogpg-verifier: Fix compiler warning
Colin Walters [Fri, 4 Dec 2015 14:51:14 +0000 (09:51 -0500)]
gpg-verifier: Fix compiler warning

10 years agorepo: Fix backwards timestamp in ostree_repo_write_commit()
Matthew Barnes [Thu, 3 Dec 2015 17:01:38 +0000 (12:01 -0500)]
repo: Fix backwards timestamp in ostree_repo_write_commit()

ostree_repo_write_commit_with_time() converts the timestamp to
big-endian byte order.

ostree_repo_write_commit() was also doing this when calling
ostree_repo_write_commit_with_time(), resulting in a corrupted
commit object (timestamp bytes were backwards).

Recent regression in 14ffd7022a8c840f277c81e53864be4ea5fabacb

10 years agoremote: Print full refspec in "ostree remote refs"
Matthew Barnes [Wed, 2 Dec 2015 19:51:00 +0000 (14:51 -0500)]
remote: Print full refspec in "ostree remote refs"

Just to make copy-and-paste a little easier, as I often use this command
immediately before rebasing.

 e.g.

 # ostree remote refs fedora-atomic
 fedora-atomic:fedora-atomic/f23/x86_64/docker-host
 fedora-atomic:fedora-atomic/f23/x86_64/testing/docker-host
 ^^^^^^^^^^^^^^ (this part is new)

 # rpm-ostree rebase fedora-atomic:fedora-atomic/f23/x86_64/testing/docker-host

10 years agofetcher: Remove "total_requests" counter
Matthew Barnes [Fri, 13 Nov 2015 20:45:15 +0000 (15:45 -0500)]
fetcher: Remove "total_requests" counter

Incremented, but not used for anything.

10 years agofetcher: Remove "sending_messages" hash table
Matthew Barnes [Mon, 9 Nov 2015 20:30:24 +0000 (15:30 -0500)]
fetcher: Remove "sending_messages" hash table

Vestige of ostree_fetcher_query_state_text(), removed last year.

10 years agoglnx: Update from master
Matthew Barnes [Mon, 23 Nov 2015 19:49:06 +0000 (14:49 -0500)]
glnx: Update from master

More autocleanup backports, this time GFileOutputStream.

10 years agotrivial-httpd: Avoid SoupBuffer when there's no content
Matthew Barnes [Mon, 23 Nov 2015 19:29:03 +0000 (14:29 -0500)]
trivial-httpd: Avoid SoupBuffer when there's no content

This was supposed to be merged into the previous commit, but I
messed up.

10 years agorepo: Never delete .commitmeta files
Matthew Barnes [Mon, 23 Nov 2015 16:04:31 +0000 (11:04 -0500)]
repo: Never delete .commitmeta files

Do not delete a .commitmeta file after removing the last metadata entry.
This way a client will pull the empty .commitmeta file and overwrite old
metadata as expected.

https://bugzilla.gnome.org/750459

10 years agorepo: Validate checksums have correct length
Matthew Barnes [Tue, 17 Nov 2015 00:29:59 +0000 (19:29 -0500)]
repo: Validate checksums have correct length

ostree_checksum_bytes_peek() can return NULL if the checksum has an
incorrect length (most likely from disk corruption) but most callers
are not prepared to handle this and would likely crash.

Use ostree_checksum_bytes_peek_validate() instead, which sets a
GError on an invalid checksum.

10 years agotests: prefix invocation of ostree with where missing
Giuseppe Scrivano [Mon, 9 Nov 2015 12:03:35 +0000 (13:03 +0100)]
tests: prefix invocation of ostree with  where missing

And add a syntax rule to avoid this in future.

Fixed by:

sed -i -e 's|^ostree |${CMD_PREFIX} ostree |g' tests/*.sh

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add tests for prune --keep-younger-than=DATE
Giuseppe Scrivano [Mon, 9 Nov 2015 11:07:16 +0000 (11:07 +0000)]
tests: add tests for prune --keep-younger-than=DATE

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocommit: add --timestamp=TIMESTAMP
Giuseppe Scrivano [Mon, 9 Nov 2015 10:35:46 +0000 (10:35 +0000)]
commit: add --timestamp=TIMESTAMP

It allows to override the timestamp of the commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
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.