Search in sources :

Example 6 with RPMProject

use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.

the class RPMProjectTest method testBuildBinaryRPMHelloWorld.

@Test
@Ignore
public void testBuildBinaryRPMHelloWorld() throws Exception {
    // Create a project for the test
    IProject testProject = root.getProject("testBuildBinaryRPMHelloWorld1");
    RPMProject rpmProject = importSrpm(testProject);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    rpmProject.buildBinaryRPM(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);
}
Also used : Path(org.eclipse.core.runtime.Path) IFile(org.eclipse.core.resources.IFile) RPMProject(org.eclipse.linuxtools.rpm.core.RPMProject) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IProject(org.eclipse.core.resources.IProject) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with RPMProject

use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.

the class RPMProjectTest method testBuildPrepHelloWorld.

@Test
@Ignore
public void testBuildPrepHelloWorld() throws Exception {
    // Create a project for the test
    IProject testProject = root.getProject("testBuildPrepHelloWorld");
    RPMProject rpmProject = importSrpm(testProject);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    rpmProject.buildPrep(bos);
    // Make sure we got everything in the build directory
    IContainer builddir = rpmProject.getConfiguration().getBuildFolder();
    IFolder helloworldFolder = builddir.getFolder(new Path("helloworld-2"));
    assertTrue(helloworldFolder.exists());
    // Clean up
    testProject.delete(true, true, monitor);
}
Also used : Path(org.eclipse.core.runtime.Path) RPMProject(org.eclipse.linuxtools.rpm.core.RPMProject) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IContainer(org.eclipse.core.resources.IContainer) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 8 with RPMProject

use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.

the class RPMProjectTest method testBuildSourceRPMHelloWorld.

@Test
@Ignore
public void testBuildSourceRPMHelloWorld() throws Exception {
    // Create a project for the test
    IProject testProject = root.getProject("testBuildSourceRPMHelloWorld1");
    RPMProject rpmProject = importSrpm(testProject);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    rpmProject.buildSourceRPM(bos);
    IFile foo2 = rpmProject.getConfiguration().getSrpmsFolder().getFile(new Path("helloworld-2-2.src.rpm"));
    assertTrue(foo2.exists());
    testProject.delete(true, true, null);
}
Also used : Path(org.eclipse.core.runtime.Path) IFile(org.eclipse.core.resources.IFile) RPMProject(org.eclipse.linuxtools.rpm.core.RPMProject) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IProject(org.eclipse.core.resources.IProject) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with RPMProject

use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.

the class SRPMImportOperation method run.

/**
 * @see org.eclipse.jface.operation.IRunnableWithProgress#run(IProgressMonitor)
 *
 * Perform the import of  SRPM import. Call the build class incrementally
 */
@Override
public void run(IProgressMonitor progressMonitor) {
    // Total number of work steps needed
    int totalWork = 3;
    rpmErrorTable = new ArrayList<>();
    // $NON-NLS-1$
    progressMonitor.beginTask(// $NON-NLS-1$
    Messages.getString("SRPMImportOperation.Starting"), totalWork);
    // Try to create an instance of the build class.
    try {
        RPMProject rpmProject = new RPMProject(project, projectLayout);
        progressMonitor.worked(1);
        // $NON-NLS-1$
        progressMonitor.setTaskName(Messages.getString("SRPMImportOperation.Importing_SRPM"));
        if (sourceRPM != null) {
            rpmProject.importSourceRPM(sourceRPM);
            progressMonitor.worked(2);
        } else if (remoteSRPM != null) {
            SubMonitor submonitor = SubMonitor.convert(progressMonitor, 1);
            rpmProject.importSourceRPM(remoteSRPM, submonitor);
            progressMonitor.worked(2);
        }
    } catch (CoreException e) {
        rpmErrorTable.add(e);
    }
    progressMonitor.worked(2);
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) RPMProject(org.eclipse.linuxtools.rpm.core.RPMProject) SubMonitor(org.eclipse.core.runtime.SubMonitor)

Example 10 with RPMProject

use of org.eclipse.linuxtools.rpm.core.RPMProject in project linuxtools by eclipse.

the class DownloadPrepareSourcesTest method layoutFLATPrepareSourcesTest.

/**
 * Test preparing sources using FLAT layout
 *
 * @throws CoreException
 * @throws IOException
 * @throws InterruptedException
 */
@Test
public void layoutFLATPrepareSourcesTest() throws CoreException, IOException, InterruptedException {
    RPMProject rpmProject = importSrpm(testProject, RPMProjectLayout.FLAT);
    assertNotNull(rpmProject);
    downloadFile(rpmProject);
    checkDownloadedFile(rpmProject, RPMProjectLayout.FLAT);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    IStatus is = rpmProject.buildPrep(bos);
    assertTrue(is.isOK());
    checkPreparedSources(rpmProject, RPMProjectLayout.FLAT);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) RPMProject(org.eclipse.linuxtools.rpm.core.RPMProject) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

RPMProject (org.eclipse.linuxtools.rpm.core.RPMProject)16 Test (org.junit.Test)11 IFile (org.eclipse.core.resources.IFile)9 Path (org.eclipse.core.runtime.Path)9 IProject (org.eclipse.core.resources.IProject)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 Ignore (org.junit.Ignore)5 URL (java.net.URL)4 IResource (org.eclipse.core.resources.IResource)4 File (java.io.File)3 IStatus (org.eclipse.core.runtime.IStatus)3 CoreException (org.eclipse.core.runtime.CoreException)2 Job (org.eclipse.core.runtime.jobs.Job)2 DownloadJob (org.eclipse.linuxtools.rpm.core.utils.DownloadJob)2 Specfile (org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile)2 SpecfileParser (org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser)2 Shell (org.eclipse.swt.widgets.Shell)2 IOException (java.io.IOException)1 HttpURLConnection (java.net.HttpURLConnection)1 MalformedURLException (java.net.MalformedURLException)1