Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Avoid failures for empty list
· 460575c3
Andreas Tille
authored
Mar 12, 2018
460575c3
Use python3-gitlab to fetch machine readable data from salsa: 1st step - get relevant blends groups
· 17f7b6d4
Andreas Tille
authored
Mar 12, 2018
17f7b6d4
Hide whitespace changes
Inline
Side-by-side
misc/machine_readable/fetch-machine-readable_salsa
View file @
17f7b6d4
...
...
@@ -47,11 +47,13 @@ list_salsa_projects () {
TOTAL_PAGES
=
$(
grep
^X-Total-Pages:
$HEADERS_FILE
)
TOTAL_PAGES
=
${
TOTAL_PAGES
#*
:
}
while
[
$PAGENO
-lt
$TOTAL_PAGES
]
do
PAGENO
=
$((
PAGENO+1
))
get_one_page
done
if
[
"
$TOTAL_PAGES
"
!=
""
]
;
then
while
[
$PAGENO
-lt
$TOTAL_PAGES
]
do
PAGENO
=
$((
PAGENO+1
))
get_one_page
done
fi
}
mkdir
-p
$TARGETDIR
...
...
misc/machine_readable/fetch-machine-readable_salsa.py
0 → 100755
View file @
17f7b6d4
#!/usr/bin/python3
import
gitlab
import
os
PER_PAGE
=
99
BLENDSGROUPS
=
[
'
Debian 3D Printing Team
'
,
'
Debian Accessibility Team
'
,
'
Debian Astro Team
'
,
'
Debian Edu Packaging Team
'
,
'
Debian Electronics
'
,
'
Debian Games
'
,
'
Debian GIS Project
'
,
'
Debian Hamradio Maintainers
'
,
'
Debian IoT
'
,
'
Debian Med
'
,
'
Debian Multimedia Team
'
,
'
Debian PhotoTools Team
'
,
'
Debian R Packages Maintainers
'
,
'
Debian Science Team
'
,
'
Debichem
'
]
def
get_blends_groups
():
blends_groups
=
[]
groups
=
gl
.
groups
.
list
(
all
=
True
)
for
group
in
groups
:
# print(group.attributes['name'])
if
group
.
attributes
[
'
name
'
]
in
BLENDSGROUPS
:
blends_groups
.
append
(
group
.
attributes
)
return
blends_groups
# SALSA_TOKEN=os.environ['SALSA_TOKEN']
gl
=
gitlab
.
Gitlab
(
"
https://salsa.debian.org
"
)
# , private_token=SALSA_TOKEN) # anonymous access is fine
blends_groups
=
get_blends_groups
()
for
group
in
blends_groups
:
print
(
group
[
'
name
'
],
group
[
'
id
'
],
group
[
'
path
'
],
group
[
'
description
'
],
group
[
'
full_name
'
])
#for project in git.getall(git.getprojects):
# print(project['name'], project['path_with_namespace'], project['id'])
# getrawfile(project['id'], 'master', 'debian/changelog')
# getfile(project['id'], 'debian/changelog', 'master')
\ No newline at end of file