~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to runlaunchpad.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2005-06-06 14:06:28 UTC
  • mfrom: (unknown (missing))
  • Revision ID: Arch-1:rocketfuel@canonical.com%launchpad--devel--0--patch-1801
New config machinery, database helpers and oddsnsods required for staging
Patches applied:

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-32
   Merge from stuart.bishop@canonical.com/launchpad--staging--0

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-33
   Restore launchpad.conf

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-34
   Merge from stuart.bishop@canonical.com/launchpad--staging--0

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-35
   Merge from stuart.bishop@canonical.com/launchpad--staging--0

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-36
   Add index to match production database

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-37
   Push DB patch to production

 * stuart.bishop@canonical.com/launchpad--devel--2--patch-38
   Review feedback

 * stuart.bishop@canonical.com/launchpad--staging--0--base-0
   tag of stuart.bishop@canonical.com/launchpad--devel--2--patch-29

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-1
   Don't build pygettextpo until it is available on asuka

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-2
   Merge from stuart.bishop@canonical.com/launchpad--devel--2

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-3
   Initial staging config

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-4
   Set ports

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-5
   Turn pygettext back on

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-6
   Propagate LPCONFIG

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-7
   Trash <canonical staging> and just use <canonical default>

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-8
   Use localhost for librarian for time being - Librarian config needs work

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-9
   Pass hostname and username on command like of database tools

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-10
   Common script verbosity helpers and wire up database scripts with it

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-11
   Add help and improve logger interface

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-12
   Simplify usage for the trivial case

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-13
   Common database connection details command line parsing

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-14
   Database schema upgrader

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-15
   Make upgrade invokoe trusted.sql and comments.sql

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-16
   Make upgrade invokoe trusted.sql and comments.sql

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-17
   Staging config works

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-18
   Config

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-19
   Merge from Rocketfuel

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-20
   Nuke launchpad.pid using an atexit handler

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-21
   Refactor configuration selection machinery

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-22
   Silence build noise unless there is a problem

 * stuart.bishop@canonical.com/launchpad--staging--0--patch-23
   Add missing script

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import subprocess
32
32
import time
33
33
from zope.app.server.main import main
 
34
from configs import generate_overrides
34
35
 
35
36
basepath = filter(None, sys.path)
36
37
 
94
95
                    )
95
96
    atexit.register(stop_librarian)
96
97
 
 
98
 
 
99
def make_pidfile():
 
100
    """Create a pidfile so we can be killed easily.
 
101
 
 
102
    Registers an atexit callback to remove the file on termination.
 
103
    """
 
104
    pidfile = os.path.join(os.path.dirname(__file__), 'launchpad.pid')
 
105
    def nukepidfile():
 
106
        if os.path.exists(pidfile):
 
107
            os.unlink(pidfile)
 
108
    atexit.register(nukepidfile)
 
109
    f = open(pidfile, 'w')
 
110
    print >> f, str(os.getpid())
 
111
    f.close()
 
112
 
 
113
 
97
114
 
98
115
def run(argv=list(sys.argv)):
99
116
 
 
117
    # Sort ZCML overrides for our current config
 
118
    generate_overrides()
 
119
 
100
120
    # setting python paths
101
121
    program = argv[0]
102
122
 
108
128
    # We really want to replace this with a generic startup harness.
109
129
    # However, this should last us until this is developed
110
130
    start_librarian()
 
131
 
 
132
    # Store our process id somewhere
 
133
    make_pidfile()
 
134
 
111
135
    main(argv[1:])
112
136
        
113
137