Both upstreams set fat LTO in their release profile (strata also codegen-units = 1), which compiles the final crate on one thread. That is a reasonable trade for the binary users run, and build() keeps it. check() then compiled the same crate a second time under the same profile for the test harness, and threw it away. On the aarch64 builds, which run under QEMU, those two serial compiles were 106 of strata's 118 minutes. check() now builds the harness with thin LTO and 16 codegen units in its own target directory. The shipped binary is unchanged. Measured on the x86_64 builder for strata's test binary: 708 s serial, 223 s with this profile. Local run: shipped strata still 7m30s from target/, tests 3m43s from target-check/, 1998 passed. ttfx has the same upstream profile but no check(), so nothing to do.
197 lines
8.1 KiB
Bash
197 lines
8.1 KiB
Bash
# Maintainer: GM <gianmarcomorales@icloud.com>
|
|
|
|
pkgname=flea
|
|
pkgver=0.3.1
|
|
pkgrel=2
|
|
pkgdesc='Fast, keyboard-first file manager for Omarchy'
|
|
arch=('x86_64' 'aarch64')
|
|
url='https://github.com/thisisgm/flea'
|
|
license=('MIT')
|
|
|
|
depends=(
|
|
'bubblewrap'
|
|
'expect'
|
|
'gcc-libs'
|
|
'glib2'
|
|
'glibc'
|
|
'gvfs'
|
|
'gvfs-afc'
|
|
'gvfs-dnssd'
|
|
'gvfs-gphoto2'
|
|
'gvfs-mtp'
|
|
'gvfs-nfs'
|
|
'gvfs-smb'
|
|
'hicolor-icon-theme'
|
|
'kimageformats'
|
|
'libheif'
|
|
'omarchy'
|
|
'python'
|
|
'python-gobject'
|
|
'quickshell'
|
|
'qt6-multimedia'
|
|
'qt6-webengine'
|
|
'shared-mime-info'
|
|
'usbmuxd'
|
|
'util-linux'
|
|
'wl-clipboard'
|
|
'xdg-terminal-exec'
|
|
'xdg-utils'
|
|
)
|
|
makedepends=('cargo')
|
|
optdepends=(
|
|
'7zip: 7z archive support'
|
|
'dropbox-cli: Dropbox browsing and share links'
|
|
'ffmpeg: media metadata previews'
|
|
'imagemagick: image conversion'
|
|
'libarchive: archive listing and extraction'
|
|
'tailscale: Taildrop sharing'
|
|
)
|
|
conflicts=('flea-git')
|
|
options=('!debug')
|
|
|
|
source=(
|
|
"$url/releases/download/v$pkgver/$pkgname-v$pkgver.tar.gz"
|
|
)
|
|
sha256sums=('b146ac3f5025da987eae623c4392c44ce69a6a7275a8df3ec1a84563920a4dd2')
|
|
|
|
build() {
|
|
cd "$pkgname-$pkgver"
|
|
|
|
export CARGO_TARGET_DIR=target
|
|
cargo build --frozen --release
|
|
}
|
|
|
|
check() {
|
|
cd "$pkgname-$pkgver"
|
|
|
|
# Upstream's release profile uses fat LTO, whose final link runs on one
|
|
# thread. build() keeps it for the shipped binary; the test harness is a
|
|
# throwaway second compile, so build it in parallel in its own target
|
|
# directory.
|
|
export CARGO_TARGET_DIR=target-check
|
|
export CARGO_PROFILE_RELEASE_LTO=thin
|
|
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16
|
|
|
|
local -a test_args=()
|
|
if ! /usr/bin/prlimit --cpu=30 --as=1073741824 \
|
|
/usr/bin/bwrap --unshare-all --die-with-parent --new-session --clearenv \
|
|
--ro-bind /usr /usr --ro-bind /etc /etc \
|
|
--symlink usr/lib /lib --symlink usr/lib /lib64 \
|
|
--symlink usr/bin /bin --symlink usr/bin /sbin \
|
|
--proc /proc --dev /dev --tmpfs /tmp /usr/bin/true >/dev/null 2>&1; then
|
|
printf 'Skipping sandbox integration tests: this builder cannot create an unprivileged namespace\n'
|
|
test_args+=(
|
|
--skip backend::archiveops::tests::a_silent_failure_names_the_operation_that_was_running
|
|
--skip tui::job::tests::preview_worker_reads_held_source_in_readonly_sandbox
|
|
--skip backend::archiveops::tests::a_tool_that_exits_zero_writing_nothing_is_caught_by_the_predicate
|
|
--skip backend::archiveops::tests::an_empty_archive_extracts_to_an_empty_directory_and_that_is_success
|
|
--skip backend::archiveops::tests::only_the_archive_root_extracts_to_nothing_while_nested_directories_do_not
|
|
--skip backend::archiveops::tests::the_emptiness_check_reads_the_destination_and_the_index_separately
|
|
--skip backend::thumbs::tests::a_cancelled_job_never_runs
|
|
--skip backend::thumbs::tests::a_real_file_round_trips_to_a_stamped_cache_entry
|
|
--skip backend::thumbs::tests::cancel_all_empties_the_queue
|
|
--skip backend::thumbs::tests::the_queue_is_bounded_and_drops_the_oldest_rather_than_growing
|
|
)
|
|
fi
|
|
|
|
if [[ ! -x /usr/bin/evince-thumbnailer ]] ||
|
|
[[ ! -x /usr/bin/ffmpegthumbnailer ]] ||
|
|
[[ ! -x /usr/bin/glycin-thumbnailer ]]; then
|
|
printf 'Skipping thumbnailer fixture tests: this builder lacks their optional host programs\n'
|
|
test_args+=(
|
|
--skip backend::thumbspec::tests::a_type_two_files_declare_goes_to_the_first_in_path_order
|
|
--skip backend::thumbspec::tests::the_heaviest_shipped_field_parses
|
|
)
|
|
fi
|
|
|
|
# Recovery-lock tests are unreliable when run concurrently with other suites.
|
|
# These fixtures require O_TMPFILE, which the builder's /tmp filesystem may
|
|
# not provide. Keep executable fixtures in the remaining suites on the normal
|
|
# temp root (/dev/shm is noexec). Note that /dev/shm does NOT buy finer
|
|
# timestamps -- see the skip below.
|
|
# shelfundo::tests::undo_refuses_to_walk_a_stranger_back deletes a file,
|
|
# creates another under the same name, and expects undo to tell them
|
|
# apart by (dev, ino, kind). ext4 hands the freed inode number straight
|
|
# back to the next create, so on the builder's /tmp the stranger is
|
|
# identical and undo walks it back. tmpfs allocates inode numbers from a
|
|
# counter and never reuses one, which is what the test assumes.
|
|
local -a filesystem_tests=(
|
|
backend::menu_actions::tests::
|
|
backend::menudelete::tests::
|
|
backend::redo::tests::
|
|
backend::trashbrowse::tests::
|
|
backend::trashdelete::
|
|
backend::trashmanifest::tests::
|
|
shelfundo::tests::
|
|
)
|
|
# redo_refuses_changed_sources_and_destination_collisions writes a file and
|
|
# then immediately asks redo to notice the edit. flea decides "changed" from
|
|
# ctime alone -- src/backend/undo.rs records (ctime, ctime_nsec) as the whole
|
|
# identity -- and this kernel stamps ctime from the coarse clock, so two
|
|
# writes microseconds apart share a timestamp and the guard sees no change.
|
|
# Measured on this builder: 196/200 back-to-back write pairs on /dev/shm and
|
|
# 192/200 on the root filesystem produced an identical ctime. The assertion
|
|
# therefore fails on any builder fast enough to stay inside one granule, and
|
|
# moving the suite to tmpfs does not help. Both halves are upstream bugs --
|
|
# the test assumes a resolution the kernel never promised, and the identity it
|
|
# exercises cannot see a same-granule edit -- so skip it rather than paper
|
|
# over it by disabling the whole package.
|
|
local -a racy_ctime_tests=(
|
|
--skip backend::redo::tests::redo_refuses_changed_sources_and_destination_collisions
|
|
)
|
|
|
|
# These three expect spawning a missing or failing program to be reported
|
|
# as such. aarch64 builds run under QEMU user-mode emulation, where
|
|
# glibc's posix_spawn cannot see the child's failed execve: the spawn
|
|
# "succeeds" with exit 127, and the timing test's child never sleeps.
|
|
# Passes natively.
|
|
if [[ $CARCH == aarch64 ]]; then
|
|
test_args+=(
|
|
--skip backend::child::tests::a_child_is_noticed_when_it_exits_rather_than_at_the_next_poll_boundary
|
|
--skip backend::child::tests::a_child_that_never_started_is_told_apart_from_one_that_ran_and_failed
|
|
--skip backend::menu_registry::tests::unavailable_failed_and_oversized_queries_are_named_errors
|
|
)
|
|
fi
|
|
|
|
local test_tmp test_status=0 suite
|
|
test_tmp=$(mktemp -d /dev/shm/flea-tests.XXXXXXXX) || return 1
|
|
TMPDIR="$test_tmp" cargo test --frozen --release -- \
|
|
--test-threads=1 "${filesystem_tests[@]}" "${racy_ctime_tests[@]}" || test_status=$?
|
|
rm -rf -- "$test_tmp"
|
|
(( test_status == 0 )) || return "$test_status"
|
|
for suite in "${filesystem_tests[@]}"; do
|
|
test_args+=(--skip "$suite")
|
|
done
|
|
cargo test --frozen --release -- --test-threads=1 "${test_args[@]}"
|
|
./tests/js.sh
|
|
./tests/keymap-gen.sh
|
|
}
|
|
|
|
package() {
|
|
cd "$pkgname-$pkgver"
|
|
|
|
install -Dm755 target/release/flea "$pkgdir/usr/bin/flea"
|
|
install -Dm755 tools/flea-gio-auth "$pkgdir/usr/lib/flea/flea-gio-auth"
|
|
install -Dm755 tools/flea-portal "$pkgdir/usr/lib/flea/flea-portal"
|
|
install -Dm644 packaging/flea.portal \
|
|
"$pkgdir/usr/share/xdg-desktop-portal/portals/flea.portal"
|
|
install -Dm644 packaging/org.freedesktop.impl.portal.desktop.flea.service \
|
|
"$pkgdir/usr/share/dbus-1/services/org.freedesktop.impl.portal.desktop.flea.service"
|
|
install -Dm755 tools/flea-filemanager1 "$pkgdir/usr/lib/flea/flea-filemanager1"
|
|
install -Dm644 packaging/com.thisisgm.flea.FileManager1.service \
|
|
"$pkgdir/usr/share/dbus-1/services/com.thisisgm.flea.FileManager1.service"
|
|
install -Dm644 packaging/com.thisisgm.flea.desktop \
|
|
"$pkgdir/usr/share/applications/com.thisisgm.flea.desktop"
|
|
install -Dm644 packaging/com.thisisgm.flea.svg \
|
|
"$pkgdir/usr/share/icons/hicolor/scalable/apps/com.thisisgm.flea.svg"
|
|
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
|
|
install -Dm644 ui/qmldir ui/*.qml -t "$pkgdir/usr/share/flea/ui"
|
|
install -Dm644 ui/js/*.js -t "$pkgdir/usr/share/flea/ui/js"
|
|
# Flea's Shelf setting installs this plugin into the user's plugin directory.
|
|
install -Dm644 shelf/manifest.json shelf/README.md shelf/*.qml shelf/*.js \
|
|
-t "$pkgdir/usr/share/flea/shelf"
|
|
ln -s /usr/share/omarchy/shell/Commons "$pkgdir/usr/share/flea/ui/Commons"
|
|
ln -s /usr/share/omarchy/shell/Ui "$pkgdir/usr/share/flea/ui/Ui"
|
|
}
|