use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.
the class DownloadPrepareSourcesTest method importSrpm.
/**
* Import the SRPM into the project (make .spec accessible)
*
* @param testProject The test project
* @param layout layout The layout of the RPM project (RPMBuild or FLAT)
* @return The RPM project
* @throws CoreException
* @throws IOException
*/
private RPMProject importSrpm(IProject testProject, RPMProjectLayout layout) throws CoreException, IOException {
// Instantiate an RPMProject
RPMProject rpmProject = new RPMProject(testProject, layout);
// Find the test SRPM and install it
URL url = FileLocator.find(FrameworkUtil.getBundle(RPMProjectTest.class), new Path(// $NON-NLS-1$ //$NON-NLS-2$
"resources" + file_sep + "srpms" + file_sep + "hello-2.8-1.fc19.src.rpm"), null);
File foo = new File(FileLocator.toFileURL(url).getPath());
// import the SRPM into the RPMProject
rpmProject.importSourceRPM(foo);
return rpmProject;
}
use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.
the class DownloadPrepareSourcesTest method layoutRPMBuildDownloadSourcesTest.
/**
* Testing downloading sources using RPMBuild layout
*
* @throws CoreException
* @throws IOException
* @throws InterruptedException
*/
@Test
public void layoutRPMBuildDownloadSourcesTest() throws CoreException, IOException, InterruptedException {
RPMProject rpmProject = importSrpm(testProject, RPMProjectLayout.RPMBUILD);
assertNotNull(rpmProject);
downloadFile(rpmProject);
checkDownloadedFile(rpmProject, RPMProjectLayout.RPMBUILD);
}
use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.
the class RPMProjectTest method testBuildAllRPMHelloWorld.
@Test
@Ignore
public void testBuildAllRPMHelloWorld() throws Exception {
// Create a project for the test
IProject testProject = root.getProject("testBuildAllRPMHelloWorld1");
RPMProject rpmProject = importSrpm(testProject);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
rpmProject.buildAll(bos);
IFile foo2 = rpmProject.getConfiguration().getSrpmsFolder().getFile(new Path("helloworld-2-2.src.rpm"));
assertTrue(foo2.exists());
String arch = Utils.runCommandToString("rpm", "--eval", "%{_arch}").trim();
IFile foo3 = rpmProject.getConfiguration().getRpmsFolder().getFolder(new Path(arch)).getFile(new Path("helloworld-2-2." + arch + ".rpm"));
assertTrue(foo3.exists());
testProject.delete(true, true, null);
}
use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.
the class RPMProjectTest method testGetSourcesFolder.
@Test
@Ignore
public void testGetSourcesFolder() throws Exception {
// Create a project for the test
IProject testProject = root.getProject("testBuildSourceRPMHelloWorld1");
testProject.create(monitor);
testProject.open(monitor);
// Instantiate an RPMProject
RPMProject rpmProject = new RPMProject(testProject, RPMProjectLayout.RPMBUILD);
IProjectConfiguration config = rpmProject.getConfiguration();
String folder = config.getSourcesFolder().getLocation().toOSString();
int sourceFolder = folder.indexOf("SOURCES");
assertTrue(sourceFolder != -1);
testProject.delete(true, true, null);
}
use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.
the class RPMProjectTest method testImportHelloWorld.
@Test
public void testImportHelloWorld() throws Exception {
// Create a project for the test
IProject testProject = root.getProject("testHelloWorld");
RPMProject rpmProject = importSrpm(testProject);
// Make sure the original SRPM got copied into the workspace
IFile srpm = rpmProject.getConfiguration().getSrpmsFolder().getFile(new Path("helloworld-2-2.src.rpm"));
assertTrue(srpm.exists());
// Make sure everything got installed properly
IFile spec = rpmProject.getConfiguration().getSpecsFolder().getFile(new Path("helloworld.spec"));
assertTrue(spec.exists());
IFile sourceBall = rpmProject.getConfiguration().getSourcesFolder().getFile(new Path("helloworld-2.tar.bz2"));
assertTrue(sourceBall.exists());
// Make sure we got the spec file
IResource specFile = rpmProject.getSpecFile();
assertNotNull(specFile);
// Make sure the RPM nature was added
assertTrue(testProject.hasNature(IRPMConstants.RPM_NATURE_ID));
// Clean up
testProject.delete(true, true, monitor);
}
Aggregations