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

348 commits

Author SHA1 Message Date
94a6c46bde
vendor: convert from glide to dep
```shell
go get -u -v github.com/golang/dep
dep init
```

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2019-01-21 11:01:52 -05:00
134ba041d7
Merge pull request #152 from tych0/compare-same
compare: add CompareSame()
2019-01-17 13:42:23 -05:00
Tycho Andersen
d8d43cd807 compare: add CompareSame()
I have a use case where I'd like to know the files that are the same in the
tree, as well as the differences.

I could do this with a separate walk and excluding the paths that were
different, but since mtree is already doing all of this for me, it makes
sense to include it here. I've added a new function so that the behavior
stays the same for existing users of Compare(), since I assume mostly this
will be slower given that most files stay the same. I'd be happy to merge
it into one, though.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2019-01-14 14:12:08 -07:00
53e54ea2f7
Merge pull request #151 from vbatts/clean.00
check: remove unused TarCheck(), for Compare()
2018-12-10 11:36:56 -05:00
40f4ce8108
check: remove unused TarCheck(), for Compare()
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-12-10 11:26:12 -05:00
abf4d54fb2 readme: travis build status
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-11-15 15:08:59 -05:00
367008df78
Merge pull request #149 from cyphar/casync-mtree-compare
entry: rework e.Path() handling for casync-mtree
2018-11-15 15:04:02 -05:00
4ae4c48dc0
Merge pull request #150 from vbatts/golint
travis, golint, and versions of golang!
2018-11-08 11:56:25 -05:00
acd3fa49ea
travis, golint, and versions of golang!
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-11-08 11:50:04 -05:00
Aleksa Sarai
4766cebac0
entry: rework e.Path() handling for casync-mtree
The core issue comes about when you consider a trivial example of a path
like "./README". This path is lexically equivalent within mtree to
"README", but a simple string comparison will yield the wrong result.
Instead you need to lexically clean the path first (filepath.Clean isn't
enough here -- you need to prepend a "/" and then do filepath.Clean).

In gomtree we generate spec files in the same style of FreeBSD's
mtree(8), so you would be very hard-pressed to find an example of such
an inconsistency. However casync's mtree implementation does not
generate leading "./" for root paths which results in "missing" entries.

The implementation of CleanPath was written by me for umoci originally,
then later I copied it to runc for other uses, and now I've copied it
here. Since I'm the sole author I'm effectively dual-licensing it under
this project's license to avoid having to relicense go-mtree for no good
reason (or deal with the multiple-license hassle).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-09-15 00:18:31 +10:00
37d776ac40
cli.test: colorize the success/failure
updating and adding vendored source to do it

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-08-20 07:57:14 -04:00
03270d3d9e *.go: clean up variable names 2018-08-19 18:25:48 -04:00
2f374a383e Make: install tools target 2018-08-13 23:03:28 -04:00
f34a2e0d2b test/cli: and a newline 2018-08-13 21:56:19 -04:00
dce9629991 test/cli: add a success message 2018-08-13 21:54:55 -04:00
68a6d43233 test/cli: fixup for supporting OSX 2018-08-13 21:20:31 -04:00
1bcf4de08f
Merge pull request #148 from cyphar/compare-improvements
compare: allow nil newDh and oldDh
2018-05-31 12:30:39 -07:00
Aleksa Sarai
be3abf053a
compare: allow nil newDh and oldDh
This allows people to create synthetic InodeDeltas, which is something
that umoci would like to be able to do in order to nicely create 'umoci
insert' layers.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-05-16 20:06:43 +10:00
Aleksa Sarai
ffb4a05860
travis: update Go version
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-05-16 20:06:42 +10:00
16da0f86ee
Merge pull request #147 from vbatts/casync
casync: adding a casync style mtree
2017-12-13 14:26:12 -05:00
144242ef1e
casync: adding a casync style mtree
This parses fine, but does not validate currently

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-12-13 14:20:29 -05:00
005af4d18f
Merge pull request #144 from wking/lowercase-sirupsen
vendor: Replace Sirupsen/logrus with sirupsen/logrus
2017-11-03 15:49:21 -04:00
W. Trevor King
72ac04e7ca vendor: Replace Sirupsen/logrus with sirupsen/logrus
With:

  $ git mv vendor/github.com/{S,s}irupsen
  $ sed -i 's/Sirupsen/sirupsen/g' $(git grep -l Sirupsen)

catching up with the upstream lowercasing [1,2,3,4].  Because of the
compatibility issues discussed in [3], some consumers may prefer to
use the old uppercase version until they have time to update their
other Logrus consumers to the new lowercase form.

[1]: https://github.com/sirupsen/logrus/blame/v1.0.3/README.md#L6
[2]: https://github.com/sirupsen/logrus/pull/384
[3]: https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276
[4]: https://github.com/sirupsen/logrus/issues/553
2017-11-03 12:19:19 -07:00
03983e2cdc
version: master back to -dev
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-10-28 22:30:23 -04:00
de69569d25
version: release 0.4.2
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-10-28 22:29:59 -04:00
2352d84626
Merge pull request #143 from vbatts/sha512256
keyword: include sha-2 512/256
2017-10-28 22:28:22 -04:00
3a0105dc85
keyword: include sha-2 512/256
Reference: https://github.com/systemd/casync/issues/101#issuecomment-340019721

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-10-28 22:16:03 -04:00
a30ab86d71 Merge pull request #142 from tklauser/utimes-unix
Use UtimesNanoAt from golang.org/x/sys/unix
2017-10-23 10:08:33 -04:00
Tobias Klauser
3fe21921b5 *: use UtimesNanoAt from x/sys/unix
Use UtimesNanoAt from golang.org/x/sys/unix instead of manually crafting
the syscall.

Since UtimesNanoAt is provided for all unix-like OSes, factor out
lchtimes to its own file with appropriate build tags. This allows to
make use of it on darwin, dragonfly, freebsd, openbsd, netbsd and
solaris in addition to linux.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-10-20 12:31:55 +02:00
Tobias Klauser
7742183cd4 vendor: explicitly vendor golang.org/x/sys
Vendor golang.org/x/sys to get the UtimesNanoAt function defined for all
unix-like OSes. The function will be used in a successive commit.

This also re-vendors the other dependencies from glide.yaml.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-10-20 11:38:03 +02:00
8bcd48e401
bump master back to dev
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-29 11:43:50 -04:00
020cebaa52
release: v0.4.1
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-29 11:43:18 -04:00
7023b74563
vscode: adding IDE tasks
making it easier to have consistent build and test across machines with
vscode editor

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-29 11:38:12 -04:00
6fec2c6177 Merge pull request #141 from cyphar/xattr-correct-prefix-handling
compare: correctly use .Prefix() during comparisons
2017-09-29 11:33:45 -04:00
Aleksa Sarai
8e5c54f51d
compare: correctly use .Prefix() during comparisons
During the rework of how xattr fields are handled, the comparison code
was not correctly updated. As a result, changes to xattrs would not be
detected in any form. This was detected in the umoci integration suite.
In addition, fix the dh.UsedKeywords logic so auto-detection works
correctly with prefix-based xattrs.

Fixes: ed464af779 ("*: xattr can Update()")
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-09-29 21:05:45 +10:00
ba49f2f918
version: master back to -dev
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-30 15:44:18 -04:00
85fac2fc14
version: bump to v0.4.0
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-30 15:43:46 -04:00
2ede6ecf20 Merge pull request #138 from vbatts/match_update_behavior
*: update `-u` behavior
2017-06-30 15:42:06 -04:00
f271d65127
cli.test: don't have -k in the print
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-30 15:34:53 -04:00
73be830998
*: update -u behavior
Fixes #16

In attempt to close https://github.com/vbatts/go-mtree/issues/16 I've
uncovered that the update was missing a function for symlink.
Additionally the update was not even opperating on the correct directory
hierarchy.

I've uncovered that os.Chtimes follows the symlink, and presumably only
Linux has an obscure way to set the mtime/atime on a symlink itself. So
I've made a custom lchtimes().

Also Mode follows through the symlink, and symlinks only ever have a
mode of 0777, so don't set them.

Lastly, directories need to have their mtime/atime set in a reverse
order after all other updates have been done. This is going to require
something like a `container/heap` to be unwound.

Also, each updateFunc will _only_ perform the update if it is needed. Much less
invasive this way.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-30 15:34:44 -04:00
a393e171c4 Merge pull request #139 from vbatts/lint
govis: comment for lint
2017-06-30 15:18:49 -04:00
04230dccdc
govis: comment for lint
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-30 15:06:50 -04:00
593cfb68b8 Merge pull request #136 from vbatts/updatefunc_sig
updatefunc: simplify the function signature
2017-06-26 14:45:45 -04:00
9408f0f4c0
updatefunc: simplify the function signature
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-26 14:24:10 -04:00
0b5038d0bc Merge pull request #135 from vbatts/xattr-updates
*: xattr can Update()
2017-06-26 14:14:00 -04:00
ed464af779
*: xattr can Update()
This is a gnarly patchset that has been mashed together.
It uncovered that some aspects of Check were never really working
correctly for `xattr` keywords, but also the `Update()` had been left
undone for a while.

This includes some API changes around the `Keyword` and `KeyVal` types.

Also I would like to update the signature for the `UpdateKeywordFunc` to
just accept a `KeyVal` as an argugment, rather than a keyword AND the
value. with this context there would be no need to guess on the value of
what's passed to the xattr update function of whether it needs or
already is base64 encoded.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 15:05:24 -04:00
fb4ec19981 Merge pull request #134 from vbatts/vendor
vendor: updating dependencies
2017-06-24 14:52:17 -04:00
50d22c5135 vendor: updating dependencies
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 14:45:05 -04:00
c5b7548e35 Merge pull request #133 from vbatts/keyval
keyval: cleaner struct functions
2017-06-24 07:09:27 -04:00
14721e6869 keyval: cleaner struct functions
KeyVal specific functions can be a part of the struct.
Also add tests and fix the NewValue functions for suffixes

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 07:01:29 -04:00