Date   

Re: mail list for Xilinx Zynq platform?

Elvis Dowson
 

Hi,

On Dec 5, 2012, at 5:21 PM, Andreas Schweigstill <andreas@schweigstill.de> wrote:

I have also tried to build a kernel and root filesystem for Zynq but the kernel
gets stuck when booting, regardless if on the ZC702 board or on Qemu. I tried
Poky denzil and Poky danny.

Also the alternate meta-zynq layer from git.yoctoproject.org shows the same
behaviour.

These are the last console messages which I get:
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-3.2.11-yocto-standard
Created: 2012-12-04 20:07:37 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2997472 Bytes = 2.9 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 01a80000
Booting using the fdt blob at 0x1a80000
Loading Device Tree to 0eff8000, end 0efff185 ... OK
Loading Kernel Image ... OK
OK
Loading Device Tree to 0efed000, end 0eff7185 ... OK

Starting kernel ...


Instead of using Linux kernel version 3.5-xilinx I always get
Linux-3.2.11-yocto-standard which is obviously missing the
Zynq patches.

meta-zynq/recipes-kernel-linux-zynq contains the following lines:
LINUX_VERSION ?= "3.5"
LINUX_VERSION_EXTENSION ?= "-xilinx"

How can I force Yocto to build kernel 3.5-xilinx?
From you messages, I infer that you are using the meta-zynq layer
located here:

http://git.yoctoproject.org/cgit/cgit.cgi/meta-zynq/

For my builds, I used Philip Ballister's meta-zynq layer located here
for the simple reason that it uses xilinx git repository:

https://github.com/balister/meta-zynq

Also, try to ensure that you don't put both the meta-layers in your bblayers.conf file
while building, and ensure that you set machine as follows in your local.conf file

MACHINE ?= "zynq-zc702"

Do let me know how it goes!

Best regards,

Elvis Dowson


Re: recrdeptask not working correctly?

Jerrod Peach <peachj@...>
 

Any thoughts on this?  Should I log a bug in bugzilla, or am I just doing something wrong?


On Mon, Dec 3, 2012 at 10:57 AM, Jerrod Peach <peachj@...> wrote:
All,

I noticed the changes to recrdeptask from Yocto 1.2 to Yocto 1.3.  I saw a number of "all" tasks in the classes change like this:

-do_checkuriall[recrdeptask] = "do_checkuri"
+do_checkuriall[recrdeptask] = "do_checkuriall do_checkuri"

I have my own task that needs to work on all packages, and I assumed making the same change to my task would cause this to occur.  (Prior to this, I had noticed the task seemed to only be running on about 12 packages, where it used to run on about 60.)  So, I made the change, and indeed started running on more packages.  It only ran on about 45 packages though, which I found curious.  So, I dug a little deeper and had bitbake spit out pn-buildlist for me (with the -g option).  That list showed around 75 packages.  That meant I was still not running on a pretty large number of packages.  Then I ran checkurilall.  I noticed it, too, was running on the same list of packages as my task, i.e. NOT all of them.  

Has recrdeptask changed in some way that now prevents a task from running on all packages in a dependency graph recursively?  Was this intentional?  Is there some other (more preferable?) way for me to cause a task to run on all packages in a dependency graph?

Kind regards,

Jerrod


Re: mail list for Xilinx Zynq platform?

Andreas Schweigstill <andreas@...>
 

Hello!

I personally have used Philip's meta-zynq layer to build a working u-boot and
linux kernel image using Yocto. It works really well.
I have also tried to build a kernel and root filesystem for Zynq but the kernel
gets stuck when booting, regardless if on the ZC702 board or on Qemu. I tried
Poky denzil and Poky danny.

Also the alternate meta-zynq layer from git.yoctoproject.org shows the same
behaviour.

These are the last console messages which I get:
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-3.2.11-yocto-standard
Created: 2012-12-04 20:07:37 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2997472 Bytes = 2.9 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 01a80000
Booting using the fdt blob at 0x1a80000
Loading Device Tree to 0eff8000, end 0efff185 ... OK
Loading Kernel Image ... OK
OK
Loading Device Tree to 0efed000, end 0eff7185 ... OK

Starting kernel ...


Instead of using Linux kernel version 3.5-xilinx I always get
Linux-3.2.11-yocto-standard which is obviously missing the
Zynq patches.

meta-zynq/recipes-kernel-linux-zynq contains the following lines:
LINUX_VERSION ?= "3.5"
LINUX_VERSION_EXTENSION ?= "-xilinx"

How can I force Yocto to build kernel 3.5-xilinx?

With best regards,
Andreas Schweigstill

​--
Dipl.-Phys. Andreas Schweigstill
Schweigstill IT | Embedded Systems
Schauenburgerstraße 116, D-24118 Kiel, Germany
Phone: (+49) 431 530354-35, Fax: (+49) 431 530354-36
Mobile: (+49) 171 6921973, Web: http://www.schweigstill.de/


Re: sysroot for use with GDB

Wolfgang Denk <wd@...>
 

Hello,

In message <20121205123818.C17EB200FF2@gemini.denx.de> I wrote:

OK, guess I should enter a bug in bugzilla, then?
Done that; please see Bug 3540 - remote target debugging broken

https://bugzilla.yoctoproject.org/show_bug.cgi?id=3540

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
I can type faster than I can move a mouse, so I find menu-driven
drawing packages time consuming and frustrating. - W. R. Stevens


Re: sysroot for use with GDB

Wolfgang Denk <wd@...>
 

Hello,

nobody here who could help out?

In message <20121203124234.6327B200FF8@gemini.denx.de> I wrote:

according to the documentation [1] the right way to debug applications
on the target is to load the target library information in GDB using

set solib-absolute-prefix /path/to/tmp/rootfs

i. e. referring it to the libraries in the target root file system
image. Assuming the target root file system uses by defualt stripped
libraries, we need to set up a copy of the rootfs with debug
information included.

But do we really have to? Why cannot we use the libraries present in
the SDK's sysroot directory (i. e. what OECORE_TARGET_SYSROOT points
to) ?
It appears that documentation and code are inconsistent; at least the
eclipse plugin generates a .gdbinit script which contains a

set sysroot /opt/poky/1.3/sysroots/armv7a-vfp-neon-poky-linux-gnueabi

statement, i. e. it uses OECORE_TARGET_SYSROOT as I thought should
work - but it doesn't.

Trying to do so, we see that it fails. Our current suspicion is that
maybe prelinking of the target images and libraries introduces some
incompatibility. Is this a reasonable assumption, and if so, is this
a problem that should be fixed, or unavoidable for some reason? Or is
there a problem with the libraries in OECORE_TARGET_SYSROOT ?

All help welcome - thanks in advance.

[1] http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#platdev-gdb-remotedebug-launch-gdb
OK, guess I should enter a bug in bugzilla, then?


Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Humanity has the stars in its future, and that future is too
important to be lost under the burden of juvenile folly and ignorant
superstition. - Isaac Asimov


Re: [PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

Grigoropol, IoanaX <ioanax.grigoropol@...>
 

Hi Jessica,

I have apparently associated my Execution Environment 1.6 with a jre 1.7. I have sent a patch for the syntax error.
As for the error shown for the existing repository, I have sent a patch to validate the entries when switching between an existing repo and a new clone.
I think that we should perform some kind of validation on the existing repo (oe-build-env-init script exists, etc.) from the very creation of the project otherwise at some point things will stop working with bitbake and the user will not know why. Indeed, check for an existing git directory does not fall into this category and should be removed.

Thanks,
Ioana

-----Original Message-----
From: Zhang, Jessica
Sent: Wednesday, December 05, 2012 12:55 AM
To: Grigoropol, IoanaX; yocto@yoctoproject.org
Subject: RE: [yocto] [PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

Hi Ioana,

There's issue as to syntax for YoctoHostShellProcessAdaptor since it's only supported by JDK version 1.7 and above. Also, when I tried the plugin on Linux, it still failed for creating a project for an existing metadata directory. With a not very clear error message " Directory /home/jzhang/poky contains a repository, please select validate repository" which is what I did. It seems we are calling out the git repository for bitbake commander project, which I don't think there's the need. I think we should preserve the existing interface that only provide user the option to clone a new one if there's the need. Otherwise, we should just validate the project repo behind the scene. And we shouldn't make the clone a new one as the default as the current implementation.

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Ioana Grigoropol
Sent: Tuesday, December 04, 2012 5:26 AM
To: yocto@yoctoproject.org
Subject: [yocto] [PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

- Resending patches with proper header for eclipse-poky
- Include fixes for showing progress information for long time running tasks on wizards for Bitbake Commander project & Bitbake recipe
- Includes validation for the location & name of a new Bitbake Commander in a new repo clone or an existing one

Ioana Grigoropol (3):
Show progress bar for New Bitbake Commander project
Show progress bar for building new Recipe in Bitbake commander
perspective
Validate project name and location for Bitbake command project

.../src/org/yocto/bc/bitbake/ShellSession.java | 116 +++-----
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 155 +++++------
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 136 +++++----- .../bc/remote/utils/YoctoRunnableWithProgress.java | 106 ++++++++
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 2 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 285 ++++++++++---------- .../yocto/bc/ui/wizards/install/InstallWizard.java | 113 ++------
.../yocto/bc/ui/wizards/install/OptionsPage.java | 178 ++++++------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 31 +--
12 files changed, 551 insertions(+), 584 deletions(-) create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[PATCH] Validate Bitbake Commander project when switching between new repo and existing one

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
.../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
index 795a9c0..366ab1b 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
@@ -106,7 +106,7 @@ public abstract class FiniteStateWizardPage extends WizardPage {
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
-// validate();
+ validate();
}

/*
--
1.7.9.5


[PATCH] Fix incompatibility with jre1.6 support for typed HashMap

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
.../remote/utils/YoctoHostShellProcessAdapter.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
index 9ab43cf..2dba0a6 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
@@ -34,6 +34,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private Semaphore sem;

+
public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
super(hostShell);
this.processStreamBuffer = processStreamBuffer;
@@ -41,7 +42,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.calculator = new GitCalculatePercentage();
this.sem = new Semaphore(1);
this.command = "";
- this.commandMonitors = new HashMap<>();
+ this.commandMonitors = new HashMap<String, IProgressMonitor>();
}

public String getLastCommand() {
@@ -50,7 +51,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

public synchronized void setLastCommand(String lastCommand) {
try {
- // there are still some processes that might take a long time and if we do not wait for them,
+ // there are still some processes that might take a long time and if we do not wait for them,
// then the semaphore will not be released, because an interrupted exception will occur
Thread.sleep(2000);
isFinished = false;
@@ -70,6 +71,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
+ @Override
public float calWorkloadDone(String info) throws IllegalArgumentException {
Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
@@ -88,13 +90,16 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

private void updateMonitor(final int work){
+
Display.getDefault().asyncExec(new Runnable() {
+
@Override
public void run() {
if (getMonitor() != null) {
getMonitor().worked(work);
}
}
+
});
}

@@ -124,7 +129,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
updateMonitor(delta);
reportedWorkload += delta;
}
-
+
if (reportedWorkload == RemoteHelper.TOTALWORKLOAD)
doneMonitor();
}
@@ -152,8 +157,9 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
continue;
}
setCommandPrompt(value);
+
if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
- value.startsWith(commandPrompt) && value.endsWith(endChar) &&
+ value.startsWith(commandPrompt) && value.endsWith(endChar) &&
!value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
sem.release();
isFinished = true;
@@ -165,7 +171,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.commandResponseHandler.response(value, false);
}
}
-
+
}
private void setCommandPrompt(String value) {
if (commandPrompt == null) {
@@ -178,7 +184,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
commandPrompt = value.substring(0, end);
endChar = PROMPT_USER_CH;
}
-
+
}
}
public boolean isFinished() {
--
1.7.9.5


Fullpass Test Report for Yocto 1.4 M1 RC1 20121128 Build

Palalau, AlexandruX <alexandrux.palalau@...>
 

 

Hello,


Here is the weekly test report for Yocto 1.4 M1 RC1 20121128 build.

The testing for p1022ds is blocked since the image didn't build out. For beagleboard, the X can’t startup in this build (Bug 3522).

For Core Build System we have new issues regarding HOB under build appliance, incremental RPM and multilib with ipks (Bugs 3531, 3453, 3534).

ADT toolchain fails regarding Clutter (Bugs 3477, 3488).




Test Summary
-------------------------

Test Result Summary

Component

Target

Status

Comments

BSP

Beagleboard

BUGGY

X can not startup

 

Routerstationpro

GOOD

Everything runs well

 

Mpc8315e-rdb

GOOD

Everything runs well

P1022DS

BLOCK

No image built out

QEMU

qemux86

GOOD

Everything runs well

 

qemux86-64

GOOD

Everything runs well

qemuarm

GOOD

Dmesg log check fail

 

qemuppc

GOOD

Everything runs well

 

qemumips

GOOD

Everything runs well

Core Build System

BUGGY

Incremental RPM image generation fails
Disk space monitoring gives error: Unknown event
lib32 connman-gnome built for qemux86-64 – ipk fails
hob launch against build-appliance-image fails

ADT Toolchain

BUGGY

Clutter C/C++ fails
iptables-1.4.15: autoreconf run failed on gmae-toolchain

HOB

 

BUGGY

Recipe added with new layer fails
Package size fails
Hob recipe build from bitbake command line fails

 

BLOCK

Critical bugs, more than 50% test cases are blocked

GOOD

Only Normal, Minor or Enhancement bugs, less than 10% test cases failed

BUGGY

Normal, Major and Critical bugs, more than 10% test cases failed

 

Detailed Test Result for each component

Target

Total TCs

Not Run

Passed

Failed

Not testable (Blocked)

Beagleboard Sato-SDK

55

18

37

1 (3522)

18 (3522)

Routerstationpro Sato-SDK

32

0

32

0

0

Mpc8315e-rdb Sato-SDK

34

0

34

0

0

P1022DS

31

31

0

0

31 (3476)

Qemux86 Sato

29

0

29

0

0

Qemux86 Sato-SDK

34

0

33

1

0

Qemux86-64 Sato

29

0

29

0

0

Qemux86-64 Sato-SDK

34

0

34

0

0

Qemuarm Sato

31

0

31

0

0

Qemuarm Sato-SDK

36

0

36

0

0

Qemumips Sato

31

0

31

0

0

Qemumips Sato-SDK

36

0

36

0

0

Qemuppc Sato

31

0

31

0

0

Qemuppc Sato-SDK

36

0

36

0

0

Core Build System

65

3

64

4 (3534,3523,3453,3531)

3(3531)

ADT Toolchain

53

0

47

6(3477,3488,3338)

0

HOB

38

0

35

3(2618,3501,3001)

0

Total

635

52

572

14

52


* You can check the detailed test result in attachment for each target.
** The failed/blocked case number is listed with failed cases’ bug number.


Commit information
--------------------------------

Location: http://autobuilder.yoctoproject.org/pub/nightly/20121128-1
Tree/Branch: poky/1.4_M1
Commit: 247b6a3754c2c50318e2a73d79981ba0e9cb560b


Issue Summary
-----------------------------------

Component

Bug Number

Target Milestone

System & Core OS

System Usage

New! Bug 3522 [beagleboard] X can not startup with 1.4 M1 RC1 20121128 build
Bug 3458 Beagleboard: No pictures shown when playing video
Bug 3452 [p1022ds] udev error: can not mount harddisk and usb stick
Bug 3451 [p1022ds] Some error messages with dmesg

1.4 M2
1.4
1.4
1.4 M1

Others

Bug 3476 Autobuilder failing on fsl-ppc
Bug 2766 coreutils build error with long TMPDIR: Argument list too long 
Bug 2759 qt4-native-4.8.1-r14.1 build error with long TMPDIR: initializer-string for array of chars is too long [-fpermissive]

---
1.4 M1
1.4

Core Build System

New! Bug 3523 Disk space monitoring gives error: Unknown event
New! Bug 3531 Hob remains at checking for correct build system startup with build appliance
New! Bug 3453 Build fails when building multilib with ipk packaging
New! Bug 3534 incremental RPM generation does not work

1.4
---
1.4
---

ADT Toolchain

Bug 3338 iptables-1.4.15: autoreconf run failed on gmae-toolchain
New! Bug 3477 Warning ClutterInitError appears when building Clutter project in Eclipse
New! Bug 3488 cannot run clutter app on qemux86
Bug 3338 iptables-1.4.15: autoreconf run failed on gmae-toolchain

1.4 M1
1.4
1.4
1.4 M1



Best Regards,


--

Alexandru Palalau

QA Contractor @ Yocto Project

Open-source Technology Center Romania

System Software Division





Re: [PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

Zhang, Jessica
 

Hi Ioana,

There's issue as to syntax for YoctoHostShellProcessAdaptor since it's only supported by JDK version 1.7 and above. Also, when I tried the plugin on Linux, it still failed for creating a project for an existing metadata directory. With a not very clear error message " Directory /home/jzhang/poky contains a repository, please select validate repository" which is what I did. It seems we are calling out the git repository for bitbake commander project, which I don't think there's the need. I think we should preserve the existing interface that only provide user the option to clone a new one if there's the need. Otherwise, we should just validate the project repo behind the scene. And we shouldn't make the clone a new one as the default as the current implementation.

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Ioana Grigoropol
Sent: Tuesday, December 04, 2012 5:26 AM
To: yocto@yoctoproject.org
Subject: [yocto] [PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

- Resending patches with proper header for eclipse-poky
- Include fixes for showing progress information for long time running tasks on wizards for Bitbake Commander project & Bitbake recipe
- Includes validation for the location & name of a new Bitbake Commander in a new repo clone or an existing one

Ioana Grigoropol (3):
Show progress bar for New Bitbake Commander project
Show progress bar for building new Recipe in Bitbake commander
perspective
Validate project name and location for Bitbake command project

.../src/org/yocto/bc/bitbake/ShellSession.java | 116 +++-----
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 155 +++++------
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 136 +++++----- .../bc/remote/utils/YoctoRunnableWithProgress.java | 106 ++++++++
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 2 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 285 ++++++++++---------- .../yocto/bc/ui/wizards/install/InstallWizard.java | 113 ++------
.../yocto/bc/ui/wizards/install/OptionsPage.java | 178 ++++++------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 31 +--
12 files changed, 551 insertions(+), 584 deletions(-) create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Yocto Project Technical Team Meeting

Liu, Song <song.liu@...>
 

When: Occurs every Tuesday effective 6/26/2012 until 6/18/2013 from 8:00 AM to 9:00 AM (UTC-08:00) Pacific Time (US & Canada).
Where: Bridge Info Enclosed
 
Note: The GMT offset above does not reflect daylight saving time adjustments.
 
*~*~*~*~*~*~*~*~*~*
 
We encourage people attending the meeting to logon the Yocto IRC chancel during the meeting (optional):
 
 
Conference details
Conference name: Yocto Technical Team
Conference date/start time: Tue Jun 26, 2012 at 10:00 AM Central Daylight Time
Participants: 30
Duration: 60 minutes
Participant passcode: 76994298
Dial-in number: 1.972.995.7777
US Toll Free number: 1.877.561.6828
BlackBerry users, click this link to join your conference as a participant: 1.972.995.7777x76994298#
  Depending on where you are dialing from, either your BlackBerry will pause and enter the passcode automatically or you will be prompted to click again to dial the passcode.
Local and Global Access Numbers
 
Country Dial-in number
Australia: 1800 636 843
Czech Republic: 242 430 350
China (Beijing): From office dial 8-9957777 or 8784277
Beijing Out of Office dial 5878 4277
China (Shanghai): From office dial 8-9957777 or 3073322
Shanghai Out of Office dial 2307 3322
China (Shenzen): From office dial 8-9957777 or 6007877
Shenzen Out of Office dial 2600 7877
China (Other Cities): From IP phone dial 8-9957777
Other cities - Non IP phone dial 021-23073322
Denmark: 8060 1400
Finland: 09 41333477
France: 0497 275888
Germany: 08161 803232
Holland: 030 2417490
India: BSNL subscribers use 1800 425 9996 (Toll Free)
Airtel subscribers use 0008 009 861 212 (Toll Free)
From TI Campus use 89957777
Others use 2509 9555 (Landline within Bangalore) or
80 2509 9555 (Outside Bangalore)
Israel: 09 790 6715
Italy: 039 69061234 (039 is local city code not country code)
Japan: From TI Campus use 8 995 7777
Outside TI use 03 4331 3777
Malaysia: From IP phone dial 2643799
From Kuala Lumpur dial 4264 3799
Outside Kuala Lumpur dial (03)4264 3799
Norway: 2 295 8744
Philippines: From Baguio City use 4471177
From Metro Manila area use 8702477
Singapore: From IP phone dial 3894777
Outside TI use 6389 4777
South Korea: From IP phone dial 5606998
From Seoul dial 5606998
Outside Seoul dial (02)5606998
Sweden: 08 58755577
Taiwan: From IP phone dial 1363
From Taipei dial 2241 1363
Outside Taipei dial (02)2241 1363
Turkey: Landline Only dial 0811 288 0001
then enter 877 633 1123
UK: 01604 663003
US: 972 995 7777 or 1877 561 6828
 
Recurring conferences
First scheduled conference: Tue Jun 26, 2012
Recurrence frequency: Weekly - Every 1 week(s) on Tuesday
Recurrence ends: End on Fri Jun 21, 2013, 10:40 AM CDT
 
 
 
 


Minutes: Yocto Project Technical Team Meeting - Tuesday, December 04, 2012 8:00 AM-9:00 AM (UTC-08:00) Pacific Time (US & Canada).

Liu, Song <song.liu@...>
 

Attendees:
Amit, Ross, Eren, Beth, ChrisL, ScottR, JeffP, TomZ, Nitin, PaulE, ScottG, BruceA, CristianI, JessicaZ, Saul, RichardP, SeanH, MarkH, Ioana, Corneliu, MichaelH, AlexD, BjörnS, Ramana, Song.
 
Minutes:
 
* Opens collection - 5 min (Song)
* Yocto 1.4 status - 20 min (Song/team)
- 1.4 test plan: would like to ask everyone to review and comment: https://wiki.yoctoproject.org/wiki/Yocto_1.4_Overall_Test_Plan
- M2 planning:
. 2 highs scheduled: zypper, running post install at rootfs gen time.
. 167 perfect days work scheduled.
- Bug fixing: 25 bug fixed, 298 open, a little high. We need to pay more attention to bug fixing. Two bugs I would like to ask the team for help:
. Connman issue: 3227. Issue is not in connman 1.9. Will upgrade to 1.9.
. Beagle Board X issue: 3522
- Master: Build Appliance failed (Beth is changing autobuilder to automate this, Beth has a fix), nightly-x86 (connman issue,3227), Freescale BSP issue, Matthew knows it. meta-intel BSP failed.
- QA: RC1 final report ETA, later Today.
 
* SWAT team rotation: LaurentiuP -> Ioana Grigoropol 
* Opens - 10 min
- Eren: Hello World documentation. Finished the oe part.
http://hambedded.org/blog/2012/11/24/from-bitbake-hello-world-to-an-image/
. Would like to feedback. After that integrate with Wiki or others.
. ScottR: sent email to Eren. Fold part of this into quick start. Bitbake information will be good to be in the newly revised bitbake manual. Will get this in Bill's hands. Suggest Eren to post specific technical questions on the mailing list. Hopefully Eren can get answers there. Afterwards, will work together to integrate this doc.
. Eren: good plan. Will get answers to technical questions first, then work with Scott to integrate the doc.
- ScottR: adding doc alert to comments in Bugzilla when filing a bug that effects documentation
. If you are filing a bug or working on a bug you think might affect doc, it will be help if you add a comment (something like 'this will affect documentation')to alert ScottR and add ScottR in the CC list of the bug. We are trying to be more proactive on doc changes for this release.
 
* Team Sharing - 20 min
- AlexD: working on integrating Wayland, started building, making progress... Sent email to people working on Wayland. Paul can help if there is no response, these people are sitting right behind Paul.
- Cristian: handling transition of HOB to be able to run on windows. One of 1.4 features. Setting up new dev environment. Investigation making the jump and figure out what would be possible problems. Bug #: 1972.
- Andrei: working on package reporting system, finished the work. Submitted some patches, waiting for Saul's review.
- Ioana: working on eclipse plugin on windows. Submitted patches for issues, should be running fine now. Next step is using hob on windows.
- Mark: SMART work. At a point that we are ready to submit the code to the community. Some bug fixes, will be the first batch. Integration will be second batch of patches.
- Bjorn: working on package testing. Would like some response to some issues already sent to the mailing list. RP suggested to do it in a different way, that needs to be discussed. (RP will respond). What we do with packages that don't have tests. Would like people to spend some time to think about it. RP: this is important, we can get these integrated, and then expand..
- Ramana: posted about configuration tool. Would like to get more comments. Bruce commented, Mark and RP will reply. RP: this is important, encourage people to look at it. The more people the better.
. https://lists.yoctoproject.org/pipermail/yocto/2012-November/012867.html
. https://lists.yoctoproject.org/pipermail/yocto/2012-November/012973.html
- MichaelH: bugzilal management, auto generation, patch review process, etc. patch work basically setup. Schedule a demo with some key people for one of the patch review tools ?. Continue some of these work this week and other things.


Re: Howto use yocto meta-toolchain?

Marco <koansoftware@...>
 

Il 04/12/2012 13:37, Laurentiu Palcu ha scritto:
script it doesn't work

https://bugzilla.yoctoproject.org/show_bug.cgi?id=3532


--
Marco


Re: Using vendo kernel with Yocto

Paul Eggleton
 

On Friday 16 November 2012 18:25:59 you wrote:
Hello, just a report

As my vendor never will release patch to a recent kernel and our
applications needs some recent fetures found in a recent kernel. I decided
to make the patchs by myself.

I missed one week reading datasheet, git log, studying the old
implementation made by Mindspeed and so on.

Now the kernel 3.4.18 boot and runs in our board using yocto 1.3. Of course
I have learned a lot of things.

Maybe some adjusts will be need to do. However I am very happy to track
Yocto project with Mindspeed hardware. This is going to speedup the release
cicles and tools of our products.
Great to hear! Please let us know if you have any other feedback or issues.

Cheers,
Paul

--

Paul Eggleton
Intel Open Source Technology Centre


Re: Question: How to install the mkfs tools from the e2fsprogs instead of the BusyBox tools.

Paul Eggleton
 

On Monday 12 November 2012 12:10:59 Elad Yosef wrote:
I have created my own image based in existing one.

****************************************************************
IMAGE_INSTALL = "task-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} u-boot"

#My additions to the File-System
IMAGE_INSTALL += "e2fsprogs iptables"
IMAGE_LINGUAS = " "
inherit core-image
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE = "8192"
# remove not needed ipkg informations
ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; "
IMAGE_FSTYPES ?= "tar.gz ext2.gz.u-boot"
******************************************************************

After building the File system I see that the mksf.ext2 point to the
BusyBox. I checked the build log file and saw the following:
***********************************************
update-alternatives: Linking
/localhome/QorIQ_SDK/QorIQ-SDK-V1.2-20120614-yocto/build_p2041rdb_release/tm
p/work/p2041rdb-fsl-linux/crgn-image-minimal-1.0-r0/rootfs//sbin/mke2fs to
../bin/busybox
update-alternatives: Linking
/localhome/QorIQ_SDK/QorIQ-SDK-V1.2-20120614-yocto/build_p2041rdb_release/tm
p/work/p2041rdb-fsl-linux/crgn-image-minimal-1.0-r0/rootfs//usr/bin/mkfifo
to ../../bin/busybox
update-alternatives: Linking
/localhome/QorIQ_SDK/QorIQ-SDK-V1.2-20120614-yocto/build_p2041rdb_release/tm
p/work/p2041rdb-fsl-linux/crgn-image-minimal-1.0-r0/rootfs//sbin/mkfs.ext2
to ../bin/busybox
update-alternatives: Linking
/localhome/QorIQ_SDK/QorIQ-SDK-V1.2-20120614-yocto/build_p2041rdb_release/tm
p/work/p2041rdb-fsl-linux/crgn-image-minimal-1.0-r0/rootfs//sbin/mkfs.minix
to ../bin/busybox
****************************************************************************
*********

What am I missing here?
Sorry for the late reply - the "mkfs" command is provided by util-linux and is
in its own separate package, so I think you want to add the util-linux-mkfs
package to IMAGE_INSTALL.

Cheers,
Paul

--

Paul Eggleton
Intel Open Source Technology Centre


Packaging ROS for Yocto-Linux

Lukas Bulwahn
 

Hi all,

we are interested in setting up a computing platform for our development
using Yocto-Linux and the robotic operating system ROS
(http://www.ros.org/). We are currently at the very beginning of this
development: As a first step, we want to package ROS for our own needs, but
we are open to contribute this to the community if there are others that
need this as well.

Has someone in the community already packaged ROS for Yocto? Are there
others that also interested in a ROS package for Yocto?

We are happy about any feedback.


Lukas Bulwahn
BMW Car IT GmbH
Petuelring 116
D-80809 Muenchen
Germany
Mail: lukas.bulwahn@oss.bmw-carit.de
Web: http://www.bmw-carit.de
-------------------------------------------------------------
BMW Car IT GmbH
Geschäftsführer: Harald Heinecke
Sitz und Registergericht: München HRB134810
-------------------------------------------------------------


[PATCH 3/3] Validate project name and location for Bitbake command project

Ioana Grigoropol <ioanax.grigoropol@...>
 

- if the project location is empty default value will be used (e.g. /home/user/)
- project name must not contain whitespaces and/or invalid characters
- if we choose to clone a new repo but the destination directory already contains a .git directory, do not allow moving forward
- if we choose to validate an existing repository, make sure that the directory exists, and contains a .git directory as well as a oe-init-build-env script

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
.../src/org/yocto/bc/bitbake/ShellSession.java | 94 +++--------
.../org/yocto/bc/remote/utils/RemoteHelper.java | 69 ++++----
.../remote/utils/YoctoHostShellProcessAdapter.java | 15 +-
.../yocto/bc/ui/wizards/install/OptionsPage.java | 178 ++++++++++----------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 24 ++-
6 files changed, 173 insertions(+), 213 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
index 961472f..f143bed 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -48,23 +48,23 @@ public class ShellSession {
public static final String LT = System.getProperty("line.separator");
public static final String exportCmd = "export BB_ENV_EXTRAWHITE=\"DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE\"";
public static final String exportColumnsCmd = "export COLUMNS=1000";
-
+
public static String getFilePath(String file) throws IOException {
File f = new File(file);
-
+
if (!f.exists() || f.isDirectory()) {
throw new IOException("Path passed is not a file: " + file);
}
-
+
StringBuffer sb = new StringBuffer();
-
+
String elems[] = file.split("//");
-
+
for (int i = 0; i < elems.length - 1; ++i) {
sb.append(elems[i]);
sb.append("//");
}
-
+
return sb.toString();
}
private Process process;
@@ -90,7 +90,7 @@ public class ShellSession {
// shellPath = "/bin/sh";
// }
// shellPath = "/bin/bash";
-
+
initializeShell(new NullProgressMonitor());
}

@@ -104,13 +104,14 @@ public class ShellSession {
}
}

- synchronized
+ synchronized
public String execute(String command) throws IOException {
return execute(command, false);
}

- synchronized
+ synchronized
public String execute(String command, boolean hasErrors) throws IOException {
+
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
@@ -119,57 +120,15 @@ public class ShellSession {
e.printStackTrace();
}
return null;
-// sendToProcessAndTerminate(command);
-//
-// if (process.getErrorStream().available() > 0) {
-// byte[] msg = new byte[process.getErrorStream().available()];
-//
-// process.getErrorStream().read(msg, 0, msg.length);
-// out.write(new String(msg));
-// out.write(LT);
-// errorMessage = "Error while executing: " + command + LT + new String(msg);
-// }
-//
-// BufferedReader br = new BufferedReader(new InputStreamReader(process
-// .getInputStream()));
-//
-// StringBuffer sb = new StringBuffer();
-// String line = null;
-
-// while (((line = br.readLine()) != null) && !line.endsWith(TERMINATOR) && !interrupt) {
-// sb.append(line);
-// sb.append(LT);
-// out.write(line);
-// out.write(LT);
-// }
-//
-// if (interrupt) {
-// process.destroy();
-// initializeShell(null);
-// interrupt = false;
-// }
-// else if (line != null && retCode != null) {
-// try {
-// retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR)));
-// }catch (NumberFormatException e) {
-// throw new IOException("Can NOT get return code" + command + LT + line);
-// }
-// }
-//
-// if (errorMessage != null) {
-// throw new IOException(errorMessage);
-// }
-//
-// return sb.toString();
}

-synchronized
+synchronized
public void execute(String command, ICommandResponseHandler handler) throws IOException {
System.out.println(command);
execute(command, TERMINATOR, handler);
}
-
- synchronized
+
+ synchronized
public void execute(String command, String terminator, ICommandResponseHandler handler) throws IOException {
interrupt = false;
InputStream errIs = process.getErrorStream();
@@ -177,40 +136,40 @@ synchronized
clearErrorStream(errIs);
}
sendToProcessAndTerminate(command);
-
+
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String std = null;

- do {
+ do {
if (errIs.available() > 0) {
byte[] msg = new byte[errIs.available()];

errIs.read(msg, 0, msg.length);
// out.write(new String(msg));
handler.response(new String(msg), true);
- }
-
+ }
+
std = br.readLine();
-
+
if (std != null && !std.endsWith(terminator)) {
// out.write(std);
handler.response(std, false);
- }
-
+ }
+
} while (std != null && !std.endsWith(terminator) && !interrupt);
-
+
if (interrupt) {
process.destroy();
initializeShell(null);
interrupt = false;
}
}
-
+
private void clearErrorStream(InputStream is) {
-
+
try {
byte b[] = new byte[is.available()];
- is.read(b);
+ is.read(b);
System.out.println("clearing: " + new String(b));
} catch (IOException e) {
e.printStackTrace();
@@ -221,7 +180,7 @@ synchronized
/**
* Send command string to shell process and add special terminator string so
* reader knows when output is complete.
- *
+ *
* @param command
* @throws IOException
*/
@@ -241,6 +200,5 @@ synchronized
public void interrupt() {
interrupt = true;
}
-
-}

+}
\ No newline at end of file
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
index 929ad63..f375de1 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
@@ -47,13 +47,13 @@ import org.yocto.bc.ui.wizards.install.Messages;
public class RemoteHelper {
public static final int TOTALWORKLOAD = 100;
private static Map<IHost, RemoteMachine> machines;
-
+
public static RemoteMachine getRemoteMachine(IHost connection){
if (!getMachines().containsKey(connection))
getMachines().put(connection, new RemoteMachine(connection));
return getMachines().get(connection);
}
-
+
private static Map<IHost, RemoteMachine> getMachines() {
if (machines == null)
machines = new HashMap<IHost, RemoteMachine>();
@@ -71,7 +71,7 @@ public class RemoteHelper {
public static YoctoHostShellProcessAdapter getHostShellProcessAdapter(IHost connection) {
return getRemoteMachine(connection).getHostShellProcessAdapter();
}
-
+
public static ProcessStreamBuffer getProcessBuffer(IHost connection) {
return getRemoteMachine(connection).getProcessBuffer();
}
@@ -87,20 +87,20 @@ public class RemoteHelper {
for (int i = 0; i < connections.length; i++)
if (connections[i].getAliasName().equals(remoteConnection))
return connections[i];
- return null;
+ return null;
}
-
+
public static IHost getRemoteConnectionForURI(URI uri, IProgressMonitor monitor) {
if (uri == null)
return null;
-
+
String host = uri.getHost();
- if (host == null)
+ if (host == null)
return null;
-
+
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost[] connections = sr.getHosts();
-
+
IHost unconnected = null;
for (IHost conn : connections) {
if (host.equalsIgnoreCase(conn.getHostName())) {
@@ -110,26 +110,26 @@ public class RemoteHelper {
unconnected = conn;
}
}
-
+
return unconnected;
}
-
+
public static IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
IRemoteFileSubSystem candidate = null;
IRemoteFileSubSystem otherServiceCandidate = null;
IRemoteFileSubSystem[] subSystems = RemoteFileUtility.getFileSubSystems(host);
-
+
for (IRemoteFileSubSystem subSystem : subSystems) {
if (subSystem instanceof FileServiceSubSystem) {
if (subSystem.isConnected())
return subSystem;
-
+
if (otherServiceCandidate == null)
otherServiceCandidate = subSystem;
-
+
} else if (candidate == null || (subSystem.isConnected() && !candidate.isConnected()))
candidate = subSystem;
-
+
}
if (candidate != null && candidate.isConnected())
return candidate;
@@ -137,7 +137,7 @@ public class RemoteHelper {
return otherServiceCandidate;
return null;
}
-
+
public static String getRemoteHostName(String remoteConnection){
final IHost host = getRemoteConnectionByName(remoteConnection);
if(host == null)
@@ -149,9 +149,9 @@ public class RemoteHelper {
public static IFileService getConnectedRemoteFileService(IHost connection, IProgressMonitor monitor) throws Exception {
return getRemoteMachine(connection).getRemoteFileService(monitor);
}
-
+
public static IHostFile[] getRemoteDirContent(IHost connection, String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor){
-
+
try {
IFileService fileServ = getConnectedRemoteFileService(connection, monitor);
return fileServ.list(remoteParent, fileFilter, fileType, monitor);
@@ -182,11 +182,11 @@ public class RemoteHelper {

return ((IFileServiceSubSystem) subsystem).getFileService();
}
-
+
public static ISubSystem getFileSubsystem(IHost connection) {
return getRemoteMachine(connection).getFileSubsystem();
}
-
+
public static IService getConnectedShellService(IHost connection, IProgressMonitor monitor) throws Exception {
return getRemoteMachine(connection).getShellService(monitor);
}
@@ -201,21 +201,21 @@ public class RemoteHelper {
}
return null;
}
-
+
public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath,
IProgressMonitor monitor) throws Exception {
-
+
assert(connection!=null);
monitor.beginTask(Messages.InfoDownload, 100);
-
+
IFileService fileService;
try {
- fileService = (IFileService) getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
+ fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
File file = new File(localExePath);
file.deleteOnExit();
monitor.worked(5);
Path remotePath = new Path(remoteExePath);
- fileService.download(remotePath.removeLastSegments(1).toString(),
+ fileService.download(remotePath.removeLastSegments(1).toString(),
remotePath.lastSegment(),file,true, null,
new SubProgressMonitor(monitor, 85));
} finally {
@@ -223,13 +223,13 @@ public class RemoteHelper {
}
return;
}
-
+
public static IHostFile getRemoteHostFile(IHost connection, String remoteFilePath, IProgressMonitor monitor){
assert(connection != null);
monitor.beginTask(Messages.InfoDownload, 100);
-
+
try {
- IFileService fileService = (IFileService) getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
+ IFileService fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
Path remotePath = new Path(remoteFilePath);
IHostFile remoteFile = fileService.getFile(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), new SubProgressMonitor(monitor, 5));
return remoteFile;
@@ -239,20 +239,20 @@ public class RemoteHelper {
}
return null;
}
-
+
public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
final boolean hasErrors = false;
-
+
if (!cmd.getInitialDirectory().isEmpty()) {
writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
if (!hasErrors)
writeToShell(connection, remoteCommand);
-
+
return hasErrors;
}
-
+
public static boolean writeToShell(final IHost connection, final String remoteCommand){
new Thread(new Runnable() {
@Override
@@ -282,7 +282,7 @@ public class RemoteHelper {
}
writeToShell(connection, remoteCommand);
}
-
+
} catch (Exception e1) {
e1.printStackTrace();
}
@@ -291,7 +291,7 @@ public class RemoteHelper {
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -329,6 +329,7 @@ public class RemoteHelper {
String parentPath = path.substring(0, nameStart);
String name = path.substring(nameStart + 1);
IHostFile hostFile = fs.getFile(parentPath, name, monitor);
+
return hostFile.exists();
} catch (Exception e) {
e.printStackTrace();
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
index baedc3b..9ab43cf 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
@@ -33,7 +33,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private String endChar = null;

private Semaphore sem;
-
+
public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
super(hostShell);
this.processStreamBuffer = processStreamBuffer;
@@ -67,11 +67,11 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private interface ICalculatePercentage {
public float calWorkloadDone(String info) throws IllegalArgumentException;
}
-
+
private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
public float calWorkloadDone(String info) throws IllegalArgumentException {
- Matcher m = pattern.matcher(info.trim());
+ Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
return new Float(m.group(1)) / 100;
}else {
@@ -79,7 +79,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}
}
}
-
+
private IProgressMonitor getMonitor() {
if (command == null) {
return null;
@@ -88,16 +88,13 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

private void updateMonitor(final int work){
-
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
if (getMonitor() != null) {
getMonitor().worked(work);
}
}
-
});
}

@@ -155,10 +152,9 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
continue;
}
setCommandPrompt(value);
-
if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
value.startsWith(commandPrompt) && value.endsWith(endChar) &&
- !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null) {
+ !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
sem.release();
isFinished = true;
}
@@ -210,4 +206,3 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

}
-
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
index 7c1a655..37c12f8 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
@@ -1,7 +1,6 @@
package org.yocto.bc.ui.wizards.install;

import java.io.File;
-import java.io.FilenameFilter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
@@ -13,6 +12,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ptp.rdt.ui.wizards.RemoteProjectContentsLocationArea;
@@ -22,9 +22,9 @@ import org.eclipse.ptp.remote.core.IRemoteFileManager;
import org.eclipse.ptp.remote.core.IRemoteServices;
import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
import org.eclipse.ptp.remote.rse.core.RSEConnection;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -32,31 +32,32 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.yocto.bc.remote.utils.RemoteHelper;
import org.yocto.bc.ui.wizards.FiniteStateWizardPage;

/**
* Select which flavor of OE is to be installed.
- *
+ *
* @author kgilmer
- *
+ *
* Setting up the parameters for creating the new Yocto Bitbake project
- *
+ *
* @modified jzhang
*/
public class OptionsPage extends FiniteStateWizardPage {

public static final String URI_SEPARATOR = "/";
public static final String LOCALHOST = "LOCALHOST";
-
+
private Composite top;
-
+
private ValidationListener validationListener;
private Text txtProjectName;
private Button btnGit;
private Button btnValidate;
-
+
private RemoteProjectContentsLocationArea locationArea;
-
+
protected OptionsPage(Map<String, Object> model) {
super("Options", model);
setMessage("Enter these parameters to create new Yocto Project BitBake commander project");
@@ -69,7 +70,7 @@ public class OptionsPage extends FiniteStateWizardPage {
top.setLayoutData(new GridData(GridData.FILL_BOTH));

GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL);
-
+
Composite projectNameComp = new Composite(top, SWT.NONE);
GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL);
projectNameComp.setLayoutData(gdProjName);
@@ -81,11 +82,11 @@ public class OptionsPage extends FiniteStateWizardPage {
txtProjectName.setLayoutData(gdFillH);
txtProjectName.setFocus();
validationListener = new ValidationListener();
-
+
txtProjectName.addModifyListener(validationListener);

IErrorMessageReporter errorReporter = new IErrorMessageReporter() {
-
+
@Override
public void reportError(String errorMessage, boolean infoOnly) {
setMessage(errorMessage);
@@ -93,47 +94,32 @@ public class OptionsPage extends FiniteStateWizardPage {
updateModel();
}
};
-
+
locationArea = new RemoteProjectContentsLocationArea(errorReporter, top, null);
-
+
Group locationValidationGroup = new Group(top, SWT.NONE);
locationValidationGroup.setText("Git repository");
GridData gd = new GridData(GridData.VERTICAL_ALIGN_END | GridData.FILL_HORIZONTAL);
locationValidationGroup.setLayoutData(gd);
GridLayout gl = new GridLayout(1, false);
locationValidationGroup.setLayout(gl);
-
- SelectionListener lst = new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (validateProjectName() && validateProjectLocation())
- setPageComplete(true);
-
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
-
+
btnGit = new Button(locationValidationGroup, SWT.RADIO);
btnGit.setText("Clone from Yocto Project &Git Repository into new location");
btnGit.setEnabled(true);
btnGit.setSelection(true);
- btnGit.addSelectionListener(lst);
-
-
+ btnGit.addSelectionListener(validationListener);
+
+
btnValidate = new Button(locationValidationGroup, SWT.RADIO);
btnValidate.setText("&Validate existing Git project location");
btnValidate.setEnabled(true);
btnValidate.setSelection(false);
- btnValidate.addSelectionListener(lst);
-
+ btnValidate.addSelectionListener(validationListener);
+
setControl(top);
}
-
+
private boolean validateProjectName() {
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();

@@ -143,7 +129,7 @@ public class OptionsPage extends FiniteStateWizardPage {
setErrorMessage("Project name cannot be empty!");
return false;
}
-
+
if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) {
setErrorMessage("Invalid project name: " + txtProjectName.getText());
return false;
@@ -156,67 +142,78 @@ public class OptionsPage extends FiniteStateWizardPage {
}
return true;
}
-
+
public String getProjectName(){
return txtProjectName.getText().trim();
}
-
+
protected boolean validateProjectLocation() {
-
+
String projectLoc = locationArea.getProjectLocation().trim();
-
- File checkProject_dir = new File(projectLoc);
- if (!checkProject_dir.isDirectory()) {
- setErrorMessage("The project location directory " + projectLoc + " is not valid");
+
+ IRemoteConnection remoteConnection = locationArea.getRemoteConnection();
+ if (remoteConnection == null)
return false;
- }
+
+ if (projectLoc.isEmpty())
+ return true;
+
+ IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+
projectLoc = convertToRealPath(projectLoc);
String separator = projectLoc.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
String projectPath = projectLoc + separator + getProjectName();
- File gitDir = new File(projectPath);
+ IHostFile repoDest = RemoteHelper.getRemoteHostFile(connection, projectPath, new NullProgressMonitor());
+
if(btnValidate.getSelection()) {
- if(!gitDir.isDirectory() || !gitDir.exists()) {
+ if (repoDest == null || !repoDest.exists()) {
setErrorMessage("Directory " + projectPath + " does not exist, please select git clone.");
return false;
}
- File[] filesMatched = gitDir.listFiles(new FilenameFilter() {
-
- @Override
- public boolean accept(File file, String pattern) {
- return file.getName().equals(".git");
- }
- });
-
- if (filesMatched.length != 1) {
+ IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
+ if (gitDescr == null || !gitDescr.exists()) {
setErrorMessage("Directory " + projectPath + " does not contain a git repository, please select git clone.");
return false;
}
-
- if(!new File(projectLoc + separator + InstallWizard.VALIDATION_FILE).exists()) {
+
+ IHostFile validationFile = RemoteHelper.getRemoteHostFile(connection, projectPath + URI_SEPARATOR + InstallWizard.VALIDATION_FILE, new NullProgressMonitor());
+ if (validationFile == null || !validationFile.exists()) {
setErrorMessage("Directory " + projectPath + " seems invalid, please use other directory or project name.");
return false;
}
+ } else { //git clone
+ if (repoDest.exists() && repoDest.isDirectory()) {
+ IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
+ if (gitDescr != null && gitDescr.exists()) {
+ setErrorMessage("Directory " + projectPath + " contains a repository, please select validate repository.");
+ return false;
+ }
+ }
}
-
+
try {
- IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
- IProject proj = wsroot.getProject(txtProjectName.getText());
- if (proj.exists()) {
- setErrorMessage("A project with the name " + txtProjectName.getText() + " already exists");
- return false;
- }
- URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
-
- IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
- if (!status.isOK()) {
- setErrorMessage(status.getMessage());
- return false;
+ String projName = txtProjectName.getText();
+ if (!projName.trim().isEmpty() && validateProjectName()) {
+ IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject proj = wsroot.getProject();
+ if (proj != null && proj.exists()) {
+ setErrorMessage("A project with the name " + projName + " already exists");
+ return false;
+ }
+ URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
+
+ IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ return false;
+ }
}
} catch (Exception e) {
+ e.printStackTrace();
setErrorMessage("Run into error while trying to validate entries!");
return false;
}
-
+
setErrorMessage(null);
return true;
}
@@ -238,7 +235,7 @@ public class OptionsPage extends FiniteStateWizardPage {
return convertedpath;
}

-
+
@Override
public void pageCleanup() {

@@ -249,7 +246,7 @@ public class OptionsPage extends FiniteStateWizardPage {
}

@Override
-
+
protected void updateModel() {
try {
URI uri = getProjectLocationURI();
@@ -266,12 +263,12 @@ public class OptionsPage extends FiniteStateWizardPage {

public URI getProjectLocationURI() throws URISyntaxException {
URI uri = locationArea.getProjectLocationURI();
-
+
if (uri != null) {
String location = locationArea.getProjectLocation();
if (!uri.getPath().isEmpty()) {
String separator = uri.getPath().endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
-
+
return new URI( uri.getScheme(),
uri.getHost(),
uri.getPath() + separator + txtProjectName.getText(),
@@ -284,7 +281,7 @@ public class OptionsPage extends FiniteStateWizardPage {
} else {
String location = locationArea.getProjectLocation();
String separator = location.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
-
+
IRemoteConnection conn = locationArea.getConnection();
if (conn instanceof RSEConnection) {
RSEConnection rseConn = (RSEConnection)conn;
@@ -294,7 +291,7 @@ public class OptionsPage extends FiniteStateWizardPage {
}
}
}
-
+
private String getDefaultPathDisplayString(IRemoteConnection connection, IRemoteServices remoteServices) {
String projectName = getProjectName();
if (projectName.isEmpty())
@@ -306,7 +303,7 @@ public class OptionsPage extends FiniteStateWizardPage {
} catch (RemoteConnectionException e) {
e.printStackTrace();
}
-
+
IRemoteFileManager fileMgr = remoteServices.getFileManager(connection);
URI defaultURI = fileMgr.toURI(connection.getWorkingDirectory());

@@ -322,19 +319,30 @@ public class OptionsPage extends FiniteStateWizardPage {
}
return ""; //$NON-NLS-1$
}
-
+
private boolean isValidProjectName(String projectName) {
- if (projectName.indexOf('$') > -1) {
+ if (projectName.contains("\\s+"))
+ return false;
+
+ if (projectName.indexOf('$') != -1)
return false;
- }

+ char[] chars = projectName.toCharArray();
+ if (!Character.isJavaIdentifierStart(chars[0]))
+ return false;
+ for (int i = 1; i < chars.length; i++)
+ if (!Character.isJavaIdentifierPart(chars[i]))
+ return false;
return true;
- }
+ }
@Override
protected boolean validatePage() {
if (!validateProjectName())
return false;
-
+
+ if (!validateProjectLocation())
+ return false;
+
setErrorMessage(null);
setMessage("All the entries are valid, press \"Finish\" to start the process, "+
"this will take a while. Please don't interrupt till there's output in the Yocto Console window...");
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
index a2af6e4..7a68ed5 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
-
import org.yocto.bc.bitbake.BBSession;
import org.yocto.bc.bitbake.ProjectInfoHelper;
import org.yocto.bc.remote.utils.RemoteHelper;
@@ -37,13 +36,16 @@ public class BBConfigurationInitializeOperation implements IRunnableWithProgress
this.writer = writer;
}

+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
BBSession session;
try {
+ monitor.beginTask("Initialize bitbake session ...", RemoteHelper.TOTALWORKLOAD);
ProjectInfoHelper.store(RemoteHelper.getRemoteConnectionByName(pinfo.getConnection().getName()), pinfo.getURI(), pinfo, monitor);
session = Activator.getBBSession(pinfo, writer, monitor);
session.initialize();
-
+ monitor.worked(90);
+ monitor.done();
} catch (Exception e) {
throw new InvocationTargetException(e);
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
index fcc939c..1a19479 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
@@ -42,40 +42,40 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException {
IProjectDescription desc = proj.getDescription();
Vector<String> natureIds = new Vector<String>();
-
+
natureIds.add(nature_id);
natureIds.addAll(Arrays.asList(desc.getNatureIds()));
- desc.setNatureIds((String[]) natureIds.toArray(new String[natureIds.size()]));
-
+ desc.setNatureIds(natureIds.toArray(new String[natureIds.size()]));
+
proj.setDescription(desc, monitor);
}
-
+
private ProjectInfo projInfo;

public CreateBBCProjectOperation(ProjectInfo projInfo) {
this.projInfo = projInfo;
}
-
+
protected void addNatures(IProject proj, IProgressMonitor monitor) throws CoreException {
addNatureToProject(proj, BitbakeCommanderNature.NATURE_ID, monitor);
}

private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInformation) throws CoreException {
IProjectDescription desc = workspace.newProjectDescription(projInformation.getProjectName());
-
+
desc.setLocationURI(projInformation.getURI());
-
+
return desc;
}

@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
IProjectDescription desc = createProjectDescription(ResourcesPlugin.getWorkspace(), projInfo);
-
+
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();

IProject proj = wsroot.getProject(projInfo.getProjectName());
-
+
try {
proj.create(desc, monitor);
ProjectInfoHelper.store(RemoteHelper.getRemoteConnectionByName(projInfo.getConnection().getName()), proj.getLocationURI(), projInfo, monitor);
@@ -85,13 +85,9 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
} catch (Exception e) {
e.printStackTrace();
}
-
-
-
-
addNatures(proj, monitor);
}
-
+
public ProjectInfo getProjectInfo() {
return projInfo;
}
--
1.7.9.5


[PATCH 2/3] Show progress bar for building new Recipe in Bitbake commander perspective

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 119 +++++++++++++-------
1 file changed, 78 insertions(+), 41 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index e27619e..e9dc1f3 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.yocto.bc.ui.wizards;

+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -27,6 +28,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
@@ -74,6 +76,8 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private IHost connection;

private String tempFolderPath;
+ private String srcFileNameExt;
+ private String srcFileName;

public static final String TEMP_FOLDER_NAME = "temp";
public static final String TAR_BZ2_EXT = ".tar.bz2";
@@ -98,6 +102,12 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private static final String md5Pattern = "^[0-9a-f]{32}$";
protected static final String sha256Pattern = "^[0-9a-f]{64}$";

+ private HashMap<String, String> mirrorTable;
+ private URI extractDir;
+ private YoctoCommand licenseChecksumCmd;
+ protected YoctoCommand md5YCmd;
+ protected YoctoCommand sha256YCmd;
+
public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) {
super("wizardPage");
setTitle("BitBake Recipe");
@@ -300,16 +310,17 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
IProgressMonitor monitor = new NullProgressMonitor();
URI srcURI = new URI(txtSrcURI.getText().trim());
String scheme = srcURI.getScheme();
- String srcFileName = getSrcFileName(true);
+ this.srcFileNameExt = getSrcFileName(true);
+ this.srcFileName = getSrcFileName(false);
if ((scheme.equals(HTTP) || scheme.equals(FTP))
- && (srcFileName.endsWith(TAR_GZ_EXT) || srcFileName.endsWith(TAR_BZ2_EXT))) {
+ && (srcFileNameExt.endsWith(TAR_GZ_EXT) || srcFileNameExt.endsWith(TAR_BZ2_EXT))) {
try {
handleRemotePopulate(srcURI, monitor);
} catch (Exception e) {
e.printStackTrace();
}
} else {
- String packageName = getSrcFileName(false).replace("-", "_");
+ String packageName = srcFileName.replace("-", "_");
fileText.setText(packageName + BB_RECIPE_EXT);

handleLocalPopulate(srcURI, monitor);
@@ -320,52 +331,78 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}

private void handleLocalPopulate(URI srcURI, IProgressMonitor monitor) {
- populateLicenseFileChecksum(srcURI, monitor);
+ populateLicenseFileChecksum(srcURI);
populateInheritance(srcURI, monitor);
}

- private void handleRemotePopulate(URI srcURI, IProgressMonitor monitor) throws Exception {
+ private void handleRemotePopulate(final URI srcURI, IProgressMonitor monitor) throws Exception {
RemoteHelper.clearProcessBuffer(connection);
-
populateRecipeName(srcURI);
- List<YoctoCommand> commands = new ArrayList<YoctoCommand>();

- String metaDirLocPath = metaDirLoc.getPath();
- commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
- commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
- updateTempFolderPath();
+ this.getContainer().run(true, true, new IRunnableWithProgress() {

+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask("Populating recipe fields ... ", 100);
+ List<YoctoCommand> commands = new ArrayList<YoctoCommand>();

- try {
- commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
+ try {
+ String metaDirLocPath = metaDirLoc.getPath();

- updateTempFolderPath();
- RemoteHelper.runBatchRemote(connection, commands, true);
+ monitor.subTask("Cleaning environment");
+ commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ updateTempFolderPath();
+ monitor.worked(10);

- commands.clear();
+ monitor.subTask("Downloading package sources");
+ commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));

- String md5Cmd = "md5sum " + getSrcFileName(true);
- YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, md5YCmd);
+ updateTempFolderPath();
+ RemoteHelper.runBatchRemote(connection, commands, true);

- String sha256Cmd = "sha256sum " + getSrcFileName(true);
- YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, sha256YCmd);
+ commands.clear();
+ monitor.worked(50);

- URI extractDir = extractPackage(srcURI, monitor);
- YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
- updateSrcUri(createMirrorLookupTable(monitor), srcURI);
- populateInheritance(extractDir, monitor);
+ monitor.subTask("Compute package checksums");
+ String md5Cmd = "md5sum " + srcFileNameExt;
+ md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, md5YCmd);

- String md5Val = retrieveSum(md5YCmd);
- md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
- String sha256Val = retrieveSum(sha256YCmd);
- sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
- String checkSumVal = retrieveSum(licenseChecksumCmd);
- checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
- } catch (Exception e) {
- e.printStackTrace();
- }
+ monitor.worked(60);
+
+ String sha256Cmd = "sha256sum " + srcFileNameExt;
+ sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, sha256YCmd);
+
+ monitor.worked(70);
+
+ monitor.subTask("Extracting package");
+ extractDir = extractPackage(srcURI);
+ monitor.worked(80);
+
+ licenseChecksumCmd = populateLicenseFileChecksum(extractDir);
+
+ monitor.subTask("Creating mirror lookup table");
+ mirrorTable = createMirrorLookupTable();
+
+ monitor.worked(90);
+ monitor.done();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ updateSrcUri(mirrorTable, srcURI);
+ populateInheritance(extractDir, monitor);
+
+ String md5Val = retrieveSum(md5YCmd);
+ md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
+ String sha256Val = retrieveSum(sha256YCmd);
+ sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
+ String checkSumVal = retrieveSum(licenseChecksumCmd);
+ checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
}

private String retrieveSum(YoctoCommand cmd) {
@@ -378,9 +415,9 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
return "";
}

- private URI extractPackage(URI srcURI, IProgressMonitor monitor) {
+ private URI extractPackage(URI srcURI) {
try {
- String path = getSrcFileName(true);
+ String path = srcFileNameExt;
String tarCmd = "tar ";
if (path.endsWith(TAR_BZ2_EXT)) {
tarCmd += "-zxvf ";
@@ -390,7 +427,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {

RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));

- return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + getSrcFileName(false));
+ return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + srcFileName);

} catch (Exception e) {
e.printStackTrace();
@@ -424,7 +461,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}

- private YoctoCommand populateLicenseFileChecksum(URI extractDir, IProgressMonitor monitor) {
+ private YoctoCommand populateLicenseFileChecksum(URI extractDir) {
if (extractDir == null)
throw new RuntimeException("Something went wrong during source extraction!");

@@ -459,7 +496,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
return "";
}

- private HashMap<String, String> createMirrorLookupTable(IProgressMonitor monitor) throws Exception {
+ private HashMap<String, String> createMirrorLookupTable() throws Exception {
HashMap<String, String> mirrorMap = new HashMap<String, String>();

YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, "");
@@ -486,7 +523,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
if (!fileName.isEmpty())
return;

- String recipeFile = getSrcFileName(false).replace("-", "_");
+ String recipeFile = srcFileName.replace("-", "_");
recipeFile += BB_RECIPE_EXT;
if (recipeFile != null)
fileText.setText(recipeFile);
--
1.7.9.5


[PATCH 1/3] Show progress bar for New Bitbake Commander project

Ioana Grigoropol <ioanax.grigoropol@...>
 

- run new Bitbake project creation in a new thread, being cancelable and update the monitor from the event handler in a asynchronous way by invoking Display.asyncExec
- use a blocking way to wait(mutex) for the event handler to finish reading command outputs - not only the event handler must be blocked, the one invoking the remote commands must block waiting for output, otherwise the new Project Wizard will not wait for the commands to finish running
- When searching for the desired output through the existing lines, we should not search for the prompt + previous command exactly, because the terminal shell used will use a wrapping value for the lines received and insert a whitespace character at each multiple of wrapping value
- usually, the wrapping value is controlled by $COLUMNS shell variable - a quick fix setting this variable to a bigger value does not prove useful
- instead, wait for the line containing the prompt & the previous command having all existing whitespaces removed
- the possibility that this line will be issued more than once is small.
- use YoctoHostShellAdapter to run long task showing progress in a Wizard page & parse task output using specialized Calculators

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
.../src/org/yocto/bc/bitbake/ShellSession.java | 24 +--
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 92 +++-----
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 137 ++++++------
.../bc/remote/utils/YoctoRunnableWithProgress.java | 106 ++++++++++
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 2 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 222 +++++++++-----------
.../yocto/bc/ui/wizards/install/InstallWizard.java | 113 +++-------
.../newproject/CreateBBCProjectOperation.java | 7 +-
10 files changed, 340 insertions(+), 370 deletions(-)
create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
index edff746..961472f 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -47,6 +47,7 @@ public class ShellSession {
public static final String TERMINATOR = "#234o987dsfkcqiuwey18837032843259d";
public static final String LT = System.getProperty("line.separator");
public static final String exportCmd = "export BB_ENV_EXTRAWHITE=\"DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE\"";
+ public static final String exportColumnsCmd = "export COLUMNS=1000";

public static String getFilePath(String file) throws IOException {
File f = new File(file);
@@ -96,8 +97,8 @@ public class ShellSession {
private void initializeShell(IProgressMonitor monitor) throws IOException {
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""), monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""), monitor);
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
} catch (Exception e) {
e.printStackTrace();
}
@@ -112,7 +113,7 @@ public class ShellSession {
public String execute(String command, boolean hasErrors) throws IOException {
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""), new NullProgressMonitor());
+ hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
return RemoteHelper.getProcessBuffer(connection).getMergedOutputLines();
} catch (Exception e) {
e.printStackTrace();
@@ -241,20 +242,5 @@ synchronized
interrupt = true;
}

- private class NullWriter extends Writer {
-
- @Override
- public void close() throws IOException {
- }
-
- @Override
- public void flush() throws IOException {
- }
-
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException {
- }
-
- }
-
}
+
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
index 6756fe3..438a5b4 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;

public class ProcessStreamBuffer {
+ private static final String WHITESPACES = "\\s+";
List<String> errorLines;
List<String> outputLines;

@@ -47,7 +48,7 @@ public class ProcessStreamBuffer {
return null;
for (int i = outputLines.size() - 1; i >= 0; i--){
String line = outputLines.get(i);
- if (line.contains(str))
+ if (line.replaceAll(WHITESPACES, "").contains(str.replaceAll(WHITESPACES, "")))
return line;
}
return null;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
index 432969c..929ad63 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
@@ -138,36 +138,6 @@ public class RemoteHelper {
return null;
}

-// private static int displayDialogBox(String name, String[] choices) {
-// Display display = Display.getDefault();;
-// final Shell shell = new Shell(display);
-// shell.setText(name);
-//
-// shell.setLayout(new GridLayout(2, false));
-//
-// new Label(shell, SWT.NONE).setText("Connections for host:");
-// final Combo comboChoices = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
-// for (int i = 0, n = choices.length; i < n; i++)
-// comboChoices.add(choices[i]);
-// comboChoices.select(0);
-//
-// Button btnOK = new Button(shell, SWT.PUSH);
-// btnOK.setText("OK");
-//
-// DialogSelectionListener dsl = new DialogSelectionListener(shell, comboChoices);
-//
-// btnOK.addSelectionListener(dsl);
-//
-// shell.pack();
-// shell.open();
-// while (!shell.isDisposed()) {
-// if (!display.readAndDispatch()) {
-// display.sleep();
-// }
-// }
-// return dsl.getReturnValue();
-// }
-
public static String getRemoteHostName(String remoteConnection){
final IHost host = getRemoteConnectionByName(remoteConnection);
if(host == null)
@@ -270,49 +240,49 @@ public class RemoteHelper {
return null;
}

- public static boolean runCommandRemote(IHost connection, YoctoCommand cmd, IProgressMonitor monitor) throws Exception {
- String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
- boolean hasErrors = false;
- try {
- if (!cmd.getInitialDirectory().isEmpty()) {
- hasErrors = writeToShell(connection, "cd " + cmd.getInitialDirectory(), monitor);
- }
- if (!hasErrors)
- return writeToShell(connection, remoteCommand, monitor);
- } catch (Exception e) {
- e.printStackTrace();
+ public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
+ final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
+ final boolean hasErrors = false;
+
+ if (!cmd.getInitialDirectory().isEmpty()) {
+ writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
+ if (!hasErrors)
+ writeToShell(connection, remoteCommand);
+
return hasErrors;
}

- public static boolean writeToShell(IHost connection, String remoteCommand, IProgressMonitor monitor){
- YoctoHostShellProcessAdapter hostShellProcessAdapter = getHostShellProcessAdapter(connection);
- hostShellProcessAdapter.setMonitor(monitor);
- hostShellProcessAdapter.setLastCommand(remoteCommand);
- getHostShell(connection).writeToShell(remoteCommand);
-
-// try {
-// while (!hostShellProcessAdapter.isFinished() && hostShellProcessAdapter.isAlive()) {
-// Thread.sleep(2);
-// }
-//// System.out.println(">>>>>>>>>>>>>>>>>>>>finished command " + remoteCommand);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-//
- return hostShellProcessAdapter.hasErrors();
+ public static boolean writeToShell(final IHost connection, final String remoteCommand){
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ YoctoHostShellProcessAdapter adapter = getHostShellProcessAdapter(connection);
+ adapter.setLastCommand(remoteCommand);
+ getHostShell(connection).writeToShell(remoteCommand);
+ while (!adapter.isFinished())
+ Thread.sleep(2);
+// return hostShellProcessAdapter.hasErrors();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }).run();
+ return true;
}
-
- public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, IProgressMonitor monitor, boolean waitForOutput) throws CoreException {
+
+ public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean waitForOutput) throws CoreException {
try {
String remoteCommand = "";
for (YoctoCommand cmd : cmds) {
remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
if (!cmd.getInitialDirectory().isEmpty()) {
- writeToShell(connection, "cd " + cmd.getInitialDirectory(), monitor);
+ writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
- writeToShell(connection, remoteCommand, monitor);
+ writeToShell(connection, remoteCommand);
}
+
} catch (Exception e1) {
e1.printStackTrace();
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
index a953ef7..6eb2945 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
@@ -8,6 +8,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ptp.remote.core.IRemoteConnection;
+import org.eclipse.ptp.remote.core.IRemoteServices;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
@@ -72,7 +74,7 @@ public class RemoteMachine {
public YoctoHostShellProcessAdapter getHostShellProcessAdapter() {
try {
if (hostShellProcessAdapter == null)
- hostShellProcessAdapter = new YoctoHostShellProcessAdapter(getHostShell(), getProcessBuffer(), getCmdHandler());
+ hostShellProcessAdapter = new YoctoRunnableWithProgress(getHostShell(), getProcessBuffer(), getCmdHandler());
return hostShellProcessAdapter;
} catch (IOException e) {
e.printStackTrace();
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
index 79a62e0..baedc3b 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
@@ -1,19 +1,22 @@
package org.yocto.bc.remote.utils;

import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.services.shells.AbstractHostShellOutputReader;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.services.shells.HostShellProcessAdapter;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
import org.eclipse.rse.services.shells.IHostShellOutputReader;
+import org.eclipse.swt.widgets.Display;

-public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
+public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private String commandPrompt = null;
private static final String ROOT = "root";
private static final String PROMPT_USER_CH = "$";
@@ -23,42 +26,42 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
private boolean isFinished;
private ICalculatePercentage calculator;
private int reportedWorkload;
- private IProgressMonitor monitor;
private boolean isAlive;

- private String lastCommand;
- private boolean waitForOutput;
+ private String command;
+ private Map<String, IProgressMonitor> commandMonitors;
private String endChar = null;

private Semaphore sem;

- public String getLastCommand() {
- return lastCommand;
- }
-
- public synchronized void setLastCommand(String lastCommand) {
-// if (waitForOutput) {
- try {
- // there are still some processes that might take a long time and if we do not wait for them,
- // then the semaphore will not be released, because an interrupted exception will occur
- Thread.sleep(2000);
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>semaphore aquire");
- sem.acquire();
- this.lastCommand = lastCommand.trim();
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>last command set " + lastCommand);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-// }
+ public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
+ super(hostShell);
+ this.processStreamBuffer = processStreamBuffer;
+ this.commandResponseHandler = commandResponseHandler;
+ this.calculator = new GitCalculatePercentage();
+ this.sem = new Semaphore(1);
+ this.command = "";
+ this.commandMonitors = new HashMap<>();
}

-
- public IProgressMonitor getMonitor() {
- return monitor;
+ public String getLastCommand() {
+ return command;
}

- public void setMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
+ public synchronized void setLastCommand(String lastCommand) {
+ try {
+ // there are still some processes that might take a long time and if we do not wait for them,
+ // then the semaphore will not be released, because an interrupted exception will occur
+ Thread.sleep(2000);
+ isFinished = false;
+ sem.acquire();
+ this.command = lastCommand.trim();
+ System.out.println("last command " + lastCommand + getOwnMonitor());
+ this.commandMonitors.put(command, getOwnMonitor());
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}

private interface ICalculatePercentage {
@@ -68,7 +71,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
public float calWorkloadDone(String info) throws IllegalArgumentException {
- Matcher m = pattern.matcher(info.trim());
+ Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
return new Float(m.group(1)) / 100;
}else {
@@ -77,38 +80,37 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
}
}

- public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
- super(hostShell);
- this.processStreamBuffer = processStreamBuffer;
- this.commandResponseHandler = commandResponseHandler;
- this.calculator = new GitCalculatePercentage();
- this.sem = new Semaphore(1);
- this.lastCommand = "";
-
+ private IProgressMonitor getMonitor() {
+ if (command == null) {
+ return null;
+ }
+ return commandMonitors.get(command);
}

private void updateMonitor(final int work){
-// Display.getDefault().syncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// monitor.worked(work);
-// }
-// });
- }

+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getMonitor() != null) {
+ getMonitor().worked(work);
+ }
+ }
+
+ });
+ }
+
private void doneMonitor(){
-// Display.getCurrent().syncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// monitor.done();
-// }
-// });
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getMonitor().done();
+ }
+ });
}
-
+
private void reportProgress(String info) {
-
if(calculator == null) {
updateMonitor(1);
} else {
@@ -130,7 +132,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
doneMonitor();
}
}
-
+
@Override
public void shellOutputChanged(IHostShellChangeEvent event) {
IHostShellOutputReader reader = event.getReader();
@@ -153,10 +155,12 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
continue;
}
setCommandPrompt(value);
- if (value.startsWith(commandPrompt) && value.endsWith(endChar) &&
- !value.endsWith(lastCommand) && processStreamBuffer.getLastOutputLineContaining(lastCommand) != null /*&& waitForOutput*/) {
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Sem release");
+
+ if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
+ value.startsWith(commandPrompt) && value.endsWith(endChar) &&
+ !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null) {
sem.release();
+ isFinished = true;
}

reportProgress(value);
@@ -166,9 +170,6 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
}
}

- AbstractHostShellOutputReader absReader = (AbstractHostShellOutputReader)reader;
- isAlive = absReader.isAlive();
- isFinished = absReader.isFinished();
}
private void setCommandPrompt(String value) {
if (commandPrompt == null) {
@@ -199,16 +200,14 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
this.isAlive = isAlive;
}

- public boolean isWaitForOutput() {
- return waitForOutput;
- }
-
- public void setWaitForOutput(boolean waitForOutput) {
- this.waitForOutput = waitForOutput;
- }
-
public void clearProcessBuffer() {
this.processStreamBuffer.outputLines.clear();
this.processStreamBuffer.errorLines.clear();
}
+
+ public IProgressMonitor getOwnMonitor() {
+ return new NullProgressMonitor();
+ }
+
}
+
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
new file mode 100644
index 0000000..3483a8c
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
@@ -0,0 +1,106 @@
+package org.yocto.bc.remote.utils;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ptp.remote.core.IRemoteConnection;
+import org.eclipse.ptp.remote.core.IRemoteServices;
+import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.services.shells.IHostShell;
+
+public class YoctoRunnableWithProgress extends YoctoHostShellProcessAdapter
+ implements IRunnableWithProgress {
+
+ private String taskName;
+ private IRemoteConnection remoteConnection;
+ private IRemoteServices remoteServices;
+ private String cmd;
+ private String args;
+ private IProgressMonitor monitor;
+
+ public YoctoRunnableWithProgress(IHostShell hostShell,
+ ProcessStreamBuffer processStreamBuffer,
+ CommandResponseHandler commandResponseHandler) throws IOException {
+ super(hostShell, processStreamBuffer, commandResponseHandler);
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ try {
+ this.monitor = monitor;
+ this.monitor.beginTask(taskName, RemoteHelper.TOTALWORKLOAD);
+
+ if (!remoteConnection.isOpen()) {
+ try {
+ remoteConnection.open(monitor);
+ } catch (RemoteConnectionException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ if (!remoteServices.isInitialized()) {
+ remoteServices.initialize();
+ }
+
+ try {
+ IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(cmd, "", args));
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ monitor.done();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public IProgressMonitor getOwnMonitor() {
+ return monitor;
+ }
+
+ public IRemoteConnection getRemoteConnection() {
+ return remoteConnection;
+ }
+
+ public void setRemoteConnection(IRemoteConnection remoteConnection) {
+ this.remoteConnection = remoteConnection;
+ }
+
+ public String getTaskName() {
+ return taskName;
+ }
+
+ public void setTaskName(String taskName) {
+ this.taskName = taskName;
+ }
+
+ public IRemoteServices getRemoteServices() {
+ return remoteServices;
+ }
+
+ public void setRemoteServices(IRemoteServices remoteServices) {
+ this.remoteServices = remoteServices;
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd = cmd;
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public void setArgs(String args) {
+ this.args = args;
+ }
+}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
index 73b21f5..57cad18 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
@@ -205,7 +205,7 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(element, monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf temp", element.getMetaDir() + "/temp", ""), monitor);
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf temp", element.getMetaDir() + "/temp", ""));
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index f1d90c9..e27619e 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
@@ -24,7 +24,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -54,7 +53,7 @@ import org.yocto.bc.remote.utils.YoctoCommand;
public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private Text containerText;
private Text fileText;
-
+
private Text descriptionText;
private Text licenseText;
private Text checksumText;
@@ -65,17 +64,17 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private Text md5sumText;
private Text sha256sumText;
private Button btnPopulate;
-
+
private BitbakeRecipeUIElement element;
-
+
private ISelection selection;
private URI metaDirLoc;
private ArrayList<String> inheritance;

private IHost connection;
-
+
private String tempFolderPath;
-
+
public static final String TEMP_FOLDER_NAME = "temp";
public static final String TAR_BZ2_EXT = ".tar.bz2";
public static final String TAR_GZ_EXT = ".tar.gz";
@@ -98,7 +97,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private static final String AUTOTOOLS = "autotools";
private static final String md5Pattern = "^[0-9a-f]{32}$";
protected static final String sha256Pattern = "^[0-9a-f]{64}$";
-
+
public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) {
super("wizardPage");
setTitle("BitBake Recipe");
@@ -107,9 +106,10 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
this.connection = connection;
this.element = new BitbakeRecipeUIElement();
this.inheritance = new ArrayList<String>();
-
+
}

+ @Override
public void createControl(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
@@ -129,6 +129,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
gd = new GridData(GridData.FILL_HORIZONTAL);
containerText.setLayoutData(gd);
containerText.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -142,12 +143,12 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
handleBrowse(container, containerText);
}
});
-
+
label = new Label(container, SWT.NULL);
gd = new GridData();
gd.horizontalSpan = 3;
label.setLayoutData(gd);
-
+
label = new Label(container, SWT.NULL);
label.setText("SRC_&URI:");

@@ -155,12 +156,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
gd = new GridData(GridData.FILL_HORIZONTAL);
txtSrcURI.setLayoutData(gd);
txtSrcURI.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
if (txtSrcURI.getText().trim().isEmpty()) {
if (btnPopulate != null)
btnPopulate.setEnabled(false);
} else if (btnPopulate != null){
- btnPopulate.setEnabled(true);
+ btnPopulate.setEnabled(true);
}
dialogChanged();
}
@@ -182,7 +184,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
createField(container, "License File &Checksum:", (checksumText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&Package Description:", (descriptionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&License:", (licenseText = new Text(container, SWT.BORDER | SWT.SINGLE)));
-
+
createField(container, "&Homepage:", (homepageText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "Package &Author:", (authorText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&Section:", (sectionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
@@ -190,7 +192,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
// ProxySettingsComposite proxySettings = new ProxySettingsComposite(container, SWT.NONE);
// proxySettings.setEnabled(true);
// proxySettings.setVisible(true);
-
+
initialize();
dialogChanged();
setControl(container);
@@ -200,12 +202,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
Label label = new Label(container, SWT.NONE);
label.setText(title);
label.moveAbove(control);
-
+
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
control.setLayoutData(gd);
control.addModifyListener(new ModifyListener() {

+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -222,7 +225,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Directory must be specified");
return;
}
-
+
if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
updateStatus("File container must exist");
return;
@@ -231,10 +234,10 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Project must be writable");
return;
}
-
+
IProject project = container.getProject();
metaDirLoc = RemoteHelper.createNewURI(project.getLocationURI(), "meta");
-
+
if (fileName.length() == 0) {
updateStatus("File name must be specified");
return;
@@ -252,7 +255,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Recipe must have a description");
return;
}
-
+
if (licenseText.getText().length() == 0) {
updateStatus("Recipe must have a license");
return;
@@ -261,7 +264,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
if (txtSrcURI.getText().length() == 0) {
updateStatus("SRC_URI can't be empty");
}
-
+
updateStatus(null);
}

@@ -281,7 +284,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
element.setMetaDir(metaDirLoc);
return element;
}
-
+
private void handleBrowse(final Composite parent, final Text text) {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select project directory");
if (dialog.open() == Window.OK) {
@@ -291,14 +294,14 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}
}
-
+
private void handlePopulate() {
try {
IProgressMonitor monitor = new NullProgressMonitor();
URI srcURI = new URI(txtSrcURI.getText().trim());
String scheme = srcURI.getScheme();
String srcFileName = getSrcFileName(true);
- if ((scheme.equals(HTTP) || scheme.equals(FTP))
+ if ((scheme.equals(HTTP) || scheme.equals(FTP))
&& (srcFileName.endsWith(TAR_GZ_EXT) || srcFileName.endsWith(TAR_BZ2_EXT))) {
try {
handleRemotePopulate(srcURI, monitor);
@@ -315,7 +318,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
e.printStackTrace();
}
}
-
+
private void handleLocalPopulate(URI srcURI, IProgressMonitor monitor) {
populateLicenseFileChecksum(srcURI, monitor);
populateInheritance(srcURI, monitor);
@@ -326,43 +329,43 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {

populateRecipeName(srcURI);
List<YoctoCommand> commands = new ArrayList<YoctoCommand>();
-
+
String metaDirLocPath = metaDirLoc.getPath();
commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
updateTempFolderPath();
- commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
-
- updateTempFolderPath();
-
+
+
try {
- RemoteHelper.runBatchRemote(connection, commands, monitor, true);
- } catch (CoreException e) {
+ commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
+
+ updateTempFolderPath();
+ RemoteHelper.runBatchRemote(connection, commands, true);
+
+ commands.clear();
+
+ String md5Cmd = "md5sum " + getSrcFileName(true);
+ YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, md5YCmd);
+
+ String sha256Cmd = "sha256sum " + getSrcFileName(true);
+ YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, sha256YCmd);
+
+ URI extractDir = extractPackage(srcURI, monitor);
+ YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
+ updateSrcUri(createMirrorLookupTable(monitor), srcURI);
+ populateInheritance(extractDir, monitor);
+
+ String md5Val = retrieveSum(md5YCmd);
+ md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
+ String sha256Val = retrieveSum(sha256YCmd);
+ sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
+ String checkSumVal = retrieveSum(licenseChecksumCmd);
+ checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
+ } catch (Exception e) {
e.printStackTrace();
}
-
- commands.clear();
-
-
- String md5Cmd = "md5sum " + getSrcFileName(true);
- YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, md5YCmd, monitor);
-
- String sha256Cmd = "sha256sum " + getSrcFileName(true);
- YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, sha256YCmd, monitor);
-
- URI extractDir = extractPackage(srcURI, monitor);
- YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
- updateSrcUri(createMirrorLookupTable(monitor), srcURI);
- populateInheritance(extractDir, monitor);
-
- String md5Val = retrieveSum(md5YCmd);
- md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
- String sha256Val = retrieveSum(sha256YCmd);
- sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
- String checkSumVal = retrieveSum(licenseChecksumCmd);
- checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
}

private String retrieveSum(YoctoCommand cmd) {
@@ -384,31 +387,31 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
} else if(path.endsWith(TAR_GZ_EXT)){
tarCmd += "-xvf ";
}
-
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""), monitor);
-
+
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));
+
return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + getSrcFileName(false));
-
+
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
-
+
private void updateTempFolderPath(){
this.tempFolderPath = getMetaFolderPath() + TEMP_FOLDER_NAME + "/";
}
-
+
private String getMetaFolderPath(){
String sep = metaDirLoc.getPath().endsWith("/")? "" : "/";
return metaDirLoc.getPath() + sep;
}
-
+
private void populateInheritance(URI extractDir, IProgressMonitor monitor) {
IHostFile[] hostFiles = RemoteHelper.getRemoteDirContent(connection, metaDirLoc.getPath(), "", IFileService.FILE_TYPE_FILES, monitor);
if (hostFiles == null)
return;
-
+
for (IHostFile file: hostFiles) {
String fileName = file.getName();
if (fileName.equalsIgnoreCase(CMAKE_LIST)){
@@ -420,21 +423,21 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}
}
-
+
private YoctoCommand populateLicenseFileChecksum(URI extractDir, IProgressMonitor monitor) {
if (extractDir == null)
throw new RuntimeException("Something went wrong during source extraction!");
-
+
try {
YoctoCommand catCmd = new YoctoCommand("md5sum " + COPYING_FILE, extractDir.getPath(), "");
- RemoteHelper.runCommandRemote(connection, catCmd, monitor);
+ RemoteHelper.runCommandRemote(connection, catCmd);
return catCmd;
} catch (Exception e) {
throw new RuntimeException("Unable to process file for MD5 calculation", e);
}
-
+
}
-
+
private String getSrcFileName(boolean withExt){
URI srcURI;
try {
@@ -455,48 +458,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
return "";
}
-
-
-
-// private void populateSrcUriChecksum(URI srcUri, IProgressMonitor monitor) {
-// try {
-// String rmCmd = "rm -rf " + TEMP_FOLDER_NAME;
-// RemoteHelper.handleRunCommandRemote(connection, metaDirLoc.getPath(), rmCmd, "", monitor, cmdHandler);
-
-// String mkdirCmd = "mkdir " + TEMP_FOLDER_NAME;
-// updateTempFolderPath();
-// RemoteHelper.handleRunCommandRemote(connection, metaDirLoc.getPath(), mkdirCmd, "", monitor, cmdHandler);
-
-
-// String wgetCmd = "wget " + srcUri.toURL();
-// RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, rmCmd + APPEND_CH + mkdirCmd + APPEND_CH + wgetCmd, "", monitor, cmdHandler);
-//
-// String md5Cmd = "md5sum " + getSrcFileName(true);
-// ProcessStreamBuffer md5SumBuffer = RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, md5Cmd, "", monitor, cmdHandler);
-// String line = md5SumBuffer.getLastOutputLineContaining(getSrcFileName(true));
-// if (line != null) {
-// String[] md5SumTokens = line.split(WHITESPACES);
-// md5sumText.setText(md5SumTokens[0]);
-// }
-//
-// String sha256Cmd = "sha256sum " + getSrcFileName(true);
-// ProcessStreamBuffer sha256SumBuffer = RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, sha256Cmd, "", monitor, cmdHandler);
-// line = sha256SumBuffer.getLastOutputLineContaining(getSrcFileName(true));
-// if (line != null) {
-// String[] sha256SumTokens = line.split(WHITESPACES);
-// sha256sumText.setText(sha256SumTokens[0]);
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-
+
private HashMap<String, String> createMirrorLookupTable(IProgressMonitor monitor) throws Exception {
HashMap<String, String> mirrorMap = new HashMap<String, String>();
-
+
YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, "");
- RemoteHelper.runCommandRemote(connection, cmd, monitor);
-
+ RemoteHelper.runCommandRemote(connection, cmd);
+
if (!cmd.getProcessBuffer().hasErrors()){
String delims = "[\\t]+";
List<String> outputLines = cmd.getProcessBuffer().getOutputLines();
@@ -512,42 +480,42 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
return mirrorMap;
}
-
+
private void populateRecipeName(URI srcUri) {
String fileName = fileText.getText();
- if (!fileName.isEmpty())
+ if (!fileName.isEmpty())
return;
-
+
String recipeFile = getSrcFileName(false).replace("-", "_");
recipeFile += BB_RECIPE_EXT;
if (recipeFile != null)
fileText.setText(recipeFile);
}
-
+
private void updateSrcUri(HashMap<String, String> mirrorsMap, URI srcUri) {
Set<String> mirrors = mirrorsMap.keySet();
Iterator<String> iter = mirrors.iterator();
String mirror_key = null;
String srcURL = srcUri.toString();
-
- while (iter.hasNext()) {
- String value = (String)iter.next();
- if (srcURL.startsWith(value)) {
- mirror_key = value;
- break;
- }
- }
-
- if (mirror_key != null) {
- String replace_string = (String)mirrorsMap.get(mirror_key);
- if (replace_string != null)
- srcURL = replace_string + srcURL.substring(mirror_key.length());
- }
- int idx = srcURL.lastIndexOf("-");
- String new_src_uri = srcURL.substring(0, idx)+"-${PV}" + TAR_GZ_EXT;
- txtSrcURI.setText(new_src_uri);
+
+ while (iter.hasNext()) {
+ String value = iter.next();
+ if (srcURL.startsWith(value)) {
+ mirror_key = value;
+ break;
+ }
+ }
+
+ if (mirror_key != null) {
+ String replace_string = mirrorsMap.get(mirror_key);
+ if (replace_string != null)
+ srcURL = replace_string + srcURL.substring(mirror_key.length());
+ }
+ int idx = srcURL.lastIndexOf("-");
+ String new_src_uri = srcURL.substring(0, idx)+"-${PV}" + TAR_GZ_EXT;
+ txtSrcURI.setText(new_src_uri);
}
-
+
private void initialize() {
if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
IStructuredSelection ssel = (IStructuredSelection) selection;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
index d780cbf..77f4d2c 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
@@ -5,16 +5,13 @@ import java.net.URI;
import java.util.Hashtable;
import java.util.Map;

-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.ptp.remote.core.IRemoteConnection;
import org.eclipse.ptp.remote.core.IRemoteServices;
-import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
@@ -22,7 +19,7 @@ import org.eclipse.ui.console.MessageConsole;
import org.yocto.bc.remote.utils.CommandResponseHandler;
import org.yocto.bc.remote.utils.ConsoleWriter;
import org.yocto.bc.remote.utils.RemoteHelper;
-import org.yocto.bc.remote.utils.YoctoCommand;
+import org.yocto.bc.remote.utils.YoctoRunnableWithProgress;
import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.model.ProjectInfo;
import org.yocto.bc.ui.wizards.FiniteStateWizard;
@@ -106,24 +103,35 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
page.setPageComplete(true);
Map<String, Object> options = model;

-
try {
URI uri = new URI("");
if (options.containsKey(INSTALL_DIRECTORY)) {
uri = (URI) options.get(INSTALL_DIRECTORY);
}
+ IRemoteConnection remoteConnection = ((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION));
+ IRemoteServices remoteServices = ((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE));
+ IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+ CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(connection);

if (((Boolean)options.get(GIT_CLONE)).booleanValue()) {
- String[] cmd = {"/usr/bin/git clone --progress", "git://git.yoctoproject.org/poky.git", uri.getPath()};
-// String[] cmd = {"md5sum /home/builder/socks-gw"};
- LongtimeRunningTask runningTask = new LongtimeRunningTask("Checking out Yocto git repository", cmd,
- ((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)),
- ((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE)));
- ModalContext.setAllowReadAndDispatch(false);
- this.getContainer().run(false, false, runningTask);
+ String cmd = "/usr/bin/git clone --progress";
+ String args = "git://git.yoctoproject.org/poky.git " + uri.getPath();
+ String taskName = "Checking out Yocto git repository";
+ YoctoRunnableWithProgress adapter = (YoctoRunnableWithProgress)RemoteHelper.getHostShellProcessAdapter(connection);
+ adapter.setRemoteConnection(remoteConnection);
+ adapter.setRemoteServices(remoteServices);
+ adapter.setTaskName(taskName);
+ adapter.setCmd(cmd);
+ adapter.setArgs(args);
+ IWizardContainer container = this.getContainer();
+ try {
+ container.run(true, true, adapter);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
-
- CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(RemoteHelper.getRemoteConnectionByName(((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)).getName()));
if (!cmdHandler.hasError()) {
String initPath = "";
if (uri.getPath() != null) {
@@ -136,28 +144,25 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
pinfo.setInitScriptPath(initPath);
pinfo.setLocation(uri);
pinfo.setName(prjName);
- IRemoteConnection remConn = (IRemoteConnection) model.get(InstallWizard.SELECTED_CONNECTION);
- IHost connection = RemoteHelper.getRemoteConnectionByName(remConn.getName());
pinfo.setConnection(connection);
- pinfo.setRemoteServices((IRemoteServices) model.get(InstallWizard.SELECTED_REMOTE_SERVICE));
+ pinfo.setRemoteServices(remoteServices);

ConsoleWriter cw = new ConsoleWriter();
- this.getContainer().run(false, false, new BBConfigurationInitializeOperation(pinfo, cw));
+ this.getContainer().run(true, true, new BBConfigurationInitializeOperation(pinfo, cw));
console = RemoteHelper.getConsole(connection);
console.newMessageStream().println(cw.getContents());

model.put(InstallWizard.KEY_PINFO, pinfo);
Activator.putProjInfo(pinfo.getURI(), pinfo);

- this.getContainer().run(false, false, new CreateBBCProjectOperation(pinfo));
+ this.getContainer().run(true, true, new CreateBBCProjectOperation(pinfo));
return true;
-
}
+ return true;
} catch (Exception e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, e.getMessage(), e));
- this.getContainer().getCurrentPage().setDescription(
- "Failed to create project: " + e.getMessage());
+ this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage());
}
return false;
}
@@ -165,66 +170,4 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
public void init(IWorkbench workbench, IStructuredSelection selection) {
}

- private class LongtimeRunningTask implements IRunnableWithProgress {
- static public final int TOTALWORKLOAD = 100;
-
- private String []cmdArray;
- private String taskName;
- private IRemoteConnection connection;
- private IRemoteServices remoteServices;
-
- public LongtimeRunningTask(String taskName,
- String []cmdArray,
- IRemoteConnection connection, IRemoteServices remoteServices) {
- this.taskName = taskName;
- this.cmdArray = cmdArray;
- this.connection = connection;
- this.remoteServices = remoteServices;
- }
-
- synchronized public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
-// boolean cancel = false;
- try {
- monitor.beginTask(taskName, TOTALWORKLOAD);
-
- if (!connection.isOpen()) {
- try {
- connection.open(monitor);
- } catch (RemoteConnectionException e1) {
- e1.printStackTrace();
- }
- }
-
- if (!remoteServices.isInitialized()) {
- remoteServices.initialize();
- }
-
- String args = "";
- for (int i = 1; i < cmdArray.length; i++)
- args += cmdArray[i] + " ";
- try {
-// while (!cancel) {
-// if(monitor.isCanceled()) {
-// cancel=true;
-// throw new InterruptedException("User Cancelled");
-// }
- RemoteHelper.runCommandRemote(RemoteHelper.getRemoteConnectionByName(connection.getName()), new YoctoCommand(cmdArray[0], "", args), monitor);
-// if (hasErrors)
-// break;
-
-// Thread.sleep(5000);
-// }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- monitor.done();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
-
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
index e5ebd1b..fcc939c 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
@@ -63,12 +63,7 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInformation) throws CoreException {
IProjectDescription desc = workspace.newProjectDescription(projInformation.getProjectName());

-// try {
-// desc.setLocationURI(new URI(OEFS_SCHEME + projInfo2.getRootPath()));
- desc.setLocationURI(projInformation.getURI());
-// } catch (URISyntaxException e) {
-// throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to load filesystem.", e));
-// }
+ desc.setLocationURI(projInformation.getURI());

return desc;
}
--
1.7.9.5


[PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation

Ioana Grigoropol <ioanax.grigoropol@...>
 

- Resending patches with proper header for eclipse-poky
- Include fixes for showing progress information for long time running tasks on wizards for Bitbake Commander project & Bitbake recipe
- Includes validation for the location & name of a new Bitbake Commander in a new repo clone or an existing one

Ioana Grigoropol (3):
Show progress bar for New Bitbake Commander project
Show progress bar for building new Recipe in Bitbake commander
perspective
Validate project name and location for Bitbake command project

.../src/org/yocto/bc/bitbake/ShellSession.java | 116 +++-----
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 155 +++++------
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 136 +++++-----
.../bc/remote/utils/YoctoRunnableWithProgress.java | 106 ++++++++
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 2 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 285 ++++++++++----------
.../yocto/bc/ui/wizards/install/InstallWizard.java | 113 ++------
.../yocto/bc/ui/wizards/install/OptionsPage.java | 178 ++++++------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 31 +--
12 files changed, 551 insertions(+), 584 deletions(-)
create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

--
1.7.9.5