1 |
On Sun, 2020-09-13 at 14:21 +0300, Andrew Savchenko wrote: |
2 |
> On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote: |
3 |
> > Thanks to David Michael for the initial patch and upstream fixes. |
4 |
> > |
5 |
> > Signed-off-by: Michał Górny <mgorny@g.o> |
6 |
> > --- |
7 |
> > eclass/acct-group.eclass | 16 +++++++++++++++- |
8 |
> > eclass/acct-user.eclass | 16 +++++++++++++++- |
9 |
> > 2 files changed, 30 insertions(+), 2 deletions(-) |
10 |
> > |
11 |
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass |
12 |
> > index 5550e4a2fb10..dc1562974870 100644 |
13 |
> > --- a/eclass/acct-group.eclass |
14 |
> > +++ b/eclass/acct-group.eclass |
15 |
> > @@ -80,7 +80,7 @@ S=${WORKDIR} |
16 |
> > |
17 |
> > |
18 |
> > # << Phase functions >> |
19 |
> > -EXPORT_FUNCTIONS pkg_pretend pkg_preinst |
20 |
> > +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst |
21 |
> > |
22 |
> > # @FUNCTION: acct-group_pkg_pretend |
23 |
> > # @DESCRIPTION: |
24 |
> > @@ -116,6 +116,20 @@ acct-group_pkg_pretend() { |
25 |
> > fi |
26 |
> > } |
27 |
> > |
28 |
> > +# @FUNCTION: acct-group_src_install |
29 |
> > +# @DESCRIPTION: |
30 |
> > +# Installs sysusers.d file for the group. |
31 |
> > +acct-group_src_install() { |
32 |
> > + debug-print-function ${FUNCNAME} "${@}" |
33 |
> > + |
34 |
> > + insinto /usr/lib/sysusers.d |
35 |
> > + newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <( |
36 |
> > + printf "g\t%q\t%q\n" \ |
37 |
> > + "${ACCT_GROUP_NAME}" \ |
38 |
> > + "${ACCT_GROUP_ID/#-*/-}" |
39 |
> > + ) |
40 |
> > +} |
41 |
> > + |
42 |
> > # @FUNCTION: acct-group_pkg_preinst |
43 |
> > # @DESCRIPTION: |
44 |
> > # Creates the group if it does not exist yet. |
45 |
> > diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
46 |
> > index e82f3c56dbbe..f9772c3cb111 100644 |
47 |
> > --- a/eclass/acct-user.eclass |
48 |
> > +++ b/eclass/acct-user.eclass |
49 |
> > @@ -312,7 +312,7 @@ acct-user_pkg_pretend() { |
50 |
> > # @FUNCTION: acct-user_src_install |
51 |
> > # @DESCRIPTION: |
52 |
> > # Installs a keep-file into the user's home directory to ensure it |
53 |
> > is |
54 |
> > -# owned by the package. |
55 |
> > +# owned by the package, and sysusers.d file. |
56 |
> > acct-user_src_install() { |
57 |
> > debug-print-function ${FUNCNAME} "${@}" |
58 |
> > |
59 |
> > @@ -321,6 +321,20 @@ acct-user_src_install() { |
60 |
> > # created yet |
61 |
> > keepdir "${ACCT_USER_HOME}" |
62 |
> > fi |
63 |
> > + |
64 |
> > + insinto /usr/lib/sysusers.d |
65 |
> > + newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <( |
66 |
> > + printf "u\t%q\t%q\t%q\t%q\t%q\n" \ |
67 |
> > + "${ACCT_USER_NAME}" \ |
68 |
> > + "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \ |
69 |
> > + "${DESCRIPTION//[:,=]/;}" \ |
70 |
> > + "${ACCT_USER_HOME}" \ |
71 |
> > + "${ACCT_USER_SHELL/#-*/-}" |
72 |
> > + if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then |
73 |
> > + printf "m\t${ACCT_USER_NAME}\t%q\n" \ |
74 |
> > + "${ACCT_USER_GROUPS[@]:1}" |
75 |
> > + fi |
76 |
> > + ) |
77 |
> > } |
78 |
> |
79 |
> Why these files are installed unconditionally? |
80 |
> |
81 |
> Of course we have a common "small files" policy that USE flags |
82 |
> should not control small files in packages, such rule was designed |
83 |
> for common packages where: |
84 |
> 1) small files are insignificant disk usage compared to a whole |
85 |
> package; |
86 |
> 2) an average package takes significant time to rebuild and mass |
87 |
> rebuild will cause problems during USE flip. |
88 |
> |
89 |
> While both arguments are valid for a common packages which provide |
90 |
> real software, this is not true for very special acct-* packages: |
91 |
> 1) They may (and usually do) have zero size of installed files, |
92 |
> this makes sysusers.d stuff an infinite times larger than a |
93 |
> whole typical acct-* package (it will still be much larger if one |
94 |
> will consider size of new passw/group records). |
95 |
|
96 |
Using a multiplicative factor here seems purely for trying to make an |
97 |
argument. Any filesystem space taken here seems negligible. |
98 |
|
99 |
> 2) acct-* packages are very fast to rebuild, so such price will |
100 |
> be small compared to other changes necessary when USE="systemd" is |
101 |
> being flipped. |
102 |
> |
103 |
> So it will be reasonable to add USE="systemd" to acct-* eclasses |
104 |
> to control the changes proposed above. |
105 |
|
106 |
Why not add these paths to INSTALL_MASK to ease the burden on the number |
107 |
of installed files? |
108 |
|
109 |
There's another argument to be made: every USE flag added potentially |
110 |
increases the complexity of the depgraph. Given the tradeoffs, I'm |
111 |
willing to accept a tiny file more here. |