[disco:linux-azure,xenial:linux-azure,1/3] UBUNTU: SAUCE: sgx-update: Add script to fetch SGX from Intel repo
diff mbox series

Message ID 20190917110547.22517-2-marcelo.cerri@canonical.com
State New
Headers show
Series
  • LP: #1844245 - Integrate Intel SGX driver into linux-azure
Related show

Commit Message

Marcelo Henrique Cerri Sept. 17, 2019, 11:05 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1844245

Add a script to simplify the process of fetching the new version of
the SGX driver source code.

The user is still responsible for reviewing the new changes and
tagging the commit with a proper launchpad bug.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 ubuntu/Makefile   |  4 ++++
 ubuntu/sgx-update | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100755 ubuntu/sgx-update

Comments

Connor Kuehl Sept. 24, 2019, 3:53 p.m. UTC | #1
On 9/17/19 4:05 AM, Marcelo Henrique Cerri wrote:
> BugLink: https://bugs.launchpad.net/bugs/1844245
> 
> Add a script to simplify the process of fetching the new version of
> the SGX driver source code.
> 
> The user is still responsible for reviewing the new changes and
> tagging the commit with a proper launchpad bug.
> 
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
> ---
>   ubuntu/Makefile   |  4 ++++
>   ubuntu/sgx-update | 33 +++++++++++++++++++++++++++++++++
>   2 files changed, 37 insertions(+)
>   create mode 100755 ubuntu/sgx-update
> 
> diff --git a/ubuntu/Makefile b/ubuntu/Makefile
> index c499b2112dec..3230b018df8c 100644
> --- a/ubuntu/Makefile
> +++ b/ubuntu/Makefile
> @@ -31,6 +31,10 @@ endif
>   ##
>   ##
>   ##
> +obj-y += sgx/
> +##
> +##
> +##
>   ##
>   ##
>   ##
> diff --git a/ubuntu/sgx-update b/ubuntu/sgx-update
> new file mode 100755
> index 000000000000..3f701040337f
> --- /dev/null
> +++ b/ubuntu/sgx-update
> @@ -0,0 +1,33 @@
> +#!/bin/bash -eu
> +remote_repo="${1:-https://github.com/haimc-intel/SGXDataCenterAttestationPrimitives}"
> +remote_branch="${2:-inker-ph1}"
> +driver_path=driver/linux/
> +
> +# Get the latest version of the driver
> +tmp=$(mktemp -d)
> +trap "rm -rf '$tmp'" 0
> +git clone "$remote_repo" ${remote_branch:+-b "$remote_branch"} "$tmp"
> +commit_id="$(cd "$tmp" && git rev-parse HEAD)"
> +
> +# Sync the new files
> +here="$(readlink -f "$(dirname "$0")")"
> +intree_path="$here/sgx/"
> +include_path="$here/../arch/x86/include/"
> +git rm -rf "$intree_path" || true
> +mkdir "$intree_path"
> +rsync -av "$tmp/$driver_path/"* "$intree_path/" \
> +      --exclude 'include' \
> +      --exclude '*.conf' \
> +      --exclude '*.rules'
> +rsync -av "$tmp/$driver_path/include/"* "$include_path/"

Could we investigate a way to do this by using git-format-patch on the 
Github repository and then 'sed' the proper file paths into the patches 
that result? Then we apply them onto our tree. This might make it easier 
for possible bisections.
Kleber Souza Sept. 27, 2019, 3:19 p.m. UTC | #2
On 17.09.19 13:05, Marcelo Henrique Cerri wrote:
> BugLink: https://bugs.launchpad.net/bugs/1844245
> 
> Add a script to simplify the process of fetching the new version of
> the SGX driver source code.
> 
> The user is still responsible for reviewing the new changes and
> tagging the commit with a proper launchpad bug.
> 
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
> ---
>  ubuntu/Makefile   |  4 ++++
>  ubuntu/sgx-update | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
>  create mode 100755 ubuntu/sgx-update
> 
> diff --git a/ubuntu/Makefile b/ubuntu/Makefile
> index c499b2112dec..3230b018df8c 100644
> --- a/ubuntu/Makefile
> +++ b/ubuntu/Makefile
> @@ -31,6 +31,10 @@ endif
>  ##
>  ##
>  ##
> +obj-y += sgx/
> +##
> +##
> +##
>  ##
>  ##
>  ##

Should this change be separated from the commit that adds the script? Possibly
together with Patch 2/3.


Kleber

> diff --git a/ubuntu/sgx-update b/ubuntu/sgx-update
> new file mode 100755
> index 000000000000..3f701040337f
> --- /dev/null
> +++ b/ubuntu/sgx-update
> @@ -0,0 +1,33 @@
> +#!/bin/bash -eu
> +remote_repo="${1:-https://github.com/haimc-intel/SGXDataCenterAttestationPrimitives}"
> +remote_branch="${2:-inker-ph1}"
> +driver_path=driver/linux/
> +
> +# Get the latest version of the driver
> +tmp=$(mktemp -d)
> +trap "rm -rf '$tmp'" 0
> +git clone "$remote_repo" ${remote_branch:+-b "$remote_branch"} "$tmp"
> +commit_id="$(cd "$tmp" && git rev-parse HEAD)"
> +
> +# Sync the new files
> +here="$(readlink -f "$(dirname "$0")")"
> +intree_path="$here/sgx/"
> +include_path="$here/../arch/x86/include/"
> +git rm -rf "$intree_path" || true
> +mkdir "$intree_path"
> +rsync -av "$tmp/$driver_path/"* "$intree_path/" \
> +      --exclude 'include' \
> +      --exclude '*.conf' \
> +      --exclude '*.rules'
> +rsync -av "$tmp/$driver_path/include/"* "$include_path/"
> +
> +# Commit changes
> +git add "$intree_path"
> +git add "$include_path"
> +{
> +	echo "UBUNTU: SAUCE: Update ubuntu/sgx driver to ${commit_id:0:12}"
> +	echo
> +	echo "Sync in-tree driver with commit id $commit_id from"
> +	echo "$remote_repo" "$remote_branch"
> +} | git commit -s -F - &&
> +	echo "Please review the commit before pushing it!"
>

Patch
diff mbox series

diff --git a/ubuntu/Makefile b/ubuntu/Makefile
index c499b2112dec..3230b018df8c 100644
--- a/ubuntu/Makefile
+++ b/ubuntu/Makefile
@@ -31,6 +31,10 @@  endif
 ##
 ##
 ##
+obj-y += sgx/
+##
+##
+##
 ##
 ##
 ##
diff --git a/ubuntu/sgx-update b/ubuntu/sgx-update
new file mode 100755
index 000000000000..3f701040337f
--- /dev/null
+++ b/ubuntu/sgx-update
@@ -0,0 +1,33 @@ 
+#!/bin/bash -eu
+remote_repo="${1:-https://github.com/haimc-intel/SGXDataCenterAttestationPrimitives}"
+remote_branch="${2:-inker-ph1}"
+driver_path=driver/linux/
+
+# Get the latest version of the driver
+tmp=$(mktemp -d)
+trap "rm -rf '$tmp'" 0
+git clone "$remote_repo" ${remote_branch:+-b "$remote_branch"} "$tmp"
+commit_id="$(cd "$tmp" && git rev-parse HEAD)"
+
+# Sync the new files
+here="$(readlink -f "$(dirname "$0")")"
+intree_path="$here/sgx/"
+include_path="$here/../arch/x86/include/"
+git rm -rf "$intree_path" || true
+mkdir "$intree_path"
+rsync -av "$tmp/$driver_path/"* "$intree_path/" \
+      --exclude 'include' \
+      --exclude '*.conf' \
+      --exclude '*.rules'
+rsync -av "$tmp/$driver_path/include/"* "$include_path/"
+
+# Commit changes
+git add "$intree_path"
+git add "$include_path"
+{
+	echo "UBUNTU: SAUCE: Update ubuntu/sgx driver to ${commit_id:0:12}"
+	echo
+	echo "Sync in-tree driver with commit id $commit_id from"
+	echo "$remote_repo" "$remote_branch"
+} | git commit -s -F - &&
+	echo "Please review the commit before pushing it!"