AspireSync/svn/bin/prelude.bash
Chuck Adams 5fcc4b8eb8
update popular themes/plugins scripts for subversion repo archival (#48)
* wip: use revision as dir hash for archive files

* tweak: slightly more verbose output

* tweak: quote directory being removed

* tweak: prettier header

* fix: use -e because lolbash

* tweak: add countdown-timer to blacklist

* fix: refactor blacklist and anchor the patterns

* feat: popular-plugins and popular-themes now output json

* refactor: mv svn/bin/popular-* bin/

* feat: trunk-only builds

* tweak: add more huge slugs before populating them scientifically

* wip: add some more unscientific slugs

* tweak: add 10M+ archive files to the 'huge' pile

* tweak:  update huge and add facebook-album-sync to corrupt

* feat: add IMMEDIATES_DEPTH to support empty checkouts

* fix: svn update missing directories automatically

* feat: specifically throw woocommerce into the trunk-only bin

* fix: drop __trunk entries from trunk-only

* refactor: break trunk-only.txt out from script source

* fix: use grep and not bash regex for trunk-only test

* tweak: add font-awesome-the-easy-way to corrupt

* update: update trunk-only.txt with more slugs

* tweak: show depth used, as trunk-only is now the norm

* tweak: break out suffix generation into function

* feat: new update-trunk-archive which will replace update-archive

* tweak: get tags before trunk

* zap: rm update-archive

* tweak: less noisy banner

* feat: sync popular plugins and themes on every run
2025-02-18 15:10:20 -07:00

62 lines
No EOL
1.2 KiB
Bash

# This file should be sourced, not run
[[ -n $TRACE ]] && [[ $TRACE != 0 ]] && set -x
set -o errexit
ORIG_PWD=$(pwd)
cd $(dirname $0)/..
BASE_DIR=$(pwd)
DATA_DIR=${DATA_DIR:-$HOME/svn-data} # should NOT be under the project root, it freaks IDEA out even if its excluded
ARCHIVE_DIR=${ARCHIVE_DIR:-$DATA_DIR/archive}
TMPDIR=${TMPDIR:-/tmp} # no underscore on this one, it's an old unixism
mkdir -p $DATA_DIR $ARCHIVE_DIR
PLUGINS_REMOTE=${PLUGINS_REMOTE:-https://plugins.svn.wordpress.org}
THEMES_REMOTE=${THEMES_REMOTE:-https://themes.svn.wordpress.org}
YMD=$(date +%Y-%m-%d)
function warn {
echo "$@" >&2
}
function die() {
warn "$@"
exit 1
}
function RUN() {
[[ -n $DRY_RUN ]] && [[ $DRY_RUN != 0 ]] && _run=echo
$_run "$@"
}
function enforce_svn_root() {
[[ -d .svn ]] || die "$(pwd) does not look like a svn checkout -- exiting"
}
function _use_checkout() {
type=$1
remote=$2
cd $DATA_DIR
mkdir -p svn/$type
cd svn/$type
if [[ -d .svn ]]; then
$BASE_DIR/bin/svn-get-immediates
else
depth=${IMMEDIATES_DEPTH:-immediates}
svn checkout --ignore-externals --depth=$depth $remote
fi
}
function use_plugins() {
_use_checkout plugins $PLUGINS_REMOTE
}
function use_themes() {
_use_checkout themes $THEMES_REMOTE
}