Skip to content

Commit f501918

Browse files
committed
postprocess: Add a symlink /usr/lib/sysimage/rpm to the rpmdb
Following on to: - http://lists.rpm.org/pipermail/rpm-maint/2017-October/006681.html - #1142 - openSUSE/libsolv#386 Write a symlink in `/usr/lib/sysimage/rpm` pointing to our current `/usr/share/rpm` - this way clients can start looking for it there, and then at some point we'll flip the symlink around and have `/usr/share/rpm` pointing to the new location. (Doing a hard swap now has upgrade implications)
1 parent e6b06f1 commit f501918

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/libpriv/rpmostree-core.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
/* See http://lists.rpm.org/pipermail/rpm-maint/2017-October/006681.html */
3636
#define RPMOSTREE_RPMDB_LOCATION "usr/share/rpm"
3737
#define RPMOSTREE_SYSIMAGE_DIR "usr/lib/sysimage"
38+
#define RPMOSTREE_NEW_RPMDB_LOCATION RPMOSTREE_SYSIMAGE_DIR "/rpm"
3839
#define RPMOSTREE_BASE_RPMDB RPMOSTREE_SYSIMAGE_DIR "/rpm-ostree-base-db"
3940

4041
/* put it in cache dir so it gets destroyed naturally with a `cleanup -m` */

src/libpriv/rpmostree-postprocess.c

+5
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,11 @@ rpmostree_postprocess_final (int rootfs_dfd,
10871087
rootfs_dfd, RPMOSTREE_BASE_RPMDB,
10881088
cancellable, error))
10891089
return glnx_prefix_error (error, "Hardlinking %s", RPMOSTREE_BASE_RPMDB);
1090+
/* And write a symlink from the proposed standard /usr/lib/sysimage/rpm
1091+
* to our /usr/share/rpm - eventually we will invert this.
1092+
*/
1093+
if (symlinkat ("../../share/rpm", rootfs_dfd, RPMOSTREE_NEW_RPMDB_LOCATION) < 0)
1094+
return glnx_throw_errno_prefix (error, "symlinking %s", RPMOSTREE_NEW_RPMDB_LOCATION);
10901095
}
10911096

10921097
return TRUE;

tests/compose/libbasic-test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ for path in /usr/share/rpm /usr/lib/sysimage/rpm-ostree-base-db; do
3636
ostree --repo=${repo} ls -R ${treeref} ${path} > db.txt
3737
assert_file_has_content_literal db.txt /Packages
3838
done
39+
ostree --repo=${repo} ls ${treeref} /usr/lib/sysimage/rpm >/dev/null
3940
echo "ok db"
4041

4142
ostree --repo=${repo} show --print-metadata-key exampleos.gitrepo ${treeref} > meta.txt

0 commit comments

Comments
 (0)