Update the roll-freetype script to update the CPE version

Now matches the Chromium version.

Bug: pdfium:1783
Change-Id: Ie743149decb108d1ce05254b83f0a272ba60d400
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92650
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/third_party/freetype/roll-freetype.sh b/third_party/freetype/roll-freetype.sh
index fd2c293..74fd660 100755
--- a/third_party/freetype/roll-freetype.sh
+++ b/third_party/freetype/roll-freetype.sh
@@ -10,17 +10,20 @@
 
 REVIEWERS=`paste -s -d, third_party/freetype/OWNERS`
 roll-dep -r "${REVIEWERS}" "$@" third_party/freetype/src/
-FTVERSION=`git -C third_party/freetype/src/ describe --long`
-FTCOMMIT=`git -C third_party/freetype/src/ rev-parse HEAD`
+FT_VERSION=`git -C third_party/freetype/src/ describe --long`
+FT_COMMIT=`git -C third_party/freetype/src/ rev-parse HEAD`
+FT_CPE_VERSION=$(echo ${FT_VERSION} | sed -r -e's/^VER-([0-9]+)-([0-9]+)-([0-9]+)-[0-9]+-g[0-9a-f]+$/\1.\2.\3/')
 
 # Make sure our copy of pstables.h matches the one in freetype/src.
 # May need to --bypass-hooks to prevent formatting of this file.
 cp third_party/freetype/src/src/psnames/pstables.h \
   third_party/freetype/include/pstables.h
 
-sed -i "s/^Version: .*\$/Version: ${FTVERSION%-*}/" \
+sed -i "s/^Version: .*\$/Version: ${FT_VERSION%-*}/" \
   third_party/freetype/README.pdfium
-sed -i "s/^Revision: .*\$/Revision: ${FTCOMMIT}/" \
+sed -i "s/^Revision: .*\$/Revision: ${FT_COMMIT}/" \
+  third_party/freetype/README.pdfium
+sed -i'' -e "s@^CPEPrefix: cpe:/a:freetype:freetype:.*\$@CPEPrefix: cpe:/a:freetype:freetype:${FT_CPE_VERSION}@" \
   third_party/freetype/README.pdfium
 
 git add third_party/freetype/README.pdfium