archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r471370 - /maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh
Date Sun, 05 Nov 2006 05:28:55 GMT
Author: jvanzyl
Date: Sat Nov  4 21:28:54 2006
New Revision: 471370

URL: http://svn.apache.org/viewvc?view=rev&rev=471370
Log:
o another script i found lying around. i have no idea what it does or if its important

Added:
    maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh

Added: maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh?view=auto&rev=471370
==============================================================================
--- maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh (added)
+++ maven/archiva/trunk/maven-meeper/src/bin/shuffle_poms.sh Sat Nov  4 21:28:54 2006
@@ -0,0 +1,98 @@
+#!/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()
+{
+  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
+
+  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
+
+  banner=0
+
+  if [ ! -f $oldPath ]; then
+    copyFile $1 $oldPath
+    banner=1
+  fi
+
+  if [ ! -f $newPath ]; then
+    copyFile $1 $newPath
+    banner=1
+  fi
+
+  if [ -f $newTxtVersion ]; then
+    if [ ! -f $oldTxtVersion ]; then
+      copyFile $newTxtVersion $oldTxtVersion
+      banner=1
+    fi
+  fi
+
+  if [ -f $oldTxtVersion ]; then
+    if [ ! -f $newTxtVersion ]; then
+      copyFile $oldTxtVersion $newTxtVersion
+      banner=1
+    fi
+  fi
+
+  if [ $banner -eq 1 ]; then
+    echo ==================================================
+  fi
+}
+
+find . -mtime -1 -name '*.pom' | xargs grep -l '<packaging>pom</packaging>' |
while read pom
+do
+  processPom $pom
+done



Mime
View raw message