Commit 64e533a5 authored by KatolaZ's avatar KatolaZ

added "current" and "suites" -- bump to version 0.2

parent 70c03edf
......@@ -10,7 +10,7 @@
## version 3 of the License or, at your option, any later version.
##
VERSION=0.1
VERSION=0.2
## Error values
ERR_PARAM=2
......@@ -46,6 +46,30 @@ Please commit your changes or ignore untracked files"
fi
}
##
## Check if debian/gbp.conf exists for the current suite, otherwise
## recreate it and commit
##
## function
ensure_gbp_conf(){
if [ ! -f debian/gbp.conf ]; then
SUITE=$(git branch | grep -E "^\*" | cut -d " " -f 2)
cat <<EOF > debian/gbp.conf
[DEFAULT]
debian-branch=${SUITE}
EOF
git add debian/gbp.conf
git commit -m "re-creating debian/gbp.conf for suite ${SUITE}"
echo "[= suite \"${CUR_BRANCH}\" ready =]" >&2
fi
}
##
## Import a new package (e.g., from alioth)
......@@ -247,17 +271,7 @@ handle_testbuild(){
check_pending_commits
SUITE=$(git branch | grep -E "^\*" | cut -d " " -f 2)
if [ ! -f "debian/gbp.conf" ]; then
cat <<EOF > debian/gbp.conf
[DEFAULT]
debian-branch=${SUITE}
EOF
git add --all
git commit -m "restored debian/gbp.conf"
fi
ensure_gbp_conf
## build package -- this might fail to sign if the changelog has not been
## updated -- that is not a problem, though
......@@ -313,12 +327,65 @@ handle_stage(){
}
## function
handle_suites(){
SUITES=$(git branch | cut -d " " -f 2 | grep -E "^suites/" | sed -r -e 's:^suites/::g')
if [ -z "${SUITES}" ]; then
echo "### no suites available -- use 'd1h prepare' to create one ###" >&2
else
echo ${SUITES}
fi
}
## function
handle_current(){
CUR_SUITE=$(git branch | grep -E "^\*" | cut -d " " -f 2 | sed -r -e 's:^suites/::g')
if [ -z "${CUR_SUITE}" ]; then
echo "### no suites available -- use 'd1h prepare' to create one ###" >&2
else
echo "${CUR_SUITE}" >&2
fi
}
## function
show_usage(){
echo "d1h ${VERSION} -- Devuan Package workflow helper"
echo "Usage: $(basename $0) command [options]"
echo
echo "d1h is a helper which guides developers through the "
echo "Devuan package management workflow"
echo
echo "Commands:"
echo " cache - rebuild the source repository cache"
echo " search - look for keywords in the source repository cache"
echo " import - import a source repository"
echo " link - link the current repository to a git remote"
echo " suites - show a list of available suite environments"
echo " current - show the name of the current suite environment"
echo " prepare - set up the environment for a release suite"
echo " switch - switch to a suite environment"
echo " dismiss - destroy and existing suite environment"
echo " testbuild - build the package in the current suite"
echo " stage - prepare the package for the CI pipeline"
echo
echo "See the d1h(1) manual page for more information"
}
## main -- the script starts here --
case $(basename $0) in
"d1h")
if [ "$#" -eq 0 ]; then
echo "Usage: $0 {cache|search|import|link|prepare|switch|dismiss|testbuild|stage} [options]"
show_usage
exit ${ERR_PARAM}
fi
;;
......@@ -376,6 +443,12 @@ case "$1" in
shift 1
handle_stage $@
;;
suites)
handle_suites
;;
current)
handle_current
;;
*)
echo "Unknown command: $1"
exit ${ERR_PARAM};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment