null+****@clear*****
null+****@clear*****
2012年 5月 29日 (火) 16:48:06 JST
Kouhei Sutou 2012-05-29 16:48:06 +0900 (Tue, 29 May 2012) New Revision: 0bec5f27df1301cf52df265009106f935822a5d0 Log: yum: move packages to repositories/ Modified files: packages/yum/Makefile.am packages/yum/build-in-chroot.sh packages/yum/build-rpm.sh packages/yum/sign-rpm.sh packages/yum/update-repository.sh Modified: packages/yum/Makefile.am (+10 -6) =================================================================== --- packages/yum/Makefile.am 2012-05-29 16:36:05 +0900 (d641316) +++ packages/yum/Makefile.am 2012-05-29 16:48:06 +0900 (b48d82a) @@ -1,3 +1,4 @@ +REPOSITORIES_PATH = repositories DISTRIBUTIONS = fedora centos ARCHITECTURES = i386 x86_64 CHROOT_BASE = /var/lib/chroot @@ -21,21 +22,23 @@ ensure-rsync-path: fi download: ensure-rsync-path - for distribution in $(DISTRIBUTIONS); do \ - rsync -avz --progress --delete \ - $(RSYNC_PATH)/$${distribution}/ $${distribution}; \ + mkdir -p $(REPOSITORIES_PATH) + for distribution in $(DISTRIBUTIONS); do \ + rsync -avz --progress --delete \ + $(RSYNC_PATH)/$${distribution} $(REPOSITORIES_PATH)/; \ done sign: - ./sign-rpm.sh '$(GPG_UID)' '$(DISTRIBUTIONS)' + ./sign-rpm.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)' update: - ./update-repository.sh '$(DISTRIBUTIONS)' + ./update-repository.sh '$(REPOSITORIES_PATH)/' '$(DISTRIBUTIONS)' upload: ensure-rsync-path for distribution in $(DISTRIBUTIONS); do \ rsync -avz --progress --exclude .gitignore --delete \ - $${distribution}/ $(RSYNC_PATH)/$${distribution}; \ + $(REPOSITORIES_PATH)/$${distribution}/ \ + $(RSYNC_PATH)/$${distribution}; \ done build: build-in-chroot @@ -46,6 +49,7 @@ build-in-chroot: source $(VERSION) \ $(top_builddir)/$(PACKAGE) \ ../rpm \ + $(REPOSITORIES_PATH)/ \ $(CHROOT_BASE) \ '$(ARCHITECTURES)' \ '$(DISTRIBUTIONS)' \ Modified: packages/yum/build-in-chroot.sh (+13 -24) =================================================================== --- packages/yum/build-in-chroot.sh 2012-05-29 16:36:05 +0900 (3880b75) +++ packages/yum/build-in-chroot.sh 2012-05-29 16:48:06 +0900 (b2bf279) @@ -1,8 +1,8 @@ #!/bin/sh -if [ $# != 10 ]; then - echo "Usage: $0 PACKAGE VERSION SOURCE_BASE_NAME SPEC_DIR CHROOT_BASE ARCHITECTURES DISTRIBUTIONS HAVE_DEVELOPMENT_BRANCH USE_RPMFORGE USE_ATRPMS" - echo " e.g.: $0 milter-manager 1.1.1 ../milter-manager ../rpm /var/lib/chroot 'i386 x86_64' 'fedora centos' yes no no" +if [ $# != 11 ]; then + echo "Usage: $0 PACKAGE VERSION SOURCE_BASE_NAME SPEC_DIR DESTINATION CHROOT_BASE ARCHITECTURES DISTRIBUTIONS HAVE_DEVELOPMENT_BRANCH USE_RPMFORGE USE_ATRPMS" + echo " e.g.: $0 milter-manager 1.1.1 ../milter-manager ../rpm repositories/ /var/lib/chroot 'i386 x86_64' 'fedora centos' yes no no" exit 1 fi @@ -10,12 +10,13 @@ PACKAGE=$1 VERSION=$2 SOURCE_BASE_NAME=$3 SPEC_DIR=$4 -CHROOT_BASE=$5 -ARCHITECTURES=$6 -DISTRIBUTIONS=$7 -HAVE_DEVELOPMENT_BRANCH=$8 -USE_RPMFORGE=$9 -USE_ATRPMS=$10 +DESTINATION=$5 +CHROOT_BASE=$6 +ARCHITECTURES=$7 +DISTRIBUTIONS=$8 +HAVE_DEVELOPMENT_BRANCH=$9 +USE_RPMFORGE=$10 +USE_ATRPMS=$11 PATH=/usr/local/sbin:/usr/sbin:$PATH @@ -58,18 +59,13 @@ build_chroot() distribution_architecture=i686 fi fi - if [ "$distribution_name-$distribution_version" = "fedora-16" ]; then - rinse_distribution_version="15" - else - rinse_distribution_version="$distribution_version" - fi run_sudo mkdir -p ${base_dir}/etc/rpm rpm_platform=${distribution_architecture}-${distribution}-linux run_sudo sh -c "echo ${rpm_platform} > ${base_dir}/etc/rpm/platform" run_sudo rinse \ --arch $rinse_architecture \ - --distribution $distribution_name-$rinse_distribution_version \ + --distribution $distribution_name-$distribution_version \ --directory $base_dir run_sudo rinse --arch $rinse_architecture --clean-cache @@ -106,7 +102,7 @@ build() rpm_base_dir=${build_user_dir}/rpm rpm_dir=${rpm_base_dir}/RPMS/${architecture} srpm_dir=${rpm_base_dir}/SRPMS - pool_base_dir=${distribution}/${distribution_version} + pool_base_dir=${DESTINATION}${distribution}/${distribution_version} if test "${HAVE_DEVELOPMENT_BRANCH}" = "yes"; then minor_version=$(echo $VERSION | ruby -pe '$_.gsub!(/\A\d+\.(\d+)\..*/, "\\1")') if test $(expr ${minor_version} % 2) -eq 0; then @@ -139,19 +135,12 @@ build() run cp ${script_base_dir}/${PACKAGE}-build-options \ ${CHROOT_BASE}/$target/tmp/build-options run cp ${script_base_dir}/build-rpm.sh ${CHROOT_BASE}/$target/tmp/ + run_sudo rm -rf $rpm_dir $srpm_dir run_sudo su -c "chroot ${CHROOT_BASE}/$target /tmp/build-rpm.sh" run mkdir -p $binary_pool_dir run mkdir -p $source_pool_dir run cp -p $rpm_dir/*-${VERSION}* $binary_pool_dir run cp -p $srpm_dir/*-${VERSION}* $source_pool_dir - if [ $distribution = "centos" -a $distribution_version -eq 5 ]; then - mysql_version=$(grep '%define mysql_version_default' \ - ${CHROOT_BASE}/$target/tmp/${PACKAGE}.spec | \ - sed -e 's/%define mysql_version_default //g' | \ - tail -1) - run cp -p $rpm_dir/MySQL-*-${mysql_version}* $binary_pool_dir - run cp -p $srpm_dir/MySQL-${mysql_version}* $source_pool_dir - fi dependencies_dir=${build_user_dir}/dependencies dependencies_rpm_dir=${dependencies_dir}/RPMS Modified: packages/yum/build-rpm.sh (+6 -3) =================================================================== --- packages/yum/build-rpm.sh 2012-05-29 16:36:05 +0900 (4a0411b) +++ packages/yum/build-rpm.sh 2012-05-29 16:48:06 +0900 (1799fa9) @@ -74,10 +74,13 @@ EOF yum_options="$yum_options --enablerepo=atrpms" fi -if ! rpm -q groonga-repository > /dev/null 2>&1; then - run rpm -Uvh http://packages.groonga.org/${distribution}/groonga-repository-1.0.0-0.noarch.rpm +if ! rpm -q groonga-release > /dev/null 2>&1; then + release_rpm=groonga-release-1.1.0-0.noarch.rpm + wget http://packages.groonga.org/${distribution}/${release_rpm} + run rpm -Uvh ${release_rpm} + rm -f ${release_rpm} fi -run yum install --nogpgcheck -y groonga-repository +run yum install --nogpgcheck -y groonga-release rpmbuild_options="${BUILD_OPTIONS}" Modified: packages/yum/sign-rpm.sh (+6 -5) =================================================================== --- packages/yum/sign-rpm.sh 2012-05-29 16:36:05 +0900 (6dd4a02) +++ packages/yum/sign-rpm.sh 2012-05-29 16:48:06 +0900 (0b346ba) @@ -2,14 +2,15 @@ script_base_dir=`dirname $0` -if [ $# != 2 ]; then - echo "Usage: $0 GPG_UID DISTRIBUTIONS" - echo " e.g.: $0 'F10399C0' 'fedora centos'" +if [ $# != 3 ]; then + echo "Usage: $0 GPG_UID DESTINATION DISTRIBUTIONS" + echo " e.g.: $0 'F10399C0' repositories/ 'fedora centos'" exit 1 fi GPG_UID=$1 -DISTRIBUTIONS=$2 +DESTINATION=$2 +DISTRIBUTIONS=$3 run() { @@ -22,7 +23,7 @@ run() rpms="" for distribution in ${DISTRIBUTIONS}; do - rpms="${rpms} $(echo $script_base_dir/${distribution}/*/*/*/*.rpm)" + rpms="${rpms} $(echo ${DESTINATION}${distribution}/*/*/*/*.rpm)" done echo "NOTE: YOU JUST ENTER! YOU DON'T NEED TO INPUT PASSWORD!" Modified: packages/yum/update-repository.sh (+7 -6) =================================================================== --- packages/yum/update-repository.sh 2012-05-29 16:36:05 +0900 (108adae) +++ packages/yum/update-repository.sh 2012-05-29 16:48:06 +0900 (59eeafa) @@ -2,13 +2,14 @@ script_base_dir=`dirname $0` -if [ $# != 1 ]; then - echo "Usage: $0 DISTRIBUTIONS" - echo " e.g.: $0 'fedora centos'" +if [ $# != 2 ]; then + echo "Usage: $0 DESTINATION DISTRIBUTIONS" + echo " e.g.: $0 repositories/ 'fedora centos'" exit 1 fi -DISTRIBUTIONS=$1 +DESTINATION=$1 +DISTRIBUTIONS=$2 run() { @@ -20,7 +21,7 @@ run() } for distribution in ${DISTRIBUTIONS}; do - for dir in $script_base_dir/${distribution}/*/*; do - run createrepo $dir + for dir in ${DESTINATION}${distribution}/*/*; do + test -d $dir && run createrepo $dir done; done