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?
mark
On Wed, Dec 27, 2017 at 3:41 PM m.roth@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.
mark
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Stephen John Smoogen wrote:
On Wed, Dec 27, 2017 at 3:41 PM m.roth@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
On 12/27/2017 3:09 PM, m.roth@5-cent.us wrote:
My current issue, that I keep falling back to, is the install *INSISTS* that it has to add a - after version.
You're missing the spec file header that includes lots of meta information. The dash is to separate the version from the package release string. You should have a Release: header to fill that in.
install -m 744 -d %{buildroot}/%{name}-%{version}
No need to set the mode here. Do that in the %files section with the defattrs tag.
%files %{buildroot}/%{name}
Use the final absolute install path in %files. Don't include the buildroot. So just /opt/%{name}.
What I see from the rpmbuild is
- cd /usr//local//src//rpmbuild/BUILD
Don't build as root. I create a special user to build packages from. Install the rpmdevtools package and run rpmdev-setuptree as your build user.
http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/
On 12/27/17 18:36, Kenneth Porter wrote:
On 12/27/2017 3:09 PM, m.roth@5-cent.us wrote:
My current issue, that I keep falling back to, is the install *INSISTS* that it has to add a - after version.
You're missing the spec file header that includes lots of meta information. The dash is to separate the version from the package release string. You should have a Release: header to fill that in.
I understood that... but I don't *want* a release number. Unless you're suggesting that I *must* do something like change my package name and directory to 1.27-0.
mark
install -m 744 -d %{buildroot}/%{name}-%{version}
No need to set the mode here. Do that in the %files section with the defattrs tag.
%files %{buildroot}/%{name}
Use the final absolute install path in %files. Don't include the buildroot. So just /opt/%{name}.
What I see from the rpmbuild is
- cd /usr//local//src//rpmbuild/BUILD
Don't build as root. I create a special user to build packages from. Install the rpmdevtools package and run rpmdev-setuptree as your build user.
http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/ _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On Thu, Dec 28, 2017 at 07:49:12AM -0500, mark wrote:
I understood that... but I don't *want* a release number. Unless you're suggesting that I *must* do something like change my package name and directory to 1.27-0.
Every package has a name, version and release (as well as other metadata like epoch and arch which are used to determine version ordering). You must define them or you get that blank release like you saw.
The definition of a release should not define where your executables go. That's for your %install section. You could put them in /foo/bar/baz/ if you wanted, as long as the %install section created $RPM_BUILD_ROOT/foo/bar/baz and populated it with files, and you listed /foo/bar/baz in your %files section.
On Wed, Dec 27, 2017 at 06:09:21PM -0500, m.roth@5-cent.us wrote:
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
You're missing a lot of package metadata in your spec file.
I suggest starting over, install rpmdevtools, use:
rpmdev-newspec -t minimal smipmicfg
It will create a file smipmicfg.spec, and it will be fully populated with a mimimal spec file. You can probably just remove the %build section entirely, and just use the %install section to extract the contents of the tarball (or just create the dir and copy %{SOURCE0} to %buildroot/opt/smipmicfg-1.20.0 if it's just one file and not a tarball). It sounds like most of the problems you're having is that you've got a fragment of a SPEC file and not the whole thing.
Don't build as root, let it build in your homedir (or use mock, but lets leave that until you've got a basic RPM building). There's absolutely no reason you should be building RPMs as root.
Jonathan Billings wrote:
On Wed, Dec 27, 2017 at 06:09:21PM -0500, m.roth@5-cent.us wrote:
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
You're missing a lot of package metadata in your spec file.
I suggest starting over, install rpmdevtools, use:
rpmdev-newspec -t minimal smipmicfg
It will create a file smipmicfg.spec, and it will be fully populated with a mimimal spec file. You can probably just remove the %build section entirely, and just use the %install section to extract the contents of the tarball (or just create the dir and copy %{SOURCE0} to %buildroot/opt/smipmicfg-1.20.0 if it's just one file and not a tarball). It sounds like most of the problems you're having is that you've got a fragment of a SPEC file and not the whole thing.
The "most of a specfile" is something I copied and hacked. Thanks, I'd seen and installed rpmdevtools, but your comments help. Much appreciated. <snip> And I'm about to take off for a long weekend, so I'll be back at this next week.
Happy New Year to all, and may the new one be better than the old (PLEASE!).
mark
On Dec 27, 2017, at 15:40, m.roth@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?
If you’re using %setup to untar your source, it needs to expand in with the directory name %name-%version in the %buildroot directory, unless you give %setup a -n parameter with what it is t expect. Not sure why you have a opt/ sub directory, the is the build root not the install root. I’m honestly not sure you can say %setup -n opt/smipmicfg-1.27.0. Are you building a package that doesn’t need to be compiled?
On 12/27/17 17:29, Jonathan Billings wrote:
On Dec 27, 2017, at 15:40, m.roth@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?
If you’re using %setup to untar your source, it needs to expand in with the directory name %name-%version in the %buildroot directory, unless you give %setup a -n parameter with what it is t expect. Not sure why you have a opt/ sub directory, the is the build root not the install root. I’m honestly not sure you can say %setup -n opt/smipmicfg-1.27.0. Are you building a package that doesn’t need to be compiled?
Right. It's just a precompiled executable and some data files (let's not go there as to why some morons would write code that *require* the datafile in the same directory as the executable... no, it's an OEM, so I have no control). And it needs to end up in /opt/smipmicfg-1.27.0. I'm still not clear on what some of the specfile directives mean, in spite of reading a lot of stuff online, so that's why some of the stuff that's probably incorrect.
mark