Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-lister
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Antoine R. Dumont
swh-lister
Commits
0e7fdf48
Commit
0e7fdf48
authored
1 year ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
crates: Don't extract unused files
The files we use weigh 440MB, and there are ~600MB of files we don't use
parent
e0bcb64e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/lister/crates/lister.py
+9
-4
9 additions, 4 deletions
swh/lister/crates/lister.py
with
9 additions
and
4 deletions
swh/lister/crates/lister.py
+
9
−
4
View file @
0e7fdf48
...
...
@@ -121,15 +121,20 @@ class CratesLister(Lister[CratesListerState, CratesListerPage]):
# Extract the Db dump
db_dump_path
=
Path
(
str
(
archive_path
).
split
(
"
.tar.gz
"
)[
0
])
tar
=
tarfile
.
open
(
archive_path
)
tar
.
extractall
(
path
=
db_dump_path
)
tar
.
close
()
members_to_extract
=
[]
with
tarfile
.
open
(
archive_path
)
as
tf
:
for
member
in
tf
.
getmembers
():
if
member
.
name
.
endswith
(
(
"
/data/crates.csv
"
,
"
/data/versions.csv
"
,
"
/metadata.json
"
)
):
members_to_extract
.
append
(
member
)
tf
.
extractall
(
members
=
members_to_extract
,
path
=
db_dump_path
)
csv
.
field_size_limit
(
1000000
)
(
crates_csv_path
,)
=
list
(
db_dump_path
.
glob
(
"
*/data/crates.csv
"
))
(
versions_csv_path
,)
=
list
(
db_dump_path
.
glob
(
"
*/data/versions.csv
"
))
(
index_metadata_json_path
,)
=
list
(
db_dump_path
.
rglob
(
"
*metadata.json
"
))
(
index_metadata_json_path
,)
=
list
(
db_dump_path
.
rglob
(
"
*
/
metadata.json
"
))
with
index_metadata_json_path
.
open
(
"
rb
"
)
as
index_metadata_json
:
self
.
index_metadata
=
json
.
load
(
index_metadata_json
)
...
...
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