Exemplo n.º 1
0
        protected override bool GetPkgInstalledStatus(out bool isInstalled)
        {
            isInstalled  = false;
            ErrorMessage = string.Empty;

            PkgInstalledStatusWaiter waiter = new PkgInstalledStatusWaiter();
            string  argument = DeviceManager.AdjustSdbArgument("shell 0 vs_lldbversion");
            Process process  = SDBLib.CreateSdbProcess(true, true);
            var     result   = (process == null) ? null : SDBLib.RunSdbProcessAsync(process, argument, true, waiter);

            if (!waiter.Waiter.WaitOne(30000))
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: Timeout");
                return(false);
            }

            try
            {
                Version installedLldbVersion = new Version(waiter.InstalledStatus);
                Version lldbRpmFileVersion   = new Version(lldbVersion);

                if (installedLldbVersion >= lldbRpmFileVersion)
                {
                    OutputDeviceErrorMsg("GetPkgInstalledStatus (already installed): " + lldbPkgName);
                    isInstalled = true;
                }

                return(true);
            }
            catch (Exception e)
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: " + e.Message);
                return(false);
            }
        }
Exemplo n.º 2
0
        protected virtual bool PushDebuggerPackage(string source, string destination)
        {
            DebuggerInstallWaiter waiter = new DebuggerInstallWaiter(this as IOndemandInstallerEvents);
            Process process = SDBLib.CreateSdbProcess(true, true);

            if (process == null)
            {
                ErrorMessage = "Failed to get sdb.exe program";
                return(false);
            }

            string fmt      = "push \"{0}\" \"{1}\"";
            string arg      = String.Format(fmt, source, destination);
            string argument = DeviceManager.AdjustSdbArgument(arg);
            var    result   = SDBLib.RunSdbProcessAsync(process, argument, true,
                                                        waiter);

            if (waiter.Waiter.WaitOne(300 * 1000)) // 5 minutes will be enough?
            {
                ErrorMessage = waiter.LastErrorMessage;
                return(waiter.PushResult);
            }

            ErrorMessage = "SDB Push Timeout.";
            return(false);
        }
Exemplo n.º 3
0
        protected virtual bool GetPkgInstalledStatus(out bool isInstalled)
        {
            isInstalled  = false;
            ErrorMessage = string.Empty;

            PkgInstalledStatusWaiter waiter2 = new PkgInstalledStatusWaiter();
            string argument = DeviceManager.AdjustSdbArgument(
                "shell \"rpm -qa | grep " + lldbPkgName + "\"");
            Process process = SDBLib.CreateSdbProcess(true, true);
            var     result  = (process == null) ? null : SDBLib.RunSdbProcessAsync(process, argument, true, waiter2);

            if (!waiter2.Waiter.WaitOne(30000))
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: " + lldbPkgName);
                return(false);
            }

            if (!string.IsNullOrEmpty(waiter2.InstalledStatus))
            {
                Version installedLldbVersion = new Version(waiter2.InstalledStatus.Split('-')[1]);
                Version lldbRpmFileVersion   = new Version(lldbVersion);

                if (installedLldbVersion >= lldbRpmFileVersion)
                {
                    OutputDeviceErrorMsg("GetPkgInstalledStatus (already installed): " + lldbPkgName);
                    isInstalled = true;
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        private void CheckPackage(string name, ProfilerPackage package)
        {
            InstalledWaiter waiter  = new InstalledWaiter();
            var             proc    = SDBLib.CreateSdbProcess(true, true);
            string          cmdline = DeviceManager.AdjustSdbArgument("shell \"rpm -q " + name + "\"");
            var             result  = SDBLib.RunSdbProcessAsync(proc, cmdline, true, waiter);

            if (!waiter.Waiter.WaitOne(30000))
            {
                Print($"CheckPackage fails for {name}");
                return;
            }

            bool installed = !string.IsNullOrEmpty(waiter.InstalledStatus) &&
                             !waiter.InstalledStatus.EndsWith("not installed");

            Print($"Package {name} installed: {installed}");
            if (installed)
            {
                string[] components = ParsePackageFilename(waiter.InstalledStatus);
                if (components.Length > 2)
                {
                    package.InstalledVersion = components[2];
                }

                if (components.Length > 3)
                {
                    package.InstalledRelease = components[3];
                }
            }

            package.NeedToInstall = !installed;
        }