diff --git a/contrib/aur/README.md b/contrib/aur/README.md new file mode 100644 index 000000000..c8b37cb73 --- /dev/null +++ b/contrib/aur/README.md @@ -0,0 +1,13 @@ +# Update the AUR packages + +Edit the `PKGBUILD` for each package: + - To package a new version, update the `pkgver` value and reset `pkgrel` to 0. + - To re-package the same version, only increment the `pkgrel` value. + +You need to run in an archlinux environment and have write permission to the +AUR repositories. Then install the prerequisites and run the update script: + +```shell +pacman -S --needed base-devel git pacman-contrib +./update-aur.sh +``` diff --git a/contrib/aur/bitcoin-abc-qt/PKGBUILD b/contrib/aur/bitcoin-abc-qt/PKGBUILD index 5a56ca69a..93663e70e 100644 --- a/contrib/aur/bitcoin-abc-qt/PKGBUILD +++ b/contrib/aur/bitcoin-abc-qt/PKGBUILD @@ -1,108 +1,102 @@ # Maintainer: Josh Ellithorpe pkgname=bitcoin-abc-qt pkgver=0.22.0 pkgrel=0 pkgdesc="Bitcoin ABC with bitcoind, bitcoin-cli, bitcoin-tx, bitcoin-seeder and bitcoin-qt" arch=('i686' 'x86_64') url="https://bitcoinabc.org" depends=('boost-libs' 'libevent' 'desktop-file-utils' 'qt5-base' 'protobuf' 'openssl' 'miniupnpc' 'zeromq' 'qrencode' 'jemalloc') -makedepends=('cmake' 'ninja' 'boost' 'qt5-tools') +makedepends=('cmake' 'ninja' 'boost' 'qt5-tools' 'python') license=('MIT') source=(https://github.com/Bitcoin-ABC/bitcoin-abc/archive/v$pkgver.tar.gz bitcoin.conf bitcoin.logrotate bitcoin.service bitcoin-reindex.service bitcoin.install) -sha256sums=('feaffb2129f49813692ec17ba5675a3ac44e6d0560af55bb4d1d2f160c5b4a0b' - 'c30e5c7e0e97b001fdeac5f4510d5ebc0e0499ec086325e845db609a24f2e22f' - '8f05207b586916d489b7d25a68eaacf6e678d7cbb5bfbac551903506b32f904f' - 'f2fd9d8331238727333cf2412ba3759cb194a65b2060eff36808b24c06382104' - '497dbeefb9cd9792757a9b6e1fbfd92710d19990ee2959add6c30533ae40b6f6' - '45429013dae87a58bc79ca7b7a037665bf8592cae0199bcf4aef088fb950e78a') backup=('etc/bitcoin/bitcoin.conf' 'etc/logrotate.d/bitcoin') provides=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx' 'bitcoin-qt' 'bitcoin-seeder') conflicts=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx' 'bitcoin-qt' 'bitcoin-seeder') install=bitcoin.install build() { cd "$srcdir/bitcoin-abc-$pkgver" msg2 'Building...' mkdir -p build pushd build cmake -GNinja .. \ -DENABLE_CLANG_TIDY=OFF \ -DCLIENT_VERSION_IS_RELEASE=ON \ -DENABLE_REDUCE_EXPORTS=ON \ -DENABLE_STATIC_LIBSTDCXX=ON \ -DCMAKE_INSTALL_PREFIX=$pkgdir/usr ninja popd } check() { cd "$srcdir/bitcoin-abc-$pkgver/build" msg2 'Testing...' #ninja check } package() { cd "$srcdir/bitcoin-abc-$pkgver" msg2 'Installing desktop shortcut...' install -Dm644 contrib/debian/bitcoin-qt.desktop \ "$pkgdir"/usr/share/applications/bitcoin.desktop install -Dm644 share/pixmaps/bitcoin-abc128.png \ "$pkgdir"/usr/share/pixmaps/bitcoin-abc128.png msg2 'Installing license...' install -Dm 644 COPYING -t "$pkgdir/usr/share/licenses/${pkgname}" msg2 'Installing examples...' install -Dm644 "contrib/debian/examples/bitcoin.conf" \ -t "$pkgdir/usr/share/doc/bitcoin/examples" msg2 'Installing documentation...' install -dm 755 "$pkgdir/usr/share/doc/bitcoin" for _doc in \ $(find doc -maxdepth 1 -type f -name "*.md" -printf '%f\n') \ release-notes; do cp -dpr --no-preserve=ownership "doc/$_doc" \ "$pkgdir/usr/share/doc/bitcoin/$_doc" done msg2 'Installing essential directories' install -dm 700 "$pkgdir/etc/bitcoin" install -dm 755 "$pkgdir/srv/bitcoin" install -dm 755 "$pkgdir/run/bitcoin" pushd build msg2 'Installing executables and man pages...' cmake -DCOMPONENT=bitcoind -P cmake_install.cmake cmake -DCOMPONENT=bitcoin-qt -P cmake_install.cmake cmake -DCOMPONENT=bitcoin-seeder -P cmake_install.cmake popd msg2 'Installing bitcoin.conf...' install -Dm 600 "$srcdir/bitcoin.conf" -t "$pkgdir/etc/bitcoin" msg2 'Installing bitcoin.service...' install -Dm 644 "$srcdir/bitcoin.service" -t "$pkgdir/usr/lib/systemd/system" install -Dm 644 "$srcdir/bitcoin-reindex.service" \ -t "$pkgdir/usr/lib/systemd/system" msg2 'Installing bitcoin.logrotate...' install -Dm 644 "$srcdir/bitcoin.logrotate" "$pkgdir/etc/logrotate.d/bitcoin" msg2 'Installing bash completion...' for _compl in bitcoin-cli bitcoin-tx bitcoind; do install -Dm 644 "contrib/${_compl}.bash-completion" \ "$pkgdir/usr/share/bash-completion/completions/$_compl" done } diff --git a/contrib/aur/bitcoin-abc/PKGBUILD b/contrib/aur/bitcoin-abc/PKGBUILD index 555266fe4..bc706fe99 100644 --- a/contrib/aur/bitcoin-abc/PKGBUILD +++ b/contrib/aur/bitcoin-abc/PKGBUILD @@ -1,103 +1,97 @@ # Maintainer: Josh Ellithorpe pkgname=bitcoin-abc pkgver=0.22.0 pkgrel=0 pkgdesc="Bitcoin ABC with bitcoind, bitcoin-tx, bitcoin-seeder and bitcoin-cli" arch=('i686' 'x86_64') url="https://bitcoinabc.org" depends=('boost-libs' 'libevent' 'openssl' 'zeromq' 'miniupnpc' 'jemalloc') -makedepends=('cmake' 'ninja' 'boost') +makedepends=('cmake' 'ninja' 'boost' 'python') license=('MIT') source=(https://github.com/Bitcoin-ABC/bitcoin-abc/archive/v$pkgver.tar.gz bitcoin.conf bitcoin.logrotate bitcoin.service bitcoin-reindex.service bitcoin.install) -sha256sums=('feaffb2129f49813692ec17ba5675a3ac44e6d0560af55bb4d1d2f160c5b4a0b' - 'c30e5c7e0e97b001fdeac5f4510d5ebc0e0499ec086325e845db609a24f2e22f' - '8f05207b586916d489b7d25a68eaacf6e678d7cbb5bfbac551903506b32f904f' - 'f2fd9d8331238727333cf2412ba3759cb194a65b2060eff36808b24c06382104' - '497dbeefb9cd9792757a9b6e1fbfd92710d19990ee2959add6c30533ae40b6f6' - '16ea5b19d554e0cb748ba14cbeee6015ed456b66f981fb8769f1403720b2d0a9') backup=('etc/bitcoin/bitcoin.conf' 'etc/logrotate.d/bitcoin') provides=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx' 'bitcoin-seeder') conflicts=('bitcoin-cli' 'bitcoin-daemon' 'bitcoin-tx' 'bitcoin-seeder') install=bitcoin.install build() { cd "$srcdir/${pkgname}-$pkgver" msg2 'Building...' mkdir -p build pushd build cmake -GNinja .. \ -DENABLE_CLANG_TIDY=OFF \ -DCLIENT_VERSION_IS_RELEASE=ON \ -DENABLE_REDUCE_EXPORTS=ON \ -DENABLE_STATIC_LIBSTDCXX=ON \ -DBUILD_BITCOIN_WALLET=OFF \ -DBUILD_BITCOIN_QT=OFF \ -DCMAKE_INSTALL_PREFIX=$pkgdir/usr ninja popd } check() { cd "$srcdir/${pkgname}-$pkgver/build" msg2 'Testing...' #ninja check } package() { cd "$srcdir/${pkgname}-$pkgver" msg2 'Installing license...' install -Dm 644 COPYING -t "$pkgdir/usr/share/licenses/${pkgname}" msg2 'Installing examples...' install -Dm644 "contrib/debian/examples/bitcoin.conf" \ -t "$pkgdir/usr/share/doc/bitcoin/examples" msg2 'Installing documentation...' install -dm 755 "$pkgdir/usr/share/doc/bitcoin" for _doc in \ $(find doc -maxdepth 1 -type f -name "*.md" -printf '%f\n') \ release-notes; do cp -dpr --no-preserve=ownership "doc/$_doc" \ "$pkgdir/usr/share/doc/bitcoin/$_doc" done msg2 'Installing essential directories' install -dm 700 "$pkgdir/etc/bitcoin" install -dm 755 "$pkgdir/srv/bitcoin" install -dm 755 "$pkgdir/run/bitcoin" pushd build msg2 'Installing executables and man pages...' cmake -DCOMPONENT=bitcoind -P cmake_install.cmake cmake -DCOMPONENT=bitcoin-seeder -P cmake_install.cmake popd msg2 'Installing bitcoin.conf...' install -Dm 600 "$srcdir/bitcoin.conf" -t "$pkgdir/etc/bitcoin" msg2 'Installing bitcoin.service...' install -Dm 644 "$srcdir/bitcoin.service" -t "$pkgdir/usr/lib/systemd/system" install -Dm 644 "$srcdir/bitcoin-reindex.service" \ -t "$pkgdir/usr/lib/systemd/system" msg2 'Installing bitcoin.logrotate...' install -Dm 644 "$srcdir/bitcoin.logrotate" "$pkgdir/etc/logrotate.d/bitcoin" msg2 'Installing bash completion...' for _compl in bitcoin-cli bitcoin-tx bitcoind; do install -Dm 644 "contrib/${_compl}.bash-completion" \ "$pkgdir/usr/share/bash-completion/completions/$_compl" done } diff --git a/contrib/aur/update-aur.sh b/contrib/aur/update-aur.sh new file mode 100644 index 000000000..b78d6f771 --- /dev/null +++ b/contrib/aur/update-aur.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +export LC_ALL=C + +set -euxo pipefail + +# The nobody user is a default on Archlinux. It has no login and no home +# directory, its main use is for running unprivileged commands in scripts, which +# is exactly what we need for running makepkg which can't run as root. +run_as_nobody() { + su -l nobody -s /bin/bash -c "cd ${PWD} && $1" +} + +PACKAGES=( + bitcoin-abc + bitcoin-abc-qt +) + +for PACKAGE in "${PACKAGES[@]}" +do + # Give write permission to the nobody user + # This is required as makepkg cannot be run as root + chmod -R o+w "${PACKAGE}" + pushd "${PACKAGE}" + + # Get the data from the PKGBUILD + # shellcheck source=bitcoin-abc/PKGBUILD + source PKGBUILD + + # Install the dependencies + pacman -S --needed --noconfirm "${depends[@]}" "${makedepends[@]}" + + # Copy the common files + for f in "${source[@]}" + do + if [ -f "../common/$f" ] + then + cp "../common/$f" . + fi + done + + # Add the checksums to the PKGBUILD. Enforce SHA256. + echo "sha256sums=()" >> PKGBUILD + run_as_nobody "updpkgsums PKGBUILD" + + # Generate the .SRCINFO + run_as_nobody "makepkg --printsrcinfo > .SRCINFO" + + popd + + # Clone the upstream repository + git clone "https://aur.archlinux.org/${PACKAGE}.git" "${PACKAGE}-upstream" + + # Copy our modified files to the upstream repository + cp -R "${PACKAGE}"/* "${PACKAGE}-upstream" + + # Give write permission to the nobody user + # This is required as makepkg cannot be run as root + chmod -R o+w "${PACKAGE}-upstream" + pushd "${PACKAGE}-upstream" + + # The package is ready, let's check it works + run_as_nobody "makepkg --clean" + + # Cleanup the output files from the build + git clean -xffd + + # Commit the version change + git commit -a -m "Update to version ${pkgver} release ${pkgrel}" + + # Push the changes upstream + git push origin master + + popd +done