Skip to content

Commit

Permalink
sysutils/pacman: update to 6.0.2
Browse files Browse the repository at this point in the history
New to this version is the archlinux FLAVOR to manage an Arch Linux
userland for the Linuxulator. It installs into/manages /compat/archlinux
to not conflict with the linux-c7 ports, similar to sysutils/debootstrap.

Reviewed by: fluffy, trasz
Event: BSDCan 2022
Event: SouthEast LinuxFest 2022
Event: SouthEast LinuxFest 2023
Differential Revision: https://reviews.freebsd.org/D33652
  • Loading branch information
vishwin committed Jun 10, 2023
1 parent 8302b44 commit 9e436cd
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 91 deletions.
81 changes: 44 additions & 37 deletions sysutils/pacman/Makefile
@@ -1,66 +1,77 @@
PORTNAME= pacman
PORTVERSION= 5.1.3
PORTREVISION= 1
DISTVERSION= 6.0.2
CATEGORIES= sysutils
MASTER_SITES= https://sources.archlinux.org/other/${PORTNAME}/

MAINTAINER= ports@FreeBSD.org
COMMENT= Package manager from ArchLinux
WWW= https://www.archlinux.org/pacman/
MAINTAINER= vishwin@vishwin.info
COMMENT= Package manager from Arch Linux

LICENSE= GPLv2+
LICENSE_FILE= ${WRKSRC}/COPYING

BROKEN_FreeBSD_14= gpgme >= 1.3.0 is needed for GPG signature support

BUILD_DEPENDS= asciidoc:textproc/asciidoc \
bash:shells/bash
BUILD_DEPENDS= bash:shells/bash
RUN_DEPENDS= bash:shells/bash
LIB_DEPENDS= libarchive.so:archivers/libarchive

USES= cpe gmake libtool localbase:ldflags pathfix perl5 pkgconfig shebangfix ssl
FLAVORS= default archlinux
FLAVORS_SUB= yes

default_CONFLICTS_INSTALL= archlinux-pacman

archlinux_PKGNAMEPREFIX= archlinux-
archlinux_CONFLICTS_INSTALL= pacman

USES= cpe libarchive localbase meson perl5 pkgconfig python:build shebangfix ssl \
tar:xz
CPE_VENDOR= ${PORTNAME}_project
SHEBANG_FILES= ${WRKSRC}/scripts/makepkg-template.pl.in \
${WRKSRC}/scripts/libmakepkg/lint_config.sh.in
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-root-dir="${PACMAN_ROOT}" \
--localstatedir=/var
CONFIGURE_ENV= LIBSSL_CFLAGS="-I${OPENSSLINC}" \
LIBSSL_LIBS="-L${OPENSSLLIB} -lcrypto"
BINARY_ALIAS= python3=${PYTHON_CMD}
MESON_ARGS= -Droot-dir=${PACMAN_ROOT} \
-Dlocalstatedir=${PACMAN_ROOT}/var \
-Dsysconfdir=${PREFIX}/etc \
-Dcrypto=openssl
USE_LDCONFIG= yes
BINARY_WRAPPERS= gm4

SUB_FILES= pkg-message pkg-deinstall
SUB_LIST= PACMAN_ROOT="${PACMAN_ROOT}" PREFIX="${PREFIX}"
PLIST_SUB= PACMAN_ROOT="${PACMAN_ROOT:C/^${PREFIX}//}"

PACMAN_ROOT?= ${PREFIX}/pacman

PORTEXAMPLES= *
PKGMESSAGE= ${PKGDIR}/pkg-message-${FLAVOR:U}

OPTIONS_DEFINE= CURL GPGME EXAMPLES NLS
OPTIONS_DEFAULT=CURL GPGME
OPTIONS_DEFINE= CURL DOCS GPGME EXAMPLES NLS
OPTIONS_DEFAULT=CURL DOCS GPGME
OPTIONS_EXCLUDE=NLS # XXX: meson cannot find ngettext(3) despite gettext-runtime
OPTIONS_SUB= yes

CURL_DESC= Use libcurl fetcher instead of external curl/wget
CURL_CONFIGURE_WITH= libcurl=${LOCALBASE}
CURL_MESON_ENABLED= curl
CURL_LIB_DEPENDS= libcurl.so:ftp/curl

DOCS_MESON_ENABLED= doc
DOCS_BUILD_DEPENDS= a2x:textproc/asciidoc

GPGME_DESC= Use GPGME for PGP signature verification
GPGME_CONFIGURE_WITH= gpgme
GPGME_MESON_ENABLED= gpgme
GPGME_LIB_DEPENDS= libgpgme.so:security/gpgme
NLS_USES= gettext
NLS_CONFIGURE_ENABLE= nls

NLS_USES= gettext-runtime gettext-tools
NLS_MESON_TRUE= i18n

.if ${FLAVOR:U} == default
PACMAN_ROOT= ${PREFIX}/pacman
.elif ${FLAVOR:U} == archlinux
ONLY_FOR_ARCHS= amd64
ONLY_FOR_ARCHS_REASON= Arch Linux itself only supports amd64
PACMAN_ROOT= /compat/archlinux
PLIST_DIRS+= %%PACMAN_ROOT%%/var/cache \
%%PACMAN_ROOT%%/var \
/compat
.endif

.include <bsd.port.options.mk>

post-patch:
@${REINPLACE_CMD} -e 's|m4|gm4|' ${WRKSRC}/scripts/Makefile.in
@${REINPLACE_CMD} -e '2 s/.*/exit 0/' ${WRKSRC}/build-aux/missing
@${REINPLACE_CMD} -e '/INSTALL_DATA.*sysconfdir/ d' ${WRKSRC}/etc/Makefile.in
.for tool in curl wget rsync lftpget
@${REINPLACE_CMD} -e 's|/usr/bin/${tool}|${LOCALBASE}/bin/${tool}|' \
${WRKSRC}/etc/pacman.conf.in ${WRKSRC}/etc/makepkg.conf.in
.endfor
.if ${ARCH} == "i386"
@${REINPLACE_CMD} -e '/^Architecture/ s|auto|i686|' ${WRKSRC}/etc/pacman.conf.in
.endif
Expand All @@ -69,11 +80,7 @@ post-patch:
.endif

post-install:
.for f in makepkg.conf pacman.conf
${INSTALL_DATA} ${WRKSRC}/etc/${f} ${STAGEDIR}${PREFIX}/etc/${f}.sample
.endfor
@${MKDIR} ${STAGEDIR}${PACMAN_ROOT}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libalpm.so
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/pacman.d

post-install-EXAMPLES-on:
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
Expand Down
6 changes: 3 additions & 3 deletions sysutils/pacman/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1552322023
SHA256 (pacman-5.1.3.tar.gz) = 10db61a0928d619871340c3f93a677d1541d6c52353c516aec4f8d96e830d4eb
SIZE (pacman-5.1.3.tar.gz) = 3358848
TIMESTAMP = 1686368450
SHA256 (pacman-6.0.2.tar.xz) = 7d8e3e8c5121aec0965df71f59bedf46052c6cf14f96365c4411ec3de0a4c1a5
SIZE (pacman-6.0.2.tar.xz) = 880868
11 changes: 11 additions & 0 deletions sysutils/pacman/files/patch-doc_meson.build
@@ -0,0 +1,11 @@
--- doc/meson.build.orig 2021-05-20 03:38:45 UTC
+++ doc/meson.build
@@ -101,7 +101,7 @@ foreach page: manpages + sitepages
endforeach

run_target('html',
- command : ['/bin/true'],
+ command : ['/usr/bin/true'],
depends : html_targets)

custom_target(
28 changes: 28 additions & 0 deletions sysutils/pacman/files/patch-etc_makepkg.conf.in
@@ -0,0 +1,28 @@
--- etc/makepkg.conf.in.orig 2020-12-03 11:37:30 UTC
+++ etc/makepkg.conf.in
@@ -9,17 +9,17 @@
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
-DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
- 'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
- 'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'rsync::/usr/bin/rsync --no-motd -z %u %o'
+DLAGENTS=('file::@prefix@/bin/curl -gqC - -o %o %u'
+ 'ftp::@prefix@/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
+ 'http::@prefix@/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
+ 'https::@prefix@/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
+ 'rsync::@prefix@/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')

# Other common tools:
-# /usr/bin/snarf
-# /usr/bin/lftpget -c
-# /usr/bin/wget
+# @prefix@/bin/snarf
+# @prefix@/bin/lftpget -c
+# @prefix@/bin/wget

#-- The package required by makepkg to download VCS sources
# Format: 'protocol::package'
13 changes: 13 additions & 0 deletions sysutils/pacman/files/patch-etc_pacman.conf.in
@@ -0,0 +1,13 @@
--- etc/pacman.conf.in.orig 2020-12-03 11:37:30 UTC
+++ etc/pacman.conf.in
@@ -16,8 +16,8 @@
#GPGDir = @sysconfdir@/pacman.d/gnupg/
#HookDir = @sysconfdir@/pacman.d/hooks/
HoldPkg = pacman glibc
-#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
-#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
+#XferCommand = @prefix@/bin/curl -L -C - -f -o %o %u
+#XferCommand = @prefix@/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto

11 changes: 11 additions & 0 deletions sysutils/pacman/files/patch-lib_libalpm_diskspace.c
@@ -0,0 +1,11 @@
--- lib/libalpm/diskspace.c.orig 2020-12-03 11:37:30 UTC
+++ lib/libalpm/diskspace.c
@@ -71,7 +71,7 @@ static void mount_point_list_free(alpm_list_t *mount_p

static int mount_point_load_fsinfo(alpm_handle_t *handle, alpm_mountpoint_t *mountpoint)
{
-#if defined(HAVE_GETMNTENT)
+#if HAVE_GETMNTENT
/* grab the filesystem usage */
if(statvfs(mountpoint->mount_dir, &(mountpoint->fsp)) != 0) {
_alpm_log(handle, ALPM_LOG_WARNING,
19 changes: 0 additions & 19 deletions sysutils/pacman/files/patch-lib_libalpm_util.c

This file was deleted.

27 changes: 27 additions & 0 deletions sysutils/pacman/files/patch-meson.build
@@ -0,0 +1,27 @@
--- meson.build.orig 2020-12-03 11:37:30 UTC
+++ meson.build
@@ -175,7 +175,7 @@ foreach type : [
endif
endforeach

-if conf.has('HAVE_STRUCT_STATVFS_F_FLAG')
+if conf.has('HAVE_STRUCT_STATVFS_F_FLAG') and not host_machine.system().contains('freebsd')
conf.set('FSSTATSTYPE', 'struct statvfs')
elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS')
conf.set('FSSTATSTYPE', 'struct statfs')
@@ -386,13 +386,13 @@ endforeach

configure_file(
input : 'etc/makepkg.conf.in',
- output : 'makepkg.conf',
+ output : 'makepkg.conf.sample',
configuration : substs,
install_dir : SYSCONFDIR)

configure_file(
input : 'etc/pacman.conf.in',
- output : 'pacman.conf',
+ output : 'pacman.conf.sample',
configuration : substs,
install_dir : SYSCONFDIR)

11 changes: 11 additions & 0 deletions sysutils/pacman/files/patch-scripts_meson.build
@@ -0,0 +1,11 @@
--- scripts/meson.build.orig 2020-12-03 11:37:30 UTC
+++ scripts/meson.build
@@ -66,7 +66,7 @@ configure_file(
configuration : { 'libmakepkgdir': LIBMAKEPKGDIR, 'PACKAGE_VERSION': PACKAGE_VERSION },
input : 'libmakepkg.pc.in',
output : '@BASENAME@',
- install_dir : join_paths(DATAROOTDIR, 'pkgconfig'))
+ install_dir : join_paths(get_option('prefix'), 'libdata', 'pkgconfig'))

custom_target(
'bash_completion',
10 changes: 10 additions & 0 deletions sysutils/pacman/files/patch-src_pacman_conf.c
@@ -0,0 +1,10 @@
--- src/pacman/conf.c.orig 2020-12-03 11:37:30 UTC
+++ src/pacman/conf.c
@@ -23,6 +23,7 @@
#include <locale.h> /* setlocale */
#include <fcntl.h> /* open */
#include <glob.h>
+#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strdup */
8 changes: 4 additions & 4 deletions sysutils/pacman/files/pkg-deinstall.in
Expand Up @@ -2,14 +2,14 @@

case $2 in
POST-DEINSTALL)
if find /var/lib/pacman /var/cache/pacman %%PACMAN_ROOT%% -type f 2>/dev/null | head -1 | grep -q ''; then
if find %%PACMAN_ROOT%% -type f 2>/dev/null | head -1 | grep -q ''; then
echo ""
echo "To completely remove the port, please remove the following"
echo "directories and the content manualy if its no longer needed:"
echo "directories and the content manually if it's no longer needed:"
echo ""
echo " %%PACMAN_ROOT%%"
echo " /var/cache/pacman"
echo " /var/lib/pacman"
echo " %%PACMAN_ROOT%%/var/cache/pacman"
echo " %%PACMAN_ROOT%%/var/lib/pacman"
echo ""
fi
;;
Expand Down
20 changes: 16 additions & 4 deletions sysutils/pacman/files/pkg-message.in
@@ -1,13 +1,25 @@
[
{ type: install
message: <<EOM
Default pacman root directory (the one it will install packages into) is
%%DEFAULT%%Default pacman root directory (the one it will install packages into) is
%%ARCHLINUX%%Default Arch Linux userland directory (the one it will install
%%ARCHLINUX%%packages to) for Linuxulator usage is

%%PACMAN_ROOT%%

To change it (and to define package repositories to use), see

%%PREFIX%%/etc/pacman.conf
%%DEFAULT%%To change it (and to define package repositories to use), see
%%DEFAULT%%
%%DEFAULT%% %%PREFIX%%/etc/pacman.conf
%%ARCHLINUX%%To use the Arch Linux repositories, generate one from
%%ARCHLINUX%%https://archlinux.org/mirrorlist/ and place the result in
%%ARCHLINUX%%
%%ARCHLINUX%% %%PREFIX%%/etc/pacman.d/mirrorlist
%%ARCHLINUX%%
%%ARCHLINUX%%Then make sure to install security/archlinux-keyring so that Arch
%%ARCHLINUX%%Linux official repository packages verify PGP signatures properly.
%%ARCHLINUX%%
%%ARCHLINUX%%You may want to sync pacman configuration from here to the Arch
%%ARCHLINUX%%Linux copy in the Linuxulator should you invoke pacman there.
EOM
}
]

0 comments on commit 9e436cd

Please sign in to comment.