Skip to content

In spec template, {{name}} should not be appended to installDir or in {{#executableFiles}} #4

@TimUnderhay

Description

@TimUnderhay

In the specfile template, the following lines are present:

%install
mkdir -p %{buildroot}{{installDir}}/{{name}}
cp -r ./* %{buildroot}{{installDir}}/{{name}}

I humbly submit that /{{name}} should not be included here for the reason that a user may wish to specify an absolute path as installDir. By appending {{name}}, the user must jump through hoops (sed, etc) to fix the resultant specfile.

For instance:

package.json:

  "spec": {
    "installDir": "/opt/mycompany/myproduct/bin"

Using %{buildroot}{{installDir}}/{{name}}, this results in the installation directory being /opt/mycompany/myproduct/bin/myproduct.

This effect also manifests in {{#executableFiles}} in %files:

{{#hasExecutableFiles}}
%defattr(755, {{username}}, {{username}}, 755)
{{#executableFiles}}
{{.}}
{{/executableFiles}}
{{/hasExecutableFiles}

...produces:

%defattr(755, 221b-server, 221b-server, 755)
/opt/mycompany/myproduct/bin/myproduct/221b_worker.py

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions