Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3767131
D3064.id7820.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3064.id7820.diff
View Options
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
--- /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
--- a/roles/devserver/userland-software/phabricator.sls
+++ b/roles/devserver/userland-software/phabricator.sls
@@ -38,6 +38,11 @@
- 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
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -45,3 +50,9 @@
{{ 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
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 22:36 (15 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259059
Default Alt Text
D3064.id7820.diff (2 KB)
Attached To
Mode
D3064: Install clang-format-linter Arcanist library on devserver role
Attached
Detach File
Event Timeline
Log In to Comment