Commit Graph

228 Commits

Author SHA1 Message Date
Colin Walters f438d9aaa6 core: Drop some dead temporary file code 2012-05-29 22:09:31 -04:00
Colin Walters 27358a8de6 core: [INCOMPATIBLE CHANGE] Re-split archive content into .file and .filecontent
This will allow us to use hard links again for user-mode checkouts,
rather than the hackish link cache.  It was pretty silly anyways to
have file objects be stored with just a small metadata header
prepended, but uncompressed.

Either they should be hardlinkable, or compressed (in pack files).
2012-05-04 16:10:30 -04:00
Colin Walters 3321fa08d7 core: Handle zero-sized archives, improve fsck error message 2012-05-04 13:40:25 -04:00
Colin Walters 8d926c3e36 core: Add valgrind framework, plug various memory leaks 2012-05-04 10:04:32 -04:00
Colin Walters 7ce587da30 core: Optimize commits to raw repositories
Avoid creating a temporary intermediate file in the case where we have
the total object length available.
2012-05-04 06:15:47 -04:00
Colin Walters 67f61976f4 core: Clean up object storage API
Rather than passing xattr/file_info for all objects, change the API to
assume we're passing the defined object stream for each type.  Namely,
for OSTREE_OBJECT_TYPE_FILE, we're now giving the "archive file" data.

This significantly cleans up the code for committing to archive mode
repositories, at the cost of having to (at present) create an
intermediate temporary file when committing to raw repositories.
2012-05-03 19:59:13 -04:00
Colin Walters 8d6bdaedfe core: Fix 32/8 bit confusion in pack index listing 2012-05-01 17:44:14 -04:00
Colin Walters 38ef75e6e0 core: Re-unify on one OSTREE_OBJECT_TYPE_FILE
Having the archived vs not distinction in the object system wasn't
useful in light of pack files.  In fact, we should probably move
towards generating a pack file per commit by default.
2012-04-11 22:27:59 -04:00
Colin Walters f15c184584 core: Clean up checksumming
Don't expose GChecksum in APIs.  Add a new stream class which allows
us to pass an input stream somewhere, but gather a checksum as it's
read.

Move some bits of the internals towards binary csums.
2012-04-11 22:04:06 -04:00
Colin Walters fa4cbc8b89 core: Drop wrapping of metadata variants 2012-04-11 22:04:05 -04:00
Colin Walters 5a82b141ae core: Split pack files into data/metadata
This will allow us to download metadata first (separately), and in the
future we can have an improved metadata pack format that compresses
heavily.
2012-04-11 22:04:05 -04:00
Colin Walters 11c0fbc738 core: Switch to 'ay' for checksums, drop versions/metadata 2012-04-11 22:04:00 -04:00
Colin Walters 0e8149eb83 core: Clean up checksum API
We want to move towards guchar * for binary checksums.
2012-04-11 19:54:55 -04:00
Colin Walters 8b6bf09d7a core: Port libostree to local alloc 2012-04-09 15:57:46 -04:00
Colin Walters 72398ab62c core: Fix xattr API to conform to coding style 2012-04-09 15:56:27 -04:00
Colin Walters 8792007bc1 core: Validate structure of objects in fsck 2012-04-03 08:52:58 -04:00
Colin Walters a0b7d94cb6 core: Fix a few memory leaks 2012-04-02 18:32:40 -04:00
Colin Walters b971ce0dfa core: Only depend on GLib 2.30 2012-04-02 13:42:09 -04:00
Colin Walters 80bdfd7f42 core: Add pack files
This concept is also directly inspired by git.  At present, our
implementation is quite similar, except we don't have delta
compression.
2012-03-31 11:51:47 -04:00
Colin Walters 70afd6011f core: Add helper functions to convert (checksum, objtype) pair to/from string 2012-03-14 09:37:00 -04:00
Colin Walters 76bc35186e core: Add --union mode to checkout
This is another step towards ostbuild using this instead of the
"compose" builtin.
2012-03-06 11:59:06 -05:00
Colin Walters 83fb6d56e1 core: Don't call unlink() on directory if it already exists
If we fail to make a directory because it exists, we shouldn't call
unlink() on it.
2012-03-06 11:59:06 -05:00
Colin Walters b783ebc189 core: Add API to validate rev 2012-02-27 08:37:37 -05:00
Colin Walters 5329f1706b core: Further fix fallout from archive mode files
Continuing from 16c0cfe9b5, we now have
the problem that we're removing the executable bit, which obviously
breaks things when we chroot in for a build.  Fix this by masking over
our bits.
2012-02-24 17:50:44 -05:00
Colin Walters 16c0cfe9b5 core: Fix regression when committing symlinks in archive mode
Commit 802959f398 broke this because it
made all archived content files be S_IFREG, which is clearly wrong.
2012-02-24 10:05:26 -05:00
Colin Walters 802959f398 core: Ensure .archive-content files are mode 0644
We don't want to inherit the permissions of the actual file, otherwise
trying to fetch e.g. /etc/passwd when being served via Apache httpd
will break.
2012-02-23 12:34:43 -05:00
Colin Walters ebe35dbefe core: Ensure we delete duplicate files in a transaction
If multiple files have the same hash, we need to ensure we're not
overwriting other tempfiles in the same transaction.  Instead
just delete them, since we know they're in the repo.
2012-01-15 12:25:52 -05:00
Colin Walters 3292dcb6d6 core: Allow / in ref names like git does
Using / is nice basically.
2011-12-22 15:59:47 -05:00
Colin Walters 9bcd4ff8aa core: Use global random object
We were pointlessly creating a new rand (and thus opening /dev/random)
on every temp file creation, but still using the global rand.
2011-12-22 11:23:16 -05:00
Colin Walters 9a71ab187d core: INCOMPATIBLE CHANGE: Split archive files in two parts (meta and content)
This will allow us to have hardlink checkouts of archives.  A key use
case here is an archive repo of an OS (with root-owned files etc.)
where we want to do builds in a user tree.

A positive side effect of doing things this way is that now the SHA256
checksums for a given file should be identical regardless of whether
it's stored in an archive or bare repository.
2011-12-15 13:14:06 -05:00
Colin Walters ecbffd4915 core: Don't insert null byte in temporary file names 2011-12-15 13:10:41 -05:00
Colin Walters 8ab2296a70 core: Add utility functions to convert a OstreeObjectType to/from a string 2011-12-15 13:09:51 -05:00
Colin Walters b8e8b58585 core: INCOMPATIBLE CHANGE: Name repo files with their type (e.g. .dirmeta)
This makes inspection easier.  Internally the code gets simpler because
metadata and files are more unified; there is just one object type.
2011-12-12 12:29:09 -05:00
Colin Walters f6117de8d3 core: s/pack/archived/
This completes the rename from the previous commit.
2011-12-08 17:45:37 -05:00
Colin Walters d6ceb91c35 core: Make ot_transfer_out_value() take a & for the second argument
As Ray Strode argued, it's confusing to have something that looks like
a function be magical.  And OT_TRANSFER_OUT_VALUE is uglier.
2011-12-08 17:31:45 -05:00
Colin Walters 35fa68a74c core: INCOMPATIBLE CHANGE: Rename .packfile to .archive
It's too confusing that we call the mode "archive" but the actual
files ".packfile".  Also, git already has a "packfile" that serves a
totally different purpose.
2011-12-08 17:15:59 -05:00
Colin Walters 7932811fbb core: Delete some dead code 2011-12-08 14:55:41 -05:00
Colin Walters a94e0b8bf8 core: Ensure we chown created directories too 2011-12-06 20:16:03 -05:00
Colin Walters c32141c2bf core: Remove some useless wrapping of packfile unpacking in checkout 2011-12-06 20:09:09 -05:00
Colin Walters 267bf8ef4a core: Ensure we initialize checksum in FIFO case too 2011-12-05 11:15:12 -05:00
Colin Walters 9d39517554 core: Add _from_input variant of checksum API 2011-12-05 10:28:42 -05:00
Colin Walters f9315e8f82 core: Fix a memory leak in checkout 2011-12-04 14:08:55 -05:00
Colin Walters 45addeadf0 core: Handle NULL xattrs in packfile generation, throw error on invalid mode 2011-12-04 13:12:06 -05:00
Colin Walters 1f6d49cdb9 core: Initialize checksums for non-regular files, handle NULL xattrs 2011-12-04 12:11:29 -05:00
Colin Walters 0003e101f6 core: New ot_transfer_out_value() macro
This makes out values considerably less typing.
2011-12-02 18:17:06 -05:00
Colin Walters 3ab69101f7 core: Fix packed file creation
We were calculating the wrong checksum, and also mistakenly
not using packed files in archive mode for non-regular files.
2011-12-02 17:49:57 -05:00
Colin Walters 0d4df5b3fe core: Avoid reading regular file data twice when archiving 2011-12-02 14:23:01 -05:00
Colin Walters d1950da1a0 core: Further unify API to create files
We now have just one place which writes to the filesystem.  Wrap a
temporary file allocation API on top of that.
2011-12-02 13:42:25 -05:00
Colin Walters 7fc625c967 core: Move pack file parsing into core, add ostree_create_file_from_input() API
This moves us closer to consistently passing around a triple of:
  (GFileInfo *info, GVariant *xattrs, GInputStream *content)
Which will help the libarchive work.
2011-12-02 10:11:09 -05:00
Colin Walters f98e2a2ddb core: Tweak dir metadata importing code for libarchive work
This will allow us to share a bit more code.
2011-12-01 19:45:00 -05:00
Colin Walters 177d845f5b core: Modify pack file importer to also optionally checksum
For future work on importing from an archive.
2011-12-01 19:25:35 -05:00
Colin Walters 702c38739e core: Drop some dead code from packfile writing, expose GInputStream API too
We never actually dropped into the bits to write metadata as packfiles,
because such a thing doesn't exist.

Also add a GInputStream-based API for writing packfiles.
2011-11-30 22:15:05 -05:00
Colin Walters 556662b24c core: Extract stage_and_checksum() internal API
This will be used for staging both metadata and data consistently
before actually importing it.
2011-11-30 21:20:15 -05:00
Colin Walters 84562f161f core: Use ot_clear_checksum() 2011-11-29 14:06:54 -05:00
Colin Walters 2f1490f766 core: Fix a compiler warning 2011-11-27 20:15:07 -05:00
Colin Walters b0b0ffcd61 core: Add asynchronous checksum API, use it in checksum builtin 2011-11-27 17:21:04 -05:00
Colin Walters 3c025e526f core: Ad ot_clear_gvariant(), use it
This saves us a conditional.
2011-11-22 10:20:10 -05:00
Colin Walters b7a45b5815 core: Also chown() after unpacking objects 2011-11-18 18:50:29 -05:00
Colin Walters 7d63ad5ae8 core: Switch to GFile* for unpacking and storing objects 2011-11-18 16:14:01 -05:00
Colin Walters 231f7ed76c core: Use ot_gfile_ prefix for new local GFile creation function 2011-11-18 08:10:23 -05:00
Colin Walters 7f64d5cec7 core: Make checksum API also operate on directories 2011-11-18 06:34:54 -05:00
Colin Walters b8cef545d1 core: CHANGE CHECKSUM ALGORITHM, port checksum API to GFile
This commit originally was to port ostree_stat_and_checksum_file() to
GFile*, but I noticed that the checksum code was reading data in host
endianness.  Fix that while we're here.

This invalidates all existing repositories.
2011-11-17 19:32:01 -05:00
Colin Walters 2c2b9c0e00 core: Convert metadata parsing API to GFile 2011-11-17 18:36:57 -05:00
Colin Walters 218684786d core: Use GFile for xattr API 2011-11-17 18:33:26 -05:00
Colin Walters a8735778f0 core: Use ot_gfile_get_path_cached() pervasively
This requires no free() calls and is just better.
2011-11-17 18:23:36 -05:00
Colin Walters c33db03b4c core: Flesh out diff a bit more
Now correctly notices changes to directory metadata (not just
contents).
2011-11-16 22:51:09 -05:00
Colin Walters d196a47043 core: We actually want rdev, not dev for devices 2011-11-15 15:15:46 -05:00
Colin Walters 18f0b537a4 build: Move sources into src/ again
This is necessary if we want to build when srcdir == builddir,
otherwise we blow up because "ostree" is a source directory and a
binary.
2011-11-14 15:39:38 -05:00
Colin Walters 21c7ff74b6 De-recursify source tree 2011-11-02 15:45:32 -04:00
Colin Walters bab31db7ee core: Squash some memory leaks 2011-11-01 12:20:33 -04:00
Colin Walters a897642315 For archive checkouts, actually unpack the packfiles 2011-11-01 10:59:07 -04:00
Colin Walters 8769f4afd8 Switch to big-endian storage for all variant data
This ensures the saved archives are architecture-independent.
2011-10-31 22:41:50 -04:00
Colin Walters a160a2a5fa Add support for pulling from remote archives
This necessitated a large set of changes.

We now support an "archive" mode for repositories.  In this mode,
files are stored "packed" rather than hard linked.  This allows one to
e.g. store an OSTree repository with root-owned files as non-root.  It
is also used as the basis for serving repositories via HTTP.

While doing this I realized that GVariant is endianness-dependent; I
decided to just store all data in big endian.
2011-10-31 20:28:47 -04:00
Colin Walters d0b3a07cf1 core: Fix checksum for symlinks walking off into uninitialized memory 2011-10-26 18:33:33 -04:00
Colin Walters a2880a6ddd src: Squash some unused variables 2011-10-20 16:30:34 -04:00
Colin Walters b7d45436a0 Don't use g_variant_new_from_fixed_array(), it was only added in 2.31
g_variant_new_from_data() works, and actually allows us to avoid
a memdup()/free().
2011-10-20 10:20:51 -04:00
Colin Walters aa25334286 repo: Only open regular files
Otherwise we'll try to open device files with predictably bad
consequences.
2011-10-19 18:06:06 -04:00
Colin Walters b27df6fd72 "Hacktree" is now known as "OSTree"
It just sounds better.
2011-10-18 14:44:48 -04:00