Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9697591
batch
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
batch
View Options
#!/bin/bash
# Copyright (C) 2015 Stefano Zacchiroli <zack@upsilon.cc>
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
export
https_proxy
=
"127.0.0.1:8118"
# use Tor
export
PYTHONPATH
=
`
pwd
`
DBNAME
=
github
DBCONN
=
"-p 5433"
psql
=
"psql
$DBCONN
--no-psqlrc --pset t --pset format=unaligned
${
DBNAME
}
"
BATCH_NO
=
"
$1
"
shift
if
[
-z
"
$BATCH_NO
"
]
;
then
echo
"Usage: batch MILLION_NO [ MIN_ID | continue ]"
exit
2
fi
MIN_ID
=
"
$1
"
shift
min_id
=
$
[
(
$BATCH_NO
-
1
)
*
1000000
+
1
]
max_id
=
$
[
$BATCH_NO
*
1000000
]
# allow min_id override on the command line
if
[
"
$MIN_ID
"
=
"continue"
]
;
then
last_id
=
$(
echo
"select max(id) from repos where
${
min_id
}
<= id and id <=
${
max_id
}
"
|
$psql
)
if
[
"
$last_id
"
-eq
"
$last_id
"
]
2
>
/dev/null
;
then
# is an integer?
echo
"Continuing from last known id
${
last_id
}
"
min_id
=
$last_id
fi
elif
[
-n
"
$MIN_ID
"
]
;
then
min_id
=
$
[
$MIN_ID
>
$min_id
?
$MIN_ID
:
$min_id
]
fi
cmd
=
"bin/ghlister list
${
min_id
}
-
${
max_id
}
"
echo
Running
$cmd
...
$cmd
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Tue, Aug 19, 12:17 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3368062
Attached To
rDLS Listers
Event Timeline
Log In to Comment