diff --git a/Makefile-hacktree.am b/Makefile-hacktree.am deleted file mode 100644 index 636b7d0c..00000000 --- a/Makefile-hacktree.am +++ /dev/null @@ -1,58 +0,0 @@ -# Makefile for C source code -# -# Copyright (C) 2011 Colin Walters -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Author: Colin Walters - -noinst_LTLIBRARIES += libhtutil.la - -libhtutil_la_SOURCES = \ - src/libhtutil/ht-unix-utils.c \ - src/libhtutil/ht-unix-utils.h \ - src/libhtutil/ht-gio-utils.c \ - src/libhtutil/ht-gio-utils.h \ - src/libhtutil/htutil.h \ - $(NULL) -libhtutil_la_CFLAGS = -I$(srcdir)/src/libhtutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) -libhtutil_la_LIBADD = $(GIO_UNIX_LIBS) - -noinst_LTLIBRARIES += libhacktree.la - -libhacktree_la_SOURCES = src/libhacktree/hacktree.h \ - src/libhacktree/hacktree-core.c \ - src/libhacktree/hacktree-core.h \ - src/libhacktree/hacktree-repo.c \ - src/libhacktree/hacktree-repo.h \ - src/libhacktree/hacktree-types.h \ - $(NULL) -libhacktree_la_CFLAGS = -I$(srcdir)/src/libhacktree -I$(srcdir)/src/libhtutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) -libhacktree_la_LIBADD = libhtutil.la $(GIO_UNIX_LIBS) - -bin_PROGRAMS += hacktree - -hacktree_SOURCES = src/main.c \ - src/ht-builtins.h \ - src/ht-builtin-checkout.c \ - src/ht-builtin-commit.c \ - src/ht-builtin-fsck.c \ - src/ht-builtin-init.c \ - src/ht-builtin-link-file.c \ - src/ht-builtin-log.c \ - src/ht-builtin-show.c \ - $(NULL) -hacktree_CFLAGS = -I$(srcdir)/src -I$(srcdir)/src/libhacktree -I$(srcdir)/src/libhtutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) -hacktree_LDADD = libhtutil.la libhacktree.la $(GIO_UNIX_LIBS) diff --git a/Makefile-src.am b/Makefile-src.am new file mode 100644 index 00000000..68cd3b52 --- /dev/null +++ b/Makefile-src.am @@ -0,0 +1,58 @@ +# Makefile for C source code +# +# Copyright (C) 2011 Colin Walters +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Author: Colin Walters + +noinst_LTLIBRARIES += libotutil.la + +libotutil_la_SOURCES = \ + src/libotutil/ot-unix-utils.c \ + src/libotutil/ot-unix-utils.h \ + src/libotutil/ot-gio-utils.c \ + src/libotutil/ot-gio-utils.h \ + src/libotutil/otutil.h \ + $(NULL) +libotutil_la_CFLAGS = -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) +libotutil_la_LIBADD = $(GIO_UNIX_LIBS) + +noinst_LTLIBRARIES += libostree.la + +libostree_la_SOURCES = src/libostree/ostree.h \ + src/libostree/ostree-core.c \ + src/libostree/ostree-core.h \ + src/libostree/ostree-repo.c \ + src/libostree/ostree-repo.h \ + src/libostree/ostree-types.h \ + $(NULL) +libostree_la_CFLAGS = -I$(srcdir)/src/libostree -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) +libostree_la_LIBADD = libotutil.la $(GIO_UNIX_LIBS) + +bin_PROGRAMS += ostree + +ostree_SOURCES = src/main.c \ + src/ot-builtins.h \ + src/ot-builtin-checkout.c \ + src/ot-builtin-commit.c \ + src/ot-builtin-fsck.c \ + src/ot-builtin-init.c \ + src/ot-builtin-link-file.c \ + src/ot-builtin-log.c \ + src/ot-builtin-show.c \ + $(NULL) +ostree_CFLAGS = -I$(srcdir)/src -I$(srcdir)/src/libostree -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(GIO_UNIX_CFLAGS) +ostree_LDADD = libotutil.la libostree.la $(GIO_UNIX_LIBS) diff --git a/Makefile.am b/Makefile.am index 9bc67c9d..8ff33df3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,5 +10,4 @@ libexec_PROGRAMS = noinst_LTLIBRARIES = noinst_PROGRAMS = - -include Makefile-hacktree.am +include Makefile-src.am diff --git a/README.md b/README.md index ca6eb5b2..3ceb5f48 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Hacktree +OSTree ======== Problem statement @@ -48,7 +48,7 @@ Comparison with existing tools the old package. This is most realistic option for people hacking on system - components currently, but hacktree will be better. + components currently, but ostree will be better. - LXC / containers @@ -66,7 +66,7 @@ Comparison with existing tools this means you can't build NetworkManager, and thus are permanently stuck on whatever the distro provides. -Who is hacktree for? +Who is ostree for? ------------------------------ First - operating system developers and testers. I specifically keep @@ -103,22 +103,19 @@ Debian). It has a root filesystem like this: Now, what we can do is have a system that installs chroots as a subdirectory of the root, like: - /usr - /etc - /home - /gnomeos/root-3.0-opt/{usr,etc,var,...} - /gnomeos/root-3.2-opt/{usr,etc,var,...} + /ostree/gnomeos-3.0-opt-393a4555/{usr,etc,sbin,...} + /ostree/gnomeos-3.2-opt-7e9788a2/{usr,etc,sbin,...} These live in the same root filesystem as your regular distribution (Note though, the root partition should be reasonably sized, or hopefully you've used just one big partition). -You should be able to boot into one of these roots. Since hacktree +You should be able to boot into one of these roots. Since ostree lives inside a distro created partition, a tricky part here is that we need to know how to interact with the installed distribution's grub. This is an annoying but tractable problem. -Hacktree will allow efficiently parallel installing and downloading OS +OSTree will allow efficiently parallel installing and downloading OS builds. An important note here is that we explicitly link /home in each root @@ -126,6 +123,40 @@ to the real /home. This means you have your data. This also implies we share uid/gid, so /etc/passwd will have to be in sync. Probably what we'll do is have a script to pull the data from the "host" OS. +Other shared directories are /var and /root. Note that /etc is +explicitly NOT shared! + +On a pure OSTree system, the filesystem layout will look like this: + + . + |-- boot + |-- home + |-- ostree + | |-- current -> gnomeos-3.2-opt-7e9788a2 + | |-- gnomeos-3.0-opt-393a4555 + | | |-- etc + | | |-- lib + | | |-- mnt + | | |-- proc + | | |-- run + | | |-- sbin + | | |-- srv + | | |-- sys + | | `-- usr + | `-- gnomeos-3.2-opt-7e9788a2 + | |-- etc + | |-- lib + | |-- mnt + | |-- proc + | |-- run + | |-- sbin + | |-- srv + | |-- sys + | `-- usr + |-- root + `-- var + + Making this efficient --------------------- @@ -142,14 +173,14 @@ that point to it. This mutability means that we have to either: This is probably tractable over a long period of time, but if anything has a bug, then it corrupts the file effectively. 2. Make the core OS read-only, with a well-defined mechanism for mutating - under the control of hacktree. + under the control of ostree. I chose 2. A userspace content-addressed versioning filesystem --------------------------------------------------- -At its very core, that's what hacktree is. Just like git. If you +At its very core, that's what ostree is. Just like git. If you understand git, you know it's not like other revision control systems. git is effectively a specialized, userspace filesystem, and that is a very powerful idea. @@ -162,16 +193,16 @@ source trees - it goes to effort to be sure it's compressing text for example, under the assumption that you have a lot of text. Its handling of binaries is very generic and unoptimized. -In contrast, hacktree is explicitly designed for binaries, and in +In contrast, ostree is explicitly designed for binaries, and in particular one type of binary - ELF executables (or it will be once we start using bsdiff). -Another big difference versus git is that hacktree uses hard links +Another big difference versus git is that ostree uses hard links between "checkouts" and the repository. This means each checkout uses almost no additional space, and is *extremely* fast to check out. We can do this because again each checkout is designed to be read-only. -So we mentioned above the +So we mentioned above there are: /gnomeos/root-3.0-opt /gnomeos/root-3.2-opt @@ -206,7 +237,7 @@ change =) Atomic upgrades, rollback ------------------------- -Hacktree is designed to atomically swap operating systems - such that +OSTree is designed to atomically swap operating systems - such that during an upgrade and reboot process, you either get the full new system, or the old one. There is no "Please don't turn off your computer". We do this by simply using a symbolic link like: @@ -272,13 +303,13 @@ What about "packages"? Basically I think they're a broken idea. There are several different classes of things that demand targeted solutions: - 1. Managing and upgrading the core OS (hacktree) + 1. Managing and upgrading the core OS (ostree) 2. Managing and upgrading desktop applications (gnome-shell, glick?) 3. System extensions - these are arbitrary RPMs like say the nVidia driver. We apply them after constructing each root. Media codecs also fall into this category. -How one might install say Apache on top of hacktree is an open +How one might install say Apache on top of ostree is an open question - I think it probably makes sense honestly to ship services like this with no configuration - just the binaries. Then admins can do whatever they want. @@ -286,7 +317,7 @@ do whatever they want. Downloads --------- -I'm pretty sure hacktree should be significantly better than RPM with +I'm pretty sure ostree should be significantly better than RPM with deltarpms. Note we only download changed objects. If say just one translation changes, we only download that new translation! One problem we will have to hunt down is programs that inject @@ -350,7 +381,7 @@ approach is it doesn't solve the race conditions that happen when unpacking packages into the live system. This problem is really important to me. -Note though hacktree can definitely take advantage of BTRFS features! +Note though ostree can definitely take advantage of BTRFS features! In particular, we could use "reflink" instead of hard links, and avoid having the object store corrupted if somehow the files are modified @@ -383,7 +414,7 @@ didn't use them: - Conary: If rpm/dpkg are like CVS, Conary is closer to Subversion. It's not - bad, but hacktree is better than it for the exact same reasons git + bad, but ostree is better than it for the exact same reasons git is better than Subversion. - BTRFS: @@ -393,4 +424,4 @@ didn't use them: - Jhbuild: What we've been using in GNOME, and has the essential property of allowing you - to "fall back" to a stable system. But hacktree will blow it out of the water. + to "fall back" to a stable system. But ostree will blow it out of the water. diff --git a/configure.ac b/configure.ac index 9bb57928..43f18cc3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.63]) -AC_INIT([hacktree], [0], [walters@verbum.org]) +AC_INIT([ostree], [0], [walters@verbum.org]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/hacktree.doap b/hacktree.doap index bb5fb5a5..d6de9253 100644 --- a/hacktree.doap +++ b/hacktree.doap @@ -5,8 +5,8 @@ xmlns:gnome="http://api.gnome.org/doap-extensions#" xmlns="http://usefulinc.com/ns/doap#"> - hacktree - hacktree + ostree + ostree GNOME OS build tool diff --git a/parallel-debian/README-testing-multiroot.md b/parallel-debian/README-testing-multiroot.md index 61279ea7..4fd0a123 100644 --- a/parallel-debian/README-testing-multiroot.md +++ b/parallel-debian/README-testing-multiroot.md @@ -37,8 +37,11 @@ parts of the OS to a new directory "r0". $ mkdir r0 $ DIRS="bin dev etc lib lib32 lib64 media mnt opt proc root run sbin selinux srv sys tmp usr" $ mv $DIRS r0 + $ mkdir r0/{boot,var,home} + $ touch r0/{boot,var,home}/EMPTY -Note that /boot, /home and /var are left shared. Now with it still +Note that /boot, /home and /var are left shared; we create empty +destination directories that will be mounted over. Now with it still mounted, we need to move on to the next part - modifying the initrd. Then I started hacking on the initrd, making understand how to chroot diff --git a/src/libhacktree/hacktree-core.c b/src/libostree/ostree-core.c similarity index 89% rename from src/libhacktree/hacktree-core.c rename to src/libostree/ostree-core.c index 9817c85c..ccf35dd6 100644 --- a/src/libhacktree/hacktree-core.c +++ b/src/libostree/ostree-core.c @@ -21,8 +21,8 @@ #include "config.h" -#include "hacktree.h" -#include "htutil.h" +#include "ostree.h" +#include "otutil.h" #include #include @@ -80,7 +80,7 @@ read_xattr_name_array (const char *path, bytes_read = lgetxattr (path, p, NULL, 0); if (bytes_read < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } if (bytes_read == 0) @@ -89,7 +89,7 @@ read_xattr_name_array (const char *path, buf = g_malloc (bytes_read); if (lgetxattr (path, p, buf, bytes_read) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); g_free (buf); goto out; } @@ -108,7 +108,7 @@ read_xattr_name_array (const char *path, } GVariant * -hacktree_get_xattrs_for_path (const char *path, +ostree_get_xattrs_for_path (const char *path, GError **error) { GVariant *ret = NULL; @@ -125,7 +125,7 @@ hacktree_get_xattrs_for_path (const char *path, { if (errno != ENOTSUP) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } } @@ -135,7 +135,7 @@ hacktree_get_xattrs_for_path (const char *path, xattr_names = g_malloc (bytes_read); if (llistxattr (path, xattr_names, bytes_read) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } xattr_names_canonical = canonicalize_xattrs (xattr_names, bytes_read); @@ -154,7 +154,7 @@ hacktree_get_xattrs_for_path (const char *path, } gboolean -hacktree_stat_and_checksum_file (int dir_fd, const char *path, +ostree_stat_and_checksum_file (int dir_fd, const char *path, GChecksum **out_checksum, struct stat *out_stbuf, GError **error) @@ -180,7 +180,7 @@ hacktree_stat_and_checksum_file (int dir_fd, const char *path, temp_dir = opendir (dirname); if (temp_dir == NULL) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); g_free (dirname); } g_free (dirname); @@ -189,22 +189,22 @@ hacktree_stat_and_checksum_file (int dir_fd, const char *path, if (fstatat (dir_fd, basename, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } if (!S_ISLNK(stbuf.st_mode)) { - fd = ht_util_open_file_read_at (dir_fd, basename, error); + fd = ot_util_open_file_read_at (dir_fd, basename, error); if (fd < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } } stat_string = stat_to_string (&stbuf); - xattrs = hacktree_get_xattrs_for_path (path, error); + xattrs = ostree_get_xattrs_for_path (path, error); if (!xattrs) goto out; @@ -218,7 +218,7 @@ hacktree_stat_and_checksum_file (int dir_fd, const char *path, g_checksum_update (content_sha256, buf, bytes_read); if (bytes_read < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } } @@ -228,7 +228,7 @@ hacktree_stat_and_checksum_file (int dir_fd, const char *path, if (readlinkat (dir_fd, basename, symlink_target, PATH_MAX) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } g_checksum_update (content_sha256, (guint8*)symlink_target, strlen (symlink_target)); diff --git a/src/libhacktree/hacktree-core.h b/src/libostree/ostree-core.h similarity index 65% rename from src/libhacktree/hacktree-core.h rename to src/libostree/ostree-core.h index 53472997..6d80941f 100644 --- a/src/libhacktree/hacktree-core.h +++ b/src/libostree/ostree-core.h @@ -19,36 +19,36 @@ * Author: Colin Walters */ -#ifndef _HACKTREE_CORE -#define _HACKTREE_CORE +#ifndef _OSTREE_CORE +#define _OSTREE_CORE -#include +#include G_BEGIN_DECLS -#define HACKTREE_EMPTY_STRING_SHA256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; +#define OSTREE_EMPTY_STRING_SHA256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; typedef enum { - HACKTREE_OBJECT_TYPE_FILE = 1, - HACKTREE_OBJECT_TYPE_META = 2, -} HacktreeObjectType; + OSTREE_OBJECT_TYPE_FILE = 1, + OSTREE_OBJECT_TYPE_META = 2, +} OstreeObjectType; typedef enum { - HACKTREE_SERIALIZED_TREE_VARIANT = 1, - HACKTREE_SERIALIZED_COMMIT_VARIANT = 2, - HACKTREE_SERIALIZED_DIRMETA_VARIANT = 3, - HACKTREE_SERIALIZED_XATTR_VARIANT = 4 -} HacktreeSerializedVariantType; + OSTREE_SERIALIZED_TREE_VARIANT = 1, + OSTREE_SERIALIZED_COMMIT_VARIANT = 2, + OSTREE_SERIALIZED_DIRMETA_VARIANT = 3, + OSTREE_SERIALIZED_XATTR_VARIANT = 4 +} OstreeSerializedVariantType; -#define HACKTREE_SERIALIZED_VARIANT_FORMAT "(uv)" +#define OSTREE_SERIALIZED_VARIANT_FORMAT "(uv)" /* * xattr objects: * a(ayay) - array of (name, value) pairs, both binary data, though name is a bytestring */ -#define HACKTREE_XATTR_GVARIANT_FORMAT "a(ayay)" +#define OSTREE_XATTR_GVARIANT_FORMAT "a(ayay)" -#define HACKTREE_DIR_META_VERSION 0 +#define OSTREE_DIR_META_VERSION 0 /* * dirmeta objects: * u - Version @@ -57,9 +57,9 @@ typedef enum { * u - mode * a(ayay) - xattrs */ -#define HACKTREE_DIRMETA_GVARIANT_FORMAT "(uuuua(ayay))" +#define OSTREE_DIRMETA_GVARIANT_FORMAT "(uuuua(ayay))" -#define HACKTREE_TREE_VERSION 0 +#define OSTREE_TREE_VERSION 0 /* * Tree objects: * u - Version @@ -67,9 +67,9 @@ typedef enum { * a(ss) - array of (filename, checksum) for files * a(sss) - array of (dirname, tree_checksum, meta_checksum) for directories */ -#define HACKTREE_TREE_GVARIANT_FORMAT "(ua{sv}a(ss)a(sss)" +#define OSTREE_TREE_GVARIANT_FORMAT "(ua{sv}a(ss)a(sss)" -#define HACKTREE_COMMIT_VERSION 0 +#define OSTREE_COMMIT_VERSION 0 /* * Commit objects: * u - Version @@ -81,15 +81,15 @@ typedef enum { * s - Root tree contents * s - Root tree metadata */ -#define HACKTREE_COMMIT_GVARIANT_FORMAT "(ua{sv}ssstss)" +#define OSTREE_COMMIT_GVARIANT_FORMAT "(ua{sv}ssstss)" -GVariant *hacktree_get_xattrs_for_path (const char *path, +GVariant *ostree_get_xattrs_for_path (const char *path, GError **error); -gboolean hacktree_stat_and_checksum_file (int dirfd, const char *path, +gboolean ostree_stat_and_checksum_file (int dirfd, const char *path, GChecksum **out_checksum, struct stat *out_stbuf, GError **error); -#endif /* _HACKTREE_REPO */ +#endif /* _OSTREE_REPO */ diff --git a/src/libhacktree/hacktree-repo.c b/src/libostree/ostree-repo.c similarity index 86% rename from src/libhacktree/hacktree-repo.c rename to src/libostree/ostree-repo.c index 90b34ad7..4c5b10bc 100644 --- a/src/libhacktree/hacktree-repo.c +++ b/src/libostree/ostree-repo.c @@ -21,22 +21,22 @@ #include "config.h" -#include "hacktree.h" -#include "htutil.h" +#include "ostree.h" +#include "otutil.h" #include #include static gboolean -link_one_file (HacktreeRepo *self, const char *path, - HacktreeObjectType type, +link_one_file (OstreeRepo *self, const char *path, + OstreeObjectType type, gboolean ignore_exists, gboolean force, GChecksum **out_checksum, GError **error); static char * -get_object_path (HacktreeRepo *self, +get_object_path (OstreeRepo *self, const char *checksum, - HacktreeObjectType type); + OstreeObjectType type); enum { PROP_0, @@ -44,14 +44,14 @@ enum { PROP_PATH }; -G_DEFINE_TYPE (HacktreeRepo, hacktree_repo, G_TYPE_OBJECT) +G_DEFINE_TYPE (OstreeRepo, ostree_repo, G_TYPE_OBJECT) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), HACKTREE_TYPE_REPO, HacktreeRepoPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), OSTREE_TYPE_REPO, OstreeRepoPrivate)) -typedef struct _HacktreeRepoPrivate HacktreeRepoPrivate; +typedef struct _OstreeRepoPrivate OstreeRepoPrivate; -struct _HacktreeRepoPrivate { +struct _OstreeRepoPrivate { char *path; GFile *repo_file; char *head_ref_path; @@ -62,10 +62,10 @@ struct _HacktreeRepoPrivate { }; static void -hacktree_repo_finalize (GObject *object) +ostree_repo_finalize (GObject *object) { - HacktreeRepo *self = HACKTREE_REPO (object); - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepo *self = OSTREE_REPO (object); + OstreeRepoPrivate *priv = GET_PRIVATE (self); g_free (priv->path); g_clear_object (&priv->repo_file); @@ -73,17 +73,17 @@ hacktree_repo_finalize (GObject *object) g_free (priv->objects_path); g_free (priv->current_head); - G_OBJECT_CLASS (hacktree_repo_parent_class)->finalize (object); + G_OBJECT_CLASS (ostree_repo_parent_class)->finalize (object); } static void -hacktree_repo_set_property(GObject *object, +ostree_repo_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - HacktreeRepo *self = HACKTREE_REPO (object); - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepo *self = OSTREE_REPO (object); + OstreeRepoPrivate *priv = GET_PRIVATE (self); switch (prop_id) { @@ -97,13 +97,13 @@ hacktree_repo_set_property(GObject *object, } static void -hacktree_repo_get_property(GObject *object, +ostree_repo_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - HacktreeRepo *self = HACKTREE_REPO (object); - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepo *self = OSTREE_REPO (object); + OstreeRepoPrivate *priv = GET_PRIVATE (self); switch (prop_id) { @@ -117,39 +117,39 @@ hacktree_repo_get_property(GObject *object, } static GObject * -hacktree_repo_constructor (GType gtype, +ostree_repo_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties) { GObject *object; GObjectClass *parent_class; - HacktreeRepoPrivate *priv; + OstreeRepoPrivate *priv; - parent_class = G_OBJECT_CLASS (hacktree_repo_parent_class); + parent_class = G_OBJECT_CLASS (ostree_repo_parent_class); object = parent_class->constructor (gtype, n_properties, properties); priv = GET_PRIVATE (object); g_assert (priv->path != NULL); - priv->repo_file = ht_util_new_file_for_path (priv->path); - priv->head_ref_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "HEAD", NULL); - priv->objects_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "objects", NULL); + priv->repo_file = ot_util_new_file_for_path (priv->path); + priv->head_ref_path = g_build_filename (priv->path, OSTREE_REPO_DIR, "HEAD", NULL); + priv->objects_path = g_build_filename (priv->path, OSTREE_REPO_DIR, "objects", NULL); return object; } static void -hacktree_repo_class_init (HacktreeRepoClass *klass) +ostree_repo_class_init (OstreeRepoClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (HacktreeRepoPrivate)); + g_type_class_add_private (klass, sizeof (OstreeRepoPrivate)); - object_class->constructor = hacktree_repo_constructor; - object_class->get_property = hacktree_repo_get_property; - object_class->set_property = hacktree_repo_set_property; - object_class->finalize = hacktree_repo_finalize; + object_class->constructor = ostree_repo_constructor; + object_class->get_property = ostree_repo_get_property; + object_class->set_property = ostree_repo_set_property; + object_class->finalize = ostree_repo_finalize; g_object_class_install_property (object_class, PROP_PATH, @@ -161,18 +161,18 @@ hacktree_repo_class_init (HacktreeRepoClass *klass) } static void -hacktree_repo_init (HacktreeRepo *self) +ostree_repo_init (OstreeRepo *self) { } -HacktreeRepo* -hacktree_repo_new (const char *path) +OstreeRepo* +ostree_repo_new (const char *path) { - return g_object_new (HACKTREE_TYPE_REPO, "path", path, NULL); + return g_object_new (OSTREE_TYPE_REPO, "path", path, NULL); } static gboolean -parse_checksum_file (HacktreeRepo *self, +parse_checksum_file (OstreeRepo *self, const char *path, char **sha256, GError **error) @@ -181,7 +181,7 @@ parse_checksum_file (HacktreeRepo *self, gboolean ret = FALSE; char *ret_sha256 = NULL; - ret_sha256 = ht_util_get_file_contents_utf8 (path, &temp_error); + ret_sha256 = ot_util_get_file_contents_utf8 (path, &temp_error); if (ret_sha256 == NULL) { if (g_error_matches (temp_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) @@ -225,9 +225,9 @@ write_checksum_file (const char *path, } gboolean -hacktree_repo_check (HacktreeRepo *self, GError **error) +ostree_repo_check (OstreeRepo *self, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -247,13 +247,13 @@ hacktree_repo_check (HacktreeRepo *self, GError **error) } static gboolean -import_gvariant_object (HacktreeRepo *self, - HacktreeSerializedVariantType type, +import_gvariant_object (OstreeRepo *self, + OstreeSerializedVariantType type, GVariant *variant, GChecksum **out_checksum, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); GVariant *serialized = NULL; gboolean ret = FALSE; gsize bytes_written; @@ -267,7 +267,7 @@ import_gvariant_object (HacktreeRepo *self, fd = mkstemp (tmp_name); if (fd < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } @@ -283,7 +283,7 @@ import_gvariant_object (HacktreeRepo *self, NULL, error)) goto out; - if (!link_one_file (self, tmp_name, HACKTREE_OBJECT_TYPE_META, + if (!link_one_file (self, tmp_name, OSTREE_OBJECT_TYPE_META, TRUE, FALSE, out_checksum, error)) goto out; @@ -301,9 +301,9 @@ import_gvariant_object (HacktreeRepo *self, } static gboolean -load_gvariant_object_unknown (HacktreeRepo *self, +load_gvariant_object_unknown (OstreeRepo *self, const char *sha256, - HacktreeSerializedVariantType *out_type, + OstreeSerializedVariantType *out_type, GVariant **out_variant, GError **error) { @@ -314,20 +314,20 @@ load_gvariant_object_unknown (HacktreeRepo *self, char *path = NULL; guint32 ret_type; - path = get_object_path (self, sha256, HACKTREE_OBJECT_TYPE_META); + path = get_object_path (self, sha256, OSTREE_OBJECT_TYPE_META); mfile = g_mapped_file_new (path, FALSE, error); if (mfile == NULL) goto out; else { - container = g_variant_new_from_data (G_VARIANT_TYPE (HACKTREE_SERIALIZED_VARIANT_FORMAT), + container = g_variant_new_from_data (G_VARIANT_TYPE (OSTREE_SERIALIZED_VARIANT_FORMAT), g_mapped_file_get_contents (mfile), g_mapped_file_get_length (mfile), FALSE, (GDestroyNotify) g_mapped_file_unref, mfile); - if (!g_variant_is_of_type (container, G_VARIANT_TYPE (HACKTREE_SERIALIZED_VARIANT_FORMAT))) + if (!g_variant_is_of_type (container, G_VARIANT_TYPE (OSTREE_SERIALIZED_VARIANT_FORMAT))) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Corrupted metadata object '%s'", sha256); @@ -359,14 +359,14 @@ load_gvariant_object_unknown (HacktreeRepo *self, } static gboolean -load_gvariant_object (HacktreeRepo *self, - HacktreeSerializedVariantType expected_type, +load_gvariant_object (OstreeRepo *self, + OstreeSerializedVariantType expected_type, const char *sha256, GVariant **out_variant, GError **error) { gboolean ret = FALSE; - HacktreeSerializedVariantType type; + OstreeSerializedVariantType type; GVariant *ret_variant = NULL; if (!load_gvariant_object_unknown (self, sha256, &type, &ret_variant, error)) @@ -393,7 +393,7 @@ load_gvariant_object (HacktreeRepo *self, } static gboolean -import_directory_meta (HacktreeRepo *self, +import_directory_meta (OstreeRepo *self, const char *path, GVariant **out_variant, GChecksum **out_checksum, @@ -408,7 +408,7 @@ import_directory_meta (HacktreeRepo *self, if (lstat (path, &stbuf) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } @@ -419,12 +419,12 @@ import_directory_meta (HacktreeRepo *self, goto out; } - xattrs = hacktree_get_xattrs_for_path (path, error); + xattrs = ostree_get_xattrs_for_path (path, error); if (!xattrs) goto out; dirmeta = g_variant_new ("(uuuu@a(ayay))", - HACKTREE_DIR_META_VERSION, + OSTREE_DIR_META_VERSION, (guint32)stbuf.st_uid, (guint32)stbuf.st_gid, (guint32)(stbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), @@ -432,7 +432,7 @@ import_directory_meta (HacktreeRepo *self, xattrs = NULL; /* was floating */ g_variant_ref_sink (dirmeta); - if (!import_gvariant_object (self, HACKTREE_SERIALIZED_DIRMETA_VARIANT, + if (!import_gvariant_object (self, OSTREE_SERIALIZED_DIRMETA_VARIANT, dirmeta, &ret_checksum, error)) goto out; @@ -456,11 +456,11 @@ import_directory_meta (HacktreeRepo *self, } static char * -get_object_path (HacktreeRepo *self, +get_object_path (OstreeRepo *self, const char *checksum, - HacktreeObjectType type) + OstreeObjectType type) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); char *checksum_prefix; char *base_path; char *ret; @@ -470,10 +470,10 @@ get_object_path (HacktreeRepo *self, base_path = g_build_filename (priv->objects_path, checksum_prefix, checksum + 2, NULL); switch (type) { - case HACKTREE_OBJECT_TYPE_FILE: + case OSTREE_OBJECT_TYPE_FILE: type_string = ".file"; break; - case HACKTREE_OBJECT_TYPE_META: + case OSTREE_OBJECT_TYPE_META: type_string = ".meta"; break; default: @@ -487,9 +487,9 @@ get_object_path (HacktreeRepo *self, } static char * -prepare_dir_for_checksum_get_object_path (HacktreeRepo *self, +prepare_dir_for_checksum_get_object_path (OstreeRepo *self, GChecksum *checksum, - HacktreeObjectType type, + OstreeObjectType type, GError **error) { char *checksum_dir = NULL; @@ -498,7 +498,7 @@ prepare_dir_for_checksum_get_object_path (HacktreeRepo *self, object_path = get_object_path (self, g_checksum_get_string (checksum), type); checksum_dir = g_path_get_dirname (object_path); - if (!ht_util_ensure_directory (checksum_dir, FALSE, error)) + if (!ot_util_ensure_directory (checksum_dir, FALSE, error)) goto out; out: @@ -507,7 +507,7 @@ prepare_dir_for_checksum_get_object_path (HacktreeRepo *self, } static gboolean -link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, +link_one_file (OstreeRepo *self, const char *path, OstreeObjectType type, gboolean ignore_exists, gboolean force, GChecksum **out_checksum, GError **error) @@ -530,11 +530,11 @@ link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, src_dir = opendir (src_dirname); if (src_dir == NULL) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } - if (!hacktree_stat_and_checksum_file (dirfd (src_dir), path, &id, &stbuf, error)) + if (!ostree_stat_and_checksum_file (dirfd (src_dir), path, &id, &stbuf, error)) goto out; dest_path = prepare_dir_for_checksum_get_object_path (self, id, type, error); if (!dest_path) @@ -545,7 +545,7 @@ link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, dest_dir = opendir (dest_dirname); if (dest_dir == NULL) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } @@ -561,7 +561,7 @@ link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, { if (errno != EEXIST || !ignore_exists) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } } @@ -571,7 +571,7 @@ link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, if (renameat (dirfd (dest_dir), tmp_dest_basename, dirfd (dest_dir), dest_basename) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } (void) unlinkat (dirfd (dest_dir), tmp_dest_basename, 0); @@ -596,19 +596,19 @@ link_one_file (HacktreeRepo *self, const char *path, HacktreeObjectType type, } gboolean -hacktree_repo_link_file (HacktreeRepo *self, +ostree_repo_link_file (OstreeRepo *self, const char *path, gboolean ignore_exists, gboolean force, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); GChecksum *checksum = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (priv->inited, FALSE); - if (!link_one_file (self, path, HACKTREE_OBJECT_TYPE_FILE, + if (!link_one_file (self, path, OSTREE_OBJECT_TYPE_FILE, ignore_exists, force, &checksum, error)) return FALSE; g_checksum_free (checksum); @@ -666,7 +666,7 @@ parsed_tree_data_free (ParsedTreeData *pdata) } static gboolean -parse_tree (HacktreeRepo *self, +parse_tree (OstreeRepo *self, const char *sha256, ParsedTreeData **out_pdata, GError **error) @@ -680,7 +680,7 @@ parse_tree (HacktreeRepo *self, GVariant *files_variant = NULL; GVariant *dirs_variant = NULL; - if (!load_gvariant_object (self, HACKTREE_SERIALIZED_TREE_VARIANT, + if (!load_gvariant_object (self, OSTREE_SERIALIZED_TREE_VARIANT, sha256, &tree_variant, error)) goto out; @@ -715,7 +715,7 @@ parse_tree (HacktreeRepo *self, if (!parse_tree (self, tree_checksum, &child_tree, error)) goto out; - if (!load_gvariant_object (self, HACKTREE_SERIALIZED_DIRMETA_VARIANT, + if (!load_gvariant_object (self, OSTREE_SERIALIZED_DIRMETA_VARIANT, meta_checksum, &metadata, error)) { parsed_tree_data_free (child_tree); @@ -748,13 +748,13 @@ parse_tree (HacktreeRepo *self, } static gboolean -load_commit_and_trees (HacktreeRepo *self, +load_commit_and_trees (OstreeRepo *self, const char *commit_sha256, GVariant **out_commit, ParsedDirectoryData **out_root_data, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); GVariant *ret_commit = NULL; ParsedDirectoryData *ret_root_data = NULL; ParsedTreeData *tree_data = NULL; @@ -771,14 +771,14 @@ load_commit_and_trees (HacktreeRepo *self, goto out; } - if (!load_gvariant_object (self, HACKTREE_SERIALIZED_COMMIT_VARIANT, + if (!load_gvariant_object (self, OSTREE_SERIALIZED_COMMIT_VARIANT, commit_sha256, &ret_commit, error)) goto out; g_variant_get_child (ret_commit, 6, "&s", &tree_contents_checksum); g_variant_get_child (ret_commit, 7, "&s", &tree_meta_checksum); - if (!load_gvariant_object (self, HACKTREE_SERIALIZED_DIRMETA_VARIANT, + if (!load_gvariant_object (self, OSTREE_SERIALIZED_DIRMETA_VARIANT, tree_meta_checksum, &root_metadata, error)) goto out; @@ -815,7 +815,7 @@ create_empty_gvariant_dict (void) } static gboolean -import_parsed_tree (HacktreeRepo *self, +import_parsed_tree (OstreeRepo *self, ParsedTreeData *tree, GChecksum **out_checksum, GError **error) @@ -862,7 +862,7 @@ import_parsed_tree (HacktreeRepo *self, g_variant_builder_end (&dirs_builder)); builders_initialized = FALSE; g_variant_ref_sink (serialized_tree); - if (!import_gvariant_object (self, HACKTREE_SERIALIZED_TREE_VARIANT, serialized_tree, out_checksum, error)) + if (!import_gvariant_object (self, OSTREE_SERIALIZED_TREE_VARIANT, serialized_tree, out_checksum, error)) goto out; ret = TRUE; @@ -897,7 +897,7 @@ check_path (const char *filename, goto out; } - if (ht_util_filename_has_dotdot (filename)) + if (ot_util_filename_has_dotdot (filename)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Path uplink '..' in filename '%s' not allowed (yet)", filename); @@ -917,7 +917,7 @@ check_path (const char *filename, } static gboolean -walk_parsed_tree (HacktreeRepo *self, +walk_parsed_tree (OstreeRepo *self, const char *filename, ParsedTreeData *tree, int *out_filename_index, /* out*/ @@ -934,7 +934,7 @@ walk_parsed_tree (HacktreeRepo *self, int i; int ret_filename_index = 0; - components = ht_util_path_split (filename); + components = ot_util_path_split (filename); g_assert (components != NULL); current_tree = tree; @@ -978,7 +978,7 @@ walk_parsed_tree (HacktreeRepo *self, } static gboolean -remove_files_from_tree (HacktreeRepo *self, +remove_files_from_tree (OstreeRepo *self, const char *base, GPtrArray *removed_files, ParsedTreeData *tree, @@ -1028,7 +1028,7 @@ remove_files_from_tree (HacktreeRepo *self, } static gboolean -add_one_directory_to_tree_and_import (HacktreeRepo *self, +add_one_directory_to_tree_and_import (OstreeRepo *self, const char *basename, const char *abspath, ParsedTreeData *tree, @@ -1068,7 +1068,7 @@ add_one_directory_to_tree_and_import (HacktreeRepo *self, } static gboolean -add_one_file_to_tree_and_import (HacktreeRepo *self, +add_one_file_to_tree_and_import (OstreeRepo *self, const char *basename, const char *abspath, ParsedTreeData *tree, @@ -1080,7 +1080,7 @@ add_one_file_to_tree_and_import (HacktreeRepo *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_assert (tree != NULL); - if (!link_one_file (self, abspath, HACKTREE_OBJECT_TYPE_FILE, + if (!link_one_file (self, abspath, OSTREE_OBJECT_TYPE_FILE, TRUE, FALSE, &checksum, error)) goto out; @@ -1095,7 +1095,7 @@ add_one_file_to_tree_and_import (HacktreeRepo *self, } static gboolean -add_one_path_to_tree_and_import (HacktreeRepo *self, +add_one_path_to_tree_and_import (OstreeRepo *self, const char *base, const char *filename, ParsedTreeData *tree, @@ -1120,14 +1120,14 @@ add_one_path_to_tree_and_import (HacktreeRepo *self, if (lstat (abspath, &stbuf) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } is_directory = S_ISDIR(stbuf.st_mode); if (components) g_ptr_array_free (components, TRUE); - components = ht_util_path_split (filename); + components = ot_util_path_split (filename); g_assert (components->len > 0); current_tree = tree; @@ -1135,7 +1135,7 @@ add_one_path_to_tree_and_import (HacktreeRepo *self, { component = components->pdata[i]; g_free (component_abspath); - component_abspath = ht_util_path_join_n (base, components, i); + component_abspath = ot_util_path_join_n (base, components, i); file_sha1 = g_hash_table_lookup (current_tree->files, component); dir = g_hash_table_lookup (current_tree->directories, component); @@ -1197,7 +1197,7 @@ add_one_path_to_tree_and_import (HacktreeRepo *self, } static gboolean -add_files_to_tree_and_import (HacktreeRepo *self, +add_files_to_tree_and_import (OstreeRepo *self, const char *base, GPtrArray *added_files, ParsedTreeData *tree, @@ -1220,7 +1220,7 @@ add_files_to_tree_and_import (HacktreeRepo *self, } static gboolean -commit_parsed_tree (HacktreeRepo *self, +commit_parsed_tree (OstreeRepo *self, const char *subject, const char *body, GVariant *metadata, @@ -1228,7 +1228,7 @@ commit_parsed_tree (HacktreeRepo *self, GChecksum **out_commit, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); gboolean ret = FALSE; GChecksum *root_checksum = NULL; GChecksum *ret_commit = NULL; @@ -1240,14 +1240,14 @@ commit_parsed_tree (HacktreeRepo *self, now = g_date_time_new_now_utc (); commit = g_variant_new ("(u@a{sv}ssstss)", - HACKTREE_COMMIT_VERSION, + OSTREE_COMMIT_VERSION, create_empty_gvariant_dict (), priv->current_head ? priv->current_head : "", subject, body ? body : "", g_date_time_to_unix (now) / G_TIME_SPAN_SECOND, g_checksum_get_string (root_checksum), root->metadata_sha256); - if (!import_gvariant_object (self, HACKTREE_SERIALIZED_COMMIT_VARIANT, + if (!import_gvariant_object (self, OSTREE_SERIALIZED_COMMIT_VARIANT, commit, &ret_commit, error)) goto out; @@ -1270,7 +1270,7 @@ commit_parsed_tree (HacktreeRepo *self, } static gboolean -import_root (HacktreeRepo *self, +import_root (OstreeRepo *self, const char *base, ParsedDirectoryData **out_root, GError **error) @@ -1302,7 +1302,7 @@ import_root (HacktreeRepo *self, } gboolean -hacktree_repo_commit (HacktreeRepo *self, +ostree_repo_commit (OstreeRepo *self, const char *subject, const char *body, GVariant *metadata, @@ -1312,7 +1312,7 @@ hacktree_repo_commit (HacktreeRepo *self, GChecksum **out_commit, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); gboolean ret = FALSE; ParsedDirectoryData *root = NULL; GVariant *previous_commit = NULL; @@ -1374,7 +1374,7 @@ hacktree_repo_commit (HacktreeRepo *self, } gboolean -hacktree_repo_commit_from_filelist_fd (HacktreeRepo *self, +ostree_repo_commit_from_filelist_fd (OstreeRepo *self, const char *subject, const char *body, GVariant *metadata, @@ -1384,7 +1384,7 @@ hacktree_repo_commit_from_filelist_fd (HacktreeRepo *self, GChecksum **out_commit, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); gboolean ret = FALSE; ParsedDirectoryData *root = NULL; GVariant *previous_commit = NULL; @@ -1456,9 +1456,9 @@ hacktree_repo_commit_from_filelist_fd (HacktreeRepo *self, } static gboolean -iter_object_dir (HacktreeRepo *self, +iter_object_dir (OstreeRepo *self, GFile *dir, - HacktreeRepoObjectIter callback, + OstreeRepoObjectIter callback, gpointer user_data, GError **error) { @@ -1519,12 +1519,12 @@ iter_object_dir (HacktreeRepo *self, } gboolean -hacktree_repo_iter_objects (HacktreeRepo *self, - HacktreeRepoObjectIter callback, +ostree_repo_iter_objects (OstreeRepo *self, + OstreeRepoObjectIter callback, gpointer user_data, GError **error) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); GFile *objectdir = NULL; GFileEnumerator *enumerator = NULL; gboolean ret = FALSE; @@ -1534,7 +1534,7 @@ hacktree_repo_iter_objects (HacktreeRepo *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (priv->inited, FALSE); - objectdir = ht_util_new_file_for_path (priv->objects_path); + objectdir = ot_util_new_file_for_path (priv->objects_path); enumerator = g_file_enumerate_children (objectdir, "standard::name,standard::type,unix::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, @@ -1579,14 +1579,14 @@ hacktree_repo_iter_objects (HacktreeRepo *self, } gboolean -hacktree_repo_load_variant (HacktreeRepo *repo, +ostree_repo_load_variant (OstreeRepo *repo, const char *sha256, - HacktreeSerializedVariantType *out_type, + OstreeSerializedVariantType *out_type, GVariant **out_variant, GError **error) { gboolean ret = FALSE; - HacktreeSerializedVariantType ret_type; + OstreeSerializedVariantType ret_type; GVariant *ret_variant = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -1608,9 +1608,9 @@ hacktree_repo_load_variant (HacktreeRepo *repo, } const char * -hacktree_repo_get_head (HacktreeRepo *self) +ostree_repo_get_head (OstreeRepo *self) { - HacktreeRepoPrivate *priv = GET_PRIVATE (self); + OstreeRepoPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->inited, NULL); @@ -1618,14 +1618,14 @@ hacktree_repo_get_head (HacktreeRepo *self) } static gboolean -resolve_ref (HacktreeRepo *self, +resolve_ref (OstreeRepo *self, const char *ref, char **resolved, GError **error) { if (strcmp (ref, "HEAD") == 0) { - *resolved = g_strdup (hacktree_repo_get_head (self)); + *resolved = g_strdup (ostree_repo_get_head (self)); return TRUE; } else if (strlen (ref) == 64) @@ -1639,13 +1639,13 @@ resolve_ref (HacktreeRepo *self, } static gboolean -checkout_tree (HacktreeRepo *self, +checkout_tree (OstreeRepo *self, ParsedTreeData *tree, const char *destination, GError **error); static gboolean -checkout_one_directory (HacktreeRepo *self, +checkout_one_directory (OstreeRepo *self, const char *destination, const char *dirname, ParsedDirectoryData *dir, @@ -1666,7 +1666,7 @@ checkout_one_directory (HacktreeRepo *self, if (mkdir (dest_path, (mode_t)mode) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); g_prefix_error (error, "Failed to create directory '%s': ", dest_path); goto out; } @@ -1684,7 +1684,7 @@ checkout_one_directory (HacktreeRepo *self, } static gboolean -checkout_tree (HacktreeRepo *self, +checkout_tree (OstreeRepo *self, ParsedTreeData *tree, const char *destination, GError **error) @@ -1701,11 +1701,11 @@ checkout_tree (HacktreeRepo *self, char *object_path; char *dest_path; - object_path = get_object_path (self, checksum, HACKTREE_OBJECT_TYPE_FILE); + object_path = get_object_path (self, checksum, OSTREE_OBJECT_TYPE_FILE); dest_path = g_build_filename (destination, filename, NULL); if (link (object_path, dest_path) < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); g_free (object_path); g_free (dest_path); goto out; @@ -1730,7 +1730,7 @@ checkout_tree (HacktreeRepo *self, } gboolean -hacktree_repo_checkout (HacktreeRepo *self, +ostree_repo_checkout (OstreeRepo *self, const char *ref, const char *destination, GError **error) diff --git a/src/libhacktree/hacktree-repo.h b/src/libostree/ostree-repo.h similarity index 65% rename from src/libhacktree/hacktree-repo.h rename to src/libostree/ostree-repo.h index 2f6d7035..e2b9de3c 100644 --- a/src/libhacktree/hacktree-repo.h +++ b/src/libostree/ostree-repo.h @@ -18,56 +18,56 @@ * * Author: Colin Walters */ -/* hacktree-repo.h */ +/* ostree-repo.h */ -#ifndef _HACKTREE_REPO -#define _HACKTREE_REPO +#ifndef _OSTREE_REPO +#define _OSTREE_REPO #include G_BEGIN_DECLS -#define HACKTREE_TYPE_REPO hacktree_repo_get_type() -#define HACKTREE_REPO(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), HACKTREE_TYPE_REPO, HacktreeRepo)) -#define HACKTREE_REPO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), HACKTREE_TYPE_REPO, HacktreeRepoClass)) -#define HACKTREE_IS_REPO(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HACKTREE_TYPE_REPO)) -#define HACKTREE_IS_REPO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), HACKTREE_TYPE_REPO)) -#define HACKTREE_REPO_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), HACKTREE_TYPE_REPO, HacktreeRepoClass)) +#define OSTREE_TYPE_REPO ostree_repo_get_type() +#define OSTREE_REPO(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSTREE_TYPE_REPO, OstreeRepo)) +#define OSTREE_REPO_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), OSTREE_TYPE_REPO, OstreeRepoClass)) +#define OSTREE_IS_REPO(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSTREE_TYPE_REPO)) +#define OSTREE_IS_REPO_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), OSTREE_TYPE_REPO)) +#define OSTREE_REPO_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), OSTREE_TYPE_REPO, OstreeRepoClass)) typedef struct { GObject parent; -} HacktreeRepo; +} OstreeRepo; typedef struct { GObjectClass parent_class; -} HacktreeRepoClass; +} OstreeRepoClass; -GType hacktree_repo_get_type (void); +GType ostree_repo_get_type (void); -HacktreeRepo* hacktree_repo_new (const char *path); +OstreeRepo* ostree_repo_new (const char *path); -gboolean hacktree_repo_check (HacktreeRepo *self, GError **error); +gboolean ostree_repo_check (OstreeRepo *self, GError **error); -gboolean hacktree_repo_link_file (HacktreeRepo *self, +gboolean ostree_repo_link_file (OstreeRepo *self, const char *path, gboolean ignore_exists, gboolean force, GError **error); -const char * hacktree_repo_get_head (HacktreeRepo *self); +const char * ostree_repo_get_head (OstreeRepo *self); -gboolean hacktree_repo_load_variant (HacktreeRepo *self, +gboolean ostree_repo_load_variant (OstreeRepo *self, const char *sha256, - HacktreeSerializedVariantType *out_type, + OstreeSerializedVariantType *out_type, GVariant **out_variant, GError **error); -gboolean hacktree_repo_commit (HacktreeRepo *self, +gboolean ostree_repo_commit (OstreeRepo *self, const char *subject, const char *body, GVariant *metadata, @@ -77,7 +77,7 @@ gboolean hacktree_repo_commit (HacktreeRepo *self, GChecksum **out_commit, GError **error); -gboolean hacktree_repo_commit_from_filelist_fd (HacktreeRepo *self, +gboolean ostree_repo_commit_from_filelist_fd (OstreeRepo *self, const char *subject, const char *body, GVariant *metadata, @@ -87,19 +87,19 @@ gboolean hacktree_repo_commit_from_filelist_fd (HacktreeRepo *self, GChecksum **out_commit, GError **error); -gboolean hacktree_repo_checkout (HacktreeRepo *self, +gboolean ostree_repo_checkout (OstreeRepo *self, const char *ref, const char *destination, GError **error); -typedef void (*HacktreeRepoObjectIter) (HacktreeRepo *self, const char *path, +typedef void (*OstreeRepoObjectIter) (OstreeRepo *self, const char *path, GFileInfo *fileinfo, gpointer user_data); -gboolean hacktree_repo_iter_objects (HacktreeRepo *self, - HacktreeRepoObjectIter callback, +gboolean ostree_repo_iter_objects (OstreeRepo *self, + OstreeRepoObjectIter callback, gpointer user_data, GError **error); G_END_DECLS -#endif /* _HACKTREE_REPO */ +#endif /* _OSTREE_REPO */ diff --git a/src/libhacktree/hacktree-types.h b/src/libostree/ostree-types.h similarity index 91% rename from src/libhacktree/hacktree-types.h rename to src/libostree/ostree-types.h index 0824ad4c..5b306b3b 100644 --- a/src/libhacktree/hacktree-types.h +++ b/src/libostree/ostree-types.h @@ -19,14 +19,14 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_TYPES_H__ -#define __HACKTREE_TYPES_H__ +#ifndef __OSTREE_TYPES_H__ +#define __OSTREE_TYPES_H__ #include G_BEGIN_DECLS -#define HACKTREE_REPO_DIR ".ht" +#define OSTREE_REPO_DIR ".ot" G_END_DECLS diff --git a/src/libhacktree/hacktree.h b/src/libostree/ostree.h similarity index 89% rename from src/libhacktree/hacktree.h rename to src/libostree/ostree.h index 0cf2f15d..75cced5f 100644 --- a/src/libhacktree/hacktree.h +++ b/src/libostree/ostree.h @@ -19,10 +19,10 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_H__ +#ifndef __OSTREE_H__ -#include -#include -#include +#include +#include +#include #endif diff --git a/src/libhtutil/ht-gio-utils.c b/src/libotutil/ot-gio-utils.c similarity index 89% rename from src/libhtutil/ht-gio-utils.c rename to src/libotutil/ot-gio-utils.c index c49b8832..0d490754 100644 --- a/src/libhtutil/ht-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -27,10 +27,10 @@ #include -#include "htutil.h" +#include "otutil.h" gboolean -ht_util_ensure_directory (const char *path, gboolean with_parents, GError **error) +ot_util_ensure_directory (const char *path, gboolean with_parents, GError **error) { GFile *dir; GError *temp_error = NULL; @@ -60,7 +60,7 @@ ht_util_ensure_directory (const char *path, gboolean with_parents, GError **erro char * -ht_util_get_file_contents_utf8 (const char *path, +ot_util_get_file_contents_utf8 (const char *path, GError **error) { char *contents; @@ -81,7 +81,7 @@ ht_util_get_file_contents_utf8 (const char *path, } GInputStream * -ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **error) +ot_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **error) { GInputStream *ret = NULL; int fd; @@ -95,7 +95,7 @@ ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro fd = open (path, flags); if (fd < 0) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } @@ -108,7 +108,7 @@ ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro /* Like g_file_new_for_path, but only do local stuff, not GVFS */ GFile * -ht_util_new_file_for_path (const char *path) +ot_util_new_file_for_path (const char *path) { return g_vfs_get_file_for_path (g_vfs_get_local (), path); } diff --git a/src/libhtutil/ht-gio-utils.h b/src/libotutil/ot-gio-utils.h similarity index 76% rename from src/libhtutil/ht-gio-utils.h rename to src/libotutil/ot-gio-utils.h index c7342c4e..722e00c1 100644 --- a/src/libhtutil/ht-gio-utils.h +++ b/src/libotutil/ot-gio-utils.h @@ -19,20 +19,20 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_GIO_UTILS_H__ -#define __HACKTREE_GIO_UTILS_H__ +#ifndef __OSTREE_GIO_UTILS_H__ +#define __OSTREE_GIO_UTILS_H__ #include G_BEGIN_DECLS -GFile *ht_util_new_file_for_path (const char *path); +GFile *ot_util_new_file_for_path (const char *path); -gboolean ht_util_ensure_directory (const char *path, gboolean with_parents, GError **error); +gboolean ot_util_ensure_directory (const char *path, gboolean with_parents, GError **error); -char * ht_util_get_file_contents_utf8 (const char *path, GError **error); +char * ot_util_get_file_contents_utf8 (const char *path, GError **error); -GInputStream *ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **error); +GInputStream *ot_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **error); G_END_DECLS diff --git a/src/libhtutil/ht-unix-utils.c b/src/libotutil/ot-unix-utils.c similarity index 88% rename from src/libhtutil/ht-unix-utils.c rename to src/libotutil/ot-unix-utils.c index d955725e..95cdb8d6 100644 --- a/src/libhtutil/ht-unix-utils.c +++ b/src/libotutil/ot-unix-utils.c @@ -21,7 +21,7 @@ #include "config.h" -#include "ht-unix-utils.h" +#include "ot-unix-utils.h" #include #include @@ -32,7 +32,7 @@ #include gboolean -ht_util_spawn_pager (GOutputStream **out_stream, +ot_util_spawn_pager (GOutputStream **out_stream, GError **error) { const char *pager; @@ -97,7 +97,7 @@ compare_filenames_by_component_length (const char *a, } GPtrArray * -ht_util_sort_filenames_by_component_length (GPtrArray *files) +ot_util_sort_filenames_by_component_length (GPtrArray *files) { GPtrArray *array = g_ptr_array_sized_new (files->len); memcpy (array->pdata, files->pdata, sizeof (gpointer) * files->len); @@ -106,7 +106,7 @@ ht_util_sort_filenames_by_component_length (GPtrArray *files) } int -ht_util_count_filename_components (const char *path) +ot_util_count_filename_components (const char *path) { int i = 0; @@ -121,7 +121,7 @@ ht_util_count_filename_components (const char *path) } gboolean -ht_util_filename_has_dotdot (const char *path) +ot_util_filename_has_dotdot (const char *path) { char *p; char last; @@ -138,7 +138,7 @@ ht_util_filename_has_dotdot (const char *path) } GPtrArray * -ht_util_path_split (const char *path) +ot_util_path_split (const char *path) { GPtrArray *ret = NULL; const char *p; @@ -176,7 +176,7 @@ ht_util_path_split (const char *path) } char * -ht_util_path_join_n (const char *base, GPtrArray *components, int n) +ot_util_path_join_n (const char *base, GPtrArray *components, int n) { int max = MIN(n+1, components->len); GPtrArray *subcomponents; @@ -201,7 +201,7 @@ ht_util_path_join_n (const char *base, GPtrArray *components, int n) } void -ht_util_set_error_from_errno (GError **error, +ot_util_set_error_from_errno (GError **error, gint saved_errno) { g_set_error_literal (error, @@ -212,7 +212,7 @@ ht_util_set_error_from_errno (GError **error, } int -ht_util_open_file_read (const char *path, GError **error) +ot_util_open_file_read (const char *path, GError **error) { char *dirname = NULL; char *basename = NULL; @@ -224,11 +224,11 @@ ht_util_open_file_read (const char *path, GError **error) dir = opendir (dirname); if (dir == NULL) { - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); goto out; } - fd = ht_util_open_file_read_at (dirfd (dir), basename, error); + fd = ot_util_open_file_read_at (dirfd (dir), basename, error); out: g_free (basename); @@ -239,7 +239,7 @@ ht_util_open_file_read (const char *path, GError **error) } int -ht_util_open_file_read_at (int dirfd, const char *name, GError **error) +ot_util_open_file_read_at (int dirfd, const char *name, GError **error) { int fd; int flags = O_RDONLY; @@ -252,6 +252,6 @@ ht_util_open_file_read_at (int dirfd, const char *name, GError **error) #endif fd = openat (dirfd, name, flags); if (fd < 0) - ht_util_set_error_from_errno (error, errno); + ot_util_set_error_from_errno (error, errno); return fd; } diff --git a/src/libhtutil/ht-unix-utils.h b/src/libotutil/ot-unix-utils.h similarity index 66% rename from src/libhtutil/ht-unix-utils.h rename to src/libotutil/ot-unix-utils.h index cc027a3d..dbbf8c07 100644 --- a/src/libhtutil/ht-unix-utils.h +++ b/src/libotutil/ot-unix-utils.h @@ -19,8 +19,8 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_UNIX_UTILS_H__ -#define __HACKTREE_UNIX_UTILS_H__ +#ifndef __OSTREE_UNIX_UTILS_H__ +#define __OSTREE_UNIX_UTILS_H__ #include #include @@ -36,23 +36,23 @@ G_BEGIN_DECLS -gboolean ht_util_spawn_pager (GOutputStream **out_stream, GError **error); +gboolean ot_util_spawn_pager (GOutputStream **out_stream, GError **error); -gboolean ht_util_filename_has_dotdot (const char *path); +gboolean ot_util_filename_has_dotdot (const char *path); -GPtrArray *ht_util_sort_filenames_by_component_length (GPtrArray *files); +GPtrArray *ot_util_sort_filenames_by_component_length (GPtrArray *files); -GPtrArray* ht_util_path_split (const char *path); +GPtrArray* ot_util_path_split (const char *path); -char *ht_util_path_join_n (const char *base, GPtrArray *components, int n); +char *ot_util_path_join_n (const char *base, GPtrArray *components, int n); -int ht_util_count_filename_components (const char *path); +int ot_util_count_filename_components (const char *path); -int ht_util_open_file_read (const char *path, GError **error); +int ot_util_open_file_read (const char *path, GError **error); -int ht_util_open_file_read_at (int dirfd, const char *name, GError **error); +int ot_util_open_file_read_at (int dirfd, const char *name, GError **error); -void ht_util_set_error_from_errno (GError **error, gint saved_errno); +void ot_util_set_error_from_errno (GError **error, gint saved_errno); G_END_DECLS diff --git a/src/libhtutil/htutil.h b/src/libotutil/otutil.h similarity index 91% rename from src/libhtutil/htutil.h rename to src/libotutil/otutil.h index 4434b384..38cfd8e1 100644 --- a/src/libhtutil/htutil.h +++ b/src/libotutil/otutil.h @@ -19,9 +19,9 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_UTIL_H__ +#ifndef __OSTREE_UTIL_H__ -#include -#include +#include +#include #endif diff --git a/src/main.c b/src/main.c index 6e8ce9dc..d6e0b5e5 100644 --- a/src/main.c +++ b/src/main.c @@ -26,23 +26,23 @@ #include -#include "ht-builtins.h" +#include "ot-builtins.h" -static HacktreeBuiltin builtins[] = { - { "checkout", hacktree_builtin_checkout, 0 }, - { "init", hacktree_builtin_init, 0 }, - { "commit", hacktree_builtin_commit, 0 }, - { "link-file", hacktree_builtin_link_file, 0 }, - { "log", hacktree_builtin_log, 0 }, - { "fsck", hacktree_builtin_fsck, 0 }, - { "show", hacktree_builtin_show, 0 }, +static OstreeBuiltin builtins[] = { + { "checkout", ostree_builtin_checkout, 0 }, + { "init", ostree_builtin_init, 0 }, + { "commit", ostree_builtin_commit, 0 }, + { "link-file", ostree_builtin_link_file, 0 }, + { "log", ostree_builtin_log, 0 }, + { "fsck", ostree_builtin_fsck, 0 }, + { "show", ostree_builtin_show, 0 }, { NULL } }; static int usage (char **argv, gboolean is_error) { - HacktreeBuiltin *builtin = builtins; + OstreeBuiltin *builtin = builtins; void (*print_func) (const gchar *format, ...); if (is_error) @@ -67,7 +67,7 @@ int main (int argc, char **argv) { - HacktreeBuiltin *builtin; + OstreeBuiltin *builtin; const char *cmd; g_type_init (); diff --git a/src/ht-builtin-checkout.c b/src/ot-builtin-checkout.c similarity index 86% rename from src/ht-builtin-checkout.c rename to src/ot-builtin-checkout.c index 5ed32b97..8eb4353c 100644 --- a/src/ht-builtin-checkout.c +++ b/src/ot-builtin-checkout.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -34,11 +34,11 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; int i; const char *commit; const char *destination; @@ -52,8 +52,8 @@ hacktree_builtin_checkout (int argc, char **argv, const char *prefix, GError **e if (repo_path == NULL) repo_path = "."; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; if (argc < 3) @@ -69,7 +69,7 @@ hacktree_builtin_checkout (int argc, char **argv, const char *prefix, GError **e commit = argv[1]; destination = argv[2]; - if (!hacktree_repo_checkout (repo, commit, destination, error)) + if (!ostree_repo_checkout (repo, commit, destination, error)) goto out; ret = TRUE; diff --git a/src/ht-builtin-commit.c b/src/ot-builtin-commit.c similarity index 92% rename from src/ht-builtin-commit.c rename to src/ot-builtin-commit.c index b26cbdbf..241ba2b5 100644 --- a/src/ht-builtin-commit.c +++ b/src/ot-builtin-commit.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -50,11 +50,11 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; gboolean using_filename_cmdline; gboolean using_filedescriptors; GPtrArray *additions_array = NULL; @@ -73,8 +73,8 @@ hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **err if (prefix == NULL) prefix = "."; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; using_filename_cmdline = (removals || additions); @@ -113,7 +113,7 @@ hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **err for (iter = removals; *iter; iter++) g_ptr_array_add (removals_array, *iter); - if (!hacktree_repo_commit (repo, subject, body, NULL, + if (!ostree_repo_commit (repo, subject, body, NULL, prefix, additions_array, removals_array, &commit_checksum, @@ -129,7 +129,7 @@ hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **err from_fd = 0; else if (from_file) { - temp_fd = ht_util_open_file_read (from_file, error); + temp_fd = ot_util_open_file_read (from_file, error); if (temp_fd < 0) { g_prefix_error (error, "Failed to open '%s': ", from_file); @@ -137,7 +137,7 @@ hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **err } from_fd = temp_fd; } - if (!hacktree_repo_commit_from_filelist_fd (repo, subject, body, NULL, + if (!ostree_repo_commit_from_filelist_fd (repo, subject, body, NULL, prefix, from_fd, separator, &commit_checksum, error)) { diff --git a/src/ht-builtin-fsck.c b/src/ot-builtin-fsck.c similarity index 87% rename from src/ht-builtin-fsck.c rename to src/ot-builtin-fsck.c index 36725240..e85c9f63 100644 --- a/src/ht-builtin-fsck.c +++ b/src/ot-builtin-fsck.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -40,7 +40,7 @@ typedef struct { } HtFsckData; static void -object_iter_callback (HacktreeRepo *repo, +object_iter_callback (OstreeRepo *repo, const char *path, GFileInfo *file_info, gpointer user_data) @@ -62,7 +62,7 @@ object_iter_callback (HacktreeRepo *repo, if (nlinks < 2 && !quiet) g_printerr ("note: floating object: %s\n", path); */ - if (!hacktree_stat_and_checksum_file (-1, path, &checksum, &stbuf, &error)) + if (!ostree_stat_and_checksum_file (-1, path, &checksum, &stbuf, &error)) goto out; filename_checksum = g_strdup (g_file_info_get_name (file_info)); @@ -95,12 +95,12 @@ object_iter_callback (HacktreeRepo *repo, } gboolean -hacktree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; HtFsckData data; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; const char *head; context = g_option_context_new ("- Check the repository for consistency"); @@ -114,14 +114,14 @@ hacktree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error data.n_objects = 0; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; - if (!hacktree_repo_iter_objects (repo, object_iter_callback, &data, error)) + if (!ostree_repo_iter_objects (repo, object_iter_callback, &data, error)) goto out; - head = hacktree_repo_get_head (repo); + head = ostree_repo_get_head (repo); if (!head) { if (!quiet) diff --git a/src/ht-builtin-init.c b/src/ot-builtin-init.c similarity index 88% rename from src/ht-builtin-init.c rename to src/ot-builtin-init.c index 4dc2d7f0..9d864645 100644 --- a/src/ht-builtin-init.c +++ b/src/ot-builtin-init.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -33,7 +33,7 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_init (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context = NULL; gboolean ret = FALSE; @@ -51,8 +51,8 @@ hacktree_builtin_init (int argc, char **argv, const char *prefix, GError **error if (repo_path == NULL) repo_path = "."; - htdir_path = g_build_filename (repo_path, HACKTREE_REPO_DIR, NULL); - htdir = ht_util_new_file_for_path (htdir_path); + htdir_path = g_build_filename (repo_path, OSTREE_REPO_DIR, NULL); + htdir = ot_util_new_file_for_path (htdir_path); if (!g_file_make_directory (htdir, NULL, error)) goto out; diff --git a/src/ht-builtin-link-file.c b/src/ot-builtin-link-file.c similarity index 85% rename from src/ht-builtin-link-file.c rename to src/ot-builtin-link-file.c index 80f511d9..dddec440 100644 --- a/src/ht-builtin-link-file.c +++ b/src/ot-builtin-link-file.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -38,11 +38,11 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; int i; context = g_option_context_new ("- Create a new hard link in the repository"); @@ -54,13 +54,13 @@ hacktree_builtin_link_file (int argc, char **argv, const char *prefix, GError ** if (repo_path == NULL) repo_path = "."; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; for (i = 0; i < argc-1; i++) { - if (!hacktree_repo_link_file (repo, argv[i+1], ignore_exists, force, error)) + if (!ostree_repo_link_file (repo, argv[i+1], ignore_exists, force, error)) goto out; } diff --git a/src/ht-builtin-log.c b/src/ot-builtin-log.c similarity index 90% rename from src/ht-builtin-log.c rename to src/ot-builtin-log.c index aa0c271e..47d5db51 100644 --- a/src/ht-builtin-log.c +++ b/src/ot-builtin-log.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -34,11 +34,11 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_log (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_log (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; GOutputStream *pager = NULL; GVariant *commit = NULL; char *head; @@ -54,23 +54,23 @@ hacktree_builtin_log (int argc, char **argv, const char *prefix, GError **error) if (prefix == NULL) prefix = "."; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; - head = g_strdup (hacktree_repo_get_head (repo)); + head = g_strdup (ostree_repo_get_head (repo)); if (!head) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "No HEAD exists"); goto out; } - if (!ht_util_spawn_pager (&pager, error)) + if (!ot_util_spawn_pager (&pager, error)) goto out; while (TRUE) { - HacktreeSerializedVariantType type; + OstreeSerializedVariantType type; char *formatted = NULL; guint32 version; const char *parent; @@ -88,7 +88,7 @@ hacktree_builtin_log (int argc, char **argv, const char *prefix, GError **error) if (commit) g_variant_unref (commit); - if (!hacktree_repo_load_variant (repo, head, &type, &commit, error)) + if (!ostree_repo_load_variant (repo, head, &type, &commit, error)) goto out; /* Ignore commit metadata for now */ diff --git a/src/ht-builtin-show.c b/src/ot-builtin-show.c similarity index 84% rename from src/ht-builtin-show.c rename to src/ot-builtin-show.c index b9f30f24..4b280fb8 100644 --- a/src/ht-builtin-show.c +++ b/src/ot-builtin-show.c @@ -21,8 +21,8 @@ #include "config.h" -#include "ht-builtins.h" -#include "hacktree.h" +#include "ot-builtins.h" +#include "ostree.h" #include @@ -34,14 +34,14 @@ static GOptionEntry options[] = { }; gboolean -hacktree_builtin_show (int argc, char **argv, const char *prefix, GError **error) +ostree_builtin_show (int argc, char **argv, const char *prefix, GError **error) { GOptionContext *context; gboolean ret = FALSE; - HacktreeRepo *repo = NULL; + OstreeRepo *repo = NULL; int i; const char *target; - HacktreeSerializedVariantType type; + OstreeSerializedVariantType type; GVariant *variant = NULL; char *formatted_variant = NULL; @@ -54,13 +54,13 @@ hacktree_builtin_show (int argc, char **argv, const char *prefix, GError **error if (repo_path == NULL) repo_path = "."; - repo = hacktree_repo_new (repo_path); - if (!hacktree_repo_check (repo, error)) + repo = ostree_repo_new (repo_path); + if (!ostree_repo_check (repo, error)) goto out; if (argc < 2) { - target = hacktree_repo_get_head (repo); + target = ostree_repo_get_head (repo); if (!target) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, @@ -71,7 +71,7 @@ hacktree_builtin_show (int argc, char **argv, const char *prefix, GError **error else target = argv[1]; - if (!hacktree_repo_load_variant (repo, target, &type, &variant, error)) + if (!ostree_repo_load_variant (repo, target, &type, &variant, error)) goto out; g_print ("Object: %s\nType: %d\n", target, type); diff --git a/src/ht-builtins.h b/src/ot-builtins.h similarity index 59% rename from src/ht-builtins.h rename to src/ot-builtins.h index 3cfe5b15..7e6d7e7e 100644 --- a/src/ht-builtins.h +++ b/src/ot-builtins.h @@ -19,30 +19,30 @@ * Author: Colin Walters */ -#ifndef __HACKTREE_BUILTINS__ -#define __HACKTREE_BUILTINS__ +#ifndef __OSTREE_BUILTINS__ +#define __OSTREE_BUILTINS__ #include G_BEGIN_DECLS typedef enum { - HACKTREE_BUILTIN_FLAG_NONE = 0, -} HacktreeBuiltinFlags; + OSTREE_BUILTIN_FLAG_NONE = 0, +} OstreeBuiltinFlags; typedef struct { const char *name; gboolean (*fn) (int argc, char **argv, const char *prefix, GError **error); - int flags; /* HacktreeBuiltinFlags */ -} HacktreeBuiltin; + int flags; /* OstreeBuiltinFlags */ +} OstreeBuiltin; -gboolean hacktree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_commit (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_init (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_log (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error); -gboolean hacktree_builtin_show (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_log (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error); +gboolean ostree_builtin_show (int argc, char **argv, const char *prefix, GError **error); G_END_DECLS diff --git a/tests/libtest.sh b/tests/libtest.sh index 41c7ffbe..2cfebae3 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -20,7 +20,7 @@ TMPDIR=${TMPDIR:-/tmp} export TMPDIR -test_tmpdir=`mktemp -d "$TMPDIR/hacktree-tests.XXXXXXXXXX"` +test_tmpdir=`mktemp -d "$TMPDIR/ostree-tests.XXXXXXXXXX"` cd "$test_tmpdir" touch "$test_tmpdir/.test$$" @@ -57,12 +57,12 @@ setup_test_repository1 () { echo second > secondfile mkdir ../repo - ht_repo="--repo=../repo" - export ht_repo - hacktree init $ht_repo - hacktree commit $ht_repo -s "Test Commit 1" -b "Commit body first" --add=firstfile - hacktree commit $ht_repo -s "Test Commit 2" -b "Commit body second" --add=secondfile - hacktree fsck -q $ht_repo + ot_repo="--repo=../repo" + export ot_repo + ostree init $ot_repo + ostree commit $ot_repo -s "Test Commit 1" -b "Commit body first" --add=firstfile + ostree commit $ot_repo -s "Test Commit 2" -b "Commit body second" --add=secondfile + ostree fsck -q $ot_repo } setup_test_repository2 () { @@ -82,13 +82,13 @@ setup_test_repository2 () { cd .. mkdir repo cd repo - ht_repo="--repo=`pwd`" + ot_repo="--repo=`pwd`" cd ../files - export ht_repo - hacktree init $ht_repo - hacktree commit $ht_repo -s "Test Commit 1" -b "Commit body first" --add=firstfile - hacktree commit $ht_repo -s "Test Commit 2" -b "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y - hacktree fsck -q $ht_repo + export ot_repo + ostree init $ot_repo + ostree commit $ot_repo -s "Test Commit 1" -b "Commit body first" --add=firstfile + ostree commit $ot_repo -s "Test Commit 2" -b "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y + ostree fsck -q $ot_repo } trap 'die' EXIT diff --git a/tests/t0000-init-link-files-fsck.sh b/tests/t0000-init-link-files-fsck.sh index 5cdbac3d..b035045f 100755 --- a/tests/t0000-init-link-files-fsck.sh +++ b/tests/t0000-init-link-files-fsck.sh @@ -31,15 +31,15 @@ echo moo > files/cow mkdir repo cd repo -hacktree init +ostree init echo 'ok init' -hacktree fsck -q +ostree fsck -q echo 'ok fsck' -hacktree link-file $files/foo +ostree link-file $files/foo echo 'ok link' -hacktree fsck -q +ostree fsck -q echo 'ok link-fsk' -hacktree link-file $files/cow -hacktree fsck -q +ostree link-file $files/cow +ostree fsck -q echo 'ok link-fsk2' diff --git a/tests/t0001-init-out-of-tree.sh b/tests/t0001-init-out-of-tree.sh index 436b41be..7ab50798 100755 --- a/tests/t0001-init-out-of-tree.sh +++ b/tests/t0001-init-out-of-tree.sh @@ -29,9 +29,9 @@ cd files echo hello > yy mkdir ../repo -hacktree init --repo=../repo +ostree init --repo=../repo echo 'ok init' -hacktree fsck --repo=../repo -q +ostree fsck --repo=../repo -q echo 'ok fsck' -hacktree link-file --repo=../repo yy +ostree link-file --repo=../repo yy echo 'ok link' diff --git a/tests/t0002-commit-one.sh b/tests/t0002-commit-one.sh index a8f8d2e9..b181a279 100755 --- a/tests/t0002-commit-one.sh +++ b/tests/t0002-commit-one.sh @@ -30,9 +30,9 @@ echo hello > yy mkdir ../repo repo="--repo=../repo" -hacktree init $repo +ostree init $repo echo 'ok init' -hacktree commit $repo -s "Test Commit" -b "Commit body" --add=yy +ostree commit $repo -s "Test Commit" -b "Commit body" --add=yy echo 'ok commit' -hacktree fsck -q $repo +ostree fsck -q $repo echo 'ok fsck' diff --git a/tests/t0003-commit-multiple.sh b/tests/t0003-commit-multiple.sh index 9036fba2..1ba31ec2 100755 --- a/tests/t0003-commit-multiple.sh +++ b/tests/t0003-commit-multiple.sh @@ -31,11 +31,11 @@ echo second > secondfile mkdir ../repo repo="--repo=../repo" -hacktree init $repo +ostree init $repo echo 'ok init' -hacktree commit $repo -s "Test Commit 1" -b "Commit body first" --add=firstfile +ostree commit $repo -s "Test Commit 1" -b "Commit body first" --add=firstfile echo 'ok commit 1' -hacktree commit $repo -s "Test Commit 2" -b "Commit body first" --add=secondfile +ostree commit $repo -s "Test Commit 2" -b "Commit body first" --add=secondfile echo 'ok commit 2' -hacktree fsck -q $repo +ostree fsck -q $repo echo 'ok fsck' diff --git a/tests/t0004-checkout-test1.sh b/tests/t0004-checkout-test1.sh index fa494e3c..5b30b6fe 100755 --- a/tests/t0004-checkout-test1.sh +++ b/tests/t0004-checkout-test1.sh @@ -26,7 +26,7 @@ echo '1..3' setup_test_repository1 echo 'ok setup' -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout1-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout1-head echo 'ok checkout cmd' cd $test_tmpdir/checkout1-head assert_has_file firstfile diff --git a/tests/t0005-nested-tree.sh b/tests/t0005-nested-tree.sh index f7f51827..d577ce70 100755 --- a/tests/t0005-nested-tree.sh +++ b/tests/t0005-nested-tree.sh @@ -26,7 +26,7 @@ echo '1..5' setup_test_repository2 echo 'ok setup' -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout2-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout2-head echo 'ok checkout cmd' cd $test_tmpdir/checkout2-head assert_has_file firstfile diff --git a/tests/t0006-removal.sh b/tests/t0006-removal.sh index 2eada218..926da72b 100755 --- a/tests/t0006-removal.sh +++ b/tests/t0006-removal.sh @@ -25,14 +25,14 @@ set -e echo '1..4' setup_test_repository2 -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout2-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout2-head echo 'ok setup' cd $test_tmpdir/checkout2-head -hacktree commit -s delete $ht_repo -r firstfile +ostree commit -s delete $ot_repo -r firstfile echo 'ok rm firstfile' assert_has_file firstfile # It should still exist in this checkout cd $test_tmpdir -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout3-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout3-head echo 'ok checkout 3' cd $test_tmpdir/checkout3-head assert_not_has_file firstfile diff --git a/tests/t0007-commit-stdin.sh b/tests/t0007-commit-stdin.sh index b2cb9351..16a68847 100755 --- a/tests/t0007-commit-stdin.sh +++ b/tests/t0007-commit-stdin.sh @@ -25,7 +25,7 @@ set -e echo "1..2" setup_test_repository2 -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout2-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout2-head cd $test_tmpdir/checkout2-head mkdir -p a/nested/tree echo one > a/nested/tree/1 @@ -39,9 +39,9 @@ mkdir -p another/nested/tree echo anotherone > another/nested/tree/1 echo whee2 > another/whee # FIXME - remove grep for . -find | grep -v '^\.$' | hacktree commit $ht_repo --from-stdin -s "From find" +find | grep -v '^\.$' | ostree commit $ot_repo --from-stdin -s "From find" echo "ok commit stdin" -hacktree checkout $ht_repo HEAD $test_tmpdir/checkout3-head +ostree checkout $ot_repo HEAD $test_tmpdir/checkout3-head cd $test_tmpdir/checkout3-head assert_has_file a/nested/2 assert_file_has_content a/nested/2 'two2' diff --git a/tests/t0008-log.sh b/tests/t0008-log.sh index 60316ce6..d75893e0 100755 --- a/tests/t0008-log.sh +++ b/tests/t0008-log.sh @@ -22,10 +22,10 @@ set -e . libtest.sh -echo "1..2" +echo "1..1" setup_test_repository2 -hacktree log $ht_repo > $test_tmpdir/log.txt +ostree log $ot_repo > $test_tmpdir/log.txt assert_file_has_content $test_tmpdir/log.txt "Test Commit 1" assert_file_has_content $test_tmpdir/log.txt "Test Commit 2" echo "ok log"