From: Amos Jeffries Date: Thu, 30 Oct 2014 11:32:29 +0000 (-0700) Subject: Source Maintenance: Add checks for copyright blurbs X-Git-Tag: merge-candidate-3-v1~523 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9549c27991260760d2d8e3db160378d3d3f3f8d;p=thirdparty%2Fsquid.git Source Maintenance: Add checks for copyright blurbs * Check for copyright blurbs in repository files. * Allow skipping of third-party and binary files. * Add copyright blurb to auto-generated files created by maintenance script. --- diff --git a/scripts/source-maintenance.sh b/scripts/source-maintenance.sh index 8e2ce05611..6baf589e4e 100755 --- a/scripts/source-maintenance.sh +++ b/scripts/source-maintenance.sh @@ -54,6 +54,7 @@ bzr grep --no-recursive "ifn?def .*_SQUID_" | # Scan for file-specific actions # for FILENAME in `bzr ls --versioned`; do + skip_copyright_check="" case ${FILENAME} in @@ -154,10 +155,20 @@ for FILENAME in `bzr ls --versioned`; do mv ${FILENAME}.styled ${FILENAME} ;; + */ChangeLog|*.list|*.png|*.po|*.pot|*.txt|*test-suite/squidconf/empty) + # we do not enforce copyright blurbs in: + # + # images, + # translation PO/POT + # auto-generated .list files, + # (imported) plain-text documentation files and ChangeLogs + # + skip_copyright_check=1 + ;; esac # check for Foundation copyright blurb - if test -f ${PWD}/${FILENAME}; then + if test -f ${PWD}/${FILENAME} -a "x$skip_copyright_check" = "x"; then BLURB=`grep "The Squid Software Foundation and contributors" ${FILENAME}`; if test "x${BLURB}" = "x"; then echo "CHECK COPYRIGHT for ${PWD}/${FILENAME}" @@ -176,20 +187,24 @@ done } # Build XPROF types file from current sources -echo "#ifndef _PROFILER_XPROF_TYPE_H_" >${ROOT}/lib/profiler/list -echo "#define _PROFILER_XPROF_TYPE_H_" >>${ROOT}/lib/profiler/list -echo "/* AUTO-GENERATED FILE */" >>${ROOT}/lib/profiler/list -echo "#if USE_XPROF_STATS" >>${ROOT}/lib/profiler/list -echo "typedef enum {" >>${ROOT}/lib/profiler/list -echo "XPROF_PROF_UNACCOUNTED," >>${ROOT}/lib/profiler/list -grep -R -h "PROF_start.*" ./* | grep -v probename | sed -e 's/ //g; s/PROF_start(/XPROF_/; s/);/,/' | sort -u >>${ROOT}/lib/profiler/list -echo " XPROF_LAST } xprof_type;" >>${ROOT}/lib/profiler/list -echo "#endif" >>${ROOT}/lib/profiler/list -echo "#endif" >>${ROOT}/lib/profiler/list +( +cat scripts/boilerplate.h +echo "#ifndef _PROFILER_XPROF_TYPE_H_" +echo "#define _PROFILER_XPROF_TYPE_H_" +echo "/* AUTO-GENERATED FILE */" +echo "#if USE_XPROF_STATS" +echo "typedef enum {" +echo " XPROF_PROF_UNACCOUNTED," +grep -R -h "PROF_start.*" ./* | grep -v probename | sed -e 's/ //g; s/PROF_start(/XPROF_/; s/);/,/' | sort -u +echo " XPROF_LAST } xprof_type;" +echo "#endif" +echo "#endif" +) >${ROOT}/lib/profiler/list mv ${ROOT}/lib/profiler/list ${ROOT}/lib/profiler/xprof_type.h # Build icons install include from current icons available ( +sed -e 's%\ \*%##%' -e 's%/\*%##%' -e 's%##/%##%' ${ROOT}/icons/list +)| sed s%${ROOT}/icons/%%g >${ROOT}/icons/icon.list # Build templates install include from current templates available ( +sed -e 's%\ \*%##%' -e 's%/\*%##%' -e 's%##/%##%' ${ROOT}/doc/debug-sections.tmp srcformat || exit 1 -sort -u <${ROOT}/doc/debug-sections.tmp | sort -n >${ROOT}/doc/debug-sections.txt -rm ${ROOT}/doc/debug-sections.tmp +sort -u <${ROOT}/doc/debug-sections.tmp | sort -n >${ROOT}/doc/debug-sections.tmp2 +cat scripts/boilerplate.h ${ROOT}/doc/debug-sections.tmp2 >${ROOT}/doc/debug-sections.txt +rm ${ROOT}/doc/debug-sections.tmp ${ROOT}/doc/debug-sections.tmp2