Created
February 17, 2013 19:12
-
-
Save jcfr/4972905 to your computer and use it in GitHub Desktop.
This is the script I used to upload the CTKAppLauncher packages to packages.kitware.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/cmake -P | |
message("Upload CTKAppLauncher packages") | |
set(MIDAS_URL "http://packages.kitware.com") | |
set(MIDAS_USER "[email protected]") | |
set(MIDAS_API_KEY YOUR_KEY_HERE) | |
set(midas_api_script ${CMAKE_CURRENT_LIST_DIR}/MidasAPI.cmake) | |
if(NOT EXISTS ${midas_api_script}) | |
file(DOWNLOAD ${MIDAS_URL}/api/rest?method=midas.packages.script.download ${CMAKE_CURRENT_LIST_DIR}/MidasAPI.cmake) | |
endif() | |
include(${midas_api_script}) | |
file(GLOB packages "CTKAppLauncher-*.tar.gz") | |
foreach(package ${packages}) | |
get_filename_component(PACKAGE_NAME ${package} NAME) | |
set(_version_regex "0.[0-9].[0-9][0-9]?") | |
set(_os_regex "-(win|linux|macosx|Darwin|Windows|Linux)") | |
set(PACKAGE_IS_RELEASE FALSE) | |
if(PACKAGE_NAME MATCHES ${_version_regex}${_os_regex}) | |
set(PACKAGE_IS_RELEASE TRUE) | |
endif() | |
string(REGEX MATCH ${_version_regex} PACKAGE_VERSION ${PACKAGE_NAME}) | |
string(REGEX MATCH ${_os_regex} _os ${PACKAGE_NAME}) | |
set(PACKAGE_OS "NA") | |
if(NOT ${_os} STREQUAL "") | |
if(${_os} MATCHES "-win|-Windows") | |
set(PACKAGE_OS "Windows") | |
elseif(${_os} MATCHES "-linux|-Linux") | |
set(PACKAGE_OS "Linux") | |
elseif(${_os} MATCHES "-macosx|-Darwin") | |
set(PACKAGE_OS "MacOSX") | |
endif() | |
endif() | |
set(PACKAGE_BITNESS "NA") | |
if(${PACKAGE_NAME} MATCHES "amd64") | |
set(PACKAGE_BITNESS "64-bit") | |
elseif(${PACKAGE_NAME} MATCHES "i386") | |
set(PACKAGE_BITNESS "32-bit") | |
endif() | |
if(PACKAGE_BITNESS STREQUAL "NA") | |
if(PACKAGE_OS MATCHES "Linux" OR PACKAGE_OS MATCHES "MacOSX") | |
set(PACKAGE_BITNESS "64-bit") | |
elseif(PACKAGE_OS MATCHES "Windows") | |
set(PACKAGE_BITNESS "32-bit") | |
endif() | |
endif() | |
message("----------------------") | |
message("${PACKAGE_NAME}") | |
message(" os: ${PACKAGE_OS}") | |
message(" bitness: ${PACKAGE_BITNESS}") | |
message(" version: ${PACKAGE_VERSION}") | |
message(" is_release: ${PACKAGE_IS_RELEASE}") | |
if(PACKAGE_IS_RELEASE) | |
midas_api_package_upload( | |
API_URL ${MIDAS_URL} | |
API_EMAIL ${MIDAS_USER} | |
API_KEY ${MIDAS_API_KEY} | |
FILE "${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_NAME}" | |
NAME ${PACKAGE_NAME} | |
FOLDER_ID 65 | |
APPLICATION_ID 10 | |
OS ${PACKAGE_OS} | |
ARCH ${PACKAGE_BITNESS} | |
PACKAGE_TYPE "TGZ Archive" | |
SUBMISSION_TYPE Experimental | |
RELEASE "${PACKAGE_VERSION}" | |
RESULT_VARNAME upload_status | |
) | |
message("Upload status: ${upload_status}") | |
endif() | |
endforeach() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment