Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Use remote if no ports tree exists
Bryan Drewery committed 13 years ago
commit 28a35639bbb13b46b3df93f8d5a04f8528170ea4
parent e28608e
2 files changed +13 -4
modified pkg/pkg-version.8
@@ -50,9 +50,13 @@ Displays usage information
Use INDEX file for determining if a package is out of date.
.It Fl P
Use ports for determining if a package is out of date.
-
This is the default.
+
This is the default if a ports tree exists.
+
The tree used can be overridden by PORTSDIR, see
+
.Xr pkg 5
+
for more information.
.It Fl R
Use repository catalogue for determining if a package is out of date.
+
This is the default if no ports tree exists.
.It Fl o
Display package origin, instead of package name.
.It Fl q
modified pkg/version.c
@@ -235,9 +235,14 @@ exec_version(int argc, char **argv)

	have_ports = (stat(portsdir, &sb) == 0 && S_ISDIR(sb.st_mode));

-
	/* If -I not specified, default to ports */
-
	if ((opt & VERSION_SOURCE_INDEX) == 0)
-
		opt |= VERSION_SOURCE_PORTS;
+
	/* If none of -IPR were specified, and portsdir exists use that,
+
	   otherwise fallback to remote. */
+
	if ((opt & (VERSION_SOURCE_PORTS|VERSION_SOURCE_REMOTE|VERSION_SOURCE_INDEX)) == 0) {
+
		if (have_ports)
+
			opt |= VERSION_SOURCE_PORTS;
+
		else
+
			opt |= VERSION_SOURCE_REMOTE;
+
	}

	if (!have_ports && (opt & (VERSION_SOURCE_INDEX|VERSION_SOURCE_PORTS)))
		err(1, "Unable to open ports directory %s", portsdir);