commit 73120dca565647cd70b69a98e4d44159d516c0c2 Author: Christian Schendel Date: Tue Sep 2 21:26:37 2025 +0200 Initial commit diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..860b923 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,54 @@ +pkgbase = libpamac-aur + pkgdesc = Pamac package manager library based on libalpm + pkgver = 11.7.3 + pkgrel = 4 + url = https://github.com/manjaro/libpamac/ + install = pamac.install + arch = i686 + arch = x86_64 + arch = arm + arch = armv6h + arch = armv7h + arch = aarch64 + license = GPL-3.0-or-later + makedepends = asciidoc + makedepends = gettext + makedepends = gobject-introspection + makedepends = itstool + makedepends = meson + makedepends = ninja + makedepends = systemd + makedepends = vala>=0.46 + depends = appstream + depends = appstream-glib>=0.7.18-1 + depends = archlinux-appstream-data + depends = bash + depends = dbus-glib + depends = git + depends = glib2>=2.42 + depends = glibc + depends = gnutls>=3.4 + depends = json-glib + depends = libalpm.so=15 + depends = libnotify + depends = libsoup3 + depends = pacman>=7.0 + depends = polkit + depends = vte3>=0.38 + depends = flatpak + provides = libpamac.so=11 + provides = libpamac-appstream.so=11 + provides = libpamac=11.7.3 + conflicts = libpamac + conflicts = libpamac-all + options = !emptydirs + options = !strip + backup = etc/pamac.conf + source = libpamac-11.7.3-4.zip::https://github.com/manjaro/libpamac//archive/087af94264cf1e79a809a2f5dbb570a617e09d45.zip + source = fix-appstream-data.sh + source = fix-appstream-data.hook + b2sums = 81e60cdb7e3391505626903b53c858b9faf586b5158d1ba6d232382d7103cb7a1d8eb18a880e50a24097eb7243d4b17842fa7f1fe321793e962d1bd4862b5207 + b2sums = 8107b9fa09bcb78d9f5cc60b3e57681c19013822eee2ec73d6ba41b35be2337cdeb15c8959879dea0c6022110328cd3ae373e2e9a0be6b29ea29220144ccea99 + b2sums = e7c51e95d0a14ac872df803a15ba6afb96d500b0c9f274b5c34e994557a4b4b6bcbdb100172dd16d7862f97719927d6b313171ffc1a41046badc81dbbc6f4d16 + +pkgname = libpamac-aur diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc9c857 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Ignore everything +* + +# But not these files... +!.gitignore +!PKGBUILD +!.SRCINFO +!LICENSE +!chroot-build +!.nvchecker.toml +!/keys +!/keys/pgp +!/keys/pgp/*.asc +!/LICENSES +!/LICENSES/*.txt +!REUSE.toml +!*.hook +!*.install +!.sh diff --git a/.nvchecker.toml b/.nvchecker.toml new file mode 100644 index 0000000..a766900 --- /dev/null +++ b/.nvchecker.toml @@ -0,0 +1,3 @@ +[libpamac-aur] +source = "git" +git = "https://github.com/manjaro/libpamac.git" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b87c5e4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright Arch Linux Contributors + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/LICENSES/0BSD.txt b/LICENSES/0BSD.txt new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/LICENSES/0BSD.txt @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..7a78c1c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,120 @@ +# Maintainer: Christian Schendel +# Contributor: Zeph +# https://gitlab.manjaro.org/packages/extra/libpamac +ENABLE_FLATPAK=1 +ENABLE_SNAPD=0 + +pkgname=libpamac-aur +pkgver=11.7.3 +pkgrel=4 +_pkgfixver=$pkgver + +_commit='087af94264cf1e79a809a2f5dbb570a617e09d45' +b2sums=('81e60cdb7e3391505626903b53c858b9faf586b5158d1ba6d232382d7103cb7a1d8eb18a880e50a24097eb7243d4b17842fa7f1fe321793e962d1bd4862b5207' + '8107b9fa09bcb78d9f5cc60b3e57681c19013822eee2ec73d6ba41b35be2337cdeb15c8959879dea0c6022110328cd3ae373e2e9a0be6b29ea29220144ccea99' + 'e7c51e95d0a14ac872df803a15ba6afb96d500b0c9f274b5c34e994557a4b4b6bcbdb100172dd16d7862f97719927d6b313171ffc1a41046badc81dbbc6f4d16') + +pkgdesc="Pamac package manager library based on libalpm" +arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64') +url="https://github.com/manjaro/libpamac/" +license=('GPL-3.0-or-later') +depends=( + appstream + 'appstream-glib>=0.7.18-1' + archlinux-appstream-data + bash + dbus-glib + git + 'glib2>=2.42' + glibc + 'gnutls>=3.4' + json-glib + 'libalpm.so=15' + libnotify + libsoup3 + 'pacman>=7.0' + polkit + 'vte3>=0.38' +) +makedepends=( + asciidoc + gettext + gobject-introspection + itstool + meson + ninja + systemd + 'vala>=0.46' +) +backup=( + 'etc/pamac.conf' +) +conflicts=( + 'libpamac' + 'libpamac-all' +) +provides=( + 'libpamac.so=11' + 'libpamac-appstream.so=11' + "libpamac=$_pkgfixver" +) +options=(!emptydirs !strip) +install=pamac.install +source=( + "libpamac-$pkgver-$pkgrel.zip::$url/archive/$_commit.zip" + 'fix-appstream-data.sh' + 'fix-appstream-data.hook' +) + +define_meson='' +if [ "${ENABLE_FLATPAK}" = 1 ]; then + depends+=('flatpak') + define_meson+=' -Denable-flatpak=true' +fi + +if [ "${ENABLE_SNAPD}" = 1 ]; then + depends+=('snapd' 'snapd-glib') + define_meson+=' -Denable-snap=true' +fi + +create_links() { + # create soname links + find "$pkgdir" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do + _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true) + _base=$(echo ${_soname} | sed -r 's/(.*)\.so.*/\1.so/') + [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}" + [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}" + done +} + +prepare() { + cd "$srcdir/libpamac-$_commit" + # adjust version string + sed -i -e "s|\"$_pkgfixver\"|\"$pkgver-$pkgrel\"|g" src/version.vala +} + +build() { + cd "$srcdir/libpamac-$_commit" + mkdir -p builddir + cd builddir + meson setup \ + --buildtype=release \ + -Denable-aur=true \ + -Denable-appstream=true \ + --prefix=/usr \ + --sysconfdir=/etc $define_meson + # build + meson compile +} + +package() { + cd "$srcdir/libpamac-$_commit/builddir" + DESTDIR="$pkgdir" ninja install + # fix appstream issue + install -Dm644 "$srcdir/fix-appstream-data.hook" "$pkgdir/etc/pacman.d/hooks/fix-appstream-data.hook" + install -Dm755 "$srcdir/fix-appstream-data.sh" "$pkgdir/etc/pacman.d/hooks.bin/fix-appstream-data.sh" + create_links + +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 0000000..eda9d0d --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,30 @@ +version = 1 + +[[annotations]] +path = [ + "PKGBUILD", + "README.md", + "keys/**", + ".SRCINFO", + ".nvchecker.toml", + ".gitignore", + "*.install", + "*.sysusers", + "*.tmpfiles", + "*.logrotate", + "*.pam", + "*.service", + "*.socket", + "*.timer", + "*.desktop", + "*.hook", +] +SPDX-FileCopyrightText = "Arch Linux contributors" +SPDX-License-Identifier = "0BSD" + +[[annotations]] +path = [ + "fix-appstream-data.sh", +] +SPDX-FileCopyrightText = "Arch Linux contributors" +SPDX-License-Identifier = "0BSD" diff --git a/chroot-build b/chroot-build new file mode 100755 index 0000000..f69cac8 --- /dev/null +++ b/chroot-build @@ -0,0 +1,65 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Christian Schendel +# SPDX-License-Identifier: 0BSD + +set -euo pipefail +use_tmpfs=true +CHROOT="/tmp/mkarchroot" + +check_available_ram() { + if [ "$(awk '/^MemAvailable:/ { print $2; }' /proc/meminfo)" -lt 50000 ]; then + use_tmpfs=false + fi +} + +create_chroot_directory() { + if [ $use_tmpfs ]; then + sudo mount --mkdir -t tmpfs -o defaults,size=20G tmpfs $CHROOT + else + sudo mkdir -p "$CHROOT" + fi +} + +create_chroot_environment() { + if [[ ! -d "$CHROOT/root" ]]; then + mkarchroot -M ~/.config/pacman/makepkg.conf "$CHROOT/root" base-devel + fi +} + +build_package(){ + arch-nspawn "$CHROOT/root" pacman -Syu + if makechrootpkg -c -r "$CHROOT" -- -Asf . ; then + makepkg --printsrcinfo >.SRCINFO + else + delete_chroot_environment && echo -e "\n\e[1;31m==> BUILD FAILED: \e[1;37m$CHROOT removed\e[0m " && exit 1 + fi +} + +sign_package(){ + PACKAGE="$(makepkg --packagelist)" + gpg --use-agent --output "$PACKAGE.sig" --detach-sign "$PACKAGE" +} + +delete_chroot_environment() { + if [ "$(stat -f --format=%T "$CHROOT")" == "btrfs" ]; then + { + sudo btrfs subvolume delete "$CHROOT/root/var/lib/portables" + sudo btrfs subvolume delete "$CHROOT/root/var/lib/machines" + sudo btrfs subvolume delete "$CHROOT/root" + sudo rm -Rf $CHROOT + } >>/dev/null 2>&1 + elif [ "$(stat -f --format=%T "$CHROOT")" == "tmpfs" ]; then + sudo umount -f $CHROOT + fi + sudo rm -Rf $CHROOT +} + +check_available_ram +create_chroot_directory +create_chroot_environment +build_package +sign_package +delete_chroot_environment + +# vim: set ts=4 sw=4 et: diff --git a/fix-appstream-data.hook b/fix-appstream-data.hook new file mode 100644 index 0000000..5a94142 --- /dev/null +++ b/fix-appstream-data.hook @@ -0,0 +1,14 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Type = Path +Target = usr/share/swcatalog/xmls/*.xml.gz + +# attention: hook name before: update-appstream-cache.hook + +[Action] +Description = fix appstream datas for pamac +When = PostTransaction +Depends = gzip +Exec = /etc/pacman.d/hooks.bin/fix-appstream-data.sh +NeedsTargets diff --git a/pamac.install b/pamac.install new file mode 100644 index 0000000..0cd8672 --- /dev/null +++ b/pamac.install @@ -0,0 +1,65 @@ +msg() { + ALL_OFF="\e[1;0m" + BOLD="\e[1;1m" + GREEN="${BOLD}\e[1;32m" + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +restore_conf() { + PAMAC_NEW="$(date +%m%d%M%S)" + if [ -f "/etc/pamac.conf.pacsave" ]; then + msg "You had an old /etc/pamac.conf.pacsave file. We restore it for you." + msg "You can find your new pamac.conf saved as \`/etc/pamac-new-${PAMAC_NEW}.conf\`" + mv /etc/pamac.conf /etc/pamac-new-${PAMAC_NEW}.conf + mv /etc/pamac.conf.pacsave /etc/pamac.conf + fi +} + +post_install() { + # remove file (#28, #29) + [[ -e /var/tmp/pamac/dbs/sync/refresh_timestamp ]] && rm -f /var/tmp/pamac/dbs/sync/refresh_timestamp + # enable flatpak repo + if [ -f /usr/bin/flatpak ]; then + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + fi + # enable systemd timers + mkdir -p /etc/systemd/system/timers.target.wants + ln -sf /usr/lib/systemd/system/pamac-cleancache.timer /etc/systemd/system/timers.target.wants/pamac-cleancache.timer + # ln -sf /usr/lib/systemd/system/pamac-mirrorlist.timer /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer + # polkit agent + printf '==> An authentication agent is required\n' + printf ' Cinnamon, Deepin, GNOME, GNOME Flashback, KDE, LXDE, LXQt, MATE and Xfce\n' + printf ' have an authentication agent already.\n' + printf ' See https://wiki.archlinux.org/index.php/Polkit#Authentication_agents\n' + printf ' for other desktop environments.\n' + # restore old conf + restore_conf +} + +post_upgrade() { + # remove file (#28, #29) + [[ -e /var/tmp/pamac/dbs/sync/refresh_timestamp ]] && rm -f /var/tmp/pamac/dbs/sync/refresh_timestamp + + # restore old conf + if [ "$(vercmp $2 7.3.5-3)" -lt 0 ]; then + restore_conf + fi + + if [ "$(vercmp $2 8.0.3-5)" -lt 0 ]; then + # remove wrong placed symlinks + msg "Updating timer symlinks" + [[ -e /etc/systemd/system/multi-user.target.wants/pamac-cleancache.timer ]] && rm -f /etc/systemd/system/multi-user.target.wants/pamac-cleancache.timer + # [[ -e /etc/systemd/system/multi-user.target.wants/pamac-mirrorlist.timer ]] && rm -f /etc/systemd/system/multi-user.target.wants/pamac-mirrorlist.timer + # enable systemd timers + mkdir -p /etc/systemd/system/timers.target.wants + ln -sf /usr/lib/systemd/system/pamac-cleancache.timer /etc/systemd/system/timers.target.wants/pamac-cleancache.timer + # ln -sf /usr/lib/systemd/system/pamac-mirrorlist.timer /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer + fi +} + +post_remove() { + # disable systemd timers + rm -f /etc/systemd/system/timers.target.wants/pamac-cleancache.timer + # rm -f /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer +}