-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ cython_debug/ | |
tests/staging/ | ||
tests/reports/ | ||
.session_conf.sav | ||
version.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,47 @@ PREFIX=/opt/yandex/mdb-ch-tools | |
INSTALL_DIR=$(DESTDIR)$(PREFIX) | ||
|
||
.PHONY: install | ||
install: install-symlinks install-bash-completions install-logrotate ; | ||
install: install-python-package install-symlinks install-bash-completions configure-logs ; | ||
|
||
.PHONY: uninstall | ||
uninstall: uninstall-python-package uninstall-symlinks uninstall-bash-completions uninstall-logrotate ; | ||
|
||
.PHONY: install-python-package | ||
install-python-package: build-python-package | ||
@echo 'Installing mdb-ch-tools' | ||
|
||
python3 -m venv $(INSTALL_DIR) | ||
rm -f $(INSTALL_DIR)/bin/activate* | ||
$(INSTALL_DIR)/bin/pip install -U pip | ||
|
||
$(INSTALL_DIR)/bin/pip install --no-compile chtools.tar.gz | ||
|
||
find $(INSTALL_DIR) -name __pycache__ -type d -exec rm -rf {} + | ||
test -n '$(DESTDIR)' \ | ||
&& grep -l -r -F '#!$(INSTALL_DIR)' $(INSTALL_DIR) \ | ||
| xargs sed -i -e 's|$(INSTALL_DIR)|$(PREFIX)|' \ | ||
|| true | ||
|
||
.PHONY: build-python-package | ||
build-python-package: chtools.tar.gz ; | ||
@echo 'Cleaning up residuals from building of Python package' | ||
rm -rf venv dist | ||
|
||
chtools.tar.gz: venv-build prepare-version | ||
@echo 'Building Python package' | ||
|
||
venv/bin/flit build --no-use-vcs | ||
mv dist/*.tar.gz $@ | ||
|
||
.PHONY: venv-build | ||
venv-build: venv/bin/python3 ; | ||
|
||
venv/bin/python3: | ||
@echo 'Setting up build venv' | ||
|
||
python3 -m venv venv | ||
venv/bin/pip install -U pip flit | ||
|
||
.PHONY: uninstall-python-package | ||
uninstall-python-package: | ||
@echo 'Uninstalling mdb-ch-tools' | ||
|
@@ -48,14 +84,14 @@ uninstall-bash-completions: | |
rm -f $(DESTDIR)/etc/bash_completion.d/$(bin) ; \ | ||
) | ||
|
||
.PHONY: install-logrotate | ||
install-logrotate: | ||
@echo 'Creating log rotation rules' | ||
.PHONY: configure-logs | ||
configure-logs: | ||
@echo 'Configuring logging' | ||
|
||
mkdir -p $(DESTDIR)/etc/logrotate.d/ | ||
$(foreach bin, chadmin clickhouse-monitoring keeper-monitoring, \ | ||
mkdir -p $(DESTDIR)/var/log/$(folder) ; \ | ||
chmod 775 $(DESTDIR)/var/log/$(folder) ; \ | ||
mkdir -p $(DESTDIR)/var/log/$(bin) ; \ | ||
chmod 775 $(DESTDIR)/var/log/$(bin) ; \ | ||
cp resources/logrotate/$(bin).logrotate $(DESTDIR)/etc/logrotate.d/$(bin) ; \ | ||
) | ||
|
||
|
@@ -67,40 +103,55 @@ uninstall-logrotate: | |
rm -f $(DESTDIR)/etc/logrotate.d/$(bin) ; \ | ||
) | ||
|
||
|
||
.PHONY: prepare-changelog | ||
prepare-changelog: prepare-version | ||
dch --force-bad-version --distribution stable -v `cat version.txt` Autobuild | ||
@echo 'Bumping version into Debian package changelog' | ||
DEBFULLNAME="Yandex LLC" DEBEMAIL="[email protected]" dch --force-bad-version --distribution stable -v `cat version.txt` Autobuild | ||
|
||
.PHONY: prepare-version | ||
prepare-version: version.txt | ||
@echo "Version: `cat version.txt`" | ||
|
||
version.txt: | ||
@echo "2.$$(git rev-list HEAD --count).$$(git rev-parse --short HEAD | perl -ne 'print hex $$_')" > $@ | ||
@# Replace version in pyproject.toml | ||
sed -ie "s/__version__ = \"[0-9\.]\+\"/__version__ = \"`cat $@`\"/" src/chtools/__init__.py | ||
|
||
.PHONY: build-deb-package | ||
build-deb-package: prepare-changelog | ||
cd debian && debuild --check-dirname-level 0 --preserve-env --no-lintian --no-tgz-check -uc -us | ||
mkdir out && mv ../mdb-ch-tools* out/ | ||
|
||
.PHONY: clean | ||
clean: | ||
@echo 'Cleaning up' | ||
|
||
rm -rf build | ||
rm -rf debian/files debian/.debhelper | ||
rm -rf debian/mdb-ch-tools* | ||
|
||
.PHONY: help | ||
help: | ||
@echo "Base targets:" | ||
@echo " prepare-changelog Add an autobuild version entity to changelog" | ||
@echo " prepare-version Update version based on latest commit" | ||
@echo " build-python-package Build 'ch-tools' Python package" | ||
@echo " build-deb-package Build 'mdb-ch-tools' debian package" | ||
@echo " clean Clean up after building debian package" | ||
@echo "" | ||
@echo "--------------------------------------------------------------------------------" | ||
@echo "" | ||
@echo "Debian package build targets:" | ||
@echo " install Install 'mdb-ch-tools' debian package" | ||
@echo " uninstall Uninstall 'mdb-ch-tools' debian package" | ||
@echo "" | ||
@echo " install-python-package Install 'ch-tools' python package" | ||
@echo " uninstall-python-package Uninstall 'ch-tools' python package" | ||
@echo " install-symlinks Install symlinks to /usr/bin/" | ||
@echo " uninstall-symlinks Uninstall symlinks from /usr/bin/" | ||
@echo " install-bash-completions Install to /etc/bash_completion.d/" | ||
@echo " uninstall-bash-completions Uninstall from /etc/bash_completion.d/" | ||
@echo " install-logrotate Install log rotation rules to /etc/logrotate.d/" | ||
@echo " configure-logs Install log rotation rules to /etc/logrotate.d/ and create log dirs" | ||
@echo " uninstall-logrotate Uninstall log rotation rules from /etc/logrotate.d/" | ||
@echo "" | ||
@echo "--------------------------------------------------------------------------------" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ Uploaders: Alexander Burmak <[email protected]>, | |
Aleksei Filatov <[email protected]>, | ||
Evgenii Kopanev <[email protected]>, | ||
Mikhail Kot <[email protected]> | ||
Build-Depends: debhelper (>= 8.0.0), python3, python3-venv, python3-pip, python3-setuptools | ||
Build-Depends: debhelper (>= 9.0.0), python3, python3-venv, python3-pip, python3-setuptools | ||
Standards-Version: 4.1.4 | ||
Homepage: https://github.com/yandex/ch-tools | ||
Vcs-Browser: https://github.com/yandex/ch-tools.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,8 @@ build-backend = "flit_core.buildapi" | |
|
||
[project] | ||
name = "chtools" | ||
version = "1.0.0" | ||
description = "A set of tools for administration and diagnostics of ClickHouse DBMS." | ||
license = { file = "LICENSE" } | ||
dynamic = ["version", "description"] | ||
|
||
authors = [ | ||
{name = "Alexander Burmak", email = "[email protected]"}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"""A set of tools for administration and diagnostics of ClickHouse DBMS.""" | ||
|
||
__version__ = "1.0.0" |