Skip to content

Commit

Permalink
Change Versioning Strategy (master) (#2154)
Browse files Browse the repository at this point in the history
~ 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`…)
  • Loading branch information
donn authored Sep 22, 2024
1 parent 16319b4 commit 70581ea
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 136 deletions.
46 changes: 14 additions & 32 deletions .github/scripts/generate_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,25 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
import subprocess
import os
import re
from gh import gh

new_tag = "NO_NEW_TAG"

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

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

latest_tag = None
latest_tag_commit = None
commits_with_tags = gh.openlane.tags
tags = [tag for _, tag in commits_with_tags]
for tag in commits_with_tags:
commit, name = tag
latest_tag = name
latest_tag_commit = commit

commit_count = int(
subprocess.check_output(
["git", "rev-list", "--count", "%s..%s" % (latest_tag_commit, "HEAD")]
)
)

if commit_count == 0:
print("No new commits. A tag will not be created.")
else:
now = datetime.datetime.now()

time = now.strftime("%Y.%m.%d")
new_tag = time
release_counter = 0
while new_tag in tags:
release_counter += 1
new_tag = f"{time}r{release_counter}"

print("Naming new tag %s." % new_tag)
for file in os.listdir("scripts"):
match = openlane_tm_rx.match(file)
if match is not None:
tag = match[1]
if tag not in tags:
new_tag = tag
print("Naming new tag %s." % new_tag)
else:
print("No new tag found.")
break

gh.export_env("NEW_TAG", new_tag)
1 change: 1 addition & 0 deletions .github/scripts/variables_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
OPENLANE_MOUNTED_SCRIPTS_VERSION
OPENLANE_ROOT
OPENLANE_VERSION
OPENLANE_COMMIT
OPENROAD_BIN
PACKAGED_SCRIPT_0
PDKPATH
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/openlane_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,6 @@ jobs:
with:
name: pdk-tarball

- name: Write Main Branch
run: |
echo "MAIN_BRANCH=${{ vars.MAIN_BRANCH }}" >> $GITHUB_ENV
- name: Write Hash
run: |
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
Expand All @@ -310,7 +306,7 @@ jobs:
done
- name: Create Tag (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }}
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py

- name: Tag Commit (If scheduled or dispatched)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This is a typical structure for a design folder:
│   ├── config.json
│   ├── logs
│   ├── openlane.log
│   ├── OPENLANE_VERSION
│   ├── OPENLANE_COMMIT
│   ├── PDK_SOURCES
│   ├── reports
│   ├── results
Expand Down
2 changes: 1 addition & 1 deletion docs/source/reference/openlane_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This page describes the list of commands available in OpenLane, their functional

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

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

## General Commands

Expand Down
18 changes: 11 additions & 7 deletions flow.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ set ::env(OPENLANE_ROOT) [file dirname [file normalize [info script]]]
if { ! [info exists ::env(OPENROAD_BIN) ] } {
set ::env(OPENROAD_BIN) openroad
}
lappend ::auto_path "$::env(OPENLANE_ROOT)/scripts/"
if { [info exists ::env(TCL8_5_TM_PATH)] } {
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts:$::env(TCL8_5_TM_PATH)"
} else {
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts"
}
package require openlane; # provides the utils as well

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

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

if {[catch {exec cat /git_version} ::env(OPENLANE_VERSION)]} {
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_VERSION)]} {
set ::env(OPENLANE_VERSION) ""
if {[catch {exec cat /git_version} ::env(OPENLANE_COMMIT)]} {
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_COMMIT)]} {
set ::env(OPENLANE_COMMIT) ""
}
}

if { [file isdirectory $::env(OPENLANE_ROOT)/.git] } {
if {![catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)]} {
if { $::env(OPENLANE_VERSION) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
if { $::env(OPENLANE_COMMIT) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
unset ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)
}
}
}

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

Expand Down
17 changes: 17 additions & 0 deletions scripts/openlane-1.1.0.tm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
foreach file [glob $scripts_dir/tcl_commands/*.tcl] {
source $file
}
8 changes: 5 additions & 3 deletions scripts/tcl_commands/refresh.tcl → scripts/openlane_utils-1.1.0.tm
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Efabless Corporation
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,5 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

pkg_mkIndex .
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
foreach file [glob $scripts_dir/utils/*.tcl] {
source $file
}
6 changes: 2 additions & 4 deletions scripts/tcl_commands/all.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ proc prep {args} {
file copy -force $::env(PDK_ROOT)/$::env(PDK)/SOURCES $::env(RUN_DIR)/PDK_SOURCES
}

if { [info exists ::env(OPENLANE_VERSION) ] } {
try_exec echo "OpenLane $::env(OPENLANE_VERSION)" > $::env(RUN_DIR)/OPENLANE_VERSION
if { [info exists ::env(OPENLANE_COMMIT) ] } {
try_exec echo "OpenLane $::env(OPENLANE_COMMIT)" > $::env(RUN_DIR)/OPENLANE_COMMIT
}

if { [info exists ::env(EXTRA_GDS_FILES)] } {
Expand Down Expand Up @@ -1322,5 +1322,3 @@ proc run_post_run_hooks {} {
puts_verbose "No post-run hook found, skipping..."
}
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/checkers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,3 @@ proc quit_on_klayout_drc {report_file} {
puts_info "No KLayout DRC violations after GDS streaming out."
}
}

package provide openlane 0.9
3 changes: 0 additions & 3 deletions scripts/tcl_commands/cts.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,3 @@ proc run_resizer_timing {args} {
puts_info "Skipping Placement Resizer Timing Optimizations."
}
}


package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/floorplan.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -518,5 +518,3 @@ proc run_floorplan {args} {

run_power_grid_generation
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/init_design.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,3 @@ if { \[file exists \$filename\] == 1} {

puts_info "Finished populating:\n$config_path \nPlease modify CLOCK_PORT, CLOCK_PERIOD and add your advanced settings to $config_path"
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/klayout.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,3 @@ proc open_in_klayout {args} {
--lym $::env(KLAYOUT_DEF_LAYER_MAP)\
$arg_values(-layout)
}

package provide openlane 0.9
3 changes: 0 additions & 3 deletions scripts/tcl_commands/lvs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,3 @@ proc run_lvs {{layout "$::env(EXT_NETLIST)"}} {
proc run_netgen {args} {
handle_deprecated_command run_lvs
}

package provide openlane 0.9

2 changes: 0 additions & 2 deletions scripts/tcl_commands/magic.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,3 @@ proc erase_box {args} {
unset ::env(_tmp_mag_box_coordinates)
unset ::env(SAVE_GDS)
}

package provide openlane 0.9
25 changes: 0 additions & 25 deletions scripts/tcl_commands/pkgIndex.tcl

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/tcl_commands/placement.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,3 @@ proc run_resizer_design {args} {
puts_info "Skipping Placement Resizer Design Optimizations."
}
}

package provide openlane 0.9
3 changes: 0 additions & 3 deletions scripts/tcl_commands/routing.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,3 @@ proc run_resizer_timing_routing {args} {
puts_info "Skipping Global Routing Resizer Timing Optimizations."
}
}


package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/sta.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,3 @@ proc run_parasitics_sta {args} {
}
}
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/synthesis.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,3 @@ proc run_verilator {} {
puts_info "$warnings_count warnings found by linter"
}
}

package provide openlane 0.9
3 changes: 0 additions & 3 deletions scripts/utils/deflef_utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,3 @@ proc insert_buffer {args} {

incr ::env(INSERT_BUFFER_COUNTER)
}


package provide openlane_utils 0.9
3 changes: 0 additions & 3 deletions scripts/utils/fake_display_buffer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ proc fake_display_buffer {args} {
proc kill_display_buffer {args} {
exec killall Xvfb
}


package provide openlane_utils 0.9
25 changes: 0 additions & 25 deletions scripts/utils/pkgIndex.tcl

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/utils/utils.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -785,5 +785,3 @@ proc run_odbpy_script {args} {
try_exec $::env(OPENROAD_BIN) -exit -no_init -python {*}$args
unset ::env(PYTHONPATH)
}

package provide openlane_utils 0.9

0 comments on commit 70581ea

Please sign in to comment.