sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Juuso Alasuutari <iuso AT sourcemage.org>
- To: sm-discuss AT lists.ibiblio.org
- Subject: Re: [SM-Discuss] removing BUILD_API=2
- Date: Thu, 21 Sep 2006 10:49:58 +0300
Okay, as some of you may have noticed I've removed all BUILD_API=2 and
MAINTAINER lines from test and z-rejected. Here's the script I used, feel
free to apply its magic to other grimoires, too. (Don't forget to change the
NAME and EMAIL fields!)
Some info: Just to make sure everything's working it's best to first do a dry
run with the "Execute git commit" parts (both of them!) commented out and
take a look at 'git diff'. Then 'git checkout -f' before you do the actual
run. If your grimoire is nearly as big as test, it'll take about forever to
finish. (You can see the progress by checking in 'git show', sections and
spells are processes in alphabetical order.)
-------------------------------------
#!/bin/bash
# This script removes all BUILD_API=2 and MAINTAINER lines in
# DETAILS from spells under current dir and does the proper git commits.
# Each modified spell will be committed separately. Spells that have
# both BUILD_API=2 and MAINTAINER will have them both removed in a
# single commit.
#################
# Begin script #
#################
# Set developer info for HISTORY entries.
NAME="First Last"
EMAIL="email AT addre.ss"
###################################################################
# Part for removing BUILD_API=2 and also MAINTAINER if necessary #
###################################################################
# Get list of DETAILS files with BUILD_API=2.
FILES="$(grep -lr "^\ *BUILD_API=2\ *$" ./ | grep DETAILS)"
# Go through the list.
for file in $FILES; do
# Remove BUILD_API=2 line
sed -i "/^\ *BUILD_API=2\ *$/d" "$file"
# If there's also a MAINTAINER line remove that too, then define correct
# commit message.
if grep -q "^\ *MAINTAINER=.*$" "$file"; then
sed -i "/^\ *MAINTAINER=.*$/d" "$file"
commitMsg="Removed BUILD_API=2 and MAINTAINER."
else
commitMsg="Removed BUILD_API=2."
fi
# Add HISTORY entry.
historyFile="${file/\/DETAILS//HISTORY}"
sed -i "1i$(date +%Y-%m-%d) $NAME <$EMAIL>\n\t* DETAILS: \
[automated] $commitMsg\n" "$historyFile"
# Execute git commit.
spellName="${file%%/DETAILS}"
spellName="${spellName##*/}"
git commit -m "$spellName: [automated] $commitMsg" -a
done
##################################################
# Part for removing leftover MAINTAINER entries #
##################################################
# Get list of DETAILS files with MAINTAINER.
FILES="$(grep -lr "^\ *MAINTAINER=.*$" ./ | grep DETAILS)"
# Go through the list.
for file in $FILES; do
# Remove the line.
sed -i "/^\ *MAINTAINER=.*$/d" "$file"
# Add HISTORY entry.
historyFile="${file/\/DETAILS//HISTORY}"
sed -i "1i$(date +%Y-%m-%d) $NAME <$EMAIL>\n\t* DETAILS: \
[automated] Removed MAINTAINER.\n" "$historyFile"
# Execute git commit.
spellName="${file%%/DETAILS}"
spellName="${spellName##*/}"
git commit -m "$spellName: [automated] Removed MAINTAINER." -a
done
-------------------------------------
--
Juuso Alasuutari
[[ Source Mage GNU/Linux ]]
Attachment:
pgpLkGTvD5bZG.pgp
Description: PGP signature
-
[SM-Discuss] removing BUILD_API=2,
Juuso Alasuutari, 09/19/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Eric Sandall, 09/19/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Juuso Alasuutari, 09/20/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
David Kowis, 09/20/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Juuso Alasuutari, 09/21/2006
- Re: [SM-Discuss] removing BUILD_API=2, Arwed von Merkatz, 09/21/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Juuso Alasuutari, 09/21/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
David Kowis, 09/20/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Juuso Alasuutari, 09/20/2006
-
Re: [SM-Discuss] removing BUILD_API=2,
Eric Sandall, 09/19/2006
Archive powered by MHonArc 2.6.24.