From 0a3a4845cae3f44585f3183d890a4c85161fe825 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 13 Jan 2015 22:34:37 +0100 Subject: reproducible: common.sh: split packages list in chunk of 100 items to avoid "Argument list too long" error --- bin/reproducible_common.sh | 22 ++++++++++++++-------- bin/reproducible_html_packages.py | 5 +++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 7497fe8b..6a8b7896 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -328,16 +328,22 @@ link_packages() { } process_packages() { - string='[' - delimiter='' - for PKG in $@ ; do - string+="${delimiter}\"${PKG}\"" - delimiter=',' - done - string+=']' CWD=$(pwd) cd /srv/jenkins/bin - python3 -c "from reproducible_html_packages import process_packages; process_packages(${string})" + for (( i=1; i<$#+1; i=i+100 )) ; do + string='[' + delimiter='' + for (( j=0; j<100; j++)) ; do + item=$(( $j+$i )) + if (( $item < $#+1 )) ; then + string+="${delimiter}\"${!item}\"" + delimiter=',' + fi + done + string+=']' + python3 -c "from reproducible_html_packages import process_packages; process_packages(${string}, no_clean=True)" + done + python3 -c "from reproducible_html_packages import purge_old_pages; purge_old_pages()" cd "$CWD" } diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index 64316127..944e4afc 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -112,7 +112,7 @@ def gen_extra_links(package, version): return (links, default_view) -def process_packages(packages): +def process_packages(packages, no_clean=False): """ generate the /rb-pkg/package.html page packages should be a list @@ -141,7 +141,8 @@ def process_packages(packages): write_html_page(title=title, body=html, destfile=destfile, noheader=True, nofooter=True, noendpage=True) log.info("Package page generated at " + desturl) - purge_old_pages() # housekeep is always good + if not no_clean: + purge_old_pages() # housekeep is always good def purge_old_pages(): -- cgit v1.2.3-70-g09d2