import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
import org.tizen.nativeplatform.launch.wizards.ShowPackageStatusDialog;
import org.tizen.nativeplatform.pkg.commander.IPackager;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.PackagerFactory;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
if (selecteDvPkgs != null && !selecteDvPkgs.isEmpty()) {
- launchUtils.installPkgsToDevice(selecteDvPkgs, monitor);
+ if (PlatformProjectUtil.isEFLApplication(platformProject)) {
+ launchUtils.installPkgsToDevice(selecteDvPkgs, IPkgCommander.TOOL.PKGCMD,
+ monitor);
+ } else {
+ launchUtils.installPkgsToDevice(selecteDvPkgs, monitor);
+ }
}
monitor.done();
PkgMgrInitializer initializer = new PkgMgrInitializer(target);
initializer.initRootstrapRepoInfo();
}
- return installPkgs(target.getRootstrapCommander(), packages, monitor);
+ return installPkgs(target.getRootstrapCommander(), IPkgCommander.TOOL.ZYPPER, packages,
+ monitor);
}
public boolean installPkgsToDevice(List<LocalPackage> packages, IProgressMonitor monitor)
PkgMgrInitializer initializer = new PkgMgrInitializer(target);
initializer.initDeviceRepoInfo();
}
- return installPkgs(target.getDeviceCommander(), packages, monitor);
+ return installPkgs(target.getDeviceCommander(), IPkgCommander.TOOL.ZYPPER, packages,
+ monitor);
}
- private boolean installPkgs(IPkgCommander commander, List<LocalPackage> packages,
+ public boolean installPkgsToDevice(List<LocalPackage> packages, IPkgCommander.TOOL type,
IProgressMonitor monitor) throws InterruptedException {
+ if (!target.getDevice().isOnline()) {
+ newException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
+ } else if (!target.getDevice().isRoot()) {
+ newException(PlatformLaunchMessages.DEVICE_IS_NOT_ROOT_ON);
+ } else {
+ PkgMgrInitializer initializer = new PkgMgrInitializer(target);
+ initializer.initDeviceRepoInfo();
+ }
+ return installPkgs(target.getDeviceCommander(), type, packages, monitor);
+ }
+
+ private boolean installPkgs(IPkgCommander commander, IPkgCommander.TOOL type,
+ List<LocalPackage> packages, IProgressMonitor monitor) throws InterruptedException {
monitor.beginTask("Installing packages to rootstrap", 2);
List<String> paths = new ArrayList<String>();
paths.add(filePath.trim());
}
- ICommandStatus status = commander.installLocalPkg(paths.toArray(new String[0]), monitor);
+ ICommandStatus status = commander.installLocalPkg(paths.toArray(new String[0]), type,
+ monitor);
monitor.worked(1);
if (!status.isOk()) {
import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingAppPage;
import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingBinPage;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
import org.tizen.sdblib.IDevice;
public class PlatformLaunchWizard extends Wizard implements IPageChangingListener,
monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
if (selecteDvPkgs != null && !selecteDvPkgs.isEmpty()) {
- launchUtil.installPkgsToDevice(selecteDvPkgs, monitor);
+ if (PlatformProjectUtil.isEFLApplication(project)) {
+ launchUtil.installPkgsToDevice(selecteDvPkgs,
+ IPkgCommander.TOOL.PKGCMD, monitor);
+ } else {
+ launchUtil.installPkgsToDevice(selecteDvPkgs, monitor);
+ }
}
monitor.done();
}
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.nativeplatform.pkg.commander;
import java.util.List;
import org.tizen.nativeplatform.pkgmgr.model.Package;
public interface IPkgCommander {
+
+ enum TOOL {
+ RPM, ZYPPER, PKGCMD
+ }
PackageManagerOuputReceiver getOutputReceiver();
String[] getName(String pkg);
String[] getVer(String pkg);
+
+ ICommandStatus installLocalPkg(String[] files, TOOL type, IProgressMonitor monitor);
ICommandStatus installLocalPkg(String[] files, IProgressMonitor monitor);
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.nativeplatform.pkg.commander.rpm;
import java.io.File;
import org.tizen.common.ui.view.console.ConsoleManager;
import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
+import org.tizen.nativeplatform.pkg.tools.PkgcmdTool;
import org.tizen.nativeplatform.pkg.tools.RpmTool;
import org.tizen.nativeplatform.pkg.tools.ZypperTool;
import org.tizen.nativeplatform.pkg.tools.ZypperXmlParser;
public RpmCommanderCommon(String consoleName) {
rec = getNewOuputReceiver(consoleName);
}
-
+
public PackageManagerOuputReceiver getOutputReceiver() {
return rec;
}
return result.toArray(new String[0]);
}
- public ICommandStatus installLocalPkg(String[] files, IProgressMonitor monitor) {
+ public ICommandStatus installLocalPkg(String[] files, TOOL type, IProgressMonitor monitor) {
ICommandStatus status = copyFiles(files);
if (!status.isOk()) {
logger.error(status.getMessage(), status.getException());
List<String> value = status.getValues();
if (value != null && value.size() > 0) {
changeUpdateMode();
- /*
- * String command = makeCommand(getResetRpmDb(),
- * RpmTool.installCommand(value.toArray(new String[0])));
- */
- String command = makeCommand(getResetRpmDb(),
- ZypperTool.installLocalCommand(value.toArray(new String[0])));
- status = execute(command, monitor);
+ if (type == TOOL.RPM) {
+ String command = makeCommand(getResetRpmDb(),
+ RpmTool.installCommand(value.toArray(new String[0])));
+ status = execute(command, monitor);
+ } else if (type == TOOL.ZYPPER) {
+ String command = makeCommand(getResetRpmDb(),
+ ZypperTool.installLocalCommand(value.toArray(new String[0])));
+ status = execute(command, monitor);
+ } else if (type == TOOL.PKGCMD) {
+ String command = makeCommand(getResetRpmDb(),
+ PkgcmdTool.installCommand(value.toArray(new String[0])));
+ status = execute(command, monitor);
+ }
}
+
return status;
}
+ public ICommandStatus installLocalPkg(String[] files, IProgressMonitor monitor) {
+ return installLocalPkg(files, TOOL.ZYPPER, monitor);
+ }
+
public ICommandStatus installLocalPkg(String file, IProgressMonitor monitor) {
String[] files = { file };
return installLocalPkg(files, monitor);
/*
* Following error can be occurred in case of using zypper.
- *
- * Error: Subprocess failed. Error: RPM failed: error: db4 error(-30971) from
- * dbenv->open: DB_VERSION_MISMATCH: Database environment version
+ *
+ * Error: Subprocess failed. Error: RPM failed: error: db4 error(-30971)
+ * from dbenv->open: DB_VERSION_MISMATCH: Database environment version
* mismatch error: cannot open Packages index using db4 - (-30971)
* error: cannot open Packages database in /var/lib/rpm error: db4
* error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database
--- /dev/null
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeplatform.pkg.tools;
+
+public class PkgcmdTool {
+
+ private final static String WS = " ";
+ private final static String TOOL = "pkgcmd";
+ private final static String INSTALL_OP = "--install";
+
+ private final static String PKGTYPE_OP = "--package-type";
+ private final static String PKGPATH_OP = "--package-path";
+
+ private final static String QUIET_OP = "--quiet";
+
+ public static String installCommand(String[] list) {
+ return installCommand(list[0]);
+ }
+
+ public static String installCommand(String file) {
+ return makeCommand(INSTALL_OP, QUIET_OP, PKGTYPE_OP, "rpm", PKGPATH_OP, file);
+ }
+
+ private static String makeCommand(String... options) {
+ String command = TOOL + WS;
+ for (String op : options) {
+ op = op.trim();
+ if (op.isEmpty())
+ continue;
+ command += op + WS;
+ }
+ return command.trim();
+ }
+}
-package org.tizen.nativeplatform.pkg.tools;
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
-import java.util.List;
+package org.tizen.nativeplatform.pkg.tools;
public class RpmTool {
-package org.tizen.nativeplatform.pkg.tools;
+/*
+ * Native Platform
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Donghyuk Yang <donghyuk.yang@samsung.com>
+ * DongHee Yang <donghee.yang@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
-import java.util.List;
+package org.tizen.nativeplatform.pkg.tools;
public class ZypperTool {