[Bug 1597074] Re: rpmbuild ignores /usr/lib/macros if option --macros=file is used
Fraser
fraser.hanson+u1 at gmail.com
Wed Jun 29 15:59:03 UTC 2016
** Summary changed:
- rpmbuild fails with /usr/lib/macros syntax error if option --macros=file is used
+ rpmbuild ignores /usr/lib/macros if option --macros=file is used
** Description changed:
Building on Ubuntu 15.10 with RPM version 4.12.0.1+dfsg1-3build2
+
+ I expect that specifying a macros file with --macros <filename> should
+ allow me to add or redefine the existing macros.
+
+ Instead it seems that only the macros file I specify is read, and the
+ macros in the "official" macros file are no longer able to be evaluated.
# Simple test case: Command fails when any macros file is specified, even an empty one:
fhanson at fhanson-linux:~/$ rpm --macros=/dev/null --eval '%{__spec_install_template}'
%{__spec_install_template}
-
# expected output:
fhanson at fhanson-linux:~/$ rpm --eval '%{__spec_install_template}'
#!/bin/sh
- RPM_SOURCE_DIR="/ssd/home/fhanson/rpmbuild/SOURCES"
- RPM_BUILD_DIR="/ssd/home/fhanson/rpmbuild/BUILD"
- RPM_OPT_FLAGS="-O2 -g"
- RPM_ARCH="x86_64"
- RPM_OS="linux"
- export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
- RPM_DOC_DIR="%{_docdir}"
- export RPM_DOC_DIR
- RPM_PACKAGE_NAME="%{name}"
- RPM_PACKAGE_VERSION="%{version}"
- RPM_PACKAGE_RELEASE="%{release}"
- export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
- LANG=C
- export LANG
- unset CDPATH DISPLAY ||:
- RPM_BUILD_ROOT="/ssd/home/fhanson/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.x86_64"
- export RPM_BUILD_ROOT
-
- PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
- export PKG_CONFIG_PATH
-
- exec > /dev/null
- umask 022
- cd "/ssd/home/fhanson/rpmbuild/BUILD"
+ RPM_SOURCE_DIR="/ssd/home/fhanson/rpmbuild/SOURCES"
+ RPM_BUILD_DIR="/ssd/home/fhanson/rpmbuild/BUILD"
+ RPM_OPT_FLAGS="-O2 -g"
+ RPM_ARCH="x86_64"
+ RPM_OS="linux"
+ export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
+ RPM_DOC_DIR="%{_docdir}"
+ export RPM_DOC_DIR
+ RPM_PACKAGE_NAME="%{name}"
+ RPM_PACKAGE_VERSION="%{version}"
+ RPM_PACKAGE_RELEASE="%{release}"
+ export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
+ LANG=C
+ export LANG
+ unset CDPATH DISPLAY ||:
+ RPM_BUILD_ROOT="/ssd/home/fhanson/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.x86_64"
+ export RPM_BUILD_ROOT
+ PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
+ export PKG_CONFIG_PATH
+
+ exec > /dev/null
+ umask 022
+ cd "/ssd/home/fhanson/rpmbuild/BUILD"
I attempted to reproduce this on SLES11Sp2 (rpm 4.4.2.3) and could not.
This causes all of my rpm builds to fail that use a macros file, because all stage scripts are created with un-expanded macros.
Instead of my prep stage looking like this:
#!/bin/sh
...stuff
It looks like this:
%{__spec_prep_template}
cd '/ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/BUILD'
rm -rf 'define-0.1'
- %{__gzip} -dc '/ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/SOURCES/define-0.1.tar.gz' | %{__tar} -xf -
+ %{__gzip} -dc '/ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/SOURCES/define-0.1.tar.gz' | %{__tar} -xf -
STATUS=$?
if [ $STATUS -ne 0 ]; then
- exit $STATUS
+ exit $STATUS
fi
cd 'define-0.1'
This results in a failed build, because of course
%{__spec_prep_template} is not a valid shebang line.
%{__spec_prep_post}fhanson at fhanson-linux:~/git/sustaining/sustaining/src/define (master)$ cat /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.OGXomQ make rpm
Building rpm package version 0.1 ...
mkdir -p build
cp -r rpmbuild build/
rpm --initdb --dbpath /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/rpmdb
tar xzf rpmbuild/SOURCES/define-0.1.tar.gz -C build/rpmbuild/BUILDROOT --strip-components=1
cd build/rpmbuild/; rpmbuild -vv --macros=rpmmacros --define="_topdir /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild" -bb SPECS/define.spec
ufdio: 1 reads, 15439 total bytes in 0.000006 secs
Executing(%prep): %{__spec_prep_cmd} /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV
error: Exec of /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV failed (%prep): No such file or directory
error: Bad exit status from /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV (%prep)
-
RPM build errors:
- Bad exit status from /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV (%prep)
+ Bad exit status from /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV (%prep)
Makefile:91: recipe for target 'rpm' failed
make: *** [rpm] Error 1
** Project changed: rpm => rpm (Ubuntu)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rpm in Ubuntu.
https://bugs.launchpad.net/bugs/1597074
Title:
rpmbuild ignores /usr/lib/macros if option --macros=file is used
Status in rpm package in Ubuntu:
New
Bug description:
Building on Ubuntu 15.10 with RPM version 4.12.0.1+dfsg1-3build2
I expect that specifying a macros file with --macros <filename> should
allow me to add or redefine the existing macros.
Instead it seems that only the macros file I specify is read, and the
macros in the "official" macros file are no longer able to be
evaluated.
# Simple test case: Command fails when any macros file is specified, even an empty one:
fhanson at fhanson-linux:~/$ rpm --macros=/dev/null --eval '%{__spec_install_template}'
%{__spec_install_template}
# expected output:
fhanson at fhanson-linux:~/$ rpm --eval '%{__spec_install_template}'
#!/bin/sh
RPM_SOURCE_DIR="/ssd/home/fhanson/rpmbuild/SOURCES"
RPM_BUILD_DIR="/ssd/home/fhanson/rpmbuild/BUILD"
RPM_OPT_FLAGS="-O2 -g"
RPM_ARCH="x86_64"
RPM_OS="linux"
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
RPM_DOC_DIR="%{_docdir}"
export RPM_DOC_DIR
RPM_PACKAGE_NAME="%{name}"
RPM_PACKAGE_VERSION="%{version}"
RPM_PACKAGE_RELEASE="%{release}"
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
LANG=C
export LANG
unset CDPATH DISPLAY ||:
RPM_BUILD_ROOT="/ssd/home/fhanson/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.x86_64"
export RPM_BUILD_ROOT
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
export PKG_CONFIG_PATH
exec > /dev/null
umask 022
cd "/ssd/home/fhanson/rpmbuild/BUILD"
I attempted to reproduce this on SLES11Sp2 (rpm 4.4.2.3) and could not.
This causes all of my rpm builds to fail that use a macros file, because all stage scripts are created with un-expanded macros.
Instead of my prep stage looking like this:
#!/bin/sh
...stuff
It looks like this:
%{__spec_prep_template}
cd '/ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/BUILD'
rm -rf 'define-0.1'
%{__gzip} -dc '/ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/SOURCES/define-0.1.tar.gz' | %{__tar} -xf -
STATUS=$?
if [ $STATUS -ne 0 ]; then
exit $STATUS
fi
cd 'define-0.1'
This results in a failed build, because of course
%{__spec_prep_template} is not a valid shebang line.
%{__spec_prep_post}fhanson at fhanson-linux:~/git/sustaining/sustaining/src/define (master)$ cat /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.OGXomQ make rpm
Building rpm package version 0.1 ...
mkdir -p build
cp -r rpmbuild build/
rpm --initdb --dbpath /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/rpmdb
tar xzf rpmbuild/SOURCES/define-0.1.tar.gz -C build/rpmbuild/BUILDROOT --strip-components=1
cd build/rpmbuild/; rpmbuild -vv --macros=rpmmacros --define="_topdir /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild" -bb SPECS/define.spec
ufdio: 1 reads, 15439 total bytes in 0.000006 secs
Executing(%prep): %{__spec_prep_cmd} /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV
error: Exec of /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV failed (%prep): No such file or directory
error: Bad exit status from /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV (%prep)
RPM build errors:
Bad exit status from /ssd/home/fhanson/git/sustaining/sustaining/src/define/build/rpmbuild/tmp/rpm-tmp.6vTHsV (%prep)
Makefile:91: recipe for target 'rpm' failed
make: *** [rpm] Error 1
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rpm/+bug/1597074/+subscriptions
More information about the foundations-bugs
mailing list