diff options
| author | Carlos Maiolino <[email protected]> | 2026-05-02 14:09:27 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2026-05-02 14:09:27 +0200 |
| commit | 296c6b9ee85209c0ce375717e30686545baea107 (patch) | |
| tree | f0da71650e8f58ca528589ad4e39476732fa5b88 /maintainer_old | |
| parent | b2e1a1cb259e482720430ff9898d2e564ee73d0f (diff) | |
Diffstat (limited to 'maintainer_old')
| -rwxr-xr-x | maintainer_old/checkpatch.awk | 251 | ||||
| -rwxr-xr-x | maintainer_old/checkpatch/checkpatch.py | 8 | ||||
| -rwxr-xr-x | maintainer_old/checkpatch/checkpatch.sh | 52 | ||||
| -rwxr-xr-x | maintainer_old/djwong-git | 41 | ||||
| -rwxr-xr-x | maintainer_old/git-announce | 170 | ||||
| -rwxr-xr-x | maintainer_old/git-checkpatch | 36 | ||||
| -rwxr-xr-x | maintainer_old/pr-create.sh | 106 | ||||
| -rwxr-xr-x | maintainer_old/xfs-release.sh | 118 | ||||
| -rwxr-xr-x | maintainer_old/xfsdump_release.sh | 303 | ||||
| -rwxr-xr-x | maintainer_old/xfsprogs-summary.sh | 81 | ||||
| -rwxr-xr-x | maintainer_old/xfsprogs_release.sh | 303 |
11 files changed, 1469 insertions, 0 deletions
diff --git a/maintainer_old/checkpatch.awk b/maintainer_old/checkpatch.awk new file mode 100755 index 0000000..fd363e3 --- /dev/null +++ b/maintainer_old/checkpatch.awk @@ -0,0 +1,251 @@ +#!/usr/bin/awk + +# Scan a patch for correctness, according to XFS/iomap rules. +# +# Pass the commit id as the variable "commit_id" and the git log --oneline +# output as "oneline" for report generation. + +function getval(key) { + realkey = sprintf("%s: ", key) + keylen = length(realkey) + + if (substr($0, 0, keylen) != realkey) + return 0 + return substr($0, keylen + 1) +} + +function is_me(val, my_signature, dead_signature) +{ + if (val == my_signature) + return 1 + if (dead_signature != 0 && val == dead_signature) + return 1 + return 0 +} + +function commit_error(why) +{ + if (!commit_errored) + printf("%s\n", oneline) > "/dev/stderr" + + printf(" - %s\n", why) > "/dev/stderr" + commit_errored = 1 +} + +function commit_error_end(why) +{ + if (commit_errored) + printf("\n") > "/dev/stderr" +} + +function prog_error(why) +{ + printf("%s: %s\n", commit_id, why) > "/dev/stderr" +} + +BEGIN { + ret = 0 + commit_errored = 0 + + if (length(commit_id) == 0) { + printf("Commit id not supplied.") > "/dev/stderr" + ret = 2 + exit + } + + if (length(oneline) == 0) { + prog_error("Commit oneline not supplied.") + ret = 2 + exit + } + + if (("git config user.name" | getline name) < 0) { + prog_error("%s: Can't get git user.name.") + ret = 2 + exit + } + + if (("git config user.email" | getline email) < 0) { + prog_error("%s: Can't get git user.email.") + ret = 2 + exit + } + + if (("git config core.abbrev" | getline abbrev_len) < 0) { + prog_error("%s: Can't get git core.abbrev.") + ret = 2 + exit + } + + if (abbrev_len <= 0) + abbrev_len = 12 + + ("git config user.deadname" | getline dead_name) + ("git config user.deademail" | getline dead_email) + + if (length(dead_name) > 0 && length(dead_email) == 0) { + dead_email = email + } + if (length(dead_email) > 0 && length(dead_name) == 0) { + dead_name = name + } + + if (("git config --type bool user.devtree" | getline dev_tree) < 0) { + dev_tree = "false" + } + dev_tree = (dev_tree == "true") + + my_signature = sprintf("%s <%s>", name, email) + if (length(dead_email) > 0) + dead_signature = sprintf("%s <%s>", dead_name, dead_email) + else + dead_signature = 0; + you_are_author = 0 + has_other_review = 0 + has_self_review = 0 + has_self_signoff = 0 + has_committer_signoff = 0 + bad_commit = 0 + in_header = 1 + in_body = 0 + subject = 0 + committer_signature = 0 + committer_name = 0 + author_signature = 0 + author_name = 0 + merge = 0 +} + +{ + # Trim leading and trailing whitespace so that we can pick up tags that + # are in the commit message. + gsub(/^[[:space:]]+|[[:space:]]+$/, "", $0) + + if (debug) + printf(":%s:%s:%s:\n", in_header, $1, $0) + + if (in_header && $0 == "") { + in_header = 0 + in_body = 1 + } else if (in_body && subject == 0) { + # Pick up the subject line for error reporting + subject = $0 + if (debug) + printf("subj:%s:%s:\n", $0, subject) + } else if ((val = getval("Merge")) != 0) { + # We don't process merge commits + merge = 1 + if (debug) + printf("Merge:%s:%s:\n", $0, val); + nextfile + } else if ((val = getval("Author")) != 0) { + # Pick up the author header + author_signature = val + author_name = gensub(/^[[:space:]]*(.+) <.*$/, "\\1", "g", + author_signature); + if (debug) + printf("author:%s:%s:\n", val, author_signature); + if (is_me(val, my_signature, dead_signature)) + you_are_author = 1 + } else if ((val = getval("Commit")) != 0) { + # Pick up the committer header + committer_signature = val; + committer_name = gensub(/^[[:space:]]*(.+) <.*$/, "\\1", "g", + committer_signature); + if (debug) + printf("committer:%s:%s:\n", val, committer_name); + } else if ((val = getval("Signed-off-by")) != 0) { + # Pick up signoffs + sob_name = gensub(/^[[:space:]]*(.+) <.*$/, "\\1", "g", val); + if (is_me(val, my_signature, dead_signature)) + has_self_signoff = 1 + if (val == author_signature || sob_name == author_name) + has_author_signoff = 1 + if (val == committer_signature || sob_name == committer_name) + has_committer_signoff = 1 + } else if ((val = getval("Reviewed-by")) != 0) { + # Pick up reviews + if (is_me(val, my_signature, dead_signature)) + has_self_review = 1 + else + has_other_review = 1 + } else if ((val = getval("Fixes")) != 0) { + # Fixes tags must be of a certain length and exist in the git + # history. + split(val, cols) + fixes_id = cols[1] + if (debug) + printf("fixes:%s:\n", fixes_id) + if (length(fixes_id) < abbrev_len) { + msg = sprintf("Fixes tag commit \"%s\" needs to be longer.", fixes_id) + commit_error(msg) + bad_commit = 1 + } + + cmd = sprintf("git log -n 1 \"%s\" >/dev/null 2>&1", fixes_id) + if (system(cmd) != 0) { + msg = sprintf("Fixes tag commit \"%s\" does not exist.", fixes_id) + commit_error(msg) + bad_commit = 1 + } + } else if ($0 ~ /scanned for virus detection/) { + commit_error("Email virus scanner garbage in commit message.") + bad_commit = 1 + } +} +END { + if (ret != 0 || merge != 0) + exit ret + + if (subject == 0) { + commit_error("Patch subject not found.") + ret = 1 + } + + if (bad_commit) + ret = 1 + + if (you_are_author) { + # If you wrote the patch, you must have your own signoff and a + # review by someone else (if this isn't your development tree). + # You can't review your own patches. + if (!has_self_signoff) { + commit_error("Your patch needs your signoff.") + ret = 1 + } + if (!has_other_review && !dev_tree) { + commit_error("Your patch needs review by someone else.") + ret = 1 + } + if (has_self_review) { + commit_error("You cannot review your own patch.") + ret = 1 + } + } else { + # If you did not write the patch, it must have a signoff from + # the author, a review by you, and a signoff by you unless the + # author is the committer. + if (!has_author_signoff) { + commit_error("Patch needs to be signed off by the author.") + ret = 1 + } + if (!has_self_review) { + commit_error("Patch needs your review.") + ret = 1 + } + if (!has_committer_signoff && !has_self_signoff) { + commit_error("Patch needs your (or the committer's) signoff.") + has_committer_signoff = 1 + ret = 1 + } + } + + # All commits must have a signoff from the committer. + if (!has_committer_signoff) { + commit_error("This patch needs to be signed off by the committer.") + ret = 1 + } + + commit_error_end() + exit ret +} diff --git a/maintainer_old/checkpatch/checkpatch.py b/maintainer_old/checkpatch/checkpatch.py new file mode 100755 index 0000000..d169872 --- /dev/null +++ b/maintainer_old/checkpatch/checkpatch.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +from pygit2 import * + +repo = Repository("./") +for commit in repo.walk(repo.head.target): + print(commit.committer) + input() diff --git a/maintainer_old/checkpatch/checkpatch.sh b/maintainer_old/checkpatch/checkpatch.sh new file mode 100755 index 0000000..e0eb6a4 --- /dev/null +++ b/maintainer_old/checkpatch/checkpatch.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +check_fixes() { + local TAG=$(echo $1 | sed -e 's/^[ ]*//' | sed 's/^[F,f]ixes://') + local HASH=$(echo $TAG | awk '{print $1}') + + git log -1 --format='%s' $HASH &> /dev/null + + if [ $? -ne 0 ]; then + echo "Patch $HASH" + echo "$TAG" + echo "...does not exist" + exit 1 + fi + + local BROKEN_SUB=$(git log -1 --format='%s' $HASH) + + local SUB=$(echo $TAG | awk 'gsub($1, "")'| \ + sed -e 's/^[ ]*//' | \ + sed -e 's/^(//' | \ + sed -e 's/)$//' |\ + sed -e 's/^"//' | \ + sed -e 's/"$//') + + + if [ "$SUB" != "$BROKEN_SUB" ]; then + echo "Broken patch does not match Fixes tag:" + echo "PATCH: $HASH" + else + echo "Strings match" + fi + +} + +check_patch() { + local PATCH=$1 + local COMMIT_MSG=$(git log -1 $PATCH) + + local HAS_FIXES=`echo "$COMMIT_MSG" |grep -i fixes:` + + if [ -n "$HAS_FIXES" ]; then + check_fixes "$HAS_FIXES" + fi +} + +LAST=$1 + +PATCHES=$(for i in `git log --oneline --no-merges $LAST.. | awk '{print $1}'`; do echo $i; done) + +for i in $PATCHES; do + check_patch $i +done diff --git a/maintainer_old/djwong-git b/maintainer_old/djwong-git new file mode 100755 index 0000000..3f1d80c --- /dev/null +++ b/maintainer_old/djwong-git @@ -0,0 +1,41 @@ +#!/bin/bash + +# Support routines for git commands + +commit_range_from_arg() { + local arg="$1" + + if [ -z "${arg}" ]; then + # If we didn't get a commit range argument and this is a + # tracking branch, pick all the commits since this branch + # deviated. + base="$(git branch-remote 2>/dev/null)" + if [ -n "${base}" ]; then + echo "${base}..HEAD" + return 0 + fi + + return 1 + fi + + # If the argument already has a range in it, we're done. + if echo "${arg}" | grep -q '\.\.'; then + echo "${arg}" + return 0 + fi + + + # If the argument is a tracking branch, pick all the commits since that + # branch deviated. + base="$(git branch-remote "${arg}" 2>/dev/null)" + if [ -n "${base}" ]; then + echo "${base}..${arg}" + return 0 + fi + + # If we didn't get something that looks like a range, only select one + # commit because git rev-list run against a non-range lists everything + # from whatever it finds all the way back to the beginning. + echo "${arg}^1..${arg}" + return 0 +} diff --git a/maintainer_old/git-announce b/maintainer_old/git-announce new file mode 100755 index 0000000..65f3fb5 --- /dev/null +++ b/maintainer_old/git-announce @@ -0,0 +1,170 @@ +#!/bin/bash + +# Announce a git branch + +die() { + echo "$@" >> /dev/stderr + exit 1 +} + +helpme() { + die "Usage: $0 [oldref] [newref] [remote] [branch] [--force] [--cc] [--review] [--tag tag]" +} + +# Note: getopt requires -o '' or else it won't process positional arguments +# correctly! +TEMP=$(getopt -o '' --long 'cc,force,debug,review,tag:' -n "$0" -- "$@") +test $? -eq 0 || helpme + +eval set -- "$TEMP" +unset TEMP + +force=0 +debug=0 +cc= +verb="announce" +tags=() +while true; do + case "$1" in + '--force') force=1; shift; continue;; + '--debug') debug=1; shift; continue;; + '--cc') cc=1; shift; continue;; + '--review') verb="review"; shift; continue;; + '--tag') tags+=("$2"); shift; shift; continue;; + '--') shift; break;; + *) helpme;; + esac +done + +oldref="$1" +newref="$2" +remote="$3" +branch="$4" + +if [ -z "${oldref}" ]; then + oldref="$(git branch-remote)" || exit 1 +fi +true "${newref:=HEAD}" +true "${remote:=korg}" +true "${branch:=for-next}" + +code_submit_tgt="$(git config user.codeSubmissionTarget)" +test -n "${code_submit_tgt}" || \ + die "${PWD}: code submission target not configured." + +# Does the oldref exist? +git rev-list -n 0 "${oldref}" > /dev/null 2>&1 || \ + die "${oldref}: starting git reference not found." + +# Make sure there's a series of commits between oldref and newref. +nr_commits="$(git rev-list "${oldref}..${newref}" | wc -l)" +# echo "${oldref}..${newref}; nr_commits = $nr_commits" > /dev/stderr +test "${nr_commits}" -gt 0 || \ + die "${oldref}..${newref}: Must have at least one commit." + +# Figure out the short name and the url of the remote repo. +git ls-remote "${remote}" > /dev/null 2>&1 || die "${remote}: remote repo unknown." +repo="$(basename "$(git remote get-url "${remote}")" | sed -e 's/\.git//g')" +origin_url="$(git remote get-url "${remote}")" + +# Figure out the commit id for the newref (or the commit the tag points +# to, if it's a tag). +longid="$(git rev-list -n 1 "${newref}")" +shortid="$(git rev-parse --short "${longid}")" +test -n "${longid}" || die "${newref}: ending git reference not found." + +filter_commit() { + local commit_id="$1" + + sed -e 's@refs/heads/@@g' | \ + awk -v commit="${commit_id}" \ + 'BEGIN{ret=1;}{if ($1 == commit) {print $2; ret=0; exit;}}END{exit(ret);}' +} + +# Let's see if the default branch has the referenced commit? +branch="$(git ls-remote "${remote}" "refs/heads/${branch}" | \ + filter_commit "${longid}")" +# Nope. Let's see if any of them have it. +test -z "${branch}" && branch="$(git ls-remote --heads "${remote}" | \ + filter_commit "${longid}")" +test -n "${branch}" || die "${newref}: couldn't find a remote branch with this reference." + +# Check each commit for RVB and SOB. +git checkpatch "${oldref}..${newref}" +test $? -ne 0 && test "${force}" -eq 0 && exit 1 + +if [ -n "${cc}" ]; then + echo "Cc: $(git contributors --delimiter ', ' "${oldref}..${newref}")" +fi + +# Compute the ANNOUNCE tag contents. +announce="[ANNOUNCE" +for ((i = 0; i < ${#tags[@]}; i++)); do + announce="${announce} ${tags[i]}" +done +announce="${announce}]" + +# Ok, emit announcement message. +review_message() { + cat << ENDL +Subject: ${announce} ${repo}: ${branch} updated to ${shortid} + +Hi folks, + +The ${branch} branch of the ${repo} repository at: + + ${origin_url} + +has just been updated for your review. + +This code snapshot has been rebased against recent upstream, freshly +QA'd, and is ready for people to examine. For veteran readers, the new +snapshot can be diffed against the previous snapshot; and for new +readers, this is a reasonable place to begin reading. For the best +experience, it is recommended to pull this branch and walk the commits +instead of trying to read any patch deluge. + +The new head of the ${branch} branch is commit: + +ENDL +} + +announce_message() { + cat << ENDL +Subject: ${announce} ${repo}: ${branch} updated to ${shortid} + +Hi folks, + +The ${branch} branch of the ${repo} repository at: + + ${origin_url} + +has just been updated. + +Patches often get missed, so please check if your outstanding patches +were in this update. If they have not been in this update, please +resubmit them to ${code_submit_tgt} so they can be picked up in +the next update. + +The new head of the ${branch} branch is commit: + +ENDL +} + +"${verb}_message" + +git log --oneline -n 1 "${oldref}..${newref}" | cat - + +echo +if [ "${nr_commits}" -eq 1 ]; then + echo "${nr_commits} new commit:" +else + echo "${nr_commits} new commits:" +fi +echo + +git shortlog --format="[%h] %s" "${oldref}..${newref}" fs/xfs Documentation/ | cat - + +echo Code Diffstat: +echo +git diff --stat --summary -C -M "${oldref}..${newref}" fs/xfs Documentation/ | cat - diff --git a/maintainer_old/git-checkpatch b/maintainer_old/git-checkpatch new file mode 100755 index 0000000..0a34125 --- /dev/null +++ b/maintainer_old/git-checkpatch @@ -0,0 +1,36 @@ +#!/bin/bash + +ldir=/home/cmaiolino/Source/tools/maintainer +source $ldir/djwong-git + +# Run the checkpatch script on every commit in the list. + +if [ "$#" -gt 1 ] || [ "$1" = "--help" ]; then + echo "Usage: $0 <commit range>" 1>&2 + exit 1 +fi +commit_range="$(commit_range_from_arg "$1")" || exit 1 + +readarray -t commits < <(git rev-list --reverse --no-merges "${commit_range}") +if [ "${#commits[@]}" -eq 0 ]; then + echo 'No commits?' + exit 1 +fi + +debug=1 +test -n "${DBG}" && debug=1 +bad=0 +for commit_id in "${commits[@]}"; do + range="${commit_id}^1..${commit_id}" + oneline="$(git log --oneline "${range}")" + + # Dump commit in full format so we get committer + git log --format=full "${range}" | \ + awk -f "$ldir/checkpatch.awk" \ + -v "commit_id=${commit_id}" \ + -v "debug=${debug}" \ + -v "oneline=${oneline}" + test $? -eq 0 || bad=1 +done + +test "${bad}" -eq 0 diff --git a/maintainer_old/pr-create.sh b/maintainer_old/pr-create.sh new file mode 100755 index 0000000..948c441 --- /dev/null +++ b/maintainer_old/pr-create.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +# pr-create: +# +# Create a Pull Request and send it to Linus Torvalds +# +# This script does: +# +# - Create a signed tag +# - push the branch and the tag to xfs-linux repository +# - Generate a list of patches in short-form +# - Craft a PR and email to Linus. +# + +REMOTE="xfs-linux" +BRANCH="$1" +TGT_BRANCH="linus/master" +TAG="$2" +TAG_MESSAGE="Signed-off-by: Carlos Maiolino <[email protected]>" +RECIPIENT="[email protected]" + +# Sending email global vars +usage() { + echo "usage: pr-create <branch> <tag>" +} + +die() { + echo "${1}... Exiting" + exit 1 +} + +git_verify_branch() { + local CUR_BRANCH=`git branch --show-current` + + if [ "${CUR_BRANCH}" != "${BRANCH}" ]; then + echo "Different branch is checked out..." + echo "... Attempting to checkout branch ${BRANCH}" + + git checkout -q ${BRANCH} 2> /dev/null + + if [ $? -ne 0 ]; then + return 1 + else + # Reset status to the old branch + git checkout -q ${CUR_BRANCH} 2> /dev/null + fi + fi +} + +git_create_tag() { + git tag -s ${TAG} -m "${TAG_MESSAGE}" +} + +push_branch() { + git push ${REMOTE} ${BRANCH}:${BRANCH} +} + +push_tag() { + git push ${REMOTE} ${TAG} +} + +git_craft_pr() { + local MSG=`git request-pull ${TGT_BRANCH} ${REMOTE} ${TAG}` + echo -e "$MSG" +} + +craft_message() { + + local MSG=$(git_craft_pr) + cat << ENDL +Hello Linus, + +Could you please pull patches included in the tag below? + +An attempt merge against your current TOT has been successful. + +Thanks, +Carlos + +${MSG} + +ENDL + +} + +generate_email() { + local MUTT_CONFIG="$HOME/.mutt/muttrc-Kernel" + neomutt -F ${MUTT_CONFIG} -s "$1" -i "$2" ${RECIPIENT} +} + +if [ -z "${BRANCH}" ] || [ -z "${TAG}" ]; then + usage +fi + +git_verify_branch + +if [ $? -ne 0 ]; then + die "Couldn't verify branch" +fi + +MAIL_MSG=$(mktemp) + +craft_message > $MAIL_MSG + +SUBJ="[GIT PULL] XFS: New code for for v6.18" +generate_email "$SUBJ" $MAIL_MSG diff --git a/maintainer_old/xfs-release.sh b/maintainer_old/xfs-release.sh new file mode 100755 index 0000000..105c4a6 --- /dev/null +++ b/maintainer_old/xfs-release.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +#Maintainer info +MAINTAINER_EMAIL="[email protected]" +MAINTAINER_NAME="Carlos Maiolino" + +SOURCE=$PWD + +#Files +VERSION_FILE="$SOURCE/VERSION" +CONFIGURE_FILE="$SOURCE/configure.ac" +DEBIAN_FILE="$SOURCE/debian/changelog" +CHANGES_FILE="$SOURCE/doc/CHANGES" + +VER_MAJ="$1" +VER_MIN="$2" +VER_REV="$3" + +REL_VER="$VER_MAJ.$VER_MIN.$VER_REV" +REL_TAG="v$VER_MAJ.$VER_MIN.$VER_REV" + +#OLD_VER here points to the previous released tag +OLD_TAG=$4 + +usage() { + echo "./xfsprogs_release.sh <mav_ver> <min_ver> <revision> <old_git_tag>" + exit +} + +## UPDATE VERSIONING ## +update_version_file() { + sed -i -e "s/^PKG_MAJOR=.*/PKG_MAJOR=$VER_MAJ/" $VERSION_FILE + sed -i -e "s/^PKG_MINOR=.*/PKG_MINOR=$VER_MIN/" $VERSION_FILE + sed -i -e "s/^PKG_REVISION=.*/PKG_REVISION=$VER_REV/" $VERSION_FILE +} + +update_configure_file() { + CONF_AC="AC_INIT([xfsprogs],[$REL_VER],[[email protected]])" + sed -i "s/^AC_INIT.*/$CONF_AC/" $CONFIGURE_FILE +} + +# Update is done in 'reverse order', so the script can always update the first +# line of the file, just to KISS. +update_debian_changelog() { + sed -i "1s/^/\n/" $DEBIAN_FILE + sed -i "1s/^/ -- Nathan Scott <[email protected]> $(date -R)\n/" $DEBIAN_FILE + sed -i "1s/^/\n/" $DEBIAN_FILE + + sed -i "1s/^/ * New upstream release\n/" $DEBIAN_FILE + sed -i "1s/^/\n/" $DEBIAN_FILE + sed -i "1s/^/xfsprogs ($VER_MAJ.$VER_MIN.$VER_REV) unstable; urgency=low\n/" $DEBIAN_FILE +} + +update_changes_file() { + + TMP_FILE=$(mktemp) + git log --oneline --reverse --format="%s (%an)" $OLD_TAG.. > $TMP_FILE + + while read -r line; do + sed -i "1s/^/\t$line\n/" $CHANGES_FILE + done < $TMP_FILE + + rm -f $TMP_FILE +} + +create_signed_tag() { + git tag -s -u $MAINTAINER_EMAIL -m "Release $REL_RAG" $REL_TAG +} + +create_and_push_tarball() { + kup put xfsprogs-$REL_VER.tar.gz xfsprogs-$REL_VER.tar.sign \ + pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-$REL_VER.tar.gz +} + +is_xfsprogs_repo() { + if [ -a $SOURCE/README ] && \ + [ "$(head -1 $SOURCE/README)" == "XFS User Tools README" ]; then + return 0 + else + echo "Current dir not a xfsprogs repository" + usage + exit 1 + fi +} + + +### PROGRAM STARTS HERE ### +# Ensure we are withing a xfsprogs repository: +is_xfsprogs_repo + +# MAJ, MIN, REV, OLD_TAG +if [ $# -ne 4 ]; then + echo "Invalid number of arguments" + usage + exit 1 +fi + +# Update files for new release + +#echo "Updating config.ac file..." +#update_configure_file +#echo "...done" +#echo +#echo "Updating debian changelog..." +#update_debian_changelog +#echo "...done" +#echo +#echo "Updating VERSION file..." +#update_version_file +#echo "...done" +#echo + +#echo "Commiting changes..." +#git add $VERSION_FILE $CONFIGURE_FILE $DEBIAN_FILE +# +#git commit -s -m "xfsprogs: Release $REL_TAG" \ +#-m "Update all the necessary files for a $REL_TAG release." +update_changes_file diff --git a/maintainer_old/xfsdump_release.sh b/maintainer_old/xfsdump_release.sh new file mode 100755 index 0000000..42fc2ac --- /dev/null +++ b/maintainer_old/xfsdump_release.sh @@ -0,0 +1,303 @@ +#!/bin/bash + +SOURCE="$PWD" +VERSION_FILE="$SOURCE/VERSION" +CONFIGURE_FILE="$SOURCE/configure.ac" +DEB_FILE="$SOURCE/debian/changelog" +LIST="[email protected]" +FORNEXT_DIR="/home/cmaiolin/Source/xfsdump/for-next" +LAST_HEAD="" +DEBUG=1 + +VER_MAJ="$1" +VER_MIN="$2" +VER_REV="$3" + +CHANGELOG_FILE="/tmp/changelog.$$" + +##### COMMON ##### + +# Print Usage information +usage(){ + echo " ./xfsdump_relase.sh <maj_ver> <min_ver> <revision>" + exit +} + +# Check update versioning +check_args(){ + if [ -z ${VER_MAJ} ]; then + echo "SET MAJ VERSION" + usage + fi + if [ -z ${VER_MIN} ]; then + echo "SET MIN VERSION" + usage + fi + if [ -z ${VER_REV} ]; then + echo "SET REVISION" + usage + fi +} + +# Open neomutt with the composed message to send +send_email(){ +SUBJECT="$1" +BODY="$2" + + if [ -z "$SUBJECT" ]; then + echo "No subject... exiting" + exit 1 + fi + + if [ -f $BODY ]; then + neomutt -F ~/.mutt/muttrc-local-korg -s "$SUBJECT" $LIST -i $BODY + else + echo "No message body... exiting" + exit 1 + fi + +} + +print_shortlog(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git shortlog --format="[%h] %s" $LAST_HEAD..$HEAD)" +} + +print_diffstat(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git diff --stat --summary -C -M $LAST_HEAD..$HEAD)" +} + +print_commit_count(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git log --oneline $LAST_HEAD.. | wc -l)" +} + +print_head(){ + if [ "$1" == "short" ]; then + HEAD=$(git log --oneline --format="%h" -1) + else + HEAD=$(git log --oneline --format="%H" -1) + fi + echo "$HEAD" +} + +##### COMMON END ##### + + +##### FOR-NEXT UPDATE ##### +compose_fornext_email(){ + + MAIL_FILE=$(mktemp) + LAST_HEAD=$1 + +if [ -z $LAST_HEAD ]; then + echo "compose_email: Previous head not set... exiting" + exit 1 +fi + +# BEGIN_OF_MESSAGE +cat << EOF > $MAIL_FILE +Hello. + +The xfsdump for-next branch, located at: + +https://git.kernel.org/pub/scm/fs/xfs/xfsdump-dev.git/refs/?h=for-next + +Has just been updated. + +Patches often get missed, so if your outstanding patches are properly reviewed on +the list and not included in this update, please let me know. + +The new head of the for-next branch is commit: + +$(print_head) + +$(print_commit_count $LAST_HEAD) new commits: + +$(print_shortlog $LAST_HEAD) + +Code Diffstat: + +$(print_diffstat $LAST_HEAD) +EOF +# END_OF_MESSAGE + +echo $MAIL_FILE +} + +compose_release_email(){ + + MAIL_FILE=$(mktemp) + LAST_HEAD=$1 + +cat << EOF > $MAIL_FILE +Hi folks, + +The xfsdump repository at: + + git://git.kernel.org/pub/scm/fs/xfs/xfsdump-dev.git + +has just been updated. + +Patches often get missed, so if your outstanding patches are properly reviewed +on the list and not included in this update, please let me know. + +The for-next branch has also been updated to match the state of master. + +The new head of the master branch is commit: + +$(print_head) + +New commits: + +$(print_shortlog $LAST_HEAD) + +Code Diffstat: + +$(print_diffstat $LAST_HEAD) +EOF + +#END_OF_MESSAGE +echo $MAIL_FILE + +} +fornext_announce(){ + + LAST_HEAD=$1 + + if [ -z $LAST_HEAD ]; then + echo "No starting HEAD specified... exiting" + exit 1 + fi + + SUBJECT="[ANNOUNCE] xfsdump: for-next updated to $(print_head short)" + BODY=$(compose_fornext_email $LAST_HEAD) + + send_email "$SUBJECT" $BODY +} + +release_announce(){ + LAST_HEAD=$1 + RELEASE=$(git describe --abbrev=0) + + if [ -z $LAST_HEAD ]; then + echo "No starting HEAD specified... exiting" + exit 1 + fi + + SUBJECT="[ANNOUNCE] xfsdump $RELEASE released" + BODY=$(compose_release_email $LAST_HEAD) + + send_email "$SUBJECT" $BODY +} +##### FOR-NEXT UPDATE ##### + +##### RELEASE SETUP ###### +update_version_file(){ + echo "updating version" + sed -i -e "s/^PKG_MAJOR=.*/PKG_MAJOR=$VER_MAJ/" $VERSION_FILE + sed -i -e "s/^PKG_MINOR=.*/PKG_MINOR=$VER_MIN/" $VERSION_FILE + sed -i -e "s/^PKG_REVISION=.*/PKG_REVISION=$VER_REV/" $VERSION_FILE +} + +update_configure_file(){ + CONF_AC="AC_INIT([xfsdump],[$VER_MAJ.$VER_MIN.$VER_REV],[[email protected]])" + + sed -i "s/^AC_INIT.*/$CONF_AC/" $CONFIGURE_FILE +} + +update_debian_changelog(){ +#if [ ! -s $CHANGELOG_FILE ]; then +# echo "Error: changelog does not exist or empty. Exiting..." +# exit +#fi + +sed -i "1s/^/\n/" $DEB_FILE +sed -i "1s/^/ -- Nathan Scott <[email protected]> `date -R`\n/" $DEB_FILE +sed -i "1s/^/\n/" $DEB_FILE + +#while read -r LINE; do +# sed -i "1s/^/ * $LINE\n/" $DEB_FILE +#done <$CHANGELOG_FILE + +sed -i "1s/^/ * New upstream release\n/" $DEB_FILE +sed -i "1s/^/\n/" $DEB_FILE +sed -i "1s/^/xfsdump ($VER_MAJ.$VER_MIN.$VER_REV) unstable; urgency=low\n/" $DEB_FILE +} + +# Get user inputs for each changelog entry +# XXX this should be automated based on patches subjects +get_changelog(){ + LOG="" + while [ 1 ]; do + read -p "Changelog entry:" tmplog + + if [ -z "$tmplog" ]; then + break; + fi + echo "$tmplog" >> $CHANGELOG_FILE + done +} + + +#MOVE TO THE CORRECT REPO +#cd $FORNEXT_DIR + +#check_args +#get_changelog +#update_version_file +#update_configure_file +#update_debian_changelog +#rm $CHANGELOG_FILE +#email_fornext $1 +#fornext_announce 37e6e80a6 + +while getopts "n:r:" opt; do + case $opt in + n) # for-next + LAST_HEAD=$OPTARG + fornext_announce $LAST_HEAD + ;; + r) # Release + LAST_HEAD=$OPTARG + release_announce $LAST_HEAD + ;; + *) + usage + ;; + esac +done diff --git a/maintainer_old/xfsprogs-summary.sh b/maintainer_old/xfsprogs-summary.sh new file mode 100755 index 0000000..ca82955 --- /dev/null +++ b/maintainer_old/xfsprogs-summary.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +MAINTAINER="Eric Sandeen <[email protected]>" + +IFS=$(echo -en "\n\b") + +for PATCH in `guilt applied -c`; do + COMMIT=`echo $PATCH | awk '{print $1}'` + FILENAME=`echo $PATCH | awk '{print $2}'` + + SUBJECT=`git show --pretty=format:%s $COMMIT | head -n 1` + AUTHOR=`git show $COMMIT | grep ^Author | awk -F": " '{print $2}'` + AUTHOR_SOB=`git show $COMMIT | grep -i Signed-off-by: | head -n 1 | awk -F": " '{print $2}'` + COMMITTER_SOB=`git show $COMMIT | grep -i Signed-off-by: | tail -n 1 | awk -F": " '{print $2}'` + REVIEWED_BY=`git show $COMMIT | grep -i Reviewed-by: | tail -n 1 | awk -F": " '{print $2}'` + + echo -n "PATCH: $PATCH" + + # Check for double spaces in subject + if [[ "$SUBJECT" == *" "* ]]; then + DOUBLE="true" + else + DOUBLE="false" + fi + + if [ "$REVIEWED_BY" != "" -a \ + "$AUTHOR" == "$AUTHOR_SOB" -a \ + "$COMMITTER_SOB" == "$MAINTAINER" -a \ + "$DOUBLE" == "false" ]; then + echo " - OK" + else + echo + fi + + if [[ "$SUBJECT" == *" "* ]]; then + echo " double spaces in: $SUBJECT" + fi + if [ "$REVIEWED_BY" == "" ]; then + echo " no Reviewed-by:" + fi + if [ "$AUTHOR" != "$AUTHOR_SOB" ]; then + echo " author $AUTHOR sob $AUTHOR_SOB" + fi + if [ "$COMMITTER_SOB" != "$MAINTAINER" ]; then + echo " committer $COMMITTER_SOB maintainer $MAINTAINER" + fi + +done +[root@intel-lizardhead-04 ~]# cat /usr/local/bin/xfsprogs-summary.sh +#!/bin/bash + +cat << EOF +Hi folks, + +The xfsprogs repository at: + + git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git + +has just been updated. + +Patches often get missed, so please check if your outstanding +patches were in this update. If they have not been in this update, +please resubmit them to [email protected] so they can be +picked up in the next update. + +The new head of the master branch is commit: + +EOF + +git log --oneline -n 1 $* #v6.4.0 + +echo +echo New Commits: +echo +git shortlog --format="[%h] %s" $* + +echo +echo Code Diffstat: +echo +git diff --stat --summary -C -M $* + diff --git a/maintainer_old/xfsprogs_release.sh b/maintainer_old/xfsprogs_release.sh new file mode 100755 index 0000000..104adc8 --- /dev/null +++ b/maintainer_old/xfsprogs_release.sh @@ -0,0 +1,303 @@ +#!/bin/bash + +SOURCE="$PWD" +VERSION_FILE="$SOURCE/VERSION" +CONFIGURE_FILE="$SOURCE/configure.ac" +DEB_FILE="$SOURCE/debian/changelog" +LIST="[email protected]" +FORNEXT_DIR="~/Source/xfsprogs/for-next" +LAST_HEAD="" +DEBUG=1 + +VER_MAJ="$1" +VER_MIN="$2" +VER_REV="$3" + +CHANGELOG_FILE="/tmp/changelog.$$" + +##### COMMON ##### + +# Print Usage information +usage(){ + echo " ./xfsprogs_relase.sh <maj_ver> <min_ver> <revision>" + exit +} + +# Check update versioning +check_args(){ + if [ -z ${VER_MAJ} ]; then + echo "SET MAJ VERSION" + usage + fi + if [ -z ${VER_MIN} ]; then + echo "SET MIN VERSION" + usage + fi + if [ -z ${VER_REV} ]; then + echo "SET REVISION" + usage + fi +} + +# Open neomutt with the composed message to send +send_email(){ +SUBJECT="$1" +BODY="$2" + + if [ -z "$SUBJECT" ]; then + echo "No subject... exiting" + exit 1 + fi + + if [ -f $BODY ]; then + neomutt -F ~/.mutt/muttrc-kernel -s "$SUBJECT" $LIST -i $BODY + else + echo "No message body... exiting" + exit 1 + fi + +} + +print_shortlog(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git shortlog --format="[%h] %s" $LAST_HEAD..$HEAD)" +} + +print_diffstat(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git diff --stat --summary -C -M $LAST_HEAD..$HEAD)" +} + +print_commit_count(){ +LAST_HEAD=$1 +HEAD=$2 + + if [ -z $LAST_HEAD ]; then + echo "Previous head not set... exiting" + exit 1 + fi + + if [ -z $HEAD ]; then + HEAD="HEAD" + fi + + echo "$(git log --oneline $LAST_HEAD.. | wc -l)" +} + +print_head(){ + if [ "$1" == "short" ]; then + HEAD=$(git log --oneline --format="%h" -1) + else + HEAD=$(git log --oneline --format="%H" -1) + fi + echo "$HEAD" +} + +##### COMMON END ##### + + +##### FOR-NEXT UPDATE ##### +compose_fornext_email(){ + + MAIL_FILE=$(mktemp) + LAST_HEAD=$1 + +if [ -z $LAST_HEAD ]; then + echo "compose_email: Previous head not set... exiting" + exit 1 +fi + +# BEGIN_OF_MESSAGE +cat << EOF > $MAIL_FILE +Hello. + +The xfsprogs for-next branch, located at: + +https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/refs/?h=for-next + +Has just been updated. + +Patches often get missed, so if your outstanding patches are properly reviewed on +the list and not included in this update, please let me know. + +The new head of the for-next branch is commit: + +$(print_head) + +$(print_commit_count $LAST_HEAD) new commits: + +$(print_shortlog $LAST_HEAD) + +Code Diffstat: + +$(print_diffstat $LAST_HEAD) +EOF +# END_OF_MESSAGE + +echo $MAIL_FILE +} + +compose_release_email(){ + + MAIL_FILE=$(mktemp) + LAST_HEAD=$1 + +cat << EOF > $MAIL_FILE +Hi folks, + +The xfsprogs repository at: + + git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git + +has just been updated. + +Patches often get missed, so if your outstanding patches are properly reviewed +on the list and not included in this update, please let me know. + +The for-next branch has also been updated to match the state of master. + +The new head of the master branch is commit: + +$(print_head) + +New commits: + +$(print_shortlog $LAST_HEAD) + +Code Diffstat: + +$(print_diffstat $LAST_HEAD) +EOF + +#END_OF_MESSAGE +echo $MAIL_FILE + +} +fornext_announce(){ + + LAST_HEAD=$1 + + if [ -z $LAST_HEAD ]; then + echo "No starting HEAD specified... exiting" + exit 1 + fi + + SUBJECT="[ANNOUNCE] xfsprogs: for-next updated to $(print_head short)" + BODY=$(compose_fornext_email $LAST_HEAD) + + send_email "$SUBJECT" $BODY +} + +release_announce(){ + LAST_HEAD=$1 + RELEASE=$(git describe --abbrev=0) + + if [ -z $LAST_HEAD ]; then + echo "No starting HEAD specified... exiting" + exit 1 + fi + + SUBJECT="[ANNOUNCE] xfsprogs $RELEASE released" + BODY=$(compose_release_email $LAST_HEAD) + + send_email "$SUBJECT" $BODY +} +##### FOR-NEXT UPDATE ##### + +##### RELEASE SETUP ###### +update_version_file(){ + echo "updating version" + sed -i -e "s/^PKG_MAJOR=.*/PKG_MAJOR=$VER_MAJ/" $VERSION_FILE + sed -i -e "s/^PKG_MINOR=.*/PKG_MINOR=$VER_MIN/" $VERSION_FILE + sed -i -e "s/^PKG_REVISION=.*/PKG_REVISION=$VER_REV/" $VERSION_FILE +} + +update_configure_file(){ + CONF_AC="AC_INIT([xfsprogs],[$VER_MAJ.$VER_MIN.$VER_REV],[[email protected]])" + + sed -i "s/^AC_INIT.*/$CONF_AC/" $CONFIGURE_FILE +} + +update_debian_changelog(){ +#if [ ! -s $CHANGELOG_FILE ]; then +# echo "Error: changelog does not exist or empty. Exiting..." +# exit +#fi + +sed -i "1s/^/\n/" $DEB_FILE +sed -i "1s/^/ -- Nathan Scott <[email protected]> `date -R`\n/" $DEB_FILE +sed -i "1s/^/\n/" $DEB_FILE + +#while read -r LINE; do +# sed -i "1s/^/ * $LINE\n/" $DEB_FILE +#done <$CHANGELOG_FILE + +sed -i "1s/^/ * New upstream release\n/" $DEB_FILE +sed -i "1s/^/\n/" $DEB_FILE +sed -i "1s/^/xfsprogs ($VER_MAJ.$VER_MIN.$VER_REV) unstable; urgency=low\n/" $DEB_FILE +} + +# Get user inputs for each changelog entry +# XXX this should be automated based on patches subjects +get_changelog(){ + LOG="" + while [ 1 ]; do + read -p "Changelog entry:" tmplog + + if [ -z "$tmplog" ]; then + break; + fi + echo "$tmplog" >> $CHANGELOG_FILE + done +} + + +#MOVE TO THE CORRECT REPO +#cd $FORNEXT_DIR + +#check_args +#get_changelog +#update_version_file +#update_configure_file +#update_debian_changelog +#rm $CHANGELOG_FILE +#email_fornext $1 +#fornext_announce 37e6e80a6 + +while getopts "n:r:" opt; do + case $opt in + n) # for-next + LAST_HEAD=$OPTARG + fornext_announce $LAST_HEAD + ;; + r) # Release + LAST_HEAD=$OPTARG + release_announce $LAST_HEAD + ;; + *) + usage + ;; + esac +done |
