Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12 seems to have broken --before-upgrade and --after-upgrade #1750

Closed
toran414 opened this issue Jan 20, 2021 · 6 comments · Fixed by #1761
Closed

1.12 seems to have broken --before-upgrade and --after-upgrade #1750

toran414 opened this issue Jan 20, 2021 · 6 comments · Fixed by #1761

Comments

@toran414
Copy link

We have a build using these flags, and after upgrading fpm to 1.12 the build started failing. If I revert to 1.11, or just remove these two flags from the build it works fine.

Error message:
Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--target", "noarch", "--define", "buildroot /tmp/package-rpm-build-06b8fa1624894ee4291366ab54c0ecea4b49cc64c8cc61f9103a9f411ef9/BUILD", "--define", "_topdir /tmp/package-rpm-build-06b8fa1624894ee4291366ab54c0ecea4b49cc64c8cc61f9103a9f411ef9", "--define", "_sourcedir /tmp/package-rpm-build-06b8fa1624894ee4291366ab54c0ecea4b49cc64c8cc61f9103a9f411ef9", "--define", "_rpmdir /tmp/package-rpm-build-06b8fa1624894ee4291366ab54c0ecea4b49cc64c8cc61f9103a9f411ef9/RPMS", "--define", "_tmppath /tmp", "/tmp/package-rpm-build-06b8fa1624894ee4291366ab54c0ecea4b49cc64c8cc61f9103a9f411ef9/SPECS/file-mover.spec"] {:level=>:error}

@x-lll
Copy link

x-lll commented Jan 26, 2021

Same problem
OS: Centos7
Installing from

    - curl -sSL https://rvm.io/mpapis.asc | gpg --import -
    - curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    - curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
    - curl -L get.rvm.io | bash -s stable
    - source /etc/profile.d/rvm.sh
    - rvm reload
    - rvm requirements run
    - rvm install 2.3.0 -j 50
    - rvm list
    - gem install --no-ri --no-rdoc fpm
    - fpm --version

Execute: fpm -s dir -t rpm -n apps
-v $(cat /opt/apps/version.json | jq -r '"(.maj).(.min).(.bld)"')
-C /opt/apps/ --prefix /opt/apps/ --verbose
--after-install /opt/apps/after-install
--before-remove /opt/apps/before-remove
--before-upgrade /opt/apps/before-upgrade
--description "app"

Error: :message=>"error: line 72: Too many names: %pre upgrade()

@thomas-pean
Copy link

The same for me : Centos 7, RPM packaging, --before-upgrade --after-upgrade flags
The same command was OK on the 1.11 version.

@jovandeginste
Copy link
Contributor

The changes in 8a40cd1 eat too much whitespace:

 %pre <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end -%>

When no rpm_macro_expansion is set, all whitespace (including newlines) after %pre are eaten, and thus results in:

%pre upgrade() {

It should be (and was, prior to v1.12.0):

%pre
upgrade() {

@jovandeginste
Copy link
Contributor

(Same for the other macro's: post, preun, postun)

@jovandeginste
Copy link
Contributor

After some testing, I believe the final -%> should just be %>, which would result in:

%pre -e
upgrade () {

Can anyone confirm?

jovandeginste added a commit to kuleuven/fpm that referenced this issue Jan 28, 2021
The previous commit eats too much whitespace after the section headers
(`%pre`, `%post` etc.). There should remain a newline.

Correct versions (for `%pre`):

```
%pre
ugrade () {
```

and

```
%pre -e
upgrade() {
```

Without this patch, we get these (wrong):

```
%pre ugrade () {
```

and

```
%pre -e upgrade() {
```

(exact number of spaces can be different, but should not be relevant)

Fixes jordansissel#1750

Signed-off-by: Jo Vandeginste <[email protected]>
@ola-pt
Copy link

ola-pt commented Feb 24, 2021

I have seen the same error message as well after attempting to use --after-upgrade:

error: line 80: Too many names: %post upgrade() { {:level=>:info} {:level=>:info} Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build-7f32c223fd3a13bcd12aaded5d048e5620510231a297cd5d7fe85b5c51a8/BUILD", "--define", "_topdir /tmp/package-rpm-build-7f32c223fd3a13bcd12aaded5d048e5620510231a297cd5d7fe85b5c51a8", "--define", "_sourcedir /tmp/package-rpm-build-7f32c223fd3a13bcd12aaded5d048e5620510231a297cd5d7fe85b5c51a8", "--define", "_rpmdir /tmp/package-rpm-build-7f32c223fd3a13bcd12aaded5d048e5620510231a297cd5d7fe85b5c51a8/RPMS", "--define", "_tmppath /tmp", "--sign", "/tmp/package-rpm-build-7f32c223fd3a13bcd12aaded5d048e5620510231a297cd5d7fe85b5c51a8/SPECS/pt-php-fpm.spec"] {:level=>:error}

I have not tried your fix @jovandeginste I can try it later today

astudentofblake pushed a commit to astudentofblake/fpm that referenced this issue Jun 18, 2021
The previous commit eats too much whitespace after the section headers
(`%pre`, `%post` etc.). There should remain a newline.

Correct versions (for `%pre`):

```
%pre
ugrade () {
```

and

```
%pre -e
upgrade() {
```

Without this patch, we get these (wrong):

```
%pre ugrade () {
```

and

```
%pre -e upgrade() {
```

(exact number of spaces can be different, but should not be relevant)

Fixes jordansissel#1750

Signed-off-by: Jo Vandeginste <[email protected]>
jordansissel pushed a commit that referenced this issue Jun 19, 2021
The previous commit eats too much whitespace after the section headers
(`%pre`, `%post` etc.). There should remain a newline.

Correct versions (for `%pre`):

```
%pre
ugrade () {
```

and

```
%pre -e
upgrade() {
```

Without this patch, we get these (wrong):

```
%pre ugrade () {
```

and

```
%pre -e upgrade() {
```

(exact number of spaces can be different, but should not be relevant)

Fixes #1750

Signed-off-by: Jo Vandeginste <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants