mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-12-22 13:56:30 +00:00
Merge pull request #79 from vbatts/bsd_flags
keywords: don't fail on presence of "flags"
This commit is contained in:
commit
3732fa351f
3 changed files with 23 additions and 1 deletions
|
@ -165,7 +165,7 @@ var (
|
|||
BsdKeywords = []string{
|
||||
"cksum",
|
||||
"device",
|
||||
"flags",
|
||||
"flags", // this one is really mostly BSD specific ...
|
||||
"ignore",
|
||||
"gid",
|
||||
"gname",
|
||||
|
@ -226,6 +226,8 @@ var (
|
|||
"sha512": hasherKeywordFunc("sha512digest", sha512.New), // The SHA512 message digest of the file
|
||||
"sha512digest": hasherKeywordFunc("sha512digest", sha512.New), // A synonym for `sha512`
|
||||
|
||||
"flags": flagsKeywordFunc, // NOTE: this is a noop, but here to support the presence of the "flags" keyword.
|
||||
|
||||
// This is not an upstreamed keyword, but used to vary from "time", as tar
|
||||
// archives do not store nanosecond precision. So comparing on "time" will
|
||||
// be only seconds level accurate.
|
||||
|
|
15
keywords_bsd.go
Normal file
15
keywords_bsd.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
// +build darwin freebsd netbsd openbsd
|
||||
|
||||
package mtree
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||
// ideally this will pull in from here https://www.freebsd.org/cgi/man.cgi?query=chflags&sektion=2
|
||||
return "", nil
|
||||
}
|
||||
)
|
|
@ -14,6 +14,11 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// this is bsd specific https://www.freebsd.org/cgi/man.cgi?query=chflags&sektion=2
|
||||
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||
if hdr, ok := info.Sys().(*tar.Header); ok {
|
||||
return fmt.Sprintf("uname=%s", hdr.Uname), nil
|
||||
|
|
Loading…
Reference in a new issue