Page MenuHomeDevCentral

No OneTemporary

diff --git a/roles/devserver/userland-software/files/install-clang-format-alias.py b/roles/devserver/userland-software/files/install-clang-format-alias.py
new file mode 100755
index 0000000..0ad5884
--- /dev/null
+++ b/roles/devserver/userland-software/files/install-clang-format-alias.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+# Create clang-format
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Search for clang-format<version> and alias it
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+
+from glob import glob
+import os
+import sys
+
+
+# -------------------------------------------------------------
+# Create clang-format alias
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def create_alias(bin_directory):
+ candidates = glob(f"{bin_directory}/clang-format*")
+
+ if not candidates:
+ return False
+
+ candidate = max(candidates)
+ os.symlink(candidate, f"{bin_directory}/clang-format")
+
+ return True
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <bin directory>", file=sys.stderr)
+ sys.exit(1)
+
+ create_alias(sys.argv[1])
diff --git a/roles/devserver/userland-software/phabricator.sls b/roles/devserver/userland-software/phabricator.sls
index 2eaa6cc..f33e495 100644
--- a/roles/devserver/userland-software/phabricator.sls
+++ b/roles/devserver/userland-software/phabricator.sls
@@ -1,47 +1,58 @@
# -------------------------------------------------------------
# Salt — Provision dev software
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-10-21
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
{% from "map.jinja" import dirs with context %}
# -------------------------------------------------------------
# Provision /opt/phabricator from Git repositories
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
libphutil_repository:
git.latest:
- name: https://secure.phabricator.com/source/libphutil.git
- target: /opt/phabricator/libphutil
arcanist_repository:
git.latest:
- name: https://secure.phabricator.com/diffusion/ARC/arcanist.git
- target: /opt/phabricator/arcanist
- update_head: False
phabricator_repository:
git.latest:
- name: https://secure.phabricator.com/source/phabricator.git
- target: /opt/phabricator/phabricator
- update_head: False
# -------------------------------------------------------------
# Extra phutil libraries
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
shellcheck_linter_repository:
git.latest:
- name: https://devcentral.nasqueron.org/source/shellcheck-linter.git
- target: /opt/phabricator/shellcheck-linter
+clang_linter_repository:
+ git.latest:
+ - name: https://github.com/vhbit/clang-format-linter
+ - target: /opt/phabricator/clang-format-linter
+
# -------------------------------------------------------------
# Aliases
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ dirs.bin }}/arc:
file.symlink:
- target: /opt/phabricator/arcanist/bin/arc
+
+devserver_aliases_clang-format:
+ cmd.script:
+ - source: salt://roles/devserver/userland-software/files/install-clang-format-alias.py
+ - args: {{ dirs.bin }}
+ - creates: {{ dirs.bin }}/clang-format

File Metadata

Mime Type
text/x-diff
Expires
Mon, Sep 15, 09:25 (8 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2983594
Default Alt Text
(3 KB)

Event Timeline