Big cleanup, linking to bundle, removing garbage, git mgmt

This commit is contained in:
Alec Leamas 2010-10-27 11:47:11 +02:00
parent 97940073d7
commit 88a12ca889
6 changed files with 23 additions and 49 deletions

View file

@ -38,16 +38,7 @@ Source file usede to compile native libraries in diaspora-bundle.
%setup -q -n %{name}-%{version}-%{git_release}
%build
bundle install --local --deployment --without ri rdoc test
for gem in vendor/git/*.gem; do
gem install --local \
--force \
--no-rdoc \
--no-ri \
--install-dir vendor/bundle/ruby/1.8 \
$gem
done
bundle install --local --deployment --without ri rdoc
pushd vendor/bundle/ruby/1.8/gems
# In repo (2.2.4)
@ -154,7 +145,7 @@ pushd vendor/bundle/ruby/1.8/gems
chmod 644 cucumber-rails-0.3.2/templates/install/step_definitions/capybara_steps.rb.erb || :
chmod 644 ffi-0.6.3/ext/ffi_c/libffi/ltmain.sh || :
chmod 644 gherkin-2.2.4/tasks/compile.rake || :
chmod 644 i18n-0.4.1/MIT-LICENSE
chmod 644 i18n-0.4.1/MIT-LICENSE || :
chmod 755 linecache-0.43/Rakefile || :
chmod 755 mime-types-1.16/Rakefile || :
chmod 755 mini_magick-2.1/test/not_an_image.php || :
@ -168,7 +159,7 @@ pushd vendor/bundle/ruby/1.8/gems
for file in CHANGES VERSION README Rakefile; do
chmod 644 term-ansicolor-1.0.5/$file || :
done
chmod 755 thin-1.2.7/lib/thin/controllers/service.sh.erb
chmod 755 thin-1.2.7/lib/thin/controllers/service.sh.erb ||:
chmod 755 thin-1.2.7/example/async_chat.ru || :
chmod 755 thin-1.2.7/example/async_tailer.ru || :
chmod 644 treetop-1.4.8/spec/compiler/test_grammar.tt || :
@ -190,8 +181,6 @@ 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/
@ -227,7 +216,7 @@ cat files >> dirs && cp dirs files
%files -f files
%defattr(-, diaspora, diaspora, 0755)
%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 docs
%doc COPYRIGHT AUTHORS GNU-AGPL-3.0 docs
%files -f dev-files devel
%defattr(-, root, root, 0644)

View file

@ -22,6 +22,11 @@ test -n "$services" && {
cd /usr/share/diaspora/master
rm -rf vendor
ln -s /usr/lib/diaspora-bundle/vendor .
ln -sf /usr/lib/diaspora-bundle/Gemfile .
ln -sf /usr/lib/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml

View file

@ -71,6 +71,7 @@ cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
rm -rf $RPM_BUILD_ROOT/%{_datadir}/diaspora/master/vendor/*
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora

View file

@ -161,6 +161,7 @@ function make_src
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
(
cd ${RELEASE_DIR}/master
rm -rf vendor/bundle/* vendor/git/* vendor/cache/* gem-tmp
git show --name-only > config/gitversion
tar czf public/source.tar.gz \
--exclude='source.tar.gz' -X .gitignore *
@ -175,17 +176,11 @@ 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 <Gemfile> <tmpdir> <gemdir>
# Horrible hack, in wait for bundler handling git gems OK.
{
mkdir gem-tmp || :
[ -d 'gem-tmp' ] || mkdir gem-tmp
cd gem-tmp
rm -rf *
@ -198,34 +193,19 @@ function build_git_gems()
}
name = $2
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 = suffix "; git reset --hard " $i
else if ( key == ":branch")
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
mv devise-mongo_mapper.git devise-mongo_mapper
for dir in *; do
if [ -e $dir/*.gemspec ] ; then
cd $dir
gem build *.gemspec
cp *.gem ../../$2
cd ..
else
if [ ! -e $dir/*.gemspec ]; then
cp -ar $dir ../$2
fi
done
@ -271,16 +251,17 @@ function make_bundle()
cd dist
rm -rf $bundle_name
cd diaspora
rm Gemfile.lock
if [ "$BUNDLE_FIX" = 'yes' ]; then
rm -f Gemfile.lock
rm -rf .bundle
bundle update
fi
[ -d 'vendor/git' ] || mkdir vendor/git
rm -rf vendor/git/*
git checkout Gemfile
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 ||

View file

@ -28,13 +28,5 @@ cp -a AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \
cp -ar docs /usr/share/doc/diaspora-bundle
bundle install --local --deployment --without ri rdoc
for gem in vendor/git/*; do
gem install --local \
--force \
--no-rdoc \
--no-ri \
--install-dir vendor/bundle/ruby/1.8/bundler \
$gem
done

View file

@ -24,6 +24,12 @@ service mongodb start || :
cd /usr/share/diaspora/master
rm -rf vendor
ln -s /usr/lib/diaspora-bundle/vendor .
ln -sf /usr/lib/diaspora-bundle/Gemfile .
ln -sf /usr/lib/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml