Skip to content
Snippets Groups Projects
Commit 31b3d739 authored by Alec Leamas's avatar Alec Leamas
Browse files

Bundle: add licenses, handle git gems

Adding a docs dir collexting README and licenses from contained gems.
git gems, which bundler does not handle well today, are handled
by a hacked parsing of Gemfile.log, gem built into the source
bundle and installed on target system
parent b17ae0bf
Branches
Tags
No related merge requests found
abstract: Ruby
actionmailer: MIT
actionpack: MIT
activemodel: MIT
activerecord: MIT
activeresource: ? (Other distros uses MIT, "Ruby-alike", no pointers)
activesupport: MIT
addressable: MIT
arel: MIT
aws MIT
bcrypt-ruby: MIT
builder: MIT
bunny: MIT
capistrano: MIT
capybara: MIT
chef: ASL 2.0
childprocess: MIT
columnize: GPLv2
crack: MIT
cucumber: MIT
cucumber-rails: MIT
culerity: MIT
daemons: Ruby+MIT
database_cleaner: MIT
devise: MIT
devise_invitable MIT
diff Ruby+GPLv2+ Artistic 2.0
em-websocket: MIT
eribus: MIT
event-machine: Ruby+GPLv2
extlib: MIT
factory_girls MIT
factory_girls_rails: MIT
ffi MIT
haml MIT
http_connection: MIT
gherkin: MIT
hashie: MIT
highline GPLv2+Ruby
json: Ruby
json-pure: Ruby
launchy: MIT
linecache: GPLv2
mail: MIT
mime-types: GPLv2+Ruby+Artistic 2.0
mini_magick: MIT
mini_fb: ?
mixlib-authentication: ASL 2.0
mixlib-cli ASL 2.0
mixlib-config ASL 2.0
mixlib-log ASL 2.0
mocha Ruby+MIT
moneta: MIT
mongo: ASL 2.0
net-scp: MIT
net-sftp: MIT
net-ssh: MIT
net-ssh-gatawey: MIT
ohai: ASL 2.0
plucky: MIT
polyglot. MIT
pubsubhubbub: ASL 2.0 http://code.google.com/p/pubsubhubbub/
rake: MIT
rack-mount: MIT
rack-test: MIT
railties: MIT
rest-client: MIT
rspec-core: MIT
rspec-expectations: MIT
rspec-mocks: MIT
rspec-rails: MIT
rack: MIT
rack-mount: MIT
ruby-debug: MIT
ruby-debug-base: MIT
rubyzip: Ruby
selenium-webdriver: ASL 2.0
subexec: MIT
term-ansicolor: GPLv2
textile. MIT
textile-warden: MIT
thin: MIT
thor: MIT
treetop: MIT
tx-info: MIT
uutdtools: MIT
iwarden: MIT
webmock: MIT
will-paginate MIT
TODO TODO
dist dist
.stgit* .stgit*
vendor
...@@ -38,9 +38,16 @@ Source file usede to compile native libraries in diaspora-bundle. ...@@ -38,9 +38,16 @@ Source file usede to compile native libraries in diaspora-bundle.
%setup -q -n %{name}-%{version}-%{git_release} %setup -q -n %{name}-%{version}-%{git_release}
%build %build
mkdir -p vendor/cache bundle install --local --deployment --without ri rdoc test
mv *.gem vendor/cache for gem in vendor/git/*; do
bundle install --local --deployment --without ri rdoc gem install --local \
--force \
--no-rdoc \
--no-ri \
--install-dir vendor/bundle/ruby/1.8/bundler \
$gem
done
pushd vendor/bundle/ruby/1.8/gems pushd vendor/bundle/ruby/1.8/gems
# In repo (2.2.4) # In repo (2.2.4)
...@@ -200,7 +207,7 @@ popd ...@@ -200,7 +207,7 @@ popd
} }
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
cp -ar vendor/bundle $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle cp -ar vendor $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
find %{buildroot}/%{_libdir}/diaspora-bundle \ find %{buildroot}/%{_libdir}/diaspora-bundle \
-type d -fprintf dirs '%%%dir "%%p"\n' -type d -fprintf dirs '%%%dir "%%p"\n'
...@@ -218,7 +225,7 @@ cat files >> dirs && cp dirs files ...@@ -218,7 +225,7 @@ cat files >> dirs && cp dirs files
%files -f files %files -f files
%defattr(-, diaspora, diaspora, 0755) %defattr(-, diaspora, diaspora, 0755)
%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 %doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 docs
%files -f dev-files devel %files -f dev-files devel
%defattr(-, root, root, 0644) %defattr(-, root, root, 0644)
......
...@@ -49,13 +49,12 @@ find . -perm /u+x -type f -exec \ ...@@ -49,13 +49,12 @@ find . -perm /u+x -type f -exec \
%build %build
rm -rf master/vendor/bundle rm -rf master/vendor/bundle
mkdir master/tmp || :
%install %install
rm -fr $RPM_BUILD_ROOT rm -fr $RPM_BUILD_ROOT
sed -i \ sed -i \
'/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/bundle|' \ '/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/vendor/bundle|' \
master/.bundle/config master/.bundle/config
cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS .
......
...@@ -138,7 +138,7 @@ function checkout() ...@@ -138,7 +138,7 @@ function checkout()
cd diaspora; cd diaspora;
git fetch --quiet upstream git fetch --quiet upstream
git merge --quiet upstream/master git merge --quiet upstream/master
git checkout --quiet ${1:-'HEAD'} [ -n "$1" ] && git reset --hard --quiet $1
git_id -n git_id -n
) )
} }
...@@ -175,41 +175,91 @@ function make_src ...@@ -175,41 +175,91 @@ function make_src
echo "Required bundle: $(git_id dist/diaspora/Gemfile)" echo "Required bundle: $(git_id dist/diaspora/Gemfile)"
} }
function get_git_repos()
function build_git_gems()
# Usage: build_git_gems <Gemfile> <tmpdir> <gemdir>
# Horrible hack, in wait for bundler handling git gems OK.
{ {
grep -A 2 GIT $1 | mkdir gem-tmp || :
awk ' /remote:/ { repo = $2 } cd gem-tmp
/revision:/ { printf "%s=%s\n",repo, $2}' rm -rf *
grep 'git:' ../$1 | sed 's/,/ /' | awk '
/^.*git:\/\/.*$/ {
gsub( "=>", "")
gsub( ",", "")
if ( $1 != "gem") {
print "Strange git: line (ignored) :" $0
next
}
name = $2
suffix = ""
url=""
for (i = 3; i <= NF; i += 1) {
key = $i
i += 1
if (key == ":git")
url = $i
else if ( key == ":ref") {
suffix = "; cd " name
suffix = suffix "; git reset --hard " $i
suffix = suffix "; cd .."
}
else if ( key == ":branch")
suffix = "; git checkout " $i
}
print "Running: ", cmd
cmd = sprintf( "git clone --quiet %s %s %s\n",
url, name, suffix)
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 ..
done
cd ..
# rm -rf gem-tmp
} }
function make_docs()
{
local gemfile=$1
for url in $(read_git_urls $gemfile); do
local name=${url##*/}
name=${name%.*}
rm -rf vendor/git/$name
git clone --bare --quiet $url vendor/git/$name &&
sed -i "s#$url#vendor/git/$name#" $gemfile ||
echo "Cannot fix git repo \"$url\""
done
}
function package_git_gems() function make_docs()
{ {
gemfile="$1" local gems=$1
dest="$2" local dest=$2
rm -rf git-tmp for gem in $(ls $gems); do
mkdir git-tmp local name=$(basename $gem)
cd git-tmp [ -r $gems/$gem/README* ] && {
for repo in $( get_git_repos $1); do local readme=$(basename $gems/$gem/README*)
url=${repo%%=*} cp -a $gems/$gem/$readme $dest/$readme.$name
rev=${repo##*=} }
[ -r $gems/$gem/COPYRIGHT ] && \
name=${url##*/} cp -a $gems/$gem/COPYRIGHT $dest/COPYRIGHT.$name
name="${name%.git}" [ -r $gems/$gem/LICENSE ] && \
cp -a $gems/$gem/LICENSE $dest/LICENSE.$name
rm -rf "$name" [ -r $gems/$gem/License ] && \
git clone "$url" "$name" cp -a $gems/$gem/License $dest/License.$name
cd $name [ -r $gems/$gem/MIT-LICENSE ] && \
git reset --hard $rev cp -a $gems/$gem/MIT-LICENSE $dest/MIT-LICENSE.$name
sed -i '/s.date/s/Date.today/"2010-09-25"/' *.gemspec [ -r $gems/$gem/COPYING ] && \
gem build *.gemspec cp -a $gems/$gem/COPYING $dest/COPYING.$name
cp *.gem $dest done
echo "Built GIT gem $name (*.gem)"
echo "Where: $dest"
cd ..
done
cd ..
} }
...@@ -219,8 +269,8 @@ function make_bundle() ...@@ -219,8 +269,8 @@ function make_bundle()
# #
{ {
checkout ${1:-'HEAD'} >/dev/null checkout ${1:-'HEAD'} >/dev/null
bundle_id=$( git_id dist/diaspora/Gemfile) local bundle_id=$( git_id dist/diaspora/Gemfile)
bundle_name="diaspora-bundle-$VERSION-$bundle_id" local bundle_name="diaspora-bundle-$VERSION-$bundle_id"
test -e "dist/$bundle_name.tar.gz" || { test -e "dist/$bundle_name.tar.gz" || {
echo "Creating bundle $bundle_name" echo "Creating bundle $bundle_name"
cd dist cd dist
...@@ -231,22 +281,25 @@ function make_bundle() ...@@ -231,22 +281,25 @@ function make_bundle()
rm -rf .bundle rm -rf .bundle
bundle update bundle update
fi fi
bundle install --deployment [ -d 'vendor/git' ] || mkdir vendor/git
bundle install
bundle package bundle package
package_git_gems "$PWD/Gemfile.lock" "$PWD/vendor/cache" mkdir vendor/git
build_git_gems Gemfile vendor/git
mkdir -p "../$bundle_name/docs"
mkdir -p "../$bundle_name/vendor"
cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \ cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \
vendor/cache ../$bundle_name
cd vendor make_docs "vendor/gems" "../$bundle_name/docs"
mv cache $bundle_name mv vendor/cache ../$bundle_name/vendor
tar czf ../../$bundle_name.tar.gz $bundle_name
mv $bundle_name cache
cd ..
cd .. cd ..
tar czf $bundle_name.tar.gz $bundle_name
mv $bundle_name/vendor/cache diaspora/vendor/cache
cd .. cd ..
} }
echo echo
echo "Bundle: dist/$bundle_name.tar.gz" echo "Bundle: dist/$bundle_name.tar.gz"
echo "Current dir:$PWD"
} }
......
...@@ -23,11 +23,18 @@ mv $(basename $1 .tar.gz) diaspora-bundle ...@@ -23,11 +23,18 @@ mv $(basename $1 .tar.gz) diaspora-bundle
mkdir -p /usr/share/doc/diaspora-bundle || : mkdir -p /usr/share/doc/diaspora-bundle || :
cd /usr/lib/diaspora-bundle cd /usr/lib/diaspora-bundle
cp AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \ cp -a AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \
/usr/share/doc/diaspora-bundle /usr/share/doc/diaspora-bundle
cp -ar docs /usr/share/doc/diaspora-bundle
mkdir -p vendor/cache
mv *.gem vendor/cache
bundle install --local --deployment --without ri rdoc 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment