render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone

Blame openssl-patch-to-tarball.sh

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