updating bumper

This commit is contained in:
David Vennik
2022-11-08 11:01:23 +01:00
parent 2865f46497
commit b908a46ad7
5 changed files with 17 additions and 47 deletions

View File

@@ -29,12 +29,13 @@ var (
check = log.E.Chk
)
func errPrintln(a ...interface{}) {
_, _ = fmt.Fprintln(os.Stderr, a...)
}
func main() {
if len(os.Args) < 2 {
fmt.Fprintln(
os.Stderr,
"arguments required in order to bump and push this repo",
)
log.E.Ln("arguments required in order to bump and push this repo")
os.Exit(1)
}
var minor, major bool
@@ -95,7 +96,6 @@ func main() {
}
var maxVersion int
if e = rt.ForEach(
func(pr *plumbing.Reference) (e error) {
s := strings.Split(pr.String(), "/")
prs := s[2]
@@ -121,16 +121,16 @@ func main() {
); check(e) {
return
}
// Bump to next patch version every time
Patch++
if minor {
switch {
case minor:
Minor++
Patch = 0
}
if major {
case major:
Major++
Minor = 0
Patch = 0
default:
Patch++
}
// Update SemVer
SemVer = fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
@@ -229,7 +229,6 @@ func Version() string {
}
func runCmd(cmd ...string) (err error) {
c := exec.Command(cmd[0], cmd[1:]...)
var output []byte
output, err = c.CombinedOutput()

View File

@@ -26,26 +26,20 @@ func Split(ep EP, segSize int) (packets [][]byte, e error) {
}
overhead := ep.GetOverhead()
segMap := NewSegments(len(ep.Data), segSize, overhead, ep.Parity)
log.I.Ln(len(ep.Data), segSize, overhead, ep.Parity)
log.I.Ln(segMap)
// pad the last part
sp := segMap[len(segMap)-1]
padLen := sp.SLen - sp.Last
log.I.Ln("padding", padLen, sp.Last)
ep.Data = append(ep.Data, slice.NoisePad(padLen)...)
log.I.Ln("data length", len(ep.Data))
var s [][]byte
var start, end int
for i, sm := range segMap {
// Add the data segments.
for curs := 0; curs < sm.DEnd-sm.DStart; curs++ {
end = start + sm.SLen
// log.I.Ln(i)
if i == sm.DEnd-sm.DStart {
log.I.Ln("last", sm.Last)
end = start + sm.Last
}
// log.I.Ln(start, end, len(ep.Data), sm)
s = append(s, ep.Data[start:end])
start += sm.SLen
}

View File

@@ -174,7 +174,6 @@ func TestSplitJoinFEC(t *testing.T) {
}
}
var pkts Packets
var keys []*pub.Key
log.I.Ln("before decode", len(splitted))
@@ -192,18 +191,6 @@ func TestSplitJoinFEC(t *testing.T) {
}
log.I.Ln("after decode", len(pkts))
_ = p
// prev := keys[0]
// // check all keys are the same
// for ki, k := range keys[1:] {
// if !prev.Equals(k) {
// log.I.Ln("key not match", ki)
// t.FailNow()
// }
// prev = k
// }
var msg []byte
if msg, e = Join(pkts); check(e) {
t.FailNow()
@@ -221,7 +208,7 @@ func TestSplitJoinFEC(t *testing.T) {
func TestSplit(t *testing.T) {
msgSize := 2 << 16
segSize := 4096 // + Overhead
segSize := 4096
payload := make([]byte, msgSize)
var e error
var n int
@@ -234,7 +221,6 @@ func TestSplit(t *testing.T) {
if sendPriv, e = prv.GenerateKey(); check(e) {
t.Error(e)
}
// sendPub = pub.Derive(sendPriv)
if reciPriv, e = prv.GenerateKey(); check(e) {
t.Error(e)
}

View File

@@ -37,7 +37,6 @@ func NewSegments(payloadLen, segmentSize, overhead, redundancy int) (s Segments)
sectsD := 256 - redundancy
sectsP := redundancy
withR := nSegs + nSegs*sectsP/sectsD
log.I.Ln(withR, payloadLen*redundancy/256)
// If any redundancy is specified, if it rounds to zero, it must be
// bumped up to 1 in order to work with the rs encoder.
if withR == nSegs && redundancy > 0 {
@@ -45,9 +44,6 @@ func NewSegments(payloadLen, segmentSize, overhead, redundancy int) (s Segments)
}
sects := nSegs / sectsD
lastSect := nSegs % sectsD
log.I.F("payload %d, segSize %d, nSegs %d, lastSeg %d, sectsD %d, sectsP %d, withR %d, sects %d, lastSect %d",
payloadLen, segSize, nSegs, lastSeg, sectsD, sectsP, withR,
sects, lastSect)
var start int
if sects > 0 {
last := segSize
@@ -66,16 +62,11 @@ func NewSegments(payloadLen, segmentSize, overhead, redundancy int) (s Segments)
}
if lastSect > 0 {
endD := start + lastSect
// if there is redundancy the DEnd must be at least one less than PEnd.
// if there is redundancy the DEnd must be at least one less
// than PEnd.
if withR == endD && redundancy > 0 {
withR++
}
log.I.Ln(start,
endD,
withR,
segSize,
lastSeg,
)
s = append(s, Segment{
DStart: start,
DEnd: endD,

View File

@@ -10,11 +10,11 @@ var (
// GitRef is the gitref, as in refs/heads/branchname.
GitRef = "refs/heads/main"
// ParentGitCommit is the commit hash of the parent HEAD.
ParentGitCommit = "c0c9e67105b384096b1c5c4528f5cdc4dbdd65b2"
ParentGitCommit = "8de4c9718d9ceb20bd4ea7c39e9e73fcf3d493cf"
// BuildTime stores the time when the current binary was built.
BuildTime = "2022-11-07T17:10:00+01:00"
BuildTime = "2022-11-08T11:01:23+01:00"
// SemVer lists the (latest) git tag on the build.
SemVer = "v0.0.80"
SemVer = "v0.0.81"
// PathBase is the path base returned from runtime caller.
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
// Major is the major number from the tag.
@@ -22,7 +22,7 @@ var (
// Minor is the minor number from the tag.
Minor = 0
// Patch is the patch version number from the tag.
Patch = 80
Patch = 81
)
// Version returns a pretty printed version information string.