Hi, the attached patch fixes *some* of the issues.

- sqlparse 0.2 changed is_whitespace into a property
- token_next now returns a (idx, token) tuple instead of just the token

However I am now getting these errors:

# journalctl _SYSTEMD_UNIT=calendarserver.service  | tail
Jan 03 17:25:31 pdeb1 calendarserver[15406]:     t = 
tableFromCreateStatement(schema, stmt)
Jan 03 17:25:31 pdeb1 calendarserver[15406]:   File 
"/usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py", line 
89, in tableFromCreateStatement
Jan 03 17:25:31 pdeb1 calendarserver[15406]:     cp.parse()
Jan 03 17:25:31 pdeb1 calendarserver[15406]:   File 
"/usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py", line 
335, in parse
Jan 03 17:25:31 pdeb1 calendarserver[15406]:     while self.nextColumn():
Jan 03 17:25:31 pdeb1 calendarserver[15406]:   File 
"/usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py", line 
349, in nextColumn
Jan 03 17:25:31 pdeb1 calendarserver[15406]:     return 
self.parseConstraint(maybeIdent)
Jan 03 17:25:31 pdeb1 calendarserver[15406]:   File 
"/usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py", line 
422, in parseConstraint
Jan 03 17:25:31 pdeb1 calendarserver[15406]:     raise 
ViolatedExpectation("PRIMARY or UNIQUE", constraintType)
Jan 03 17:25:31 pdeb1 calendarserver[15406]: 
twext.enterprise.dal.parseschema.ViolatedExpectation: Expected 'PRIMARY or 
UNIQUE' got unique(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID, 
CALENDAR_NAME, RESOURCE_NAME)    -- implicit index

X

On Sun, 18 Dec 2016 12:02:32 +0100 P'tit g <ptit-g-...@orange.fr> wrote:
> Currently I downgraded python-sqlparse in 0.1.18-1.
> 
> Maybe more recent version of calendarserver is compatible with
> python-sqlparse 0.2.2-1, but I don't know.
> 
> I saw this recent commit on git about sqlparse 0.2.0 :
> https://github.com/apple/ccs-calendarserver/commit/60a169dc824433002a48c2331e1df7e5850e91d5
> 
> But in the last release (9.0) the requirement is sqlparse 0.1.18 :
> https://github.com/apple/ccs-calendarserver/blob/CalendarServer-9.0/requirements-cs.txt
> 
> 
> 
> Le 18/12/2016 à 06:12, Rahul Amaram a écrit :
> > Will look into this before stretch "soft" freeze. Are you aware of the
> > fix for this?
> > 
> > Thanks,
> > Rahul.
> > 
> > On Friday 16 December 2016 10:39 PM, P'tit g wrote:
> >> Package: calendarserver
> >> Version: 7.0+dfsg-2
> >> Severity: grave
> >> Justification: renders package unusable
> >>
> >> Dear Maintainer,
> >>
> >> Regression in python-sqlparse 0.2.2-1 causes calendarserver fail at
> >> startup
> >>
> >>
> >> -- System Information:
> >> Debian Release: stretch/sid
> >>    APT prefers testing
> >>    APT policy: (990, 'testing'), (500, 'stable'), (100, 'unstable'),
> >> (10, 'experimental')
> >> Architecture: amd64 (x86_64)
> >> Foreign Architectures: i386
> >>
> >> Kernel: Linux 4.8.0-1-amd64 (SMP w/6 CPU cores)
> >> Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
> >> Shell: /bin/sh linked to /bin/dash
> >> Init: systemd (via /run/systemd/system)
> >>
> >> Versions of packages calendarserver depends on:
> >> ii  adduser                  3.115
> >> ii  memcached                1.4.28-1
> >> ii  python-crypto            2.6.1-6+b1
> >> ii  python-dateutil          2.5.3-2
> >> ii  python-kerberos          1.1.5-2+b2
> >> ii  python-openssl           16.2.0-1
> >> ii  python-pg8000            1.10.6-1
> >> ii  python-psutil            4.3.1-1
> >> ii  python-pycalendar        2.1~svn15020-1
> >> ii  python-service-identity  16.0.0-2
> >> ii  python-setproctitle      1.1.10-1
> >> pn  python-sqlparse          <none>
> >> ii  python-twext             0.1.b2.dev15059-1
> >> ii  python-twisted           16.6.0-1

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
--- /usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py.orig	2017-01-03 17:30:39.270029351 +0100
+++ /usr/lib/python2.7/dist-packages/twext/enterprise/dal/parseschema.py	2017-01-03 17:30:00.743991413 +0100
@@ -146,7 +146,7 @@
             continue
 
         if stmt.get_type() == "CREATE":
-            createType = stmt.token_next(1, True).value.upper()
+            createType = stmt.token_next(1, True)[1].value.upper()
 
             if createType == u"TABLE":
                 t = tableFromCreateStatement(schema, stmt)
@@ -155,7 +155,7 @@
             elif createType == u"SEQUENCE":
                 Sequence(
                     schema,
-                    stmt.token_next(2, True).get_name().encode("utf-8")
+                    stmt.token_next(2, True)[1].get_name().encode("utf-8")
                 )
 
             elif createType in (u"INDEX", u"UNIQUE"):
@@ -248,7 +248,7 @@
             schema.tableNamed(tableName).insertSchemaRow(rowData, columns=columns)
 
         elif stmt.get_type() == "CREATE OR REPLACE":
-            createType = stmt.token_next(1, True).value.upper()
+            createType = stmt.token_next(1, True)[1].value.upper()
 
             if createType == u"FUNCTION":
                 parseFunction(schema, stmt)
@@ -265,7 +265,7 @@
     A FUNCTION may or may not have an argument list, so we need to account for
     both possibilities.
     """
-    fn_name = stmt.token_next(2, True)
+    fn_name = stmt.token_next(2, True)[1]
     if isinstance(fn_name, Function):
         [fn_name, _ignore_args] = iterSignificant(fn_name)
         fn_name = fn_name.get_name()
@@ -731,7 +731,7 @@
     not whitespace.
     """
     # comment has None is_whitespace() result.  intentional?
-    return (not isinstance(token, Comment) and not token.is_whitespace())
+    return (not isinstance(token, Comment) and not token.is_whitespace)
 
 
 

Reply via email to