incubator-bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bm...@apache.org
Subject svn commit: r1182232 [1/2] - in /incubator/bigtop/trunk: bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ bigtop-tests/test-artifacts/package/src/main/resources/
Date Wed, 12 Oct 2011 06:55:49 GMT
Author: bmahe
Date: Wed Oct 12 06:55:48 2011
New Revision: 1182232

URL: http://svn.apache.org/viewvc?rev=1182232&view=rev
Log:
BIGTOP-111. Add urpmi support in test framework for Mageia

Added:
    incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
    incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_urpmi.xml
Modified:
    incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
    incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy

Modified: incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy?rev=1182232&r1=1182231&r2=1182232&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
(original)
+++ incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
Wed Oct 12 06:55:48 2011
@@ -213,6 +213,8 @@ public abstract class PackageManager {
         return new YumCmdLinePackageManager();
       case ~/(?is).*(suse|sles|sled).*/:
         return new ZypperCmdLinePackageManager();
+      case ~/(?is).*(mageia).*/:
+        return new UrpmiCmdLinePackageManager();
       default:
         return null;
     }

Modified: incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy?rev=1182232&r1=1182231&r2=1182232&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
(original)
+++ incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
Wed Oct 12 06:55:48 2011
@@ -44,7 +44,7 @@ class RPMPackage extends ManagedPackage 
       if (curMetaKey == "description" || ((it =~ /^\s+: /).find() && curMetaKey ==
"summary")) {
         pkg.meta[curMetaKey] <<= "\n${it.replaceAll(/^\s+:/,'')}";
       } else {
-        def m = (it =~ /(\S+) *: *(.+)/);
+        def m = (it =~ /(\S+)\s*:\s*(.*)/);
         if (m.size()) {
           String[] matcher = m[0];
           if ("Name" == matcher[1] && !givenPkg) {

Added: incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy?rev=1182232&view=auto
==============================================================================
--- incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
(added)
+++ incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
Wed Oct 12 06:55:48 2011
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.bigtop.itest.pmanager
+
+import org.apache.bigtop.itest.posix.Service
+
+class UrpmiCmdLinePackageManager extends PackageManager {
+  static String type  = "urpmi";
+  
+  public void setDefaults(String defaults) {}
+
+  public int addBinRepo(String record, String url, String key, String cookie) {
+    shRoot.exec("urpmi.addmedia '${record}' $url");
+    return shRoot.getRet();
+  }
+
+  public int removeBinRepo(String record) {
+    shRoot.exec("urpmi.removemedia -q '${record}'");
+    return shRoot.getRet();
+  }
+
+  public int refresh() {
+    shRoot.exec("urpmi.update -a");
+    return shRoot.getRet();
+  }
+
+  public int cleanup() {
+    shRoot.exec("urpmi --clean");
+    return shRoot.getRet();
+  }
+
+  public List<PackageInstance> search(String name) {
+    def packages = new ArrayList<PackageInstance>();
+    shUser.exec("urpmq ${name} | sed -e 's/|/\\n/g' | uniq").out.each {
+      packages.add(PackageInstance.getPackageInstance (this, it))
+    }
+    return packages
+  }
+
+  public List<PackageInstance> lookup(String name) {
+    shUser.exec("urpmq -i $name | sed -re \"s/(Size\\s+:\\s[0-9]+)\\s+/\\1\\n/\" ");
+    return (shUser.getRet() == 0) ? RPMPackage.parseMetaOutput(null, shUser.out, this) :
[];
+  }
+
+  public int install(PackageInstance pkg) {
+    shRoot.exec("urpmi --verbose --force --auto ${pkg.name}");
+    pkg.installMessages = shRoot.getOut().join('\n');
+    return shRoot.getRet();
+  }
+
+  public int remove(PackageInstance pkg) {
+    shRoot.exec("urpme --verbose --force --auto ${pkg.name}");
+    return shRoot.getRet();
+  }
+
+  public boolean isInstalled(PackageInstance pkg) {
+    shUser.exec("rpm -q ${pkg.name}")
+    return (shUser.getRet() == 0)
+  }
+}



Mime
View raw message