contrib: learn to build website/_uploads
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
dd0be5e166
commit
57b2794bfb
5
Makefile
5
Makefile
@ -14,9 +14,10 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
# Warning: VERSION, ABBREV and TARGZ are used in docs/build-uploads.sh.
|
||||||
VERSION=$(shell ./offlineimap.py --version)
|
VERSION=$(shell ./offlineimap.py --version)
|
||||||
ABBREV=$(shell git log --format='%h' HEAD~1..)
|
ABBREV=$(shell git log --format='%h' HEAD~1..)
|
||||||
TARGZ=offlineimap-$(VERSION)-$(ABBREV)
|
TARGZ=offlineimap-v$(VERSION)-$(ABBREV)
|
||||||
SHELL=/bin/bash
|
SHELL=/bin/bash
|
||||||
RST2HTML=`type rst2html >/dev/null 2>&1 && echo rst2html || echo rst2html.py`
|
RST2HTML=`type rst2html >/dev/null 2>&1 && echo rst2html || echo rst2html.py`
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ websitedoc:
|
|||||||
|
|
||||||
targz: ../$(TARGZ)
|
targz: ../$(TARGZ)
|
||||||
../$(TARGZ):
|
../$(TARGZ):
|
||||||
cd .. && tar -zhcv -f $(TARGZ).tar.gz --exclude '.*.swp' --exclude '.*.swo' --exclude '*.pyc' --exclude '__pycache__' offlineimap/{bin,Changelog.md,Changelog.maint.md,contrib,CONTRIBUTING.rst,COPYING,docs,MAINTAINERS.rst,Makefile,MANIFEST.in,offlineimap,offlineimap.conf,offlineimap.conf.minimal,offlineimap.py,README.md,requirements.txt,scripts,setup.cfg,setup.py,snapcraft.yaml,test,tests,TODO.rst}
|
cd .. && tar -zhcv --transform s,^offlineimap,$(TARGZ), -f $(TARGZ).tar.gz --exclude '.*.swp' --exclude '.*.swo' --exclude '*.pyc' --exclude '__pycache__' offlineimap/{bin,Changelog.md,Changelog.maint.md,contrib,CONTRIBUTING.rst,COPYING,docs,MAINTAINERS.rst,Makefile,MANIFEST.in,offlineimap,offlineimap.conf,offlineimap.conf.minimal,offlineimap.py,README.md,requirements.txt,scripts,setup.cfg,setup.py,snapcraft.yaml,test,tests,TODO.rst}
|
||||||
|
|
||||||
rpm: targz
|
rpm: targz
|
||||||
cd .. && sudo rpmbuild -ta $(TARGZ)
|
cd .. && sudo rpmbuild -ta $(TARGZ)
|
||||||
|
@ -26,7 +26,7 @@ from helpers import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
__VERSION__ = "0.1"
|
__VERSION__ = "0.2"
|
||||||
|
|
||||||
SPHINXBUILD = 'sphinx-build'
|
SPHINXBUILD = 'sphinx-build'
|
||||||
DOCSDIR = 'docs'
|
DOCSDIR = 'docs'
|
||||||
@ -260,6 +260,15 @@ Pip:
|
|||||||
|
|
||||||
|
|
||||||
class Website(object):
|
class Website(object):
|
||||||
|
def updateUploads(self):
|
||||||
|
req = ("update uploads/ of the website? "
|
||||||
|
"(warning: checksums will change if they already exist)")
|
||||||
|
if User.yesNo(req, defaultToYes=True) is False:
|
||||||
|
return False
|
||||||
|
if check_call(shlex.split("./docs/build-uploads.sh")) != 0:
|
||||||
|
return exit(5)
|
||||||
|
return True
|
||||||
|
|
||||||
def updateAPI(self):
|
def updateAPI(self):
|
||||||
req = "update API of the website? (requires {})".format(SPHINXBUILD)
|
req = "update API of the website? (requires {})".format(SPHINXBUILD)
|
||||||
if User.yesNo(req, defaultToYes=True) is False:
|
if User.yesNo(req, defaultToYes=True) is False:
|
||||||
@ -292,9 +301,7 @@ Then, commit and push changes of the website.""".format(SPHINXBUILD, DOCSDIR))
|
|||||||
with open(WEBSITE_LATEST, 'w') as fd:
|
with open(WEBSITE_LATEST, 'w') as fd:
|
||||||
fd.write(WEBSITE_LATEST_SKEL.format(stable=version))
|
fd.write(WEBSITE_LATEST_SKEL.format(stable=version))
|
||||||
|
|
||||||
def exportDocs(self, version):
|
def exportDocs(self):
|
||||||
branchName = "import-v{}".format(version)
|
|
||||||
|
|
||||||
if not goTo(DOCSDIR):
|
if not goTo(DOCSDIR):
|
||||||
User.pause()
|
User.pause()
|
||||||
return
|
return
|
||||||
@ -303,6 +310,9 @@ Then, commit and push changes of the website.""".format(SPHINXBUILD, DOCSDIR))
|
|||||||
print("error while calling 'make websitedoc'")
|
print("error while calling 'make websitedoc'")
|
||||||
exit(3)
|
exit(3)
|
||||||
|
|
||||||
|
def createImportBranch(self, version):
|
||||||
|
branchName = "import-v{}".format(version)
|
||||||
|
|
||||||
Git.chdirToRepositoryTopLevel()
|
Git.chdirToRepositoryTopLevel()
|
||||||
if not goTo("website"):
|
if not goTo("website"):
|
||||||
User.pause()
|
User.pause()
|
||||||
@ -410,8 +420,12 @@ class Release(object):
|
|||||||
self.state.saveWebsite()
|
self.state.saveWebsite()
|
||||||
website = Website()
|
website = Website()
|
||||||
website.buildLatest(newVersion)
|
website.buildLatest(newVersion)
|
||||||
if website.updateAPI():
|
res_upload = website.updateUploads()
|
||||||
self.websiteBranch = website.exportDocs(newVersion)
|
res_api = website.updateAPI()
|
||||||
|
if res_api:
|
||||||
|
res_export = website.exportDocs()
|
||||||
|
if True in [res_upload, res_api, res_export]:
|
||||||
|
self.websiteBranch = website.createImportBranch(newVersion)
|
||||||
|
|
||||||
def getWebsiteBranch(self):
|
def getWebsiteBranch(self):
|
||||||
return self.websiteBranch
|
return self.websiteBranch
|
||||||
|
34
docs/build-uploads.sh
Executable file
34
docs/build-uploads.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# vim: expandtab ts=2 :
|
||||||
|
|
||||||
|
WEBSITE_UPLOADS='./website/_uploads'
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
test -d .git && break
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "make clean"
|
||||||
|
make clean >/dev/null
|
||||||
|
echo "make targz"
|
||||||
|
make targz >/dev/null
|
||||||
|
|
||||||
|
# Defined in the root Makefile.
|
||||||
|
version="$(./offlineimap.py --version)"
|
||||||
|
abbrev="$(git log --format='%h' HEAD~1..)"
|
||||||
|
targz="../offlineimap-v${version}-${abbrev}.tar.gz"
|
||||||
|
|
||||||
|
filename="offlineimap-v${version}.tar.gz"
|
||||||
|
|
||||||
|
mv -v "$targz" "${WEBSITE_UPLOADS}/${filename}"
|
||||||
|
cd "$WEBSITE_UPLOADS"
|
||||||
|
for digest in sha1 sha256 sha512
|
||||||
|
do
|
||||||
|
target="${filename}.${digest}"
|
||||||
|
echo "Adding digest ${WEBSITE_UPLOADS}/${target}"
|
||||||
|
"${digest}sum" "$filename" > "$target"
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user