From b99d37f92b1b45afbe27c3d0f405c51e85b10f7b Mon Sep 17 00:00:00 2001 From: Victor Boctor Date: Sat, 25 Apr 2020 22:17:50 -0700 Subject: [PATCH 1/2] Remove useless files --- check-svn-properties.sh | 34 ---------------------------------- index.php3 | 9 --------- mantisbt-subversion-config | 29 ----------------------------- subversion_mantis_config.reg | 20 -------------------- 4 files changed, 92 deletions(-) delete mode 100755 check-svn-properties.sh delete mode 100644 index.php3 delete mode 100644 mantisbt-subversion-config delete mode 100644 subversion_mantis_config.reg diff --git a/check-svn-properties.sh b/check-svn-properties.sh deleted file mode 100755 index 7ad9317..0000000 --- a/check-svn-properties.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# -# check-svn-properties.sh -# -# This script sets the required Subversion properties for all files in -# the current directory and all subdirectories based on file extensions. -# As result the current difference to be checked in is written to stdout. -# - -svn up - -find . -name \*.php -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.php -exec svn propset svn:keywords 'Author Date Id Revision' {} \; >/dev/null -find . -name \*.txt -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.txt -exec svn propset svn:keywords 'Author Date Id Revision' {} \; >/dev/null -find . -name \*.sgml -exec svn propset svn:mime-type text/sgml {} \; >/dev/null -find . -name \*.sgml -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.sgml -exec svn propset svn:keywords 'Author Date Id Revision' {} \; >/dev/null -find . -name \*.dsl -exec svn propset svn:mime-type text/xml {} \; >/dev/null -find . -name \*.dsl -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.ent -exec svn propset svn:mime-type text/xml {} \; >/dev/null -find . -name \*.ent -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.css -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.js -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.sample -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.htm -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.html -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name .htaccess -exec svn propset svn:eol-style native {} \; >/dev/null -find . -name \*.png -exec svn propset svn:mime-type image/png {} \; >/dev/null -find . -name \*.jpg -exec svn propset svn:mime-type image/jpeg {} \; >/dev/null -find . -name \*.gif -exec svn propset svn:mime-type image/gif {} \; >/dev/null - -svn di diff --git a/index.php3 b/index.php3 deleted file mode 100644 index cadd647..0000000 --- a/index.php3 +++ /dev/null @@ -1,9 +0,0 @@ - - - -Mantis - - - - - diff --git a/mantisbt-subversion-config b/mantisbt-subversion-config deleted file mode 100644 index c9a6e5b..0000000 --- a/mantisbt-subversion-config +++ /dev/null @@ -1,29 +0,0 @@ -### Set enable-auto-props to 'yes' to enable automatic properties -### for 'svn add' and 'svn import', it defaults to 'no'. -### Automatic properties are defined in the section 'auto-props'. - -enable-auto-props = yes - -### Section for configuring automatic properties. -### The format of the entries is: -### file-name-pattern = propname[=value][;propname[=value]...] -### The file-name-pattern can contain wildcards (such as '*' and -### '?'). All entries which match will be applied to the file. -### Note that auto-props functionality must be enabled, which -### is typically done by setting the 'enable-auto-props' option. - -[auto-props] -*.php = svn:eol-style=native;svn:keywords=Author Date Id Revision -*.txt = svn:eol-style=native;svn:keywords=Author Date Id Revision -*.sgml=svn:mine-type=text/sgml;svn:eol-style=native;svn:keywords=Author Date Id Revision -*.dsl=svn:mime-type=text/xml;svn:eol-style=native -*.ent=svn:mime-type=text/xml;svn:eol-style=native -*.css = svn:eol-style=native -*.js = svn:eol-style=native -*.sample = svn:eol-style=native -*.html = svn:eol-style=native -*.htm = svn:eol-style=native -*.htaccess = svn:eol-style=native -*.png = svn:mime-type=image/png -*.jpg = svn:mime-type=image/jpeg -*.gif = svn:mime-type=image/gif diff --git a/subversion_mantis_config.reg b/subversion_mantis_config.reg deleted file mode 100644 index d0fb7b7..0000000 --- a/subversion_mantis_config.reg +++ /dev/null @@ -1,20 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\auto-props] -"*.php"="svn:eol-style=native;svn:keywords=Author Date Id Revision" -"*.txt"="svn:eol-style=native;svn:keywords=Author Date Id Revision" -"*.sgml"="svn:mine-type=text/sgml;svn:eol-style=native;svn:keywords=Author Date Id Revision" -"*.dsl"="svn:mime-type=text/xml;svn:eol-style=native" -"*.ent"="svn:mime-type=text/xml;svn:eol-style=native" -"*.css"="svn:eol-style=native" -"*.js"="svn:eol-style=native" -"*.sample"="svn:eol-style" -"*.html"="svn:eol-style=native" -"*.htm"="svn:eol-style=native" -"*.htaccess"="svn:eol-style=native" -"*.png"="svn:mime-type=image/png" -"*.jpg"="svn:mime-type=image/jpeg" -"*.gif"="svn:mime-type=image/gif" - -[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\miscellany] -"enable-auto-props"="yes" From d18c7cbea3d10e7c159c3a5f05d104d8395f0912 Mon Sep 17 00:00:00 2001 From: Victor Boctor Date: Sat, 25 Apr 2020 22:18:28 -0700 Subject: [PATCH 2/2] Remove scripts that were moved to MantisBT repo --- buildrelease-repo.py | 202 --------------------------------- buildrelease.py | 251 ----------------------------------------- check_apostrophe.php | 71 ------------ check_formatting.php | 137 ---------------------- check_lang.php | 142 ----------------------- check_lineterm.php | 210 ---------------------------------- docbook-manual-repo.py | 200 -------------------------------- docbook-manual.py | 203 --------------------------------- readme.md | 6 +- update-copyright.sh | 80 ------------- update-credits.sh | 79 ------------- 11 files changed, 2 insertions(+), 1579 deletions(-) delete mode 100755 buildrelease-repo.py delete mode 100755 buildrelease.py delete mode 100755 check_apostrophe.php delete mode 100755 check_formatting.php delete mode 100755 check_lang.php delete mode 100755 check_lineterm.php delete mode 100755 docbook-manual-repo.py delete mode 100755 docbook-manual.py delete mode 100755 update-copyright.sh delete mode 100755 update-credits.sh diff --git a/buildrelease-repo.py b/buildrelease-repo.py deleted file mode 100755 index 235c63e..0000000 --- a/buildrelease-repo.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/python -u - -import getopt -import re -import os -from os import path -import shutil -import subprocess -import sys -import tempfile - -# clone URL for MantisBT repository -clone_url = 'git://github.com/mantisbt/mantisbt.git' - -# Absolute path to buildrelease.py -buildscript = path.dirname(path.abspath(__file__)) + '/buildrelease.py' - -# Regular expressions of refs to ignore -ignorelist = map(re.compile, [ - 'HEAD', - '-1\.0\.[\w\d]+', - ]) - -# Script options -options = "hfr:bacds:" -long_options = ["help", "fresh", "ref=", "branches", "auto-suffix", "clean", - "docbook", "suffix="] - - -def usage(): - print '''Builds one or more releases (zip/tarball) for the specified -references or for all branches. - -Usage: %s [options] /path/for/tarballs [/path/to/repo] - -Options: - -h | --help Show this usage message - - -f | --fresh Create a fresh clone in repository path, - or temporary path - -r | --ref [,...] Build a release for named refs - -b | --branches Build a release for all branches - -a | --auto-suffix Automatically append the HEAD commit's sha1 - to the version suffix - -The following options are passed on to '%s': - -c | --clean Remove build directories when completed - -d | --docbook Build the docbook manuals - -s | --suffix Include version suffix in config files -''' % (path.basename(__file__), path.basename(buildscript)) -#end usage() - - -def ignore(ref): - '''Decide which refs to ignore based on regexen listed in 'ignorelist'. - ''' - - ignore = False - for regex in ignorelist: - if len(regex.findall(ref)) > 0: - ignore = True - return ignore -#end ignore() - - -def main(): - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) - except getopt.GetoptError, err: - print str(err) - usage() - sys.exit(2) - - pass_opts = "" - refs = [] - all_branches = False - version_suffix = "" - auto_suffix = False - fresh_clone = False - delete_clone = False - - for opt, val in opts: - if opt in ("-h", "--help"): - usage() - sys.exit(0) - - elif opt in ("-f", "--fresh"): - fresh_clone = True - - elif opt in ("-r", "--ref"): - refs.extend(val.split(",")) - - elif opt in ("-b", "--branches"): - all_branches = True - - elif opt in ("-c", "--clean"): - pass_opts += " -c" - - elif opt in ("-d", "--docbook"): - pass_opts += " -d" - - elif opt in ("-a", "--auto-suffix"): - auto_suffix = True - - elif opt in ("-s", "--suffix"): - version_suffix = val - - if len(args) < 1: - usage() - sys.exit(1) - - release_path = path.abspath(args[0]) - repo_path = "." - - if len(args) > 1: - repo_path = path.abspath(args[1]) - - # Create a new repo clone - if fresh_clone: - print "Origin MantisBT repository:", clone_url - if repo_path == ".": - repo_path = tempfile.mkdtemp(prefix="mantisbt-", suffix=".git") - delete_clone = True - ret = subprocess.call('git clone %s %s' % (clone_url, repo_path), - shell=True) - if ret != 0: - print "ERROR: clone failed" - sys.exit(1) - - # Change to the repo path - os.chdir(repo_path) - - # Update the repository - if not fresh_clone: - os.system('git fetch') - - # Consolidate refs/branches - if all_branches: - os.system('git remote prune origin') - refs.extend(os.popen('git branch -r').read().split()) - - if len(refs) < 1: - refs.append(os.popen('git log --pretty="format:%h" -n1').read()) - - refs = [ref for ref in refs if not ignore(ref)] - - # Info - print "\nWill build the following releases:" - for ref in refs: - print " %s" % ref - - # Regex to strip 'origin/' from ref names - refnameregex = re.compile('(?:[a-zA-Z0-9-.]+/)?(.*)') - - for ref in refs: - print "\nChecking out '%s'" % ref - os.system("git checkout -f -q %s" % ref) - os.system("git log -n1 --pretty='HEAD is now at %h... %s'") - print - - # Composer - if path.isfile('composer.json'): - print "Installing Composer packages" - if subprocess.call('composer install --no-plugins --no-scripts --no-dev', shell=True): - continue - print - - # Update and reset submodules - print "Updating submodules" - subprocess.call('git submodule update --init', shell=True) - subprocess.call('git submodule foreach git checkout -- .', shell=True) - - # Handle suffix/auto-suffix generation - hash = os.popen('git log --pretty="format:%h" -n1').read() - if hash != ref: - ref = refnameregex.search(ref).group(1) - hash = "%s-%s" % (ref, hash) - - suffix = "" - if auto_suffix and version_suffix: - suffix = "--suffix %s-%s" % (version_suffix, hash) - elif auto_suffix: - suffix = "--suffix %s" % hash - elif version_suffix: - suffix = "--suffix %s" % version_suffix - - # Start building - os.system("%s %s %s %s %s" % (buildscript, pass_opts, suffix, - release_path, repo_path)) - - # Cleanup temporary repo if needed - if delete_clone: - print "\nRemoving temporary clone." - shutil.rmtree(repo_path) - - # Done - print "\nAll builds completed." - -#end main() - -if __name__ == "__main__": - main() diff --git a/buildrelease.py b/buildrelease.py deleted file mode 100755 index d1eeb72..0000000 --- a/buildrelease.py +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/python -u - -import getopt -import os -from os import path -import re -import shutil -import subprocess -import sys -import tempfile - -# Script options -options = "hcdv:s:" -long_options = ["help", "clean", "docbook", "version=", "suffix="] - -# Absolute path to docbook-manual.py -manualscript = path.dirname(path.abspath(__file__)) + '/docbook-manual.py' - -# List of files and dirs to exclude from the release tarball -exclude_list = ( - # System / build files - ".git*", - ".mailmap", - ".travis.yml", - "build.xml", - # User custom files - "config_inc.php", - "custom_constant*_inc.php", - "custom_functions_inc.php", - "custom_strings_inc.php", - "custom_relationships_inc.php", - "mantis_offline.php", - "mc_config_inc.php", - # Directories - "docbook/", - "javascript/dev/", - "packages/", - "phing/", - "tests/" - ) - - -def usage(): - print '''Builds a release (zip/tarball) - -Usage: %s [options] /path/for/tarballs [/path/to/mantisbt] - -Options: - -h | --help Show this usage message - - -c | --clean Remove build directory when completed - -d | --docbook Build and include the docbook manuals - -v | --version Override version name detection - -s | --suffix Include version suffix in config file -''' % path.basename(__file__) -#end usage() - - -def gpg_sign_tarball(filename): - ''' Sign the file using GPG ''' - gpgsign = "gpg -b -a %s" + path.abspath(path.join(os.curdir, filename)) - try: - subprocess.check_call(gpgsign % '--batch --yes ', shell=True) - except subprocess.CalledProcessError: - print "WARNING: GPG signature failed; to sign manually, run\n" \ - " %s" % (gpgsign % '') - - -def generate_checksum(filename): - ''' Generate MD5 and SHA1 checksums for the file ''' - f = open("%s.digests" % filename, 'w') - for method in ("md5", "sha1"): - checksum_cmd = "%ssum --binary " % method - checksum = os.popen(checksum_cmd + filename).read() - f.write(checksum) - print " %s: %s" % (method, checksum.rstrip()) - f.close() - - -def remove_build_dir(release_dir): - print "Removing build directory..." - shutil.rmtree(release_dir) - - -def main(): - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) - except getopt.GetoptError, err: - print str(err) - usage() - sys.exit(2) - - build_docbook = False - clean_build = False - mantis_version = "" - version_suffix = "" - - for opt, val in opts: - if opt in ("-h", "--help"): - usage() - sys.exit(0) - - elif opt in ("-c", "--clean"): - clean_build = True - - elif opt in ("-d", "--docbook"): - build_docbook = True - - elif opt in ("-v", "--version"): - mantis_version = val - - elif opt in ("-s", "--suffix"): - version_suffix = val - - if len(args) < 1: - usage() - sys.exit(1) - - release_path = args[0] - mantis_path = "." - - if len(args) > 1: - mantis_path = args[1] - - # 'Standard' umask - old_umask = os.umask(0002) - - # Check paths - if not path.isdir(release_path): - print "Creating release path..." - os.mkdir(release_path) - - if not path.isdir(mantis_path): - print "Error: mantis path is not a directory or does not exist." - sys.exit(3) - - if ( - not path.isfile(path.join(mantis_path, "core.php")) or - not path.isdir(path.join(mantis_path, "core")) or - not path.isfile(path.join(mantis_path, "core", "constant_inc.php")) - ): - print "Error: '%s' does not appear to be a valid Mantis directory." % \ - mantis_path - sys.exit(3) - - # Find Mantis version - if not mantis_version: - f = open(path.join(mantis_path, "core", "constant_inc.php")) - content = f.read() - f.close - - mantis_version = re.search("'MANTIS_VERSION'[,\s]+'([^']+)'", - content).group(1) - - # Generate release name - release_name = 'mantisbt-' + mantis_version - if version_suffix: - release_name += '-' + version_suffix - - # Copy to release path, excluding unwanted files - release_dir = path.abspath(path.join(release_path, release_name)) - - print "\nBuilding release '%s' in path '%s'" % (release_name, release_dir) - print " Source repository: '%s'\n" % mantis_path - - if path.exists(release_dir): - print "Error: release path already contains %s." % (release_name) - sys.exit(3) - - # Generate temp file with list of exclusions - fp = tempfile.NamedTemporaryFile(delete=False) - print " Excluded files and directories:" - for name in exclude_list: - print " " + name - fp.write(name + "\n") - fp.close() - - # Copy the files from the source repo, then delete temp file - rsync = "rsync -rltD --exclude-from=%s %s/ %s" % ( - fp.name, - mantis_path, - release_dir - ) - subprocess.check_call(rsync, shell=True) - - os.unlink(fp.name) - print " Copy complete.\n" - - # Apply version suffix - if version_suffix: - print "Applying version suffix..." - sed_cmd = "s/(%s\s*=\s*)'.*'/\\1'%s'/" % ( - 'g_version_suffix', - version_suffix - ) - subprocess.call( - 'sed -r -i.bak "%s" %s' % ( - sed_cmd, - path.join(release_dir, "config_defaults_inc.php") - ), - shell=True - ) - - # Build documentation for release - if build_docbook: - print "Building docbook manuals...\n" - subprocess.call( - manualscript + " --release %s %s" % ( - path.join(mantis_path, "docbook"), - path.join(release_dir, "doc") - ), - shell=True - ) - - # Create tarballs and sign them - print "Creating release tarballs..." - os.chdir(release_path) - tarball_ext = ("tar.gz", "zip") - - for ext in tarball_ext: - tarball = "%s.%s" % (release_name, ext) - print " " + tarball - - if ext == "tar.gz": - tar_cmd = "tar -czf" - elif ext == "zip": - tar_cmd = "zip -rq" - tar_cmd += " %s %s" - - subprocess.call(tar_cmd % (tarball, release_name), shell=True) - - print " Signing the tarball" - gpg_sign_tarball(tarball) - - print " Generating checksums..." - generate_checksum(tarball) - - # Cleanup - if clean_build: - print - remove_build_dir(release_dir) - - # Restore previous umask - os.umask(old_umask) - - print "Done!\n" - -#end main() - -if __name__ == "__main__": - main() diff --git a/check_apostrophe.php b/check_apostrophe.php deleted file mode 100755 index ceabb6b..0000000 --- a/check_apostrophe.php +++ /dev/null @@ -1,71 +0,0 @@ -0) { - $lang_files[] = $file; - } - } - closedir($handle); - } - } - # - --- - function found( $p_haystack, $p_needle ) { - if ( strpos( $p_haystack, $p_needle ) > 0 ) { - return true; - } else { - return false; - } - } - # - --- - function check_apostrophes( $p_file ) { - $strings = file( $p_file ); - $lang_strings = array(); - $counter = 0; - foreach( $strings as $string ) { - $counter++; - $string = trim( $string ); - $apostrophe_count = substr_count( $string, "'" ); - $apostrophe_escaped_count = substr_count( $string, "\'" ); - $diff = $apostrophe_count - $apostrophe_escaped_count; - if ( ( $diff ) > 2 ) { - echo "$counter: $diff\n"; - } - } - } - # - --- - function print_usage() { - echo "\nUsage:\n php -q check_apostrophe.php \n"; - } - # - --- - - # -- MAIN -- - $argv = $_SERVER['argv']; - $argc = $_SERVER['argc']; - - # too few arguments? - if ( $argc < 2 ) { - print_usage(); - exit; - } else if ( is_dir( $argv[1] ) ) { - print_usage(); - exit; - } - - echo "Processing: ".$argv[1]."\n"; - check_apostrophes( $argv[1] ); -?> diff --git a/check_formatting.php b/check_formatting.php deleted file mode 100755 index 1835098..0000000 --- a/check_formatting.php +++ /dev/null @@ -1,137 +0,0 @@ - 0 ) { - print "$p_file : $counter\n"; - } - $pos = strpos( $line, "[ \$" ); - if ( $pos > 0 ) { - print "$p_file : $counter\n"; - } - break; - case '-p': - # parenthesis - break; - case '-c': - # check for order of comparison ( constant == variable ) - break; - case '-m': - # check for // comment - $pos = strpos( $line, '//' ); - if ( FALSE !== $pos ) { - print "$p_file : $counter\n"; - } - break; - case '-n': - # check for ! with space - $pos = strpos( $line, '! ' ); - if ( FALSE !== $pos ) { - print "$p_file : $counter\n"; - } - break; - } # end switch - } - } - # - --- - # read in all files - function process_files( $p_dir ) { - $cwd = getcwd(); - $cwd .= '\\'.$p_dir; - chdir( $cwd ); - if ( $handle = opendir( $cwd ) ) { - #echo "Directory: ".getcwd()."\n"; - $file_arr = array(); - while (false !== ( $file = readdir( $handle ) )) { - $file_arr[] = $file; - } - closedir( $handle ); - foreach( $file_arr as $file ) { - #echo "file: $file\n"; - if (( '.' == $file )||( '..' == $file )||( 'CVS' == $file )) { - continue; - } - if ( TRUE == is_dir( $file ) ) { - # directory - #process_files( $file ); - } else { - process_file( $file ); - #echo "Processing: ".getcwd()."\\".$file."\n"; - } - } - } - chdir( '..' ); - } - # - --- - function print_usage() { - echo "\nUsage:\n php -q check_formatting.php