~dricottone/huttese-apk

8c3c3e9ef3ca93890927addc991c5096126ba0a3 — Drew DeVault 5 years ago e70a64f
Add pkgver function
1 files changed, 21 insertions(+), 0 deletions(-)

M pkgkit
M pkgkit => pkgkit +21 -0
@@ 9,6 9,8 @@ usage() {
	printf "\t%s\n" "-c: update checksums"
	printf "\t%s\n" "-u: update pkgrel"
	printf "\t%s\n\n" "-v <pkgver>: update pkgver"
	printf "%s\n" "$0 pkgver"
	printf "\t%s\n\n" "Prints the suggested package ver for this directory"
	printf "%s\n" "$0 upload <ssh server> <remote path> <packages...>"
	printf "\t%s\n" "Uploads packages via rsync and updates remote APKINDEX"
}


@@ 131,6 133,22 @@ build() (
	done
)

print_pkgver() {
	if [ $# -ne 0 ]
	then
		usage
		exit 1
	fi
	pkgver=$(git describe --abbrev=0)
	if ! git describe --exact-match HEAD >/dev/null 2>&1
	then
		cdate=$(git show -s -1 --format='%ci' HEAD)
		cdate=$(echo "$cdate" | cut -d' ' -f1 | sed -e 's/-//g')
		pkgver="${pkgver}_git${cdate}"
	fi
	echo "$pkgver"
}

upload_pkg() (
	repo="$1"
	pkg="$2"


@@ 226,6 244,9 @@ case "$cmd" in
	build)
		build "$@"
		;;
	pkgver)
		print_pkgver "$@"
		;;
	upload)
		upload "$@"
		;;