diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/profile.py | 59 | ||||
-rwxr-xr-x | tools/release.sh | 56 | ||||
-rwxr-xr-x | tools/test-github.sh | 43 |
3 files changed, 158 insertions, 0 deletions
diff --git a/tools/profile.py b/tools/profile.py new file mode 100644 index 0000000..7f98a13 --- /dev/null +++ b/tools/profile.py @@ -0,0 +1,59 @@ +# +# parse the output of "dracut --profile" and produce profiling information +# +# Copyright 2011 Harald Hoyer <harald@redhat.com> +# Copyright 2011 Red Hat, Inc. All rights reserved. +# +# 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 <http://www.gnu.org/licenses/>. +# + +import sys +import operator +import re +loglines = sys.stdin + +logpats = r'[+]+[ \t]+([^ \t]+)[ \t]+([^ \t:]+):[ ]+.*' + +logpat = re.compile(logpats) + +groups = (logpat.match(line) for line in loglines) +tuples = (g.groups() for g in groups if g) + +def gen_times(t): + oldx=None + for x in t: + fx=float(x[0]) + if oldx: + #print fx - float(oldx[0]), x[0], x[1], oldx[0], oldx[1] + if ((fx - float(oldx[0])) > 0): + yield (fx - float(oldx[0]), oldx[1]) + + oldx = x + +colnames = ('time','line') + +log = (dict(zip(colnames,t)) for t in gen_times(tuples)) + +if __name__ == '__main__': + e={} + for x in log: + if not x['line'] in e: + e[x['line']] = x['time'] + else: + e[x['line']] += x['time'] + + sorted_x = sorted(e.iteritems(), key=operator.itemgetter(1), reverse=True) + for x in sorted_x: + print x[0], x[1] + diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 0000000..b6f7826 --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# CONTRIBUTORS +make CONTRIBUTORS > _CONTRIBUTORS +if [ ! -s _CONTRIBUTORS ]; then + # no CONTRIBUTORS means no need to make a release + # exit without populating new_version + exit 0 +fi + +if [ -z "$1" ]; then + LAST_VERSION=$(git describe --abbrev=0 --tags --always 2> /dev/null) + NEW_VERSION=$(echo "$LAST_VERSION" | awk '{print ++$1}') + if [ "$NEW_VERSION" -lt 100 ]; then + NEW_VERSION="0$NEW_VERSION" + fi +else + NEW_VERSION="$1" +fi + +printf "#### Contributors\n\n" > CONTRIBUTORS.md +cat _CONTRIBUTORS >> CONTRIBUTORS.md + +# Update AUTHORS +make AUTHORS + +# Update NEWS.md +cargo install clog-cli +head -2 NEWS.md > NEWS_header.md +tail +2 NEWS.md > NEWS_body.md +printf "dracut-%s\n==========\n" "$NEW_VERSION" > NEWS_header_new.md +cat CONTRIBUTORS.md NEWS_body.md > NEWS_body_with_conttributors.md + +# clog will always output both the new release and old release information together +clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracutdevs/dracut | sed '1,2d' > NEWS_body_full.md + +# Use diff to separate new release information and remove repeated empty lines +diff NEWS_body_with_conttributors.md NEWS_body_full.md | grep -e ^\>\ | sed s/^\>\ // | cat -s > NEWS_body_new.md +cat NEWS_header.md NEWS_header_new.md NEWS_body_new.md NEWS_body_with_conttributors.md > NEWS.md + +# message for https://github.com/dracutdevs/dracut/releases/tag +cat -s NEWS_body_new.md CONTRIBUTORS.md > release.md + +# dracut-version.sh +printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$NEW_VERSION" > dracut-version.sh + +# Check in AUTHORS and NEWS.md +git config user.name "Dracut Release Bot" +git config user.email "<>" +git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS dracut-version.sh +git push origin master +git tag "$NEW_VERSION" -m "$NEW_VERSION" +git push --tags + +# export new version to Github Action +echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}" diff --git a/tools/test-github.sh b/tools/test-github.sh new file mode 100755 index 0000000..4fed092 --- /dev/null +++ b/tools/test-github.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -ex + +[[ -d ${0%/*} ]] && cd "${0%/*}"/../ + +RUN_ID="$1" +TESTS=$2 + +./configure + +NCPU=$(getconf _NPROCESSORS_ONLN) + +if ! [[ $TESTS ]]; then + # GitHub workflows fetch a clone of the dracut repository which doesn't + # contain git tags, thus "breaking" the RPM build in certain situations + # i.e.: + # DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`, + # which in full git clone returns a tag with a numeric version. However, + # without tags it returns SHA of the last commit, which later propagates into + # `Provides:` attribute of the built RPM and can break dependency tree when + # installed + [[ -d .git ]] && git fetch --tags && git describe --tags + make -j "$NCPU" all syncheck rpm logtee +else + make -j "$NCPU" enable_documentation=no all logtee + + cd test + + # shellcheck disable=SC2012 + time LOGTEE_TIMEOUT_MS=590000 make \ + enable_documentation=no \ + KVERSION="$( + cd /lib/modules + ls -1 | tail -1 + )" \ + QEMU_CPU="IvyBridge-v2" \ + DRACUT_NO_XATTR=1 \ + TEST_RUN_ID="$RUN_ID" \ + ${TESTS:+TESTS="$TESTS"} \ + -k V=1 \ + check +fi |