You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(52) |
Nov
(902) |
Dec
(89) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(10) |
Feb
(103) |
Mar
(216) |
Apr
(184) |
May
(435) |
Jun
(123) |
Jul
(145) |
Aug
(107) |
Sep
(53) |
Oct
(140) |
Nov
(59) |
Dec
(40) |
| 2009 |
Jan
(28) |
Feb
(39) |
Mar
(70) |
Apr
(35) |
May
(146) |
Jun
(23) |
Jul
(6) |
Aug
(110) |
Sep
(65) |
Oct
(111) |
Nov
(127) |
Dec
(1) |
| 2010 |
Jan
(12) |
Feb
(2) |
Mar
(56) |
Apr
(123) |
May
(13) |
Jun
(120) |
Jul
(42) |
Aug
(2) |
Sep
(23) |
Oct
(3) |
Nov
(10) |
Dec
(1) |
| 2011 |
Jan
(9) |
Feb
(99) |
Mar
(3) |
Apr
(1) |
May
(18) |
Jun
|
Jul
(43) |
Aug
(1) |
Sep
(1) |
Oct
(34) |
Nov
(7) |
Dec
(74) |
| 2012 |
Jan
(10) |
Feb
(10) |
Mar
(71) |
Apr
(1) |
May
(9) |
Jun
(8) |
Jul
(2) |
Aug
(97) |
Sep
(1) |
Oct
(16) |
Nov
(3) |
Dec
(33) |
| 2013 |
Jan
(26) |
Feb
(3) |
Mar
|
Apr
(4) |
May
(9) |
Jun
(2) |
Jul
(6) |
Aug
(2) |
Sep
|
Oct
|
Nov
(32) |
Dec
(2) |
| 2014 |
Jan
(38) |
Feb
(39) |
Mar
|
Apr
|
May
(11) |
Jun
(22) |
Jul
|
Aug
(3) |
Sep
(3) |
Oct
(7) |
Nov
|
Dec
|
| 2015 |
Jan
(3) |
Feb
(1) |
Mar
(12) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: HAYASHI K. <nul...@cl...> - 2014-09-30 10:58:08
|
HAYASHI Kentaro 2014-09-30 19:53:44 +0900 (Tue, 30 Sep 2014) New Revision: ba8f526f5cd5416bf136d833032e1bb26484fbeb https://github.com/clear-code/cutter/commit/ba8f526f5cd5416bf136d833032e1bb26484fbeb Message: rpm centos: remove needless swap This part derives from Groonga's one, but Cutter doesn't require such a heavy machine spec. Modified files: packages/yum/build-rpm.sh Modified: packages/yum/build-rpm.sh (+0 -5) =================================================================== --- packages/yum/build-rpm.sh 2014-09-30 19:38:49 +0900 (7ce7f6b) +++ packages/yum/build-rpm.sh 2014-09-30 19:53:44 +0900 (c947515) @@ -13,11 +13,6 @@ rpmbuild_options= . /vagrant/env.sh -swap_file=/tmp/swap -run dd if=/dev/zero of="$swap_file" bs=1024 count=3024K -run mkswap "$swap_file" -run swapon "$swap_file" - distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z") if grep -q Linux /etc/redhat-release; then distribution_version=$(cut -d " " -f 4 /etc/redhat-release) |
|
From: HAYASHI K. <nul...@cl...> - 2014-09-30 10:40:17
|
HAYASHI Kentaro 2014-09-30 19:38:49 +0900 (Tue, 30 Sep 2014) New Revision: fe3e64ff9b2ca33c6b15e710dbc51375ee61e155 https://github.com/clear-code/cutter/commit/fe3e64ff9b2ca33c6b15e710dbc51375ee61e155 Message: rpm centos: use vagrant instead of chroot for building package Added files: packages/yum/Vagrantfile packages/yum/env.sh.in Removed files: packages/yum/build-in-chroot.sh Modified files: configure.ac packages/yum/Makefile.am packages/yum/build-rpm.sh Modified: configure.ac (+2 -1) =================================================================== --- configure.ac 2014-08-19 09:10:57 +0900 (b9ca92f) +++ configure.ac 2014-09-30 19:38:49 +0900 (f3199e0) @@ -1051,7 +1051,8 @@ AC_CONFIG_FILES([Makefile packages/rpm/centos/cutter.spec packages/apt/Makefile packages/ubuntu/Makefile - packages/yum/Makefile]) + packages/yum/Makefile + packages/yum/env.sh]) AC_OUTPUT Modified: packages/yum/Makefile.am (+23 -20) =================================================================== --- packages/yum/Makefile.am 2014-08-19 09:10:57 +0900 (6a9a1ca) +++ packages/yum/Makefile.am 2014-09-30 19:38:49 +0900 (9d39112) @@ -2,11 +2,8 @@ SERVER_PATH = $(SF_FRS) REPOSITORIES_PATH = repositories DISTRIBUTIONS = centos ARCHITECTURES = i386 x86_64 -CHROOT_BASE = /var/lib/chroot BASE_URL_PREFIX = http://downloads.sourceforge.net/project/$(PACKAGE) HAVE_DEVELOPMENT_BRANCH = no -USE_RPMFORGE = no -USE_ATRPMS = no release: download build sign-packages update-repository upload @@ -33,21 +30,20 @@ download: $(REPOSITORIES_PATH)/$${distribution}; \ done -build: build-in-chroot build-release-rpm +build: build-in-vm build-release-rpm -build-in-chroot: source - ./build-in-chroot.sh \ - $(PACKAGE) \ - $(VERSION) \ - $(top_builddir)/$(PACKAGE) \ - ../rpm \ - $(REPOSITORIES_PATH)/ \ - $(CHROOT_BASE) \ - '$(ARCHITECTURES)' \ - '$(DISTRIBUTIONS)' \ - '$(HAVE_DEVELOPMENT_BRANCH)' \ - '$(USE_RPMFORGE)' \ - '$(USE_ATRPMS)' +build-in-vm: source specs env.sh + vagrant destroy --force + for architecture in $(ARCHITECTURES); do \ + for version in 5 6 7; do \ + if [ $$version = 7 -a $$architecture = i386 ]; then \ + continue; \ + fi; \ + id=centos-$$version-$$architecture; \ + vagrant up $$id; \ + vagrant destroy --force $$id; \ + done; \ + done build-release-rpm: RPM-GPG-KEY-$(PACKAGE) ./build-release-rpm.sh \ @@ -65,10 +61,17 @@ ensure-public-key: RPM-GPG-KEY-$(PACKAGE): ensure-public-key gpg --armor --export '$(GPG_UID)' > $@ -source: ../$(PACKAGE)-$(VERSION).tar.gz +source: tmp/$(PACKAGE)-$(VERSION).tar.gz -../$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz - ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz ../ +tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz + mkdir -p tmp/ + cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz tmp/ $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz: cd $(abs_top_builddir) && $(MAKE) dist + +specs: tmp/centos/$(PACKAGE).spec + +tmp/centos/$(PACKAGE).spec: $(builddir)/../rpm/centos/$(PACKAGE).spec + mkdir -p tmp/centos + cp $(builddir)/../rpm/centos/$(PACKAGE).spec tmp/centos/ Added: packages/yum/Vagrantfile (+41 -0) 100644 =================================================================== --- /dev/null +++ packages/yum/Vagrantfile 2014-09-30 19:38:49 +0900 (20627ed) @@ -0,0 +1,41 @@ +# -*- 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 => "centos-5-i386", + :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10-i386_chef-provisionerless.box", + }, + { + :id => "centos-5-x86_64", + :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box", + }, + { + :id => "centos-6-i386", + :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5-i386_chef-provisionerless.box", + }, + { + :id => "centos-6-x86_64", + :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box", + }, + { + :id => "centos-7-x86_64", + :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.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, :path => "build-rpm.sh") + node.vm.provider("virtualbox") do |virtual_box| + virtual_box.memory = 768 + end + end + end +end Deleted: packages/yum/build-in-chroot.sh (+0 -173) 100755 =================================================================== --- packages/yum/build-in-chroot.sh 2014-08-19 09:10:57 +0900 (d8589b5) +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/sh - -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 - -PACKAGE=$1 -VERSION=$2 -SOURCE_BASE_NAME=$3 -SPEC_DIR=$4 -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 - -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 - distribution_name=$2 - distribution_version=$3 - - if [ $architecture = "x86_64" ]; then - rinse_architecture="amd64" - distribution_architecture=$architecture - else - rinse_architecture=$architecture - if [ "$distribution_name-$distribution_version" = "centos-5" ]; then - distribution_architecture=$architecture - else - distribution_architecture=i686 - fi - 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-$distribution_version \ - --directory $base_dir - run_sudo rinse --arch $rinse_architecture --clean-cache - - run_sudo sh -c "echo >> /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}/dev - run_sudo mount ${base_dir}/dev/pts - run_sudo mount ${base_dir}/proc -} - -build() -{ - architecture=$1 - distribution=$2 - distribution_version=$3 - - target=${distribution}-${distribution_version}-${architecture} - base_dir=${CHROOT_BASE}/${target} - if [ ! -d $base_dir ]; then - run build_chroot $architecture $distribution $distribution_version - fi - - build_user=${PACKAGE}-build - build_user_dir=${base_dir}/home/${build_user} - rpm_base_dir=${build_user_dir}/rpmbuild - rpm_dir=${rpm_base_dir}/RPMS/${architecture} - srpm_dir=${rpm_base_dir}/SRPMS - 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 - branch_name=stable - else - branch_name=development - fi - pool_base_dir=${pool_base_dir}/${branch_name} - fi - binary_pool_dir=$pool_base_dir/$architecture/Packages - source_pool_dir=$pool_base_dir/source/SRPMS - if test -f ${SOURCE_BASE_NAME}-${VERSION}-*.src.rpm; then - run cp ${SOURCE_BASE_NAME}-${VERSION}-*.src.rpm \ - ${CHROOT_BASE}/$target/tmp/ - else - run cp ${SOURCE_BASE_NAME}-${VERSION}.* \ - ${CHROOT_BASE}/$target/tmp/ - run cp ${SPEC_DIR}/${distribution}/${PACKAGE}.spec \ - ${CHROOT_BASE}/$target/tmp/ - fi - run echo $PACKAGE > ${CHROOT_BASE}/$target/tmp/build-package - run echo $VERSION > ${CHROOT_BASE}/$target/tmp/build-version - run echo $(basename ${SOURCE_BASE_NAME}) > \ - ${CHROOT_BASE}/$target/tmp/build-source-base-name - 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 echo $USE_RPMFORGE > ${CHROOT_BASE}/$target/tmp/build-use-rpmforge - run echo $USE_ATRPMS > ${CHROOT_BASE}/$target/tmp/build-use-atrpms - 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 - - dependencies_dir=${build_user_dir}/dependencies - dependencies_rpm_dir=${dependencies_dir}/RPMS - dependencies_srpm_dir=${dependencies_dir}/SRPMS - if [ -d "${dependencies_rpm_dir}" ]; then - run cp -p ${dependencies_rpm_dir}/* $binary_pool_dir - fi - if [ -d "${dependencies_srpm_dir}" ]; then - run cp -p ${dependencies_srpm_dir}/* $source_pool_dir - fi -} - -for architecture in $ARCHITECTURES; do - for distribution in $DISTRIBUTIONS; do - case $distribution in - fedora) - distribution_versions="17" - ;; - centos) - distribution_versions="5 6" - ;; - esac - for distribution_version in $distribution_versions; do - if test "$parallel" = "yes"; then - build $architecture $distribution $distribution_version & - else - mkdir -p tmp - build_log=tmp/build-$distribution-$distribution_version-$architecture.log - build $architecture $distribution $distribution_version 2>&1 | tee $build_log - fi; - done; - done; -done - -if test "$parallel" = "yes"; then - wait -fi Modified: packages/yum/build-rpm.sh (+44 -102) =================================================================== --- packages/yum/build-rpm.sh 2014-08-19 09:10:57 +0900 (5661555) +++ packages/yum/build-rpm.sh 2014-09-30 19:38:49 +0900 (7ce7f6b) @@ -1,127 +1,69 @@ #!/bin/sh -LANG=C - -PACKAGE=$(cat /tmp/build-package) -VERSION=$(cat /tmp/build-version) -SOURCE_BASE_NAME=$(cat /tmp/build-source-base-name) -USER_NAME=$(cat /tmp/build-user) -DEPENDED_PACKAGES=$(cat /tmp/depended-packages) -USE_RPMFORGE=$(cat /tmp/build-use-rpmforge) -USE_ATRPMS=$(cat /tmp/build-use-atrpms) -BUILD_OPTIONS=$(cat /tmp/build-options) -BUILD_SCRIPT=/tmp/build-${PACKAGE}.sh - run() { "$@" if test $? -ne 0; then - echo "Failed $@" - exit 1 + echo "Failed $@" + exit 1 fi } -yum_options= +rpmbuild_options= -distribution=$(cut -d ' ' -f 1 /etc/redhat-release | tr 'A-Z' 'a-z') -if grep -q Linux /etc/redhat-release; then - distribution_version=$(cut -d ' ' -f 4 /etc/redhat-release) -else - distribution_version=$(cut -d ' ' -f 3 /etc/redhat-release) -fi -if ! rpm -q ${distribution}-release > /dev/null 2>&1; then - packages_dir=/var/cache/yum/core/packages - release_rpm=${distribution}-release-${distribution_version}-*.rpm - run rpm -Uvh --force ${packages_dir}/${release_rpm} - run rpm -Uvh --force ${packages_dir}/ca-certificates-*.rpm -fi +. /vagrant/env.sh -if test "$USE_RPMFORGE" = "yes"; then - if ! rpm -q rpmforge-release > /dev/null 2>&1; then - architecture=$(cut -d '-' -f 1 /etc/rpm/platform) - rpmforge_url=http://packages.sw.be/rpmforge-release - rpmforge_rpm_base=rpmforge-release-0.5.2-2.el5.rf.${architecture}.rpm - wget $rpmforge_url/$rpmforge_rpm_base - run rpm -Uvh $rpmforge_rpm_base - rm $rpmforge_rpm_base - sed -i'' -e 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/rpmforge.repo - fi - yum_options="$yum_options --enablerepo=rpmforge" -fi +swap_file=/tmp/swap +run dd if=/dev/zero of="$swap_file" bs=1024 count=3024K +run mkswap "$swap_file" +run swapon "$swap_file" -if test "$USE_ATRPMS" = "yes"; then - case "$(cat /etc/redhat-release)" in - CentOS*) - repository_label=CentOS - repository_prefix=el - ;; - *) - repository_label=Fedora - repository_prefix=f - ;; - esac - cat <<EOF > /etc/yum.repos.d/atrpms.repo -[atrpms] -name=${repository_label} \$releasever - \$basearch - ATrpms -baseurl=http://dl.atrpms.net/${repository_prefix}\$releasever-\$basearch/atrpms/stable -gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms -gpgcheck=1 -enabled=0 -EOF - yum_options="$yum_options --enablerepo=atrpms" +distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z") +if grep -q Linux /etc/redhat-release; then + distribution_version=$(cut -d " " -f 4 /etc/redhat-release) +else + distribution_version=$(cut -d " " -f 3 /etc/redhat-release) fi +distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g') -rpmbuild_options="${BUILD_OPTIONS}" +architecture="$(arch)" +case "${architecture}" in + i*86) + architecture=i386 + ;; +esac -run yum update ${yum_options} -y -run yum install ${yum_options} -y rpm-build rpmdevtools tar ${DEPENDED_PACKAGES} -run yum clean ${yum_options} packages - -if ! id $USER_NAME >/dev/null 2>&1; then - run useradd -m $USER_NAME -fi - -cat <<EOF > $BUILD_SCRIPT -#!/bin/sh +run yum groupinstall -y "Development Tools" +run yum install -y rpm-build rpmdevtools tar ${DEPENDED_PACKAGES} if [ -x /usr/bin/rpmdev-setuptree ]; then rm -rf .rpmmacros - rpmdev-setuptree + run rpmdev-setuptree else - cat <<EOM > ~/.rpmmacros -%_topdir \$HOME/rpmbuild + run cat <<EOM > ~/.rpmmacros +%_topdir ${HOME}/rpmbuild EOM - - mkdir -p rpmbuild/SOURCES - mkdir -p rpmbuild/SPECS - mkdir -p rpmbuild/BUILD - mkdir -p rpmbuild/RPMS - mkdir -p rpmbuild/SRPMS + run mkdir -p ~/rpmbuild/SOURCES + run mkdir -p ~/rpmbuild/SPECS + run mkdir -p ~/rpmbuild/BUILD + run mkdir -p ~/rpmbuild/RPMS + run mkdir -p ~/rpmbuild/SRPMS fi -if test -f /tmp/${SOURCE_BASE_NAME}-$VERSION-*.src.rpm; then - if ! rpm -Uvh /tmp/${SOURCE_BASE_NAME}-$VERSION-*.src.rpm; then - cd rpmbuild/SOURCES - rpm2cpio /tmp/${SOURCE_BASE_NAME}-$VERSION-*.src.rpm | cpio -id - if ! yum info tcp_wrappers-devel >/dev/null 2>&1; then - sed -i'' -e 's/tcp_wrappers-devel/tcp_wrappers/g' ${PACKAGE}.spec - fi - if ! yum info libdb-devel >/dev/null 2>&1; then - sed -i'' -e 's/libdb-devel/db4-devel/g' ${PACKAGE}.spec - fi - sed -i'' -e 's/BuildArch: noarch//g' ${PACKAGE}.spec - mv ${PACKAGE}.spec ../SPECS/ - cd - fi -else - cp /tmp/${SOURCE_BASE_NAME}-$VERSION.* rpmbuild/SOURCES/ - cp /tmp/${PACKAGE}.spec rpmbuild/SPECS/ -fi +repository="/vagrant/repositories/${distribution}/${distribution_version}" +rpm_dir="${repository}/${architecture}/Packages" +srpm_dir="${repository}/source/SRPMS" +run mkdir -p "${rpm_dir}" "${srpm_dir}" + +# for debug +# rpmbuild_options="$rpmbuild_options --define 'optflags -O0 -g3'" + +cd -chmod o+rx . rpmbuild rpmbuild/RPMS rpmbuild/SRPMS +run cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/ +run cp /vagrant/tmp/${distribution}/${PACKAGE}.spec rpmbuild/SPECS/ -rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${PACKAGE}.spec -EOF +run rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${PACKAGE}.spec -run chmod +x $BUILD_SCRIPT -run su - $USER_NAME $BUILD_SCRIPT +run mv rpmbuild/RPMS/*/* "${rpm_dir}/" +run mv rpmbuild/SRPMS/* "${srpm_dir}/" Added: packages/yum/env.sh.in (+15 -0) 100644 =================================================================== --- /dev/null +++ packages/yum/env.sh.in 2014-09-30 19:38:49 +0900 (3f92559) @@ -0,0 +1,15 @@ +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +DEPENDED_PACKAGES=" +intltool +gettext +gtk-doc +gcc +gcc-c++ +make +glib2-devel +libsoup-devel +gtk2-devel +goffice08-devel +gstreamer-devel +" |
|
From: Kenji O. <nul...@cl...> - 2014-08-19 00:15:25
|
Kenji Okimoto 2014-08-19 09:10:57 +0900 (Tue, 19 Aug 2014) New Revision: 2a2fa51c82c15a9a3a161bed037176be42f812af https://github.com/clear-code/cutter/commit/2a2fa51c82c15a9a3a161bed037176be42f812af Message: misc: Fix man syntax warning `title` is an Array Modified files: misc/rd2man-lib.rb Modified: misc/rd2man-lib.rb (+2 -2) =================================================================== --- misc/rd2man-lib.rb 2014-08-06 09:03:02 +0900 (3c50948) +++ misc/rd2man-lib.rb 2014-08-19 09:10:57 +0900 (78ba6e8) @@ -22,9 +22,9 @@ EOT @title = @title.upcase "" when 2 - ".SH #{title}\n" + ".SH #{title.join}\n" else - ".SS #{title}\n" + ".SS #{title.join}\n" end end |
|
From: Noriki N. <nul...@cl...> - 2014-08-06 00:03:26
|
Noriki Nakamura 2014-08-05 23:17:05 +0900 (Tue, 05 Aug 2014) New Revision: b90dc726de47440a06e32af73e242b3bca4fd6b4 https://github.com/clear-code/cutter/commit/b90dc726de47440a06e32af73e242b3bca4fd6b4 Merged 0a073e5: Merge pull request #15 from bynnchapu/add-hatohol-to-users Message: *USERS*: add Hatohol. Modified files: USERS USERS.ja Modified: USERS (+2 -0) =================================================================== --- USERS 2014-06-25 10:43:16 +0900 (22d15d0) +++ USERS 2014-08-05 23:17:05 +0900 (382e38e) @@ -28,3 +28,5 @@ # * ((<Poppler|URL:http://poppler.freedesktop.org/>)): # PDF rendering library. # + * ((<Hatohol|URL:https://github.com/project-hatohol/hatohol>)): + Operational integrated management software Modified: USERS.ja (+2 -0) =================================================================== --- USERS.ja 2014-06-25 10:43:16 +0900 (c2ddfb7) +++ USERS.ja 2014-08-05 23:17:05 +0900 (4566aec) @@ -27,3 +27,5 @@ # * ((<Poppler|URL:http://poppler.freedesktop.org/>)): PDF # レンダリングライブラリ * ((<海野さん|URL:http://uhideyuki.sakura.ne.jp/uDiary/?category=Cutter>)) + * ((<Hatohol|URL:https://github.com/project-hatohol/hatohol>)): + 運用統合管理ソフトウェア |
|
From: okkez <nul...@cl...> - 2014-08-06 00:03:24
|
okkez 2014-08-06 09:03:02 +0900 (Wed, 06 Aug 2014) New Revision: 0a073e530fe9a76ba88c24c105849d25d7747fc2 https://github.com/clear-code/cutter/commit/0a073e530fe9a76ba88c24c105849d25d7747fc2 Message: Merge pull request #15 from bynnchapu/add-hatohol-to-users *USERS*: add Hatohol. |
|
From: Kouhei S. <nul...@cl...> - 2014-06-25 01:43:46
|
Kouhei Sutou 2014-06-25 10:43:16 +0900 (Wed, 25 Jun 2014) New Revision: e2f5261b6de020d05161c938695eafcdfb59583a https://github.com/clear-code/cutter/commit/e2f5261b6de020d05161c938695eafcdfb59583a Message: sample glib: remove API changed test Modified files: sample/glib/utf8-validate.c Modified: sample/glib/utf8-validate.c (+0 -1) =================================================================== --- sample/glib/utf8-validate.c 2014-06-25 10:27:22 +0900 (5a4017f) +++ sample/glib/utf8-validate.c 2014-06-25 10:43:16 +0900 (ab438a9) @@ -73,7 +73,6 @@ struct { /* last sequence of each length */ { "\x7f", -1, 1, TRUE }, { "\xdf\xbf", -1, 2, TRUE }, - { "\xef\xbf\xbf", -1, 0, FALSE }, { "\xf7\xbf\xbf\xbf", -1, 0, FALSE }, { "\xfb\xbf\xbf\xbf\xbf", -1, 0, FALSE }, { "\xfd\xbf\xbf\xbf\xbf\xbf", -1, 0, FALSE }, |
|
From: Kouhei S. <nul...@cl...> - 2014-06-25 01:30:26
|
Kouhei Sutou 2014-06-25 10:27:22 +0900 (Wed, 25 Jun 2014) New Revision: d82aae568d0dd8c032bc58fe1cd04614b8836469 https://github.com/clear-code/cutter/commit/d82aae568d0dd8c032bc58fe1cd04614b8836469 Message: sample glib: remove an unmaintainable test It causes the following warning: In file included from ../../cutter/cut-assertions.h:23:0, from ../../cutter/cutter.h:26, from regex.c:21: regex.c: In function 'test_split': ../../cutter/cut-assertions-helper.h:43:5: warning: 'cut_previous_jump_buffer' may be used uninitialized in this function [-Wmaybe-uninitialized] cut_test_context_set_jump_buffer(cut_get_current_test_context(), \ ^ In file included from ../../cutter/cutter.h:28:0, from regex.c:21: ../../cutter/cut-assertions-helper.h:32:14: note: 'cut_previous_jump_buffer' was declared here jmp_buf *cut_previous_jump_buffer; \ ^ ../../cutter/cut-helper.h:394:9: note: in definition of macro 'cut_trace_with_info_expression' expression; \ ^ ../../cutter/cut-assertions.h:231:9: note: in expansion of macro 'cut_test_with_user_message' cut_test_with_user_message( \ ^ regex.c:1193:5: note: in expansion of macro 'cut_assert_equal_int' cut_assert_equal_int (g_strv_length (expected), token_count); \ ^ regex.c:1222:3: note: in expansion of macro 'TEST_SPLIT' TEST_SPLIT("a", "", 0, 1, expected1); ^ ../../cutter/cut-helper.h:396:5: warning: '_cut_test_context' may be used uninitialized in this function [-Wmaybe-uninitialized] cut_test_context_pop_backtrace(_cut_test_context); \ ^ ../../cutter/cut-helper.h:385:21: note: '_cut_test_context' was declared here CutTestContext *_cut_test_context; \ ^ ../../cutter/cut-assertions.h:230:5: note: in expansion of macro 'cut_trace_with_info_expression' cut_trace_with_info_expression( \ ^ regex.c:1193:5: note: in expansion of macro 'cut_assert_equal_int' cut_assert_equal_int (g_strv_length (expected), token_count); \ ^ regex.c:1222:3: note: in expansion of macro 'TEST_SPLIT' TEST_SPLIT("a", "", 0, 1, expected1); ^ But we can't fix it with simple and fuss-free way. Removed files: sample/glib/regex.c Modified files: sample/glib/Makefile.am Modified: sample/glib/Makefile.am (+0 -6) =================================================================== --- sample/glib/Makefile.am 2014-06-21 15:17:39 +0900 (b549fbe) +++ sample/glib/Makefile.am 2014-06-25 10:27:22 +0900 (f00117f) @@ -24,11 +24,6 @@ noinst_LTLIBRARIES = \ test_utf8_validate.la \ test_uri.la -if !GLIB_2_12 -noinst_LTLIBRARIES += \ - test_regex.la -endif - AM_LDFLAGS = \ -rpath `pwd`/.libs \ -module \ @@ -43,7 +38,6 @@ test_array_la_SOURCES = array.c test_base64_la_SOURCES = base64.c test_iochannel_la_SOURCES = iochannel.c test_keyfile_la_SOURCES = keyfile.c -test_regex_la_SOURCES = regex.c test_uri_la_SOURCES = uri.c test_utf8_pointer_la_SOURCES = utf8-pointer.c test_utf8_validate_la_SOURCES = utf8-validate.c Deleted: sample/glib/regex.c (+0 -1374) 100644 =================================================================== --- sample/glib/regex.c 2014-06-21 15:17:39 +0900 (603fb66) +++ /dev/null @@ -1,1374 +0,0 @@ -/* -*- c-file-style: "gnu" -*- */ -/* - * Copyright (C) 2005 - 2006, Marco Barisione <ma...@ba...> - * - * 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, or (at your option) any later version. - * - * 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <cutter.h> -#include <cut-utils.h> - -#include <string.h> -#include <locale.h> -#include <glib.h> - -/* U+20AC EURO SIGN (symbol, currency) */ -#define EURO "\xe2\x82\xac" -/* U+00E0 LATIN SMALL LETTER A WITH GRAVE (letter, lowercase) */ -#define AGRAVE "\xc3\xa0" -/* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE (letter, uppercase) */ -#define AGRAVE_UPPER "\xc3\x80" -/* U+00E8 LATIN SMALL LETTER E WITH GRAVE (letter, lowercase) */ -#define EGRAVE "\xc3\xa8" -/* U+00F2 LATIN SMALL LETTER O WITH GRAVE (letter, lowercase) */ -#define OGRAVE "\xc3\xb2" -/* U+014B LATIN SMALL LETTER ENG (letter, lowercase) */ -#define ENG "\xc5\x8b" -/* U+0127 LATIN SMALL LETTER H WITH STROKE (letter, lowercase) */ -#define HSTROKE "\xc4\xa7" -/* U+0634 ARABIC LETTER SHEEN (letter, other) */ -#define SHEEN "\xd8\xb4" -/* U+1374 ETHIOPIC NUMBER THIRTY (number, other) */ -#define ETH30 "\xe1\x8d\xb4" - -/* A random value use to mark untouched integer variables. */ -#define UNTOUCHED -559038737 - -void test_regex_new (void); -void test_regex_new_fail (void); -void test_match_simple (void); -void test_match (void); -void test_mismatch (void); -void test_match_count (void); -void test_get_string_number (void); -void test_escape (void); -void test_check_replacement (void); -void test_replace (void); -void test_partial_match (void); -void test_replace_lit (void); -void test_expand (void); -void test_match_next (void); -void test_match_all (void); -void test_sub_pattern (void); -void test_named_sub_pattern (void); -void test_fetch_all (void); -void test_split_simple (void); -void test_split (void); - -typedef struct _Match -{ - gchar *string; - gint start, end; -} Match; - -static GRegex *regex; -static GMatchInfo *match_info; -static GSList *expected_matches, *actual_matches; -static gchar *escaped_string, *replaced_string, *expanded_string, *substring; - -void -setup (void) -{ - regex = NULL; - match_info = NULL; - expected_matches = NULL; - actual_matches = NULL; - escaped_string = NULL; - replaced_string = NULL; - expanded_string = NULL; - substring = NULL; -} - -static void -free_regex (void) -{ - if (regex) - g_regex_unref (regex); - regex = NULL; -} - -static void -free_match_info (void) -{ - if (match_info) - g_match_info_free (match_info); - match_info = NULL; - -} - -static void -free_match (gpointer data, gpointer user_data) -{ - Match *match = data; - if (match == NULL) - return; - g_free (match->string); - g_free (match); -} - -static void -free_expected_matches (void) -{ - g_slist_foreach (expected_matches, free_match, NULL); - g_slist_free (expected_matches); - expected_matches = NULL; -} - -static void -free_actual_matches (void) -{ - g_slist_foreach (actual_matches, free_match, NULL); - g_slist_free (actual_matches); - actual_matches = NULL; -} - -static void -free_escaped_string (void) -{ - g_free (escaped_string); - escaped_string = NULL; -} - -static void -free_replaced_string (void) -{ - g_free (replaced_string); - replaced_string = NULL; -} - -static void -free_expanded_string (void) -{ - g_free (expanded_string); - expanded_string = NULL; -} - -static void -free_substring (void) -{ - g_free (substring); - substring = NULL; -} - -void -teardown (void) -{ - free_regex (); - free_match_info (); - free_expected_matches (); - free_actual_matches (); - free_escaped_string (); - free_replaced_string (); - free_expanded_string (); - free_substring (); -} - -static void -cut_assert_regex_new_without_free (const gchar *pattern, - GRegexCompileFlags compile_opts, - GRegexMatchFlags match_opts) -{ - regex = g_regex_new (pattern, compile_opts, match_opts, NULL); - cut_assert (regex, - cut_message ("failed (pattern: \"%s\", compile: %d, match %d)", - pattern, compile_opts, match_opts)); - cut_assert_equal_string (pattern, g_regex_get_pattern (regex)); -} - -static void -cut_assert_regex_new (const gchar *pattern, - GRegexCompileFlags compile_opts, - GRegexMatchFlags match_opts) -{ - cut_assert_regex_new_without_free (pattern, compile_opts, match_opts); - free_regex (); -} - -void -test_regex_new (void) -{ - cut_assert_regex_new ("", 0, 0); - cut_assert_regex_new (".*", 0, 0); - cut_assert_regex_new (".*", G_REGEX_OPTIMIZE, 0); - cut_assert_regex_new (".*", G_REGEX_MULTILINE, 0); - cut_assert_regex_new (".*", G_REGEX_DOTALL, 0); - cut_assert_regex_new (".*", G_REGEX_DOTALL, G_REGEX_MATCH_NOTBOL); - cut_assert_regex_new ("(123\\d*)[a-zA-Z]+(?P<hello>.*)", 0, 0); - cut_assert_regex_new ("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS, 0); - cut_assert_regex_new ("(123\\d*)[a-zA-Z]+(?P<hello>.*)", - G_REGEX_CASELESS | G_REGEX_OPTIMIZE, 0); - cut_assert_regex_new ("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES, 0); - cut_assert_regex_new ("(?P<A>x)|(?P<A>y)", - G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, 0); - /* This gives "internal error: code overflow" with pcre 6.0 */ - cut_assert_regex_new ("(?i)(?-i)", 0, 0); -} - -static void -cut_assert_regex_new_fail (const gchar *pattern, - GRegexCompileFlags compile_opts) -{ - regex = g_regex_new (pattern, compile_opts, 0, NULL); - cut_assert_null (regex, - cut_message ("failed (pattern: \"%s\", compile: %d)", - pattern, compile_opts)); -} - -void -test_regex_new_fail (void) -{ - cut_assert_regex_new_fail ("(", 0); - cut_assert_regex_new_fail (")", 0); - cut_assert_regex_new_fail ("[", 0); - cut_assert_regex_new_fail ("*", 0); - cut_assert_regex_new_fail ("?", 0); - cut_assert_regex_new_fail ("(?P<A>x)|(?P<A>y)", 0); -} - -#define cut_assert_match_simple(pattern, string, \ - compile_options, match_options) \ - cut_assert (g_regex_match_simple (pattern, string, \ - compile_options, match_options)) - -#define cut_assert_not_match_simple(pattern, string, \ - compile_options, match_options) \ - cut_assert (!g_regex_match_simple (pattern, string, \ - compile_options, match_options)) - -void -test_match_simple (void) -{ - cut_assert_not_match_simple ("a", "", 0, 0); - cut_assert_not_match_simple ("a", "", 0, 0); - cut_assert_match_simple ("a", "a", 0, 0); - cut_assert_match_simple ("a", "ba", 0, 0); - cut_assert_not_match_simple ("^a", "ba", 0, 0); - cut_assert_not_match_simple ("a", "ba", G_REGEX_ANCHORED, 0); - cut_assert_not_match_simple ("a", "ba", 0, G_REGEX_MATCH_ANCHORED); - cut_assert_match_simple ("a", "ab", G_REGEX_ANCHORED, 0); - cut_assert_match_simple ("a", "ab", 0, G_REGEX_MATCH_ANCHORED); - cut_assert_match_simple ("a", "a", G_REGEX_CASELESS, 0); - cut_assert_match_simple ("a", "A", G_REGEX_CASELESS, 0); - /* These are needed to test extended properties. */ - cut_assert_match_simple (AGRAVE, AGRAVE, G_REGEX_CASELESS, 0); - cut_assert_match_simple (AGRAVE, AGRAVE_UPPER, G_REGEX_CASELESS, 0); - cut_assert_match_simple ("\\p{L}", "a", 0, 0); - cut_assert_not_match_simple ("\\p{L}", "1", 0, 0); - cut_assert_match_simple ("\\p{L}", AGRAVE, 0, 0); - cut_assert_match_simple ("\\p{L}", AGRAVE_UPPER, 0, 0); - cut_assert_match_simple ("\\p{L}", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{L}", ETH30, 0, 0); - cut_assert_match_simple ("\\p{Ll}", "a", 0, 0); - cut_assert_match_simple ("\\p{Ll}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{Ll}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{Ll}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Sc}", AGRAVE, 0, 0); - cut_assert_match_simple ("\\p{Sc}", EURO, 0, 0); - cut_assert_not_match_simple ("\\p{Sc}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{N}", "a", 0, 0); - cut_assert_match_simple ("\\p{N}", "1", 0, 0); - cut_assert_not_match_simple ("\\p{N}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{N}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{N}", SHEEN, 0, 0); - cut_assert_match_simple ("\\p{N}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Nd}", "a", 0, 0); - cut_assert_match_simple ("\\p{Nd}", "1", 0, 0); - cut_assert_not_match_simple ("\\p{Nd}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{Nd}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{Nd}", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{Nd}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Common}", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{Common}", "a", 0, 0); - cut_assert_not_match_simple ("\\p{Common}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{Common}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{Common}", ETH30, 0, 0); - cut_assert_match_simple ("\\p{Common}", "%", 0, 0); - cut_assert_match_simple ("\\p{Common}", "1", 0, 0); - cut_assert_match_simple ("\\p{Arabic}", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", "a", 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", "%", 0, 0); - cut_assert_not_match_simple ("\\p{Arabic}", "1", 0, 0); - cut_assert_not_match_simple ("\\p{Latin}", SHEEN, 0, 0); - cut_assert_match_simple ("\\p{Latin}", "a", 0, 0); - cut_assert_match_simple ("\\p{Latin}", AGRAVE, 0, 0); - cut_assert_match_simple ("\\p{Latin}", AGRAVE_UPPER, 0, 0); - cut_assert_not_match_simple ("\\p{Latin}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Latin}", "%", 0, 0); - cut_assert_not_match_simple ("\\p{Latin}", "1", 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", "a", 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", AGRAVE, 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", AGRAVE_UPPER, 0, 0); - cut_assert_match_simple ("\\p{Ethiopic}", ETH30, 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", "%", 0, 0); - cut_assert_not_match_simple ("\\p{Ethiopic}", "1", 0, 0); - cut_assert_match_simple ("\\p{L}(?<=\\p{Arabic})", SHEEN, 0, 0); - cut_assert_not_match_simple ("\\p{L}(?<=\\p{Latin})", SHEEN, 0, 0); - /* Invalid patterns. */ - cut_assert_not_match_simple ("\\", "a", 0, 0); - cut_assert_not_match_simple ("[", "", 0, 0); -} - -static void -cut_assert_match_full (const gchar *pattern, - GRegexCompileFlags compile_options, - GRegexMatchFlags pattern_match_options, - const gchar *string, - gssize length, - gint start_position, - GRegexMatchFlags match_options) -{ - cut_assert_regex_new_without_free (pattern, compile_options, - pattern_match_options); - cut_assert (g_regex_match_full (regex, string, length, start_position, - match_options, NULL, NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - if (length == -1 && start_position == 0) - { - cut_assert (g_regex_match (regex, string, match_options, NULL), - cut_message ("failed (pattern: \"%s\", string: \"%s\")", - pattern, string)); - } - free_regex (); -} - -void -test_match (void) -{ - cut_assert_match_full ("a", 0, 0, "a", -1, 0, 0); - cut_assert_match_full ("a", G_REGEX_CASELESS, 0, "A", -1, 0, 0); - cut_assert_match_full ("a", 0, 0, "bab", -1, 0, 0); - cut_assert_match_full ("a", 0, G_REGEX_ANCHORED, "a", -1, 0, 0); - cut_assert_match_full ("a|b", 0, 0, "a", -1, 0, 0); - cut_assert_match_full ("^.$", 0, 0, EURO, -1, 0, 0); - cut_assert_match_full ("^.{3}$", G_REGEX_RAW, 0, EURO, -1, 0, 0); - cut_assert_match_full (AGRAVE, G_REGEX_CASELESS, 0, AGRAVE_UPPER, -1, 0, 0); - cut_assert_match_full ("a", 0, 0, "a", -1, 0, G_REGEX_ANCHORED); - - /* New lines handling. */ - cut_assert_match_full ("^a\\Rb$", 0, 0, "a\r\nb", -1, 0, 0); - cut_assert_match_full ("^a\\Rb$", 0, 0, "a\nb", -1, 0, 0); - cut_assert_match_full ("^a\\Rb$", 0, 0, "a\rb", -1, 0, 0); - cut_assert_match_full ("^a\\R\\Rb$", 0, 0, "a\n\rb", -1, 0, 0); - cut_assert_match_full ("^a\\r\\nb$", 0, 0, "a\r\nb", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, 0, "a\nb\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, 0, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, 0, "a\rb\rc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_LF, 0, "a\nb\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CRLF, 0, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, 0, "a\rb\rc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_LF, "a\nb\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CRLF, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CR, "a\rb\rc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_ANY, "a\nb\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_ANY, "a\rb\rc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_ANY, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_LF, "a\nb\nc", -1, 0, 0); - cut_assert_match_full ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_CRLF, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_match_full ("a#\nb", G_REGEX_EXTENDED | G_REGEX_NEWLINE_CR, 0, "a", -1, 0, 0); -} - -static void -cut_assert_mismatch (const gchar *pattern, - GRegexCompileFlags compile_opts, - GRegexMatchFlags match_opts, - const gchar *string, - gsize string_len, - gint start_position, - GRegexMatchFlags match_opts2) -{ - cut_assert_regex_new_without_free (pattern, compile_opts, match_opts); - cut_assert (!g_regex_match_full (regex, string, string_len, - start_position, match_opts2, NULL, NULL), - cut_message ("/%s/ !~ <%s>", pattern, string)); - if (string_len == -1 && start_position == 0) - { - cut_assert (!g_regex_match (regex, string, match_opts2, NULL), - cut_message ("/%s/ !~ <%s>", pattern, string)); - } - free_regex (); -} - -void -test_mismatch (void) -{ - cut_assert_mismatch ("a", 0, 0, "A", -1, 0, 0); - cut_assert_mismatch ("a", 0, 0, "ab", -1, 1, 0); - cut_assert_mismatch ("a", 0, 0, "ba", 1, 0, 0); - cut_assert_mismatch ("a", 0, 0, "b", -1, 0, 0); - cut_assert_mismatch ("a", 0, G_REGEX_ANCHORED, "ab", -1, 1, 0); - cut_assert_mismatch ("a", 0, G_REGEX_ANCHORED, "ba", 1, 0, 0); - cut_assert_mismatch ("a", 0, G_REGEX_ANCHORED, "bab", -1, 0, 0); - cut_assert_mismatch ("a", 0, G_REGEX_ANCHORED, "b", -1, 0, 0); - cut_assert_mismatch ("a", 0, 0, "ab", -1, 1, G_REGEX_ANCHORED); - cut_assert_mismatch ("a", 0, 0, "ba", 1, 0, G_REGEX_ANCHORED); - cut_assert_mismatch ("a", 0, 0, "bab", -1, 0, G_REGEX_ANCHORED); - cut_assert_mismatch ("a", 0, 0, "b", -1, 0, G_REGEX_ANCHORED); - cut_assert_mismatch ("\\d", 0, 0, EURO, -1, 0, 0); - cut_assert_mismatch ("^.{3}$", 0, 0, EURO, -1, 0, 0); - cut_assert_mismatch ("^.$", G_REGEX_RAW, 0, EURO, -1, 0, 0); - - /* New lines handling. */ - cut_assert_mismatch ("^a\\Rb$", 0, 0, "a\n\rb", -1, 0, 0); - cut_assert_mismatch ("^a\\nb$", 0, 0, "a\r\nb", -1, 0, 0); - - cut_assert_mismatch ("^b$", 0, 0, "a\nb\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, 0, "a\nb\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CRLF, 0, "a\nb\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, 0, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_LF, 0, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_LF, 0, "a\rb\rc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CRLF, 0, "a\rb\rc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CR, "a\nb\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CRLF, "a\nb\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CR, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_LF, "a\r\nb\r\nc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_LF, "a\rb\rc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE, G_REGEX_MATCH_NEWLINE_CRLF, "a\rb\rc", -1, 0, 0); - - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_LF, "a\rb\rc", -1, 0, 0); - cut_assert_mismatch ("^b$", G_REGEX_MULTILINE | G_REGEX_NEWLINE_CR, G_REGEX_MATCH_NEWLINE_CRLF, "a\rb\rc", -1, 0, 0); - - cut_assert_mismatch ("a#\nb", G_REGEX_EXTENDED, 0, "a", -1, 0, 0); - cut_assert_mismatch ("a#\r\nb", G_REGEX_EXTENDED, 0, "a", -1, 0, 0); - cut_assert_mismatch ("a#\rb", G_REGEX_EXTENDED, 0, "a", -1, 0, 0); - cut_assert_mismatch ("a#\nb", G_REGEX_EXTENDED, G_REGEX_MATCH_NEWLINE_CR, "a", -1, 0, 0); -} - -static void -cut_assert_match_count (const gchar *pattern, - const gchar *string, - gint start_position, - GRegexMatchFlags match_opts, - gint expected_count) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - if (expected_count == 0) - cut_assert (!g_regex_match_full (regex, string, -1, start_position, - match_opts, &match_info, NULL), - cut_message ("/%s/ !~ <%s>", pattern, string)); - else - cut_assert (g_regex_match_full (regex, string, -1, start_position, - match_opts, &match_info, NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - cut_assert_equal_int (expected_count, - g_match_info_get_match_count (match_info)); - free_regex (); - free_match_info (); -} - -void -test_match_count (void) -{ - cut_assert_match_count ("a", "", 0, 0, 0); - cut_assert_match_count ("a", "a", 0, 0, 1); - cut_assert_match_count ("a", "a", 1, 0, 0); - cut_assert_match_count ("(.)", "a", 0, 0, 2); - cut_assert_match_count ("(.)", EURO, 0, 0, 2); - cut_assert_match_count ("(?:.)", "a", 0, 0, 1); - cut_assert_match_count ("(?P<A>.)", "a", 0, 0, 2); - cut_assert_match_count ("a$", "a", 0, G_REGEX_MATCH_NOTEOL, 0); - cut_assert_match_count ("(a)?(b)", "b", 0, 0, 3); - cut_assert_match_count ("(a)?(b)", "ab", 0, 0, 3); -} - -static void -cut_assert_get_string_number (const gchar *pattern, - const gchar *name, - gint expected_num) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - cut_assert_equal_int (expected_num, g_regex_get_string_number (regex, name)); - free_regex (); -} - -void -test_get_string_number (void) -{ - cut_assert_get_string_number ("", "A", -1); - cut_assert_get_string_number ("(?P<A>.)", "A", 1); - cut_assert_get_string_number ("(?P<A>.)", "B", -1); - cut_assert_get_string_number ("(?P<A>.)(?P<B>a)", "A", 1); - cut_assert_get_string_number ("(?P<A>.)(?P<B>a)", "B", 2); - cut_assert_get_string_number ("(?P<A>.)(?P<B>a)", "C", -1); - cut_assert_get_string_number ("(?P<A>.)(.)(?P<B>a)", "A", 1); - cut_assert_get_string_number ("(?P<A>.)(.)(?P<B>a)", "B", 3); - cut_assert_get_string_number ("(?P<A>.)(.)(?P<B>a)", "C", -1); - cut_assert_get_string_number ("(?:a)(?P<A>.)", "A", 1); - cut_assert_get_string_number ("(?:a)(?P<A>.)", "B", -1); -} - -static void -cut_assert_escape (const gchar *string, - gint length, - const gchar *expected) -{ - escaped_string = g_regex_escape_string (string, length); - cut_assert_equal_string (expected, escaped_string, - cut_message ("<%s> -> <%s>", string, escaped_string)); - free_escaped_string (); -} - -void -test_escape (void) -{ - cut_assert_escape ("hello world", -1, "hello world"); - cut_assert_escape ("hello world", 5, "hello"); - cut_assert_escape ("hello.world", -1, "hello\\.world"); - cut_assert_escape ("a(b\\b.$", -1, "a\\(b\\\\b\\.\\$"); - cut_assert_escape ("hello\0world", -1, "hello"); - cut_assert_escape ("hello\0world", 11, "hello\\0world"); - cut_assert_escape (EURO "*" ENG, -1, EURO "\\*" ENG); - cut_assert_escape ("a$", -1, "a\\$"); - cut_assert_escape ("$a", -1, "\\$a"); - cut_assert_escape ("a$a", -1, "a\\$a"); - cut_assert_escape ("$a$", -1, "\\$a\\$"); - cut_assert_escape ("$a$", 0, ""); - cut_assert_escape ("$a$", 1, "\\$"); - cut_assert_escape ("$a$", 2, "\\$a"); - cut_assert_escape ("$a$", 3, "\\$a\\$"); - cut_assert_escape ("$a$", 4, "\\$a\\$\\0"); - cut_assert_escape ("|()[]{}^$*+?.", -1, "\\|\\(\\)\\[\\]\\{\\}\\^\\$\\*\\+\\?\\."); - cut_assert_escape ("a|a(a)a[a]a{a}a^a$a*a+a?a.a", -1, - "a\\|a\\(a\\)a\\[a\\]a\\{a\\}a\\^a\\$a\\*a\\+a\\?a\\.a"); -} - -static void -cut_assert_replace (const gchar *pattern, - const gchar *string, - gint start_position, - const gchar *replacement, - const gchar *expected) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - replaced_string = g_regex_replace (regex, string, -1, start_position, - replacement, 0, NULL); - cut_assert_equal_string_or_null (expected, replaced_string); - free_regex (); - free_replaced_string (); -} - -void -test_replace (void) -{ - cut_assert_replace ("a", "ababa", 0, "A", "AbAbA"); - cut_assert_replace ("a", "ababa", 1, "A", "abAbA"); - cut_assert_replace ("a", "ababa", 2, "A", "abAbA"); - cut_assert_replace ("a", "ababa", 3, "A", "ababA"); - cut_assert_replace ("a", "ababa", 4, "A", "ababA"); - cut_assert_replace ("a", "ababa", 5, "A", "ababa"); - cut_assert_replace ("a", "ababa", 6, "A", "ababa"); - cut_assert_replace ("a", "abababa", 2, "A", "abAbAbA"); - cut_assert_replace ("a", "abab", 0, "A", "AbAb"); - cut_assert_replace ("a", "baba", 0, "A", "bAbA"); - cut_assert_replace ("a", "bab", 0, "A", "bAb"); - cut_assert_replace ("$^", "abc", 0, "X", "abc"); - cut_assert_replace ("(.)a", "ciao", 0, "a\\1", "caio"); - cut_assert_replace ("a.", "abc", 0, "\\0\\0", "ababc"); - cut_assert_replace ("a", "asd", 0, "\\0101", "Asd"); - cut_assert_replace ("(a).\\1", "aba cda", 0, "\\1\\n", "a\n cda"); - cut_assert_replace ("a" AGRAVE "a", "a" AGRAVE "a", 0, "x", "x"); - cut_assert_replace ("a" AGRAVE "a", "a" AGRAVE "a", 0, OGRAVE, OGRAVE); - cut_assert_replace ("[^-]", "-" EURO "-x-" HSTROKE, 0, "a", "-a-a-a"); - cut_assert_replace ("[^-]", "-" EURO "-" HSTROKE, 0, "a\\g<0>a", "-a" EURO "a-a" HSTROKE "a"); - cut_assert_replace ("-", "-" EURO "-" HSTROKE, 0, "", EURO HSTROKE); - cut_assert_replace (".*", "hello", 0, "\\U\\0\\E", "HELLO"); - cut_assert_replace (".*", "hello", 0, "\\u\\0", "Hello"); - cut_assert_replace ("\\S+", "hello world", 0, "\\U-\\0-", "-HELLO- -WORLD-"); - cut_assert_replace (".", "a", 0, "\\A", NULL); - cut_assert_replace (".", "a", 0, "\\g", NULL); -} - -static void -cut_assert_partial_match (const gchar *pattern, - const gchar *string) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - g_regex_match (regex, string, G_REGEX_MATCH_PARTIAL, &match_info); - cut_assert (!g_match_info_fetch_pos (match_info, 0, NULL, NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - cut_assert (!g_match_info_fetch_pos (match_info, 1, NULL, NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - - free_regex (); - free_match_info (); -} - -static void -cut_assert_partial_mismatch (const gchar *pattern, - const gchar *string) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - g_regex_match (regex, string, G_REGEX_MATCH_PARTIAL, &match_info); - cut_assert (!g_match_info_is_partial_match (match_info), - cut_message ("/%s/ =~ <%s>", pattern, string)); - - free_regex (); - free_match_info (); -} - -void -test_partial_match (void) -{ - cut_assert_partial_match ("^ab", "a"); - cut_assert_partial_match ("ab", "xa"); - cut_assert_partial_match ("a+b", "aa"); - cut_assert_partial_match ("(a)+b", "aa"); - cut_assert_partial_match ("a?b", "a"); - cut_assert_partial_mismatch ("^ab", "xa"); - cut_assert_partial_mismatch ("ab", "ab"); /* normal match. */ -} - -static void -cut_assert_replacement (const gchar *string_to_expand, - gboolean expected_refs) -{ - gboolean has_refs; - cut_assert (g_regex_check_replacement (string_to_expand, &has_refs, NULL)); - cut_assert_equal_int (expected_refs, has_refs); -} - -void -test_check_replacement (void) -{ - cut_assert_replacement ("", FALSE); - cut_assert_replacement ("a", FALSE); - cut_assert_replacement ("\\t\\n\\v\\r\\f\\a\\b\\\\\\x{61}", FALSE); - cut_assert_replacement ("\\0", TRUE); - cut_assert_replacement ("\\n\\2", TRUE); - cut_assert_replacement ("\\g<foo>", TRUE); - - /* Invalid strings */ - cut_assert (!g_regex_check_replacement ("\\Q", NULL, NULL)); - cut_assert (!g_regex_check_replacement ("x\\Ay", NULL, NULL)); -} - -static void -cut_assert_replace_lit (const gchar *pattern, - const gchar *string, - gint start_position, - const gchar *replacement, - const gchar *expected) -{ - cut_assert_regex_new_without_free (pattern, 0, 0); - replaced_string = g_regex_replace_literal (regex, string, -1, start_position, - replacement, 0, NULL); - cut_assert_equal_string (expected, replaced_string); - - free_regex (); - free_replaced_string (); -} - -void -test_replace_lit (void) -{ - cut_assert_replace_lit ("a", "ababa", 0, "A", "AbAbA"); - cut_assert_replace_lit ("a", "ababa", 1, "A", "abAbA"); - cut_assert_replace_lit ("a", "ababa", 2, "A", "abAbA"); - cut_assert_replace_lit ("a", "ababa", 3, "A", "ababA"); - cut_assert_replace_lit ("a", "ababa", 4, "A", "ababA"); - cut_assert_replace_lit ("a", "ababa", 5, "A", "ababa"); - cut_assert_replace_lit ("a", "ababa", 6, "A", "ababa"); - cut_assert_replace_lit ("a", "abababa", 2, "A", "abAbAbA"); - cut_assert_replace_lit ("a", "abcadaa", 0, "A", "AbcAdAA"); - cut_assert_replace_lit ("$^", "abc", 0, "X", "abc"); - cut_assert_replace_lit ("(.)a", "ciao", 0, "a\\1", "ca\\1o"); - cut_assert_replace_lit ("a.", "abc", 0, "\\0\\0\\n", "\\0\\0\\nc"); - cut_assert_replace_lit ("a" AGRAVE "a", "a" AGRAVE "a", 0, "x", "x"); - cut_assert_replace_lit ("a" AGRAVE "a", "a" AGRAVE "a", 0, OGRAVE, OGRAVE); - cut_assert_replace_lit (AGRAVE, "-" AGRAVE "-" HSTROKE, 0, "a" ENG "a", "-a" ENG "a-" HSTROKE); - cut_assert_replace_lit ("[^-]", "-" EURO "-" AGRAVE "-" HSTROKE, 0, "a", "-a-a-a"); - cut_assert_replace_lit ("[^-]", "-" EURO "-" AGRAVE, 0, "a\\g<0>a", "-a\\g<0>a-a\\g<0>a"); - cut_assert_replace_lit ("-", "-" EURO "-" AGRAVE "-" HSTROKE, 0, "", EURO AGRAVE HSTROKE); -} - -static void -cut_assert_expand (const gchar *pattern, - const gchar *string, - const gchar *string_to_expand, - gboolean raw, - const gchar *expected) -{ - cut_assert_regex_new_without_free (pattern, raw ? G_REGEX_RAW : 0, 0); - - g_regex_match (regex, string, 0, &match_info); - expanded_string = g_match_info_expand_references (match_info, - string_to_expand, NULL); - cut_assert_equal_string_or_null (expected, expanded_string); - - free_regex (); - free_match_info (); - free_expanded_string (); -} - -static void -cut_assert_expand_null (const gchar *string_to_expand, - const gchar *expected) -{ - expanded_string = g_match_info_expand_references (NULL, string_to_expand, - NULL); - cut_assert_equal_string (expected, expanded_string); - free_expanded_string (); -} - -void -test_expand (void) -{ - /* TEST_EXPAND(pattern, string, string_to_expand, raw, expected) */ - cut_assert_expand ("a", "a", "", FALSE, ""); - cut_assert_expand ("a", "a", "\\0", FALSE, "a"); - cut_assert_expand ("a", "a", "\\1", FALSE, ""); - cut_assert_expand ("(a)", "ab", "\\1", FALSE, "a"); - cut_assert_expand ("(a)", "a", "\\1", FALSE, "a"); - cut_assert_expand ("(a)", "a", "\\g<1>", FALSE, "a"); - cut_assert_expand ("a", "a", "\\0130", FALSE, "X"); - cut_assert_expand ("a", "a", "\\\\\\0", FALSE, "\\a"); - cut_assert_expand ("a(?P<G>.)c", "xabcy", "X\\g<G>X", FALSE, "XbX"); - cut_assert_expand ("(.)(?P<1>.)", "ab", "\\1", FALSE, "a"); - cut_assert_expand ("(.)(?P<1>.)", "ab", "\\g<1>", FALSE, "a"); - cut_assert_expand (".", EURO, "\\0", FALSE, EURO); - cut_assert_expand ("(.)", EURO, "\\1", FALSE, EURO); - cut_assert_expand ("(?P<G>.)", EURO, "\\g<G>", FALSE, EURO); - cut_assert_expand (".", "a", EURO, FALSE, EURO); - cut_assert_expand (".", "a", EURO "\\0", FALSE, EURO "a"); - cut_assert_expand (".", "", "\\Lab\\Ec", FALSE, "abc"); - cut_assert_expand (".", "", "\\LaB\\EC", FALSE, "abC"); - cut_assert_expand (".", "", "\\Uab\\Ec", FALSE, "ABc"); - cut_assert_expand (".", "", "a\\ubc", FALSE, "aBc"); - cut_assert_expand (".", "", "a\\lbc", FALSE, "abc"); - cut_assert_expand (".", "", "A\\uBC", FALSE, "ABC"); - cut_assert_expand (".", "", "A\\lBC", FALSE, "AbC"); - cut_assert_expand (".", "", "A\\l\\\\BC", FALSE, "A\\BC"); - cut_assert_expand (".", "", "\\L" AGRAVE "\\E", FALSE, AGRAVE); - cut_assert_expand (".", "", "\\U" AGRAVE "\\E", FALSE, AGRAVE_UPPER); - cut_assert_expand (".", "", "\\u" AGRAVE "a", FALSE, AGRAVE_UPPER "a"); - cut_assert_expand (".", "ab", "x\\U\\0y\\Ez", FALSE, "xAYz"); - cut_assert_expand (".(.)", "AB", "x\\L\\1y\\Ez", FALSE, "xbyz"); - cut_assert_expand (".", "ab", "x\\u\\0y\\Ez", FALSE, "xAyz"); - cut_assert_expand (".(.)", "AB", "x\\l\\1y\\Ez", FALSE, "xbyz"); - cut_assert_expand (".(.)", "a" AGRAVE_UPPER, "x\\l\\1y", FALSE, "x" AGRAVE "y"); - cut_assert_expand ("a", "bab", "\\x{61}", FALSE, "a"); - cut_assert_expand ("a", "bab", "\\x61", FALSE, "a"); - cut_assert_expand ("a", "bab", "\\x5a", FALSE, "Z"); - cut_assert_expand ("a", "bab", "\\0\\x5A", FALSE, "aZ"); - cut_assert_expand ("a", "bab", "\\1\\x{5A}", FALSE, "Z"); - cut_assert_expand ("a", "bab", "\\x{00E0}", FALSE, AGRAVE); - cut_assert_expand ("", "bab", "\\x{0634}", FALSE, SHEEN); - cut_assert_expand ("", "bab", "\\x{634}", FALSE, SHEEN); - cut_assert_expand ("", "", "\\t", FALSE, "\t"); - cut_assert_expand ("", "", "\\v", FALSE, "\v"); - cut_assert_expand ("", "", "\\r", FALSE, "\r"); - cut_assert_expand ("", "", "\\n", FALSE, "\n"); - cut_assert_expand ("", "", "\\f", FALSE, "\f"); - cut_assert_expand ("", "", "\\a", FALSE, "\a"); - cut_assert_expand ("", "", "\\b", FALSE, "\b"); - cut_assert_expand ("a(.)", "abc", "\\0\\b\\1", FALSE, "ab\bb"); - cut_assert_expand ("a(.)", "abc", "\\0141", FALSE, "a"); - cut_assert_expand ("a(.)", "abc", "\\078", FALSE, "\a8"); - cut_assert_expand ("a(.)", "abc", "\\077", FALSE, "?"); - cut_assert_expand ("a(.)", "abc", "\\0778", FALSE, "?8"); - cut_assert_expand ("a(.)", "a" AGRAVE "b", "\\1", FALSE, AGRAVE); - cut_assert_expand ("a(.)", "a" AGRAVE "b", "\\1", TRUE, "\xc3"); - cut_assert_expand ("a(.)", "a" AGRAVE "b", "\\0", TRUE, "a\xc3"); - - /* Invalid strings. */ - cut_assert_expand ("", "", "\\Q", FALSE, NULL); - cut_assert_expand ("", "", "x\\Ay", FALSE, NULL); - cut_assert_expand ("", "", "\\g<", FALSE, NULL); - cut_assert_expand ("", "", "\\g<>", FALSE, NULL); - cut_assert_expand ("", "", "\\g<1a>", FALSE, NULL); - cut_assert_expand ("", "", "\\g<a$>", FALSE, NULL); - cut_assert_expand ("", "", "\\", FALSE, NULL); - cut_assert_expand ("a", "a", "\\x{61", FALSE, NULL); - cut_assert_expand ("a", "a", "\\x6X", FALSE, NULL); - /* Pattern-less. */ - cut_assert_expand_null ("", ""); - cut_assert_expand_null ("\\n", "\n"); - /* Invalid strings */ - cut_assert_null (g_match_info_expand_references (NULL, "\\Q", NULL)); - cut_assert_null (g_match_info_expand_references (NULL, "x\\Ay", NULL)); -} - -static void -collect_expected_matches (va_list args) -{ - /* The va_list is a NULL-terminated sequence of: extected matched string, - * expected start and expected end. */ - while (TRUE) - { - Match *match; - const gchar *expected_string = va_arg (args, const gchar *); - if (expected_string == NULL) - break; - match = g_new0 (Match, 1); - match->string = g_strdup (expected_string); - match->start = va_arg (args, gint); - match->end = va_arg (args, gint); - expected_matches = g_slist_prepend (expected_matches, match); - } - expected_matches = g_slist_reverse (expected_matches); -} - -static void -collect_actual_matches (GRegex **regex, const gchar *pattern, - const gchar *string, gssize string_len, - gint start_position, GMatchInfo **match_info) -{ - *regex = g_regex_new (pattern, 0, 0, NULL); - g_regex_match_full (*regex, string, string_len, - start_position, 0, match_info, NULL); - - while (g_match_info_matches (*match_info)) - { - Match *match = g_new0 (Match, 1); - match->string = g_match_info_fetch (*match_info, 0); - match->start = UNTOUCHED; - match->end = UNTOUCHED; - g_match_info_fetch_pos (*match_info, 0, &match->start, &match->end); - actual_matches = g_slist_prepend (actual_matches, match); - g_match_info_next (*match_info, NULL); - } - actual_matches = g_slist_reverse (actual_matches); -} - -static void -cut_assert_match_next (const gchar *pattern, - const gchar *string, - gssize string_length, - gint start_position, - ...) -{ - GSList *actual_node, *expected_node; - va_list args; - - va_start (args, start_position); - collect_expected_matches (args); - va_end (args); - - collect_actual_matches (®ex, pattern, - string, string_length, - start_position, &match_info); - cut_assert (regex == g_match_info_get_regex (match_info)); - cut_assert_equal_string (string, g_match_info_get_string (match_info)); - free_match_info (); - - cut_assert_equal_int(g_slist_length (expected_matches), - g_slist_length (actual_matches)); - - expected_node = expected_matches; - actual_node = actual_matches; - while (expected_node) - { - Match *exp = expected_node->data; - Match *act = actual_node->data; - - cut_assert_equal_string_or_null (exp->string, act->string); - - expected_node = g_slist_next (expected_node); - actual_node = g_slist_next (actual_node); - } - - free_regex (); - free_expected_matches (); - free_actual_matches (); -} - -void -test_match_next (void) -{ - /* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */ - cut_assert_match_next ("a", "x", -1, 0, NULL); - cut_assert_match_next ("a", "ax", -1, 1, NULL); - cut_assert_match_next ("a", "xa", 1, 0, NULL); - cut_assert_match_next ("a", "axa", 1, 2, NULL); - cut_assert_match_next ("a", "a", -1, 0, "a", 0, 1, NULL); - cut_assert_match_next ("a", "xax", -1, 0, "a", 1, 2, NULL); - cut_assert_match_next (EURO, ENG EURO, -1, 0, EURO, 2, 5, NULL); - cut_assert_match_next ("a*", "", -1, 0, "", 0, 0, NULL); - cut_assert_match_next ("a*", "aa", -1, 0, "aa", 0, 2, "", 2, 2, NULL); - cut_assert_match_next (EURO "*", EURO EURO, -1, 0, EURO EURO, 0, 6, "", 6, 6, NULL); - cut_assert_match_next ("a", "axa", -1, 0, "a", 0, 1, "a", 2, 3, NULL); - cut_assert_match_next ("a+", "aaxa", -1, 0, "aa", 0, 2, "a", 3, 4, NULL); - cut_assert_match_next ("a", "aa", -1, 0, "a", 0, 1, "a", 1, 2, NULL); - cut_assert_match_next ("a", "ababa", -1, 2, "a", 2, 3, "a", 4, 5, NULL); - cut_assert_match_next (EURO "+", EURO "-" EURO, -1, 0, EURO, 0, 3, EURO, 4, 7, NULL); - cut_assert_match_next ("", "ab", -1, 0, "", 0, 0, "", 1, 1, "", 2, 2, NULL); - cut_assert_match_next ("", AGRAVE "b", -1, 0, "", 0, 0, "", 2, 2, "", 3, 3, NULL); - cut_assert_match_next ("a", "aaxa", -1, 0, "a", 0, 1, "a", 1, 2, "a", 3, 4, NULL); - cut_assert_match_next ("a", "aa" OGRAVE "a", -1, 0, "a", 0, 1, "a", 1, 2, "a", 4, 5, NULL); - cut_assert_match_next ("a*", "aax", -1, 0, "aa", 0, 2, "", 2, 2, "", 3, 3, NULL); - cut_assert_match_next ("a*", "aaxa", -1, 0, "aa", 0, 2, "", 2, 2, "a", 3, 4, "", 4, 4, NULL); - -} - -static void -cut_assert_sub_pattern (const gchar *pattern, - const gchar *string, - gint start_position, - gint sub_n, - const gchar *expected_sub, - gint expected_start, - gint expected_end) -{ - gint start = UNTOUCHED, end = UNTOUCHED; - cut_assert_regex_new_without_free (pattern, 0, 0); - cut_assert (g_regex_match_full (regex, string, -1, start_position, 0, - &match_info, NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - substring = g_match_info_fetch (match_info, sub_n); - cut_assert_equal_string_or_null (expected_sub, substring); - free_substring (); - - if (expected_sub) - cut_assert (g_match_info_fetch_pos (match_info, sub_n, &start, &end), - cut_message ("$%d", sub_n)); - else - cut_assert (!g_match_info_fetch_pos (match_info, sub_n, &start, &end), - cut_message ("!$%d", sub_n)); - cut_assert_equal_int (expected_start, start); /* FIXME */ - cut_assert_equal_int (expected_end, end); /* assert_equal_int_array() */ - - free_regex (); - free_match_info (); -} - -void -test_sub_pattern (void) -{ - /* TEST_SUB_PATTERN(pattern, string, start_position, sub_n, expected_sub, - * expected_start, expected_end) */ - cut_assert_sub_pattern ("a", "a", 0, 0, "a", 0, 1); - cut_assert_sub_pattern ("a(.)", "ab", 0, 1, "b", 1, 2); - cut_assert_sub_pattern ("a(.)", "a" EURO, 0, 1, EURO, 1, 4); - cut_assert_sub_pattern ("(?:.*)(a)(.)", "xxa" ENG, 0, 2, ENG, 3, 5); - cut_assert_sub_pattern ("(" HSTROKE ")", "a" HSTROKE ENG, 0, 1, HSTROKE, 1, 3); - cut_assert_sub_pattern ("a", "a", 0, 1, NULL, UNTOUCHED, UNTOUCHED); - cut_assert_sub_pattern ("(a)?(b)", "b", 0, 0, "b", 0, 1); - cut_assert_sub_pattern ("(a)?(b)", "b", 0, 1, "", -1, -1); - cut_assert_sub_pattern ("(a)?(b)", "b", 0, 2, "b", 0, 1); -} - -#define TEST_NAMED_SUB_PATTERN(pattern, string, start_position, \ - sub_name, expected_sub, \ - expected_start, expected_end) { \ - gint start = UNTOUCHED, end = UNTOUCHED; \ - gchar *sub_expr; \ - regex = g_regex_new (pattern, 0, 0, NULL); \ - g_regex_match_full (regex, string, -1, start_position, 0, \ - &match_info, NULL); \ - sub_expr = g_match_info_fetch_named (match_info, sub_name); \ - cut_assert_equal_string (expected_sub, sub_expr); \ - g_free (sub_expr); \ - g_match_info_fetch_named_pos (match_info, sub_name, &start, &end); \ - cut_assert (start == expected_start && end == expected_end, \ - cut_message ("failed (got [%d, %d], expected [%d, %d])", \ - start, end, expected_start, expected_end)); \ - g_regex_unref (regex); \ - g_match_info_free (match_info); \ - regex = NULL; \ - match_info = NULL; \ -} - -#define TEST_NAMED_SUB_PATTERN_NULL(pattern, string, start_position, \ - sub_name, \ - expected_start, expected_end) { \ - gint start = UNTOUCHED, end = UNTOUCHED; \ - gchar *sub_expr; \ - regex = g_regex_new (pattern, 0, 0, NULL); \ - g_regex_match_full (regex, string, -1, start_position, 0, \ - &match_info, NULL); \ - sub_expr = g_match_info_fetch_named (match_info, sub_name); \ - cut_assert_null (sub_expr); \ - g_match_info_fetch_named_pos (match_info, sub_name, &start, &end); \ - cut_assert (start == expected_start && end == expected_end, \ - cut_message ("failed (got [%d, %d], expected [%d, %d])", \ - start, end, expected_start, expected_end)); \ - g_regex_unref (regex); \ - g_match_info_free (match_info); \ - regex = NULL; \ - match_info = NULL; \ -} - -#define TEST_NAMED_SUB_PATTERN_DUPNAMES(pattern, string, \ - start_position, sub_name, \ - expected_sub, \ - expected_start, expected_end) { \ - gint start = UNTOUCHED, end = UNTOUCHED; \ - gchar *sub_expr; \ - regex = g_regex_new (pattern, G_REGEX_DUPNAMES, 0, NULL); \ - g_regex_match_full (regex, string, -1, start_position, 0, \ - &match_info, NULL); \ - sub_expr = g_match_info_fetch_named (match_info, sub_name); \ - cut_assert_equal_string (expected_sub, sub_expr); \ - g_free (sub_expr); \ - g_match_info_fetch_named_pos (match_info, sub_name, &start, &end); \ - cut_assert (start == expected_start && end == expected_end, \ - cut_message ("failed (got [%d, %d], expected [%d, %d])", \ - start, end, expected_start, expected_end)); \ - g_regex_unref (regex); \ - g_match_info_free (match_info); \ - regex = NULL; \ - match_info = NULL; \ -} - -void -test_named_sub_pattern (void) -{ - /* TEST_NAMED_SUB_PATTERN(pattern, string, start_position, sub_name, - * expected_sub, expected_start, expected_end) */ - TEST_NAMED_SUB_PATTERN("a(?P<A>.)(?P<B>.)?", "ab", 0, "A", "b", 1, 2); - TEST_NAMED_SUB_PATTERN("a(?P<A>.)(?P<B>.)?", "aab", 1, "A", "b", 2, 3); - TEST_NAMED_SUB_PATTERN("a(?P<A>.)(?P<B>.)?", EURO "ab", 0, "A", "b", 4, 5); - TEST_NAMED_SUB_PATTERN("a(?P<A>.)(?P<B>.)?", "a" EGRAVE "x", 0, "A", EGRAVE, 1, 3); - TEST_NAMED_SUB_PATTERN("a(?P<A>.)(?P<B>.)?", "a" EGRAVE "x", 0, "B", "x", 3, 4); - TEST_NAMED_SUB_PATTERN("(?P<A>a)?(?P<B>b)", "b", 0, "A", "", -1, -1); - TEST_NAMED_SUB_PATTERN("(?P<A>a)?(?P<B>b)", "b", 0, "B", "b", 0, 1); - - TEST_NAMED_SUB_PATTERN_NULL("a(?P<A>.)(?P<B>.)?", EURO "ab", 0, "B", UNTOUCHED, UNTOUCHED); - TEST_NAMED_SUB_PATTERN_NULL("a(?P<A>.)(?P<B>.)?", EURO "ab", 0, "C", UNTOUCHED, UNTOUCHED); - - /* TEST_NAMED_SUB_PATTERN_DUPNAMES(pattern, string, start_position, sub_name, - * expected_sub, expected_start, expected_end) */ - TEST_NAMED_SUB_PATTERN_DUPNAMES("(?P<N>a)|(?P<N>b)", "ab", 0, "N", "a", 0, 1); - TEST_NAMED_SUB_PATTERN_DUPNAMES("(?P<N>aa)|(?P<N>a)", "aa", 0, "N", "aa", 0, 2); - TEST_NAMED_SUB_PATTERN_DUPNAMES("(?P<N>aa)(?P<N>a)", "aaa", 0, "N", "aa", 0, 2); - TEST_NAMED_SUB_PATTERN_DUPNAMES("(?P<N>x)|(?P<N>a)", "a", 0, "N", "a", 0, 1); - TEST_NAMED_SUB_PATTERN_DUPNAMES("(?P<N>x)y|(?P<N>a)b", "ab", 0, "N", "a", 0, 1); - - /* DUPNAMES option inside the pattern */ - TEST_NAMED_SUB_PATTERN("(?J)(?P<N>a)|(?P<N>b)", "ab", 0, "N", "a", 0, 1); - TEST_NAMED_SUB_PATTERN("(?J)(?P<N>aa)|(?P<N>a)", "aa", 0, "N", "aa", 0, 2); - TEST_NAMED_SUB_PATTERN("(?J)(?P<N>aa)(?P<N>a)", "aaa", 0, "N", "aa", 0, 2); - TEST_NAMED_SUB_PATTERN("(?J)(?P<N>x)|(?P<N>a)", "a", 0, "N", "a", 0, 1); - TEST_NAMED_SUB_PATTERN("(?J)(?P<N>x)y|(?P<N>a)b", "ab", 0, "N", "a", 0, 1); -} - -#define TEST_FETCH_ALL(pattern, string, expected) { \ - gchar **matches; \ - gint match_count; \ - regex = g_regex_new (pattern, 0, 0, NULL); \ - g_regex_match (regex, string, 0, &match_info); \ - matches = g_match_info_fetch_all (match_info); \ - if (matches) \ - match_count = g_strv_length (matches); \ - else \ - match_count = 0; \ - cut_assert_equal_int (g_strv_length (expected), match_count); \ - cut_assert_equal_string_array (expected, matches); \ - g_match_info_free (match_info); \ - g_regex_unref (regex); \ - g_strfreev (matches); \ - match_info = NULL; \ - regex = NULL; \ -} - -#define TEST_FETCH_ALL_NULL(pattern, string) { \ - gchar **matches; \ - regex = g_regex_new (pattern, 0, 0, NULL); \ - g_regex_match (regex, string, 0, &match_info); \ - matches = g_match_info_fetch_all (match_info); \ - cut_assert_null (matches); \ - g_match_info_free (match_info); \ - g_regex_unref (regex); \ - match_info = NULL; \ - regex = NULL; \ -} - -void -test_fetch_all (void) -{ - gchar *expected2[] = {"a", NULL}; - gchar *expected3[] = {"aa", NULL}; - gchar *expected4[] = {"a", "a", NULL}; - gchar *expected5[] = {"ab", "b", NULL}; - gchar *expected6[] = {"a" HSTROKE, HSTROKE, NULL}; - gchar *expected7[] = {"xyaz", "a", "z", NULL}; - gchar *expected8[] = {"xa", "x", "a", NULL}; - gchar *expected9[] = {ENG "a", ENG, "a", NULL}; - gchar *expected10[] = {"b", "", "b", NULL}; - gchar *expected11[] = {"ab", "a", "b", NULL}; - - TEST_FETCH_ALL_NULL("a", ""); - TEST_FETCH_ALL_NULL("a", "b"); - TEST_FETCH_ALL("a", "a", expected2); - TEST_FETCH_ALL("a+", "aa", expected3); - TEST_FETCH_ALL("(?:a)", "a", expected2); - TEST_FETCH_ALL("(a)", "a", expected4); - TEST_FETCH_ALL("a(.)", "ab", expected5); - TEST_FETCH_ALL("a(.)", "a" HSTROKE, expected6); - TEST_FETCH_ALL("(?:.*)(a)(.)", "xyazk", expected7); - TEST_FETCH_ALL("(?P<A>.)(a)", "xa", expected8); - TEST_FETCH_ALL("(?P<A>.)(a)", ENG "a", expected9); - TEST_FETCH_ALL("(a)?(b)", "b", expected10); - TEST_FETCH_ALL("(a)?(b)", "ab", expected11); -} - -#define TEST_SPLIT_SIMPLE(pattern, string, expected) { \ - gchar **tokens; \ - gint token_count; \ - tokens = g_regex_split_simple (pattern, string, 0, 0); \ - if (tokens) \ - token_count = g_strv_length (tokens); \ - else \ - token_count = 0; \ - cut_assert_equal_int (g_strv_length (expected), token_count); \ - cut_assert_equal_string_array (expected, tokens); \ - g_strfreev (tokens); \ -} - -#define TEST_SPLIT_SIMPLE_NULL(pattern, string) { \ - gchar **tokens; \ - tokens = g_regex_split_simple (pattern, string, 0, 0); \ - cut_assert_null (tokens); \ -} - -void -test_split_simple (void) -{ - gchar *expected1[] = {NULL}; - gchar *expected2[] = {"a", NULL}; - gchar *expected3[] = {"a", "b", NULL}; - gchar *expected4[] = {"a", "b", "c", NULL}; - gchar *expected5[] = {"a", ",", "b", NULL}; - gchar *expected6[] = {"x", "y", NULL}; - gchar *expected7[] = {"x", "b", "y", NULL}; - - TEST_SPLIT_SIMPLE("", "", expected1); - TEST_SPLIT_SIMPLE("a", "", expected1); - TEST_SPLIT_SIMPLE(",", "a", expected2); - TEST_SPLIT_SIMPLE("(,)\\s*", "a", expected2); - TEST_SPLIT_SIMPLE(",", "a,b", expected3); - TEST_SPLIT_SIMPLE(",", "a,b,c", expected4); - TEST_SPLIT_SIMPLE(",\\s*", "a,b,c", expected4); - TEST_SPLIT_SIMPLE(",\\s*", "a, b, c", expected4); - TEST_SPLIT_SIMPLE("(,)\\s*", "a,b", expected5); - TEST_SPLIT_SIMPLE("(,)\\s*", "a, b", expected5); - /* Not matched sub-strings. */ - TEST_SPLIT_SIMPLE("a|(b)", "xay", expected6); - TEST_SPLIT_SIMPLE("a|(b)", "xby", expected7); - /* Empty matches. */ - TEST_SPLIT_SIMPLE("", "abc", expected4); - TEST_SPLIT_SIMPLE(" *", "ab c", expected4); - /* Invalid patterns. */ - TEST_SPLIT_SIMPLE_NULL("\\", ""); - TEST_SPLIT_SIMPLE_NULL("[", ""); -} - -#define TEST_SPLIT(pattern, string, start_position, max_tokens, expected) { \ - gchar **tokens; \ - gint token_count; \ - regex = g_regex_new (pattern, 0, 0, NULL); \ - tokens = g_regex_split_full (regex, string, -1, start_position, \ - 0, max_tokens, NULL); \ - if (tokens) \ - token_count = g_strv_length (tokens); \ - else \ - token_count = 0; \ - cut_assert_equal_int (g_strv_length (expected), token_count); \ - cut_assert_equal_string_array (expected, tokens); \ - g_strfreev (tokens); \ -\ - if (start_position == 0 && max_tokens <= 0) {\ - tokens = g_regex_split (regex, string, 0); \ - if (tokens) \ - token_count = g_strv_length (tokens); \ - else \ - token_count = 0; \ - cut_assert_equal_int (g_strv_length (expected), token_count); \ - cut_assert_equal_string_array (expected, tokens); \ - g_strfreev (tokens); \ - } \ - g_regex_unref (regex); \ - regex = NULL; \ -} - -void -test_split (void) -{ - gchar *expected1[] = {NULL}; - gchar *expected2[] = {"a", NULL}; - gchar *expected3[] = {"a,b", NULL}; - gchar *expected4[] = {"b", NULL}; - gchar *expected5[] = {"a", "b", NULL}; - gchar *expected6[] = {"a", "b,c", NULL}; - gchar *expected7[] = {"", "b", NULL}; - gchar *expected8[] = {"a", "", NULL}; - gchar *expected9[] = {"a", "b", "c", NULL}; - gchar *expected10[] = {"a", ",", "b", NULL}; - gchar *expected11[] = {"x", "y", NULL}; - gchar *expected12[] = {"x", "b", "y", NULL}; - gchar *expected13[] = {"b", "c", NULL}; - gchar *expected14[] = {"ab c", NULL}; - gchar *expected15[] = {"a", "b c", NULL}; - - TEST_SPLIT("", "", 0, 0, expected1); - TEST_SPLIT("a", "", 0, 0, expected1); - TEST_SPLIT("a", "", 0, 1, expected1); - TEST_SPLIT("a", "", 0, 2, expected1); - TEST_SPLIT("a", "a", 1, 0, expected1); - - TEST_SPLIT(",", "a", 0, 0, expected2); - TEST_SPLIT(",", "a,b", 0, 1, expected3); - TEST_SPLIT("(,)\\s*", "a", 0, 0, expected2); - TEST_SPLIT(",", "a,b", 2, 0, expected4); - TEST_SPLIT(",", "a,b", 0, 0, expected5); - TEST_SPLIT(",", "a,b,c", 0, 2, expected6); - TEST_SPLIT(",", "a,b", 1, 0, expected7); - TEST_SPLIT(",", "a,", 0, 0, expected8); - TEST_SPLIT(",", "a,b,c", 0, 0, expected9); - TEST_SPLIT(",\\s*", "a,b,c", 0, 0, expected9); - TEST_SPLIT(",\\s*", "a, b, c", 0, 0, expected9); - TEST_SPLIT("(,)\\s*", "a,b", 0, 0, expected10); - TEST_SPLIT("(,)\\s*", "a, b", 0, 0, expected10); - /* Not matched sub-strings. */ - TEST_SPLIT("a|(b)", "xay", 0, 0, expected11); - TEST_SPLIT("a|(b)", "xby", 0, -1, expected12); - /* Empty matches. */ - TEST_SPLIT(" *", "ab c", 1, 0, expected13); - TEST_SPLIT("", "abc", 0, 0, expected9); - TEST_SPLIT(" *", "ab c", 0, 0, expected9); - TEST_SPLIT(" *", "ab c", 0, 1, expected14); - TEST_SPLIT(" *", "ab c", 0, 2, expected15); - TEST_SPLIT(" *", "ab c", 0, 3, expected9); - TEST_SPLIT(" *", "ab c", 0, 4, expected9); -} - -static void -cut_assert_match_all_each (const gchar *pattern, - gboolean use_full, - const gchar *string, - gssize string_len, - gint start_position, - va_list args) -{ - GSList *expected_node; - gint expected_length; - gint match_count; - gint i; - - collect_expected_matches (args); - expected_length = g_slist_length (expected_matches); - - regex = g_regex_new (pattern, 0, 0, NULL); - if (expected_length == 0) - { - if (use_full) - cut_assert (!g_regex_match_all_full (regex, string, string_len, - start_position, 0, &match_info, - NULL), - cut_message ("/%s/ !~ <%s>", pattern, string)); - else - cut_assert (!g_regex_match_all (regex, string, 0, &match_info), - cut_message ("/%s/ !~ <%s>", pattern, string)); - } - else - { - if (use_full) - cut_assert (g_regex_match_all_full (regex, string, string_len, - start_position, 0, &match_info, - NULL), - cut_message ("/%s/ =~ <%s>", pattern, string)); - else - cut_assert (g_regex_match_all (regex, string, 0, &match_info), - cut_message ("/%s/ =~ <%s>", pattern, string)); - } - - match_count = g_match_info_get_match_count (match_info); - cut_assert_equal_int (expected_length, match_count); - - expected_node = expected_matches; - for (i = 0; i < match_count; i++) - { - gint start, end; - gchar *matched_string; - Match *expected_match = expected_node->data; - - matched_string = g_match_info_fetch (match_info, i); - cut_assert_equal_string (expected_match->string, matched_string, - cut_message ("/%s/ =~ <%s>", - pattern, expected_match->string)); - g_free (matched_string); - - cut_assert (g_match_info_fetch_pos (match_info, i, &start, &end)); - cut_assert_equal_int (expected_match->start, start, - cut_message ("/%s/ =~ <%s>", - pattern, expected_match->string)); - cut_assert_equal_int (expected_match->end, end, - cut_message ("/%s/ =~ <%s>", - pattern, expected_match->string)); - - expected_node = g_slist_next (expected_node); - } - - free_regex (); - free_match_info (); - free_expected_matches (); -} - -static void -cut_assert_match_all (const gchar *pattern, - const gchar *string, - gssize string_length, - gint start_position, - ...) -{ - va_list args, copied_args; - - va_start (args, start_position); - - va_copy (copied_args, args); - cut_assert_match_all_each (pattern, TRUE, - string, string_length, start_position, - copied_args); - va_end(copied_args); - - if (string_length == -1 && start_position == 0) - { - va_copy (copied_args, args); - cut_assert_match_all_each (pattern, FALSE, - string, string_length, start_position, - copied_args); - va_end(copied_args); - } - - va_end (args); -} - -void -test_match_all (void) -{ - cut_assert_match_all ("<.*>", "", -1, 0, NULL); - cut_assert_match_all ("a+", "", -1, 0, NULL); - cut_assert_match_all ("a+", "a", 0, 0, NULL); - cut_assert_match_all ("a+", "a", -1, 1, NULL); - cut_assert_match_all ("<.*>", "<a>", -1, 0, "<a>", 0, 3, NULL); - cut_assert_match_all ("a+", "a", -1, 0, "a", 0, 1, NULL); - cut_assert_match_all ("a+", "aa", 1, 0, "a", 0, 1, NULL); - cut_assert_match_all ("a+", "aa", -1, 1, "a", 1, 2, NULL); - cut_assert_match_all ("a+", "aa", 2, 1, "a", 1, 2, NULL); - cut_assert_match_all (".+", ENG, -1, 0, ENG, 0, 2, NULL); - cut_assert_match_all ("<.*>", "<a><b>", -1, 0, "<a><b>", 0, 6, - "<a>", 0, 3, NULL); - cut_assert_match... [truncated message content] |
|
From: Kouhei S. <nul...@cl...> - 2014-06-21 06:17:57
|
Kouhei Sutou 2014-06-21 15:17:39 +0900 (Sat, 21 Jun 2014) New Revision: fbac62756e3a727bbe923ec3ccfe8eac288952e0 https://github.com/clear-code/cutter/commit/fbac62756e3a727bbe923ec3ccfe8eac288952e0 Message: doc ubuntu: Cutter doesn't require universe Modified files: doc/install-to-ubuntu.rd doc/install-to-ubuntu.rd.ja Modified: doc/install-to-ubuntu.rd (+1 -5) =================================================================== --- doc/install-to-ubuntu.rd 2014-06-21 14:37:13 +0900 (c9e5cfb) +++ doc/install-to-ubuntu.rd 2014-06-21 15:17:39 +0900 (4496fae) @@ -26,13 +26,9 @@ Here are supported Ubuntu versions: * 13.10 Saucy Salamander * 14.04 LTS Trusty Tahr -Enable the universe repository to install Cutter: - - % sudo apt-get -y install software-properties-common - % sudo add-apt-repository -y universe - Add the (({ppa:cutter-testing-framework/ppa})) PPA to your system: + % sudo apt-get -y install software-properties-common % sudo add-apt-repository -y ppa:cutter-testing-framework/ppa % sudo apt-get update Modified: doc/install-to-ubuntu.rd.ja (+1 -5) =================================================================== --- doc/install-to-ubuntu.rd.ja 2014-06-21 14:37:13 +0900 (f247c56) +++ doc/install-to-ubuntu.rd.ja 2014-06-21 15:17:39 +0900 (9fb11bf) @@ -22,13 +22,9 @@ UbuntuではCutterのリポジトリとしてLaunchpadのPPA (Personal Package A * 13.10 Saucy Salamander * 14.04 LTS Trusty Tahr -Cutterをインストールするためにuniverseリポトリを有効にします: - - % sudo apt-get -y install software-properties-common - % sudo add-apt-repository -y universe - (({ppa:cutter-testing-framework/ppa})) PPA を登録します: + % sudo apt-get -y install software-properties-common % sudo add-apt-repository -y ppa:cutter-testing-framework/ppa % sudo apt-get update |
|
From: Kouhei S. <nul...@cl...> - 2014-06-21 06:16:42
|
Kouhei Sutou 2014-06-21 14:37:13 +0900 (Sat, 21 Jun 2014) New Revision: a24fe489e3d6dc9c4ecee1926435828461e9e4e4 https://github.com/clear-code/cutter/commit/a24fe489e3d6dc9c4ecee1926435828461e9e4e4 Message: travis: use PPA for Ubuntu Modified files: data/travis/setup.sh Modified: data/travis/setup.sh (+14 -6) =================================================================== --- data/travis/setup.sh 2014-06-21 14:32:22 +0900 (93fdbca) +++ data/travis/setup.sh 2014-06-21 14:37:13 +0900 (b92acbe) @@ -3,15 +3,23 @@ set -e distribution=$(lsb_release --short --id | tr 'A-Z' 'a-z') -code_name=$(lsb_release --short --codename) -component=main -apt_url_base=http://downloads.sourceforge.net/project/cutter -cat <<EOF | sudo tee /etc/apt/sources.list.d/cutter.list +case $distribution in + debian) + code_name=$(lsb_release --short --codename) + component=main + apt_url_base=http://downloads.sourceforge.net/project/cutter + cat <<EOF | sudo tee /etc/apt/sources.list.d/cutter.list deb ${apt_url_base}/${distribution}/ ${code_name} ${component} deb-src ${apt_url_base}/${distribution}/ ${code_name} ${component} EOF + sudo apt-get update -qq + sudo apt-get install -qq -y --allow-unauthenticated cutter-keyring + ;; + ubuntu) + sudo apt-get install -qq -y -V software-properties-common + sudo add-apt-repository -y ppa:cutter-testing-framework/ppa + ;; +esac sudo apt-get update -qq -sudo apt-get install -qq -y --allow-unauthenticated cutter-keyring -sudo apt-get update -qq sudo apt-get install -qq -y -V cutter-testing-framework |
|
From: Masafumi Y. <nul...@cl...> - 2014-06-21 05:32:37
|
Masafumi Yokoyama 2014-06-21 13:14:11 +0900 (Sat, 21 Jun 2014) New Revision: f3e2cbc989ac791d68643d99966cb1a44aa97b21 https://github.com/clear-code/cutter/commit/f3e2cbc989ac791d68643d99966cb1a44aa97b21 Merged 8a31888: Merge pull request #14 from myokoym/tutorial-add-missing-slash Message: TUTORIAL*: add a missing slash in PATH src .libs -> src/.libs + Modified files: TUTORIAL TUTORIAL.ja Modified: TUTORIAL (+1 -1) =================================================================== --- TUTORIAL 2014-06-20 21:37:02 +0900 (5c044bb) +++ TUTORIAL 2014-06-21 13:14:11 +0900 (545ad0d) @@ -821,7 +821,7 @@ test/run-test.sh: export DYLD_LIBRARY_PATH ;; *BSD) - LD_LIBRARY_PATH="$top_dir/src.libs:$LD_LIBRARY_PATH" + LD_LIBRARY_PATH="$top_dir/src/.libs:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH ;; *) Modified: TUTORIAL.ja (+1 -1) =================================================================== --- TUTORIAL.ja 2014-06-20 21:37:02 +0900 (b416109) +++ TUTORIAL.ja 2014-06-21 13:14:11 +0900 (ef1782b) @@ -807,7 +807,7 @@ test/run-test.sh: export DYLD_LIBRARY_PATH ;; *BSD) - LD_LIBRARY_PATH="$top_dir/src.libs:$LD_LIBRARY_PATH" + LD_LIBRARY_PATH="$top_dir/src/.libs:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH ;; *) |
|
From: Kouhei S. <nul...@cl...> - 2014-06-21 05:32:36
|
Kouhei Sutou 2014-06-21 14:32:22 +0900 (Sat, 21 Jun 2014) New Revision: 8a318887695fdfae99fcdb8f73aaabe9da36c91c https://github.com/clear-code/cutter/commit/8a318887695fdfae99fcdb8f73aaabe9da36c91c Message: Merge pull request #14 from myokoym/tutorial-add-missing-slash TUTORIAL*: add a missing slash in PATH Patch by Masafumi Yokoyama. Thanks!!! |
|
From: HAYASHI K. <nul...@cl...> - 2014-06-20 12:40:21
|
HAYASHI Kentaro 2014-06-20 21:37:02 +0900 (Fri, 20 Jun 2014) New Revision: 916d4fcdbc6028cab4ee3e91fac5a146d6914243 https://github.com/clear-code/cutter/commit/916d4fcdbc6028cab4ee3e91fac5a146d6914243 Message: doc: update install document which use Launchpad PPA Modified files: doc/install-to-ubuntu.rd doc/install-to-ubuntu.rd.ja Modified: doc/install-to-ubuntu.rd (+12 -20) =================================================================== --- doc/install-to-ubuntu.rd 2014-06-20 09:23:18 +0900 (16d4e9d) +++ doc/install-to-ubuntu.rd 2014-06-20 21:37:02 +0900 (c9e5cfb) @@ -16,36 +16,28 @@ If you need a package for another environment, you can request on ((<mailing list|URL:https://lists.sourceforge.net/lists/listinfo/cutter-users-en>)). -Here are apt lines for for Precise. We put them into -/etc/apt/sources.list.d/cutter.list. +=== PPA (Personal Package Archive) -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ precise main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ precise main +The Cutter APT repository for Ubuntu uses PPA (Personal Package Archive) on Launchpad since Cutter 1.2.4. You can install Cutter by APT from the PPA. -Here are apt lines for for Saucy. We put them into -/etc/apt/sources.list.d/cutter.list. +Here are supported Ubuntu versions: -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ saucy main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ saucy main + * 12.04 LTS Precise Pangolin + * 13.10 Saucy Salamander + * 14.04 LTS Trusty Tahr -Here are apt lines for for Trusty. We put them into -/etc/apt/sources.list.d/cutter.list. +Enable the universe repository to install Cutter: -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ trusty main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ trusty main + % sudo apt-get -y install software-properties-common + % sudo add-apt-repository -y universe -Cutter packages are signed by key of cutter-keyring. -Register the key by installing cutter-keyring package. +Add the (({ppa:cutter-testing-framework/ppa})) PPA to your system: + % sudo add-apt-repository -y ppa:cutter-testing-framework/ppa % sudo apt-get update - % sudo apt-get -y --allow-unauthenticated install cutter-keyring -If you install the keyring package, you can install Cutter by apt-get: +Install: - % sudo apt-get update % sudo apt-get -y install cutter-testing-framework == The next step Modified: doc/install-to-ubuntu.rd.ja (+14 -27) =================================================================== --- doc/install-to-ubuntu.rd.ja 2014-06-20 09:23:18 +0900 (dfbcdef) +++ doc/install-to-ubuntu.rd.ja 2014-06-20 21:37:02 +0900 (f247c56) @@ -8,45 +8,32 @@ UbuntuへのCutterのインストール方法を説明します。 == インストール -CutterのDebianパッケージが提供されているので、aptitudeでインス -トールできます。 +CutterのDebianパッケージが提供されているので、APTでインストールできます。 -現在は、Ubuntu Precise Pangolin/Saucy Salamander/Trusty Tahr i386/amd64 -用のパッケージのみ提供しています。他のバージョンが必要な場合 -は((<メーリングリスト -|URL:https://lists.sourceforge.net/lists/listinfo/cutter-users-ja>)) -でリクエストしてください。 +現在は、Ubuntu Precise Pangolin/Saucy Salamander/Trusty Tahr i386/amd64用のパッケージのみ提供しています。他のバージョンが必要な場合は((<メーリングリスト|URL:https://lists.sourceforge.net/lists/listinfo/cutter-users-ja>))でリクエストしてください。 -Preciseの場合は以下のapt lineを書いた -/etc/apt/sources.list.d/cutter.listを作成してください。 +=== PPA (Personal Package Archive) -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ precise main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ precise main +UbuntuではCutterのリポジトリとしてLaunchpadのPPA (Personal Package Archive)をCutter 1.2.4から使っています。 PPAからAPTでCutterをインストールできます。 -Saucyの場合は以下のapt lineを書いた -/etc/apt/sources.list.d/cutter.listを作成してください。 +現在サポートしているUbuntuのバージョンは次のとおりです: -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ saucy main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ saucy main + * 12.04 LTS Precise Pangolin + * 13.10 Saucy Salamander + * 14.04 LTS Trusty Tahr -Trustyの場合は以下のapt lineを書いた -/etc/apt/sources.list.d/cutter.listを作成してください。 +Cutterをインストールするためにuniverseリポトリを有効にします: -/etc/apt/sources.list.d/cutter.list: - deb http://sourceforge.net/projects/cutter/files/ubuntu/ trusty main - deb-src http://sourceforge.net/projects/cutter/files/ubuntu/ trusty main + % sudo apt-get -y install software-properties-common + % sudo add-apt-repository -y universe -Cutterパッケージはcutter-keyringが提供している鍵で署名されています。 -cutter-keyringパッケージをインストールして鍵を登録してください。 +(({ppa:cutter-testing-framework/ppa})) PPA を登録します: + % sudo add-apt-repository -y ppa:cutter-testing-framework/ppa % sudo apt-get update - % sudo apt-get -y --allow-unauthenticated install cutter-keyring -cutter-keyringパッケージをインストール後はapt-getでインストールできます。 +apt-getでインストールします:: - % sudo apt-get update % sudo apt-get -y install cutter-testing-framework == 次のステップ |
|
From: Kenji O. <nul...@cl...> - 2014-06-20 00:49:32
|
Kenji Okimoto 2014-06-20 09:23:18 +0900 (Fri, 20 Jun 2014) New Revision: ee48d69c11e6a6458e038ff14a0870ce6ad19967 https://github.com/clear-code/cutter/commit/ee48d69c11e6a6458e038ff14a0870ce6ad19967 Message: misc: Add error and use it It can describe context clearly. Modified files: misc/release-to-github.rb Modified: misc/release-to-github.rb (+11 -21) =================================================================== --- misc/release-to-github.rb 2014-06-19 18:15:34 +0900 (057ce1b) +++ misc/release-to-github.rb 2014-06-20 09:23:18 +0900 (94d2bf1) @@ -13,6 +13,11 @@ def extract_sections(file) normalized_text.split(/.*\n^(?:==\s+|=+$).*\n\n\n*/) end +def error(message) + $stderr.puts message + exit false +end + def main github_repository = nil github_tag = nil @@ -41,29 +46,14 @@ def main begin parser.parse! rescue OptionParser::ParseError => ex - warn ex.message + error ex.message end - unless github_repository - warn parser.help - exit false - end - unless github_tag - warn parser.help - exit false - end - unless github_release_body - warn parser.help - exit false - end - unless github_release_asset_file - warn parser.help - exit false - end - unless github_access_token - warn parser.help - exit false - end + error parser.help unless github_repository + error parser.help unless github_tag + error parser.help unless github_release_body + error parser.help unless github_release_asset_file + error parser.help unless github_access_token client = Octokit::Client.new(access_token: github_access_token) |
|
From: Kouhei S. <ko...@cl...> - 2014-06-19 09:40:14
|
In <53A...@cl...> "[cutter-commit 04536] Re: clear-code/cutter@ba806a6 [master] misc: Check arguments" on Thu, 19 Jun 2014 18:24:43 +0900, Kenji Okimoto <ok...@cl...> wrote: > (2014年06月19日 18:19), Kouhei Sutou wrote: >>> + warn parser.help >>> + exit false >> >> 処理を継続しないならwarningじゃなくてstderrに出力してexitがい >> いんじゃないかと思いました。warningなら「問題はあるかもしれな >> いけど動く」みたいな感じがします。 > > warn が stderr に出してくれるんですが、そういうことじゃないですよね。。。 えぇ、そういうことじゃないです。 このコードは「warning扱いにしている」コードだと読めますが、 「warning扱いは本当に妥当?」ということです。 実際に同じように動くかどうか(動作)だけを気にしているわけで はありません。 |
|
From: Kenji O. <ok...@cl...> - 2014-06-19 09:25:42
|
(2014年06月19日 18:19), Kouhei Sutou wrote: >> + warn parser.help >> + exit false > > 処理を継続しないならwarningじゃなくてstderrに出力してexitがい > いんじゃないかと思いました。warningなら「問題はあるかもしれな > いけど動く」みたいな感じがします。 warn が stderr に出してくれるんですが、そういうことじゃないですよね。。。 -- Kenji Okimoto <ok...@cl...> |
|
From: Kouhei S. <ko...@cl...> - 2014-06-19 09:19:23
|
> + warn parser.help > + exit false 処理を継続しないならwarningじゃなくてstderrに出力してexitがい いんじゃないかと思いました。warningなら「問題はあるかもしれな いけど動く」みたいな感じがします。 In <ba8...@je...> "[cutter-commit 04532] clear-code/cutter@ba806a6 [master] misc: Check arguments" on Thu, 19 Jun 2014 17:51:18 +0900, Kenji Okimoto <nul...@cl...> wrote: > Kenji Okimoto 2014-06-19 17:51:18 +0900 (Thu, 19 Jun 2014) > > New Revision: ba806a6dbd7f7843098898cfabf459a6e35aeb90 > https://github.com/clear-code/cutter/commit/ba806a6dbd7f7843098898cfabf459a6e35aeb90 > > Message: > misc: Check arguments > > Modified files: > misc/release-to-github.rb > > Modified: misc/release-to-github.rb (+21 -0) > =================================================================== > --- misc/release-to-github.rb 2014-06-19 17:51:09 +0900 (16fc559) > +++ misc/release-to-github.rb 2014-06-19 17:51:18 +0900 (057ce1b) > @@ -44,6 +44,27 @@ def main > warn ex.message > end > > + unless github_repository > + warn parser.help > + exit false > + end > + unless github_tag > + warn parser.help > + exit false > + end > + unless github_release_body > + warn parser.help > + exit false > + end > + unless github_release_asset_file > + warn parser.help > + exit false > + end > + unless github_access_token > + warn parser.help > + exit false > + end > + > client = Octokit::Client.new(access_token: github_access_token) > > new_release = client.create_release(github_repository, github_tag, body: github_release_body) |
|
From: Kouhei S. <nul...@cl...> - 2014-06-19 09:15:51
|
Kouhei Sutou 2014-06-19 18:15:34 +0900 (Thu, 19 Jun 2014) New Revision: 9140ffd7b8f9fca88968f245762558bbeb755807 https://github.com/clear-code/cutter/commit/9140ffd7b8f9fca88968f245762558bbeb755807 Message: Tabify Modified files: Makefile.am Modified: Makefile.am (+1 -1) =================================================================== --- Makefile.am 2014-06-19 17:54:48 +0900 (ccee70a) +++ Makefile.am 2014-06-19 18:15:34 +0900 (4b98e23) @@ -78,7 +78,7 @@ release-github: dist $(srcdir)/misc/release-to-github.rb \ --repository=clear-code/cutter \ --tag=$(VERSION) \ - --news-file=NEWS \ + --news-file=NEWS \ --asset-file=$(PACKAGE)-$(VERSION).tar.gz \ --access-token-file=$(ACCESS_TOKEN_FILE) |
|
From: Kenji O. <nul...@cl...> - 2014-06-19 08:55:59
|
Kenji Okimoto 2014-06-19 17:54:48 +0900 (Thu, 19 Jun 2014) New Revision: 841495e83a861b9692115f5458b2cff1b622715a https://github.com/clear-code/cutter/commit/841495e83a861b9692115f5458b2cff1b622715a Message: Add release-github target Modified files: Makefile.am Modified: Makefile.am (+8 -0) =================================================================== --- Makefile.am 2014-06-19 17:51:18 +0900 (8a4bfdb) +++ Makefile.am 2014-06-19 17:54:48 +0900 (ccee70a) @@ -74,6 +74,14 @@ release-debian: tmp/archives/debian/ rsync -avz tmp/archives $(SF_HTDOCS)/ +release-github: dist + $(srcdir)/misc/release-to-github.rb \ + --repository=clear-code/cutter \ + --tag=$(VERSION) \ + --news-file=NEWS \ + --asset-file=$(PACKAGE)-$(VERSION).tar.gz \ + --access-token-file=$(ACCESS_TOKEN_FILE) + upload-doc: cd html && $(MAKE) upload cd doc/reference && $(MAKE) upload |
|
From: Kenji O. <nul...@cl...> - 2014-06-19 08:52:28
|
Kenji Okimoto 2014-06-19 17:51:18 +0900 (Thu, 19 Jun 2014) New Revision: ba806a6dbd7f7843098898cfabf459a6e35aeb90 https://github.com/clear-code/cutter/commit/ba806a6dbd7f7843098898cfabf459a6e35aeb90 Message: misc: Check arguments Modified files: misc/release-to-github.rb Modified: misc/release-to-github.rb (+21 -0) =================================================================== --- misc/release-to-github.rb 2014-06-19 17:51:09 +0900 (16fc559) +++ misc/release-to-github.rb 2014-06-19 17:51:18 +0900 (057ce1b) @@ -44,6 +44,27 @@ def main warn ex.message end + unless github_repository + warn parser.help + exit false + end + unless github_tag + warn parser.help + exit false + end + unless github_release_body + warn parser.help + exit false + end + unless github_release_asset_file + warn parser.help + exit false + end + unless github_access_token + warn parser.help + exit false + end + client = Octokit::Client.new(access_token: github_access_token) new_release = client.create_release(github_repository, github_tag, body: github_release_body) |
|
From: Kenji O. <nul...@cl...> - 2014-06-19 08:52:27
|
Kenji Okimoto 2014-06-19 17:51:09 +0900 (Thu, 19 Jun 2014) New Revision: eb26cd609e01b5c244c00fa07e1522b87d9b4e26 https://github.com/clear-code/cutter/commit/eb26cd609e01b5c244c00fa07e1522b87d9b4e26 Message: misc: Specify NEWS file instead of release announce body Modified files: misc/release-to-github.rb Modified: misc/release-to-github.rb (+8 -2) =================================================================== --- misc/release-to-github.rb 2014-06-19 17:31:05 +0900 (8d14a3e) +++ misc/release-to-github.rb 2014-06-19 17:51:09 +0900 (16fc559) @@ -8,6 +8,11 @@ end require "octokit" require "optparse" +def extract_sections(file) + normalized_text = File.read(file).gsub(/==+\n.*\n==+\n/, '') + normalized_text.split(/.*\n^(?:==\s+|=+$).*\n\n\n*/) +end + def main github_repository = nil github_tag = nil @@ -22,8 +27,9 @@ def main parser.on("--tag=TAG", "Specify tag name") do |tag| github_tag = tag end - parser.on("--body-file=FILE", "Body file") do |file| - github_release_body = File.read(file) + parser.on("--news-file=FILE", "NEWS file") do |file| + latest_release_changes = extract_sections(file)[1].chomp + github_release_body = latest_release_changes.gsub(/^(=+)/){ $1.tr("=", "#") } end parser.on("--asset-file=FILE", "Asset file") do |file| github_release_asset_file = file |
|
From: Kenji O. <nul...@cl...> - 2014-06-19 08:32:19
|
Kenji Okimoto 2014-06-19 17:31:05 +0900 (Thu, 19 Jun 2014) New Revision: 1b26b7eb3b631c48c2b3102737013004760d8943 https://github.com/clear-code/cutter/commit/1b26b7eb3b631c48c2b3102737013004760d8943 Message: misc: Add release-to-github.rb This script can create a release on github.com. Added files: misc/Gemfile misc/release-to-github.rb Added: misc/Gemfile (+4 -0) 100644 =================================================================== --- /dev/null +++ misc/Gemfile 2014-06-19 17:31:05 +0900 (dcd1f14) @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "octokit" +gem "mime-types" Added: misc/release-to-github.rb (+47 -0) 100755 =================================================================== --- /dev/null +++ misc/release-to-github.rb 2014-06-19 17:31:05 +0900 (8d14a3e) @@ -0,0 +1,47 @@ +#! /usr/bin/env ruby + +begin + require "bundler/setup" +rescue LoadError +end + +require "octokit" +require "optparse" + +def main + github_repository = nil + github_tag = nil + github_release_body = nil + github_release_asset_file = nil + github_access_token = nil + + parser = OptionParser.new + parser.on("--repository=OWNER/REPO_NAME", "GitHub repository name") do |repo| + github_repository = repo + end + parser.on("--tag=TAG", "Specify tag name") do |tag| + github_tag = tag + end + parser.on("--body-file=FILE", "Body file") do |file| + github_release_body = File.read(file) + end + parser.on("--asset-file=FILE", "Asset file") do |file| + github_release_asset_file = file + end + parser.on("--access-token-file=FILE", "Access token file") do |file| + github_access_token = File.read(file).chomp + end + + begin + parser.parse! + rescue OptionParser::ParseError => ex + warn ex.message + end + + client = Octokit::Client.new(access_token: github_access_token) + + new_release = client.create_release(github_repository, github_tag, body: github_release_body) + client.upload_asset(new_release[:url], github_release_asset_file) +end + +main |
|
From: Kenji O. <nul...@cl...> - 2014-06-18 01:25:06
|
Kenji Okimoto 2014-06-18 10:23:53 +0900 (Wed, 18 Jun 2014) New Revision: 6f186c9b048215fbb3145145a2837169a4593389 https://github.com/clear-code/cutter/commit/6f186c9b048215fbb3145145a2837169a4593389 Message: m4: Add 1.11 to ltp_version_list Modified files: m4macros/cutter.m4 Modified: m4macros/cutter.m4 (+1 -1) =================================================================== --- m4macros/cutter.m4 2014-06-17 15:48:10 +0900 (1b97644) +++ m4macros/cutter.m4 2014-06-18 10:23:53 +0900 (5761edf) @@ -9,7 +9,7 @@ AC_DEFUN([AC_CHECK_ENABLE_COVERAGE], AC_MSG_RESULT($cutter_enable_coverage) cutter_enable_coverage_report_lcov=no if test "x$cutter_enable_coverage" != "xno"; then - ltp_version_list="1.6 1.7 1.8 1.9 1.10" + ltp_version_list="1.6 1.7 1.8 1.9 1.10 1.11" AC_PATH_TOOL(LCOV, lcov) AC_PATH_TOOL(GENHTML, genhtml) |
|
From: HAYASHI K. <nul...@cl...> - 2014-06-17 06:48:32
|
HAYASHI Kentaro 2014-06-17 15:48:10 +0900 (Tue, 17 Jun 2014) New Revision: d0748a0badc4b37a78d3e9e32bc38cb55a68b912 https://github.com/clear-code/cutter/commit/d0748a0badc4b37a78d3e9e32bc38cb55a68b912 Message: packages ubuntu: remove needless dput target Modified files: packages/ubuntu/upload.rb Modified: packages/ubuntu/upload.rb (+0 -1) =================================================================== --- packages/ubuntu/upload.rb 2014-06-17 15:43:06 +0900 (12995af) +++ packages/ubuntu/upload.rb 2014-06-17 15:48:10 +0900 (83d1a9b) @@ -22,7 +22,6 @@ require "pathname" class Uploader def initialize @dput_configuration_name = "cutter-ppa" - @dput_configuration_name = "cutter-nightly" end def run |
|
From: HAYASHI K. <nul...@cl...> - 2014-06-17 06:44:53
|
HAYASHI Kentaro 2014-06-17 15:42:06 +0900 (Tue, 17 Jun 2014) New Revision: 8b94c8f740edd11b9954f813c10aaaa98cc82101 https://github.com/clear-code/cutter/commit/8b94c8f740edd11b9954f813c10aaaa98cc82101 Message: packages ubuntu: add upload script for Launchpad PPA Added files: packages/ubuntu/upload.rb Added: packages/ubuntu/upload.rb (+136 -0) 100755 =================================================================== --- /dev/null +++ packages/ubuntu/upload.rb 2014-06-17 15:42:06 +0900 (12995af) @@ -0,0 +1,136 @@ +#!/usr/bin/env ruby +# +# Copyright(C) 2014 Kouhei Sutou <ko...@cl...> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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 library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "optparse" +require "fileutils" +require "pathname" + +class Uploader + def initialize + @dput_configuration_name = "cutter-ppa" + @dput_configuration_name = "cutter-nightly" + end + + def run + ensure_dput_configuration + + parse_command_line! + + @code_names.each do |code_name| + upload(code_name) + end + end + + private + def ensure_dput_configuration + dput_cf_path = Pathname.new("~/.dput.cf").expand_path + if dput_cf_path.exist? + dput_cf_content = dput_cf_path.read + else + dput_cf_content = "" + end + dput_cf_content.each_line do |line| + return if line.chomp == "[#{@dput_configuration_name}]" + end + + dput_cf_path.open("w") do |dput_cf| + dput_cf.puts(dput_cf_content) + dput_cf.puts(<<-CONFIGURATION) +[#{@dput_configuration_name}] +fqdn = ppa.launchpad.net +method = ftp +incoming = ~cutter-testing-framework/ppa/ubuntu/ +login = anonymous +allow_unsigned_uploads = 0 + CONFIGURATION + end + end + + def parse_command_line! + + parser = OptionParser.new + parser.on("--package=NAME", + "The package name") do |name| + @package = name + end + parser.on("--version=VERSION", + "The version") do |version| + @version = version + end + parser.on("--source-archive=ARCHIVE", + "The source archive") do |source_archive| + @source_archive = Pathname.new(source_archive).expand_path + end + parser.on("--code-names=CODE_NAME1,CODE_NAME2,CODE_NAME3,...", Array, + "The target code names") do |code_names| + @code_names = code_names + end + parser.on("--debian-directory=DIRECTORY", + "The debian/ directory") do |debian_directory| + @debian_directory = Pathname.new(debian_directory).expand_path + end + parser.on("--pgp-sign-key=KEY", + "The PGP key to sign .changes and .dsc") do |pgp_sign_key| + @pgp_sign_key = pgp_sign_key + end + + parser.parse! + end + + def upload(code_name) + in_temporary_directory do + FileUtils.cp(@source_archive.to_s, + "#{@package}_#{@version}.orig.tar.gz") + run_command("tar", "xf", @source_archive.to_s) + directory_name = "#{@package}-#{@version}" + Dir.chdir(directory_name) do + FileUtils.cp_r(@debian_directory.to_s, "debian") + deb_version = "#{current_deb_version.succ}~#{code_name}1" + run_command("dch", + "--distribution", code_name, + "--newversion", deb_version, + "Build for #{code_name}.") + run_command("debuild", "-S", "-sa", "-pgpg2", "-k#{@pgp_sign_key}") + run_command("dput", @dput_configuration_name, + "../#{@package}_#{deb_version}_source.changes") + end + end + end + + def current_deb_version + /\((.+)\)/ =~ File.read("debian/changelog").lines.first + $1 + end + + def in_temporary_directory + name = "tmp" + FileUtils.rm_rf(name) + FileUtils.mkdir_p(name) + Dir.chdir(name) do + yield + end + end + + def run_command(*command_line) + unless system(*command_line) + raise "failed to run command: #{command_line.join(' ')}" + end + end +end + +uploader = Uploader.new +uploader.run |
|
From: HAYASHI K. <nul...@cl...> - 2014-06-17 06:44:52
|
HAYASHI Kentaro 2014-06-17 15:19:37 +0900 (Tue, 17 Jun 2014) New Revision: b19749d31295db41ee95309c7208da613c83bd1a https://github.com/clear-code/cutter/commit/b19749d31295db41ee95309c7208da613c83bd1a Message: Add missing Makefile for AC_CONFIG_FILES Modified files: configure.ac Modified: configure.ac (+1 -0) =================================================================== --- configure.ac 2014-06-04 11:48:17 +0900 (2a0b678) +++ configure.ac 2014-06-17 15:19:37 +0900 (b9ca92f) @@ -1050,6 +1050,7 @@ AC_CONFIG_FILES([Makefile packages/rpm/centos/Makefile packages/rpm/centos/cutter.spec packages/apt/Makefile + packages/ubuntu/Makefile packages/yum/Makefile]) AC_OUTPUT |