All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] perforce.py: fix the perforce fetcher
@ 2013-02-04  9:27 Robert Yang
  2013-02-04  9:27 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2013-02-04  9:27 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Zhenfeng.Zhao

The following changes since commit 75f470cd18d693a9a96d9849291c2c8de4dcbeb8:

  qt4: Add space for _appends (2013-02-01 22:49:47 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib robert/p4
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/p4

Robert Yang (1):
  perforce.py: fix the perforce fetcher

 bitbake/lib/bb/fetch2/perforce.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.11.2




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

* [PATCH 1/1] perforce.py: fix the perforce fetcher
  2013-02-04  9:27 [PATCH 0/1] perforce.py: fix the perforce fetcher Robert Yang
@ 2013-02-04  9:27 ` Robert Yang
  2013-02-04 15:46   ` Chris Larson
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2013-02-04  9:27 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Zhenfeng.Zhao

The bb.process.run() will return one tuple, e.g:

p4file = ('strA\nStrB\nstrC\n'), then there will be an iteration on p4file:

for i in p4file:
	[snip]

The i will be 's t r A ...', this is incorrect. use:

p4file = p4file.splitlines()

will fix the problem.

[YOCTO #3619]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/fetch2/perforce.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py
index df3a3a3..86ec9ba 100644
--- a/bitbake/lib/bb/fetch2/perforce.py
+++ b/bitbake/lib/bb/fetch2/perforce.py
@@ -170,7 +170,7 @@ class Perforce(FetchMethod):
         logger.info("Fetch " + loc)
         logger.info("%s%s files %s", p4cmd, p4opt, depot)
         p4file, errors = bb.process.run("%s%s files %s" % (p4cmd, p4opt, depot))
-        p4file = p4file.strip()
+        p4file = p4file.splitlines()
 
         if not p4file:
             raise FetchError("Fetch: unable to get the P4 files from %s" % depot, loc)
-- 
1.7.11.2




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

* Re: [PATCH 1/1] perforce.py: fix the perforce fetcher
  2013-02-04  9:27 ` [PATCH 1/1] " Robert Yang
@ 2013-02-04 15:46   ` Chris Larson
  2013-02-05  2:36     ` Robert Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Larson @ 2013-02-04 15:46 UTC (permalink / raw)
  To: Robert Yang; +Cc: bitbake-devel@lists.openembedded.org, Zhenfeng.Zhao

[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]

On Mon, Feb 4, 2013 at 2:27 AM, Robert Yang <liezhi.yang@windriver.com>wrote:

> The bb.process.run() will return one tuple, e.g:
>
> p4file = ('strA\nStrB\nstrC\n'), then there will be an iteration on p4file:
>
> for i in p4file:
>         [snip]
>
> The i will be 's t r A ...', this is incorrect. use:
>
> p4file = p4file.splitlines()
>
> will fix the problem.
>
> [YOCTO #3619]
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  bitbake/lib/bb/fetch2/perforce.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bitbake/lib/bb/fetch2/perforce.py
> b/bitbake/lib/bb/fetch2/perforce.py
> index df3a3a3..86ec9ba 100644
> --- a/bitbake/lib/bb/fetch2/perforce.py
> +++ b/bitbake/lib/bb/fetch2/perforce.py
> @@ -170,7 +170,7 @@ class Perforce(FetchMethod):
>          logger.info("Fetch " + loc)
>          logger.info("%s%s files %s", p4cmd, p4opt, depot)
>          p4file, errors = bb.process.run("%s%s files %s" % (p4cmd, p4opt,
> depot))
> -        p4file = p4file.strip()
> +        p4file = p4file.splitlines()
>

Note that splitlines doesn't chop off the trailing newlines from the
individual strings. It *probably* wont cause an issue in this case due to
how it's passed to the shell in the subsequent subprocess call, but from a
correctness standpoint, I'd suggest changing this to something like p4files
= [f.rstrip() for f in p4file.splitlines], or doing an rstrip on the
individual files in the later iteration.
-- 
Christopher Larson

[-- Attachment #2: Type: text/html, Size: 2169 bytes --]

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

* Re: [PATCH 1/1] perforce.py: fix the perforce fetcher
  2013-02-04 15:46   ` Chris Larson
@ 2013-02-05  2:36     ` Robert Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Yang @ 2013-02-05  2:36 UTC (permalink / raw)
  To: Chris Larson; +Cc: bitbake-devel@lists.openembedded.org, Zhenfeng.Zhao


Hi Chris,

Thank you very much, I've updated the pull request:

   git://git.pokylinux.org/poky-contrib robert/p4
   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/p4


diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py
index df3a3a3..fc4074d 100644
--- a/bitbake/lib/bb/fetch2/perforce.py
+++ b/bitbake/lib/bb/fetch2/perforce.py
@@ -170,7 +170,7 @@ class Perforce(FetchMethod):
          logger.info("Fetch " + loc)
          logger.info("%s%s files %s", p4cmd, p4opt, depot)
          p4file, errors = bb.process.run("%s%s files %s" % (p4cmd, p4opt, depot))
-        p4file = p4file.strip()
+        p4file = [f.rstrip() for f in p4file.splitlines()]

          if not p4file:
              raise FetchError("Fetch: unable to get the P4 files from %s" % 
depot, loc)

// Robert

On 02/04/2013 11:46 PM, Chris Larson wrote:
> On Mon, Feb 4, 2013 at 2:27 AM, Robert Yang <liezhi.yang@windriver.com>wrote:
>
>> The bb.process.run() will return one tuple, e.g:
>>
>> p4file = ('strA\nStrB\nstrC\n'), then there will be an iteration on p4file:
>>
>> for i in p4file:
>>          [snip]
>>
>> The i will be 's t r A ...', this is incorrect. use:
>>
>> p4file = p4file.splitlines()
>>
>> will fix the problem.
>>
>> [YOCTO #3619]
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   bitbake/lib/bb/fetch2/perforce.py | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/bitbake/lib/bb/fetch2/perforce.py
>> b/bitbake/lib/bb/fetch2/perforce.py
>> index df3a3a3..86ec9ba 100644
>> --- a/bitbake/lib/bb/fetch2/perforce.py
>> +++ b/bitbake/lib/bb/fetch2/perforce.py
>> @@ -170,7 +170,7 @@ class Perforce(FetchMethod):
>>           logger.info("Fetch " + loc)
>>           logger.info("%s%s files %s", p4cmd, p4opt, depot)
>>           p4file, errors = bb.process.run("%s%s files %s" % (p4cmd, p4opt,
>> depot))
>> -        p4file = p4file.strip()
>> +        p4file = p4file.splitlines()
>>
>
> Note that splitlines doesn't chop off the trailing newlines from the
> individual strings. It *probably* wont cause an issue in this case due to
> how it's passed to the shell in the subsequent subprocess call, but from a
> correctness standpoint, I'd suggest changing this to something like p4files
> = [f.rstrip() for f in p4file.splitlines], or doing an rstrip on the
> individual files in the later iteration.
>



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

end of thread, other threads:[~2013-02-05  2:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04  9:27 [PATCH 0/1] perforce.py: fix the perforce fetcher Robert Yang
2013-02-04  9:27 ` [PATCH 1/1] " Robert Yang
2013-02-04 15:46   ` Chris Larson
2013-02-05  2:36     ` Robert Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.