[gentoo-commits] proj/R_overlay:master commit in: bin/build/
commit: 9fd99e101f586bf91f551b79e8296ca4a5c9ce41 Author: André Erdmann mailerd de> AuthorDate: Fri Jul 18 15:36:52 2014 + Commit: André Erdmann mailerd de> CommitDate: Fri Jul 18 15:36:52 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9fd99e10 bin/build/setver.sh: --help --- bin/build/setver.sh | 8 1 file changed, 8 insertions(+) diff --git a/bin/build/setver.sh b/bin/build/setver.sh index bf5bf67..221bb40 100755 --- a/bin/build/setver.sh +++ b/bin/build/setver.sh @@ -2,6 +2,8 @@ # # Sets roverlay's version. # +print_help() { +cat << EOF | sed -re 's,^[#]\s?,,' # Usage: setver [-S,--src ] [--pretend] [--suffix ] [--reset] #[--git-add] [--git-commit] [--force-commit] [--git-tag] #[+,pbump|++,mbump|Mbump|[setver] ] @@ -24,6 +26,8 @@ # --force-commit -- enforce git commit (allow other files) # --git-tag-- run git-tag after git-commit # +EOF +} set -e set -u readonly IFS_DEFAULT="${IFS}" @@ -194,6 +198,10 @@ while [ ${#} -gt 0 ]; do echo "VERSION" exit 0 ;; + -h|--help) + print_help + exit 0 + ;; *) die "unknown arg: ${1}" 64
[gentoo-commits] proj/R_overlay:master commit in: bin/build/
commit: 6bb55c0f9bb8925a50cb4e2f9aec302da6037500 Author: André Erdmann mailerd de> AuthorDate: Fri Jul 18 15:33:53 2014 + Commit: André Erdmann mailerd de> CommitDate: Fri Jul 18 15:33:53 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6bb55c0f bin/build/setver.sh: change suffix handling --- bin/build/setver.sh | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/build/setver.sh b/bin/build/setver.sh index ae8b048..bf5bf67 100755 --- a/bin/build/setver.sh +++ b/bin/build/setver.sh @@ -170,10 +170,11 @@ while [ ${#} -gt 0 ]; do --force-commit) want_forcecommit=true ;; --git-tag) want_gittag=true ;; - [Mmp]bump) ACTION="${1}" ;; - '+') ACTION=pbump ;; - '++') ACTION=mbump ;; - *.*.*) ACTION=setver; V="${1}" ;; + [Mmp]bump) ACTION="${1}" ;; + '+')ACTION=pbump ;; + '++') ACTION=mbump ;; + *.*.*) ACTION=setver; V="${1}" ;; + *.*.*[-_]*) ACTION=setver; V="${1}"; new_suffix= ;; setver) [ -n "${2-}" ] || die "one non-empty arg required after '${1}'." @@ -218,18 +219,18 @@ autodie parse_version "${OLDVER}" case "${ACTION-}" in pbump) inc "${plvl}" - V="${major}.${minor}.${v0}${new_suffix}" + V="${major}.${minor}.${v0}" ;; mbump) inc "${minor}" - V="${major}.${v0}.0${new_suffix}" + V="${major}.${v0}.0" ;; Mbump) inc "${major}" - V="${v0}.0.0${new_suffix}" + V="${v0}.0.0" ;; setver) - true + V="${V}${new_suffix}" ;; *) ${want_reset} || die "unknown or no action specified."
[gentoo-commits] proj/R_overlay:master commit in: /, bin/build/
commit: b79d90014df34bd8995780ed10c9a129898a11cb Author: André Erdmann mailerd de> AuthorDate: Thu Apr 3 18:58:15 2014 + Commit: André Erdmann mailerd de> CommitDate: Thu Apr 3 18:58:15 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b79d9001 remove bin/build/{do_pydoc,roverlay_rst2html}.sh --- Makefile | 1 - bin/build/do_pydoc.sh | 13 - bin/build/roverlay_rst2html.sh | 13 - 3 files changed, 27 deletions(-) diff --git a/Makefile b/Makefile index 2efca5a..090841a 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,6 @@ _BUILDSCRIPTS := $(_SCRIPTS_DIR)/build MANIFEST_GEN := $(_BUILDSCRIPTS)/create_manifest.sh LICENSES_GEN := $(_BUILDSCRIPTS)/make-licenses.sh X_SETVER := $(_BUILDSCRIPTS)/setver.sh -PYDOC_SH := $(_BUILDSCRIPTS)/do_pydoc.sh RV_SETUP := $(_SCRIPTS_DIR)/$(_PN)-setup X_RUN_TESTS := $(_SCRIPTS_DIR)/run_tests diff --git a/bin/build/do_pydoc.sh b/bin/build/do_pydoc.sh deleted file mode 100755 index e6a227f..000 --- a/bin/build/do_pydoc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -xe - -into="${1:?}" - -cd "$into" -[ -e ./roverlay ] - -find roverlay/ -name "*.py" | \ - sed -e 's,\/,.,g' -e 's,[.]__init__[.]py$,,' -e 's,[.]py$,,' | \ - xargs pydoc -w && \ - ln -fs roverlay.html index.html && \ - rm -f -- roverlay - diff --git a/bin/build/roverlay_rst2html.sh b/bin/build/roverlay_rst2html.sh deleted file mode 100755 index a3450db..000 --- a/bin/build/roverlay_rst2html.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -u -die_usage() { echo "usage: $0 "; exit 1; } - -[ $# -eq 2 ] || die_usage - -from="${1}" -to="${2}" - -[ -r "${from}" ] || die_usage - -TITLE='Automatically Generated Overlay of R packages' - -rst2html.py --title "${TITLE}" --date "${from}" "${to}"
[gentoo-commits] proj/R_overlay:master commit in: bin/build/
commit: 280c04d3d53b3ce3fac72f035811b7514722a81a Author: André Erdmann mailerd de> AuthorDate: Wed Apr 2 19:53:47 2014 + Commit: André Erdmann mailerd de> CommitDate: Wed Apr 2 20:00:30 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=280c04d3 bin/build/setver: --git-{add,commit,tag}, --reset --- bin/build/setver.sh | 180 +--- 1 file changed, 157 insertions(+), 23 deletions(-) diff --git a/bin/build/setver.sh b/bin/build/setver.sh index 470e529..ae8b048 100755 --- a/bin/build/setver.sh +++ b/bin/build/setver.sh @@ -2,7 +2,8 @@ # # Sets roverlay's version. # -# Usage: setver [-S,--src ] [--pretend] [--suffix ] +# Usage: setver [-S,--src ] [--pretend] [--suffix ] [--reset] +#[--git-add] [--git-commit] [--force-commit] [--git-tag] #[+,pbump|++,mbump|Mbump|[setver] ] # # Actions: @@ -15,40 +16,140 @@ # -S, --src -- set roverlay source directory (default: $PWD) # --pretend-- just show what would be done # --suffix-- replace old version suffix with +# -l, --list-files -- just list files that would be edited by this script +# (usage example: setver -l | xargs git checkout HEAD --) +# --reset -- check out VERSION file from git HEAD before doing anything +# --git-add-- git-add modified files +# --git-commit -- commit changes (commit message: "roverlay ") +# --force-commit -- enforce git commit (allow other files) +# --git-tag-- run git-tag after git-commit # +set -e set -u -IFS_DEFAULT="${IFS}" +readonly IFS_DEFAULT="${IFS}" -PY_FILES_TO_EDIT="roverlay/core.py setup.py" +readonly PY_FILES_TO_EDIT="roverlay/core.py setup.py" +readonly X_GIT="${X_GIT:-git}" +# get_git_commit_message ( new_version, **commit_msg! ) +# +# Creates a commit message and stores it in $commit_msg. +# An empty str can be set if no commit should be made. +# +get_git_commit_message() { + commit_msg="roverlay ${1:?}" +} + +# get_git_tag ( new_version, **tag! ) +# +# Creates a git tag str and stores it in $tag. +# An empty str suppresses tag creation. +# +get_git_tag() { + tag="${1:?}" +} +# @noreturn die ( [message], [exit_code] ), raises exit($exit_code) +# +# Lets the script die. +# die() { - echo "${1:-unknown error.}" 1>&2; exit ${2:-2}; + echo "${1:+died: }${1:-died.}" 1>&2; exit ${2:-2}; +} + +# autodie ( *cmdv ) +# +# Runs *cmdv and dies on non-zero return. +# ("set -ex" is too verbose) +# +autodie() { + "$@" || die "command '${*}' returned ${?}." ${?} } +# parse_version ( version_str, **major!, **minor!, **plvl!, **suffix! ) +# +# Splits a version_str into its components. +# +# Example: 0.2.6-pre1 => major=0 minor=2 plvl=6 suffix=-pre1 +# parse_version() { + unset -v major minor plvl suffix local IFS="." set -- ${1} IFS="${IFS_DEFAULT}" - [ ${#} -ge 3 ] || return 2 + [ -n "${1-}" ] && [ -n "${2-}" ] && [ -n "${3-}" ] || return 2 major="${1:?}" minor="${2:?}" plvl="${3:?}" shift 3 || die "error in parse_version()" - suffix="${*}" + suffix= + while [ ${#} -gt 0 ]; do suffix="${suffix}.${1}"; shift; done + suffix="${suffix#.}" } +# inc ( k, **v0! ) +# +# Increments $k by one and stores the result in $v0. +# inc() { - v0=$(( ${1} + 1 )) + v0=$(( ${1:?} + 1 )) + # unlikely: [ ${v0} -gt ${1} ] || die "overflow" } +# do_git_add ( *files, **want_gitadd, **X_GIT ) +# +do_git_add() { + ${want_gitadd} || return 0 + printf "git-add: %s\n" "${*}" + ${want_pretend} || autodie "${X_GIT}" add -- "$@" +} + +# do_git_commit_and_tag ( +#version_str, numfiles_changed, +#**want_gitcommit, **want_forcecommit, **want_gittag, **X_GIT +# ) +# +do_git_commit_and_tag() { + ${want_gitcommit} || return 0 + local commit_msg commit_type tag + + autodie get_git_commit_message "${1}" + autodie get_git_tag "${1}" + + if [ -z "${commit_msg}" ]; then + return 0 + elif ${want_pretend}; then + commit_type=maybe + elif \ + [ $(git status --porcelain -- . | grep -c -- ^[MADRCU]) -eq ${2} ] + then + commit_type=clean + elif ${want_forcecommit}; then + commit_type=forced + else + die "cannot commit changes (try --force-commit)." + fi + + printf "git-commit [%s]: %s\n" "${commit_type}" "${commit_msg}" + ${want_pretend} || autodie "${X_GIT}" commit -m "${commit_msg}" + + ${want_gittag} && [ -n "${tag}" ] || return 0 + printf "git-tag: %s\n" "${tag}" + ${want_pretend} || autodie "${X_GIT}" tag "${tag}" +} + + +# set defaults / parse args +autodie hash "${X_GIT}" S="${PWD}" unset -v V unset -v ACTION unset -v new_suffix -unset -v do_pretend + +readonly _boolvars="pretend gitadd gitcommit forcecommit gittag reset" +for iter in ${_boolvars}; do eval "want_${iter}=false"; done doshift= while [ ${#} -gt 0 ]; do @@ -56,15 +157,18 @@ while [ ${#} -gt 0 ]; do case "${1}" in '') : ;;
[gentoo-commits] proj/R_overlay:master commit in: /, bin/build/
commit: 71e37945e29257ba8ad3dbc08ae5221986be450d Author: André Erdmann mailerd de> AuthorDate: Tue Apr 1 22:48:36 2014 + Commit: André Erdmann mailerd de> CommitDate: Wed Apr 2 20:00:30 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=71e37945 bin/build/setver: versioning helper script --- VERSION | 1 + bin/build/setver.sh | 131 2 files changed, 132 insertions(+) diff --git a/VERSION b/VERSION new file mode 100644 index 000..53a75d6 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.6 diff --git a/bin/build/setver.sh b/bin/build/setver.sh new file mode 100755 index 000..470e529 --- /dev/null +++ b/bin/build/setver.sh @@ -0,0 +1,131 @@ +#!/bin/sh +# +# Sets roverlay's version. +# +# Usage: setver [-S,--src ] [--pretend] [--suffix ] +#[+,pbump|++,mbump|Mbump|[setver] ] +# +# Actions: +# +, pbump-- increase patchlevel by one +# ++, mbump -- increase minor version by one and set patchlevel to 0 +# Mbump -- increase major version by one and set minor/patchlevel to 0 +# setver -- set a specific version +# +# Options: +# -S, --src -- set roverlay source directory (default: $PWD) +# --pretend-- just show what would be done +# --suffix-- replace old version suffix with +# +set -u +IFS_DEFAULT="${IFS}" + +PY_FILES_TO_EDIT="roverlay/core.py setup.py" + + +die() { + echo "${1:-unknown error.}" 1>&2; exit ${2:-2}; +} + +parse_version() { + local IFS="." + set -- ${1} + IFS="${IFS_DEFAULT}" + [ ${#} -ge 3 ] || return 2 + + major="${1:?}" + minor="${2:?}" + plvl="${3:?}" + shift 3 || die "error in parse_version()" + suffix="${*}" +} + +inc() { + v0=$(( ${1} + 1 )) + [ ${v0} -gt ${1} ] || die "overflow" +} + +S="${PWD}" +unset -v V +unset -v ACTION +unset -v new_suffix +unset -v do_pretend + +doshift= +while [ ${#} -gt 0 ]; do + doshift=1 + case "${1}" in + '') : ;; + + '--src'|'-S') + [ ${#} -ge 2 ] || die "argparse error" + doshift=2 + S="${2:?}" + ;; + + pretend|--pretend) + do_pretend=true + ;; + + [Mmp]bump) ACTION="${1}" ;; + '+') ACTION=pbump ;; + '++') ACTION=mbump ;; + *.*.*) ACTION=setver; V="${1}" ;; + + setver) + [ ${#} -ge 2 ] || die "argparse error" + doshift=2 + ACTION=setver + V="${2:?}" + ;; + + suffix|--suffix) + [ ${#} -ge 2 ] || die "argparse error" + doshift=2 + new_suffix="${2?}" + ;; + + *) + die "unknown arg: ${1}" 64 + ;; + esac + [ ${doshift} -eq 0 ] || shift ${doshift} || die "argparse: shift failed" +done + +: ${do_pretend:=false} +OLDVER="$(cat "${S}/VERSION")" +parse_version "${OLDVER}" || die "bad version: ${OLDVER}." +[ -n "${new_suffix+SET}" ] || new_suffix="${suffix}" + +case "${ACTION-}" in + pbump) + inc "${plvl}" + V="${major}.${minor}.${v0}${new_suffix}" + ;; + mbump) + inc "${minor}" + V="${major}.${v0}.0${new_suffix}" + ;; + Mbump) + inc "${major}" + V="${v0}.0.0${new_suffix}" + ;; + setver) + true + ;; + *) + die "unknown or no action specified." + ;; +esac + +q="\"\'" +re_pyfile_ver="^(\s*version\s*=\s*)[${q}]?([^\s;,${q}]*)[${q}]?(\s*[;,]?\s*)\$" + +_fmt="edit %-18s: %8s -> %s\n" +for fname in ${PY_FILES_TO_EDIT}; do + f="${S}/${fname}" + fver="$(sed -rn -e "s@${re_pyfile_ver}@\2@p" < "${f}")" + printf "${_fmt}" "${fname}" "${fver}" "${V}" + ${do_pretend} || sed -r -e "s@${re_pyfile_ver}@\1\"${V}\"\3@" -i "${f}" +done +printf "${_fmt}" "VERSION" "${OLDVER}" "${V}" +${do_pretend} || echo "${V}" > "${S}/VERSION"
[gentoo-commits] proj/R_overlay:master commit in: /, bin/build/
commit: f7b9302ecf014c0699f9114556755a7294ef2974 Author: André Erdmann mailerd de> AuthorDate: Mon Mar 31 17:51:40 2014 + Commit: André Erdmann mailerd de> CommitDate: Tue Apr 1 16:36:36 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f7b9302e Makefile: $ROVERLAY_TARGET_TYPE ROVERLAY_TARGET_TYPE controls which files get installed: when gentoo: => config/R-overlay.conf.install => no licenses file when others: => config/R-overlay.conf.install.others => install files/licenses to $DATADIR/licenses Also added a "generate-licenses" target for creating files/licenses. --- Makefile | 32 ++-- bin/build/make-licenses.sh | 53 ++ 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9a41011..06933f8 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,16 @@ CONFDIR := $(DESTDIR)etc BUILDDIR := ./tmp +ROVERLAY_TARGET_TYPE := gentoo + PYMOD_FILE_LIST := ./roverlay_files.list -MANIFEST := MANIFEST -MANIFEST_TMP := $(MANIFEST).tmp +MANIFEST := $(CURDIR)/MANIFEST +LICENSES_FILE := $(CURDIR)/files/licenses MANIFEST_GEN := ./bin/build/create_manifest.sh +LICENSES_GEN := ./bin/build/make-licenses.sh RV_SETUP := ./bin/roverlay-setup @@ -90,10 +93,18 @@ htmldoc: $(SRC_DOCDIR)/rst/usage.rst PHONY += generate-doc generate-doc: htmldoc +$(MANIFEST): $(MANIFEST_GEN) FORCE + $< > $@ + PHONY += generate-manifest -generate-manifest: $(MANIFEST_GEN) - $(MANIFEST_GEN) > $(MANIFEST_TMP) - mv -- $(MANIFEST_TMP) $(MANIFEST) +generate-manifest: $(MANIFEST) + +$(LICENSES_FILE): $(LICENSES_GEN) FORCE | $(CURDIR)/files + $< $@ + +PHONY += generate-licenses +generate-licenses: $(CURDIR)/files/licenses + $(CURDIR)/config/R-overlay.conf.install: $(RV_SETUP) FORCE | $(CURDIR)/config @@ -133,7 +144,7 @@ generate-config: \ PHONY += generate-files -generate-files: generate-config generate-doc generate-manifest +generate-files: generate-config generate-doc generate-manifest generate-licenses # creates a src tarball (.tar.bz2) # !!! does not include config files @@ -167,8 +178,13 @@ install-config-common: install -m 0644 -t $(CONFDIR)/roverlay \ config/description_fields.conf config/repo.list \ config/package_rules config/hookrc +ifeq ($(ROVERLAY_TARGET_TYPE),gentoo) install -m 0644 -T \ config/R-overlay.conf.install $(CONFDIR)/roverlay/R-overlay.conf +else + install -m 0644 -T \ + config/R-overlay.conf.install.others $(CONFDIR)/roverlay/R-overlay.conf +endif PHONY += install-config-compressed install-config-compressed: install-config-common @@ -187,9 +203,13 @@ install-config: install-config-common PHONY += install-data install-data: install -m 0755 -d \ + $(DATADIR)/roverlay \ $(DATADIR)/roverlay/shlib $(DATADIR)/roverlay/hooks \ $(DATADIR)/roverlay/eclass $(DATADIR)/roverlay/mako_templates +ifneq ($(ROVERLAY_TARGET_TYPE),gentoo) + install -m 0644 -- $(LICENSES_FILE) $(DATADIR)/roverlay/licenses +endif install -m 0644 -t $(DATADIR)/roverlay/hooks files/hooks/*.sh install -m 0644 -t $(DATADIR)/roverlay/shlib files/shlib/*.sh chmod 0775 $(DATADIR)/roverlay/hooks/mux.sh diff --git a/bin/build/make-licenses.sh b/bin/build/make-licenses.sh new file mode 100755 index 000..77ae1d0 --- /dev/null +++ b/bin/build/make-licenses.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Creates a license list file for roverlay. +# +# Usage: make-licenses [dest_file] [compression] +# +# Environment variables: +# * PORTDIR: path to the main tree (= root of the "licenses" dir) +# +set -u + +die() { echo "${1:-error}" 1>&2; exit ${2:-2}; } + +mkmap() { + local x + # find -type f, ls -1, ... + set +f + for x in "${PORTDIR}/licenses/"*; do + [ ! -f "${x}" ] || echo "${x##*/}" + done +} + +mkmap_bz2() { mkmap | bzip2 -c; } +mkmap_xz() { mkmap | xz -c; } +mkmap_gz() { mkmap | gzip -c; } + +get_mkmap_func() { + case "${1-}" in + '') func=mkmap ;; + bz2|xz|gz) func=mkmap_${1} ;; + *) die "unknown compression '${1-}'." 64 ;; + esac +} + +if [ -z "${PORTDIR-}" ]; then + PORTDIR="$(portageq get_repo_path / gentoo)" + #PORTDIR="$(portageq get_repo_path $(portageq envvar EROOT) gentoo)" + [ -n "${PORTDIR}" ] || PORTDIR="$(portageq envvar PORTDIR)" + [ -n "${PORTDIR}" ] || die "failed to get \$PORTDIR" +fi + +case "${1-}" in + ''|'-') + get_mkmap_func "${2-}" && ${func} + ;; + *.bz2|*.xz|*.gz) + [ -z "${2-}" ] || [ "${2}" = "${1##*.}" ] || die + get_mkmap_func "${1##*.}" && ${func} > "${1}" + ;; + *) + get_mkmap_func "${2-}" && ${func} > "${1}" + ;; +esac