Skip to content

Commit

Permalink
Don't package tests and workspace subdirs into source dist.
Browse files Browse the repository at this point in the history
Did this by extending git-untracked-files to accept a list of subdirectories
which to add to CPack's exclusion list.
  • Loading branch information
mjuric committed Jun 30, 2010
1 parent 6bf007d commit 9c5c28f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ install (TARGETS galfast DESTINATION bin)
#

execute_process(
COMMAND "${PROJECT_SOURCE_DIR}/git-untracked-files" "${PROJECT_SOURCE_DIR}"
COMMAND "${PROJECT_SOURCE_DIR}/git-untracked-files" "${PROJECT_SOURCE_DIR}" "tests" "workspace"
OUTPUT_VARIABLE CPACK_IGNORE_FILES
)

Expand Down
21 changes: 18 additions & 3 deletions git-untracked-files
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,34 @@
# to CPack's CPACK_IGNORE_FILES variable for ignoring while making the
# source/binary packages, and also stored in .cpackignore file.
#
# If more than two command line arguments are given, the second and higher
# arguments are taken as subdirectories (relative to the source root
# directory) to exclude in entirety. This allows you to exclude directories
# that are tracked in git, but you don't want in the final source
# distribution.
#
# If there's no .git directory, or git is not installed, look for
# .cpackignore file. This may happen if we're building the source outside
# of a git repository (or if there's no git on the system).
#
# Usage: git-untracked-files [dir_from_which_to_run]
# Usage: git-untracked-files [dir_from_which_to_run] [extra_dir_to_exclude [extra_dir_to_exclude [..]]]
#

test "x$1" != "x" && cd "$1"
test "x$1" != "x" && cd "$1" && shift

{ which git 2>&1 > /dev/null && test -d .git; } || { test -f .cpackignore && cat .cpackignore && exit; } || exit -1;

rm -f .cpackignore

EXTRAREGEX="__dummy__"
for DIR in "$@"
do
echo -n "/$DIR/;" | sed 's/\./\\\\./g' | tee -a .cpackignore
EXTRAREGEX="$EXTRAREGEX|$DIR"
done

echo -n '/\\.git;' | tee -a .cpackignore
git clean -ndx | grep "Would remove" | cut -b 14- \
git clean -ndx | grep "Would remove" | egrep -v "Would remove \"?($EXTRAREGEX)" | cut -b 14- \
| sed '/^.cpackignore$/d' \
| sed '/^.version$/d' \
| awk '{ print "/"$0 }' \
Expand Down

0 comments on commit 9c5c28f

Please sign in to comment.