public String getPackageVersion(DebianDependency pkg, boolean onlyInstalled) { GetPackageVersionResult packageResult = new GetPackageVersionResult(); IOUtil.executeProcess(new String[] {"dpkg", "--status", pkg.getPackageName()}, packageResult); if (packageResult.getResult() != null) { return packageResult.getResult(); } if (!onlyInstalled) { GetChangelogVersionResult versionResult = new GetChangelogVersionResult(pkg.getPackageName()); IOUtil.executeProcess( new String[] { "apt-get", "--no-act", "--verbose-versions", "install", pkg.getPackageName() }, versionResult); if (versionResult.getResult() != null) { return versionResult.getResult(); } } return null; }
/** * Searches the package containing the Javadoc for the specified package. * * @param dependency */ public DebianDependency searchJavaDocPkg(DebianDependency dependency) { DebianDependency pkg = searchPkg(new File("/usr/share/doc/" + dependency.getPackageName() + "/api/index.html")); if (pkg == null) { pkg = searchPkg( new File("/usr/share/doc/" + dependency.getPackageName() + "-doc/api/index.html")); } if (pkg == null) { pkg = searchPkg( new File("/usr/share/doc/" + dependency.getPackageName() + "/apidocs/index.html")); } if (pkg == null) { pkg = searchPkg( new File( "/usr/share/doc/" + dependency.getPackageName() + "-doc/apidocs/index.html")); } return pkg; }