[pkg-java] r13807 - in trunk/yui-compressor/debian: . patches

Damien Raude-Morvan drazzib at alioth.debian.org
Mon Jun 20 20:28:42 UTC 2011


Author: drazzib
Date: 2011-06-20 20:28:41 +0000 (Mon, 20 Jun 2011)
New Revision: 13807

Added:
   trunk/yui-compressor/debian/patches/tokenstream.patch
Modified:
   trunk/yui-compressor/debian/changelog
   trunk/yui-compressor/debian/copyright
   trunk/yui-compressor/debian/fetch-upstream
   trunk/yui-compressor/debian/patches/series
   trunk/yui-compressor/debian/rules
Log:
* Re-add some part of embedded Rhino source code because
  some code as not been merged into Rhino 1.7R3 release.
  - d/copyright: Readd copyright notice.
  - d/fetch-upstream: Update script to download rhino source code.
  - d/patches/tokenstream.patch: Updated for Rhino 1.7R3.

Modified: trunk/yui-compressor/debian/changelog
===================================================================
--- trunk/yui-compressor/debian/changelog	2011-06-20 17:52:44 UTC (rev 13806)
+++ trunk/yui-compressor/debian/changelog	2011-06-20 20:28:41 UTC (rev 13807)
@@ -1,3 +1,13 @@
+yui-compressor (2.4.6+rhino17R3-1) UNRELEASED; urgency=low
+
+  * Re-add some part of embedded Rhino source code because
+    some code as not been merged into Rhino 1.7R3 release.
+    - d/copyright: Readd copyright notice.
+    - d/fetch-upstream: Update script to download rhino source code.
+    - d/patches/tokenstream.patch: Updated for Rhino 1.7R3.
+
+ -- Damien Raude-Morvan <drazzib at debian.org>  Mon, 20 Jun 2011 22:17:29 +0200
+
 yui-compressor (2.4.6+debian1-1) unstable; urgency=low
 
   * New source tarball without embedded Rhino source code:

Modified: trunk/yui-compressor/debian/copyright
===================================================================
--- trunk/yui-compressor/debian/copyright	2011-06-20 17:52:44 UTC (rev 13806)
+++ trunk/yui-compressor/debian/copyright	2011-06-20 20:28:41 UTC (rev 13807)
@@ -69,6 +69,43 @@
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+Files: src/org/*
+Copyright: Copyright 1997-1999, Netscape Communications Corporation.
+License: MPL-1.1 | GPL-2+
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (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.mozilla.org/MPL/
+ .
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ for the specific language governing rights and limitations under the
+ License.
+ .
+ The Original Code is Rhino code, released
+ May 6, 1999.
+ .
+ The Initial Developer of the Original Code is
+ Netscape Communications Corporation.
+ Portions created by the Initial Developer are Copyright (C) 1997-1999
+ the Initial Developer. All Rights Reserved.
+ .
+ Contributor(s):
+   Mike Ang
+   Igor Bukanov
+   Bob Jervis
+   Mike McCabe
+ .
+ Alternatively, the contents of this file may be used under the terms of
+ the GNU General Public License Version 2 or later (the "GPL"), in which
+ case the provisions of the GPL are applicable instead of those above. If
+ you wish to allow use of your version of this file only under the terms of
+ the GPL and not to allow others to use your version of this file under the
+ MPL, indicate your decision by deleting the provisions above and replacing
+ them with the notice and other provisions required by the GPL. If you do
+ not delete the provisions above, a recipient may use your version of this
+ file under either the MPL or the GPL.
+
 Files: debian/*
 Copyright: Copyright 2009, Dominik Smatana <dominik.smatana at gmail.com>
 Copyright: Copyright 2009-2011, Damien Raude-Morvan <drazzib at debian.org>

Modified: trunk/yui-compressor/debian/fetch-upstream
===================================================================
--- trunk/yui-compressor/debian/fetch-upstream	2011-06-20 17:52:44 UTC (rev 13806)
+++ trunk/yui-compressor/debian/fetch-upstream	2011-06-20 20:28:41 UTC (rev 13807)
@@ -2,12 +2,13 @@
 set -e
 
 echo $#
-if test "$#" != "2" ; then
-    echo "usage: $0 <upstream version number> <expected tarball version>"
+if test "$#" != "3" ; then
+    echo "usage: $0 <upstream version number> <expected tarball version> <rhino package version>"
     exit 1
 fi
 version="$1"
 orig_tarball_version="$2"
+rhino_version="$3"
 curdir="$PWD"
 
 # download
@@ -21,6 +22,14 @@
 rm -rf yuicompressor-$version/lib
 rm -rf yuicompressor-$version/src/org/mozilla/javascript/*
 
+# download rhino source
+apt-get source rhino=$rhino_version
+rhino_version="$(echo $rhino_version | cut -d - -f 1)"
+#cp rhino-$rhino_version/src/org/mozilla/javascript/Decompiler.java yuicompressor-$version/src/org/mozilla/javascript
+#cp rhino-$rhino_version/src/org/mozilla/javascript/Parser.java yuicompressor-$version/src/org/mozilla/javascript
+#cp rhino-$rhino_version/src/org/mozilla/javascript/Token.java yuicompressor-$version/src/org/mozilla/javascript
+cp rhino-$rhino_version/src/org/mozilla/javascript/TokenStream.java yuicompressor-$version/src/org/mozilla/javascript
+
 # repack
 mv yuicompressor-$version yui-compressor-$version
 tar czf yui-compressor_$orig_tarball_version.orig.tar.gz yui-compressor-$version

Modified: trunk/yui-compressor/debian/patches/series
===================================================================
--- trunk/yui-compressor/debian/patches/series	2011-06-20 17:52:44 UTC (rev 13806)
+++ trunk/yui-compressor/debian/patches/series	2011-06-20 20:28:41 UTC (rev 13807)
@@ -1,3 +1,4 @@
 rhino17R3.diff
 fix_testsuite.diff
 use-system-libraries.patch
+tokenstream.patch

Added: trunk/yui-compressor/debian/patches/tokenstream.patch
===================================================================
--- trunk/yui-compressor/debian/patches/tokenstream.patch	                        (rev 0)
+++ trunk/yui-compressor/debian/patches/tokenstream.patch	2011-06-20 20:28:41 UTC (rev 13807)
@@ -0,0 +1,176 @@
+YUI patch for the Rhino library's TokenStream.java
+--- a/src/org/mozilla/javascript/TokenStream.java
++++ b/src/org/mozilla/javascript/TokenStream.java
+@@ -541,7 +541,7 @@
+                 stringBufferTop = 0;
+ 
+                 c = getChar();
+-            strLoop: while (c != quoteChar) {
++                while (c != quoteChar) {
+                     if (c == '\n' || c == EOF_CHAR) {
+                         ungetChar(c);
+                         tokenEnd = cursor;
+@@ -551,89 +551,47 @@
+ 
+                     if (c == '\\') {
+                         // We've hit an escaped character
+-                        int escapeVal;
+ 
+                         c = getChar();
++
+                         switch (c) {
+-                        case 'b': c = '\b'; break;
+-                        case 'f': c = '\f'; break;
+-                        case 'n': c = '\n'; break;
+-                        case 'r': c = '\r'; break;
+-                        case 't': c = '\t'; break;
+-
+-                        // \v a late addition to the ECMA spec,
+-                        // it is not in Java, so use 0xb
+-                        case 'v': c = 0xb; break;
+-
+-                        case 'u':
+-                            // Get 4 hex digits; if the u escape is not
+-                            // followed by 4 hex digits, use 'u' + the
+-                            // literal character sequence that follows.
+-                            int escapeStart = stringBufferTop;
+-                            addToString('u');
+-                            escapeVal = 0;
+-                            for (int i = 0; i != 4; ++i) {
+-                                c = getChar();
+-                                escapeVal = Kit.xDigitToInt(c, escapeVal);
+-                                if (escapeVal < 0) {
+-                                    continue strLoop;
+-                                }
++
++                            case '\\': // backslash
++                            case 'b':  // backspace
++                            case 'f':  // form feed
++                            case 'n':  // line feed
++                            case 'r':  // carriage return
++                            case 't':  // horizontal tab
++                            case 'v':  // vertical tab
++                            case 'd':  // octal sequence
++                            case 'u':  // unicode sequence
++                            case 'x':  // hexadecimal sequence
++                                // Only keep the '\' character for those
++                                // characters that need to be escaped...
++                                // Don't escape quoting characters...
++                                addToString('\\');
+                                 addToString(c);
+-                            }
+-                            // prepare for replace of stored 'u' sequence
+-                            // by escape value
+-                            stringBufferTop = escapeStart;
+-                            c = escapeVal;
+-                            break;
+-                        case 'x':
+-                            // Get 2 hex digits, defaulting to 'x'+literal
+-                            // sequence, as above.
+-                            c = getChar();
+-                            escapeVal = Kit.xDigitToInt(c, 0);
+-                            if (escapeVal < 0) {
+-                                addToString('x');
+-                                continue strLoop;
+-                            } else {
+-                                int c1 = c;
+-                                c = getChar();
+-                                escapeVal = Kit.xDigitToInt(c, escapeVal);
+-                                if (escapeVal < 0) {
+-                                    addToString('x');
+-                                    addToString(c1);
+-                                    continue strLoop;
+-                                } else {
+-                                    // got 2 hex digits
+-                                    c = escapeVal;
+-                                }
+-                            }
+-                            break;
++                                break;
+ 
+-                        case '\n':
+-                            // Remove line terminator after escape to follow
+-                            // SpiderMonkey and C/C++
+-                            c = getChar();
+-                            continue strLoop;
+-
+-                        default:
+-                            if ('0' <= c && c < '8') {
+-                                int val = c - '0';
+-                                c = getChar();
+-                                if ('0' <= c && c < '8') {
+-                                    val = 8 * val + c - '0';
+-                                    c = getChar();
+-                                    if ('0' <= c && c < '8' && val <= 037) {
+-                                        // c is 3rd char of octal sequence only
+-                                        // if the resulting val <= 0377
+-                                        val = 8 * val + c - '0';
+-                                        c = getChar();
+-                                    }
++                            case '\n':
++                                // Remove line terminator after escape
++                                break;
++
++                            default:
++                                if (isDigit(c)) {
++                                    // Octal representation of a character.
++                                    // Preserve the escaping (see Y! bug #1637286)
++                                    addToString('\\');
+                                 }
+-                                ungetChar(c);
+-                                c = val;
+-                            }
++                                addToString(c);
++                                break;
+                         }
++
++                    } else {
++
++                        addToString(c);
+                     }
+-                    addToString(c);
++
+                     c = getChar();
+                 }
+ 
+@@ -784,6 +742,7 @@
+                 // is it a /* or /** comment?
+                 if (matchChar('*')) {
+                     boolean lookForSlash = false;
++                    StringBuffer sb = new StringBuffer();
+                     tokenBeg = cursor - 2;
+                     if (matchChar('*')) {
+                         lookForSlash = true;
+@@ -797,12 +756,30 @@
+                             tokenEnd = cursor - 1;
+                             parser.addError("msg.unterminated.comment");
+                             return Token.COMMENT;
+-                        } else if (c == '*') {
++                        }
++                        sb.append((char) c);
++                        if (c == '*') {
+                             lookForSlash = true;
+                         } else if (c == '/') {
+                             if (lookForSlash) {
+                                 tokenEnd = cursor;
+-                                return Token.COMMENT;
++                                sb.delete(sb.length()-2, sb.length());
++                                String s1 = sb.toString();
++                                String s2 = s1.trim();
++                                if (s1.startsWith("!")) {
++                                    // Remove the leading '!' ** EDIT actually don't remove it:
++                                    // http://yuilibrary.com/projects/yuicompressor/ticket/2528008
++                                    // this.string = s1.substring(1);
++                                    this.string = s1;
++                                    return Token.COMMENT;
++                                } else if (s2.startsWith("@cc_on") ||
++                                           s2.startsWith("@if")    ||
++                                           s2.startsWith("@elif")  ||
++                                           s2.startsWith("@else")  ||
++                                           s2.startsWith("@end")) {
++                                    this.string = s1;
++                                    return Token.COMMENT;
++                                }
+                             }
+                         } else {
+                             lookForSlash = false;

Modified: trunk/yui-compressor/debian/rules
===================================================================
--- trunk/yui-compressor/debian/rules	2011-06-20 17:52:44 UTC (rev 13806)
+++ trunk/yui-compressor/debian/rules	2011-06-20 20:28:41 UTC (rev 13807)
@@ -13,6 +13,7 @@
 
 LIBRARY=yui-compressor
 VERSION=2.4.6
+RHINO_VERSION=1.7R3-2
 
 install/yui-compressor::
 	# Launch tests
@@ -21,4 +22,4 @@
 	cp build/yuicompressor-${VERSION}.jar build/yui-compressor.jar
 
 get-orig-source:
-	debian/fetch-upstream ${VERSION} ${DEB_UPSTREAM_VERSION}
+	debian/fetch-upstream ${VERSION} ${DEB_UPSTREAM_VERSION} ${RHINO_VERSION}




More information about the pkg-java-commits mailing list