summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-checkout.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-09-08 17:07:45 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-13 19:19:33 +0000
commit051cdf396c4e2aed6fc1aad74dbf4d1a064b72d7 (patch)
tree3077f968b545dfd9855e979e01493cec27d191b2 /src/ostree/ot-builtin-checkout.c
parent8d3752a0d6034b378724134277e0fa1004591bb6 (diff)
downloadostree-051cdf396c4e2aed6fc1aad74dbf4d1a064b72d7.tar.gz
lib/checkout: Rename disjoint union, change to merge identical files
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
Diffstat (limited to 'src/ostree/ot-builtin-checkout.c')
-rw-r--r--src/ostree/ot-builtin-checkout.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c
index a3494ae3..170d24e9 100644
--- a/src/ostree/ot-builtin-checkout.c
+++ b/src/ostree/ot-builtin-checkout.c
@@ -37,7 +37,7 @@ static gboolean opt_disable_cache;
static char *opt_subpath;
static gboolean opt_union;
static gboolean opt_union_add;
-static gboolean opt_disjoint_union;
+static gboolean opt_union_identical;
static gboolean opt_whiteouts;
static gboolean opt_from_stdin;
static char *opt_from_file;
@@ -73,7 +73,7 @@ static GOptionEntry options[] = {
{ "subpath", 0, 0, G_OPTION_ARG_FILENAME, &opt_subpath, "Checkout sub-directory PATH", "PATH" },
{ "union", 0, 0, G_OPTION_ARG_NONE, &opt_union, "Keep existing directories, overwrite existing files", NULL },
{ "union-add", 0, 0, G_OPTION_ARG_NONE, &opt_union_add, "Keep existing files/directories, only add new", NULL },
- { "disjoint-union", 0, 0, G_OPTION_ARG_NONE, &opt_disjoint_union, "When layering checkouts, error out if a file would be replaced, but add new files and directories", NULL },
+ { "union-identical", 0, 0, G_OPTION_ARG_NONE, &opt_union_identical, "When layering checkouts, error out if a file would be replaced with a different version, but add new files and directories", NULL },
{ "whiteouts", 0, 0, G_OPTION_ARG_NONE, &opt_whiteouts, "Process 'whiteout' (Docker style) entries", NULL },
{ "allow-noent", 0, 0, G_OPTION_ARG_NONE, &opt_allow_noent, "Do nothing if specified path does not exist", NULL },
{ "from-stdin", 0, 0, G_OPTION_ARG_NONE, &opt_from_stdin, "Process many checkouts from standard input", NULL },
@@ -101,7 +101,7 @@ process_one_checkout (OstreeRepo *repo,
* convenient infrastructure for testing C APIs with data.
*/
if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks ||
- opt_union_add || opt_force_copy || opt_bareuseronly_dirs || opt_disjoint_union)
+ opt_union_add || opt_force_copy || opt_bareuseronly_dirs || opt_union_identical)
{
OstreeRepoCheckoutAtOptions options = { 0, };
@@ -114,16 +114,16 @@ process_one_checkout (OstreeRepo *repo,
"Cannot specify both --union and --union-add");
goto out;
}
- if (opt_union && opt_disjoint_union)
+ if (opt_union && opt_union_identical)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Cannot specify both --union and --disjoint-union");
+ "Cannot specify both --union and --union-identical");
goto out;
}
- if (opt_union_add && opt_disjoint_union)
+ if (opt_union_add && opt_union_identical)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Cannot specify both --union-add and --disjoint-union ");
+ "Cannot specify both --union-add and --union-identical ");
goto out;
}
if (opt_require_hardlinks && opt_force_copy)
@@ -135,8 +135,16 @@ process_one_checkout (OstreeRepo *repo,
options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES;
else if (opt_union_add)
options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES;
- else if (opt_disjoint_union)
- options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_DISJOINT_UNION_FILES;
+ else if (opt_union_identical)
+ {
+ if (!opt_require_hardlinks)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "--union-identical requires --require-hardlinks");
+ goto out;
+ }
+ options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL;
+ }
if (opt_whiteouts)
options.process_whiteouts = TRUE;
if (subpath)