Skip to content

Commit

Permalink
made build.sh add version to ldflags
Browse files Browse the repository at this point in the history
  • Loading branch information
gdunstone committed Mar 15, 2018
1 parent 0ee7f13 commit 256af30
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 52 deletions.
Binary file modified ansible/files/go-eyepi
Binary file not shown.
6 changes: 2 additions & 4 deletions ansible/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ build_gphoto2=False
[rpis]
#Acacia02 ansible_host=10.9.0.100 dslrs='{"Cam01": "bd73910b59f148e2ba5f25bfe8f5212e"}'
#GC02 ansible_host=10.9.0.2
#GC03 ansible_host=10.9.0.3 dslrs='{"GC03L": "b0079691de474678b5e6ddd8f6363c7a", "GC03R": "cd6acfa090894f9bbe7b21037a49389b"}'
GC03 ansible_host=192.168.1.42 dslrs='{"GC03L": "b0079691de474678b5e6ddd8f6363c7a", "GC03R": "cd6acfa090894f9bbe7b21037a49389b"}'
GC03 ansible_host=10.9.0.3 dslrs='{"GC03L": "b0079691de474678b5e6ddd8f6363c7a", "GC03R": "cd6acfa090894f9bbe7b21037a49389b"}'
#GC04 ansible_host=10.9.0.4
#GC05 ansible_host=10.9.0.5 dslrs='{"GC05L": "ecd776dcbd594850ae1a497d645809cf", "GC05R": "ad3028baa16e44f184012ad3dd686466"}'
GC05 ansible_host=192.168.1.30 dslrs='{"GC05L": "ecd776dcbd594850ae1a497d645809cf", "GC05R": "ad3028baa16e44f184012ad3dd686466"}'
GC05 ansible_host=10.9.0.5 dslrs='{"GC05L": "ecd776dcbd594850ae1a497d645809cf", "GC05R": "ad3028baa16e44f184012ad3dd686466"}'
#GC35 ansible_host=10.9.0.35
#GC36 ansible_host=10.9.0.36
#GC37 ansible_host=10.9.0.37
Expand Down
Binary file modified bin/go-eyepi
Binary file not shown.
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

VERSION=`git describe --tags`
BUILT=`date +%FT%T%z`
echo "$VERSION"
env GOOS=linux GOARCH=arm GOARM=7 go test ./rpi-sshsign
env GOOS=linux GOARCH=arm GOARM=7 go build -o bin/rpi-sshsign ./rpi-sshsign
cp bin/rpi-sshsign ansible/files/rpi-sshsign
env GOOS=linux go test ./openvpn-mongopass
go build -o bin/openvpn-mongopass ./openvpn-mongopass
env GOOS=linux go test .

env GOOS=linux GOARCH=arm GOARM=7 go build -a -o bin/go-eyepi .
env GOOS=linux GOARCH=arm GOARM=7 go build -a -o bin/go-eyepi -ldflags "-X main.Version=$VERSION -X main.Built=$BUILT" .
cp bin/go-eyepi ansible/files/go-eyepi
7 changes: 6 additions & 1 deletion go-eyepi.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"path/filepath"
"time"
"sync"

)

//CONFIGPATH system path to configuration file
Expand All @@ -27,6 +26,10 @@ var (
errLog *log.Logger
config *GlobalConfig
mutex *sync.Mutex
// Version and Built are both informational
Version string
// Built see above
Built string
)

//GlobalConfig type to support the configuration of all cameras managed
Expand Down Expand Up @@ -185,10 +188,12 @@ func initLogging(
log.Ldate|log.Ltime|log.Lshortfile)
}
func init() {

infoLogger, _ := syslog.New(syslog.LOG_NOTICE, "eyepi")
warningLogger, _ := syslog.New(syslog.LOG_NOTICE, "eyepi")
errLogger, _ := syslog.New(syslog.LOG_NOTICE, "eyepi")
initLogging(infoLogger, warningLogger, errLogger)
infoLog.Printf("\n\tgo-eyepi v%s\n\tbuilt on %s", Version, Built)
mutex = &sync.Mutex{}
reloadCameraConfig()
}
Expand Down
86 changes: 43 additions & 43 deletions go-eyepi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,27 @@ var snRegexData = []reTest{
"Current: cd6acfa090894f9bbe7b21037a49389b",
},
}

var failsnRegexData = []reTest{
{`*** Error ***
An error occurred in the io-library ('I/O problem'): No error description available
*** Error ***
An error occurred in the io-library ('I/O problem'): No error description available
*** Error (-7: 'I/O problem') ***
For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <[email protected]>, please run
gphoto2 as follows:
env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --get-config serialnumber --port=usb:001,006
Please make sure there is sufficient quoting around the arguments.
`,
""},
}
//
//var failsnRegexData = []reTest{
// {`*** Error ***
// An error occurred in the io-library ('I/O problem'): No error description available
//
// *** Error ***
// An error occurred in the io-library ('I/O problem'): No error description available
// *** Error (-7: 'I/O problem') ***
//
// For debugging messages, please use the --debug option.
// Debugging messages may help finding a solution to your problem.
// If you intend to send any error or debug messages to the gphoto
// developer mailing list <[email protected]>, please run
// gphoto2 as follows:
//
// env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --get-config serialnumber --port=usb:001,006
//
// Please make sure there is sufficient quoting around the arguments.
// `,
// ""},
//}

var usbRegexData = []reMultiTest{
{`----------------------------------------------------------
Expand All @@ -110,28 +110,28 @@ var usbRegexData = []reMultiTest{
Canon EOS 650D usb:001,007 `,
[][]byte{[]byte("usb:001,6"), []byte("usb:001,007")}},
}

var failUsbRegexData = []reMultiTest{
{
`*** Error ***
An error occurred in the io-library ('I/O problem'): No error description available
*** Error ***
An error occurred in the io-library ('I/O problem'): No error description available
*** Error (-7: 'I/O problem') ***
For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <[email protected]>, please run
gphoto2 as follows:
env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --get-config serialnumber --port=usb:001,006
Please make sure there is sufficient quoting around the arguments.
`, [][]byte{},
},
}
//
//var failUsbRegexData = []reMultiTest{
// {
// `*** Error ***
// An error occurred in the io-library ('I/O problem'): No error description available
//
// *** Error ***
// An error occurred in the io-library ('I/O problem'): No error description available
// *** Error (-7: 'I/O problem') ***
//
// For debugging messages, please use the --debug option.
// Debugging messages may help finding a solution to your problem.
// If you intend to send any error or debug messages to the gphoto
// developer mailing list <[email protected]>, please run
// gphoto2 as follows:
//
// env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --get-config serialnumber --port=usb:001,006
//
// Please make sure there is sufficient quoting around the arguments.
// `, [][]byte{},
// },
//}

func TestRegexes(t *testing.T) {
for _, regexData := range snRegexData {
Expand Down
2 changes: 1 addition & 1 deletion gphotocamera.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (cam *GphotoCamera) RunWait(stop <-chan bool, captureTime chan<- telegraf.M
for {
select {
case t := <-ticker.C:
if cam.Enable == true{
if cam.Enable{
start := time.Now()
// Truncate the current time to the interval duration
timestamp := t.Truncate(cam.Interval.Duration).Format(config.TimestampFormat)
Expand Down
2 changes: 1 addition & 1 deletion picamera.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (cam *RaspberryPiCamera) RunWait(stop <-chan bool, captureTime chan<- teleg
for {
select {
case t := <-ticker.C:
if cam.Enable == true {
if cam.Enable{
start := time.Now()
// Truncate the current time to the interval duration
timestamp := t.Truncate(cam.Interval.Duration).Format(config.TimestampFormat)
Expand Down

0 comments on commit 256af30

Please sign in to comment.