Accepting request 63727 from home:andtecheu:go

OBS-URL: https://build.opensuse.org/request/show/63727
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=38
This commit is contained in:
Sascha Peilicke 2011-03-09 16:01:35 +00:00 committed by Git OBS Bridge
parent 027f206dae
commit 9b80826f32
5 changed files with 94 additions and 56 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:889741ac66af06c91a52c9cb8daae8abae58bbb3413c3a711cb5f79ded427bf9
size 5738196

3
go-20110307.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c8bdad4103381eb43cf8a22098c9fb06da1bd30f9d5e3cf22dfce56bb26b0f55
size 5883902

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Mar 8 18:16:34 UTC 2011 - graham@andtech.eu
- Update to 07/03/2011 .1 upstream mercurual release
- Update godoc patch to reflect changes to path package
-------------------------------------------------------------------
Tue Mar 1 13:12:30 UTC 2011 - graham@andtech.eu

View File

@ -10,7 +10,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
%define pkg_release 20110224
%define pkg_release 20110307.1
%ifarch %ix86
%define go_os_arch linux_386
%endif

View File

@ -1,52 +1,84 @@
diff -r 867d37fb41a4 src/cmd/godoc/godoc.go
--- a/src/cmd/godoc/godoc.go Wed Feb 02 12:09:31 2011 +1100
+++ b/src/cmd/godoc/godoc.go Tue Feb 08 16:14:52 2011 +0100
@@ -77,12 +77,15 @@
pkgHandler httpHandler
)
+// for openSUSE packaging of godoc
+const docroot = "/usr/share/doc/packages/go-doc/"
+const srcroot = "/usr/share/go/"
func initHandlers() {
fsMap.Init(*pkgPath)
- fileServer = http.FileServer(*goroot, "")
- cmdHandler = httpHandler{"/cmd/", pathutil.Join(*goroot, "src/cmd"), false}
- pkgHandler = httpHandler{"/pkg/", pathutil.Join(*goroot, "src/pkg"), true}
+ fileServer = http.FileServer(docroot, "")
+ cmdHandler = httpHandler{"/cmd/", pathutil.Join(srcroot, "src/cmd"), false}
+ pkgHandler = httpHandler{"/pkg/", pathutil.Join(srcroot, "src/pkg"), true}
}
@@ -622,7 +625,7 @@
func readTemplate(name string) *template.Template {
- path := pathutil.Join(*goroot, "lib/godoc/"+name)
+ path := pathutil.Join(*goroot, "lib/"+name)
data, err := ioutil.ReadFile(path)
if err != nil {
log.Fatalf("ReadFile %s: %v", path, err)
@@ -804,13 +807,18 @@
func serveFile(w http.ResponseWriter, r *http.Request) {
+ // openSUSE: serv docs from root of go-doc package install location
+ if strings.HasPrefix(r.URL.Path, "/doc/") {
+ http.Redirect(w, r, "/"+ r.URL.Path[len("/doc"):], http.StatusMovedPermanently)
+ return
+ }
relpath := r.URL.Path[1:] // serveFile URL paths start with '/'
- abspath := absolutePath(relpath, *goroot)
+ abspath := absolutePath(relpath, docroot)
// pick off special cases and hand the rest to the standard file server
switch r.URL.Path {
case "/":
- serveHTMLDoc(w, r, pathutil.Join(*goroot, "doc/root.html"), "doc/root.html")
+ serveHTMLDoc(w, r, pathutil.Join(docroot, "root.html"), "root.html")
return
case "/doc/root.html":
*** a/src/cmd/godoc/godoc.go 2011-03-08 18:46:40.906386884 +0100
--- b/src/cmd/godoc/godoc.go 2011-03-08 19:10:03.880387209 +0100
***************
*** 78,89 ****
pkgHandler httpHandler
)
func initHandlers() {
fsMap.Init(*pkgPath)
! fileServer = http.FileServer(*goroot, "")
! cmdHandler = httpHandler{"/cmd/", filepath.Join(*goroot, "src", "cmd"), false}
! pkgHandler = httpHandler{"/pkg/", filepath.Join(*goroot, "src", "pkg"), true}
}
--- 78,92 ----
pkgHandler httpHandler
)
+ // for openSUSE packaging of godoc
+ const docroot = "/usr/share/doc/packages/go-doc/"
+ const srcroot = "/usr/share/go/"
func initHandlers() {
fsMap.Init(*pkgPath)
! fileServer = http.FileServer(docroot, "")
! cmdHandler = httpHandler{"/cmd/", filepath.Join(srcroot, "src/cmd"), false}
! pkgHandler = httpHandler{"/pkg/", filepath.Join(srcroot, "src/pkg"), true}
}
***************
*** 634,640 ****
func readTemplate(name string) *template.Template {
! path := filepath.Join(*goroot, "lib", "godoc", name)
data, err := ioutil.ReadFile(path)
if err != nil {
log.Fatalf("ReadFile %s: %v", path, err)
--- 637,643 ----
func readTemplate(name string) *template.Template {
! path := filepath.Join(*goroot, "lib/"+name)
data, err := ioutil.ReadFile(path)
if err != nil {
log.Fatalf("ReadFile %s: %v", path, err)
***************
*** 819,831 ****
func serveFile(w http.ResponseWriter, r *http.Request) {
relpath := r.URL.Path[1:] // serveFile URL paths start with '/'
! abspath := absolutePath(relpath, *goroot)
// pick off special cases and hand the rest to the standard file server
switch r.URL.Path {
case "/":
! serveHTMLDoc(w, r, filepath.Join(*goroot, "doc", "root.html"), "doc/root.html")
return
case "/doc/root.html":
--- 822,840 ----
func serveFile(w http.ResponseWriter, r *http.Request) {
+ // openSUSE: serv docs from root of go-doc package install location
+ if strings.HasPrefix(r.URL.Path, "/doc/") {
+ http.Redirect(w, r, "/"+ r.URL.Path[len("/doc"):], http.StatusMovedPermanently)
+ return
+ }
+
relpath := r.URL.Path[1:] // serveFile URL paths start with '/'
! abspath := absolutePath(relpath, docroot)
// pick off special cases and hand the rest to the standard file server
switch r.URL.Path {
case "/":
! serveHTMLDoc(w, r, filepath.Join(docroot, "root.html"), "root.html")
return
case "/doc/root.html":