-
Notifications
You must be signed in to change notification settings - Fork 6
/
CONCEPT
357 lines (280 loc) · 12.6 KB
/
CONCEPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
-------
Purpose
-------
pacman-curses is a curses frontend to libalpm. It is intended to provide a
"graphical", convenient, easy to use alternative to pacman for simple routine
tasks such as browsing, searching, and installing / removing packages. It is
NOT intended for any more advanced tasks, which are better left to pacman
itself. Seeing this as a side by side companion to pacman is probably the
correct point of view.
The interface should be very simple, friendly and intuitive, similar to mc and
mocp. Likewise, the code itself should be very simple - this is a one man
project and like this it has the best chance of staying clean and actually
getting finished.
------------------
Technical Overview
------------------
pacman-curses is written in C++ using ncurses and libalpm. The interface will
consist of two panes, very similar to mc and mocp.
Info View:
+Pkg List--------------------+Pkg Info-----------------------------------------+
|[--] 3ddesktop |name: 3ddesktop |
|[--] 6tunnel |version: 0.2.9-3 |
|[--] 9base |url: http://desk3d.sourceforge.net |
|[--] a2ps |repo: extra |
|[D-] a52dec |packager: Eric Belanger <[email protected]> |
|[D-] aalib |builddate: Thu Mar 26 03:13:36 2009 |
|[E-] abcde |install reason: not installed |
|[--] abiword |desc: a 3d virtual desktop switcher (opengl/mesa)|
|[--] abiword-plugins | |
|[--] abook | |
|[E-] abs | |
|[--] abuse | |
|[--] acct | |
+-2498 Pkgs (400 installed)--+-------------------------------------------------+
Queue View:
+Pkg List--------------------+Pkg Queue----------------------------------------+
|[--] 3ddesktop |S pkg1 |
|[--] 6tunnel |R pkg2 |
|[--] 9base | |
|[--] a2ps | |
|[D-] a52dec | |
|[D-] aalib | |
|[E-] abcde | |
|[--] abiword | |
|[--] abiword-plugins | |
|[--] abook | |
|[E-] abs | |
|[--] abuse | |
|[--] acct | |
+-2498 Pkgs (400 installed)--+-10 R 20 I 200.3 MB DL +500 MB/-200 MB INST------+
Configuration is read from pacman.conf.
The left pane displays an (optionally filtered) package list. Each package is
displayed only once, regardless if it appears in more than one repository.
Earlier repositories win, which means testing/make would be displayed while
core/make is hidden.
It can be navigated by record, by page, and by jumping to the beginning / end
of the list.
The list can be filtered by fields (like name, description, ...) and other
criteria such as install status.
The list uses colors. These can display a packages installation status (not
installed / explicit / as dep) and more.
It also shows a summary of appropriate details.
The right pane has 2 modes, Info and Queue.
In info mode, the right pane simply displays package infos. The pane cannot be
focused or scrolled. It is updated every time the focused package in the list
pane changes.
In queue mode, the right pane displays all packages queued for an operation
(remove / install) as well as the operation and other details
(download size, installed size, ...). This list is also color coded. The queue
displays only packages added by the user. Implicit dependencies are either 1)
NOT displayed or 2) displayed but greyed out and cannot be directly modified by
the user.
--------
Commands
--------
Global
------
Filter Pkg List:
Filters the displayed packages by a filter phrase. Filtering can be specific
to a package field, eg name/repo/group/provides. Field selection is handled
in the syntax of the filter phrase. Default is name/desc/provides/groups.
Sort Pkg List:
Colorcode Pkg List:
Similar to Filter Pkg List
Clear Pkg List Filter:
Reverts to displaying all available packages.
Quit:
Exit the application.
Begin Transaction:
Begin processing the queue. This is handled outside of ncurses mode,
similarly to Sync DBs. Pacman callbacks display progress bars and any other
messages. The queue pane is only cleared if the operation completes
successfully. Aborting the operation (Ctrl C) is handled like an error.
Switch Right Pane Mode:
Toggles between Info and Queue modes. Focus is restored to the left pane.
Switch Focused Pane:
Switch focus between list and queue pane. If info pane is currently
displayed, automatically switch to queue mode. The caption of the selected
pane is highlighted.
Help:
Display a popup window listing all commands.
List Pane
---------
Add Pkg to Queue:
Adds the selected pkg(s) to the queue. If Pkg is currently installed, the
queued operation is 'Remove', otherwise it is 'Install'. If pkg is already
in queue, does nothing. Does NOT remove the pkg from list pane.
Remove Pkg from Queue:
Removes the selected pkg(s) from the queue. If pkg is not in queue, does
nothing.
Multiselect Toggle:
The user is able to select a collection of packages by using the multiselect
command. Toggles the selected state of a Pkg.
Multiselect Regexp:
Similar to Filter Pkg List
Queue Pane
----------
Multiselect:
The user is able to select a collection of packages by using the multiselect
command. Toggles the selected state of a Pkg.
Remove Pkg from Queue:
Removes the selected pkg(s) from the queue.
------------------
Details: List Pane
------------------
+-Pkg List (/n:searchphrs)---+ <-- Header, search phrase
|[--] 3ddesktop | <-- actual package list
...
|[--] abiword-plugins |
|[--] abook |
|[E-] abs |
|[--] abuse |
+-2498 Pkgs (400 installed)--+ <-- status bar
The list pane owns a vector of pointers to Package objects. All of these are
displayed in the pane. When the list is filtered, the vector is altered to only
contain the corresponding packages.
The Package class is a thin wrapper around alpm's pkg functions. Additionally,
it contains a few fields we need internally, like a pkg's selection status, its
queued operation, etc.
In details, display:
Install status
Availability of upgrades
Orphan status
Foreign status
Queue status
Display details as columns? Or only a list of applicable chars (EU == Explicit,
Upgrade Avail). Columns are easier to read but a list of chars is shorter.
Columns might not make sense for fields that are rarely filled (orphan, update
avail).
Color code by:
Repos? (how to handle many user repos?)
Install status?
In the status bar, display:
Nr of pkgs in filtered list
Nr of installed pkgs in filtered list
-------------------
Details: Info Pane
-------------------
The info pane indicates which attributes are used to sort / color code.
-------------------
Details: Queue Pane
-------------------
+-Pkg Queue---------------------------------------+
|S abook |
|R abuse |
...
| |
+-10 R 20 I 200.3 MB DL +500 MB/-200 MB INST------+
Color code by:
Queued operation
Explicit/implicit (dep) target (if we choose to display these in queue)
In the status bar, display:
Nr of queued packages to 1) remove 2) install
Download size
Installed size (delta?)
-------------
Details: Misc
-------------
Text Entry Area
---------------
A text entry area is needed for filtering. The simplest way to handle this that
I can think of right now is to overlay the bottom row with an input area when
needed and hide it when not needed.
Color Coding
------------
Only applies to package list.
Color coding is done using the similar syntax as filtering (except it uses a
different operator).Allows color coding anything that is listed in the info
pane (Name/Desc/Repo/Install Status/...). Of course this doesn't make sense for
things like Name, but its very consistent with filtering. We define a sequence
of colors, get the distinct values of the defined field, and apply the colors
according to that. If there are more values than defined colors, cycle around
and start from the first color. Applies only to contents of currently filtered
list. Values are sorted alphabetically, so assigned colors are always the same
for the same set of values.
Syntax could be:
12
.[ndg...]
1 is the command to start color code mode
2 is a single field descriptor
Default is install status.
Multiselect
-----------
Multi select can either be done manually by using the Toggle Multiselect
command, or with a syntax identical to filtering.
Syntax could be:
,[ndg...:]regexp
This doesn't toggle all selected states; it toggles the selection state of the
first package and applies that state to all others. Applies only to the current
contents of the filtered pkg list.
Groups
------
For simplicity, pacman-curses does not have foldable lists (treelists) or
navigateable lists. Installation/removal of groups is handled by filtering the
list by a group name and then adding the desired packages.
Sorting
-------
Handled using syntax similar to filtering.
m[ndg]
Sorting is always ascending. Secondary sort field is always Name
Default is Name.
Filtering
---------
Filtering must be able to handle
1) filtering by a specific field (name/desc/...)
2) filtering using either 'contains' or 'exact' matching (?)
3) regexp matching (?)
4) combined filters (name = .. AND repo = ..) (?)
Realistically, 1) and 3) sounds like the simplest choice. Syntax:
12 3
/[ndg...:]regexp
1 is the command to start filter mode
2 is one or more field descriptors followed by ':' (optional)
3 is the actual search regexp
Besides text matching filters, it should be possible to filter by things like:
Install status: Not installed/Explicit/Dep
Orphan status: Orphan/Not Orphan
Foreign status: Foreign/Not Foreign
Queue status: Queued/Not Queued
Selection status: Selected/Not Selected
With these nontext filters, it would also make sense to allow chaining filters.
Make all filters apply using AND logic, and only clear them when the user
specifically uses the 'clear filters' command. This can be implemented by
filtering the same list over and over again.
We might be able to handle this using standard text filters by listing this
stuff in the info pane in an easily filterable way. Something like:
Orphan: y (/n)
Foreign: y (/n)
...
Clearing a filter does NOT reset the colors and selection states.
System Update
-------------
A system update '-Su' should be mostly equivalent to -S 'pacman -Qu' since
reinstalling a package doesn't change its install reason.
Provides/Replaces complicate this. We'd need to remove the old package, add the
replace package, manually set the install reason (if the original package was
installed asdeps) and have some kind of user confirmation for replacement of
packages during upgrades.
This is way too complicated. Several ways to handle this:
1) Bypass queue for system updates and use pacman code.
This one feels weird. Why not just use pacman -Su?
2) Ignore replace during upgrades.
Different behavior from pacman, not good.
3) Don't do update operations.
I don't really like this because its probably the most used pacman op, but at
the moment it feels like the cleanest solution. We could also leave out db
updates..
-----------
First Steps
-----------
Current state:
A package browser with the basics of navigation / filtering implemented. Messy
implementation.
Next up:
???
----------
Ideas/Open Questions/Misc
----------
Run as root/get root when needed??
List and queue pane both display packages. Do they use the same object (class)??