Skip to content
Snippets Groups Projects
Commit 1d8a2e8a authored by Dimitris Lampridis's avatar Dimitris Lampridis
Browse files

tools: make SDB descriptor generator script less fragile wrt git commands. Also add header.

parent 3f33ca1b
Branches
Tags
No related merge requests found
# Tcl script to automatically generate the SDB synthesis descriptor. ##-------------------------------------------------------------------------------
# ## CERN BE-CO-HT
# Must be added to your top-level Manifest.py like this: ## General Cores
# ## https://www.ohwr.org/projects/general-cores
# syn_post_project_cmd = "$(TCL_INTERPRETER) [this_tcl_script] " + ##-------------------------------------------------------------------------------
# syn_tool + " $(PROJECT_FILE)" ##
# ## Tcl script to automatically generate the SDB synthesis descriptor.
# Notes: ##
# ## Must be added to your top-level Manifest.py like this:
# 1. $(TCL_INTERPRETER) and $(PROJECT_FILE) will be automatically ##
# resolved inside the Makefile generated by hdlmake. ## syn_post_project_cmd = "$(TCL_INTERPRETER) [this_tcl_script] " +
# 2. syn_tool is a Manifest.py variable, it should already be in your ## syn_tool + " $(PROJECT_FILE)"
# tol-level Manifest.py. ##
# 3. [this_tcl_script] should be replaced by the full path to ## notes:
# this Tcl script. Relative paths should be with respect to ##
# the location of the top-level Manifest.py. ## 1. $(TCL_INTERPRETER) and $(PROJECT_FILE) will be automatically
# 4. Mind the spaces inside the quotes, before and after syn_tool. ## resolved inside the Makefile generated by hdlmake.
## 2. syn_tool is a Manifest.py variable, it should already be in your
## tol-level Manifest.py.
## 3. [this_tcl_script] should be replaced by the full path to
## this Tcl script. Relative paths should be with respect to
## the location of the top-level Manifest.py.
## 4. Mind the spaces inside the quotes, before and after syn_tool.
##
##-------------------------------------------------------------------------------
## Copyright CERN 2018
##-------------------------------------------------------------------------------
## This Source Code Form is subject to the terms of the Mozilla Public License,
## version 2.0. If a copy of the MPL was not distributed with this file, You can
## obtain one at https://mozilla.org/MPL/2.0/.
##-------------------------------------------------------------------------------
# get current time # get current time
set time_now [clock seconds] set time_now [clock seconds]
...@@ -92,13 +106,21 @@ if {$syn_tool == "ise"} { ...@@ -92,13 +106,21 @@ if {$syn_tool == "ise"} {
# For now we hard-code, since anyway ISE is end-of-life at version 14.7. # For now we hard-code, since anyway ISE is end-of-life at version 14.7.
set inf_tool_version [format "%08d" "147"] set inf_tool_version [format "%08d" "147"]
} }
set inf_tool_name [string toupper $syn_tool] set inf_tool_name [string toupper $syn_tool]
set inf_commit_id [exec git log -1 --format=%H]
set inf_date [clock format $time_now -format "%A, %B %d %Y"] set inf_date [clock format $time_now -format "%A, %B %d %Y"]
set inf_date_ymd [clock format $time_now -format "%Y%m%d"] set inf_date_ymd [clock format $time_now -format "%Y%m%d"]
set inf_user [exec git config user.name]
# next line could break if git remote is not called "origin" # Git commands below have fallbacks in case something goes wrong.
set inf_repo_url [exec git remote get-url origin] if { [catch { set inf_user [exec git config --get user.name] }] } {
set inf_user "unknown user"
}
if { [catch { set inf_commit_id [exec git log -1 --format=%H] }] } {
set inf_commit_id "unknown commit"
}
if { [catch { set inf_repo_url [exec git config --get remote.origin.url] }] } {
set inf_repo_url "unknown url"
}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# STEP 5/7: Generate the output file # STEP 5/7: Generate the output file
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment