Commit Graph

2380 Commits

Author SHA1 Message Date
Colin Walters
d456fe5adb libglnx porting: Use glnx_set_error_from_errno
⚠️ There is a notable spiked pit trap here around
`posix_fallocate()` and `errno`.  This has bit other projects,
see e.g.
7bb87460e6

Otherwise the port was straightforward.
2016-03-23 10:26:01 -04:00
Colin Walters
614483ecd1 Use GSubprocess instead of GSSubprocess (libgsystem removal)
Since we hard-depend on GLib 2.40, we can start using GSubprocess.
This is part of dropping our dependency on libgsystem, which is
deprecated in favor of libglnx (as well as migrating things to GLib).
2016-03-23 10:26:01 -04:00
Colin Walters
afb6105a51 admin-switch: Add missing reboot argument
Spotted by jlebon in https://github.com/GNOME/ostree/pull/211
2016-03-23 09:42:17 -04:00
Simon McVittie
3f6f2e2a2f test-libarchive: fix underlinking
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-03-21 13:03:06 -04:00
Simon McVittie
0a7e128782 Skip test_libarchive_ignore_device_file if we cannot write xattrs
The test tries to get a filesystem that supports xattrs by writing
to /var/tmp, but in some automated build environments the entire
build chroot is on a tmpfs.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-03-21 13:02:49 -04:00
Simon McVittie
35f412c86a tests/admin-test.sh: add #!/bin/sh
This is executable and appears to be intended to be executed directly,
so it should have a #! line.
2016-03-21 13:02:25 -04:00
Colin Walters
63e1c86dcd mkdocs: Fix the site name 2016-03-21 12:53:40 -04:00
Colin Walters
8894bb3949 deploy: Handle a read-only /boot
I'd like to encourage people to make OSTree-managed systems more
strictly read-only in multiple places.  Ideally everywhere is
read-only normally besides `/var/`, `/tmp/`, and `/run`.

`/boot` is a good example of something to make readonly.  Particularly
now that there's work on the `admin unlock` verb, we need to protect
the system better against things like `rpm -Uvh kernel.rpm` because
the RPM-packaged kernel won't understand how to do OSTree right.

In order to make this work of course, we *do* need to remount `/boot`
as writable when we're doing an upgrade that changes the kernel
configuration.  So the strategy is to detect whether it's read-only,
and if so, temporarily mount read-write, then remount read-only when
the upgrade is done.

We can generalize this in the future to also do `/etc` (and possibly
`/sysroot/ostree/` although that gets tricky).

One detail: In order to detect "is this path a mountpoint" is
nontrivial - I looked at copying the systemd code, but the right place
is to use `libmount` anyways.
2016-03-21 12:49:05 -04:00
Colin Walters
b842429bf2 manual: Migrate related projects wiki page into manual
This content currently lives here:
<https://wiki.gnome.org/Projects/OSTree/RelatedProjects>.  Moving it
into the manual in Markdown:

 - Makes it look better
 - It's more useful alongside the rest of the docs
 - Is much less crummy in general than the GNOME wiki
2016-03-18 13:11:54 -04:00
Alexander Larsson
cb60de0f95 Don't fail "ostree remote refs" if writing the summary cache is not permitted
It used to be allowed to run something like "ostree remote refs" on
a read-only (e.g. system) repo. However, the summary cache caused that to
break. This commit just makes it not save the cache if we get some kind
of permission error when writing it. It'll still work, even without the
cache.

https://bugzilla.gnome.org/show_bug.cgi?id=763855
2016-03-18 17:33:39 +01:00
Colin Walters
c58ad36840 libglnx porting: gs_transfer_out_value -> g_steal_pointer
It's a bit more verbose but...eh.
2016-03-18 12:08:19 -04:00
Colin Walters
b67f5364ac libglnx porting: xattr calls
These are straightforward as the libgsystem versions were already just
equivalent shims.
2016-03-18 12:08:19 -04:00
Colin Walters
684029daa3 libglnx porting: gs_free -> g_autofree
There were surprisingly few uses left.
2016-03-18 12:08:19 -04:00
Colin Walters
ac4c298061 libglnx porting: gs_fd_close -> glnx_fd_close
I'd like to eventually kill libgsystem.
2016-03-18 12:08:19 -04:00
Colin Walters
a02b425fc2 tests: Strengthen test tmpdir sanity check, be compat with ginsttest saving
GNOME Continuous uses ginstest-runner --report-directory, which causes
the tests to save their tmpdirs persistently.  This also means the
result directories didn't match the `/(var/)?tmp` regexp, which broke
the ostree tests in GContinuous.

Fix this by simply asserting that the tmpdir either has `.tmpdir` or
nothing.
2016-03-18 08:45:25 -04:00
Colin Walters
8057254b0b contrib/golang: Initial golang bindings
We were considering using this for Docker integration, but we may end
up going a different architectural path.  Anyways, it doesn't hurt to
have the bindings in here - they can do a few things.

I decided to fork some of the core code from
https://github.com/dradtke/gotk3 because...well, what we really need a
GIR-based core generator but I didn't want to start on the fully
correct thing until we knew we wanted it, and this was a quick hack.

Also, let's make a `contrib/` directory for things like this.
2016-03-17 09:02:24 -04:00
Colin Walters
f51d651b10 docs: Add a section on writing buildsystems
And add a test that is a demo buildsystem.
2016-03-16 17:15:58 -04:00
Micah Abbott
0b068c668a docs: Cleanup Markdown
I was going through the new version of the docs and noticed a few
problems.  Mostly URLs that aren't linked, extra whitespace, and a few
mis-spellings.

I ran the files through `aspell check` and made some manual changes
myself.

These changes were tested locally with `mkdocs serve`
2016-03-16 15:02:18 -04:00
Alexander Larsson
89624ee57d rofiles-fuse: Fix permission comparison
We want to allow write if the devinode is in the set,
not the other way around.

https://bugzilla.gnome.org/show_bug.cgi?id=763676
2016-03-16 16:30:53 +01:00
Alexander Larsson
9b919c8dd2 repo: Fix the skip-summary-if-summary.sig-is-same cache
This code was always downloading the summary even for a cache hit due
to a missing else.
2016-03-15 12:04:43 +01:00
Giuseppe Scrivano
2bb25a05b0 tests: add test for summary file caching
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-15 09:48:47 +01:00
Giuseppe Scrivano
cff4e48d02 prune: delete all cached summaries files
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-15 09:48:47 +01:00
Giuseppe Scrivano
2bf84d7e5d repo: use the skip summary download optimization for repo_remote_fetch_summary
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-15 09:48:47 +01:00
Giuseppe Scrivano
58b48424bc pull: cache summary and summary.sig
It allows an optimization to skip the download of the summary file
if its .sig file is unchanged.

Downloading the .sig file is much cheaper than downloading the summary
file from repositories with many branches.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-15 09:48:47 +01:00
Giuseppe Scrivano
a98133072d libotutil: new function ot_openat_ignore_enoent
Refactor some common code

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-15 09:48:47 +01:00
Colin Walters
89514dd8ba docs: Reference the git docs on references 2016-03-09 14:07:52 -05:00
Colin Walters
6cc7238c4d build: Don't install test data without --enable-installed-tests
Otherwise $(installed_testdir) is empty so we try to put content in
`/`, which I noticed when trying to build an RPM (it works works fine
`sudo make install`).
2016-03-08 14:48:10 -05:00
Colin Walters
e2234e854d tests/basic: Fix race in timestamp test
%Z only uses seconds, so it's possible that we did the commit
in the same second, which made this test racy.

- Switch to full nanosecond precision using '%.Y' so it always differs
- Fix the inverted `cmp` usage
- Add a missing `ok`
2016-03-04 10:53:47 -05:00
Colin Walters
fea786cb2d lib: Add ostree_sysroot_load_if_changed() API
This will allow daemons like rpm-ostree to detect if there are any new
deployments efficiently, in combination with using inotify.  If there
are any changes, rpm-ostree wants publish them on DBus.

While we're here, add some changes to start doing unit C testing of
the sysroot API.
2016-03-03 21:56:23 -05:00
Colin Walters
ebd0370976 tests: Unify some tmpdir code, add ability for C to use libtest.sh
I want to be able to easily test the C API on actual data in an OSTree
repo.  The shell `libtest.sh` has code to generate it.  Bridge the two
worlds by introducing a little `libostreetest` library which has a C
API which spawns a shell that runs things in `libtest.sh`.

Yes, this is about as beautiful as it sounds, which is to say, it's
not.  But it works!

Note while we were here, I realized we were actually now creating
*two* tmpdirs per test in `make check` because the tap driver was
already doing that.  Unify it so we know the C code can rely on it.
2016-03-03 18:03:32 -05:00
Colin Walters
12db46e5af tests: More TAP fixups
Hopefully getting closer now.
2016-03-03 18:00:54 -05:00
Colin Walters
fbd9409ebb lib: Add ostree_sysroot_init_osname() API, bump mtime
And change the command line to use it.  rpm-ostree had a copy
of this code, and thus there's a clear reason to have an API.

While we're moving this into API, ensure the mtime on deploy is bumped
after an osname is created, so that daemons like rpm-ostree can notice
changes.  (In reality, creating the directory should do this, but
let's be double sure)
2016-03-03 14:21:57 -05:00
Colin Walters
7ace5d35bd docs/introduction: Note VMs vs baremetal 2016-03-03 14:20:44 -05:00
Colin Walters
0174224a2d tests: Convert two more exit 77 instances into TAP-compatible SKIP
Followup to https://github.com/GNOME/ostree/pull/194
2016-03-03 14:19:10 -05:00
Colin Walters
d49718a619 deploy: Bump the mtime on ostree/deploy after deployments finish
This allows other processes (e.g. rpm-ostreed) to monitor for external
changes (e.g. if someone does `ostree admin undeploy`) in a relatively
sane fashion.

Specifically, I'm trying to fix:
https://github.com/projectatomic/rpm-ostree/issues/220
2016-03-03 08:52:42 -05:00
Colin Walters
d25212f04a tests: Port to glib-tap.mk, make make check run all of the tests
OSTree's code for testing predates the `glib-tap.mk` making its
way into GLib.  Let's switch to it, as it provides a number
of advantages.

By far the biggest advantage is that `make check` can start to run
most of the tests *in addition* to having them work installed.

This commit keeps the installed tests working, but `make check` turns
out to be really broken because...our TAP usage has bitrotted to say
the least.  Fix that all up.

Do some hacks so that the tests work uninstalled as well - in
particular, `glib-tap.mk` and the bits encoded into
`g_test_build_filename()` assume *recursive* Automake (blah).  Work
around that by creating a symlink when installed to loop back.
2016-03-03 08:50:19 -05:00
Giuseppe Scrivano
6d73a620e1 refs: Add argument --list to print the full ref name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:53:14 -05:00
Giuseppe Scrivano
3e3621b7b6 libostree: Adjust cleanup_ref_prefix to use ostree_repo_list_refs_ext
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:52:02 -05:00
Giuseppe Scrivano
c9b02ae1f3 refs: add tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:52:02 -05:00
Giuseppe Scrivano
a4be237a2e refs: allow to specify multiple refs as args
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:52:02 -05:00
Giuseppe Scrivano
898c7b6577 ostree-repo: new public function ostree_repo_list_refs_ext
It accepts a `flags` argument to control its behavior.  Differently
from `ostree_repo_list_refs`, the `refspec_prefix` is not removed from
the results.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:52:02 -05:00
Colin Walters
5d463ba577 Add a missing #include to fix "make check" 2016-03-02 10:29:41 -05:00
Colin Walters
3efdcb54b7 repo: Add ostree_repo_get_dfd()
I plan to use this in rpm-ostree at least for two reasons:
 - To find the mtime on the repo
 - To use the tmp/ directory to stage content (but we should eventually
   add a better API)
2016-03-01 21:52:22 -05:00
Colin Walters
16979cc5ed lib: Introduce versioned symbols
As rpm-ostree evolves, it keeps driving API additions to libostree.
This creates a relatively tight coupling.

However, if delivering via e.g. RPM, unless one manually remembers to
increment the `Requires:` in the spec file, it's possible for the two
to become desynchronized.

RPM handles versioned symbols and will ensure a dependency if the
application starts using a newer version.

To implement this, switch to `-fvisibility=hidden`, along with an
annotation in the header, and finally add a `.sym` file.

This matches what other projects like systemd and libvirt do.

Although rather than attempting to retroactively version symbols, glom
them all onto the current one.
2016-03-01 21:45:26 -05:00
Giuseppe Scrivano
2badf36cfd test-rofiles-fuse: skip when fusermount is not present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-01 10:08:25 -05:00
Giuseppe Scrivano
82d4e7fe68 Fix make syntax-check
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-01 10:08:25 -05:00
Colin Walters
96d12b3f68 docs: Add a blurb on the summary file
We expect people to use it now, so let's actually describe what it is.
2016-02-27 11:28:54 -05:00
Colin Walters
3d7098bc5e Release 2016.3 2016-02-26 11:58:05 -05:00
Colin Walters
5345573470 deltas: Add a compression size heuristic for endianness detection
I see when analyzing a delta here that due to byteswapping a negative
compression ratio of 540%, 66%, and 28%.  Let's arbitrarily pick 20%
as a threshold for detecting byetswapping.
2016-02-26 08:19:01 -05:00
Colin Walters
7fdf072710 deltas: Heuristically detect endianness for older deltas
If the average object size is greater than 4GiB, let's assume we're
dealing with opposite endianness.  I'm fairly confident no one is
going to be shipping peta- or exa- byte size ostree deltas, period.
Past the gigabyte scale you really want bittorrent or something.
2016-02-26 08:19:01 -05:00