]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Create distribution working.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 6 Jun 2013 10:55:50 +0000 (10:55 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 6 Jun 2013 10:55:50 +0000 (10:55 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6333 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.rpmfactory/src/main/java/org/argeo/slc/rpmfactory/core/CreateRpmDistribution.java
runtime/org.argeo.slc.rpmfactory/src/main/java/org/argeo/slc/rpmfactory/core/RpmFactory.java
runtime/org.argeo.slc.rpmfactory/src/main/java/org/argeo/slc/rpmfactory/core/ThirdPartyRpmRepository.java

index 70a5e705c2a3601466059d260ad0de52bacb8ef5..625193aa924aaaf7b431b9c3aab259bcdeb3d44c 100644 (file)
@@ -16,7 +16,6 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.core.execution.tasks.SystemCall;
-import org.springframework.core.io.ByteArrayResource;
 
 /**
  * Gather RPMs from various sources (local builds or third party) into a
@@ -46,7 +45,7 @@ public class CreateRpmDistribution implements Runnable {
                        SystemCall repoquery = new SystemCall();
                        repoquery.arg(repoqueryExecutable);
 
-                       File yumConfigFile = rpmFactory.getYumConfigFile(arch);
+                       File yumConfigFile = rpmFactory.getYumRepoFile(arch);
                        repoquery.arg("-c", yumConfigFile.getAbsolutePath());
                        repoquery.arg("--requires");
                        repoquery.arg("--resolve");
@@ -102,6 +101,17 @@ public class CreateRpmDistribution implements Runnable {
                                }
                        }
 
+                       // createrepo
+                       File workspaceDir = rpmFactory.getWorkspaceDir(rpmDistribution
+                                       .getId());
+                       SystemCall createrepo = new SystemCall();
+                       createrepo.arg("createrepo");
+                       createrepo.arg("-q");
+                       createrepo.arg("-d");
+                       File archDir = new File(workspaceDir.getPath()
+                                       + targetFolder.getPath());
+                       createrepo.arg(archDir.getAbsolutePath());
+                       createrepo.run();
                } catch (Exception e) {
                        throw new SlcException("Cannot generate distribution "
                                        + rpmDistribution.getId(), e);
index b881cf46f12f692e451afd70782eb4088df939c5..4daf3b1eadb239839b3700f55cf18201e1032ec9 100644 (file)
@@ -243,6 +243,10 @@ public class RpmFactory {
                                buf.append("baseurl=").append(proxiedReposBase)
                                                .append(repository.getId()).append('/').append(arch)
                                                .append('/').append("\n");
+                               if (((ThirdPartyRpmRepository) repository).getYumConf() != null)
+                                       buf.append(
+                                                       ((ThirdPartyRpmRepository) repository).getYumConf()
+                                                                       .trim()).append('\n');
                        }
                }
 
@@ -259,6 +263,7 @@ public class RpmFactory {
                buf.append('[').append(workspace).append("]\n");
                buf.append("baseurl=").append(managedReposBase).append(workspace)
                                .append('/').append(arch).append('/').append("\n");
+               buf.append("gpgcheck=0").append("\n");
        }
 
        /** Creates a mock config file. */
@@ -284,8 +289,8 @@ public class RpmFactory {
        }
 
        /** Creates a yum config file. */
-       public File getYumConfigFile(String arch) {
-               File yumConfigFile = new File(yumConfDir, getIdWithArch(arch) + ".conf");
+       public File getYumRepoFile(String arch) {
+               File yumConfigFile = new File(yumConfDir, getIdWithArch(arch) + ".repo");
                try {
                        FileUtils.writeStringToFile(yumConfigFile,
                                        generateYumConfigFile(arch));
index 3e366e28b27f2239dd4bb35f508db430a4a919a2..29025301cbc71102a28033ee7dbe965efe385157 100644 (file)
@@ -5,5 +5,14 @@ package org.argeo.slc.rpmfactory.core;
  * will be cached within the system.
  */
 public class ThirdPartyRpmRepository extends AbstractRpmRepository {
+       private String yumConf;
+
+       public String getYumConf() {
+               return yumConf;
+       }
+
+       public void setYumConf(String yumConf) {
+               this.yumConf = yumConf;
+       }
 
 }