Commit Graph

2148 Commits

Author SHA1 Message Date
Colin Walters
687a6f8314 Add internal ot_openat_read_stream() helper
We had two cases which were creating an input stream using openat().
2015-01-07 08:41:45 -05:00
Colin Walters
026c5c60d3 Use *at() functions for native filesystem commits
This is just an efficiency optimization.  We're getting fairly close
to all of the hot code paths using `*at()`.

Note that we end up maintaining a half-duplicate code path set here,
because we still need to support commits from an arbitrary GFile *,
which in a possible common case is an OSTree commit.

I think it's worth it though.
2015-01-06 22:43:14 -05:00
Colin Walters
cf8d6848b3 refs: Use G_IO_ERROR_NOT_FOUND when a ref lookup fails
rpm-ostree had code to check for this, which didn't actually work.

I don't see a no backwards compatibility concern in changing this, as
it's unlikely a caller would try to sensibly disambiguate FAILED.
2015-01-06 18:47:04 -05:00
Colin Walters
86764dbf00 repo: Improve ostree_repo_load_file() to use *at() for xattrs
We were already using openat() for the contents, but not the xattrs.
Now that libgsystem 2014.3 has gs_fd_get_all_xattrs(), make use of it.

Clean things up a bit so we only open the fd once.
2015-01-06 16:47:03 -05:00
Colin Walters
6dab41ba77 deploy: Update to use latest libgsystem API 2015-01-06 12:46:21 -05:00
Colin Walters
01f6d68c60 deploy: Actually copy xattrs of modified config files
Regression from 7b01bd2e43
where we stopped using g_file_copy() - we lost copying xattrs.

This specifically breaks /etc/shadow SELinux labeling, with the
obvious bad consequences.

https://bugzilla.gnome.org/show_bug.cgi?id=742289
2015-01-06 10:55:44 -05:00
Matthew Barnes
7727fe84d9 Require a PREFIX when deleting refs
Also fix the "ostree refs" help output to not give the impression that
the --delete option takes its own PREFIX argument.

https://bugzilla.gnome.org/show_bug.cgi?id=742454
2015-01-06 10:33:12 -05:00
Colin Walters
1e8e070102 Port to libgsystem errno API, hard depend on 2014.3
This is long overdue to make it to libgsystem.  Update our dependency.
2015-01-04 21:17:11 -05:00
Colin Walters
1bcc7a8e3a Merge branch 'giuseppe/staticdeltas' of https://github.com/giuseppe/ostree 2014-12-19 16:31:31 -05:00
Colin Walters
125889fd7e Enforce 'rdev' (device file major/minor) is 0
Historically OSTree supported device files, but it wasn't useful, and
added attack surface.  Support was removed in

https://git.gnome.org/browse/ostree/commit/?id=62a896350bd54bff5a9413d2ee0fad7ff4364f9a

Perform a further cleanup by enforcing internally that the device
major/minor must be 0.

Conflicts:
	src/libostree/ostree-core.c
2014-12-19 10:20:05 -05:00
Colin Walters
c4efbf6718 core: Deduplicate code converting struct stat -> GFileInfo
We were doing the same thing in a number of places, make a helper
function.
2014-12-19 10:18:59 -05:00
Matthew Barnes
880328ba03 Add ostree_repo_pull_default_console_progress_changed()
Replaces ot_common_pull_progress() in ostree binary, so it can be shared
with rpm-ostree.
2014-12-18 21:31:53 -05:00
Colin Walters
abb88336b3 repo: Minor cleanup: Move size generation code initialization
It has a global effect, so do it in the entrypoint.
2014-12-18 18:06:56 -05:00
Giuseppe Scrivano
6e60c05d2f Remove unused variable warning 2014-12-18 12:48:47 +01:00
Giuseppe Scrivano
ed2b56a430 fix --help for static-delta
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-12-18 12:48:47 +01:00
Colin Walters
5c47389243 test-rollsum: Process all input, print more statistics
Copying the bup code, we need to loop over all chunks even after
hitting the rollsum returning 0.

Also print more statistics.
2014-12-18 12:48:47 +01:00
Colin Walters
ca678224be Static deltas support
https://bugzilla.gnome.org/show_bug.cgi?id=721799
2014-12-18 12:48:47 +01:00
Giuseppe Scrivano
a23b3b332e Revert "ostree-repo-pull: Remove currently #if 0 static delta code"
This reverts commit 1c2e20af25.
2014-12-18 12:48:47 +01:00
Matthew Barnes
880940f93b doc: Update gtk-docs 2014-12-17 19:34:17 -05:00
Matthew Barnes
e54d48be39 Add "ostree remote list" command
Lists available remote names.
2014-12-17 16:05:53 -05:00
Matthew Barnes
39be27fc93 Add ostree_repo_remote_list()
Lists available remote names.
2014-12-17 16:05:37 -05:00
Colin Walters
fd07a6a862 Release 2014.13 2014-12-17 11:35:52 -05:00
Colin Walters
d3edda5edc basic-test: Fixup mtime check for bare-user
https://bugzilla.gnome.org/show_bug.cgi?id=741662
2014-12-17 11:34:10 -05:00
Colin Walters
9dadebb501 tests: Fix two bugs in tests revealed by new remote changes 2014-12-17 10:43:01 -05:00
Colin Walters
f6a6e68412 Add more flexible _remote_change() API , expose via 'ostree remote'
For Anaconda, I needed OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
with the GFile *sysroot argument to avoid ugly hacks.  We want to
write the content provided via "ostreesetup" as a remote to the target
chroot only in the case where it isn't provided as part of the tree
content itself.

This is also potentially useful in idempotent systems management tools
like Ansible.

https://bugzilla.gnome.org/show_bug.cgi?id=741577
2014-12-15 21:28:09 -05:00
Colin Walters
8067e977a7 repo: (cleanup) Use _is_system() rather than inlining it
No reason to duplicate the code.
2014-12-15 13:59:46 -05:00
Matthew Barnes
fa6e7b4b01 Improve "ostree remote" help output
Must have glossed over these because the commands are so simple.

 - List subcommands for "ostree remote --help".

 - Only show options relevant to COMMAND for
   "ostree remote COMMAND --help".
2014-12-09 09:56:30 -05:00
Colin Walters
f7c926c5e9 trivial-httpd: use PR_SET_PDEATHSIG by default
If we're not daemonizing, this is a useful way to ensure we go away if
our parent does.

https://bugzilla.gnome.org/show_bug.cgi?id=741264
2014-12-08 14:47:37 -05:00
Alexander Larsson
e908ebd9b3 test-local-pull: Sort find output to make test robust
There is no guarantee that find will produce output in the same
order, so we need to sort the output to ensure we always
get the same output.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 20:28:09 +01:00
Matthew Barnes
ac882f2128 repo: Add private functions to access remote options
ostree_repo_pull_with_options() needs this, and I'd rather keep the
OstreeRemote struct definition tucked away in ostree-repo.c with its
own internal API.
2014-12-08 12:49:25 -05:00
Matthew Barnes
f79896693e repo: Add ostree_repo_remote_get_url()
Peeking at remote details by way of ostree_repo_copy_config() doesn't
work anymore.
2014-12-08 12:49:23 -05:00
Matthew Barnes
17b9e399b8 repo: Add an internal struct to manage remotes
OstreeRemote is a reference-counted struct that encompasses data about a
remote, whether read from a configuration file or created explicitly via
ostree_repo_remote_add().

OstreeRemotes are held in an internal table indexed by remote name.
This solves some problems caused by merging system-wide remote data into
the OstreeRepo's internal config key file.

Also fixes https://bugzilla.gnome.org/show_bug.cgi?id=740911
2014-12-08 12:49:10 -05:00
Matthew Barnes
f3dcb7a052 libotutil: Add ot_keyfile_copy_group()
Copies all the keys of a group from one GKeyFile to another.
2014-12-08 12:47:19 -05:00
Alexander Larsson
dbf717ac4b Add local-pull archive-z2 <=> bare-user roundtrip test
This creates a archive-z2 repo, pull-locals it to bare-user and then
again back to archive-z2 making sure things fsck along the way.
Then it checks out all repos and makes sure each one reproduces
the same result.

Unfortunately we can't install this as a real test because
it doesn't work in the test-runner because tmpfs doesn't support
user xattrs.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 12:03:27 +01:00
Alexander Larsson
fcd3caf6dd Add test-basic-user.sh testing for bare-user repos
This just does whatever test-basic.sh does, but on a bare-user
repo.

This works standalone, but unfortunately it breaks in
gnome-desktop-testing-runner as /tmp doesn't support
xattrs, so it is not installed atm.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Alexander Larsson
a3422791d4 Split out basic tests from test-basic.sh
This will let us reuse them with other repo types

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Alexander Larsson
47c612e5a0 Support for "bare-user" repo format
This format is pretty much the same as the "bare" format, except the
file ownership and xattrs is not stored in the actual filesystem object, but
rather on the side in a user xattr. This means two things:

1) An unprivileged user can store such a repo independent of the types
   of files in it or their xattrs. And you can later (as root)
   reconstruct the real filesystem tree with ownership. Although you
   can't do that using hardlink-sharing. This also means ostree
   fsck does a full verification.

2) Such a repository can be checked out with user-mode (checkout -U)
   as an unprivileged user using hardlinks for space sharing.

Additionally, symlinks are stored as regular files (with the content
being the symlink target) because user xattrs are not supported on
symlinks. We know at checkout time if the file is a symlink because
the original st_mode is stored in the xattr metadata.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:39 +01:00
Alexander Larsson
26a47b9cca Add ot_lgetxattrat and ot_lsetxattrat utils
These are implementation of the missing corresponding syscalls that
are done with the /proc/self/fd mechanism described at:

https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:39 +01:00
Colin Walters
b8a06c11f6 README.md: Add a quick blurb on style 2014-12-07 17:19:42 -05:00
Alexander Larsson
22ed7d0fbf union checkout: Fix symlink handling for xattrs
Applying xattrs on a symlink during checkout failed since
it was setting the xattrs on the final filename, not the
temporary name.

This made the "checkout union 1" test in test-basic.sh
fail.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-05 15:53:42 +01:00
Alexander Larsson
bb82c17701 checkout: fchown symlink to proper uid/gid
When commiting a symlink we do store the uid/gid of the actual
symlink (i.e. not target). However, this was not restored
on non-user-mode checkout as it should.

This commit fixes that, and additionally it ensures xattrs
on symlinks are not set in user-mode checkout.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-04 20:30:10 +01:00
Colin Walters
37a059925f deploy: Ensure that we can deploy using only /usr/lib/ostree-boot
rpm-ostree at least has the option to generate a tree with just that
instead of /boot, but while we were enumerating the latter, we'd still
return paths from /boot.

https://bugzilla.gnome.org/show_bug.cgi?id=740947
2014-11-30 23:14:05 -05:00
Kenjiro Nakayama
1a3f2cce5d docs: Add verbose option to manual 2014-11-30 13:42:29 -05:00
Colin Walters
2731155950 README.md: Mention patches and test suite 2014-11-30 13:23:06 -05:00
Colin Walters
546237cc6f docs: Fix a pile of Docbook validation errors
At least now validates with RNG mode in Emacs.
2014-11-29 12:15:21 -05:00
Colin Walters
f8a3d82da8 Release 2014.12 2014-11-26 11:56:10 -05:00
Colin Walters
038ba3dade tests: Fix u-boot test failure
This bit needs to be specific to syslinux.
2014-11-25 15:21:12 -05:00
Colin Walters
387ee4cd65 trivial: Fix typo in previous commit 2014-11-25 13:47:54 -05:00
Colin Walters
12187994e2 grub2: If using --sysroot, run in chroot
In Anaconda, we're using "ostree admin --sysroot=/mnt/sysimage
instutil set-kargs", and it was working before, but newer versions of
lorax strip out /etc/system-release which grub2 wants.

That was wrong anyways as we want the /etc/system-release from the
target root.

(Man, grub2 sucks...give me a declarative config file format I can just
 write)

https://bugzilla.gnome.org/show_bug.cgi?id=740697
2014-11-25 12:24:06 -05:00
Matthew Barnes
97558276e4 Refactor command-line parsing
Refactor command-line parsing to better utilize GOptionContext.  This
eliminates most of the manual parsing and global options are now shown
in the help output.

Here's a sample:

    $ ostree admin --help
    Usage:
      ostree admin [OPTION...] --print-current-dir|COMMAND

    Builtin "admin" Commands:
      cleanup
      config-diff
      deploy
      init-fs
      instutil
      os-init
      status
      switch
      undeploy
      upgrade

    Help Options:
      -h, --help         Show help options

    Application Options:
      --sysroot=PATH     Create a new OSTree sysroot at PATH
      -v, --verbose      Print debug information during command processing
      --version          Print version information and exit

https://bugzilla.gnome.org/show_bug.cgi?id=740295
2014-11-24 19:36:07 -05:00