World of Warcraft > World of Warcraft AddOns >
Conclusion
Doable, but risky.
AddOns with dependencies (libraries) almost never bundle them in or refer to them in their repository.
- You could symlink to the repository of that library, giving you the latest version of it. However, there is no guarantee that the latest version of an AddOn uses the latest versions of its libraries.
- So you are usually stuck with manually downloading the complete bundled AddOn, extracting it and pulling out the libraries. That defeats the entire purpose of repository updating, leaving it solely as a change detection mechanism. Boo.
SVN/GIT updating
Note that at the time I didn't know Mercurial, and I didn't want to spend the time to learn it after deciding that this entire affair wasn't working out.
# Props to devbanana's post:function elementExists(){ if [ -z "$1" ] || [ -z "$2" ]; then echo "needs two parameters" return fi
- http://www.sitepoint.com/forums/4178213-post2.html
- Modified so I pass the info directly to it without relying on a fixed name for the array-variable.
- TODO: Return the number of occurrences. 0 = none, 1 = one, 2 = two were found in the array.. etc.
var=$1 shift 1 for i in $@; do if [[ $i == $var ]]; then return 1 fi done return 0 } test_elementExists(){ a=( test ) elementExists test $a echo $? elementExists testing $a echo $? }
- shift $@ to the left, by one. This kills $1.
- But we need to use $1, so let's keep it.
skip=( LibDBIcon-1.0 ) for dir in *; do if ! [ -d $dir ]; then continue fi \cd $dir
- Having svn freezing issues. I need to `killall -9 svn` and then `svn cleanup` repeatedly to break out of this nonsense.
- I kept LibDBIcon-1.0 locked. It was having freezing issues.
- It's libs are fine, it's the main directory that's not updating properly. The checkout works, not the update.
elementExists $dir $skip if [ $? -eq 0 ]; then continue fi
- Skip select directories:
if [[ $dir == PitBull4 ]]; then
- Process certain directories differently like so:
\rm -rf $dir/Modules/VisualHeal/
- I'm using VisualHeal5, and this conflicts:
\rm -rf $dir/libs/LibHealComm-4.0/ continue fi if [ -d '.git' ]; then \echo "git: ${dir}" \git pull \echo "" fi if [ -d '.svn' ]; then \echo "svn: ${dir}" \svn update \echo "" fi
- A dependency for the old VisualHeal. Not needed for VisualHeal5.
\cd .. done
- TODO: Mercurial support would go here.
Library Linker
This script is run while in any arbitrary addon's 'libs' folder. It checks to see if you already have that library installed alongside your other addons, and it replaces the addon's embedded library with a symbolic link to the 'official' one (which is probably svn/git-updated).
It wouldn't be hard to expand this to have it walk through all Interface/AddOns/* directories and search for 'libs', 'Libs' etc. I didn't do this because I wanted finer control.
The reason why this is a bad idea is that libraries don't have obvious minor version numbers. So any particular addon could bundle specific revisions of a library which are not compatible with the current svn/git edition you're linking-to.
That is, you're taking away the addon's specific reference to a specific major and minor revision of a library. You're replacing it with the latest and greatest. Things can break even with minor revisions, and I learned this the hard way.
Authors are retarded for:
- Not keeping their libraries absolutely up-to-date.
- Not having their svn repository reference the repository for each of their libraries.
- Embedding modified versions of libraries which are not identified/named differently.
- I don't even know how conflicts like this are resolved, but I'd bet this causes issues.
After going through all of this, it makes me really wonder how all the different embedded libraries are handled by wow. Do I seriously have that many editions of every single library all running concurrently? Shit.
addons_dir="../.."
ace_dir="${addons_dir}/Ace3"
moved="zzz_moved"
if ! [ -d $moved ]; then
\mkdir -p $moved
fi
for dir in *; do
if [ -L $dir ]; then
\echo Skipping symbolic link: $dir
else
if [ -d $dir ]; then
if [ -d $addons_dir/$dir ]; then
\mv --interactive $dir $moved
\ln --symbolic --verbose $addons_dir/$dir .
fi
if [ -d $ace_dir/$dir ]; then
\mv --interactive $dir $moved
\ln --symbolic --verbose $ace_dir/$dir .
fi
fi
fi
done
\rmdir --ignore-fail-on-non-empty $moved
if ! [ -d $moved ]; then
\echo "nothing was moved."
else
\ls --color .
\ls --color $moved
fi