Re: [5/5] tools: Update to use 'parsemail --hash'
On Thu, Dec 01, 2016 at 01:21:40PM +, Stephen Finucane wrote: > On Tue, 2016-11-29 at 18:53 -0500, Tom Rini wrote: > > On Fri, Nov 18, 2016 at 12:54:52AM +, Stephen Finucane wrote: > > > > > This replaces the older 'parser' main function. > > > > > > Signed-off-by: Stephen Finucane> > > Cc: Paul Jakma > > > > With this series on top of 2941d6f47fd242d53c52e966501fb09e2eb19473 I > > don't have success, but instead: > > Traceback (most recent call last): > > File "/home/trini/work/u-boot/patchwork/manage.py", line 11, in > > execute_from_command_line(sys.argv) > > File "/usr/lib/python2.7/dist- > > packages/django/core/management/__init__.py", line 399, in > > execute_from_command_line > > utility.execute() > > File "/usr/lib/python2.7/dist- > > packages/django/core/management/__init__.py", line 392, in execute > > self.fetch_command(subcommand).run_from_argv(self.argv) > > File "/usr/lib/python2.7/dist- > > packages/django/core/management/base.py", line 242, in run_from_argv > > self.execute(*args, **options.__dict__) > > File "/usr/lib/python2.7/dist- > > packages/django/core/management/base.py", line 285, in execute > > output = self.handle(*args, **options) > > File "/home/trini/work/u- > > boot/patchwork/patchwork/management/commands/parsemail.py", line 69, > > in > > handle > > infile = args[0] if args else > > options['infile'] KeyError: > > 'infile' > > > > And if I don't pass PW_PYTHON=python2: > > ./post-receive.hook: line 38: PW_PYTHON: unbound variable > > > > I also need to set DJANGO_SETTINGS_MODULE=patchwork.settings.dev > > because > > the default of 'production' assumes a bunch of other stuff has been > > setup and configured. > > > > A related tangent, as an end user I'm finding top of tree way way > > harder > > to get going with than v1.1.1. > > Does this relate to the script / hook functionality only, or are there > other usability issues you've seen in deploying 'master'? I'm just talking about the hook here, we use the ozlabs patchwork instance for patchwork on U-Boot. > > From the point of view of a script / > > hook that will be used very disconnected from the patchwork server it > > seems like things are taking a step backwards in terms of ease of > > use. > > I hear you: usage of this script on a different server from the one > that Patchwork is hosted from is a clear use case, but one I didn't > consider when writing v1 of this series. Hopefully v3 of this is more > to your liking. Let me know. Yes, this solved all of my concerns in that regard, I purged django from my system and was able to run the tools again. This is important because I don't want to install more stuff than is strictly required on the git server. Thanks! -- Tom signature.asc Description: Digital signature ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [5/5] tools: Update to use 'parsemail --hash'
On Fri, Nov 18, 2016 at 12:54:52AM +, Stephen Finucane wrote: > This replaces the older 'parser' main function. > > Signed-off-by: Stephen Finucane> Cc: Paul Jakma With this series on top of 2941d6f47fd242d53c52e966501fb09e2eb19473 I don't have success, but instead: Traceback (most recent call last): File "/home/trini/work/u-boot/patchwork/manage.py", line 11, in execute_from_command_line(sys.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) File "/home/trini/work/u-boot/patchwork/patchwork/management/commands/parsemail.py", line 69, in handle infile = args[0] if args else options['infile'] KeyError: 'infile' And if I don't pass PW_PYTHON=python2: ./post-receive.hook: line 38: PW_PYTHON: unbound variable I also need to set DJANGO_SETTINGS_MODULE=patchwork.settings.dev because the default of 'production' assumes a bunch of other stuff has been setup and configured. A related tangent, as an end user I'm finding top of tree way way harder to get going with than v1.1.1. From the point of view of a script / hook that will be used very disconnected from the patchwork server it seems like things are taking a step backwards in terms of ease of use. Thanks and happy to help test things more! -- Tom signature.asc Description: Digital signature ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [5/5] tools: Update to use 'parsemail --hash'
On Tue, 2016-11-29 at 18:53 -0500, Tom Rini wrote: > On Fri, Nov 18, 2016 at 12:54:52AM +, Stephen Finucane wrote: > > > This replaces the older 'parser' main function. > > > > Signed-off-by: Stephen Finucane> > Cc: Paul Jakma > > With this series on top of 2941d6f47fd242d53c52e966501fb09e2eb19473 I > don't have success, but instead: > Traceback (most recent call last): > File "/home/trini/work/u-boot/patchwork/manage.py", line 11, in > execute_from_command_line(sys.argv) > File "/usr/lib/python2.7/dist- > packages/django/core/management/__init__.py", line 399, in > execute_from_command_line > utility.execute() > File "/usr/lib/python2.7/dist- > packages/django/core/management/__init__.py", line 392, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/lib/python2.7/dist- > packages/django/core/management/base.py", line 242, in run_from_argv > self.execute(*args, **options.__dict__) > File "/usr/lib/python2.7/dist- > packages/django/core/management/base.py", line 285, in execute > output = self.handle(*args, **options) > File "/home/trini/work/u- > boot/patchwork/patchwork/management/commands/parsemail.py", line 69, > in > handle > infile = args[0] if args else > options['infile'] KeyError: > 'infile' > > And if I don't pass PW_PYTHON=python2: > ./post-receive.hook: line 38: PW_PYTHON: unbound variable > > I also need to set DJANGO_SETTINGS_MODULE=patchwork.settings.dev > because > the default of 'production' assumes a bunch of other stuff has been > setup and configured. > > A related tangent, as an end user I'm finding top of tree way way > harder > to get going with than v1.1.1. Does this relate to the script / hook functionality only, or are there other usability issues you've seen in deploying 'master'? > From the point of view of a script / > hook that will be used very disconnected from the patchwork server it > seems like things are taking a step backwards in terms of ease of > use. I hear you: usage of this script on a different server from the one that Patchwork is hosted from is a clear use case, but one I didn't consider when writing v1 of this series. Hopefully v3 of this is more to your liking. Let me know. > Thanks and happy to help test things more! Any time. Stephen ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
[PATCH 5/5] tools: Update to use 'parsemail --hash'
This replaces the older 'parser' main function. Signed-off-by: Stephen FinucaneCc: Paul Jakma --- tools/patchwork-update-commits | 18 ++ tools/post-receive.hook| 21 +++-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/patchwork-update-commits b/tools/patchwork-update-commits index d0f63a9..c5e8b15 100755 --- a/tools/patchwork-update-commits +++ b/tools/patchwork-update-commits @@ -19,8 +19,16 @@ # along with Patchwork; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -toolsdir="$(dirname "$0")" -pwpath="${toolsdir}"/../patchwork +BASE_DIR=`dirname $0` +PW_DIR=`readlink -e $BASE_DIR/..` + +if [ -z $PW_PYTHON ]; then +PW_PYTHON=python2 +fi + +if [ -z $DJANGO_SETTINGS_MODULE ]; then +DJANGO_SETTINGS_MODULE=patchwork.settings.production +fi if [ "$#" -lt 1 ]; then echo "usage: $0 " >&2 @@ -29,6 +37,8 @@ fi git rev-list --reverse "$@" | while read commit; do -hash=$(git show "$commit" | python $pwpath/parser.py -#) -$pwpath/bin/pwclient update -s Accepted -c "$commit" -h "$hash" +hash=$(git show "$commit" | \ + DJANGO_SETTINGS_MODULE="$DJANGO_SETTINGS_MODULE" \ + $PW_PYTHON "$PW_DIR/manage.py" parsemail --hash --verbosity=0) +$PW_DIR/patchwork/bin/pwclient update -s Accepted -c "$commit" -h "$hash" done diff --git a/tools/post-receive.hook b/tools/post-receive.hook index a19e1b2..aba7b8a 100755 --- a/tools/post-receive.hook +++ b/tools/post-receive.hook @@ -30,29 +30,38 @@ STATE_MAP="refs/heads/master:Accepted" # EXCLUDE="" -PWDIR=/opt/patchwork/patchwork +PW_DIR=/opt/patchwork do_exit=0 trap "do_exit=1" INT -get_patchwork_hash() -{ +if [ -z $PW_PYTHON ]; then +PW_PYTHON=python2 +fi + +if [ -z $DJANGO_SETTINGS_MODULE ]; then +DJANGO_SETTINGS_MODULE=patchwork.settings.production +fi + +get_patchwork_hash() { local hash -hash=$(git show -C $1 | python $PWDIR/parser.py --hash) +hash=$(git show -C $1 | \ + DJANGO_SETTINGS_MODULE="$DJANGO_SETTINGS_MODULE" \ + $PW_PYTHON "$PW_DIR/manage.py" parsemail --hash --verbosity 0) echo $hash test -n "$hash" } get_patch_id() { local id -id=$($PWDIR/bin/pwclient info -h $1 2>/dev/null \ +id=$($PW_DIR/patchwork/bin/pwclient info -h $1 2>/dev/null \ | sed -rne 's,- id[[:space:]]*: ,,p') echo $id test -n "$id" } set_patch_state() { -$PWDIR/bin/pwclient update -s $2 -c $3 $1 2>&1 +$PW_DIR/patchwork/bin/pwclient update -s $2 -c $3 $1 2>&1 } update_patches() { -- 2.7.4 ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork