Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM packaging via CPack #310

Merged
merged 4 commits into from
Aug 15, 2020
Merged

RPM packaging via CPack #310

merged 4 commits into from
Aug 15, 2020

Conversation

traceon
Copy link
Collaborator

@traceon traceon commented Aug 7, 2020

Closes #238

@traceon traceon marked this pull request as draft August 7, 2020 21:24
@traceon traceon requested a review from filimonov August 7, 2020 21:25
@filimonov
Copy link
Collaborator

Can you upload somewhere the resulting spec file to review / rpm to test?

@filimonov
Copy link
Collaborator

BTW to build rpm some extra flag should be passed?

@traceon
Copy link
Collaborator Author

traceon commented Aug 8, 2020

BTW to build rpm some extra flag should be passed?

No, the same cmake --build . --config RelWithDebInfo --target package will work.

@traceon
Copy link
Collaborator Author

traceon commented Aug 8, 2020

Can you upload somewhere the resulting spec file to review / rpm to test?

Here is the generated specs file:

# Restore old style debuginfo creation for rpm >= 4.14.
%undefine _debugsource_packages
%undefine _debuginfo_subpackages

# -*- rpm-spec -*-
BuildRoot:      %_topdir/clickhouse-odbc-1.1.8-Linux
Summary:        ClickHouse ODBC Driver (64-bit)
Name:           clickhouse-odbc
Version:        1.1.8
Release:        1%{?dist}
License:        ASL 2.0
Group:          Applications/Databases
Vendor:         Yandex LLC

Url: https://github.com/ClickHouse/clickhouse-odbc
Requires: unixODBC












Prefix: /usr/local





%define _rpmdir %_topdir/RPMS
%define _srcrpmdir %_topdir/SRPMS

%define _unpackaged_files_terminate_build 0


%define _binary_payload w9.gzdio

%description
The official ODBC driver implementation for accessing ClickHouse as a data source.

# This is a shortcutted spec file generated by CMake RPM generator
# we skip _install step because CPack does that for us.
# We do only save CPack installed tree in _prepr
# and then restore it in build.
%prep
mv $RPM_BUILD_ROOT %_topdir/tmpBBroot

%install
if [ -e $RPM_BUILD_ROOT ];
then
  rm -rf $RPM_BUILD_ROOT
fi
mv %_topdir/tmpBBroot $RPM_BUILD_ROOT



%clean

%post



%postun


%pre


%preun


%files
%defattr(-,root,root,-)
%dir "/usr/local"
%dir "/usr/local/lib64"
"/usr/local/lib64/libclickhouseodbc.so"
"/usr/local/lib64/libclickhouseodbcw.so"
%dir "/usr/local/share"
%dir "/usr/local/share/doc"
%dir "/usr/local/share/doc/clickhouse-odbc"
%dir "/usr/local/share/doc/clickhouse-odbc/config"
"/usr/local/share/doc/clickhouse-odbc/config/clickhouse-odbc.tdc.sample"
"/usr/local/share/doc/clickhouse-odbc/config/odbc.ini.sample"
"/usr/local/share/doc/clickhouse-odbc/config/odbcinst.ini.sample"




%changelog



@filimonov
Copy link
Collaborator

Should we add to deps: openssl libicu libtool-ltdl
?

Also spec from Vlad had this (not sure if needed)
https://github.com/Altinity/clickhouse-odbc-rpm/blob/3eb2b5996074de45f347bdad6517de1971639ee0/src/clickhouse.spec.in#L88

@traceon
Copy link
Collaborator Author

traceon commented Aug 8, 2020

Should we add to deps: openssl libicu libtool-ltdl?

No, because the RPM builder detects such dependencies automatically, and this is very convenient, because we don't want to depend on them if we actually don't link with them dynamically.

@traceon
Copy link
Collaborator Author

traceon commented Aug 8, 2020

Also spec from Vlad had this (not sure if needed)
https://github.com/Altinity/clickhouse-odbc-rpm/blob/3eb2b5996074de45f347bdad6517de1971639ee0/src/clickhouse.spec.in#L88

I don't think this is necessary, because ODBC drivers are loaded by ODBC driver manager code usually explicitly by dlopen()'ing them using absolute file path from odbcinst.ini.

@filimonov
Copy link
Collaborator

filimonov commented Aug 8, 2020

+1. Also that correpsonds to best practicies listed in https://docs.fedoraproject.org/en-US/packaging-guidelines/

Fix descriptions of the project and for packages
Add odbcinst example to README.md
Fix warnings in cmake find modules
Fix packaging prefix
@traceon traceon marked this pull request as ready for review August 8, 2020 13:30
Copy link
Collaborator

@filimonov filimonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Tested in docker. Much better and simpler than before! :)

A bit questionable part - paths in /usr/local (best practices for fedore not recommend using that in rpm).
And adding abs. path in sample files. (discussed in chat).

@traceon traceon merged commit 41201cd into ClickHouse:master Aug 15, 2020
@traceon traceon deleted the rpm-generation branch August 20, 2020 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement RPM packaging via cpack
2 participants