More parcel updates.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/42052a85 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/42052a85 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/42052a85 Branch: refs/heads/master Commit: 42052a8582c94865f72980d91e9d3a75ee967636 Parents: de8a98b Author: Aaron McCurry <amccu...@gmail.com> Authored: Wed Jul 1 15:29:05 2015 -0400 Committer: Aaron McCurry <amccu...@gmail.com> Committed: Wed Jul 1 15:29:05 2015 -0400 ---------------------------------------------------------------------- .../org/apache/blur/doc/BlurPropertyParser.java | 3 - .../apache/blur/doc/CreateCSDDescriptor.java | 17 ++++-- .../org/apache/blur/doc/ParcelJsonTemplate.java | 59 ++++++++++++++++++++ distribution/pom.xml | 37 ++++++++---- distribution/run_parcel_server.sh | 57 +++++++++++++++++++ .../cdh/csd/descriptor/service.sdl.template | 18 +----- .../src/assemble/cdh/parcel/meta/parcel.json | 58 ------------------- .../cdh/parcel/meta/parcel.json.template | 42 ++++++++++++++ distribution/src/assemble/parcel-hadoop2.xml | 6 ++ pom.xml | 2 + 10 files changed, 206 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/blur-util/src/main/java/org/apache/blur/doc/BlurPropertyParser.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/doc/BlurPropertyParser.java b/blur-util/src/main/java/org/apache/blur/doc/BlurPropertyParser.java index 6973aea..f386c2c 100644 --- a/blur-util/src/main/java/org/apache/blur/doc/BlurPropertyParser.java +++ b/blur-util/src/main/java/org/apache/blur/doc/BlurPropertyParser.java @@ -17,12 +17,9 @@ package org.apache.blur.doc; import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.PrintWriter; import java.util.HashMap; import java.util.List; import java.util.Map; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/blur-util/src/main/java/org/apache/blur/doc/CreateCSDDescriptor.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/doc/CreateCSDDescriptor.java b/blur-util/src/main/java/org/apache/blur/doc/CreateCSDDescriptor.java index 2804ed8..83d31d0 100644 --- a/blur-util/src/main/java/org/apache/blur/doc/CreateCSDDescriptor.java +++ b/blur-util/src/main/java/org/apache/blur/doc/CreateCSDDescriptor.java @@ -30,6 +30,8 @@ import org.apache.blur.doc.BlurPropertyParser.BlurProp; public class CreateCSDDescriptor { + private static final String BLUR_VERSION = "|||BLUR-VERSION|||"; + public static void main(String[] args) throws IOException { BlurPropertyParser parser = new BlurPropertyParser(); Map<String, List<BlurProp>> props = parser.parse(); @@ -53,16 +55,20 @@ public class CreateCSDDescriptor { buffer.append(formatter.format(p)); first = false; } - } String source = args[0]; String dest = args[1]; + String blurVersion = args[2]; - replaceValuesInFile(source, dest, map); + replaceValuesInFile(source, dest, map, formatVersion(blurVersion)); } - private static void replaceValuesInFile(String s, String o, Map<String, StringBuffer> replacements) + public static String formatVersion(String blurVersion) { + return blurVersion.replace("-", "."); + } + + private static void replaceValuesInFile(String s, String o, Map<String, StringBuffer> replacements, String blurVersion) throws IOException { File source = new File(s); @@ -75,8 +81,9 @@ public class CreateCSDDescriptor { String line; while ((line = reader.readLine()) != null) { StringBuffer newData = replacements.get(line.trim()); - - if (newData != null) { + if (line.contains(BLUR_VERSION)) { + writer.println(line.replace(BLUR_VERSION, blurVersion)); + } else if (newData != null) { writer.println(newData.toString()); } else { writer.println(line); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/blur-util/src/main/java/org/apache/blur/doc/ParcelJsonTemplate.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/doc/ParcelJsonTemplate.java b/blur-util/src/main/java/org/apache/blur/doc/ParcelJsonTemplate.java new file mode 100644 index 0000000..f165963 --- /dev/null +++ b/blur-util/src/main/java/org/apache/blur/doc/ParcelJsonTemplate.java @@ -0,0 +1,59 @@ +/** + * 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.blur.doc; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; + +public class ParcelJsonTemplate { + + private static final String BLUR_VERSION = "|||BLUR-VERSION|||"; + + public static void main(String[] args) throws IOException { + + String source = args[0]; + String dest = args[1]; + String blurVersion = args[2]; + + replaceValuesInFile(source, dest, blurVersion); + } + + private static void replaceValuesInFile(String s, String o, String blurVersion) throws IOException { + File source = new File(s); + File output = new File(o); + System.out.println("Source[" + source.getAbsolutePath() + "]"); + System.out.println("Output[" + output.getAbsolutePath() + "]"); + PrintWriter writer = new PrintWriter(output); + + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(source))); + String line; + while ((line = reader.readLine()) != null) { + if (line.contains(BLUR_VERSION)) { + writer.println(line.replace(BLUR_VERSION, blurVersion)); + } else { + writer.println(line); + } + } + writer.close(); + reader.close(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/pom.xml b/distribution/pom.xml index 0bb9e5a..19be49e 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -58,7 +58,8 @@ under the License. </dependencies> <build> - <plugins> <plugin> + <plugins> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> @@ -69,15 +70,31 @@ under the License. <goals> <goal>java</goal> </goals> + <configuration> + <mainClass>org.apache.blur.doc.CreateCSDDescriptor</mainClass> + <arguments> + <argument>${project.build.scriptSourceDirectory}/../../assemble/cdh/csd/descriptor/service.sdl.template</argument> + <argument>${project.build.directory}/service.sdl</argument> + <argument>${project.version}</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>create-parcel-json</id> + <phase>package</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.apache.blur.doc.ParcelJsonTemplate</mainClass> + <arguments> + <argument>${project.build.scriptSourceDirectory}/../../assemble/cdh/parcel/meta/parcel.json.template</argument> + <argument>${project.build.directory}/parcel.json</argument> + <argument>${project.version}</argument> + </arguments> + </configuration> </execution> </executions> - <configuration> - <mainClass>org.apache.blur.doc.CreateCSDDescriptor</mainClass> - <arguments> - <argument>${project.build.scriptSourceDirectory}/../../assemble/cdh/csd/descriptor/service.sdl.template</argument> - <argument>${project.build.directory}/service.sdl</argument> - </arguments> - </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> @@ -117,7 +134,7 @@ under the License. <descriptors> <descriptor>${parcel.assembly.file}</descriptor> </descriptors> - <finalName>blur-${project.version}-el6.parcel</finalName> + <finalName>blur-${project.version}.parcel</finalName> <appendAssemblyId>false</appendAssemblyId> <ignoreDirFormatExtensions>false</ignoreDirFormatExtensions> </configuration> @@ -132,7 +149,7 @@ under the License. <descriptors> <descriptor>${csd.assembly.file}</descriptor> </descriptors> - <finalName>BLUR-0.2.4</finalName> + <finalName>BLUR-${project.version}</finalName> <appendAssemblyId>false</appendAssemblyId> </configuration> </execution> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/run_parcel_server.sh ---------------------------------------------------------------------- diff --git a/distribution/run_parcel_server.sh b/distribution/run_parcel_server.sh new file mode 100755 index 0000000..a5fb287 --- /dev/null +++ b/distribution/run_parcel_server.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# 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. + +PROJECT_DIR=`dirname "$0"` +PROJECT_DIR=`cd "$PROJECT_DIR"; pwd` + +BLUR_VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -Dhadoop2 | grep -Ev '(^\[|Download\w+:)'` +TARGET="${PROJECT_DIR}/target" + +LAST_UPDATED_SEC=`date +%s` +LAST_UPDATED="${LAST_UPDATED_SEC}0000" + +PARCEL="${TARGET}/blur-${BLUR_VERSION}.parcel.tar.gz" +PARCEL_SHA="${PARCEL}.sha" +BLUR_CSD="${TARGET}/BLUR-${BLUR_VERSION}.jar" + +HTTP_DIR="${TARGET}/http" +MANIFEST="${HTTP_DIR}/manifest.json" + +rm -r $HTTP_DIR +mkdir $HTTP_DIR + +shasum $PARCEL | awk '{print $1}' > $PARCEL_SHA +HASH=`cat $PARCEL_SHA` +echo "{\"lastUpdated\":${LAST_UPDATED},\"parcels\": [" > $MANIFEST +for DISTRO in el5 el6 sles11 lucid precise trusty squeeze wheezy +do + if [ $DISTRO != "el5" ] ; then + echo "," >> $MANIFEST + fi + DISTRO_PARCEL="blur-${BLUR_VERSION}-${DISTRO}.parcel" + DISTRO_PARCEL_SHA="blur-${BLUR_VERSION}-${DISTRO}.parcel.sha" + ln $PARCEL "${HTTP_DIR}/${DISTRO_PARCEL}" + ln $PARCEL_SHA "${HTTP_DIR}/${DISTRO_PARCEL_SHA}" + echo "{\"parcelName\":\"${DISTRO_PARCEL}\",\"components\": [{\"name\" : \"blur\",\"version\" : \"${BLUR_VERSION}\",\"pkg_version\": \"${BLUR_VERSION}\"}],\"hash\":\"${HASH}\"}" >> $MANIFEST +done +echo "]}" >> $MANIFEST +CSD_BLUR_VERSION=`echo ${BLUR_VERSION} | tr - .` +ln $BLUR_CSD "${HTTP_DIR}/BLUR-${CSD_BLUR_VERSION}.jar" +cd ${HTTP_DIR} +python -m SimpleHTTPServer + + http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/src/assemble/cdh/csd/descriptor/service.sdl.template ---------------------------------------------------------------------- diff --git a/distribution/src/assemble/cdh/csd/descriptor/service.sdl.template b/distribution/src/assemble/cdh/csd/descriptor/service.sdl.template index 3f9f6dc..a8f6b01 100644 --- a/distribution/src/assemble/cdh/csd/descriptor/service.sdl.template +++ b/distribution/src/assemble/cdh/csd/descriptor/service.sdl.template @@ -1,24 +1,8 @@ -/** - * 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. - */ { "name" : "BLUR", "label" : "Blur", "description": "Apache Blur Search Service", - "version" : "0.2.4", + "version" : "|||BLUR-VERSION|||", "runAs" : { "user" : "blur", "group" : "blur" http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/src/assemble/cdh/parcel/meta/parcel.json ---------------------------------------------------------------------- diff --git a/distribution/src/assemble/cdh/parcel/meta/parcel.json b/distribution/src/assemble/cdh/parcel/meta/parcel.json deleted file mode 100644 index f0145e7..0000000 --- a/distribution/src/assemble/cdh/parcel/meta/parcel.json +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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. - */ -{ - "schema_version": 1, - "name": "blur", - "version" : "hadoop2-2.5.0-cdh5.2.0-0.2.4-incubating-SNAPSHOT", - "setActiveSymlink": false, - - "depends": "", - "replaces":"blur", - "conflicts":"", - - "provides": [ - "blurcontroller", - "blurshard", - "blurconsole" - ], - - "scripts": { - "defines":"blur_parcel_env.sh" - }, - - "components": [ - { - "name" : "blur", - "version" : "0.2.4", - "pkg_version": "0.2.4" - } - ], - - "packages" : [], - - "users": { - "blur": { - "longname" : "Blur", - "home" : "/var/lib/blur", - "shell" : "/bin/bash", - "extra_groups": [] - - } - }, - "groups": [] - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/src/assemble/cdh/parcel/meta/parcel.json.template ---------------------------------------------------------------------- diff --git a/distribution/src/assemble/cdh/parcel/meta/parcel.json.template b/distribution/src/assemble/cdh/parcel/meta/parcel.json.template new file mode 100644 index 0000000..324d9f8 --- /dev/null +++ b/distribution/src/assemble/cdh/parcel/meta/parcel.json.template @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "name": "blur", + "version" : "|||BLUR-VERSION|||", + "setActiveSymlink": false, + + "depends": "", + "replaces":"blur", + "conflicts":"", + + "provides": [ + "blurcontroller", + "blurshard", + "blurconsole" + ], + + "scripts": { + "defines":"blur_parcel_env.sh" + }, + + "components": [ + { + "name" : "blur", + "version" : "|||BLUR-VERSION|||", + "pkg_version": "|||BLUR-VERSION|||" + } + ], + + "packages" : [], + + "users": { + "blur": { + "longname" : "Blur", + "home" : "/var/lib/blur", + "shell" : "/bin/bash", + "extra_groups": [] + + } + }, + "groups": [] + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/distribution/src/assemble/parcel-hadoop2.xml ---------------------------------------------------------------------- diff --git a/distribution/src/assemble/parcel-hadoop2.xml b/distribution/src/assemble/parcel-hadoop2.xml index 4eeacb4..276af73 100644 --- a/distribution/src/assemble/parcel-hadoop2.xml +++ b/distribution/src/assemble/parcel-hadoop2.xml @@ -74,6 +74,7 @@ under the License. <outputDirectory>blur-${project.version}/meta</outputDirectory> <excludes> <exclude>**/.empty</exclude> + <exclude>**/parcel.json.template</exclude> </excludes> </fileSet> <fileSet> @@ -88,6 +89,11 @@ under the License. <files> <file> + <source>${project.build.directory}/parcel.json</source> + <outputDirectory>blur-${project.version}/meta</outputDirectory> + <destName>parcel.json</destName> + </file> + <file> <source>${project.build.scriptSourceDirectory}/../resources-hadoop2/NOTICE-bin.txt</source> <outputDirectory>blur-${project.version}</outputDirectory> <destName>NOTICE</destName> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/42052a85/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 622f873..e83f968 100644 --- a/pom.xml +++ b/pom.xml @@ -391,6 +391,8 @@ under the License. <exclude>**/.empty</exclude> <exclude>**/test/**/prop.doc.base.html</exclude> + <exclude>**/parcel.json.template</exclude> + <exclude>**/service.sdl.template</exclude> </excludes> </configuration> <executions>