301.2. sfeed-2.4
RSS and Atom feeds as a tab-separated file, and the programs that read it
| Version | 2.4, release 1 |
| Shelf | mail — Email clients, fetch and send tools, mail libraries, and feed readers |
| Phase | 44_apps (Applications), 276 of 422 in build order |
| Licence | ISC |
| Homepage | https://codemadness.org/sfeed-simple-feed-parser.html |
| Build time | 0.1 SBU |
| Installed size | 475.4 KiB in 44 files |
| Recipe | ports/core/mail/sfeed/kpkgbuild |
About
sfeed parses RSS and Atom feeds into a tab-separated file, one line per item, and ships the small programs that read that file: sfeed_update fetches the feeds listed in ~/.sfeed/sfeedrc with curl, sfeed_curses is a terminal reader, and others write the items out as plain text, HTML, JSON, an mbox, a gopher page or Atom again. Where newsboat is a reader with a database, sfeed is a pipeline whose file can be read with grep and cut.
Why it is in KDOS
The comment above it in script/phases/44_apps/packages.d/mail.txt:
THE OTHER ANSWER TO THE SAME QUESTION, and it is a different one rather than a smaller one. newsboat is a reader with a database; sfeed is a PARSER that writes one tab-separated line per item, and everything after that — the curses reader, an mbox, a gopher page, a plain list — is a separate program reading that file. That is what makes a feed greppable, and it is why the two are both here: one is an application, the other is a pipeline.
Sources
sfeed-2.4.tar.gz(68.5 KiB)
sha256f9503fe9205a8136f76a9b753c6007abad33e2a516807e416a986723db06e879
upstream: https://codemadness.org/releases/sfeed/sfeed-2.4.tar.gz
archive copy: sources-3/mail--sfeed-2.4.tar.gz
Dependencies
Depends on: ncurses, curl, wl-clipboard.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install sfeed'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/mail/sfeed.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/mail/sfeed
echo 'f9503fe9205a8136f76a9b753c6007abad33e2a516807e416a986723db06e879 sfeed-2.4.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/sfeed
SRC=$SRC_ROOT/sfeed-2.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sfeed-2.4.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -O2"
make PREFIX=/usr MANPREFIX=/usr/share/man \
SFEED_CURSES_LDFLAGS="$LDFLAGS -lncurses"
make DESTDIR=$PKG PREFIX=/usr MANPREFIX=/usr/share/man \
DOCPREFIX=/usr/share/doc/sfeed install
install -d "$PKG/usr/bin"
cat > "$PKG/usr/bin/sfeed-read" <<'KDOS_SH'
#!/bin/sh
dir="$HOME/.sfeed/feeds"
set -- "$dir"/*
if [ -e "$1" ]; then
exec sfeed_curses "$@"
fi
printf 'No feeds in %s yet.\n' "$dir"
printf 'List them in ~/.sfeed/sfeedrc (see sfeedrc(5)), then run sfeed_update.\n'
printf 'Press Enter to close. '
read -r _
KDOS_SH
chmod 755 "$PKG/usr/bin/sfeed-read"
install -Dm644 /dev/stdin "$PKG/etc/profile.d/50-sfeed.sh" <<'KDOS_SH'
export SFEED_YANKER="${SFEED_YANKER:-wl-copy -n}"
KDOS_SH
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/sfeed.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Feeds (sfeed)
GenericName=Feed Reader
Comment=Read the feeds sfeed_update has fetched
Exec=sfeed-read
Icon=mail-message
Terminal=true
Categories=Network;News;
Keywords=rss;atom;feed;news;sfeed;
EOF
chmod 644 "$PKG/usr/share/applications/sfeed.desktop"
The switches, and why each is set:
MANPREFIX=/usr/share/man— upstream’s default is${PREFIX}/man, which here would be/usr/man, a directorymandoes not search.DOCPREFIX=/usr/share/doc/sfeed— the directory the README and example files go to; upstream’s default spells the same path fromPREFIX.SFEED_CURSES_LDFLAGS— the link line ofsfeed_curses. Upstream’s default ends in-lcurses; this names the real library,-lncurses, with the exportedLDFLAGSbefore it. The ncurses port installslibcurses.soonly as a compatibility link.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/sfeed, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf sfeed-2.4-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/sfeed, and runs the triggers its paths call for.
Contents
Installed programs: sfeed, sfeed-read, sfeed_atom, sfeed_content, sfeed_curses, sfeed_frames, sfeed_gopher, sfeed_html, sfeed_json, sfeed_markread, sfeed_mbox, sfeed_opml_export, sfeed_opml_import, sfeed_plain, sfeed_twtxt, sfeed_update, sfeed_web, sfeed_xmlenc.
Installed directories: /usr/share/doc/sfeed, /usr/share/licenses/sfeed.
Short descriptions
sfeed |
RSS and Atom parser |
sfeed_atom |
format feed data to an Atom feed |
sfeed_content |
view RSS/Atom content |
sfeed_curses |
curses UI for viewing feed data |
sfeed_frames |
format feed data to HTML with frames |
sfeed_gopher |
format feed data to Gopher files |
sfeed_html |
format feed data to HTML |
sfeed_json |
format feed data to JSON Feed |
sfeed_markread |
mark items as read/unread |
sfeed_mbox |
format feed data to mboxrd |
sfeed_opml_export |
export feeds in a sfeedrc file to OPML data |
sfeed_opml_import |
generate a sfeedrc config file from an OPML subscription list |
sfeed_plain |
format feed data to a plain-text list |
sfeed_twtxt |
format feed data to a twtxt feed |
sfeed_update |
update feeds and merge with old feeds |
sfeed_web |
finds URLs to feeds from a HTML webpage |
sfeed_xmlenc |
get text-encoding from XML |
Notes
build.sh adds three files of KDOS’s own.
/usr/bin/sfeed-readis what the desktop entry runs.sfeed_curseswith no file arguments reads a feed from standard input, which from a launcher is the terminal, so it would sit in an empty window waiting for end of input. The wrapper passes every file under~/.sfeed/feeds, wheresfeed_updatewrites by default, and with none there yet prints how to fetch some and waits for Enter./etc/profile.d/50-sfeed.shsetsSFEED_YANKERtowl-copy -nfrom wl-clipboard unless it is already set.sfeed_cursespipes a link to that command when its yank key is pressed, and its default,xclip -r, needs an X clipboard.sfeed.desktop, withTerminal=true: upstream ships no desktop entry.
The exported CFLAGS already carry -O2, so the -O2 that build.sh appends changes nothing in the compile.