From 296c6b9ee85209c0ce375717e30686545baea107 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sat, 2 May 2026 14:09:27 +0200 Subject: Save new changes --- DEPRECATED | 1 + README | 1 + bin/fetch_mail.sh | 16 ++ bin/korgmail | 4 +- bin/rhmail | 2 +- bin/sync_mail.sh | 20 ++- bin/toxicmail | 5 + bin/work_setup.sh | 21 ++- bin/xfs-release.sh | 118 ------------- bin/xfsdump_release.sh | 303 -------------------------------- bin/xfsprogs-summary.sh | 81 --------- bin/xfsprogs_release.sh | 303 -------------------------------- git-announce.tar.gz | Bin 0 -> 4528 bytes git_contributors.py | 68 +++++++ maintainer/mutt-hooks/b4-shazam.sh | 8 +- maintainer/pr-create.sh | 6 +- maintainer_old/checkpatch.awk | 251 ++++++++++++++++++++++++++ maintainer_old/checkpatch/checkpatch.py | 8 + maintainer_old/checkpatch/checkpatch.sh | 52 ++++++ maintainer_old/djwong-git | 41 +++++ maintainer_old/git-announce | 170 ++++++++++++++++++ maintainer_old/git-checkpatch | 36 ++++ maintainer_old/pr-create.sh | 106 +++++++++++ maintainer_old/xfs-release.sh | 118 +++++++++++++ maintainer_old/xfsdump_release.sh | 303 ++++++++++++++++++++++++++++++++ maintainer_old/xfsprogs-summary.sh | 81 +++++++++ maintainer_old/xfsprogs_release.sh | 303 ++++++++++++++++++++++++++++++++ xfsprogs-eric-notes.txt | 66 +++++++ 28 files changed, 1671 insertions(+), 821 deletions(-) create mode 100644 DEPRECATED create mode 100644 README create mode 100755 bin/fetch_mail.sh create mode 100755 bin/toxicmail delete mode 100755 bin/xfs-release.sh delete mode 100755 bin/xfsdump_release.sh delete mode 100755 bin/xfsprogs-summary.sh delete mode 100755 bin/xfsprogs_release.sh create mode 100644 git-announce.tar.gz create mode 100644 git_contributors.py create mode 100755 maintainer_old/checkpatch.awk create mode 100755 maintainer_old/checkpatch/checkpatch.py create mode 100755 maintainer_old/checkpatch/checkpatch.sh create mode 100755 maintainer_old/djwong-git create mode 100755 maintainer_old/git-announce create mode 100755 maintainer_old/git-checkpatch create mode 100755 maintainer_old/pr-create.sh create mode 100755 maintainer_old/xfs-release.sh create mode 100755 maintainer_old/xfsdump_release.sh create mode 100755 maintainer_old/xfsprogs-summary.sh create mode 100755 maintainer_old/xfsprogs_release.sh create mode 100644 xfsprogs-eric-notes.txt diff --git a/DEPRECATED b/DEPRECATED new file mode 100644 index 0000000..cb258db --- /dev/null +++ b/DEPRECATED @@ -0,0 +1 @@ +move it to workstation.git diff --git a/README b/README new file mode 100644 index 0000000..35a3bcd --- /dev/null +++ b/README @@ -0,0 +1 @@ +Scripts for several purposes diff --git a/bin/fetch_mail.sh b/bin/fetch_mail.sh new file mode 100755 index 0000000..2f10567 --- /dev/null +++ b/bin/fetch_mail.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -x +MAIL_DIR=/home/cem/Mail + +sync_toxic() { + local TOXIC_MAIL=$MAIL_DIR/toxiclabs + local TOXIC_NOTMUCH_CONFIG=$TOXIC_MAIL/notmuch-config + local TOXIC_MBSYNC_CONFIG=$TOXIC_MAIL/mbsyncrc + local TOXIC_NM_TAGS=$TOXIC_MAIL/tags.conf + + mbsync --config=$TOXIC_MBSYNC_CONFIG -q -a toxiclabs + notmuch --config=$TOXIC_NOTMUCH_CONFIG new + notmuch --config=$TOXIC_NOTMUCH_CONFIG tag --input=$TOXIC_NM_TAGS +} + +sync_toxic diff --git a/bin/korgmail b/bin/korgmail index 3741930..d045804 100755 --- a/bin/korgmail +++ b/bin/korgmail @@ -1,5 +1,5 @@ #!/bin/bash -MAIL_DIR=/home/cmaiolino/Mail/kernel +MAIL_DIR=/home/cmaiolino/Mail/Kernel export NOTMUCH_CONFIG=$MAIL_DIR/notmuch-config -neomutt -F ~/.mutt/muttrc-kernel +neomutt -F ~/.mutt/muttrc-Kernel diff --git a/bin/rhmail b/bin/rhmail index 3f435d5..fd132de 100755 --- a/bin/rhmail +++ b/bin/rhmail @@ -1,7 +1,7 @@ #!/bin/bash MUTT=`which neomutt` -MUTTRC="~/.mutt/muttrc-local" +MUTTRC="~/.mutt/muttrc-redhat" $MUTT -F $MUTTRC diff --git a/bin/sync_mail.sh b/bin/sync_mail.sh index b718b9a..2bf04c5 100755 --- a/bin/sync_mail.sh +++ b/bin/sync_mail.sh @@ -2,9 +2,22 @@ MBSYNC=`which mbsync` NOTMUCH=`which notmuch` -MUTT_DIR=/home/cmaiolino/.mutt -MAIL_DIR=/home/cmaiolino/Mail +MUTT_DIR=/home/cem/.mutt +MAIL_DIR=/home/cem/Mail +sync_toxic() { + local TOXIC_MAIL=$MAIL_DIR/toxiclabs + local MBSYNC_CONFIG=$TOXIC_MAIL/mbsyncrc + local NOTMUCH_TAGS=$TOXIC_MAIL/toxic_nmtag.conf + local TOXIC_MUTTRC=$MUTT_DIR/muttrc-toxiclabs + local TOXIC_NM_CONFIG=$TOXIC_MAIL/notmuch-config + local TOXIC_NM_TAGS=$TOXIC_MAIL/toxic_nmtag.conf + + mbsync --config=$MBSYNC_CONFIG -a -q + + notmuch --config=$KORG_NM_CONFIG new + notmuch --config=$KORG_NM_CONFIG tag --input=$KORG_NM_TAGS +} sync_redhat() { local RH_MAIL=$MAIL_DIR/redhat local MBSYNC_CONFIG=$RH_MAIL/mbsyncrc @@ -14,7 +27,7 @@ sync_redhat() { } sync_korg() { - local KORG_MAIL=$MAIL_DIR/kernel + local KORG_MAIL=$MAIL_DIR/Kernel local MBSYNC_CONFIG=$KORG_MAIL/mbsyncrc local NOTMUCH_TAGS=$KORG_MAIL/kernel_nmtag.conf local KORG_MUTTRC=$MUTT_DIR/muttrc-kernel @@ -29,3 +42,4 @@ sync_korg() { sync_redhat sync_korg +sync_toxic diff --git a/bin/toxicmail b/bin/toxicmail new file mode 100755 index 0000000..00189b4 --- /dev/null +++ b/bin/toxicmail @@ -0,0 +1,5 @@ +#!/bin/bash + +#MAIL_DIR=/home/cmaiolino/Mail/toxiclabs +#export NOTMUCH_CONFIG=$MAIL_DIR/notmuch-config +neomutt -F ~/.mutt/muttrc-toxiclabs diff --git a/bin/work_setup.sh b/bin/work_setup.sh index d54e777..15f50e9 100755 --- a/bin/work_setup.sh +++ b/bin/work_setup.sh @@ -1,9 +1,20 @@ #!/bin/bash -tmux new-session -s "WORKSPACE" -d -n "WORKSPACE" 'rhmail' -tmux split-window -t WORKSPACE -v 'ikhal' -tmux split-window -t WORKSPACE -h -tmux split-window -t WORKSPACE -h 'weechat' +tmux new-session -s "WORKSPACE" -d -n "WORKDSPACE" 'ikhal' tmux split-window -t WORKSPACE -v -tmux select-layout -t WORKSPACE "77ad,343x61,0,0{156x61,0,0,4,186x61,157,0[186x30,157,0{93x30,157,0,6,92x30,251,0,9},186x30,157,31{93x30,157,31,8,92x30,251,31,10}]}" +tmux select-pane -t 1 +tmux split-window -t WORKSPACE -h 'emacs ~/Nextcloud/ORG/GTD.org' +tmux select-pane -t 3 +tmux split-window -t WORKSPACE -h 'weechat' +tmux select-layout -t WORKSPACE "4432,223x61,0,0{111x61,0,0[111x30,0,0,0,111x30,0,31,6],111x61,112,0[111x30,112,0,4,111x30,112,31,5]}" +tmux select-pane -t 1 'ikhal' +#tmux split-window -t WORKSPACE -h -n "IRC" +#tmux select-window -t "CALENDAR" +#tmux split-window -t WORKSPACE -n "TODO" -v 'emacs ~/Nextcloud/ORG/GTD.org' +#tmux select-window -t "IRC" +#tmux split-window -t WORKSPACE -h 'vim ~/Nextcloud/vimwiki/index.wiki' +#tmux split-window -t WORKSPACE -v 'weechat' +#tmux select-layout -t WORKSPACE "5e76,343x64,0,0{171x64,0,0,0,171x64,172,0,1}" +#tmux select-layout -t WORKSPACE "a201,343x63,0,0{171x63,0,0,13,171x63,172,0[171x31,172,0,14,171x31,172,32{85x31,172,32,15,85x31,258,32,16}]}" +#tmux select-layout -t WORKSPACE "77ad,343x61,0,0{156x61,0,0,4,186x61,157,0[186x30,157,0{93x30,157,0,6,92x30,251,0,9},186x30,157,31{93x30,157,31,8,92x30,251,31,10}]}" tmux attach diff --git a/bin/xfs-release.sh b/bin/xfs-release.sh deleted file mode 100755 index 105c4a6..0000000 --- a/bin/xfs-release.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -#Maintainer info -MAINTAINER_EMAIL="cem@kernel.org" -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 " - 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],[linux-xfs@vger.kernel.org])" - 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 $(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/bin/xfsdump_release.sh b/bin/xfsdump_release.sh deleted file mode 100755 index 42fc2ac..0000000 --- a/bin/xfsdump_release.sh +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/bash - -SOURCE="$PWD" -VERSION_FILE="$SOURCE/VERSION" -CONFIGURE_FILE="$SOURCE/configure.ac" -DEB_FILE="$SOURCE/debian/changelog" -LIST="carlos@maiolino.me" -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 " - 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],[linux-xfs@vger.kernel.org])" - - 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 `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/bin/xfsprogs-summary.sh b/bin/xfsprogs-summary.sh deleted file mode 100755 index ca82955..0000000 --- a/bin/xfsprogs-summary.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -MAINTAINER="Eric Sandeen " - -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 linux-xfs@vger.kernel.org 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/bin/xfsprogs_release.sh b/bin/xfsprogs_release.sh deleted file mode 100755 index 104adc8..0000000 --- a/bin/xfsprogs_release.sh +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/bash - -SOURCE="$PWD" -VERSION_FILE="$SOURCE/VERSION" -CONFIGURE_FILE="$SOURCE/configure.ac" -DEB_FILE="$SOURCE/debian/changelog" -LIST="linux-xfs@vger.kernel.org" -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 " - 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],[linux-xfs@vger.kernel.org])" - - 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 `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 diff --git a/git-announce.tar.gz b/git-announce.tar.gz new file mode 100644 index 0000000..8abd2b5 Binary files /dev/null and b/git-announce.tar.gz differ diff --git a/git_contributors.py b/git_contributors.py new file mode 100644 index 0000000..91a7f6a --- /dev/null +++ b/git_contributors.py @@ -0,0 +1,68 @@ +#!/usr/bin/python3 + +# List all contributors to a series of git commits. +# Copyright(C) 2022 Darrick J. Wong, All Rights Reserved. +# Licensed under GPL 2.0 or later + +import re +import subprocess +import io +import sys +import argparse + +DEBUG = False + +def backtick(args): + '''Generator function that yields lines of a program's stdout.''' + if DEBUG: + print(' '.join(args)) + p = subprocess.Popen(args, stdout = subprocess.PIPE) + for line in io.TextIOWrapper(p.stdout, encoding="utf-8"): + yield line.strip() + +def get_developers(revspec): + """Return the address list generated from signed-off-by and + acked-by lines in the message. + """ + addr_list = ['linux-xfs@vger.kernel.org', 'linux-fsdevel@vger.kernel.org'] + tags = '%s|%s|%s|%s|%s|%s|%s|%s' % ( + 'signed-off-by', + 'acked-by', + 'cc', + 'reviewed-by', + 'reported-by', + 'tested-by', + 'suggested-by', + 'reported-and-tested-by') + regex1 = r'^(%s):\s+(.+)$' % tags + regex2 = r'^(%s):\s+.+<(.+)>$' % tags + + r1 = re.compile(regex1, re.I) + r2 = re.compile(regex2, re.I) + + for output in backtick(['git', 'log', '--pretty=medium', revspec]): + m = r2.match(output) + if m: + addr_list.append(m.expand(r'\g<2>')) + continue + m = r1.match(output) + if m: + addr_list.append(m.expand(r'\g<2>')) + + return set(addr_list) + +def main(): + parser = argparse.ArgumentParser(description = "List email addresses of contributors to a series of git commits.") + parser.add_argument("revisions", nargs = 1, \ + help = "git revisions to process.") + parser.add_argument("--delimiter", type = str, default = '\n', \ + help = "Separate each email address with this string.") + args = parser.parse_args() + + contributors = get_developers(args.revisions[0]) + + print(args.delimiter.join(sorted(contributors))) + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/maintainer/mutt-hooks/b4-shazam.sh b/maintainer/mutt-hooks/b4-shazam.sh index 4920658..478a276 100755 --- a/maintainer/mutt-hooks/b4-shazam.sh +++ b/maintainer/mutt-hooks/b4-shazam.sh @@ -1,6 +1,6 @@ #!/bin/bash -REPO_DIR=/home/cem/Source/MAINTAINER/xfs-linux +REPO_DIR=/home/cem/Source/MAINTAINER/$1 FORMAIL=$(which formail) B4=$(which b4) @@ -11,6 +11,10 @@ _die() { check_env() { + if [ -z $1 ]; then + _die "You must specify a branch" + fi + if [ ! -d $REPO_DIR ]; then _die "Linux repo does not exist" fi @@ -41,7 +45,7 @@ shazam_message() { echo "Message/Series $MSG_ID applied" } -check_env +check_env $1 MSG="" diff --git a/maintainer/pr-create.sh b/maintainer/pr-create.sh index 62721b0..36387b7 100755 --- a/maintainer/pr-create.sh +++ b/maintainer/pr-create.sh @@ -21,7 +21,7 @@ SUBJECT="" # Email tool NEOMUTT=$(which neomutt) -MUTT_CONFIG="$HOME/.mutt/muttrc-Kernel" +MUTT_CONFIG="$HOME/.mutt/muttrc-kernel" #temp files PULL_FILE=$(mktemp) @@ -116,11 +116,11 @@ TYPE=$(echo $TAG | sed 's/xfs-//' | awk '{split($0, a, "-"); print a[1]}') VER=$(echo $TAG | sed 's/xfs-//' | awk '{split($0, a, "-"); print a[2]}') RC=$(echo $TAG | sed 's/xfs-//' | awk '{split($0, a, "-"); print a[3]}') -if [ $TYPE = "merge" ] && [ $RC ]; then +if [ "$TYPE" = "merge" ] && [ "$RC" ]; then _die "Can't have a -RC tag with a merge tag" fi -if [ $TYPE = "fixes" ] && [ -z $RC ]; then +if [ "$TYPE" = "fixes" ] && [ -z "$RC" ]; then _die "A Fixes tag requires a -RC version" fi 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 " 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 " +RECIPIENT="cem@kernel.org" + +# Sending email global vars +usage() { + echo "usage: pr-create " +} + +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="cem@kernel.org" +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 " + 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],[linux-xfs@vger.kernel.org])" + 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 $(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="carlos@maiolino.me" +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 " + 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],[linux-xfs@vger.kernel.org])" + + 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 `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 " + +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 linux-xfs@vger.kernel.org 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="linux-xfs@vger.kernel.org" +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 " + 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],[linux-xfs@vger.kernel.org])" + + 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 `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 diff --git a/xfsprogs-eric-notes.txt b/xfsprogs-eric-notes.txt new file mode 100644 index 0000000..7c725cb --- /dev/null +++ b/xfsprogs-eric-notes.txt @@ -0,0 +1,66 @@ +foo +https://korg.wiki.kernel.org/userdoc/kup + +$ git remote add korg git@gitolite.kernel.org:pub/scm/fs/xfs/xfsprogs-dev.git + +adds that remote so we can push as "korg" + +$ git push -f korg master:for-next + +-f forces the update into for-next + +to push my for-next to for-next -- for-next:for-next + +*** might need guilt/$BRANCH not just $BRANCH *** + +Modify files for new version! + +VERSION +configure.ac +debian/changelog <-- for -rc as well! +doc/CHANGES + +vim VERSION configure.ac debian/changelog doc/CHANGES + +changelog entry: + + xfsprogs: Release v4.16.0 + + Update all the necessary files for a 4.16.0 release. + + Signed-off-by: Eric Sandeen + +signed tag: + +yum install pinentry +export GPG_TTY=`tty` +export LC_CTYPE="en_US.UTF-8" +export RELVER="4.14.0" +git tag -s -u sandeen@sandeen.net -m "Release v${RELVER}" v${RELVER} +/////// $ git push --tags korg for-next:master for-next:for-next + +# NEVER USE --tags or --follow-tags +$ git push origin + + +xfsprogs-summary.sh v${RELVER}.. + +Create the tarballs: +$ make dist + +For actual release, to sign tarball: +gpg -u sandeen@sandeen.net -a --detach-sign xfsprogs-${RELVER}.tar + + + +and to publish it: +$ mv xfsprogs-${RELVER}.tar.asc xfsprogs-${RELVER}.tar.sign +$ gzip xfsprogs-${RELVER}.tar +$ kup put xfsprogs-${RELVER}.tar.gz xfsprogs-${RELVER}.tar.sign pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-${RELVER}.tar.gz + +where: + +# cat ~/.kuprc +host = git@gitolite.kernel.org +subcmd = kup-server + -- cgit v1.2.3