Use clones of git repos for site building.

The svn interface to our repos on git is not behaving well.  This is resulting in the website, examples, and api docs not being updated when they should (`svn up` is not doing what it should).

Instead of using svn checkouts, we should use clones of the git repos.  At the same time, it makes sense to organize things a bit.  These changes depend on a new structure on the openlayers.org machine:

    /osgeo/openlayers/repos - clones of our openlayers, docs, and website repos
    /osgeo/openlayers/sites - sources for openlayers.org, dev.openlayers.org, and docs.openlayers.org

Where things are "built" (e.g. minifying js and modifying example markup to point to that js), changes are now made outside of the repo cleans.  Having dirty repos was another source of build failures.

Changes still need to be made to the release process/script.
This commit is contained in:
Tim Schaub
2012-05-10 01:03:54 -06:00
parent 8dabefebb2
commit cadb20c18a
2 changed files with 126 additions and 74 deletions

View File

@@ -87,15 +87,20 @@ def parseHtml(html,ids):
d['classes'] = classes
return d
def getSvnInfo(path):
h = os.popen("svn info %s --xml" % path)
tree = ElementTree.fromstring(h.read())
def getGitInfo(exampleDir, exampleName):
orig = os.getcwd()
os.chdir(exampleDir)
h = os.popen("git log -n 1 --pretty=format:'%an|%ai' " + exampleName)
os.chdir(orig)
log = h.read()
h.close()
d = {
'url': tree.findtext('entry/url'),
'author': tree.findtext('entry/commit/author'),
'date': tree.findtext('entry/commit/date')
}
d = {}
parts = log.split("|")
d["author"] = parts[0]
# compensate for spaces in git log time
td = parts[1].split(" ")
td.insert(1, "T")
d["date"] = "".join(td)
return d
def createFeed(examples):
@@ -190,34 +195,33 @@ if __name__ == "__main__":
print "This script requires json or simplejson and BeautifulSoup. You don't have them. \n(%s)" % E
sys.exit()
if len(sys.argv) > 1:
outFile = open(sys.argv[1],'w')
if len(sys.argv) == 3:
inExampleDir = sys.argv[1]
outExampleDir = sys.argv[2]
else:
outFile = open('../examples/example-list.js','w')
inExampleDir = "../examples"
outExampleDir = "../examples"
examplesLocation = '../examples'
print 'Reading examples from %s and writing out to %s' % (examplesLocation, outFile.name)
outFile = open(os.path.join(outExampleDir, "example-list.js"), "w")
print 'Reading examples from %s and writing out to %s' % (inExampleDir, outFile.name)
exampleList = []
docIds = ['title','shortdesc','tags']
#comment out option to create docs from online resource
#examplesLocation = 'http://svn.openlayers.org/sandbox/docs/examples/'
#examples = getListOfOnlineExamples(examplesLocation)
examples = getListOfExamples(examplesLocation)
examples = getListOfExamples(inExampleDir)
modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime())
for example in examples:
url = os.path.join(examplesLocation,example)
html = getExampleHtml(url)
path = os.path.join(inExampleDir, example)
html = getExampleHtml(path)
tagvalues = parseHtml(html,docIds)
tagvalues['example'] = example
# add in svn info
d = getSvnInfo(url)
tagvalues["modified"] = d["date"] or modtime
# add in author/date info
d = getGitInfo(inExampleDir, example)
tagvalues["author"] = d["author"] or "anonymous"
tagvalues["modified"] = d["date"] or modtime
tagvalues['link'] = example
exampleList.append(tagvalues)
@@ -234,8 +238,9 @@ if __name__ == "__main__":
outFile.write(json)
outFile.close()
print "writing feed to ../examples/%s " % feedName
atom = open('../examples/%s' % feedName, 'w')
outFeedPath = os.path.join(outExampleDir, feedName);
print "writing feed to %s " % outFeedPath
atom = open(outFeedPath, 'w')
doc = createFeed(exampleList)
atom.write(doc.toxml())
atom.close()