1SUMMARY = "Tool for working with series of patches"
2DESCRIPTION = "Quilt is a tool to manage large sets of patches by keeping \
3track of the changes each patch makes. Patches can be applied, un-applied,\
4refreshed, etc."
5HOMEPAGE = "http://savannah.nongnu.org/projects/quilt/"
6SECTION = "devel"
7LICENSE = "GPL-2.0-only"
8LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
9
10SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
11        file://run-ptest \
12        file://test.sh \
13        file://0001-tests-Allow-different-output-from-mv.patch \
14        file://fix-grep-3.8.patch \
15        file://faildiff-order.patch \
16        file://0001-test-Fix-a-race-condition-in-merge.test.patch \
17"
18
19SRC_URI:append:class-target = " file://gnu_patch_test_fix_target.patch"
20
21SRC_URI[sha256sum] = "3be3be0987e72a6c364678bb827e3e1fcc10322b56bc5f02b576698f55013cc2"
22
23inherit autotools-brokensep ptest
24
25INHIBIT_AUTOTOOLS_DEPS:class-native = "1"
26PATCHTOOL:class-native = "patch"
27
28CLEANBROKEN = "1"
29
30EXTRA_OECONF = "--with-perl='${USRBINPATH}/env perl' --with-patch=patch --without-sendmail"
31EXTRA_OECONF:append:class-native = " --disable-nls"
32
33EXTRA_AUTORECONF += "--exclude=aclocal"
34
35CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash ac_cv_path_COLUMN=column"
36
37# Make sure we don't have "-w" in shebang lines: it breaks using
38# "/usr/bin/env perl" as parser
39do_configure:prepend () {
40	find ${S} -name "*.in" -exec sed -i -e "1s,^#\!.*@PERL@ -w$,#\! @PERL@\nuse warnings;," {} \;
41}
42
43# Don't setup symlinks to host utilities, we don't need them
44do_configure:append () {
45	sed -e 's,^COMPAT_SYMLINKS.*:=.*,COMPAT_SYMLINKS	:=,' -i ${S}/Makefile
46}
47
48do_configure:class-native () {
49    oe_runconf
50}
51
52# quilt Makefiles install to BUILD_ROOT instead of DESTDIR
53do_install () {
54	oe_runmake 'BUILD_ROOT=${D}' install
55	# cleanup unpackaged files
56	rm -rf ${D}/${datadir}/emacs
57}
58
59do_install:append:class-native () {
60    # Dummy quiltrc file for patch.bbclass
61    install -d ${D}${sysconfdir}/
62    touch ${D}${sysconfdir}/quiltrc
63}
64
65# The tests need to run as a non-root user, so pull in the ptest user
66DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
67PACKAGE_WRITE_DEPS += "ptest-runner"
68
69do_install_ptest() {
70	install ${WORKDIR}/test.sh ${D}${PTEST_PATH}
71    mkdir ${D}${PTEST_PATH}/test
72    install ${S}/test/* ${D}${PTEST_PATH}/test
73    # mail needs a MTA, and the patch-wrapper is disabled
74    rm -f ${D}${PTEST_PATH}/test/mail.test ${D}${PTEST_PATH}/test/patch-wrapper.test
75}
76
77# ptest.bbclass currently chowns the ptest directory explicitly, so we need to
78# change permission after that has happened so the ptest user can write a
79# temporary directory.
80do_install_ptest_base:append() {
81    chgrp ptest ${D}${PTEST_PATH}/test
82    chmod g+w ${D}${PTEST_PATH}/test
83}
84
85PACKAGES += "guards guards-doc"
86
87FILES:${PN} = "${sysconfdir} ${datadir}/quilt \
88               ${bindir}/quilt ${libdir}/quilt"
89FILES:guards = "${bindir}/guards"
90FILES:${PN}-doc = "${mandir}/man1/quilt.1 ${docdir}/${BPN}"
91FILES:guards-doc = "${mandir}/man1/guards.1"
92
93RDEPENDS:${PN} = "bash patch diffstat bzip2 util-linux less"
94RDEPENDS:${PN}:class-native = "diffstat-native patch-native bzip2-native"
95
96RDEPENDS:${PN}-ptest += "file sed gawk diffutils findutils ed perl \
97                         perl-module-filehandle perl-module-getopt-std \
98                         perl-module-posix perl-module-file-temp \
99                         perl-module-text-parsewords perl-module-overloading \
100                         bash util-linux-getopt ptest-runner \
101                        "
102