From 97940073d7e3d0abea98d74f6a9984228d8c92e5 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 26 Oct 2010 22:09:12 +0200 Subject: [PATCH] Works, w ith bit gem file and git repos... --- pkg/fedora/README.md | 12 ++++-- pkg/fedora/diaspora-bundle.spec | 6 ++- pkg/fedora/make-dist.sh | 67 +++++++++++++++++++------------- pkg/ubuntu/diaspora-install-deps | 3 +- 4 files changed, 55 insertions(+), 33 deletions(-) diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index 7c5c9e3a2..38801dc42 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -18,7 +18,7 @@ Prerequisites: - A personal environment to build RPM:s, also described in [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora) -Install g++ (possibly unnnecessary?): +Install g++ (unnecessary?): % yum install gcc-c++ Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz @@ -73,7 +73,7 @@ to the bundle's bundle directory. Reasonable defaults are to install diaspora in /usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these, the link is % rm -rf /usr/share/diaspora/master/vendor/bundle - % ln -sf /usr/lib/diaspora-bundle/bundle \ + % ln -sf /usr/lib/diaspora-bundle/vendor/bundle \ > /usr/share/diaspora/master/vendor % @@ -93,6 +93,9 @@ The source tarball is as retrieved from diaspora with following differences: - The file .bundle/config is patched. Remove before doing *bundle install* +The bundle is basically the output from 'bundle package'. The git-based +gems are also added into vendor/git. + ./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The root cause is a bad Gemfile in the git repo. Possible fixes includes using a older version known to work: @@ -128,9 +131,10 @@ at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.ne 'make-dist.sh source' script checks out latest version of diaspora into the dist/diaspora directory. This content is, after some patches, the diaspora package. -'make-dir.sh bundle' makes a 'bundle install --deployment' in the diaspora dir. +'make-dir.sh bundle' makes a *bundle package* in the diaspora dir. The resulting bundle is stored in vendor/bundle. This is, after some more -patches, the content of diaspora-bundle. +patches, the content of diaspora-bundle tarball. Target systems makes a +*bundle install --local* to use it. Here is also support for running the diaspora websocket service as a system service through /sbin/service and some install scripts. diff --git a/pkg/fedora/diaspora-bundle.spec b/pkg/fedora/diaspora-bundle.spec index a13a85368..a5f1e7071 100644 --- a/pkg/fedora/diaspora-bundle.spec +++ b/pkg/fedora/diaspora-bundle.spec @@ -39,12 +39,12 @@ Source file usede to compile native libraries in diaspora-bundle. %build bundle install --local --deployment --without ri rdoc test -for gem in vendor/git/*; do +for gem in vendor/git/*.gem; do gem install --local \ --force \ --no-rdoc \ --no-ri \ - --install-dir vendor/bundle/ruby/1.8/bundler \ + --install-dir vendor/bundle/ruby/1.8 \ $gem done @@ -190,6 +190,8 @@ exit 0 find . -name .git | xargs rm -rf find . -name .gitignore -delete find . -name \*.o -delete || : +rm -rf vendor/git +rm -rf vendor/cache test -d vendor/bundle/ruby/1.8//gems/selenium-webdriver-0.0.* && { pushd vendor/bundle//ruby/1.8/gems/selenium-webdriver-0.0.*/lib/selenium/webdriver/ diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 093f6a4c3..3e250f31b 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -175,6 +175,12 @@ function make_src echo "Required bundle: $(git_id dist/diaspora/Gemfile)" } +function fix_gemfile +{ + sed -i 's|git://.*/|vendor/git/|g' $1 + +} + function build_git_gems() # Usage: build_git_gems # Horrible hack, in wait for bundler handling git gems OK. @@ -183,42 +189,46 @@ function build_git_gems() cd gem-tmp rm -rf * - grep 'git:' ../$1 | sed 's/,/ /' | awk ' + grep 'git:' ../$1 | sed 's/,/ /g' | awk ' /^.*git:\/\/.*$/ { - gsub( "=>", "") + gsub( "=>", " ") if ( $1 != "gem") { print "Strange git: line (ignored) :" $0 next } name = $2 - suffix = "" url="" + suffix = "; cd " name for (i = 3; i <= NF; i += 1) { key = $i i += 1 if (key == ":git") url = $i - else if ( key == ":ref") { - suffix = "; cd " name + else if ( key == ":ref") suffix = suffix "; git reset --hard " $i - suffix = suffix "; cd .." - } else if ( key == ":branch") - suffix = "; git checkout " $i + suffix = suffix "; git checkout " $i } + suffix = suffix "; cd .." cmd = sprintf( "git clone --quiet %s %s %s\n", url, name, suffix) print "Running: ", cmd system( cmd) + cmd = sprintf( "git clone --bare --quiet %s\n", url) + print "Running: ", cmd + system( cmd) }' sed -i 's/Date.today/"2010-10-24"/' carrierwave/carrierwave.gemspec for dir in *; do - cd $dir - gem build *.gemspec - cp *.gem ../../$2 - cd .. + if [ -e $dir/*.gemspec ] ; then + cd $dir + gem build *.gemspec + cp *.gem ../../$2 + cd .. + else + cp -ar $dir ../$2 + fi done - cd .. # rm -rf gem-tmp } @@ -230,19 +240,19 @@ function make_docs() for gem in $(ls $gems); do local name=$(basename $gem) - [ -r $gems/$gem/README* ] && { + [ -r "$gems/$gem/README*" ] && { local readme=$(basename $gems/$gem/README*) cp -a $gems/$gem/$readme $dest/$readme.$name } - [ -r $gems/$gem/COPYRIGHT ] && \ + [ -r "$gems/$gem/COPYRIGHT" ] && \ cp -a $gems/$gem/COPYRIGHT $dest/COPYRIGHT.$name - [ -r $gems/$gem/LICENSE ] && \ + [ -r "$gems/$gem/LICENSE" ] && \ cp -a $gems/$gem/LICENSE $dest/LICENSE.$name - [ -r $gems/$gem/License ] && \ + [ -r "$gems/$gem/License" ] && \ cp -a $gems/$gem/License $dest/License.$name - [ -r $gems/$gem/MIT-LICENSE ] && \ + [ -r "$gems/$gem/MIT-LICENSE" ] && \ cp -a $gems/$gem/MIT-LICENSE $dest/MIT-LICENSE.$name - [ -r $gems/$gem/COPYING ] && \ + [ -r "$gems/$gem/COPYING" ] && \ cp -a $gems/$gem/COPYING $dest/COPYING.$name done } @@ -267,17 +277,22 @@ function make_bundle() bundle update fi - bundle install - bundle package [ -d 'vendor/git' ] || mkdir vendor/git build_git_gems Gemfile vendor/git + sed -i 's|git://.*/|vendor/git/|g' Gemfile + rm Gemfile.lock + rm -rf .bundle + # see: http://bugs.joindiaspora.com/issues/440 + bundle install --path=vendor/bundle || + bundle install --path=vendor/bundle + bundle package mkdir -p "../$bundle_name/docs" mkdir -p "../$bundle_name/vendor" cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \ ../$bundle_name - make_docs "vendor/gems" "../$bundle_name/docs" + make_docs "vendor/bundle/ruby/1.8/gems/" "../$bundle_name/docs" mv vendor/cache ../$bundle_name/vendor mv vendor/git ../$bundle_name/vendor rm -rf vendor/gems/* @@ -348,16 +363,16 @@ function usage() -h Print this message. -c commit Use a given commit, defaults to last checked in. - -r release Mark with specified release, defaults to 1. + -r release For prepare, mark with release nr, defaults to 1. -u uri Git repository URI, defaults to $GIT_REPO. - -f For bundle, fix dependencies by running 'bundle update' - before 'bundle install' + -f For bundle, fix dependencies by running 'bundle update' + before 'bundle install' source Build a diaspora application tarball. bundle Build a bundler(1) bundle for diaspora. prepare Symlink bundle and source tarballs to rpm source dir, - create patched rpm spec files. + create patched rpm spec files. All results are stored in dist/ diff --git a/pkg/ubuntu/diaspora-install-deps b/pkg/ubuntu/diaspora-install-deps index 388dc39e0..cf30822ea 100755 --- a/pkg/ubuntu/diaspora-install-deps +++ b/pkg/ubuntu/diaspora-install-deps @@ -14,7 +14,8 @@ grep -v '^#' /etc/apt/sources.list | grep -q universe || { release=$( lsb_release -a | awk '/Release:/ {print $2}') sudo apt-get update -sudo apt-get install -qy build-essential libxslt1-dev libxml2 \ +sudo apt-get install --no-install-recommends -qy\ + build-essential libxslt1-dev libxml2 \ ruby-full mongodb rake python-software-properties git-core \ imagemagick libmagick9-dev if [ "$release" = "10.04" ]; then