From 192d84417aea1869744d52572a528374fc6f6ce1 Mon Sep 17 00:00:00 2001 From: Sam Liddicott Date: Fri, 7 Nov 2008 15:39:43 +0000 Subject: [PATCH] Use srpm building tools Builds an RPM with a specified revision as the source tar.gz and additional changes as patches make srpms make samba-srpm make talloc-srpm make tdb-srpm with optinal arguments; To select the revision to build an RPM for REVISION=[ HEAD | LOCAL | sha1 | TAG ] (Local means HEAD + uncomitted changes) To select the revision to be used for the main tar.gz ORIGIN=[HEAD | sha1 | TAG ] Let it guess which revision to use for the main tar.gz ORIGIN_PATTERN=[ glob | release-4*alpha* ] --- packaging4/Fedora/cplusplus-headers.patch | 4 +-- packaging4/Fedora/samba4.spec | 60 +++++++++++++++++-------------- packaging4/utils/make-srpm | 7 +++- source4/Makefile | 41 +++++++++++++++++++++ 4 files changed, 83 insertions(+), 29 deletions(-) diff --git a/packaging4/Fedora/cplusplus-headers.patch b/packaging4/Fedora/cplusplus-headers.patch index ce05f545991..ae60c6f132a 100644 --- a/packaging4/Fedora/cplusplus-headers.patch +++ b/packaging4/Fedora/cplusplus-headers.patch @@ -1,6 +1,6 @@ diff -Naur samba-4.0.0alpha5-orig/source/lib/events/events.h samba-4.0.0alpha5/source/lib/events/events.h ---- samba-4.0.0alpha5-orig/source/lib/events/events.h 2008-06-30 19:34:11.000000000 +1000 -+++ samba-4.0.0alpha5/source/lib/events/events.h 2008-07-25 20:02:56.000000000 +1000 +--- samba-4.0.0alpha5-orig/source4/lib/events/events.h 2008-06-30 19:34:11.000000000 +1000 ++++ samba-4.0.0alpha5/source4/lib/events/events.h 2008-07-25 20:02:56.000000000 +1000 @@ -53,24 +53,24 @@ struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx, diff --git a/packaging4/Fedora/samba4.spec b/packaging4/Fedora/samba4.spec index dfdd36811ba..50ecbac4512 100644 --- a/packaging4/Fedora/samba4.spec +++ b/packaging4/Fedora/samba4.spec @@ -3,6 +3,7 @@ %define alpha_version 5 %define samba_version 4.0.0alpha%{alpha_version} %define tarball_name samba-4.0.0alpha%{alpha_version} +%define version_info unknown #Set what versions we require for tdb and talloc %define tdb_version 1.1.1 @@ -37,7 +38,8 @@ Requires(pre): /usr/sbin/groupadd Requires(post): /sbin/chkconfig, /sbin/service Requires(preun): /sbin/chkconfig, /sbin/service BuildRequires: pam-devel, readline-devel, ncurses-devel, libacl-devel, e2fsprogs-devel -BuildRequires: popt-devel, libattr-devel, libaio-devel, sed +#BuildRequires: popt-devel +BuildRequires: libattr-devel, libaio-devel, sed BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: libtalloc-devel >= %{talloc_version} BuildRequires: libtdb-devel >= %{tdb_version} @@ -126,17 +128,19 @@ domains and to use Windows user and group accounts on Linux. # Upstream patches %patch0 -p1 -b . -mv source/VERSION source/VERSION.orig -sed -e 's/SAMBA_VERSION_VENDOR_SUFFIX=$/&%{release}/' < source/VERSION.orig > source/VERSION -cd source -script/mkversion.sh +mv source4/VERSION source4/VERSION.orig +sed -e 's/SAMBA_VERSION_VENDOR_SUFFIX=$/&%{release}/' < source4/VERSION.orig > source4/VERSION +cd source4 +GIT_INFO="%version_info" script/mkversion.sh cd .. %build -cd source +cd source4 +test -r ./configure || ./autogen.sh %configure \ --with-fhs \ + --enable-fhs \ --with-lockdir=/var/lib/%{name} \ --with-piddir=/var/run \ --with-privatedir=/var/lib/%{name}/private \ @@ -157,7 +161,7 @@ make everything %install rm -rf $RPM_BUILD_ROOT -cd source +cd source4 #Don't call 'make install' as we want to call out to the PIDL install manually make install DESTDIR=%{buildroot} @@ -166,15 +170,15 @@ make install DESTDIR=%{buildroot} rm -rf $RPM_BUILD_ROOT/%{_libdir}/perl5 rm -rf $RPM_BUILD_ROOT/%{_datadir}/perl5 +cd .. + #Install PIDL -( cd pidl && make install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT ) +( cd pidl && make install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT/ ) #Clean out crap left behind by the Pidl install find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; -cd .. - mkdir -p $RPM_BUILD_ROOT/%{_initrddir} mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name} @@ -206,27 +210,30 @@ mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir} install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} #clean out some stuff we don't want in the Fedora package -rm $RPM_BUILD_ROOT/%{_bindir}/autoidl.py* -rm $RPM_BUILD_ROOT/%{_bindir}/epdump.py* -rm $RPM_BUILD_ROOT/%{_bindir}/gentest -rm $RPM_BUILD_ROOT/%{_bindir}/locktest -rm $RPM_BUILD_ROOT/%{_bindir}/masktest -rm $RPM_BUILD_ROOT/%{_bindir}/minschema.py* -rm $RPM_BUILD_ROOT/%{_bindir}/rpcclient -rm $RPM_BUILD_ROOT/%{_bindir}/samba3dump -rm $RPM_BUILD_ROOT/%{_bindir}/setnttoken -rm $RPM_BUILD_ROOT/%{_bindir}/getntacl -rm $RPM_BUILD_ROOT/%{_datadir}/samba/js/base.js +rm -f $RPM_BUILD_ROOT/%{_bindir}/autoidl* +rm -f $RPM_BUILD_ROOT/%{_bindir}/epdump* +rm -f $RPM_BUILD_ROOT/%{_bindir}/gentest +rm -f $RPM_BUILD_ROOT/%{_bindir}/locktest +rm -f $RPM_BUILD_ROOT/%{_bindir}/masktest +rm -f $RPM_BUILD_ROOT/%{_bindir}/minschema* +rm -f $RPM_BUILD_ROOT/%{_bindir}/rpcclient +rm -f $RPM_BUILD_ROOT/%{_bindir}/samba3dump +rm -f $RPM_BUILD_ROOT/%{_bindir}/setnttoken +rm -f $RPM_BUILD_ROOT/%{_bindir}/getntacl +rm -f $RPM_BUILD_ROOT/%{_datadir}/samba/js/base.js + +# Whats this doing here? +rm -fr $RPM_BUILD_ROOT/perl5/ #This makes the right links, as rpmlint requires that the #ldconfig-created links be recorded in the RPM. /sbin/ldconfig -N -n $RPM_BUILD_ROOT/%{_libdir} #Fix up permission on perl install -%{_fixperms} $RPM_BUILD_ROOT/%{perl_vendorlib} +%{_fixperms} $RPM_BUILD_ROOT/%{perl_sitelib} #Fix up permissions in source tree, for debuginfo -find source/heimdal -type f | xargs chmod -x +find source4/heimdal -type f | xargs chmod -x %clean rm -rf $RPM_BUILD_ROOT @@ -256,7 +263,7 @@ exit 0 %files %defattr(-,root,root) -%{_sbindir}/smbd +%{_sbindir}/samba %{_bindir}/smbstatus %attr(755,root,root) %{_initrddir}/%{name} @@ -270,7 +277,7 @@ exit 0 %files libs %defattr(-,root,root) -%doc WHATSNEW.txt NEWS PFIF.txt +%doc WHATSNEW.txt source4/NEWS PFIF.txt %dir %{_datadir}/samba %{_datadir}/samba/*.dat %{_libdir}/*.so.* @@ -314,7 +321,7 @@ exit 0 %files pidl %defattr(-,root,root,-) -%{perl_vendorlib}/* +%{perl_sitelib}/* %{_mandir}/man1/pidl* %{_mandir}/man3/Parse* %attr(755,root,root) %{_bindir}/pidl @@ -327,6 +334,7 @@ exit 0 %files common %defattr(-,root,root) +#%{_bindir}/mymachinepw %{_bindir}/net %{_bindir}/testparm %{_bindir}/ldbadd diff --git a/packaging4/utils/make-srpm b/packaging4/utils/make-srpm index 3a37a2d4b6c..3feedba45c8 100644 --- a/packaging4/utils/make-srpm +++ b/packaging4/utils/make-srpm @@ -215,7 +215,12 @@ mkdir -p "$TMPDIR" for spec in "$@" do ( - # find a spec file if one is not specified + # fixup relative paths to what PWD was when we launched + case "$spec" in + /*) ;; + *) spec="$BASED/$spec";; + esac + case "$spec" in *.spec.in) test -z "$SPECIN" && SPECIN="$spec";; *.spec) test -z "$SPEC" && SPEC="$spec";; diff --git a/source4/Makefile b/source4/Makefile index 38eb0706c9e..d6f964790ec 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -306,3 +306,44 @@ include $(srcdir)/selftest/config.mk showflags:: @echo ' pwd = '`/bin/pwd` + +RPM_SPEC_TEMPLATE=packaging4/Fedora/samba4.spec +# git -l type glob to detect tagged releases +ORIGIN_PATTERN="release-4*alpha*" +# because of the great git-refactor there are no tags in the current head, so +# don't let it look for recent tags as ORIGIN or fallback to tags if RELEASE is not set +ORIGIN=91643773b8ff0727b40a230b7c41288f57e6a9cb +MAIN_RELEASE=5 + +srpm: talloc-srpm tdb-srpm samba-srpm + +talloc-srpm:: + bash ../packaging4/utils/make-srpm ../lib/talloc/talloc.spec + +tdb-srpm:: + bash ../packaging4/utils/make-srpm ../lib/tdb/tdb.spec + +samba-srpm:: + # RELEASE specifies a commit or tag that we want to build an SRPM for. + # The special value LOCAL means local uncomitted changes in contrast to HEAD + # If RELEASE isn't specified, default to latest tagged release matching RELEASE_PATTERN + # GIT_INFO is the various git attributes for a given release and will be passed to + # mkversion.sh now and at build-time + ORIGIN=$(ORIGIN); RELEASE=$(RELEASE) ; test -z "$$RELEASE" && RELEASE="$${ORIGIN:-`git tag -l $(ORIGIN_PATTERN) | sort -r | head -1`}" ; \ + _RELEASE="$$RELEASE" ; test "$$_RELEASE" = "LOCAL" && _RELEASE="HEAD"; \ + GIT_INFO="`git show --pretty=format:"%h %ct %H %cd" $${_RELEASE:-HEAD}^{commit} 2>/dev/null | head -1`"; \ + VERSION_FILE="VERSION.$$RELEASE"; git show $$_RELEASE:source4/VERSION > $$VERSION_FILE || exit 1; \ + VERSION="`RPM_GIT_INFO="$$GIT_INFO" sh script/mkversion.sh "$$VERSION_FILE" /dev/stdout | sed -e '/^SAMBA_VERSION_STRING[ =]/!d;s/^.*VERSION_STRING[ =]*"*-*//;s/[" ].*//;q'`"; \ + rm -f "$$VERSION_FILE"; \ + echo "Make samba-srpm release $$RELEASE, Version $$VERSION, Git $$GIT_INFO"; \ + bash -x ../packaging4/utils/make-srpm \ + ORIGIN_PATTERN="$(ORIGIN_PATTERN)" $${ORIGIN:+"ORIGIN=$$ORIGIN"} \ + VERSION_INFO="$$GIT_INFO" \ + VERSION=$$VERSION \ + RELEASE="$$RELEASE" \ + define_samba_version="$$VERSION" \ + define_alpha_version="`echo "$$VERSION" | sed -e "s/.*alpha//"`" \ + define_main_release=$(MAIN_RELEASE) \ + define_tarball_name='%makesrpm_tarprefix' \ + define_git_info="$$GIT_INFO" \ + "$(RPM_SPEC_TEMPLATE)" -- 2.11.4.GIT