Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
70a8948a
Commit
70a8948a
authored
Mar 28, 2012
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/dist: support upload only (no build)
R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/5940050
parent
16fd9fd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
10 deletions
+39
-10
misc/dist/bindist.go
misc/dist/bindist.go
+39
-10
No files found.
misc/dist/bindist.go
View file @
70a8948a
...
...
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// This is a tool for packaging binary releases.
// It supports FreeBSD, Linux,
and OS X
.
// It supports FreeBSD, Linux,
OS X, and Windows
.
package
main
import
(
...
...
@@ -24,16 +24,18 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
)
var
(
tag
=
flag
.
String
(
"tag"
,
"weekly"
,
"mercurial tag to check out"
)
repo
=
flag
.
String
(
"repo"
,
"https://code.google.com/p/go"
,
"repo URL"
)
verbose
=
flag
.
Bool
(
"v"
,
false
,
"verbose output"
)
upload
=
flag
.
Bool
(
"upload"
,
true
,
"upload resulting files to Google Code"
)
wxsFile
=
flag
.
String
(
"wxs"
,
""
,
"path to custom installer.wxs"
)
tag
=
flag
.
String
(
"tag"
,
"weekly"
,
"mercurial tag to check out"
)
repo
=
flag
.
String
(
"repo"
,
"https://code.google.com/p/go"
,
"repo URL"
)
verbose
=
flag
.
Bool
(
"v"
,
false
,
"verbose output"
)
upload
=
flag
.
Bool
(
"upload"
,
true
,
"upload resulting files to Google Code"
)
wxsFile
=
flag
.
String
(
"wxs"
,
""
,
"path to custom installer.wxs"
)
addLabel
=
flag
.
String
(
"label"
,
""
,
"additional label to apply to file hwhen uploading"
)
username
,
password
string
// for Google Code upload
)
...
...
@@ -64,6 +66,8 @@ var sourceCleanFiles = []string{
"pkg"
,
}
var
fileRe
=
regexp
.
MustCompile
(
`^go\.([a-z0-9-.]+)\.(src|([a-z0-9]+)-([a-z0-9]+))\.`
)
func
main
()
{
flag
.
Usage
=
func
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
"usage: %s [flags] targets...
\n
"
,
os
.
Args
[
0
])
...
...
@@ -85,6 +89,24 @@ func main() {
}
for
_
,
targ
:=
range
flag
.
Args
()
{
var
b
Build
if
m
:=
fileRe
.
FindStringSubmatch
(
targ
);
m
!=
nil
{
// targ is a file name; upload it to googlecode.
version
:=
m
[
1
]
if
m
[
2
]
==
"src"
{
b
.
Source
=
true
}
else
{
b
.
OS
=
m
[
3
]
b
.
Arch
=
m
[
4
]
}
if
!*
upload
{
log
.
Printf
(
"%s: -upload=false, skipping"
,
targ
)
continue
}
if
err
:=
b
.
Upload
(
version
,
targ
);
err
!=
nil
{
log
.
Printf
(
"%s: %v"
,
targ
,
err
)
}
continue
}
if
targ
==
"source"
{
b
.
Source
=
true
}
else
{
...
...
@@ -296,7 +318,7 @@ func (b *Build) Do() error {
}
if
err
==
nil
&&
*
upload
{
for
_
,
targ
:=
range
targs
{
err
=
b
.
u
pload
(
version
,
targ
)
err
=
b
.
U
pload
(
version
,
targ
)
if
err
!=
nil
{
return
err
}
...
...
@@ -362,7 +384,7 @@ func (b *Build) env() []string {
return
env
}
func
(
b
*
Build
)
u
pload
(
version
string
,
filename
string
)
error
{
func
(
b
*
Build
)
U
pload
(
version
string
,
filename
string
)
error
{
// Prepare upload metadata.
var
labels
[]
string
os_
,
arch
:=
b
.
OS
,
b
.
Arch
...
...
@@ -389,7 +411,7 @@ func (b *Build) upload(version string, filename string) error {
os_
=
"Windows"
labels
=
append
(
labels
,
"OpSys-Windows"
)
}
summary
:=
fmt
.
Sprintf
(
"
Go
%s %s (%s)"
,
version
,
os_
,
arch
)
summary
:=
fmt
.
Sprintf
(
"%s %s (%s)"
,
version
,
os_
,
arch
)
if
b
.
OS
==
"windows"
{
switch
{
case
strings
.
HasSuffix
(
filename
,
".msi"
)
:
...
...
@@ -402,7 +424,14 @@ func (b *Build) upload(version string, filename string) error {
}
if
b
.
Source
{
labels
=
append
(
labels
,
"Type-Source"
)
summary
=
fmt
.
Sprintf
(
"Go %s (source only)"
,
version
)
summary
=
fmt
.
Sprintf
(
"%s (source only)"
,
version
)
}
if
*
addLabel
!=
""
{
labels
=
append
(
labels
,
*
addLabel
)
}
// Put "Go" prefix on summary when it doesn't already begin with "go".
if
!
strings
.
HasPrefix
(
strings
.
ToLower
(
summary
),
"go"
)
{
summary
=
"Go "
+
summary
}
// Open file to upload.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment