From a64a713fc2a56cf6182e4e7c7c50533ad0afe32a Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 19 Jan 2013 12:00:20 -0500 Subject: pacsort: add -f, --files option for sorting filenames Teach pacsort to understand package filenames and optionally strip away some of the context. alpm_pkg_vercmp() intentionally only understands pure versions, so strings such as '18.0-2-x86_64' and '18.0.1-1-x86_64' will be compared wrongly. Partially addresses FS#33455. Signed-off-by: Dave Reisner Signed-off-by: Allan McRae --- test/util/pacsorttest.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/util/pacsorttest.sh b/test/util/pacsorttest.sh index 9d52d694..9cbf619d 100755 --- a/test/util/pacsorttest.sh +++ b/test/util/pacsorttest.sh @@ -66,6 +66,24 @@ runtest $in $ex "add trailing newline" in="1.0-1\n1.0\n1.0-2\n1.0\n" runtest $in $in "stable sort" +in="firefox-18.0-2-x86_64.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n" +runtest $in $in "filename sort" "--files" + +in="firefox-18.0-2\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n" +runtest $in $in "filename sort with invalid filename" "--files" + +in="firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n" +runtest $in $in "filename sort maybe with leading paths" "--files" + +in="/path1/firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n" +runtest $in $in "filename sort with different leading paths" "--files" + +in="/path2/firefox-18.0-2-x86_64.pkg.tar.xz\n/path1/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n" +runtest $in $in "filename sort with uneven leading path components" "--files" + +in="firefox-18.0-2-i686.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.gz\n" +runtest $in $in "filename sort with different extensions" "--files" + # generate some long input/expected for the next few tests declare normal reverse names_normal names_reverse for ((i=1; i<600; i++)); do -- cgit v1.2.3-70-g09d2