[Esbox-commits] r1038 - in branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2: command launcher ui/wizard
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Thu Dec 4 19:25:32 EET 2008
Author: eswartz
Date: 2008-12-04 19:25:31 +0200 (Thu, 04 Dec 2008)
New Revision: 1038
Modified:
branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java
branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
Log:
Fix some available rootstrap scanning and installation issues.
Modified: branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-12-04 14:46:53 UTC (rev 1037)
+++ branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-12-04 17:25:31 UTC (rev 1038)
@@ -12,7 +12,6 @@
package org.maemo.esbox.internal.scratchbox.sb2.command;
import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.internal.scratchbox.sb2.core.Scratchbox2SDK;
import org.maemo.esbox.scratchbox.core.command.ScratchboxInvalidParameterException;
import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
import org.maemo.esbox.scratchbox.sb2.sdk.MaemoRootstrap;
@@ -22,7 +21,6 @@
import org.maemo.mica.common.core.sdk.commands.ICommandAbstractor;
import java.util.*;
-import java.util.regex.Matcher;
/**
* List the maemo rootstraps available for installation.
@@ -67,24 +65,31 @@
.singletonList(availableAction), proxyEnvBlock, LIST_TIMEOUT);
// this output has a few header lines
+ boolean gotHeader = false;
+
List<MaemoRootstrap> targetsAvailable = new ArrayList<MaemoRootstrap>();
+ // the output is in the form "target_arch, arch, description" for each line
for (String line : available) {
- Matcher matcher = Scratchbox2SDK.TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN.matcher(line);
- if(!matcher.matches()){
+ if (line.contains("Nickname,")) {
+ gotHeader = true;
continue;
}
if (line.trim().length() == 0) {
continue;
}
+ if (!gotHeader) {
+ continue;
+ }
- String[] tokens = line.split("_");
- if (tokens.length == 2) {
+ String[] tokens = line.split(",\\s*");
+ if (tokens.length == 3) {
targetsAvailable.add(new MaemoRootstrap(tokens[0], tokens[1],
- ""));
+ tokens[2]));
}
}
+
return targetsAvailable;
}
Modified: branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
===================================================================
--- branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java 2008-12-04 14:46:53 UTC (rev 1037)
+++ branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java 2008-12-04 17:25:31 UTC (rev 1038)
@@ -40,9 +40,9 @@
super(encodeArgumentArray(sdkTarget, cmdLine, modeKey),
environmentModifierBlock, workingDirectory,
sdkTarget);
-// if (runAsRoot) {
-// getLaunchCommandArguments().add(0, "sudo");
-// }
+ if (runAsRoot) {
+ getLaunchCommandArguments().add(0, "sudo");
+ }
if (sdkTarget == null)
throw new IllegalArgumentException();
this.sdkTarget = sdkTarget;
Modified: branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java
===================================================================
--- branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java 2008-12-04 14:46:53 UTC (rev 1037)
+++ branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/NewScratchbox2TargetWizard.java 2008-12-04 17:25:31 UTC (rev 1038)
@@ -107,7 +107,9 @@
private boolean setupTargetFromRootstrap() {
String targetName;
// in this mode, make a predefined target from a maemo rootstrap
- targetName = getRootstrap().getTarget();
+
+ // EJS: #getName(), not #getTarget() after changes to parsing
+ targetName = getRootstrap().getName();
boolean create = true;
if (true) {
@@ -158,8 +160,9 @@
monitor.beginTask("Creating rootstrap",
IProgressMonitor.UNKNOWN);
try {
+ // the user approved this, whether or not it existed before, so pass "true" to force installation
sdk.createRootstrapTarget(targetName, useHostTools,
- false, new SubProgressMonitor(monitor, 1));
+ true, new SubProgressMonitor(monitor, 1));
createdTarget = sdk.findSDKTarget(targetName);
} catch (MicaException e) {
throw new InvocationTargetException(e);
Modified: branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
===================================================================
--- branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-12-04 14:46:53 UTC (rev 1037)
+++ branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-12-04 17:25:31 UTC (rev 1038)
@@ -154,7 +154,8 @@
Object parentElement, Object element) {
if (element instanceof MaemoRootstrap) {
MaemoRootstrap rootstrap = (MaemoRootstrap) element;
- if (sdk.findSDKTarget(rootstrap.getTarget()) != null)
+ // EJS: not getTarget() after changing the parsing
+ if (sdk.findSDKTarget(rootstrap.getName()) != null)
return false;
}
return true;
More information about the Esbox-commits
mailing list