[Piuparts-devel] [Git][debian/piuparts][develop] 2 commits: rename variable

Holger Levsen gitlab at salsa.debian.org
Wed Nov 28 16:35:53 GMT 2018


Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
bb7d3add by Holger Levsen at 2018-11-28T16:19:54Z
rename variable

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
e7999f03 by Holger Levsen at 2018-11-28T16:35:37Z
add support for daily prefix text (to not repeat meta-information in the logs)

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


7 changed files:

- lib/write_log.sh
- master-bin/detect_archive_issues.in
- master-bin/detect_network_issues.in
- master-bin/detect_piuparts_issues.in
- master-bin/master_shell_runner.in
- master-bin/reschedule_oldest_logs.in
- master-bin/rotate_master_logs.in


Changes:

=====================================
lib/write_log.sh
=====================================
@@ -18,14 +18,19 @@
 #
 
 publish_logs() {
-	local TEMPORARY_OUTPUT=$1
-	local HTDOCS="$2"
-	local LOG=$3
+	local LOG_OUTPUT=$1
+	local LOG_PREFIX=$2
+	local HTDOCS="$3"
+	local LOG=$4
 	local YEAR=$(date -u +%Y)
 	local MONTH=$(date -u +%m)
 	local DAY=$(date -u +%d)
 	local DIR="$HTDOCS/logs/$YEAR/$MONTH/$DAY"
 	mkdir -p "$DIR"
-	cat $TEMPORARY_OUTPUT >> "$DIR/$LOG.txt"
-	rm -f $TEMPORARY_OUTPUT >/dev/null
+	if [ -n "$LOG_PREFIX" ] && [ ! -s "$DIR/$LOG.txt" ] ; then
+		cat $LOG_PREFIX >> "$DIR/$LOG.txt"
+		rm -f $LOG_PREFIX >/dev/null
+	fi
+	cat $LOG_OUTPUT >> "$DIR/$LOG.txt"
+	rm -f $LOG_OUTPUT >/dev/null
 }


=====================================
master-bin/detect_archive_issues.in
=====================================
@@ -27,7 +27,8 @@ 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"
-TEMPORARY_OUTPUT=`mktemp`
+LOG_OUTPUT=`mktemp`
+LOG_PREFIX=$(mktemp)
 
 STARTDATE=$(date -u +%s)
 
@@ -63,9 +64,6 @@ if [ -s $URLS ]; then
 	FINALDATE=$(date -u +%s)
 	RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T)
 	(
-		echo "$(date -u)"
-		echo "Runtime: $RUNTIME"
-		echo
 		echo "Broken packages detected! The following packages have been moved to"
 		echo "$section/untestable and will be tested again in $DAYS days."
 		echo
@@ -74,14 +72,19 @@ if [ -s $URLS ]; then
 		echo "If it is always the same package failing, it's likely to be an issue in the"
 		echo "package."
 		echo
-		grep -f $URLS $ISSUE_LOG | sort | uniq -c | sort -rn
-		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
-	) > $TEMPORARY_OUTPUT
-	publish_logs $TEMPORARY_OUTPUT $HTDOCS archive_issues
+	) > $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


=====================================
master-bin/detect_network_issues.in
=====================================
@@ -25,7 +25,8 @@ get_config_value SECTIONS global sections
 get_config_value HTDOCS global output-directory
 
 STARTDATE=$(date -u +%s)
-TEMPORARY_OUTPUT=$(mktemp)
+LOG_OUTPUT=$(mktemp)
+LOG_PREFIX=$(mktemp)
 
 #
 # detect network/mirror problems
@@ -75,12 +76,17 @@ done
 if [ -s $FILE ] ; then
 	FINALDATE=$(date -u +%s)
 	RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T)
+	(
+		echo "Network problems detected! The following logfiles have been deleted:"
+		echo
+		echo "Those problems were found in failed logs by grep'ing for these patterns:"
+		echo "$DISPLAY_PATTERN"
+		echo
+	) > $LOG_PREFIX
 	(
 		echo "$(date -u)"
 		echo "Runtime: $RUNTIME"
 		echo
-		echo "Network problems detected! The following logfiles have been deleted:"
-		echo
 		for log in $(sort -u $FILE)
 		do
 			echo "$log" | cut -d "/" -f5-
@@ -88,9 +94,7 @@ if [ -s $FILE ] ; then
 			rm -f "$log"
 		done
 		echo
-		echo "Those problems were found in failed logs by grep'ing for these patterns:"
-		echo "$DISPLAY_PATTERN"
-	) > $TEMPORARY_OUTPUT
-	publish_logs $TEMPORARY_OUTPUT $HTDOCS network_issues
+	) > $LOG_OUTPUT
+	publish_logs $LOG_OUTPUT $LOG_PREFIX $HTDOCS network_issues
 fi
 rm $FILE


=====================================
master-bin/detect_piuparts_issues.in
=====================================
@@ -25,7 +25,8 @@ get_config_value SECTIONS global sections
 get_config_value HTDOCS global output-directory
 
 STARTDATE=$(date -u +%s)
-TEMPORARY_OUTPUT=$(mktemp)
+LOG_OUTPUT=$(mktemp)
+LOG_PREFIX=$(mktemp)
 
 #
 # detect piuparts problems
@@ -99,13 +100,18 @@ if [ -s $FILE ] ; then
 	FINALDATE=$(date -u +%s)
 	RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T)
 	(
-		echo "$(date -u)"
-		echo "Runtime: $RUNTIME"
-		echo
 		echo "piuparts problems detected! Please review the following logfiles/packages."
 		echo "If it is always the same package failing, it's likely to be an issue in the"
 		echo "package."
 		echo
+		echo "Problems were found in failed logs by grep'ing for these patterns:"
+		echo "$DISPLAY_PATTERN"
+		echo
+	) > $LOG_PREFIX
+	(
+		echo "$(date -u)"
+		echo "Runtime: $RUNTIME"
+		echo
 		echo "The following logfiles have been deleted:"
 		echo
 		for log in $(sort -u $FILE)
@@ -116,10 +122,7 @@ if [ -s $FILE ] ; then
 			rm -f "$log"
 		done
 		echo
-		echo "Those problems were found in failed logs by grep'ing for these patterns:"
-		echo "$DISPLAY_PATTERN"
-		echo
-	) > $TEMPORARY_OUTPUT
-	publish_logs $TEMPORARY_OUTPUT $HTDOCS piuparts_issues
+	) > $LOG_OUTPUT
+	publish_logs $LOG_OUTPUT $LOG_PREFIX $HTDOCS piuparts_issues
 fi
 rm $FILE


=====================================
master-bin/master_shell_runner.in
=====================================
@@ -20,7 +20,7 @@
 
 get_config_value HTDOCS global output-directory
 
-TEMPORARY_OUTPUT=$(mktemp)
+LOG_OUTPUT=$(mktemp)
 
-$1 >$TEMPORARY_OUTPUT 2>&1
-publish_logs $TEMPORARY_OUTPUT $HTDOCS $1
+$1 >$LOG_OUTPUT 2>&1
+publish_logs $LOG_OUTPUT "" $HTDOCS $1


=====================================
master-bin/reschedule_oldest_logs.in
=====================================
@@ -26,7 +26,7 @@ get_config_value HTDOCS global output-directory
 
 STARTDATE=$(date -u +%s)
 OUTPUT=$(mktemp)
-TEMPORARY_OUTPUT=$(mktemp)
+LOG_OUTPUT=$(mktemp)
 
 #
 # reschedule 200 oldest log files, if they are older than 180 days
@@ -41,7 +41,6 @@ get_config_value COUNT      global reschedule-old-count 200
 get_config_value EXPIRE_FAIL_AGE global expire-fail-days 0
 get_config_value FAIL_AGE   global reschedule-fail-days 30
 get_config_value FAIL_COUNT global reschedule-fail-count 25
-
 get_config_value AUTO_RESCHEDULE	global auto-reschedule yes
 
 
@@ -208,7 +207,9 @@ RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T)
 	fi
 	echo
 	cat $OUTPUT
+	echo "##################################################################################################################" >> $OUTPUT
+	echo "##################################################################################################################" >> $OUTPUT
 	echo
-) > $TEMPORARY_OUTPUT
-publish_logs $TEMPORARY_OUTPUT $HTDOCS reschedule_oldest_logs
+) > $LOG_OUTPUT
+publish_logs $LOG_OUTPUT "" $HTDOCS reschedule_oldest_logs
 rm -f $OUTPUT


=====================================
master-bin/rotate_master_logs.in
=====================================
@@ -52,11 +52,11 @@ for SECTION in $SECTIONS ; do
 done
 
 if [ -s $OUTPUT ] ; then
-	TEMPORARY_OUTPUT=$(mktemp)
-	echo "$(date -u)" > $TEMPORARY_OUTPUT
-	echo >> $TEMPORARY_OUTPUT
-	cat $OUTPUT >> $TEMPORARY_OUTPUT
-	echo >> $TEMPORARY_OUTPUT
-	publish_logs $TEMPORARY_OUTPUT $HTDOCS rotate_master_logs
+	LOG_OUTPUT=$(mktemp)
+	echo "$(date -u)" > $LOG_OUTPUT
+	echo >> $LOG_OUTPUT
+	cat $OUTPUT >> $LOG_OUTPUT
+	echo >> $LOG_OUTPUT
+	publish_logs $LOG_OUTPUT "" $HTDOCS rotate_master_logs
 fi
 rm $OUTPUT



View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/9f404e337006066ca21fb219b26937ab127f7f69...e7999f0334da06310ebf4d061384142c52ae7ade

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/9f404e337006066ca21fb219b26937ab127f7f69...e7999f0334da06310ebf4d061384142c52ae7ade
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20181128/09f47397/attachment-0001.html>


More information about the Piuparts-devel mailing list