Closed marcosfrm closed 1 year ago
About permissions/ownership in %files
, let's drop all of them. Only set a different owner (%attr(-,foo,foo)
) when required. From RPM manual:
By default, packaged files are owned by root:root and permission bits
are taken directly from the on-disk files.
I think it's risky to trust that all file permissions are correct in the repo. There have been incorrect perms in the past.
If you introduce a systemd
variable that can handle the different service file paths.
In SConstruct
add
systemd = ['build/install/lin/fah-client.service'],
Would need to modify cbang deb packager to also use it, and not use var misc
in SConstruct
for this.
Just thinking out loud.
I believe target
passed to the scons build function is always an array(list) of str or bytes.
Which is why you may see
str(target[0])
Why are underscores in the package filename a problem?
See GetPackageName
in cbang/config/packager
.
ResolvePackageFileMap
is also in there.
To keep the resolve happy, you might need
rpm_client_dirs = [('var/lib/fah-client', '.'), ('var/log/fah-client', '.'), ('etc/fah-client', '.')],
Which makes each element a tuple. I might be off my rocker.
Edit: never mind this. An install_dirs
function is a better idea.
Maybe just not use install_files
for rpm_client_dirs
.
Make an install_dirs
function.
install_dirs(f, env, 'rpm_client_dirs', build_dir, '/', '%attr(-,fah-client,fah-client) %dir')
Untested:
def install_dirs(f, env, key, build_dir, path, prefix = None, dperms = 0o755):
# Create dirs and write dirs list
for dir in env.get(key):
os.makedirs(os.path.join(build_dir, path, dir), dperms, True)
if prefix: f.write(prefix + ' ')
else: f.write('%dir ')
f.write(os.path.join(path, dir) + '\n')
Roughly equivalent to your hack, I think. But no resolving excludes. Dirs are expected to be strings, not tuples.
In case rpm_client_dirs
has any absolute paths in it, install_dirs
maybe should .replace('//', '/')
.
Or use whatever python has to normalize paths.
PR #125 merged.
While trying to create v8 fah-client RPM (see https://github.com/FoldingAtHome/fah-client-bastet/pull/155), I came up with these changes:
Do you think acceptable?
There are missing pieces:
/lib/systemd/system
, while Fedora/RHEL is/usr/lib/systemd/system
(did not test https://github.com/FoldingAtHome/fah-client-bastet/pull/155#issuecomment-1758881226 yet)%attr(-,fah-client,fah-client) %dir
in the SPEC's%files
sectionTried with this hack in
install_files()
(config/rpm/__init__.py
):And:
in
build_function()
.And:
in fah-client's
SConstruct
.(also suggested by @kbernhagen)
But then
ResolvePackageFileMap
breaks resulting in incomplete%files
...