14851733 pkgrecv should default to retreving all-timestamps not just latest versions
--- a/src/man/pkgrecv.1 Fri Mar 01 11:23:31 2013 -0800
+++ b/src/man/pkgrecv.1 Fri Mar 01 14:17:24 2013 -0800
@@ -102,11 +102,11 @@
.ne 2
.mk
.na
-\fB\fBall-timestamps\fR\fR
+\fB\fBall-timestamps (default)\fR\fR
.ad
.sp .6
.RS 4n
-Includes all matching timestamps, not just the latest (implies \fBall-versions\fR).
+Includes all matching timestamps (implies \fBall-versions\fR).
.RE
.sp
@@ -117,7 +117,18 @@
.ad
.sp .6
.RS 4n
-Includes all matching versions, not just the latest.
+Includes all matching versions.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBlatest\fR\fR
+.ad
+.sp .6
+.RS 4n
+Includes only the latest version of each package.
.RE
.RE
--- a/src/pull.py Fri Mar 01 11:23:31 2013 -0800
+++ b/src/pull.py Fri Mar 01 14:17:24 2013 -0800
@@ -120,11 +120,13 @@
when republishing. Should not be used with pkgsend.
-m match Controls matching behaviour using the following values:
- all-timestamps
- includes all matching timestamps, not just
- latest (implies all-versions)
+ all-timestamps (default)
+ includes all matching timestamps (implies
+ all-versions)
all-versions
- includes all matching versions, not just latest
+ includes all matching versions
+ latest
+ includes only the latest version of each package
-n Perform a trial run with no changes made.
@@ -352,7 +354,7 @@
global archive, cache_dir, download_start, xport, xport_cfg, \
dest_xport, temp_root, targ_pub, target
- all_timestamps = False
+ all_timestamps = True
all_versions = False
dry_run = False
keep_compressed = False
@@ -408,8 +410,13 @@
elif opt == "-m":
if arg == "all-timestamps":
all_timestamps = True
+ all_versions = False
elif arg == "all-versions":
+ all_timestamps = False
all_versions = True
+ elif arg == "latest":
+ all_timestamps = False
+ all_versions = False
else:
usage(_("Illegal option value -- %s") % arg)
elif opt == "-n":
--- a/src/tests/cli/t_pkgrecv.py Fri Mar 01 11:23:31 2013 -0800
+++ b/src/tests/cli/t_pkgrecv.py Fri Mar 01 14:17:24 2013 -0800
@@ -458,6 +458,48 @@
"manifest")
self.assertTrue(os.path.isfile(mpath))
+ # Cleanup for next test.
+ shutil.rmtree(os.path.join(self.tempdir, "bronze"))
+
+ # Retrieve bronze using -m latest, this should only
+ # retrieve bronze20_2.
+ self.pkgrecv(self.durl1, "--raw -m latest -r -k "
+ "-d %s %s" % (self.tempdir, "bronze"))
+
+ # Verify that only expected packages were retrieved.
+ expected = [
+ bronze20_2.get_dir_path(),
+ ]
+
+ for d in os.listdir(os.path.join(self.tempdir, "bronze")):
+ self.assertTrue(os.path.join("bronze", d) in expected)
+
+ mpath = os.path.join(self.tempdir, "bronze", d,
+ "manifest")
+ self.assertTrue(os.path.isfile(mpath))
+
+ # Cleanup for next test.
+ shutil.rmtree(os.path.join(self.tempdir, "bronze"))
+
+ # Retrieve bronze using default setting.
+ # This should retrieve bronze10, bronze20_1, and bronze20_2.
+ self.pkgrecv(self.durl1, "--raw -r -k "
+ "-d %s %s" % (self.tempdir, "bronze"))
+
+ # Verify that all expected packages were retrieved.
+ expected = [
+ bronze10.get_dir_path(),
+ bronze20_1.get_dir_path(),
+ bronze20_2.get_dir_path(),
+ ]
+
+ for d in expected:
+ paths = os.listdir(os.path.join(self.tempdir, "bronze"))
+ self.assertTrue(os.path.basename(d) in paths)
+
+ mpath = os.path.join(self.tempdir, d, "manifest")
+ self.assertTrue(os.path.isfile(mpath))
+
def test_5_recv_env(self):
"""Verify that pkgrecv environment vars work as expected."""