From 7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3 Mon Sep 17 00:00:00 2001 From: Vincent Petithory Date: Tue, 24 Sep 2013 20:41:01 +0200 Subject: Remove deprecated client-updates --- client/client-updates/.gitignore | 3 - client/client-updates/README | 69 --------------- client/client-updates/README.init.verbose.txt | 97 ---------------------- client/client-updates/release/news.txt | 0 client/client-updates/release/resources.xml | 3 - client/client-updates/release/resources2.txt | 0 client/client-updates/src/adler32.c | 68 --------------- client/client-updates/src/client-updates-gen | 68 --------------- client/client-updates/src/client-updates-inspect | 20 ----- client/client-updates/src/client-updates-news | 14 ---- client/client-updates/src/client-updates-push | 8 -- .../client-updates/src/client-updates.conf.example | 15 ---- client/client-updates/src/makefile | 9 -- 13 files changed, 374 deletions(-) delete mode 100644 client/client-updates/.gitignore delete mode 100644 client/client-updates/README delete mode 100644 client/client-updates/README.init.verbose.txt delete mode 100644 client/client-updates/release/news.txt delete mode 100644 client/client-updates/release/resources.xml delete mode 100644 client/client-updates/release/resources2.txt delete mode 100644 client/client-updates/src/adler32.c delete mode 100755 client/client-updates/src/client-updates-gen delete mode 100755 client/client-updates/src/client-updates-inspect delete mode 100755 client/client-updates/src/client-updates-news delete mode 100755 client/client-updates/src/client-updates-push delete mode 100644 client/client-updates/src/client-updates.conf.example delete mode 100644 client/client-updates/src/makefile diff --git a/client/client-updates/.gitignore b/client/client-updates/.gitignore deleted file mode 100644 index c369c66..0000000 --- a/client/client-updates/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/src/adler32 -/src/client-updates.conf - diff --git a/client/client-updates/README b/client/client-updates/README deleted file mode 100644 index 56026b8..0000000 --- a/client/client-updates/README +++ /dev/null @@ -1,69 +0,0 @@ -######################################## -# How to use the client updates system # -######################################## - -# Initial setup - -1. compile adler32: Run 'make' in the src directory. -2. Copy example config and edit it to your needs: - $ cp client-updates.conf.example client-updates.conf -3. Optionally, put the client-update-{gen,news,inspect,push} in your PATH -4. Init a git repository for the client-updates dir, as zip updates will be committed. - $ git init - $ git add . - $ git commit -m 'Initial scripts' - -Now we have to generate the base update. -If you have already base zip files, you can include them in the release/ directory. -Fill properly the resources.xml and resources2.xml files. -Otherwise, run client-updates-gen with proper arguments. -1st arg is base commit, 2nd arg is final commit (HEAD if omitted). - -# Overview -The process to manage client updates is as follows: - -1. a developer needs to include new client data. -2. if not done already, he/she will set up a personal branch in the tmwa-client-data repo - and pull what is necessary. -3. the tmwa-client-data repo has a "testing" branch which is the reference for generating the updates. - there is also the "master" branch which is in sync with mainline. - the developer will perform a merge in the "testing" branch, and if necessary resolve the conflicts. -4. $ client-updates-gen - will generate if necessary a new zip and display its contents. -5. optionally, you can check the contents of the updates is correct: - $ client-updates-inspect - This will list the contents of all updates in a pager, from most recent to oldest. -6. $ client-updates-push - will sync the client updates to the local webserver directory - -As a general rule, never break the history of the "$CLIENT_DATA_BRANCH" branch of the tmwa-client-data repository. - -# Handling news -- only useful if not using the news of the server-data. - -1. $ client-updates-news - will open the news.txt for editing. -2. Publish these changes. - $ client-updates-push - -# Details on the client-updates-gen script - -This script analyses the client data repo and generates -a zip file with the files changed / added between 2 revisions. - -The script will check the differences between HEAD and the latest reference commit. -The reference commit is determined by the latest entry in $UPDATES_DIR/resources2.src.txt - -# Config file (client-updates.conf) - -Several variables for finding the UPDATES_DIR, the client data repository, -and ftp credentials. -Find it next to client-updates-* scripts. - -# Client updates repository - -A local git repository is used for managing these scripts. -This repository has 2 branches: master and updates -The repository should always be left on the branch "updates": most scripts will write commits -when updates are issued or when news.txt is updated. -When you need to change things in the core scripts, change to master, commit, then rebase the "updates" branch. - diff --git a/client/client-updates/README.init.verbose.txt b/client/client-updates/README.init.verbose.txt deleted file mode 100644 index a0d3374..0000000 --- a/client/client-updates/README.init.verbose.txt +++ /dev/null @@ -1,97 +0,0 @@ -$ ~/Desktop ➜ mkdir client-data-test -$ ~/Desktop ➜ cd client-data-test -$ ~/Desktop/client-data-test ➜ git clone git://github.com/themanaworld/tmwa-client-data.git -Cloning into 'tmwa-client-data'... -remote: Counting objects: 15162, done. -remote: Compressing objects: 100% (5452/5452), done. -remote: Total 15162 (delta 9679), reused 15083 (delta 9629) -Receiving objects: 100% (15162/15162), 58.81 MiB | 188 KiB/s, done. -Resolving deltas: 100% (9679/9679), done. -$ ~/Desktop/client-data-test ➜ ls -tmwa-client-data -$ ~/Desktop/client-data-test ➜ cp -a tmwa-client-data/tools/client-updates . -$ ~/Desktop/client-data-test ➜ ls -client-updates tmwa-client-data -$ ~/Desktop/client-data-test ➜ cd client-updates -$ ~/Desktop/client-data-test/client-updates ➜ ls -README release src -$ ~/Desktop/client-data-test/client-updates ➜ cd src -$ ~/Desktop/client-data-test/client-updates/src ➜ make -gcc -lz -o adler32 adler32.c -$ ~/Desktop/client-data-test/client-updates/src ➜ cp client-updates.conf.example client-updates.conf -$ ~/Desktop/client-data-test/client-updates/src ➜ vim client-updates.conf -$ ~/Desktop/client-data-test/client-updates/src ➜ cat client-updates.conf -# The client-data directory -CLIENT_DATA_DIR="$HOME/Desktop/client-data-test/tmwa-client-data" - -# The updates working directory -UPDATES_DIR="$HOME/Desktop/client-data-test/client-updates" - -# The git branch used for generating the updates -# This allows for more complex setups, where e.g a branch is used for merging -# from various other branches. It's used on the testing server -# Defaults to master -CLIENT_DATA_BRANCH=master - -# Local directory served by the web server, -# where the update files will be copied -UPDATES_PUBLISH_DIR="$HOME/Desktop/client-data-test/www" -$ ~/Desktop/client-data-test/client-updates/src ➜ cd .. -$ ~/Desktop/client-data-test/client-updates ➜ git init -Initialized empty Git repository in /home/vincent/Desktop/client-data-test/client-updates/.git/ -$ ~/Desktop/client-data-test/client-updates ➜ git add . -$ ~/Desktop/client-data-test/client-updates ➜ git commit -m 'Initial scripts' -[master (root-commit) 88b4d1f] Initial scripts - 12 files changed, 277 insertions(+) - create mode 100644 .gitignore - create mode 100644 README - create mode 100644 release/news.txt - create mode 100644 release/resources.xml - create mode 100644 release/resources2.txt - create mode 100644 src/adler32.c - create mode 100755 src/client-updates-gen - create mode 100755 src/client-updates-inspect - create mode 100755 src/client-updates-news - create mode 100755 src/client-updates-push - create mode 100644 src/client-updates.conf.example - create mode 100644 src/makefile -$ ~/Desktop/client-data-test/client-updates ➜ cd ../tmwa-client-data -$ ~/Desktop/client-data-test/tmwa-client-data ➜ git log --oneline | tail -n 1 -840c732 *** empty log message *** -$ ~/Desktop/client-data-test/tmwa-client-data ➜ cd .. -$ ~/Desktop/client-data-test ➜ mkdir www -$ ~/Desktop/client-data-test ➜ ls -client-updates tmwa-client-data www -$ ~/Desktop/client-data-test ➜ ./client-updates/src/client-updates-gen 840c732 -Adding update-840c732..15ff3ba.zip: -Archive: update-840c732..15ff3ba.zip - Length Date Time Name ---------- ---------- ----- ---- - 191 02-06-2013 17:22 charcreation.xml - 18009 02-06-2013 17:22 COPYING - 1657 02-06-2013 17:22 ea-skills.xml -.................. MORE FILES HERE -........ -........ ---------- ------- - 20138266 1793 files -$ ~/Desktop/client-data-test ➜ ls client-updates/release -news.txt resources2.txt resources.xml update-840c732..15ff3ba.zip -$ ~/Desktop/client-data-test ➜ cat client-updates/release/{news.txt,resources2.txt,resources.xml} -update-840c732..15ff3ba.zip 71aa03f0 - - - - -$ ~/Desktop/client-data-test ➜ ./client-updates/src/client-updates-push -sending incremental file list -./ -news.txt -resources.xml -resources2.txt -update-840c732..15ff3ba.zip - -sent 16973826 bytes received 91 bytes 33947834.00 bytes/sec -total size is 16971447 speedup is 1.00 -$ ~/Desktop/client-data-test ➜ ls www -news.txt resources2.txt resources.xml update-840c732..15ff3ba.zip diff --git a/client/client-updates/release/news.txt b/client/client-updates/release/news.txt deleted file mode 100644 index e69de29..0000000 diff --git a/client/client-updates/release/resources.xml b/client/client-updates/release/resources.xml deleted file mode 100644 index faab981..0000000 --- a/client/client-updates/release/resources.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/client/client-updates/release/resources2.txt b/client/client-updates/release/resources2.txt deleted file mode 100644 index e69de29..0000000 diff --git a/client/client-updates/src/adler32.c b/client/client-updates/src/adler32.c deleted file mode 100644 index 5dd7e4c..0000000 --- a/client/client-updates/src/adler32.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * adler32.c (c) 2006 Bjorn Lindeijer - * License: GPL, v2 or later - * - * Calculates Adler-32 checksums for all files passed as argument. - * - * Usage: adler32 [file]... - */ - -#include -#include -#include - -/** - * Calculates the Adler-32 checksum for the given file. - */ -unsigned long fadler32(FILE *file) -{ - // Obtain file size - fseek(file, 0, SEEK_END); - long fileSize = ftell(file); - rewind(file); - - // Calculate Adler-32 checksum - char *buffer = (char*) malloc(fileSize); - fread(buffer, 1, fileSize, file); - unsigned long adler = adler32(0L, Z_NULL, 0); - adler = adler32(adler, (Bytef*) buffer, fileSize); - free(buffer); - - return adler; -} - -/** - * Prints out usage and exists. - */ -void print_usage() -{ - printf("Usage: adler32 [file]...\n"); - exit(0); -} - -int main(int argc, char *argv[]) -{ - int i; /**< Loops through arguments. */ - - if (argc == 1) - { - print_usage(); - } - - for (i = 1; i < argc; ++i) - { - FILE *file = fopen(argv[i], "r"); - - if (!file) - { - printf("Error while opening '%s' for reading!\n", argv[i]); - exit(1); - } - - unsigned long adler = fadler32(file); - printf("%s %lx\n", argv[i], adler); - fclose(file); - } - - return 0; -} diff --git a/client/client-updates/src/client-updates-gen b/client/client-updates/src/client-updates-gen deleted file mode 100755 index 76c0ed3..0000000 --- a/client/client-updates/src/client-updates-gen +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -# Check we are on the $CLIENT_DATA_BRANCH branch -git --git-dir "${CLIENT_DATA_DIR}/.git" branch | grep -q "^* $CLIENT_DATA_BRANCH" || { echo "The client-data repository is not on $CLIENT_DATA_BRANCH branch. Exiting"; exit 2; } - -# Unless specified on 1st argument, we'll use the latest revision that was -# included in updates, as starting revision. -# If this is the initial generation, this argument is mandatory. -if [ $# -gt 0 ]; then - OLD_CLIENT_DATA_HEAD="$1" -else - # Get the last commit sha where we generated an update - # This assumes the generated zip names follow the pattern: update-SHA1..SHA2.zip - OLD_CLIENT_DATA_HEAD=$(tail -n 1 ${UPDATES_DIR}/release/resources2.txt | cut -d . -f 3) -fi - -# Unless specified on 2nd argument, we'll use the HEAD as final revision. -if [ $# -gt 1 ]; then - NEW_CLIENT_DATA_HEAD="$2" -else - # get the commit SHA from the client data repo - NEW_CLIENT_DATA_HEAD=$(git --git-dir "${CLIENT_DATA_DIR}/.git" rev-parse HEAD | cut -c 1-7) -fi - -if [ "$OLD_CLIENT_DATA_HEAD" = "$NEW_CLIENT_DATA_HEAD" ]; then - echo "Everything is up-to-date." - exit 0 -fi - -update_basename="update-${OLD_CLIENT_DATA_HEAD}..${NEW_CLIENT_DATA_HEAD}" - -# generate a diff of files to package -cd ${CLIENT_DATA_DIR} -git --git-dir "${CLIENT_DATA_DIR}/.git" log --name-status ${OLD_CLIENT_DATA_HEAD}..${NEW_CLIENT_DATA_HEAD} | awk '/^(A|M)\t/ {print $2}' | sort | uniq | xargs zip -9 -r "${UPDATES_DIR}/${update_basename}.zip" > /dev/null -cd - > /dev/null - -if [ ! -f "${UPDATES_DIR}/${update_basename}.zip" ];then - echo "Error while generating ${update_basename}.zip. Exiting." > /dev/stderr - exit 1 -fi - -# package update -cd "${UPDATES_DIR}" -mkdir -p "release" -${SRC}/adler32 "${update_basename}.zip" >> "release/resources2.txt" -hash=$(tail -n 1 "release/resources2.txt" | awk '{ print $2; }') -# populate resources.xml as well -xmlentry="" - -sed -i '$d' 'release/resources.xml' -echo " $xmlentry" >> 'release/resources.xml' -echo '' >> 'release/resources.xml' - -echo "Adding ${update_basename}.zip:" -# Display the contents of the update -unzip -l ${update_basename}.zip -mv "${update_basename}.zip" "release/" -# Copy resources -git add 'release' -git commit -m "Updating resources to ${NEW_CLIENT_DATA_HEAD}" > /dev/null -cd - > /dev/null - -exit 0 diff --git a/client/client-updates/src/client-updates-inspect b/client/client-updates/src/client-updates-inspect deleted file mode 100755 index 03ae2d6..0000000 --- a/client/client-updates/src/client-updates-inspect +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -#config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -DIRECTORY="${UPDATES_DIR}/release" -listing=$(mktemp) -IFS=' -' -for f in $(tac $DIRECTORY/resources2.txt); do - file=$(awk '{ print $1; }' <<< $f) - unzip -l "$DIRECTORY/$file" >> $listing -done - -if [ -f "$listing" ]; then - less "$listing" -fi -rm -f "$listing" diff --git a/client/client-updates/src/client-updates-news b/client/client-updates/src/client-updates-news deleted file mode 100755 index bc78e4e..0000000 --- a/client/client-updates/src/client-updates-news +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -# Edit news.txt -nano "${UPDATES_DIR}"/release/news.txt - -# Commit if changed -cd "${UPDATES_DIR}" -git status | grep -q 'news.txt' && { git add release/news.txt; git commit -m 'Updating news.txt' > /dev/null; } -cd - > /dev/null diff --git a/client/client-updates/src/client-updates-push b/client/client-updates/src/client-updates-push deleted file mode 100755 index edeae49..0000000 --- a/client/client-updates/src/client-updates-push +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -rsync -av --delete "$UPDATES_DIR/release/" "$UPDATES_PUBLISH_DIR" diff --git a/client/client-updates/src/client-updates.conf.example b/client/client-updates/src/client-updates.conf.example deleted file mode 100644 index 8bdce43..0000000 --- a/client/client-updates/src/client-updates.conf.example +++ /dev/null @@ -1,15 +0,0 @@ -# The client-data directory -CLIENT_DATA_DIR="$HOME/tmwa-client-data" - -# The updates working directory -UPDATES_DIR="$HOME/client-updates" - -# The git branch used for generating the updates -# This allows for more complex setups, where e.g a branch is used for merging -# from various other branches. It's used on the testing server -# Defaults to master -CLIENT_DATA_BRANCH=master - -# Local directory served by the web server, -# where the update files will be copied -UPDATES_PUBLISH_DIR="$HOME/www/tmwupdate" diff --git a/client/client-updates/src/makefile b/client/client-updates/src/makefile deleted file mode 100644 index 00acaf0..0000000 --- a/client/client-updates/src/makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: adler32 - -adler32: adler32.c - gcc -lz -o $@ $< - -clean: - rm -f adler32 - -.PHONY: clean -- cgit v1.2.3-60-g2f50