Kouhei Sutou
null+****@clear*****
Fri May 29 11:59:35 JST 2015
Kouhei Sutou 2015-05-29 11:59:35 +0900 (Fri, 29 May 2015) New Revision: 116f460b1d0417299a1f372c664e1b711e0de041 https://github.com/pgroonga/pgroonga/commit/116f460b1d0417299a1f372c664e1b711e0de041 Message: package apt: add packages for Jessie Added files: packages/apt/Vagrantfile packages/apt/build-deb.sh Modified files: .gitignore Rakefile Modified: .gitignore (+4 -0) =================================================================== --- .gitignore 2015-05-29 11:07:28 +0900 (e9e76aa) +++ .gitignore 2015-05-29 11:59:35 +0900 (1e3a71c) @@ -6,6 +6,10 @@ /regression.* /results/ /packages/source/ +/packages/apt/.vagrant/ +/packages/apt/env.sh +/packages/apt/repositories/ +/packages/apt/tmp/ /packages/yum/.vagrant/ /packages/yum/env.sh /packages/yum/repositories/ Modified: Rakefile (+107 -0) =================================================================== --- Rakefile 2015-05-29 11:07:28 +0900 (83735e8) +++ Rakefile 2015-05-29 11:59:35 +0900 (cee7761) @@ -246,6 +246,113 @@ postgresql94-devel ] task :yum => yum_tasks + namespace :apt do + distribution = "debian" + code_names = [ + "jessie", + ] + architectures = [ + "i386", + "amd64", + ] + rsync_path = rsync_base_path + debian_dir = "#{packages_dir}/debian" + apt_dir = "#{packages_dir}/apt" + repositories_dir = "#{apt_dir}/repositories" + + directory repositories_dir + + env_sh = "#{apt_dir}/env.sh" + file env_sh => __FILE__ do + File.open(env_sh, "w") do |file| + file.puts(<<-ENV) +PACKAGE=#{package} +VERSION=#{version} +DEPENDED_PACKAGES=" +debhelper +pkg-config +libgroonga-dev +postgresql-server-dev-9.4 +" + ENV + end + end + + desc "Build DEB packages" + task :build => [archive_name, env_sh, repositories_dir] do + tmp_dir = "#{apt_dir}/tmp" + rm_rf(tmp_dir) + mkdir_p(tmp_dir) + cp(archive_name, tmp_dir) + cp_r(debian_dir, tmp_dir) + + cd(apt_dir) do + sh("vagrant", "destroy", "--force") + code_names.each do |code_name| + architectures.each do |arch| + id = "#{distribution}-#{code_name}-#{arch}" + sh("vagrant", "up", id) + sh("vagrant", "destroy", "--force", id) + end + end + end + end + + desc "Sign packages" + task :sign do + sh("#{groonga_source_dir}/packages/apt/sign-packages.sh", + gpg_uid, + "#{repositories_dir}/", + code_names.join(" ")) + end + + namespace :repository do + desc "Update repositories" + task :update do + sh("#{groonga_source_dir}/packages/apt/update-repository.sh", + "Groonga", + "#{repositories_dir}/", + architectures.join(" "), + code_names.join(" ")) + end + + desc "Sign repositories" + task :sign do + sh("#{groonga_source_dir}/packages/apt/sign-repository.sh", + gpg_uid, + "#{repositories_dir}/", + architectures.join(" ")) + end + end + + desc "Download repositories" + task :download => repositories_dir do + sh("rsync", "-avz", "--progress", + "--delete", + "#{rsync_path}/#{distribution}/", + "#{repositories_dir}/#{distribution}") + end + + desc "Upload repositories" + task :upload => repositories_dir do + sh("rsync", "-avz", "--progress", + "--delete", + "#{repositories_dir}/#{distribution}/", + "#{rsync_path}/#{distribution}") + end + end + + desc "Release APT packages" + apt_tasks = [ + "package:apt:download", + "package:apt:build", + "package:apt:sign", + "package:apt:repository:update", + "package:apt:repository:sign", + "package:apt:upload", + ] + task :apt => apt_tasks + namespace :ubuntu do desc "Upload package" task :upload do Added: packages/apt/Vagrantfile (+26 -0) 100644 =================================================================== --- /dev/null +++ packages/apt/Vagrantfile 2015-05-29 11:59:35 +0900 (7369a56) @@ -0,0 +1,26 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + vms = [ + { + :id => "debian-jessie-i386", + :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0-i386_chef-provisionerless.box", + }, + { + :id => "debian-jessie-amd64", + :box_url => "http://packages.groonga.org/tmp/opscode_debian-8.0_chef-provisionerless.box", + }, + ] + + vms.each do |vm| + config.vm.define(vm[:id]) do |node| + node.vm.box = vm[:id] + node.vm.box_url = vm[:box_url] + node.vm.provision(:shell, :privileged => false, :path => "build-deb.sh") + end + end +end Added: packages/apt/build-deb.sh (+57 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/build-deb.sh 2015-05-29 11:59:35 +0900 (197cd0a) @@ -0,0 +1,57 @@ +#!/bin/sh + +LANG=C + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +. /vagrant/env.sh + +run sudo apt-get update +run sudo apt-get install -y lsb-release + +distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') +code_name=$(lsb_release --codename --short) +case "${distribution}" in + debian) + component=main + run cat <<EOF | run sudo tee /etc/apt/sources.list.d/groonga.list +deb http://packages.groonga.org/debian/ ${code_name} main +deb-src http://packages.groonga.org/debian/ ${code_name} main +EOF + run sudo apt-get update + run sudo apt-get install -y --allow-unauthenticated groonga-keyring + run sudo apt-get update + ;; + ubuntu) + component=universe + run sudo apt-get -y install software-properties-common + run sudo add-apt-repository -y universe + run sudo add-apt-repository -y ppa:groonga/ppa + run sudo apt-get update + ;; +esac + +run sudo apt-get install -V -y build-essential devscripts ${DEPENDED_PACKAGES} + +run mkdir -p build +run cp /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz \ + build/${PACKAGE}_${VERSION}.orig.tar.gz +run cd build +run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz +run cd ${PACKAGE}-${VERSION}/ +run cp -rp /vagrant/tmp/debian debian +# export DEB_BUILD_OPTIONS=noopt +run debuild -us -uc +run cd - + +package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/') +pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}" +run mkdir -p "${pool_dir}/" +run cp *.tar.gz *.dsc *.deb "${pool_dir}/" -------------- next part -------------- HTML����������������������������...下载