1 |
This example shows how to use a vcs with confsink and how cfs is a |
2 |
wrapper around that vcs. If you are used to git then you should |
3 |
understand the output of the commands easily. If not then it might be |
4 |
a bit harder to understand. But please also note the options that can |
5 |
be used to configure confsink. You will be able to configure cfs to |
6 |
show output more understandable to people not accustomed to the |
7 |
underlying vcs. Of course when using the vcs directly this won't have |
8 |
an effect. |
9 |
|
10 |
So please read this and try to understand. To set you in the right |
11 |
mood I would like to mention upfront the most important thing to |
12 |
noticed: Beyond 'cfs focus' you do not need to use cfs at all at least |
13 |
for all operations that the vcs already supports. |
14 |
|
15 |
-------------------- |
16 |
|
17 |
$ cfs --help |
18 |
usage: cfs COMMAND [--package PACKAGE] [ARGS] |
19 |
|
20 |
The most commonly used cfs commands are: |
21 |
ls-files |
22 |
status |
23 |
diff |
24 |
... |
25 |
|
26 |
The most commonly used cfs commands for experts are: |
27 |
focus Focus on a particular package/branch or the master branch. |
28 |
... |
29 |
|
30 |
$ cat /etc/confsink/cfs.conf |
31 |
# underlying_vcs sets the underlying vcs. Note that this has to be set |
32 |
# before cfs and emerge are run for the first time after setting |
33 |
# FEATURES="confsink" in /etc/make.conf. It is possible to switch the |
34 |
# underlying vcs as described in the documentation but this is more |
35 |
# complicated than just changing the value here. |
36 |
# default: underlying_vcs=git |
37 |
# |
38 |
underlying_vcs=git |
39 |
|
40 |
# If you are accustomed to the underlying vcs then you should set this |
41 |
# to true, otherwise it might be better to keep the default of false |
42 |
# making it easier to understan cfs output. |
43 |
# default: porceclain_recembles_underlying_vcs=false |
44 |
# |
45 |
porceclain_recembles_underlying_vcs=true |
46 |
|
47 |
# enable_focus is dangerous because it makes 'git clean -fd', act like |
48 |
# 'rm -rf /'. |
49 |
# default: enable_focus=false |
50 |
# |
51 |
enable_focus=true |
52 |
|
53 |
# disable_dangerous will prevent dangerous command of the underlying |
54 |
# commands, like for example 'git clean -fd'. This is only relevant if |
55 |
# enable_focus is true. |
56 |
# default: disable_dangerous=true |
57 |
disable_dangerous=true |
58 |
|
59 |
# expert_mode causes the cfs commands to be behave exactly like the |
60 |
# underlying vcs. If it is not enabled then cfs features different |
61 |
# commands and the options of some commands have been simplified. |
62 |
# default: expert_mode=false |
63 |
expert_mode=true |
64 |
... |
65 |
|
66 |
$ cfs package |
67 |
* overall-configuration |
68 |
app-misc/foo |
69 |
app-misc/bar |
70 |
... |
71 |
|
72 |
$ cfs package -v |
73 |
* overall-configuration |
74 |
app-misc/foo |
75 |
* live |
76 |
vanilla |
77 |
experiment |
78 |
from-another-user |
79 |
app-misc/bar |
80 |
* live |
81 |
vanilla |
82 |
app-misc/baz |
83 |
* live |
84 |
vanilla |
85 |
... |
86 |
|
87 |
$ cfs focus -v app-misc/foo |
88 |
# You are using the git backend. |
89 |
# Running these commands: |
90 |
# export GIT_DIR=/var/confsink |
91 |
# export GIT_WORK_TREE=/ |
92 |
# mv $GIT_DIR/index.d/$package $GIT_DIR/index |
93 |
# git symbolic-ref HEAD refs/heads/live/$package |
94 |
Switched to package "app-misc/foo" branch "live" |
95 |
# Warning: |
96 |
# All git commands in this console will now operate on this package/branch. |
97 |
# Don't do this 'git clean -fd', it's like 'rm -rf /'. |
98 |
|
99 |
[cfs: app-misc/foo/live] $ cfs package |
100 |
app-misc/foo |
101 |
* * live |
102 |
vanilla |
103 |
experiment |
104 |
from-another-user |
105 |
app-misc/bar |
106 |
app-misc/baz |
107 |
... |
108 |
|
109 |
[cfs: app-misc/foo/live] $ git ls-files |
110 |
/etc/foo.conf |
111 |
/etc/foo-extras.conf |
112 |
|
113 |
[cfs: app-misc/foo/live] $ cfs focus |
114 |
# Unfocus. git now operates as normal. |
115 |
|
116 |
[cfs: app-misc/foo/live] $ git clean -fdx |
117 |
fatal: operation not permitted, it's considered to be to dangerous. |
118 |
# Woow take it easy! |
119 |
# This would wip your system much like 'rm -rf /'. |
120 |
# Please read the confsink documentation. |
121 |
|
122 |
$ cfs ls-files --package app-misc/foo |
123 |
/etc/foo.conf |
124 |
/etc/foo-extras.conf |
125 |
|
126 |
$ cfs ls-files |
127 |
error: no package/branch is currently focused |
128 |
|
129 |
$ git ls-files |
130 |
fatal: Not a git repository (or any of the parent directories): .git |
131 |
|
132 |
$ cfs status |
133 |
# Packages changed but not updated: |
134 |
# |
135 |
# app-misc/xxx |
136 |
# app-misc/yyy |
137 |
# |
138 |
# Untracked packages with config protected files: |
139 |
# |
140 |
# app-misc/zzz |
141 |
|
142 |
$ cfs status --package app-misc/xxx |
143 |
# Tempory focus on package app-misc/xxx branch live |
144 |
# Changed but not updated: |
145 |
# (use "cfs add --package app-misc/xxx <file>..." to update what |
146 |
will be committed) |
147 |
# (use "cfs checkout --package app-misc/xxx -- <file>..." to discard |
148 |
changes in working directory) |
149 |
# |
150 |
# modified: /etc/zzz.conf |
151 |
no changes added to commit (use "git add" and/or "git commit -a") |
152 |
|
153 |
$ cfs focus app-misc/xxx |
154 |
Switched to package "app-misc/xxx" branch "live" |
155 |
# Warning: |
156 |
# All git commands in this console will now operate on this package/branch. |
157 |
# Don't do this 'git clean -fd', it's like 'rm -rf /'. |
158 |
|
159 |
[cfs: app-misc/xxx/live] $ git status |
160 |
# On branch app-misc/xxx/live |
161 |
# Changed but not updated: |
162 |
# (use "git add <file>..." to update what will be committed) |
163 |
# (use "git checkout -- <file>..." to discard changes in working directory) |
164 |
# |
165 |
# modified: /etc/zzz.conf |
166 |
no changes added to commit (use "git add" and/or "git commit -a") |
167 |
|
168 |
------------ |
169 |
|
170 |
so this is basically the same: |
171 |
[1] $ cfs focus PACKAGE; git COMMAND; git focus |
172 |
[2] $ cfs COMMAND --package PACKAGE COMMAND |
173 |
|
174 |
git experts would probably prefer [2]. A draw back is that the output |
175 |
of git will be slightly less informative than that of cfs. |
176 |
|
177 |
Given the commands demonstrated above one only needs 'cfs focus', but |
178 |
cfs will also have commands not available in git. For example a |
179 |
command to show what known repositories contain configuration for a |
180 |
particular package and if the author provided a description of why he |
181 |
configured things the way he did also display that. As "described" in |
182 |
another post there will also be @sets containing related configuration |
183 |
for multiple packages. |
184 |
|
185 |
-- Jonas |