Compare commits

...

180 Commits

Author SHA1 Message Date
Jeff Carr dcac6d6608 build-quick 2025-09-22 20:35:06 -05:00
Jeff Carr da0540d3a7 more stuff 2025-09-13 07:45:09 -05:00
Jeff Carr bcaded6b37 s// 2025-09-13 07:30:31 -05:00
Jeff Carr 926a1ce33c moved to new scan func 2025-09-13 07:09:28 -05:00
Jeff Carr d31c80d780 minor 2025-09-13 05:32:42 -05:00
Jeff Carr 0e6cefb72e duh 2025-09-13 01:57:04 -05:00
Jeff Carr 5ceab01b0e smarter build 2025-09-13 01:31:07 -05:00
Jeff Carr 2d5a45476c api change 2025-09-13 01:07:42 -05:00
Jeff Carr 03daf07ec2 rm bits 2025-09-12 16:02:14 -05:00
Jeff Carr dca25f2425 rm debugging code 2025-09-12 16:01:33 -05:00
Jeff Carr 756586e95e attempt to debug the release process further 2025-09-12 15:51:45 -05:00
Jeff Carr bad8a5c628 trying to debug the process 2025-09-12 15:40:19 -05:00
Jeff Carr 73cc9c0693 track down versioning 2025-09-12 15:12:32 -05:00
Jeff Carr 63dc802ded add tag check to doRelease() 2025-09-12 14:52:13 -05:00
Jeff Carr fd2254cd72 stop using GoSrc() 2025-09-11 22:14:41 -05:00
Jeff Carr d813ade5ab trying to get things back to working 2025-09-11 07:53:07 -05:00
Jeff Carr 7cf1758a36 back to a common Init() 2025-09-11 04:38:22 -05:00
Jeff Carr ad1144efe5 new forge init() 2025-09-11 03:28:07 -05:00
Jeff Carr fa876aa17d switch to new config 2025-09-11 03:15:28 -05:00
Jeff Carr 131d6b4178 everything must be on the master branch to publish 2025-09-10 17:30:33 -05:00
Jeff Carr c0d131a659 new GUI codebase 2025-09-09 05:45:29 -05:00
Jeff Carr e5c43347ea try even quicker release process 2025-09-05 13:04:46 -05:00
Jeff Carr 515f862f19 patch stuff 2025-09-05 01:24:25 -05:00
Jeff Carr 27b10fdc73 releaser went through the whole process this time 2025-09-04 12:34:37 -05:00
Jeff Carr 09d595fd53 attempt to fix the release process 2025-09-03 20:50:30 -05:00
Jeff Carr d5626a5e23 fixes 2025-08-31 16:30:12 -05:00
Jeff Carr d8706ed738 fix the release process somewhat 2025-08-31 09:15:25 -05:00
Jeff Carr 1528d8d507 verify all repos are on master 2025-08-17 23:44:34 -05:00
Jeff Carr 2f6b497b12 fixes do to 'go mod' behavior changes 2025-05-29 19:18:12 -05:00
Jeff Carr c0b5f7da3a stub in args 2025-03-23 11:41:33 -05:00
Jeff Carr 8037a3cc01 minor 2025-03-22 05:21:48 -05:00
Jeff Carr 0cfaf29361 run this way 2025-03-19 07:52:51 -05:00
Jeff Carr 0662c2e0cb minor 2025-03-19 07:19:32 -05:00
Jeff Carr 236a7cb5e8 add verbose 2025-03-05 05:11:50 -06:00
Jeff Carr 8d5d7ca85c hmm. notsure what is going on 2025-03-05 04:35:38 -06:00
Jeff Carr 6add3f9982 notsure why this stalled without this line 2025-03-05 03:57:17 -06:00
Jeff Carr bfa63cac22 these are done now 2025-03-03 11:10:19 -06:00
Jeff Carr 392ea6e98e misc 2025-02-22 07:35:45 -06:00
Jeff Carr 0a1cb978e8 allow building just changed packages 2025-02-22 03:40:49 -06:00
Jeff Carr 3ff6dae849 put a non-empty file in resources/ 2025-02-20 11:06:08 -06:00
Jeff Carr 721ee08ad2 actually try to make all the packages also 2025-02-19 18:19:28 -06:00
Jeff Carr 38a0f70c78 trim old code 2025-02-17 14:14:00 -06:00
Jeff Carr eb57f644f7 rm old code 2025-02-15 18:58:56 -06:00
Jeff Carr 93b659020b remove wrong code 2025-02-15 18:55:19 -06:00
Jeff Carr a128a45ef9 attempt to make debian packages on success 2025-02-15 18:02:46 -06:00
Jeff Carr 8efada2a54 handle private repos first 2025-02-14 20:42:16 -06:00
Jeff Carr f70f3bfe1a hopefully the last check. perfectly perfect? 2025-02-14 19:15:57 -06:00
Jeff Carr 2f1d7ac1f2 minor 2025-02-14 17:58:20 -06:00
Jeff Carr ffecf5ea0a finally am checking for duplicate tags correctly. maybe. 2025-02-14 00:43:16 -06:00
Jeff Carr 8f514d4268 fix changes related to plugin updates 2025-02-14 00:09:37 -06:00
Jeff Carr 225cd84f68 set MAX loop to Repos.Len() 2025-02-12 17:02:47 -06:00
Jeff Carr 248642b681 minor 2025-02-12 17:01:03 -06:00
Jeff Carr cfd6046978 handle primitive package logic 2025-02-12 10:35:50 -06:00
Jeff Carr 76c327b1f1 send back an error on nil 2025-02-09 15:05:10 -06:00
Jeff Carr 447b4ebd3b changed 20 to 40 2025-02-09 14:53:31 -06:00
Jeff Carr 973032af1c nil check 2025-02-09 14:50:08 -06:00
Jeff Carr 8d33a63e7e hot diggity. this might actually work. 2025-02-08 19:46:39 -06:00
Jeff Carr 8cc487393f checks for more things 2025-02-08 06:32:37 -06:00
Jeff Carr 021c7774b2 moved lots of logic to go-mod-clean 2025-02-07 11:21:51 -06:00
Jeff Carr 3ceb5d0bf5 lame debugging code before. couldn't tell what was failing 2025-01-30 14:12:29 -06:00
Jeff Carr 501241dbb6 func name change 2025-01-30 12:08:08 -06:00
Jeff Carr 2ea06531dc minor debugging on the end 2025-01-30 04:43:51 -06:00
Jeff Carr 8d4687e2c1 dump old doRelease() all code. terrible code 2025-01-30 03:06:49 -06:00
Jeff Carr d81a1f6cb9 just name fixups. maybe more. this still doesn't work 2025-01-30 01:47:56 -06:00
Jeff Carr ffb90cd28f this process is annoying 2025-01-30 01:15:00 -06:00
Jeff Carr f690c1a8a3 need fixes to force versions in go.mod 2025-01-29 21:24:08 -06:00
Jeff Carr 250742905f maybe this works finally 2025-01-29 20:43:03 -06:00
Jeff Carr 9ee828cc3b hopefully this logic will finally fucking work 2025-01-29 20:00:26 -06:00
Jeff Carr 1d6c67b46c fix more of the logic errors 2025-01-29 16:41:01 -06:00
Jeff Carr 2d118d3ae7 worked pretty well last release 2025-01-28 11:36:06 -06:00
Jeff Carr 0ec680f2c3 maybe actually works 2025-01-20 08:14:18 -06:00
Jeff Carr fbc3dae556 improving the logic 2025-01-20 07:58:39 -06:00
Jeff Carr 9ef08346f8 print published repos at the end 2025-01-20 05:09:28 -06:00
Jeff Carr 782a2c35b1 try to debug the current logic 2025-01-19 11:51:54 -06:00
Jeff Carr 82f06c160a more rill. trying to improve logic 2025-01-19 10:48:16 -06:00
Jeff Carr f3e7f02e16 Merge branch 'jcarr' into devel 2025-01-19 04:35:58 -06:00
Jeff Carr ff90528c2e this needs rework 2025-01-19 04:32:01 -06:00
Jeff Carr f9c5e4c444 rill some stuff 2025-01-18 11:31:36 -06:00
Jeff Carr 57883ffa61 rill stuff 2025-01-18 11:11:06 -06:00
Jeff Carr 31a8c54d0f minor 2025-01-18 08:04:39 -06:00
Jeff Carr e4616e5971 put in wrong place 2025-01-18 07:57:51 -06:00
Jeff Carr 5bc157ec34 still fucking loops(?) 2025-01-18 07:30:11 -06:00
Jeff Carr 80109e7e65 more debugging 2025-01-18 05:52:41 -06:00
Jeff Carr 9738e869bf keep tracking down publish loops 2025-01-18 04:47:57 -06:00
Jeff Carr 0eeab33e64 zookeeper debian package logic is wrong 2025-01-18 03:13:58 -06:00
Jeff Carr ab73c05b9d double check finished repos 2025-01-17 14:19:26 -06:00
Jeff Carr 68ee252acd add bash support 2025-01-17 06:20:55 -06:00
Jeff Carr 9431656ae8 quiet output 2025-01-17 05:30:24 -06:00
Jeff Carr 5a745337fb check for go-mod-clean 2025-01-17 05:13:11 -06:00
Jeff Carr cb26cd9610 notes on what to fix 2025-01-17 04:47:32 -06:00
Jeff Carr db659057c1 .proto changes 2025-01-13 08:11:43 -06:00
Jeff Carr f5b53b403e quiet some output 2025-01-08 04:53:45 -06:00
Jeff Carr 2c71c4a5fe keep working on why this doesn't work anymore 2025-01-08 02:39:30 -06:00
Jeff Carr 3d94edd024 code cleanup in aisle 9 2025-01-08 00:59:38 -06:00
Jeff Carr a0428fa5f6 move code into forgepb 2025-01-08 00:52:17 -06:00
Jeff Carr bc710a8fd2 minor 2025-01-08 00:24:00 -06:00
Jeff Carr 81d34e86a1 tracking down bugs 2025-01-07 21:17:33 -06:00
Jeff Carr fcbc000fcf blah 2025-01-07 07:09:39 -06:00
Jeff Carr 7ccbf7f59d say goodbye finally 2025-01-07 06:46:55 -06:00
Jeff Carr 209c270add no longer merge to master 2025-01-07 03:23:47 -06:00
Jeff Carr 439067b9ac improve versioning by verifying it is greater
Signed-off-by: Jeff Carr <jcarr@wit.com>
2025-01-05 17:35:21 -06:00
Jeff Carr 6d0503b9e5 sure thing 2024-12-30 06:03:49 -06:00
Jeff Carr c9639a8db2 try to use the last tag versions 2024-12-18 20:24:28 -06:00
Jeff Carr 35fdbe3150 go.work files should be git metadata 2024-12-18 20:08:48 -06:00
Jeff Carr 54c70eb166 rm old stuff 2024-12-18 01:29:24 -06:00
Jeff Carr 5447f9ebfe jesus. what a slow slog 2024-12-17 23:59:08 -06:00
Jeff Carr 79ea2eaec1 more and more and more 2024-12-17 21:58:14 -06:00
Jeff Carr 491c4455d8 use GetGoPrimitive() 2024-12-17 20:47:35 -06:00
Jeff Carr 4e0a111c8c more things moved to gitpb 2024-12-17 18:48:45 -06:00
Jeff Carr 9e297f4603 attempt to save pb and reload it 2024-12-17 15:36:54 -06:00
Jeff Carr db2296b5b4 fix for new gitpb 2024-12-17 13:13:15 -06:00
Jeff Carr 3d22172fa9 fixes for new gitpb 2024-12-17 07:03:17 -06:00
Jeff Carr 8dd47d59e3 oops 2024-12-16 00:21:32 -06:00
Jeff Carr e76894265e add --protobuf 2024-12-16 00:19:03 -06:00
Jeff Carr 04f3fa193a hmm. move this to forge 2024-12-15 22:53:01 -06:00
Jeff Carr 279182ab62 maybe safely exit when finished 2024-12-15 20:53:15 -06:00
Jeff Carr 8e9408bac8 don't os.exit anymore as often 2024-12-15 17:03:51 -06:00
Jeff Carr 24ddb803f3 maybe forge.ConfigSave() at the right time? 2024-12-15 15:52:11 -06:00
Jeff Carr 139653ba8c add --minor argv. will it work? 2024-12-15 08:46:23 -06:00
Jeff Carr 7bfd240649 force binary and plugin packages to update 2024-12-14 23:28:53 -06:00
Jeff Carr 5f196513df maybe don't redo those go.* files anymore here 2024-12-14 23:22:34 -06:00
Jeff Carr 47085c837e use go-mod-clean --strict here 2024-12-14 18:47:28 -06:00
Jeff Carr e214aff7db keep trying to automate this 2024-12-14 16:29:14 -06:00
Jeff Carr 1c8f55d397 move checks to panic in safer places 2024-12-13 20:32:07 -06:00
Jeff Carr d1708d6a4b logic is better 2024-12-13 19:30:12 -06:00
Jeff Carr 6f39827fb9 need to run from a unchanged repo 2024-12-13 19:00:20 -06:00
Jeff Carr ffade519ff attempt to AutogenSave() files 2024-12-13 16:19:12 -06:00
Jeff Carr 02bce38b78 use go-mod-clean 2024-12-13 12:35:39 -06:00
Jeff Carr da4f5402b3 works?
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-12-13 04:13:33 -06:00
Jeff Carr 0de08f72ef maybe someday this will work 2024-12-13 02:21:39 -06:00
Jeff Carr 6e9ff62fba keep switching to protobuf 2024-12-12 02:05:47 -06:00
Jeff Carr 2d981da765 better checking 2024-12-11 01:19:07 -06:00
Jeff Carr 20b3fa3520 testing automation 2024-12-10 01:47:45 -06:00
Jeff Carr dcf18c2b7a minor 2024-12-07 16:47:51 -06:00
Jeff Carr 9acb73470b closer to full automated run 2024-12-05 17:39:45 -06:00
Jeff Carr 6b3dd97713 yet another attempt at doReleaseAll() 2024-12-05 14:18:24 -06:00
Jeff Carr c275e762c6 protobuf changes 2024-12-05 12:49:07 -06:00
Jeff Carr d6ecd246e0 track down logic error on detecting go 'primitive' packages 2024-12-03 22:35:19 -06:00
Jeff Carr 9b9df05f33 more removal of old stuff 2024-12-03 18:00:42 -06:00
Jeff Carr 9b2e99ac6b still working on full automation. was not close before. 2024-12-03 15:16:41 -06:00
Jeff Carr 0fa1ea471f smarter IsReadOnly() logic 2024-12-03 13:23:55 -06:00
Jeff Carr 135f1e5f42 don't exit. not stable yet 2024-12-03 03:51:56 -06:00
Jeff Carr 96b72979a1 almost, maybe, fully automated. maybe. finally. 2024-12-03 03:18:27 -06:00
Jeff Carr 0abb2f7861 minor 2024-12-03 00:32:55 -06:00
Jeff Carr c8fdd11ab6 almost automated again 2024-12-02 10:43:48 -06:00
Jeff Carr e9ecf2ed7e man this doesn't work right 2024-12-02 08:45:13 -06:00
Jeff Carr 1c8815685b continue to migrate to protobuf package 2024-12-02 07:00:28 -06:00
Jeff Carr cfb4fb61bf more rewriting of old code 2024-12-02 05:13:17 -06:00
Jeff Carr 02f7ee387f always redo go.mod 2024-12-01 22:21:56 -06:00
Jeff Carr 007e0e81e3 fix logic for godeps checking using forgepb 2024-12-01 17:36:34 -06:00
Jeff Carr f5b8202fda try it all 2024-12-01 16:40:22 -06:00
Jeff Carr 07decc492e maybe works? 2024-12-01 16:17:28 -06:00
Jeff Carr 8209a5645a try to detect binaries 2024-12-01 16:03:36 -06:00
Jeff Carr a61feade1e attempt to show pre and post published godeps 2024-12-01 12:59:39 -06:00
Jeff Carr 690706dc9d rm old code 2024-12-01 12:55:37 -06:00
Jeff Carr f4c2be6d8d minor fixes 2024-12-01 11:38:15 -06:00
Jeff Carr bb0bec4717 attempt to save published godeps 2024-12-01 11:02:27 -06:00
Jeff Carr 6ee304e830 attempt to set repo.Published 2024-12-01 10:42:49 -06:00
Jeff Carr 935767fde1 moving to gitpb 2024-11-30 02:02:19 -06:00
Jeff Carr 0a49db74f4 move stuff to gitpb 2024-11-29 23:18:03 -06:00
Jeff Carr d183dffab4 might work? 2024-11-29 22:38:13 -06:00
Jeff Carr 8fd6383535 runs kinda 2024-11-29 22:32:25 -06:00
Jeff Carr f7c9af9537 compiles again. doesn't work 2024-11-29 22:21:58 -06:00
Jeff Carr 24e942df16 todo: enforce this in setTargetVersion() 2024-11-22 21:34:46 -06:00
Jeff Carr e8b8316f23 attempt go mod init & tidy 2024-11-22 21:22:07 -06:00
Jeff Carr d9b91402cf repos.FindByName() 2024-11-22 21:05:09 -06:00
Jeff Carr 1735ae5826 use forge for IsPrivate() and IsReadOnly() 2024-11-22 08:41:37 -06:00
Jeff Carr 8e73e6fd7e hmm. this still doesn't work 2024-11-17 17:47:50 -06:00
Jeff Carr e2fcd1cc2b maybe exit if actually done? 2024-11-17 06:26:25 -06:00
Jeff Carr e5fb8f6b1b try to blow up before it's an actual problem 2024-11-16 04:59:21 -06:00
Jeff Carr cae26ecb18 fix build 2024-11-16 00:07:53 -06:00
Jeff Carr 9cf14144ed release gui is quite nice 2024-11-13 18:32:53 -06:00
Jeff Carr 5fcdd19170 rm more old code 2024-11-13 18:24:58 -06:00
Jeff Carr 2007be922c rm old code 2024-11-13 18:15:38 -06:00
Jeff Carr 0354e5a4a0 old whitelist removed 2024-11-13 18:13:20 -06:00
Jeff Carr fc4079aae3 use whitelist in repostatus 2024-11-13 18:10:53 -06:00
Jeff Carr 76268a71bb better prepare-release button 2024-11-13 17:53:12 -06:00
Jeff Carr 3502ea0b5b clean releasebox 2024-11-13 17:45:51 -06:00
Jeff Carr fcd132c109 code cleanup 2024-11-13 17:23:33 -06:00
Jeff Carr 250a96c49f rm more code 2024-11-13 17:03:03 -06:00
20 changed files with 972 additions and 1323 deletions

118
Makefile
View File

@ -1,36 +1,10 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)
all:
@echo run this from the autotypist dir:
@echo " GUIREASON=blah guireleaser"
@echo then:
@echo " make prepare-release"
@echo then:
@echo " make showNext"
@echo " make doRelease"
@echo loop until done
# single: build
# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run
# dump:
# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run --dump-versions
# single-really-do-it: build
# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser"
stderr: build
echo "writing to /tmp/guireleaser.stderr"
./guireleaser >/tmp/guireleaser.stderr 2>&1
prepare-release:
reset
make list-release-notdone
make curl-incrementAllTargetVersions
make list-release-notdone
make curl-whitelist-stuff
make findNext
make showNext
all: install
goimports:
reset
goimports -w *.go
# // to globally reset paths:
# // gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" .
@ -40,31 +14,33 @@ vet:
build:
echo "build it!"
touch resources/blank.so
-rm resources/*.so
cp -a ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE=off go build -v -x -ldflags " \
-X main.VERSION=${VERSION}"
-mkdir resources/
-cp -a ~/go/src/go.wit.com/toolkits/*/*.so resources/
touch resources/blank.so
GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
install:
clean:
rm -f go.*
-rm resources/*.so
cp -a ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE=off go install -v -x -ldflags " \
-X main.VERSION=${VERSION}"
touch resources/blank.so
install: goimports
touch resources/blank.so
-rm resources/*.so
# -cp -a ~/go/src/go.wit.com/toolkits/*/*.so resources/
touch resources/blank.so
GO111MODULE=off go install \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
check-git-clean:
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy
curl-help:
curl --silent http://localhost:9419/help
curl-tempWin:
curl --silent http://localhost:9419/tempWin
curl-rescan-All:
curl --silent http://localhost:9419/rescanAll
@ -84,7 +60,6 @@ showNext:
doRelease:
reset
make curl-list-changed
make showNext
sleep 10
curl --silent http://localhost:9419/doRelease
@ -92,9 +67,17 @@ doRelease:
curl-setCurrent-go-wit-com-gui:
curl --silent http://localhost:9419/setCurrentRepo?repo=go.wit.com/gui
curl-setCurrent-go-clone:
curl --silent http://localhost:9419/setCurrentRepo?repo=go.wit.com/apps/go-clone
make showNext
curl-setTargetVersion-virtigo-v0.1.1:
curl --silent http://localhost:9419/setTargetVersion?version=v0.1.1
# CAN NOT HAVE v0.6 -- MUST BE v0.6.0
curl-setTargetVersion-go-clone-v0.6.0:
curl --silent "http://localhost:9419/setTargetVersion?repo=go-clone&version=v0.6.0"
curl-incrementAllTargetVersions:
curl --silent http://localhost:9419/setAllTargetVersions
@ -102,14 +85,41 @@ curl-incrementAllTargetVersions:
list-release-notdone:
curl --silent http://localhost:9419/releaseList?readonly=true
# only show repos that need to be merged to the master branch
curl-list-changed:
curl --silent http://localhost:9419/list?perfect=false
safe-build: install
# forge list --private
wit-test install --verbose
# cd ~/go/src/go.wit.com/lib/xgb/ && time GUIRELEASE_REASON="safe-build" guireleaser --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so >/tmp/forge.log 2>&1
rm -f go.* ; git checkout go.mod ; cd ~/go/src/go.wit.com/lib/xgb/ && time GUIRELEASE_REASON="safe-build" guireleaser --gui andlabs
# include repos that you probably can't git push commits
curl-list-everything:
curl --silent http://localhost:9419/list?readonly=true
build-quick: install
wit-test install --verbose
# rm -f go.* ; git checkout go.mod ;cd ~/go/src/go.wit.com/lib/xgb/ && time GUIRELEASE_REASON="safe-build" guireleaser --gui andlabs quick
sudo "wit update"
curl-file-for-go.wit.com:
curl --silent http://localhost:9419/goweblist?readonly=true
curl --silent http://localhost:9419/goweblist?readonly=true |sort > ~/go.wit.com.versions
autocomplete:
guireleaser --bash > ~/.local/share/bash-completion/completions/guireleaser
test-build-force:
GUIRELEASE_REASON="safe-build" guireleaser --gui andlabs --force
# time GUIRELEASE_REASON="safe-build" make test-build
test-build:
wit-test install --verbose
rm ~/go/bin/forged
cd ~/go/src/go.wit.com/lib/xgb/ && rm -f go.*
cd ~/go/src/go.wit.com/lib/xgb/ && git checkout go.mod
cd ~/go/src/go.wit.com/lib/xgb/ && time guireleaser --gui andlabs
cd ~/go/src/go.wit.com/apps/guireleaser
wit-test debian --verbose
do-aptly
# time GUIRELEASE_REASON="safe-build" make test-build-quick
test-build-quick:
wit-test install --verbose
rm ~/go/bin/forged
cd ~/go/src/go.wit.com/lib/xgb/ && rm -f go.*
cd ~/go/src/go.wit.com/lib/xgb/ && git checkout go.mod
cd ~/go/src/go.wit.com/lib/xgb/ && time guireleaser --gui andlabs quick
cd ~/go/src/go.wit.com/apps/guireleaser
wit-test debian --verbose
do-aptly

8
TODO Normal file
View File

@ -0,0 +1,8 @@
notes on what to fix next
go-args make patches for alexflint
go-mod-clean --restore *.pb.go files
go-mod-clean set ctime on files
guireleaser change "title small" to the package being updated"

75
argv.go
View File

@ -1,22 +1,41 @@
package main
import (
"fmt"
"os"
"os/user"
)
/*
this parses the command line arguements
this enables command line options from other packages like 'gui' and 'log'
*/
type argv struct {
// Repo string `arg:"positional" help:"go import path"`
// Increment bool `arg:"--increment" help:"auto increment"`
// Release bool `arg:"--release" help:"do a release an exit"`
DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"`
Reason string `arg:"--reason" help:"tag message"`
DumpVersions bool `arg:"--dump-versions" help:"dump the versions file for go.wit.com"`
Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"`
type args struct {
Quick *QuickCmd `arg:"subcommand:quick" help:"only do repos with patches"`
DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"`
Minor bool `arg:"--minor" help:"increment minor verion numbers"`
Protobuf bool `arg:"--protobuf" help:"increment protobuf repos"`
Verbose bool `arg:"--verbose" help:"talk alot"`
Full bool `arg:"--full" help:"build every package"`
Reason string `arg:"--reason" help:"tag message"`
Force bool `arg:"--force" help:"try harder than normal"`
Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"`
Bash bool `arg:"--bash" help:"generate bash completion"`
BashAuto []string `arg:"--auto-complete" help:"does the actual autocompletion"`
}
func (a argv) Description() string {
type QuickCmd struct {
List *EmptyCmd `arg:"subcommand:list" help:"list available patches"`
Show *EmptyCmd `arg:"subcommand:show" help:"show a specific patch"`
NoLibs *EmptyCmd `arg:"subcommand:show" help:"skip libraries that aren't changed"`
}
type EmptyCmd struct {
}
func (a args) Description() string {
return `
Example usage:
guireleaser go.wit.com/apps/go-clone --increment --release --dry-run --reason "blerg"
@ -25,6 +44,42 @@ This will pull down the go sources and
the repositories in the go.sum file using git clone`
}
func (argv) Version() string {
func (args) Version() string {
return "guireleaser " + VERSION
}
/*
handles shell autocomplete
*/
func (a args) DoAutoComplete(argv []string) {
switch argv[0] {
case "checkout":
usr, _ := user.Current()
fmt.Println("user devel master " + usr.Username)
case "commit":
fmt.Println("--all")
case "config":
fmt.Println("add fix list delete")
case "list":
fmt.Println("--all --mine --favorites --private")
case "pull":
fmt.Println("--all --mine --favorites --private")
case "patch":
fmt.Println("--list --submit --show")
case "dirty":
fmt.Println("--show-files")
case "user":
fmt.Println("--force")
case "devel":
fmt.Println("--force")
case "master":
fmt.Println("--force")
default:
if argv[0] == ARGNAME {
// list the subcommands here
fmt.Println("--bash quick")
}
}
os.Exit(0)
}

View File

@ -2,63 +2,154 @@
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/go-cmd/cmd"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
func doRelease() bool {
log.Info("doRelease() on", me.current.Name())
func doRelease() error {
check := me.current
log.Info("doRelease() on", me.current.GetGoPath())
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
return fmt.Errorf("findOK = false %s", check.GetGoPath())
}
// double check release version logic
if me.release.releaseVersionB.String() != "release version "+me.release.version.String() {
log.Warn("something went wrong with the release.version:", me.release.version.String())
return false
return fmt.Errorf("GUI lied %s", check.GetGoPath())
}
if strings.HasPrefix(me.release.version.String(), "v") {
log.Warn("everything is ok. version starts with v.", me.release.version.String())
} else {
log.Warn("version does not start with v.", me.release.version.String())
return false
return fmt.Errorf("release does not start with a v %s", check.GetGoPath())
}
curName := me.current.Status.GetCurrentBranchName()
mName := me.current.Status.GetMasterBranchName()
if shell.Exists("go.mod") {
log.Info("go.mod exists ok")
} else {
pwd, _ := os.Getwd()
log.Info("go.mod missing in working dir", pwd)
return fmt.Errorf("go.mod missing %s", check.GetGoPath())
}
curName := me.current.GetCurrentBranchName()
mName := me.current.GetMasterBranchName()
if curName != mName {
log.Info("\trepo is not working from main branch", curName, "!=", mName)
return false
return fmt.Errorf("not on main branch %s", check.GetGoPath())
}
if !checkValidGoSum(me.current) {
return false
if alreadyDone(check) {
// means it was already published
// protects against logic errors that might result
// in an infinite loop
log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath())
log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath())
log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath())
check.ReloadCheck()
return fmt.Errorf("already released %s", check.GetGoPath())
}
// check if the git tag already exists somehow
testtag := me.release.version.String()
if check.LocalTagExists(testtag) {
log.Info("TAG ALREADY EXISTS", testtag)
return log.Errorf("%s TAG ALREADY EXISTS %s", check.FullPath, testtag)
} else {
log.Info("TAG IS NEW", testtag)
}
if me.forge.Config.IsPrivate(me.current.GetGoPath()) {
// do not self update private repos
log.Info("This is a private repo.")
var retag [][]string
retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()})
retag = append(retag, []string{"git", "push", "origin", me.release.version.String()})
if !me.current.RunAll(retag) {
log.Info("retag failed")
findOk = false
return fmt.Errorf("RETAG FAILED %s", check.GetGoPath())
}
return skipToNext()
}
me.done = append(me.done, me.current.GetGoPath())
if err := me.forge.FinalGoDepsCheckOk(check, true); err != nil {
msg := fmt.Sprint("the go.mod file is wrong. fix it here?", check.GetGoPath())
badExit(errors.New(msg))
return fmt.Errorf("FinalGoDeps %s err %v", check.GetGoPath(), err)
}
if check.GetGoPath() == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()")
log.Info("go get must be run from somewhere else other than startRepo")
log.Info("chdir to autotypist if it exists")
msg := fmt.Sprint("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()")
badExit(errors.New(msg))
}
if !me.startRepo.Exists("go.mod") {
log.Info("go.sum missing in", me.startRepo.GetGoPath())
log.Info("pick a different repo here")
log.Info("todo: error out earlier knowing this will upgrade")
log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion())
panic("redo go.sum")
}
log.Info("\ttag and push", curName, me.release.version.String(), me.releaseReasonS)
if err := check.ValidGoSum(); err != nil {
log.Info("ValidGoSum() error", check.GetGoPath(), err)
msg := fmt.Sprint("ValidGoSum() error", check.GetGoPath(), err)
badExit(errors.New(msg))
}
// this is the final check. even here, just to be a total asshole
// I rerun go mod init and go mod tidy
// the re-parse all the results
// this is the last and final check.
// believe it or not, I've seen this fail. It's not worth being careful here
// or liberal about it. if it doesn't work, yep, you are stuck here you bastard
// (bastard being me. I designed this to be so annoying that if it makes it
// past this point it always works. that is the whole point of this code. NEVER
// EVER FAIL PAST THIS POINT
// )
// so let's do it: let's run go-mod-clean strict
// then reparse everything
_, err := check.RunVerboseOnError([]string{"go-mod-clean", "strict"})
if err != nil {
badExit(err)
}
var all [][]string
var autogen []string
all = append(all, []string{"git", "add", "-f", "go.mod"})
if me.current.Status.IsPrimitive() {
autogen = append(autogen, "go.mod")
if check.GoInfo.GoPrimitive {
// don't add go.sum here. TODO: check for go.sum file and fail
} else {
all = append(all, []string{"git", "add", "-f", "go.sum"})
autogen = append(autogen, "go.sum")
}
if ok, compiled, err := me.current.Status.IsProtobuf(); ok {
if ok, compiled, err := me.current.IsProtobuf(); ok {
log.Info("\tIsProtobuf() == true")
if err != nil {
log.Info("\tERROR: There are protobuf files, but they are not compiled")
log.Info("\tERROR: can not continue")
os.Exit(-1)
msg := fmt.Sprint("ERROR: There are protobuf files, but they are not compiled")
badExit(errors.New(msg))
}
log.Info("\tshould add the protobuf files here")
log.Info("\tcompiled files found:", compiled)
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
all = append(all, []string{"git", "add", "-f", s})
autogen = append(autogen, s)
}
} else {
log.Info("\tIsProtobuf() == false")
@ -68,16 +159,30 @@ func doRelease() bool {
all = append(all, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()})
all = append(all, []string{"git", "push", "origin", me.release.version.String()})
if !me.current.Status.DoAll(all) {
// save the autogenerated files in git metadata (aka: notes)
cname := check.GetCurrentBranchName()
if err := check.AutogenSave(autogen, cname, true); err != nil {
log.Info("AutogenSave() error", err)
msg := fmt.Sprint("AutogenSave() error", err)
badExit(errors.New(msg))
}
if !me.current.RunAll(all) {
log.Info("failed to make new release", me.release.version.String())
return false
findOk = false
return fmt.Errorf("setting findOK = false %s", check.GetGoPath())
}
log.Info("RELEASE OK")
// 'publish' the version to the golang package versioning system
if !doPublishVersion() {
log.Info("PUBLISH FAILED")
return false
time.Sleep(3 * time.Second)
// this can fail to update, try it again after sleep(3s)
if !doPublishVersion() {
log.Info("PUBLISH FAILED gopath=%s", check.GetGoPath())
findOk = false
return fmt.Errorf("PUBLISH FAILED gopath=%s", check.GetGoPath())
}
}
log.Info("PUBLISH OK")
@ -85,9 +190,10 @@ func doRelease() bool {
// unwind and re-tag. Now that the go.mod and go.sum are published, revert
// to the development branch
if !me.current.Status.RevertMasterToDevel() {
if !me.current.RevertMasterToDevel() {
log.Info("Revert Failed")
return false
findOk = false
return fmt.Errorf("REVERT FAILED %s", check.GetGoPath())
}
// update tag
@ -97,92 +203,42 @@ func doRelease() bool {
retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()})
retag = append(retag, []string{"git", "push", "origin", me.release.version.String()})
if !me.current.Status.DoAll(retag) {
if !me.current.RunAll(retag) {
log.Info("retag failed")
return false
findOk = false
return fmt.Errorf("RETAG FAILED %s", check.GetGoPath())
}
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath())
// update the values in the GUI
me.current.NewScan()
// attempt to find another repo to release
if !doReleaseFindNext() {
log.Info("doReleaseFindNext() could not find a new")
return false
}
log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.Name())
return true
}
func checkValidGoSum(repo *repolist.RepoRow) bool {
ok, err := me.repos.View.CheckValidGoSum(repo)
if err != nil {
log.Info("go mod tidy not ok", err)
return false
}
if ok {
log.Info("repo has go.sum requirements that are clean")
// me.current.setGoSumStatus("CLEAN")
me.release.status.SetValue("GOOD")
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
return true
}
me.release.notes.SetValue("CheckValidGoSum() failed")
return false
}
// try to figure out if there is another package to update
func doReleaseFindNext() bool {
// scan for new repo
if findNext() {
log.Info("findNext() found something")
} else {
log.Info("findNext() could not find anything")
return false
}
if checkValidGoSum(me.current) {
return true
}
return false
return nil
}
// this pulls the new tag from the golang package repository
// to insert the new version
func doPublishVersion() bool {
gopath := me.current.GoPath()
gopath := me.current.GetGoPath()
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
log.Info("SHOULD RUN cmd HERE:", docmd)
// right now, you can't publish this because the go.* files in this project are screwed up
if me.release.guireleaser == nil {
log.Info("CAN NOT SELF UPDATE HERE. cmd =", docmd)
return false
}
homeDir, _ := os.UserHomeDir()
gosum := filepath.Join(homeDir, "go/src/go.wit.com/apps/guireleaser/go.sum")
if !shell.Exists(gosum) {
log.Info("go.sum must exist here")
me.release.guireleaser.Status.MakeRedomod()
}
if me.current.Status.IsPrivate() {
if me.forge.Config.IsPrivate(me.current.GetGoPath()) {
// do not self update private repos
log.Info("This is a private repo and can not be self checked")
return true
}
// try to pull from google
var result cmd.Status
if gopath == "go.wit.com/apps/guireleaser" {
if gopath == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
log.Info("go get must be run from somewhere else other than guireleaser")
result = shell.PathRun("/home/jcarr/go/src/go.wit.com/apps/autotypist", docmd)
} else {
// publish go.mod & go.sum for use with go
os.Unsetenv("GO111MODULE")
log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
result = me.release.guireleaser.Status.Run(docmd)
log.Info("go get must be run from somewhere else other than startRepo")
log.Info("chdir to autotypist if it exists")
msg := fmt.Sprint("CAN NOT SELF UPDATE. cmd =", docmd)
badExit(errors.New(msg))
}
// publish go.mod & go.sum for use with go
os.Unsetenv("GO111MODULE")
log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
result := me.startRepo.Run(docmd)
if result.Error != nil {
log.Info("SELF UPDATE FAILED. error =", result.Error)
log.Info("SELF UPDATE FAILED. exit =", result.Exit)
@ -197,7 +253,7 @@ func doPublishVersion() bool {
log.Info("SELF UPDATE FAILED")
return false
}
log.Info("SELF UPDATE OK. out =", result.Stdout)
log.Info("SELF UPDATE OK. out =", strings.Join(result.Stdout, "\n"))
log.Info("SELF UPDATE WORKED")
return true
}

19
exit.go Normal file
View File

@ -0,0 +1,19 @@
package main
import (
"os"
"go.wit.com/log"
)
func okExit(thing string) {
log.Info(thing, "ok")
// log.Info("Finished go-clean on", check.GetNamespace(), "ok")
me.forge.Exit()
os.Exit(0)
}
func badExit(err error) {
log.Info("forge failed: ", err, me.forge.Config.ReposDir)
os.Exit(-1)
}

167
findNext.go Normal file
View File

@ -0,0 +1,167 @@
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
"go.wit.com/log"
"go.wit.com/lib/protobuf/gitpb"
)
var findCounter int
var findFix bool = false
var findOk bool = true
func checkDeps(repo *gitpb.Repo) error {
if repo.GoDeps == nil {
return fmt.Errorf("%s has GoDeps == nil", repo.GetNamespace())
}
for dep := range repo.GoDeps.IterAll() {
// log.Info(repo.GetNamespace(), dep.GoPath, dep.Version)
// check if the package in question is waiting for another package to publish
found := me.forge.FindByGoPath(dep.GoPath)
if found == nil {
return fmt.Errorf("%s has dep == nil", repo.GetNamespace(), dep.GoPath)
}
// loop through all the repos that need to be published with new go versions
all := me.found.SortByFullPath()
for all.Scan() {
check := all.Next()
if found.GetNamespace() == check.GetNamespace() {
// this package is waiting on other packages to publish
return fmt.Errorf("%s is waiting on %s", repo.GetNamespace(), found.GetNamespace())
}
}
// found package isn't being published. is the version correct?
// never check this? we are done?
/*
if found.GetLastTag() == dep.Version {
// everything is normal
} else {
return fmt.Errorf("%s version mismatch on %s (%s vs %s)", repo.GetNamespace(), found.GetNamespace(), found.GetLastTag(), dep.Version)
}
*/
}
// everything might be cool?
return nil
}
// trys to figure out if there is still something to update
// todo: redo this logic as it is terrible
// rename this findNext()
func findNext() bool {
findCounter = 0
all := me.found.SortByFullPath()
for all.Scan() {
check := all.Next()
if check.GetMasterBranchName() != check.GetCurrentBranchName() {
log.Info("YOU MUST BE ON THE MASTER BRANCH", check.GetNamespace())
continue
}
if check.IsDirty() {
log.Info("CAN NOT RELEASE DIRTY REPO", check.GetNamespace())
continue
}
if alreadyDone(check) {
log.Info("findNext() alreadyDone. WHY IS THIS STILL CHECKING?", check.GetNamespace())
continue
}
log.Info("CHECKING START:", check.GetNamespace())
if me.forge.Config.IsPrivate(check.GetNamespace()) {
log.Info("GOOD TO GO ON PRIVATE REPO", check.GetNamespace())
setCurrentRepo(check, "should be good to release", "pretty sure")
return true
}
godepsNew, err := check.GoSumFromRepo()
if err != nil {
log.Info("CHECKING go deps from repo failed", err)
continue
}
if godepsNew == nil {
// don't check godepsNew, but check to make sure go mod tidy actually ran without error
os.Unsetenv("GO111MODULE")
cmd := []string{"go", "mod", "tidy"}
err := check.RunVerbose(cmd)
if err != nil {
log.Info("go mod tidy failed. this go package needs to be examined by hand as it doesn't appear to be primitive")
os.Exit(-1)
}
// if godepsNew == nil, then this go package is a primitive and there is no go.sum file
} else {
if err := testGoDepsCheckOk(godepsNew, argv.Verbose); err != nil {
log.Info("CHECKING current repo deps failed", err)
continue
}
}
if err := me.forge.FinalGoDepsCheckOk(check, argv.Verbose); err != nil {
// if err := me.forge.FinalGoDepsCheckOk(check, false); err != nil {
log.Info("FinalGoDepsCheckOk() repo=", check.GetNamespace(), "err:", err)
log.Info("CHECKING END:", check.GetNamespace())
log.Info("")
continue
}
log.Info("GOOD TO GO ON", check.GetNamespace())
setCurrentRepo(check, "should be good to release", "pretty sure")
return true
}
if findCounter == 0 {
log.Info("NOTHING TO UPDATE. findCounter =", findCounter, "found len =", me.found.Len())
if me.found.Len() == 0 {
printDone()
okExit("")
}
} else {
log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix)
}
log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix)
setCurrentRepo(nil, "findNext found nothing", "crap")
me.release.status.SetText("ALL DONE?")
return false
}
func setCurrentRepo(check *gitpb.Repo, s string, note string) bool {
me.current = check
if check == nil {
me.release.repo.SetText("")
me.release.version.SetText("")
me.release.releaseVersionB.SetText("nope")
me.release.version.SetText("badver")
} else {
me.release.repo.SetText(check.GetNamespace())
me.release.version.SetText(check.GetTargetVersion())
me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion())
me.release.version.SetText(check.GetTargetVersion())
}
me.release.status.SetText(s)
me.release.notes.SetText(note)
// me.release.openrepo.Enable()
return true
}
func testGoDepsCheckOk(godeps *gitpb.GoDeps, verbose bool) error {
if godeps == nil {
return errors.New("testGoDepsCheckOk() godeps == nil")
}
all := godeps.SortByGoPath()
for all.Scan() {
depRepo := all.Next()
fullpath := filepath.Join(me.forge.Config.ReposDir, depRepo.GoPath)
found := me.found.FindByFullPath(fullpath)
if found == nil {
continue
}
return fmt.Errorf("dep is being upgraded %s", depRepo.GoPath)
}
return nil
}

View File

@ -1,13 +1,9 @@
package main
import (
"os"
"strings"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
)
func globalDisplayOptions(box *gui.Node) {
@ -15,219 +11,33 @@ func globalDisplayOptions(box *gui.Node) {
group1 := vbox.NewGroup("Global Display Options")
hidegrid := group1.NewGrid("hidecfg", 0, 0)
hidegrid.NewButton("Show Repository Window", func() {
if me.repos.Hidden() {
me.repos.Show()
} else {
me.repos.Hide()
}
log.Info("showing reposwin")
})
hidegrid.NextRow()
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() {
os.Setenv("AUTOTYPIST_READONLY", "hide")
} else {
os.Unsetenv("AUTOTYPIST_READONLY")
}
}
os.Setenv("AUTOTYPIST_READONLY", "hide")
hidegrid.NextRow()
me.autoHideReleased = hidegrid.NewCheckbox("Hide Released repos").SetChecked(true)
hidegrid.NextRow()
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
hidegrid.NextRow()
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
me.scanEveryMinute.Custom = func() {
if me.scanEveryMinute.Checked() {
os.Setenv("REPO_AUTO_SCAN", "true")
log.Info("env REPO_AUTO_SCAN=", os.Getenv("REPO_AUTO_SCAN"))
} else {
os.Unsetenv("REPO_AUTO_SCAN")
log.Info("env REPO_AUTO_SCAN=", os.Getenv("REPO_AUTO_SCAN"))
}
}
hidegrid.NewButton("scan now", func() {
log.Info("re-scanning repos now")
i, s := me.repos.View.ScanRepositories()
log.Info("re-scanning repos done", i, s)
// me.duration.SetText(s)
})
me.duration = me.repos.View.MirrorScanDuration()
hidegrid.Append(me.duration)
hidegrid.NextRow()
/*
hidegrid := group1.NewGrid("hidecfg", 0, 0)
hidegrid.NewButton("Show Repository Window", func() {
if me.repos.Hidden() {
me.repos.Show()
} else {
me.repos.Hide()
}
log.Info("showing reposwin")
})
hidegrid.NextRow()
*/
group1 = vbox.NewGroup("prep for release")
grid := group1.RawGrid()
var longB *gui.Node
longB = grid.NewButton("generate go.sum files", func() {
me.Disable()
var worked bool = true
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
ok, err := me.repos.View.CheckValidGoSum(repo)
if !ok {
log.Info("redo go.sum failed on", repo.GoPath(), err)
worked = false
}
}
log.Info("redo go.sum finished with", worked)
me.Enable()
longB.SetLabel("go.sum files created")
if worked {
longB.Disable()
}
})
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
me.Disable()
defer me.Enable()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
}
grid.NewButton("make prepare-release", func() {
rePrepareRelease()
})
grid.NextRow()
var incrementTags *gui.Node
incrementTags = grid.NewButton("increment tags", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
if repo.ReadOnly() {
continue
}
lasttag := repo.LastTag()
masterv := repo.Status.GetMasterVersion()
targetv := repo.Status.GetTargetVersion()
if lasttag == masterv {
// nothing to do if curv == masterv
// unless go.sum depends on changed repos
if targetv != lasttag {
log.Info(repo.GoPath(), "trigger a new release?", targetv, lasttag)
// repo.Status.SetVersion("0", "21", "0", me.releaseReasonS)
repo.Status.IncrementMinorVersion(me.releaseReasonS)
}
continue
}
newversion := repo.Status.GetNewVersionTag()
if newversion == targetv {
log.Info(repo.GoPath(), "targetv has been increased already to", targetv)
continue
}
if masterv != targetv {
log.Info(repo.GoPath(), "master and target differ", masterv, targetv)
repo.Status.IncrementVersion()
newversion := repo.Status.GetNewVersionTag()
repo.Status.SetTargetVersion("v" + newversion)
// already incremented
continue
}
}
if findNext() {
log.Info("findNext() found a repo")
}
incrementTags.SetText("maybe ready?")
me.Enable()
})
grid.NewButton("increment minor version", func() {
// this is messy still. if the release process fails, it needs to continue
// for now, use the "go.wit.com/log" release minor number as the official
// release. If it hasn't been updated yet, then start there
logrepo := me.repos.View.FindRepo("go.wit.com/log")
if logrepo == nil {
log.Info("couldn't find go.wit.com/log")
return
}
releasev := logrepo.Status.LastTag()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
if repo.ReadOnly() {
continue
}
if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev") {
continue
}
if strings.HasPrefix(repo.GoPath(), "go.wit.com/widget") {
// widget I versioned early before I knew what the hell this would mean and can
// not be down versioned because that's not how GO versioning works. Once you
// set the version for a path, it's set in stone forever. (smart system!)
// we could rename go.wit.com/widget to go.wit.com/newwidget and restart the versioning
// system, but that's rediculous and this servers to always remind me to never make this mistake again
repo.Status.IncrementRevisionVersion("trying minor")
continue
}
if releasev == repo.Status.LastTag() {
log.Info("skipping already released repo", repo.Status.GoPath())
repo.Status.SetTargetVersion(releasev)
continue
}
// repo.Status.SetVersion("0", "22", "0", "trying increment minor")
repo.Status.IncrementMinorVersion("trying minor")
}
})
grid.NewButton("increment changed repos", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
if repo.ReadOnly() {
continue
}
lasttag := repo.Status.LastTag()
if repo.Status.GetCurrentVersion() == lasttag {
log.Info("skipping unchanged repo", repo.Status.GoPath())
repo.Status.SetTargetVersion(lasttag)
continue
}
repo.Status.IncrementRevisionVersion("go-clone")
}
me.repos.View.ScanRepositories()
me.Enable()
})
grid.NextRow()
group2 := vbox.NewGroup("Debugger")
dbggrid := group2.NewGrid("gdb", 0, 0)
dbggrid.NewButton("logging Window", func() {
grid.NewButton("logging Window", func() {
logsettings.LogWindow()
})
dbggrid.NextRow()
grid.NextRow()
dbggrid.NewButton("Debugger Window", func() {
grid.NewButton("Debugger Window", func() {
debugger.DebugWindow()
})
}
func hidePerfect() {
for _, repo := range me.repos.View.AllRepos() {
if repo.State() == "PERFECT" {
if repo.Hidden() {
continue
}
repo.Hide()
// return
}
}
}

View File

@ -1,78 +0,0 @@
package main
import (
"os"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
// like tcl/tk, use ENV variables to set display preferences
func hideFunction(r *repolist.RepoRow) {
if r.GoPath() == "go.wit.com/dev/alexflint/arg" {
log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
log.Info("found alexflint/arg IsReleased() =", r.Status.IsReleased())
}
// always show dirty repos
if r.Status.IsDirty() {
r.Show()
return
}
// always show repos that have not been merged ?
// if r.GoState() == "merge to devel" {
// r.Show()
// return
// }
// hide read-only repos
if os.Getenv("AUTOTYPIST_READONLY") == "hide" {
if r.Status.ReadOnly() {
// log.Info(r.Name(), "hiding read-only repo")
r.Hide()
return
} else {
// log.Info(r.Name(), "not hiding read-only repo")
}
}
// show repos with mismatched mode
// this means, if you are in "devel" mode, show all the repos that
// might be stuck on the wrong branch, like 'master' or '<username>'
if os.Getenv("AUTOTYPIST_MODE") != "" {
if !r.Status.IsCorrectMode(os.Getenv("AUTOTYPIST_MODE")) {
r.Show()
return
}
}
if me.autoHideReleased.Checked() {
if r.Status.IsReleased() {
r.Hide()
return
}
}
// show everything else. often this will be "unconforming" repos
// if you what those repos ignored, add these to the config file
// as read-only=true
r.Show()
}
/*
func showHideRepos(repo *repolist.RepoRow) {
if repo.GoPath() == "go.wit.com/dev/alexflint/arg" {
log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
log.Info("found alexflint/arg IsReleased() =", repo.Status.IsReleased())
}
if me.autoHideReleased.Checked() {
if repo.Status.IsReleased() {
repo.Hide()
return
}
}
repo.Show()
}
*/

198
http.go
View File

@ -4,9 +4,10 @@ import (
"fmt"
"net/http"
"os"
"path/filepath"
"strings"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@ -26,10 +27,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
repoName := r.URL.Query().Get("repo")
version := r.URL.Query().Get("version")
comment := r.URL.Query().Get("comment")
readonly := r.URL.Query().Get("readonly")
onlydirty := r.URL.Query().Get("onlydirty")
perfect := r.URL.Query().Get("perfect")
whitelist := r.URL.Query().Get("whitelist")
switch route {
case "/help":
@ -47,18 +44,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("")
log.Info("setVersion?repo=go.wit.com/gui?target=0.2 attempts to set the target version to 0.2")
log.Info("")
case "/tempWin":
tempWin := makeTempView()
loop := me.repos.View.UnmergedRepos()
for loop.Scan() {
repo := loop.Repo()
tempWin.View.ShowRepo(repo)
log.Info("UnmergedRepo: " + repo.Name())
}
case "/doRelease":
buttonDisable()
if doRelease() {
if err := doRelease(); err == nil {
buttonEnable()
log.Info("doRelease() worked")
} else {
@ -82,185 +70,59 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
log.Info(me.current.StandardHeader())
log.Info(me.current.StandardReleaseHeader())
case "/rescanAll":
me.repos.View.ScanRepositories()
// log.Info(me.current.StandardHeader())
log.Info(me.forge.StandardReleaseHeader(me.current, "todoing"))
case "/setCurrentRepo":
log.Info("repo: " + repoName)
log.Info("version: " + version)
log.Info("comment: " + comment)
repo := me.repos.View.FindRepoByName(repoName)
repo := me.forge.FindByGoPath(repoName)
if repo == nil {
log.Info("FindRepoByName() returned nil")
return
}
setCurrentRepo(repo, "HTTP", "doRelease() ?")
case "/IncrementRevisonVersion":
log.Info("repo: " + repoName)
log.Info("version: " + version)
me.current.Status.IncrementRevisionVersion(comment)
case "/IncrementMinorVersion":
log.Info("repo: " + repoName)
log.Info("version: " + version)
me.current.Status.IncrementMinorVersion("trying minor")
case "/setAllBranchesToMaster":
log.Info("set all branches to master")
me.Disable()
defer me.Enable()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
}
return
case "/setTargetVersion":
log.Info("repo: " + repoName)
log.Info("version: " + version)
if me.current == nil {
log.Info("me.current == nil")
return
}
me.current.Status.SetTargetVersion(version)
case "/setAllTargetVersions":
log.Info("version: " + version)
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
master := repo.Status.GetMasterVersion()
lastTag := repo.Status.LastTag()
if master == lastTag {
repo.Status.SetTargetVersion(master)
} else {
repo.Status.IncrementRevisionVersion("Nov 2024 test")
}
}
case "/whitelist":
repo := me.repos.View.FindRepoByName(repoName)
if repo == nil {
log.Info("FindRepoByName() returned nil")
return
}
log.Info("whitelisted " + repo.Name())
if whitelist == "false" {
repo.Status.Whitelist = false
} else {
repo.Status.Whitelist = true
}
case "/showNext":
log.Info("gui repo: " + me.release.repo.String())
log.Info("gui name: " + me.release.version.String())
log.Info("gui notes: " + me.release.notes.String())
log.Info("gui status: " + me.release.status.String())
log.Info("")
if me.current == nil {
log.Info("me.current == nil")
check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil {
log.Info("boo, current is missing", me.current.GetGoPath())
return
}
if checkValidGoSum(me.current) {
log.Info("checkValidGoSum() == true")
} else {
log.Info("checkValidGoSum() == false SHOULD NOT RELEASE THIS")
}
if me.current.Status.IsReleased() {
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
} else {
log.Info("IsReleased() == false")
}
if me.current.Status.CheckDirty() {
log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS")
} else {
log.Info("CheckDirty() == false")
}
if me.current.Status.IsPrimitive() {
log.Info("IsPrimitive() == true")
} else {
log.Info("IsPrimitive() == false")
}
if me.current.Status.IsPrivate() {
log.Info("IsPrivate() == true")
} else {
log.Info("IsPrivate() == false")
}
if ok, compiled, err := me.current.Status.IsProtobuf(); ok {
log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
os.Exit(-1)
}
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
}
} else {
log.Info("IsProtobuf() == false")
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
}
}
if me.current.Status.Whitelist {
log.Info("Whitelist == true SHOULD NOT RELEASE THIS")
} else {
log.Info("Whitelist == false")
}
log.Info("")
log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader())
log.Info("")
log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader())
testGoRepo(check)
me.forge.HumanPrintRepo(check)
log.Info("upgrade reason:", me.reason[check])
return
case "/list":
me.repos.View.PrintReport(readonly, onlydirty, perfect)
me.forge.PrintHumanTable(me.found)
return
case "/releaseList":
me.repos.View.PrintReleaseReport(readonly, perfect)
case "/quit":
log.Info("Got URL /quit")
os.Exit(0)
case "/goweblist":
loop := me.repos.View.ReposAll()
for loop.Scan() {
repo := loop.Repo()
lastTag := repo.LastTag()
tag := repo.Status.NewestTag()
gitAge, err := tag.GetDate()
if err != nil {
log.Info(fmt.Sprintf("tag date error", repo.Name()))
}
// if lastTag == "" {
// lastTag = tag.Name()
// }
if repo.ReadOnly() {
if readonly == "true" {
continue
}
}
// dur := time.Since(gitAge)
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
/*
for _, tag := range repo.Tags.ListAll() {
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
}
*/
}
me.forge.PrintHumanTable(me.found)
return
default:
log.Info("BAD URL = " + route)
}
}
func testGoRepo(check *gitpb.Repo) {
data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod"))
log.Info(string(data))
if err := me.forge.FinalGoDepsCheckOk(check, true); err == nil {
log.Info("forge.FinalGoDepsCheck(check) worked!")
} else {
log.Info("forge.FinalGoDepsCheck(check) failed. boo.")
}
}
// starts and sits waiting for HTTP requests
func startHTTP() {
http.HandleFunc("/", okHandler)
p := fmt.Sprintf(":%d", myargs.Port)
p := fmt.Sprintf(":%d", argv.Port)
log.Println("Running on port", p)
err := http.ListenAndServe(p, nil)

View File

@ -1,35 +0,0 @@
package main
// this initializes the repos
import (
"strings"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
func (r *repoWindow) initRepoList() {
r.View.InitRepoList(".config/guireleaser")
log.Info("scanning everything in ~/go/src")
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
path = strings.TrimPrefix(path, me.goSrcPwd.String())
path = strings.Trim(path, "/")
log.Info("addRepo()", i, path)
r.View.NewRepo(path)
}
}
func (r *repoWindow) tmpRepoList() {
log.Info("scanning everything in ~/go/src")
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
path = strings.TrimPrefix(path, me.goSrcPwd.String())
path = strings.Trim(path, "/")
log.Info("addRepo()", i, path)
r.View.NewRepo(path)
}
}

167
main.go
View File

@ -2,35 +2,49 @@ package main
import (
"embed"
"errors"
"fmt"
"os"
"path/filepath"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
var VERSION string
var ARGNAME string = "guireleaser"
//go:embed resources/*
var resources embed.FS
var myargs argv
var argv args
func main() {
me = new(autoType)
prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv)
me.myGui = prep.Gui() // prepares the GUI package for go-args
me.pp = arg.MustParse(&argv)
// parse the command line
arg.MustParse(&myargs)
me.forge = forgepb.Init()
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
me.found = new(gitpb.Repos)
fhelp.CheckGoModCleanExit()
// me.forge.ConfigPrintTable()
os.Setenv("REPO_WORK_PATH", me.forge.Config.ReposDir)
// save the ENV var here
me.releaseReasonS = os.Getenv("GUIRELEASE_REASON")
if me.releaseReasonS == "" {
log.Info("shell ENV GUIRELEASE_REASON not set")
os.Exit(0)
badExit(errors.New("shell ENV GUIRELEASE_REASON not set"))
}
// unset the go development ENV var to generate release files
@ -38,16 +52,20 @@ func main() {
// user drops to a shell or xterm, then they shouldn't be set there either
os.Unsetenv("GO111MODULE")
me.myGui = gui.New()
me.myGui.InitEmbed(resources)
me.myGui.Default()
me.myGui.Start() // loads the GUI toolkit
// our main window
me.mainWindow = me.myGui.NewWindow("GUI release manager " + VERSION)
me.mainBox = me.mainWindow.NewBox("bw hbox", true)
me.mainWindow = gadgets.RawBasicWindow("GUI release manager " + VERSION)
me.mainWindow.Custom = func() {
log.Warn("Window closed. forge configsave")
// sets the hidden flag to false so Toggle() works
me.forge.ConfigSave()
okExit("")
}
me.mainWindow.Make()
me.mainWindow.Show()
// start the http server for polling status
go startHTTP()
me.mainBox = me.mainWindow.Box()
// sanity check of things that might be around that mess
// up things later
@ -56,109 +74,58 @@ func main() {
homeDir, _ := os.UserHomeDir()
gowork := filepath.Join(homeDir, "go/src/go.work")
if shell.Exists(gowork) {
log.Info("go.work must be deleted")
os.Exit(0)
}
// sanity check of things that might be around that mess
// up things later
// check to make sure we have a go.sum here
gosum := filepath.Join(homeDir, "go/src/go.wit.com/apps/guireleaser/go.sum")
if !shell.Exists(gosum) {
log.Info("go.sum must exist here")
os.Exit(0)
badExit(errors.New("go.work must be deleted"))
}
log.Info("Creating the Release Window")
// initialize the repo list window
// which should be all the git repositories in ~/go/src & the .config file
me.repos = makeRepoView()
if myargs.DumpVersions {
gowit.DumpVersions(me.repos.View)
os.Exit(0)
}
// the left side of the window options
globalDisplayOptions(me.mainBox)
// create the right side of the main window
createReleaseBox(me.mainBox)
// disable the open repo button. this isn't really important
// but does indicates the app (and toolkit) is working
// this can be removed later, but in these early days, I'm using this
// tool to release the code for this app, the gui and the gui toolkits
// and sometimes they lie, don't display stuff, don't even disable things
// so I can't trust even what I see. It's complicated right now still.
me.release.openrepo.Disable()
// disable the gui until the repos are scanned
me.release.box.Disable()
me.Disable()
// parse config file and scan for .git repos
me.repos.initRepoList()
// setTargetVersion()
// todo: add this to forgepb
me.startRepo = me.forge.FindWorkingDirRepo()
// register a Show/Hide function for the repo list table
me.repos.View.RegisterHideFunction(hideFunction)
// scan in the State of all the repos
// TODO: should not really be necessary directly after init()
me.repos.View.ScanRepositories()
// the repo from the command line
// var myrepo *repolist.RepoRow
// find myself. the guireleaser directory is used as a working scratchpad
// for running go commands that can mess up the go.* files
for _, repo := range me.repos.View.AllRepos() {
if repo.GoPath() == "go.wit.com/apps/guireleaser" {
if me.release.guireleaser == nil {
me.release.guireleaser = repo
}
if _, count, _, err := me.forge.IsEverythingOnMaster(); err != nil {
log.Info("not everything is on the master branch (", count, "repos)")
if argv.Quick != nil {
// quick also means ignore the master branch check
argv.Force = true
}
if !argv.Force {
os.Exit(-1)
}
/*
if repo.GoPath() == myargs.Repo {
myrepo = repo
}
*/
}
if me.release.guireleaser == nil {
log.Info("Can not release if guireleaser was not found")
os.Exit(0)
if me.startRepo == nil {
pwd, _ := os.Getwd()
msg := fmt.Sprint("Can not run if pwd is not a repo", pwd)
badExit(errors.New(msg))
}
me.forge.RillFuncError(rillPurge)
// run this each time something gets published successfully
rePrepareRelease()
if findNext() {
log.Info("prepare release findNext() returned true")
} else {
// check if nothing is found an exit?
if me.found.Len() == 0 {
log.Info("nothing found to publish")
okExit("found nothing")
}
}
me.Enable()
me.release.box.Enable()
// intermittently scans the status indefinitly
me.repos.View.Watchdog(func() {
log.Info("In main()")
// processing is done. update the repo summary box
// me.summary.Update()
})
}
// start the initail scan and make sure each repo is set
// to the master branch
func setAllBranchesToMaster() bool {
var worked bool = true
for _, repo := range me.repos.View.AllRepos() {
if repo.ReadOnly() {
continue
}
if repo.IsDirty() {
continue
}
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.CheckoutMaster() {
log.Warn("git checkout master branch worked", repo.Name())
} else {
log.Warn("git checkout master branch failed", repo.Name())
worked = false
}
// repo.NewScan()
}
return worked
// start the http server for polling status
startHTTP()
}

View File

@ -1,71 +0,0 @@
package main
import (
"go.wit.com/log"
)
func mergeAllDevelToMain() bool {
log.Info("merge all here")
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() {
log.Info("skipping readonly", repo.Name(), repo.State())
continue
}
if repo.State() != "merge to main" {
log.Info("skipping. not merge to main", repo.Name(), repo.State())
continue
}
if repo.CheckDirty() {
log.Info("skipping dirty", repo.Name(), repo.State())
continue
}
log.Info("found", repo.Name(), repo.State())
repo.NewScan()
if repo.Status.MergeDevelToMaster() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("last repo:", repo.Name())
log.Warn("THINGS FAILED fullAutomation() returned false")
return false
}
repo.NewScan()
}
log.Warn("EVERYTHING WORKED")
return true
}
func mergeAllUserToDevel() bool {
log.Info("merge all here")
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() {
log.Info("skipping readonly", repo.Name(), repo.State())
continue
}
if repo.State() != "merge to devel" {
log.Info("skipping. not merge to devel", repo.Name(), repo.State())
continue
}
if repo.CheckDirty() {
log.Info("skipping dirty", repo.Name(), repo.State())
continue
}
log.Info("found", repo.Name(), repo.State())
repo.NewScan()
if repo.Status.MergeUserToDevel() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("last repo:", repo.Status.Path())
log.Warn("THINGS FAILED fullAutomation() returned false")
return false
}
repo.NewScan()
}
log.Warn("EVERYTHING WORKED")
return true
}

297
prepareRelease.go Normal file
View File

@ -0,0 +1,297 @@
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
"time"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func forceReleaseVersion(repo *gitpb.Repo) {
if argv.Minor {
// if v1.2.3 change to v.1.3.0
repo.IncrementTargetMinor()
} else {
// if v1.2.3 change to v.1.2.4
repo.IncrementTargetRevision()
}
}
func checkpkgcache(repo *gitpb.Repo) error {
homedir, err := os.UserHomeDir()
if err != nil {
return err
}
rver := repo.GetLastTag()
if rver == "" {
return errors.New("could not get master version")
}
moddir := filepath.Join(homedir, "go/pkg/mod", repo.GetGoPath()+"@"+rver)
if shell.IsDir(moddir) {
return nil
}
getpath := repo.GetGoPath() + "@" + repo.GetLastTag()
log.Infof("~/go/pkg/mod/ IS MISSING %s so I'm running go get here.", getpath)
_, err = me.startRepo.RunVerboseOnError([]string{"go", "get", getpath})
return err
}
var rillcount int
func rillPurge(repo *gitpb.Repo) error {
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
return nil
}
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
return nil
}
_, err := repo.RunQuiet([]string{"go-mod-clean", "purge"})
rillcount += 1
if err != nil {
log.Info("go-mod-clean purge failed", repo.GetGoPath(), err)
return err
}
return nil
}
func rillRestore(repo *gitpb.Repo) error {
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
return nil
}
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
return nil
}
var err error
if argv.Verbose {
log.Info("go-mod-clean lax START", repo.GetGoPath())
result := repo.RunRealtime([]string{"go-mod-clean", "lax"})
log.Info("go-mod-clean lax END", repo.GetGoPath())
if result.Exit != 0 {
err = fmt.Errorf("repo %s failed %d", repo.GetGoPath(), result.Exit)
}
} else {
_, err = repo.RunQuiet([]string{"go-mod-clean", "lax"})
}
rillcount += 1
if err != nil {
log.Info("go-mod-clean lax failed", repo.GetGoPath(), err)
return err
}
return nil
}
func rePrepareRelease() {
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
me.found = new(gitpb.Repos)
me.reason = make(map[*gitpb.Repo]string) // stores the reason repos need to be versioned & released
log.Printf("rePrepareRelease() START rill go-mod-clean lax (11 seconds?)")
rillcount = 0
forgepb.RillX = 2
forgepb.RillY = 2
now := time.Now()
me.forge.RillFuncError(rillRestore)
log.Printf("showRestore() (%d total repos) took:%s\n", rillcount, shell.FormatDuration(time.Since(now)))
log.Sleep(1)
all2 := me.forge.Repos.SortByFullPath()
for all2.Scan() {
check := all2.Next()
if me.forge.Config.IsReadOnly(check.GetGoPath()) {
continue
}
if me.forge.Config.IsPrivate(check.GetGoPath()) {
continue
}
// this should be rare? nonexistant?
if err := checkpkgcache(check); err != nil {
log.Info("go get checks failed here.", err, check.GetGoPath())
}
}
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
check := all.Next()
if alreadyDone(check) {
// means it was already published
// protects against logic errors that might result
// in an infinite loop
log.Info("WARNING alreadyDone rePrepareRelease()", check.GetGoPath())
continue
}
if me.forge.Config.IsReadOnly(check.GetGoPath()) {
// can't release readonly repos
continue
}
master := check.GetMasterVersion()
lastTag := check.GetLastTag()
if argv.Quick != nil {
// if argv has 'quick' don't do anything
// that doesn't actually have a patch
if master == lastTag {
continue
}
}
log.Info("LAST TAG", check.FullPath, master, lastTag)
// this is detailed. It makes sure the go.* files are absolutely perfect
if !me.forge.Config.IsPrivate(check.GetGoPath()) {
if err := checkPublishedGodeps(check); err != nil {
// this means the published godeps are no longer up to date
forceReleaseVersion(check)
me.found.AppendByFullPath(check)
log.Info("checkPublishedGodeps failed with err", check.GetGoPath(), err)
continue
} else {
// log.Info("checkPublishedGodeps is ok", check.GetGoPath())
}
}
// if master != lastTag, always increment
if master != lastTag {
newmhash := check.GetTagHash(master)
oldlhash := check.GetTagHash(lastTag)
if newmhash == oldlhash {
// they are actually equal
continue
}
b1 := check.CountDiffObjects(oldlhash, newmhash)
b2 := check.CountDiffObjects(newmhash, oldlhash)
if b1 != 0 {
log.Printf("HASH ERROR %-50s tag %s < %s\n", check.GetGoPath(), newmhash, oldlhash)
log.Info("old vs new count", b1, b2, "git merge", oldlhash)
}
if b1 == 0 && b2 == 0 {
log.Info("got to identical repo", check.GetGoPath(), b1, b2)
log.Info("got to identical repo", check.GetGoPath(), oldlhash, newmhash)
// actually identical. do nothing
continue
}
if gitpb.IsGoTagVersionGreater(lastTag, master) {
// this function is not right really. the hash error above should catch it correctly
// log.Printf("PROBABLY NOT NEE %-50s tag %s < %s\n", check.GetGoPath(), lastTag, master)
}
log.Printf("NEED RELEASE FOR %-50s tag %s != %s\n", check.GetGoPath(), master, lastTag)
forceReleaseVersion(check)
me.found.AppendByFullPath(check)
me.reason[check] = "master != lastTag"
continue
}
if me.forge.Config.IsPrivate(check.GetGoPath()) {
// only checks after this are GO dep related which don't matter for private repos
continue
}
if argv.Protobuf && check.GetRepoType() == "protobuf" {
log.Printf("NEED RELEASE FOR %s err: %v\n", check.GetGoPath(), "because --protobuf")
// if --protobuf, this will force upgrade each one
forceReleaseVersion(check)
me.found.AppendByFullPath(check)
me.reason[check] = "protobuf repo deps changed"
continue
}
// if the repo is a go binary or plugin for a new release for
// any library version change
// if check.GetRepoType() == "binary" || check.GetRepoType() == "plugin" {
// check if the package dependancies changed, if so, re-publish
if err := me.forge.FinalGoDepsCheckOk(check, false); err == nil {
// log.Printf("go.sum is perfect! %s\n", check.GetGoPath())
continue
} else {
log.Printf("NEED RELEASE FOR %-50s err: %v\n", check.GetGoPath(), err)
forceReleaseVersion(check)
me.found.AppendByFullPath(check)
me.reason[check] = "FinalGoDepsCheckOk() failed even though master tag == last tag"
}
}
me.forge.PrintHumanTable(me.found)
// todo: verify each found repo is on the master branch
for repo := range me.found.IterAll() {
if repo.CurrentBranchName != repo.MasterBranchName {
log.Info("repo not on master branch", repo.FullPath)
if !argv.Force {
os.Exit(-1)
}
}
}
}
func printDone() {
for _, gopath := range me.done {
log.Info("printDone() THESE WERE PUBLISHED", gopath)
}
log.Info("printDone() total finished so far:", len(me.done))
time.Sleep(time.Second)
}
func alreadyDone(repo *gitpb.Repo) bool {
for _, gopath := range me.done {
// log.Info("WARNING already done", gopath, repo.GetGoPath())
// log.Info("WARNING already done", gopath, repo.GetGoPath())
// log.Info("WARNING already done", gopath, repo.GetGoPath())
if repo.GetGoPath() == gopath {
log.Info("FOUND. RETURN TRUE. already done", gopath, repo.GetGoPath())
return true
}
}
return false
}
/*
func upgradeReason(repo *gitpb.Repo) string {
for _, gopath := range me.reason {
// log.Info("WARNING already done", gopath, repo.GetGoPath())
// log.Info("WARNING already done", gopath, repo.GetGoPath())
// log.Info("WARNING already done", gopath, repo.GetGoPath())
if repo.GetGoPath() == gopath {
log.Info("FOUND. RETURN TRUE. already done", gopath, repo.GetGoPath())
return true
}
}
return false
}
*/
func checkPublishedGodeps(repo *gitpb.Repo) error {
godepsOld, err := repo.GoSumFromPkgDir()
if err != nil {
return err
}
if godepsOld != nil {
if err := me.forge.TestGoDepsCheckOk(godepsOld, argv.Verbose); err != nil {
return err
}
}
godepsNew, err := repo.GoSumFromRepo()
if err != nil {
return err
}
if godepsOld == nil {
if godepsNew == nil {
log.Printf("%s published godeps == nil && real == nil\n", repo.GetGoPath())
return nil
} else {
return fmt.Errorf("published godeps == nil vs real != nil")
}
}
if err := me.forge.TestGoDepsCheckOk(godepsNew, argv.Verbose); err != nil {
return err
}
return nil
}

View File

@ -3,16 +3,14 @@ package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"time"
"go.wit.com/gui"
"go.wit.com/log"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
)
type releaseStruct struct {
@ -27,19 +25,14 @@ type releaseStruct struct {
releaseVersionB *gui.Node
reason *gadgets.BasicEntry
openrepo *gui.Node
// openrepo *gui.Node
goGetB *gui.Node
checkGoSumB *gui.Node
checkDirtyB *gui.Node
makeRedomodB *gui.Node
sendVersionB *gui.Node
checkSafeB *gui.Node
whitelist map[string]*repolist.RepoRow
// store myself here. use myself to
// do garbage go get tests and other potential junk
guireleaser *repolist.RepoRow
// whitelist map[string]*repolist.RepoRow
}
func (w *autoType) Disable() {
@ -51,8 +44,6 @@ func (w *autoType) Enable() {
}
func createReleaseBox(box *gui.Node) {
initWhitelist()
me.release.box = box.NewVerticalBox("vbox")
me.release.group = me.release.box.NewGroup("Current Repo")
me.release.grid = me.release.group.NewGrid("buildOptions", 0, 0)
@ -60,14 +51,20 @@ func createReleaseBox(box *gui.Node) {
me.release.releaseVersionB = me.release.grid.NewButton("release version", func() {
buttonDisable()
if doRelease() {
fpath := me.current.FullPath
if err := doRelease(); err == nil {
buttonEnable()
log.Info("doRelease() worked")
log.Info("doRelease() worked", fpath)
} else {
log.Info("doRelease() failed")
log.Info("doRelease() failed", err, fpath)
log.Info("doRelease() FAILED", err, fpath)
log.Info("doRelease() FAILED", err, fpath)
log.Info("doRelease() FAILED", err, fpath)
}
skipToNext()
me.forge.PrintHumanTable(me.found)
})
me.release.grid.NewButton("Find Next Releasable", func() {
me.release.grid.NewButton("Find Next", func() {
me.Disable()
defer me.Enable()
if findNext() {
@ -75,13 +72,18 @@ func createReleaseBox(box *gui.Node) {
return
}
})
me.release.grid.NewButton("Show Next", func() {
check := me.current
if check == nil {
log.Info("boo, current is missing", me.current.GetGoPath())
return
}
testGoRepo(check)
me.forge.HumanPrintRepo(check)
})
me.release.grid.NextRow()
me.release.repo = gadgets.NewOneLiner(me.release.grid, "repo")
me.release.openrepo = me.release.grid.NewButton("Configure", func() {
me.current.Status.Toggle()
})
me.release.openrepo.Disable()
me.release.grid.NextRow()
me.release.status = gadgets.NewOneLiner(me.release.grid, "status")
me.release.grid.NextRow()
@ -99,212 +101,79 @@ func createReleaseBox(box *gui.Node) {
me.autoWorkingPwd = gadgets.NewOneLiner(me.release.grid, "working directory (pwd)")
me.release.grid.NextRow()
me.userHomePwd = gadgets.NewOneLiner(me.release.grid, "user home")
me.release.grid.NextRow()
me.goSrcPwd = gadgets.NewOneLiner(me.release.grid, "go src home")
me.release.grid.NextRow()
homeDir, err := os.UserHomeDir()
if err != nil {
log.Warn("Error getting home directory:", err)
homeDir = "/home/autotypist"
}
me.userHomePwd.SetText(homeDir)
srcDir := filepath.Join(homeDir, "go/src")
me.goSrcPwd.SetText(srcDir)
testf := filepath.Join(srcDir, "go.wit.com/apps/guireleaser", "go.sum")
if !shell.Exists(testf) {
log.Info("go.sum missing", testf)
panic("redo go.sum")
}
// me.userHomePwd.SetText(homeDir)
me.goSrcPwd.SetText(me.forge.Config.ReposDir)
group := me.release.box.NewGroup("Run on Current Repo")
grid := group.NewGrid("buildOptions", 0, 0)
grid.NewButton("set to IGNORE", func() {
// tmp := me.current.GoState()
log.Info("trying to whitelist repo", me.current.GoPath())
// me.current.SetGoState("IGNORE")
me.release.whitelist[me.current.GoPath()] = me.current
})
me.release.checkGoSumB = grid.NewButton("checkValidGoSum()", func() {
buttonDisable()
checkValidGoSum(me.current)
buttonEnable()
})
grid.NextRow()
group = me.release.box.NewGroup("Process against all repos")
group = me.release.box.NewGroup("Publish until done")
grid = group.NewGrid("buildOptions", 0, 0)
grid.NewButton("doRelease() all", func() {
var worked bool = true
buttonDisable()
// rather than loop forever, at least limit this to the number of repos
// incase something, somewhere, goes wrong
duration := repolist.TimeFunction(func() {
for n := 0; n <= len(me.repos.View.AllRepos()); n++ {
if doRelease() {
log.Info("doRelease() worked")
} else {
if me.release.status.String() == "ALL DONE?" {
log.Info("maybe ALL DONE?")
buttonEnable()
worked = true
break
}
log.Info("doRelease() failed")
worked = false
break
}
}
})
s := fmt.Sprint(duration)
log.Info("release returned", worked, "and ran for", s)
doReleaseAll()
buttonEnable()
})
grid.NextRow()
}
group = me.release.box.NewGroup("experimental and potentially dangerous stuff")
grid = group.NewGrid("buildOptions", 0, 0)
grid.NewButton("rm -f go.mod go.sum", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.ReadOnly() {
continue
}
repo.Status.Run([]string{"rm", "-f", "go.mod", "go.sum"})
func doReleaseAll() {
count := 0
for {
log.Info("START doRelease() LOOP count =", count, "len me.done =", len(me.done))
if err := doRelease(); err != nil {
break
}
me.Enable()
})
grid.NewButton("git reset --hard", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
log.Warn("skipping whitelist", repo.Name())
continue
}
log.Warn("running git reset --hard", repo.Name())
repo.Status.Run([]string{"git", "reset", "--hard"})
if err := skipToNext(); err != nil {
break
}
me.Enable()
})
grid.NewButton("git ls-files |grep go.mod", func() {
// var all []string
for _, repo := range me.repos.View.AllRepos() {
log.Info("repo:", repo.Name())
if repo.Status.ReadOnly() {
continue
}
if whitelist(repo.GoPath()) {
log.Warn("skipping whitelist", repo.GoPath())
continue
}
good, files := repo.Status.GitLsFiles()
if !good {
log.Warn("Something went wrong", repo.GoPath())
continue
}
for _, filename := range strings.Split(files, "\n") {
log.Info("\tfile", filename)
if filename == "go.mod" {
log.Info("Found go.mod. does version match release version?")
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
log.Info("Found go.sum. version mismatch")
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
return
}
}
if filename == "go.sum" {
log.Info("Found go.sum. does version match release version?")
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
log.Info("Found go.sum. version mismatch")
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
return
}
}
}
count += 1
if count > me.forge.Repos.Len() {
// never allow a loop longer than all the known repos
// this probably doesn't matter, but often this code is wrong
// so this is a safety check. never remove this check.
break
}
log.Info("All repos seem okay")
})
grid.NextRow()
}
}
func skipToNext() error {
shell.RunVerbose([]string{"forge", "dirty"})
log.Info("Sleeping for 2 seconds for no reason.")
time.Sleep(1)
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
me.found = new(gitpb.Repos)
me.current.ReloadCheck()
me.forge.SetConfigSave(true)
me.forge.ConfigSave()
log.Info("sleep 2")
time.Sleep(2 * time.Second)
printDone()
rePrepareRelease()
findNext()
if me.current == nil {
log.Info("NOT GOOD TO RUN ANOTHER DAY")
log.Info("took out all the loop code")
setCurrentRepo(nil, "loop by hand motherfucker", "fucknuts")
return fmt.Errorf("findNext returned next repo == nil")
}
log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.GetGoPath())
return nil
}
func buttonDisable() {
me.Disable()
me.release.box.Disable()
}
func buttonEnable() {
me.Enable()
}
func setCurrentRepo(newcur *repolist.RepoRow, s string, note string) bool {
if newcur.ReadOnly() {
return false
}
me.release.repo.SetText(newcur.GoPath())
me.release.status.SetText(s)
me.release.notes.SetText(note)
me.current = newcur
me.release.version.SetText(me.current.Status.GetTargetVersion())
me.release.releaseVersionB.SetText("release version " + me.current.Status.GetTargetVersion())
me.release.openrepo.Enable()
return true
}
// trys to figure out if there is still something to update
// todo: redo this logic as it is terrible
// rename this findNext()
func findNext() bool {
for _, repo := range me.repos.View.AllRepos() {
if repo.Status.IsReleased() {
continue
}
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.Whitelist {
continue
}
if repo.ReadOnly() {
// log.Info("findNext() skipping readonly")
continue
}
if repo.CheckDirty() {
log.Info("findNext() skipping dirty")
continue
}
// do makeredomod here
// if ! repo.Status.Exists("go.sum") {
// }
if repo.Status.IsPrimitive() {
log.Info("findNext()", repo.GoPath())
if setCurrentRepo(repo, "PRIMATIVE", "release new version") {
return true
}
continue
}
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
if checkValidGoSum(repo) {
setCurrentRepo(repo, "should be good to release", "pretty sure")
return true
}
}
log.Info("tried to findNext() but not sure what to do next")
me.release.status.SetText("ALL DONE?")
return false
me.release.box.Enable()
}

View File

@ -1,72 +0,0 @@
package main
import (
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
"go.wit.com/gui"
)
type repoWindow struct {
win *gadgets.BasicWindow
box *gui.Node
View *repolist.RepoList
}
func (r *repoWindow) Hidden() bool {
return r.win.Hidden()
}
func (r *repoWindow) Show() {
r.win.Show()
}
func (r *repoWindow) Hide() {
r.win.Hide()
}
func (r *repoWindow) Disable() {
r.box.Disable()
}
func (r *repoWindow) Enable() {
r.box.Enable()
}
// you can only have one of these
func makeRepoView() *repoWindow {
if me.repos != nil {
return me.repos
}
r := new(repoWindow)
r.win = gadgets.RawBasicWindow("GUI repositories in ~/go/src/")
r.win.Make()
r.box = r.win.Box().NewBox("bw vbox", false)
r.win.Custom = func() {
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
log.Warn("Should I do something special here?")
}
// reposbox.SetExpand(false)
group1 := r.box.NewGroup("Run on all repos:")
hbox := group1.Box()
// hbox.Horizontal()
hbox.Vertical()
box2 := hbox.Box().Vertical()
box2.NewButton("Dump version file", func() {
gowit.DumpVersions(me.repos.View)
})
r.View = repolist.GuireleaserView(r.box)
showncount := r.View.MirrorShownCount()
box2.Append(showncount)
duration := r.View.MirrorScanDuration()
box2.Append(duration)
return r
}

1
resources/README Normal file
View File

@ -0,0 +1 @@
* you can put toolkit .so binaries here

View File

@ -1,74 +0,0 @@
package main
import (
"os"
"strings"
"go.wit.com/log"
)
func setTargetVersion() {
// go through and set the target versions for each repo
// todo: add sanity checking in repolist to verify these and/or autocompute them
// for now, just don't be stupid when you set your ENV vars
// widget I versioned early before I knew what the hell this would mean and can
// not be down versioned because that's not how GO versioning works. Once you
// set the version for a path, it's set in stone forever. (smart system!)
// we could rename go.wit.com/widget to go.wit.com/newwidget and restart the versioning
// system, but that's rediculous and this servers to always remind me to never make this mistake again
var count int
for i, repo := range me.repos.View.AllRepos() {
if repo == nil {
log.Info("initial scan repo = nil", i)
continue
}
if repo.Status == nil {
log.Info("repo.status == nil", repo.Name())
continue
}
if repo.GoPath() == "go.wit.com/widget" {
repo.Status.SetTargetVersion("v" + os.Getenv("GUIRELEASE_WIDGET"))
} else {
prefix := "v" + os.Getenv("GUIRELEASE_VERSION")
lasttag := repo.Status.LastTag()
if strings.HasPrefix(lasttag, prefix) {
repo.Status.SetTargetVersion(lasttag)
} else {
repo.Status.SetTargetVersion(prefix)
}
}
if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev/") {
lasttag := repo.Status.GetLastTagVersion()
repo.Status.SetTargetVersion(lasttag)
}
// repo.NewScan()
count += 1
}
log.Info("target versions set for", count, "repos")
}
// trys to figure out if the version needs to be incremented
func incrementTargetVersion() bool {
var count int
for _, repo := range me.repos.View.AllRepos() {
if repo.ReadOnly() {
continue
}
lasttag := repo.Status.GetLastTagVersion()
master := repo.Status.GetMasterVersion()
if lasttag != master {
log.Info("increment target version", repo.GoPath(), lasttag, master)
count += 1
} else {
// check go dependancies for target version changes
}
}
log.Info("need to update target versions for", count, "repos")
if count == 0 {
return true
}
return false
}

View File

@ -2,55 +2,39 @@
package main
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
)
var me *autoType
type autoType struct {
myGui *gui.Node
pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
myGui *prep.GuiPrep // the gui handle itself
releaseReasonS string // = "gocui dropdown select"
release releaseStruct // notsure
reposbox *gui.Node // notsure
reposgrid *gui.Node // notsure
reposgroup *gui.Node // notsure
current *gitpb.Repo // tracks the next repo to publish
found *gitpb.Repos // stores the list of repos to process things on
done []string // gopaths for repos already published
reason map[*gitpb.Repo]string // the reason this package is going to be updated
releaseReasonS string // = "gocui dropdown select"
release releaseStruct
reposbox *gui.Node
reposgrid *gui.Node
reposgroup *gui.Node
current *repolist.RepoRow
// this is the repo we are starting in
// make sure it never changes so go.mod and go.sum are always there
// 'go get' is called from here
startRepo *gitpb.Repo
// guireleaser window
mainWindow *gui.Node
mainWindow *gadgets.BasicWindow
mainBox *gui.Node
// our view of the repositories
repos *repoWindow
// #### guireleaser repolist display options
autoHideReadOnly *gui.Node
autoHideReleased *gui.Node
ignoreWhitelist *gui.Node
// #### autotypist Global Build Options
// what to change all the branches to
// so, as a developer, you can move all the repos
// to the 'devel' branch and then test a devel branch build
// then switch back to your 'username' branch and do a build there
toMoveToBranch string
// displays the preferred names used for the repo tree state
mainBranch *gadgets.BasicCombobox
develBranch *gadgets.BasicCombobox
userBranch *gadgets.BasicCombobox
// this button will regenerate everyones go.mod & go.sum
rerunGoMod *gui.Node
// if checked, will stop trying to os.Exec() things after failure
stopOnErrors *gui.Node
// button to attempt to autorebuild
autoRebuildButton *gui.Node
forge *forgepb.Forge // your customized repo preferences and settings
// checkbox for --dry-run
autoDryRun *gui.Node
@ -61,9 +45,6 @@ type autoType struct {
// The current working directory
autoWorkingPwd *gadgets.OneLiner
// shows what is being used as your home dir
userHomePwd *gadgets.OneLiner
// shows what directory being used as ~/go/src
goSrcPwd *gadgets.OneLiner
@ -79,37 +60,3 @@ type autoType struct {
// show the time it took to do a scan
duration *gui.Node
}
func (my *autoType) GoSrcPath() string {
return my.goSrcPwd.String()
}
/*
var cmds *gui.Node
var doit *gui.Node
var dryrun *gui.Node
*/
/*
type repo struct {
hidden bool
path string
lasttagrev string
lasttag string
// what version to release this package as
targetVersionS string
pLabel *gui.Node // path label
// bLabel *gui.Node // branch label
lastTag *gui.Node // last tagged version label
vLabel *gui.Node // version label
dirtyLabel *gui.Node // git state (dirty or not?)
goSumStatus *gui.Node // what is the state of the go.sum file
targetVersion *gui.Node // the final repo release version
statusButton *gui.Node // opens up the status window
status *repostatus.RepoStatus
}
*/

View File

@ -1,48 +0,0 @@
package main
import (
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
func makeTempView() *repoWindow {
r := new(repoWindow)
r.win = gadgets.RawBasicWindow("unmerged repositories")
r.win.Make()
r.box = r.win.Box().NewBox("bw vbox", false)
r.win.Custom = func() {
log.Warn("GOT HERE: makeTempView() close")
log.Warn("GOT HERE: makeTempView() close")
log.Warn("Should I do something special here?")
}
// reposbox.SetExpand(false)
group1 := r.box.NewGroup("Run on all repos:")
hbox := group1.Box()
// hbox.Horizontal()
hbox.Vertical()
box2 := hbox.Box().Vertical()
box2.NewButton("merge user to devel", func() {
mergeAllUserToDevel()
})
box2.NewButton("merge devel to master", func() {
mergeAllDevelToMain()
})
box2.NewButton("rescan values", func() {
log.Warn("figure this out")
r.View.ListRows()
/*
for _, repo := range r.View.AllRepos() {
log.Warn("repo:", repo.Name())
}
*/
})
r.View = repolist.TempWindowView(r.box)
r.Show()
return r
}

View File

@ -1,41 +0,0 @@
// This is a simple example
package main
import (
"strings"
"go.wit.com/lib/gui/repolist"
)
func initWhitelist() {
me.release.whitelist = make(map[string]*repolist.RepoRow)
for _, repo := range me.repos.View.AllRepos() {
if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev/davecgh") {
me.release.whitelist[repo.GoPath()] = repo
}
//
// if repo.String() == "go.wit.com/apps/guireleaser" {
// me.release.whitelist[repo.String()] = repo
// }
//
// if repo.String() == "go.wit.com/lib/gui/repostatus" {
// me.release.whitelist[repo.String()] = repo
// }
//
}
}
func whitelist(path string) bool {
// log.Info("whitelist START", path)
if me.ignoreWhitelist.Checked() {
return false
}
_, ok := me.release.whitelist[path]
if ok {
// log.Info("whitelist ok == true", path)
return true
}
// log.Info("whitelist ok == false", path)
return false
}