How to edit PKGBUILD with diff?

I was trying to install davinci-resolve and it failed, so I check the comments in the aur where it was suggested to edit de PKGBUILD.

I did some searching to learn how to do this and I tried

yay --editmenu -S davinci-resolve

and when it asked Edit PKGBUILD with? I pasted

-minor_version=0
-release_version=3
-pkgver=${major_version}.${minor_version}.${release_version}
+minor_version=1
+release_version=
+pkgver=${major_version}.${minor_version}

but it seems like it’s not how you do it, since I got

==> Edit PKGBUILD with?
==>  -> exec: "-release_version=3": executable file not found in $PATH
==> Edit PKGBUILD with?
==>  -> exec: "-pkgver=${major_version}.${minor_version}.${release_version}": executable file not found in $PATH
==> Edit PKGBUILD with?
==>  -> exec: "+minor_version=1": executable file not found in $PATH
==> Edit PKGBUILD with?
==>  -> exec: "+release_version=": executable file not found in $PATH
==> Edit PKGBUILD with?
==> 

What am I doing wrong?

I believe you should type the name of a text editor there. Like nano, micro, vim, or something graphical like xed or geany. Whatever you have installed.

2 Likes

OK, fair enough, I should have caught that, it was pretty obvious in hindsight.

However, I am now facing this error:

/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 12: -minor_version=0: command not found
/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 13: -release_version=3: command not found
/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 14: -pkgver=..: command not found
/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 15: +minor_version=1: command not found
/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 16: +release_version=: command not found
/home/radu/.cache/yay/davinci-resolve/PKGBUILD: line 17: +pkgver=.: command not found
==> ERROR: pkgver is not allowed to be empty.
 -> error downloading sources: /home/radu/.cache/yay/davinci-resolve 
	 context: exit status 12 

Can you post the edited version of the PKGBUILD? Let’s see exactly what you’ve done.

Also, have you tried downloading it directly from the source and installing it that way?
It worked for me.

Check here: https://www.blackmagicdesign.com/support/

1 Like
# Maintainer: Alex S. <shantanna_at_hotmail_dot_com>
# Contributor: Jonathon Fernyhough <jonathon_at_manjaro_dot_org>

# Hardware support is limited. Nvidia cards should work fine.
# If you're running a hybrid setup, try with primusrun/optirun.

# This was originally written by Daniel Bermond in blackmagic-decklink-sdk pkgbuild
# It is sufficient to just replace _downloadid to correspond new release version
# It can be obtained from chromium -> Developer Tools -> Network -> XHR -> click latest-version and copy downloadId

pkgname=davinci-resolve
-minor_version=0
-release_version=3
-pkgver=${major_version}.${minor_version}.${release_version}
+minor_version=1
+release_version=
+pkgver=${major_version}.${minor_version}
pkgrel=1

if [ "$pkgname" == "davinci-resolve" ]; then
  # Variables for FREE edition
  _product="DaVinci Resolve"
  _referid='ee1da4f13df74d72b6da783ead2ed875'
  _siteurl="https://www.blackmagicdesign.com/api/support/latest-stable-version/davinci-resolve/linux"
  sha256sums=('ebfd232ba56bf8ef484dcab612a8ff53880aae8c6994f73c28bafeba65c2b125')
  pkgdesc='Professional A/V post-production software suite from Blackmagic Design'
  _archive_name=DaVinci_Resolve_${pkgver}_Linux
  _archive_run_name=DaVinci_Resolve_${pkgver}_Linux
  conflicts=('davinci-resolve-studio' 'davinci-resolve-beta' 'davinci-resolve-studio-beta')
elif [ "$pkgname" == "davinci-resolve-studio" ]; then
  # Variables for STUDIO edition
  _product="DaVinci Resolve Studio"
  _referid='86463718c6d1491d8d95f8b49f75c4db'
  _siteurl="https://www.blackmagicdesign.com/api/support/latest-stable-version/davinci-resolve-studio/linux"
  sha256sums=('53faec4c738c4941bd1f898020142b57c2112ca8ca3d9ef2c6e89f1d38c732cc')
  pkgdesc='Professional A/V post-production software suite from Blackmagic Design. Studio edition, requires license key or license dongle.'
  _archive_name=DaVinci_Resolve_Studio_${pkgver}_Linux
  _archive_run_name=DaVinci_Resolve_Studio_${pkgver}_Linux
  conflicts=('davinci-resolve' 'davinci-resolve-beta' 'davinci-resolve-studio-beta')
fi

_useragent="User-Agent: Mozilla/5.0 (X11; Linux ${CARCH}) \
                        AppleWebKit/537.36 (KHTML, like Gecko) \
                        Chrome/77.0.3865.75 \
                        Safari/537.36"
_releaseinfo=$(curl -Ls "$_siteurl")

_downloadId=$(printf "%s" $_releaseinfo | sed -n 's/.*"downloadId":"\([^"]*\).*/\1/p')
_pkgver=$(printf "%s" $_releaseinfo | awk -F'[,:]' '{for(i=1;i<=NF;i++){if($i~/"major"/){print $(i+1)} if($i~/"minor"/){print $(i+1)} if($i~/"releaseNum"/){print $(i+1)}}}' | sed 'N;s/\n/./;N;s/\n/./')

#if [[ $pkgver != $_pkgver ]]; then
#  echo "Version mismatch. ($pkgver ≠ $_pkgver)"
#  echo "It is recommended to wait for the next release."
#  exit
#fi

_reqjson="{ \
  \"firstname\": \"Arch\", \
  \"lastname\": \"Linux\", \
  \"email\": \"someone@archlinux.org\", \
  \"phone\": \"202-555-0194\", \
  \"country\": \"us\", \
  \"street\": \"Bowery 146\", \
  \"state\": \"New York\", \
  \"city\": \"AUR\", \
  \"product\": \"$_product\" \
}"

_reqjson="$(  printf '%s' "$_reqjson"   | sed 's/[[:space:]]\+/ /g')"
_useragent="$(printf '%s' "$_useragent" | sed 's/[[:space:]]\+/ /g')"
_useragent_escaped="${_useragent// /\\ }"

_siteurl="https://www.blackmagicdesign.com/api/register/us/download/${_downloadId}"
_srcurl="$(curl \
           -s \
           -H 'Host: www.blackmagicdesign.com' \
           -H 'Accept: application/json, text/plain, */*' \
           -H 'Origin: https://www.blackmagicdesign.com' \
           -H "$_useragent" \
           -H 'Content-Type: application/json;charset=UTF-8' \
           -H "Referer: https://www.blackmagicdesign.com/support/download/${_referid}/Linux" \
           -H 'Accept-Encoding: gzip, deflate, br' \
           -H 'Accept-Language: en-US,en;q=0.9' \
           -H 'Authority: www.blackmagicdesign.com' \
           -H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
           --data-ascii "$_reqjson" \
           --compressed \
           "$_siteurl")"

DLAGENTS=("https::/usr/bin/curl \
           -gqb '' -C - --retry 3 --retry-delay 3 \
           -H Upgrade-Insecure-Requests:\ 1 \
           -H ${_useragent_escaped} \
           -H Accept:\ text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 \
           -H Accept-Language:\ en-US,en;q=0.9 \
           -o %o \
           --compressed \
           %u")

_pkgname=resolve
resolve_app_name=com.blackmagicdesign.resolve
arch=('x86_64')
url="https://www.blackmagicdesign.com/support/family/davinci-resolve-and-fusion"
license=('Commercial')
depends=('glu' 'gtk2' 'libpng12' 'fuse2' 'opencl-driver' 'qt5-x11extras' 'qt5-svg' 'qt5-webengine' 'qt5-websockets'
'qt5-quickcontrols2' 'qt5-multimedia' 'libxcrypt-compat' 'xmlsec' 'java-runtime' 'ffmpeg4.4' 'gst-plugins-bad-libs' 'python-numpy' 
'tbb' 'apr-util' 'luajit' 'libc++')
makedepends=('libarchive' 'xdg-user-dirs' 'patchelf')
options=('!strip')

_archive=${_archive_name}.zip
_installer_binary=${_archive_run_name}.run
source=("${_archive}"::"$_srcurl")

install='davinci-resolve.install'

prepare()
{
  pushd "${srcdir}"
  chmod u+x "${srcdir}/${_installer_binary}"
  "${srcdir}/${_installer_binary}" --appimage-extract
  popd

  # Fix permission to all files and dirs
  chmod -R u+rwX,go+rX,go-w "${srcdir}/squashfs-root"

  pushd "${srcdir}/squashfs-root/share/panels"
  tar -zxvf dvpanel-framework-linux-x86_64.tgz
  chmod -R u+rwX,go+rX,go-w "${srcdir}/squashfs-root/share/panels/lib"
  mv *.so "${srcdir}/squashfs-root/libs"
  mv lib/* "${srcdir}/squashfs-root/libs"
  popd

  rm -rf "${srcdir}"/squashfs-root/installer "${srcdir}"/squashfs-root/installer* "${srcdir}"/squashfs-root/AppRun "${srcdir}"/squashfs-root/AppRun*

  while IFS= read -r -d '' i; do
    chmod 0755 "${i}"
  done < <(find "${srcdir}/squashfs-root" -type d -print0)

  while IFS= read -r -d '' i; do
    [[ -f "${i}" && $(od -t x1 -N 4 "${i}") == *"7f 45 4c 46"* ]] || continue
    chmod 0755 "${i}"
  done < <(find "${srcdir}/squashfs-root" -type f -print0)

  while IFS= read -r -d '' i; do
    [[ -f "${i}" && $(od -t x1 -N 4 "${i}") == *"7f 45 4c 46"* ]] || continue
    patchelf --set-rpath \
'/opt/'"${_pkgname}"'/libs:'\
'/opt/'"${_pkgname}"'/libs/plugins/sqldrivers:'\
'/opt/'"${_pkgname}"'/libs/plugins/xcbglintegrations:'\
'/opt/'"${_pkgname}"'/libs/plugins/imageformats:'\
'/opt/'"${_pkgname}"'/libs/plugins/platforms:'\
'/opt/'"${_pkgname}"'/libs/Fusion:'\
'/opt/'"${_pkgname}"'/plugins:'\
'/opt/'"${_pkgname}"'/bin:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/BlackmagicRawAPI:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/platforms:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/imageformats:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/mediaservice:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/audio:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/xcbglintegrations:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWSpeedTest/plugins/bearer:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/BlackmagicRawAPI:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/mediaservice:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/imageformats:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/audio:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/platforms:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/xcbglintegrations:'\
'/opt/'"${_pkgname}"'/BlackmagicRAWPlayer/plugins/bearer:'\
'/opt/'"${_pkgname}"'/Onboarding/plugins/xcbglintegrations:'\
'/opt/'"${_pkgname}"'/Onboarding/plugins/qtwebengine:'\
'/opt/'"${_pkgname}"'/Onboarding/plugins/platforms:'\
'/opt/'"${_pkgname}"'/Onboarding/plugins/imageformats:'\
'/opt/'"${_pkgname}"'/DaVinci Control Panels Setup/plugins/platforms:'\
'/opt/'"${_pkgname}"'/DaVinci Control Panels Setup/plugins/imageformats:'\
'/opt/'"${_pkgname}"'/DaVinci Control Panels Setup/plugins/bearer:'\
'/opt/'"${_pkgname}"'/DaVinci Control Panels Setup/AdminUtility/PlugIns/DaVinciKeyboards:'\
'/opt/'"${_pkgname}"'/DaVinci Control Panels Setup/AdminUtility/PlugIns/DaVinciPanels:'\
'$ORIGIN' "${i}"
  done < <(find "${srcdir}/squashfs-root" -type f -size -32M -print0)

  while IFS= read -r -d '' i; do
    sed -i "s|RESOLVE_INSTALL_LOCATION|/opt/${_pkgname}|g" "${i}"
  done < <(find . -type f '(' -name "*.desktop" -o -name "*.directory" -o -name "*.directory" -o -name "*.menu" ')' -print0)

  ln -s "${srcdir}/squashfs-root/BlackmagicRAWPlayer/BlackmagicRawAPI" "${srcdir}/squashfs-root/bin/"

  mv "${srcdir}/squashfs-root/libs/libc++.so.1" "${srcdir}/squashfs-root/libs/libc++.so.1.orig"

  ln -s /usr/lib/libc++.so.1.0 "${srcdir}/squashfs-root/libs/libc++.so.1"

  mv "${srcdir}/squashfs-root/libs/libglib-2.0.so.0" "${srcdir}/squashfs-root/libs/libglib-2.0.so.0.orig"

  ln -s /usr/lib/libglib-2.0.so.0 "${srcdir}/squashfs-root/libs/libglib-2.0.so.0"

  mv "${srcdir}/squashfs-root/libs/libgio-2.0.so.0" "${srcdir}/squashfs-root/libs/libgio-2.0.so.0.orig"

  ln -s /usr/lib/libgio-2.0.so.0 "${srcdir}/squashfs-root/libs/libgio-2.0.so.0"

  mv "${srcdir}/squashfs-root/libs/libgmodule-2.0.so.0" "${srcdir}/squashfs-root/libs/libgmodule-2.0.so.0.orig"

  ln -s /usr/lib/libgmodule-2.0.so.0 "${srcdir}/squashfs-root/libs/libgmodule-2.0.so.0"

  ln -s /usr/lib/libgdk_pixbuf-2.0.so.0 "${srcdir}/squashfs-root/libs/libgdk_pixbuf-2.0.so.0"

  echo "StartupWMClass=resolve" >> "${srcdir}/squashfs-root/share/DaVinciResolve.desktop"

  echo 'SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="096e", MODE="0666"' > "${srcdir}/squashfs-root/share/etc/udev/rules.d/99-DavinciPanel.rules"
}

package()
{
  mkdir -p -m 0755 "${pkgdir}/opt/${_pkgname}/"{configs,DolbyVision,easyDCP,Fairlight,GPUCache,logs,Media,"Resolve Disk Database",.crashreport,.license,.LUT}

  # Install the squashfs-root
  cp -rf "${srcdir}"/squashfs-root/* "${pkgdir}/opt/${_pkgname}"

  # Distribute files into other directories
  pushd "${pkgdir}/opt/${_pkgname}/"
  install -Dm0644 share/default-config.dat -t "${pkgdir}/opt/${_pkgname}/configs"
  install -Dm0644 share/log-conf.xml -t "${pkgdir}/opt/${_pkgname}/configs"
  install -Dm0644 share/default_cm_config.bin -t "${pkgdir}/opt/${_pkgname}/DolbyVision"

  install -Dm0644 share/DaVinciResolve.desktop -t "${pkgdir}/usr/share/applications"
  install -Dm0644 share/DaVinciControlPanelsSetup.desktop -t "${pkgdir}/usr/share/applications"
  install -Dm0644 share/DaVinciResolveInstaller.desktop -t "${pkgdir}/usr/share/applications"
  install -Dm0644 share/DaVinciResolveCaptureLogs.desktop -t "${pkgdir}/usr/share/applications"
  install -Dm0644 share/blackmagicraw-player.desktop -t "${pkgdir}/usr/share/applications"
  install -Dm0644 share/blackmagicraw-speedtest.desktop -t "${pkgdir}/usr/share/applications"

  install -Dm0644 share/DaVinciResolve.directory -t "${pkgdir}/usr/share/desktop-directories"
  install -Dm0644 share/DaVinciResolve.menu -t "${pkgdir}/etc/xdg/menus"
  install -Dm0644 graphics/DV_Resolve.png -t "${pkgdir}/usr/share/icons/hicolor/64x64/apps"
  install -Dm0644 graphics/DV_ResolveProj.png -t "${pkgdir}/usr/share/icons/hicolor/64x64/apps"
  install -Dm0644 share/resolve.xml -t "${pkgdir}/usr/share/mime/packages"

  install -Dm0644 share/etc/udev/rules.d/99-BlackmagicDevices.rules -t "${pkgdir}/usr/lib/udev/rules.d"
  install -Dm0644 share/etc/udev/rules.d/99-ResolveKeyboardHID.rules -t "${pkgdir}/usr/lib/udev/rules.d"
  install -Dm0644 share/etc/udev/rules.d/99-DavinciPanel.rules -t "${pkgdir}/usr/lib/udev/rules.d"
  popd
}

# vim: fileencoding=utf-8 sts=4 sw=4 noet

Yeah, that would be a good workaround and I suspect it will work, but I like haveing it installed from the AUR, it’s easier to update.

Try this:

pkgname=davinci-resolve
major_version=19
-minor_version=0
-release_version=3
-pkgver=${major_version}.${minor_version}.${release_version}
+minor_version=1
+release_version=
+pkgver=${major_version}.${minor_version}

Or

pkgname=davinci-resolve
major_version=19
-minor_version=0
-release_version=3
-pkgver=${major_version}.${minor_version}.${release_version}
+minor_version=1
+release_version=
+pkgver=${major_version}.${minor_version}
pkgrel=1
1 Like

The diff output means

  • lines starting with a minus sign must be removed
  • lines starting with plus sign are to be added, and remove the plus sign too

Something like:

pkgname=davinci-resolve
# -minor_version=0
# -release_version=3
# -pkgver=${major_version}.${minor_version}.${release_version}
minor_version=1
release_version=
pkgver=${major_version}.${minor_version}
pkgrel=1

(Simply commented out the lines with minus signs above.)

2 Likes

Thanks, I’ll give these a try.

==> ERROR: One or more files did not pass the validity check!
 -> error downloading sources: /home/radu/.cache/yay/davinci-resolve 
	 context: exit status 1 
==> ERROR: One or more files did not pass the validity check!
 -> error making: davinci-resolve-exit status 1
 -> Failed to install the following packages. Manual intervention is required:
davinci-resolve - exit status 1

If I’m not mistaken, you have to run updpkgsums after you’ve edited the PKGBUILD

1 Like

Yes, different versions typically have different checksums. Updating checksums should help.

1 Like

How do I do that because once I’ve saved and exited out of nano it asks me if I want to proceed with install. If I choose yes I get the validity error and if I choose no and then run updkgsums I get ==> ERROR: PKGBUILD not found or is not a file

Just run sha256sum on the downloaded file /home/radu/.cache/yay/davinci-resolve. Open PKGBUILD and replace the wrong checksum with the new one. Take care to use the right one, there’s two in there, one for DaVinci Resolve, one for DaVinci Resolve Studio.

Run makepkg again.

EDIT: Or just do what trevarj in the AUR comment said and run makepkg -si --skipchecksums --skippgpcheck instead.

1 Like

Thank you everyone that has helped. I eventually managed to do it.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.