I'm trying to build a new rpm package for CentOS 6. Using my spec file I'm able to build src.rpm but for some reason I`m not able to create rpm binary file.
This is my spec file:
Name: mc
Version: 4.8.11
Release: 1%{?dist}
Summary: Midnight Commander
Group: System Environment/Base
License: GPLv2
URL: http://ftp.midnight-commander.org/mc-4.8.11.tar.bz2
Source0: mc-4.8.11.tar.bz2
Buildroot: <dir>
BuildRequires: glibc-utils
Requires: sland
%description
This is simply file manager for linux.
%prep
%setup -q
%build
%configure
make %{?_smp_mflags}
%check
make check
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
install -m 755 -d $RPM_BUILD_ROOT/%{_sbindir}
ln -s /home/rpmbuilder/bin/mckonrad $RPM_BUILD_ROOT/%{_sbindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc
%changelog
rpmlint command showing this:
[rpmbuilder#localhost SPECS]$ rpmlint mc.spec
mc.spec: W: invalid-url Source0: mc-4.8.11.tar.bz2
0 packages and 1 specfiles checked; 0 errors, 1 warnings.
[rpmbuilder#localhost SPECS]$
I executed command:
rpmbuild -bb mc.spec
and I cannot find *.rpm file in RPMS folder.
I suspect that something is wrong with my mc.spec file.
Would be perfect is somebody could help me.
You have no entries in the %files section of your spec file.
Try adding an entry in %files and then rebuilding.
Related
I'm trying to build an rpm from source-1.4.3-linux.tgz (that is downloaded so I don't control the name) and the file untars into the directory source-1.4.3-linux. In my source.spec file, I have
Name: source
Version: 1.4.3
So it is probably quite logical that I am getting an error:
cd: source-1.4.3: No such file or directory.
I tried tacking -linux onto the version, but rpmbuild wants only a number there. What do I have to do to tell rpmbuild that the source files are untarred into source-1.4.3-linux?
Just use the setup macro.
setup -n %{name}-%{version}.linux
Here is a simple.spec file that would help you understand the issue. Source tarball contains the following:
$ tar tzf simple-0.tar.gz
simple-0/
simple-0/simple.txt
Spec file:
Summary: Simple SPEC
Name: simple
Version: 0
Release: 1
License: NONE
Group: NONE
URL: NONE
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
" This is Simple "
%prep
%setup -q
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/tmp/
install -m 0644 simple.txt %{buildroot}/tmp/simple.txt
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo "In the Post section of Simple"
%files
%defattr(-,root,root,-)
%doc
/tmp/simple.txt
%changelog
* Wed Sep 12 2018 <iamauser#localdomain> -
- Initial build.
ok I got this working. Maybe a hack but it is working. As per the question my tarball is unconventionally named.
$ tar tzf source-1.4.3-linux-amd64.tar.gz
source-1.4.3-linux-amd64/
source-1.4.3-linux-amd64/simple.txt
in the specfile %prep section instead of using %setup or %autosetup, I unpacked manually and renamed the untarred directory.
Name: source
Version: 1.4.3
Release: 0
Source0: https://example.com/%{name}-%{version}-linux-amd64.tar.bz2
%prep
rm -fr %{name}-%{version}
tar -xjf %{SOURCE0}
mv %{name}-%{version}-linux-amd64 %{name}-%{version}
I have written spec file just copy some files to some directory on CentOS7.
...(snip)...
%prep
%setup -q
%build
%install
install -m 644 -p $RPM_SOURCE_DIR/some/file \
$RPM_BUILD_ROOT%{_sysconfdir}/file
%clean
rm -rf $RPM_BUILD_ROOT
%files
%doc
%config(noreplace) %{_sysconfdir}/some/file
--------
$ cd rpmbuild
$ rpmbuild SPECS/my.spec
...(snip)...
+ ./configure --build=x86_64 ...
/var/tmp/rpm-tmp.RidAmi: line41: ./configure: No such file or directory
I have not written ./configure ... anywhere.
I don't know why rpmbuild fails.
I found an answer here.
Looks like deleting %build line.
https://www.centos.org/forums/viewtopic.php?t=51254
When I tried to make a link inside the rules file it didn't allow me.How can I make it?
Here is what I did.
#!/usr/bin/make -f
icon = $(CURDIR)/frontpage.png
script = $(CURDIR)/guilotinga.py
launcher = $(CURDIR)/internation.desktop
DEST1 = $(CURDIR)/debian/internation/usr/share/internation
DEST2 = $(CURDIR)/debian/internation/usr/share/applications
build: build-stamp
build-stamp:
dh_testdir
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp
dh_clean
install: build clean $(icon) $(script) $(launcher)
dh_testdir
dh_testroot
dh_prep
dh_installdirs
mkdir -m 755 -p $(DEST1)
mkdir -m 755 -p $(DEST2)
install -m 666 $(icon) $(DEST1)
install -m 777 $(script) $(DEST1)
install -m 777 $(launcher) $(DEST2)
ln -s usr/share/internation/guilotinga.py /usr/bin/internation
(That's where I stopped)
The line above is giving error saying I don't have enough privileges.What was my fault?
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_installman
dh_link
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary-arch: build install
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
I'm assuming that what you wanted was to make a symlink to /usr/bin/internation, and have the link show up as /usr/share/internation/guilotinga.py when the package is installed. If so, you're just giving the link command backwards. You want
ln -s /usr/bin/internation usr/share/internation/guilotinga.py
As a further note, though, symlinks in Debian packages should not ever be absolute, unless you're symlinking one toplevel directory to another (see Debian Policy section 10.5).
In your case, you probably don't need to change anything, since you have a call to dh_link in your build script. That tool will automatically fix noncompliant symlinks in the package build area (unless you're running in a super-ancient debhelper compat mode).
But if you want to avoid potentially confusing readers (or yourself), perhaps you ought to do
ln -s ../../bin/internation usr/share/internation/guilotinga.py
I am packaging a very simple rpm of a redmine plugin, for internal use, and I am stuck with a "Package has no %description:" error.
The .spec has a description and I couldn't find anything relevant on the inet. Here goes my .spec:
codeName: redmine_knowledgebase
Version: 2.2.1
Release: 1%{?dist}
Summary: Redmine plugin to add knowledgbase functionality
Group: redmine-plugins
License: MIT
URL: https://github.com/alexbevi/redmine_knowledgebase
Source0: redmine_knowledgebase.tar.gz
BuildRoot: %(mktemp -ud %{tmp/%{name}-%{version}-%{release})
BuildRequires:
Requires: redmine, ruby, rubygems
%description
Redmine plugin to add knowledgbase functionality
%prep
%setup -q -n redmine_knowledgebase
%build
%install
rm -rf %{buildroot}
install -m 0755 / /var/www/redmine/plugins/
bundle install
rake redmine:plugins:migrate NAME=redmine_knowledgebase
%clean
rm -rf %{buildroot}
%files
%defattr(-,apache,apache,-)
/var/www/redmine/plugins/*
%post
echo " "
echo "This will display after rpm installs the package!"
echo "If the plugin does not work, check the permissions ans ownership of the newly created ../redmine/plugins/redmine_knowledgebase"
rpmlint gives me the following errors:
rpmlint ../SPECS/redmine_knowledgebase.spec
../SPECS/redmine_knowledgebase.spec:5: W: non-standard-group redmine-plugins
../SPECS/redmine_knowledgebase.spec: E: specfile-error error: Package has no %description: redmine_knowledgebase
../SPECS/redmine_knowledgebase.spec: E: specfile-error error: query of specfile ../SPECS/redmine_knowledgebase.spec failed, can't parse
0 packages and 1 specfiles checked; 2 errors, 1 warnings
Apparently "Package has no %description" pops up when an unidentified error occurs.
I solved this by formatting better the .spec:
-I have given a path to source0
-I have provided a BuildRequired package (anything will do, I put gcc in there)
-I have fixed indentation to use only tabs
Perhaps it's because your braces are not balanced?
BuildRoot: %(mktemp -ud %{tmp/%{name}-%{version}-%{release})
Balanced:
BuildRoot: %(mktemp -ud %{tmp}/%{name}-%{version}-%{release})
I'm trying to build my first RPM, but getting an error. My .rpmmarcos files looks like this:
%packager Your Name
%_topdir /home/snort/test
%_tmppath /home/snort/test/tmp
%_smp_mflags -j3
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
When I run: "rpmbuild -v -bb SPECS/test.spec" I receive this error:
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd test-1
/home/snort/test/tmp/rpm-tmp.55712: line 36: cd: test-1: No such file or directory
error: Bad exit status from /home/snort/test/tmp/rpm-tmp.55712 (%prep)
File rpm-tmp.55712 ends with this:
cd '/home/snort/test/BUILD'
rm -rf 'test-1'
/bin/gzip -dc '/home/snort/test/SOURCES/test-1.c55.tar.gz' | tar -xvvf -
STATUS=$?
if [ $STATUS -ne 0 ]; then
exit $STATUS
fi
cd 'test-1'
I'm guessing rpmbuild does the "rm -rf 'test-1'" to remove any old/un-needed directories, then it untar's the test-1.c55.tar.gz file, then tries to "cd test-1" but the untar command doesn't make the directory so the scripts errors out. I'm not sure what to do now.
My spec file: more SPECS/test.spec
Name: test
Version: 1
Release: .c55
Summary: Just a Test
Group: MyJunk
License: GPL
URL: http://www.somesite.com
Source0: test-1.c55.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
This is just a test
<br>
%prep
%setup BUILD
%build<br>
%configure<br>
make %{?_smp_mflags}<br>
%install<br>
rm -rf $RPM_BUILD_ROOT<br>
make install DESTDIR=$RPM_BUILD_ROOT
<br>
%clean<br>
rm -rf $RPM_BUILD_ROOT<br>
%files
%defattr(-,root,root,-)
%doc
%changelog
Any ideas?
Thanks for the Help
Gary
RPM (or, to be exact, %setup macro) expects your source tarbal test-1.c55.... to contain the directory test-1.
If the directory there is different, you can fix that by using
%setup -n yourdir
See http://www.rpm.org/max-rpm/s1-rpm-inside-macros.html for more details.