################################################################################ ## ## Copyright (c) 2007-2009 Illumina, Inc. ## ## This software is covered by the "Illumina Genome Analyzer Software ## License Agreement" and the "Illumina Source Code License Agreement", ## and certain third party copyright/licenses, and any user of this ## source file is bound by the terms therein (see accompanying files ## Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ## Illumina_Source_Code_License_Agreement.pdf and third party ## copyright/license notices). ## ## This file is part of the Consensus Assessment of Sequence And VAriation ## (CASAVA) software package. ## ## file unpackMultifileTarGz.cmake ## ## extracts the set of files matching the *.tar.gz.* pattern assuming they ## concatenate into a valid tar.gz file if ordered lexicographically ## arguments: ## SOURCE_ARCHIVE_FOLDER - Location of *.tar.gz.* files ## TARGET_FOLDER - Destination folder. Tar will -C ${TARGET_FOLDER} ## TAR_EXCLUDE_PATTERN - will add --exclude ${TAR_EXCLUDE_PATTERN} to the ## tar cmd line if not empty ## ## author Roman Petrovski ## ################################################################################ file(GLOB ARCHIVE_VOLUMES ${SOURCE_ARCHIVE_FOLDER}/*.tar.gz.*) IF(NOT EXISTS ${TARGET_FOLDER}/.unpacked) IF(NOT "${TAR_EXCLUDE_PATTERN}" STREQUAL "") set(TAR_ARGS --exclude "${TAR_EXCLUDE_PATTERN}") ENDIF(NOT "${TAR_EXCLUDE_PATTERN}" STREQUAL "") execute_process(COMMAND mkdir -p ${TARGET_FOLDER}) execute_process(COMMAND echo "${ARCHIVE_VOLUMES}" COMMAND sed "s/;/\\n/g" COMMAND sort COMMAND xargs -L 1 cat COMMAND tar -xzv ${TAR_ARGS} -C ${TARGET_FOLDER} RESULT_VARIABLE UNPACK_RESULT ) IF(NOT ${UNPACK_RESULT}) execute_process(COMMAND touch ${TARGET_FOLDER}/.unpacked) ENDIF(NOT ${UNPACK_RESULT}) ENDIF(NOT EXISTS ${TARGET_FOLDER}/.unpacked)