summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-checkout.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-86/+89
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* Support overlayfs whiteouts on checkoutMiguel Angel Ajo2022-09-281-1/+6
| | | | | | | | | | | | Introduces an intermediate format for overlayfs storage, where .wh-ostree. prefixed files will be converted into char 0:0 whiteout devices used by overlayfs to mark deletions across layers. The CI scripts now uses a volume for the scratch directories previously in /var/tmp otherwise we cannot create whiteout devices into an overlayfs mounted filesystem. Related-Issue: #2712
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* bin/checkout: Port some to new styleColin Walters2020-11-111-69/+31
| | | | | I was reading this code for unrelated reasons and noticed it was still old style; port most (but not all) to new style.
* checkout: Don't hardlink zero sized filesColin Walters2020-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | Alternative to https://github.com/ostreedev/ostree/pull/2197 Python's (usually) zero-sized `__init__.py` files can provoke us hitting the hardlink limits on some filesystems (`EMLINK`). At least one Fedora rpm-ostree user hit this. The benefits of hardlinking here are quite marginal; lots of hardlinks can behave suboptimally in particular filesystems like BTRFS too. This builds on prior code which made this an option, introduced in https://github.com/ostreedev/ostree/commit/673cacd633f9d6b653cdea530657d3e780a41bbd Now we just do it uncondtionally. Also this provoked a different bug in a very obscure user mode checkout case; when the "real" permissions were different from the "physical" permissions, we would still hardlink. Fix the test case for this.
* Avoid shadowing local variablesavoid-shadowsPhaedrus Leeds2020-09-131-16/+16
| | | | | | This should help with code readability. Fixes https://github.com/ostreedev/ostree/issues/2194
* checkout: use FILE as option argument string for --skip-listStefan Agner2020-06-081-1/+1
| | | | | | | Align with --from-file and use 'FILE' instead of 'PATH' as option argument string. No functional change, this is only cosmetics. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
* lib/util: Drop unneeded ot-tool-util.h includesRobert Fairley2019-06-211-1/+0
| | | | | | | | | With `ot-tool-util.h` made visible in `otutil.h` (in be2572bf68090a5e277338d2613d3c7d53b0c9e8), drop previous includes of `ot-tool-util.h` elsewhere. Closes: #1876 Approved by: zonggen
* repo: Add a checkout option to not hardlink zero-sized filesColin Walters2018-10-111-1/+5
| | | | | | | | | | | | | | | | | | | | | In rpm-ostree we've hit a few cases where hardlinking zero-sized files causes us problems. The most prominent is lock files in `/usr/etc`, such as `/usr/etc/selinux/semanage.LOCK`. If there are two zero-sized lock files to grab, but they're hardlinked, then locking will fail. Another case here is if one is using ostree inside a container and don't have access to FUSE (i.e. `rofiles-fuse`), then the ostree hardlinking can cause files that aren't ordinarily hardlinked to become so, and mutation of one mutates all. An example where this is concerning is Python `__init__.py` files. Now, these lock files should clearly not be in the tree to begin with, but - we're not gaining a huge amount by hardlinking these files either, so let's add an option to disable it. Closes: #1752 Approved by: jlebon
* lib/checkout: add filter API to skip over filesJonathan Lebon2018-02-061-1/+36
| | | | | | | | | | | | | | | | This is analogous to the filtering support for the commit API: we allow library users to skip over checking out specific files. This is useful in some tricky situations where we *know* that the files to be checked out will conflict with existing files in subtle ways. One such example is in rpm-ostree support for multilib. There, we want to allow checking out a package onto an existing tree, but skipping over files that are not coloured to our preferred value (e.g. not overwriting an i686 version of `ldconfig` if we already have the `x86_64` version). See https://github.com/projectatomic/rpm-ostree/pull/1227 for details. Closes: #1441 Approved by: cgwalters
* bin/checkout: add --selinux-policy switchJonathan Lebon2018-02-021-4/+35
| | | | | | | | This was already supported by the underlying API. Expose it so that we can test it. Closes: #1442 Approved by: cgwalters
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* ostree: provide command description in a better placeRuixin Bao2017-10-201-1/+1
| | | | | | | | | | | | | | | | | | | This is similar idea as https://github.com/projectatomic/rpm-ostree/pull/916/commits/5c0bf889155573feec108501ce849ac09a0c9567, The duplicated description is now removed, and the description of the command is now displayed beneath the Usage. For example: ostree cat -h will output the following: "Usage: ostree cat [OPTION?] COMMIT PATH... Concatenate contents of files" Closes: #1267 Approved by: cgwalters
* ostree: move flags into command struct, pass down through builtinsRuixin Bao2017-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | This is a similar approach as https://github.com/projectatomic/rpm-ostree/commit/12c34bb2491a07079c911ef26401fee939e5573c. One thing to note is when we parse the admin related functions, we still keep the old admin related flags, and added a new parameter to represent the command struct. This allows us to identify the caller of the function, making it easier for us to possibly deduplicate the subcommand handling in the future. A similar approach is done in rpm-ostree: https://github.com/projectatomic/rpm-ostree/commit/83aeb018c1012c7a43783c09b74ec71bc9c45826 This also makes it easier for us to change the prototype of the function. If we want to add something new in the future, we won't need to touch every prototype. Closes: #1267 Approved by: cgwalters
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* lib/checkout: Rename disjoint union, change to merge identical filesColin Walters2017-09-131-9/+17
| | | | | | | | | | | | | It turns out that librpm automatically merges identical files between distinct packages, and this occurs in practice with Fedora today between `chkconfig` and `initscripts` for exmaple. Since we added this for rpm-ostree, we basically want to do what librpm does, let's change the semantics to do a merge. While we're here rename to `UNION_IDENTICAL`. Closes: #1156 Approved by: jlebon
* checkout: add an extra checkout_overwrite modeRuixin2017-09-011-1/+17
| | | | | | | | | | | | This is for issue projectatomic/rpm-ostree#365, an extra option of overwrite mode is added to the checkout command so that when there is "non-directory" file already exist during checkout, the error will be handled. Some tests are added for regression Closes: #1116 Approved by: cgwalters
* ostree: Add naggy comments to help keep options in syncMatthew Barnes2017-08-151-0/+5
| | | | | | | | | | /* ATTENTION: * Please remember to update the bash-completion script (bash/ostree) and * man page (man/ostree-$COMMANDNAME.xml) when changing the option list. */ Closes: #1080 Approved by: cgwalters
* tree-wide: Use g_autoptr(Ostree*)Colin Walters2017-08-031-1/+1
| | | | | | | | | | | Part of cleaning up our usage of libglnx; we want to use what's in GLib where we can. Had to change a few .c files to `#include ostree.h` early on to pick up autoptrs for the core types. Closes: #1040 Approved by: jlebon
* lib/checkout: Add bareuseronly_dirs optionColin Walters2017-06-131-1/+5
| | | | | | | | | | | | | | | This is a continuation of https://github.com/ostreedev/ostree/pull/926 for directories instead of files. See: https://github.com/flatpak/flatpak/issues/845 This option suppresses mode bits outside of `0775` for directory checkouts. I think most people should start doing this by default, and use explicit overrides for e.g. `/tmp` if doing a recommit based on a checkout. Closes: #927 Approved by: alexlarsson
* ostree: Use G_OPTION_ARG_FILENAME where appropriatePhilip Withnall2017-04-271-1/+1
| | | | | | | | | | | | | Instead of using G_OPTION_ARG_STRING, use G_OPTION_ARG_FILENAME, which handles filename encoding conversion differently from the locale conversion which G_OPTION_ARG_STRING. This will fix argument handling on systems where the filename encoding is not the same as the locale encoding (which is fairly unlikely since most systems use UTF-8). Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #810 Approved by: cgwalters
* repo: Add a "force copy" flag to checkoutColin Walters2017-04-241-1/+9
| | | | | | | | | | | This is intended to be used for copying `/usr/etc` → `/etc` for deployments. A TODO here is to use `glnx_file_copy_at()` if the repo mode allows it - then we'd use reflinks if available. Closes: #804 Approved by: jlebon
* checkout: Support a "pure addition" modeColin Walters2017-03-061-3/+14
| | | | | | | | I plan to use this for `rpm-ostree livefs`. https://github.com/projectatomic/rpm-ostree/issues/639 Closes: #714 Approved by: jlebon
* tree-wide: Switch to autoptr for GOptionContextColin Walters2016-12-081-3/+1
| | | | | | | | | | We were leaking in a few places that I noticed in an ASAN run. Also, this was one of the last non-autoptr cleanup sections we have in `out:` cleanup sections, making us a lot closer to a potential full-tree rewrite to `return FALSE`. Closes: #624 Approved by: jlebon
* libostree, ostree: fix usage of ostree_repo_checkout_tree_atGiuseppe Scrivano2016-07-301-6/+6
| | | | | | | | | it was deprecated, use ostree_repo_checkout_at. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #417 Approved by: cgwalters
* checkout: Add an option to require hardlinksColin Walters2016-06-271-1/+4
| | | | | | | | | | | | | | | | | I've seen a few people hit this and wonder why checkouts are slow/take space. Really, ensuring this happens is the *point* of OSTree. Physical copies should be a last resort fallback for very unusual situations (one of those is rpm-ostree checking out the db since librpm doesn't know how to read from libostree). Even I hit the fact that `/var` is a mountpoint disallowing hardlinks with `/ostree` once and was confused. =) Add this to the rofiles-fuse test case because it creates a mount point. Closes: #368 Approved by: jlebon
* Support Docker-style whiteoutsColin Walters2016-02-161-2/+5
| | | | | | | | | | | 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
* Use glnx_unref_object instead of gs_unref_objectMatthew Barnes2015-05-061-1/+1
| | | | | For non-GIO object types, at least until autocleanup support for GObject based types becomes more widespread.
* Use g_autoptr() for GIO object typesMatthew Barnes2015-05-061-7/+7
| | | | | GLib 2.44 supplies all the necessary autocleanup macros for GIO types, and libglnx backports the relevant macros for ostree.
* Use g_autofree instead of gs_freeMatthew Barnes2015-05-061-4/+4
|
* ostree_repo_checkout_tree_at: New API for checkoutsColin Walters2015-04-071-36/+64
| | | | | | | | | | | | | | | | | | | | | | | | | rpm-ostree currently uses ostree_repo_checkout_tree(), which as a side effect will use the uncompressed objects cache by default. This is rather annoying if you're using rpm-ostree on a server-side repository, because if you then rsync the repo, you'll be syncing out the uncompressed objects unless you exclude them. We added the ability to disable the uncompressed cache in the repository config to fix this, but it's better to allow application control over this. The uncompressed cache will in some future version become opt in as well. This new API further: - Drops the `GFile` usage in favor of `openat` APIs - Improves ergonomics by avoiding callers having to query the source `GFileInfo` (and carry around a copy of `OSTREE_GIO_FAST_QUERYINFO`) - Has a more extensible options structure Per the comment, I rather crudely have the `ostree checkout` builtin call both APIs to ensure some testing coverage. However, I'd like to in the future have easier-to-set-up testing code that calls `libtest.sh` to set up dummy data.
* src: Drop unused argument "value" from ot_parse_booleanGiuseppe Scrivano2015-03-061-1/+1
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* checkout: Add --fsync=falseColin Walters2015-01-071-0/+22
| | | | | | | | | | | Some use cases for checkouts don't need to fsync during checkout. Installer programs for example will just do a global fsync at the end. In the future, the default "ostree admin" core could also be rearchitected to only do a transaction commit right before reboot, and do the fsync then. https://bugzilla.gnome.org/show_bug.cgi?id=742482
* Refactor command-line parsingMatthew Barnes2014-11-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Various manpage / usage blurb improvementsMatthew Barnes2014-11-161-2/+2
| | | | | | | | | Corrections, clarifications, consistency. Not a comprehensive overhaul of the manpages; they do still need work. These are just flaws I've noted while studying the ostree command syntax. https://bugzilla.gnome.org/show_bug.cgi?id=740097
* [staticanalysis]: Delete an unused variableColin Walters2014-06-211-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=732020
* repo: Make read_commit spit out a resolved commit ref as wellJasper St. Pierre2013-09-091-1/+1
| | | | | | | | read_commit resolves the ref to a commit, and a lot of consumers want the resolved commit for their own purposes; this prevents them from calling resolve_rev themselves. https://bugzilla.gnome.org/show_bug.cgi?id=707727
* repo-file: Base OstreeRepoFile on trees instead of commitsJasper St. Pierre2013-09-091-8/+7
| | | | | | | | | | | We want an OstreeRepoFile to be the way to represent a filesystem tree inside an ostree repository. In order to do this, we need to drop the commit from an OstreeRepoFile, and make that go to callers. Switch all current users of ostree_repo_file_new_root to ostree_repo_read_commit, and make the actual constructor private. https://bugzilla.gnome.org/show_bug.cgi?id=707727
* Fix warnings about unused variablesTobias Hunger2013-08-301-4/+0
|
* main: Code cleanup by passing OstreeRepo * directly to builtinsColin Walters2013-08-251-6/+1
| | | | | | | | | | It turns out every builtin (with one special exception) that takes a repo argument did the same thing; let's just centralize it. The special exception was "ostree init --repo=foo" where foo is expected to *not* actually be a repo. In that case, simply skip the ostree_repo_check() invocation. https://bugzilla.gnome.org/show_bug.cgi?id=706762
* libostree: Check out directories depth-first in serial, switch to sync APIColin Walters2013-08-211-49/+3
| | | | | | | | | | | | | The way we recurse into subdirectories in parallel makes it far too easy to hit up against the arbitrary Linux fd limit of 1024. Since the fix here is about dropping parallelism, let's just go all the way for now and make a plain old synchronous API =( This does simplify both internal callers which wanted a sync API anyways. https://bugzilla.gnome.org/show_bug.cgi?id=706380
* Install a shared libraryColin Walters2013-07-261-2/+4
| | | | | This required a fair bit of surgery because previously ostree.h included otutil.h, but that's supposed to be a private library.
* main: Move GCancellable to toplevelColin Walters2013-07-161-2/+1
| | | | | This is just cleaner, and makes the builtins slightly more of a library, which in turn makes it easier to turn them into real API.
* ostree: Some header file cleanupsColin Walters2013-07-091-2/+0
|
* Remove built in "triggers"Colin Walters2013-07-071-15/+0
| | | | | | | | | | | | | | | Originally, the idea was that clients would replicate "OS/tree"s from a build server, but we'd run things like "ldconfig" on the client. This was to allow adding e.g. the nVidia binary driver. However, the triggers were the only thing in the system at the moment that really had expected knowledge of the *contents* of the OS, like the location of binaries. For now, it's architecturally cleaner if we move the burden of triggers to the tree builder (e.g. gnome-ostree or RPM). Eventually we may want OSTree to assist with this type of thing (perhaps something like RPM %ghost), but this is the right thing to do now.
* Switch to libgsystem local allocation macrosColin Walters2013-07-071-17/+17
| | | | And drop our compatibility wrapper.
* checkout: Add --allow-noent optionColin Walters2013-05-011-2/+17
| | | | | | | | | | This is useful for the gnome-ostree build system where each build is one commit, but it's split up into /runtime /devel /debug etc. trees. Ideally we wouldn't have a /debug subdirectory for "noarch" components for example. So add an option to not error out if the given path doesn't exist in the commit.
* checkout: Drop uncompressed object GC for nowColin Walters2012-10-131-3/+0
| | | | | It's racy when multiple processes are involved, and needs a bit more thought.
* core: Add dynamic uncompressed object cache for archive-zColin Walters2012-10-111-0/+3
| | | | | | | | | This gives us something closer to the advantages of archive and archive-z when using the latter. Concretely we get deduplication among multiple checkouts, along with the "devino" hash table trick during commits to avoid checksumming content again. This is enabled by default.
* Make /etc a writable mountColin Walters2012-09-061-148/+13
| | | | | | | | | | | | | | | | First, move deployments to /ostree/deploy. Having them in the toplevel clutters the filesystem layout too much. When we deploy a tree like /ostree/deploy/NAME, there is now also a writable directory /ostree/deploy/NAME-etc. This is mounted as read-write inside the system. On an initial install, that directory is copied from /ostree/deploy/NAME/etc. On subsequent deployments, we find any changes made in the current deployment's /etc, and apply that set of changes to the new deployment's /etc. See https://live.gnome.org/OSTree/EverythingInEtcIsABug