Skip to content

Commit

Permalink
[#6] Update the test scripts for Arch packing.
Browse files Browse the repository at this point in the history
As part of issue #6, I'm changing the way I make an Arch package to
publish a few PKGBUILDs (-bin, -git, &c). This patchset updates a
few test scripts.

Also, add LICENSE to the distribution & fix the Debian package build.
Somehow, the name got out of sync; I was missing a '-1'.
  • Loading branch information
sp1ff committed May 10, 2024
1 parent ca60c73 commit e58710a
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 45 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ configure
Makefile
config.log
config.status
PKGBUILD
*.deb
*.zst
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
2024-05-09 Michael Herstine <sp1ff@pobox.com>

[#6] Update the test scripts for Arch packing.
As part of issue #6, I'm changing the way I make an Arch package to
publish a few PKGBUILDs (-bin, -git, &c). This patchset updates a
few test scripts.

Also, add LICENSE to the distribution & fix the Debian package build.
Somehow, the name got out of sync; I was missing a '-1'.

2024-03-12 Michael Herstine <sp1ff@pobox.com>

Switching clap to a tilde version dependency; throwing-in a change to version.texi that got missed

2023-12-28 Michael Herstine <sp1ff@pobox.com>

Cutting release 0.3.2

Assorted clean-up pre-merge:
- fix the project CI (again)
- I've decided on a policy of supporting rust versions going back
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SUBDIRS = mpdpopm doc
EXTRA_DIST = LICENSE
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ mpdpopm News -- history of user-visible changes -*- outline -*-
*** User-visible changes

**** If HOME isn't set, look for .mppopm in /
**** [#6] Removed the Arch package from the build & start publishing them to the AUR
**** Add LICENSE to the distribution
** 0.3.2 build

*** Bugfixes
Expand Down
1 change: 1 addition & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKGBUILD
48 changes: 26 additions & 22 deletions admin/Dockerfile-arch
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
# Docker image for building, debugging & packaging -*- mode: dockerfile; -*-
FROM archlinux:latest AS base

# Bootstrap
RUN pacman --noconfirm -Syu && \
cp -v /etc/pacman.conf /etc/pacman.conf.orig && \
sed -e 's/^NoExtract/# NoExtract/' /etc/pacman.conf > /tmp/pacman.conf.tmp && \
cp -v /tmp/pacman.conf.tmp /etc/pacman.conf
# I've had problems with the base image having out-of-date
# mirrors. Begin by installing `reflector` & upating the
# mirrorlist. Then update the system passing "-yy" to force a refresh
# of all package databases (even if they appear to be up-to-date [this
# has resolved the dreaded "404" problem for me in the past]).

# See here https://bbs.archlinux.org/viewtopic.php?id=141029
RUN pacman-key --init && pacman --noconfirm -Sy archlinux-keyring && \
pacman --noconfirm -Syyu reflector && \
reflector --latest 10 --sort rate --save /etc/pacman.d/mirrorlist && \
cp -v /etc/pacman.conf /etc/pacman.conf.orig && \
sed -i -e 's/^NoExtract/# NoExtract/' /etc/pacman.conf

# WORKAROUND for glibc 2.33 and old Docker
# Seems to be no longer needed
# (seems to be no longer needed)
# See https://github.com/actions/virtual-environments/issues/2658
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562
# RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
# curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
# bsdtar -C / -xvf "$patched_glibc"

# Get the mirrorlist up-to-date
# RUN pacman rsync --noconfirm -S reflector rsync && \
# reflector --latest 16 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

# See here https://bbs.archlinux.org/viewtopic.php?id=141029
# Not sure why the -yyu needed, perhaps as a result of reflector changing the mirrorlist?
# RUN pacman --noconfirm -Syyu man-db man-pages texinfo vim base-devel gdb rust cargo && \
RUN pacman --noconfirm -S man-db man-pages texinfo vim base-devel gdb rust cargo && \
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
useradd -ms /bin/bash -G users,wheel mgh && \
echo 'mgh:mgh' | chpasswd && \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir /cores && chmod 777 /cores && \
echo "kernel.core_pattern=/cores/core.%e.%p" >> /etc/sysctl.d/50-coredump.conf
RUN pacman --noconfirm -S base-devel pacman-contrib namcap git man-db man-pages \
texinfo vim gdb rust cargo && \
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
useradd -ms /bin/bash -G users,wheel mgh && \
echo 'mgh:mgh' | chpasswd && \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir /cores && chmod 777 /cores && \
echo "kernel.core_pattern=/cores/core.%e.%p" >> /etc/sysctl.d/50-coredump.conf && \
mkdir -p /tmp/mpdpopm{,-git,-bin} && \
chown mgh:users /tmp/mpdpopm{,-git,-bin} && \
chmod 775 /tmp/mpdpopm{,-git,-bin}

# Rhm... needed?
# sudo sysctl -p /etc/sysctl.d/50-coredump.conf

USER mgh

ENV PATH="/home/mgh/.cargo/bin:${PATH}"
# Huh... still needed?
# ENV PATH="/home/mgh/.cargo/bin:${PATH}"

1 change: 0 additions & 1 deletion admin/Dockerfile-debian
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-noninteractive}
RUN set -ex && \
echo "Installing pre-requisites..." && \
apt-get update && \
apt-get upgrade && \
apt-get install -y --no-install-recommends \
# Wow... \
ca-certificates \
Expand Down
6 changes: 4 additions & 2 deletions admin/PKGBUILD.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Maintainer: Michael <sp1ff at pobox dot com>
pkgname=@PACKAGE_NAME@
pkgver=@PACKAGE_VERSION@
pkgrel=1
pkgdesc='Maintain ratings & playcounts for your mpd server'
url=https://github.com/sp1ff/mpdpopm
arch=('x86_64')
license=('GPL3')
license=('GPL-3.0-or-later')
depends=("gcc-libs" "glibc")
source=(mpdpopm-@PACKAGE_VERSION@.tar.gz)

build() {
cd "${pkgname}-${pkgver}"
./configure --prefix=/usr/local
./configure --prefix=/usr
make
}

Expand Down
19 changes: 11 additions & 8 deletions admin/build-dev-arch-pkg
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
#!/usr/bin/env bash

# This script will bindmount the host mpdpopm project directory and invoke
# `makepkg` so as to make an Arch package. It's meant for use during mpdpopm
# development, as a check that my latest changes won't break anything at
# release-time when it's time to package the latest mpdpopm.
# This script will mount a source tarball into a thin Arc Linux container and
# invoke`makepkg` so as to make an Arch package. It's meant for use during
# mpdpopm development, as a check that my latest changes won't break anything
# at release-time when it's time to package the latest mpdpopm.

# It is presumably run from the root mpdpopm directory.

# Invoke as `admin/build-dev-arch-pkg mpdpopm-${version}.tar.gz
# Invoke as `admin/build-dev-arch-pkg mpdpopm-${version}.tar.gz`

set -ex
docker build -t mpdpopm-arch:latest -f admin/Dockerfile-arch .
docker build -t mpdpopm-arch:latest -f admin/Dockerfile-arch --label "mpdpopm-arch" .

here=$(pwd)
script=${here}/admin/build-dev-arch-pkg-cnt
pkgbuild=${here}/PKGBUILD
pkgbuild=${here}/admin/PKGBUILD
tarball=${here}/$1

docker_args="-it"
docker_args="$docker_args -v ${script}:/build-dev-pkg:ro"
docker_args="$docker_args -v ${tarball}:/$1:ro"
docker_args="$docker_args -v ${pkgbuild}:/PKGBUILD"
docker_args="$docker_args --mount type=bind,source=${here},target=/mpdpopm"
docker_args="$docker_args --privileged"
docker_args="$docker_args --ulimit core=-1"
docker_args="$docker_args -u mgh"
docker_args="$docker_args --name=mpdpopm-dev-arch"

docker container rm -f mpdpopm-dev-arch

# Un-comment to just drop into the container & experiment
# cmd="docker run ${docker_args} mpdpopm-arch:latest"
cmd="docker run ${docker_args} mpdpopm-arch:latest /build-dev-pkg $1"
Expand Down
17 changes: 14 additions & 3 deletions admin/build-dev-arch-pkg-cnt
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
#!/bin/bash

# This script is presumably mounted into the build container, with an argument
# of the tarball to be used for the package.

set -ex
base="$(basename $1 .tar.gz)"
version="${base:8}"
cp -v /$1 /tmp
cp -v /PKGBUILD /tmp
cd /tmp
makepkg -g >> PKGBUILD
updpkgsums PKGBUILD
namcap PKGBUILD | tee /tmp/namcap.$$.log
makepkg
namcap mpdpopm-${version}-1-x86_64.pkg.tar.zst | tee -a /tmp/namcap.$$.log
pacman -Qlp mpdpopm-${version}-1-x86_64.pkg.tar.zst
pacman -Qip mpdpopm-${version}-1-x86_64.pkg.tar.zst
if grep -F ' E: ' /tmp/namcap.$$.log; then
echo "There were errors and/or warnings from namcap:"
cat /tmp/namcap.$$.log
exit 1
fi
sudo pacman --noconfirm -Uv mpdpopm-${version}-1-x86_64.pkg.tar.zst
mppopm --version
mppopm --help
test -f /usr/local/share/info/mpdpopm.info.gz
test -f /usr/share/info/mpdpopm.info.gz
sudo pacman --noconfirm -R mpdpopm
cp -v mpdpopm-${version}-1-x86_64.pkg.tar.zst /mpdpopm
1 change: 0 additions & 1 deletion admin/build-dev-debian-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tarball=${here}/$1
docker_args="-it"
docker_args="$docker_args -v ${script}:/build-dev-pkg:ro"
docker_args="$docker_args -v ${tarball}:/$1:ro"
docker_args="$docker_args -v ${license}:/LICENSE"
docker_args="$docker_args --mount type=bind,source=${here},target=/mpdpopm"
docker_args="$docker_args --privileged"
docker_args="$docker_args --ulimit core=-1"
Expand Down
5 changes: 2 additions & 3 deletions admin/build-dev-debian-pkg-cnt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ cp -v /"$1" /tmp
cd /tmp
tar -xf "$1"
cd mpdpopm-${version}
cp -v /LICENSE .
./configure
cd mpdpopm
cargo deb
sudo dpkg --debug=2 -i target/debian/mpdpopm_${version}_amd64.deb
sudo dpkg --debug=2 -i target/debian/mpdpopm_${version}-1_amd64.deb
mppopm --version
mppopm --help
test -f /usr/local/share/info/mpdpopm.info
sudo dpkg --debug=2 -r mpdpopm
sudo cp -v target/debian/mpdpopm_${version}_amd64.deb /mpdpopm
sudo cp -v target/debian/mpdpopm_${version}-1_amd64.deb /mpdpopm

39 changes: 39 additions & 0 deletions admin/test-aur-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

# This script will mount the PKGBUILDs for my assorted AUR packages into a thin
# Arch Linux Docker container and then attempt to build, install & uninstall
# each.

# It's meant for use after an mpdpopm release, when I'm updating my AUR
# packages, before releasing new package versions.

# It is presumably run from the root mpdpopm directory.

# Invoke as `admin/test-aur-packages $version`

set -ex
docker build -t mpdpopm-arch:latest -f admin/Dockerfile-arch --label "mpdpopm-arch" .

# If this 👆 fails with 404s when trying to download packages, try deleting any
# Arch images before blowing away everything.

version="$1"
here=$(pwd)
script=${here}/admin/test-aur-packages-cnt

docker_args="-it"
docker_args="$docker_args -v ${script}:/build-pkgs:ro"
docker_args="$docker_args -v ${HOME}/code/projects/mpdpopm-aur/PKGBUILD:/tmp/mpdpopm/PKGBUILD"
docker_args="$docker_args -v ${HOME}/code/projects/mpdpopm-git/PKGBUILD:/tmp/mpdpopm-git/PKGBUILD"
docker_args="$docker_args -v ${HOME}/code/projects/mpdpopm-bin/PKGBUILD:/tmp/mpdpopm-bin/PKGBUILD"
docker_args="$docker_args --privileged"
docker_args="$docker_args --ulimit core=-1"
docker_args="$docker_args -u mgh"
docker_args="$docker_args --name=mpdpopm-aur"

docker container rm -f mpdpopm-aur

# Un-comment to just drop into the container & experiment
# cmd="docker run ${docker_args} mpdpopm-arch:latest"
cmd="docker run ${docker_args} mpdpopm-arch:latest /build-pkgs ${version}"
exec $cmd
59 changes: 59 additions & 0 deletions admin/test-aur-packages-cnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# This script is presumably mounted into the build container. Invoke with
# the package version.

set -ex
version="$1"

# Test the "stock" package
cd /tmp/mpdpopm
makepkg
namcap mpdpopm-${version}-1-x86_64.pkg.tar.zst | tee -a /tmp/namcap.$$.log
pacman -Qlp mpdpopm-${version}-1-x86_64.pkg.tar.zst
pacman -Qip mpdpopm-${version}-1-x86_64.pkg.tar.zst
if grep -F ' E: ' /tmp/namcap.$$.log; then
echo "There were errors and/or warnings from namcap:"
cat /tmp/namcap.$$.log
exit 1
fi
sudo pacman --noconfirm -Uv mpdpopm-${version}-1-x86_64.pkg.tar.zst
mppopm --version
mppopm --help
test -f /usr/share/info/mpdpopm.info.gz
sudo pacman --noconfirm -R mpdpopm

# Test the "git" package
cd /tmp/mpdpopm-git
makepkg
namcap mpdpopm-git-${version}-1-x86_64.pkg.tar.zst | tee -a /tmp/namcap.$$.log
pacman -Qlp mpdpopm-git-${version}-1-x86_64.pkg.tar.zst
pacman -Qip mpdpopm-git-${version}-1-x86_64.pkg.tar.zst
if grep -F ' E: ' /tmp/namcap.$$.log; then
echo "There were errors and/or warnings from namcap:"
cat /tmp/namcap.$$.log
exit 1
fi
sudo pacman --noconfirm -Uv mpdpopm-git-${version}-1-x86_64.pkg.tar.zst
mppopm --version
mppopm --help
test -f /usr/share/info/mpdpopm.info.gz
sudo pacman --noconfirm -R mpdpopm-git

# Finally, test the "bin" package
cd /tmp/mpdpopm-bin
makepkg
namcap mpdpopm-bin-${version}-1-x86_64.pkg.tar.zst | tee -a /tmp/namcap.$$.log
pacman -Qlp mpdpopm-bin-${version}-1-x86_64.pkg.tar.zst
pacman -Qip mpdpopm-bin-${version}-1-x86_64.pkg.tar.zst
if grep -F ' E: ' /tmp/namcap.$$.log; then
echo "There were errors and/or warnings from namcap:"
cat /tmp/namcap.$$.log
exit 1
fi
sudo pacman --noconfirm -Uv mpdpopm-bin-${version}-1-x86_64.pkg.tar.zst
mppopm --version
mppopm --help
test -f /usr/share/info/mpdpopm.info.gz
grep -F 'mpdpopm' /usr/share/info/dir
sudo pacman --noconfirm -R mpdpopm-bin
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([mpdpopm], [0.3.2], [sp1ff@pobox.com], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_INIT([mpdpopm], [0.3.3], [sp1ff@pobox.com], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([mpdpopm/Cargo.toml.in])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability -Wno-override gnits std-options dist-xz dist-zstd])
Expand All @@ -25,7 +25,7 @@ dnl Ditto for etc/mppopmd.conf.am.in and etc/mppopmd.service.am.in
AC_CONFIG_FILES([mpdpopm/src/vars.rs.am])
AC_CONFIG_FILES([mpdpopm/mppopmd.conf.am:etc/mppopmd.conf.am.in])
AC_CONFIG_FILES([mpdpopm/mppopmd.service.am:etc/mppopmd.service.am.in])
AC_CONFIG_FILES([PKGBUILD:admin/PKGBUILD.in])
AC_CONFIG_FILES([admin/PKGBUILD])
AC_CONFIG_FILES([Makefile mpdpopm/Makefile mpdpopm/Cargo.toml])
AC_CONFIG_FILES([doc/Makefile])

Expand Down
4 changes: 2 additions & 2 deletions doc/version.texi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@set UPDATED 29 December 2023
@set UPDATED-MONTH December 2023
@set EDITION 0.3.2
@set VERSION 0.3.2
@set EDITION 0.3.3
@set VERSION 0.3.3

0 comments on commit e58710a

Please sign in to comment.