Merge pull request #1848 from iquiw/netbsd-support

Support NetBSD without fuse
This commit is contained in:
Alexander Neumann 2018-06-16 17:12:20 +02:00
commit 1824168aa3
18 changed files with 45 additions and 5 deletions

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -66,7 +66,7 @@ func isSymlink(fi os.FileInfo) bool {
func sameModTime(fi1, fi2 os.FileInfo) bool { func sameModTime(fi1, fi2 os.FileInfo) bool {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "freebsd", "openbsd": case "darwin", "freebsd", "openbsd", "netbsd":
if isSymlink(fi1) && isSymlink(fi2) { if isSymlink(fi1) && isSymlink(fi2) {
return true return true
} }

View File

@ -1,4 +1,4 @@
// +build freebsd darwin // +build freebsd darwin netbsd
package fs package fs

View File

@ -1,4 +1,4 @@
// +build !windows,!darwin,!freebsd // +build !windows,!darwin,!freebsd,!netbsd
package fs package fs

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -0,0 +1,27 @@
package restic
import "syscall"
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
return nil
}
func (s statUnix) atim() syscall.Timespec { return s.Atimespec }
func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec }
func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec }
// Getxattr retrieves extended attribute data associated with path.
func Getxattr(path, name string) ([]byte, error) {
return nil, nil
}
// Listxattr retrieves a list of names of extended attributes associated with the
// given path in the file system.
func Listxattr(path string) ([]string, error) {
return nil, nil
}
// Setxattr associates name and data together as an attribute of path.
func Setxattr(path, name string, data []byte) error {
return nil
}

View File

@ -210,7 +210,7 @@ func TestNodeRestoreAt(t *testing.T) {
"%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID) "%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID)
if test.Type != "symlink" { if test.Type != "symlink" {
// On OpenBSD only root can set sticky bit (see sticky(8)). // On OpenBSD only root can set sticky bit (see sticky(8)).
if runtime.GOOS != "openbsd" && test.Name == "testSticky" { if runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && test.Name == "testSticky" {
rtest.Assert(t, test.Mode == n2.Mode, rtest.Assert(t, test.Mode == n2.Mode,
"%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode) "%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode)
} }
@ -228,7 +228,7 @@ func AssertFsTimeEqual(t *testing.T, label string, nodeType string, t1 time.Time
// Go currently doesn't support setting timestamps of symbolic links on darwin and bsd // Go currently doesn't support setting timestamps of symbolic links on darwin and bsd
if nodeType == "symlink" { if nodeType == "symlink" {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "freebsd", "openbsd": case "darwin", "freebsd", "openbsd", "netbsd":
return return
} }
} }

View File

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View File

@ -134,6 +134,7 @@ func (env *TravisEnvironment) Prepare() error {
"darwin/386", "darwin/amd64", "darwin/386", "darwin/amd64",
"freebsd/386", "freebsd/amd64", "freebsd/386", "freebsd/amd64",
"openbsd/386", "openbsd/amd64", "openbsd/386", "openbsd/amd64",
"netbsd/386", "netbsd/amd64",
"linux/arm", "freebsd/arm", "linux/arm", "freebsd/arm",
} }