You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by neykov <gi...@git.apache.org> on 2014/10/07 12:35:37 UTC

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

GitHub user neykov opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/222

    Fix Windows EOL issues

     * Instruct git to do EOL normalization on commit/checkout
     * Work around archetype:generate forcing OS line endings - treat shell scripts as binary and resolve variables at runtime.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/incubator-brooklyn fix/windows-eol

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/222.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #222
    
----
commit 0d775db8495f0485963a625316c894d17b4576fa
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2014-10-06T18:46:39Z

    Instruct git to do eol normalization on text files (in case core.autocrlf is not set in git config)

commit 1e02b3683d788f5b171d1ce2d6a88709460211a1
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2014-10-07T08:59:28Z

    Work around for archetype:generate forcing OS line endings.
    
    When processing template resources (filtered="true") the archetype plugin forces all content to use the current OS specific line endings. Treat shell scripts as binary files so their line endings are preserved, saving any variables in a helper text file.
    
    Shell scripts don't work when they contain Windows style line breaks, so it is important to preserve the original line breaks even when building on Windows.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#discussion_r18557709
  
    --- Diff: usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh ---
    @@ -18,6 +18,10 @@
     # under the License.
     #
     
    +# Handle Windows line breaks on UNIX. You can replace the variables directly with the values from project.conf
    +JAVA_PACKAGE=`awk -F '=' '/JAVA_PACKAGE/ {print $2}' conf/project.conf | tr -d '\r\n'`
    --- End diff --
    
    hideous to have this in an archetypal script.  is there not a simpler way to do the replacements?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#issuecomment-58165888
  
    Tested by 
      * building the archetype project
      * generating a new project based on the archetype
      * building and assembling the resulting project
      * copying the .tar.gz file to Linux and extracting
      * launching the start.sh shell script
    
    Not tested on MacOS, either ask me for the tar.gz file or before executing start.sh run unix2dos on conf/project.conf



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/222


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#issuecomment-58559372
  
    Take 2 on the fix. Much more happy with the result.
    
    Now the variable replacement in the start.sh script takes place at assembly time (of the generated project). For this purpose the name of the Main file is moved as a property in the pom file.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#issuecomment-59192978
  
    Thanks @neykov - I'll take your word for it that this now passes on windows.
    One minor comment about `project.entry` that you can look at later. It doesn't need to block this PR.
    Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#discussion_r18566215
  
    --- Diff: usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh ---
    @@ -18,6 +18,10 @@
     # under the License.
     #
     
    +# Handle Windows line breaks on UNIX. You can replace the variables directly with the values from project.conf
    +JAVA_PACKAGE=`awk -F '=' '/JAVA_PACKAGE/ {print $2}' conf/project.conf | tr -d '\r\n'`
    --- End diff --
    
    I agree it's not elegant but at least works.
    
    The possible solutions are:
      * Copy the shell script as is (treat as binary) and resolve needed options at runtime (current approach)
      * Let the archetype plugin replace the variables and strip lines at build time
      * Copy the shell script as is (treat as binary) and replace variables at build time.
    
    I think the last item will result in more clean solution, I can try and see what happens. It wasn't obvious when choosing the runtime approach that the variable extraction would be so complex. 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#issuecomment-58282748
  
    if there's a simpler way to solve the line break issue in archetype i'd really like to find it.
    
    but if that's going to be really hard then let's open a jira issue and merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix Windows EOL issues

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/222#discussion_r18887978
  
    --- Diff: usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh ---
    @@ -29,12 +29,12 @@ if [ ! -x "$JAVA" ] ; then
       exit 1
     fi
     
    -if [[ ! `ls brooklyn-sample-*.jar 2> /dev/null` ]] ; then
    +if [[ ! `ls ${project.artifactId}-*.jar 2> /dev/null` ]] ; then
       echo Command must be run from the directory where the JAR is installed.
       exit 4
     fi
     
     $JAVA -Xms256m -Xmx1024m -XX:MaxPermSize=1024m \
         -classpath "conf/:patch/*:*:lib/*" \
    -    com.acme.sample.brooklyn.SampleMain \
    +    ${project.entry} \
    --- End diff --
    
    Is there a better name than `project.entry` for this? `project.mainClass` perhaps?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---