Skip to content

Commit 70581ea

Browse files
authored
Change Versioning Strategy (master) (#2154)
~ use tclmodules (`.tm`) files instead of pkgIndex.tcl for openlane and openlane_utils ~ change tagging to use the version from the `.tm` files instead of the day of the release ~ include superstable branch in tagging efforts (even though this doesn't mean much in `master`…)
1 parent 16319b4 commit 70581ea

25 files changed

+53
-136
lines changed

.github/scripts/generate_tag.py

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,25 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
import datetime
17-
import subprocess
16+
import os
17+
import re
1818
from gh import gh
1919

2020
new_tag = "NO_NEW_TAG"
2121

22-
print("Getting latest release index…")
22+
tags = [tag for _, tag in gh.openlane.tags]
2323

24-
print("Getting the latest tag…")
24+
openlane_tm_rx = re.compile(r"openlane-(.+?)\.tm")
2525

26-
latest_tag = None
27-
latest_tag_commit = None
28-
commits_with_tags = gh.openlane.tags
29-
tags = [tag for _, tag in commits_with_tags]
30-
for tag in commits_with_tags:
31-
commit, name = tag
32-
latest_tag = name
33-
latest_tag_commit = commit
34-
35-
commit_count = int(
36-
subprocess.check_output(
37-
["git", "rev-list", "--count", "%s..%s" % (latest_tag_commit, "HEAD")]
38-
)
39-
)
40-
41-
if commit_count == 0:
42-
print("No new commits. A tag will not be created.")
43-
else:
44-
now = datetime.datetime.now()
45-
46-
time = now.strftime("%Y.%m.%d")
47-
new_tag = time
48-
release_counter = 0
49-
while new_tag in tags:
50-
release_counter += 1
51-
new_tag = f"{time}r{release_counter}"
52-
53-
print("Naming new tag %s." % new_tag)
26+
for file in os.listdir("scripts"):
27+
match = openlane_tm_rx.match(file)
28+
if match is not None:
29+
tag = match[1]
30+
if tag not in tags:
31+
new_tag = tag
32+
print("Naming new tag %s." % new_tag)
33+
else:
34+
print("No new tag found.")
35+
break
5436

5537
gh.export_env("NEW_TAG", new_tag)

.github/scripts/variables_documentation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
OPENLANE_MOUNTED_SCRIPTS_VERSION
6464
OPENLANE_ROOT
6565
OPENLANE_VERSION
66+
OPENLANE_COMMIT
6667
OPENROAD_BIN
6768
PACKAGED_SCRIPT_0
6869
PDKPATH

.github/workflows/openlane_ci.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ jobs:
294294
with:
295295
name: pdk-tarball
296296

297-
- name: Write Main Branch
298-
run: |
299-
echo "MAIN_BRANCH=${{ vars.MAIN_BRANCH }}" >> $GITHUB_ENV
300-
301297
- name: Write Hash
302298
run: |
303299
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
@@ -310,7 +306,7 @@ jobs:
310306
done
311307
312308
- name: Create Tag (If scheduled or dispatched)
313-
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
309+
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }}
314310
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py
315311

316312
- name: Tag Commit (If scheduled or dispatched)

docs/source/getting_started/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ This is a typical structure for a design folder:
8181
│   ├── config.json
8282
│   ├── logs
8383
│   ├── openlane.log
84-
│   ├── OPENLANE_VERSION
84+
│   ├── OPENLANE_COMMIT
8585
│   ├── PDK_SOURCES
8686
│   ├── reports
8787
│   ├── results

docs/source/reference/openlane_commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page describes the list of commands available in OpenLane, their functional
44

55
**NOTE:** You must run the `prep` command before running any of the other commands, in order to have the necessary files and configurations loaded.
66

7-
The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane 0.9`.
7+
The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane`.
88

99
## General Commands
1010

flow.tcl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ set ::env(OPENLANE_ROOT) [file dirname [file normalize [info script]]]
1717
if { ! [info exists ::env(OPENROAD_BIN) ] } {
1818
set ::env(OPENROAD_BIN) openroad
1919
}
20-
lappend ::auto_path "$::env(OPENLANE_ROOT)/scripts/"
20+
if { [info exists ::env(TCL8_5_TM_PATH)] } {
21+
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts:$::env(TCL8_5_TM_PATH)"
22+
} else {
23+
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts"
24+
}
2125
package require openlane; # provides the utils as well
2226

2327
proc run_placement_step {args} {
@@ -371,25 +375,25 @@ set flags {-interactive -it -drc -lvs -synth_explore -run_hooks}
371375

372376
parse_key_args "flow.tcl" argv arg_values $options flags_map $flags -no_consume
373377

374-
if {[catch {exec cat /git_version} ::env(OPENLANE_VERSION)]} {
375-
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_VERSION)]} {
376-
set ::env(OPENLANE_VERSION) ""
378+
if {[catch {exec cat /git_version} ::env(OPENLANE_COMMIT)]} {
379+
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_COMMIT)]} {
380+
set ::env(OPENLANE_COMMIT) ""
377381
}
378382
}
379383

380384
if { [file isdirectory $::env(OPENLANE_ROOT)/.git] } {
381385
if {![catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)]} {
382-
if { $::env(OPENLANE_VERSION) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
386+
if { $::env(OPENLANE_COMMIT) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
383387
unset ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)
384388
}
385389
}
386390
}
387391

388-
puts "OpenLane $::env(OPENLANE_VERSION)"
392+
puts "OpenLane v[package version openlane] ($::env(OPENLANE_COMMIT))"
389393
if { [info exists ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)] } {
390394
puts "(with mounted scripts from $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION))"
391395
}
392-
puts "All rights reserved. (c) 2020-2023 Efabless Corporation and contributors."
396+
puts "All rights reserved. (c) 2020-2024 Efabless Corporation and contributors."
393397
puts "Available under the Apache License, version 2.0. See the LICENSE file for more details."
394398
puts ""
395399

scripts/openlane-1.1.0.tm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2024 Efabless Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
15+
foreach file [glob $scripts_dir/tcl_commands/*.tcl] {
16+
source $file
17+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Efabless Corporation
1+
# Copyright 2024 Efabless Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,5 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
pkg_mkIndex .
14+
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
15+
foreach file [glob $scripts_dir/utils/*.tcl] {
16+
source $file
17+
}

scripts/tcl_commands/all.tcl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,8 @@ proc prep {args} {
868868
file copy -force $::env(PDK_ROOT)/$::env(PDK)/SOURCES $::env(RUN_DIR)/PDK_SOURCES
869869
}
870870

871-
if { [info exists ::env(OPENLANE_VERSION) ] } {
872-
try_exec echo "OpenLane $::env(OPENLANE_VERSION)" > $::env(RUN_DIR)/OPENLANE_VERSION
871+
if { [info exists ::env(OPENLANE_COMMIT) ] } {
872+
try_exec echo "OpenLane $::env(OPENLANE_COMMIT)" > $::env(RUN_DIR)/OPENLANE_COMMIT
873873
}
874874

875875
if { [info exists ::env(EXTRA_GDS_FILES)] } {
@@ -1322,5 +1322,3 @@ proc run_post_run_hooks {} {
13221322
puts_verbose "No post-run hook found, skipping..."
13231323
}
13241324
}
1325-
1326-
package provide openlane 0.9

scripts/tcl_commands/checkers.tcl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,5 +401,3 @@ proc quit_on_klayout_drc {report_file} {
401401
puts_info "No KLayout DRC violations after GDS streaming out."
402402
}
403403
}
404-
405-
package provide openlane 0.9

0 commit comments

Comments
 (0)