750d890
#! /bin/sh
750d890
750d890
: << \EOF
750d890
  For importing the hobbled OpenSSL tarball from Fedora, the following
750d890
  steps are necessary. Note that both the "sources" file format and the
750d890
  pkgs.fedoraproject.org directory structure have changed, accommodating
750d890
  SHA512 checksums.
750d890
750d890
  # in a separate directory
750d890
  fedpkg clone -a openssl
750d890
  cd openssl
750d890
  fedpkg switch-branch master
750d890
  gitk -- sources
750d890
7ae6f15
  # the commit that added the 1.1.0h hobbled tarball is 6eb8f620273
7ae6f15
  # subject "update to upstream version 1.1.0h"
7ae6f15
  git checkout 6eb8f620273
750d890
750d890
  # fetch the hobbled tarball and verify the checksum
750d890
  (
750d890
    set -e
750d890
    while read HASH_TYPE FN EQ HASH; do
750d890
      # remove leading and trailing parens
750d890
      FN="${FN#(*}"
750d890
      FN="${FN%*)}"
750d890
      wget \
750d890
        http://pkgs.fedoraproject.org/repo/pkgs/openssl/$FN/sha512/$HASH/$FN
750d890
    done 
750d890
    sha512sum -c sources
750d890
  )
750d890
750d890
  # unpack the hobbled tarball into edk2, according to
750d890
  # "OpenSSL-HOWTO.txt"; WORKSPACE stands for the root of the edk2 project
750d890
  # tree
7ae6f15
  tar -x --xz -f openssl-1.1.0h-hobbled.tar.xz
7ae6f15
  mv -- openssl-1.1.0h "$WORKSPACE"/CryptoPkg/Library/OpensslLib/openssl
750d890
750d890
  # update the INF files as described in "OpenSSL-HOWTO.txt", then save
750d890
  # the results as a single commit
7ae6f15
  (cd "$WORKSPACE"/CryptoPkg/Library/OpensslLib && perl process_files.pl)
7ae6f15
  git rm --cached CryptoPkg/Library/OpensslLib/openssl
7ae6f15
  git commit -m'remove openssl submodule'
7ae6f15
  git add -A CryptoPkg/Library/OpensslLib/openssl
7ae6f15
  git commit -m'add openssl 1.1.0h'
750d890
  git format-patch -1
750d890
750d890
Then run the patch through this script which will build a new tar file.
750d890
EOF
750d890
750d890
set -e
750d890
edk2_githash=$(awk '/^%global edk2_githash/ {print $3}' edk2.spec)
750d890
openssl_version=$(awk '/^%global openssl_version/ {print $3}' edk2.spec)
750d890
mkdir -p tianocore-openssl-${openssl_version}
750d890
(exec 3> openssl-${openssl_version}-hobbled.tar.xz
750d890
 cd tianocore-openssl-${openssl_version}
750d890
 git init .
750d890
 git config core.whitespace cr-at-eol
750d890
 git config am.keepcr true
750d890
 git am
750d890
 git archive --format=tar --prefix=tianocore-edk2-${edk2_githash}/ \
750d890
  HEAD CryptoPkg/Library/OpensslLib/ | \
750d890
  xz -9ev >&3) < $1
750d890
rm -rf tianocore-openssl-${openssl_version}