Remove scripts that don't really belong in OpenSim SVN.
parent
1b69714c44
commit
34cac351cb
|
@ -1,72 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
TEMPNAME="copyright_script_temp_file"
|
||||
COPYNAME="copyright_script_copyright_notice"
|
||||
|
||||
URL="http://opensimulator.org/"
|
||||
PROJNAME="OpenSim"
|
||||
|
||||
cat > ${COPYNAME} <<EOF
|
||||
/*
|
||||
* Copyright (c) Contributors, ${URL}
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the ${PROJNAME} Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS \`\`AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
EOF
|
||||
|
||||
has_bom() {
|
||||
CHARS=`hexdump -c $1 | head -n1 | cut -d\ -f1-4`
|
||||
BOMMARK="0000000 357 273 277"
|
||||
if [ "${CHARS}" == "${BOMMARK}" ]; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
for f in `find . -iname "*.cs"`; do
|
||||
head -n2 $f | tail -n1 > ${TEMPNAME}
|
||||
grep -q Copyright ${TEMPNAME}
|
||||
if [ $? == 1 ]; then
|
||||
BOMSTATUS=`has_bom $f`
|
||||
rm ${TEMPNAME}
|
||||
|
||||
if [ ${BOMSTATUS} == 1 ]; then
|
||||
echo -ne \\0357\\0273\\0277 > ${TEMPNAME}
|
||||
fi
|
||||
|
||||
cat ${COPYNAME} >> ${TEMPNAME}
|
||||
|
||||
if [ ${BOMSTATUS} == 1 ]; then
|
||||
cat $f | perl -p -e "s/^\\xEF\\xBB\\xBF//" >> ${TEMPNAME}
|
||||
else
|
||||
cat $f >> ${TEMPNAME}
|
||||
fi
|
||||
|
||||
mv ${TEMPNAME} $f
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f ${COPYNAME} ${TEMPNAME}
|
|
@ -1,171 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os, os.path, popen2, re, string, sys
|
||||
|
||||
def text(file):
|
||||
return {
|
||||
"svn:eol-style" : "native"
|
||||
}
|
||||
|
||||
def script(file):
|
||||
return {
|
||||
"svn:eol-style" : "native",
|
||||
"svn:executable" : "*"
|
||||
}
|
||||
|
||||
def executable(file):
|
||||
return {
|
||||
"svn:executable" : "*",
|
||||
"svn:mime-type" : "application/octet-stream"
|
||||
}
|
||||
|
||||
def binary(file):
|
||||
return {
|
||||
"svn:mime-type" : "application/octet-stream"
|
||||
}
|
||||
|
||||
def is_binary(file):
|
||||
f = open(file)
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
for c in data:
|
||||
if c not in string.printable:
|
||||
return True
|
||||
return False
|
||||
|
||||
def binary_or_text(file):
|
||||
if is_binary(file):
|
||||
return binary(file)
|
||||
else:
|
||||
return text(file)
|
||||
|
||||
property_map = {
|
||||
".bat" : script,
|
||||
".build" : text,
|
||||
".cfg" : text,
|
||||
".cgi" : text,
|
||||
".conf" : text,
|
||||
".config" : text,
|
||||
".cs" : text,
|
||||
".csproj" : text,
|
||||
".dat" : binary_or_text,
|
||||
".dll" : binary,
|
||||
".dylib" : binary,
|
||||
".example" : text,
|
||||
".exe" : executable,
|
||||
".fxcop" : text,
|
||||
".hgignore" : text,
|
||||
".ico" : binary,
|
||||
".include" : text,
|
||||
".ini" : text,
|
||||
".j2c" : binary,
|
||||
".jp2" : binary,
|
||||
".lsl" : text,
|
||||
".mdp" : text,
|
||||
".mds" : text,
|
||||
".nsi" : text,
|
||||
".ogg" : binary,
|
||||
".pdb" : binary,
|
||||
".php" : script,
|
||||
".pidb" : binary,
|
||||
".pl" : script,
|
||||
".plist" : text,
|
||||
".pm" : text,
|
||||
".png" : binary,
|
||||
".py" : script,
|
||||
".rb" : script,
|
||||
".resx" : text,
|
||||
".settings" : text,
|
||||
".stetic" : text,
|
||||
".sh" : script,
|
||||
".snk" : binary,
|
||||
".so" : binary,
|
||||
".sql" : text,
|
||||
".txt" : text,
|
||||
".user" : text,
|
||||
".userprefs" : text,
|
||||
".usertasks" : text,
|
||||
".xml" : text,
|
||||
".xsd" : text
|
||||
}
|
||||
|
||||
def propset(file, property, value):
|
||||
os.system('svn propset %s "%s" "%s"' % (property, value, file))
|
||||
|
||||
def propdel(file, property):
|
||||
os.system('svn propdel %s "%s"' % (property, file))
|
||||
|
||||
def propget(file, property):
|
||||
output, input, error = popen2.popen3('svn propget %s "%s"' % (property, file))
|
||||
|
||||
err = error.read()
|
||||
if err != "":
|
||||
output.close()
|
||||
error.close()
|
||||
input.close()
|
||||
return ""
|
||||
|
||||
result = output.read()
|
||||
output.close()
|
||||
error.close()
|
||||
input.close()
|
||||
return result.strip()
|
||||
|
||||
def proplist(file):
|
||||
output, input, error = popen2.popen3('svn proplist "%s"' % file)
|
||||
|
||||
err = error.read()
|
||||
if err != "":
|
||||
output.close()
|
||||
error.close()
|
||||
input.close()
|
||||
return None
|
||||
|
||||
result = output.readlines()
|
||||
output.close()
|
||||
error.close()
|
||||
input.close()
|
||||
if len(result) > 0 and re.match("^Properties on .*:$", result[0]) is not None:
|
||||
return [r.strip() for r in result[1:]]
|
||||
else:
|
||||
return ""
|
||||
|
||||
def update_file(file, properties, ignorelist):
|
||||
current_props = proplist(file)
|
||||
|
||||
if current_props is None:
|
||||
# svn error occurred -- probably an unversioned file
|
||||
return
|
||||
|
||||
for p in current_props:
|
||||
if p not in ignorelist and not properties.has_key(p):
|
||||
propdel(file, p)
|
||||
|
||||
for p in properties:
|
||||
if p not in current_props or propget(file, p) != properties[p]:
|
||||
propset(file, p, properties[p])
|
||||
|
||||
def update(dir, ignorelist):
|
||||
for f in os.listdir(dir):
|
||||
fullpath = os.path.join(dir, f)
|
||||
if os.path.isdir(fullpath):
|
||||
if not os.path.islink(fullpath):
|
||||
update(fullpath, ignorelist)
|
||||
else:
|
||||
extension = os.path.splitext(fullpath)[1].lower()
|
||||
if property_map.has_key(extension):
|
||||
update_file(fullpath, property_map[extension](fullpath), ignorelist)
|
||||
elif extension != "" and proplist(fullpath) is not None:
|
||||
print "Warning: No properties defined for %s files (%s)" % (extension, fullpath)
|
||||
|
||||
def main(argv = None):
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
ignorelist = ("svn:keywords",)
|
||||
|
||||
update(".", ignorelist)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
Loading…
Reference in New Issue