Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PKGBUILD much less flaky and ideompotent #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions archlinux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pkg/
src/
*.tar.zst
61 changes: 45 additions & 16 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
pkgname=(qubes-vm-gui qubes-vm-pulseaudio)
pkgver=$(cat version)
pkgrel=10
epoch=
pkgdesc="The Qubes GUI Agent for AppVMs"
arch=("x86_64")
url="http://qubes-os.org/"
license=('GPL')
groups=()
makedepends=(pkg-config make gcc patch git automake autoconf libtool
'pulseaudio<=16.1'
xorg-server-devel xorg-util-macros libxcomposite libxt pixman lsb-release
qubes-vm-gui-common qubes-libvchan qubes-db-vm
)
checkdepends=()
optdepends=()
provides=()
Expand All @@ -21,22 +15,58 @@ backup=()
options=()
changelog=

source=(PKGBUILD-z-qubes-session.sh)
source=()
md5sums=()

noextract=()
md5sums=() #generate with 'makepkg -g'
pa_ver=$((pkg-config --modversion libpulse 2>/dev/null || echo 0.0) | cut -f 1 -d "-")

# Use envvar $PA_VER_FULL to specify pulseaudio version manually
# e.g. PA_VER_FULL=16.1 makepkg -s
if [ -z $PA_VER_FULL ]
then
pa_ver=$(pkg-config --modversion libpulse)
if [ ! $? -eq 0 ]; then
echo "Cannot find libpulse version with pkg-config."
echo "Please specify version manually with PA_VER_FULL."
exit 1
fi
pa_ver=$(echo $pa_ver | cut -f 1 -d "-")
export PA_VER_FULL=$pa_ver
else
pa_ver=$PA_VER_FULL
fi

makedepends=(pkg-config make gcc patch git automake autoconf libtool
"pulseaudio=$pa_ver"
xorg-server-devel xorg-util-macros libxcomposite libxt pixman
qubes-vm-gui-common qubes-libvchan qubes-db-vm
)


if [ -e archlinux ] # on no, at repo root
then
echo Do not run 'makepkg' at repo root! >&2
cd archlinux
fi

pkgver=$(cat $startdir/../version)

build() {

rm $srcdir/PKGBUILD-z-qubes-session.sh || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm -f instead of || true ?

Copy link
Author

@iacore iacore Jun 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will still fail if the file doesn't exist. makepkg still abort if any command return non-zero.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ rm -f /no-such-file; echo $?
0

Copy link
Author

@iacore iacore Jun 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed clean(). It was for the broken build script before this patch. Now we can use makepkg -c to clean after build.

cp $startdir/PKGBUILD-z-qubes-session.sh $srcdir/
for source in Makefile appvm-scripts gui-common include pulse gui-agent common xf86-input-mfndev xf86-video-dummy xf86-qubes-common window-icon-updater version; do
(ln -s $srcdir/../$source $srcdir/$source)
if [ -e "$source" ]; then rm -r "$source"; fi
cp -r $startdir/../$source $source
done

pa_ver=$((pkg-config --modversion libpulse 2>/dev/null || echo 0.0) | cut -f 1 -d "-")

rm -f pulse/pulsecore
ln -s pulsecore-$pa_ver pulse/pulsecore
pulsecore_dir="pulse/pulsecore-$pa_ver"
if [ ! -d $pulsecore_dir ]; then
echo "Invalid pulsecore_dir: $pulsecore_dir"
exit 2
fi
if [ -e pulse/pulsecore ]; then rm -r pulse/pulsecore; fi
ln -s $(realpath "$pulsecore_dir") pulse/pulsecore

# Bug fixes : /var/run/console depends on pam_console, which is fedora specific
# As a consequece, /var/run/console does not exists and qubes-gui-agent will always fail
Expand Down Expand Up @@ -71,9 +101,8 @@ install -D $srcdir/PKGBUILD-z-qubes-session.sh $pkgdir/etc/X11/xinit/xinitrc.d/z
package_qubes-vm-pulseaudio() {

pkgdesc="Pulseaudio support for Qubes VM"
depends=('alsa-lib' 'alsa-utils' 'pulseaudio-alsa' 'pulseaudio<=16.1')
depends=('alsa-lib' 'alsa-utils' 'pulseaudio-alsa' "pulseaudio=$pa_ver")
install=PKGBUILD-pulseaudio.install
pa_ver=$((pkg-config --modversion libpulse 2>/dev/null || echo 0.0) | cut -f 1 -d "-")

make install-pulseaudio DESTDIR=$pkgdir PA_VER=$pa_ver LIBDIR=/usr/lib USRLIBDIR=/usr/lib SYSLIBDIR=/usr/lib

Expand Down