Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

Commit d81e952

Browse files
committed
Fix and enhance maintanence scripts
Add new script publish-doc.sh. It requires to build documentation with `make doc' in advance. Built documentation is not gathered into release directory in make_release.sh. Fix script publish-packages.sh, add missing SPEC file. Each time to make a release, delete whole release directory. Be able to publish packages and documentation from Makefile. Signed-off-by: Chenxiong Qi <[email protected]>
1 parent e61a591 commit d81e952

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

Makefile

+12-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ define get_cur_rel_ver
3030
$(shell grep "^version = [0-9]\+\.[0-9]\+" setup.cfg | cut -d' ' -f3)
3131
endef
3232

33+
3334
release: distcheck
3435
@sh -e scripts/make_release.sh
3536
@echo
@@ -41,4 +42,14 @@ release: distcheck
4142
@echo "git tag -m \"$(call get_cur_rel_ver) Release\" v$(call get_cur_rel_ver)"
4243
@echo "twine-3 upload -u tkdchen release/krbcontext-$(call get_cur_rel_ver).tar.gz"
4344
@echo "Push documentation to tkdchen.github.io"
44-
.PHONY: release
45+
.PHONY: release
46+
47+
48+
publishpackages:
49+
@sh -e scripts/publish-packages.sh
50+
.PHONY: publishpackages
51+
52+
53+
publishdoc: doc
54+
@sh -e scripts/publish-doc.sh
55+
.PHONY: publishdoc

scripts/make_release.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
cd $(dirname $(realpath $0))/..
66

77
release_dir=release
8-
test -e ${release_dir} || mkdir ${release_dir}
9-
108
specfile=python-krbcontext.spec
119

10+
test -e ${release_dir} && rm -rf ${release_dir}
11+
mkdir ${release_dir}
12+
13+
1214
name=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'name'))")
1315
rel_ver=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(float(cfg.get('package', 'version'))+0.1)")
1416
rel_date=$(date --rfc-3339='date')
@@ -44,8 +46,11 @@ function update_spec_changelog
4446
rm .release-changelog
4547
}
4648

49+
4750
function gather_release_artifacts
4851
{
52+
# Gather tarball and RPM packages into release directory.
53+
4954
cp dist/${name}-${rel_ver}.tar.gz ${release_dir}
5055

5156
local -r srpm_nvr=$(rpm -q --qf "%{NVR}\n" --specfile ${specfile} | head -n 1)
@@ -56,12 +61,10 @@ function gather_release_artifacts
5661
| while read -r rpm_nvra arch; do
5762
cp dist/${arch}/${rpm_nvra}.rpm ${release_dir}
5863
done
59-
60-
cp -r docs/build/html/ ${release_dir}/docs
6164
}
6265

6366
bump_version
6467
update_changelog_rst
6568
update_spec_changelog
6669
make rpm doc
67-
gather_release_artifacts
70+
gather_release_artifacts

scripts/publish-doc.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# `make doc' is required to run in advance.
4+
5+
cd "$(dirname $(realpath $0))/../"
6+
7+
author=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'author'))")
8+
email=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'email'))")
9+
rel_ver=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'version'))")
10+
11+
RELEASE_DIR="$(realpath release)"
12+
mkdir ${RELEASE_DIR}/docs
13+
cp -r docs/build/html/* ${RELEASE_DIR}/docs/
14+
15+
# All rest things happen in release directory.
16+
17+
cd "${RELEASE_DIR}"
18+
19+
git clone [email protected]:krbcontext/krbcontext.github.io.git
20+
21+
cp -r docs/* krbcontext.github.io/
22+
23+
cd krbcontext.github.io/
24+
git config user.name "${author}"
25+
git config user.email "${email}"
26+
27+
git add *
28+
git commit -s -m "Update doc for ${rel_ver} release"
29+
git push origin HEAD:master

scripts/publish-packages.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
cd "$(dirname $(realpath $0))/../"
44

55
RELEASE_DIR="$(realpath release)"
6+
SPEC=python-krbcontext.spec
67

78
name=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'name'))")
89
rel_ver=$(python -c "import ConfigParser; cfg=ConfigParser.RawConfigParser(); cfg.read('setup.cfg'); print(cfg.get('package', 'version'))")
910

1011
twine upload -u tkdchen "${RELEASE_DIR}/${name}-${rel_ver}.tar.gz"
1112

12-
srpm_nvr=$(rpm -q --qf "%{NVR}\n" --specfile ${specfile} | head -n 1)
13+
srpm_nvr=$(rpm -q --qf "%{NVR}\n" --specfile ${SPEC} | head -n 1)
1314
copr-cli --config ~/.config/copr-fedora build cqi/python-krbcontext "${RELEASE_DIR}/${srpm_nvr}.src.rpm"

0 commit comments

Comments
 (0)