Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg-repo: Follow symlinks and ignore directories starting with '.' or named 'Latest'.
Bryan Drewery committed 11 years ago
commit cbdff5eb27ffb3e77bd02e4b94515569efae2fa7
parent 807ecb6
2 files changed +35 -2
modified docs/pkg-repo.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd November 18, 2014
+
.Dd April 9, 2015
.Dt PKG-REPO 8
.Os
.Sh NAME
@@ -57,7 +57,12 @@ top-level directory where all the packages are stored as
will search the filesystem beneath
.Ar repo-path
to find all the packages it contains.
-
Symbolic links are ignored.
+
Directories starting with
+
.Qq . Qc
+
or
+
named
+
.Pa Latest
+
are not traversed.
.Pp
The repository will be created in the package directory unless the
.Fl o Ar output-dir
modified libpkg/pkg_repo_create.c
@@ -212,6 +212,34 @@ pkg_create_repo_read_fts(struct pkg_fts_item **items, FTS *fts,
	errno = 0;

	while ((fts_ent = fts_read(fts)) != NULL) {
+
		/*
+
		 * Skip directories starting with '.' to avoid Poudriere
+
		 * symlinks.
+
		 */
+
		if ((fts_ent->fts_info == FTS_D ||
+
		    fts_ent->fts_info == FTS_DP) &&
+
		    fts_ent->fts_namelen > 2 &&
+
		    fts_ent->fts_name[0] == '.') {
+
			fts_set(fts, fts_ent, FTS_SKIP);
+
			continue;
+
		}
+
		/*
+
		 * Ignore 'Latest' directory as it is just symlinks back to
+
		 * already-processed packages.
+
		 */
+
		if ((fts_ent->fts_info == FTS_D ||
+
		    fts_ent->fts_info == FTS_DP ||
+
		    fts_ent->fts_info == FTS_SL) &&
+
		    strcmp(fts_ent->fts_name, "Latest") == 0) {
+
			fts_set(fts, fts_ent, FTS_SKIP);
+
			continue;
+
		}
+
		/* Follow symlinks. */
+
		if (fts_ent->fts_info == FTS_SL) {
+
			fts_set(fts, fts_ent, FTS_FOLLOW);
+
			/* Restart. Next entry will be the resolved file. */
+
			continue;
+
		}
		/* Skip everything that is not a file */
		if (fts_ent->fts_info != FTS_F)
			continue;