Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
a24a7fe5
Commit
a24a7fe5
authored
Aug 06, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for sha256 checksum
parent
ef8da067
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
docs/new_packages.md
docs/new_packages.md
+5
-1
packages/pytz/meta.yaml
packages/pytz/meta.yaml
+1
-1
tools/buildpkg.py
tools/buildpkg.py
+9
-4
No files found.
docs/new_packages.md
View file @
a24a7fe5
...
...
@@ -67,7 +67,11 @@ The tarball may be in any of the formats supported by Python's
#### `source/md5`
The MD5 checksum of the tarball. (TODO: More hash types should be supported in the future).
The MD5 checksum of the tarball. It is recommended to use SHA256 instead of MD5.
#### `source/sha256`
The SHA256 checksum of the tarball. It is recommended to use SHA256 instead of MD5.
#### `source/patches`
...
...
packages/pytz/meta.yaml
View file @
a24a7fe5
...
...
@@ -4,7 +4,7 @@ package:
source
:
url
:
https://files.pythonhosted.org/packages/10/76/52efda4ef98e7544321fd8d5d512e11739c1df18b0649551aeccfb1c8376/pytz-2018.4.tar.gz
md5
:
f054437920c895dd14a4509fabafe02
9
sha256
:
c06425302f2cf668f1bba7a0a03f3c1d34d4ebeef2c72003da308b3947c7f74
9
patches
:
-
patches/dummy-threading.patch
tools/buildpkg.py
View file @
a24a7fe5
...
...
@@ -21,11 +21,16 @@ def check_checksum(path, pkg):
"""
Checks that a tarball matches the checksum in the package metadata.
"""
if
'md5'
not
in
pkg
[
'source'
]:
checksum_keys
=
{
'md5'
,
'sha256'
}.
intersection
(
pkg
[
'source'
])
if
not
checksum_keys
:
return
checksum
=
pkg
[
'source'
][
'md5'
]
elif
len
(
checksum_keys
)
!=
1
:
raise
ValueError
(
'Only one checksum should be included in a package '
'setup; found {}.'
.
format
(
checksum_keys
))
checksum_algorithm
=
checksum_keys
.
pop
()
checksum
=
pkg
[
'source'
][
checksum_algorithm
]
CHUNK_SIZE
=
1
<<
16
h
=
hashlib
.
md5
()
h
=
getattr
(
hashlib
,
checksum_algorithm
)
()
with
open
(
path
,
'rb'
)
as
fd
:
while
True
:
chunk
=
fd
.
read
(
CHUNK_SIZE
)
...
...
@@ -33,7 +38,7 @@ def check_checksum(path, pkg):
if
len
(
chunk
)
<
CHUNK_SIZE
:
break
if
h
.
hexdigest
()
!=
checksum
:
raise
ValueError
(
"Invalid
checksum"
)
raise
ValueError
(
"Invalid
{} checksum"
.
format
(
checksum_algorithm
)
)
def
download_and_extract
(
buildpath
,
packagedir
,
pkg
,
args
):
...
...
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