Rather than explicitly excluding the tests, just copy the source files
by default. Add an option (--copy-all) to include all of the non-source
stuff in each module.
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Usage: $progname [options] <outdir> <depends>...
options:
Usage: $progname [options] <outdir> <depends>...
options:
- -t, --exclude-tests exclude test/ directories from ccan modules
+ -a, --copy-all copy all files in module tree (not just
+ sources required for build)
-c, --exclude-configurator exclude configurator. config.h must be
supplied by another method (eg, autotools)
EOF
}
# parse options, setting the following flags
-c, --exclude-configurator exclude configurator. config.h must be
supplied by another method (eg, autotools)
EOF
}
# parse options, setting the following flags
-opts=$(getopt -o tc --long exclude-tests,exclude-configurator -n $progname \
- -- "$@")
+opts=$(getopt -o ac --long copy-all,exclude-configurator -n $progname -- "$@")
- -t|--exclude-tests)
- exclude_tests=1
+ -a|--copy-all)
+ copy_all=1
shift
;;
-c|--exclude-configurator)
shift
;;
-c|--exclude-configurator)
# clean up on error
trap 'rm -rf $tmpdir' EXIT
# clean up on error
trap 'rm -rf $tmpdir' EXIT
+copy_ccan_module() {
+ module_dir="$1"
+ module_srcdir="$srcdir/$module_dir"
+ module_destdir="$tmpdir/$module_dir"
+
+ if [ -n "$copy_all" ]
+ then
+ # bulk copy
+ mkdir -p "$(dirname "$module_destdir")"
+ cp -a "$module_srcdir" "$module_destdir"
+ else
+ mkdir -p "$module_destdir"
+ # only copy sources & license
+ license="$module_srcdir/LICENSE"
+ cp -a "$module_srcdir"/*.[ch] "$module_destdir"
+ [ -e "$license" ] && cp -a "$license" "$module_destdir"
+ fi
+}
+
# generate list of directories to copy
for module in $modules
do
# generate list of directories to copy
for module in $modules
do
sort -u |
while read dir
do
sort -u |
while read dir
do
- module_srcdir="$srcdir/$dir"
- module_destdir="$tmpdir/$dir"
- mkdir -p "$(dirname "$module_destdir")"
- cp -a "$module_srcdir" "$module_destdir"
- if [ -n "$exclude_tests" ]
- then
- rm -rf "$module_destdir/test"
- fi
done
# we're done with the dependency-tracking, remove the tool from our
done
# we're done with the dependency-tracking, remove the tool from our