1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-27 18:45:39 +00:00
Commit graph

13 commits

Author SHA1 Message Date
Matthew Garrett
cb1fb5dded test: Allow using an environment variable to override the test dir
Some build systems may not permit writing to . during build, so allow
that path to be overridden with an environment variable.
2017-04-13 11:35:01 -07:00
Aleksa Sarai
e22043cb86
walk: implement FsEval hooks
In certain circumstances (such as the manifest generation of a
filesystem as an unprivileged user) it is important to provide hooks
that override the default os.* implementation of filesystem-related
functions.

In order to avoid merging too much code from outside projects (such as
umoci) this is implemented by providing FsEval hooks to Walk() and
Check(). This allows for users of go-mtree to modify how filesystem
checks are done, without compromising the simplicity of go-mtree's code.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-14 16:26:31 +11:00
c0a5cb25ec
-d: exclude non-directories
Adding flag, and supporting functionality for exluding entries that are
non-directories

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 22:43:02 -05:00
4eec68be4b
*: make Keyword and KeyVal pervasive
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 21:38:01 -05:00
Aleksa Sarai
d214ab47e8
check: re-implement *Check() using Compare()
This removes all of the special handling code for both TarCheck() and
Check() so that everything now uses the new (generic) Compare() code. In
addition, the tests had to be modified to reflect the new classes of
errors.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-10 11:30:06 +11:00
Aleksa Sarai
c4be8dfe32
compare: implement proper testing with tar
While the full testing is broken due to bugs in the tar DH generator, we
ignore known bugs in the tar generator to at least allow us to test some
of the other semantics of Compare.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-10 11:30:06 +11:00
Stephen Chung
0e2cf67ac3 tar_test: don't check for extra/missing when validating relative to "."
right now, Check() doesn't check for missing/extra files. So, for the
sake of this test, we don't want to do this check for extra/missing files
when we validate the validation manifest produced from a tar against
the "." root directory (which would be /testdata).

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-11 22:23:26 -04:00
Stephen Chung
5837d00b07 tar: resolve hardlinks when streaming archive
Fill in the data of the Entry with the data of the
file that a hardlink actually represents.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-11 13:24:44 -04:00
Stephen Chung
3d6b74d6f7 tar: populate Entry tree under a common root
Resolves #56. Now, the Entry tree will be populated
under a common root (if necessary), so that a manifest can
be accurately generate from a tar file that has been
created using multiple directories.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-09 12:09:36 -04:00
Stephen Chung
773763fb87 vis: refactored code to reflect using vis/unvis for file names
Added some more test cases for `vis`ing and `unvis`ing
strings, and a test case that walks/checks a directory with
filenames that require encoding. Had to change Path() to account
for possible errors Unvis() could return. Refactored Vis()/Unvis() into
go-mtree tar functionality as well.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-25 16:41:06 -04:00
Stephen Chung
656e577ecc *: have gomtree always evaluate tar_time if it is present
if the keyword "tar_time" is present when evaluating
an Entry, gomtree should use the tar_time when evaluating
the "time" keyword as well. This commit also adds a test that
makes sure "tar_time" wins against "time" if both are present.
Some minor clean-ups as well, such as checking if KeywordFunc[keyword]
actually retrieves a function.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04:00
Stephen Chung
decc72b335 tar: create and validate a manifest from a tar stream
This commit contains added features to go-mtree that allows
user to create an mtree spec with '-T' option when specifying
a tar archive. Users can also validate an mtree spec against
a tar archive with an mtree spec. Also for the test archive,
there is a mixture of files, and folders (empty & non-empty),
and symlinks (broken & unbroken).

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04:00
faa80931af *: refactoring to support streams
when creating a manifest from, or validating, a stream like a tar
archive, it requires thinking about some of the functions differently
than walking a directory tree.

This is the beginning of allowing for such features.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-23 12:07:43 -04:00