GithubHelp home page GithubHelp logo

pwclient's People

Contributors

1ace avatar aldot avatar alialnu avatar andersson avatar bebarino avatar computersforpeace avatar daxtens avatar dianders avatar dirkwallenstein avatar ffainelli avatar ffy00 avatar fweimer-rh avatar gkurz avatar jk-ozlabs avatar jnikula avatar karolherbst avatar mbgg avatar mchehab avatar nwnk avatar olofj avatar paulepanter avatar pevik avatar rjarry avatar robherring avatar rossburton avatar saiprakash-ranjan avatar stephenfin avatar ukleinek avatar vapier avatar yann-morin-1998 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwclient's Issues

pwclient crash when migrating old config

/home/compile/.pwclientrc is in the old format. Migrating it...Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.7/pwclient", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.7/site-packages/pwclient/shell.py", line 45, in main
    utils.migrate_old_config_file(CONFIG_FILE, config)
  File "/usr/lib/python3.7/site-packages/pwclient/utils.py", line 41, in migrate_old_config_file
    new_config.write(fd)
  File "/usr/lib/python3.7/configparser.py", line 918, in write
    self._sections[section].items(), d)
  File "/usr/lib/python3.7/configparser.py", line 922, in _write_section
    fp.write("[{}]\n".format(section_name))
TypeError: a bytes-like object is required, not 'str'

This is my old config:

[base]                                                                                              
url: https://patchwork.kernel.org/xmlrpc/
project: linux-arm-kernel

I can't round-trip a hash/patchid

I appear to be unable to correctly round-trip a patch ID to hash and back again.

Using this patchwork server: https://patchwork.yoctoproject.org/project/oe-core/ and this fragment in my .pwclientrc:

[options]
default = oe-core

[oe-core]
backend = rest
url = https://patchwork.yoctoproject.org/api
token = xxx

I can request the info for a specific patch ID:

$ pwclient info 34317
Information for patch id 34317
------------------------------
- archived      : False
- commit_ref    :
- date          : 2023-11-11T18:44:32
- delegate      :
- delegate_id   :
- filename      :
- hash          : 732e487978cd2af56aaad959cae1a772448ddfed
- id            : 34317
- msgid         : <[email protected]>
- name          : libsoup: Upgrade to 3.4.2 -> 3.4.4
- project       : OpenEmbedded Core Layer
- project_id    : 6
- state         : new
- state_id      :
- submitter     : Khem Raj <[email protected]>
- submitter_id  : 10

But if I try and look up the hash:

$ pwclient info -h 732e487978cd2af56aaad959cae1a772448ddfed
No patch has the hash provided

It's the enforced project argument which is causing this, and I can't figure out what project it's expecting. Neither oe-core, 6, or OpenEmbedded Core Layer are accepted, but if I delete the project argument from the API call entirely then the call succeeds.

I suspect I'm missing something obvious?

Crash when migrating old config

I'm getting an error when migrating an old config, version 2.0.0, installed through pip

  File "/usr/bin/pwclient", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/pwclient/shell.py", line 45, in main
    utils.migrate_old_config_file(CONFIG_FILE, config)
  File "/usr/lib/python3.10/site-packages/pwclient/utils.py", line 17, in migrate_old_config_file
    old_project = config.get('base', 'project')
  File "/usr/lib/python3.10/configparser.py", line 782, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.10/configparser.py", line 1153, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'base'```

If multiple patches have the same hash, pwclient does not take any

pwclient info -h 4a47f1233259930c1e9c532d8c5c0acbf2ae213b
No patch has the hash provided

git-pw patch list --hash 4a47f1233259930c1e9c532d8c5c0acbf2ae213b
+------+-------------+-----------------------------------------------------------------+----------------------------------------------+---------+------------+------------+
|   ID | Date        | Name                                                            | Submitter                                    | State   | Archived   | Delegate   |
|------+-------------+-----------------------------------------------------------------+----------------------------------------------+---------+------------+------------|
| 1928 | a week ago  | [v2,46/46] utils: merge  | jp (jxxxxxxx.com)                    | new     | no         |            |
| 4646 | 2 weeks ago | [45/45] utils: merge     | jp (jxxxxxxx..com)                   | new     | no         |            |
+------+-------------+-----------------------------------------------------------------+----------------------------------------------+---------+------------+------------+

Please add a command to fetch all patches in a series and apply them

I currently have to find all patches in a series and manually list them as args to git-am to apply them. It would be cooler if I could apply them with the series id somehow.

I would love to be able to do something like this:

pwclient git-am-series 846671

Where 846671 is a patch series and the command applies all patches from that series.

cannot marshal None unless allow_none is enabled

$ pwclient list -w Licht
Traceback (most recent call last):
  File "/gnu/store/8z3z6p6rl6i8z7s96m18a251rfkdz4il-pwclient-2.6.0/bin/.pwclient-real", line 10, in <module>
    sys.exit(main())
  File "/gnu/store/8z3z6p6rl6i8z7s96m18a251rfkdz4il-pwclient-2.6.0/lib/python3.10/site-packages/pwclient/shell.py", line 140, in main
    patches.action_list(
  File "/gnu/store/8z3z6p6rl6i8z7s96m18a251rfkdz4il-pwclient-2.6.0/lib/python3.10/site-packages/pwclient/patches.py", line 91, in action_list
    patches = api.patch_list(**filters)
  File "/gnu/store/8z3z6p6rl6i8z7s96m18a251rfkdz4il-pwclient-2.6.0/lib/python3.10/site-packages/pwclient/api.py", line 300, in patch_list
    patches += self._client.patch_list(filters)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 1182, in single_request
    return self.parse_response(resp)
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: "<class 'TypeError'>:cannot marshal None unless allow_none is enabled">
$ cat ~/.pwclientrc
# Sample .pwclientrc file for the guix-patches project,
# running on patches.guix-patches.cbaines.net.
#
# Just append this file to your existing ~/.pwclientrc
# If you do not already have a ~/.pwclientrc, then copy this file to
# ~/.pwclientrc, and uncomment the following two lines:
# [options]
# default=guix-patches

[guix-patches]
url = https://patches.guix-patches.cbaines.net/xmlrpc/

[options]
default=guix-patches

Are the entries in .pwclientrc servers or projects?

There appears to be some confusion as to whether the entries in .pwclientrc are servers or projects.

Should it list projects, so I should have a "glibc" entry for https://patchwork.sourceware.org/project/glibc/ if I then wanted to search the gcc project too, I should copy-paste the block entirely as the URL and auth token are identical?

Or should the pwclientrc file list servers as settings like custom states are per-server, and ensure that any confusion in the code between the server and the project is cleared up?

Discovered as I had a patchwork entry for "yocto" and the lookup-by-hash functionality wasn't working as whilst it was hitting the right server, it was telling the server to restrict my search to the "yocto" project, but that doesn't exist.

pwclient git-am id but failed

$ root@peter-Z390-UD:/opt/test/linux# pwclient search "DEBUG_EXPERIENCE"

ID      State        Name
--      -----        ----
10373897 New          [4/5] kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization
10373893 New          [5/5] asm-generic: fix build error in fix_to_virt with CONFIG_DEBUG_EXPERIENCE
10375673 New          [v2,4/5] kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization
10375671 New          [v2,5/5] asm-generic: fix build error in fix_to_virt with CONFIG_DEBUG_EXPERIENCE
10378241 New          [v2,5/5] asm-generic: fix build error in fix_to_virt with CONFIG_DEBUG_EXPERIENCE

$ root@peter-Z390-UD:/opt/test/linux# pwclient get 10375673

Saved patch to v2-4-5-kernel-hacking-new-config-DEBUG_EXPERIENCE-to-apply-GCC--Og-optimization.0.patch

$ root@peter-Z390-UD:/opt/test/linux# pwclient git-am 10375673

Applying patch #10375673 using "git am"
Description: [v2,4/5] kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization
Applying: kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization
error: patch failed: Makefile:639
error: Makefile: patch does not apply
error: patch failed: include/linux/compiler-gcc.h:192
error: include/linux/compiler-gcc.h: patch does not apply
error: patch failed: include/linux/compiler.h:301
error: include/linux/compiler.h: patch does not apply
error: patch failed: lib/Kconfig.debug:216
error: lib/Kconfig.debug: patch does not apply
Patch failed at 0001 kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
'git am' failed with exit status 128

REST API limited to 30 responses

The current implementation of the REST API doesn't handle pagination responses for listing patches, so it is limited to a single reply, which is 30 items by default on most patchwork servers.

username/password not properly encoded for proxy servers

Hello,

The current code in pwclient.xmlrpc does not encode the username/password properly (using URL percent encoding) when the proxy server requires authentification. This could lead to issues (failure to authenticate) if the password contains special characters such as '@'.

Best regards,
François

pwclient should report more user-friendly message on Connection Refused

From an email exchange, pwclient failed with:

[long traceback snipped]
socket.error: [Errno 111] Connection refused

This looks like what would happen if you tried to use pwclient when our
web server was down. This happens every now and then for very short
periods of time when we do updates to various things (including
libraries that the web server itself depends on).

Do the developers: maybe it is worth catching this error in particular
and giving some reasonable message (or, optionally,trying again after a
short wait - or both).

Do this in the pwclient rest api rewrite.

This was originally filed against Patchwork.

The delegate option gives an error 'Must be User instance'

Hi,
when I run this command:

pwclient list -p linux-pm -s New -N 3 -d "[email protected]"

I'm getting this output but unable to parse the problem.

Patches delegated to Daniel Lezcano <[email protected]>:
Traceback (most recent call last):
  File "/usr/local/bin/pwclient", line 11, in <module>
    sys.exit(main())
  File "/home/dlezcano/.local/lib/python2.7/site-packages/pwclient/shell.py", line 129, in main
    patches.action_list(rpc, filt, submitter_str, delegate_str, format_str)
  File "/home/dlezcano/.local/lib/python2.7/site-packages/pwclient/patches.py", line 144, in action_list
    patches = rpc.patch_list(f.d)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1493, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: u'<class \'ValueError\'>:Cannot query "Daniel Lezcano <[email protected]>": Must be "User" instance.'>

pwclient info fails with "the JSON object must be str, bytes or bytearray, not dict"

I tried to use pwclient, but it fails with "the JSON object must be str, bytes or bytearray, not dict"

$ pip install pwclient
$ pip show pwclient
Name: pwclient
Version: 2.5.0
Summary: The command-line client for the Patchwork patch tracking tool
Home-page: https://github.com/getpatchwork/pwclient
Author: Nate Case
Author-email: [email protected]
License: GPL v2
Location: /home/jekeller/.local/lib/python3.10/site-packages
Requires:
Required-by:

$ cat ~/.pwclientrc
[options]
default = kernel

[kernel]
url = https://patchwork.kernel.org/api/
backend = rest
username = jekeller
token = <redacted>

$ pwclient info 13185597
the JSON object must be str, bytes or bytearray, not dict

'check-get' command is broken in 2.2.0

Running check-get command results in a splat:

$ pwclient check-get 1643273
Traceback (most recent call last):
File "/home/rob/.local/bin/pwclient", line 10, in
sys.exit(main())
File "/home/rob/.local/lib/python3.10/site-packages/pwclient/shell.py", line 245, in main
checks.action_get(api, patch_id, format_str)
File "/home/rob/.local/lib/python3.10/site-packages/pwclient/checks.py", line 42, in action_get
checks_list = api.patch_check_get(patch_id)
AttributeError: 'XMLRPC' object has no attribute 'patch_check_get'

update from 2.5.0 to 2.6.0 break pw-fdo

Updating pwclient from 2.5.0 to 2.6.0 broke updating pathches in pw-fdo setup:

$  ~/.local/bin/pwclient update -s Accep 524726
Patch not updated

Bisecting pointed out to 0949e9e as the first bad commit.

Cannot apply patches with non-ascii characters inside

Hello,

I am using patchwork/pwclient for quite some time now to manage my linux-mtd patches.

I recently got into troubles because of one contributor having a non-ascii character in its name (I suppose this is the root cause). Here is the trace:

$ git pwc -rN100
pw_filter=
git-pwc: Patchwork cache too cold, retrieving patch list for linux-mtd...pwclient command: pwclient list -p linux-mtd -N 100 -s New 
 done
Traceback (most recent call last):
  File "/home/mraynal/.local/bin/pwclient", line 10, in <module>
    sys.exit(main())
  File "/home/mraynal/.local/lib/python2.7/site-packages/pwclient/shell.py", line 757, in main
    print(s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 7360: ordinal not in range(128)

This is happening with the latest pwclient from Git:
698fa7f Fix return code when getting patch information fails

Here is the patch I tried to apply:
mtd-onenand-Add-support-for-8Gb-datasize-onenand.patch.txt

Right now I use the following hack to avoid being bothered, but there are probably many other places where this can happen and a cleaner solution would be welcome!

diff --git a/pwclient/shell.py b/pwclient/shell.py
index 43c7a37..30826fa 100644
--- a/pwclient/shell.py
+++ b/pwclient/shell.py
@@ -754,7 +754,7 @@ installed locales.
             for patch_id in non_empty(h, patch_ids):
                 s = rpc.patch_get_mbox(patch_id)
                 if len(s) > 0:
-                    print(s)
+                    print(s.encode('utf-8', errors='ignore'))
 
     elif action == 'info':
         for patch_id in non_empty(h, patch_ids):

Issues with HTTPS endpoints behind a proxy server

Hello,

The code in pwclient.xmlrpc fails when a proxy server is used (either HTTP or HTTPS) and the remote endpoint is served over HTTPS.

That's because the code attempts to proxy the request using a non-standard way, e.g.

POST https://somehost/api/ HTTP/1.1
...

Instead it should use the standard CONNECT method to first establish an SSL tunnel with the remote server and then send the request the usual way:

CONNECT https://somehost/ HTTP/1.1
(wait for confirmation that the tunnel has been set up)
POST /api/ HTTP/1.1
...

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling#http_tunneling for more information.

Please note that this only affects connects to an HTTPS endpoint behind a proxy. For HTTP endpoints, the current code does a proper job (in this case, using a fully qualified URL is the right way to proxy the request).

Best regards,
François

Encoding error in output of `pwclient info`

When interacting with the patchwork instance on http://patchwork.ozlabs.org/project/linux-pwm/list/ using pwclient 1.3.0 I get:

$ pwclient info 1483752
Information for patch id 1483752
--------------------------------
- archived      : False
- commit_ref    : 
- date          : 2021-05-25 20:31:56
- delegate      : None
- delegate_id   : 0
- filename      : pwm-crc-Simplify-using-devm_pwmchip_add
- hash          : 49644ef2e5a02b4e009a3ae9a7a706e74e2791d2
- id            : 1483752
- msgid         : <[email protected]>
- name          : pwm: crc: Simplify using devm_pwmchip_add()
- project       : Linux PWM development
- project_id    : 38
- state         : New
- state_id      : 1
- submitter     : Uwe Kleine-König <[email protected]>
- submitter_id  : 1476

The ö in my name in the submitter line is misencoded. As the name looks fine when looking at
http://patchwork.ozlabs.org/project/linux-pwm/list/?submitter=1476 I assume the problem is in pwclient. (But I didn't check).

'view' command output broken in 2.2.0

The patch 'view' subcommand output is broken in 2.2.0 release. The problem is new lines aren't decoded. For example:

$ pwclient view 1643273                                                                  
('From patchwork Tue Jun 14 12:09:57 2022\nContent-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Trans
fer-Encoding: 7bit\nX-Patchwork-Submitter: Irui Wang <[email protected]>\nX-Patchwork-Id: 1643273\nReturn-Path: <
[email protected]>\nX-Original-To: [email protected]\nDelivered-To: patchwork-incoming-d
[email protected]\nAuthentication-Results: ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.o
rg\n (client-ip=2620:137:e000::1:20; helo=out1.vger.email;\n [email protected]; receiver=
<UNKNOWN>)\nReceived: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20])\n\tby bilbo.ozlabs.org (Postfi
x) with ESMTP id 4LMnLz19mZz9sGk\n\tfor <[email protected]>;\n Tue, 14 Jun 2022 22:10:19 +1000 (AEST)\n
...

Add a release

Hello, would it be possible to add a release so that pwclient can be properly packaged by distributions?

Thanks,
Filipe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.