Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/318#discussion_r217152555
  
    --- Diff: src/madpack/create_changelist.py ---
    @@ -0,0 +1,229 @@
    +#!/usr/bin/python
    +# 
------------------------------------------------------------------------------
    +# 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.
    +# 
------------------------------------------------------------------------------
    +
    +# Create changelist for any two branches/tags
    +
    +# Prequisites:
    +# The old version has to be installed in the "madlib_old_vers" schema
    +# The new version has to be installed in the "madlib" (default) schema
    +# Two branches/tags must exist locally (run 'git fetch' to ensure you have 
the latest version)
    +# The current branch does not matter
    +
    +# Usage (must be executed in the src/madpack directory):
    +# python create_changelist.py <database name> <old version branch> <new 
version branch> <changelist filename>
    +
    +# Example (should be equivalent to changelist_1.13_1.14.yaml):
    +# python create_changelist.py madlib rel/v1.13 rel/v1.14 chtest1.yaml
    +
    +import sys
    +import os
    +
    +database = sys.argv[1]
    +old_vers = sys.argv[2]
    +new_vers = sys.argv[3]
    +ch_filename = sys.argv[4]
    +
    +if os.path.exists(ch_filename):
    +    print "{0} already exists".format(ch_filename)
    +    raise SystemExit
    +
    +err1 = os.system("""psql {0} -l > /dev/null""".format(database))
    +if err1 != 0:
    +    print "Database {0} does not exist".format(old_vers)
    +    raise SystemExit
    +
    +err1 = os.system("""psql {0} -c "select madlib_old_vers.version()" > 
/dev/null
    +                 """.format(database))
    +if err1 != 0:
    +    print "Schema {0} does not exist".format(old_vers)
    +    raise SystemExit
    +
    +err1 = os.system("""psql {0} -c "select madlib.version()" > /dev/null
    +                 """.format(database))
    +if err1 != 0:
    +    print "Schema {0} does not exist".format(new_vers)
    +    raise SystemExit
    +
    --- End diff --
    
    Can we add another error check to ensure that the 
`madlib_old_vers.schema()` is the same as `old_vers branch/tag`? This does 
assume that the branch/tag will always be a release tag.


---

Reply via email to