I mean, if they go to copy a hardlink, they’ll get the original file anyway…
AFAIK rpm-ostree status gets the list of packages in the currently deployment via D-Bus:
$ busctl get-property org.projectatomic.rpmostree1 /org/projectatomic/rpmostree1/fedora_workstation org.projectatomic.rpmostree1.OS DefaultDeployment
...
"requested-local-packages" as 5 "rpmfusion-nonfree-release-29-0.5.noarch" "bluecap-0.3-1.fc29.x86_64" "bat-0.9.0-1.fc30.x86_64" "rpmfusion-free-release-29-0.5.noarch" "refind-0.11.3-1.x86_64"
...
"rpmostree.packages" as 38 "ImageMagick" "WoeUSB" "adapta-gtk-theme" "ansible" "bsdtar" "evtest" "fd-find" "fedora-toolbox" "ffmpeg" "file-roller" "git" "git-lfs" "git-subrepo" "gnome-boxes" "gnome-tweaks" "google-roboto-fonts" "google-roboto-mono-fonts" "gparted" "htop" "kubectl" "libXScrnSaver" "neofetch" "powerline-fonts" "rclone" "ripgrep" "simple-scan" "sshfs" "systemd-container" "testdisk" "thai-scalable-purisa-fonts" "tilix" "tuned" "unrar" "virt-manager" "vulkan-tools" "xclip" "xdotool" "zsh"
However, as you can see, this doesn’t have version information.
ostree refs rpm-ostree/pkg (the repo defaults to /ostree/repo) will print all the layered packages and tehri versions, but it doesn’t distinguish between which versions are where, e.g.:
$ ostree refs rpmostree/pkg | rg kubectl
kubectl/1.13.3-0.x86__64
kubectl/1.13.4-0.x86__64
AFAIK this information isn’t stored anywhere; since once a deployment is created, it will never be modified, rpm-ostree never has needed this.
Some more info:
ostree refs --repo=/var/lib/flatpak/repo deploy (or --repo=~/.local/share/flatpak/repo for the user install) will list all the deployed refs:
...
runtime/org.gnome.Lollypop.Locale/x86_64/stable
runtime/org.audacityteam.Audacity.Codecs/x86_64/stable
runtime/org.gtk.Gtk3theme.AdwaitaRefresh/x86_64/3.22
app/org.gnome.Lollypop/x86_64/stable
runtime/org.gnome.Sdk/x86_64/3.30
runtime/org.freedesktop.Platform.Compat.i386/x86_64/18.08
app/org.gnome.BoxesDevel/x86_64/master
....
and then you can get the metadata for one via ostree --repo=/var/lib/flatpak/repo cat my-ref metadata, e.g.:
$ ostree --repo=/var/lib/flatpak/repo cat app/org.gnome.BoxesDevel/x86_64/master metadata
[Application]
name=org.gnome.BoxesDevel
runtime=org.gnome.Platform/x86_64/master
sdk=org.gnome.Sdk/x86_64/master
tags=devel;development;nightly;
command=gnome-boxes
[Context]
shared=network;ipc;
sockets=x11;wayland;pulseaudio;
devices=all;
filesystems=xdg-run/dconf;~/.config/dconf:ro;home;
[Session Bus Policy]
ca.desrt.dconf=talk
org.freedesktop.Tracker1=talk
org.freedesktop.timedate1=talk
org.freedesktop.Accounts=talk
[Environment]
DCONF_USER_CONFIG_DIR=.config/dconf
[Extension org.gnome.BoxesDevel.Locale]
directory=share/runtime/locale
autodelete=true
locale-subset=true
[Extension org.gnome.BoxesDevel.Debug]
directory=lib/debug
autodelete=true
no-autodownload=true
[Build]
built-extensions=org.gnome.BoxesDevel.Locale;org.gnome.BoxesDevel.Debug;
If you go the directory-walking route, you can check /var/lib/flatpak/app and /var/lib/flatpak/runtime for the different directories (or changed paths for your local install). For apps, you can then navigate to current/active to grab the deployment for the active commit, and then read the metadata file inside. For runtimes, you have go to whatever-architecture/whatever-version, e.g. x86_64/18.08 for the fd.o platform.