diff options
-rwxr-xr-x | debian/rules | 3 | ||||
-rw-r--r-- | docs/chapters/building.sgml | 15 | ||||
-rw-r--r-- | docs/common.ent | 1 | ||||
-rwxr-xr-x | examples/gbp-configure-unpatched-source | 52 |
4 files changed, 70 insertions, 1 deletions
diff --git a/debian/rules b/debian/rules index ae680c63..cf25ba73 100755 --- a/debian/rules +++ b/debian/rules @@ -20,7 +20,8 @@ EXAMPLE_SCRIPTS=\ gbp-add-patch \ gbp-cowbuilder-sid \ gbp-pbuilder \ - gbp-posttag-push + gbp-posttag-push \ + gbp-configure-unpatched-source DEB_COMPRESS_EXCLUDE=$(EXAMPLE_SCRIPTS) diff --git a/docs/chapters/building.sgml b/docs/chapters/building.sgml index f68e3780..97a9932b 100644 --- a/docs/chapters/building.sgml +++ b/docs/chapters/building.sgml @@ -152,4 +152,19 @@ echo "done." </para> </sect2> </sect1> + <sect1 id="gbp.building.patch"> + <title>Working with patches</title> + <para> + You can use &gbp-pq; to handle patches. See + <ulink url="https://honk.sigxcpu.org/piki/development/debian_packages_in_git/"></ulink> + for an example workflow. + </para> + <para> + In order to avoid a patched (unclean) source tree after the build you + can use &dpkg-source;'s <option>unapply-patches</option> option and + tell &git; to ignore the <filename>.pc</filename> directory. + <filename>/usr/share/doc/examples/git-buildpackage/examples/gbp-config-unpatched-source</filename> + sets up these two files for you. + </para> + </sect1> </chapter> diff --git a/docs/common.ent b/docs/common.ent index 8a7e3e24..735511ae 100644 --- a/docs/common.ent +++ b/docs/common.ent @@ -27,6 +27,7 @@ <!ENTITY svn-buildpackage "<productname>svn-buildpackage</productname>"> <!ENTITY gpg "<productname>GPG</productname>"> <!ENTITY dpkg-buildpackage "<productname>Dpkg-buildpackage</productname>"> + <!ENTITY dpkg-source "<productname>Dpkg-source</productname>"> <!ENTITY pristine-tar "<productname>pristine-tar</productname>"> <!ENTITY apt-get "<productname>apt-get</productname>"> <!ENTITY dget "<productname>dget</productname>"> diff --git a/examples/gbp-configure-unpatched-source b/examples/gbp-configure-unpatched-source new file mode 100755 index 00000000..93e2cbea --- /dev/null +++ b/examples/gbp-configure-unpatched-source @@ -0,0 +1,52 @@ +#!/bin/bash +# +# +# Setup dpkg-source and git to unpatch the source after the build and ignore +# the .pc directory. + +GIT_EXCLUDE=.git/info/exclude +LOCAL_OPTIONS=debian/source/local-options + +help () +{ + cat << EOF >/dev/stdout +Modifies "$LOCAL_OPTIONS" and "$GIT_EXCLUDE" +to ignore .pc and unpatch the source after the build. +EOF + + exit $1 +} + + +case $1 in + -h|--help) + help 0 + ;; +esac + + +if [ ! -d .git ]; then + echo "Not the top of a git repository - aborting." + help 1 +fi + +if ! grep -qs '^3.*\(quilt\)' debian/source/format; then + echo "Not a source format 3 (quilt) package - aborting." + help 1 +fi + +if ! grep -qs '^unapply-patches' $LOCAL_OPTIONS; then + echo "Setting unapply-patches in $LOCAL_OPTIONS" + echo "unapply-patches" >> $LOCAL_OPTIONS + git add $LOCAL_OPTIONS + git commit -m "Unapply patches from source" $LOCAL_OPTIONS +else + echo "unapply-patches already configured" +fi + +if ! grep -qs "^\.pc/" $GIT_EXCLUDE; then + echo "Adding .pc/ to $GIT_EXCLUDE" + echo ".pc/" >> $GIT_EXCLUDE +else + echo "$GIT_EXCLUDE already configured" +fi |