From 79fe1edc90f5894d5d77203827f45750f37fbe3e Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 30 Aug 2013 09:09:22 -0500 Subject: [PATCH 1/6] fix meta dependency on libc --- golang.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 90262e4..6381cf7 100644 --- a/golang.spec +++ b/golang.spec @@ -16,9 +16,16 @@ # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata %global __strip /bin/true +# rpmbuild magic to keep from having meta dependency on libc.so.6 +%define _use_internal_dependency_generator 0 +%define __find_requires %{nil} +%global debug_package %{nil} +%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ + /usr/lib/rpm/brp-compress + Name: golang Version: 1.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Go Programming Language License: BSD @@ -250,6 +257,9 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Aug 30 2013 Adam Miller - 1.1.2-2 +- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) + * Tue Aug 20 2013 Adam Miller - 1.1.2-1 - Update to latest upstream From a601655be19dda7a830d478ee4475a04a8dea111 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 20 Sep 2013 09:49:37 -0500 Subject: [PATCH 2/6] fix for BZ#1010271 --- golang-1.1.2-long-links.patch | 510 +++++++++++++++++++++++++++++++++ golang-1.1.2-ustar-split.patch | 62 ++++ golang.spec | 17 +- 3 files changed, 588 insertions(+), 1 deletion(-) create mode 100644 golang-1.1.2-long-links.patch create mode 100644 golang-1.1.2-ustar-split.patch diff --git a/golang-1.1.2-long-links.patch b/golang-1.1.2-long-links.patch new file mode 100644 index 0000000..85c3541 --- /dev/null +++ b/golang-1.1.2-long-links.patch @@ -0,0 +1,510 @@ +Index: src/pkg/archive/tar/common.go +=================================================================== +--- a/src/pkg/archive/tar/common.go ++++ b/src/pkg/archive/tar/common.go +@@ -13,6 +13,7 @@ + package tar + + import ( ++ "bytes" + "errors" + "fmt" + "os" +@@ -174,6 +175,23 @@ + c_ISSOCK = 0140000 // Socket + ) + ++// Keywords for the PAX Extended Header ++const ( ++ paxAtime = "atime" ++ paxCharset = "charset" ++ paxComment = "comment" ++ paxCtime = "ctime" // please note that ctime is not a valid pax header. ++ paxGid = "gid" ++ paxGname = "gname" ++ paxLinkpath = "linkpath" ++ paxMtime = "mtime" ++ paxPath = "path" ++ paxSize = "size" ++ paxUid = "uid" ++ paxUname = "uname" ++ paxNone = "" ++) ++ + // FileInfoHeader creates a partially-populated Header from fi. + // If fi describes a symlink, FileInfoHeader records link as the link target. + // If fi describes a directory, a slash is appended to the name. +@@ -257,3 +275,25 @@ + b, *sp = s[0:n], s[n:] + return + } ++ ++func isASCII(s string) bool { ++ for _, c := range s { ++ if c >= 0x80 { ++ return false ++ } ++ } ++ return true ++} ++ ++func toASCII(s string) string { ++ if isASCII(s) { ++ return s ++ } ++ var buf bytes.Buffer ++ for _, c := range s { ++ if c < 0x80 { ++ buf.WriteByte(byte(c)) ++ } ++ } ++ return buf.String() ++} +Index: src/pkg/archive/tar/reader.go +=================================================================== +--- a/src/pkg/archive/tar/reader.go ++++ b/src/pkg/archive/tar/reader.go +@@ -95,45 +95,45 @@ + func mergePAX(hdr *Header, headers map[string]string) error { + for k, v := range headers { + switch k { +- case "path": ++ case paxPath: + hdr.Name = v +- case "linkpath": ++ case paxLinkpath: + hdr.Linkname = v +- case "gname": ++ case paxGname: + hdr.Gname = v +- case "uname": ++ case paxUname: + hdr.Uname = v +- case "uid": ++ case paxUid: + uid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Uid = int(uid) +- case "gid": ++ case paxGid: + gid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Gid = int(gid) +- case "atime": ++ case paxAtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.AccessTime = t +- case "mtime": ++ case paxMtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ModTime = t +- case "ctime": ++ case paxCtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ChangeTime = t +- case "size": ++ case paxSize: + size, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -24,6 +24,7 @@ + ErrFieldTooLong = errors.New("archive/tar: header field too long") + ErrWriteAfterClose = errors.New("archive/tar: write after close") + errNameTooLong = errors.New("archive/tar: name too long") ++ errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values") + ) + + // A Writer provides sequential writing of a tar archive in POSIX.1 format. +@@ -37,6 +38,7 @@ + pad int64 // amount of padding to write after current file entry + closed bool + usedBinary bool // whether the binary numeric field extension was used ++ preferPax bool // use pax header instead of binary numeric header + } + + // NewWriter creates a new Writer writing to w. +@@ -65,16 +67,23 @@ + } + + // Write s into b, terminating it with a NUL if there is room. +-func (tw *Writer) cString(b []byte, s string) { ++// If the value is too long for the field and allowPax is true add a paxheader record instead ++func (tw *Writer) cString(b []byte, s string, allowPax bool, paxKeyword string, paxHeaders map[string]string) { ++ needsPaxHeader := allowPax && len(s) > len(b) || !isASCII(s) ++ if needsPaxHeader { ++ paxHeaders[paxKeyword] = s ++ return ++ } + if len(s) > len(b) { + if tw.err == nil { + tw.err = ErrFieldTooLong + } + return + } +- copy(b, s) +- if len(s) < len(b) { +- b[len(s)] = 0 ++ ascii := toASCII(s) ++ copy(b, ascii) ++ if len(ascii) < len(b) { ++ b[len(ascii)] = 0 + } + } + +@@ -85,17 +94,27 @@ + for len(s)+1 < len(b) { + s = "0" + s + } +- tw.cString(b, s) ++ tw.cString(b, s, false, paxNone, nil) + } + + // Write x into b, either as octal or as binary (GNUtar/star extension). +-func (tw *Writer) numeric(b []byte, x int64) { ++// If the value is too long for the field and writingPax is enabled both for the field and the add a paxheader record instead ++func (tw *Writer) numeric(b []byte, x int64, allowPax bool, paxKeyword string, paxHeaders map[string]string) { + // Try octal first. + s := strconv.FormatInt(x, 8) + if len(s) < len(b) { + tw.octal(b, x) + return + } ++ ++ // If it is too long for octal, and pax is preferred, use a pax header ++ if allowPax && tw.preferPax { ++ tw.octal(b, 0) ++ s := strconv.FormatInt(x, 10) ++ paxHeaders[paxKeyword] = s ++ return ++ } ++ + // Too big: use binary (big-endian). + tw.usedBinary = true + for i := len(b) - 1; x > 0 && i >= 0; i-- { +@@ -115,6 +134,15 @@ + // WriteHeader calls Flush if it is not the first header. + // Calling after a Close will return ErrWriteAfterClose. + func (tw *Writer) WriteHeader(hdr *Header) error { ++ return tw.writeHeader(hdr, true) ++} ++ ++// WriteHeader writes hdr and prepares to accept the file's contents. ++// WriteHeader calls Flush if it is not the first header. ++// Calling after a Close will return ErrWriteAfterClose. ++// As this method is called internally by writePax header to allow it to ++// suppress writing the pax header. ++func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { + if tw.closed { + return ErrWriteAfterClose + } +@@ -124,31 +152,21 @@ + if tw.err != nil { + return tw.err + } +- // Decide whether or not to use PAX extensions ++ ++ // a map to hold pax header records, if any are needed ++ paxHeaders := make(map[string]string) ++ + // TODO(shanemhansen): we might want to use PAX headers for + // subsecond time resolution, but for now let's just capture +- // the long name/long symlink use case. +- suffix := hdr.Name +- prefix := "" +- if len(hdr.Name) > fileNameSize || len(hdr.Linkname) > fileNameSize { +- var err error +- prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) +- // Either we were unable to pack the long name into ustar format +- // or the link name is too long; use PAX headers. +- if err == errNameTooLong || len(hdr.Linkname) > fileNameSize { +- if err := tw.writePAXHeader(hdr); err != nil { +- return err +- } +- } else if err != nil { +- return err +- } +- } +- tw.nb = int64(hdr.Size) +- tw.pad = -tw.nb & (blockSize - 1) // blockSize is a power of two ++ // too long fields or non ascii characters + + header := make([]byte, blockSize) + s := slicer(header) +- tw.cString(s.next(fileNameSize), suffix) ++ ++ // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ pathHeaderBytes := s.next(fileNameSize) ++ ++ tw.cString(pathHeaderBytes, hdr.Name, true, paxPath, paxHeaders) + + // Handle out of range ModTime carefully. + var modTime int64 +@@ -156,27 +174,55 @@ + modTime = hdr.ModTime.Unix() + } + +- tw.octal(s.next(8), hdr.Mode) // 100:108 +- tw.numeric(s.next(8), int64(hdr.Uid)) // 108:116 +- tw.numeric(s.next(8), int64(hdr.Gid)) // 116:124 +- tw.numeric(s.next(12), hdr.Size) // 124:136 +- tw.numeric(s.next(12), modTime) // 136:148 +- s.next(8) // chksum (148:156) +- s.next(1)[0] = hdr.Typeflag // 156:157 +- tw.cString(s.next(100), hdr.Linkname) // linkname (157:257) +- copy(s.next(8), []byte("ustar\x0000")) // 257:265 +- tw.cString(s.next(32), hdr.Uname) // 265:297 +- tw.cString(s.next(32), hdr.Gname) // 297:329 +- tw.numeric(s.next(8), hdr.Devmajor) // 329:337 +- tw.numeric(s.next(8), hdr.Devminor) // 337:345 +- tw.cString(s.next(155), prefix) // 345:500 ++ tw.octal(s.next(8), hdr.Mode) // 100:108 ++ tw.numeric(s.next(8), int64(hdr.Uid), true, paxUid, paxHeaders) // 108:116 ++ tw.numeric(s.next(8), int64(hdr.Gid), true, paxGid, paxHeaders) // 116:124 ++ tw.numeric(s.next(12), hdr.Size, true, paxSize, paxHeaders) // 124:136 ++ tw.numeric(s.next(12), modTime, false, paxNone, nil) // 136:148 --- consider using pax for finer granularity ++ s.next(8) // chksum (148:156) ++ s.next(1)[0] = hdr.Typeflag // 156:157 ++ ++ tw.cString(s.next(100), hdr.Linkname, true, paxLinkpath, paxHeaders) ++ ++ copy(s.next(8), []byte("ustar\x0000")) // 257:265 ++ tw.cString(s.next(32), hdr.Uname, true, paxUname, paxHeaders) // 265:297 ++ tw.cString(s.next(32), hdr.Gname, true, paxGname, paxHeaders) // 297:329 ++ tw.numeric(s.next(8), hdr.Devmajor, false, paxNone, nil) // 329:337 ++ tw.numeric(s.next(8), hdr.Devminor, false, paxNone, nil) // 337:345 ++ ++ // keep a reference to the prefix to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ prefixHeaderBytes := s.next(155) ++ tw.cString(prefixHeaderBytes, "", false, paxNone, nil) // 345:500 prefix ++ + // Use the GNU magic instead of POSIX magic if we used any GNU extensions. + if tw.usedBinary { + copy(header[257:265], []byte("ustar \x00")) + } +- // Use the ustar magic if we used ustar long names. +- if len(prefix) > 0 { +- copy(header[257:265], []byte("ustar\000")) ++ ++ _, paxPathUsed := paxHeaders[paxPath] ++ // try to use a ustar header when only the name is too long ++ if !tw.preferPax && len(paxHeaders) == 1 && paxPathUsed { ++ suffix := hdr.Name ++ prefix := "" ++ if len(hdr.Name) > fileNameSize && isASCII(hdr.Name) { ++ var err error ++ prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) ++ if err == nil { ++ // ok we can use a ustar long name instead of pax, now correct the fields ++ ++ // remove the path field from the pax header. this will suppress the pax header ++ delete(paxHeaders, paxPath) ++ ++ // update the path fields ++ tw.cString(pathHeaderBytes, suffix, false, paxNone, nil) ++ tw.cString(prefixHeaderBytes, prefix, false, paxNone, nil) ++ ++ // Use the ustar magic if we used ustar long names. ++ if len(prefix) > 0 { ++ copy(header[257:265], []byte("ustar\000")) ++ } ++ } ++ } + } + + // The chksum field is terminated by a NUL and a space. +@@ -190,8 +236,18 @@ + return tw.err + } + ++ if len(paxHeaders) > 0 { ++ if !allowPax { ++ return errInvalidHeader ++ } ++ if err := tw.writePAXHeader(hdr, paxHeaders); err != nil { ++ return err ++ } ++ } ++ tw.nb = int64(hdr.Size) ++ tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize ++ + _, tw.err = tw.w.Write(header) +- + return tw.err + } + +@@ -218,7 +274,7 @@ + + // writePaxHeader writes an extended pax header to the + // archive. +-func (tw *Writer) writePAXHeader(hdr *Header) error { ++func (tw *Writer) writePAXHeader(hdr *Header, paxHeaders map[string]string) error { + // Prepare extended header + ext := new(Header) + ext.Typeflag = TypeXHeader +@@ -229,18 +285,23 @@ + // with the current pid. + pid := os.Getpid() + dir, file := path.Split(hdr.Name) +- ext.Name = path.Join(dir, +- fmt.Sprintf("PaxHeaders.%d", pid), file)[0:100] ++ fullName := path.Join(dir, ++ fmt.Sprintf("PaxHeaders.%d", pid), file) ++ ++ ascii := toASCII(fullName) ++ if len(ascii) > 100 { ++ ascii = ascii[:100] ++ } ++ ext.Name = ascii + // Construct the body + var buf bytes.Buffer +- if len(hdr.Name) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("path="+hdr.Name)) ++ ++ for k, v := range paxHeaders { ++ fmt.Fprint(&buf, paxHeader(k+"="+v)) + } +- if len(hdr.Linkname) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("linkpath="+hdr.Linkname)) +- } ++ + ext.Size = int64(len(buf.Bytes())) +- if err := tw.WriteHeader(ext); err != nil { ++ if err := tw.writeHeader(ext, false); err != nil { + return err + } + if _, err := tw.Write(buf.Bytes()); err != nil { +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -243,15 +243,110 @@ + } + } + ++func TestPaxSymlink(t *testing.T) { ++ // Create an archive with a large linkname ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeSymlink ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long linkname to be written ++ longLinkname := strings.Repeat("1234567890/1234567890", 10) ++ hdr.Linkname = longLinkname ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Linkname != longLinkname { ++ t.Fatal("Couldn't recover long link name") ++ } ++} ++ ++func TestPaxNonAscii(t *testing.T) { ++ // Create an archive with non ascii. These should trigger a pax header ++ // because pax headers have a defined utf-8 encoding. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ hdr, err := FileInfoHeader(fileinfo, "") ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ ++ // some sample data ++ chineseFilename := "文件名" ++ chineseGroupname := "組" ++ chineseUsername := "用戶名" ++ ++ hdr.Name = chineseFilename ++ hdr.Gname = chineseGroupname ++ hdr.Uname = chineseUsername ++ ++ contents := strings.Repeat(" ", int(hdr.Size)) ++ ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if _, err = writer.Write([]byte(contents)); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != chineseFilename { ++ t.Fatal("Couldn't recover unicode name") ++ } ++ if hdr.Gname != chineseGroupname { ++ t.Fatal("Couldn't recover unicode group") ++ } ++ if hdr.Uname != chineseUsername { ++ t.Fatal("Couldn't recover unicode user") ++ } ++} ++ + func TestPAXHeader(t *testing.T) { + medName := strings.Repeat("CD", 50) + longName := strings.Repeat("AB", 100) + paxTests := [][2]string{ +- {"name=/etc/hosts", "19 name=/etc/hosts\n"}, ++ {paxPath + "=/etc/hosts", "19 path=/etc/hosts\n"}, + {"a=b", "6 a=b\n"}, // Single digit length + {"a=names", "11 a=names\n"}, // Test case involving carries +- {"name=" + longName, fmt.Sprintf("210 name=%s\n", longName)}, +- {"name=" + medName, fmt.Sprintf("110 name=%s\n", medName)}} ++ {paxPath + "=" + longName, fmt.Sprintf("210 path=%s\n", longName)}, ++ {paxPath + "=" + medName, fmt.Sprintf("110 path=%s\n", medName)}} + + for _, test := range paxTests { + key, expected := test[0], test[1] diff --git a/golang-1.1.2-ustar-split.patch b/golang-1.1.2-ustar-split.patch new file mode 100644 index 0000000..9e97b38 --- /dev/null +++ b/golang-1.1.2-ustar-split.patch @@ -0,0 +1,62 @@ +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -263,8 +263,11 @@ + length-- + } + i := strings.LastIndex(name[:length], "/") +- nlen := length - i - 1 +- if i <= 0 || nlen > fileNameSize || nlen == 0 { ++ // nlen contains the resulting length in the name field. ++ // plen contains the resulting length in the prefix field. ++ nlen := len(name) - i - 1 ++ plen := i ++ if i <= 0 || nlen > fileNameSize || nlen == 0 || plen > fileNamePrefixSize { + err = errNameTooLong + return + } +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -355,3 +355,39 @@ + } + } + } ++ ++func TestUSTARLongName(t *testing.T) { ++ // Create an archive with a path that failed to split with USTAR extension in previous versions. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeDir ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long name to be written. The name was taken from a practical example ++ // that fails and replaced ever char through numbers to anonymize the sample. ++ longName := "/0000_0000000/00000-000000000/0000_0000000/00000-0000000000000/0000_0000000/00000-0000000-00000000/0000_0000000/00000000/0000_0000000/000/0000_0000000/00000000v00/0000_0000000/000000/0000_0000000/0000000/0000_0000000/00000y-00/0000/0000/00000000/0x000000/" ++ hdr.Name = longName ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != longName { ++ t.Fatal("Couldn't recover long name") ++ } ++} diff --git a/golang.spec b/golang.spec index 6381cf7..cde5a95 100644 --- a/golang.spec +++ b/golang.spec @@ -25,7 +25,7 @@ Name: golang Version: 1.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Go Programming Language License: BSD @@ -35,8 +35,16 @@ Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz BuildRequires: /bin/hostname BuildRequires: emacs xemacs xemacs-packages-extra +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc + Patch0: golang-1.1-verbose-build.patch +Patch10: golang-1.1.2-long-links.patch +Patch11: golang-1.1.2-ustar-split.patch + + # Having godoc and the documentation separate was broken Obsoletes: %{name}-godoc < 1.1-4 Obsoletes: %{name}-docs < 1.1-4 @@ -109,6 +117,9 @@ end # increase verbosity of build %patch0 -p1 +# Fix BZ#1010271 +%patch10 -p1 +%patch11 -p1 %build # create a gcc wrapper to allow us to build with our own flags @@ -257,6 +268,10 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Sep 20 2013 Adam Miller - 1.1.2-3 +- Pull upstream patches for BZ#1010271 +- Add glibc requirement that got dropped because of meta dep fix + * Fri Aug 30 2013 Adam Miller - 1.1.2-2 - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) From 96d7496e0543c6de0c1a1ef8cb9ee1dbb818f6a3 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 8 Jul 2014 11:36:44 -0400 Subject: [PATCH 3/6] cleaning up multiarch builds bz1105901, bz1101508 --- golang.spec | 175 +++++++++++++--------------------------------------- 1 file changed, 42 insertions(+), 133 deletions(-) diff --git a/golang.spec b/golang.spec index 4c3a7b2..f74d7fd 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: The Go Programming Language License: BSD @@ -221,7 +221,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler toolchain to compile for linux 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-386 %{summary} @@ -229,7 +229,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-amd64 %{summary} @@ -237,7 +237,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-arm %{summary} @@ -245,7 +245,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-386 %{summary} @@ -253,7 +253,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-amd64 %{summary} @@ -261,7 +261,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-386 %{summary} @@ -269,7 +269,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-amd64 %{summary} @@ -277,7 +277,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-386 %{summary} @@ -285,7 +285,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-amd64 %{summary} @@ -293,7 +293,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-386 %{summary} @@ -301,7 +301,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-amd64 %{summary} @@ -309,7 +309,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-arm %{summary} @@ -317,7 +317,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-386 %{summary} @@ -325,7 +325,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-amd64 %{summary} @@ -333,7 +333,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-arm %{summary} @@ -341,7 +341,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-386 %{summary} @@ -349,7 +349,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-amd64 %{summary} @@ -359,7 +359,6 @@ Requires(post): golang-bin #Summary: Golang compiler toolchain to compile for openbsd arm #Requires: go = %{version}-%{release} #BuildArch: noarch -#Requires(post): golang-bin #%description pkg-openbsd-arm #%{summary} @@ -436,7 +435,7 @@ pushd src PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ GOOS=${goos} \ GOARCH=${goarch} \ - ./make.bash + ./make.bash --no-clean done done popd @@ -472,7 +471,7 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} # install everything into libdir (until symlink problems are fixed) # https://code.google.com/p/go/issues/detail?id=5830 -cp -av api bin doc favicon.ico include lib pkg robots.txt src \ +cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} # remove the unnecessary zoneinfo file (Go will always use the system one first) @@ -598,61 +597,11 @@ if [ $1 = 0 ]; then fi %endif -# All these archives need to be newer than the corresponding source in goroot -# https://bugzilla.redhat.com/show_bug.cgi?id=1099206 -%post pkg-linux-386 -GOROOT=%{goroot} GOOS=linux GOARCH=386 go install std - -%post pkg-linux-amd64 -GOROOT=%{goroot} GOOS=linux GOARCH=amd64 go install std - -%post pkg-linux-arm -GOROOT=%{goroot} GOOS=linux GOARCH=arm go install std - -%post pkg-darwin-386 -GOROOT=%{goroot} GOOS=darwin GOARCH=386 go install std - -%post pkg-darwin-amd64 -GOROOT=%{goroot} GOOS=darwin GOARCH=amd64 go install std - -%post pkg-windows-386 -GOROOT=%{goroot} GOOS=windows GOARCH=386 go install std - -%post pkg-windows-amd64 -GOROOT=%{goroot} GOOS=windows GOARCH=amd64 go install std - -%post pkg-plan9-386 -GOROOT=%{goroot} GOOS=plan9 GOARCH=386 go install std - -%post pkg-plan9-amd64 -GOROOT=%{goroot} GOOS=plan9 GOARCH=amd64 go install std - -%post pkg-freebsd-386 -GOROOT=%{goroot} GOOS=freebsd GOARCH=386 go install std - -%post pkg-freebsd-amd64 -GOROOT=%{goroot} GOOS=freebsd GOARCH=amd64 go install std - -%post pkg-freebsd-arm -GOROOT=%{goroot} GOOS=freebsd GOARCH=arm go install std - -%post pkg-netbsd-386 -GOROOT=%{goroot} GOOS=netbsd GOARCH=386 go install std - -%post pkg-netbsd-amd64 -GOROOT=%{goroot} GOOS=netbsd GOARCH=amd64 go install std - -%post pkg-netbsd-arm -GOROOT=%{goroot} GOOS=netbsd GOARCH=arm go install std - -%post pkg-openbsd-386 -GOROOT=%{goroot} GOOS=openbsd GOARCH=386 go install std - -%post pkg-openbsd-amd64 -GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +# VERSION has to be present in the GOROOT, for `go install std` to work +%doc %{goroot}/VERSION # go files %dir %{goroot} @@ -708,65 +657,6 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files src %{goroot}/src/ -# files that are generated based on compile-time ARCH will go in that arch's pkg-bin-* -%ifarch %{ix86} - -# this is wacky that now these files are generated in a different arch -%exclude %{goroot}/src/cmd/8l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_386.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_386.h -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_386.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_386.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_386.c -%endif - -%ifarch x86_64 -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_amd64.h -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsema_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_amd64.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_amd64.c -%endif - -%ifarch %{arm} -%exclude %{goroot}/src/cmd/5l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_arm.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_arm.h -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_arm.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_arm.c -%endif - %ifarch %{ix86} %files pkg-bin-linux-386 @@ -778,6 +668,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_386/* %{goroot}/pkg/linux_386/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_386 +%{goroot}/pkg/tool/linux_386/5a +%{goroot}/pkg/tool/linux_386/5c +%{goroot}/pkg/tool/linux_386/5g +%{goroot}/pkg/tool/linux_386/5l %{goroot}/pkg/tool/linux_386/6a %{goroot}/pkg/tool/linux_386/6c %{goroot}/pkg/tool/linux_386/6g @@ -819,10 +713,18 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_amd64/* %{goroot}/pkg/linux_amd64/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_amd64 +%{goroot}/pkg/tool/linux_amd64/5a +%{goroot}/pkg/tool/linux_amd64/5c +%{goroot}/pkg/tool/linux_amd64/5g +%{goroot}/pkg/tool/linux_amd64/5l %{goroot}/pkg/tool/linux_amd64/6a %{goroot}/pkg/tool/linux_amd64/6c %{goroot}/pkg/tool/linux_amd64/6g %{goroot}/pkg/tool/linux_amd64/6l +%{goroot}/pkg/tool/linux_amd64/8a +%{goroot}/pkg/tool/linux_amd64/8c +%{goroot}/pkg/tool/linux_amd64/8g +%{goroot}/pkg/tool/linux_amd64/8l %{goroot}/pkg/tool/linux_amd64/addr2line %{goroot}/pkg/tool/linux_amd64/dist %{goroot}/pkg/tool/linux_amd64/nm @@ -864,6 +766,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/tool/linux_arm/6c %{goroot}/pkg/tool/linux_arm/6g %{goroot}/pkg/tool/linux_arm/6l +%{goroot}/pkg/tool/linux_arm/8a +%{goroot}/pkg/tool/linux_arm/8c +%{goroot}/pkg/tool/linux_arm/8g +%{goroot}/pkg/tool/linux_arm/8l %{goroot}/pkg/tool/linux_arm/addr2line %{goroot}/pkg/tool/linux_arm/dist %{goroot}/pkg/tool/linux_arm/nm @@ -978,6 +884,9 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %changelog +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 + * Wed May 21 2014 Vincent Batts 1.2.2-7 - bz1099206 ghost files are not what is needed From e3554eaea80a6e928043be91e9af906a3f642c05 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 15 Jul 2014 12:30:16 -0400 Subject: [PATCH 4/6] fix gdb init for safe-paths bz981356 Conflicts: golang.spec --- golang-gdbinit | 1 - golang.spec | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/golang-gdbinit b/golang-gdbinit index 0a32958..4ef690b 100644 --- a/golang-gdbinit +++ b/golang-gdbinit @@ -1,2 +1 @@ add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py -add-auto-load-safe-path /usr/lib64/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang.spec b/golang.spec index f74d7fd..40520ae 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: The Go Programming Language License: BSD @@ -544,7 +544,7 @@ cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions # gdbinit mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d -cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang +cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb # prelink blacklist mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d @@ -884,7 +884,10 @@ fi %changelog -* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +* Tue Jul 15 2014 Vincent Batts - 1.2.2-9 +- fix the loading of gdb safe-path. bz981356 + +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 - `go install std` requires gcc, to build cgo. bz1105901, bz1101508 * Wed May 21 2014 Vincent Batts 1.2.2-7 @@ -934,7 +937,7 @@ fi * Tue Mar 04 2014 Adam Miller 1.2.1-1 - Update to latest upstream -* Thu Feb 20 2014 Adam Miller 1.2-7 +* Thu Feb 20 2014 Adam Miller 1.2-7 - Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent versions of glibc and aren't needed From 9abed9ed8411d1c50e7277300027e0e2585f3018 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 6 Aug 2014 21:23:25 +0000 Subject: [PATCH 5/6] making the golang-src package arch'ed. Fixes bz1099206 Conflicts: golang.spec --- golang.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index 40520ae..c2159c4 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: The Go Programming Language License: BSD @@ -161,8 +161,6 @@ BuildArch: noarch %package src Summary: Golang compiler source tree Requires: go = %{version}-%{release} -# the binary bits in this tree are for testdata -BuildArch: noarch %description src %{summary} @@ -884,6 +882,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-10 +- make the source subpackage arch'ed, instead of noarch + * Tue Jul 15 2014 Vincent Batts - 1.2.2-9 - fix the loading of gdb safe-path. bz981356 From 6da1cd966e9a5d36005c1f30f1d7b09c9210c653 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 7 Aug 2014 03:39:03 +0000 Subject: [PATCH 6/6] xemacs version constraint for bz1127518 --- golang.spec | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index c2159c4..9789ed8 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: The Go Programming Language License: BSD @@ -65,7 +65,10 @@ Requires: golang-src BuildRequires: emacs # xemacs on fedora only %if 0%{?fedora} -BuildRequires: xemacs xemacs-packages-extra +BuildRequires: xemacs +# xemacs-packages-extra-20130408-3 worked fine, but not the newer bump +# https://bugzilla.redhat.com/show_bug.cgi?id=1127518 +BuildRequires: xemacs-packages-extra < 20140705-1 %endif Patch0: golang-1.2-verbose-build.patch @@ -149,7 +152,8 @@ BuildArch: noarch %package -n xemacs-%{name} Summary: XEmacs add-on package for Go Requires: xemacs(bin) >= %{_xemacs_version} -Requires: xemacs-packages-extra +# https://bugzilla.redhat.com/show_bug.cgi?id=1127518 +Requires: xemacs-packages-extra < 20140705-1 BuildArch: noarch %description -n xemacs-%{name} @@ -882,6 +886,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-11 +- set a version constraint on xemacs due to bz1127518 + * Wed Aug 06 2014 Vincent Batts - 1.2.2-10 - make the source subpackage arch'ed, instead of noarch