<commit_before>#!/usr/bin/env bash

export COPYFILE_DISABLE=true

distFiles=(README.md LICENSE) # apart from the binary itself
version=$(git describe --always)

build() {
	go build -ldflags "-w -X main.Version $version" ./cmd/syncthing	
}

prepare() {
	go run cmd/assets/assets.go gui > auto/gui.files.go
	go get -d
}

test() {
	go test ./...
}	

tarDist() {
	name="$1"
	mkdir -p "$name"
	cp syncthing "${distFiles[@]}" "$name"
	tar zcvf "$name.tar.gz" "$name"
	rm -rf "$name"
	gpg -ab "$name.tar.gz"
}

zipDist() {
	name="$1"
	mkdir -p "$name"
	cp syncthing.exe "${distFiles[@]}" "$name"
	zip -r "$name.zip" "$name"
	rm -rf "$name"
	gpg -ab "$name.zip"
}

case "$1" in
	"")
		build
		;;

	tar)
		rm -f *.tar.gz *.zip
		prepare
		test || exit 1
		build

		eval $(go env)
		name="syncthing-$GOOS-$GOARCH-$version"

		tarDist "$name"
		;;

	all)
		rm -f *.tar.gz *.zip
		prepare
		test || exit 1

		export GOARM=7
		for os in darwin-amd64 linux-amd64 linux-arm freebsd-amd64 ; do
			export GOOS=${os%-*}
			export GOARCH=${os#*-}

			build
			
			name="syncthing-$os-$version"
			case $GOOS in
				windows)
					zipDist "$name"
					rm -f syncthing.exe
					;;
				*)
					tarDist "$name"
					rm -f syncthing
					;;
			esac
		done
		;;

	upload)
		tag=$(git describe)
		shopt -s nullglob
		for f in *.tar.gz *.zip *.asc ; do
			relup calmh/syncthing "$tag" "$f"
		done
		;;

	*)
		echo "Unknown build parameter $1"
		;;
esac
<commit_msg>Also remove old signatures when rebuilding<commit_after>#!/usr/bin/env bash

export COPYFILE_DISABLE=true

distFiles=(README.md LICENSE) # apart from the binary itself
version=$(git describe --always)

build() {
	go build -ldflags "-w -X main.Version $version" ./cmd/syncthing	
}

prepare() {
	go run cmd/assets/assets.go gui > auto/gui.files.go
	go get -d
}

test() {
	go test ./...
}	

tarDist() {
	name="$1"
	mkdir -p "$name"
	cp syncthing "${distFiles[@]}" "$name"
	tar zcvf "$name.tar.gz" "$name"
	rm -rf "$name"
	gpg -ab "$name.tar.gz"
}

zipDist() {
	name="$1"
	mkdir -p "$name"
	cp syncthing.exe "${distFiles[@]}" "$name"
	zip -r "$name.zip" "$name"
	rm -rf "$name"
	gpg -ab "$name.zip"
}

case "$1" in
	"")
		build
		;;

	tar)
		rm -f *.tar.gz *.zip *.asc
		prepare
		test || exit 1
		build

		eval $(go env)
		name="syncthing-$GOOS-$GOARCH-$version"

		tarDist "$name"
		;;

	all)
		rm -f *.tar.gz *.zip *.asc
		prepare
		test || exit 1

		export GOARM=7
		for os in darwin-amd64 linux-amd64 linux-arm freebsd-amd64 ; do
			export GOOS=${os%-*}
			export GOARCH=${os#*-}

			build
			
			name="syncthing-$os-$version"
			case $GOOS in
				windows)
					zipDist "$name"
					rm -f syncthing.exe
					;;
				*)
					tarDist "$name"
					rm -f syncthing
					;;
			esac
		done
		;;

	upload)
		tag=$(git describe)
		shopt -s nullglob
		for f in *.tar.gz *.zip *.asc ; do
			relup calmh/syncthing "$tag" "$f"
		done
		;;

	*)
		echo "Unknown build parameter $1"
		;;
esac

{'fraction_non_alphanumeric': 0.17701543739279588, 'fraction_numerical': 0.008919382504288165, 'mean_word_length': 2.5823095823095823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7257593', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1173, 'n_words': 323}