Return-Path: X-Original-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9B8247E0A for ; Wed, 12 Oct 2011 06:56:16 +0000 (UTC) Received: (qmail 67859 invoked by uid 500); 12 Oct 2011 06:56:16 -0000 Delivered-To: apmail-incubator-bigtop-commits-archive@incubator.apache.org Received: (qmail 67805 invoked by uid 500); 12 Oct 2011 06:56:14 -0000 Mailing-List: contact bigtop-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bigtop-dev@incubator.apache.org Delivered-To: mailing list bigtop-commits@incubator.apache.org Received: (qmail 67788 invoked by uid 99); 12 Oct 2011 06:56:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2011 06:56:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2011 06:56:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 98B692388A02; Wed, 12 Oct 2011 06:55:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: bigtop-commits@incubator.apache.org From: bmahe@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111012065549.98B692388A02@eris.apache.org> 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 search(String name) { + def packages = new ArrayList(); + shUser.exec("urpmq ${name} | sed -e 's/|/\\n/g' | uniq").out.each { + packages.add(PackageInstance.getPackageInstance (this, it)) + } + return packages + } + + public List 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) + } +}