diff mbox

[U-Boot,v3] patman: add distutils based installer

Message ID 1437556906-18358-1-git-send-email-judge.packham@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Chris Packham July 22, 2015, 9:21 a.m. UTC
To make it easier to use patman on other projects add a distutils style
installer. Now patman can be installed with

  cd u-boot/tools/patman && python setup.py install

There are also the usual distutils options for creating source/binary
distributions of patman.

Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Chris Packham <judge.packham@gmail.com>

---
This gives us something that can be distributed separately as well as
in-tree. The import trick allows the python module "patman" to be
distributed and enables in-tree use without moving things around. An
alternative would be to move the files into a sub directory
(unfortunately a directory called "patman" would clash with the existing
symlink).

Thanks,
Chris

Changes in v3:
- Add installation instructions to tools/patman/README
- Drop RFC, Add sign-off
- Collect tested tag from Simon

Changes in v2:
- Install as "patman" package
- Allow running in-tree or out-of-tree

 tools/patman/README      | 11 +++++++++++
 tools/patman/__init__.py |  3 +++
 tools/patman/patman.py   | 20 ++++++++++++--------
 tools/patman/setup.py    | 13 +++++++++++++
 4 files changed, 39 insertions(+), 8 deletions(-)
 create mode 100644 tools/patman/__init__.py
 create mode 100644 tools/patman/setup.py

Comments

Simon Glass July 23, 2015, 2:10 a.m. UTC | #1
Hi Chris,

On 22 July 2015 at 03:21, Chris Packham <judge.packham@gmail.com> wrote:
> To make it easier to use patman on other projects add a distutils style
> installer. Now patman can be installed with
>
>   cd u-boot/tools/patman && python setup.py install
>
> There are also the usual distutils options for creating source/binary
> distributions of patman.
>
> Tested-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>
> ---
> This gives us something that can be distributed separately as well as
> in-tree. The import trick allows the python module "patman" to be
> distributed and enables in-tree use without moving things around. An
> alternative would be to move the files into a sub directory
> (unfortunately a directory called "patman" would clash with the existing
> symlink).
>
> Thanks,
> Chris
>
> Changes in v3:
> - Add installation instructions to tools/patman/README
> - Drop RFC, Add sign-off
> - Collect tested tag from Simon
>
> Changes in v2:
> - Install as "patman" package
> - Allow running in-tree or out-of-tree
>
>  tools/patman/README      | 11 +++++++++++
>  tools/patman/__init__.py |  3 +++
>  tools/patman/patman.py   | 20 ++++++++++++--------
>  tools/patman/setup.py    | 13 +++++++++++++
>  4 files changed, 39 insertions(+), 8 deletions(-)
>  create mode 100644 tools/patman/__init__.py
>  create mode 100644 tools/patman/setup.py

Acked-by: Simon Glass <sjg@chromium.org>

BTW in the README it should be U-Boot with a capital b. I can fix that
up when I apply it if you like. For me I needed 'sudo' on the python
command. Is that expected?

Regards
Simon
Masahiro Yamada July 23, 2015, 3:41 a.m. UTC | #2
2015-07-23 11:10 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Chris,
>
> On 22 July 2015 at 03:21, Chris Packham <judge.packham@gmail.com> wrote:
>> To make it easier to use patman on other projects add a distutils style
>> installer. Now patman can be installed with
>>
>>   cd u-boot/tools/patman && python setup.py install
>>
>> There are also the usual distutils options for creating source/binary
>> distributions of patman.
>>


Maybe we should split patman into a separate project someday.
It is not tightly coupled with the u-boot core.
Chris Packham July 23, 2015, 9:20 a.m. UTC | #3
On Thu, Jul 23, 2015 at 2:10 PM, Simon Glass <sjg@chromium.org> wrote:
> Hi Chris,
>
> On 22 July 2015 at 03:21, Chris Packham <judge.packham@gmail.com> wrote:
>> To make it easier to use patman on other projects add a distutils style
>> installer. Now patman can be installed with
>>
>>   cd u-boot/tools/patman && python setup.py install
>>
>> There are also the usual distutils options for creating source/binary
>> distributions of patman.
>>
>> Tested-by: Simon Glass <sjg@chromium.org>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>>
>> ---
>> This gives us something that can be distributed separately as well as
>> in-tree. The import trick allows the python module "patman" to be
>> distributed and enables in-tree use without moving things around. An
>> alternative would be to move the files into a sub directory
>> (unfortunately a directory called "patman" would clash with the existing
>> symlink).
>>
>> Thanks,
>> Chris
>>
>> Changes in v3:
>> - Add installation instructions to tools/patman/README
>> - Drop RFC, Add sign-off
>> - Collect tested tag from Simon
>>
>> Changes in v2:
>> - Install as "patman" package
>> - Allow running in-tree or out-of-tree
>>
>>  tools/patman/README      | 11 +++++++++++
>>  tools/patman/__init__.py |  3 +++
>>  tools/patman/patman.py   | 20 ++++++++++++--------
>>  tools/patman/setup.py    | 13 +++++++++++++
>>  4 files changed, 39 insertions(+), 8 deletions(-)
>>  create mode 100644 tools/patman/__init__.py
>>  create mode 100644 tools/patman/setup.py
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
> BTW in the README it should be U-Boot with a capital b. I can fix that
> up when I apply it if you like.

Yes thanks.

> For me I needed 'sudo' on the python
> command. Is that expected?

Depending on your OS and where you want to install it yes. You could also use

 $ python setup.py install --user

or

 $ python setup.py install --home=~

or even

 $ python setup.py bdist_rpm
 $ sudo rpm -i dist/patman-1.0-1.noarch.rpm

distutils[1] provides lots of knobs for how you might want to install
packages (except for .deb, I have no idea why bdist_deb isn't a
thing).

--
[1] - https://docs.python.org/2/install/index.html#install-index
Chris Packham July 23, 2015, 9:36 a.m. UTC | #4
On Thu, Jul 23, 2015 at 3:41 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2015-07-23 11:10 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Chris,
>>
>> On 22 July 2015 at 03:21, Chris Packham <judge.packham@gmail.com> wrote:
>>> To make it easier to use patman on other projects add a distutils style
>>> installer. Now patman can be installed with
>>>
>>>   cd u-boot/tools/patman && python setup.py install
>>>
>>> There are also the usual distutils options for creating source/binary
>>> distributions of patman.
>>>
>
>
> Maybe we should split patman into a separate project someday.
> It is not tightly coupled with the u-boot core.
>

It could be treated the same way the git project treats gitk and
git-gui. The sources are still included in the main project and
distributed along with the rest of it but they are merged from an
external upstream where the real development happens. The upstream
project is also free to make releases on whatever schedule they
determine (although these days there isn't much development going on
in for gitk/git-gui).
Simon Glass July 28, 2015, 5:39 p.m. UTC | #5
Hi Chris,

On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
> On Thu, Jul 23, 2015 at 3:41 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> 2015-07-23 11:10 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> Hi Chris,
>>>
>>> On 22 July 2015 at 03:21, Chris Packham <judge.packham@gmail.com> wrote:
>>>> To make it easier to use patman on other projects add a distutils style
>>>> installer. Now patman can be installed with
>>>>
>>>>   cd u-boot/tools/patman && python setup.py install
>>>>
>>>> There are also the usual distutils options for creating source/binary
>>>> distributions of patman.
>>>>
>>

Applied to u-boot-x86, thanks!

>>
>> Maybe we should split patman into a separate project someday.
>> It is not tightly coupled with the u-boot core.
>>
>
> It could be treated the same way the git project treats gitk and
> git-gui. The sources are still included in the main project and
> distributed along with the rest of it but they are merged from an
> external upstream where the real development happens. The upstream
> project is also free to make releases on whatever schedule they
> determine (although these days there isn't much development going on
> in for gitk/git-gui).

That sounds like a useful model. However there are so few patches to
patman - is it worth it?

Regards,
Simon
Otavio Salvador July 28, 2015, 5:45 p.m. UTC | #6
On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>> It could be treated the same way the git project treats gitk and
>> git-gui. The sources are still included in the main project and
>> distributed along with the rest of it but they are merged from an
>> external upstream where the real development happens. The upstream
>> project is also free to make releases on whatever schedule they
>> determine (although these days there isn't much development going on
>> in for gitk/git-gui).
>
> That sounds like a useful model. However there are so few patches to
> patman - is it worth it?

Sure it is; I have asked it in past I think.

I would like to have it in Debian, Arch and other linux distros and
get more people using it to manage patch series. It is hard to explain
it can be used for other project it being inside U-Boot source code.
Simon Glass July 28, 2015, 5:48 p.m. UTC | #7
Hi Otavio,

On 28 July 2015 at 11:45, Otavio Salvador
<otavio.salvador@ossystems.com.br> wrote:
> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>> It could be treated the same way the git project treats gitk and
>>> git-gui. The sources are still included in the main project and
>>> distributed along with the rest of it but they are merged from an
>>> external upstream where the real development happens. The upstream
>>> project is also free to make releases on whatever schedule they
>>> determine (although these days there isn't much development going on
>>> in for gitk/git-gui).
>>
>> That sounds like a useful model. However there are so few patches to
>> patman - is it worth it?
>
> Sure it is; I have asked it in past I think.
>
> I would like to have it in Debian, Arch and other linux distros and
> get more people using it to manage patch series. It is hard to explain
> it can be used for other project it being inside U-Boot source code.

OK so if we do this, what's the best way to get a repo and a mailing list?

>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

Regards,
Simon
Otavio Salvador July 28, 2015, 5:54 p.m. UTC | #8
On Tue, Jul 28, 2015 at 2:48 PM, Simon Glass <sjg@chromium.org> wrote:
> On 28 July 2015 at 11:45, Otavio Salvador
> <otavio.salvador@ossystems.com.br> wrote:
>> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>>> It could be treated the same way the git project treats gitk and
>>>> git-gui. The sources are still included in the main project and
>>>> distributed along with the rest of it but they are merged from an
>>>> external upstream where the real development happens. The upstream
>>>> project is also free to make releases on whatever schedule they
>>>> determine (although these days there isn't much development going on
>>>> in for gitk/git-gui).
>>>
>>> That sounds like a useful model. However there are so few patches to
>>> patman - is it worth it?
>>
>> Sure it is; I have asked it in past I think.
>>
>> I would like to have it in Debian, Arch and other linux distros and
>> get more people using it to manage patch series. It is hard to explain
>> it can be used for other project it being inside U-Boot source code.
>
> OK so if we do this, what's the best way to get a repo and a mailing list?

I would try github or kernel.org if possible.
Simon Glass July 28, 2015, 6:04 p.m. UTC | #9
Hi Otavio,

On 28 July 2015 at 11:54, Otavio Salvador
<otavio.salvador@ossystems.com.br> wrote:
> On Tue, Jul 28, 2015 at 2:48 PM, Simon Glass <sjg@chromium.org> wrote:
>> On 28 July 2015 at 11:45, Otavio Salvador
>> <otavio.salvador@ossystems.com.br> wrote:
>>> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>>>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>>>> It could be treated the same way the git project treats gitk and
>>>>> git-gui. The sources are still included in the main project and
>>>>> distributed along with the rest of it but they are merged from an
>>>>> external upstream where the real development happens. The upstream
>>>>> project is also free to make releases on whatever schedule they
>>>>> determine (although these days there isn't much development going on
>>>>> in for gitk/git-gui).
>>>>
>>>> That sounds like a useful model. However there are so few patches to
>>>> patman - is it worth it?
>>>
>>> Sure it is; I have asked it in past I think.
>>>
>>> I would like to have it in Debian, Arch and other linux distros and
>>> get more people using it to manage patch series. It is hard to explain
>>> it can be used for other project it being inside U-Boot source code.
>>
>> OK so if we do this, what's the best way to get a repo and a mailing list?
>
> I would try github or kernel.org if possible.

I can't see mailing lists in github.

I've sent a request to kernel.org, and copied you.

Regards,
Simon
Otavio Salvador July 28, 2015, 6:06 p.m. UTC | #10
On Tue, Jul 28, 2015 at 3:04 PM, Simon Glass <sjg@chromium.org> wrote:
> On 28 July 2015 at 11:54, Otavio Salvador
> <otavio.salvador@ossystems.com.br> wrote:
>> On Tue, Jul 28, 2015 at 2:48 PM, Simon Glass <sjg@chromium.org> wrote:
>>> On 28 July 2015 at 11:45, Otavio Salvador
>>> <otavio.salvador@ossystems.com.br> wrote:
>>>> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>>>>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>>>>> It could be treated the same way the git project treats gitk and
>>>>>> git-gui. The sources are still included in the main project and
>>>>>> distributed along with the rest of it but they are merged from an
>>>>>> external upstream where the real development happens. The upstream
>>>>>> project is also free to make releases on whatever schedule they
>>>>>> determine (although these days there isn't much development going on
>>>>>> in for gitk/git-gui).
>>>>>
>>>>> That sounds like a useful model. However there are so few patches to
>>>>> patman - is it worth it?
>>>>
>>>> Sure it is; I have asked it in past I think.
>>>>
>>>> I would like to have it in Debian, Arch and other linux distros and
>>>> get more people using it to manage patch series. It is hard to explain
>>>> it can be used for other project it being inside U-Boot source code.
>>>
>>> OK so if we do this, what's the best way to get a repo and a mailing list?
>>
>> I would try github or kernel.org if possible.
>
> I can't see mailing lists in github.

Sure but it has issues and pull requests. Likely what we need.

> I've sent a request to kernel.org, and copied you.

Great :-)
Simon Glass July 28, 2015, 10:28 p.m. UTC | #11
Hi Otavio,

On 28 July 2015 at 12:06, Otavio Salvador
<otavio.salvador@ossystems.com.br> wrote:
> On Tue, Jul 28, 2015 at 3:04 PM, Simon Glass <sjg@chromium.org> wrote:
>> On 28 July 2015 at 11:54, Otavio Salvador
>> <otavio.salvador@ossystems.com.br> wrote:
>>> On Tue, Jul 28, 2015 at 2:48 PM, Simon Glass <sjg@chromium.org> wrote:
>>>> On 28 July 2015 at 11:45, Otavio Salvador
>>>> <otavio.salvador@ossystems.com.br> wrote:
>>>>> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>>>>>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>>>>>> It could be treated the same way the git project treats gitk and
>>>>>>> git-gui. The sources are still included in the main project and
>>>>>>> distributed along with the rest of it but they are merged from an
>>>>>>> external upstream where the real development happens. The upstream
>>>>>>> project is also free to make releases on whatever schedule they
>>>>>>> determine (although these days there isn't much development going on
>>>>>>> in for gitk/git-gui).
>>>>>>
>>>>>> That sounds like a useful model. However there are so few patches to
>>>>>> patman - is it worth it?
>>>>>
>>>>> Sure it is; I have asked it in past I think.
>>>>>
>>>>> I would like to have it in Debian, Arch and other linux distros and
>>>>> get more people using it to manage patch series. It is hard to explain
>>>>> it can be used for other project it being inside U-Boot source code.
>>>>
>>>> OK so if we do this, what's the best way to get a repo and a mailing list?
>>>
>>> I would try github or kernel.org if possible.
>>
>> I can't see mailing lists in github.
>
> Sure but it has issues and pull requests. Likely what we need.
>
>> I've sent a request to kernel.org, and copied you.
>
> Great :-)

It doesn't look like Greg is keen. I'll take a look at github.

Regards,
Simon
Chris Packham July 29, 2015, 9:10 a.m. UTC | #12
On Wed, Jul 29, 2015 at 10:28 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Otavio,
>
> On 28 July 2015 at 12:06, Otavio Salvador
> <otavio.salvador@ossystems.com.br> wrote:
>> On Tue, Jul 28, 2015 at 3:04 PM, Simon Glass <sjg@chromium.org> wrote:
>>> On 28 July 2015 at 11:54, Otavio Salvador
>>> <otavio.salvador@ossystems.com.br> wrote:
>>>> On Tue, Jul 28, 2015 at 2:48 PM, Simon Glass <sjg@chromium.org> wrote:
>>>>> On 28 July 2015 at 11:45, Otavio Salvador
>>>>> <otavio.salvador@ossystems.com.br> wrote:
>>>>>> On Tue, Jul 28, 2015 at 2:39 PM, Simon Glass <sjg@chromium.org> wrote:
>>>>>>> On 23 July 2015 at 03:36, Chris Packham <judge.packham@gmail.com> wrote:
>>>>>>>> It could be treated the same way the git project treats gitk and
>>>>>>>> git-gui. The sources are still included in the main project and
>>>>>>>> distributed along with the rest of it but they are merged from an
>>>>>>>> external upstream where the real development happens. The upstream
>>>>>>>> project is also free to make releases on whatever schedule they
>>>>>>>> determine (although these days there isn't much development going on
>>>>>>>> in for gitk/git-gui).
>>>>>>>
>>>>>>> That sounds like a useful model. However there are so few patches to
>>>>>>> patman - is it worth it?
>>>>>>
>>>>>> Sure it is; I have asked it in past I think.
>>>>>>
>>>>>> I would like to have it in Debian, Arch and other linux distros and
>>>>>> get more people using it to manage patch series. It is hard to explain
>>>>>> it can be used for other project it being inside U-Boot source code.
>>>>>
>>>>> OK so if we do this, what's the best way to get a repo and a mailing list?
>>>>
>>>> I would try github or kernel.org if possible.
>>>
>>> I can't see mailing lists in github.
>>
>> Sure but it has issues and pull requests. Likely what we need.
>>
>>> I've sent a request to kernel.org, and copied you.
>>
>> Great :-)
>
> It doesn't look like Greg is keen. I'll take a look at github.
>

I should really read all my mail before starting to reply :).

GitHub seems appropriate. As you've already identified having a
mailing list is one thing missing, but perhaps given the low volume of
changes it won't be missed (on a side note that was one of the useful
things sourceforge could provide before they went evil). You could
even go as far as setting up an organisation for patman (looks like
there are a few other "patman" repositories).
diff mbox

Patch

diff --git a/tools/patman/README b/tools/patman/README
index 27ec90a..5bd74c4 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -135,6 +135,17 @@  Similar to the above, but skip the first commit and take the next 5. This
 is useful if your top commit is for setting up testing.
 
 
+How to install it
+=================
+
+The most up to date version of patman can be found in the U-boot sources.
+However to use it on other projects it may be more convenient to install it as
+a standalone application. A distutils installer is included, this can be used
+to install patman:
+
+$ cd tools/patman && python setup.py install
+
+
 How to add tags
 ===============
 
diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
new file mode 100644
index 0000000..7cbe5fa
--- /dev/null
+++ b/tools/patman/__init__.py
@@ -0,0 +1,3 @@ 
+__all__ = ['checkpatch', 'command', 'commit', 'cros_subprocess',
+           'get_maintainer', 'gitutil', 'patchstream', 'project',
+           'series', 'settings', 'terminal', 'test']
diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index 6c6473e..e76fc42 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -14,14 +14,18 @@  import sys
 import unittest
 
 # Our modules
-import checkpatch
-import command
-import gitutil
-import patchstream
-import project
-import settings
-import terminal
-import test
+try:
+    from patman import checkpatch, command, gitutil, patchstream, \
+        project, settings, terminal, test
+except ImportError:
+    import checkpatch
+    import command
+    import gitutil
+    import patchstream
+    import project
+    import settings
+    import terminal
+    import test
 
 
 parser = OptionParser()
diff --git a/tools/patman/setup.py b/tools/patman/setup.py
new file mode 100644
index 0000000..e61804f
--- /dev/null
+++ b/tools/patman/setup.py
@@ -0,0 +1,13 @@ 
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+from distutils.core import setup
+setup(name='patman',
+      version='1.0',
+      license='GPL-2.0+',
+      scripts=['patman'],
+      packages=['patman'],
+      package_dir={'patman': ''},
+      package_data={'patman': ['README']},
+      classifiers=['Environment :: Console',
+                   'Topic :: Software Development'])