diff mbox

[core] bb/utils.py: add missing import for getstatusoutput()

Message ID 1384847702-14804-1-git-send-email-kim.hansen@prevas.dk
State Changes Requested
Delegated to: Esben Haabendal
Headers show

Commit Message

kim.hansen@prevas.dk Nov. 19, 2013, 7:55 a.m. UTC
From: Kim Højgaard-Hansen <kiho@prevas.dk>

---
 lib/bb/utils.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Esben Haabendal Nov. 28, 2013, 8:23 a.m. UTC | #1
<kim.hansen@prevas.dk> writes:

> From: Kim Højgaard-Hansen <kiho@prevas.dk>
>
> ---
>  lib/bb/utils.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/bb/utils.py b/lib/bb/utils.py
> index d5350f4..759e9b3 100644
> --- a/lib/bb/utils.py
> +++ b/lib/bb/utils.py
> @@ -21,6 +21,7 @@ BitBake Utility Functions
>  
>  import re, fcntl, os, string, stat, shutil, time
>  import sys
> +import commands
>  import errno
>  import logging

AFAICS, getstatusoutput is called without commands. prefix, so this
import don't really fix anything.

Also, I really would like to see movefile() and copyfile() from bb.utils
to be dropped, and if something like that is still needed, reimplemented
without calls to shell commands.

Do you use these functions?

/Esben
Kim Højgaard-Hansen Nov. 28, 2013, 9:17 a.m. UTC | #2
On 28/11/13 09:23, Esben Haabendal wrote:
> <kim.hansen@prevas.dk> writes:
>
>> From: Kim Højgaard-Hansen <kiho@prevas.dk>
>>
>> ---
>>   lib/bb/utils.py | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/bb/utils.py b/lib/bb/utils.py
>> index d5350f4..759e9b3 100644
>> --- a/lib/bb/utils.py
>> +++ b/lib/bb/utils.py
>> @@ -21,6 +21,7 @@ BitBake Utility Functions
>>   
>>   import re, fcntl, os, string, stat, shutil, time
>>   import sys
>> +import commands
>>   import errno
>>   import logging
> AFAICS, getstatusoutput is called without commands. prefix, so this
> import don't really fix anything.
>
> Also, I really would like to see movefile() and copyfile() from bb.utils
> to be dropped, and if something like that is still needed, reimplemented
> without calls to shell commands.
>
> Do you use these functions?
>
> /Esben
oups, yes it should be prefixed with commands also. It is possible to 
hit that code path in a specific error case though, I hit it when 
testing some of the do_split scenarios. Should remember to attach the 
error log. Currently it will fail with a traceback when you enter that 
part of that code

/Kim
Esben Haabendal Nov. 28, 2013, 1:16 p.m. UTC | #3
Kim Højgaard-Hansen <kiho@prevas.dk> writes:

> On 28/11/13 09:23, Esben Haabendal wrote:
>
>     <kim.hansen@prevas.dk> writes:
>
>
>         From: Kim Højgaard-Hansen <kiho@prevas.dk>
>
>         ---
>          lib/bb/utils.py | 1 +
>          1 file changed, 1 insertion(+)
>
>         diff --git a/lib/bb/utils.py b/lib/bb/utils.py
>         index d5350f4..759e9b3 100644
>         --- a/lib/bb/utils.py
>         +++ b/lib/bb/utils.py
>         @@ -21,6 +21,7 @@ BitBake Utility Functions
>
>          import re, fcntl, os, string, stat, shutil, time
>          import sys
>         +import commands
>          import errno
>          import logging
>
>     AFAICS, getstatusoutput is called without commands. prefix, so this
>     import don't really fix anything.
>
>     Also, I really would like to see movefile() and copyfile() from bb.utils
>     to be dropped, and if something like that is still needed, reimplemented
>     without calls to shell commands.
>
>     Do you use these functions?
>
>     /Esben
>
> oups, yes it should be prefixed with commands also. It is possible to hit that
> code path in a specific error case though, I hit it when testing some of the
> do_split scenarios. Should remember to attach the error log. Currently it will
> fail with a traceback when you enter that part of that code

I see. bb.utils.copyfile() is used in package.oeclass.  I don't see any
references to bb.utils.movefile().

Could the bb.utils.copyfile() call be replaced with a shutil.copy2()
call?

/Esben
diff mbox

Patch

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index d5350f4..759e9b3 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -21,6 +21,7 @@  BitBake Utility Functions
 
 import re, fcntl, os, string, stat, shutil, time
 import sys
+import commands
 import errno
 import logging