Bug 2388 - [Hob] Separate the hob image writer into a separate application
Summary: [Hob] Separate the hob image writer into a separate application
Status: VERIFIED FIXED
Alias: None
Product: Hob
Classification: Build System, Metadata & Runtime
Component: hob (show other bugs)
Version: 1.2
Hardware: x86 Multiple
: Low enhancement
Target Milestone: 1.3 M1
Assignee: Kai Kang
QA Contact:
URL:
Whiteboard: (QA testing completed) Done
Depends on:
Blocks:
 
Reported: 2012-05-02 16:20 UTC by Darren Hart
Modified: 2012-06-20 02:25 UTC (History)
10 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darren Hart 2012-05-02 16:20:54 UTC
The Hob image writer should be broken out as a separate application that Hob calls. This would enable use of this image writer independently from Hob when users have an image and no build environment. It's also unfortunate to have to parse recipes and build pseudo just to write an image. ddimage provides a workaround, but for the GUI folks, this would be a boon.
Comment 1 Shane Wang 2012-05-09 02:58:28 UTC
Kai, can you help to separate the deploy dialog from Hob into an app and then Hob to call the app to deploy images?
Comment 2 Kai Kang 2012-05-09 05:24:11 UTC
ok,I'll take it.
Comment 3 Kai Kang 2012-05-28 02:59:37 UTC
(In reply to comment #1)
> Kai, can you help to separate the deploy dialog from Hob into an app and
> then Hob to call the app to deploy images?

How about create a gui tool using the existing codes without separate them?
Comment 4 Darren Hart 2012-05-29 16:04:29 UTC
Mostly just basic UNIX philosophy: Do one thing and do it well.

What would the advantage be of not separating the tool?
Comment 5 Kai Kang 2012-05-30 01:58:41 UTC
The deploy dialog is already a independent class.
Comment 6 Darren Hart 2012-05-30 15:57:14 UTC
That doesn't really answer the question for me. There is a distinct advantage of having a GUI tool to write images we create that can be deployed as a single file that people can run without pulling in all of the bitbake API code or even the rest of the Hob UI (even if they don't load it).

If the image writer class is indeed self sufficient, then adding a python main block which allows it to run standalone, then this is a good plan.

e.g.

# just pseudocode, surely complete wrong class names, gtk api, etc. It's the "if __name__" bit that is relevant:


class DiskWriterUI(object):
    ...

def main():
    ui = DiskWriterUI()
    # validate arguments
    gtk.main()

if __name__ == "__main__":
    main()
Comment 7 Kai Kang 2012-06-13 02:55:33 UTC
Patch merged,but need new patches to tweak string issues.
Comment 8 Kai Kang 2012-06-15 01:09:07 UTC
Strings issues are fixed.
Comment 9 liang li 2012-06-18 10:12:54 UTC
I have tried the following :
1. plug a usb device to my pc machine
2. run "path_to_git/poky/bitbake/bin/image-writer"

Can choose a ext3 file and select the usb drive and chose "Write USB image",after type root passwd and wait and can get success info (Deploy images successfully).
then can get the extracted rootfs info from the usb device. 

some warning messages met from the terminal during test:

maybe sometimes following info :
/home/liangli/test_poky_git_43/poky/bitbake/lib/bb/ui/crumbs/hig.py:872: RuntimeWarning: tmpnam is a potential security risk to your program
  tmpname = os.tmpnam()

maybe that would be no helpful to user.

git info:   4f65868ea56695177212ebe4b357b6e1d010e483
git branch: poky/master

test env:
host : ubuntu 12.04 x86_64
kernel: 3.2.0-25-generic #40-Ubuntu SMP
Comment 10 Darren Hart 2012-06-18 14:32:40 UTC
(In reply to comment #9)

> some warning messages met from the terminal during test:
> 
> maybe sometimes following info :
> /home/liangli/test_poky_git_43/poky/bitbake/lib/bb/ui/crumbs/hig.py:872:
> RuntimeWarning: tmpnam is a potential security risk to your program
>   tmpname = os.tmpnam()

The preferred temp file mechansim is now tempfile:

from tempfile import *
f = NamedTemporaryFile(...)

http://docs.python.org/library/tempfile.html

Available since python 2.3
Comment 11 Kai Kang 2012-06-20 02:25:34 UTC
(In reply to comment #10)
> (In reply to comment #9)
> 
> > some warning messages met from the terminal during test:
> > 
> > maybe sometimes following info :
> > /home/liangli/test_poky_git_43/poky/bitbake/lib/bb/ui/crumbs/hig.py:872:
> > RuntimeWarning: tmpnam is a potential security risk to your program
> >   tmpname = os.tmpnam()
> 
> The preferred temp file mechansim is now tempfile:
> 
> from tempfile import *
> f = NamedTemporaryFile(...)
> 
> http://docs.python.org/library/tempfile.html
> 
> Available since python 2.3

Thanks. I'll fix it.