From: Jason van Zyl Date: Sun, 5 Nov 2006 05:28:54 +0000 (+0000) Subject: o another script i found lying around. i have no idea what it does or if its important X-Git-Tag: archiva-0.9-alpha-1~371 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a357494875fe820d4e0ebb3939ce7f7750d29a0b;p=archiva.git o another script i found lying around. i have no idea what it does or if its important git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@471370 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/maven-meeper/src/bin/shuffle_poms.sh b/maven-meeper/src/bin/shuffle_poms.sh new file mode 100644 index 000000000..6a5dd9455 --- /dev/null +++ b/maven-meeper/src/bin/shuffle_poms.sh @@ -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#.*##m' | sed 's#.*##m'` + groupId=`echo $contents | grep '' | sed 's#^.*##' | sed 's#.*$##'` + artifactId=`echo $contents | grep '' | sed 's#^.*##' | sed 's#.*$##'` + version=`echo $contents | grep '' | sed 's#^.*##' | sed 's#.*$##'` + parent=`cat $1 | tr '\n' ' ' | grep '' | sed 's#^.*##' | sed 's#.*$##'` + + if [ -z "$groupId" ]; then + groupId=`echo $parent | grep '' | sed 's#^.*##' | sed 's#.*$##'` + fi + + if [ -z "$artifactId" ]; then + artifactId=`echo $parent | grep '' | sed 's#^.*##' | sed 's#.*$##'` + fi + + if [ -z "$version" ]; then + version=`echo $parent | grep '' | sed 's#^.*##' | sed 's#.*$##'` + 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 'pom' | while read pom +do + processPom $pom +done