merge(3p/git): Merge git subtree at v2.29.2
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
This commit is contained in:
parent
082c006c04
commit
f4609b896f
1485 changed files with 241535 additions and 109418 deletions
|
@ -13,7 +13,8 @@
|
|||
|
||||
. ./test.config
|
||||
|
||||
WIKI_URL=http://"$SERVER_ADDR:$PORT/$WIKI_DIR_NAME"
|
||||
WIKI_BASE_URL=http://$SERVER_ADDR:$PORT
|
||||
WIKI_URL=$WIKI_BASE_URL/$WIKI_DIR_NAME
|
||||
CURR_DIR=$(pwd)
|
||||
TEST_OUTPUT_DIRECTORY=$(pwd)
|
||||
TEST_DIRECTORY="$CURR_DIR"/../../../t
|
||||
|
@ -65,7 +66,7 @@ test_check_precond () {
|
|||
GIT_EXEC_PATH=$(cd "$(dirname "$0")" && cd "../.." && pwd)
|
||||
PATH="$GIT_EXEC_PATH"'/bin-wrapper:'"$PATH"
|
||||
|
||||
if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ];
|
||||
if ! test -d "$WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
then
|
||||
skip_all='skipping gateway git-mw tests, no mediawiki found'
|
||||
test_done
|
||||
|
@ -279,7 +280,7 @@ start_lighttpd () {
|
|||
"$LIGHTTPD_DIR"/lighttpd -f "$WEB"/lighttpd.conf
|
||||
|
||||
if test $? -ne 0 ; then
|
||||
echo "Could not execute http deamon lighttpd"
|
||||
echo "Could not execute http daemon lighttpd"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -291,27 +292,59 @@ stop_lighttpd () {
|
|||
test -f "$WEB_TMP/pid" && kill $(cat "$WEB_TMP/pid")
|
||||
}
|
||||
|
||||
# Create the SQLite database of the MediaWiki. If the database file already
|
||||
# exists, it will be deleted.
|
||||
# This script should be runned from the directory where $FILES_FOLDER is
|
||||
# located.
|
||||
create_db () {
|
||||
rm -f "$TMP/$DB_FILE"
|
||||
wiki_delete_db () {
|
||||
rm -rf \
|
||||
"$FILES_FOLDER_DB"/* || error "Couldn't delete $FILES_FOLDER_DB/"
|
||||
}
|
||||
|
||||
echo "Generating the SQLite database file. It can take some time ..."
|
||||
# Run the php script to generate the SQLite database file
|
||||
# with cURL calls.
|
||||
php "$FILES_FOLDER/$DB_INSTALL_SCRIPT" $(basename "$DB_FILE" .sqlite) \
|
||||
"$WIKI_ADMIN" "$WIKI_PASSW" "$TMP" "$PORT"
|
||||
wiki_delete_db_backup () {
|
||||
rm -rf \
|
||||
"$FILES_FOLDER_POST_INSTALL_DB"/* || error "Couldn't delete $FILES_FOLDER_POST_INSTALL_DB/"
|
||||
}
|
||||
|
||||
if [ ! -f "$TMP/$DB_FILE" ] ; then
|
||||
error "Can't create database file $TMP/$DB_FILE. Try to run ./install-wiki.sh delete first."
|
||||
# Install MediaWiki using its install.php script. If the database file
|
||||
# already exists, it will be deleted.
|
||||
install_mediawiki () {
|
||||
|
||||
localsettings="$WIKI_DIR_INST/$WIKI_DIR_NAME/LocalSettings.php"
|
||||
if test -f "$localsettings"
|
||||
then
|
||||
error "We already installed the wiki, since $localsettings exists" \
|
||||
"perhaps you wanted to run 'delete' first?"
|
||||
fi
|
||||
|
||||
# Copy the generated database file into the directory the
|
||||
# user indicated.
|
||||
cp "$TMP/$DB_FILE" "$FILES_FOLDER" ||
|
||||
error "Unable to copy $TMP/$DB_FILE to $FILES_FOLDER"
|
||||
wiki_delete_db
|
||||
wiki_delete_db_backup
|
||||
mkdir \
|
||||
"$FILES_FOLDER_DB/" \
|
||||
"$FILES_FOLDER_POST_INSTALL_DB/"
|
||||
|
||||
install_script="$WIKI_DIR_INST/$WIKI_DIR_NAME/maintenance/install.php"
|
||||
echo "Installing MediaWiki using $install_script. This may take some time ..."
|
||||
|
||||
php "$WIKI_DIR_INST/$WIKI_DIR_NAME/maintenance/install.php" \
|
||||
--server $WIKI_BASE_URL \
|
||||
--scriptpath /wiki \
|
||||
--lang en \
|
||||
--dbtype sqlite \
|
||||
--dbpath $PWD/$FILES_FOLDER_DB/ \
|
||||
--pass "$WIKI_PASSW" \
|
||||
Git-MediaWiki-Test \
|
||||
"$WIKI_ADMIN" ||
|
||||
error "Couldn't run $install_script, see errors above. Try to run ./install-wiki.sh delete first."
|
||||
cat <<-'EOF' >>$localsettings
|
||||
# Custom settings added by test-gitmw-lib.sh
|
||||
#
|
||||
# Uploading text files is needed for
|
||||
# t9363-mw-to-git-export-import.sh
|
||||
$wgEnableUploads = true;
|
||||
$wgFileExtensions[] = 'txt';
|
||||
EOF
|
||||
|
||||
# Copy the initially generated database file into our backup
|
||||
# folder
|
||||
cp -R "$FILES_FOLDER_DB/"* "$FILES_FOLDER_POST_INSTALL_DB/" ||
|
||||
error "Unable to copy $FILES_FOLDER_DB/* to $FILES_FOLDER_POST_INSTALL_DB/*"
|
||||
}
|
||||
|
||||
# Install a wiki in your web server directory.
|
||||
|
@ -320,30 +353,33 @@ wiki_install () {
|
|||
start_lighttpd
|
||||
fi
|
||||
|
||||
SERVER_ADDR=$SERVER_ADDR:$PORT
|
||||
# In this part, we change directory to $TMP in order to download,
|
||||
# unpack and copy the files of MediaWiki
|
||||
(
|
||||
mkdir -p "$WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ] ; then
|
||||
if ! test -d "$WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
then
|
||||
error "Folder $WIKI_DIR_INST/$WIKI_DIR_NAME doesn't exist.
|
||||
Please create it and launch the script again."
|
||||
fi
|
||||
|
||||
# Fetch MediaWiki's archive if not already present in the TMP directory
|
||||
# Fetch MediaWiki's archive if not already present in the
|
||||
# download directory
|
||||
mkdir -p "$FILES_FOLDER_DOWNLOAD"
|
||||
MW_FILENAME="mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
|
||||
cd "$TMP"
|
||||
if [ ! -f $MW_FILENAME ] ; then
|
||||
cd "$FILES_FOLDER_DOWNLOAD"
|
||||
if ! test -f $MW_FILENAME
|
||||
then
|
||||
echo "Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ..."
|
||||
wget "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME" ||
|
||||
error "Unable to download "\
|
||||
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
|
||||
"$MW_FILENAME. "\
|
||||
"Please fix your connection and launch the script again."
|
||||
echo "$MW_FILENAME downloaded in $(pwd). "\
|
||||
"You can delete it later if you want."
|
||||
echo "$MW_FILENAME downloaded in $(pwd)/;" \
|
||||
"you can delete it later if you want."
|
||||
else
|
||||
echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
|
||||
echo "Reusing existing $MW_FILENAME downloaded in $(pwd)/"
|
||||
fi
|
||||
archive_abs_path=$(pwd)/$MW_FILENAME
|
||||
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
|
||||
|
@ -352,48 +388,12 @@ wiki_install () {
|
|||
error "Unable to extract WikiMedia's files from $archive_abs_path to "\
|
||||
"$WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
) || exit 1
|
||||
echo Extracted in "$WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
|
||||
create_db
|
||||
|
||||
# Copy the generic LocalSettings.php in the web server's directory
|
||||
# And modify parameters according to the ones set at the top
|
||||
# of this script.
|
||||
# Note that LocalSettings.php is never modified.
|
||||
if [ ! -f "$FILES_FOLDER/LocalSettings.php" ] ; then
|
||||
error "Can't find $FILES_FOLDER/LocalSettings.php " \
|
||||
"in the current folder. "\
|
||||
"Please run the script inside its folder."
|
||||
fi
|
||||
cp "$FILES_FOLDER/LocalSettings.php" \
|
||||
"$FILES_FOLDER/LocalSettings-tmp.php" ||
|
||||
error "Unable to copy $FILES_FOLDER/LocalSettings.php " \
|
||||
"to $FILES_FOLDER/LocalSettings-tmp.php"
|
||||
|
||||
# Parse and set the LocalSettings file of the user according to the
|
||||
# CONFIGURATION VARIABLES section at the beginning of this script
|
||||
file_swap="$FILES_FOLDER/LocalSettings-swap.php"
|
||||
sed "s,@WG_SCRIPT_PATH@,/$WIKI_DIR_NAME," \
|
||||
"$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap"
|
||||
mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php"
|
||||
sed "s,@WG_SERVER@,http://$SERVER_ADDR," \
|
||||
"$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap"
|
||||
mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php"
|
||||
sed "s,@WG_SQLITE_DATADIR@,$TMP," \
|
||||
"$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap"
|
||||
mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php"
|
||||
sed "s,@WG_SQLITE_DATAFILE@,$( basename $DB_FILE .sqlite)," \
|
||||
"$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap"
|
||||
mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php"
|
||||
|
||||
mv "$FILES_FOLDER/LocalSettings-tmp.php" \
|
||||
"$WIKI_DIR_INST/$WIKI_DIR_NAME/LocalSettings.php" ||
|
||||
error "Unable to move $FILES_FOLDER/LocalSettings-tmp.php" \
|
||||
"in $WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
echo "File $FILES_FOLDER/LocalSettings.php is set in" \
|
||||
" $WIKI_DIR_INST/$WIKI_DIR_NAME"
|
||||
install_mediawiki
|
||||
|
||||
echo "Your wiki has been installed. You can check it at
|
||||
http://$SERVER_ADDR/$WIKI_DIR_NAME"
|
||||
$WIKI_URL"
|
||||
}
|
||||
|
||||
# Reset the database of the wiki and the password of the admin
|
||||
|
@ -401,12 +401,18 @@ wiki_install () {
|
|||
# Warning: This function must be called only in a subdirectory of t/ directory
|
||||
wiki_reset () {
|
||||
# Copy initial database of the wiki
|
||||
if [ ! -f "../$FILES_FOLDER/$DB_FILE" ] ; then
|
||||
error "Can't find ../$FILES_FOLDER/$DB_FILE in the current folder."
|
||||
if ! test -d "../$FILES_FOLDER_DB"
|
||||
then
|
||||
error "No wiki database at ../$FILES_FOLDER_DB, not installed yet?"
|
||||
fi
|
||||
cp "../$FILES_FOLDER/$DB_FILE" "$TMP" ||
|
||||
error "Can't copy ../$FILES_FOLDER/$DB_FILE in $TMP"
|
||||
echo "File $FILES_FOLDER/$DB_FILE is set in $TMP"
|
||||
if ! test -d "../$FILES_FOLDER_POST_INSTALL_DB"
|
||||
then
|
||||
error "No wiki backup database at ../$FILES_FOLDER_POST_INSTALL_DB, failed installation?"
|
||||
fi
|
||||
wiki_delete_db
|
||||
cp -R "../$FILES_FOLDER_POST_INSTALL_DB/"* "../$FILES_FOLDER_DB/" ||
|
||||
error "Can't copy ../$FILES_FOLDER_POST_INSTALL_DB/* to ../$FILES_FOLDER_DB/*"
|
||||
echo "File $FILES_FOLDER_DB/* has been reset"
|
||||
}
|
||||
|
||||
# Delete the wiki created in the web server's directory and all its content
|
||||
|
@ -420,13 +426,7 @@ wiki_delete () {
|
|||
rm -rf "$WIKI_DIR_INST/$WIKI_DIR_NAME" ||
|
||||
error "Wiki's directory $WIKI_DIR_INST/" \
|
||||
"$WIKI_DIR_NAME could not be deleted"
|
||||
# Delete the wiki's SQLite database.
|
||||
rm -f "$TMP/$DB_FILE" ||
|
||||
error "Database $TMP/$DB_FILE could not be deleted."
|
||||
fi
|
||||
|
||||
# Delete the wiki's SQLite database
|
||||
rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted."
|
||||
rm -f "$FILES_FOLDER/$DB_FILE"
|
||||
rm -rf "$TMP/mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
|
||||
wiki_delete_db
|
||||
wiki_delete_db_backup
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue