[CentOS] An rpmbuild spec question

Wed Dec 27 23:09:21 UTC 2017
m.roth at 5-cent.us <m.roth at 5-cent.us>

Stephen John Smoogen wrote:
> On Wed, Dec 27, 2017 at 3:41 PM <m.roth at 5-cent.us> wrote:
>
>> I'm trying to build a package to create a directory and install some
>> files. My rpmbuild keeps failing, unable to cd into the directory, "no
>> such". Now, in the tmpfile, I *see* it cd'ing into BUILD/opt, and the
>> source was unzipped and untared into BUILD/opt/smipmicfg-1.27.0. In the
>> spec file, I've even added a cd $RPM_BUILD_ROOT/opt, and I see it cd to
>> there... and then it says it fails cd'ing into the directory under it.
>>
>> I've been doing a lot of googling, but nothing seems to fix this. Anyone
>> got a clue?
>>
> Can you post any of the rpm spec file OR the tmp file? Without that it is
> very hard to know what you are trying to do and what it is actually doing
> instead.
>
Sure. I think I'm closer, but I'm also at the point where I'm just trying
things. My current issue, that I keep falling back to, is the install
*INSISTS* that it has to add a - after version.

%prep

%install
mkdir $RPM_BUILD_DIR/opt/smipmicfg-%{version}
 install -m 744 -d %{buildroot}/%{name}-%{version}

%clean
rm -rf %{buildroot}

%files
%{buildroot}/%{name}

All I want to build is a package to create /opt/smipmicfg-1.20.0, and copy
files into it.

What I see from the rpmbuild is
+ cd /usr//local//src//rpmbuild/BUILD
+ '['
/usr/local/src/rpmbuild/BUILDROOT/smipmicfg-1.27.0-.el7.centos.x86_64 '!='
/ ']'
And you see that "-" after the name/version

     mark