Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel393
Commits
9558c06d
Commit
9558c06d
authored
Sep 16, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. python 3 and 2 compatible
2. sorted list
parent
1af2fb90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
check_versions.py
check_versions.py
+11
-6
No files found.
check_versions.py
View file @
9558c06d
#!/usr/bin/env python
#!/usr/bin/env python
3
'''
'''
Copyright 2020, Elphel Inc.
Copyright 2020, Elphel Inc.
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: GPL-3.0-or-later
Author: Oleg Dzhimiev <oleg@elphel.com>
Author: Oleg Dzhimiev <oleg@elphel.com>
Description: C
heck software versions on th
e target
Description: C
ompares software versions between local GIT and hardwar
e target
'''
'''
import
json
import
json
...
@@ -69,8 +69,8 @@ def get_versions_from_target_quick(addr,tdir):
...
@@ -69,8 +69,8 @@ def get_versions_from_target_quick(addr,tdir):
shout
(
"scp -r "
+
addr
+
":"
+
tdir
+
" ."
)
shout
(
"scp -r "
+
addr
+
":"
+
tdir
+
" ."
)
remote_list
=
[]
remote_list
=
[]
for
f
in
os
.
listdir
(
ldir
):
for
f
in
sorted
(
os
.
listdir
(
ldir
)
):
with
open
(
ldir
+
"/"
+
f
,
'r'
)
as
content_file
:
with
open
(
ldir
+
"/"
+
f
,
'r'
)
as
content_file
:
content
=
content_file
.
read
()
content
=
content_file
.
read
()
remote_list
.
append
([
f
,
content
.
strip
()])
remote_list
.
append
([
f
,
content
.
strip
()])
...
@@ -99,8 +99,7 @@ def get_version_from_git(path,vfile):
...
@@ -99,8 +99,7 @@ def get_version_from_git(path,vfile):
#PR
#PR
cmd
=
"git rev-list --count $(git log -1 --pretty=format:
\"
%
H
\"
"
+
vfile
+
")..HEAD"
cmd
=
"git rev-list --count $(git log -1 --pretty=format:
\"
%
H
\"
"
+
vfile
+
")..HEAD"
p1
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
p1
=
subprocess
.
check_output
(
cmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
.
strip
()
.
decode
(
'utf-8'
)
p1
=
p1
.
strip
()
else
:
else
:
print
(
vfile
+
" file is missing in the project"
)
print
(
vfile
+
" file is missing in the project"
)
...
@@ -115,6 +114,9 @@ def deep_analysis(local,remote):
...
@@ -115,6 +114,9 @@ def deep_analysis(local,remote):
update_list
=
""
update_list
=
""
for
pl
,
vl
in
local
:
for
pl
,
vl
in
local
:
# pl is <class 'bytes'>
# vl is <class 'str'>
pl
=
pl
.
decode
(
'utf-8'
)
recstr
=
"{:<24}"
.
format
(
pl
)
+
"{:<16}"
.
format
(
vl
)
recstr
=
"{:<24}"
.
format
(
pl
)
+
"{:<16}"
.
format
(
vl
)
prfound
=
False
prfound
=
False
for
pr
,
vr
in
remote
:
for
pr
,
vr
in
remote
:
...
@@ -222,6 +224,9 @@ for p,v in Projects.items():
...
@@ -222,6 +224,9 @@ for p,v in Projects.items():
else
:
else
:
raise
Exception
(
"Unknown error"
)
raise
Exception
(
"Unknown error"
)
# sort [[a,va],[b,vb]] by key 0
local_list
=
sorted
(
local_list
,
key
=
lambda
x
:
x
[
0
])
#print(local_list)
#print(local_list)
deep_analysis
(
local_list
,
target_list
)
deep_analysis
(
local_list
,
target_list
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment