Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Waiting for Salsa 1800 seconds
· 65af41e3
Andreas Tille
authored
Jul 11, 2018
65af41e3
Now try all teams
· bf7d8f83
Andreas Tille
authored
Jul 11, 2018
bf7d8f83
Hide whitespace changes
Inline
Side-by-side
misc/machine_readable/fetch-machine-readable_salsa.py
View file @
bf7d8f83
...
...
@@ -37,7 +37,7 @@ BLENDSGROUPS={ 'Debian 3D Printing Team' : '3dprinter'
# FIXME: Debian Perl Group is listed with only 2 projects which is definitely wrong
# just start with one team
BLENDSGROUPS
=
{
'
Debian Med
'
:
'
debian-med
'
}
#
BLENDSGROUPS={ 'Debian Med' : 'debian-med'}
debianmetadata
=
[
'
changelog
'
,
'
control
'
,
...
...
@@ -54,7 +54,7 @@ READMEDEBIANARCHIVE='/srv/blends.debian.org/www/_'+TDNAME+'/README.Debian.tar.xz
TARGETDIR
=
os
.
path
.
join
(
os
.
environ
[
'
HOME
'
],
TDNAME
)
SLEEPTIME
=
1
SLEEPUNTILRETRY
=
36
00
SLEEPUNTILRETRY
=
18
00
debug
=
0
# do not clean dirs. FIXME: Find a method to detect removed repositories and clean this up here
...
...
@@ -63,6 +63,10 @@ try:
except
:
pass
def
wait_for_salsa
():
time
.
sleep
(
SLEEPUNTILRETRY
)
print
(
"
Received GitlabGetError: 429 - Retry later ... waiting for %i seconds
"
%
SLEEPUNTILRETRY
)
def
get_blends_groups
():
blends_groups
=
[]
groups
=
gl
.
groups
.
list
(
all
=
True
,
order_by
=
'
name
'
,
sort
=
'
asc
'
)
...
...
@@ -87,8 +91,7 @@ def output_metadata(subdir, metadata):
try
:
file_info
=
project
.
repository_blob
(
item
[
'
id
'
])
except
gitlab
.
exceptions
.
GitlabGetError
:
time
.
sleep
(
SLEEPUNTILRETRY
)
print
(
"
Received GitlabGetError: 429 - Retry later ... waiting for %i seconds
"
%
SLEEPUNTILRETRY
)
wait_for_salsa
()
file_info
=
project
.
repository_blob
(
item
[
'
id
'
])
content
=
base64
.
b64decode
(
file_info
[
'
content
'
])
if
item
[
'
name
'
]
==
'
metadata
'
:
...
...
@@ -117,7 +120,11 @@ for group in blends_groups:
# projects = group.projects.list(page=1, per_page=10, order_by='name', sort='asc')
print
(
"
%s has %i projects (Blend name %s)
"
%
(
group
.
attributes
[
'
name
'
],
len
(
projects
),
blend
))
# group.attributes['id'], group.attributes['path']) # , group.attributes['description'], group.attributes['full_name'])
for
pr
in
projects
:
project
=
gl
.
projects
.
get
(
pr
.
attributes
[
'
id
'
])
# without this extra get repository_tree() fails
try
:
project
=
gl
.
projects
.
get
(
pr
.
attributes
[
'
id
'
])
# without this extra get repository_tree() fails
except
gitlab
.
exceptions
.
GitlabGetError
:
wait_for_salsa
()
project
=
gl
.
projects
.
get
(
pr
.
attributes
[
'
id
'
])
# without this extra get repository_tree() fails
name
=
project
.
attributes
[
'
name
'
]
namedir
=
os
.
path
.
join
(
TARGETDIR
,
name
[
0
])
if
not
os
.
path
.
exists
(
namedir
):
...
...