Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RadioHDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
RadioHDL
Merge requests
!1
L2 sdp 185
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
L2 sdp 185
L2SDP-185
into
master
Overview
0
Commits
4
Pipelines
0
Changes
2
Merged
Pieter Donker
requested to merge
L2SDP-185
into
master
4 years ago
Overview
0
Commits
4
Pipelines
0
Changes
2
Expand
Test if "quartus_config unb2b" works with changed source files in the build dir.
If source files in the build dir are newer a warning and a list with the newer files is print on the screen.
quartus_config is stopped without copying the source files.
A message is showing what to do.
0
0
Merge request reports
Compare
master
version 1
e4fde939
4 years ago
master (base)
and
latest version
latest version
352eab5d
4 commits,
4 years ago
version 1
e4fde939
3 commits,
4 years ago
2 files
+
79
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/hdl_libraries_wizard.py
+
78
−
2
Options
@@ -49,8 +49,8 @@
import
sys
import
fnmatch
from
os
import
listdir
,
walk
,
getenv
from
os.path
import
expandvars
,
isabs
,
join
,
isfile
from
os
import
listdir
,
walk
,
getenv
,
stat
from
os.path
import
expandvars
,
isabs
,
join
,
isfile
,
basename
,
exists
import
shutil
from
distutils.dir_util
import
copy_tree
from
argparse
import
ArgumentParser
@@ -567,6 +567,82 @@ class HdlLibrariesWizard:
print
(
"
Could not copy source {} to desination {}
"
.
format
(
sourcePathName
,
destinationPath
))
print
(
"
Copied {} files and {} directories for {} libraries
"
.
format
(
file_count
,
dir_count
,
lib_count
))
def
check_for_build_changes
(
self
,
build_type
,
lib_names
=
None
):
"""
Check all source directories and source files listed at the <tool_name>_copy_files key, if the file in
the build dir is younger than in the source dir, a warning is print on the screen and the script is stopped.
The build_type selects the <tool_name>_copy_files key using the <build_type>_tool_name key value
from the hdl_buildset_<buildset>.cfg.
The <tool_name>_copy_files key expects a source and a destination pair per listed directory or file:
- The sources need to be specified with absolute path or relative to the HDL library source directory
where the hdllib.cfg is stored
- The destinations need to be specified with absolute path or relative to HDL library build directory
where the project file (e.g. mpf, qpf) gets stored
Arguments:
- lib_names : zero or more HDL libraries
"""
if
lib_names
is
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_configfiles
(
key
=
'
hdl_lib_name
'
,
values
=
lib_names
)
tool_name_key
=
build_type
+
'
_tool_name
'
tool_name_value
=
self
.
buildset
[
tool_name_key
]
tool_name_copy_key
=
tool_name_value
+
'
_copy_files
'
build_file_newer
=
[]
for
lib_dict
in
lib_dicts
:
if
tool_name_copy_key
in
lib_dict
.
content
:
lib_path
=
lib_dict
.
location
build_dir_path
=
self
.
get_lib_build_dirs
(
build_type
,
lib_dicts
=
lib_dict
)
cm
.
mkdir
(
build_dir_path
)
key_values
=
lib_dict
[
tool_name_copy_key
].
split
()
sources
=
key_values
[
0
::
2
]
destinations
=
key_values
[
1
::
2
]
file_io
=
list
(
zip
(
sources
,
destinations
))
for
fpn_io
in
file_io
:
try
:
sourcePathName
=
cm
.
expand_file_path_name
(
fpn_io
[
0
],
lib_path
)
destinationPath
=
cm
.
expand_file_path_name
(
fpn_io
[
1
],
build_dir_path
)
if
sourcePathName
.
endswith
(
'
./
'
):
sourcePathName
=
sourcePathName
[:
-
3
]
if
destinationPath
.
endswith
(
'
.
'
):
destinationPath
=
destinationPath
[:
-
2
]
if
isfile
(
sourcePathName
):
destinationPath
=
join
(
destinationPath
,
basename
(
sourcePathName
))
if
exists
(
destinationPath
):
_stat
=
[
stat
(
sourcePathName
),
stat
(
destinationPath
)]
if
_stat
[
1
].
st_mtime
>
_stat
[
0
].
st_mtime
:
build_file_newer
.
append
(
destinationPath
)
else
:
if
exists
(
destinationPath
):
for
root
,
dirs
,
files
in
walk
(
sourcePathName
):
for
file
in
files
:
_src_file
=
join
(
root
,
file
)
_dst_file
=
destinationPath
+
_src_file
[
len
(
sourcePathName
):]
if
exists
(
_src_file
)
and
exists
(
_dst_file
):
#_stat = [stat(_src_file), stat(_dst_file)]
if
stat
(
_dst_file
).
st_mtime
>
stat
(
_src_file
).
st_mtime
:
build_file_newer
.
append
(
_dst_file
)
except
:
print
(
"
Could not check for changes for {}
"
.
format
(
sourcePathName
))
if
len
(
build_file_newer
)
>
0
:
print
(
""
)
print
(
"
########################################################################
"
)
print
(
""
)
#print(" ********************************************************************")
print
(
"
ERROR, some destination files are younger than source files
"
)
print
(
"
------------------------------------------------------------
"
)
print
(
""
)
print
(
"
The following files are newer in the destination(build) dir:
"
)
for
file
in
build_file_newer
:
print
(
"
{}
"
.
format
(
file
))
print
(
""
)
print
(
"
- Copy changed files to source dir or remove the files in the build dir.
"
)
print
(
"
- If done run this script again.
"
)
print
(
""
)
sys
.
exit
(
"
Stopped quartus_config
"
)
if
__name__
==
'
__main__
'
:
# Parse command line arguments
Loading