HAYASHI Kentaro
null+****@clear*****
Tue Jan 29 13:26:31 JST 2013
HAYASHI Kentaro 2013-01-29 13:26:31 +0900 (Tue, 29 Jan 2013) New Revision: 37ee5b60ab523e0640c73b3a6e3ee99ce8a1b3b0 https://github.com/groonga/groonga-normalizer-mysql/commit/37ee5b60ab523e0640c73b3a6e3ee99ce8a1b3b0 Log: apt: support to build deb package Added files: packages/apt/Makefile.am packages/apt/build-deb.sh packages/apt/build-in-chroot.sh packages/apt/groonga-normalizer-mysql-depended-packages packages/apt/sign-packages.sh packages/apt/sign-repository.sh packages/apt/update-repository.sh packages/debian/changelog packages/debian/compat packages/debian/control packages/debian/copyright packages/debian/groonga-normalizer-mysql.install packages/debian/patches/series packages/debian/rules packages/debian/source/format Added: packages/apt/Makefile.am (+60 -0) 100644 =================================================================== --- /dev/null +++ packages/apt/Makefile.am 2013-01-29 13:26:31 +0900 (54e05f9) @@ -0,0 +1,60 @@ +REPOSITORIES_PATH = repositories +DISTRIBUTIONS = debian ubuntu +CHROOT_BASE = /var/lib/chroot +ARCHITECTURES = i386 amd64 +CODES = squeeze wheezy unstable lucid oneiric precise quantal +KEYRING_PACKAGE = groonga-keyring +KEYRING_VERSION = 2012.05.29 +KEYRING_BASE_NAME = $(KEYRING_PACKAGE)-$(KEYRING_VERSION) + +all: + +release: build sign-packages update-repository sign-repository upload + +remove-existing-packages: + for distribution in $(DISTRIBUTIONS); do \ + find $(REPOSITORIES_PATH)/$${distribution}/pool \ + -type f -delete; \ + done + +ensure-rsync-path: + @if test -z "$(RSYNC_PATH)"; then \ + echo "--with-rsync-path configure option must be specified."; \ + false; \ + fi + +download: ensure-rsync-path + for distribution in $(DISTRIBUTIONS); do \ + rsync -avz --progress --delete \ + $(RSYNC_PATH)/$${distribution} \ + ${REPOSITORIES_PATH}/; \ + done + +sign-packages: + ./sign-packages.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODES)' + +update-repository: + ./update-repository.sh '$(PACKAGE_NAME)' '$(REPOSITORIES_PATH)/' \ + '$(ARCHITECTURES)' '$(CODES)' + +sign-repository: + ./sign-repository.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODES)' + +upload: ensure-rsync-path + for distribution in $(DISTRIBUTIONS); do \ + (cd $(REPOSITORIES_PATH)/$${distribution}; \ + rsync -avz --progress --delete \ + dists pool $(RSYNC_PATH)/$${distribution}); \ + done + +build: build-package-deb + +build-package-deb: source + ./build-in-chroot.sh \ + $(PACKAGE) $(VERSION) $(srcdir)/.. $(REPOSITORIES_PATH)/ \ + $(CHROOT_BASE) '$(ARCHITECTURES)' '$(CODES)' + +source: ../$(PACKAGE)-$(VERSION).tar.gz + +../$(PACKAGE)-$(VERSION).tar.gz: + ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz ../ Added: packages/apt/build-deb.sh (+86 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/build-deb.sh 2013-01-29 13:26:31 +0900 (28ee628) @@ -0,0 +1,86 @@ +#!/bin/sh + +LANG=C + +PACKAGE=$(cat /tmp/build-package) +USER_NAME=$(cat /tmp/build-user) +VERSION=$(cat /tmp/build-version) +DEPENDED_PACKAGES=$(cat /tmp/depended-packages) +BUILD_SCRIPT=/tmp/build-deb-in-chroot.sh + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +if [ ! -x /usr/bin/lsb_release ]; then + run apt-get update + run apt-get install -y lsb-release +fi + +distribution=$(lsb_release --id --short) +code_name=$(lsb_release --codename --short) + +security_list=/etc/apt/sources.list.d/security.list +if [ ! -f "${security_list}" ]; then + case ${distribution} in + Debian) + if [ "${code_name}" = "sid" ]; then + touch "${security_list}" + else + cat <<EOF > "${security_list}" +deb http://security.debian.org/ ${code_name}/updates main +deb-src http://security.debian.org/ ${code_name}/updates main +EOF + fi + ;; + Ubuntu) + cat <<EOF > "${security_list}" +deb http://security.ubuntu.com/ubuntu ${code_name}-security main restricted +deb-src http://security.ubuntu.com/ubuntu ${code_name}-security main restricted +EOF + ;; + esac +fi + +sources_list=/etc/apt/sources.list +if [ "$distribution" = "Ubuntu" ] && \ + ! (grep '^deb' $sources_list | grep -q universe); then + run sed -i'' -e 's/main$/main universe/g' $sources_list +fi + +if [ ! -x /usr/bin/aptitude ]; then + run apt-get update + run apt-get install -y aptitude +fi +run aptitude update -V -D +run aptitude safe-upgrade -V -D -y + +run aptitude install -V -D -y devscripts ${DEPENDED_PACKAGES} +run aptitude clean + +if ! id $USER_NAME >/dev/null 2>&1; then + run useradd -m $USER_NAME +fi + +cat <<EOF > $BUILD_SCRIPT +#!/bin/sh + +rm -rf build +mkdir -p build + +cp /tmp/${PACKAGE}-${VERSION}.tar.gz build/${PACKAGE}_${VERSION}.orig.tar.gz +cd build +tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz +cd ${PACKAGE}-${VERSION}/ +cp -rp /tmp/${PACKAGE}-debian debian +# export DEB_BUILD_OPTIONS=noopt +debuild -us -uc +EOF + +run chmod +x $BUILD_SCRIPT +run su - $USER_NAME $BUILD_SCRIPT Added: packages/apt/build-in-chroot.sh (+134 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/build-in-chroot.sh 2013-01-29 13:26:31 +0900 (095ef30) @@ -0,0 +1,134 @@ +#!/bin/sh + +if [ $# != 7 ]; then + echo "Usage: $0 PACKAGE VERSION SOURCE_DIR DESTINATION CHROOT_BASE ARCHITECTURES CODES" + echo " e.g.: $0 groonga 0.1.9 SOURCE_DIR repositories/ /var/lib/chroot 'i386 amd64' 'lenny unstable hardy karmic'" + exit 1 +fi + +PACKAGE=$1 +VERSION=$2 +SOURCE_DIR=$3 +DESTINATION=$4 +CHROOT_BASE=$5 +ARCHITECTURES=$6 +CODES=$7 + +PATH=/usr/local/sbin:/usr/sbin:$PATH + +script_base_dir=`dirname $0` + +if test "$PARALLEL" = "yes"; then + parallel="yes" +else + parallel="no" +fi + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +run_sudo() +{ + run sudo "$@" +} + +build_chroot() +{ + architecture=$1 + code_name=$2 + + run_sudo debootstrap --arch $architecture $code_name $base_dir + + case $code_name in + lenny|squeeze|wheezy|unstable) + run_sudo sed -i'' -e 's/us/jp/' $base_dir/etc/apt/sources.list + ;; + *) + run_sudo sed -i'' \ + -e 's,http://archive,http://jp.archive,' \ + -e 's/main$/main universe/' \ + $base_dir/etc/apt/sources.list + ;; + esac + + run_sudo sh -c "echo >> /etc/fstab" + run_sudo sh -c "echo /sys ${base_dir}/sys none bind 0 0 >> /etc/fstab" + run_sudo sh -c "echo /dev ${base_dir}/dev none bind 0 0 >> /etc/fstab" + run_sudo sh -c "echo devpts-chroot ${base_dir}/dev/pts devpts defaults 0 0 >> /etc/fstab" + run_sudo sh -c "echo proc-chroot ${base_dir}/proc proc defaults 0 0 >> /etc/fstab" + run_sudo mount ${base_dir}/sys + run_sudo mount ${base_dir}/dev + run_sudo mount ${base_dir}/dev/pts + run_sudo mount ${base_dir}/proc +} + +build() +{ + architecture=$1 + code_name=$2 + + target=${code_name}-${architecture} + base_dir=${CHROOT_BASE}/${target} + if [ ! -d $base_dir ]; then + run build_chroot $architecture $code_name + fi + + case ${code_name} in + lenny|squeeze|wheezy|unstable) + distribution=debian + component=main + ;; + *) + distribution=ubuntu + component=universe + ;; + esac + + source_dir=${SOURCE_DIR} + build_user=${PACKAGE}-build + build_user_dir=${base_dir}/home/$build_user + build_dir=${build_user_dir}/build + pool_base_dir=${DESTINATION}${distribution}/pool/${code_name}/${component} + package_initial=$(echo ${PACKAGE} | sed -e 's/\(.\).*/\1/') + pool_dir=${pool_base_dir}/${package_initial}/${PACKAGE} + run cp $source_dir/${PACKAGE}-${VERSION}.tar.gz \ + ${CHROOT_BASE}/$target/tmp/ + run rm -rf ${CHROOT_BASE}/$target/tmp/${PACKAGE}-debian + run cp -rp $source_dir/debian/ \ + ${CHROOT_BASE}/$target/tmp/${PACKAGE}-debian + run echo $PACKAGE > ${CHROOT_BASE}/$target/tmp/build-package + run echo $VERSION > ${CHROOT_BASE}/$target/tmp/build-version + run echo $build_user > ${CHROOT_BASE}/$target/tmp/build-user + run cp ${script_base_dir}/${PACKAGE}-depended-packages \ + ${CHROOT_BASE}/$target/tmp/depended-packages + run cp ${script_base_dir}/build-deb.sh \ + ${CHROOT_BASE}/$target/tmp/ + run_sudo rm -rf $build_dir + run_sudo su -c "/usr/sbin/chroot ${CHROOT_BASE}/$target /tmp/build-deb.sh" + run mkdir -p $pool_dir + for path in $build_dir/*; do + [ -f $path ] && run cp -p $path $pool_dir/ + done +} + +for architecture in $ARCHITECTURES; do + for code_name in $CODES; do + if test "$parallel" = "yes"; then + build $architecture $code_name & + else + mkdir -p tmp + build_log=tmp/build-$code_name-$architecture.log + build $architecture $code_name 2>&1 | tee $build_log + fi; + done; +done + +if test "$parallel" = "yes"; then + wait +fi Added: packages/apt/groonga-normalizer-mysql-depended-packages (+4 -0) 100644 =================================================================== --- /dev/null +++ packages/apt/groonga-normalizer-mysql-depended-packages 2013-01-29 13:26:31 +0900 (5bc35c3) @@ -0,0 +1,4 @@ +debhelper +autotools-dev +pkg-config +libgroonga-dev Added: packages/apt/sign-packages.sh (+42 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/sign-packages.sh 2013-01-29 13:26:31 +0900 (6e865d6) @@ -0,0 +1,42 @@ +#!/bin/sh + +script_base_dir=`dirname $0` + +if [ $# != 3 ]; then + echo "Usage: $0 GPG_UID DESITINATION CODES" + echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'" + exit 1 +fi + +GPG_UID=$1 +DESTINATION=$2 +CODES=$3 + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +for code_name in ${CODES}; do + case ${code_name} in + lenny|squeeze|wheezy|unstable) + distribution=debian + ;; + *) + distribution=ubuntu + ;; + esac + + base_directory=${DESTINATION}${distribution} + debsign -pgpg2 --re-sign -k${GPG_UID} \ + $(find ${base_directory} -name '*.dsc' -or -name '*.changes') & + if [ "${PARALLEL}" != "yes" ]; then + wait + fi +done + +wait Added: packages/apt/sign-repository.sh (+46 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/sign-repository.sh 2013-01-29 13:26:31 +0900 (c36ff0b) @@ -0,0 +1,46 @@ +#!/bin/sh + +script_base_dir=`dirname $0` + +if [ $# != 3 ]; then + echo "Usage: $0 GPG_UID DESTINATION CODES" + echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'" + exit 1 +fi + +GPG_UID=$1 +DESTINATION=$2 +CODES=$3 + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +for code_name in ${CODES}; do + case ${code_name} in + lenny|squeeze|wheezy|unstable) + distribution=debian + ;; + *) + distribution=ubuntu + ;; + esac + + release=${DESTINATION}${distribution}/dists/${code_name}/Release + rm -f ${release}.gpg + gpg2 --sign --detach-sign --armor \ + --local-user ${GPG_UID} \ + --output ${release}.gpg \ + ${release} & + + if [ "${PARALLEL}" != "yes" ]; then + wait + fi +done + +wait Added: packages/apt/update-repository.sh (+130 -0) 100755 =================================================================== --- /dev/null +++ packages/apt/update-repository.sh 2013-01-29 13:26:31 +0900 (65ebb9c) @@ -0,0 +1,130 @@ +#!/bin/sh + +script_base_dir=`dirname $0` + +if [ $# != 4 ]; then + echo "Usage: $0 PROJECT_NAME DESTINATION ARCHITECTURES CODES" + echo " e.g.: $0 mroonga repositories/ 'i386 amd64' 'lenny unstable hardy karmic'" + exit 1 +fi + +PROJECT_NAME=$1 +DESTINATION=$2 +ARCHITECTURES=$3 +CODES=$4 + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +update_repository() +{ + distribution=$1 + code_name=$2 + component=$3 + + rm -rf dists/${code_name} + mkdir -p dists/${code_name}/${component}/binary-i386/ + mkdir -p dists/${code_name}/${component}/binary-amd64/ + mkdir -p dists/${code_name}/${component}/source/ + + cat <<EOF > dists/.htaccess +Options +Indexes +EOF + + cat <<EOF > dists/${code_name}/${component}/binary-i386/Release +Archive: ${code_name} +Component: ${component} +Origin: The ${PROJECT_NAME} project +Label: The ${PROJECT_NAME} project +Architecture: i386 +EOF + + cat <<EOF > dists/${code_name}/${component}/binary-amd64/Release +Archive: ${code_name} +Component: ${component} +Origin: The ${PROJECT_NAME} project +Label: The ${PROJECT_NAME} project +Architecture: amd64 +EOF + + cat <<EOF > dists/${code_name}/${component}/source/Release +Archive: ${code_name} +Component: ${component} +Origin: The ${PROJECT_NAME} project +Label: The ${PROJECT_NAME} project +Architecture: source +EOF + + cat <<EOF > generate-${code_name}.conf +Dir::ArchiveDir "."; +Dir::CacheDir "."; +TreeDefault::Directory "pool/${code_name}/${component}"; +TreeDefault::SrcDirectory "pool/${code_name}/${component}"; +Default::Packages::Extensions ".deb"; +Default::Packages::Compress ". gzip bzip2"; +Default::Sources::Compress ". gzip bzip2"; +Default::Contents::Compress "gzip bzip2"; + +BinDirectory "dists/${code_name}/${component}/binary-i386" { + Packages "dists/${code_name}/${component}/binary-i386/Packages"; + Contents "dists/${code_name}/Contents-i386"; + SrcPackages "dists/${code_name}/${component}/source/Sources"; +}; + +BinDirectory "dists/${code_name}/${component}/binary-amd64" { + Packages "dists/${code_name}/${component}/binary-amd64/Packages"; + Contents "dists/${code_name}/Contents-amd64"; + SrcPackages "dists/${code_name}/${component}/source/Sources"; +}; + +Tree "dists/${code_name}" { + Sections "${component}"; + Architectures "i386 amd64 source"; +}; +EOF + apt-ftparchive generate generate-${code_name}.conf + chmod 644 dists/${code_name}/Contents-* + + rm -f dists/${code_name}/Release* + rm -f *.db + cat <<EOF > release-${code_name}.conf +APT::FTPArchive::Release::Origin "The ${PROJECT_NAME} project"; +APT::FTPArchive::Release::Label "The ${PROJECT_NAME} project"; +APT::FTPArchive::Release::Architectures "i386 amd64"; +APT::FTPArchive::Release::Codename "${code_name}"; +APT::FTPArchive::Release::Suite "${code_name}"; +APT::FTPArchive::Release::Components "${component}"; +APT::FTPArchive::Release::Description "${PACKAGE_NAME} packages"; +EOF + apt-ftparchive -c release-${code_name}.conf \ + release dists/${code_name} > /tmp/Release + mv /tmp/Release dists/${code_name} +} + +for code_name in ${CODES}; do + case ${code_name} in + lenny|squeeze|wheezy|unstable) + distribution=debian + component=main + ;; + *) + distribution=ubuntu + component=universe + ;; + esac + + mkdir -p ${DESTINATION}${distribution} + (cd ${DESTINATION}${distribution} + update_repository $distribution $code_name $component) & + if [ "${PARALLEL}" != "yes" ]; then + wait + fi +done + +wait Added: packages/debian/changelog (+5 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/changelog 2013-01-29 13:26:31 +0900 (f4f2b77) @@ -0,0 +1,5 @@ +groonga-normalizer-mysql (1.0.0-1) unstable; urgency=low + + * Initial release + + -- Kouhei Sutou <kou �� clear-code.com> Sat, 9 Feb 2013 00:00:00 +0900 Added: packages/debian/compat (+1 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/compat 2013-01-29 13:26:31 +0900 (7f8f011) @@ -0,0 +1 @@ +7 Added: packages/debian/control (+23 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/control 2013-01-29 13:26:31 +0900 (ab77da6) @@ -0,0 +1,23 @@ +Source: groonga-normalizer-mysql +Section: libs +Priority: optional +Maintainer: Kouhei Sutou <kou �� clear-code.com> +Build-Depends: + debhelper (>= 7.0.50), + autotools-dev +Standards-Version: 3.9.1 +Homepage: http://groonga.org/ + +Package: groonga-normalizer-mysql +Section: libs +Architecture: any +Depends: + ${misc:Depends}, + ${shlibs:Depends}, + libgroonga-dev +Description: MySQL derived normalizer for groonga. + Groonga is an open-source fulltext search engine and column store. + It lets you write high-performance applications that requires fulltext search. + . + This package provides a normalizer which normalizes text as same as MySQL does. + Added: packages/debian/copyright (+29 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/copyright 2013-01-29 13:26:31 +0900 (cd3295a) @@ -0,0 +1,29 @@ +This package was debianized by Kouhei Sutou <kou �� clear-code.com> on +Tue, 29 Jan 2013 14:52:04 +0000. + +It was downloaded from <http://groonga.org/> + +Upstream Author(s): + + Kouhei Sutou <kou****@clear*****> + +Copyright: + + Copyright(C) 2013 Brazil + +License: + + This library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +The Debian packaging is (C) 2013, Kouhei Sutou <kou �� clear-code.com> and +is licensed under the LGPL-2, see `/usr/share/common-licenses/LGPL-2'. Added: packages/debian/groonga-normalizer-mysql.install (+1 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/groonga-normalizer-mysql.install 2013-01-29 13:26:31 +0900 (1f58446) @@ -0,0 +1 @@ +usr/lib/groonga/plugins/normalizers/mysql* Added: packages/debian/patches/series (+0 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/patches/series 2013-01-29 13:26:31 +0900 (e69de29) Added: packages/debian/rules (+17 -0) 100755 =================================================================== --- /dev/null +++ packages/debian/rules 2013-01-29 13:26:31 +0900 (8dd221c) @@ -0,0 +1,17 @@ +#!/usr/bin/make -f +# -*- makefile-gmake -*- +# +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 +# This has to be exported to make some magic below work. +export DH_OPTIONS + +%: + dh $@ + +override_dh_auto_configure: + +# disable 'make check'. +override_dh_auto_test: + +override_dh_install: Added: packages/debian/source/format (+1 -0) 100644 =================================================================== --- /dev/null +++ packages/debian/source/format 2013-01-29 13:26:31 +0900 (163aaf8) @@ -0,0 +1 @@ +3.0 (quilt) -------------- next part -------------- HTML����������������������������...다운로드