#!/bin/sh # Copyright © 2009-2018 Holger Levsen (holger@layer-acht.org) # Copyright © 2011-2017 Andreas Beckmann (anbe@debian.org) # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . @sharedir@/piuparts/lib/read_config.sh . @sharedir@/piuparts/lib/write_log.sh get_config_value MASTER global master-directory get_config_value HTDOCS global output-directory get_config_value SECTIONS global sections get_config_value URLBASE global urlbase https://piuparts.debian.org get_config_value DAYS global reschedule-untestable-days 7 ISSUE_LOG="$MASTER/archive_issues.txt" LOG_OUTPUT=$(mktemp) LOG_PREFIX=$(mktemp) STARTDATE=$(date -u +%s) # # detect packages which are/were untestable due to archive issue and mark them as such # LOGS=$(mktemp) URLS=$(mktemp) for SECTION in $SECTIONS ; do test -d $MASTER/$SECTION || continue URL_SED="s#$MASTER/$SECTION/fail#$URLBASE/$SECTION/untestable#" mkdir -p $MASTER/$SECTION/fail/ $MASTER/$SECTION/untestable/ $MASTER/$SECTION/recycle/ # '-mtime +0' actually means '24 hours or older' find $MASTER/$SECTION/fail -name '*.log' -mtime +0 | xargs -r \ grep -l -E "E: Broken packages|E: Unable to correct problems, you have held broken packages|E: Error, pkgProblemResolver::Resolve generated breaks" 2>/dev/null > $LOGS if [ -s $LOGS ]; then for package_log in $(cat $LOGS) do URL=$(echo "$package_log" | sed "$URL_SED") if ! grep -q "$URL" $ISSUE_LOG ; then # immediately recycle upon first appearance ln -f $package_log $MASTER/$SECTION/recycle/ fi mv $package_log $MASTER/$SECTION/untestable/ done sed "$URL_SED" $LOGS >> $URLS fi done if [ -s $URLS ]; then date >> $ISSUE_LOG cat $URLS >> $ISSUE_LOG FINALDATE=$(date -u +%s) RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T) ( echo "Broken packages detected! The following packages have been moved to" echo "$section/untestable and will be tested again in $DAYS days." echo echo "Broken packages are usually a temporary problem in the archive and are" echo "caught by other tools like britney or https://qa.debian.org/dose/debcheck.html" echo "If it is always the same package failing, it's likely to be an issue in the" echo "package." echo echo "Those problems were found in failed logs by grep'ing for these patterns:" echo " 'E: Broken packages'" echo " 'E: Unable to correct problems, you have held broken packages'" echo " 'E: Error, pkgProblemResolver::Resolve generated breaks'" echo ) > $LOG_PREFIX ( echo "$(date -u)" echo "Runtime: $RUNTIME" echo grep -f $URLS $ISSUE_LOG | sort | uniq -c | sort -rn echo ) > $LOG_OUTPUT publish_logs $LOG_OUTPUT $LOG_PREFIX $HTDOCS archive_issues fi rm $LOGS $URLS