Make it easier to generate docs for the next release
Change the docs-in-docker target to generate the docs for the NEXT release, not the current one. Also pass in uid/gid so that the new files can be set to the correct ownership instead of root. Modify docs/conf.py to bump the version of the docs if LORAX_VERSION=next is set in the environment. (cherry picked from commit2acd13d612
) (cherry picked from commita71ef40dd5
)
This commit is contained in:
parent
7a86aa1d17
commit
c9f076c86d
@ -19,6 +19,7 @@ RUN dnf -y install \
|
||||
python3-pytoml \
|
||||
python3-semantic_version \
|
||||
python3-sphinx \
|
||||
python3-sphinx-argparse \
|
||||
python3-sphinx_rtd_theme \
|
||||
python3-rpmfluff \
|
||||
python3-librepo \
|
||||
|
11
Makefile
11
Makefile
@ -3,6 +3,7 @@ DESTDIR ?= /
|
||||
PREFIX ?= /usr
|
||||
mandir ?= $(PREFIX)/share/man
|
||||
DOCKER ?= docker
|
||||
DOCS_VERSION ?= next
|
||||
|
||||
PKGNAME = lorax
|
||||
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
|
||||
@ -88,6 +89,10 @@ tag:
|
||||
docs:
|
||||
$(MAKE) -C docs apidoc html man
|
||||
|
||||
# This is needed to reset the ownership of the new docs files after they are created in a container
|
||||
set-docs-owner:
|
||||
chown -R $(LOCAL_UID):$(LOCAL_GID) docs/
|
||||
|
||||
archive:
|
||||
@git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
|
||||
@gzip $(PKGNAME)-$(VERSION).tar
|
||||
@ -116,7 +121,11 @@ test-in-docker:
|
||||
sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
|
||||
|
||||
docs-in-docker:
|
||||
sudo $(DOCKER) run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs
|
||||
sudo $(DOCKER) run -it --rm -v `pwd`:/lorax-ro:ro \
|
||||
-v `pwd`/docs/:/lorax-ro/docs/ \
|
||||
--env LORAX_VERSION=$(DOCS_VERSION) \
|
||||
--env LOCAL_UID=`id -u` --env LOCAL_GID=`id -g` \
|
||||
--security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs set-docs-owner
|
||||
|
||||
ci: check test
|
||||
|
||||
|
19
docs/conf.py
19
docs/conf.py
@ -56,19 +56,32 @@ copyright = u'2018, Red Hat, Inc.' # pylint: disable=redefined-builtin
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
# Pass in LORAX_VERSION to set a specific version
|
||||
# Set LORAX_VERSION=next to bump it to the next release
|
||||
def read_version():
|
||||
"""Read version from $LORAX_VERSION or ../lorax.spec"""
|
||||
"""Read version from $LORAX_VERSION or ../lorax.spec, or bump the version from lorax.spec"""
|
||||
# This allows the .spec version to be overridded. eg. when documenting an upcoming release
|
||||
if "LORAX_VERSION" in os.environ:
|
||||
if "LORAX_VERSION" in os.environ and "next" not in os.environ["LORAX_VERSION"]:
|
||||
return os.environ["LORAX_VERSION"]
|
||||
|
||||
doc_version = None
|
||||
import re
|
||||
version_re = re.compile(r"Version:\s+(.*)")
|
||||
with open("../lorax.spec", "rt") as f:
|
||||
for line in f:
|
||||
m = version_re.match(line)
|
||||
if m:
|
||||
return m.group(1)
|
||||
doc_version = m.group(1)
|
||||
if not doc_version:
|
||||
raise RuntimeError("Failed to find current version")
|
||||
|
||||
# Make it easier to generate docs for the next release
|
||||
if "next" in os.environ["LORAX_VERSION"]:
|
||||
fields = doc_version.split(".")
|
||||
fields[-1] = str(int(fields[-1]) + 1)
|
||||
doc_version = ".".join(fields)
|
||||
|
||||
return doc_version
|
||||
|
||||
#
|
||||
# The short X.Y version.
|
||||
|
Loading…
Reference in New Issue
Block a user