diff options
| author | Carlos Maiolino <[email protected]> | 2024-04-21 13:52:26 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2024-04-21 13:52:26 +0200 |
| commit | 47b7016ed5ac6dd8efc041060d62e632e937a6d2 (patch) | |
| tree | 2540760186b400288565c2d2f67dd3c3e93bcfe0 | |
Initial commit
| -rw-r--r-- | stale/boot_kernel.sh | 91 | ||||
| -rw-r--r-- | stale/hooks.sh | 57 | ||||
| -rw-r--r-- | stale/install_kernel.sh_old | 23 | ||||
| -rwxr-xr-x | stale/make_patchlist.sh | 63 | ||||
| -rw-r--r-- | stale/pack_kernel.sh_old | 26 | ||||
| -rwxr-xr-x | stale/stack_patches.sh | 132 | ||||
| -rwxr-xr-x | stale/xfsdump-release.sh | 248 | ||||
| -rwxr-xr-x | stale/xfsprogs-release.sh | 248 |
8 files changed, 888 insertions, 0 deletions
diff --git a/stale/boot_kernel.sh b/stale/boot_kernel.sh new file mode 100644 index 0000000..a29f8a0 --- /dev/null +++ b/stale/boot_kernel.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +#This script is used to start-up a KVM-based virtual machine with a specific +#kernel, specified via command line with -k option + +#--------------------------------------------------# + +#virt-xml <domain> --edit --boot kernel=args=<args> +VIRTXML_BIN=`which virt-xml 2> /dev/null` +DEFAULT_OPS="ro vconsole.font=latarcyrheb-sun16 LANG=en_CA.UTF-8 console=ttyS0 +crashkernel=128M" + +# Display usage help function +usage() { + echo + echo "boot_kernel.sh: start a virtual machine with a direct kernel" + echo + echo "Usage: boot_kernel.sh -d <vm_name> -k <kernel> -r <root_dev> -o \"<kernel_opts>\"" + echo + echo "-d: Specify the virtual machine name (domain name)" + echo "-k: Kernel executable path to be loaded in the virtual machine" + echo "-o: Kernel Options command line arguments (please use \"\")" + echo "-r: Root device, partition where rootfs is stored inside VM" + echo "-h: Show this help" +} + + +if [ -z $VIRTXML_BIN ]; then + echo "virt-xml executable not found..." + echo "Please make sure your system has virt-install package installed" + echo + exit +fi + +add_kernel_to_xml() { + echo $VIRTXML_BIN --edit --boot kernel=$KERNEL_PATH kernel_args=$KERNEL_OPS +} + + +while getopts "d:hk:o:r:" ARG; do + case $ARG in + d) #domain name + DOMAIN_NAME=$OPTARG + ;; + h) + #help menu + usage + ;; + k) #kernel path + KERNEL_PATH=$OPTARG + ;; + o) + #kernel_ops + KERNEL_OPS=$OPTARG + ;; + r) + #root_device + ROOT_DEV=$OPTARG + ;; + *) + usage + exit + ;; + + esac +done + +#Ensure $KERNEL_PATH is valid +if [ -z $KERNEL_PATH ]; then + echo "Kernel image not specified..." + usage + exit 1 +fi + +if [ ! -f $KERNEL_PATH ]; then + echo "Kernel image not found...exiting" + exit 1 +fi + +#add_kernel_to_xml +$VIRTXML_BIN $DOMAIN_NAME --edit --boot kernel=$KERNEL_PATH + +#Set kernel_args +if [ -z "$KERNEL_OPS" ]; then + $VIRTXML_BIN $DOMAIN_NAME --edit --boot kernel_args="root=$ROOT_DEV $DEFAULT_OPS" +else + $VIRTXML_BIN $DOMAIN_NAME --edit --boot kernel=$KERNEL_PATH --boot kernel_args="root=$ROOT_DEV ro $KERNEL_OPS" +fi + +#Starting VM +virsh start $DOMAIN_NAME diff --git a/stale/hooks.sh b/stale/hooks.sh new file mode 100644 index 0000000..d8add42 --- /dev/null +++ b/stale/hooks.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +email=$1 +patch=/tmp/$$.patch +tempfile=/tmp/item_menu.$$ +sources=~/pristine/ + + + +clear_repo(){ + dialog --clear --yesno \ + " Wanna reset the git tree?" 0 0 + + if [ $? -eq 0 ]; then + git reset --hard + fi +} + +diff_patch(){ + + dialog --clear --yesno --yes-label "git diff" --no-label "difftool" \ + "Choose DIFF format:" 0 0 + + if [ $? -eq 0 ]; then + git diff + else + git difftool + fi + +} + +apply_patch(){ + repolist=$(ls $sources | awk '{print $1,$1}') + + dialog --clear --menu "Select repository to apply the patch" 0 0 20 $repolist 2> $tempfile + #"Select repository to apply the patch" 30 60 20 $repolist 2> $tempfile + + repo=`cat $tempfile` + + echo $repo + cd $sources/$repo + git apply $patch + #diff_patch + clear_repo +} + +clear_env(){ + rm -rf $tempfile + rm -rf $patch +} + +###main + +cat $email | formail -I "" > $patch +#cat $email | formail -I "" | awk '/^---/{p=1}p' > /tmp/patch.patch +apply_patch +clear_env diff --git a/stale/install_kernel.sh_old b/stale/install_kernel.sh_old new file mode 100644 index 0000000..196c7bb --- /dev/null +++ b/stale/install_kernel.sh_old @@ -0,0 +1,23 @@ +#!/bin/bash +if [ -z "$1" ]; then + echo "$0 <tarball>" >&2; + exit 1; +fi + +tarball="$1"; +tmp=$(mktemp -d); +mv $tarball $tmp/; +cd $tmp; +tar xfj $tarball +mv $tarball ../ +#rm -f $tarball; +chown root.root -R boot lib; +/bin/cp boot/* /boot/ +/bin/cp -R lib/modules/* /lib/modules + +version=$(basename $tarball .tar.bz2); +#depmod $version; +#mkinitrd --force /boot/initramfs-$version.img $version +new-kernel-pkg --install --make-default --depmod --mkinitrd $version + +#rm -Rf $tmp; diff --git a/stale/make_patchlist.sh b/stale/make_patchlist.sh new file mode 100755 index 0000000..3168b9f --- /dev/null +++ b/stale/make_patchlist.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +MBOX=/tmp/mbox +PATCH_DIR=/tmp/patches +PATCH_SERIES=/tmp/series +sources=~/sources + + +# Read patch series and import inside a git tree using guilt + +guilt_import() { + for i in `tac $PATCH_SERIES`; do + echo "Importing: $i" + echo $PATCH_DIR/$i + guilt import $PATCH_DIR/$i + done +} + + +# Open a dialog with a list based on directories under $source directory, each +# directory should be a git repository where the patches will be imported + +apply_patch() { + repolist=$(ls $sources | awk '{print $1,$1}') + tempfile=/tmp/item_menu.$$ + + dialog --clear --menu "Select repository to apply the patch" 0 0 20 $repolist 2> $tempfile + #"Select repository to apply the patch" 30 60 20 $repolist 2> $tempfile + + repo=`cat $tempfile` + + cd $sources/$repo + guilt init + guilt_import + rm -rf $tempfile +} + + +# Reads all files under a mailbox and its sub-directories (cur, new, tmp +# usually), and transform all emails under there in patches to be applied to a +# git tree + +mkdir $PATCH_DIR +for dir in `ls $MBOX`; do + for i in `ls $MBOX/$dir`; do + FILE=$MBOX/$dir/$i + SUBJ=`cat $FILE|formail -xSubject` + TITLE=`echo $SUBJ| sed -e '{ s@\[@@g; s@\]@@g; s@[*()" \t]@_@g;s@[/:]@-@g; s@^ \+@@; s@\.\.@.@g; s@-_@_@g; s@__@_@g; s@\.$@@; }' | cut -c 1-70`.patch + SUBJ=`echo $SUBJ | sed -e 's/\[[^]]*\]//'` + PATCH=$PATCH_DIR/$TITLE + echo $TITLE >> $PATCH_SERIES + echo $SUBJ > $PATCH + cat $FILE | formail -I "" >> $PATCH + done +done + + +apply_patch +rm -rf $PATCH_SERIES +rm -rf $MBOX + +#clean patches +rm -rf $PATCH_DIR diff --git a/stale/pack_kernel.sh_old b/stale/pack_kernel.sh_old new file mode 100644 index 0000000..faf92df --- /dev/null +++ b/stale/pack_kernel.sh_old @@ -0,0 +1,26 @@ +#!/bin/bash + +DIR=/tmp/kernel +if [ -f include/generated/utsrelease.h ]; then + FILE=include/generated/utsrelease.h; +else + FILE=include/linux/utsrelease.h; +fi +version=$(grep UTS_RELEASE $FILE | cut -f 2 -d '"'); +if [ -z "$version" ]; then + echo "couldn't get version" >&2; + exit 1; +fi +echo "version is $version" >&2 +rm -Rf $DIR +make $(cat vars) modules_install INSTALL_MOD_PATH=$DIR/ >/dev/null; +mkdir $DIR/boot +cp .config $DIR/boot/config-$version; +cp System.map $DIR/boot/System.map-$version; +cp arch/x86/boot/bzImage $DIR/boot/vmlinuz-$version; +cd $DIR +tar cfj /tmp/$version.tar.bz2 * +cd ..; +echo $version.tar.bz2; +scp /tmp/$version.tar.bz2 [email protected]:./public_html/kernel/ + diff --git a/stale/stack_patches.sh b/stale/stack_patches.sh new file mode 100755 index 0000000..e8072c1 --- /dev/null +++ b/stale/stack_patches.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +# Stateless script to create stacked patch series (with guilt) on a specified +# git repository. +# +# Used mostly to help with patch maintenance on xfsprogs project. +# +# The idea is to use it as a hook in neomutt, select a bunch of patches create +# stgit series based on those. +# +# The script relies on b4 tool to create mailboxes from the patches's msg-ids, +# and those mboxes sent to stgi to transform them in patch series. + + +#Piped message(s) +emails=$2 + +#Repository to act on +REPO="$1" + +patch=/tmp/$$.patch +mbox=/tmp/mutt_mbox.tmp +MBOX_DIR=/tmp/MBOX_DIR + +# Logging +IMPORT_LOG=/tmp/$$.import_log + +#Commands used +B4=`which b4` +GIT=`which git` +GUILT=`which guilt` + + +#Repositories location +KERNEL_REPO=$HOME/Source/kernel/linux.pristine +XFSPROGS_REPO=$HOME/Source/xfsprogs/xfsprogs-dev.pristine +XFSDUMP_REPO=$HOME/Source/xfsdump/xfsdump-dev.pristine + +cleanup(){ + rm -rf $MBOX_DIR + rm -rf $IMPORT_LOG + rm -rf /tmp/*.error_log +} + +setup(){ + if [ -d $MBOX_DIR ]; then + mkdir -p $MBOX_DIR + fi +} + +# Create multiple mboxes from tagged messages +import_from_list(){ + + ID_LIST=/tmp/$$.idlist + ERR_LOG=/tmp/$$_import.error_log + + cat $emails | grep Message-Id | awk '{print $2}'> $ID_LIST + + for i in `cat $ID_LIST`; do + b4 -q am -t -s -o $MBOX_DIR $i &> $ERR_LOG + done + + rm $ID_LIST +} + +# Import patches from mailboxes into a git branch +create_git_branch(){ + + if [ $REPO == "xfsprogs" ]; then + cd $XFSPROGS_REPO + elif [ $REPO == "xfsdump" ]; then + cd $XFSDUMP_REPO + else + echo "Invalid repository" + exit 1 + fi + + for i in `ls $MBOX_DIR | grep ".mbx"`; do + series=$(echo $i | sed 's/.mbx//') + ERR_LOG=/tmp/$series.error_log + #stack=$(echo $i) + + echo "=====================" + echo "- Applying Series:" + echo "$series" + echo + # Ensure we are at for-next branch, to avoid stacking different + # series in the same branch + echo "- Creating new Branch:" + $GIT checkout -q -B IMPORT_$series >> $ERR_LOG + echo + echo "- Resetting branch to for-next" + $GIT reset -q --hard for-next >> $ERR_LOG + #$GIT checkout -q for-next > $ERR_LOG + echo + echo "- Importing commits" + $GIT am $MBOX_DIR/$i 2>> $ERR_LOG >> $IMPORT_LOG + + #if [ $? != 0 ]; then + if [ -s $ERR_LOG ]; then + echo "GIT AM ERROR: Failed to import series: $series" + #echo "DEBUG: $MBOX_DIR/$i" + #echo "DEBUG: $PWD" + echo "See: $ERR_LOG" + $GIT am --abort >> $IMPORT_LOG + continue + else + echo + echo "-= SERIES APPLIED =-" + fi + done + echo + echo "- Moving back to master branch..." + $GIT checkout -q master >> $ERR_LOG + echo + echo "-= Job finished =-" + echo "=====================" +} + +show_dialog(){ + dialog --clear --menu "Select reposiroty" 0 0 20 "kernel" "" "xfsprogs" "" 2>&1 >/dev/tty +} + + +# Prog starts here + +cleanup +mkdir $MBOX_DIR +import_from_list $emails +create_git_branch +#create_patch_stacks $XFSPROGS_REPO +#create_patch_stacks $XFSDUMP_REPO diff --git a/stale/xfsdump-release.sh b/stale/xfsdump-release.sh new file mode 100755 index 0000000..cbd3f28 --- /dev/null +++ b/stale/xfsdump-release.sh @@ -0,0 +1,248 @@ +#!/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-cem -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 +} + +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 +} +##### 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:" opt; do + case $opt in + n) + LAST_HEAD=$OPTARG + fornext_announce $LAST_HEAD + ;; + *) + usage + ;; + esac +done diff --git a/stale/xfsprogs-release.sh b/stale/xfsprogs-release.sh new file mode 100755 index 0000000..28312ee --- /dev/null +++ b/stale/xfsprogs-release.sh @@ -0,0 +1,248 @@ +#!/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/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-local-cem -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 +} + +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 +} +##### 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:" opt; do + case $opt in + n) + LAST_HEAD=$OPTARG + fornext_announce $LAST_HEAD + ;; + *) + usage + ;; + esac +done |
