From a84cb7fc3784697f2f5ef9b693192149589b75a6 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 22 Jul 2011 15:32:10 -0400 Subject: [PATCH 1/2] CC-2579: Upgrad fails 1.8->1.9 - moved all the config files to each upgrade dir - also fixed back up name of 1.9.0 conifg to 1.9.0(from 1.8.1) --- install_minimal/upgrades/airtime-1.7.0/airtime-upgrade.php | 4 +--- .../upgrades/airtime-1.7.0}/airtime.conf.170 | 0 install_minimal/upgrades/airtime-1.8.0/airtime-upgrade.php | 3 +-- .../upgrades/airtime-1.8.0}/airtime.conf.180 | 0 install_minimal/upgrades/airtime-1.8.1/airtime-upgrade.php | 3 +-- .../upgrades/airtime-1.8.1}/airtime.conf.181 | 0 install_minimal/upgrades/airtime-1.8.2/airtime-upgrade.php | 3 +-- .../upgrades/airtime-1.8.2}/airtime.conf.182 | 0 install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php | 2 +- 9 files changed, 5 insertions(+), 10 deletions(-) rename {airtime_mvc/build => install_minimal/upgrades/airtime-1.7.0}/airtime.conf.170 (100%) rename {airtime_mvc/build => install_minimal/upgrades/airtime-1.8.0}/airtime.conf.180 (100%) rename {airtime_mvc/build => install_minimal/upgrades/airtime-1.8.1}/airtime.conf.181 (100%) rename {airtime_mvc/build => install_minimal/upgrades/airtime-1.8.2}/airtime.conf.182 (100%) diff --git a/install_minimal/upgrades/airtime-1.7.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.7.0/airtime-upgrade.php index 89e157c88..f43e416f7 100644 --- a/install_minimal/upgrades/airtime-1.7.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.7.0/airtime-upgrade.php @@ -9,14 +9,12 @@ require_once(dirname(__FILE__).'/../../include/AirtimeIni.php'); require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php'); - /** * This function creates the /etc/airtime configuration folder * and copies the default config files to it. */ function CreateIniFiles() { - global $AIRTIME_SRC; global $AIRTIME_PYTHON_APPS; if (!file_exists("/etc/airtime/")){ @@ -26,7 +24,7 @@ function CreateIniFiles() } } - if (!copy($AIRTIME_SRC."/build/airtime.conf.170", CONF_FILE_AIRTIME)){ + if (!copy("airtime.conf.170", CONF_FILE_AIRTIME)){ echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; exit(1); } diff --git a/airtime_mvc/build/airtime.conf.170 b/install_minimal/upgrades/airtime-1.7.0/airtime.conf.170 similarity index 100% rename from airtime_mvc/build/airtime.conf.170 rename to install_minimal/upgrades/airtime-1.7.0/airtime.conf.170 diff --git a/install_minimal/upgrades/airtime-1.8.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.8.0/airtime-upgrade.php index b38f0dde6..897555da6 100644 --- a/install_minimal/upgrades/airtime-1.8.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.8.0/airtime-upgrade.php @@ -59,7 +59,6 @@ foreach ($configFiles as $conf) { */ function CreateIniFiles() { - global $AIRTIME_SRC; global $AIRTIME_PYTHON_APPS; if (!file_exists("/etc/airtime/")){ @@ -69,7 +68,7 @@ function CreateIniFiles() } } - if (!copy($AIRTIME_SRC."/build/airtime.conf.180", CONF_FILE_AIRTIME)){ + if (!copy("airtime.conf.180", CONF_FILE_AIRTIME)){ echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; exit(1); } diff --git a/airtime_mvc/build/airtime.conf.180 b/install_minimal/upgrades/airtime-1.8.0/airtime.conf.180 similarity index 100% rename from airtime_mvc/build/airtime.conf.180 rename to install_minimal/upgrades/airtime-1.8.0/airtime.conf.180 diff --git a/install_minimal/upgrades/airtime-1.8.1/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.8.1/airtime-upgrade.php index 46b8f7ebd..dad5f18d1 100644 --- a/install_minimal/upgrades/airtime-1.8.1/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.8.1/airtime-upgrade.php @@ -112,7 +112,6 @@ function LoadConfig($CC_CONFIG) { */ function CreateIniFiles() { - global $AIRTIME_SRC; global $AIRTIME_PYTHON_APPS; if (!file_exists("/etc/airtime/")){ @@ -122,7 +121,7 @@ function CreateIniFiles() } } - if (!copy($AIRTIME_SRC."/build/airtime.conf.181", CONF_FILE_AIRTIME)){ + if (!copy("airtime.conf.181", CONF_FILE_AIRTIME)){ echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; exit(1); } diff --git a/airtime_mvc/build/airtime.conf.181 b/install_minimal/upgrades/airtime-1.8.1/airtime.conf.181 similarity index 100% rename from airtime_mvc/build/airtime.conf.181 rename to install_minimal/upgrades/airtime-1.8.1/airtime.conf.181 diff --git a/install_minimal/upgrades/airtime-1.8.2/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.8.2/airtime-upgrade.php index a19aee382..29d799669 100644 --- a/install_minimal/upgrades/airtime-1.8.2/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.8.2/airtime-upgrade.php @@ -112,7 +112,6 @@ function LoadConfig($CC_CONFIG) { */ function CreateIniFiles() { - global $AIRTIME_SRC; global $AIRTIME_PYTHON_APPS; if (!file_exists("/etc/airtime/")){ @@ -122,7 +121,7 @@ function CreateIniFiles() } } - if (!copy($AIRTIME_SRC."/build/airtime.conf.182", CONF_FILE_AIRTIME)){ + if (!copy("airtime.conf.182", CONF_FILE_AIRTIME)){ echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; exit(1); } diff --git a/airtime_mvc/build/airtime.conf.182 b/install_minimal/upgrades/airtime-1.8.2/airtime.conf.182 similarity index 100% rename from airtime_mvc/build/airtime.conf.182 rename to install_minimal/upgrades/airtime-1.8.2/airtime.conf.182 diff --git a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php index 290e952d2..ca6c1208c 100644 --- a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php @@ -462,7 +462,7 @@ class AirtimeIni{ AirtimeIni::CONF_FILE_LIQUIDSOAP); // Backup the config files - $suffix = date("Ymdhis")."-1.8.1"; + $suffix = date("Ymdhis")."-1.9.0"; foreach ($configFiles as $conf) { if (file_exists($conf)) { echo "Backing up $conf to $conf$suffix.bak".PHP_EOL; From ccdb886b9aab3aa922164a4a1181cbf3447f0555 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 22 Jul 2011 16:24:31 -0400 Subject: [PATCH 2/2] CC-2584: airtime-import fails - fixed relative path problem - handle the case where file name contains '-' --- utils/airtime-import/airtime-import | 4 +++- utils/airtime-import/airtime-import.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/utils/airtime-import/airtime-import b/utils/airtime-import/airtime-import index 135b19252..ed62c8a72 100755 --- a/utils/airtime-import/airtime-import +++ b/utils/airtime-import/airtime-import @@ -3,6 +3,8 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" . ${virtualenv_bin}activate +invokePwd=$PWD + airtime_import_path="/usr/lib/airtime/utils/airtime-import/" airtime_import_script="airtime-import.py" @@ -14,6 +16,6 @@ exec 2>&1 export PYTHONPATH=${api_client_path} # Note the -u when calling python! we need it to get unbuffered binary stdout and stderr -exec python -u ${airtime_import_path}${airtime_import_script} "$@" +exec python -u ${airtime_import_path}${airtime_import_script} --dir "$invokePwd" "$@" # EOF diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index bf369bc51..5d00a8f1d 100644 --- a/utils/airtime-import/airtime-import.py +++ b/utils/airtime-import/airtime-import.py @@ -33,6 +33,10 @@ api_client = api_client.api_client_factory(config) # flag should be 'copy' or 'move' def copy_or_move_files_to(paths, dest, flag): for path in paths: + if (path[0] == "/" or path[0] == "~"): + path = os.path.realpath(path) + else: + path = currentDir+path if(os.path.exists(path)): if(os.path.isdir(path)): path = format_dir_string(path) @@ -73,7 +77,7 @@ def helper_get_stor_dir(): def checkOtherOption(args): for i in args: - if('-' in i): + if(i[0] == '-'): return True def errorIfMultipleOption(args, msg=''): @@ -243,6 +247,11 @@ parser.add_option('--storage-dir-set', action='callback', callback=StorageSetAct parser.add_option('--storage-dir-get', action='callback', callback=StorageGetAction, help='Show the current storage dir.') parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit') +# pop "--dir" +sys.argv.pop(1) +# pop "invoked pwd" +currentDir = sys.argv.pop(1)+'/' + if('-l' in sys.argv or '--link' in sys.argv): print "\nThe [-l][--link] option is deprecated. Please use the --watch-add option.\nTry 'airtime-import -h' for more detail.\n" sys.exit()