Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Seblu
installsystems
Commits
a4191c84
Commit
a4191c84
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
move md5sum into tools module
parent
26e8f22f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
installsystems/image.py
+2
-8
2 additions, 8 deletions
installsystems/image.py
installsystems/tools.py
+6
-0
6 additions, 0 deletions
installsystems/tools.py
with
8 additions
and
8 deletions
installsystems/image.py
+
2
−
8
View file @
a4191c84
...
...
@@ -51,12 +51,6 @@ class Image(object):
return
os
.
path
.
join
(
os
.
path
.
abspath
(
d
),
name
)
return
None
def
md5_checksum
(
self
,
path
):
'''
Compute md5 of a file
'''
m
=
hashlib
.
md5
()
m
.
update
(
open
(
path
,
"
r
"
).
read
())
return
m
.
hexdigest
()
class
SourceImage
(
Image
):
'''
Image source manipulation class
'''
...
...
@@ -239,7 +233,7 @@ class SourceImage(Image):
arrow
(
"
Compute MD5 of %s
"
%
dt
,
2
,
self
.
verbose
)
path
=
os
.
path
.
join
(
self
.
base_path
,
dt
)
desc
[
"
data
"
][
dt
]
=
{
"
size
"
:
os
.
path
.
getsize
(
path
),
"
md5
"
:
self
.
md5_check
sum
(
path
)
}
"
md5
"
:
istools
.
md5
sum
(
path
)
}
# create file
filedesc
=
StringIO
.
StringIO
()
# serialize
...
...
@@ -294,7 +288,7 @@ class PackageImage(Image):
for
databall
in
databalls
:
arrow
(
databall
,
2
,
self
.
verbose
)
md5_meta
=
databalls
[
databall
][
"
md5
"
]
md5_file
=
self
.
md5_check
sum
(
os
.
path
.
join
(
self
.
base_path
,
databall
))
md5_file
=
istools
.
md5
sum
(
os
.
path
.
join
(
self
.
base_path
,
databall
))
if
md5_meta
!=
md5_file
:
raise
Exception
(
"
Invalid md5: %s
"
%
databall
)
...
...
This diff is collapsed.
Click to expand it.
installsystems/tools.py
+
6
−
0
View file @
a4191c84
...
...
@@ -9,6 +9,12 @@ InstallSystems Generic Tools Library
import
os
from
installsystems.image
import
Image
def
md5sum
(
self
,
path
):
'''
Compute md5 of a file
'''
m
=
hashlib
.
md5
()
m
.
update
(
open
(
path
,
"
r
"
).
read
())
return
m
.
hexdigest
()
def
cp
(
self
,
source
,
destination
):
'''
Copy a source to destination. Take care of path type
'''
stype
=
path_type
(
source
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment