Skip to content

Commit 0c52170

Browse files
committed
Reverse merging from valencia
2 parents 5945b7e + 6ca33d9 commit 0c52170

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1663
-1340
lines changed

Makefile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ SVGEXPORT := $(shell which svgexport 2> /dev/null)
1313

1414
BOOT2DOCKER := $(shell which boot2docker 2> /dev/null)
1515

16-
BUILD_DATE := $(shell date -u +%Y%m%d.%H%M%S)
16+
GIT_REVISION_SHORTCODE := $(shell git rev-parse --short HEAD)
1717
GIT_REVISION := $(shell git describe --abbrev=0 --tags --exact-match 2> /dev/null || git rev-parse --short HEAD)
18+
GIT_REVISION_DATE := $(shell git show -s --format=%ci $(GIT_REVISION_SHORTCODE))
19+
20+
REVISION_DATE := $(shell date -u -j -f "%F %T %z" "$(GIT_REVISION_DATE)" +"%Y%m%d.%H%M%S" || date -u -d "$(GIT_REVISION_DATE)" +"%Y%m%d.%H%M%S")
21+
BUILD_DATE := $(shell date -u +%Y%m%d.%H%M%S)
22+
1823
LOGGLY_TOKEN := 469973d5-6eaf-445a-be71-cf27141316a1
19-
LDFLAGS := -w -X main.version $(GIT_REVISION) -X main.buildDate $(BUILD_DATE) -X github.com/getlantern/flashlight/logging.logglyToken \"$(LOGGLY_TOKEN)\"
24+
LDFLAGS := -w -X main.version $(GIT_REVISION) -X main.revisionDate $(REVISION_DATE) -X main.buildDate $(BUILD_DATE) -X github.com/getlantern/flashlight/logging.logglyToken \"$(LOGGLY_TOKEN)\"
2025
LANTERN_DESCRIPTION := "Censorship circumvention tool"
2126
LANTERN_EXTENDED_DESCRIPTION := "Lantern allows you to access sites blocked by internet censorship.\nWhen you run it, Lantern reroutes traffic to selected domains through servers located where such domains aren't censored."
2227

@@ -28,7 +33,7 @@ PACKAGE_URL := "https://www.getlantern.org"
2833

2934
LANTERN_BINARIES_PATH ?= ../lantern-binaries
3035

31-
GO_MOBILE_REVISION=47553f4d4275316f2610b3204f8f9ecaf3ce63a7
36+
GO_MOBILE_REVISION=f88f8237ec301d3403c630c0b20e940f187187e2
3237

3338
GH_USER ?= getlantern
3439

@@ -210,7 +215,6 @@ docker-golang-android: require-mercurial
210215
cd src/golang.org/x/mobile && \
211216
git reset --hard && \
212217
git checkout $(GO_MOBILE_REVISION) && \
213-
curl https://gist.githubusercontent.com/xiam/56d8fe575176f459613d/raw/8873ed3af55a7d449a1c9c2112de118da968dbc3/gistfile1.txt | git apply - && \
214218
docker build -t golang/mobile .; \
215219
fi
216220

@@ -342,10 +346,22 @@ package-darwin: require-version require-appdmg require-svgexport darwin
342346
echo "-> Skipped: Can not generate a package on a non-OSX host."; \
343347
fi;
344348

349+
manoto:
350+
@echo "Replacing NO_URL with manoto"
351+
perl -pi -e "s/NO_URL/https:\/\/www.facebook.com\/manototv/" src/github.com/getlantern/flashlight/ui/ui.go
352+
353+
unmanoto:
354+
@echo "Replacing manoto url with NO_URL"
355+
perl -pi -e "s/https:\/\/www.facebook.com\/manototv/NO_URL/" src/github.com/getlantern/flashlight/ui/ui.go
356+
357+
manoto-binaries: manoto binaries unmanoto
358+
345359
binaries: docker genassets linux windows darwin
346360

347361
packages: require-version require-secrets clean genconfig binaries package-windows package-linux package-darwin
348362

363+
manoto-packages: require-version require-secrets clean genconfig manoto-binaries package-windows package-linux package-darwin
364+
349365
release-qa: require-tag require-s3cmd
350366
@BASE_NAME="lantern-installer-qa" && \
351367
rm -f $$BASE_NAME* && \
@@ -454,7 +470,7 @@ android-lib: docker-golang-android genconfig
454470
gobind -lang=go github.com/getlantern/lantern-android/libflashlight/bindings > bindings/go_bindings/go_bindings.go && \
455471
gobind -lang=java github.com/getlantern/lantern-android/libflashlight/bindings > bindings/Flashlight.java || exit 1;
456472
@$(call docker-up) && \
457-
$(DOCKER) run -v $$PWD/src:/src golang/mobile /bin/bash -c \ "cd /src/github.com/getlantern/lantern-android/libflashlight && ./make.bash $(GIT_REVISION) $(BUILD_DATE)" && \
473+
$(DOCKER) run -v $$PWD/src:/src golang/mobile /bin/bash -c \ "cd /src/github.com/getlantern/lantern-android/libflashlight && ./make.bash $(GIT_REVISION) $(REVISION_DATE) $(BUILD_DATE)" && \
458474
ls -l src/github.com/getlantern/lantern-android/app/libs/armeabi-v7a/libgojni.so && \
459475
if [ -d "$(FIRETWEET_DIR)" ]; then \
460476
cp -v src/github.com/getlantern/lantern-android/app/libs/armeabi-v7a/libgojni.so $(FIRETWEET_DIR)/firetweet/src/main/jniLibs/armeabi-v7a && \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# lantern [![Travis CI Status](https://travis-ci.org/getlantern/lantern.svg?branch=devel)](https://travis-ci.org/getlantern/lantern) [![Coverage Status](https://coveralls.io/repos/getlantern/lantern/badge.png?branch=devel)](https://coveralls.io/r/getlantern/lantern)
1+
# lantern [![Travis CI Status](https://travis-ci.org/getlantern/lantern.svg?branch=valencia)](https://travis-ci.org/getlantern/lantern) [![Coverage Status](https://coveralls.io/repos/getlantern/lantern/badge.png?branch=valencia)](https://coveralls.io/r/getlantern/lantern)
22

33
lantern is a [gost](https://github.com/getlantern/gost) project that
44
provides repeatable builds and consolidated pull requests for lantern. **It's very important to read the gost documentation thoroughly in

installer-resources/linux/lantern.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,26 @@ LANTERN_WRAPPER_DIR=$(dirname "$LANTERN_WRAPPER")
1313
LANTERN_SOURCE_BINARY=$LANTERN_WRAPPER_DIR/lantern-binary
1414

1515
LANTERN_USER_DIRECTORY=$HOME/.lantern
16+
LANTERN_SOURCE_BINARY_HASH=$LANTERN_USER_DIRECTORY/bin/lantern.sha1
1617
LANTERN_USER_BINARY=$LANTERN_USER_DIRECTORY/bin/lantern
1718

18-
# A local copy of the Lantern binary is preferred since it can update by
19-
# itself.
19+
# Checking if the source Lantern binary had any change.
20+
if [ -f $LANTERN_SOURCE_BINARY_HASH ]; then
21+
# If the checksum does not match then it probably means that the source
22+
# binary got updated. See https://github.com/getlantern/lantern/issues/2670.
23+
sha1sum -c $LANTERN_SOURCE_BINARY_HASH || rm -f $LANTERN_USER_BINARY;
24+
else
25+
# This was an old version that didn't saved verification sums.
26+
rm -f $LANTERN_USER_BINARY;
27+
fi
28+
29+
# A local copy of the Lantern binary is preferred since it has the current
30+
# user's writing permissions and it can be updated.
2031
if [ ! -f $LANTERN_USER_BINARY ]; then
2132
# If there is no local copy, we use the original Lantern binary.
2233
mkdir -p $LANTERN_USER_DIRECTORY/bin
2334
cp $LANTERN_SOURCE_BINARY $LANTERN_USER_BINARY
35+
sha1sum $LANTERN_SOURCE_BINARY > $LANTERN_SOURCE_BINARY_HASH
2436
chmod +x $LANTERN_USER_BINARY
2537
fi
2638

src/github.com/blang/semver/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Note: Always vendor your dependencies or fix on a specific version tag.
1212

1313
```go
1414
import github.com/blang/semver
15-
v1, err := semver.New("1.0.0-beta")
16-
v2, err := semver.New("2.0.0-beta")
15+
v1, err := semver.Make("1.0.0-beta")
16+
v2, err := semver.Make("2.0.0-beta")
1717
v1.Compare(v2)
1818
```
1919

@@ -53,7 +53,7 @@ Have a look at full examples in [examples/main.go](examples/main.go)
5353
```go
5454
import github.com/blang/semver
5555

56-
v, err := semver.New("0.0.1-alpha.preview+123.github")
56+
v, err := semver.Make("0.0.1-alpha.preview+123.github")
5757
fmt.Printf("Major: %d\n", v.Major)
5858
fmt.Printf("Minor: %d\n", v.Minor)
5959
fmt.Printf("Patch: %d\n", v.Patch)
@@ -76,7 +76,7 @@ if len(v.Build) > 0 {
7676
}
7777
}
7878

79-
v001, err := semver.New("0.0.1")
79+
v001, err := semver.Make("0.0.1")
8080
// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE
8181
v001.GT(v) == true
8282
v.LT(v001) == true

src/github.com/blang/semver/examples/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func main() {
3232
}
3333
}
3434

35-
// New == Parse
36-
v001, err := semver.New("0.0.1")
35+
// Make == Parse (Value), New for Pointer
36+
v001, err := semver.Make("0.0.1")
3737

3838
fmt.Println("\nUse Version.Compare for comparisons (-1, 0, 1):")
3939
fmt.Printf("%q is greater than %q: Compare == %d\n", v001, v, v001.Compare(v))

src/github.com/blang/semver/semver.go

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const (
1313
alphanum = alphas + numbers
1414
)
1515

16-
// Latest fully supported spec version
17-
var SPEC_VERSION = Version{
16+
// SpecVersion is the latest fully supported spec version of semver
17+
var SpecVersion = Version{
1818
Major: 2,
1919
Minor: 0,
2020
Patch: 0,
2121
}
2222

23+
// Version represents a semver compatible version
2324
type Version struct {
2425
Major uint64
2526
Minor uint64
@@ -60,76 +61,73 @@ func (v Version) String() string {
6061
return string(b)
6162
}
6263

63-
// Checks if v is equal to o.
64+
// Equals checks if v is equal to o.
6465
func (v Version) Equals(o Version) bool {
6566
return (v.Compare(o) == 0)
6667
}
6768

68-
// Checks if v is equal to o.
69+
// EQ checks if v is equal to o.
6970
func (v Version) EQ(o Version) bool {
7071
return (v.Compare(o) == 0)
7172
}
7273

73-
// Checks if v is not equal to o.
74+
// NE checks if v is not equal to o.
7475
func (v Version) NE(o Version) bool {
7576
return (v.Compare(o) != 0)
7677
}
7778

78-
// Checks if v is greater than o.
79+
// GT checks if v is greater than o.
7980
func (v Version) GT(o Version) bool {
8081
return (v.Compare(o) == 1)
8182
}
8283

83-
// Checks if v is greater than or equal to o.
84+
// GTE checks if v is greater than or equal to o.
8485
func (v Version) GTE(o Version) bool {
8586
return (v.Compare(o) >= 0)
8687
}
8788

88-
// Checks if v is greater than or equal to o.
89+
// GE checks if v is greater than or equal to o.
8990
func (v Version) GE(o Version) bool {
9091
return (v.Compare(o) >= 0)
9192
}
9293

93-
// Checks if v is less than o.
94+
// LT checks if v is less than o.
9495
func (v Version) LT(o Version) bool {
9596
return (v.Compare(o) == -1)
9697
}
9798

98-
// Checks if v is less than or equal to o.
99+
// LTE checks if v is less than or equal to o.
99100
func (v Version) LTE(o Version) bool {
100101
return (v.Compare(o) <= 0)
101102
}
102103

103-
// Checks if v is less than or equal to o.
104+
// LE checks if v is less than or equal to o.
104105
func (v Version) LE(o Version) bool {
105106
return (v.Compare(o) <= 0)
106107
}
107108

108-
// Compares Versions v to o:
109+
// Compare compares Versions v to o:
109110
// -1 == v is less than o
110111
// 0 == v is equal to o
111112
// 1 == v is greater than o
112113
func (v Version) Compare(o Version) int {
113114
if v.Major != o.Major {
114115
if v.Major > o.Major {
115116
return 1
116-
} else {
117-
return -1
118117
}
118+
return -1
119119
}
120120
if v.Minor != o.Minor {
121121
if v.Minor > o.Minor {
122122
return 1
123-
} else {
124-
return -1
125123
}
124+
return -1
126125
}
127126
if v.Patch != o.Patch {
128127
if v.Patch > o.Patch {
129128
return 1
130-
} else {
131-
return -1
132129
}
130+
return -1
133131
}
134132

135133
// Quick comparison if a version has no prerelease versions
@@ -139,32 +137,31 @@ func (v Version) Compare(o Version) int {
139137
return 1
140138
} else if len(v.Pre) > 0 && len(o.Pre) == 0 {
141139
return -1
142-
} else {
143-
144-
i := 0
145-
for ; i < len(v.Pre) && i < len(o.Pre); i++ {
146-
if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
147-
continue
148-
} else if comp == 1 {
149-
return 1
150-
} else {
151-
return -1
152-
}
153-
}
140+
}
154141

155-
// If all pr versions are the equal but one has further prversion, this one greater
156-
if i == len(v.Pre) && i == len(o.Pre) {
157-
return 0
158-
} else if i == len(v.Pre) && i < len(o.Pre) {
159-
return -1
160-
} else {
142+
i := 0
143+
for ; i < len(v.Pre) && i < len(o.Pre); i++ {
144+
if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
145+
continue
146+
} else if comp == 1 {
161147
return 1
148+
} else {
149+
return -1
162150
}
151+
}
163152

153+
// If all pr versions are the equal but one has further prversion, this one greater
154+
if i == len(v.Pre) && i == len(o.Pre) {
155+
return 0
156+
} else if i == len(v.Pre) && i < len(o.Pre) {
157+
return -1
158+
} else {
159+
return 1
164160
}
161+
165162
}
166163

167-
// Validates v and returns error in case
164+
// Validate validates v and returns error in case
168165
func (v Version) Validate() error {
169166
// Major, Minor, Patch already validated using uint64
170167

@@ -191,12 +188,19 @@ func (v Version) Validate() error {
191188
return nil
192189
}
193190

194-
// Alias for Parse, parses version string and returns a validated Version or error
195-
func New(s string) (Version, error) {
191+
// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error
192+
func New(s string) (vp *Version, err error) {
193+
v, err := Parse(s)
194+
vp = &v
195+
return
196+
}
197+
198+
// Make is an alias for Parse, parses version string and returns a validated Version or error
199+
func Make(s string) (Version, error) {
196200
return Parse(s)
197201
}
198202

199-
// Parses version string and returns a validated Version or error
203+
// Parse parses version string and returns a validated Version or error
200204
func Parse(s string) (Version, error) {
201205
if len(s) == 0 {
202206
return Version{}, errors.New("Version string empty")
@@ -294,14 +298,14 @@ func MustParse(s string) Version {
294298
return v
295299
}
296300

297-
// PreRelease Version
301+
// PRVersion represents a PreRelease Version
298302
type PRVersion struct {
299303
VersionStr string
300304
VersionNum uint64
301305
IsNum bool
302306
}
303307

304-
// Creates a new valid prerelease version
308+
// NewPRVersion creates a new valid prerelease version
305309
func NewPRVersion(s string) (PRVersion, error) {
306310
if len(s) == 0 {
307311
return PRVersion{}, errors.New("Prerelease is empty")
@@ -328,12 +332,12 @@ func NewPRVersion(s string) (PRVersion, error) {
328332
return v, nil
329333
}
330334

331-
// Is pre release version numeric?
335+
// IsNumeric checks if prerelease-version is numeric
332336
func (v PRVersion) IsNumeric() bool {
333337
return v.IsNum
334338
}
335339

336-
// Compares PreRelease Versions v to o:
340+
// Compare compares two PreRelease Versions v and o:
337341
// -1 == v is less than o
338342
// 0 == v is equal to o
339343
// 1 == v is greater than o
@@ -379,7 +383,7 @@ func hasLeadingZeroes(s string) bool {
379383
return len(s) > 1 && s[0] == '0'
380384
}
381385

382-
// Creates a new valid build version
386+
// NewBuildVersion creates a new valid build version
383387
func NewBuildVersion(s string) (string, error) {
384388
if len(s) == 0 {
385389
return "", errors.New("Buildversion is empty")

0 commit comments

Comments
 (0)