Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jul 2020 17:47:35 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r541295 - in head/sysutils/cpupdate: . files
Message-ID:  <202007051747.065HlZl6037927@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Sun Jul  5 17:47:34 2020
New Revision: 541295
URL: https://svnweb.freebsd.org/changeset/ports/541295

Log:
  sysutils/cpupdate: introduce "service cpupdate download"
  
  New command "service cpupdate download" targeted
  for package users is equivalent to "make install-microcodes"
  already present for ports users. (*)
  
  Also, sync with Intel pack microcode-20200616 available from Github.
  Bump PORTREVISION.
  
  PR:		247766
  Suggested by:	Walter von Entferndt (*)

Modified:
  head/sysutils/cpupdate/Makefile
  head/sysutils/cpupdate/distinfo
  head/sysutils/cpupdate/files/cpupdate.in
  head/sysutils/cpupdate/files/pkg-message.in

Modified: head/sysutils/cpupdate/Makefile
==============================================================================
--- head/sysutils/cpupdate/Makefile	Sun Jul  5 17:43:47 2020	(r541294)
+++ head/sysutils/cpupdate/Makefile	Sun Jul  5 17:47:34 2020	(r541295)
@@ -3,7 +3,7 @@
 
 PORTNAME=	cpupdate
 DISTVERSION=	g20180513
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils
 
 MAINTAINER=	eugen@FreeBSD.org
@@ -25,7 +25,10 @@ ONLY_FOR_ARCHS=		amd64 i386
 ONLY_FOR_ARCHS_REASON=	specific to x86 processors
 
 SUB_FILES=	pkg-message
-SUB_LIST=	CPM_DIR=${CPM_DIR} INTEL_DIR=${INTEL_DIR}
+SUB_LIST=	CPM_DIR="${CPM_DIR}" INTEL_DIR="${INTEL_DIR}" \
+		CPM_DATADIR="${CPM_DATADIR}" INTEL_DATADIR="${INTEL_DATADIR}" \
+		FETCH_CMD="${FETCH_CMD}" MASTER_SITES="${MASTER_SITES}" \
+		DISTFILES="${DISTFILES}"
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	kernschmelze
@@ -47,11 +50,12 @@ CPM_GH_TAGNAME=		${CPM_TAGNAME}:cpm
 CPM_DIR=		${WRKDIR}/${CPM_PROJECT}-${CPM_TAGNAME}
 CPM_DATADIR=		${DATADIR}/CPUMicrocodes/secondary/Intel
 
-INTEL_PACK=		microcode-20180807.tgz
+INTEL_PACK=		microcode-20200616
 INTEL_DESC=		Download Intel microcode pack ${INTEL_PACK}
-INTEL_MASTER_SITES=	https://downloadmirror.intel.com/28039/eng/:intel
+INTEL_PROJECT=		Intel-Linux-Processor-Microcode-Data-Files
+INTEL_MASTER_SITES=	https://codeload.github.com/intel/${INTEL_PROJECT}/tar.gz/:intel
 INTEL_DISTFILES=	${INTEL_PACK}:intel
-INTEL_DIR=		${WRKDIR}/intel-ucode
+INTEL_DIR=		${WRKDIR}/${INTEL_PROJECT}-${INTEL_PACK}/intel-ucode
 INTEL_DATADIR=		${DATADIR}/CPUMicrocodes/primary/Intel
 
 post-patch:
@@ -73,7 +77,7 @@ install-microcodes:
 .if ${PORT_OPTIONS:MCPM}
 	${RM} -rf ${CPM_DATADIR}
 	${MKDIR} ${CPM_DATADIR}
-	cpupdate -IC -S ${CPM_DIR}/Intel -T ${CPM_DATADIR}
+	cpupdate -q -IC -S ${CPM_DIR}/Intel -T ${CPM_DATADIR} >/dev/null
 .endif
 .for _o in INTEL CPM
 .if ${PORT_OPTIONS:M${_o}}

Modified: head/sysutils/cpupdate/distinfo
==============================================================================
--- head/sysutils/cpupdate/distinfo	Sun Jul  5 17:43:47 2020	(r541294)
+++ head/sysutils/cpupdate/distinfo	Sun Jul  5 17:47:34 2020	(r541295)
@@ -1,6 +1,6 @@
-TIMESTAMP = 1593938356
-SHA256 (microcode-20180807.tgz) = 29f9e8dc27e6c9b6488cecd7fe2394030307799e511db2d197d9e6553a7f9e40
-SIZE (microcode-20180807.tgz) = 1629357
+TIMESTAMP = 1593962076
+SHA256 (microcode-20200616) = eb4f939421ac6cdea3c586c9d984ec518320f00c07eb2b3d6754309c83c93371
+SIZE (microcode-20200616) = 3036726
 SHA256 (kernschmelze-cpupdate-g20180513-48e42d5_GH0.tar.gz) = d28582fe7edfb57da99fb2466417033ee619c32de9c6b5f1a5fae7d9be8253da
 SIZE (kernschmelze-cpupdate-g20180513-48e42d5_GH0.tar.gz) = 4566722
 SHA256 (platomav-CPUMicrocodes-0d2412f_GH0.tar.gz) = ed9aaf409a0a4831a164216536b0a372ffeeff297f65de4b244f0bd8536503fc

Modified: head/sysutils/cpupdate/files/cpupdate.in
==============================================================================
--- head/sysutils/cpupdate/files/cpupdate.in	Sun Jul  5 17:43:47 2020	(r541294)
+++ head/sysutils/cpupdate/files/cpupdate.in	Sun Jul  5 17:47:34 2020	(r541295)
@@ -27,11 +27,81 @@ start_postcmd="cpupdate_poststart"
 load_rc_config $name
 
 : ${cpupdate_enable:="NO"}
-: ${cpupdate_flags="-w -u"}
-: ${cpupdate_ibrs_enable="YES"}
+: ${cpupdate_flags:="-w -u"}
+: ${cpupdate_ibrs_enable:="YES"}
+: ${cpupdate_fetch:=%%FETCH_CMD%%}
+: ${cpupdate_sites:=%%MASTER_SITES%%}
+: ${cpupdate_distfiles:=%%DISTFILES%%}
+
 command=%%PREFIX%%/sbin/${name}
+download_cmd="cpupdate_download"
 resume_cmd="cpupdate_resume"
-extra_commands="resume"
+extra_commands="download resume"
+
+cpupdate_distfile() {
+  local _distfile
+
+  setvar $1 ''
+  for _distfile in $cpupdate_distfiles
+  do
+    case $_distfile in
+    *:$2) setvar $1 ${_distfile%:*}; return;;
+    esac
+  done
+}
+
+cpupdate_download() {
+  local _d _dst _file _tmpdir _url
+  local -
+
+  set -e
+  : ${TMPDIR:=/var/tmp}
+  export TMPDIR
+  trap 'rm -rf $_tmpdir' EXIT
+  _tmpdir=$(mktemp -d -t ${name})
+
+  for _url in $cpupdate_sites
+  do
+    case "$_url" in
+    *:cpm|*:intel)
+      cpupdate_distfile _file ${_url##*:}
+      _url=${_url%:*}${_file}
+      echo Downloading $_url
+      $cpupdate_fetch -o - $_url | tar -C $_tmpdir -xf - || exit
+      ;;
+    esac
+  done
+
+  echo -n Installing microcodes to %%DATADIR%% ...
+  umask 022
+  _dst=%%INTEL_DATADIR%%
+  _d=%%INTEL_DIR%%
+  _d=$_tmpdir/Intel${_d##*/Intel}
+  if [ -d $_d ]; then
+    rm -rf $_dst || true
+    mkdir -p $_dst
+    cp -Rp $_d/ $_dst
+    [ -d $_d-with-caveats ] && cp -Rp $_d-with-caveats/ $_dst
+    chmod -R 644 $_dst
+    chown -R root:wheel $_dst
+    chmod 755 $_dst
+  fi
+
+  _dst=%%CPM_DATADIR%%
+  _d=%%CPM_DIR%%
+  _d=$_tmpdir/${_d##*/}/Intel
+  if [ -d $_d ]; then
+    rm -rf $_d/LICENSE $_dst || true
+    mkdir -p $_dst
+    %%PREFIX%%/sbin/${name} -q -IC -S $_d -T $_dst >/dev/null
+  fi
+  echo ' done.'
+  echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
+  echo NOTE: you have to manually remove the directory
+  echo %%DATADIR%%
+  echo after deinstallation of ${name}.
+  echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
+}
 
 cpupdate_poststart() {
   checkyesno cpupdate_ibrs_enable && sysctl -i hw.ibrs_disable=0

Modified: head/sysutils/cpupdate/files/pkg-message.in
==============================================================================
--- head/sysutils/cpupdate/files/pkg-message.in	Sun Jul  5 17:43:47 2020	(r541294)
+++ head/sysutils/cpupdate/files/pkg-message.in	Sun Jul  5 17:47:34 2020	(r541295)
@@ -9,8 +9,10 @@ NOTE: The following directories
 contain Intel and/or platomav/CPUMicrocodes collections respectively
 if you have just built the port with corresponding CPM/INTEL option(s) enabled.
 In this case you can run "make install-microcodes" to install them to
-
 %%DATADIR%%
+
+If you installed the package then you may download microcodes with following command:
+service cpupdate download
 EOM
 }
 ]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007051747.065HlZl6037927>