<commit_before>#!/bin/sh
# Copyright (c) Arduino. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

SDK_DIR=$1
SRC_SDK_DIR=../src/sdk
EXAMPLES_SDK_DIR=../examples/sdk
SDK_METADATA=$SRC_SDK_DIR/metadata.txt

if [ -z "$SDK_DIR" ]
then
	echo "Please specify Azure SDK directory as command line argument!"
	exit 1
fi

if [ ! -d "$SDK_DIR" ]
then
	echo "'$SDK_DIR' does not exist!"
	exit 1
fi

copy_filelist() {
	for file in `cat $1`
	do
		echo "\t$file"
		cp "$2/$file" "$3"
	done
}

echo "Copying SDK C source files over"
copy_filelist "sdk-files.txt" "$SDK_DIR" "$SRC_SDK_DIR"

echo "Copying SDK sample files over"
copy_filelist "iothub-client-sample-http-files.txt" "$SDK_DIR" "$EXAMPLES_SDK_DIR/iothub_client_sample_http"
copy_filelist "simplesample-http-files.txt" "$SDK_DIR" "$EXAMPLES_SDK_DIR/simplesample_http"

echo "Storing SDK metadata"
git ls-remote --get-url > "$SDK_METADATA"
git rev-parse --abbrev-ref HEAD >> "$SDK_METADATA"
git rev-parse HEAD >> "$SDK_METADATA"
cat $SDK_METADATA<commit_msg>Use git dir for SDK for metadata<commit_after>#!/bin/sh
# Copyright (c) Arduino. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

SDK_DIR=$1
SRC_SDK_DIR=../src/sdk
EXAMPLES_SDK_DIR=../examples/sdk
SDK_METADATA=$SRC_SDK_DIR/metadata.txt

if [ -z "$SDK_DIR" ]
then
	echo "Please specify Azure SDK directory as command line argument!"
	exit 1
fi

if [ ! -d "$SDK_DIR" ]
then
	echo "'$SDK_DIR' does not exist!"
	exit 1
fi

copy_filelist() {
	for file in `cat $1`
	do
		echo "\t$file"
		cp "$2/$file" "$3"
	done
}

echo "Copying SDK C source files over"
copy_filelist "sdk-files.txt" "$SDK_DIR" "$SRC_SDK_DIR"

echo "Copying SDK sample files over"
copy_filelist "iothub-client-sample-http-files.txt" "$SDK_DIR" "$EXAMPLES_SDK_DIR/iothub_client_sample_http"
copy_filelist "simplesample-http-files.txt" "$SDK_DIR" "$EXAMPLES_SDK_DIR/simplesample_http"

echo "Storing SDK metadata"
git --git-dir "$SDK_DIR/.git" ls-remote --get-url > "$SDK_METADATA"
git --git-dir "$SDK_DIR/.git" rev-parse --abbrev-ref HEAD >> "$SDK_METADATA"
git --git-dir "$SDK_DIR/.git" rev-parse HEAD >> "$SDK_METADATA"
cat $SDK_METADATA
{'fraction_non_alphanumeric': 0.1332741003998223, 'fraction_numerical': 0.0053309640159928924, 'mean_word_length': 4.715736040609137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6392858', 'n_tokens_mistral': 920, 'n_tokens_neox': 845, 'n_words': 237}