www/minio-client: stat patch no longer necessary

PR:	244582
Reported by:	dmitry.wagin@ya.ru
This commit is contained in:
John Hixson 2020-03-20 22:39:16 +00:00
parent 1736f5b072
commit a82adc010b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=528806
2 changed files with 1 additions and 68 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= minio-client
PORTVERSION= ${GH_TAGNAME:S/RELEASE.//:S/Z//:S/T/-/:S/-/./g}
PORTREVISION= 2
CATEGORIES= www
MAINTAINER= jhixson@FreeBSD.org

View File

@ -1,68 +0,0 @@
--- pkg/disk/stat_freebsd.go.orig 2020-02-24 22:16:58 UTC
+++ pkg/disk/stat_freebsd.go
@@ -0,0 +1,65 @@
+// +build freebsd
+
+/*
+ * MinIO Cloud Storage, (C) 2019-2020 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package disk
+
+import (
+ "os/user"
+ "strconv"
+ "strings"
+ "syscall"
+)
+
+// GetFileSystemAttrs return the file system attribute as string; containing mode,
+// uid, gid, uname, Gname, atime, mtime, ctime and md5
+func GetFileSystemAttrs(file string) (string, error) {
+ st := syscall.Stat_t{}
+ err := syscall.Stat(file, &st)
+ if err != nil {
+ return "", err
+ }
+
+ var fileAttr strings.Builder
+ fileAttr.WriteString("atime:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Atimespec.Sec)))
+ fileAttr.WriteString("/ctime:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Ctimespec.Sec)))
+ fileAttr.WriteString("/gid:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Gid)))
+
+ g, err := user.LookupGroupId(strconv.FormatUint(uint64(st.Gid), 10))
+ if err == nil {
+ fileAttr.WriteString("/gname:")
+ fileAttr.WriteString(g.Name)
+ }
+
+ fileAttr.WriteString("/mode:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Mode)))
+ fileAttr.WriteString("/mtime:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Mtimespec.Sec)))
+ fileAttr.WriteString("/uid:")
+ fileAttr.WriteString(strconv.Itoa(int(st.Uid)))
+
+ u, err := user.LookupId(strconv.FormatUint(uint64(st.Uid), 10))
+ if err == nil {
+ fileAttr.WriteString("/uname:")
+ fileAttr.WriteString(u.Username)
+ }
+
+ return fileAttr.String(), nil
+}