Merge ~dviererbe/ubuntu/+source/plocate:merge-lp2029150-mantic into ubuntu/+source/plocate:debian/sid

Proposed by Dominik Viererbe
Status: Merged
Merge reported by: Dominik Viererbe
Merged at revision: 5fc9314a8470b36e989cc526385af90bcf7c652a
Proposed branch: ~dviererbe/ubuntu/+source/plocate:merge-lp2029150-mantic
Merge into: ubuntu/+source/plocate:debian/sid
Diff against target: 370 lines (+282/-1)
6 files modified
debian/changelog (+93/-0)
debian/control (+2/-1)
debian/patches/locate-add-ignore-spaces-option-to-ignore-word-separ.patch (+173/-0)
debian/patches/series (+1/-0)
debian/plocate.postinst (+10/-0)
debian/rules (+3/-0)
Reviewer Review Type Date Requested Status
Graham Inggs (community) Approve
Review via email: mp+448127@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dominik Viererbe (dviererbe) wrote (last edit ):
Revision history for this message
Graham Inggs (ginggs) wrote :

Uploaded, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 57c3215..ddcfe1a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
1plocate (1.1.19-2ubuntu1) mantic; urgency=medium
2
3 * Merge with Debian unstable (LP: #2029150). Remaining changes:
4 - Adjust handling of db generation on package install to ensure db
5 generation even in chroots, print a message before, and ensure db
6 generation finishes before the postinst returns.
7 - Adjust dh_systemd handling to match the above.
8 - d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
9 support for the --ignore-spaces option from mlocate.
10
11 -- Dominik Viererbe <dominik.viererbe@canonical.com> Mon, 31 Jul 2023 23:04:46 +0300
12
1plocate (1.1.19-2) unstable; urgency=medium13plocate (1.1.19-2) unstable; urgency=medium
214
3 * Remove compatibility cruft for upgrading from pre-bullseye.15 * Remove compatibility cruft for upgrading from pre-bullseye.
@@ -10,18 +22,56 @@ plocate (1.1.19-2) unstable; urgency=medium
1022
11 -- Steinar H. Gunderson <sesse@debian.org> Tue, 04 Jul 2023 18:24:02 +020023 -- Steinar H. Gunderson <sesse@debian.org> Tue, 04 Jul 2023 18:24:02 +0200
1224
25plocate (1.1.19-1ubuntu1) mantic; urgency=low
26
27 * Merge from Debian unstable. Remaining changes:
28 - Adjust handling of db generation on package install to ensure db
29 generation even in chroots, print a message before, and ensure db
30 generation finishes before the postinst returns.
31 - Adjust dh_systemd handling to match the above.
32 - d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
33 support for the --ignore-spaces option from mlocate.
34
35 -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 15 Jun 2023 19:10:12 -0700
36
13plocate (1.1.19-1) unstable; urgency=medium37plocate (1.1.19-1) unstable; urgency=medium
1438
15 * New upstream release.39 * New upstream release.
1640
17 -- Steinar H. Gunderson <sesse@debian.org> Fri, 09 Jun 2023 09:36:32 +020041 -- Steinar H. Gunderson <sesse@debian.org> Fri, 09 Jun 2023 09:36:32 +0200
1842
43plocate (1.1.18-1ubuntu1) lunar; urgency=low
44
45 * Merge from Debian unstable. Remaining changes:
46 - Adjust handling of db generation on package install to match the
47 previous mlocate behavior, which ensured db generation even in
48 chroots, printed a message before, and ensured db generation finished
49 before the postinst returned.
50 - Adjust dh_systemd handling to match the above.
51 - d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
52 support for the --ignore-spaces option from mlocate.
53
54 -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 06 Feb 2023 16:09:29 -0800
55
19plocate (1.1.18-1) unstable; urgency=medium56plocate (1.1.18-1) unstable; urgency=medium
2057
21 * New upstream release.58 * New upstream release.
2259
23 -- Steinar H. Gunderson <sesse@debian.org> Sat, 28 Jan 2023 21:46:26 +010060 -- Steinar H. Gunderson <sesse@debian.org> Sat, 28 Jan 2023 21:46:26 +0100
2461
62plocate (1.1.17-2ubuntu1) lunar; urgency=low
63
64 * Merge from Debian unstable. Remaining changes:
65 - Adjust handling of db generation on package install to match the
66 previous mlocate behavior, which ensured db generation even in
67 chroots, printed a message before, and ensured db generation finished
68 before the postinst returned.
69 - Adjust dh_systemd handling to match the above.
70 - d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
71 support for the --ignore-spaces option from mlocate.
72
73 -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 24 Jan 2023 13:21:44 -0800
74
25plocate (1.1.17-2) unstable; urgency=medium75plocate (1.1.17-2) unstable; urgency=medium
2676
27 * Adjust the autopkgtest to deal with the return value changes in 1.1.17.77 * Adjust the autopkgtest to deal with the return value changes in 1.1.17.
@@ -36,6 +86,23 @@ plocate (1.1.17-1) unstable; urgency=medium
3686
37 -- Steinar H. Gunderson <sesse@debian.org> Mon, 21 Nov 2022 18:27:45 +010087 -- Steinar H. Gunderson <sesse@debian.org> Mon, 21 Nov 2022 18:27:45 +0100
3888
89plocate (1.1.16-1ubuntu1) kinetic; urgency=low
90
91 * Merge from Debian unstable. Remaining changes:
92 - Adjust handling of db generation on package install to match the
93 previous mlocate behavior, which ensured db generation even in
94 chroots, printed a message before, and ensured db generation finished
95 before the postinst returned.
96 - Adjust dh_systemd handling to match the above.
97 - d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
98 support for the --ignore-spaces option from mlocate.
99 * Dropped changes, included in Debian:
100 - Add /home/.ecryptfs and /var/lib/schroot to PRUNEPATHS.
101 - Add fuse.cryfs and fuse.encfs to PRUNEFS.
102 - Remove debian/source/include-binaries file.
103
104 -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 24 Jun 2022 09:50:11 -0700
105
39plocate (1.1.16-1) unstable; urgency=medium106plocate (1.1.16-1) unstable; urgency=medium
40107
41 * New upstream release.108 * New upstream release.
@@ -53,6 +120,31 @@ plocate (1.1.15-2) unstable; urgency=medium
53120
54 -- Steinar H. Gunderson <sesse@debian.org> Wed, 02 Mar 2022 20:52:02 +0100121 -- Steinar H. Gunderson <sesse@debian.org> Wed, 02 Mar 2022 20:52:02 +0100
55122
123plocate (1.1.15-1ubuntu2) jammy; urgency=medium
124
125 * Remove debian/source/include-binaries file. (LP: #1961266)
126
127 -- Nick Rosbrook <nick.rosbrook@canonical.com> Thu, 17 Feb 2022 09:26:51 -0500
128
129plocate (1.1.15-1ubuntu1) jammy; urgency=medium
130
131 * Port changes over from mlocate so that we can move to plocate in Ubuntu.
132 * Add /home/.ecryptfs and /var/lib/schroot to PRUNEPATHS.
133 * Add fuse.cryfs and fuse.encfs to PRUNEFS.
134 * Adjust handling of db generation on package install to match the
135 previous mlocate behavior, which ensured db generation even in chroots,
136 printed a message before, and ensured db generation finished before the
137 postinst returned.
138 * Adjust dh_systemd handling to match the above.
139 * Drops support for the --transliterate option, which requires significant
140 porting of functionality from C to the independent plocate C++ codebase.
141 * d/p/locate-add-ignore-spaces-option-to-ignore-word-separ.patch: port
142 support for the --ignore-spaces option from mlocate.
143 * All other patches and packaging delta for mlocate are obsolete for
144 plocate.
145
146 -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 10 Feb 2022 00:45:06 +0000
147
56plocate (1.1.15-1) unstable; urgency=medium148plocate (1.1.15-1) unstable; urgency=medium
57149
58 * New upstream release.150 * New upstream release.
@@ -389,3 +481,4 @@ plocate (1.0.0-1) unstable; urgency=medium
389 * Initial release.481 * Initial release.
390482
391 -- Steinar H. Gunderson <sesse@debian.org> Sun, 11 Oct 2020 21:24:13 +0200483 -- Steinar H. Gunderson <sesse@debian.org> Sun, 11 Oct 2020 21:24:13 +0200
484
diff --git a/debian/control b/debian/control
index 8ecf3be..2147b08 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
1Source: plocate1Source: plocate
2Section: utils2Section: utils
3Priority: optional3Priority: optional
4Maintainer: Steinar H. Gunderson <sesse@debian.org>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Steinar H. Gunderson <sesse@debian.org>
5# liburing-dev is technically optional, but strongly recommended.6# liburing-dev is technically optional, but strongly recommended.
6Build-Depends: debhelper-compat (= 13), liburing-dev [linux-any], libzstd-dev, meson, ninja-build, pkg-config, systemd [linux-any]7Build-Depends: debhelper-compat (= 13), liburing-dev [linux-any], libzstd-dev, meson, ninja-build, pkg-config, systemd [linux-any]
7Standards-Version: 4.5.08Standards-Version: 4.5.0
diff --git a/debian/patches/locate-add-ignore-spaces-option-to-ignore-word-separ.patch b/debian/patches/locate-add-ignore-spaces-option-to-ignore-word-separ.patch
8new file mode 1006449new file mode 100644
index 0000000..2774959
--- /dev/null
+++ b/debian/patches/locate-add-ignore-spaces-option-to-ignore-word-separ.patch
@@ -0,0 +1,173 @@
1Description: locate: add --ignore-spaces option to ignore word separators
2 It allows to locate files ignoring separators such as punctuation and
3 spaces, so searching for "foo-bar" will match "foo bar", "foo_bar" or
4 "foo?bar".
5 .
6 This is not compatible with regex.
7 .
8 Ported from https://pagure.io/mlocate/pull-request/42
9Author: Steve Langasek <steve.langasek@ubuntu.com>
10Last-Update: 2022-02-09
11Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mlocate/+bug/1752148
12
13Index: plocate-1.1.15/plocate.cpp
14===================================================================
15--- plocate-1.1.15.orig/plocate.cpp
16+++ plocate-1.1.15/plocate.cpp
17@@ -47,6 +47,7 @@
18 using namespace std::chrono;
19
20 bool ignore_case = false;
21+bool ignore_spaces = false;
22 bool only_count = false;
23 bool print_nul = false;
24 bool use_debug = false;
25@@ -171,6 +172,49 @@
26 }
27 }
28
29+/* Remove repeated punctuation or spaces from string and replace
30+ them with a space */
31+static char *
32+collapse_string_separators (const char *str, bool is_pattern)
33+{
34+ size_t strippedlen = 0;
35+ size_t i;
36+ char *outbuf;
37+ bool first = false;
38+ bool changed = false;
39+
40+ outbuf = (char *) malloc (strlen (str) + 1);
41+
42+ for (i = 0; str[i]; i++) {
43+ char cnt = str[i];
44+
45+ if (isspace (cnt) || (ispunct (cnt) && cnt != '@' &&
46+ (!is_pattern || strchr ("*?[\\]", cnt) == NULL)))
47+ {
48+ if (first) {
49+ changed = true;
50+ continue;
51+ }
52+ if (cnt != ' ') {
53+ cnt = ' ';
54+ changed = true;
55+ }
56+ first = true;
57+ } else
58+ first = false;
59+
60+ outbuf[strippedlen++] = cnt;
61+ }
62+
63+ if (!changed) {
64+ free (outbuf);
65+ return NULL;
66+ }
67+
68+ outbuf[strippedlen] = '\0';
69+ return outbuf;
70+}
71+
72 void scan_file_block(const vector<Needle> &needles, string_view compressed,
73 IOUringEngine *engine, AccessRXCache *access_rx_cache, uint64_t seq, ResultReceiver *serializer,
74 atomic<uint64_t> *matched)
75@@ -223,6 +267,7 @@
76 filename != block.data() + block.size();
77 filename += strlen(filename) + 1) {
78 const char *haystack = filename;
79+ char *altered_match = NULL;
80 if (match_basename) {
81 haystack = strrchr(filename, '/');
82 if (haystack == nullptr) {
83@@ -232,6 +277,12 @@
84 }
85 }
86
87+ if (ignore_spaces)
88+ altered_match = collapse_string_separators(haystack,
89+ false);
90+ if (altered_match)
91+ haystack = altered_match;
92+
93 bool found = true;
94 for (const Needle &needle : needles) {
95 if (!matches(needle, haystack)) {
96@@ -246,6 +297,8 @@
97 }
98 pending_candidate = filename;
99 }
100+ if (altered_match)
101+ free(altered_match);
102 }
103 if (pending_candidate == nullptr) {
104 serializer->print(seq << 32, 1ULL << 32, "");
105@@ -842,6 +895,7 @@
106 { "database", required_argument, 0, 'd' },
107 { "existing", no_argument, 0, 'e' },
108 { "ignore-case", no_argument, 0, 'i' },
109+ { "ignore-spaces", no_argument, 0, 'p' },
110 { "limit", required_argument, 0, 'l' },
111 { "literal", no_argument, 0, 'N' },
112 { "null", no_argument, 0, '0' },
113@@ -858,7 +912,7 @@
114 setlocale(LC_ALL, "");
115 for (;;) {
116 int option_index = 0;
117- int c = getopt_long(argc, argv, "Abcd:ehil:n:N0rwVD", long_options, &option_index);
118+ int c = getopt_long(argc, argv, "Abcd:ehipl:n:N0rwVD", long_options, &option_index);
119 if (c == -1) {
120 break;
121 }
122@@ -884,6 +938,9 @@
123 case 'i':
124 ignore_case = true;
125 break;
126+ case 'p':
127+ ignore_spaces = true;
128+ break;
129 case 'l':
130 case 'n':
131 limit_matches = limit_left = atoll(optarg);
132@@ -934,6 +991,11 @@
133 }
134 }
135
136+ if (patterns_are_regex && ignore_spaces) {
137+ perror("ignore-spaces is not supported when using regexp");
138+ exit(EXIT_FAILURE);
139+ }
140+
141 if (!print_nul) {
142 stdout_is_tty = isatty(1);
143 }
144@@ -968,6 +1030,14 @@
145 needle.type = Needle::STRSTR;
146 needle.str = unescape_glob_to_plain_string(needle.str);
147 }
148+
149+ if (ignore_spaces) {
150+ char *pattern = collapse_string_separators(needle.str.c_str(),
151+ true);
152+ if (pattern)
153+ needle.str = pattern;
154+ }
155+
156 needles.push_back(move(needle));
157 }
158 if (needles.empty()) {
159Index: plocate-1.1.15/plocate.1
160===================================================================
161--- plocate-1.1.15.orig/plocate.1
162+++ plocate-1.1.15/plocate.1
163@@ -104,6 +104,10 @@
164 generate more candidates for searching the index.
165
166 .TP
167+\fB\-p\fR, \fB\-\-ignore\-spaces\fR
168+Ignore punctuation and spaces when matching patterns.
169+
170+.TP
171 \fB\-l\fR, \fB\-\-limit\fR \fILIMIT\fR
172 Stop searching after
173 .I LIMIT
diff --git a/debian/patches/series b/debian/patches/series
0new file mode 100644174new file mode 100644
index 0000000..7a363de
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
1locate-add-ignore-spaces-option-to-ignore-word-separ.patch
diff --git a/debian/plocate.postinst b/debian/plocate.postinst
index 5728938..ad3b1f3 100644
--- a/debian/plocate.postinst
+++ b/debian/plocate.postinst
@@ -17,6 +17,16 @@ if [ "$1" = "configure" ]; then
17 if ! dpkg-statoverride --list /usr/bin/plocate >/dev/null 2>&1; then17 if ! dpkg-statoverride --list /usr/bin/plocate >/dev/null 2>&1; then
18 dpkg-statoverride --update --add root "$GROUP" 2755 /usr/bin/plocate 18 dpkg-statoverride --update --add root "$GROUP" 2755 /usr/bin/plocate
19 fi19 fi
20
21 if [ -z "$2" ] && ! [ -f /var/lib/plocate/plocate.db ]; then
22 echo -n "Initializing plocate database; this may take some time... "
23 NOCACHE=
24 if [ -x /usr/bin/nocache ]; then
25 NOCACHE="/usr/bin/nocache"
26 fi
27 $NOCACHE /usr/sbin/updatedb.plocate || true
28 echo "done"
29 fi
20fi30fi
2131
2232
diff --git a/debian/rules b/debian/rules
index 8e8b766..c24f340 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,3 +5,6 @@
55
6override_dh_auto_configure:6override_dh_auto_configure:
7 dh_auto_configure -- -Dupdatedb_progname=updatedb.plocate7 dh_auto_configure -- -Dupdatedb_progname=updatedb.plocate
8
9override_dh_installsystemd:
10 dh_installsystemd --no-start

Subscribers

People subscribed via source and target branches