You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/04/23 04:49:51 UTC

svn commit: r164316 - /maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh

Author: brett
Date: Fri Apr 22 19:49:50 2005
New Revision: 164316

URL: http://svn.apache.org/viewcvs?rev=164316&view=rev
Log:
add a script to shuffle poms into new/old layout

Added:
    maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh   (with props)

Added: maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh?rev=164316&view=auto
==============================================================================
--- maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh (added)
+++ maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh Fri Apr 22 19:49:50 2005
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+copyFile()
+{
+  echo Copying:
+  echo "    $1"
+  echo "      --> $2"
+  cp $1 $2
+
+  if [ -f $1.sha1 ]; then
+    echo "  (with sha1)"
+    cp $1.sha1 $2.sha1
+  fi
+
+  if [ -f $1.md5 ]; then
+    echo "  (with md5)"
+    cp $1.md5 $2.md5
+  fi
+}
+
+processPom()
+{
+  echo processing POM: $1
+  contents=`cat $1 | tr '\n' ' ' | sed 's#<parent>.*</parent>##m' | sed 's#<dependencies>.*</dependencies>##m'`
+  groupId=`echo $contents | grep '<groupId>' | sed 's#^.*<groupId>##' | sed 's#</groupId>.*$##'`
+  artifactId=`echo $contents | grep '<artifactId>' | sed 's#^.*<artifactId>##' | sed 's#</artifactId>.*$##'`
+  version=`echo $contents | grep '<version>' | sed 's#^.*<version>##' | sed 's#</version>.*$##'`
+  parent=`cat $1 | tr '\n' ' ' | grep '<parent>' | sed 's#^.*<parent>##' | sed 's#</parent>.*$##'`
+
+  if [ -z "$groupId" ]; then
+    groupId=`echo $parent | grep '<groupId>' | sed 's#^.*<groupId>##' | sed 's#</groupId>.*$##'`
+  fi
+
+  if [ -z "$artifactId" ]; then
+    artifactId=`echo $parent | grep '<artifactId>' | sed 's#^.*<artifactId>##' | sed 's#</artifactId>.*$##'`
+  fi
+
+  if [ -z "$version" ]; then
+    version=`echo $parent | grep '<version>' | sed 's#^.*<version>##' | sed 's#</version>.*$##'`
+  fi
+
+  if [ -z "$version" ]; then
+    echo no version
+    exit 1
+  fi
+
+  if [ -z "$artifactId" ]; then
+    echo no artifactId
+    exit 1
+  fi
+
+  if [ -z "$groupId" ]; then
+    echo no groupId
+    exit 1
+  fi
+
+  echo $groupId : $artifactId : $version
+
+  slashedGroupId=`echo $groupId | sed 's#\.#/#g'`
+  tsVersion=`echo $1 | sed "s#^.*/$artifactId-##" | sed 's#.pom$##'`
+
+  oldPath=$slashedGroupId/$artifactId/$version/$artifactId-$tsVersion.pom
+  newPath=$slashedGroupId/$artifactId-$tsVersion.pom
+  oldTxtVersion=$slashedGroupId/$artifactId/$version/$artifactId-$version.version.txt
+  newTxtVersion=$slashedGroupId/$artifactId-$version.version.txt
+
+  if [ ! -f $oldPath ]; then
+    copyFile $1 $oldPath
+  fi
+
+  if [ ! -f $newPath ]; then
+    copyFile $1 $newPath
+  fi
+
+  if [ -f $newTxtVersion ]; then
+    if [ ! -f $oldTxtVersion ]; then
+      copyFile $newTxtVersion $oldTxtVersion
+    fi
+  fi
+
+  if [ -f $oldTxtVersion ]; then
+    if [ ! -f $newTxtVersion ]; then
+      copyFile $oldTxtVersion $newTxtVersion
+    fi
+  fi
+
+  echo ==================================================
+}
+
+find . -mtime -1 -name '*.pom' | xargs grep -l '<packaging>pom</packaging>' | while read pom
+do
+  processPom $pom
+done

Propchange: maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/components/trunk/maven-meeper/src/bin/shuffle_poms.sh
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org