packaging: add a simple 'make rpm' (#3)

Summary: Pull Request resolved: https://github.com/facebook/sapling-staging/pull/3

Reviewed By: bolinfest

Differential Revision: D39072060

fbshipit-source-id: bb7a207fade4d3b717a1cf2ff6c68542d2da6e84
This commit is contained in:
Durham Goode 2022-08-29 09:46:43 -07:00 committed by Facebook GitHub Bot
parent 0ff247bc9f
commit 2e3ca8b5fa
3 changed files with 54 additions and 1 deletions

View File

@ -113,6 +113,12 @@ deb:
dpkg-deb --build --root-owner-group install
dpkg-name install.deb
rpm:
rpmbuild \
--define "sapling_root `pwd`" \
--define "version $(VERSION)" \
-bb packaging/rpm/sapling.spec
wheel:
FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)

View File

@ -0,0 +1,45 @@
%define py_version 3.8
%define py_version_num 38
%define py_usr_dir /usr
%define __python python3.8
%if 0%{?fedora}
%define os_release fc29
%else
%define os_release el
%endif
%undefine __brp_mangle_shebangs
Summary: Sapling
Name: sapling
Version: %version
Release: %{os_release}
License: GPLv2+
Group: Development/Tools
Requires: python%{py_version}
%description
A source control system.
%prep
%build
%install
cd "%{sapling_root}"
make DESTDIR="$RPM_BUILD_ROOT" PREFIX="%{_prefix}" install-oss
%post
%clean
rm -rf "$RPM_BUILD_ROOT"
%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/*
%changelog

View File

@ -522,7 +522,9 @@ void print_buildinfo() {
# If NEED_BUILDINFO is set, write buildinfo.
# For rpmbuild, imply NEED_BUILDINFO.
needbuildinfo = bool(os.environ.get("NEED_BUILDINFO", "RPM_PACKAGE_NAME" in os.environ))
needbuildinfo = bool(
os.environ.get("NEED_BUILDINFO", "RPM_PACKAGE_NAME" in os.environ and not ossbuild)
)
if needbuildinfo:
buildinfocpath = writebuildinfoc()