public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-06 11:10 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-06 11:10 UTC (permalink / raw
  To: gentoo-commits

commit:     c33afbec6517198fa9b8d076546c296ec6162cc3
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep  6 11:07:52 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep  6 11:07:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c33afbec

files/hooks/mux.sh: preload extra function files

---
 files/hooks/mux.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/files/hooks/mux.sh b/files/hooks/mux.sh
index c78d9e8..7789b99 100755
--- a/files/hooks/mux.sh
+++ b/files/hooks/mux.sh
@@ -30,9 +30,17 @@ for hookfile in \
    ${FILESDIR}/hooks/?*.${ROVERLAY_PHASE}
 do
    if [ -f "${hookfile}" ]; then
+      # preload function files
+      hookfile_name="${hookfile##*/}"
+      case "${hookfile_name}" in
+         *git*)
+            $lf git
+         ;;
+      esac
+
       # subshell: don't leak hook vars/functions
       (
-         readonly hookfile_name="${hookfile##*/}"
+         readonly hookfile_name
          this="${hookfile_name#[0-9]*-}"; this="${this%.*}"
 
          if [ -n "${this}" ]; then
@@ -47,6 +55,8 @@ do
          # initial directory should always be $S
          cd "${S}" && . "${hookfile}"
       ) || die "errors occured while running hook '${hookfile}'"
+
+      unset -v hookfile_name
    fi
 done
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2014-04-01 16:38 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2014-04-01 16:38 UTC (permalink / raw
  To: gentoo-commits

commit:     5b39452838f97dd3645fb102a8f784639209ef1b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Mar 31 15:37:15 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Mar 31 15:37:15 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5b394528

hooks: use die_cannot_run()

---
 files/hooks/create-metadata-cache.sh | 4 ++--
 files/hooks/git-commit-overlay.sh    | 2 +-
 files/hooks/git-push.sh              | 2 ++
 files/hooks/notify-desktop.sh        | 2 ++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/files/hooks/create-metadata-cache.sh b/files/hooks/create-metadata-cache.sh
index 808f537..a406d7f 100644
--- a/files/hooks/create-metadata-cache.sh
+++ b/files/hooks/create-metadata-cache.sh
@@ -14,10 +14,10 @@ set -u
 #$lf ...
 
 : ${EGENCACHE:=egencache}
-#autodie qwhich "${EGENCACHE}"
+qwhich "${EGENCACHE}" || die_cannot_run "egencache is not available."
 
 # a valid PORTDIR is required
-[ -d "${PORTDIR-}" ] || die "\$PORTDIR '${PORTDIR-}' does not exist."
+[ -d "${PORTDIR-}" ] || die_cannot_run "\$PORTDIR '${PORTDIR-}' does not exist."
 
 # void cleanup()
 #

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index 2e726fb..30aad1c 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -17,7 +17,7 @@ set -u
 
 ## load git helper functions
 $lf git
-#autodie qwhich ${GIT}
+qwhich "${GIT}" || die_cannot_run "git is not available."
 
 
 ## functions

diff --git a/files/hooks/git-push.sh b/files/hooks/git-push.sh
index 7d79e64..d5a410a 100644
--- a/files/hooks/git-push.sh
+++ b/files/hooks/git-push.sh
@@ -13,6 +13,8 @@ set -u
 # using line_iterator() from itertools
 $lf git itertools
 
+qwhich "${GIT}" || die_cannot_run "git is not available."
+
 
 ## functions
 

diff --git a/files/hooks/notify-desktop.sh b/files/hooks/notify-desktop.sh
index 9184c2f..32ae230 100644
--- a/files/hooks/notify-desktop.sh
+++ b/files/hooks/notify-desktop.sh
@@ -9,6 +9,8 @@ set -u
 . "${FUNCTIONS?}" || exit
 #dont_run_as_root
 
+qwhich notify-send || die_cannot_run "notify-send is not available."
+
 ## load helper functions
 #$lf ...
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2014-01-25 18:14 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2014-01-25 18:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e22bb678775d90b90ca81aea22194ce000aff992
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jan 25 17:56:24 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jan 25 17:56:24 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e22bb678

metadata-cache hook: --repositories-configuration

Pass --repositories-configuration instead of --portdir-overlay to egencache.

---
 files/hooks/create-metadata-cache.sh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/files/hooks/create-metadata-cache.sh b/files/hooks/create-metadata-cache.sh
index dbe7286..808f537 100644
--- a/files/hooks/create-metadata-cache.sh
+++ b/files/hooks/create-metadata-cache.sh
@@ -16,6 +16,9 @@ set -u
 : ${EGENCACHE:=egencache}
 #autodie qwhich "${EGENCACHE}"
 
+# a valid PORTDIR is required
+[ -d "${PORTDIR-}" ] || die "\$PORTDIR '${PORTDIR-}' does not exist."
+
 # void cleanup()
 #
 cleanup() {
@@ -28,8 +31,22 @@ MY_CACHE_DIR="${T}/egencache.$$"
 autodie dodir "${MY_CACHE_DIR}"
 trap cleanup INT TERM EXIT
 
+# inlined repos.conf for egencache
+MY_REPO_CONFIG="
+[DEFAULT]
+main-repo = gentoo
+
+[gentoo]
+location = ${PORTDIR}
+
+[${OVERLAY_NAME}]
+location = ${OVERLAY}"
+
+
 # --portdir, --portdir-overlay?
-#  using --portdir-overlay
+#  using --repositories-configuration as
+#   --portdir-overlay is considered deprecated
+#
 # --jobs=?
 # --rsync?
 # --tolerant?
@@ -37,5 +54,6 @@ trap cleanup INT TERM EXIT
 #
 autodie ${EGENCACHE} --ignore-default-opts --update --tolerant \
    --cache-dir="${MY_CACHE_DIR}" \
-   --portdir-overlay="${OVERLAY}" --repo="${OVERLAY_NAME}"
+   --repositories-configuration="${MY_REPO_CONFIG}" \
+   --repo="${OVERLAY_NAME}"
 autodie cleanup


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-23 15:30 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-23 15:30 UTC (permalink / raw
  To: gentoo-commits

commit:     67c6a9d4fb817284a61b0155d5964beb85001987
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Sep 23 14:22:20 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Sep 23 14:22:20 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=67c6a9d4

files/hooks: notify-desktop

Uses notify-send to signalize that roverlay is done.

---
 files/hooks/notify-desktop.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/files/hooks/notify-desktop.sh b/files/hooks/notify-desktop.sh
new file mode 100644
index 0000000..9184c2f
--- /dev/null
+++ b/files/hooks/notify-desktop.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -*- coding: utf-8 -*-
+#
+#  Sends a desktop notification.
+#
+set -u
+
+## load core functions
+. "${FUNCTIONS?}" || exit
+#dont_run_as_root
+
+## load helper functions
+#$lf ...
+
+# hook body starts here
+
+#  roverlay's hook environment doesn't pass $DISPLAY, set it here
+: ${DISPLAY:=:0.0}
+export DISPLAY
+run_command_logged notify-send -t 10000 roverlay "done" || true


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-06 11:10 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-06 11:10 UTC (permalink / raw
  To: gentoo-commits

commit:     7e034cd72de22dc70ca76bbf0b150e3a6fc722b8
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep  6 11:06:23 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep  6 11:06:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7e034cd7

load git functions in git-push

---
 files/hooks/git-push.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/hooks/git-push.sh b/files/hooks/git-push.sh
index e65d861..7d79e64 100644
--- a/files/hooks/git-push.sh
+++ b/files/hooks/git-push.sh
@@ -11,7 +11,7 @@ set -u
 #dont_run_as_root
 
 # using line_iterator() from itertools
-$lf itertools
+$lf git itertools
 
 
 ## functions


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-06 10:22 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-06 10:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e24b74fa8ebecf2338d01b2acc824a7683c5a809
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep  6 10:20:51 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep  6 10:20:51 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e24b74fa

git-push: return 0 even if git push failed

+ remove "echo" in the git push command

---
 files/hooks/git-push.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/files/hooks/git-push.sh b/files/hooks/git-push.sh
index 2dbb73e..e65d861 100644
--- a/files/hooks/git-push.sh
+++ b/files/hooks/git-push.sh
@@ -24,7 +24,7 @@ $lf itertools
 #  if errors occured.
 #
 git_push_to_remote() {
-   if run_command_logged echo ${GIT} push ${GIT_PUSH_ARGS-} "$@"; then
+   if run_command_logged ${GIT} push ${GIT_PUSH_ARGS-} "$@"; then
       veinfo "successfully pushed changes to ${1}"
    else
       __GIT_PUSH_SUCCESS=n
@@ -55,15 +55,16 @@ git_push_to_remotes() {
    if [ "${__GIT_PUSH_SUCCESS}" = "y" ]; then
       return 0
    else
-      return ${EX_GIT_PUSH_ERR}
+      # don't return non-zero due to "git push" errors
+      #  this would cause roverlay to abort
+      #return ${EX_GIT_PUSH_ERR}
+      return 0
    fi
 }
 
 
 ## main
 
-if yesno "${NOSYNC?}"; then
-   einfo "sync is disabled - not pushing anything."
-else
+if sync_allowed "${this}"; then
    git_push_to_remotes
 fi


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-06 10:22 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-06 10:22 UTC (permalink / raw
  To: gentoo-commits

commit:     b5d42e5d74d5aaefca966efe4af8f5bcf0c477f4
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep  6 10:20:05 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep  6 10:20:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b5d42e5d

git-commit-overlay: always reinit git repo

---
 files/hooks/git-commit-overlay.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index e9630d9..2e726fb 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -99,6 +99,8 @@ git_reinit() {
 
 ## main
 
+GIT_WANT_COMMIT=n
+
 # $GIT_DIR, $S/.git, $HOME/.git, ...?
 if [ ! -e "${S}/.git" ]; then
    einfo "Creating git repo"
@@ -107,10 +109,16 @@ if [ ! -e "${S}/.git" ]; then
 
    # assume that there are changes,
    #  git_has_changes() does not work for new repos
-elif ! git_has_changes; then
-   veinfo "${SCRIPT_NAME}: nothing to do."
-   return 0
+   GIT_WANT_COMMIT=y
+elif git_has_changes; then
+   GIT_WANT_COMMIT=y
 fi
 
 autodie git_reinit
-autodie git_commit
+
+if yesno "${GIT_WANT_COMMIT}"; then
+   autodie git_commit
+else
+   veinfo "${this}: nothing to do."
+   return 0
+fi


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-06 10:22 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-06 10:22 UTC (permalink / raw
  To: gentoo-commits

commit:     9f4d5cecf2de280506c0e96b94de56ea6a603ecb
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep  6 10:18:59 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep  6 10:18:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9f4d5cec

files/hooks/mux: run hooks in a subshell

---
 files/hooks/mux.sh | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/files/hooks/mux.sh b/files/hooks/mux.sh
index efda723..c78d9e8 100755
--- a/files/hooks/mux.sh
+++ b/files/hooks/mux.sh
@@ -30,28 +30,23 @@ for hookfile in \
    ${FILESDIR}/hooks/?*.${ROVERLAY_PHASE}
 do
    if [ -f "${hookfile}" ]; then
-      #subshell?
-      #( . "${hookfile}"; ) || ...
-
-      hookfile_name="${hookfile##*/}"
-      this="${hookfile_name#[0-9]*-}"; this="${this%.*}"
-
-      if [ -n "${this}" ]; then
-         veinfo "Running hook ${this} ('${hookfile_name}')"
-      else
-         this="${hookfile_name}"
-         veinfo "Running hook '${hookfile_name}'"
-      fi
-
-      # initial directory should always be $S
-      cd "${S}" && . "${hookfile}" || \
-         die "errors occured while running hook '${hookfile}'"
-
-      # restore signals
-      trap - INT TERM EXIT
-
-      this="${SCRIPT_NAME}"
-      unset -v hookfile_name
+      # subshell: don't leak hook vars/functions
+      (
+         readonly hookfile_name="${hookfile##*/}"
+         this="${hookfile_name#[0-9]*-}"; this="${this%.*}"
+
+         if [ -n "${this}" ]; then
+            veinfo "Running hook ${this} ('${hookfile_name}')"
+         else
+            this="${hookfile_name}"
+            veinfo "Running hook '${hookfile_name}'"
+         fi
+
+         readonly this
+
+         # initial directory should always be $S
+         cd "${S}" && . "${hookfile}"
+      ) || die "errors occured while running hook '${hookfile}'"
    fi
 done
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-04 13:13 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-04 13:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e5b7893c8af1ab5873761e55d7e21b41ba0ff56c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep  4 13:13:30 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep  4 13:13:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e5b7893c

files/hooks: git-push (experimental/todo)

---
 files/hooks/git-push.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/files/hooks/git-push.sh b/files/hooks/git-push.sh
new file mode 100644
index 0000000..2dbb73e
--- /dev/null
+++ b/files/hooks/git-push.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+# -*- coding: utf-8 -*-
+# roverlay hook that pushes the git history to a remote
+#
+#  It's expected that git-commit-overlay is run before this hook.
+#
+set -u
+
+## load core functions
+. "${FUNCTIONS?}" || exit
+#dont_run_as_root
+
+# using line_iterator() from itertools
+$lf itertools
+
+
+## functions
+
+# void git_push_to_remote (
+#    remote, *refspec, **__GIT_PUSH_SUCCESS!, **GIT_PUSH_ARGS
+# )
+#
+#  Runs "git push" for the given remote and sets __GIT_PUSH_SUCCESS to 'n'
+#  if errors occured.
+#
+git_push_to_remote() {
+   if run_command_logged echo ${GIT} push ${GIT_PUSH_ARGS-} "$@"; then
+      veinfo "successfully pushed changes to ${1}"
+   else
+      __GIT_PUSH_SUCCESS=n
+      eerror "could not push changes to ${1}"
+   fi
+   return 0
+}
+
+# int git_push_to_remotes ( **GIT_REMOTES, **GIT_DEFAULT_REMOTE )
+#
+#  Calls git_push_to_remote() for each remote in GIT_REMOTES.
+#  Returns EX_GIT_PUSH_ERR if pushing failed for at least one remote,
+#  else 0.
+#
+git_push_to_remotes() {
+   [ -n "${GIT_REMOTES-}" ] || \
+      local GIT_REMOTES="${GIT_DEFAULT_REMOTE:-origin} master"
+   # or "<remote> :"
+
+   local __GIT_PUSH_SUCCESS=y
+
+   F_ITER=git_push_to_remote \
+   F_ITER_ON_ERROR=return \
+   ITER_SKIP_EMTY=y \
+   ITER_UNPACK_ITEM=y \
+   line_iterator "${GIT_REMOTES}"
+
+   if [ "${__GIT_PUSH_SUCCESS}" = "y" ]; then
+      return 0
+   else
+      return ${EX_GIT_PUSH_ERR}
+   fi
+}
+
+
+## main
+
+if yesno "${NOSYNC?}"; then
+   einfo "sync is disabled - not pushing anything."
+else
+   git_push_to_remotes
+fi


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-04 12:50 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-04 12:50 UTC (permalink / raw
  To: gentoo-commits

commit:     8460261ad790e6a35f47bda6b3089c0bf886143e
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep  4 12:48:06 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep  4 12:48:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=8460261a

git-commit-overlay: reinit git repo, use config vars

* partially reconfigure the git repo (user name/email, ...)
* use GIT_COMMIT_MESSAGE, GIT_COMMIT_MAX_LINE_WIDTH from the hookrc config file
  (if defined there)

---
 files/hooks/git-commit-overlay.sh | 51 ++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index d8b936c..e9630d9 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -19,18 +19,6 @@ set -u
 $lf git
 #autodie qwhich ${GIT}
 
-## "config" for this script
-# FIXME/TODO: remove config here?
-##GIT_COMMIT_AUTHOR='undef undef undef@undef.org'
-GIT_COMMIT_MESSAGE='roverlay updates'
-
-GIT_COMMIT_MAX_LINE_WIDTH=79
-
-
-## other vars
-EX_ADD_ERR=2
-EX_COMMIT_ERR=3
-
 
 ## functions
 
@@ -47,7 +35,7 @@ git_try_rollback() {
    fi
 }
 
-# int git_commit()
+# int git_commit ( **GIT_COMMIT_MESSAGE, **GIT_COMMIT_MAX_LINE_WIDTH )
 #
 #  Adds changes and creates a commit.
 #
@@ -60,17 +48,18 @@ git_commit() {
    #  --all: add changed, new and deleted files
    if ! run_command_logged ${GIT} add --all; then
       git_try_rollback
-      return ${EX_ADD_ERR}
+      return ${EX_GIT_ADD_ERR}
    fi
 
    # create a commit message (file)
    {
-      echo "${GIT_COMMIT_MESSAGE}" && \
+      echo "${GIT_COMMIT_MESSAGE:-roverlay updates}" && \
       echo && \
       ${GIT} status \
          --porcelain --untracked-files=no --ignore-submodules | \
             sed -n -e 's,^[MADRC].[[:blank:]]\(.*\)\/..*[.]ebuild$,\1,p' | \
-               sort -u | xargs echo | fold -s -w ${GIT_COMMIT_MAX_LINE_WIDTH}
+               sort -u | xargs echo | \
+               fold -s -w ${GIT_COMMIT_MAX_LINE_WIDTH:-79}
    } > "${f}" || die
    COMMIT_MSG_FILE="${f}"
 
@@ -84,7 +73,26 @@ git_commit() {
       return 0
    else
       git_try_rollback
-      return ${EX_COMMIT_ERR}
+      return ${EX_GIT_COMMIT_ERR}
+   fi
+}
+
+# void git_reinit (
+#    **GIT_REPO_USER_NAME, **GIT_REPO_USER_EMAIL, **GIT_DEFAULT_REMOTE
+# ), raises die()
+#
+#  Configures the git repo.
+#
+git_reinit() {
+   # update git config
+   git_update_config "user.name" "${GIT_REPO_USER_NAME-}" "roverlay"
+   git_update_config \
+      "user.email" "${GIT_REPO_USER_EMAIL-}" "roverlay@undef.org"
+   git_update_config "push.default" "" "matching"
+
+   # add default remote
+   if [ -n "${GIT_DEFAULT_REMOTE-}" ] && ! git remote | grep -q .; then
+      autodie ${GIT} remote add origin "${GIT_DEFAULT_REMOTE}"
    fi
 }
 
@@ -104,12 +112,5 @@ elif ! git_has_changes; then
    return 0
 fi
 
-
-
+autodie git_reinit
 autodie git_commit
-
-##push changes to local repo?
-##
-##if ! yesno ${NOSYNC}; then
-##   #push changes to remote?
-##fi


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-09-04 10:16 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-09-04 10:16 UTC (permalink / raw
  To: gentoo-commits

commit:     f5b3a78b841a9ae0536a10fe0ccbebfe8aca572c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep  4 10:15:47 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep  4 10:15:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f5b3a78b

files/hook/mux: load ROVERLAY_HOOKRC

... before running the actual hooks

---
 files/hooks/mux.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/files/hooks/mux.sh b/files/hooks/mux.sh
index 40833c6..80bff31 100755
--- a/files/hooks/mux.sh
+++ b/files/hooks/mux.sh
@@ -14,6 +14,13 @@ export LC_CTYPE
 . "${FUNCTIONS?}" || exit
 #dont_run_as_root
 
+
+## load $ROVERLAY_HOOKRC (if set)
+if [ -n "${ROVERLAY_HOOKRC-}" ]; then
+   . "${ROVERLAY_HOOKRC}" || \
+      die "failed to load ROVERLAY_HOOKRC (${ROVERLAY_HOOKRC})."
+fi
+
 # tmpdir should exist (assuming that hooks don't remove this dir)
 autodie dodir "${T}"
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-08-02 10:34 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-08-02 10:34 UTC (permalink / raw
  To: gentoo-commits

commit:     be0c5373d859a7421836189626b0b39d74a6534a
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug  2 10:14:30 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug  2 10:14:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=be0c5373

files/hooks/git-commit-overlay: don't exit

typo fix, hooks have to return instead of exiting

---
 files/hooks/git-commit-overlay.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index ebac032..d8b936c 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -101,7 +101,7 @@ if [ ! -e "${S}/.git" ]; then
    #  git_has_changes() does not work for new repos
 elif ! git_has_changes; then
    veinfo "${SCRIPT_NAME}: nothing to do."
-   exit 0
+   return 0
 fi
 
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-06-22 15:24 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     f4f7cc8c19defd199b4282fefc3db09d96c92e94
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jun 22 10:06:15 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jun 22 10:06:15 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f4f7cc8c

files/hooks/mux.sh: create temporary directory

---
 files/hooks/mux.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/files/hooks/mux.sh b/files/hooks/mux.sh
index c114db5..298998e 100755
--- a/files/hooks/mux.sh
+++ b/files/hooks/mux.sh
@@ -8,6 +8,9 @@ set -u
 . "${FUNCTIONS?}" || exit
 #dont_run_as_root
 
+# tmpdir should exist (assuming that hooks don't remove this dir)
+autodie dodir "${T}"
+
 for hookfile in \
    ${FILESDIR}/hooks/${ROVERLAY_PHASE}/?*.sh \
    ${FILESDIR}/hooks/?*.${ROVERLAY_PHASE}
@@ -26,3 +29,5 @@ do
       trap - INT TERM EXIT
    fi
 done
+
+rmdir "${T}" 2>>${DEVNULL} || true


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: files/hooks/
@ 2013-06-22 15:24 André Erdmann
  0 siblings, 0 replies; 15+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     c0d8dede6893a998f7ec5d06eb24d30f02e931b1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jun 21 18:33:23 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jun 21 18:33:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c0d8dede

git-commit-overlay.sh: drop --author arg

---
 files/hooks/git-commit-overlay.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index 43060ab..c33be9e 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -28,7 +28,7 @@ $lf git
 
 ## "config" for this script
 # FIXME/TODO: remove config here?
-GIT_COMMIT_AUTHOR='undef undef undef@undef.org'
+##GIT_COMMIT_AUTHOR='undef undef undef@undef.org'
 GIT_COMMIT_MESSAGE='roverlay updates'
 
 GIT_COMMIT_MAX_LINE_WIDTH=79
@@ -84,7 +84,7 @@ git_commit() {
    # commit
    if run_command_logged \
       ${GIT} commit --quiet --no-edit \
-         --file "${COMMIT_MSG_FILE}" --author="${GIT_COMMIT_AUTHOR}"
+         --file "${COMMIT_MSG_FILE}" ## --author="${GIT_COMMIT_AUTHOR}"
    then
       rm "${COMMIT_MSG_FILE-}" && COMMIT_MSG_FILE=
       trap - INT TERM EXIT


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: files/hooks/
@ 2013-06-21 18:41 André Erdmann
  2013-06-22 15:24 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
  0 siblings, 1 reply; 15+ messages in thread
From: André Erdmann @ 2013-06-21 18:41 UTC (permalink / raw
  To: gentoo-commits

commit:     5234fac2c9dfd6f8620db345becf16258e87da4d
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jun 21 18:40:42 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jun 21 18:40:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5234fac2

git-commit-overlay.sh: remove TODO note

remove commit message TODO note as it's implemented now

---
 files/hooks/git-commit-overlay.sh | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/files/hooks/git-commit-overlay.sh b/files/hooks/git-commit-overlay.sh
index c33be9e..ebac032 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -11,13 +11,6 @@
 #
 set -u
 
-# TODO:
-#
-# create meaningful commit messages
-# * include package list in the message body
-# -> git status --porcelain
-# -> 78/80 chars per line
-
 ## load core functions
 . "${FUNCTIONS?}" || exit
 #dont_run_as_root


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-04-01 16:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 11:10 [gentoo-commits] proj/R_overlay:master commit in: files/hooks/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2014-04-01 16:38 André Erdmann
2014-01-25 18:14 André Erdmann
2013-09-23 15:30 André Erdmann
2013-09-06 11:10 André Erdmann
2013-09-06 10:22 André Erdmann
2013-09-06 10:22 André Erdmann
2013-09-06 10:22 André Erdmann
2013-09-04 13:13 André Erdmann
2013-09-04 12:50 André Erdmann
2013-09-04 10:16 André Erdmann
2013-08-02 10:34 André Erdmann
2013-06-22 15:24 André Erdmann
2013-06-22 15:24 André Erdmann
2013-06-21 18:41 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 ` [gentoo-commits] proj/R_overlay:master " André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox