From ff48b6cd7b36dc0393c8cc17486e28e600e8214d Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 5 Oct 2010 15:19:21 +0200 Subject: [PATCH] provisionary, passes rpmbuild and rpmplint (more or less) --- pkg/fedora/README.fedora | 28 +------------------- pkg/fedora/diaspora.spec | 53 ++++++++++++++++++-------------------- pkg/fedora/make_dist.sh | 55 ++++++++++++++++++++++++++++++++-------- 3 files changed, 70 insertions(+), 66 deletions(-) diff --git a/pkg/fedora/README.fedora b/pkg/fedora/README.fedora index 851a5b330..a0990367e 100644 --- a/pkg/fedora/README.fedora +++ b/pkg/fedora/README.fedora @@ -1,27 +1 @@ -#Build ruby-1.8.7 on Fedora 13 -#============================ -set -x - - - -rpmdir=$(rpm --showrc | grep _rpmdir | cut -f2) -echo "Building rpms in $rpmdir" - -sudo yum install yum-utils fedora-release-rawhide - -yumdownloader --enablerepo=rawhide --source ruby -vers=$( ls ruby-*src.rpm) -vers=$(echo ${vers%.fc*}) -vers=$(echo ${vers#ruby-}) -echo "Downloaded and uding version $vers" - -sudo yum install $( rpm -q --requires -p ruby*src.rpm | grep -v rpmlib) -rpmbuild --rebuild ruby-1.8.7.302-1.fc15.src.rpm -sudo rpm -i $rpmdir/i686/ruby-$vers.i686.rpm -sudo rpm -i $rpmdir/i686/ruby-libs-$vers.i686.rpm -sudo rpm -i $rpmdir/i686/ruby-irb-$vers.i686.rpm -sudo rpm -i $rpmdir/noarch/ruby-rdoc-$rdoc.noarch.rpm - -rpmbuild --rebuild rubygems-*.src.rpm -sudo rpm -i $rpmdir/noarch/rubygems-*.noarch.rpm - +TBD diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec index 5aaa5a544..8e7a2ef39 100644 --- a/pkg/fedora/diaspora.spec +++ b/pkg/fedora/diaspora.spec @@ -7,6 +7,8 @@ # If the environment variable GIT_VERSION is set, builds an rpm # from this version (i. e., uses this commit). # + +%global debug_package %{nil} %define git_release HEAD Summary: A social network server @@ -19,10 +21,10 @@ URL: http://www.joindiaspora.com/ Vendor: joindiaspora.com Source: %{name}-%{version}-%{git_release}.tar.gz Source1: diaspora-ws -#BuildRoot: %{_tmppath}/root-%{name}-%{version} -#Prefix: %{_prefix} +BuildArch: noarch BuildRequires: git + Requires(pre): shadow-utils Requires: mongodb-server Requires: ruby(abi) = 1.8 @@ -34,56 +36,50 @@ open source social network server. %pre getent group diaspora >/dev/null || groupadd -r diaspora -getent passwd diaspora >/dev/null || \ - useradd -r -g diaspora \ - -md /var/diaspora -s /sbin/nologin \ +getent passwd diaspora >/dev/null || \ + useradd -r -g diaspora \ + -md /var/lib/diaspora -s /sbin/nologin \ -c "Diaspora daemon" diaspora exit 0 %prep %setup -q -n %{name}-%{version}-%{git_release} + mkdir diaspora/tmp || : +find . -name .git | xargs rm -rf || : +find . -type f -exec \ + sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null + +# Patch request: http://github.com/diaspora/diaspora/issues/issue/392 +find . -name \*.css -print0 | xargs --null chmod 644 +find . -name \*.js -print0 | xargs --null chmod 644 +chmod 644 master/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg +chmod 644 master/public/stylesheets/brandongrotesque_light/demo.html %build -find . -name .git* -execdir rm -rf {} \; || : -#find . -name test -execdir rm -rf {} \; || : > /dev/null 2>&1 -find . -name \*.css -exec chmod 644 {} \; -find . -name \*.js -exec chmod 644 {} \; -#find . -name \*.treetop -exec chmod 644 {} \; -find . -name \*.rdoc -exec chmod 644 {} \; -#find . -name Rakefile -exec chmod 755 {} \; -#for f in $(find . -name \*.rb); do -# sed -i -e '/^#!/d' $f -# chmod 0644 $f -#done > /dev/null 2>&1 -find . -type f -exec \ - sed -i 's/^#!\/usr\/local\/bin\/ruby/#!\/usr\/bin\/ruby/g' {} \; > /dev/null - -chmod 644 master/public/stylesheets/brandongrotesque_light/demo.html -chmod 644 master/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg -sed -i -e "s|\r||" master/public/javascripts/jquery.cycle/src/jquery.cycle.lite.js -sed -i -e "s|\r||" master/public/javascripts/fancybox/jquery.fancybox-1.3.1.js - +rm -rf master/vendor/bundle %install + [ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora -mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora/master/vendor cp master/README.md . mv master/GNU-AGPL-3.0 . -sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' diaspora-ws mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora mkdir -p $RPM_BUILD_ROOT/etc/init.d +sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' diaspora-ws cp diaspora-ws $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d -cp diaspora $RPM_BUILD_ROOT/etc/logrotate.d +cp diaspora.logconf $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora +cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora %post /bin/chown diaspora:diaspora %{_localstatedir}/log/diaspora ln -sf %{_localstatedir}/log/diaspora \ %{_datadir}/diaspora/master/log || : -ln -sf %{_libdir}/diaspora/master/vendor/bundle \ +ln -sf %{_libdir}/diaspora-bundle/master/vendor/bundle \ %{_datadir}/diaspora/master/vendor || : /sbin/chkconfig --add diaspora-ws @@ -100,7 +96,6 @@ fi %defattr(-, root, root, 0755) %doc README.md GNU-AGPL-3.0 %{_datadir}/diaspora -%{_libdir}/diaspora %{_localstatedir}/log/diaspora %config(noreplace) %{_sysconfdir}/logrotate.d/diaspora %{_sysconfdir}/init.d/diaspora-ws diff --git a/pkg/fedora/make_dist.sh b/pkg/fedora/make_dist.sh index 3c9085b3c..b2ca4695e 100755 --- a/pkg/fedora/make_dist.sh +++ b/pkg/fedora/make_dist.sh @@ -59,7 +59,6 @@ function fix_alphatag() # Uses %define git_release to get release. #* Fri Sep 24 2010 name surname 1.20100925_faf234320 { -set -x dist=$(rpm --eval %dist) awk -v dist="$dist" -v version="$2" \ ' BEGIN { done = 0 } @@ -98,14 +97,14 @@ function patch() # Patch git_release, Requires: diaspora-bundle and top comment version. # Usage: patch VERSION RELEASE { - sed -e "/^%%define/s|HEAD|$2|" \ + sed -e "/^%define/s|HEAD|$2|" \ -e '/^Version:/s|.*|Version: '$1'|' \ dist/diaspora.spec fix_alphatag dist/diaspora.spec $1 - mkdir dist/diaspora/tmp + #mkdir dist/diaspora/tmp || : bundle_id=$(git_id dist/diaspora/Gemfile) - fix_bundle_deps dist/diaspora.spec $1 $bundle_id - sed -e "/^%%define/s|HEAD|$bundle_deps|" \ + fix_bundle_deps dist/diaspora.spec $1 "1.$bundle_id.fc13" + sed -e "/^%define/s|HEAD|$bundle_deps|" \ -e '/^Version:/s|.*|Version: '$1'|' \ < diaspora-bundle.spec > dist/diaspora-bundle.spec @@ -113,12 +112,17 @@ function patch() } function checkout() -# Checkout last version of dispora unless it's already there. +# Checkout last version of diaspora unless it's already there. +# Returns: commit for current branch's HEAD. { mkdir dist || : ( cd dist - rm -rf diaspora; git clone --quiet $GIT_REPO; \ + test -d diaspora && { + ( cd diaspora; git_id -n) + return + } + git clone --quiet $GIT_REPO; \ cd diaspora; git checkout --quiet -b dist $GIT_VERSION; git_id -n @@ -136,7 +140,7 @@ function make_dist rm -rf dist/${RELEASE_DIR} mkdir dist/${RELEASE_DIR} cp diaspora-ws dist/${RELEASE_DIR} - cp diaspora.logconf dist/${RELEASE_DIR}/diaspora + cp diaspora.logconf dist/${RELEASE_DIR} cd dist mkdir ${RELEASE_DIR}/master cp -ar diaspora/* ${RELEASE_DIR}/master @@ -176,6 +180,34 @@ function make_bundle() } } +function make_links() +# Usage: make_links [source commit] +{ + dest=$(rpm --eval %_sourcedir) + test -z "$dest" && { + echo "Can't find RPM source directory, giving up." + exit 2 + } + + src_commit="$1" + test -z "$src_commit" && { + src_commit=$(checkout) + } + src="dist/diaspora-$VERSION-$src_commit.tar.gz" + ln -sf $PWD/$src $dest + + bundle_commit=$(git_id dist/diaspora/Gemfile) + bundle="dist/diaspora-bundle-$VERSION-$bundle_commit.tar.gz" + ln -sf $PWD/$bundle $dest + cd $dest + find . -type l -not -readable -exec rm {} \; +} + + + + + + function usage() { cat <<- EOF @@ -188,7 +220,6 @@ function usage() All results are stored in dist/ EOF } -set -x test "$1" = "-h" -o $# = 0 && { usage; exit 0 @@ -208,8 +239,12 @@ test "$1" = "-c" && { "bundle") make_bundle $commit ;; - "dist") make_dist $commit + 'source') make_dist $commit ;; + + 'links') make_links $commit + ;; + "fix_gemfile") fix_gemfile ;;