Build a package in copr

Dear all,

I am trying to install a program called QtiPlot in my f30 system. Since I need this program a lot, I decided to make a repository in copr. I am completely new to building packages so I read the following articles

  1. https://docs.pagure.org/copr.copr/user_documentation.html
  2. https://pagure.io/rpkg-util
  3. https://fedoraproject.org/wiki/How_to_create_a_GNU_Hello_RPM_package

So at the moment I have created the repository thanos/qtiplot and then I guess I need to build the .spec file, however I don’t know how to do it. I can write the first lines as follows

Name:           QiPlot
Version:        0.9.8.9
Release:        1%{?dist}
Summary:       A data analysis and plotting software

but I don’t know what to add in the source section. I do have the source files (qtiplot-0.9.8.9.tar.bz2) but in corp I can only upload either srpm or .spec files. I guess that I can just add the following

+Source: qtiplot-0.9.8.9.tar.bz2

but this means that I have to upload somewhere the .tar.bz2 file. I am wondering if I am missing something essential here, so any idea would be much appreciated!

Thanks in advance!

Hi @thanos, I’m pretty new to packaging too.
But what you need to do, is to build the RPM locally, then upload the source RPM to copr.

But supposing that Source contains an URL, you can also build the package on copr uploading only the spec file.

So you could upload qtiplot-0.9.8.9.tar.bz2 on a publicy accessible place on internet, and modify the spec file accordingly.
Or better: put the original URL of the source file in the spec file. QtiPlot is hosted on sourceforge, right?

Thank you very much for your reply.
Indeed the source code is in sourceforge.

So I edited the .spec file and now it looks like that

Summary:	Data analysis and scientific plotting
Name:		qtiplot
Version:	0.9.8.9
Release:	1%{?dist}
License:	GPLv2+
Group:		Sciences/Other
Source0:	https://sourceforge.net/projects/qtiplot.berlios/files/qtiplot-0.9.8.9.tar.bz2

BuildRequires:	qt4-devel >= 4.4.0
BuildRequires:	qt-assistant-adp-devel
BuildRequires:	gsl-devel
BuildRequires:	icoutils
BuildRequires:	muParser-devel >= 1.32
BuildRequires:	python-qt4 >= 4.4.4
BuildRequires:	docbook-utils
BuildRequires:	docbook-dtd44-xml
BuildRequires:	pkgconfig(glu)
BuildRequires:  libpng-devel
BuildRequires:  boost-devel
Requires:	qt-assistant-adp
Requires:	python-qt4 >= 4.4.4
Requires:	python(abi) = 2.7

%description
Software for data analysis and plotting.
Linux equivalent to Origin.

I am aware that it’s not yet fully ready, but how do I continue?

I know that I have to add the %build and %install commands. This implies that I have build it at least one on the same system, so I know which commands to follow, right? And if this is the case, if I want to create rpms for various distributions, I have to have these distributions! Am I missing something?

Hi @thanos , cool that your are trying do a .rpm to this app, i don’t know nothing about build .rpm but reading your link:

And looking this video (just replace yum for dnf)


Maybe is enough to creat a first build. About your question about other distributions I think you just need that dependecies /libraries are presents in the distribution what you will do intalation, and the called of them from the route of installation is the same. (but someone should confirme it, I am not sure 100%)

I hope the video can help you at leats a bit.

Regards.

Thank you very much for your reply!
It helped a bit, as a tutorial.

So I followed the instructions and made the following spec file

Name:           qtiplot
Version:        0.9.8.9
Release:        1%{?dist}
Summary:        Data analysis and scientific plotting

License:        GPLv2+
URL:            https://www.qtiplot.com
Source0:        %{name}-%{version}.tar.bz2

BuildRequires:	qt4-devel >= 4.4.0
BuildRequires:	qt-assistant-adp-devel
BuildRequires:	gsl-devel
BuildRequires:	icoutils
BuildRequires:	muParser-devel >= 1.32
BuildRequires:	python-qt4 >= 4.4.4
BuildRequires:	docbook-utils
BuildRequires:	docbook-dtd44-xml
BuildRequires:	pkgconfig(glu)
BuildRequires:  libpng-devel
BuildRequires:  boost-devel
Requires:	    qt-assistant-adp
Requires:	    python-qt4 >= 4.4.4
Requires:	    python(abi) = 2.7     

%description
Software for data analysis and plotting.
Linux equivalent to Origin.


%prep
%autosetup


%build
%configure
%make_build


%install
rm -rf $RPM_BUILD_ROOT
%make_install


%files
%license gpl_licence.txt
/usr/bin/%{name}



%changelog
* Thu Oct 31 2019 Athanasios Stamatopoulos <athanasios.stamamatopoulos@cern.ch> %{version}-1
- Initial package for Fedora.

However when I execute rpmbuild -ba qtiplot.spec I get the following output

[astamato@dhcp016 SPECS]$ rpmbuild -ba qtiplot.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.1H0zTc
+ umask 022
+ cd /home/astamato/rpmbuild/BUILD
+ cd /home/astamato/rpmbuild/BUILD
+ rm -rf qtiplot-0.9.8.9
+ /usr/bin/bzip2 -dc /home/astamato/rpmbuild/SOURCES/qtiplot-0.9.8.9.tar.bz2
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd qtiplot-0.9.8.9
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.5BUoYH
+ umask 022
+ cd /home/astamato/rpmbuild/BUILD
+ cd qtiplot-0.9.8.9
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
+ export FFLAGS
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
+ export FCFLAGS
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
+ export LDFLAGS
+ '[' 1 = 1 ']'
+++ dirname ./configure
++ find . -name config.guess -o -name config.sub
+ '[' 1 = 1 ']'
+ '[' x '!=' 'x-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' ']'
++ find . -name ltmain.sh
+ ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
/var/tmp/rpm-tmp.5BUoYH: line 45: ./configure: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.5BUoYH (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.5BUoYH (%build)

So I don’t really understand what is the issue… I understand that it tries to find a configure executable but how am I supposed to create it?

Thanks in advance!

Nice that it did help a bit. Look this link maybe it help you to solve the issue too.

They talked about double comment the line of config. Maybe someone can help with it too.

Regards

@xtym Thank you very much for your help and time!
Searching in google I found the following .spec file that builds QtiPlot

https://copr-dist-git.fedorainfracloud.org/cgit/scorpionit/qtiplot/qtiplot.git/commit/?id=59b0ca58be0c89edfb61d5369f533f8ba2d88422

So I copied the .spec and now it looks like the following

Name:           qtiplot
Version:        0.9.8.9
Release:        1%{?dist}
Summary:        Data analysis and scientific plotting

License:        GPLv2+
URL:            https://www.qtiplot.com
Source0:        %{name}-%{version}.tar.bz2
Source1:	    tamuanova_0.2.orig.tar.gz
Source2:	    build.conf
Source3:        qtiplot.png

BuildRequires:	qt4-devel >= 4.4.0
BuildRequires:	qt-assistant-adp-devel
BuildRequires:	gsl-devel
BuildRequires:	icoutils
BuildRequires:	muParser-devel >= 1.32
BuildRequires:	python-qt4 >= 4.4.4
BuildRequires:	docbook-utils
BuildRequires:	docbook-dtd44-xml
BuildRequires:	pkgconfig(glu)
BuildRequires:  libpng-devel
BuildRequires:  boost-devel
Requires:	    qt-assistant-adp
Requires:	    python-qt4 >= 4.4.4
Requires:	    python(abi) = 2.7     

%description
Software for data analysis and plotting.
Linux equivalent to Origin.


%prep
%setup -q
pushd 3rdparty
tar xf %{SOURCE1}
mv tamu_anova-0.2 tamu_anova
popd

#cp build.conf.example build.conf
#sed -i 's|@LIBDIR@|%{_libdir}|g;s|@INCLUDEDIR@|%{_includedir}|g' build.conf


%build
pushd 3rdparty/tamu_anova
%configure --disable-shared --enable-static
%{__make}
popd
qmake-qt4 -d \
	%if "%{_lib}" != "lib"
		libsuff=64 \
	%endif
	-o Makefile
%{__make}


%install
make install INSTALL_ROOT=%{buildroot}

mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/mandriva-%{name}.desktop << EOF
[Desktop Entry]
Name=QtiPlot
Comment=Data analysis and scientific plotting
Exec=qtiplot
Icon=qtiplot
Terminal=false
Type=Application
Categories=Qt;Science;DataVisualization;
StartupNotify=true
EOF

mkdir -p %{buildroot}%{_datadir}/pixmaps
install -m 644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/

rm -fr %{buildroot}/usr/local

# Nuke the junk
find %{buildroot} -name libqwtplot3d.a -delete

%files
%defattr(644,root,root,755)
%doc README.md LICENSE
%attr(755,root,root) %{_bindir}/qtiplot
%{_mandir}/man1/qtiplot.1.*
%{_libdir}/qtiplot/plugins
%{_datadir}/*


%changelog
* Thu Oct 31 2019 Athanasios Stamatopoulos <athanasios.stamamatopoulos@cern.ch> %{version}-1
- Initial package for Fedora.

So when I run rpmbuild -ba qtiplot.spec I get the following error

make[1]: *** [Makefile:8: web] Error 8
make[1]: Leaving directory ‘/home/astamato/rpmbuild/BUILD/qtiplot-0.9.8.9/manual’
make: *** [Makefile:65: sub-manual-make_default] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.x3Y8KW (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.x3Y8KW (%build)

I am not sure if it’s related to the creation of the rpm, though. To my understanding it looks like it’s trying to build and install qtiplot on my system and it gets stuck somewhere.

Any idea?

Really not idea but maybe look this post

Maybe it is related an you need install the package libuuid-devel.

I hope someone can help you a bit more
But look that is blaming the log file about errors Bad exit status from /var/tmp/rpm-tmp.x3Y8KW look into the file
Regards.

Thank you very much @xtym for your help!
I’ve installed libuuid-devel but I still get the same error.

I checked the file that you mentioned, but only the sequence of commands that were executed were listed

#!/bin/sh

  RPM_SOURCE_DIR="/home/astamato/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/home/astamato/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"
  RPM_LD_FLAGS="-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="qtiplot"
  RPM_PACKAGE_VERSION="0.9.8.9"
  RPM_PACKAGE_RELEASE="1.fc30"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/home/astamato/rpmbuild/BUILDROOT/qtiplot-0.9.8.9-1.fc30.x86_64"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  CONFIG_SITE=${CONFIG_SITE:-NONE}
  export CONFIG_SITE
  
  set -x
  umask 022
  cd "/home/astamato/rpmbuild/BUILD"
cd 'qtiplot-0.9.8.9'
pushd 3rdparty/tamu_anova

  
  CFLAGS="${CFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ; 
  LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld}" ; export LDFLAGS; 
  [ "1" = 1 ] && for i in $(find $(dirname ./configure) -name config.guess -o -name config.sub) ; do 
      [ -f /usr/lib/rpm/redhat/$(basename $i) ] && /usr/bin/rm -f $i && /usr/bin/cp -fv /usr/lib/rpm/redhat/$(basename $i) $i ; 
  done ; 
  [ "1" = 1 ] && [ x != "x-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld" ] && 
      for i in $(find . -name ltmain.sh) ; do 
        /usr/bin/sed -i.backup -e 's~compiler_flags=$~compiler_flags="-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"~' $i 
      done ; 
  ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
	--program-prefix= \
	--disable-dependency-tracking \
	 \
	--prefix=/usr \
	--exec-prefix=/usr \
	--bindir=/usr/bin \
	--sbindir=/usr/sbin \
	--sysconfdir=/etc \
	--datadir=/usr/share \
	--includedir=/usr/include \
	--libdir=/usr/lib64 \
	--libexecdir=/usr/libexec \
	--localstatedir=/var \
	--sharedstatedir=/var/lib \
	--mandir=/usr/share/man \
	--infodir=/usr/share/info --disable-shared --enable-static
/usr/bin/make
popd
qmake-qt4 -d \
		libsuff=64 \
	-o Makefile
/usr/bin/make




exit $? 

And I don’t really get where the exit $? comes from…
Any idea?

Thank you very much in advance!

Hi ;

(I have not idea :sweat_smile: about rpm build) But look likes that it is failing to pick the manual of the app, in your config the path is
%{_mandir}/man1/qtiplot.1.* which it should move the manual from /home/astamato/rpmbuild/BUILD/qtiplot-0.9.8.9/manual/ I am not sure for nothing but maybe should you have a manual file called qtiplot.1.gz (gz is the extension for gzip compression) or maybe you can use a qtiplot.1.pdz gz is the format that looks like be a standard in the folder of manuals /usr/share/man/ or /usr/share/man/man1/ what one is the one you are marking how your target. Check you do have a manual in your build path and if this solve this issue, in the other hand you can delele/skip these part that do reference to the manual.

I did find this old post if this help you :wink:
https://forums.fedoraforum.org/showthread.php?306919-INstalling-qtiplot-0-9-8-9

Regards.

This was very helpful and bizarre actually because…

[astamato@192 manual]$ ll /home/astamato/Downloads/qtiplot-0.9.8.9/manual
total 52
-rw-rw-r--. 1 astamato astamato    42 Oct 21  2010 dblatex.conf
-rw-rw-r--. 1 astamato astamato   868 Oct 21  2010 dblatex-param.xsl
drwxrwxr-x. 2 astamato astamato  4096 Nov  2  2011 docbook-en
drwxrwxr-x. 2 astamato astamato  4096 Nov  2  2011 docbook-it
-rw-rw-r--. 1 astamato astamato 13250 Oct 21  2010 help.dsl
drwxrwxr-x. 8 astamato astamato  4096 Nov  2  2011 html
-rw-rw-r--. 1 astamato astamato   492 Nov  1  2011 Makefile
-rw-rw-r--. 1 astamato astamato  2379 Oct 21  2010 qtiplot.dsl
-rw-rw-r--. 1 astamato astamato  1876 Oct 21  2010 qtiplot_html.xsl
-rw-rw-r--. 1 astamato astamato  1973 Oct 21  2010 qtiplot-style.xsl

So it seems that there is no qtiplot.1.* file…

There is one file but is in the main folder in place of the folder manual, this file is related with the manual part if you open and read it:

[jorge@fedora31 Hämtningar]$ ls ./qtiplot-0.9.8.9
3rdparty            gpl_licence.txt  qtiplot.1       README.html
build.conf.example  manual           qtiplot.css
Doxyfile            Python-Doxyfile  qtiplot_logo.png
fitPlugins          qtiplot          qtiplot.pro

Regards

Thank you very much for your answer @xtym !

Indeed I was able to see a manual directory in my build directory /home/astamato/rpmbuild/BUILD/qtiplot-0.9.8.9 and listing its comments provided the following

[astamato@pcen35240 qtiplot-0.9.8.9]$ ls manual
dblatex.conf  dblatex-param.xsl  docbook-en  docbook-it  help.dsl  html  
Makefile  qtiplot.dsl  qtiplot_html.xsl  qtiplot-style.xsl

From what I understand the build is having trouble in copying the manual in the directory %{_mandir}/man1/qtiplot.1.*.

I checked at the MakeFile of the manual and from what I understand the output file is a .pdf one

all: en pdf-it
en: web pdf
it: web-it pdf-it

# we can't name the target "html", since there is already a folder with that name
# and so make thinks this target is already up to date
web:
	docbook2html -d qtiplot.dsl docbook-en/index.docbook -e no-valid
web-it:
	docbook2html -d qtiplot.dsl docbook-it/index.docbook -e no-valid

pdf:
	dblatex -o qtiplot-manual-en.pdf -c dblatex.conf docbook-en/index.docbook
pdf-it:
	dblatex -o qtiplot-manual-it.pdf -c dblatex.conf docbook-it/index.docbook

So how can I modify the spec file in order to continue the rpm build?

Thanks ins advance!

Hi, No idea really but what happen if you move/copy the file qtiplot.1 to the path /home/astamato/Downloads/qtiplot-0.9.8.9/manual maybe it does the trick. It is the file than the build is calling for and looks like it in in the wrong place.

Regards