git-dpm-0.9.1/0000755000175100017510000000000012420416173010065 500000000000000git-dpm-0.9.1/Makefile.am0000644000175100017510000000251112420414724012040 00000000000000bin_SCRIPTS = git-dpm MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/stamp-h.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in $(srcdir)/INSTALL clean-local: -rm -rf autom4te.cache $(srcdir)/autom4te.cache maintainer-clean-local: -rm -rf $(srcdir)/ac git-dpm: git-dpm.sh Makefile sed -e 's#^VERSION=.*#VERSION="${PACKAGE_VERSION}"#' \ -e 's#^GIT=.*#GIT="${GIT}"#' \ $< > $@ EXTRA_DIST = git-dpm.sh git-dpm.1 index.html examples.html git-dpm.sh image.ps IMAGES = image-full.png image-patches.png image-cloned.png image-prepared.png image-checkout.png image-commit.png image-updated.png image-tag.png image-newupstream.png image-upstreamrecorded.png image-rebased.png image-rebaserecorded.png image-newtag.png image-1.png image-2.png image-3.png image-4.png image-5.png image-6.png CLEANFILES = manpage.pdf manpage.html git-dpm $(IMAGES) if BUILDDOCS man_MANS = git-dpm.1 html_DATA = index.html examples.html manpage.html $(IMAGES) manpage.pdf GS_FLAGS = -dBATCH -dNOPAUSE -dSAFER GS_PNG_OPTIONS = -sDEVICE=png16 -g600x300 -r100x100 image-%.png: image.ps $(GS) $(GS_FLAGS) $(GS_PNG_OPTIONS) -sOutputFile="$@" -sMYPARAMETER="$*" $< PS2PDF_FLAGS = -sPAPERSIZE=a4 manpage.pdf: git-dpm.1 $(GROFF) -T ps -mandoc $< | $(PS2PDF) $(PS2PDF_FLAGS) - > $@ manpage.html: git-dpm.1 $(GROFF) -T html -mandoc $< > $@ endif git-dpm-0.9.1/examples.html0000644000175100017510000002447512420414724012525 00000000000000 git-dpm examples

git-dpm examples

Contents

Adding a new patch

First get the master branch:

git clone git://git.debian.org/users/brlink/xwit.git

Then create upstream branch and see if the .orig.tar is ready (if you have pristine-tar installed, it will recreate the file for you):

git-dpm prepare

Create the patched branch and check it out:

git-dpm checkout-patched

Do some changes, apply some patches, commit them. (Remember the commit message will be the patch description. So use a proper one. The first line will be the Subject and part of the patch filename, so make it precise).

vim xwit.c
git commit -a

If your modification fixes a previous change (and that is not the last commit, otherwise you could have used --amend to commit), you might want to squash those two commits into one, so use:

git rebase -i upstream

Merge your changes into the debian branch and create patches:

git-dpm update-patches
dch -i
git commit --amend -a

(Note how update-patched put you back into the master branch and deleted the patched branch, so it will not be outdated in case you pull the master branch again later).

Perhaps change something else in debian/:

vim debian/control
dch
git commit -a

Then push the whole thing back (will not work in this example, you would have had to checkout over git+ssh:// and have permissions to that repository...)

git push

Switching to a new upstream version

First get a new .orig.tar file. In this example it will be stuff_newversion.orig.tar.gz.

Prepare a new upstream branch. There are many ways to do this, depending how you want your repository organized. Either

Note that the --rebase also told git-dpm to rebase your patched branch to the new upstream branch. This might cause some conflicts which you have to resolve as with usual git rebases, i.e. continue

vim conflicting files
git add resolved files
git rebase --continue

until the rebase is done.

After rebase is run (with some luck even in the first try), and you made sure it still looks good, merge them into your debian branch again.

git-dpm update-patches

And record the new upstream version in the Debian changelog:

dch -v newversion-1 "new upstream version"
git commit --amend -a

Do other debian/ changes, if there is anything:

vim debian/control
dch "Bump Standards-Version (no changes needed)"
git commit -a

You might want to use pristine tar to store your new tar, too:

pristine-tar commit ../stuff_newversion.orig.tar.gz upstream

Then push the whole thing back:

git push

Create a new project

Create an upstream (or upstream-whatever) branch containing the contents of your orig.tar file:

tar -xvf example_0.orig.tar.gz
cd example-0
git init
git add .
git commit -m "import example_0.orig.tar.gz"
git checkout -b upstream-unstable

You might want to use pristine tar to store your tar:

pristine-tar commit ../example_0.orig.tar.gz upstream-unstable

Then let git-dpm know what tar ball your upstream branch belongs to:

git-dpm init ../example_0.orig.tar.gz

Do the rest of the packaging:

vim debian/control debian/rules
dch --create --package example -v 0-1
git add debian/control debian/rules debian/changelog
git commit -m "initial packaging"

Then add some patches:

git-dpm checkout-patched
vim ...
git commit -a
git-dpm update-patches
dch "fix ... (Closes: num)"
git commit --amend -a

Then build your package:

git-dpm status &&
  dpkg-buildpackage -rfakeroot -us -uc -I".git*"

Now take a look what happened, perhaps you want to add some files to .gitignore (in the unstable branch), or remove some files from the unstable branch because your clean rule removes them.

Continue the last few steps until the package is finished. Then push your package:

git-dpm tag
git push --tags target unstable:unstable pristine-tar:pristine-tar

Switching an existing project to git-dpm

In this example about porting an existing repository to git-dpm, let's use some realistic example: xorg-server.

First check it out:

git clone git://git.debian.org/pkg-xorg/xserver/xorg-server.git
cd xorg-server

To make this example reproducible, let's switch to an specific point, namely version 2:1.7.3.902-1:

git checkout -b master 6fad5b26289e6b13aebfd9e684942743d2384439

First, let's also get the upstream tar ball (That might need snapshot.debian.net or something like that instead in the future).

(cd .. && wget http://ftp.debian.org/debian/pool/main/x/xorg-server/xorg-server_1.7.3.902.orig.tar.gz)

First we need an upstream branch with contents similar enough to the upstream tar ball. The easiest way it to just use that:

git-dpm import-tar -p d1320f4f2908fd3a248a79314bd78f76b03c71c5 ../xorg-server_1.7.3.902.orig.tar.gz
git checkout -b upstream

(The -p adds the appropriate point in remotes/origin/upstream-unstable history as parent to this one). Note the many files added here and also some files deleted.

Then we can just try (if that succeeds, we could be finished):

git-dpm init ../xorg-server_1.7.3.902.orig.tar.gz upstream

This gives a long list of files that are added or modified in our current debian branch master, so we have to investigate. (It suggests --patched-applied, but it's easy to say the patches in debian/patches/ are not yet applied, so this will not help).

First remember that there were also files deleted when importing the .tar.gz. Some seem to be only in the repository as they are also in upstream's repository. Let's try to delete them (Of course that means one has later to verify they are really not needed in the build or even the final packages):

git checkout master
git rm -f hw/xquartz/GL/glcontextmodes.c hw/xquartz/GL/glcontextmodes.h hw/xfree86/doc/README.modes config/dbus-api doc/c-extensions hw/kdrive/Xkdrive.man hw/kdrive/ephyr/ephyrhostproxy.c hw/kdrive/ephyr/ephyrhostproxy.h hw/kdrive/ephyr/ephyrproxyext.c hw/kdrive/ephyr/ephyrproxyext.h hw/kdrive/fbdev/Xfbdev.man 'hw/xquartz/bundle/Resources/*.lproj/locversion.plist' 'hw/xquartz/bundle/Resources/*.lproj/main.nib/designable.nib' hw/xwin/xlaunch/Makefile hw/xwin/xlaunch/config.h
git commit -m "remove unused files not in the upstream tar.gz"

Trying again to see what is left:

git-dpm init ../xorg-server_1.7.3.902.orig.tar.gz upstream

Looking with gitk for commits touching those paths, shows us that one file is from some cherry-picked commit directly applied in the debian branch, so tell git-dpm about it:

git checkout upstream
git checkout -b pre
git cherry-pick cd192850fc73aa43432e1068503699ebdaa2cb83
git checkout master
git-dpm init ../xorg-server_1.7.3.902.orig.tar.gz upstream pre

Only one file left. Looking at this shows it is empty and no longer referenced anywhere in the source, so some other artefact.

git checkout master
git rm -f hw/xfree86/osandcommon.c
git commit -m "remove empty files left in the debian branch"

Trying again:

git-dpm init ../xorg-server_1.7.3.902.orig.tar.gz upstream pre

show that is worked this time. So get rid of the temporary branch:

git branch -d pre
git-dpm-0.9.1/ac/0000755000175100017510000000000012420416173010450 500000000000000git-dpm-0.9.1/ac/missing0000755000175100017510000001533012420416171011767 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: git-dpm-0.9.1/ac/install-sh0000755000175100017510000003325512420416171012402 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: git-dpm-0.9.1/INSTALL0000644000175100017510000003661012420416171011042 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. git-dpm-0.9.1/ChangeLog0000644000175100017510000002534612420416120011561 000000000000002014-10-18 describe what --allow-nonlinear does 2014-10-18 fix import-dsc broken by tar_exclude functionality (and add --tar-exclude option to it) 2014-10-11 prepare 0.9.0 2014-10-11 mark new-upstream command name deprecated and make sure all documentation mentions record-new-upstream 2014-10-11 add --exclude option to import-tar and import-new-upstream passed to tar 2014-10-11 fix bug in merge-patched reporting debian/patches up to date if it was empty before 2014-09-07 look into debian/.git-dpm for default tag names 2014-09-07 add %V %U %E %f to tag name templates 2014-07-06 Document how to remove patches in the middle of the series 2014-08-09 try to help against a remote pristine-tar branch not having a local branch tracking it yet 2014-08-09 add a --ignore-unclean-branches to git-dpm import-new-uptream 2014-07-24 allow non-lightweight tags at more places 2014-03-09 prepare 0.8.6 2014-03-09 fix bug in tar importer w.r.t. files with hardlinks in it 2014-03-09 remove double-alias c-p (now only alias for checkout-patched) 2014-03-02 try harder to detect dpatch patches to import 2013-12-28 silence some shelllint warnings 2013-12-28 Some grammar fixes for the manpage 2013-12-28 Update webpage now that git-dpm is packaged 2013-12-28 make index.html valid html 2013-12-28 make example.html valid html 2013-12-27 Allow passing annotated tags to "-p" 2013-08-29 fix bug in file deletion propagation 2013-06-18 fix a lot of spelling mistaked and/or spelling inconsistencies 2013-06-12 allow import-dsc --edit-patches to also edit author information 2013-06-12 also cope with Author: lines in patches to apply 2013-03-21 fix wrong hint in overlapping project error message 2013-03-21 proper error message if new-upstream is called with no new upstream branch 2013-03-21 add alias record-new-upstream for new-upstream 2012-06-11 prepare 0.8.4 2012-06-11 when using import-dsc --use-changelog, also use date as commit date for patches from 1.0 packages 2012-06-09 if a dpatch patch does not apply, try some more git-apply options 2012-05-15 prepare 0.8.3 2012-05-15 manpage: instruct groff to produce hyphen-minus and not hyphen or minus 2012-04-24 prepare 0.8.2 2012-04-24 fix test against git 1.7.1 triggered by git 1.7.10 2012-04-08 add missing -- to some git-dpm dch examples in manpage 2012-04-02 prepare 0.8.1 2012-04-02 fix import-dsc complaining about up-to-date upstream branch 2012-02-22 import-{tar,dsc}: do not call tar with -U as that breaks tar in squeeze with tarballs containing an explicit ./ directory 2012-02-22 import-{tar,dsc}: fix "rmdir: failed to remove `./': Invalid argument" 2012-02-18 git-dpm init: respect --allow-upstream-changes-in-debian 2012-02-04 if not changing the upstream branch but only recording new files, don't call or warn about rebase-patched 2011-11-27 prepare 0.8.0 2011-09-19 add --use-changelog to import-dsc 2011-11-12 don't get confused by dpatch files starting with '#\!/' instead if '#\! /' 2011-11-12 filter out ^diff -[Naurp]* from diff descriptions 2011-10-23 remove buggy cherry-pick error message 2011-10-23 improve dpatch patch header (especially those without author information) 2011-10-01 try to ignore less errors 2011-10-01 explicitly return all errors instead of relying on set -e 2011-10-01 fix typo making warning in import-tar to error 2011-09-29 add -x to test.sh 2011-09-21 add --allow-native-import to import-dsc 2011-09-19 harmonize order verbatim branch is merged in 2011-09-19 refactor code to internally encapsulate git commit-tree calls 2011-09-18 add --author to import-tar, --upstream-author and --upstream-date to import-new-upstream and import-dsc 2011-09-21 import-dsc: don't get confused by .dsc without Format: 2011-09-18 make rebase-patches work with no upstream branch existing as git branch yet 2011-09-16 add empty line after subject so git identifies it correctly 2011-09-13 avoid problems with some awk variants 2011-09-13 avoid one instance of git-checkout being now too verbose in import-dsc 2011-09-08 remove forgotten debug output 2011-08-29 update command list in --help 2011-07-21 rewrite merge operation, add --ignore-deletions, add --dot-git-files, remove unreleased --keep-deletes/--no-deletes/--uptream-git-files/--keep-git-files again 2011-08-08 require at least git 1.7.2 2011-08-07 add --branch option to import-tar 2011-08-07 fix import-dsc doing the dpm.importwithoutparent=false check at the wrong time 2011-07-19 avoid test-case failing if ~/.gitconfig has dpm.importWithoutParent = false 2011-07-04 add --keep-deletes, --no-deletes, --upstream-git-files, --keep-git-files 2011-06-05 use --no-signature in format-patch calls 2011-05-07 add record-dsc command to record a pristine .dsc file with contents 2011-05-07 make tag and ref-tag more chatty by default 2011-05-06 add dpm.importWithoutParent git config so one does not forget -p with import-new-upstream or import-dsc 2011-05-04 prepare 0.7.1 2011-05-04 fix bug calculating wrong file sizes if those are symlinks 2011-03-19 prepare 0.7.0 2011-03-17 improve error handling if import-dsc cannot import some patches 2011-03-17 improve reverting to previous state if started with a detached HEAD 2011-03-17 fix another bug in dpmPatchedBranch config handling 2011-03-16 fix typo causing spurious error in a patched branch named with dpmPatchedBranch config 2011-03-11 add --init and --branch options to import-new-upstream 2011-03-09 change import-dsc to look more like something not imported 2011-03-14 allow branch names with slashes in them 2011-03-09 don't give update-ref a reason most of the time wrong message for the log 2011-03-08 make import-tar (and other -p users) support volatile commits like HEAD better 2011-03-08 add --date option to import-tar 2011-03-05 allow 'NONE' to disable a specific type of tag 2011-03-04 add 'ref-tag' to tag a not checked out version 2011-03-04 fix 'tag' description in manpage 2011-02-23 prepare 0.6.0 2011-02-22 avoid git getting confused when commits happen to fast by waiting between applying patches 2011-02-12 fix bug causing pristine-tar to be called again 2011-02-12 allow to enable --pristine-tar-commit options by git-config setting 2011-02-11 check harder to ensure not calculated branch name is configured for another function 2011-02-08 allow specifying related branches via git-config 2011-02-08 remove undocumented -U, -D and -P switches. 2011-02-06 add git-dpm tag --debian-tag --patched-tag and --upstream-tag and make those and --named setable via git-config 2011-01-31 import-tar: don't litter working directory with empty directories 2011-01-31 add support for symlinks in import-tar 2011-01-30 fix typo in manpage 2011-01-27 improve emtry tree creation by using git mktree 2011-01-08 better check for existance and correct type of some arguments 2010-12-29 git-dpm.1: fix some typos 2010-11-09 prepare 0.5.0 2010-11-09 add missing ']' in import-dsc (introduces recently) 2010-11-09 add some sanity checks to catch some of the errors possible with components 2010-11-08 don't refuse to record upstream-branch/files if only components changed 2010-11-07 add options to create Patch-Category and Patch-Name fields 2010-11-07 patches can chose their name with Patch-Filename and Patch-Category 2010-11-07 fix newly introduced bug in git-dpm init 2010-11-06 document dch in git-dpm --help 2010-11-06 add --component option to init 2010-11-06 refactor some code (especialy init), remove init --no-commit 2010-11-06 import-dsc now marks patches as exported if there are none 2010-11-05 avoid creating extra commit for .orig.tar where possible 2010-11-05 add components support to git-dpm import-new-upstream 2010-11-05 add --pristine-tar-commit option to import-dsc 2010-11-05 fix import-dsc with components being removed since last revision 2010-11-05 git-dpm empty-tree checks before doing anything 2010-11-04 add support for .orig-component.tar files to import_dsc 2010-11-03 better cope with author information in patches that are not in a format git supports. 2010-11-03 allow imported patches to reside in subdirectories 2010-11-03 better and more checks against upstream changes in the debian branch 2010-11-02 document --component option of new-upstream 2010-11-01 add some support for components 2010-10-31 fix some hypen vs minus issues in the manpage 2010-10-31 prepare 0.4.0 2010-10-31 be less noisy when switching branches 2010-10-31 (import-)new-upstream do a merged-debian if there were no patches previously 2010-10-21 add git-dpm dch to the manpage 2010-10-20 improve update-patches 2010-10-23 improve manpage w.r.t. merge-patched 2010-10-21 git-dpm dch no longer needs a clean debian branch when merging patches 2010-10-01 add some shelllint hints 2010-10-20 add support for deleting stuff in modify_tree 2010-10-20 add --no-rebase-patched option to import-new-upstream 2010-10-20 add -m option to import-new-upstream, new-upstream and merge-patched 2010-10-18 remove confusing rm message from dsc importing code 2010-10-18 remove confusing messages from merge_patched 2010-10-18 fix some newline issues in the new merge_patched 2010-10-15 move git hash-object into function 2010-10-12 implement recording new upstream versions in a more low-level fashion 2010-10-18 make sure .git/dpm/oldcontrol is up to date 2010-10-07 add git-dpm version (only having git-dpm version is perhaps a bit non-standard) 2010-10-07 fix typo 2010-10-06 testsuite: also ignore done.substvars (so it runs on unstable again) 2010-10-06 testsuite: check if git-dpm prepare can checkout a orig.tar file 2010-10-06 prepare 0.3.0 2010-10-05 improve creating of empty commit by using GIT_INDEX_FILE 2010-10-05 Merging patches into debian by using a different index 2010-10-05 always keep control file 2010-08-15 introduce git-dpm dch 2010-10-06 fix merge-patched: proper diagnotics and cleanup if nothing to do 2010-10-04 remove unused variables 2010-10-04 make --date option work 2010-10-03 remove unused --force option of merge-patched 2010-10-03 move lines_must_match into top-level functions calling a function needing it 2010-10-03 fix typo in variable name (only fixing an confusing message, though) 2010-10-03 fix typo causing --amend no effect with git-dpm's merge-patched 2010-10-03 fix wrong variable in debug output and warnings of git-dpm init 2010-10-03 fix typo causing wrong old commits computed in git-dpm import 2010-10-03 remove wrong reverence of level in apply_next_dpatch_patch 2010-10-02 fix miswritten variable name 2010-08-15 improve internal merge_patched code 2010-08-15 improve update-patches 2010-08-15 improve error handling 2010-09-01 do not execute git rev-parse --is-* output but compare to true 2010-10-01 fix typo in variable name 2010-08-23 fix empty-tree 2010-08-20 add link to the Debian Wiki to the documentation 2010-08-20 add git-dpm empty-tree (for test-suite) 2010-08-16 more tests 2010-08-16 fix git-dpm init in the case the upstrem branch does not yet exist 2010-08-03 list import-dsc in commands printed by --help git-dpm-0.9.1/COPYING0000644000175100017510000004313312420414724011044 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. git-dpm-0.9.1/aclocal.m40000644000175100017510000007213412420416171011652 00000000000000# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR git-dpm-0.9.1/README0000644000175100017510000000166312420414724010673 00000000000000git-dpm: manage debian source packages in git --------------------------------------------- Git-dpm help you store debian source packages with modifications to the upstream sources in git. Let's look at an short example. Assume there is some project under git-dpm control (there is a debian/.git-dpm file). First get the master branch: git clone Then create upstream branch and see if the .orig.tar is ready: git-dpm prepare Create the patched branch and check it out: git-dpm checkout-patched Do some changes, apply some patches, commit them.. <...> git commit If your modification fixes a previous change (and that is not the last commit, otherwise you could have used \-\-amend), you might want to squash those two commits into one, so use: git rebase -i upstream Merge your changes into the debian branch and create patches: git-dpm update-patches dch -i git commit --amend -a Then push the whole thing back: git push git-dpm-0.9.1/git-dpm.sh0000755000175100017510000100364512420415151011711 00000000000000#!/bin/bash # git-dpm: manage Debian packages in git # # Copyright (C) 2009,2010,2011,2012 Bernhard R. Link # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc. # Not really used anymore, but better safe than sorry... set -e # those could cause problems, so remove: unset CDPATH unset GREP_COLOR unset GREP_COLORS export GREP_OPTIONS=--color=never VERSION=unreleased GIT=git ORIGHEADBRANCH="" HEADBRANCH="" DEBUG=false dosilent=false allow_nonclean=false delete_temp_files=true commit_in_tree= dpatch_forbid_empty=true # gets -1 if checked and unclean, 1 if checked and clean checked_if_clean=0 gitdpm_print_git_commands=false allowchangesindebian=false ##:global checked_if_clean ##:compound globalcmdvars gitdir delete_temp_files commit_in_tree allow_nonclean DEBUG gitdpm_print_git_commands GIT ##:compound gitcheck reldir/ro =globalcmdvars ##:compound head =gitcheck ORIGHEADBRANCH/ro HEADBRANCH ##:compound branches =head DEBIANBRANCH/ro PATCHEDBRANCH/ro UPSTREAMBRANCH/ro BASEBRANCH/ro UPSTREAMREV PATCHEDREV DEBIANREV ##:compound dpm_control control_upstream/ro control_patches/ro control_patched/ro control_origtarname/ro control_origtarsha/ro control_origtarsize/ro control_oldupstream/ro ##:compound dpmcontrol =branches =dpm_control ##:compound subcommand =gitcheck/local =head =dpm_control/local =branches/local =globalcmdvars ##:external awk ##:external bunzip2 ##:external cat ##:external cp ##:external cut ##:external dch ##:external diff ##:external dirname ##:external dpkg-parsechangelog ##:external egrep ##:external find ##:external grep ##:external gunzip ##:external head ##:external ls ##:external mkdir ##:external printf ##:external pristine-tar ##:external readlink ##:external rm ##:external rmdir ##:external sed ##:external sensible-editor ##:external sha1sum ##:external sleep ##:external sort ##:external stat ##:external tac ##:external tail ##:external tar ##:external tr ##:external unlzma ##:external uudecode ##:external wc ##:external which ##:function debugout/nofail DEBUG function debugout() { if $DEBUG ; then echo "$@" ; fi } ##:function printwarn/nofail function printwarn() { echo "git-dpm: WARNING: $*" >&2 } ##:function printerror/nofail function printerror() { echo "git-dpm: ERROR: $*" >&2 } # sanitize a string to be passed as part of an sed regexp enclosed in // ##:function sedsafe/nofail function sedsafe() { printf "%s" "$1" | LC_ALL=C sed -e 's:[]\[\^\$\.\*\/]:\\&:g' } # sanitize a string to be passed as part of an basic grep request ##:function grepsafe/nofail function grepsafe() { printf "%s" "$1" | LC_ALL=C sed -e 's:[]\[\^\$\.\*]:\\&:g' } while [ $# -gt 0 ] ; do case "$1" in --help) cat <&2 fi "$GIT" "$@" } # we need at least format-patch --no-signature and ls-tree --full-tree gitversion="$(gitcmd --version || true)" case "$gitversion" in # only filter out known old versions, so that it will # still work if the output changes format: "git version 1."[0-6]*|"git version 1.7."[01]|"git version 1.7."[01].*) printerror "Your git seems to be too old. Git-dpm needs at least 1.7.2" ;; *) ;; esac gitdir="$(gitcmd rev-parse --git-dir || true)" ##:function checkgitdir =gitcheck/out function checkgitdir() { if ! [ -d "$gitdir" ] ; then debugout "Could not find $gitdir!" printerror "Not in a git repository!" return 1 fi if ! mkdir -p "$gitdir/dpm/" ; then printerror "Could not create '$gitdir/dpm/'!" return 1 fi reldir="$(gitcmd rev-parse --show-cdup || true)" } ##:function checkworkingdir =gitcheck function checkworkingdir() { if [ "x$(gitcmd rev-parse --is-bare-repository || true)" = x"true" ] ; then printerror "requested operation does not work in a bare repository!" return 1 fi if [ "x$(gitcmd rev-parse --is-inside-work-tree || true)" != x"true" ] ; then printerror "requested operation only possible inside working tree!" return 1 fi } ##:function cdtoplevel reldir/override =gitcheck function cdtoplevel() { test -n "$gitdir" || return 1 checkworkingdir || return 1 cd -- "$reldir" || return 1 reldir="" } ##:function dotgitoption dotgitoption/inout function dotgitoption() { # never make 'none' a valid option to avoid endless recursion case "$1" in auto) dotgitoption="automatic" ;; automatic|debian|upstream|default) dotgitoption="$1" ;; *) printerror "Unknown ${2:-dot-git-files option} '$1'. Supported are: automatic, debian and upstream." return 1 ;; esac return 0 } ##:function determinedotgitbehaviour dotgitoption/in dotgitfiles/out =branches function determinedotgitbehaviour() { case "$dotgitoption" in automatic|debian|upstream) dotgitfiles="$dotgitoption" ;; none) dotgitoption "$(gitcmd config --get "branch.$DEBIANBRANCH.dpmdotgitfiles" || gitcmd config --get dpm.dotgitfiles || echo "default" )" "dotgitfiles config" || return 1 determinedotgitbehaviour || return 1 ;; default) dotgitfiles="automatic" ;; *) printerror "Internal Error: strange dotgitoption value $dotgitoption" return 1 esac return 0 } ##:function committreem commit/out =gitcheck function committreem() { local message="$1" ; shift local tree="$1" ; shift local author="$1" ; shift local email="$1" ; shift local date="$1" ; shift commit="$(printf '%s\n' "$message" | { ##:local GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL if test -n "$author" ; then if test -z "$email" ; then export GIT_AUTHOR_NAME="${author%%<*}" email="${author#*<}" export GIT_AUTHOR_EMAIL="${email%>*}" else export GIT_AUTHOR_NAME="${author}" export GIT_AUTHOR_EMAIL="${email}" fi fi if test -n "$date" ; then export GIT_AUTHOR_DATE="$date" fi gitcmd commit-tree "$tree" "$@" || exit 1 } )" || return 1 } ##:function committreef commit/out =gitcheck function committreef() { local message="$1" ; shift local tree="$1" ; shift local author="$1" ; shift local email="$1" ; shift local date="$1" ; shift commit="$(LC_ALL=C sed -e '/^#/d' "$message" | { ##:local GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL if test -n "$author" ; then if test -z "$email" ; then export GIT_AUTHOR_NAME="${author%%<*}" email="${author#*<}" export GIT_AUTHOR_EMAIL="${email%>*}" else export GIT_AUTHOR_NAME="${author}" export GIT_AUTHOR_EMAIL="${email}" fi fi if test -n "$date" ; then export GIT_AUTHOR_DATE="$date" fi gitcmd commit-tree "$tree" "$@" || exit 1 } )" || return 1 } ##:function checkclean =gitcheck function checkclean() { local allow_unclean compareagainst diff allow_unclean="${1:-ERROR}" ##:allow checked_if_clean checked_if_clean=1 # this is approximately what git-rebase does to check the tree is clean: if ! gitcmd update-index --ignore-submodules --refresh > /dev/null; then checked_if_clean=-1 if $allow_unclean ; then printwarn "unstaged changes:" gitcmd diff-files --name-status -r --ignore-submodules -- >&2 || true else printerror "cowardly refusing to run because of unstaged changes:" gitcmd diff-files --name-status -r --ignore-submodules -- >&2 || true return 1 fi fi # check that the current index belongs to HEAD or to the empty # tree in case HEAD does not work (e.g. directly after git init). compareagainst="$(gitcmd rev-parse -q --verify HEAD 2>/dev/null || echo 4b825dc642cb6eb9a060e54bf8d69288fbee4904)" diff="$(gitcmd diff-index --cached --name-status -r --ignore-submodules $compareagainst -- | wc -c)" || true if [ "$diff" -ne 0 ] ; then checked_if_clean=-1 if $allow_unclean ; then printwarn "uncommitted changes:" gitcmd diff-index --cached --name-status -r --ignore-submodules $compareagainst -- >&2 || true else printerror "cowardly refusing to run because of uncommitted changes:" gitcmd diff-index --cached --name-status -r --ignore-submodules $compareagainst -- >&2 || true return 1 fi fi return 0 } ##:function checknoconfiguredbranches BASEBRANCH =gitcheck function checknoconfiguredbranches() { if gitcmd config --get "branch.${1}.dpmupstreambranch" || gitcmd config --get "branch.${1}.dpmpatchedbranch" ; then printerror "'$BASEBRANCH' would belong to '${1}', but that has dpmPatchedBranch or dpmUpstreamBranch set" return 1 fi return 0 } ##:function nametoregexp/nofail function nametoregexp() { printf '%s' "$1" | LC_ALL=C sed -e 's/[^a-zA-z0-9]/\\&/g' } ##:function checknotdependantbranch HEADBRANCH =gitcheck function checknotdependantbranch() { local nameasregexp="^$(nametoregexp "$1")\$" # check if the output is empty, in case the return values change to more # sensible values... if test -n "$(gitcmd config --get-regexp '^branch\..*\.dpmupstreambranch$' "$nameasregexp" || true)" ; then printerror "Branch '$1' derived to belong to '$HEADBRANCH' is also configured to belong elsewhere:" gitcmd config --get-regexp '^branch\..*\.dpmupstreambranch$' "$nameasregexp" >&2 || true gitcmd config --get-regexp '^branch\..*\.dpmpatchedbranch$' "$nameasregexp" >&2 || true return 1 fi if test -n "$(gitcmd config --get-regexp '^branch\..*\.dpmpatchedbranch$' "$nameasregexp" || true)" ; then printerror "Branch '$1' derived to belong to '$HEADBRANCH' is also configured to belong elsewhere:" gitcmd config --get-regexp '^branch\..*\.dpmupstreambranch$' "$nameasregexp" >&2 || true gitcmd config --get-regexp '^branch\..*\.dpmpatchedbranch$' "$nameasregexp" >&2 || true return 1 fi return 0 } ##:function initheadbranch =head/out function initheadbranch() { HEADBRANCH="HEAD" HEADBRANCH="$(gitcmd symbolic-ref -q "$HEADBRANCH" || echo "DETACHED")" HEADBRANCH="${HEADBRANCH#refs/heads/}" if [ x"$HEADBRANCH" = x"DETACHED" ] ; then ORIGHEADBRANCH="$(gitcmd rev-parse HEAD)" || return 1 else ORIGHEADBRANCH="$HEADBRANCH" fi } # determine which branch we are and what the names of the # other branches are. ##:function initbranchvariables =head/out =branches/out function initbranchvariables() { local upstreamcandidates patchedcandidates baseasregexp u p initheadbranch || return 1 BASEBRANCH="${1:-HEAD}" BASEBRANCH="$(gitcmd symbolic-ref -q "$BASEBRANCH" || echo "${BASEBRANCH}")" BASEBRANCH="${BASEBRANCH#refs/heads/}" case "$BASEBRANCH" in HEAD) printerror "You seem to be in an detached HEAD (or something more strange is happening)" return 1 ;; refs/*) echo "git-dpm: CONFUSED: Strange rev '$BASEBRANCH' as derived from '${1:-HEAD}'" >&2 return 1 ;; esac baseasregexp="^$(nametoregexp "$BASEBRANCH")\$" upstreamcandidates="$(gitcmd config --get-regexp '^branch\..*\.dpmupstreambranch$' "$baseasregexp" || true)" patchedcandidates="$(gitcmd config --get-regexp '^branch\..*\.dpmpatchedbranch$' "$baseasregexp" || true)" u="$(gitcmd config --get "branch.$BASEBRANCH.dpmupstreambranch" || true)" p="$(gitcmd config --get "branch.$BASEBRANCH.dpmpatchedbranch" || true)" if test -n "$u" ; then if test -z "$p" ; then printerror "'$u' has only dpmUpstreamBranch but not dpmPatchedBranch" return 1 fi DEBIANBRANCH="$BASEBRANCH" UPSTREAMBRANCH="$u" PATCHEDBRANCH="$p" if test -n "$patchedcandidates" || test -n "$upstreamcandidates"; then printerror "'$BASEBRANCH' both listed to be Debian branch and to belong to a different Debian branch:" echo "branch.${BASEBRANCH}.dpmupstreambranch $UPSTREAMBRANCH" >&2 echo "branch.${BASEBRANCH}.dpmpatchedbranch $PATCHEDBRANCH" >&2 test -z "$upstreamcandidates" || echo "$upstreamcandidates" >&2 test -z "$patchedcandidates" || echo "$patchedcandidates" >&2 return 1 fi elif test -n "$p" ; then printerror "'$BASEBRANCH' has only dpmPatchedBranch but not dpmUpstreamBranch" return 1 elif test -n "$upstreamcandidates" ; then if test -n "$patchedcandidates" ; then printerror "'$BASEBRANCH' is listed both as patched branch and as upstream branch:" echo "$upstreamcandidates" >&2 echo "$patchedcandidates" >&2 return 1 fi if test "x${upstreamcandidates#branch.*.dpmupstreambranch }" != "x${BASEBRANCH}" ; then printerror "'$BASEBRANCH' is listed as upstream branch of multiple branches or parse error:" echo "$upstreamcandidates" >&2 return 1 fi DEBIANBRANCH="${upstreamcandidates#branch.}" DEBIANBRANCH="${DEBIANBRANCH%.dpmupstreambranch $BASEBRANCH}" UPSTREAMBRANCH="$(gitcmd config --get "branch.$DEBIANBRANCH.dpmupstreambranch" || true)" if test "x$UPSTREAMBRANCH" != "x$BASEBRANCH" ; then echo "git-dpm: CONFUSED: '$BASEBRANCH' found as dpmUpstreamBranch of '$DEBIANBRANCH', but the key is not there??" >&2 return 1 fi PATCHEDBRANCH="$(gitcmd config --get "branch.$DEBIANBRANCH.dpmpatchedbranch" || true)" if test -z "$PATCHEDBRANCH" ; then printerror "'$DEBIANBRANCH' has only dpmUpstreamBranch but not dpmPatchedBranch" return 1 fi elif test -n "$patchedcandidates" ; then if test "x${patchedcandidates#branch.*.dpmpatchedbranch }" != "x${BASEBRANCH}" ; then printerror "'$BASEBRANCH' is listed as patched branch of multiple branches or parse error:" echo "$patchedcandidates" >&2 return 1 fi DEBIANBRANCH="${patchedcandidates#branch.}" DEBIANBRANCH="${DEBIANBRANCH%.dpmpatchedbranch $BASEBRANCH}" PATCHEDBRANCH="$(gitcmd config --get "branch.$DEBIANBRANCH.dpmpatchedbranch" || true)" if test "x$PATCHEDBRANCH" != "x$BASEBRANCH" ; then echo "git-dpm: CONFUSED: '$BASEBRANCH' found as dpmPatchedBranch of '$DEBIANBRANCH', but the key is not there??" >&2 return 1 fi UPSTREAMBRANCH="$(gitcmd config --get "branch.$DEBIANBRANCH.dpmupstreambranch" || true)" if test -z "$UPSTREAMBRANCH" ; then printerror "'$DEBIANBRANCH' has only dpmPatchedBranch but not dpmUpstreamBranch" return 1 fi else case "$BASEBRANCH" in patched) PATCHEDBRANCH="patched" DEBIANBRANCH="master" UPSTREAMBRANCH="upstream" checknoconfiguredbranches "master" || return 1 checknotdependantbranch 'master' || return 1 checknotdependantbranch 'upstream' || return 1 ;; patched-*) PATCHEDBRANCH="$BASEBRANCH" DEBIANBRANCH="${BASEBRANCH#patched-}" UPSTREAMBRANCH="upstream-${BASEBRANCH#patched-}" checknoconfiguredbranches "$DEBIANBRANCH" || return 1 checknotdependantbranch "$DEBIANBRANCH" || return 1 checknotdependantbranch "$UPSTREAMBRANCH" || return 1 ;; upstream) UPSTREAMBRANCH="upstream" DEBIANBRANCH="master" PATCHEDBRANCH="patched" checknoconfiguredbranches "master" || return 1 checknotdependantbranch 'master' || return 1 checknotdependantbranch 'patched' || return 1 ;; upstream-*) UPSTREAMBRANCH="$BASEBRANCH" DEBIANBRANCH="${BASEBRANCH#upstream-}" PATCHEDBRANCH="patched-${BASEBRANCH#upstream-}" checknoconfiguredbranches "$DEBIANBRANCH" || return 1 checknotdependantbranch "$DEBIANBRANCH" || return 1 checknotdependantbranch "$PATCHEDBRANCH" || return 1 ;; master) DEBIANBRANCH="$BASEBRANCH" PATCHEDBRANCH="patched" UPSTREAMBRANCH="upstream" checknotdependantbranch 'patched' || return 1 checknotdependantbranch 'upstream' || return 1 ;; *) DEBIANBRANCH="$BASEBRANCH" PATCHEDBRANCH="patched-$BASEBRANCH" UPSTREAMBRANCH="upstream-$BASEBRANCH" ;; esac ; fi debugout "Guessing upstream branch name $UPSTREAMBRANCH" debugout "Guessing patched branch name $PATCHEDBRANCH" debugout "Guessing Debian branch name $DEBIANBRANCH" debugout "Guessing current branch to be $HEADBRANCH" DEBIANREV="$(gitcmd rev-parse -q --verify "$DEBIANBRANCH" || true)" if ${2:-true} && [ -z "$DEBIANREV" ] ; then printerror "There seems to be no branch called '$DEBIANBRANCH'" return 1 fi UPSTREAMREV="$(gitcmd rev-parse -q --verify "$UPSTREAMBRANCH" || true)" PATCHEDREV="$(gitcmd rev-parse -q --verify "$PATCHEDBRANCH" || true)" } # initbranchvariables ##:function isancestor =gitcheck function isancestor() { # todo: investigate if there is an easier way # hopefully --max-count has no effect but making it faster... test -z "$(gitcmd rev-list --max-count=1 "^$2" "$1" || echo "failed")" } ##:function parseextracteddpmcontrolfile fromwhere =gitcheck =dpm_control/out function parseextracteddpmcontrolfile() { local n control_comment control_comment=ERROR control_upstream=ERROR control_oldupstream=ERROR control_patches=ERROR control_patched=ERROR control_origtarname=ERROR control_origtarsha=ERROR control_origtarsize=ERROR for n in comment patches patched oldupstream upstream origtarname origtarsha origtarsize ; do read control_$n || return 1 done < "$gitdir/dpm/oldcontrol" || return 1 if [ "x$control_origtarsize" = "xERROR" ] ; then printerror "malformed debian/.git-dpm$fromwhere!" return 1 fi if test -z "$commit_in_tree" && LC_ALL=C grep -q -s '^commit-in-tree[ ]*=[ ]*true[ ]*\($\|#\)' "$gitdir/dpm/oldcontrol" ; then debugout "enable commit-in-tree as no command line option and set in .git-dpm" commit_in_tree=true elif test -z "$commit_in_tree" && LC_ALL=C grep -q -s '^no-commit-in-tree[ ]*=[ ]*true[ ]*\($\|#\)' "$gitdir/dpm/oldcontrol" ; then debugout "disabling commit-in-tree as no command line option and disabled in .git-dpm" commit_in_tree=false fi ##:unused control_comment return 0 } ##:function no_control_yet =gitcheck =dpm_control/out function no_control_yet() { # create a empty file so it can be looked at in both cases: true > "$gitdir"/dpm/oldcontrol # set to NONE to make it easier to see if they are used uninitialized... control_upstream=NONE control_oldupstream=NONE control_patches=NONE control_patched=NONE control_origtarname=NONE control_origtarsha=NONE control_origtarsize=NONE } ##:function parsedpmcontrolfromcommit =gitcheck =dpm_control/out function parsedpmcontrolfromcommit() { local fromwhere blob if test -n "$2" ; then fromwhere=" $2" else fromwhere=" in commit $1'" fi blob=$(gitcmd rev-parse --verify -q "$1"':debian/.git-dpm' || true) if test -z "$blob" ; then printerror "No file debian/.git-dpm${fromwhere}!" return 1 fi if ! gitcmd cat-file blob "$blob" > "$gitdir/dpm/oldcontrol" ; then if $delete_temp_files ; then rm -- "$gitdir/dpm/oldcontrol" || return 1 fi return 1 fi parseextracteddpmcontrolfile || return 1 } ##:function parsedpmcontrolfile =branches =dpm_control/out function parsedpmcontrolfile() { local fromwhere rev if test -n "$1" ; then rev="$1" elif [ "x$HEADBRANCH" != "x$DEBIANBRANCH" ] ; then rev="$DEBIANREV" else rev="" fi if test -n "$rev" ; then parsedpmcontrolfromcommit "$rev" "in branch '$DEBIANBRANCH'" || return 1 else checkworkingdir || return 1 if ! test -f ${reldir}debian/.git-dpm ; then printerror "Missing file debian/.git-dpm" return 1 fi cp -- "${reldir}debian/.git-dpm" "$gitdir/dpm/oldcontrol" || return 1 fromwhere="" parseextracteddpmcontrolfile || return 1 fi } ##:function checkupstreambranchcurrent =dpmcontrol function checkupstreambranchcurrent() { if test -n "$UPSTREAMREV" && [ "x$UPSTREAMREV" != "x$control_upstream" ] ; then printerror "branch '$UPSTREAMBRANCH' changed!" echo "If you changed it, try running record-new-upstream first." >&2 echo "Or have you forgotten to run prepare after an pull?" >&2 return 1 fi return 0 } ##:function checkpatched =dpmcontrol function checkpatched() { local badrevs badrevs="$(gitcmd rev-list "${UPSTREAMREV:-$control_upstream}..${PATCHEDREV:-$control_patched}" -- ${reldir}debian/ )" || return 1 if test -n "$badrevs" ; then printerror " patched branch changed debian/ in commits:" gitcmd rev-list --pretty=oneline "${UPSTREAMREV:-$control_upstream}..${PATCHEDREV:-$control_patched}" -- ${reldir}debian/ >&2 return 1 fi return 0 } # Checking if Debian branch contains changes outside debian/ # (except deleting files, which should be permitted) # $1: branch to compare to ("" = patched branch) # $2: error message to use in case of error ##:function checkdebian =dpmcontrol function checkdebian() { local relativeto ret # compare to control_patched, as that is what should last have been # merged into the Debian branch. relativeto="${1:-${control_patched}}" # todo: allow filtering files, there might be more than .gitignore... # Let's hope ls-tree is always sorted in the filename... gitcmd ls-tree --full-tree -r "$relativeto" | LC_ALL=C grep -v ' debian/' | LC_ALL=C grep -v '[ /]\.git' > "$gitdir/dpm/tree1" || return 1 gitcmd ls-tree --full-tree -r "$DEBIANREV" | LC_ALL=C grep -v ' debian/' | LC_ALL=C grep -v '[ /]\.git' > "$gitdir/dpm/tree2" || return 1 if (diff --normal "$gitdir/dpm/tree1" "$gitdir/dpm/tree2" || true) | LC_ALL=C grep -q -s '^>' ; then ret=1 if [ x"$2" = x"warn" ] ; then printwarn "Debian branch contains non-debian changes:" ret=0 elif test -z "$2" ; then printerror "Debian branch contains non-debian changes:" else printerror "$2" fi (diff --normal "$gitdir/dpm/tree1" "$gitdir/dpm/tree2" || true) | sed -e 's/^> .*\t/ /p' -e 'd' >&2 || true if $delete_temp_files ; then rm -f -- "$gitdir/dpm/tree1" "$gitdir/dpm/tree2" fi return $ret fi if $delete_temp_files ; then rm -f -- "$gitdir/dpm/tree1" "$gitdir/dpm/tree2" fi return 0 } ##:function checkpatchedlinear =dpmcontrol function checkpatchedlinear() { local parent_expected rev parent gitcmd rev-list --reverse "${UPSTREAMREV:-$control_upstream}".."${PATCHEDREV:-$control_patched}" -- "${reldir}." > "$gitdir/dpm/list" parent_expected="${UPSTREAMREV:-$control_upstream}" while read rev ; do parent="$(gitcmd rev-parse --verify "$rev"^1)" || return 1 if [ x"$parent" != x"$parent_expected" ] ; then debugout "'$rev' has parent '$parent' but expected '$parent_expected'" if $delete_temp_files ; then rm -f -- "$gitdir/dpm/list" fi return 1 fi parent_expected="$rev" ## TODO: fix while parsing: ##:unused parent_expected done < "$gitdir/dpm/list" if $delete_temp_files ; then rm -f -- "$gitdir/dpm/list" fi return 0 } # apply some modifications to the Debian branch, # without requiring that to be checkout out. # Arguments: # $1: the new tree # $2: true if doing an amend, false if not # $3: a new parent to add and which ancestors are to remove, or "" # $4: a parent which is to be removed with all its ancestors (amend only) # $5: commitmessage (may be empty if amending, then old message and author is used) # DEBIANREV may be "" if no amend (in that case $3 might be multiple parents) ##:function committodebianbranch =branches =dpm_control/out function committodebianbranch() { local tree amendmerge newparent parenttoremove commitmessage local parent parents parent_arguments author authorinfo commit np tree="$1" amendmerge="$2" newparent="$3" parenttoremove="$4" commitmessage="$5" if $amendmerge ; then parents="$(gitcmd rev-list --max-count=1 --parents "$DEBIANREV")" || return 1 parents="${parents#* }" parent_arguments="" for parent in $parents ; do if test -n "$parenttoremove" && isancestor "$parent" "$parenttoremove" ; then continue fi if test -n "$newparent" && isancestor "$parent" "$newparent" ; then continue fi parent_arguments="$parent_arguments -p $parent" done if test -n "$newparent" ; then parent_arguments="$parent_arguments -p $newparent" fi if test -n "$commitmessage" ; then # if an message was given, use that and do not reuse # the old author or date (assuming --amend -m "..." is # supposed to only make the old commit vanish). committreem "$commitmessage" "$tree" "" "" "" $parent_arguments || return 1 else # TODO: allow invoking editor here? # if no message was given, assume amending is supposed # to also keep the old author and date # (just like git commit --amend does). rm -f -- "$gitdir"/dpm/msg.author gitcmd cat-file commit "$DEBIANREV" | LC_ALL=C awk \ 'BEGIN {auth=ARGV[1];ARGV[1]="";l=0} l {print;next} /^ *$/ {l=1} /^author / {print > auth} {next}' "$gitdir"/dpm/msg.author - > "$gitdir"/dpm/msg.txt || return 1 if test -f "$gitdir"/dpm/msg.author ; then authorinfo="$(cat "$gitdir"/dpm/msg.author)" || return 1 authorinfo="${authorinfo#author }" author="${authorinfo%%<*}" authorinfo="${authorinfo#*<}" committreef "$gitdir"/dpm/msg.txt "$tree" "$author" "${authorinfo%>*}" "${authorinfo##*>}" $parent_arguments || return 1 else committreef "$gitdir"/dpm/msg.txt "$tree" "" "" "" $parent_arguments || return 1 fi if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/msg.txt "$gitdir"/dpm/msg.author fi fi else if test -n "$DEBIANREV" ; then parent_arguments="-p $DEBIANREV" else parent_arguments="" fi for np in $newparent ; do parent_arguments="$parent_arguments -p $np" done committreem "$commitmessage" "$tree" "" "" "" $parent_arguments || return 1 fi debugout "Update '$DEBIANBRANCH' .." if [ x"$HEADBRANCH" = x"$DEBIANBRANCH" ] ; then gitcmd checkout -q ${commit} || return 1 HEADBRANCH=DETACHED gitcmd update-ref refs/heads/"$DEBIANBRANCH" "$commit" "$DEBIANREV" || return 1 gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" else gitcmd update-ref refs/heads/"$DEBIANBRANCH" "$commit" "$DEBIANREV" || return 1 fi DEBIANREV="$commit" # set all control_ variables to the values just set. parsedpmcontrolfromcommit "$DEBIANREV" "newly created commit in '$DEBIANBRANCH'" || return 1 } # Creates an tree based on some tree ($1) and modifications in a file ($2) # and call git rm --cached for all other arguments $3... ##:function modify_tree tree/out =gitcheck function modify_tree() { local GIT_INDEX_FILE modfile tree="$1" shift modfile="$1" shift rm -f -- "$gitdir/dpm/tmpindex" || return 1 GIT_INDEX_FILE="$gitdir/dpm/tmpindex" export GIT_INDEX_FILE debugout "Read $tree into $gitdir/dpm/tmpindex" gitcmd read-tree "$tree" || return 1 if [ $# -gt 0 ] ; then gitcmd rm -f --cached "$@" || true fi debugout "and apply $modfile:" if $DEBUG ; then cat -- "$modfile" || true ; fi gitcmd update-index --index-info < "$modfile" || return 1 debugout "writing index stored in $gitdir/dpm/tmpindex into tree" tree="$(gitcmd write-tree)" || return 1 unset GIT_INDEX_FILE rm -- "$gitdir/dpm/tmpindex" || return 1 } # Create a new tree from an old tree a an list of dirs to add... ##:function create_tree_with_dirs tree/out =gitcheck function create_tree_with_dirs() { local GIT_INDEX_FILE rulesfile name rest tree="$1" rulesfile="$2" rm -f -- "$gitdir/dpm/tmpindex" || return 1 GIT_INDEX_FILE="$gitdir/dpm/tmpindex" export GIT_INDEX_FILE debugout "Read $tree into $gitdir/dpm/tmpindex" gitcmd read-tree "$tree" || return 1 while IFS=":" read name tree rest ; do ##:unused rest debugout "replace $name/ with $tree" gitcmd rm --ignore-unmatch --cached -f -q -r -- "$name" || return 1 gitcmd read-tree --prefix="${name}/" "$tree" || return 1 done < "$rulesfile" debugout "writing index stored in $gitdir/dpm/tmpindex into tree" tree="$(gitcmd write-tree)" || return 1 unset GIT_INDEX_FILE rm -- "$gitdir/dpm/tmpindex" || return 1 } # Create a new tree from an old tree and a new debian/ ##:function create_tree_with_new_debian tree/out =gitcheck function create_tree_with_new_debian() { local GIT_INDEX_FILE rm -f -- "$gitdir/dpm/tmpindex" || return 1 GIT_INDEX_FILE="$gitdir/dpm/tmpindex" export GIT_INDEX_FILE debugout "Read $1 into $gitdir/dpm/tmpindex" gitcmd read-tree "$1" || return 1 debugout "replace debian/ with $2" gitcmd rm --ignore-unmatch --cached -f -q -r -- debian || return 1 gitcmd read-tree --prefix=debian/ "$2" || return 1 debugout "writing index stored in $gitdir/dpm/tmpindex into tree" tree="$(gitcmd write-tree)" || return 1 unset GIT_INDEX_FILE rm -- "$gitdir/dpm/tmpindex" || return 1 } ##:function ensure_pristine_tar_branch_ready =gitcheck function ensure_pristine_tar_branch_ready() { local remotename if ! gitcmd rev-parse -q --verify "pristine-tar:" > /dev/null ; then if [ "$( gitcmd branch --list --remote '*/pristine-tar' | LC_ALL=C sed -e 's/^ *//' -e '/^$/d' | wc -l || true)" -eq 1 ] ; then remotename="$(gitcmd branch --list --remote '*/pristine-tar' | LC_ALL=C sed -e 's/^ *//' -e '/^$/d')" || return 1 printwarn "pristine-tar branch did not exist as local branch yet. Creating local one from '$remotename'..." gitcmd branch pristine-tar "refs/remotes/$remotename" || return 1 fi fi true } ##:function check_new_pristine_tar =gitcheck function check_new_pristine_tar() { local component tree filename filesfile docommit needmessage ptbranch filesfile="$1" docommit="$2" needmessage=true if $docommit ; then needmessage=false ensure_pristine_tar_branch_ready || true fi ptbranch="$(gitcmd rev-parse -q --verify "pristine-tar:" || true)" while IFS=":" read component tree filename ; do ##:unused component if test -n "$ptbranch" ; then if gitcmd rev-parse -q --verify "${ptbranch}:${filename##*/}.id" >/dev/null || gitcmd rev-parse -q --verify "${ptbranch}:${filename##*/}.delta" >/dev/null ; then debugout "$filename seems to be already known to pristine-tar" continue; fi fi if $docommit ; then echo "calling pristine-tar commit '$filename' '$tree'..." pristine-tar commit "$filename" "$tree" else if $needmessage ; then echo "You might want to call:" needmessage=false fi echo "pristine-tar commit $filename $tree" fi done < "$filesfile" ##:unused needmessage } # encapsulare git hash-object ##:function hash_object/dirty =gitcheck function hash_object() { # git hash-object needs GIT_DIR set or it fails in bare repositories # (at least with git version 1.5.6.5 (lenny)) GIT_DIR="$gitdir" export GIT_DIR gitcmd hash-object -t blob -w -- "$1" } # Create information suitable for modify_tree or deban_onto_patched # based on a new control file # and information about new upstream and patchedrev # (might be empty to denote no change) ##:function modifications_for_newcontrol commit_in_tree/ro =gitcheck function modifications_for_newcontrol() { local newcontrolhash newcontrol upstreamrev patchedrev newcontrol="$1" upstreamrev="$2" patchedrev="$3" newcontrolhash="$(hash_object "$newcontrol")" || return 1 printf '100644 blob %s\tdebian/.git-dpm\n' "${newcontrolhash}" || return 1 if ${commit_in_tree:-false} ; then if test -n "$upstreamrev" ; then printf '160000 commit %s\tdebian/.git-dpm-upstream\n' "${upstreamrev}" || return 1 fi if test -n "$patchedrev" ; then printf '160000 commit %s\tdebian/.git-dpm-patched\n' "${patchedrev}" || return 1 fi fi return 0 } # rev-parse and make sure it is a commit ##:function get_and_verify_commit =gitcheck function get_and_verify_commit() { local name object objtype name="$1" object="$(gitcmd rev-parse --verify -q "$name"'^{commit}')" || object="" if test -z "$object" ; then # try again without ^{commit}, for better error messages object="$(gitcmd rev-parse --verify -q "$name")" || object="" fi if test -z "$object" ; then printerror "git cannot parse '$name' (or it is ambiguous)" return 1 elif gitcmd cat-file -e "$object" ; then objtype="$(gitcmd cat-file -t "$object")" || return 1 if [ x"$objtype" != x"commit" ] ; then printerror "'$name' is not a commit but of type $objtype" return 1 fi echo "$object" return 0 else printerror "git resolves '$name' to '$object', but that is no known object" return 1 fi } ##### merge-patched-into-debian ###### # The function 'debianmerge' takes four trees: # an old upstream/patched tree A # an old merged tree B # an new patched tree C # an tree D for the debian/ directory. # plus a list of modifications (typecially information about debian/.git-dpm) # # It creates a tree with: # - debian/ like in D # - things outside debian/ matching .git* like in B or C (depending on $dotgitfiles) # - things outside debian/ and not matching .git* which are also # found by this name in A but not in B only foun if $ignoredeletions is true # - otherwise everything like in C ##:function debianmerge tree/out dotgitfiles ignoredeletions =branches function debianmerge() { local GIT_INDEX_FILE local tmptree1 tmptree2 local modifications="$1" local newpatchedrev="$2" # usually $PATCHEDREV, must be != "" local newpatchedname="$3" # usually $PATCHEDBRANCH, must be != "" local newdebianrev="$4" # usually $DEBIANREV:debian, must be != "" local newdebianname="$5" # usually $DEBIANBRANCH:debian, must be != "" local oldpatchedrev="$6" # usually old $control_patched, "" means no delete local oldpatchedname="$7" local oldmergedrev="$8" # usually $DEBIANREV local oldmergedname="$9" # must be != "" debugout "Switch to a empty index file .git/dpm/mergeindex" rm -f -- "$gitdir/dpm/mergeindex" GIT_INDEX_FILE="$gitdir/dpm/mergeindex" export GIT_INDEX_FILE gitcmd ls-tree --full-tree -r "$newpatchedrev" > "$gitdir/dpm/newfiles" || return 1 case "$dotgitfiles" in upstream|automatic) debugout "start with non-debian/ files from $newpatchedname" LC_ALL=C sed -e '/\t"\?debian/d' \ -- "$gitdir/dpm/newfiles" \ | gitcmd update-index --index-info || return 1 ;; *) debugout "start with non-.git, non-debian/ files from $newpatchedname" LC_ALL=C sed -e '/\t"\?debian/d' \ -e '/\(\t\|\t"\|\/\)\.git/d' \ -- "$gitdir/dpm/oldfiles" \ | gitcmd update-index --index-info || return 1 ;; esac if ! $ignoredeletions && test -n "$oldpatchedrev" && test -n "$oldmergedrev" ; then debugout "Remove all files that are in $oldpatchedname but deleted from $oldmergedrev" tmptree1=$(gitcmd ls-tree --full-tree "$oldpatchedrev" | LC_ALL=C sed -e '/\tdebian$/d' | gitcmd mktree) || return 1 tmptree2=$(gitcmd ls-tree --full-tree "$oldmergedrev" | LC_ALL=C sed -e '/\tdebian$/d' | gitcmd mktree) || return 1 gitcmd diff-tree -r --raw --name-only --diff-filter=D "$tmptree1" "$tmptree2" | LC_ALL=C sed -e 's/^/0 0000000000000000000000000000000000000000\t/' | gitcmd update-index --index-info || return 1 fi case "$dotgitfiles" in upstream|delete) ;; allupstream) debugout "Add all .git files outside debian/ from $newpatchedname" LC_ALL=C sed -n -e '/\t"\?debian/d' \ -e '/\(\t\|\t"\|\/\)\.git/p' \ -- "$gitdir/dpm/newfiles" \ | gitcmd update-index --index-info || return 1 ;; debian) debugout "Add all .git files outside debian/ from $oldmergedname" gitcmd ls-tree --fulname -r "$oldmergedrev" \ | LC_ALL=C sed -n -e '/\t"\?debian/d' \ -e '/\(\t\|\t"\|\/\)\.git/p' \ | gitcmd update-index --index-info || return 1 ;; automatic) if test -n "$oldpatchedrev" ; then debugout "Restoring changed .git* files from '$DEBIANBRANCH' (comparing '${oldpatchedname}' and '$oldmergedrev' ..." tmptree1=$(gitcmd ls-tree --full-tree "$oldpatchedrev" | LC_ALL=C sed -e '/\tdebian$/d' | gitcmd mktree) || return 1 tmptree2=$(gitcmd ls-tree --full-tree "$oldmergedrev" | LC_ALL=C sed -e '/\tdebian$/d' | gitcmd mktree) || return 1 gitcmd diff-tree -r --raw --diff-filter=ADM "$tmptree1" "$tmptree2" | LC_ALL=C sed -n -e 's/^:[0-7]\+ \([0-7]\+\) [0-9a-f]\+ \([0-9a-f]\+\) [ADM]\t\(\(\|"\|[^\t]*\/\)\.git.*\)$/\1 \2\t\3/p' | gitcmd update-index --index-info || return 1 fi ;; *) printerror "Internal error: unexpected dotgitfiles value '$dotgitfiles'" return 1 ;; esac debugout "add debian/ directory from '$newdebianname'..." # TODO: what happens if there is no debian/ in Debian branch? gitcmd read-tree --prefix=debian/ -i "$newdebianrev" || return 1 if test -n "$modifications" ; then debugout "applying modifictions stored in $modifications:" if $DEBUG ; then cat "$modifications" || true ; fi gitcmd update-index --index-info < "$modifications" || return 1 fi debugout "writing index stored in $gitdir/dpm/mergeindex into tree" tree="$(gitcmd write-tree)" || return 1 unset GIT_INDEX_FILE rm -- "$gitdir/dpm/mergeindex" || return 1 } # Update the Debian branch # by replacing anything but debian/ with the patched branch # control_oldupstream must be the upstream DEBIANREV is relative to ##:function merge_patched_in_debian allowchangesindebian dotgitfiles ignoredeletions =dpmcontrol function merge_patched_in_debian() { local disallow_reverts="$1" local disallow_nonlinear="$2" local amendmerge="$3" local commitmessage="$4" local nopatched="$5" local newpatchedrev newpatchedbranch newpatches if ! isancestor "$control_oldupstream" "$DEBIANREV" ; then printerror "'$DEBIANBRANCH' does not contain upstream '$control_oldupstream'!" return 1 fi if test -n "$UPSTREAMREV" && [ x"$UPSTREAMREV" != x"$control_upstream" ] ; then printerror "Confused, merge_patched called with strange upstream branch" return 1 fi if ${nopatched:-false} ; then if test -n "$PATCHEDREV" ; then printerror "Confused, non-patched merge_patched called with existing patched branch!" return 1 fi newpatchedrev="$control_upstream" newpatchedbranch="$UPSTREAMBRANCH" else if $disallow_reverts && isancestor "$PATCHEDREV" "$DEBIANREV" ; then printerror "cowardly refusing to update patched to already merged version!. Use --allow-revert to override!" return 1 fi if ! isancestor "$control_upstream" "$PATCHEDREV" ; then printerror "'$PATCHEDBRANCH' does not contain upstream '$control_upstream'!" return 1 fi debugout "Checking if patched branch '$PATCHEDBRANCH' is linear..." if ! checkpatchedlinear ; then if $disallow_nonlinear ; then printerror "'$PATCHEDBRANCH' is not linear!" echo "Try git checkout '$PATCHEDBRANCH' && git rebase -i '$UPSTREAMBRANCH' first." >&2 return 1 else printwarn "'$PATCHEDBRANCH' is not linear!" fi fi newpatchedrev="$PATCHEDREV" newpatchedbranch="$PATCHEDBRANCH" fi # Error out or warn if there are upstream changes in the Debian branch. # (merge_patched overwrites them by merging in the patched branch). if $allowchangesindebian ; then checkdebian "" "warn" || return 1 else checkdebian "" "Operation would discard the following upstream changes not found in the"\ "previously recorded patched branch (Use --allow-changes-in-debian-branch "\ "to discard them):" || return 1 fi if [ x"$control_patched" = x"$control_oldupstream" ] && [ x"$control_patched" = x"$control_patches" ] && [ x"$newpatchedrev" = x"$control_upstream" ] ; then # there were no patches before and # debian/patches/ was up to date and # there are no patches now, # so keep marked as up to date, as empty is empty... newpatches="$newpatchedrev" # TODO: check that this does not confuse update-patches... else # otherwise denote debian/patches is still the old... newpatches="$control_patches" fi debugout "update debian/.git-dpm for new merged patch state '${newpatchedrev}'" cat > "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "${control_upstream}" "${newpatchedrev}" > "$gitdir/dpm/modifications" || return 1 local oldpatchedrev oldpatchedbranch if test -n "$control_patched" ; then oldpatchedrev="${control_patched}" oldpatchedbranch="old patched branch (${control_patched})" else oldpatchedrev="${control_oldupstream}" oldpatchedbranch="old upstream branch (${control_oldupstream})" fi local tree # Returns the merged tree with the modifications in ${tree} debianmerge "$gitdir/dpm/modifications" "$newpatchedrev" "$newpatchedbranch" \ "${DEBIANREV}:debian" "${DEBIANBRANCH}:debian" \ "${oldpatchedrev}" "${oldpatchedbranch}" \ "${DEBIANREV}" "${DEBIANBRANCH})" || return 1 if test -z "$commitmessage" && ! $amendmerge ; then commitmessage="merge $newpatchedbranch into $DEBIANBRANCH" fi committodebianbranch "$tree" "$amendmerge" "$newpatchedrev" "$control_patched" "$commitmessage" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/modifications "$gitdir"/dpm/newcontrol fi } ##:function do_merge_patched_into_debian allowchangesindebian =subcommand function do_merge_patched_into_debian() { ##:local delete_patched disallow_reverts disallow_nonlinear checkout_debian docheckout_debian amendmerge dotgitoption ignoredeletions delete_patched=true disallow_reverts=true disallow_nonlinear=true checkout_debian=true docheckout_debian=false amendmerge=false dotgitoption="none" ignoredeletions="auto" while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] merge-patched-into-debian [local options] [debian-branch] Create a new commit in the Debian branch with the debian bits from the Debian branch and the other bits from the patched branch. Possible local options: --keep-branch: do not remove the patched branch afterwards. --amend: replace the last commit from the Debian branch instead. --allow-revert: allow to rever the patched branch to an older state --allow-nonlinear: allow a non-linear patched branch --allow-misplaces-changes: discard upstream changes in the Debian branch instead of erroring out. EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --keep-branch) delete_patched=false ;; --allow-revert) disallow_reverts=false ;; --allow-nonlinear) disallow_nonlinear=false ;; --no-checkout) checkout_debian=false ;; --checkout) docheckout_debian=true ;; --amend) amendmerge=true ;; --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; --) shift break ;; -*) printerror "git-dpm: Unrecognized update-patches argument '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 1 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 if test -n "${1:-}" ; then initbranchvariables "$1" || return 1 parsedpmcontrolfile "$DEBIANREV" || return 1 checkout_debian="$docheckout_debian" else initbranchvariables || return 1 parsedpmcontrolfile "" || return 1 fi ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi if $checkout_debian || [ x"$HEADBRANCH" = x"$DEBIANBRANCH" ] ; then checkclean $allow_nonclean || return 1 fi if test -z "$PATCHEDREV" ; then printerror "merge-patched-into-debian needs a local patched branch, but '$PATCHEDBRANCH' does not exist!" return 1 fi checkupstreambranchcurrent || return 1 if [ "x$PATCHEDREV" = "x$control_patched" ] ; then if ! isancestor "$PATCHEDREV" "$DEBIANREV" ; then printerror "'$PATCHEDBRANCH' already recorded as merged in debian/.git-dpm, but not ancestor of '$DEBIANBRANCH'!" return 1 fi echo "'$PATCHEDBRANCH' already recorded as merged in debian/.git-dpm. Nothing to do..." if [ "x$HEADBRANCH" != "x$PATCHEDBRANCH" ] && $delete_patched; then gitcmd branch -D "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi return 0 fi merge_patched_in_debian "$disallow_reverts" "$disallow_nonlinear" "$amendmerge" "" false || return 1 if $checkout_debian ; then gitcmd checkout "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi echo "Updated '$DEBIANBRANCH' with content from '$PATCHEDBRANCH'" if $delete_patched && [ x"$HEADBRANCH" != x"$PATCHEDBRANCH" ] ; then if [ x"$HEADBRANCH" = x"$DEBIANBRANCH" ] ; then gitcmd branch -d "$PATCHEDBRANCH" || return 1 else gitcmd branch -D "$PATCHEDBRANCH" || return 1 fi PATCHEDREV="" fi return 0 } ######### update-patches ######## ##:function update_patches =dpmcontrol function update_patches() { local basefilename filename hash patchname category local upstreamrev="$1" local patchedrev="$2" local doamend="$3" # may be empty if doamend is true: local commitmessage="$4" debugout "Check if new patched branch contains no debian/ changes..." checkpatched || return 1 gitcmd format-patch --no-signature --no-numbered -k -o "$gitdir/dpm/newpatches" "${upstreamrev}".."${patchedrev}" > "$gitdir/dpm/newpatches.list" || return 1 LC_ALL=C sed -e 's#.*/##' -i "$gitdir/dpm/newpatches.list" || return 1 rm -f -- "$gitdir/dpm/patchmods" || return 1 cat > "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "" "" > "$gitdir/dpm/patchmods" || return 1 if test -s "$gitdir/dpm/newpatches.list" ; then rm -f -- "$gitdir/dpm/newpatches.series" true > "$gitdir/dpm/newpatches.series" || return 1 while read basefilename ; do filename="$gitdir/dpm/newpatches/$basefilename" hash="$(hash_object "$filename")" || return 1 patchname="$(LC_ALL=C sed -n -e 's/^Patch-Name: [ ]*\([A-Za-z0-9.,\/+_:;-]*\)[ ]*$/\1/p' -e '/^++/q' -- "$gitdir/dpm/newpatches/$basefilename" )" || return 1 category="$(LC_ALL=C sed -n -e 's/^Patch-Category: [ ]*\([A-Za-z0-9+_:-]*\)[ ]*$/\1/p' -e '/^++/q' -- "$gitdir/dpm/newpatches/$basefilename" )" || return 1 if test -n "$patchname" && [ x"${patchname#*../}" = x"${patchname#* }" ] ; then basefilename="$patchname" elif test -n "$category" ; then basefilename="${category%% *}/$basefilename" fi if $delete_temp_files ; then rm -f -- "$filename" fi printf '100644 %s\tdebian/patches/%s\n' "$hash" "$basefilename" >> "$gitdir/dpm/patchmods" || return 1 printf '%s\n' "$basefilename" >> "$gitdir/dpm/newpatches.series" || return 1 done < "$gitdir/dpm/newpatches.list" hash="$(hash_object "$gitdir/dpm/newpatches.series")" || return 1 printf '100644 %s\tdebian/patches/series\n' "$hash" >> "$gitdir/dpm/patchmods" || return 1 if $delete_temp_files ; then rm -rf -- "$gitdir/dpm/newpatches.series" "$gitdir/dpm/newpatches" || true fi fi if $delete_temp_files ; then rm -- "$gitdir/dpm/newpatches.list" || true fi if gitcmd rev-parse --verify -q "$DEBIANREV":debian/source/format >/dev/null ; then debugout "debian/source/format already exists. Assume it contents are correct" else debugout "Creating debian/source/format" echo "3.0 (quilt)" > "$gitdir/dpm/tmpfile" || return 1 hash=$(hash_object "$gitdir/dpm/tmpfile") || return 1 if $delete_temp_files ; then rm -- "$gitdir/dpm/tmpfile" || true fi printf "100644 $hash\\tdebian/source/format\\n" >> "$gitdir/dpm/patchmods" || return 1 fi local tree modify_tree "$DEBIANREV": "$gitdir/dpm/patchmods" -r -q --ignore-unmatch "debian/patches" || return 1 echo "Patches updated..." if test -z "$commitmessage" && ! $doamend ; then commitmessage="update debian/patches/ directory" fi committodebianbranch "$tree" "$doamend" "" "" "$commitmessage" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/patchmods" "$gitdir/dpm/newcontrol" fi } ##:function do_update_patches allowchangesindebian =subcommand function do_update_patches() { ##:local allowredo disallow_reverts disallow_nonlinear delete_patched amendmerge commitmessage dotgitoption ignoredeletions allowredo=false disallow_reverts=true disallow_nonlinear=true delete_patched=true amendmerge=false commitmessage="" dotgitoption="none" ignoredeletions="auto" while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] update-patches [local options] Run merge-patched if necessary and create/update debian/patches directory. Possible local options: -m MSG: commit message to use --redo: update debian/patches even if no changes are recorded. --amend, --keep-branch, --allow-revert, --allow-nonlinear: passed to merge-patched EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --redo) allowredo=true ;; # You should not ignore it, so it does not # matter the name is too long... ;-> --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; --allow-revert) disallow_reverts=false ;; --allow-nonlinear) disallow_nonlinear=false ;; --keep-branch) delete_patched=false ;; --amend) amendmerge=true ;; -m) shift commitmessage="$1" ;; --) shift break ;; -*) printerror "Unrecognized update-patches option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 1 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 if test -n "${1:-}" ; then initbranchvariables "$1" || return 1 parsedpmcontrolfile "$DEBIANREV" || return 1 else initbranchvariables || return 1 parsedpmcontrolfile "" || return 1 fi ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi ##:local patchedrev upstreamrev if test -z "$PATCHEDREV" ; then debugout "No '$PATCHEDBRANCH' branch, only checking recorded stuff!" patchedrev="$control_patched" if ! gitcmd cat-file -e "$control_patched" ; then printerror "recorded '$PATCHEDBRANCH' branch '$control_patched' not found in current repository!" return 1 fi else patchedrev="$PATCHEDREV" fi if test -z "$UPSTREAMREV" ; then debugout "No '$UPSTREAMBRANCH' branch, only checking recorded stuff!" upstreamrev="$control_upstream" else upstreamrev="$UPSTREAMREV" fi if [ "x$HEADBRANCH" != "x$DEBIANBRANCH" ] ; then debugout "Switching to '$DEBIANBRANCH'.." gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi if ! test -f "debian/.git-dpm" ; then printerror "cannot find debian/.git-dpm!" echo "Are you in the wrong branch? Or needing init?" >&2 return 1 fi # TODO: allow mode only looking at recorded branches?? checkupstreambranchcurrent || return 1 if [ "x$patchedrev" = "x$control_patches" ] && [ "x$patchedrev" = "x$control_patched" ] && [ "x$upstreamrev" = "x$control_upstream" ] && ! $allowredo ; then printwarn "doing nothing as branches unchanged. Use --redo to force recreation of patches!" if $delete_patched && test -n "$PATCHEDREV"; then if [ "x$HEADBRANCH" = "x$PATCHEDBRANCH" ] ; then debugout "Not removing '$PATCHEDBRANCH' as currently checked out" else gitcmd branch -D "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi fi return 0 fi # check if the invariants still hold: debugout "Checking if patched branch contains current upstream branch..." if ! isancestor "$upstreamrev" "$patchedrev"; then printerror "'$PATCHEDBRANCH' does not contain '$UPSTREAMBRANCH'!" return 1 fi debugout "Check if new patched branch contains the old one..." if [ x"$control_patches" != x00000000000000000000000000000000 ] && \ [ x"$control_patches" != x"NONE" ] && \ ! gitcmd cat-file -e "$control_patches" 2>/dev/null ; then echo "git-dpm: WARNING/ERROR: current recorded state of patches not found in repository!" >&2 fi debugout "Checking if patched branch is contained in Debian branch..." if [ "x$patchedrev" != "x$control_patched" ] ; then if test -z "$PATCHEDREV" ; then printerror "Confused! How can '$PATCHEDBRANCH' be not up to date if it does not exist?" return 1 fi echo "git-dpm: Calling merge-patched-into-debian first..." merge_patched_in_debian "$disallow_reverts" "$disallow_nonlinear" "$amendmerge" "" false || return 1 patchedrev="$control_patched" if $delete_patched ; then gitcmd branch -d "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi amendmerge="true" else # This catches a possible user error of commiting stuff to # the wrong branch. Erroring out is not really needed as # only the patches in the Debian branch will be changed, but # it's a good place to tell the user something is not as # it is supposed to be. debugout "Check if all changes are in patched..." if $allowchangesindebian ; then checkdebian "" "warn" || return 1 else checkdebian "" "" || return 1 fi fi if test -z "$commitmessage" && ! $amendmerge ; then commitmessage="update debian/patches directory" fi update_patches "$upstreamrev" "$patchedrev" "$amendmerge" "$commitmessage" } ############ prepare ############### # Make sure a file exists in the parent directory with the specified # characteristics. # If there is no file, try to tell pristine-tar to create it first. ##:function check_sourcetarfile =gitcheck function check_sourcetarfile() { local origtarname="$1" local origtarsha="$2" local origtarsize="$3" local origsha origsize debugout "Looking for ../$origtarname with $origtarsha $origtarsize" if ! [ -e "../$origtarname" ] ; then if which pristine-tar >/dev/null 2>&1 ; then echo "No file '../$origtarname', running pristine-tar..." pristine-tar checkout "../$origtarname" || return 1 else if gitcmd branch -a | LC_ALL=C grep pristine-tar > /dev/null ; then echo "No file '../$origtarname', and no pristine-tar installed..." fi fi fi if [ -e "../$origtarname" ] ; then origsha="$(sha1sum -b -- "../$origtarname")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' ../"$origtarname")" || return 1 if [ "x$origsha" != "x$origtarsha" ] || [ "$origsize" -ne "$origtarsize" ] ; then printerror "file '../$origtarname' already exists but has wrong content!" echo "expected: $origtarsha $origtarsize" >&2 echo "found: $origsha $origsize" >&2 return 1 fi debugout "up to date: ../$origtarname" else echo "Could not find '../$origtarname!" >&2 echo "Without that file dpkg-source will not work!" >&2 return 1 fi return 0 } ##:function do_prepare =subcommand function do_prepare() { while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] prepare Make sure everything is ready to build a Debian package or error out. EOF return 0 ;; --) shift break ;; -*) printerror "Unrecognized prepare option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 if [ x"$control_patches" != x00000000000000000000000000000000 ] && \ [ x"$control_patches" != x"NONE" ] && \ ! gitcmd cat-file -e "$control_patches" ; then printerror "recorded patched state '$control_patches' does not exist in local repository!" return 1 fi if ! gitcmd cat-file -e "$control_patched" ; then printerror "recorded patched state '$control_patched' does not exist in local repository!" return 1 fi if ! gitcmd cat-file -e "$control_upstream" ; then printerror "recorded upstream state '$control_upstream' does not exist in local repository!" return 1 fi if test -z "$UPSTREAMREV" ; then debugout "Creating '$UPSTREAMBRANCH'..." gitcmd branch "$UPSTREAMBRANCH" "$control_upstream" || return 1 UPSTREAMREV="$(gitcmd rev-parse --verify "$UPSTREAMBRANCH")" || return 1 elif [ "$UPSTREAMREV" = "$control_upstream" ] ; then debugout "'$UPSTREAMBRANCH' matched recorded '$control_upstream'" elif isancestor "$UPSTREAMREV" "$control_upstream" ; then if [ x"$UPSTREAMBRANCH" = x"$HEADBRANCH" ] ; then echo "Updating upstream branch '$UPSTREAMBRANCH' to '$control_upstream'..." gitcmd merge "$control_upstream" || return 1 else echo "Updating upstream branch '$UPSTREAMBRANCH' to '$control_upstream'..." gitcmd update-ref refs/heads/"$UPSTREAMBRANCH" "$control_upstream" "$UPSTREAMREV" || return 1 fi elif isancestor "$control_upstream" "$UPSTREAMREV" ; then printwarn "'$UPSTREAMBRANCH' has changes not yet recorded! (perhaps you need record-new-upstream?)" return 1 else printerror "'$UPSTREAMBRANCH' is not the expected one!" return 1 fi if test -z "$control_origtarname" || test -z "$control_origtarsha" || test -z "$control_origtarsize" ; then echo "git-dpm: CONFUSED: not enough information about tar! (debian/.git-dpm broken?)" >&2 return 1 fi check_sourcetarfile "$control_origtarname" "$control_origtarsha" "$control_origtarsize" || return 1 LC_ALL=C sed -n -e 's/^component:\([0-9a-f]\+\):\([0-9]\+\):/\1 \2 /p' -- "$gitdir/dpm/oldcontrol" | while read hash size name ; do check_sourcetarfile "$name" "$hash" "$size" || exit 1 done || return 1 if test -n "$PATCHEDREV" ; then if [ "$PATCHEDREV" = "$control_patched" ] ; then debugout "'$PATCHEDBRANCH' up to date" elif isancestor "$PATCHEDREV" "$DEBIANREV" ; then if [ "x$HEADBRANCH" = "x$PATCHEDBRANCH" ] ; then printerror "your '$PATCHEDBRANCH' is not up to date!" echo "try git reset --hard '$control_patched' or call again from another branch!" >&2 return 1 else echo "Updating outdated '$PATCHEDBRANCH'..." gitcmd update-ref "refs/heads/$PATCHEDBRANCH" "$control_patched" "$PATCHEDREV" || return 1 fi elif isancestor "$control_patched" "$PATCHEDREV" ; then printwarn "your '$PATCHEDBRANCH' contains yet unrecorded changes" return 2 else printwarn "your '$PATCHEDBRANCH' does not match (rebased?)" return 3 fi fi return 0 } ############### checkout-patched ############## ##:function reset_patch_branch =dpmcontrol function reset_patch_branch() { if [ "x$HEADBRANCH" = "x$PATCHEDBRANCH" ] ; then gitcmd reset --hard "$control_patched" else gitcmd update-ref "refs/heads/$PATCHEDBRANCH" "$control_patched" "$PATCHEDREV" || return 1 gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi PATCHEDREV="$control_patched" } ##:function do_checkout_patched =subcommand function do_checkout_patched() { ##:local use_force use_force=false while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] checkout-patched [local options] Create/update the patched branch. The patched branch is temporary and should not be pushed anywhere, but is for adding/modifying the patches which will be integrated into the history of the Debian branch using merge-patched or update-patches. Possible local options: --force: reset the branch even if it looks locally modified. EOF return 0 ;; --force) use_force=true ;; --) shift break ;; -*) printerror "Unrecognized checkout-patched option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 if test -n "$PATCHEDREV" ; then if [ "$PATCHEDREV" = "$control_patched" ] ; then debugout "'$PATCHEDBRANCH' up to date" gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" elif isancestor "$PATCHEDREV" "$DEBIANREV" ; then echo "Updating outdated '$PATCHEDBRANCH'..." reset_patch_branch || return 1 elif isancestor "$control_patched" "$PATCHEDREV" ; then if $use_force ; then echo "Reverting '$PATCHEDBRANCH'..." reset_patch_branch || return 1 else printerror "'$PATCHEDBRANCH' is newer than currently recorded version." echo "Use --force to change to recorded version!" >&2 return 1 fi else if $use_force ; then echo "Reverting/forcibly upgrading '$PATCHEDBRANCH'..." reset_patch_branch || return 1 else printerror "your '$PATCHEDBRANCH' does not match (rebased?)" echo "Use --force to change to recorded version!" >&2 return 1 fi fi else gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 PATCHEDREV="$control_patched" HEADBRANCH="$PATCHEDBRANCH" fi return 0 } ############### linearize ############## ##:function do_linearize =subcommand function do_linearize() { while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] linearize Run git rebase -i on the patched branch. EOF return 0 ;; --) shift break ;; -*) printerror "Unrecognized linearize option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 checkclean $allow_nonclean || return 1 checkupstreambranchcurrent || return 1 if test -z "$PATCHEDREV" ; then debugout "No '$PATCHEDBRANCH', creating it as recorded last '$control_patched'" PATCHEDREV="$control_patched" gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi if [ "x$HEADBRANCH" != "x$PATCHEDBRANCH" ] ; then debugout "Switching to '$PATCHEDBRANCH'" gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi ##:local ret ret=0 debugout "Rebase -i checked put '$PATCHEDBRANCH' branch relative to upstream..." gitcmd rebase -i "${UPSTREAMREV:-$control_upstream}" || ret=$? if [ "$ret" -ne 0 ] ; then echo "Once you finished rebase, don't forget to call update-patches" return $ret fi ##:local headrev headrev="$(gitcmd rev-parse --verify -q HEAD)" || return 1 if [ x"$PATCHEDREV" = "x$headrev" ] ; then echo "Nothing changed. (Did you change your mind?)" else echo "Re'base' -i seems to have been successful. Don't forget to call update-patches!" # TODO: perhaps call it here? # (but don't forget to update PATCHEDREV first...) fi return 0 } ############### rebase-patched ############## ##:function find_likely_upstream oldupstream/out =dpmcontrol function find_likely_upstream() { # This is complicated because it needs to be idempotent. # i.e. it might have already be run. # Another complicating case is backporting debian changes to # an older upstream... # Things do not get easier as we do not know if merge-patches # was calles since the last new upstream version... if isancestor "$UPSTREAMREV" "$PATCHEDREV" ; then # if it already contains the current branch, # the only bad case if things are newer than the current # branch and we also contain those... if isancestor "$UPSTREAMREV" "$control_upstream" && isancestor "$control_upstream" "$PATCHEDREV" ; then debugout "'$PATCHEDBRANCH' contains in '$UPSTREAMBRANCH' but also old upstream containing that one, too..." elif isancestor "$UPSTREAMREV" "$control_oldupstream" && isancestor "$control_oldupstream" "$PATCHEDREV" ; then debugout "'$PATCHEDBRANCH' contains in '$UPSTREAMBRANCH' but also the old upstream containing that one, too..." else # That was easy... oldupstream="$UPSTREAMREV" return 0 fi fi if isancestor "$control_upstream" "$PATCHEDREV" ; then if isancestor "$control_upstream" "$control_oldupstream" && isancestor "$control_oldupstream" "$PATCHEDREV" ; then : fi oldupstream="$control_upstream" return 0; fi if isancestor "$control_oldupstream" "$PATCHEDREV" ; then oldupstream="$control_oldupstream" return 0; fi printerror "'$PATCHEDBRANCH' seems to be unrelated to current or last recorded '$UPSTREAMBRANCH'." echo "Please rebase it yourself to '$UPSTREAMBRANCH' and try again." >&2 return 1 } ##:function rebase_patches =dpmcontrol function rebase_patches() { if test -z "$PATCHEDREV" ; then debugout "No '$PATCHEDBRANCH', creating it as recorded last '$control_patched'" PATCHEDREV="$control_patched" gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi if test -z "$UPSTREAMREV" ; then debugout "No '$UPSTREAMBRANCH', creating it as recorded last '$control_upstream'" UPSTREAMREV="$control_upstream" gitcmd checkout -b "$UPSTREAMBRANCH" "$control_upstream" || return 1 HEADBRANCH="$UPSTREAMBRANCH" fi if [ "x$HEADBRANCH" != "x$PATCHEDBRANCH" ] ; then debugout "Switching to '$PATCHEDBRANCH'" gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi local ret ret=0 # First determine the upstream $PATCHEDREV is based on # and store it as "$oldupstream". local oldupstream find_likely_upstream || return 1 echo "Rebasing changes in '$PATCHEDBRANCH' since '$oldupstream' onto '$UPSTREAMBRANCH'..." gitcmd rebase -m --onto "$UPSTREAMREV" "$oldupstream" || ret=$? if [ "$ret" -ne 0 ] ; then echo "Once you finished rebase, don't forget to call update-patches" return $ret fi local headrev headrev="$(gitcmd rev-parse --verify -q HEAD)" || return 1 if [ x"$PATCHEDREV" = "x$headrev" ] ; then echo "Nothing changed. (Did something strange happen?)" if [ "x$PATCHEDREV" != "x$control_patches" ] ; then echo "Don't forget to call update-patches, though." fi else echo "Rebase seems to have been successful. Don't forget to call update-patches!" PATCHEDREV="$(gitcmd rev-parse --verify -q HEAD)" || return 1 fi return 0 } ##:function do_rebase_patched =subcommand function do_rebase_patched() { while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] rebase-patched Rebase the patched branch to a previously recoded new upstream branch. EOF return 0 ;; --) shift break ;; -*) printerror "Unrecognized rebase-patched option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 if test -z "$UPSTREAMREV" ; then debugout "No '$UPSTREAMBRANCH', creating it as recorded last '$control_upstream'" UPSTREAMREV="$control_upstream" gitcmd update-ref refs/heads/"$UPSTREAMBRANCH" "$control_upstream" "$UPSTREAMREV" || return 1 fi rebase_patches } ################## record-new-upstream-branch ############### ##:function record_new_upstream_branch origname origsha origsize allowchangesindebian dotgitfiles ignoredeletions =dpmcontrol function record_new_upstream_branch() { local commitmessage mergedcommitmessage initialcommit local doamend dorebase newcomponents local oldch newch doamend="${1:-false}" dorebase="$2" # must not be empty unless doamend is true commitmessage="$3" mergedcommitmessage="$4" newcomponents="$5" # if != "" then create a new Debian branch initialcommit="$6" if test -n "$initialcommit" && [ "x$control_upstream" = "x$UPSTREAMREV" ] && [ "x$control_origtarname" = "x$origname" ] && [ "x$control_origtarsha" = "x$origsha" ] && [ "x$control_origtarsize" = "x$origsize" ] ; then oldch="$(LC_ALL=C sed -n -e '/^component:/p' -- "$gitdir"/dpm/oldcontrol | LC_ALL=C sort | sha1sum)" || return 1 newch="$(LC_ALL=C sort -- "$newcomponents" | sha1sum)" || return 1 if [ x"$oldch" != x"$newch" ] ; then # The usre may just have forgotten to record it # last time but already have it in the upstream # branch, so only warn about it here. printwarn "components changed but upstream branch still the same. I hope you know what you do." else debugout "debian/.git-dpm already up to date!" if $dorebase ; then debugout "Calling rebase-patched..." rebase_patches || return 1 elif isancestor "$UPSTREAMREV" "${PATCHEDREV:-$control_patched}" ; then echo "Not recording new upstream branch, as everything seems to be up to date." else echo "Next you need to call git-dpm rebase-patched." fi return 0 fi fi local canskiprebase canskiprebase=false if test -n "$initialcommit" ; then canskiprebase=true elif [ x"$control_oldupstream" = x"$control_patched" ] ; then debugout "No patches recorded, checking if patched branch can be updated trivially..." if test -z "$PATCHEDREV" ; then debugout "No patched branch checked out, that's easy." canskiprebase=true elif [ x"$control_patched" != x"$PATCHEDREV" ] ; then debugout "Patched branch not the recorded one, no easy way..." canskiprebase=false elif [ x"$HEADBRANCH" = x"$PATCHEDBRANCH" ] ; then debugout "Patched branch currently checked out, cannot delete it" canskiprebase=false else echo "Deleting old patched branch '$PATCHEDBRANCH' to avoid it getting stale." gitcmd branch -D "$PATCHEDBRANCH" || return 1 PATCHEDREV="" canskiprebase=true fi fi # Doing this in two steps in the $canskiprebase case is a bit # wasteful, but is easier and makes sure it is a bit less confusing # in case of an error causing git-dpm to stop in the middle... debugout "preparing new debian/.git-dpm file for ${DEBIANBRANCH}" if test -n "$initialcommit" ; then cat > "$gitdir/dpm/newcontrol" < "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 cat -- "$newcomponents" >> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "${UPSTREAMREV}" "" > "$gitdir/dpm/modifications" || return 1 local tree modify_tree "${initialcommit:-${DEBIANREV}}:" "$gitdir/dpm/modifications" || return 1 committodebianbranch "$tree" "$doamend" "$initialcommit" "" "$commitmessage" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/modifications "$gitdir"/dpm/newcontrol fi if test -n "$initialcommit" ; then echo "New git-dpm project created in '$DEBIANBRANCH'" if [ x"$HEADBRANCH" != x"$DEBIANBRANCH" ] ; then gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi elif [ x"$control_upstream" = x"$control_oldupstream" ] ; then echo "Upstream branch unchanged, only file information changed..." if [ x"$HEADBRANCH" != x"$DEBIANBRANCH" ] ; then gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi elif $canskiprebase ; then echo "There were no patches recorded, so merging the new state directly (no git-dpm rebase-patched needed)." merge_patched_in_debian "dummy" "dummy" true "$mergedcommitmessage" true || return 1 if [ x"$control_patches" != x"$control_patched" ] ; then echo "debian/patches is not marked to be current, you might want to run update-patches" fi debugout "Switch to Debian branch, as everything to do elsewhere is done..." if [ x"$HEADBRANCH" != x"$DEBIANBRANCH" ] ; then gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi elif $dorebase ; then debugout "Calling rebase-patched..." rebase_patches else echo "Next you need to call git-dpm rebase-patched." if [ x"$HEADBRANCH" != x"$DEBIANBRANCH" ] ; then gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi fi } ##:function do_new_upstream_branch allowchangesindebian =subcommand function do_new_upstream_branch() { ##:local dorebase doamend disallownochange commitmessage dotgitoption ignoredeletions dorebase=false doamend=false disallownochange=true commitmessage="" dotgitoption="none" ignoredeletions="auto" checkgitdir || return 1 true > "$gitdir/dpm/newcomponents" || return 1 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] record-new-upstream [options] [] Record a new upstream branch and a new tarbal belonging to this. It's your responsiblity to have the tarball match the contents of the current upstream branch (or the commit given). Use import-new-upstream instead if you want to import a tarball as commit first. Possible local options: --new-tarball-only: don't refuse to run if the upstream tarball did not change (to repair some mistake in choosing that file) --amend: replace the last commit in the Debian branch instead of creating a new one -m MSG: commit message to use --rebase-patched: call rebase-patched afterwards to rebase the patches to the upstream EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --amend) doamend=true ;; -m) shift commitmessage="$1" ;; --new-tarball-only) disallownochange=false ;; --rebase|--rebase-patched) dorebase=true ;; --component) shift ##:local componentfilename componentbasename componentfilename="$1" componentbasename="${1##*/}" if ! test -e "$componentfilename" ; then printerror "No such file: '$componentfilename'" return 1 fi case "$componentbasename" in *.orig-*.tar*) ;; *) printerror "'$componentbasename' is not of the form *.orig-*.tar*" return 1 ;; esac ##:local origsha origsize origsha="$(sha1sum -b -- "$componentfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$componentfilename")" || return 1 debugout "$componentbasename has sha1 $origsha and size $origsize" printf 'component:%s:%s:%s\n' "$origsha" "$origsize" "$componentbasename" >> "$gitdir/dpm/newcomponents" || return 1 ##:invalidate origsha origsize ;; --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; --) shift break ;; -*) printerror "Unrecognized record-new-upstream option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -lt 1 ] ; then cat >&2 <<'EOF' Syntax: git-dpm [global options] record-new-upstream [] [] EOF return 1 fi ##:local origfilename origname origfilename="$1" shift if ! [ -f "$origfilename" ] ; then printerror "no such file: '$origfilename'!" return 1 fi origname=${origfilename##*/} case "$origname" in *.orig.tar.*) ;; *) printerror "'$origname' does not contain .orig.tar!" return 1 ;; esac debugout "look at '$origfilename'..." origsha="$(sha1sum -b -- "$origfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$origfilename")" || return 1 ##:local newupstreambranch newupstreamrev newupstreambranch="" newupstreamrev="" if [ $# -gt 0 ] ; then newupstreambranch="$1" shift newupstreamrev="$(get_and_verify_commit "$newupstreambranch")" || return 1 fi if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi initbranchvariables || return 1 if test -z "$UPSTREAMREV" && test -z "$newupstreamrev" ; then printerror "No new upstream branch given as command line argument and no branch $UPSTREAMBRANCH exists. What shall be recorded??" return 1 fi cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi if test -z "$UPSTREAMREV" ; then debugout "setting up '$UPSTREAMBRANCH'..." # use newupstreambranch instead of rev so magic can occour... # TODO: check if automatic remote detection needs checkout or if update-ref suffices... gitcmd update-ref refs/heads/"$UPSTREAMBRANCH" "$newupstreambranch" || return 1 UPSTREAMREV="$newupstreamrev" elif test -n "$newupstreamrev" ; then if [ "x$newupstreamrev" = "x$UPSTREAMREV" ] ; then debugout "'$UPSTREAMBRANCH' is already the same as '$newupstreambranch'" elif [ "x$control_upstream" = "x$UPSTREAMREV" ] ; then debugout "switching old '$UPSTREAMBRANCH' to new '$newupstreambranch'" if [ "x$HEADBRANCH" = "x$UPSTREAMBRANCH" ] ; then gitcmd reset --hard "$newupstreamrev" || return 1 UPSTREAMREV="$newupstreamrev" else gitcmd update-ref refs/heads/"$UPSTREAMBRANCH" "$newupstreambranch" "$UPSTREAMREV" || return 1 UPSTREAMREV="$newupstreamrev" fi else printerror "'$UPSTREAMBRANCH already exists and differs from the recorded one!'" return 1 fi fi if test -s "$gitdir/dpm/newcomponents" ; then debugout "checking components to exist in the upstream dir:" ##:local dummy1 dummy2 dummy3 filename while IFS=":" read dummy1 dummy2 dummy3 filename ; do ##:unused dummy1 dummy2 dummy3 ##:local basefilename component basefilename="${filename##*/}" component="${basefilename%.tar*}" component="${component##*.orig-}" if [ x"${basefilename%.orig-*.tar*}" != x"${origname%.orig.tar*}" ] ; then printerror "${basefilename} does not match ${origname%.orig.tar*}.orig-*.tar*!" return 1 fi if ! gitcmd rev-parse -q --verify "$UPSTREAMREV":"$component" >/dev/null ; then printerror "new upstream branch $UPSTREAMBRANCH does not contain a subdirectory called '$component', so '$basefilename' seems not yet included in that one!" return 1 elif [ x"$(gitcmd cat-file -t "$UPSTREAMREV":"$component" || true)" != xtree ] ; then printerror "new upstream branch $UPSTREAMBRANCH does not contain a subdirectory called '$component' but some other object! Something is very strange." return 1 else debugout "successfully checked '$component' is a directory in '$UPSTREAMREV'" fi done < "$gitdir/dpm/newcomponents" fi if $disallownochange && [ x"$UPSTREAMREV" = x"$control_upstream" ] ; then printerror "cowardly refusing record-new-upstream if upstream branch has not changed!" echo "Have you forgotten to update '$UPSTREAMBRANCH'?" >&2 echo "Use --new-tarball-only if the tarball has changed but not its contents." >&2 return 1 fi # TODO: check if branch and contents of .orig.tar match in same # way and warn about differences here? ##:local commitmessage2 if test -z "$commitmessage" && ! $doamend ; then commitmessage="record new upstream branch" commitmessage2="record new upstream branch and merge it" else commitmessage2="$commitmessage" fi record_new_upstream_branch "$doamend" "$dorebase" "$commitmessage" "$commitmessage2" "$gitdir/dpm/newcomponents" "" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/newcomponents" fi } ####################### tag ######################### ##:function settag notsilent =gitcheck function settag() { # name newvalue force local oldrev if test x"$1" = x"NONE" ; then return 0 fi oldrev=$(gitcmd rev-parse --verify -q "refs/tags/$1" || true) if test -z "$oldrev" ; then if $notsilent ; then echo "Creating new tag '$1'..." fi gitcmd tag "$1" "$2" elif [ x"$oldrev" = x"$2" ] ; then if $notsilent ; then echo "'$1' already up to date" else debugout "'$1' already up to date" fi elif ${3:-false} ; then if $notsilent ; then echo "Replacing tag '$1'..." fi gitcmd tag -f "$1" "$2" else printerror "tag '$1' already exists and differs!" return 1 fi } ##:function escape_version/nofail version/inout epoch/out uversion/out v/out V/out u/out U/out e/out E/out f/out function escape_version() { local dottedversion udottedversion dottedepoch underscoreepoch # replace ~ with _, as the formet is not allowed in tags: dottedversion="${version//\~/.}" version="${version//\~/_}" # split off the epoch, as : is not allowed either... if [ x"${version#*:}" != x"$version" ] ; then epoch="${version%%:*}" underscoreepoch="${epoch}_" version="${version#*:}" version="${version//:/_}" dottedepoch="${dottedversion%%:*}." dottedversion="${dottedversion#*:}" dottedversion="${dottedversion//:/.}" else epoch="" dottedepoch="" underscoreepoch="" fi uversion="${version%-*}" udottedversion="${dottedversion%-*}" v="$(sedsafe "$version")" u="$(sedsafe "$uversion")" e="$(sedsafe "$epoch")" f="$(sedsafe "$underscoreepoch")" E="$(sedsafe "$dottedepoch")" V="$(sedsafe "$dottedversion")" U="$(sedsafe "$udottedversion")" return 0 } ##:function createtagname p v u e V U E f =dpm_control =gitcheck function createtagname() { local tagname="$1" local tagtype="$2" local defaultname="$3" local fromcontrol if test -z "$tagname" || test x"$tagname" = x"AUTO" ; then debugout >&2 "No $tagtype tag configured locally, check control file..." fromcontrol="$(sed -n \ -e 's/^'"$tagtype"'Tag="\([^ "]*\)"[ ]*$/\1/p' \ "$gitdir/dpm/oldcontrol" || true)" if test -z "$fromcontrol" ; then if grep -q -s "^[ ]*${tagtype}Tag[ ]*=" "$gitdir/dpm/oldcontrol" ; then printerror "Malformed ${tagtype}Tag line in debian/.git-dpm (No spaces allowed, double-quotes are mandatory)." return 1 fi debugout >&2 "No ${tagtype}Tag="..." in control, using default..." printf "%s" "$defaultname" return $? else tagname="$fromcontrol" fi fi printf "%s" "$tagname" | sed -e "s/%p/$p/g" -e "s/%f/$f/" \ -e "s/%v/$v/g" -e "s/%u/$u/g" -e "s/%e/$e/g" \ -e "s/%V/$V/g" -e "s/%U/$U/g" -e "s/%E/$E/g" \ -e 's/%%/%/g' -e '1q' } ##:function do_tag =subcommand function do_tag() { ##:local dorefresh dorefreshupstream disallowstale donamed name debiantag patchedtag upstreamtag notsilent dorefresh=false dorefreshupstream=false disallowstale=true donamed="$(gitcmd config --bool --get dpm.tagsNamed || echo false)" name="$(gitcmd config --get dpm.tagsName || true)" debiantag="$(gitcmd config --get dpm.debianTag || true)" patchedtag="$(gitcmd config --get dpm.patchedTag || true)" upstreamtag="$(gitcmd config --get dpm.upstreamTag || true)" notsilent=true while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] tag [options] [] Create tags for the current version. Local options: --refresh: replace tags for this version if they already exist --refresh-upstream: dito for the tag of the upstream version --named: use the package name in the tags --with-name : like --named but explicitly set name --debian-tag , --patched-tag : specify tag names directly (%%, %p, %e, %v, %u are substituted). --allow-stale-patches: don't refuse to run if the patches are not exported (for importing pre-git-dpm packages verbatimly) EOF return 0 ;; --silent) notsilent=false ;; --refresh) dorefresh=true ;; --refresh-upstream) dorefreshupstream=true ;; --unnamed) donamed=false ;; --named) donamed=true ;; --with-name) donamed=true shift name="$1" ;; --with-name=*) donamed=true name="${1#--with-name=}" ;; --allow-stale-patches) # makes sense when importing historic packages: disallowstale=false ;; --upstream-tag) shift upstreamtag="$1" ;; --upstream-tag=*) upstreamtag="${1#--upstream-tag=}" ;; --patched-tag) shift patchedtag="$1" ;; --patched-tag=*) patchedtag="${1#--patched-tag=}" ;; --debian-tag) shift debiantag="$1" ;; --debian-tag=*) debiantag="${1#--debian-tag=}" ;; --) shift break ;; -*) printerror "Unrecognized tag option '$1'!" return 1 ;; *) break ;; esac shift done ##:local version version="" if [ $# -gt 0 ] ; then version="$1" shift fi if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 initbranchvariables || return 1 parsedpmcontrolfile "" || return 1 # tagging makes no sense if things are not up to date: if test -n "$UPSTREAMREV" && [ x"$UPSTREAMREV" != x"$control_upstream" ] ; then printerror "'$UPSTREAMBRANCH' differs from recorded one!" return 1 fi if test -n "$PATCHEDREV" && [ x"$PATCHEDREV" != x"$control_patched" ] ; then printerror "'$PATCHEDREV' differs from recorded one!" return 1 fi if $disallowstale && [ x"$control_patches" != x"$control_patched" ] ; then printerror "debian/patches not recorded up-to-date!" return 1 fi if test -z "$version" ; then debugout "Trying to determine debian version..." if [ x"$DEBIANBRANCH" = x"$HEADBRANCH" ] ; then dpkg-parsechangelog > "$gitdir/dpm/changelog" || return 1 else gitcmd cat-file blob "$DEBIANREV:debian/changelog" | dpkg-parsechangelog -l- > "$gitdir/dpm/changelog" || return 1 fi ##:local packagename packagename="$(LC_ALL=C sed -n -e 's/^Source: //p' "$gitdir/dpm/changelog")" || return 1 if $donamed && test -z "$name" ; then name="$packagename" fi version="$(LC_ALL=C sed -n -e 's/^Version: //p' "$gitdir/dpm/changelog")" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/changelog" fi debugout "Determined version to be '$version'" elif test -z "$name" ; then printerror "--named not possible with explicit version, use --with-name name" return 1 fi # translate version to $epoch, $uversion, $v, $u, $e, $V, $U and $E: ##:local v u e V U E f epoch uversion escape_version ##:local nameprefix p nameprefix="${name}${name:+-}" p="$(sedsafe "$packagename")" upstreamtag="$(createtagname "$upstreamtag" "upstream" \ "${nameprefix}upstream$epoch-$uversion")" || return 1 patchedtag="$(createtagname "$patchedtag" "patched" \ "${nameprefix}patched$epoch-$version")" || return 1 debiantag="$(createtagname "$debiantag" "debian" \ "${nameprefix}debian$epoch-$version")" || return 1 settag "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1 settag "$patchedtag" "$control_patched" "$dorefresh" || return 1 settag "$debiantag" "$DEBIANREV" "$dorefresh" || return 1 } ##:function do_reftag =subcommand function do_reftag() { ##:local dorefresh dorefreshupstream disallowstale donamed name debiantag patchedtag upstreamtag notsilent dorefresh=false dorefreshupstream=false disallowstale=true donamed="$(gitcmd config --bool --get dpm.tagsNamed || echo false)" name="$(gitcmd config --get dpm.tagsName || true)" debiantag="$(gitcmd config --get dpm.debianTag || true)" patchedtag="$(gitcmd config --get dpm.patchedTag || true)" upstreamtag="$(gitcmd config --get dpm.upstreamTag || true)" notsilent=true while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] ref-tag [options] [] Create tags for a version stored in commit . This is similar like creating a new branch with this commit, checking this branch out, calling git-dpm tag there and then removing the branch again. Local options: --refresh: replace tags for this version if they already exist --refresh-upstream: dito for the tag of the upstream version --named: use the package name in the tags --with-name : like --named but explicitly set name --debian-tag , --patched-tag : specify tag names directly (%%, %p, %e, %v, %u are substituted). --allow-stale-patches: don't refuse to run if the patches are not exported (for importing pre-git-dpm packages verbatimly) EOF return 0 ;; --silent) notsilent=false ;; --refresh) dorefresh=true ;; --refresh-upstream) dorefreshupstream=true ;; --unnamed) donamed=false ;; --named) donamed=true ;; --with-name) donamed=true shift name="$1" ;; --with-name=*) donamed=true name="${1#--with-name=}" ;; --allow-stale-patches) # makes sense when importing historic packages: disallowstale=false ;; --upstream-tag) shift upstreamtag="$1" ;; --upstream-tag=*) upstreamtag="${1#--upstream-tag=}" ;; --patched-tag) shift patchedtag="$1" ;; --patched-tag=*) patchedtag="${1#--patched-tag=}" ;; --debian-tag) shift debiantag="$1" ;; --debian-tag=*) debiantag="${1#--debian-tag=}" ;; --) shift break ;; -*) printerror "Unrecognized tag option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -eq 0 ] ; then printerror "Missing commit argument!" return 1 fi ##:local totagname totag version totagname="$1" totag="$(get_and_verify_commit "$totagname")" || return 1 shift version="" if [ $# -gt 0 ] ; then version="$1" shift fi if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 parsedpmcontrolfromcommit "$totag" "in commit $totagname" || return 1 if $disallowstale && [ x"$control_patches" != x"$control_patched" ] ; then printerror "debian/patches not recorded up-to-date!" echo "Use --allow-stale-patches if you want to tag anyway." >&2 return 1 fi if test -z "$version" ; then debugout "Trying to determine debian version..." gitcmd cat-file blob "${totag}:debian/changelog" | dpkg-parsechangelog -l- > "$gitdir/dpm/changelog" || return 1 ##:local packagename packagename="$(sed -n -e 's/^Source: //p' "$gitdir/dpm/changelog")" || return 1 if $donamed && test -z "$name" ; then name="$packagename" fi version="$(sed -n -e 's/^Version: //p' "$gitdir/dpm/changelog")" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/changelog" fi debugout "Determined version to be '$version'" elif test -z "$name" ; then printerror "--named not possible with explicit version, use --with-name name" return 1 fi ##:local epoch nameprefix uversion p v u e V U E f # split $version into $epoch $version and $uversion and set $v $u $e $V $U $E $f: escape_version nameprefix="${name}${name:+-}" p="$(sedsafe "$packagename")" upstreamtag="$(createtagname "$upstreamtag" "upstream" \ "${nameprefix}upstream$epoch-$uversion")" || return 1 patchedtag="$(createtagname "$patchedtag" "patched" \ "${nameprefix}patched$epoch-$version")" || return 1 debiantag="$(createtagname "$debiantag" "debian" \ "${nameprefix}debian$epoch-$version")" || return 1 settag "$upstreamtag" "$control_upstream" "$dorefreshupstream" || return 1 settag "$patchedtag" "$control_patched" "$dorefresh" || return 1 settag "$debiantag" "$totag" "$dorefresh" || return 1 } ############ common stuff ############### ##:function getdebianfile =branches function getdebianfile () { if test -n "$2" ; then gitcmd cat-file blob "${2}${1}" || return 1 elif [ x"$HEADBRANCH" = x"$DEBIANBRANCH" ] && test -e "${reldir}debian/$1" ; then cat "${reldir}debian/$1" || return 1 else gitcmd cat-file blob "${DEBIANREV}:debian/$1" || return 1 fi } ##:compound patchoptions =dpmcontrol lines_must_match patch_author patch_fallbackauthor patch_date patch_edit forcecommitreuse patch_include_name patch_include_category ##:compound patchstate old_commit_count ##:function apply_patch patchname level =patchoptions =patchstate ##:function apply_dpatch_patch patchname =patchoptions =patchstate dpatch_forbid_empty ##:function apply_next_patch next_patch =patchoptions =patchstate function apply_next_patch() { local patchname level inpatchedbranch patchname="$(sed -e "${next_patch}"'s/\([ #].*\)\?$//p' -n "$gitdir"/dpm/import/series)" || return 1 if test -z "$patchname" ; then return 0 fi level="$(sed -e "${next_patch}"'s/^.*[ ]-p/-p/p' -n "$gitdir"/dpm/import/series)" || return 1 echo "Applying '$patchname' ${level:+with option '$level' }..." cp "$gitdir"/dpm/import/"${patchname//\//__slash__}" "$gitdir"/dpm/patchfile || return 1 apply_patch "$1" || return 1 debugout "patch $patchname applied..." } # old_commit_count must be 0 or $gitdir/dpm/oldcommits existing ##:function apply_patches =patchoptions =patchstate function apply_patches() { local debiantreerev inpatchedbranch num_patches num_lines # if != "" the tree object to get the debian stuff from debiantreerev="$1" # if true, switch to and update PATCHEDBRANCH and PATCHEDREV inpatchedbranch="$2" rm -rf "$gitdir/dpm/import" || return 1 mkdir "$gitdir/dpm/import" || return 1 getdebianfile patches/series "$debiantreerev" >"$gitdir/dpm/import/series" || return 1 num_patches=0 num_lines=0 local filename option options while read filename option options ; do case "$filename" in ''|'#'*) num_lines="$(( $num_lines + 1))" continue ;; esac case "$option" in ''|'#'*|-p*) ;; *) printerror "Unsupported option '$option' in debian/patches/series" ;; esac case "$options" in ''|'#'*) ;; *) printerror "Unsupported option '$option' in debian/patches/series" ;; esac getdebianfile patches/"$filename" "$debiantreerev" >"$gitdir"/dpm/import/"${filename//\//__slash__}" || return 1 num_lines="$(( $num_lines + 1))" num_patches="$(( $num_patches + 1))" done <"$gitdir/dpm/import/series" if $inpatchedbranch ; then gitcmd checkout -q "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi if [ $num_patches -eq 0 ] ; then debugout "No patches in series, done." return 0 fi local next_patch next_patch=1 while [ $next_patch -le $num_lines ] ; do apply_next_patch "$inpatchedbranch" || return 1 next_patch="$(( $next_patch + 1))" ## TODO: fix shelllint's while parsing ##:unused next_patch done if $delete_temp_files ; then rm -f -r -- "$gitdir/dpm/import" fi if $inpatchedbranch ; then PATCHEDREV="$(gitcmd rev-parse --verify HEAD)" || return 1 fi } ##:function apply_next_dpatch_patch next_patch =patchoptions =patchstate dpatch_forbid_empty function apply_next_dpatch_patch() { local patchname patchname="$(sed -e "${next_patch}"'s/\([ #].*\)\?$//p' -n "$gitdir"/dpm/import/series)" || return 1 patchname="${patchname%.dpatch}" if test -z "$patchname" ; then return 0 fi echo "Applying '$patchname'..." cp "$gitdir"/dpm/import/"${patchname//\//__slash__}" "$gitdir"/dpm/patchfile || return 1 apply_dpatch_patch || return 1 debugout "patch $patchname applied..." } # old_commit_count must be 0 or $gitdir/dpm/oldcommits existing and forcecommitreuse set ##:function apply_dpatch_patches =patchoptions =patchstate dpatch_forbid_empty function apply_dpatch_patches() { local debiantreerev num_patches num_lines # if != "" the tree object to get the debian stuff from debiantreerev="$1" rm -rf "$gitdir/dpm/import" || return 1 mkdir "$gitdir/dpm/import" || return 1 getdebianfile patches/00list "$debiantreerev" >"$gitdir/dpm/import/series" || return 1 num_patches=0 num_lines=0 local filename rest while read filename rest ; do case "$filename" in ''|'#'*) num_lines="$(( $num_lines + 1))" continue ;; esac filename="${filename%.dpatch}" if [ "x$rest" != "x" ] ; then printerror "Unsupported trailing data '$rest' in debian/patches/00list" fi getdebianfile patches/"$filename".dpatch "$debiantreerev" >"$gitdir"/dpm/import/"${filename//\//__slash__}" || return 1 num_lines="$(( $num_lines + 1))" num_patches="$(( $num_patches + 1))" done <"$gitdir/dpm/import/series" if [ x"$HEADBRANCH" != x"$PATCHEDBRANCH" ] ; then gitcmd checkout -q "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi if [ $num_patches -eq 0 ] ; then debugout "No patches in 00list, done." return 0 fi local next_patch next_patch=1 while [ $next_patch -le $num_lines ] ; do apply_next_dpatch_patch || return 1 next_patch="$(( $next_patch + 1))" ## TODO: fix shelllint's while parsing ##:unused next_patch done if $delete_temp_files ; then rm -f -r -- "$gitdir/dpm/import" fi PATCHEDREV="$(gitcmd rev-parse --verify HEAD)" || return 1 } ############ init ############### ##:function do_init dpatch_forbid_empty allowchangesindebian =subcommand =patchoptions/local function do_init() { ##:local doamend createpatches patchesapplied ##:local dotgitoption ignoredeletions patch_author="" patch_fallbackauthor="" patch_date="" doamend=false patch_edit=false createpatches=true patchesapplied=false lines_must_match=1 forcecommitreuse=false patch_include_name=false patch_include_category=false dotgitoption="none" ignoredeletions="auto" checkgitdir || return 1 true > "$gitdir/dpm/newcomponents" || return 1 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] init [options] <.orig.tar.* filename> [ [ []]] Set up git-dpm for some project. You need to have an branch with the upstream sources (Either the contents of the .orig.tar file for example as produced by import-tar, or some upstream branch with all files outside debian/ and .git* removed that are not in the upstream tarball). Additionally you can already have a Debian branch. If that has a debian/patches/series file and neither --patched-applied is given nor a where those are already applied, they will be applied on top of (create that commit with any possible not debian/patched managed changes, otherwise the is used). If this commit is called with active branch 'master' or 'upstream', the Debian branch is assumed to be called 'master' and the upstream branch 'upstream'. If it is called 'upstream-'something, or something else, then the Debian branch is assumed to be called 'something' and the upstream branch 'upstream-'something. If there is no given then the upstream branch is used, otherwise that is replaced with the upstream commit. Possible local options: --create-no-patches: don't (re)create debian/patches/ --patches-applied: patches are already applied in the Debian branch EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --create-no-patches) createpatches=false ;; --patches-applied) patchesapplied=true ;; --dpatch-allow-empty) dpatch_forbid_empty=false ;; --patch-context|-C) shift lines_must_match="$1" ;; -C*|--patch-context=*) lines_must_match="${1#-C}" lines_must_match="${lines_must_match#--patch-context=}" ;; --component) shift ##:local componentfilename componentbasename componentfilename="$1" componentbasename="${1##*/}" if ! test -e "$componentfilename" ; then printerror "No such file: '$componentfilename'" return 1 fi case "$componentbasename" in *.orig-*.tar*) ;; *) printerror "'$componentbasename' is not of the form *.orig-*.tar*" return 1 ;; esac ##:local origsha origsize origsha="$(sha1sum -b -- "$componentfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$componentfilename")" || return 1 debugout "$componentbasename has sha1 $origsha and size $origsize" printf 'component:%s:%s:%s\n' "$origsha" "$origsize" "$componentbasename" >> "$gitdir/dpm/newcomponents" || return 1 ##:invalidate origsha origsize ##:invalidate componentfilename componentbasename ;; --record-patch-name) patch_include_name=true ;; --record-patch-category) patch_include_category=true ;; --) shift break ;; -*) printerror "Unrecognized init option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 4 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi if [ $# -lt 1 ] ; then cat >&2 <<'EOF' Syntax: git-dpm [global options] init [--create-no-patches] [--patches-applies] <.orig.tar.* filename> [ [ []]] EOF return 1 fi if ! [ -f "$1" ] ; then printerror "no such file: '$1'!" return 1 fi ##:local origfilename origname origfilename="$1" shift origname=${origfilename##*/} case "$origname" in *.orig.tar.*) ;; *) printerror "'$origname' does not contain .orig.tar!" return 1 ;; esac ##:local filenamebeforeorig dummy1 dummy2 dummy3 componentbasename filenamebeforeorig="${origname%.orig.tar*}" while IFS=":" read dummy1 dummy2 dummy3 componentbasename ; do ##:unused dummy1 dummy2 dummy3 case "$componentbasename" in ${filenamebeforeorig}.orig-*.tar*) ;; *) printerror "Component filename '$componentbasename' does not match '${filenamebeforeorig}.orig-*.tar*'!" return 1 ;; esac done < "$gitdir/dpm/newcomponents" ##:invalidate dummy1 dummy2 dummy3 ##:local NEWUPSTREAMBRANCH NEWOLDPATCHEDBRANCH NEWPATCHEDBRANCH NEWUPSTREAMBRANCH="" NEWOLDPATCHEDBRANCH="" NEWPATCHEDBRANCH="" if [ $# -gt 0 ] ; then NEWUPSTREAMBRANCH="$1" shift fi if [ $# -gt 0 ] ; then NEWOLDPATCHEDBRANCH="$1" shift fi if [ $# -gt 0 ] ; then NEWPATCHEDBRANCH="$1" shift fi cdtoplevel || return 1 initbranchvariables "" false || return 1 ##:local dotgitfiles determinedotgitbehaviour || return 1 checkclean $allow_nonclean || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi if [ x"$HEADBRANCH" = x"$PATCHEDBRANCH" ] ; then printerror "git-dpm init cannot be run with '$PATCHEDBRANCH' as active head!" return 1 fi debugout "look at '$origfilename'..." origsha="$(sha1sum -b -- "$origfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$origfilename")" || return 1 debugout "checking and initializing branches..." if test -n "$DEBIANREV" ; then debugout "First test if there already is a debian/.git-dpm in '$DEBIANBRANCH'" if gitcmd rev-parse -q --verify "$DEBIANREV"':debian/.git-dpm' ; then printerror "debian/.git-dpm already existing in '$DEBIANBRANCH'!" return 1 fi elif "$patchesapplied" ; then printerror "--patches-applied makes no sense if there is no Debian branch ('$DEBIANBRANCH')!" return 1 fi ##:local NEWUPSTREAMREV if test -n "$NEWUPSTREAMBRANCH" ; then NEWUPSTREAMREV="$(get_and_verify_commit "$NEWUPSTREAMBRANCH")" || return 1 elif test -n "$UPSTREAMREV" ; then NEWUPSTREAMREV="$UPSTREAMREV" else # todo: import the tar-file? printerror "No upstream branch argument given and '$UPSTREAMBRANCH' does not yet exists." return 1 fi ##:local NEWOLDPATCHEDREV if test -n "$NEWOLDPATCHEDBRANCH" ; then NEWOLDPATCHEDREV="$(get_and_verify_commit "$NEWOLDPATCHEDBRANCH")" || return 1 else NEWOLDPATCHEDREV="$NEWUPSTREAMREV" fi ##:local NEWPATCHEDREV if test -n "$NEWPATCHEDBRANCH" ; then NEWPATCHEDREV="$(get_and_verify_commit "$NEWPATCHEDBRANCH")" || return 1 else NEWPATCHEDREV="" fi if test -z "$UPSTREAMREV" ; then debugout "Creating '$UPSTREAMBRANCH'..." gitcmd branch "$UPSTREAMBRANCH" "$NEWUPSTREAMREV" || return 1 UPSTREAMREV="$NEWUPSTREAMREV" elif [ x"$UPSTREAMREV" = x"$NEWUPSTREAMREV" ] ; then debugout "'$UPSTREAMBRANCH' already as it should be..." elif [ "x$HEADBRANCH" != "x$UPSTREAMBRANCH" ] ; then gitcmd update-ref -m "git-dpm init" refs/heads/"$UPSTREAMBRANCH" "$NEWUPSTREAMREV" "$UPSTREAMREV" || return 1 UPSTREAMREV="$NEWUPSTREAMREV" else printerror "Upstream branch '$UPSTREAMBRANCH' to be updated but current HEAD!" return 1 fi if test -n "$NEWOLDPATCHEDREV" && ! isancestor "$UPSTREAMREV" "$NEWOLDPATCHEDREV"; then printerror "'$NEWOLDPATCHEDBRANCH' does not contain '$UPSTREAMBRANCH'!" return 1 fi if test -s "$gitdir/dpm/newcomponents" ; then debugout "checking components to exist in the upstream dir..." ##:local dummy1 dummy2 dummy3 filename while IFS=":" read dummy1 dummy2 dummy3 filename ; do ##:unused dummy1 dummy2 dummy3 ##:local basefilename component basefilename="${filename##*/}" component="${basefilename%.tar*}" component="${component##*.orig-}" if [ x"${basefilename%.orig-*.tar*}" != x"${origname%.orig.tar*}" ] ; then printerror "${basefilename} does not match ${origname%.orig.tar*}.orig-*.tar*!" return 1 fi if ! gitcmd rev-parse -q --verify "$UPSTREAMREV":"$component" >/dev/null ; then printerror "new upstream branch $UPSTREAMBRANCH does not contain a subdirectory called '$component', so '$basefilename' seems not yet included in that one!" return 1 elif [ x"$(gitcmd cat-file -t "$UPSTREAMREV":"$component" || true)" != xtree ] ; then printerror "new upstream branch $UPSTREAMBRANCH does not contain a subdirectory called '$component' but some other object! Something is very strange." return 1 else debugout "successfully checked '$component' is a directory in '$UPSTREAMREV'" fi done < "$gitdir/dpm/newcomponents" fi if test -n "$NEWPATCHEDREV" ; then if test -n "$NEWOLDPATCHEDREV" ; then if ! isancestor "$NEWOLDPATCHEDREV" "$NEWPATCHEDREV"; then printerror "'$NEWPATCHEDBRANCH' does not contain '$NEWOLDPATCHEDBRANCH'!" return 1 fi elif ! isancestor "$UPSTREAMREV" "$NEWPATCHEDREV"; then printerror "'$NEWPATCHEDBRANCH' does not contain '$UPSTREAMBRANCH'!" return 1 fi fi if test -n "$DEBIANREV" && test -z "$NEWUPSTREAMBRANCH" && ! isancestor "$UPSTREAMREV" "$DEBIANREV" ; then printerror "Your Debian branch '$DEBIANBRANCH' does not contain your '$UPSTREAMBRANCH'." echo "To use it anyway, specify it as explicit argument.." >&2 return 1 fi ##:local topmost topmostname # Find the top-most non-Debian branch if test -n "$NEWPATCHEDBRANCH" ; then topmost="$NEWPATCHEDREV" topmostname="$NEWPATCHEDBRANCH" elif test -n "$NEWOLDPATCHEDBRANCH" ; then topmost="$NEWOLDPATCHEDREV" topmostname="$NEWOLDPATCHEDBRANCH" else topmost="$UPSTREAMREV" topmostname="$UPSTREAMBRANCH" fi if [ x"$UPSTREAMREV" != x"$topmost" ] ; then ##:local badrevs debugout "Check if '$UPSTREAMBRANCH'..'$topmostname' contains any debian/ changes" badrevs="$(gitcmd rev-list "$UPSTREAMREV..$topmost" -- ${reldir}debian/ | wc -l)" || return 1 if [ 0 -lt "$badrevs" ] ; then printerror "'$topmostname' contains commits changing debian/:" gitcmd rev-list --pretty=oneline "$UPSTREAMREV..$topmost" -- ${reldir}debian/ >&2 return 1 fi fi if test -z "$DEBIANREV" ; then if gitcmd rev-parse --verify -q "$topmost:debian" > /dev/null ; then printerror "Cowardly refusing to run with no Debian branch '$DEBIANBRANCH' but a debian/ in '$topmostname'!" cat >&2 <&2 if test -n "$NEWOLDPATCHEDREV" ; then cat >&2 </dev/null ; then ##:local patched_base old_commit_count debugout "found debian/patches/series, trying to apply quilt series..." patched_base="${NEWOLDPATCHEDREV:-$UPSTREAMREV}" if [ x"$PATCHEDREV" != x"$patched_base" ] ; then if [ x"$HEADBRANCH" = x"$PATCHEDBRANCH" ] ; then printerror "Cannot change '$PATCHEDBRANCH' when it's checked out!" return 1 fi debugout "Starting at '${NEWPATCHEDBRANCH:-$UPSTREAMBRANCH}'..." gitcmd update-ref -m "git-dpm init" refs/heads/"$PATCHEDBRANCH" "$patched_base" "$PATCHEDREV" || return 1 PATCHEDREV="$patched_base" fi old_commit_count=0 apply_patches "" true || return 1 ##:invalidate patched_base old_commit_count elif gitcmd rev-parse -q --verify "$DEBIANREV:debian/patches/00list" >/dev/null ; then ##:local patched_base old_commit_count debugout "found debian/patches/00list, trying to apply dpatch series..." patched_base="${NEWOLDPATCHEDREV:-$UPSTREAMREV}" if [ x"$PATCHEDREV" != x"$patched_base" ] ; then if [ x"$HEADBRANCH" = x"$PATCHEDBRANCH" ] ; then printerror "Cannot change '$PATCHEDBRANCH' when it's checked out!" return 1 fi debugout "Starting at '${NEWPATCHEDBRANCH:-$UPSTREAMBRANCH}'..." gitcmd update-ref -m "git-dpm init" refs/heads/"$PATCHEDBRANCH" "$patched_base" "$PATCHEDREV" || return 1 PATCHEDREV="$patched_base" fi old_commit_count=0 apply_dpatch_patches "" || return 1 ##:invalidate patched_base old_commit_count else ##:local patched_base debugout "No debian/patches..." patched_base="${NEWOLDPATCHEDREV:-$UPSTREAMREV}" if [ x"$PATCHEDREV" != x"$patched_base" ] ; then if [ x"$HEADBRANCH" = x"$PATCHEDBRANCH" ] ; then printerror "Cannot change '$PATCHEDBRANCH' when it's checked out!" return 1 fi debugout "Changing to given '${NEWPATCHEDBRANCH:-$UPSTREAMBRANCH}'..." gitcmd update-ref -m "git-dpm init" refs/heads/"$PATCHEDBRANCH" "$patched_base" "$PATCHEDREV" || return 1 PATCHEDREV="$patched_base" else debugout "Already up to date..." fi ##:invalidate patched_base fi if "$patchesapplied" ; then debugout "Make sure Debian branch does not contain any additional changes..." if $allowchangesindebian ; then checkdebian "$PATCHEDREV" "warn" || return 1 elif ! checkdebian "$PATCHEDREV" "Your Debian branch '$DEBIANBRANCH' contains non-debian changes:" ; then if test -z "$NEWPATCHEDREV" ; then cat >&2 < "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 fi cat -- "$gitdir"/dpm/newcomponents >> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "${UPSTREAMREV}" "${PATCHEDREV}" > "$gitdir/dpm/modifications" || return 1 ##:local parents tree parents="" if $domergepatched ; then debianmerge "$gitdir/dpm/modifications" \ "$PATCHEDREV" "$PATCHEDBRANCH" \ "${DEBIANREV}:debian" "${DEBIANBRANCH}:debian" \ "$UPSTREAMREV" "$UPSTREAMBRANCH" \ "${DEBIANREV}" "${DEBIANBRANCH}" || return 1 parents="$PATCHEDREV" else modify_tree "${DEBIANREV}:" "$gitdir/dpm/modifications" || return 1 fi committodebianbranch "$tree" "$doamend" "$parents" "" "Initialize git-dpm" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/modifications "$gitdir"/dpm/newcomponents "$gitdir"/dpm/newcontrol fi # amending the commit instead of having done it before the last # commit is a bit wasteful but makes the code much easier... # (and has the advantage of being in a bit saner state if anything # about that fails... if $createpatches ; then update_patches "$control_upstream" "$control_patched" true "Initialize git-dpm" || return 1 fi if test -n "$PATCHEDREV" ; then debugout "remove '$PATCHEDBRANCH', so it does not get stale" gitcmd branch -d "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi return 0 } ########### status ############## ##:function check_origname =dpmcontrol function check_origname() { local success=true if test -e "../$control_origtarname" ; then debugout "../$control_origtarname is there, to check it contents run prepare" else echo "Could not find '../$control_origtarname!" >&2 echo "Without that file dpkg-source will not work!" >&2 echo "(Have you forgotten to run git-dpm prepare?)" >&2 success=false fi gitcmd cat-file blob "$DEBIANREV:debian/changelog" | dpkg-parsechangelog -l- > "$gitdir/dpm/changelog" || return 1 local version sourcename upstreamversion version="$(sed -n -e 's/^Version: //p' "$gitdir/dpm/changelog")" || return 1 sourcename="$(sed -n -e 's/^Source: //p' "$gitdir/dpm/changelog")" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/changelog" fi version="${version#*:}" upstreamversion="${version%-*}" if [ x"${sourcename}_${upstreamversion}" = x"${control_origtarname%.orig.tar*}" ] ; then debugout "name of '$control_origtarname' matches what debian/changelog says" else printwarn "guessing from your debian/changelog, your upstream file should be named '${sourcename}_${upstreamversion}.orig.tar.*' but it is named '${control_origtarname}'" success=false fi LC_ALL=C sed -n -e 's/^component:\([0-9a-f]\+\):\([0-9]\+\):/\1 \2 /p' -- "$gitdir/dpm/oldcontrol" | { while read hash size name ; do ##:unused hash size if ! test -e "../$name" ; then echo "Could not find '../$name!" >&2 if $success ; then echo "Without that file dpkg-source might not work!" >&2 echo "(Have you forgotten to run git-dpm prepare?)" >&2 success=false fi fi if [ x"${sourcename}_${upstreamversion}" = x"${name%.orig-*}" ] ; then debugout "name of '$name' matches what debian/changelog says" else printwarn "guessing from your debian/changelog, your upstream file should be named '${sourcename}_${upstreamversion}.orig-*.tar.*' but it is named '${name}'" success=false fi done ; $success ; } || return 1 # return sucess if there were no warnings... $success } ##:function do_status =subcommand function do_status() { ##:local status_ret status_ret=0 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] status [branch] Check the current status. EOF return 0 ;; --) shift break ;; -*) printerror "Unrecognized status option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -gt 1 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 checkclean true || return 1 if [ "$checked_if_clean" -lt 1 ] ; then status_ret=3 fi initbranchvariables "${1:-HEAD}" || return 1 if test -z "$UPSTREAMREV" ; then echo "No branch named '$UPSTREAMBRANCH'." status_ret=2 else debugout "Upstream branch '$UPSTREAMBRANCH': ${UPSTREAMREV}" fi if test -z "$PATCHEDREV" ; then debugout "'$PATCHEDBRANCH' does currently not exist." else debugout "Upstream branch '$PATCHEDBRANCH': ${PATCHEDREV}" echo "'$PATCHEDBRANCH' exists." echo "Once you are finished doing changes to this, don't forget to run update-patches (or at least merge-patched-into-debian)" echo "(Or remove it if it is a left-over from an old patch editing session)" fi if test -z "$DEBIANREV" ; then echo "No branch named '$DEBIANBRANCH'." status_ret=2 else debugout "Upstream branch '$DEBIANBRANCH': ${DEBIANREV}" fi debugout "Checking if branches are up to date..." ##:local cancheckdebian cancheckdebian=false if [ -n "$UPSTREAMREV" ] && [ -n "$PATCHEDREV" ] ; then if ! isancestor "$UPSTREAMREV" "$PATCHEDREV"; then echo "NOT UP TO DATE: '$PATCHEDBRANCH' does not contain '$UPSTREAMBRANCH'!" >&2 status_ret=3 fi else debugout "Could not check if '$PATCHEDBRANCH' contains '$UPSTREAMBRANCH'" fi if [ -z "$PATCHEDREV" ] && [ -n "$UPSTREAMREV" ] && [ -n "$DEBIANREV" ] ; then if ! isancestor "$UPSTREAMREV" "$DEBIANREV"; then echo "NOT UP TO DATE: '$DEBIANBRANCH' does not contain '$UPSTREAMBRANCH'!" >&2 status_ret=3 fi fi debugout "Checking if patched branch changed debian/ ..." if [ -n "$UPSTREAMREV" -a -n "$PATCHEDREV" ] ; then checkpatched || status_ret=4 fi debugout "Check contents of debian/.git-dpm file..." if parsedpmcontrolfile "${1:-}" ; then if [ x"$control_patches" != x00000000000000000000000000000000 ] && \ [ x"$control_patches" != x"NONE" ] && \ ! gitcmd cat-file -e "$control_patches" 2>/dev/null ; then printerror \ "revision '$control_patches' recorded in debian/.git-dpm to be the current state of debian/patches not found in repository!" status_ret=4 elif ! gitcmd cat-file -e "$control_patched" 2>/dev/null ; then printerror \ "patched revision '$control_patched' from debian/.git-dpm not found in repository!" status_ret=4 else if [ "x$control_patches" = "x$control_patched" ] ; then debugout \ "Current recorded state of debian/patches matched recorded patch branch." else echo \ "NOT UP TO DATE: debian/patches (update-patches needed?)" >&2 status_ret=3 fi if test -n "$PATCHEDREV" ; then if [ "x$PATCHEDREV" = "x$control_patched" ] ; then debugout \ "up to date: '$PATCHEDBRANCH' is the same as recorded in debian/.git-dpm." elif isancestor "$control_patched" "$PATCHEDREV" ; then echo \ "NOT UP TO DATE: '$PATCHEDBRANCH' is newer than listed in debian/.git-dpm" echo \ "(try running merge-patched-into-debian or update-patches)" status_ret=3 elif isancestor "$PATCHEDREV" "$control_patched" ; then printwarn \ "'$PATCHEDBRANCH' looks outdated!" status_ret=3 elif test -n "$DEBIANREV" && isancestor "$DEBIANREV" "$PATCHEDREV" ; then printwarn \ "'$PATCHEDBRANCH' looks outdated!" status_ret=3 else echo \ "NOT UP TO DATE: '$PATCHEDBRANCH' differs from recorded one (rebased?)" status_ret=3 fi fi if ! isancestor "$control_patched" "$DEBIANREV" ; then printerror "previously recorded revision '$control_patched' not contained in current Debian branch!" status_ret=4 else cancheckdebian=true fi fi if ! gitcmd cat-file -e "$control_upstream" 2>/dev/null ; then printerror "upstream revision '$control_upstream' from debian/.git-dpm not found in repository!" status_ret=4 elif test -n "$UPSTREAMREV" ; then if [ "x$UPSTREAMREV" = "x$control_upstream" ] ; then debugout "up to date: 'upstream' is the same as recorded in debian/.git-dpm." elif ! isancestor "$control_upstream" "$UPSTREAMREV" ; then printerror "'$UPSTREAMBRANCH' does not contain previously recorded revision '$control_upstream'!" status_ret=4 else echo "NOT UP TO DATE: 'upstream' is newer than listed in debian/.git-dpm" status_ret=3 fi # with no upstream branch, less things to check... elif test -n "$PATCHEDREV" ; then if ! isancestor "$control_upstream" "$PATCHEDREV" ; then printerror "previously recorded upstream revision '$control_upstream' not contained in current patched branch!" status_ret=4 fi elif ! isancestor "$control_upstream" "$DEBIANREV" ; then printerror "previously recorded upstream revision '$control_upstream' not contained in current Debian branch!" status_ret=4 fi if ! check_origname ; then status_ret=4 fi else debugout "Missing debian/.git-dpm makes further checks impossible" status_ret=3 fi if $cancheckdebian ; then debugout "Checking if Debian branch contains changes outside debian/ ..." checkdebian "" "" || status_ret=4 fi if [ "$status_ret" -eq 0 ] ; then echo "git-dpm: everything up to date" else debugout "status returning with code $status_ret" fi return $status_ret } ######### common stuff ############## # check if commit $1 has the same message as in file $2, # i.e. if the old commit can be reused (if tree already checked) ##:function checkcommitmessage =gitcheck function checkcommitmessage() { # "$candidate" "$gitdir/dpm/patch-log" gitcmd cat-file commit "$1" | sed -e '1,/^$/d' > "$gitdir"/dpm/oldmessage || return 1 diff -a -w "$gitdir"/dpm/oldmessage "$2" # > /dev/null } ##:function parse_author author/out email/out function parse_author() { local data="$1" data="${data/ *$/}" data="${data/^ */}" author="${data%%<*}" email="${data##*<}" if [ x"$author" = x"" ] ; then printerror "Missing author name in '$data'." return 1 fi if [ x"$author" = x"$data" ] ; then # no email information found in <>, # check if it looks like an email address: if [ x"$( echo "x$data" | tr -d -C '@ ' || true)" = x"@" ] ; then printwarn "No <>-enclosed email address in author information '$author', translating to '$data <$data>'" author="$data" email="$data" else printwarn "No <>-enclosed email address in author information '$author', treating as '$data <>'" author="$data" email="" fi return 0 elif [ x"$author<$email" != x"$data" ] ; then printerror "Malformed author information '$data' (too many '<'?)." return 1 elif [ x"$email" = "x${email%>}" ] ; then printerror "Malformed author information '$data' (missing final '>'?)." return 1 else email="${email%>}" return 0 fi } ##:function recycle_commit =gitcheck # patchname, patch_author patch_fallbackauthor patch_date must be set (or empty) # the patch already be in "$gitdir"/dpm/patchfile # old_commit_count must be 0 or $gitdir/dpm/oldcommits existing and forcecommitreuse set function apply_patch() { local inpatchedbranch inpatchedbranch="$1" # parse patch before switching, as the checkout might remove the file. debugout "Parse $patchname..." rm -f "$gitdir/dpm/patch-author" "$gitdir/dpm/patch-date" "$gitdir/dpm/patch-subject" "$gitdir/dpm/patch-needs-repair" || return 1 LC_ALL=C awk ' BEGIN {fname=ARGV[1];ARGV[1]="";level=ARGV[2];ARGV[2]="";inpatch=0;hasheader=0;hadauthor=0} /^---/ { hasheader=1 ; inpatch=1 ; next } hasheader == 0 && inpatch && /^@@/ { print "gitneedshelp" > fname "-needs-repair" } inpatch { next } /^index [0-9a-f]+\.\.[0-9a-f]+ [0-7]+$/ \ || /^Index: [^ ]*\/[^ ]*$/ \ || (level == 0 && /^Index: [^ ]*$/) \ || /^diff --git / \ || /^diff -[Naurp]* / \ { inpatch=1 ; next } /^Patch-Name: / {next} afterheader { print ; next } /^[ ]*$/ { afterheader=1 ; print ; next } /^From [0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f] / { next} /^Date: / { gsub(/^Date: */,"") ; print > fname "-date" ; next} !hadauthor && /^Author: [^<]*[^< ] *<[^<>]*>[ ]*$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^Author: *[^<>@ ]*@[^<>@ ]* *$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <" $0 ">" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^Author: *<[^<>@ ]*@[^<>@ ]*> *$/ { gsub(/^Author: *[ ]*$/,"") ; print $0 " <" $0 ">" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^Author: [^<>]*$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <>" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: [^<]*[^< ] *<[^<>]*>[ ]*$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: *[^<>@ ]*@[^<>@ ]* *$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <" $0 ">" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: [^<>]*$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <>" >> fname "-author" ; hadauthor=1 ; next} /^Subject: / { gsub(/^Subject: *(\[[^]]*\] *)*/,"") ; print >> fname "-subject" ; next} /^Description: / {gsub(/^Description: */,"") ; print >> fname "-subject" ; next} { print ; next } ' "$gitdir/dpm/patch" "${level#-p}" "$gitdir/dpm/patchfile" > "$gitdir/dpm/patch-parsed" || return 1 ( if test -f "$gitdir/dpm/patch-subject" ; then cat "$gitdir/dpm/patch-subject" || return 1 echo "" else echo "${patchname%%.patch}" echo "" fi cat "$gitdir/dpm/patch-parsed" || return 1 if $patch_include_name ; then echo "Patch-Name: ${patchname}" fi if $patch_include_category && [ x"${patchname%/*}" != x"$patchname" ] ; then echo "Patch-Category: ${patchname%/*}" fi ) > "$gitdir/dpm/patch-log" local author email if test -n "$patch_author" ; then parse_author "$patch_author" || return 1 debugout "using Author: $author <$email>" elif test -f "$gitdir/dpm/patch-author" ; then author="$(cat "$gitdir/dpm/patch-author")" || return 1 parse_author "$author" || return 1 debugout "determined Author: $author <$email>" elif test -n "$patch_fallbackauthor" ; then parse_author "$patch_fallbackauthor" || return 1 debugout "using default Author: $author <$email>" else author="" email="" fi local date if test -f "$gitdir/dpm/patch-date" ; then date="$(cat "$gitdir/dpm/patch-date")" || return 1 debugout "using Date: $date" else date="$patch_date" fi if $inpatchedbranch ; then # switch do patched branch if not already there: if test -z "$PATCHEDREV" ; then debugout "Creating patched branch '$PATCHEDBRANCH'..." gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 PATCHEDREV="$control_patched" HEADBRANCH="$PATCHEDBRANCH" elif [ x"$PATCHEDBRANCH" = x"$HEADBRANCH" ] ; then debugout "already in '$PATCHEDBRANCH', no need to switch" else gitcmd checkout -q "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi fi debugout "Applying patch..." if test -f "$gitdir/dpm/patch-needs-repair" ; then debugout "Preprocessing patch to make sure git accepts it" awk ' BEGIN {headermissing = 1} /^Index: / { lastindex = substr($0, 8) headermissing = 1 } /^\+\+\+/ || /^---/ { headermissing = 0 } /^@@/ && headermissing { print "--- " lastindex print "+++ " lastindex headermissing = 0; } { print ; next } ' "$gitdir/dpm/patchfile" \ | gitcmd apply --index -C${lines_must_match} $level || return 1 else gitcmd apply --index -C${lines_must_match} $level "$gitdir/dpm/patchfile" || return 1 fi debugout "Creating commit..." local tree parent commit candidate tree="$(gitcmd write-tree)" || return 1 if "$patch_edit" ; then cat >> "$gitdir/dpm/patch-log" < fname "-date" ; next} !hadauthor && /^Author: [^<]*[^< ] *<[^<>]*>[ ]*$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^Author: *[^<>@ ]*@[^<>@ ]* *$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <" $0 ">" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^Author: [^<>]*$/ { gsub(/^Author: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <>" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: [^<]*[^< ] *<[^<>]*>[ ]*$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: *[^<>@ ]*@[^<>@ ]* *$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <" $0 ">" >> fname "-author" ; hadauthor=1 ; next} !hadauthor && /^From: [^<>]*$/ { gsub(/^From: */,"") ; gsub(/[ ]*$/,"") ; print $0 " <>" >> fname "-author" ; hadauthor=1 ; next} /^Subject: / { gsub(/^Subject: *(\[[^]]*\] *)*/,"") ; print >> fname "-subject" ; next} /^Description: / {gsub(/^Description: */,"") ; print >> fname "-subject" ; next} { print ; next } ' "$gitdir/dpm/patch" "$gitdir/dpm/patchfile" > "$gitdir/dpm/patch-parsed" || return 1 ( if test -f "$gitdir/dpm/patch-subject" ; then cat "$gitdir/dpm/patch-subject" || exit 1 else echo "${patchname%%.patch}" fi cat "$gitdir/dpm/patch-parsed" || exit 1 if $patch_include_name ; then echo "Patch-Name: ${patchname}" fi if $patch_include_category && [ x"${patchname%/*}" != "$patchname" ] ; then echo "Patch-Category: ${patchname%/*}" fi ) > "$gitdir/dpm/patch-log" || return 1 local author email date if test -n "$patch_author" ; then parse_author "$patch_author" || return 1 debugout "using Author: $author <$email>" elif test -f "$gitdir/dpm/patch-author" ; then author="$(cat "$gitdir/dpm/patch-author")" || return 1 parse_author "$author" || return 1 debugout "determined Author: $author <$email>" elif test -n "$patch_fallbackauthor" ; then parse_author "$patch_fallbackauthor" || return 1 debugout "using default Author: $author <$email>" else author="" email="" fi if test -f "$gitdir/dpm/patch-date" ; then date="$(cat "$gitdir/dpm/patch-date")" || return 1 debugout "using Date: $date" else date="$patch_date" fi # switch do patched branch if not already there: if test -z "$PATCHEDREV" ; then debugout "Creating patched branch '$PATCHEDBRANCH'..." gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 PATCHEDREV="$control_patched" HEADBRANCH="$PATCHEDBRANCH" elif [ x"$PATCHEDBRANCH" = x"$HEADBRANCH" ] ; then debugout "already in '$PATCHEDBRANCH', no need to switch" else gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi if test -n "$level" ; then debugout "Applying patch with level ${level} ..." gitcmd apply --index -C${lines_must_match} -p$level "$gitdir/dpm/patchfile" || return 1 else debugout "Applying patch.. testing first level 1..." if gitcmd apply --index -C${lines_must_match} -p1 "$gitdir/dpm/patchfile" ; then debugout "level 1 worked" else echo "Could not apply $patchname with level 1, trying 0..." if gitcmd apply --index -C${lines_must_match} -p0 "$gitdir/dpm/patchfile" ; then debugout "level 0 worked" else echo "Could not apply $patchname with level 1, trying 0..." if gitcmd apply --index -C${lines_must_match} -p2 "$gitdir/dpm/patchfile" ; then debugout "level 2 worked" else printerror "Could not apply $patchname with neither level 1, 0 nor 2." return 1 fi fi fi fi local tree parent commit candidate debugout "Creating commit..." tree="$(gitcmd write-tree)" || return 1 if "$patch_edit" ; then sensible-editor "$gitdir/dpm/patch-log" || return $? fi parent="$PATCHEDREV" commit="" if [ "$old_commit_count" -gt 0 ] ; then candidate="$(recycle_commit "$tree" "$parent")" || return 1 if test -z "$candidate" ; then debugout "Cannot reuse old commit $candidate, creating new commit" elif $forcecommitreuse || checkcommitmessage "$candidate" "$gitdir/dpm/patch-log" ; then debugout "Reusing old commit $candidate" commit="$candidate" else debugout "Old commit had same tree but different message, creating new commit" fi fi if test -z "$commit" ; then # git doesn't like commits happening too fast: sleep 1 committreef "$gitdir/dpm/patch-log" "$tree" "$author" "$email" "$date" -p "$parent" || return 1 fi gitcmd update-ref -m "git-dpm: import $patchname" HEAD "$commit" "$PATCHEDREV" || return 1 PATCHEDREV="$commit" if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/patch* fi return 0 } ######### apply-patch ############## ##:function do_apply_patch dpatch_forbid_empty =subcommand =patchoptions/local =patchstate/local function do_apply_patch() { ##:local is_dpatch_patch is_cdbs_patch category patchname patch_author="" patch_fallbackauthor="" patch_date="" patch_edit=false is_dpatch_patch=false is_cdbs_patch=false lines_must_match=1 forcecommitreuse=false patch_include_name=false category="" patchname="" while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] apply-patch [options] [] Import a patch to the patched branch. (Without filename, stadin is used). Possible local options: --default-author "name ": If no author information can be extracted from the patch, use this. --author "name ": Explicitly give author information. --date : Explicitly set the date. --context Require at least lines of context to match. (Default 1) --cdbs: Parse patch as cdbs simple-makesys patch file. --dpatch: Parse patch as dpatch patch file. --edit: edit the preprocessed patch before applying EOF return 0 ;; --dpatch) is_dpatch_patch=true ;; --cdbs) is_cdbs_patch=true ;; --context|--patch-context|-C) shift lines_must_match="$1" ;; -C*|--context=*|--patch-context=*) lines_must_match="${1#-C}" lines_must_match="${lines_must_match#--context=}" lines_must_match="${lines_must_match#--patch-context=}" ;; --author) shift patch_author="$1" ;; --author=*) patch_author="${1#--author=}" ;; --defaultauthor|--default-author) shift patch_fallbackauthor="$1" ;; --defaultauthor=*|--default-author=*) patch_fallbackauthor="${1#--defaultauthor=}" patch_fallbackauthor="${patch_fallbackauthor#--default-author=}" ;; --date) shift patch_date="$1" ;; --date=*) patch_date="${1#--date=}" ;; --edit) patch_edit=true ;; --dpatch-allow-empty) dpatch_forbid_empty=false ;; --record-name) patch_include_name=true ;; --name) shift patch_include_name=true patchname="$1" ;; --name=*) patch_include_name=true patchname="${1#--name=}" ;; --category) shift category="$1" ;; --category=*) category="${1#--category=}" ;; --) shift break ;; -*) printerror "Unrecognized tag option '$1'!" return 1 ;; *) break ;; esac shift done if $is_cdbs_patch && $is_dpatch_patch ; then printerror "--cdbs and --dpatch are incompatible..." return 1 fi if $patch_include_name && test -n "$category" ; then printerror "Only one of --name, --category, and --retain-name can be used at the same time!" return 1 fi ##:local level filename level="" filename="-" if [ $# -gt 0 ] ; then filename="$1" shift fi if [ $# -gt 0 ] ; then printerror "Unexpected arguments '$*'!" return 1 fi checkgitdir || return 1 rm -f -- "$gitdir"/dpm/patch* if [ x"$filename" = x"-" ] ; then if test -z "$patchname" && $patch_include_name ; then printerror "--retain-name cannot guess name of stdin." return 1 fi cat > "$gitdir"/dpm/patchfile else if test -z "$patchname" ; then patchname="${filename##*/}" fi cp -- "$filename" "$gitdir"/dpm/patchfile || return 1 fi if test -n "$category" ; then patch_include_category=true patchname="${category}/${patchname}" else patch_include_category=false fi cdtoplevel || return 1 initbranchvariables || return 1 parsedpmcontrolfile "" || return 1 checkclean $allow_nonclean || return 1 old_commit_count=0 if $is_cdbs_patch ; then apply_cdbs_patch || return 1 elif $is_dpatch_patch ; then apply_dpatch_patch || return 1 else apply_patch true || return 1 fi echo "patch applied to '$PATCHEDBRANCH' branch." echo "Don't forget to call update-patches after you are done." return 0 } ######### apply-dpatch-patch ############## # patchname, patch_author patch_fallbackauthor patch_date must be set (or empty) # the patch already be in "$gitdir"/dpm/patchfile # old_commit_count must be 0 or $gitdir/dpm/oldcommits existing and forcecommitreuse set function apply_dpatch_patch() { ##:local ret # parse patch before switching, as the checkout might remove the file. debugout "Parse $patchname as dpatch patch..." local level ret=0 rm -f "$gitdir/dpm/patch-author" rm -f "$gitdir/dpm/patch-unpack-command" LC_ALL=C awk ' BEGIN {fname=ARGV[1];ARGV[1]="";inpatch=0} inpatch { next } FNR == 1 && !/^#! ?\/bin\/sh/ { exit 3 } FNR == 2 && !/^## .*\.dpatch by .*/ && !/^## .*\.dpatch$/{ exit 3 } FNR == 2 && /^## .*\.dpatch by *[^<]* <[^<>]*> *$/ { gsub(/.*\.dpatch by /,""); gsub(/ *$/,""); print >> fname "-author" ; next } FNR == 2 && /^## .*\.dpatch$/ { next } FNR == 2 { gsub(/^## DP: /,"") ; gsub(/^## */,"") ; print ; next } /^## DP: Patch-Name:/ { next} /^## DP: / { gsub(/^## DP: /,"") ; print ; next} /^[ ]*-patch) patch/ { print >> fname "-unpack-command" ; next} /^---/ \ || /^index [0-9a-f]+\.\.[0-9a-f]+ [0-7]+$/ \ || /^Index: [^ ]*\/[^ ]*$/ \ || /^diff --git / \ || /^@DPATCH@$/ \ { inpatch=1 ; next } { next } ' "$gitdir/dpm/patch" "$gitdir/dpm/patchfile" > "$gitdir/dpm/patch-log" || ret=$? if [ $ret = 3 ] ; then printerror "$patchname" does not look like a dpatch file return 1 fi if [ $ret != 0 ] ; then return 1 fi level="" if test -f "$gitdir/dpm/patch-unpack-command" ; then level="-p$(sed -n '1s/.* -p\([0-9]*\) .*/\1/p' "$gitdir/dpm/patch-unpack-command")" || return 1 fi if ! test -s "$gitdir/dpm/patch-log" || ! grep -q -v '^No description\.$' -- "$gitdir/dpm/patch-log" ; then echo "${patchname}" | sed -e 's/^[0-9]\+_//' > "$gitdir/dpm/patch-log" || return 1 fi if $patch_include_name ; then echo "Patch-Name: ${patchname}" >> "$gitdir/dpm/patch-log" fi if $patch_include_category && [ x"${patchname%/*}" != "$patchname" ] ; then echo "Patch-Category: ${patchname%/*}" >> "$gitdir/dpm/patch-log" fi ##:local author email if test -n "$patch_author" ; then parse_author "$patch_author" || return 1 debugout "using Author: $author <$email>" elif test -f "$gitdir/dpm/patch-author" ; then author="$(cat "$gitdir/dpm/patch-author")" || return 1 parse_author "$author" || return 1 debugout "determined Author: $author <$email>" elif test -n "$patch_fallbackauthor" ; then parse_author "$patch_fallbackauthor" || return 1 debugout "using default Author: $author <$email>" else author="" email="" fi # switch do patched branch if not already there: if test -z "$PATCHEDREV" ; then debugout "Creating patched branch '$PATCHEDBRANCH'..." gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 PATCHEDREV="$control_patched" HEADBRANCH="$PATCHEDBRANCH" elif [ x"$PATCHEDBRANCH" = x"$HEADBRANCH" ] ; then debugout "already in '$PATCHEDBRANCH', no need to switch" else gitcmd checkout "$PATCHEDBRANCH" || return 1 HEADBRANCH="$PATCHEDBRANCH" fi debugout "Applying patch..." if gitcmd apply --index -C${lines_must_match} $level "$gitdir/dpm/patchfile" ; then debugout "patch successfully applied" else printwarn "failed to apply patch, retry with more options..." if gitcmd apply --recount --index -C${lines_must_match} $level "$gitdir/dpm/patchfile" ; then debugout "patch applied with --recount" elif gitcmd apply --inaccurate-eof --index -C${lines_must_match} $level "$gitdir/dpm/patchfile" ; then debugout "patch applied with --inaccurate-eof" elif gitcmd apply --recount --inaccurate-eof --index -C${lines_must_match} $level "$gitdir/dpm/patchfile" ; then debugout "patch applied with --recount --inaccurate-eof" else return 1 fi fi local tree commit candidate patchedrevtree debugout "Creating commit..." tree="$(gitcmd write-tree)" || return 1 patchedrevtree="$(gitcmd rev-parse ${PATCHEDREV}:)" || return 1 if [ x"$tree" = x"$patchedrevtree" ] && $dpatch_forbid_empty ; then printerror "Error importing ${patchname}.dpatch: No changes." echo "Either this is an empty patch (force processing with --dpatch-allow-empty)" >&2 echo "Or this is not a patch but a dpatch script which is not supported" >&2 return 1 fi if "$patch_edit" ; then sensible-editor "$gitdir/dpm/patch-log" || return $? fi commit="" if [ "$old_commit_count" -gt 0 ] ; then candidate="$(recycle_commit "$tree" "$PATCHEDREV")" || return 1 if test -z "$candidate" ; then debugout "Cannot reuse old commit $candidate, creating new commit" elif $forcecommitreuse || checkcommitmessage "$candidate" "$gitdir/dpm/patch-log" ; then debugout "Reusing old commit $candidate" commit="$candidate" else debugout "Old commit had same tree but different message, creating new commit" fi fi if test -z "$commit" ; then # git doesn't like commits happening too fast: sleep 1 # create new commit committreef "$gitdir/dpm/patch-log" "$tree" "$author" "$email" "$patch_date" -p "$PATCHEDREV" || return 1 fi gitcmd update-ref -m "git-dpm: import ${patchname}.dpatch" HEAD "$commit" "$PATCHEDREV" || return 1 PATCHEDREV="$commit" if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/patch* fi return 0 } ######### import-tar ############ ##:function detached_empty_head =head function detached_empty_head() { local commit emptytree local GIT_INDEX_FILE # While git hard-codes the empty tree to be # 4b825dc642cb6eb9a060e54bf8d69288fbee4904, # it may still to be added to the local object storage. emptytree="$(gitcmd mktree < /dev/null)" || return 1 if [ x"$emptytree" != x"4b825dc642cb6eb9a060e54bf8d69288fbee4904" ] ; then printerror "Something is very strange. The empty tree is not 4b825dc642cb6eb9a060e54bf8d69288fbee4904" return 1 fi committreem "$1" "$emptytree" "" "" "2000-01-01 00:00 UTC" || return 1 debugout "Create detached empty HEAD..." gitcmd checkout -q "$commit" || return 1 HEADBRANCH="DETACHED" } ##:function do_empty_tree =subcommand function do_empty_tree() { if [ $# -ne 1 ] ; then printerror "git-dpm empty-tree needs exactly one argument (the commit message)" return 1 fi case "$1" in -*|'') printerror "git-dpm empty-tree needs a commit message as only argument" return 1 esac checkgitdir || return 1 cdtoplevel || return 1 initheadbranch || return 1 checkclean $allow_nonclean || return 1 detached_empty_head "$1" || return 1 } ##:function import_tar commit/out =head tar_exclude_set/in function import_tar() { commit="" local filename="$1" local parents="$2" local p_commits="$3" local parent_commits="$4" local commit_msg="${5:-}" local commit_date="${6:-}" local commit_author="${7:-}" local this rest local treeonlymember parent # This is a bit over-cautionous, perhaps not only a bit. # But if anything of the following fails, I do not want to end # up with a commit having deleted everything... detached_empty_head "Empty Tree - to avoid things deleted at the wrong place" || return 1 if [ x"$commit_date" = x"auto" ] ; then debugout "trying to find date in '$filename'" commit_date="$(LC_ALL=C TZ=UTC tar --numeric-owner -tvvf "$filename" | LC_ALL=C sed -n -e 's#^[-d]......... [0-9]\+/[0-9]\+[ \t]\+[0-9]\+[ \t]\+\([12][90][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [012][0-9]:[0-9][0-9]\)[ \t].*#\1 UTC#p' | LC_ALL=C sort -r | head -n 1)" || true if test -z "$commit_date" ; then printwarn "Could not extract date from '$filename'!" fi fi debugout "Unpack '$filename'" # TODO: allow another strip-components value # TODO: readd -U once a fixed tar reached stable? tar -X "${gitdir}/dpm/tar_exclude" --exclude=.git --force-local --no-same-owner --no-same-permissions -xvvf "$filename" > "${gitdir}/dpm/tar.list" || return 1 debugout "and import into git's index". LC_ALL=C sed -n -e 's/ link to .*//' -e 's/ -> .*//' -e 's/^[-lh].........[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+\(.*\)$/\1/p' -- "${gitdir}/dpm/tar.list" | gitcmd update-index --add --stdin || return 1 debugout "removing possible left over empty folders..." LC_ALL=C sed -n -e '/[ \/]\.\/$/d' -e 's/^d.........[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+[^ ]\+[ ]\+\(.*\)$/\1/p' -- "${gitdir}/dpm/tar.list" | tac | while read dir ; do rmdir --ignore-fail-on-non-empty -- "$dir" ; done || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/tar.list" fi # it would be nice to have used --strip-components, but they would have still # appeared in the output, needing filtering there... local tree treemembercount tree="$(gitcmd write-tree)" || return 1 treemembercount="$(gitcmd ls-tree "$tree" | wc -l)" || return 1 if [ 1 -eq "$treemembercount" ] && gitcmd ls-tree "$tree" | LC_ALL=C grep -q -s '^[0-7]* tree ' ; then ##:local treeonlymember treeonlymember=$(gitcmd ls-tree --name-only "$tree") || return 1 tree="$(gitcmd rev-parse --verify "$tree":"$treeonlymember")" || return 1 fi if test -n "$commit_msg" ; then committreem "$commit_msg" "$tree" "$commit_author" "" "$commit_date" $parents || return 1 else echo "Import ${filename##*/}" > "$gitdir"/dpm/import-tar.txt || return 1 rest="$p_commits" ##:local parent for parent in $parent_commits ; do this="${rest%%|*}" rest="${rest#*|}" echo >> "$gitdir"/dpm/import-tar.txt || return 1 echo "# differences relative to $this:" \ >> "$gitdir"/dpm/import-tar.txt || return 1 echo >> "$gitdir"/dpm/import-tar.txt || return 1 gitcmd diff --stat "$parent" "$tree" \ | sed -e 's/^/# /' >> "$gitdir"/dpm/import-tar.txt || return 1 done ##:unused rest ##:invalidate rest sensible-editor "$gitdir"/dpm/import-tar.txt || return 1 committreef "$gitdir"/dpm/import-tar.txt "$tree" "$commit_author" "" "$commit_date" $parents || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/import-tar.txt" fi fi gitcmd checkout -q -f "$commit" || return 1 #returns commit id in $commit return 0 } ##:function add_parent parents/inout parent_commits/inout p_commits/inout =gitcheck function add_parent() { local object object="$(get_and_verify_commit "$1")" || return 1 parents="$parents -p $object" parent_commits="$parent_commits $object" p_commits="${p_commits}$1|" } ##:function do_import_tar =subcommand function do_import_tar() { ##:local parents parent_commits p_commits commit_date commit_author branch commit_msg parents="" parent_commits="" p_commits="" commit_date="" commit_author="" branch="" # empty message means start an editor commit_msg="" checkgitdir || return 1 : > "$gitdir/dpm/tar_exclude" || return 1 ##:local tar_exclude_set tar_exclude_set=1 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] import-tar [ ] Create a new git commit with the contents of the given targfile as contents and with the given parents as parents. (Without parents, it will be a root node). The new commit will be checked out as detached HEAD. Use "git checkout -b name" to name it afterwards. Options: --branch : Store in (and add it as parent if existing). -p : Parent to add. (Can be given multiple times). --message : Use given message instead of starting editor. --date : Date to set (instead of current). --author : Author to set. --exclude : Exclude pattern given to tar. EOF return 0 ;; --branch) shift branch="$1" ;; --branch=*) shift branch="${1#--branch=}" ;; -p|--parent) shift add_parent "$1" || return 1 ;; --parent=*) add_parent "${1#--parent=}" || return 1 ;; -m|--message) shift commit_msg="$1" ;; --message=*) commit_msg="${1#--message=}" ;; -d|--date) shift commit_date="$1" ;; --date=*) commit_date="${1#--date=}" ;; --author) shift commit_author="$1" ;; --author=*) commit_author="${1#--author=}" ;; --exclude=*) printf '%s' "${1#--exclude=}" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; --exclude) shift printf '%s' "$1" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; --) shift break ;; -*) printerror "Unrecognized import-tar option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -lt 1 ] ; then cat >&2 <<'EOF' Syntax: git-dpm [global options] import-tar [ -p ]* EOF return 1 fi ##:local filename filename="$1" shift if ! [ -f "$filename" ] ; then printerror "no such file: '$filename'!" return 1 fi if [ $# -gt 0 ] ; then printerror "Unexpected import-tar argument: '$filename'!" return 1 fi initheadbranch || return 1 cdtoplevel || return 1 checkclean $allow_nonclean || return 1 if test -n "$branch" ; then ##:local fullbranchname oldbranchhead if test x"${branch#refs/}" = x"$branch" ; then fullbranchname="refs/heads/$branch" else fullbranchname="$branch" fi oldbranchhead="$(gitcmd rev-parse --verify "$fullbranchname" 2>/dev/null || true)" if test -n "$oldbranchhead" ; then add_parent "$fullbranchname" || return 1 else printwarn "Did not find '$fullbranchname', trying to create it..." fi fi ##:local commit import_tar "$filename" "$parents" "$p_commits" "$parent_commits" "$commit_msg" "$commit_date" "$commit_author" || return 1 # returns commit in commit, should also be detached HEAD... if test -n "$branch" ; then gitcmd update-ref "$fullbranchname" "$commit" "$oldbranchhead" || return 1 if test x"$fullbranchname" = x"refs/heads/${fullbranchname#refs/heads/}" ; then gitcmd checkout "${fullbranchname#refs/heads/}" -- || return 1 else echo "The new commit was stored as '$fullbranchname'." echo "You are now in a detached head with the new commit." fi else echo "You are now in a detached head with the new commit." echo "(To store that in a branch, use git checkout -b NEWNAME)" fi if $delete_temp_files ; then rm -f -- "$gitdir/dpm/tar_exclude" fi return 0 } ##:function do_import_new_upstream allowchangesindebian =subcommand function do_import_new_upstream() { ##:local parents p_commits parent_commits connectoldupstream dorebase ##:local upstream_date upstream_author wrongupstreambranchiserror ##:local wrongpatchedbranchiserror commitmessage committopristinetar ##:local branchname notcreate no_manual_parents dotgitoption ignoredeletions ##:local allownoparent ##:local ignorewrongbranches parents="" p_commits="" parent_commits="" connectoldupstream=true dorebase=false upstream_date="" upstream_author="" wrongupstreambranchiserror=true wrongpatchedbranchiserror=true commitmessage="" committopristinetar="auto" branchname="" notcreate=true no_manual_parents=true dotgitoption="none" ignoredeletions="auto" ignorewrongbranches="false" checkgitdir || return 1 allownoparent="$(gitcmd config --bool --get dpm.importwithoutparent || echo default)" true > "$gitdir/dpm/newcomponents" || return 1 true > "$gitdir/dpm/newcomponents.full" || return 1 true > "$gitdir/dpm/tar_exclude" || return 1 ##:local tar_exclude_set tar_exclude_set=1 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] import-new-upstream [options] <.orig.tar file to import> Import and record a new upstream tarball. (If you do not want to have the whole tarball imported, prepare a suitable upstream branch yourself and use git-dpm record-new-upstream instead). Possible local options: -p parent: Add the given parent as parent. (Can be given multiple time). You can include upstream's history by naming the branch you have upstream's commit for that version. --detached: Do not add the old upstream branch as parent. --rebase-patched: Call git-dpm rebase-patched afterwards to rebase possible patches to the new upstream. -m MSG: Commit message to use. --use-strange-upstream-branch: --use-strange-patched-branch: Discard any possible local changes to (or not automatically detected stale states of ) the branches --upstream-date (|auto): Set the given date as author commit time of imported .orig files. (if date is 'auto', try to determine from the file's contents). --component file.orig-component.tar.gz: add component tarball --exclude pattern: exclude pattern given to tar. --pristine-tar-commit: call pristine-tar commit to save the tarballs in git. EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --init) notcreate=false ;; --branch) shift branchname="$1" ;; --branch=*) branchname="${1#--branch=}" ;; --allow-no-parent) allownoparent=true ;; -p|--parent) shift no_manual_parents=false add_parent "$1" || return 1 ;; --parent=*) no_manual_parents=false add_parent "${1#--parent=}" || return 1 ;; --detached) connectoldupstream=false ;; --rebase-patched|--rebase) dorebase=true ;; --no-rebase-patched|--no-rebase) dorebase=false ;; --ignore-unclean-branches) ignorewrongbranches=true ;; --use-strange-upstream-branch) wrongupstreambranchiserror=false ;; --use-strange-patched-branch) wrongpatchedbranchiserror=false ;; --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; --upstream-date=*) upstream_date="${1#--upstream-date=}" ;; --upstream-date) shift upstream_date="$1" ;; --upstream-author=*) upstream_author="${1#--upstream-author=}" ;; --upstream-author) shift upstream_author="$1" ;; --exclude=*) printf '%s' "${1#--exclude=}" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; --exclude) shift printf '%s' "$1" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; -m) shift commitmessage="$1" ;; --component) shift ##:local componentfilename componentbasename componentfilename="$1" componentbasename="${1##*/}" if ! test -e "$componentfilename" ; then printerror "No such file: '$componentfilename'" return 1 fi case "$componentbasename" in *.orig-*.tar*) ;; *) printerror "'$componentbasename' is not of the form *.orig-*.tar*" return 1 ;; esac ##:local origsha origsize origsha="$(sha1sum -b -- "$componentfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$componentfilename")" || return 1 debugout "$componentbasename has sha1 $origsha and size $origsize" printf 'component:%s:%s:%s\n' "$origsha" "$origsize" "$componentbasename" >> "$gitdir/dpm/newcomponents" || return 1 printf '%s\n' "$componentfilename" >> "$gitdir/dpm/newcomponents.full" || return 1 ##:invalidate origsha origsize ##:invalidate componentfilename componentbasename ;; --ptc|--p-t-c|--pristine-tar|--pristine-tar-commit) committopristinetar=true ;; --no-ptc|--no-p-t-c|--no-pristine-tar|--no-pristine-tar-commit) committopristinetar=false ;; --) shift break ;; -*) printerror "Unrecognized import-new-upstream option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -lt 1 ] ; then cat >&2 <<'EOF' Syntax: git-dpm [global options] import-new-upstream [ --detached ] [ -p ]* <.orig.tar file to import> EOF return 1 fi ##:local origfilename origname origfilename="$1" shift if ! [ -f "$origfilename" ] ; then printerror "no such file: '$origfilename'!" return 1 fi origname=${origfilename##*/} case "$origname" in *.orig.tar*) ;; *) printerror "'$origname' does not contain .orig.tar!" return 1 ;; esac debugout "look at '$origfilename'..." origsha="$(sha1sum -b -- "$origfilename")" || return 1 origsha="${origsha%% *}" origsize="$(stat -L --printf '%s' "$origfilename")" || return 1 initbranchvariables "$branchname" "$notcreate" || return 1 if test -n "$branchname" && test "x$branchname" != x"$DEBIANBRANCH" ; then printerror "'$branchname' not a suitable name for a Debian branch." return 1 fi ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi if $notcreate ; then case "$allownoparent" in true|default) ;; false) if $no_manual_parents ; then printerror "No parent commit specified (and dpm.importWithoutParent set to false)" echo "Use --allow-no-parent to override that once." return 1 fi ;; *) printerror "Internal Error: strange allownoparent value" return 1 ;; esac else connectoldupstream=false dorebase=false if test -n "$DEBIANREV" ; then printerror "'--init' given, but '$DEBIANBRANCH' already exists!" return 1 fi if test -n "$UPSTREAMREV" ; then if $ignorewrongbranches ; then gitcmd branch -D "$UPSTREAMBRANCH" || return 1 else printerror "Cowardly refusing to create '$DEBIANBRANCH', as '$UPSTREAMBRANCH' already exists." return 1 fi fi if test -n "$PATCHEDREV" ; then if $ignorewrongbranches ; then gitcmd branch -D "$PATCHEDBRANCH" || return 1 else printerror "Cowardly refusing to create '$DEBIANBRANCH', as '$PATCHEDBRANCH' already exists." return 1 fi fi fi cdtoplevel || return 1 checkclean $allow_nonclean || return 1 if test -n "$DEBIANREV" ; then parsedpmcontrolfile "" || return 1 if $ignorewrongbranches && test -n "$UPSTREAMREV" && [ x"$UPSTREAMREV" != x"$control_upstream" ] ; then printwarn "$UPSTREAMBRANCH was out of date, deleting first..." gitcmd branch -D "$UPSTREAMBRANCH" || return 1 UPSTREAMREV="" fi if $ignorewrongbranches && test -n "$PATCHEDREV" && [ x"$PATCHEDREV" != x"$control_patched" ] ; then printwarn "$PATCHEDBRANCH was out of date, deleting first..." gitcmd branch -D "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi else true > "$gitdir"/dpm/oldcontrol fi if test "$committopristinetar" = "auto" ; then committopristinetar="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmPristineTarCommit" || gitcmd config --bool --get dpm.pristineTarCommit || echo false)" fi ##:local filenamebeforeorig dummy1 dummy2 dummy3 componentbasename filenamebeforeorig="${origname%.orig.tar*}" while IFS=":" read dummy1 dummy2 dummy3 componentbasename ; do ##:unused dummy1 dummy2 dummy3 case "$componentbasename" in ${filenamebeforeorig}.orig-*.tar*) ;; *) printerror "Component filename '$componentbasename' does not match '${filenamebeforeorig}.orig-*.tar*'!" return 1 ;; esac done < "$gitdir/dpm/newcomponents" ##:local upstream if test -n "$UPSTREAMREV" ; then if $connectoldupstream && [ x"$UPSTREAMREV" != x"$control_upstream" ] ; then if $wrongupstreambranchiserror ; then printerror "Cowardly refusing to run as '$UPSTREAMBRANCH' differs from recorded '$control_upstream'!." echo "Use --ignore-unclean-branches to delete/ignore it." >&2 echo "Or if you manually modified that branch to contain more history and want to incorporate that (and only then) use --use-strange-upstream-branch." >&2 return 1 else printwarn "Using unrecorded '$UPSTREAMBRANCH'." fi fi upstream="$UPSTREAMBRANCH" else upstream="$control_upstream" fi if $dorebase && test -n "$PATCHEDREV" && [ x"$PATCHEDREV" != x"$control_patched" ] && $wrongpatchedbranchiserror ; then printerror "'$PATCHEDBRANCH' differs from recorded '$control_patched'!" echo "If that branch is in some old state, delete it or run with --ignore-unclean-branches." >&2 echo "If you have unrecorded changes there you want to use for the new version, use --use-strange-patched-branch." >&2 return 1 fi if $connectoldupstream ; then ##:local u u=$(gitcmd rev-parse "$upstream") || return 1 parents="-p $u $parents" parent_commits="$u $parent_commits" p_commits="$upstream|${p_commits}" fi true > "$gitdir/dpm/newcomponents.trees" || return 1 ##:local filenames origcmessage filenames="" if test -n "$upstream_author" ; then origcmessage="$origname" else origcmessage="Import $origname" fi ##:local commit if test -s "$gitdir/dpm/newcomponents" ; then while read componentfilename ; do ##:local component componentbasename="${componentfilename##*/}" component="${componentbasename#${filenamebeforeorig}.orig-}" component="${component%.tar*}" ##:local commit committree import_tar "$componentfilename" "" "" "" "Import $componentbasename" "$upstream_date" "$upstream_author" || return 1 committree="$(gitcmd rev-parse --verify "${commit}:")" || return 1 printf '%s:%s:%s\n' "$component" "$committree" "$componentfilename" >> "$gitdir/dpm/newcomponents.trees" || return 1 filenames="$filenames, $componentbasename" ##:invalidate componentfilename componentbasename component commit done < "$gitdir/dpm/newcomponents.full" # extra commit, so one can pristine-tar it... import_tar "$origfilename" "" "" "" "$origcmessage" "$upstream_date" "$upstream_author" || return 1 ##:local origonlytree origonlytree="$(gitcmd rev-parse --verify "${commit}:")" || return 1 if test -n "$parent_commits" && gitcmd rev-list --pretty=tformat:%T $parent_commits | LC_ALL=C grep -q "^${origonlytree}\$" ; then debugout "$origonlytree already a tree in the history, so not including an extra commit for it" else add_parent "$commit" || return 1 ##:unused p_commits fi ##:local tree create_tree_with_dirs "$origonlytree" "$gitdir/dpm/newcomponents.trees" || return 1 printf ':%s:%s\n' "$origonlytree" "$origfilename" >> "$gitdir/dpm/newcomponents.trees" || return 1 committreem "Import ${origname}$filenames" "$tree" "" "" "" $parents || return 1 gitcmd checkout -q "$commit" || return 1 HEADBRANCH=DETACHED else import_tar "$origfilename" "$parents" "$p_commits" "$parent_commits" "$origcmessage" "$upstream_date" "$upstream_author" || return 1 # returns commit in commit, should also be detached HEAD... ##:local committree committree="$(gitcmd rev-parse "${commit}:")" || return 1 printf ':%s:%s\n' "$committree" "$origfilename" >> "$gitdir/dpm/newcomponents.trees" || return 1 fi debugout "setting upstream branch..." if test -n "$UPSTREAMREV" ; then gitcmd update-ref -m "imported $origname" refs/heads/"$UPSTREAMBRANCH" "$commit" "$UPSTREAMREV" || return 1 gitcmd checkout -q "$UPSTREAMBRANCH" || return 1 else gitcmd checkout -q -b "$UPSTREAMBRANCH" || return 1 echo "Created $UPSTREAMBRANCH with contents of $origname and parents $parent_commits" fi UPSTREAMREV="$commit" HEADBRANCH="$UPSTREAMBRANCH" debugout "Record new upstream branch..." ##:local initialcommit commitmessage2 if $notcreate ; then initialcommit="" if test -z "$commitmessage" ; then commitmessage="record new upstream branch created by importing $origname$filenames" commitmessage2="record new upstream branch created by importing $origname$filenames and merge it" else commitmessage2="$commitmessage" fi else initialcommit="${commit}" if test -z "$commitmessage" ; then commitmessage="Initialize project by importing $origname$filenames" fi commitmessage2="You should never see this message I hope" fi record_new_upstream_branch false "$dorebase" "$commitmessage" "$commitmessage2" "$gitdir/dpm/newcomponents" "$initialcommit" || return 1 if $notcreate && test x"$allownoparent" = x"default" ; then if $no_manual_parents ; then printwarn "No parent commit specified." if $connectoldupstream ; then echo >&2 \ "This means the upstream branch was created from the .orig.tar with only the"\ "old upstream branch as parent (but not any possible upstream git history)." else echo >&2 \ "This means the upstream branch is only the .orig.tar imported without history." fi echo >&2 \ "Use 'git config dpm.importWithoutParent true' to no longer show this warning." echo >&2 \ "or 'git config dpm.importWithoutParent false' to make this an hard error." fi fi check_new_pristine_tar "$gitdir/dpm/newcomponents.trees" "$committopristinetar" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/newcomponents.*" "$gitdir/dpm/tar_exclude" fi } ########## import-dsc ############ ##:function findshaindsc shaandsize/out dscfilename DEBUG function findshaindsc() { local filename="$1" local knownsize="$2" local filetouse="$3" local actualsize debugout "Looking for sha1 sum of $filename in $dscfilename" # TODO: check if a dsc file lists a file twice? shaandsize="$(LC_ALL=C sed -n -e '/^Checksums-Sha1:/,/^\([^ ]\|$\)/s/^ \([0-9a-f]\{40\}\) \+\([0-9]\+\) \+'"$(sedsafe "$filename")"'$/dsc:\2:\1/p' "$dscfilename")" || return 1 case "$shaandsize" in '') debugout "no sha1 sum found, looking at file..." if ! test -e "$filetouse" ; then printerror "No such file '$filetouse'!" return 1 fi actualsize="$(stat -L --printf '%s' "$filetouse")" || return 1 if [ "$knownsize" -ne "$actualsize" ] ; then printerror "File $filetouse has different size than announced in $dscfilename!" return 1 fi shaandsize="$(sha1sum -b -- "$filetouse")" || return 1 shaandsize="${knownsize}:${shaandsize%% *}" ;; dsc:*:*:*) printerror "Confusing data from $dscfilename. Perhaps two sha1 sums for $filename listed?" return 1 ;; dsc:${knownsize}:*) debugout "Found .dsc: '$shaandsize' ('dsc':size:sha1)" ;; *) printerror "Different sizes for $filename listed in $dscfilename!" return 1 ;; esac return 0 } ##:function checkfilehash function checkfilehash() { local filename="$1" local size="${2%%:*}" local shasum="${2#*:}" local shafound local sizefound sizefound="$(stat -L --printf '%s' "$filename")" || return 1 if [ "$size" -ne "$sizefound" ] ; then printerror "File $filename has wrong size ($size expected)!" return 1 fi shafound="$(sha1sum -b -- "$filename")" || return 1 case "$shafound" in ${shasum}" "*) ;; *) printerror "File $filename has wrong sha1sum ($shasum expected)!" return 1 esac return 0 } ##:function parse_dsc dscfilename/out dirname/out founddifffilename/out foundorigfilename/out founddebianfilename/out foundnativefilename/out origsize/out format/out fversion/out fsource/out quilt_build_deps/out dpatch_build_deps/out =gitcheck function parse_dsc() { local md5sum size filename rest local component shaandsize local fileversion origfileversion fformat dscfilename="$1" dirname="$(dirname "$dscfilename")" || return 1 shift if ! test -f "$dscfilename" ; then printerror "Cannot find $dscfilename" return 1 fi true > "$gitdir"/dpm/newcomponents.import || return 1 # Quick & Dirty .dsc parser: debugout "Parsing .dsc file $dscfilename" fsource="$(grep "^Source: " "$dscfilename" || echo non-found)" fsource="${fsource#Source: }" case "$fsource" in (non-found) printerror "Missing Source in $dscfilename" return 1 ;; ("* *") printerror "Cannot parse Source header in $dscfilename" return 1 ;; esac debugout "Name determined to be '$fsource'" fversion="$(grep "^Version: " "$dscfilename" | head -n 1 || echo non-found)" fversion="${fversion#Version: }" case "$fversion" in (non-found) printerror "Missing Version in $dscfilename" return 1 ;; ("* *") printerror "Cannot parse Version header in $dscfilename" return 1 ;; esac ##:local fileversion origfileversion fformat fileversion="${fversion#*:}" origfileversion="${fileversion%-*}" debugout "Version determined to be '$fversion', without epoch '$fileversion', without epoch and revision '$origfileversion'" fformat="$(grep "^Format:" "$dscfilename" || echo non-found)" case "$fformat" in (non-found) if LC_ALL=C grep -q -s "^Standards-Version: " "$dscfilename" ; then printwarn "$dscfilename does not have a Format: field, assuming old 1.0" format="old" else printerror "$dscfilename does not look like a .dsc (missing Format)" return 1 fi ;; ("Format: 1.0") format="old" ;; ("Format: 3.0 (native)") format="native" ;; ("Format: 3.0 (quilt)") format="quilt" ;; ("*") printerror "Unsupported format '${fformat#Format: }' of $dscfilename" return 1 ;; esac debugout "Format determined: $format" awk 'BEGIN { infiles = 0} \ /^Files:[ ]*/ {infiles = 1 ; next} \ /^ / && infiles { print ; next} \ { infiles = 0 ; next } \ ' "$dscfilename" > "$gitdir"/dpm/dscfiles foundorigfilename="" foundnativefilename="" founddifffilename="" founddebianfilename="" ##:local md5sum size filename rest while read md5sum size filename rest ; do if test -n "$rest" || test -z "$filename"; then printerror "Unparseable line in $dscfilename Files: $md5sum $size $filename $rest" return 1 fi debugout "lists file '$filename'..." case "$filename" in (${fsource}_${fileversion}.tar.*) foundnativefilename="$filename" origsize="$size" ;; (${fsource}_${origfileversion}.orig.tar.*) foundorigfilename="$filename" origsize="$size" ;; (${fsource}_${origfileversion}.orig-*.tar.*) ##:local component component="${filename#${fsource}_${origfileversion}.orig-}" component="${component%.tar.*}" if [ x"${component#* }" != x"$component" ] || [ x"${component#*:}" != x"$component" ] || [ x"${component#*/}" != x"$component" ] ; then printerror "Unsupported component name '$component' in filename '$filename'" return 1 fi ##:local shaandsize findshaindsc "$filename" "$size" "$dirname/$filename" || return 1 printf '%s:%s:%s\n' "${shaandsize#dsc:}" "$component" "$filename" >> "$gitdir"/dpm/newcomponents.import || return 1 ##:invalidate shaandsize component ;; (${fsource}_${fileversion}.debian.tar.*) founddebianfilename="$filename" ;; (${fsource}_${fileversion}.diff.*) founddifffilename="$filename" ;; (*) printerror "Unexpected file $filename in $dscfilename" return 1 esac done < "$gitdir"/dpm/dscfiles if $delete_temp_files ; then rm -f -- "$gitdir/dpm/dscfiles" fi quilt_build_deps="" dpatch_build_deps="" # Fail out early, fail out often... case $format in (old) if test -n "$founddebianfilename" ; then printerror "$dscfilename is Format 1.0 but contains a .debian.tar" return 1 fi if test -n "$founddifffilename" ; then if test -z "$foundorigfilename" ; then printerror "$dscfilename is Format 1.0 and contains a .diff but no .orig.tar was found" return 1 fi if test -n "$foundnativefilename" ; then printerror "$dscfilename is Format 1.0 and contains a .diff but a non-orig .tar was found" return 1 fi format=diff else if test -n "$foundorigfilename" ; then printerror "$dscfilename is Format 1.0 and contains no .diff but a .orig.tar" return 1 fi if test -z "$foundnativefilename" ; then printerror "$dscfilename did not contain .diff nor .tar" return 1 fi format=oldnative fi # make some guessing more realistic quilt_build_deps="$(awk 'BEGIN { inbd = 0} inbd && ! /^ / { inbd = 0 ; next } /^Build-Depends:/ {inbd = 1} inbd == 0 { next } /\/ { print "quilt" } { next } ' "$dscfilename")" || return 1 dpatch_build_deps="$(awk 'BEGIN { inbd = 0} inbd && ! /^ / { inbd = 0 ; next } /^Build-Depends:/ {inbd = 1} inbd == 0 { next } /\/ { print "quilt" } { next } ' "$dscfilename")" || return 1 ;; (quilt) if test -z "$founddebianfilename" ; then printerror "$dscfilename is Format 3.0 (quilt), but no .debian.tar was found" return 1 fi if test -z "$foundorigfilename" ; then printerror "$dscfilename is Format 3.0 (quilt), but no .orig.tar was found" return 1 fi if test -n "$foundnativefilename" ; then printerror "$dscfilename is Format 3.0 (quilt), but a native .tar was found" return 1 fi if test -n "$founddifffilename" ; then printerror "$dscfilename is Format 3.0 (quilt), but a .diff was found" return 1 fi ;; (native) if test -n "$founddebianfilename" ; then printerror "$dscfilename is Format 3.0 (native), but a .debian.tar was found" return 1 fi if test -n "$foundorigfilename" ; then printerror "$dscfilename is Format 3.0 (native), but a .orig.tar was found" return 1 fi if test -z "$foundnativefilename" ; then printerror "$dscfilename is Format 3.0 (native), but no native .tar was found" return 1 fi if test -n "$founddifffilename" ; then printerror "$dscfilename is Format 3.0 (native), but a .diff was found" return 1 fi ;; (*) printerror "Confused (what is my format)?" return 1 esac } ##:function douncompress function douncompress() { case "$1" in (*.diff|*.patch) cat "$1" ;; (*.gz) gunzip -c "$1" ;; (*.bz2) bunzip2 -c "$1" ;; (*.lzma) unlzma -c "$1" ;; (*.uu) uudecode -o - "$1" ;; (*) printerror "Unsupported/unknown compression of $1" return 1 esac } function recycle_commit() { LC_ALL=C sed -n -e 's/^\([^ ]*\) '"$1"' '"$2"'$/\1/p' -- "$gitdir"/dpm/oldcommits | head -n 1 } # tree and parent must be full sha1-hex ##:function recycle_or_create_commit commit/out =gitcheck function recycle_or_create_commit() { local message="$1" local tree="$2" local parent="$3" commit="$(recycle_commit "$tree" "$parent")" || return 1 if test -z "$commit" ; then committreem "$message" "$tree" "" "" "" -p "$parent" || return 1 fi # returns in $commit } # This function is called from if, ##:function import_patches_from_dsc apply_patches_first preapplied_patches patch_system verbatimDEBIANtree verbatimDEBIANREV verbatimUPSTREAMREV verbatimPATCHEDREV old_commit_count foundnativefilename foundorigfilename founddifffilename founddebianfilename fsource fversion imported_patches/inout dpatch_forbid_empty tree/out =patchoptions function import_patches_from_dsc() { local commit headtree difftree patchedrevtree patchname patchedbase no_patches filename # After importing a 1.0 format dsc, # by user choosing or autodetection # a quilt/dpatch/simple series to apply was detected. # Now import that: case $patch_system in (quilt) if ! test -f debian/patches/series ; then printwarn "No debian/patches/series file found. Assuming that means there are not patches..." tree="$verbatimDEBIANtree" return 0 fi ;; (dpatch) if ls debian/patches/00list.* 2>/dev/null ; then printwarn "There seem to be architecture dependent patches. Those will not be imported." fi if ! test -f debian/patches/00list ; then printwarn "No debian/patches/00list file found. Assuming that means there are not patches..." tree="$verbatimDEBIANtree" return 0 fi ;; (simple) rm -rf "$gitdir/dpm/import" || return 1 mkdir "$gitdir/dpm/import" || return 1 find debian/patches -type f -name "*.patch" \( -name "*.diff" -o -name "*.diff.gz" -o -name "*.diff.bz2" -o -name "*.diff.uu" -o -name "*.patch" -o -name "*.patch.gz" -o -name "*.patch.bz2" -o -name "*.patch.uu" \) -printf '%f\n' | sort > "$gitdir"/dpm/import/series || return 1 ##:local no_patches filename no_patches=true while read filename ; do douncompress debian/patches/"$filename" >"$gitdir"/dpm/import/"${filename//\//__slash__}" || return 1 no_patches=false done <"$gitdir/dpm/import/series" if $no_patches ; then printwarn "No patches found in debian/patches" if $delete_temp_files ; then rm -f -r -- "$gitdir/dpm/import" fi tree="$verbatimDEBIANtree" return 0 fi ;; esac ##:local patchedbase if $apply_patches_first ; then patchedbase="$verbatimUPSTREAMREV" if [ x"$verbatimPATCHEDREV" != x"$verbatimUPSTREAMREV" ] ; then debugout "applying patches directly upon upstream" fi else patchedbase="$verbatimPATCHEDREV" fi PATCHEDREV="$patchedbase" gitcmd checkout -q -b "$PATCHEDBRANCH" "$PATCHEDREV" || return 1 echo "Switched to new branch '$PATCHEDBRANCH'" HEADBRANCH="$PATCHEDBRANCH" debugout "Trying to apply $patch_system patches found in the package..." case $patch_system in (quilt) apply_patches "${verbatimDEBIANREV}:debian/" true || return 1 ;; (dpatch) apply_dpatch_patches "${verbatimDEBIANREV}:debian/" || return 1 ;; (simple) ##:local patchname while read patchname ; do echo "Applying '$patchname'..." cp "$gitdir"/dpm/import/"${patchname//\//__slash__}" "$gitdir"/dpm/patchfile || return 1 apply_cdbs_patch || return 1 debugout "patch $patchname applied..." done <"$gitdir/dpm/import/series" if $delete_temp_files ; then rm -f -r -- "$gitdir/dpm/import" fi ;; esac if [ x"$PATCHEDREV" = x"$patchedbase" ] ; then printwarn "Strange - no patches were applied..." gitcmd checkout -q "$verbatimDEBIANREV" || return 1 HEADBRANCH="DETACHED" gitcmd branch -d "$PATCHEDBRANCH" || return 1 PATCHEDREV="" tree="$verbatimDEBIANtree" return 0 fi imported_patches=true if $apply_patches_first && [ x"$verbatimPATCHEDREV" != x"$verbatimUPSTREAMREV" ] ; then if $preapplied_patches ; then ##:local difftree patchedrevtree difftree="$(gitcmd rev-parse "$verbatimPATCHEDREV":)" || return 1 patchedrevtree="$(gitcmd rev-parse "$PATCHEDREV":)" || return 1 if [ x"$patchedrevtree" = x"$difftree" ] ; then debugout "All changes in the diff were already in debian/patches/" else debugout "Adding an additional patch setting the tree to what was found in .diff" ##:local commit recycle_or_create_commit "Changes found in $founddifffilename" "$difftree" "$PATCHEDREV" || return 1 gitcmd checkout -q "$commit" || return 1 gitcmd update-ref refs/heads/"$PATCHEDBRANCH" "$commit" "$PATCHEDREV" || return 1 PATCHEDREV="$commit" gitcmd checkout -q "$PATCHEDBRANCH" || return 1 fi else echo "Try to pick the differences found in .diff on top of the patches" gitcmd cherry-pick -r "$verbatimPATCHEDREV" || return 1 ##:local commit headtree headtree="$(gitcmd rev-parse HEAD:)" || return 1 commit="$(recycle_commit "$headtree" "$PATCHEDREV")" || return 1 if test -n "$commit" ; then debugout "can reuse old commit instead..." gitcmd checkout -q "$commit" || return 1 gitcmd update-ref refs/heads/"$PATCHEDBRANCH" "$commit" || return 1 PATCHEDREV="$commit" gitcmd checkout -q "$PATCHEDBRANCH" || return 1 else PATCHEDREV="$(gitcmd rev-parse HEAD)" || return 1 fi fi fi # returns the new tree as $tree debugout "create tree like '$PATCHEDBRANCH' but debian/ from the .dsc..." # TODO: what happens if there is no debian/ ? create_tree_with_new_debian "$PATCHEDREV" "$verbatimDEBIANtree:debian" || return 1 return 0 } ##:function select_patch_system patch_system/inout selected_patch_system/inout function select_patch_system() { patch_system="$1" selected_patch_system="$1" case "$patch_system" in # aliases cdbs) patch_system=simple ;; cdbs-first) patch_system=simple-first ;; cdbs-applied) patch_system=simple-applied ;; # supported auto|none|quilt|dpatch|history|simple|quilt-first|quilt-applied|dpatch-first|dpatch-applied|simple-first|simple-applied) ;; # unsupported *) printerror "Unknown patch system '$patch_system'!" return 1 ;; esac } # apply a .diff.gz file and return two trees with # all the .diff.gz applied and one only without debian/ changed. # does not need a working directory ##:function applydscdiff dsctree/out prepatchedtree/out =gitcheck function applydscdiff() { local upstreamtree patchfilename GIT_INDEX_FILE local debianrules debiantree olddebiantree upstreamtree="$1" patchfilename="$2" rm -f -- "$gitdir/dpm/tmpindex" || return 1 GIT_INDEX_FILE="$gitdir/dpm/tmpindex" export GIT_INDEX_FILE debugout "Read $upstreamtree into $gitdir/dpm/tmpindex" gitcmd read-tree "$upstreamtree" || return 1 olddebiantree="$(gitcmd rev-parse --verify -q "${upstreamtree%:}":debian || [ "$?" -eq 1 ])" || return 1 debugout "apply diff file '$patchfilename' to index..." douncompress "$patchfilename" | \ gitcmd apply --index --cached --whitespace=nowarn -p1 - || return 1 debugout "look for debian/rules to make it executeable..." debiantree="$(gitcmd write-tree --prefix=debian/)" || return 1 debianrules="$(gitcmd rev-parse --verify -q "$debiantree":rules || [ "$?" -eq 1 ])" || return 1 if test -n "$debianrules" ; then gitcmd update-index --cacheinfo 100755 "$debianrules" "debian/rules" || return 1 else printwarn "There does not seem to be a debian/rules file after applying $patchfilename" fi debugout "writing index stored in $gitdir/dpm/tmpindex into tree" dsctree="$(gitcmd write-tree)" || return 1 debugout "creating a tree with only the non-debian/ changes..." gitcmd rm --cached --ignore-unmatch -f -q -r -- debian/ || return 1 if test -n "$olddebiantree" ; then gitcmd read-tree --prefix=debian/ "$olddebiantree" || return 1 fi prepatchedtree="$(gitcmd write-tree)" || return 1 unset GIT_INDEX_FILE rm -- "$gitdir/dpm/tmpindex" || return 1 } ##:function import_dsc dpatch_forbid_empty committopristinetar allownoparent =patchoptions upstream_author upstream_date connectoldupstream parents p_commits parent_commits branchname patch_system selected_patch_system imported_patches has_unmanaged_differences upstreamtouse verbatimbranchname no_manual_parents use_changelog import_native =gitcheck =head =dpm_control =branches =globalcmdvars oldDEBIANREV tar_exclude_set/in ##:function do_import_dsc dpatch_forbid_empty =subcommand =patchoptions/local function do_import_dsc() { ##:local upstream_author upstream_date connectoldupstream ##:local parents p_commits parent_commits ##:local branchname ##:local patch_system selected_patch_system imported_patches ##:local has_unmanaged_differences upstreamtouse verbatimbranchname ##:local committopristinetar ##:local no_manual_parents allownoparent use_changelog import_native patch_author="" patch_fallbackauthor="" patch_date="" patch_edit=false upstream_date="" upstream_author="" connectoldupstream=true parents="" p_commits="" parent_commits="" branchname="HEAD" forcecommitreuse=false patch_system="auto" selected_patch_system="" imported_patches=false has_unmanaged_differences=false upstreamtouse="" verbatimbranchname="" lines_must_match=1 committopristinetar="auto" patch_include_name=false patch_include_category=false no_manual_parents=true allownoparent="default" import_native=false use_changelog=false checkgitdir || return 1 : > "$gitdir/dpm/tar_exclude" || return 1 ##:local tar_exclude_set tar_exclude_set=1 while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] import-dsc Import a dsc file. --branch : Use instead what HEAD points to as branch to create or update. -e, --edit-patches: add opportunity to edit patches imported -f, --force-reuse: use old commits for patches, even if the description changed. --patch-system How to import patches found in a 1.0 format source package. auto: (default) try to determine directly none: don't try to find any patches (only the .diff gets applied) history: don't try to find any patches. But if the upstream tarball is the same, generate a new patch on top of the old changes. (Some as 'none' if there is no previous version.) quilt: extract and apply debian/patches/series quilt-style patches dpatch: extract and apply debian/patches/00list dpatch-style patches (only real patches are supported, not arbitrary scripts). simple: extract and apply a cdbs simple-patchsys style debian/patches/ (quilt|dpatch|simple)-first like quilt|dpatch|simple, but apply patches before applying .diff (quilt|dpatch|simple)-applied like *-first, but assume patches are already applied in .diff --upstream-to-use : Assume the .orig.tar is already available as the named commit and use that instead of importing or reusing anything else. (Your responsibility to make sure it is equal enough to the file contents). --upstream-date (|auto): Set the given date as author commit time of imported .orig files. (if date is 'auto', try to determine from the file's contents). --parent : if creating a new commit for the .orig.tar, add this add parent node (can be repeated) --detached: if creating a new commit for the .orig.tar, do not make the old upstream a parent node --patch-author: force author of patches imported --patch-default-author: author for patches if none found --patch-context : minimal lines of context to match (default: 1) --pristine-tar-commit: call pristine-tar to commit tarballs EOF return 0 ;; --allow-native-import) import_native=true ;; -e|--edit|--edit-patch|--edit-patches) patch_edit=true ;; --patch-system) shift select_patch_system "$1" || return 1 ;; --patch-system=*) select_patch_system "${1#--patch-system=}" || return 1 # remove that variable or actually use it? ##:unused selected_patch_system ;; --verbatim|--verbatim-branch) shift verbatimbranchname="$1" ;; --verbatim=*|--verbatim-branch=*) verbatimbranchname="${1#--verbatim=}" verbatimbranchname="${verbatimbranchname#--verbatim-branch=}" ;; --patch-author|--author) shift patch_author="$1" ;; --patch-author=*|--author=*) patch_author="${1#--patch-author=}" patch_author="${patch_author#--author=}" ;; --patch-defaultauthor|--patch-default-author|--default-author|--defaultauthor) shift patch_fallbackauthor="$1" ;; --patch-defaultauthor=*|--patch-default-author=*|--default-author=*|--defaultauthor=*) patch_fallbackauthor="${1#--patch-default-author=}" patch_fallbackauthor="${patch_fallbackauthor#--patch-defaultauthor=}" patch_fallbackauthor="${patch_fallbackauthor#--defaultauthor=}" patch_fallbackauthor="${patch_fallbackauthor#--default-author=}" ;; --patch-context|-C) shift lines_must_match="$1" ;; -C*|--patch-context=*) lines_must_match="${1#-C}" lines_must_match="${lines_must_match#--context=}" lines_must_match="${lines_must_match#--patch-context=}" ;; --detached-upstream|--detached) connectoldupstream=false ;; --upstream-date=*) upstream_date="${1#--upstream-date=}" ;; --upstream-date) shift upstream_date="$1" ;; --upstream-author=*) upstream_author="${1#--upstream-author=}" ;; --upstream-author) shift upstream_author="$1" ;; --upstream-to-use) shift upstreamtouse="$(get_and_verify_commit "$1")" || return 1 ;; --upstream-to-use=*) upstreamtouse="$(get_and_verify_commit "${1#--upstream-to-use}")" || return 1 ;; --parent|--upstream-parent) shift no_manual_parents=false add_parent "$1" || return 1 ;; --parent=*|--upstream-parent=*) no_manual_parents=false ##:local p p=${1#--upstream-parent=} add_parent "${p#--parent=}" || return 1 ;; --allow-no-parent) allownoparent=true ;; -f|--force-reuse|--force-commit-reuse) forcecommitreuse=true ;; -b|--branch|--branch-name) shift branchname="$1" ;; --branch=*|--branch-name=*) shift branchname="${1#--branch-name=}" branchname="${branchname#--branch=}" ;; --ptc|--p-t-c|--pristine-tar|--pristine-tar-commit) committopristinetar=true ;; --no-ptc|--no-p-t-c|--no-pristine-tar|--no-pristine-tar-commit) committopristinetar=false ;; --record-patch-name) patch_include_name=true ;; --record-patch-category) patch_include_category=true ;; --use-changelog) use_changelog=true ;; --tar-exclude=*) printf '%s' "${1#--tar-exclude=}" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; --tar-exclude) shift printf '%s' "$1" >> "${gitdir}/dpm/tar_exclude" || return 1 ;; # Also available as global options --dpatch-allow-empty) dpatch_forbid_empty=false ;; # usual stuff: --) shift break ;; -*) printerror "Unrecognized import-dsc option '$1'!" return 1 ;; *) break ;; esac shift done if test -n "$upstreamtouse" && test -n "$parents" ; then printerror "--upstream-to-use and --parent cannot be mixed!" return 1 fi if test -n "$upstreamtouse" && ! $connectoldupstream ; then printwarn "--detached-upstream has no effect with --upstream-to-use!" return 1 fi if [ $# -eq 0 ] ; then printerror "no dsc file given as argument" return 1 fi ##:local dsc dsc="$1" shift if [ $# -gt 0 ] ; then printerror "too many arguments" return 1 fi if test x"$allownoparent" = x"default" ; then allownoparent="$(gitcmd config --bool --get dpm.importwithoutparent || echo default)" fi cdtoplevel || return 1 checkclean $allow_nonclean || return 1 true > "$gitdir/dpm/oldcontrol" || return 1 initbranchvariables "${branchname}" false || return 1 if test "$committopristinetar" = "auto" ; then committopristinetar="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmPristineTarCommit" || gitcmd config --bool --get dpm.pristineTarCommit || echo false)" fi ##:local oldDEBIANREV oldDEBIANREV="" if test -n "$DEBIANREV" ; then oldDEBIANREV="$DEBIANREV" debugout "$DEBIANBRANCH exists. Assume update on top." parsedpmcontrolfile "" || return 1 # we will do everything new and only using the old stuff # as parents. So no need to keep it in any branches, # thus removing it to avoid many ifs later... if test -n "$PATCHEDREV" ; then if [ "$PATCHEDREV" != "$control_patched" ; then printerror "branch $PATCHEDBRANCH exists and not up to date. Do something against this first (for example deleting it if you do not care for its contents)." return 1 fi debugout "Removing old $PATCHEDBRANCH, to avoid problems later." gitcmd branch -D "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi if test -n "$UPSTREAMREV" ; then if [ "$UPSTREAMREV" != "$control_upstream" ] ; then printerror "branch $UPSTREAMBRANCH exists and not up to date. Do something against this first (for example deleting it if you do not care for its contents)." return 1 fi debugout "Removing old $UPSTREAMBRANCH, to avoid problems later." gitcmd branch -D "$UPSTREAMBRANCH" || return 1 UPSTREAMREV="" fi else debugout "no branch $DEBIANBRANCH, assuming creating new one" if test -n "$UPSTREAMREV" ; then printerror "$DEBIANBRANCH does not exists, but $UPSTREAMBRANCH does. import-dsc does not know that this means." return 1 fi if test -n "$PATCHEDREV" ; then printerror "$DEBIANBRANCH does not exists, but $PATCHEDBRANCH does. import-dsc does not know that this means." return 1 fi no_control_yet || return 1 fi import_dsc "$dsc" } function import_dsc() { ##:local dsc dsc="$1" ##:local oldverbatimcommit oldverbatimcommit="" if test -n "$verbatimbranchname" ; then # if that returns empty, we assume it is to be created... oldverbatimcommit="$(gitcmd rev-parse --verify -q "$verbatimbranchname" || true)" fi ##:local quilt_build_deps dpatch_build_deps fsource fversion format origsize ##:local foundnativefilename founddebianfilename foundorigfilename ##:local founddifffilename dirname dscfilename parse_dsc "$dsc" || return 1 true > "$gitdir/dpm/newcomponents" || return 1 if test -s "$gitdir/dpm/newcomponents.import" ; then ##:local size hash component filename while IFS=":" read size hash component filename ; do ##:unused component printf 'component:%s:%s:%s\n' "$hash" "$size" "$filename" >> "$gitdir/dpm/newcomponents" || return 1 done < "$gitdir/dpm/newcomponents.import" ##:invalidate size hash component filename fi ##:local origname basetar origname="${foundorigfilename:-$foundnativefilename}" basetar="$dirname/$origname" ##:local shaandsize neworighash origsha findshaindsc "$origname" "$origsize" "$basetar" || return 1 neworighash="$shaandsize" origsha="${neworighash##*:}" ##:local reuse_upstream true > "$gitdir/dpm/newcomponents.trees" # Check if the .orig.tar is the same... if test -n "$upstreamtouse" ; then ##:local size hash component filename # we are told which branch to use, nothing to do while IFS=":" read size hash component filename ; do ##:unused size hash if ! gitcmd rev-parse -q --verify "$upstreamtouse":"$component" >/dev/null ; then printerror "$upstreamtouse does not contain a subdirectory called '$component', so '$filename' seems not yet included in that one!" return 1 elif [ x"$(gitcmd cat-file -t "$upstreamtouse":"$component" || true)" != xtree ] ; then printerror "$upstreamtouse does not contain a subdirectory called '$component' but some other object! Something is very strange." return 1 else debugout "successfully checked '$component' is a directory in '$upstreamtouse'" fi done < "$gitdir/dpm/newcomponents.import" ##:invalidate size hash component filename reuse_upstream=false elif [ x"${control_origtarsize}:${control_origtarsha}:${control_origtarname}" != x"${neworighash#dsc:}:${origname}" ] ; then debugout "New .orig.tar, will have to import it afresh" reuse_upstream=false else debugout "Old .orig.tar.gz is unchanged. Check if the components are, too.." LC_ALL=C sed -n -e 's/^component:\([0-9a-f]\+\):\([0-9]\+\):/\1 \2 /p' -- "$gitdir/dpm/oldcontrol" > "$gitdir/dpm/newcomponents.old" ##:local nothingremoved nothingremoved=true ##:local size hash name while read size hash name ; do if ! LC_ALL=C grep -q "^$hash:$size:.*:$(grepsafe "$name")\$" "$gitdir/dpm/newcomponents.import" ; then debugout "Component $name no longer included, will need to recreate upstream branch from scratch" nothingremoved=false reuse_upstream=false break fi ##:unused hash size done < "$gitdir/dpm/newcomponents.old" if $nothingremoved ; then debugout "No components removed, look for added..." ##:local components_added components_added="" while IFS=":" read size hash component filename ; do if ! LC_ALL=C grep -q "^component:$hash:$size:$(grepsafe "$filename")\$" -- "$gitdir"/dpm/oldcontrol ; then components_added="$components_added $component" checkfilehash "$dirname/$filename" "$size:$hash" || return 1 ##:local commit committree import_tar "$dirname/$filename" "" "" "" "Import $filename" "$upstream_date" "$upstream_author" || return 1 committree="$(gitcmd rev-parse "${commit}:")" || return 1 printf '%s:%s:%s\n' "$component" "$committree" "$dirname/$filename" >> "$gitdir/dpm/newcomponents.trees" || return 1 ##:invalidate commit committree fi done < "$gitdir/dpm/newcomponents.import" ##:invalidate size hash component filename commit if test -z "$components_added" ; then reuse_upstream=true else reuse_upstream=false debugout "Create new commit adding $components_added..." ##:local tree create_tree_with_dirs "${control_upstream}:" "$gitdir/dpm/newcomponents.trees" || return 1 # git doesn't like commits happening too fast: sleep 1 committreem "Add $components_added" "$tree" "" "" "" -p "$control_upstream" || return 1 upstreamtouse="$commit" ##:invalidate tree commit fi fi fi if test -z "${upstreamtouse:-}" && ! $reuse_upstream ; then case "$allownoparent" in true|default) ;; false) if $no_manual_parents && test -z "$upstreamtouse" ; then printerror "No parent commit specified (and dpm.importWithoutParent set to false)" echo "Use --allow-no-parent to override that once." return 1 fi ;; *) printerror "Internal Error: strange allownoparent value" return 1 ;; esac fi true > "$gitdir"/dpm/oldcommits ##:local old_commit_count verbatimUPSTREAMREV if test -n "$upstreamtouse" ; then old_commit_count=0 verbatimUPSTREAMREV="$upstreamtouse" gitcmd checkout -q "$verbatimUPSTREAMREV" || return 1 HEADBRANCH=DETACHED elif $reuse_upstream ; then debugout "Reusing old upstreambranch ${control_upstream}, as $origname unchanged" verbatimUPSTREAMREV="$control_upstream" gitcmd checkout -q "$verbatimUPSTREAMREV" || return 1 HEADBRANCH=DETACHED if isancestor "${control_upstream}" "${control_patched}" ; then gitcmd rev-list --pretty="format:%H %T %P" --reverse "${control_upstream}..${control_patched}" | sed '/^commit/d' > "$gitdir/dpm/oldcommits" || return 1 old_commit_count=$(wc -l "$gitdir/dpm/oldcommits") || return 1 old_commit_count="${old_commit_count%% *}" else old_commit_count=0 fi else if [ x"${neworighash}" != x"${neworighash#dsc:}" ] ; then # the leading dsc: means we only have looked dsc yet, # as the file will be unpacked, check the file, too: neworighash="${neworighash#dsc:}" if checkfilehash "$basetar" "$neworighash" ; then debugout "File $basetar has correct size and sha1sum" else printerror "File $basetar differs from the one recorded in $dscfilename" fi fi old_commit_count=0 if test -n "$foundnativefilename" && test -n "$oldverbatimcommit" ; then parents="-p $oldverbatimcommit $parents" parent_commits="$oldverbatimcommit $parent_commits" elif $connectoldupstream && [ x"$control_upstream" != xNONE ] ; then parents="-p $control_upstream $parents" parent_commits="$control_upstream $parent_commits" fi ##:local origcmessage filenames if test -n "$upstream_author" ; then origcmessage="$origname" else origcmessage="Import $origname" fi true > "$gitdir/dpm/newcomponents.trees" || return 1 filenames="" while IFS=":" read size hash component filename ; do checkfilehash "$dirname/$filename" "$size:$hash" || return 1 ##:local commit committree import_tar "$dirname/$filename" "" "" "" "Import $filename" "$upstream_date" "$upstream_author" || return 1 committree="$(gitcmd rev-parse "${commit}:")" || return 1 printf '%s:%s:%s\n' "$component" "$committree" "$dirname/$filename" >> "$gitdir/dpm/newcomponents.trees" || return 1 filenames="${filenames}, ${filename}" ##:invalidate commit committree done < "$gitdir/dpm/newcomponents.import" ##:local commit if test -s "$gitdir/dpm/newcomponents.import" ; then debugout "Import $basetar as stand-alone commit (so pristine-tar can use it)" # TODO: some way to add an parent here? import_tar "$basetar" "" "" "" "$origcmessage" "$upstream_date" "$upstream_author" || return 1 ##:local origonlytree origonlytree="$(gitcmd rev-parse --verify "${commit}:")" || return 1 if test -n "$parent_commits" && gitcmd rev-list --pretty=tformat:%T $parent_commits | LC_ALL=C grep -q "^${origonlytree}\$" ; then debugout "$origonlytree already a tree in the history, so not including an extra commit for it" else parents="$parents -p $commit" parent_commits="$parent_commits $commit" fi create_tree_with_dirs "$origonlytree" "$gitdir/dpm/newcomponents.trees" || return 1 # record for pristine-tar call or warning... printf ':%s:%s\n' "$origonlytree" "$dirname/$origname" >> "$gitdir/dpm/newcomponents.trees" || return 1 debugout "Create combined commit containing all components" committreem "Import ${origname}$filenames" "$tree" "" "" "" $parents || return 1 ##:unused parent_commits gitcmd checkout -q "$commit" || return 1 HEADBRANCH=DETACHED else debugout "Importing $basetar" import_tar "$basetar" "$parents" "$p_commits" "$parent_commits" "$origcmessage" "$upstream_date" "$upstream_author" || return 1 ##:local committree committree="$(gitcmd rev-parse --verify "${commit}:")" || return 1 # record for pristine-tar call or warning... printf ':%s:%s\n' "$committree" "$dirname/$origname" >> "$gitdir/dpm/newcomponents.trees" || return 1 fi verbatimUPSTREAMREV="$commit" fi ##:invalidate parents parent_commits if test -n "$oldDEBIANREV" && isancestor "$verbatimUPSTREAMREV" "$oldDEBIANREV" ; then # Allow more things where old commits can be recylced... gitcmd rev-list --pretty="format:%H %T %P" --reverse "${verbatimUPSTREAMREV}..${oldDEBIANREV}" | sed '/^commit/d' >> "$gitdir/dpm/oldcommits" || return 1 fi if [ "$format" = "diff" ] && test -n "$oldverbatimcommit" && isancestor "$verbatimUPSTREAMREV" "$oldverbatimcommit" ; then # Those are most likely already in the oldDEBIANREV ones above, # but by adding them they get priority for the tail below gitcmd rev-list --pretty="format:%H %T %P" --reverse "${verbatimUPSTREAMREV}..${oldverbatimcommit}" | sed '/^commit/d' >> "$gitdir/dpm/oldcommits" || return 1 old_commit_count=$(wc -l "$gitdir/dpm/oldcommits") || return 1 old_commit_count="${old_commit_count%% *}" fi ##:invalidate commit local changelog_maintainer changelog_date oldchangelog_version oldchangelog_version="" if $use_changelog && test -n "$oldverbatimcommit" ; then ##:local changelogblob changelogblob="$(gitcmd rev-parse --verify -q "${oldverbatimcommit}:debian/changelog" || [ "$?" -eq 1 ] )" || return 1 if test -n "$changelogblob" ; then debugout "determine version in debian/changelog in $oldverbatimcommit" gitcmd cat-file blob "$oldverbatimcommit":debian/changelog > "$gitdir"/dpm/changelog.old || return 1 dpkg-parsechangelog -l"$gitdir"/dpm/changelog.old > "$gitdir"/dpm/changelog.old.parsed || return 1 oldchangelog_version="$(LC_ALL=C sed -n -e 's/^Version: //p' -- "$gitdir"/dpm/changelog.old.parsed)" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/changelog.old* fi fi fi ##:local verbatimPATCHEDREV verbatimDEBIANREV case $format in (diff) ##:local dsctree prepatchedtree # this sets dsctree and prepatchedtree applydscdiff "${verbatimUPSTREAMREV}:" "$dirname/$founddifffilename" || return 1 if $use_changelog ; then debugout "getting date from debian/changelog..." gitcmd cat-file blob "$dsctree":debian/changelog > "$gitdir"/dpm/changelog.new || return 1 dpkg-parsechangelog -l"$gitdir"/dpm/changelog.new > "$gitdir"/dpm/changelog.parsed || return 1 changelog_maintainer="$(LC_ALL=C sed -n -e 's/^Maintainer: \(.* <.*>\)$/\1/p' -- "$gitdir"/dpm/changelog.parsed)" || return 1 debugout "changelog's Maintainer is '$changelog_maintainer'" changelog_date="$(LC_ALL=C sed -n -e 's/^Date: //p' -- "$gitdir"/dpm/changelog.parsed)" || return 1 debugout "changelog's Date is '$changelog_date'" LC_ALL=C sed -e '0,/^Changes: *$/d' -e '/^[^ ]/d' -e 's/^ //' -e 's/^\.$//' -- "$gitdir"/dpm/changelog.parsed > "$gitdir"/dpm/changelog.changes || return 1 if test -n "$oldchangelog_version" ; then debugout "extracing changes since '$oldchangelog_version'" dpkg-parsechangelog --since "$oldchangelog_version" -l"$gitdir"/dpm/changelog.new > "$gitdir"/dpm/changelog.newerchanges || return 1 LC_ALL=C sed -e '0,/^Changes: *$/d' -e '/^[^ ]/d' -e 's/^ //' -e 's/^\.$//' -i -- "$gitdir"/dpm/changelog.newerchanges || return 1 else cp -- "$gitdir"/dpm/changelog.changes "$gitdir"/dpm/changelog.newerchanges || return 1 fi if test -z "$patch_fallbackauthor" ; then patch_fallbackauthor="$changelog_maintainer" fi if test -z "$patch_date" ; then patch_date="$changelog_date" fi commit="" else changelog_maintainer="" changelog_date="" true > "$gitdir"/dpm/changelog.changes true > "$gitdir"/dpm/changelog.newerchanges fi debugout "see if there are any direct changes to upstream..." ##:local verbatimupstreamrevtree verbatimupstreamrevtree="$(gitcmd rev-parse "$verbatimUPSTREAMREV":)" || return 1 if [ "$prepatchedtree" != "$verbatimupstreamrevtree" ] ; then has_unmanaged_differences=true commit="" if $reuse_upstream && \ test -n "$control_patched" && \ [ x"$patch_system" = x"history" ] ; then ##:local patched_tree patched_tree="$(gitcmd rev-parse "${control_patched}:")" || return 1 if [ x"$prepatchedtree" = x"$patched_tree" ] ; then debugout "Contents after .diff applied is the same as old patched branch, reuse that one" commit="$control_patched" else debugout "Adding additional commit on top of patched branch" printf 'Additional changes found in %s\n\n' "${founddifffilename}" > "$gitdir"/dpm/changelog.patch.txt || return 1 if test -n "$oldchangelog_version" ; then printf 'patch containing changes since %s\n\n' "$oldchangelog_version" >> "$gitdir"/dpm/changelog.patch.txt || return 1 fi if test -s "$gitdir"/dpm/changelog.newerchanges ; then printf '\nThe debian/changelog hopefully describing those changes:\n\n' >> "$gitdir"/dpm/changelog.patch.txt || return 1 cat "$gitdir"/dpm/changelog.newerchanges >> "$gitdir"/dpm/changelog.patch.txt || return 1 fi gitcmd diff "$control_patched" "$prepatchedtree" | LC_ALL=C sed -e 's/^/# /' >> "$gitdir"/dpm/changelog.patch.txt || true sensible-editor "$gitdir"/dpm/changelog.patch.txt || return 1 committreef "$gitdir"/dpm/changelog.patch.txt "$prepatchedtree" "$changelog_maintainer" "" "$changelog_date" -p "$control_patched" || return 1 fi else ##:local candidate candidate="$(LC_ALL=C sed -n -e 's/^\([^ ]*\) '"$prepatchedtree"' '"$verbatimUPSTREAMREV"'$/\1/p' -- "$gitdir"/dpm/oldcommits | tail -n 1)" || return 1 if test -n "$candidate" ; then # do not compare message here. # if that patch was here and gives # the right tree, it is better than # a "changes found in..." commit="$candidate" debugout "Reuse $commit for non-debian/ patches found in $founddifffilename" fi fi if test -z "$commit" ; then printwarn "$founddifffilename contains changes outside debian/, importing as single patch" echo "changes in $founddifffilename" > "$gitdir"/dpm/changelog.patch.txt || return 1 if [ x"$patch_system" = x"history" ] ; then if test -s "$gitdir"/dpm/changelog.changes ; then printf '\nThe debian/changelog describing the last version says:\n\n' >> "$gitdir"/dpm/changelog.patch.txt || return 1 if test -s "$gitdir"/dpm/changelog.newerchanges ; then cat "$gitdir"/dpm/changelog.newerchanges >> "$gitdir"/dpm/changelog.patch.txt || return 1 else cat "$gitdir"/dpm/changelog.changes >> "$gitdir"/dpm/changelog.patch.txt || return 1 fi gitcmd diff "$verbatimUPSTREAMREV" "$prepatchedtree" | LC_ALL=C sed -e 's/^/# /' >> "$gitdir"/dpm/changelog.patch.txt || true sensible-editor "$gitdir"/dpm/changelog.patch.txt || return 1 fi fi committreef "$gitdir"/dpm/changelog.patch.txt "$prepatchedtree" "$changelog_maintainer" "" "$changelog_date" -p "$verbatimUPSTREAMREV" || return 1 fi else commit="$verbatimUPSTREAMREV" fi verbatimPATCHEDREV="${commit}" if ! test -s "$gitdir"/dpm/changelog.newerchanges ; then if $use_changelog ; then printwarn "Failed to extract Changes from debian/changelog!" echo "${dscfilename##*/}" > "$gitdir"/dpm/changelog.newerchanges || return 1 else echo "Import ${dscfilename##*/}" > "$gitdir"/dpm/changelog.newerchanges || return 1 fi fi if test -n "$oldverbatimcommit" ; then committreef "$gitdir"/dpm/changelog.newerchanges "$dsctree" "$changelog_maintainer" "" "$changelog_date" -p "$oldverbatimcommit" -p "$verbatimPATCHEDREV" || return 1 else committreef "$gitdir"/dpm/changelog.newerchanges "$dsctree" "$changelog_maintainer" "" "$changelog_date" -p "$verbatimPATCHEDREV" || return 1 fi if $delete_temp_files ; then rm -f -- "$gitdir"/dpm/changelog.* fi gitcmd checkout -q "$commit" || return 1 verbatimDEBIANREV="$commit" ;; (quilt) debugout "Importing $founddebianfilename" import_tar "$dirname/$founddebianfilename" "" "" "" "temporary commit containing .debian.tar file" "" "" || return 1 ##:local debiantree debiantree="$(gitcmd rev-parse "$commit":)" || return 1 if $use_changelog ; then debugout "getting date from debian/changelog..." gitcmd cat-file blob "$debiantree":changelog > "$gitdir"/dpm/changelog.new || return 1 dpkg-parsechangelog -l"$gitdir"/dpm/changelog.new > "$gitdir"/dpm/changelog.parsed || return 1 changelog_maintainer="$(LC_ALL=C sed -n -e 's/^Maintainer: \(.* <.*>\)$/\1/p' -- "$gitdir"/dpm/changelog.parsed)" || return 1 debugout "changelog's Maintainer is '$changelog_maintainer'" changelog_date="$(LC_ALL=C sed -n -e 's/^Date: //p' -- "$gitdir"/dpm/changelog.parsed)" || return 1 debugout "changelog's Date is '$changelog_date'" LC_ALL=C sed -e '0,/^Changes: *$/d' -e '/^[^ ]/d' -e 's/^ //' -e 's/^\.$//' -- "$gitdir"/dpm/changelog.parsed > "$gitdir"/dpm/changelog.changes || return 1 if test -n "$oldchangelog_version" ; then debugout "extracing changes since '$oldchangelog_version'" dpkg-parsechangelog --since "$oldchangelog_version" -l"$gitdir"/dpm/changelog.new > "$gitdir"/dpm/changelog.newerchanges || return 1 LC_ALL=C sed -e '0,/^Changes: *$/d' -e '/^[^ ]/d' -e 's/^ //' -e 's/^\.$//' -i -- "$gitdir"/dpm/changelog.newerchanges || return 1 else cp -- "$gitdir"/dpm/changelog.changes "$gitdir"/dpm/changelog.newerchanges || return 1 fi if test -z "$patch_fallbackauthor" ; then patch_fallbackauthor="$changelog_maintainer" fi if test -z "$patch_date" ; then patch_date="$changelog_date" fi else changelog_maintainer="" changelog_date="" echo "Import ${dscfilename##*/}" > "$gitdir"/dpm/changelog.newerchanges || return 1 fi debugout "changing back to upstream source" gitcmd checkout -q "$verbatimUPSTREAMREV" || return 1 if gitcmd rev-parse --verify -q "${debiantree}:patches/series" >/dev/null ; then debugout "Importing patches" apply_patches "${debiantree}:" false || return 1 imported_patches=true fi verbatimPATCHEDREV="$(gitcmd rev-parse --verify HEAD)" || return 1 debugout "Replace debian/ with contents of .debian.tar." ##:local message tree dsctree create_tree_with_new_debian "$verbatimPATCHEDREV" "$debiantree" || return 1 dsctree="$tree" ##:invalidate debiantree tree debugout "Create the new verbatim debian commit" if test -n "$verbatimbranchname" && test -n "$oldverbatimcommit" ; then committreef "$gitdir"/dpm/changelog.newerchanges "$dsctree" "$changelog_maintainer" "" "$changelog_date" -p "$oldverbatimcommit" -p "$verbatimPATCHEDREV" || return 1 else committreef "$gitdir"/dpm/changelog.newerchanges "$dsctree" "$changelog_maintainer" "" "$changelog_date" -p "$verbatimPATCHEDREV" || return 1 fi ##:invalidate dsctree verbatimDEBIANREV="$commit" gitcmd checkout -q "$commit" || return 1 # 3.0 has built-in patch system, no more madness... patch_system=none3.0 ;; (oldnative|native) # no more things in the .dsc verbatimPATCHEDREV="$verbatimUPSTREAMREV" verbatimDEBIANREV="$verbatimUPSTREAMREV" ;; esac if test -n "$verbatimbranchname" ; then gitcmd update-ref refs/heads/"$verbatimbranchname" "$verbatimDEBIANREV" "$oldverbatimcommit" || return 1 echo "Updated $verbatimbranchname to contents of $dscfilename" fi debugout "import of verbatim content complete" case $format in (oldnative|native) if $import_native ; then debugout "Create debian/.git-dpm file..." cat > "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 cat -- "$gitdir/dpm/newcomponents" >> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "${verbatimUPSTREAMREV}" "${verbatimPATCHEDREV}" > "$gitdir/dpm/modifications" || return 1 ##:local tree modify_tree "${verbatimDEBIANREV}:" "$gitdir/dpm/modifications" || return 1 committodebianbranch "$tree" false "$verbatimDEBIANREV" "" "Import $fsource $fversion" || return 1 ##:invalidate tree return 0 fi printerror "1.0 without diff and 3.0 (native) cannot be imported (you can force it anyway by using --allow-native-import, but that is mostly useful if you do an other import-dsc or import-new-upstream afterwards...)" return 1 ;; esac gitcmd checkout -q "$verbatimDEBIANREV" || return 1 HEADBRANCH="DETACHED" ##:local verbatimDEBIANtree complete_if_no_patches verbatimDEBIANtree="$(gitcmd rev-parse "$verbatimDEBIANREV":)" || return 1 if ! test -e debian/patches && test -f debian/source/format && grep -q '^3.0 (quilt)' debian/source/format ; then complete_if_no_patches=true else complete_if_no_patches=false fi # TODO: does it make sense to create a partial .git-dpm here and # complete that once the patches finished? That might make it easier # if the user has to change anything to make that work... if [ "x$patch_system" = x"auto" ] ; then debugout "Trying to determine patch system in use..." # TODO: check for variables moving the patches to different places? if grep -q '^include[ ]\+/usr/share/quilt/quilt.make' debian/rules ; then patch_system=quilt elif grep -q '^include[ ]\+/usr/share/quilt/quilt.debbuild.mk' debian/rules ; then patch_system=quilt elif grep -q '^include[ ]\+/usr/share/cdbs/1/rules/patchsys-quilt.mk' debian/rules ; then patch_system=quilt elif grep -q '^ dh\>.*--with quilt' debian/rules ; then patch_system=quilt elif grep -q '^include[ ]\+/usr/share/dpatch/dpatch.make' debian/rules ; then patch_system=dpatch elif grep -q '^include[ ]\+/usr/share/cdbs/1/rules/dpatch.mk' debian/rules ; then patch_system=dpatch elif grep -q '^include[ ]\+/usr/share/cdbs/1/rules/simple-patchsys.mk' debian/rules ; then if grep -q 'DEB_PATCH_SUFFIX' debian/rules ; then printerror "debian/rules seems to change DEB_PATCH_SUFFIX. That is not supported by git-dpm. Imported patches will most likely be incomplete." fi if grep -q 'DEB_PATCHDIRS' debian/rules ; then printerror "debian/rules seems to change DEB_PATCHDIRS. That is not supported by git-dpm. Imported patches will most likely be incomplete." fi patch_system=simple elif test -f debian/patches/series ; then if test -n "$quilt_build_deps" ; then debugout "Has debian/patches series and build-depends on quilt, so assume they should be applied" patch_system="quilt" else debugout "Has debian/patches series, but no build-dependency on quilt, will try quilt-applied" patch_system="quilt-applied" fi elif test -f debian/patches/00list ; then if test -n "$dpatch_build_deps" ; then printwarn "Unusual dpatch patched detected (debian/patches/00list and build-depends on dpatch, but non of the usual includes). Hopefully no strange options break importing." debugout "Has debian/patches/00list and build-depends on dpatch, so assume dpatch" patch_system="dpatch" else printwarn "There is a debian/patches/00list but there does not seem to be a build-dependency on dpatch, so ignoring it. (Use --patch-system dpatch to enforce it)" patch_system="nonefound" fi else patch_system="nonefound" fi fi ##:local patch_system_ apply_patches_first preapplied_patches patch_system_="${patch_system%-first}" if [ x"$patch_system_" = x"$patch_system" ] ; then apply_patches_first=false else patch_system="$patch_system_" apply_patches_first=true fi patch_system_="${patch_system%-applied}" if [ x"$patch_system_" = x"$patch_system" ] ; then preapplied_patches=false else patch_system="$patch_system_" apply_patches_first=true preapplied_patches=true fi ##:local tree case "$patch_system" in none|none3.0|nonefound|history) tree="$verbatimDEBIANtree" ;; quilt|dpatch|simple) # TODO: instead write some --continue/--abort logik... if ! import_patches_from_dsc ; then printerror "Could not import patches. (above this message should be some error messages from git indicating why)" echo "reseting branches to previous state." >&2 echo "to debug what failed:" >&2 echo "new upstream rev would have been ${verbatimUPSTREAMREV}" >&2 echo "in .diff patches ${verbatimPATCHEDREV}" >&2 echo "in .diff debian/ ${verbatimDEBIANREV}" >&2 echo "applied patches got till $PATCHEDREV" >&2 if test -n "$oldDEBIANREV" ; then debugout "resetting $DEBIANBRANCH to $oldDEBIANREV" gitcmd checkout -f -q "$oldDEBIANREV" || return 1 gitcmd update-ref -m "reset" refs/heads/"$DEBIANBRANCH" "$oldDEBIANREV" || return 1 gitcmd checkout "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" elif [ "$ORIGHEADBRANCH" != "$DEBIANBRANCH" ] ; then debugout "switching back to original HEAD" gitcmd checkout -f "$ORIGHEADBRANCH" || return 1 HEADBRANCH="$ORIGHEADBRANCH" else printwarn "HEAD originally pointed to non-existant '$DEBIANBRANCH'. Cannot go back to that state so detaching HEAD." ##:local headrev headrev="$(gitcmd rev-parse HEAD)" || return 1 gitcmd checkout -q "$headrev" || return 1 HEADBRANCH=DETACHED fi if test -n "$verbatimbranchname" ; then if test -n "$oldverbatimcommit" ; then echo "reseting $verbatimbranchname from $verbatimDEBIANREV back to $oldverbatimcommit" gitcmd update-ref "refs/heads/$verbatimbranchname" "$oldverbatimcommit" "$verbatimDEBIANREV" || return 1 else gitcmd branch -D "$verbatimbranchname" || return 1 fi fi if test -n "$PATCHEDREV" ; then gitcmd branch -D "$PATCHEDBRANCH" || return 1 fi return 1 fi ;; *) printerror "$patch_system patches not yet supported in import-dsc" return 1 ;; esac # if PATCHEDREV != "", that is the new patched rev, # otherwise use verbatimDEBIANREV for the tree. # the new Debian branch is in verbatimDEBIANREV ##:local doamend upstream patched dparents patches doamend=false upstream="$verbatimUPSTREAMREV" if [ x"$PATCHEDREV" = x"" ] ; then patched="$verbatimPATCHEDREV" dparents="$verbatimDEBIANREV" else # tree should be set here... patched="$PATCHEDREV" dparents="$verbatimDEBIANREV $PATCHEDREV" fi if [ x"$patched" = x"$upstream" ] && $complete_if_no_patches ; then debugout "no patches and no debian/patches directory, so patches are fully exported ;-)" patches="$patched" else # if there was an old debian/patches we would have replaced # it with the one in the .diff or .debian.tar, so mark it # as outdated relative to everything... patches="NONE" fi debugout "Create debian/.git-dpm file..." cat > "$gitdir/dpm/newcontrol" <> "$gitdir/dpm/newcontrol" || return 1 cat -- "$gitdir/dpm/newcomponents" >> "$gitdir/dpm/newcontrol" || return 1 modifications_for_newcontrol "$gitdir/dpm/newcontrol" "${upstream}" "${patched}" > "$gitdir/dpm/modifications" || return 1 # this might just come from a file, no goes back into a file, # but makes the logik here much easier... modify_tree "$tree" "$gitdir/dpm/modifications" || return 1 committodebianbranch "$tree" "$doamend" "$dparents" "" "Import $fsource $fversion" || return 1 gitcmd checkout -q "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" if test -n "$PATCHEDREV" ; then gitcmd branch -d "$PATCHEDBRANCH" && PATCHEDREV="" || true fi if $delete_temp_files ; then rm -f -- "$gitdir/dpm/oldcommits" "$gitdir/dpm/modifications" fi echo "$dscfilename successfully imported" case "$patch_system" in none|history) ;; nonefound) if $has_unmanaged_differences ; then echo "Looks like no patch system was used but everything patched directly instead..." else echo "No patch system found. If there is one, you'll have to import the patches manually..." fi ;; quilt-applied|none3.0) if $imported_patches && [ x"$control_patches" != x"$control_patched" ] ; then echo "To regenerate the patches, run git-dpm update-patches" fi ;; *) if $imported_patches ; then echo "patches were imported and thus are now applied." if ! $preapplied_patches ; then echo "You will most likely have to change the build-system" echo "to no longer apply them at build time." fi if [ x"$control_patches" != x"$control_patched" ] ; then echo "To export the patches as debian/patches quilt series," echo "use git-dpm update-patches." fi fi ;; esac check_new_pristine_tar "$gitdir/dpm/newcomponents.trees" "$committopristinetar" || return 1 if $delete_temp_files ; then rm -f -- "$gitdir/dpm/newcomponents.*" fi } ########## cherry-pick ############ ##:function do_cherry_pick allowchangesindebian =subcommand function do_cherry_pick() { ##:local merge_only disallow_nonlinear checkout_debian amendmerge ##:local delete_patched pass_options redo merge_parent dotgitoption ##:local ignoredeletions merge_only=false disallow_nonlinear=true checkout_debian=true amendmerge=false delete_patched=true pass_options="" redo=false merge_parent="" dotgitoption="none" ignoredeletions="auto" while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] cherry-pick [-e] [-s] [-x|-r] [-m parent] Cherry-pick a commit into the patched branch. This is mostly a safer/faster form of git-dpm checkout-patch ; git cherry-pick ; git-dpm update-patches Possible local options: --merge-only: Do not update debian/patches --repick: don't try to avoid applying something already contained --allow-nonlinear: passed to git-dpm merge-patched-into-debian --keep-branch: dont' remove the patched temporary branch when done. --amend: passed to git-dpm merge-patched-into-debian -e, -s, -x, -m num: passed along to git's cherry-pick EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; --merge-only) merge_only=true ;; # git's checky-pick options: -e|--edit|-s|--signoff|-x|-r) pass_options="$pass_options $1" ;; -m|--mainline) shift merge_parent="$1" pass_options="$pass_options -m $merge_parent" ;; --mainline=*) merge_parent="${1#--mainline=}" pass_options="$pass_options -m $merge_parent" ;; --no-checkout) checkout_debian=false ;; --repick) redo=true ;; # merge-patched-into-debian options: --allow-nonlinear) disallow_nonlinear=false ;; --keep-branch) delete_patched=false ;; --amend) amendmerge=true ;; --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; # usual stuff: --) shift break ;; -*) printerror "Unrecognized cherry-pick option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -eq 0 ] ; then printerror "no commit given as argument" return 1 fi ##:local committopick committopick="$1" shift if [ $# -gt 0 ] ; then printerror "too many arguments" return 1 fi if ! $checkout_debian && ! $merge_only ; then checkout_debian=true echo "Ignoring --no-checkout as not supported without --merge-only" fi checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 checkclean $allow_nonclean || return 1 parsedpmcontrolfile "" || return 1 checkupstreambranchcurrent || return 1 ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi if ! $allowchangesindebian ; then checkdebian "" "" || return 1 fi ##:local TOPICKREV TOPICKREV="$(get_and_verify_commit "$committopick")" || return 1 if test -n "$PATCHEDREV" && [ "$PATCHEDREV" != "$control_patched" ] ; then printerror "you already have '$PATCHEDBRANCH' branch different from the last recorded" echo "Either remove that or use git's cherry-pick instead followed by a git-dpm update-patches" >&2 return 1 fi debugout "checking if '$committopick' ('$TOPICKREV') is sane..." if isancestor "$TOPICKREV" "$control_patched" ; then if $redo ; then printwarn "trying to repick..." else printerror "'$committopick' is already included in '$PATCHEDBRANCH'" echo "To force processing use --repick" >&2 return 1 fi fi debugout "Check if commit is a merge and if yes if -m was correctly given" ##:local numparentsplusone comparewith numparentsplusone="$(gitcmd rev-list --max-count=1 --parents "$TOPICKREV" | wc -w)" || return 1 if test -z "$merge_parent" ; then if [ 2 -eq "$numparentsplusone" ] ; then comparewith="$TOPICKREV"'^1' else printerror "'$committopick' is a merge. Perhaps you need --mainline parent_num?" return 1 fi else if [ 0 -lt "$merge_parent" ] && [ "$numparentsplusone" -gt "$merge_parent" ] ; then comparewith="$(gitcmd --verify "$TOPICKREV"'^'"$merge_parent")" || return 1 else printerror "'$merge_parent' not in interval 1..$(( "$merge_parent" - 1 ))!" return 1 fi fi debugout "Check if commit has changes in debian/" ##:local badrevs badrevs="$(gitcmd rev-list "${comparewith}..${TOPICKREV}" -- ${reldir}debian/)" || return 1 if [ -n "$badrevs" ] ; then printerror "'$committopick' contains debian/ changes:" gitcmd rev-list --pretty=oneline "${comparewith}..${TOPICKREV}" -- ${reldir}debian/ >&2 return 1 fi if test -n "$PATCHEDREV" ; then debugout "Switching to '$PATCHEDBRANCH'" [ "$PATCHEDREV" == "$control_patched" ] || printerror "CONFUSED" gitcmd checkout "$PATCHEDBRANCH" || return 1 else debugout "Creating '$PATCHEDBRANCH'" gitcmd checkout -b "$PATCHEDBRANCH" "$control_patched" || return 1 PATCHEDREV="$control_patched" fi HEADBRANCH="$PATCHEDBRANCH" ##:local r r=0 gitcmd cherry-pick $pass_options -- "$committopick" || r=$? if [ "$r" -ne 0 ] ; then printerror "git cherry-pick failed. Try to repair and then run git-dpm update-patches." return 1 fi ##:local newPATCHEDREV newPATCHEDREV="$(gitcmd rev-parse --verify HEAD)" || return 1 if [ x"$newPATCHEDREV" = x"$PATCHEDREV" ] ; then printwarn "git's cherry-pick did not change '$PATCHEDBRANCH', doing nothing..." if [ x"$ORIGHEADBRANCH" != x"$PATCHEDBRANCH" ] && $delete_patched ; then gitcmd checkout "$ORIGHEADBRANCH" || return 1 HEADBRANCH="$ORIGHEADBRANCH" gitcmd branch -D "$PATCHEDBRANCH" || return 1 fi return 0 fi PATCHEDREV="$newPATCHEDREV" debugout "switching to '$DEBIANBRANCH'" gitcmd checkout "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" echo "git-dpm: Calling merge-patched-into-debian..." ##:local pickmessage pickmessage="$(gitcmd rev-list --max-count=1 --abbrev=8 --abbrev-commit --pretty=oneline "$committopick")" || return 1 merge_patched_in_debian true "$disallow_nonlinear" "$amendmerge" "cherry-picked '$pickmessage' into '$PATCHEDBRANCH'" false || return 1 if $checkout_debian && [ x"$HEADBRANCH" != x"$DEBIANBRANCH" ] ; then gitcmd checkout "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi if $delete_patched && [ x"$HEADBRANCH" != x"$PATCHEDBRANCH" ] ; then if [ x"$HEADBRANCH" = x"$DEBIANBRANCH" ] ; then gitcmd branch -d "$PATCHEDBRANCH" || return 1 else gitcmd branch -D "$PATCHEDBRANCH" || return 1 fi PATCHEDREV="" fi if $merge_only ; then printwarn "Don't forget to run update-patches..." return 0 else echo "git-dpm: Calling update-patches..." update_patches "$control_upstream" "$control_patched" "true" "" return $? fi } ########## dch ############ ##:function do_dch allowchangesindebian =subcommand function do_dch() { ##:local delete_patched disallow_reverts disallow_nonlinear ##:local dchdoamend latestonly updatepatches doforce gitcommitarguments ##:local authortouse haveeditoption cleanupoption ##:local noneedfordiffcommentary additionalcommitflags dotgitoption ##:local ignoredeletions delete_patched=true disallow_reverts=true disallow_nonlinear=true dchdoamend=false latestonly=false updatepatches=true doforce=false gitcommitarguments="" authortouse="" haveeditoption=false cleanupoption="default" noneedfordiffcommentary=false additionalcommitflags="" dotgitoption="none" ignoredeletions="auto" while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] dch [local options] [--] Call dch and do a git commit with a commit message generated from the changes to debian/changelog. Possible local options: --amend: call git commit with and take older changelog changes into account --ignore-patches: don't call update-patches if patches are not up to date --latest-only: only use new changes to changelog, not older uncommitted ones. -f|--force: don't be coward -a|-s|-n|--cleanup|-e|-u|-q|-v: pass through to git commit EOF return 0 ;; --dot-git|--dot-git-files) shift dotgitoption "$1" || return 1 ;; --dot-git=*) dotgitoption "${1#--dot-git=}" || return 1 ;; --dot-git-files=*) dotgitoption "${1#--dot-git-files=}" || return 1 ;; --deletions|--no-ignore-deletions) ignoredeletions=false ;; --ignore-deletions|--no-deletions) ignoredeletions=true ;; -f|--force) doforce=true ;; --update-patches|--update) updatepatches=true ;; --ignore-patches|--i-p) updatepatches=false ;; #begin of Options for update-patches --keep-branch) delete_patched=false ;; --allow-revert) disallow_reverts=false ;; --allow-nonlinear) disallow_nonlinear=false ;; --allow-upstream-changes-in-debian-branch|--allow-changes-in-debian-branch|--allow-changes-in-debian) allowchangesindebian=true ;; #end --latest-only|--latest|-l) latestonly=true ;; -e|--edit) haveeditoption=true gitcommitarguments="$gitcommitarguments $1" ;; -v|--verbose) noneedfordiffcommentary=true gitcommitarguments="$gitcommitarguments $1" ;; -a|--all|-s|--signoff|-n|--no-verify|-u|--untracked-files|-q|--quiet) gitcommitarguments="$gitcommitarguments $1" ;; --cleanup=*) gitcommitarguments="$gitcommitarguments $1" cleanupoption="${1#--cleanup=}" ;; --author) shift authortouse="$1" ;; --author=*) authortouse="${1#--author=}" ;; --amend) gitcommitarguments="$gitcommitarguments --amend" dchdoamend=true ;; # usual stuff: --) shift break ;; -*) printerror "Unrecognized git-dpm dch option '$1'!" echo "(perhaps you forgot a '--' before options to devscripts' dch?)" return 1 ;; *) break ;; esac shift done checkgitdir || return 1 initbranchvariables || return 1 cdtoplevel || return 1 parsedpmcontrolfile "" || return 1 ##:local dotgitfiles determinedotgitbehaviour || return 1 if test x"$ignoredeletions" = x"auto" ; then ignoredeletions="$(gitcmd config --bool --get "branch.$DEBIANBRANCH.dpmignoredeletions" || gitcmd config --bool --get dpm.ignoredeletions || echo false)" fi ##:local doupdatepatches doupdatepatches=false if test -n "$PATCHEDREV" && [ "$PATCHEDREV" != "$control_patched" ] ; then if $updatepatches ; then doupdatepatches=true else printwarn "The current state of $PATCHEDBRANCH is not the one recorded." echo "Continuing in this state because of --ignore-patches." >&2 fi elif [ "$control_patched" != "$control_patches" ] ; then if $updatepatches ; then doupdatepatches=true else printwarn "There are patches merged into the Debian branch not yet exported as debian/patches/" echo "That most likely means you only called merge-patched but not update-patches and thus your debian/patches is not up to date." >&2 echo "Continuing in this state because of --ignore-patches." >&2 fi elif [ "$control_upstream" != "$control_oldupstream" ] && ! $doforce ; then printerror "There is a new source recorded but patches were not yet rebased. You most likely forgot to call git-dpm rebase-patched." echo "Cowardly refusing to run git-dpm dch because of this. Use --force to run anyway." return 1 fi if ! $allowchangesindebian ; then checkdebian "" "" || return 1 fi if [ "$HEADBRANCH" != "$DEBIANBRANCH" ] ; then debugout "Switch to Debian branch (and check before that we are clean)" checkclean $allow_nonclean || return 1 gitcmd checkout "$DEBIANBRANCH" || return 1 HEADBRANCH="$DEBIANBRANCH" fi debugout "Try to find the old changelog first." if $latestonly ; then debugout "looking in the working directory because of --latest-only" if [ ! test -f debian/changelog ] ; then cp debian/changelog "$gitdir"/dpm/oldchangelog || return 1 elif echo A -- "$gitcommitarguments" | grep -q -- --create ; then true > "$gitdir"/dpm/oldchangelog else printerror "Cannot find debian/changelog file!" return 1 fi elif $dchdoamend ; then debugout "looking for older debian/changelog because of amend" if gitcmd rev-parse --verify -q "HEAD^1:debian/changelog" >/dev/null ; then gitcmd cat-file blob "HEAD^1:debian/changelog" > "$gitdir"/dpm/oldchangelog || return 1 elif gitcmd rev-parse --verify -q "HEAD^2:debian/changelog" >/dev/null ; then gitcmd cat-file blob "HEAD^2:debian/changelog" > "$gitdir"/dpm/oldchangelog || return 1 elif gitcmd rev-parse --verify -q "HEAD^3:debian/changelog" >/dev/null ; then gitcmd cat-file blob "HEAD^3:debian/changelog" > "$gitdir"/dpm/oldchangelog || return 1 else printwarn "Cannot find old debian/changelog file. Assuming it is newly created." true > "$gitdir"/dpm/oldchangelog || return 1 fi else debugout "extracting HEAD:debian/changelog" if gitcmd rev-parse --verify -q "HEAD:debian/changelog" >/dev/null ; then gitcmd cat-file blob "HEAD:debian/changelog" > "$gitdir"/dpm/oldchangelog || return 1 else printwarn "Cannot find old debian/changelog file. Assuming it is newly created." true > "$gitdir"/dpm/oldchangelog fi fi if $doupdatepatches ; then debugout "Updating debian/patches first..." ##:local patchedrev if test -z "$PATCHEDREV" ; then patchedrev="$control_patched" if ! gitcmd cat-file -e "$control_patched" 2>/dev/null ; then printerror "recorded '$PATCHEDBRANCH' branch '$control_patched' not found in current repository!" return 1 fi else patchedrev="$PATCHEDREV" fi if test -n "$UPSTREAMREV" && [ x"$UPSTREAMREV" != x"$control_upstream" ] ; then printerror "Your '$UPSTREAMBRANCH' is not the one currently recorded." echo "Either first call git-dpm record-new-upstream to record it," >&2 echo "use git-dpm prepare to update it if it is out of date." >&2 echo "or just remove the branch using git branch -d $UPSTREAMBRANCH" >&2 return 1 fi ##:local upstreamrev upstreamrev="$control_upstream" debugout "Checking if patched branch contains current upstream branch..." if ! isancestor "$upstreamrev" "$patchedrev"; then printerror "'$PATCHEDBRANCH' does not contain '$UPSTREAMBRANCH'!" echo "(perhaps a git-dpm rebase-patched is needed?)" >&2 return 1 fi debugout "Checking if patched branch is contained in Debian branch..." if [ "x$patchedrev" != "x$control_patched" ] ; then if test -z "$PATCHEDREV" ; then printerror "Confused! How can '$PATCHEDBRANCH' be not up to date if it does not exist?" return 1 fi ##:local msg msg="git-dpm: Calling merge-patched-into-debian" if ! $disallow_reverts ; then msg="$msg --allow-revert" ; fi if ! $disallow_nonlinear ; then msg="$msg --allow-nonlinear" ; fi if $dchdoamend ; then msg="$msg --amend" ; fi echo "$msg" merge_patched_in_debian "$disallow_reverts" "$disallow_nonlinear" "$dchdoamend" "" false || return 1 patchedrev="$control_patched" if $delete_patched ; then gitcmd branch -d "$PATCHEDBRANCH" || return 1 PATCHEDREV="" fi if ! $dchdoamend ; then additionalcommitflags="--amend" dchdoamend=true fi fi echo "git-dpm: Calling update-patches" update_patches "$upstreamrev" "$patchedrev" "$dchdoamend" "" || return 1 if ! $dchdoamend ; then additionalcommitflags="--amend" dchdoamend=true ##:unused dchdoamend fi fi debugout "Call dch $*" ##:local ret ret=0 dch "$@" || ret=$? if [ "$ret" -ne "0" ] ; then printerror "dch returned with non-zero exit code $ret!" echo "(No commit will be made.)" >&2 return 1 fi debugout "add debian/changelog to index" gitcmd add debian/changelog || return 1 debugout "Extract message from changelog" # TODO: parsing is still quite crude. But how to do it better? true > "$gitdir"/dpm/commitmessage ##:local oldversion newversion oldtarget newtarget oldversion="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* (\([^() \t]\+\)).*;.*/\1/p' -- "$gitdir"/dpm/oldchangelog | head -n 1)" || return 1 newversion="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* (\([^() \t]\+\)).*;.*/\1/p' debian/changelog | head -n 1)" || return 1 oldtarget="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* ([^() \t]\+)\(\( \+[A-Za-z0-9+/-]\+\)*\).*;.*/\1/p' -- "$gitdir"/dpm/oldchangelog | head -n 1)" || return 1 newtarget="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* ([^() \t]\+)\(\( \+[A-Za-z0-9+/-]\+\)*\).*;.*/\1/p' -- debian/changelog | head -n 1)" || return 1 if [ x"$oldversion" != x"$newversion" ] ; then if [ x"$oldtarget" != x"$newtarget" ] ; then echo "change version to $newversion (${newtarget# })" >> "$gitdir"/dpm/commitmessage else echo "change version to $newversion" >> "$gitdir"/dpm/commitmessage fi elif [ x"$oldtarget" != x"$newtarget" ] ; then echo "change target to$newtarget" >> "$gitdir"/dpm/commitmessage fi diff -d --new-line-format="%L" --old-line-format="" --unchanged-line-format="" -- "$gitdir"/dpm/oldchangelog debian/changelog | sed -n -e 's/^ [*+-] *//p' -e 's/^ *//p' -e '/^ -- /q' >> "$gitdir"/dpm/commitmessage || true # only add a diff of the changelog files, # if it will be removed from the final commit message: ##:local addcommentary if $noneedfordiffcommentary ; then addcommentary=false else case "$cleanupoption" in default) addcommentary=$haveeditoption ;; strip) addcommentary=true ;; *) addcommentary=false ;; esac fi ##:local oldurgency newurgency oldurgency="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* ([^() \t]\+).*;[ ]*Urgency[ ]*=[ ]*\([^ ]\+\).*/\1/ip' -- "$gitdir"/dpm/oldchangelog | head -n 1)" || return 1 newurgency="$(sed -n -e 's/^[a-zA-Z0-9][-+a-zA-Z0-9.]* ([^() \t]\+).*;[ ]*Urgency[ ]*=[ ]*\([^ ]\+\).*/\1/ip' -- debian/changelog | head -n 1)" || return 1 if [ x"$oldurgency" != x"$newurgency" ] ; then echo "change urgency to $newurgency" >> "$gitdir"/dpm/commitmessage fi if $addcommentary ; then debugout "Adding diff of old and new changelog to commit message" diff -u "$gitdir"/dpm/oldchangelog debian/changelog | sed -e 's/^/# /' >> "$gitdir"/dpm/commitmessage || true fi debugout "calling git commit $gitcommitarguments ${authortouse:+--author="$authortouse"}" gitcmd commit $additionalcommitflags $gitcommitarguments ${authortouse:+--author="$authortouse"} -F "$gitdir"/dpm/commitmessage || return 1 DEBIANREV="$(gitcmd rev-parse HEAD)" || return 1 return 0 } ########## record-dsc ############ ##:function inpristinetar =gitcheck function inpristinetar() { local ptbranch ptbranch="$(gitcmd rev-parse -q --verify "pristine-tar:")" || return 1 if test -z "$ptbranch" ; then return 1 fi if gitcmd rev-parse -q --verify "${ptbranch}:${1##*/}.id" >/dev/null || gitcmd rev-parse -q --verify "${ptbranch}:${1##*/}.delta" >/dev/null ; then return 0 else return 1 fi } ##:function checkfilenametocommit dscdir dscfilename function checkfilenametocommit() { local fn="$1" fs="$2" fh="$3" local ah as if ! test -e "$dscdir/$fn" ; then printerror "No such file '$dscdir/$fn' listed by '$dscfilename'" return 1 fi as="$(stat -L --printf '%s' "$dscdir/$fn")" || return 1 if test "$as" -ne "$fs" ; then printerror "Wrong file size of '$dscdir/$fn' (expected $fs)!" return 1 fi if test -n "$fh" ; then ah="$(sha1sum -b -- "$dscdir/$fn")" || return 1 ah="${ah%% *}" if test "$ah" != "$fh" ; then printerror "Wrong sha1sum of '$dscdir/$fn' (expected $fh)!" return 1 fi fi } ##:function do_record_dsc =subcommand function do_record_dsc() { ##:local DSCBRANCH allow_unsigned create_branch DSCBRANCH="dscs" allow_unsigned=false create_branch=false while [ $# -gt 0 ] ; do case "$1" in --help) cat <<'EOF' Syntax: git-dpm [global options] record-dsc <.dsc-filename>' Commit upstream tarballs and debian.tar via pristine-tar, then store .dsc file in branch "dscs". EOF return 0 ;; --allow-unsigned) allow_unsigned=true ;; --create-branch) create_branch=true ;; # usual stuff: --) shift break ;; -*) printerror "Unrecognized git-dpm record-dsc option '$1'!" return 1 ;; *) break ;; esac shift done if [ $# -ne 2 ] ; then printerror "wrong number of arguments: record-dsc needs commit and .dsc filename" return 1 fi ##:local dscfilename dscfullname dscbasename dscdir dscfilename="$2" if ! test -f "$dscfilename" ; then printerror "No such file '$dscfilename'" return 1 fi dscfullname="$(readlink -f "$dscfilename")" || return 1 dscbasename="${dscfilename##*/}" dscdir="${dscfullname%/*}" case "$dscbasename" in *.dsc) ;; *) printerror "'$dscfilename' does not end in '.dsc'" return 1 ;; esac checkgitdir || return 1 cdtoplevel || return 1 initheadbranch || return 1 if test x"$HEADBRANCH" = x"$DSCBRANCH" ; then printerror "record-dsc does not work in '$DSCBRANCH' is checked out" return 1 fi debugout "store '$dscfilename' into git's object database" ##:local dscblob DSCREV dscblob="$(hash_object "$dscfullname")" || return 1 debugout "check if branch '$DSCBRANCH' already exists" DSCREV="$(gitcmd rev-parse -q --verify "$DSCBRANCH" || true)" if test -z "$DSCREV" ; then if $create_branch ; then debugout "'$DSCBRANCH' is '$DSCREV'" else printerror "No such branch '$DSCBRANCH'. Use --create-branch to create it." return 1 fi else if $create_branch ; then printerror "Branch '$DSCBRANCH' already exists but --create-branch." return 1 fi if test x"$(gitcmd ls-tree "$DSCREV" "$dscbasename" | LC_ALL=C awk '{print $3}' || true)" = "x$dscblob" ; then printerror "'$dscbasename' already found in branch '$DSCBRANCH' with the same contents. Aborting." return 1 fi fi debugout "Parsing '$dscfullname'..." if test -z "$(LC_ALL=C sed -n -e 's/^-\+BEGIN PGP.*/found/p' -- "$dscfullname" || true)" ; then if $allow_unsigned ; then printwarn "Unsigned file '$dscfilename'" else printerror "Unsigned file '$dscfilename' (use --allow-unsigned to allow)" return 1 fi fi LC_ALL=C sed -e '/^-\+BEGIN PGP SIGNED MESSAGE-\+$/,/^$/d' -e '/^-\+BEGIN PGP SIGNATURE-\+$/,/^-\+END PGP SIGNATURE-\+$/d' -- "$dscfullname" > "$gitdir"/dpm/dsccontents || return 1 LC_ALL=C awk -- '/^Files:|^Checksums-[A-Za-z0-9]+:/ {i=1; next} i && /^ [a-f0-9]+ [0-9]+ [^ ]+$/ {print $3 " " $2; next} {i=0;next}' "$gitdir"/dpm/dsccontents | LC_ALL=C sort -u > "$gitdir"/dpm/dscfiles || return 1 LC_ALL=C awk -- '/^Checksums-Sha1:/ {i=1; next} i && /^ [a-f0-9]+ [0-9]+ [^ ]+$/ {print ; next} {i=0;next}' "$gitdir"/dpm/dsccontents > "$gitdir"/dpm/dscsha1 || return 1 if test -z "$(LC_ALL=C sed -n -e 's/^Format: 3.0 (quilt)/found/p' -- "$gitdir"/dpm/dsccontents || true)" ; then printerror "'$dscfilename' does not look like '3.0 (quilt)' (missing or wrong Format field, or problems removing signature parts)" return 1 fi ##:local dscsource dscversion dscsource="$(LC_ALL=C sed -n -e 's/^Source: //p' -- "$gitdir"/dpm/dsccontents)" || true dscversion="$(LC_ALL=C sed -n -e 's/^Version: //p' -- "$gitdir"/dpm/dsccontents)" || true if test -z "$dscsource" ; then printerror "'$dscfilename' does not seem to have a Source field" return 1 fi if test -z "$dscversion" ; then printerror "'$dscfilename' does not seem to have a Version field" return 1 fi case "$dscbasename" in "$dscsource"_"${dscversion#*:}".dsc) ;; *) printerror "'$dscbasename' has Source and Version fields as if it should be called '${dscsource}_${dscversion#*:}.dsc' instead." return 1 ;; esac ##:local totagname totag totagname="$1" totag="$(get_and_verify_commit "$totagname")" || return 1 shift shift parsedpmcontrolfromcommit "$totag" "in commit $totagname" || return 1 debugout "Extract changelog information from '$totagname'" gitcmd cat-file blob "${totag}:debian/changelog" | dpkg-parsechangelog -l- > "$gitdir/dpm/changelog" || return 1 ##:local packagename version upstreamversion packagename="$(LC_ALL=C sed -n -e 's/^Source: //p' -- "$gitdir/dpm/changelog")" || return 1 version="$(LC_ALL=C sed -n -e 's/^Version: //p' -- "$gitdir/dpm/changelog")" || return 1 upstreamversion="${version#*:}" upstreamversion="${upstreamversion%-*}" if $delete_temp_files ; then rm -f -- "$gitdir/dpm/changelog" fi if test x"$dscsource" != x"$packagename" ; then printerror "'$dscfilename' lists Source '$dscsource', but $totagname's debian/changelog says '$packagename'" return 1 fi if test x"$dscversion" != x"$version" ; then printerror "'$dscfilename' lists Version '$dscversion', but $totagname's debian/changelog says '$version'" return 1 fi ##:local debiantarfilename num_components origtar_needs_ptc debiantarfilename="" debugout "Check all files in the .dsc match the specified commit." num_components=0 origtar_needs_ptc=false ##:local filename filesize filehash while read filename filesize; do case "$filename" in *.diff.gz) printerror "'$dscfilename' is no 3.0 (quilt) package, it contains a .diff.gz file" return 1 ;; "$packagename"_"$upstreamversion"*) ;; *) printerror "'$filename' listed in '$dscfilename' does not start with '${packagename}_${upstreamversion}' as expected" return 1 ;; esac filehash="$(LC_ALL=C sed -n -e 's/^ \([a-f0-9]\+\) '"$filesize $(sedsafe "$filename")"'$/\1/p' -- "$gitdir"/dpm/dscsha1)" || return 1 case "$filename" in "$control_origtarname") if test "$control_origtarsize" -ne "$filesize" ; then printerror "'$filename' listed in '$dscfilename' to have size '$filesize', but '$totagname' lists '$control_origtarsize'" return 1 fi if test -n "$filehash" && test "$control_origtarsha" != "$filehash" ; then printerror "'$filename' listed in '$dscfilename' to have sha1sum '$filehash', but '$totagname' lists '$control_origtarsha'" return 1 fi if inpristinetar "$filename" ; then printwarn "'$filename' already in pristine-tar. Assuming that is the correct one..." else origtar_needs_ptc=true checkfilenametocommit "$filename" "$filesize" "${filehash:-$control_origtarsha}" || return 1 fi ;; *.orig.tar|*.orig.tar.gz|*.orig.tar.bz2|*.orig.tar.lzma|*.orig.tar.xz) printerror "'$filename' listed in '$dscfilename' but '$totagname' lists '$control_origtarname' as .orig.tar file" return 1 ;; *.orig-*.tar|*.orig-*.tar.gz|*.orig-*.tar.bz2|*.orig-*.tar.lzma|*.orig-*.tar.xz) ##:local componentname component componenthash componentsize componentname="${filename##*.orig-}" componentname="${componentname%.tar*}" component="$(LC_ALL=C sed -n -e 's/^component:\([a-f0-9]*:[0-9]*\):'"$(sedsafe "$filename")"'$/\1/p' -- "$gitdir"/dpm/oldcontrol)" || return 1 if test -z "$component" ; then printerror "'$filename' listed in '$dscfilename', but not registered component in '$totagname'" return 1 fi componenthash="${component%:*}" componentsize="${component##*:}" if test "$componentsize" -ne "$filesize" ; then printerror "'$filename' listed in '$dscfilename' to have size '$filesize', but '$totagname' lists '$componentsize'" return 1 fi if test -n "$filehash" && test "$componenthash" != "$filehash" ; then printerror "'$filename' listed in '$dscfilename' to have sha1sum '$filehash', but '$totagname' lists '$componenthash'" return 1 fi num_components=$(( $num_components + 1 )) if inpristinetar "$filename" ; then printwarn "'$filename' already in pristine-tar. Assuming that is the correct one..." else checkfilenametocommit "$filename" "$filesize" "${filehash:-$componenthash}" || return 1 ##:local componenttree componenttree="$(gitcmd rev-parse --verify "$totag":"$componentname")" || return 1 ensure_pristine_tar_branch_ready || return 1 echo pristine-tar commit "${dscdir}/$filename" "$componenttree" pristine-tar commit "${dscdir}/$filename" "$componenttree" || return 1 ##:invalidate componenttree fi ##:invalidate componentname component componenthash componentsize ;; *.debian.tar|*.debian.tar.gz|*.debian.tar.bz2|*.debian.tar.lzma|*.debian.tar.xz) if test -n "$debiantarfilename" ; then printerror "Found both '$debiantarfilename' and '$filename' in '$dscfilename', confused." return 1 fi debiantarfilename="$filename" checkfilenametocommit "$filename" "$filesize" "$filehash" || return 1 ;; *) printerror "Unexpected filename '$filename' listed in '$dscfilename'" return 1 ;; esac debugout "'$filename' seems to fit" done < "$gitdir"/dpm/dscfiles ##:invalidate filename filesize filehash ##:local num_commit_components num_commit_components="$(LC_ALL=C sed -n -e 's/^component:\([a-f0-9]*:[0-9]*\):\(.*\)$/\2/p' -- "$gitdir"/dpm/oldcontrol | LC_ALL=C wc -l)" || return 1 if test "$num_components" -ne "$num_commit_components" ; then printerror "Wrong number of component .orig-*.tar files. '$dscfilename' lists $num_components while '$totagname' lists $num_commit_components" fi if $origtar_needs_ptc ; then if test "$num_components" -ne 0 ; then printwarn "Running pristine-tar for .orig.tar in record-dsc not yet supported with components!" else ensure_pristine_tar_branch_ready || return 1 echo pristine-tar commit "${dscdir}/$control_origtarname" "$control_upstream" pristine-tar commit "${dscdir}/$control_origtarname" "$control_upstream" || return 1 fi fi ##:local debiantree debiantree="$(gitcmd rev-parse --verify "${totag}:debian")" || return 1 ensure_pristine_tar_branch_ready || return 1 echo pristine-tar commit "${dscdir}/$debiantarfilename" "$debiantree" pristine-tar commit "${dscdir}/$debiantarfilename" "$debiantree" || return 1 ##:invalidate debiantree debugout "add $dscbasename to branch dscs..." printf '100644 blob %s\t%s\n' "$dscblob" "$dscbasename" > "$gitdir/dpm/modifications" || return 1 ##:local commit if test -z "$DSCREV" ; then # returns new tree in $tree ##:local tree empty_tree empty_tree="$(gitcmd mktree < /dev/null)" || return 1 modify_tree "$empty_tree" "$gitdir/dpm/modifications" || return 1 committreem "record $dscbasename" "$tree" "" "" "" || return 1 ##:invalidate tree empty_tree else # returns new tree in $tree ##:local tree modify_tree "${DSCREV}:" "$gitdir/dpm/modifications" || return 1 committreem "record $dscbasename" "$tree" "" "" "" -p "$DSCREV" || return 1 ##:invalidate tree fi gitcmd update-ref -m "record $dscbasename" refs/heads/$DSCBRANCH "$commit" "$DSCREV" || return 1 ##:invalidate DSCREV echo "recorded $dscbasename to $DSCBRANCH" if $delete_temp_files ; then rm -f -- "$gitdir/dpm/dscfiles" "$gitdir/dpm/dscsha1" \ "$gitdir/dpm/modifications" "$gitdir/dpm/dsccontents" fi return 0 } ################################# ##:function do_testbranchnames =subcommand function do_testbranchnames() { checkgitdir || return 1 initbranchvariables "${1-}" false || return 1 echo "'DEBIANBRANCH' is '$DEBIANBRANCH' (${DEBIANREV:-no such head})" echo "'UPSTREAMBRANCH' is '$UPSTREAMBRANCH' (${UPSTREAMREV:-no such head})" echo "'PATCHEDBRANCH' is '$PATCHEDBRANCH' (${PATCHEDREV:-no such head})" } ############ MAIN ############### if [ $# -eq 0 ] ; then printerror "Nothing to do specified! Try giving an action (or --help)" exit 1 fi # those are "" to denote not yet having a sane value... ##:unused HEADBRANCH ORIGHEADBRANCH case "$1" in version) echo "git-dpm version $VERSION" exit 0 ;; empty-tree) # mostly only for the test-suite... shift do_empty_tree "$@" || exit 1 ;; init) shift do_init "$@" || exit 1 ;; status) shift do_status "$@" || exit 1 ;; update-patches|up|u-p|ci) shift do_update_patches "$@" || exit 1 ;; merge-patched|merge-patched-into-debian) shift do_merge_patched_into_debian "$@" || exit 1 ;; prepare|prep) shift do_prepare "$@" || exit 1 ;; checkout-patched|co|c-p) shift do_checkout_patched "$@" || exit 1 ;; linearize) shift do_linearize "$@" || exit 1 ;; rebase-patched|r-p) shift do_rebase_patched "$@" || exit 1 ;; record-new-upstream-branch|record-new-upstream|new-upstream-branch|new-upstream|r-n-u|n-u|rnu) if test x"$1" = x"new-upstream" ; then printwarn "'new-upstream' command name is deprecated, please use 'record-new-upstream'" elif test x"$1" = x"n-u" ; then printwarn "'n-u' command name is deprecated, please use 'rnu' (for record-new-upstream)" elif test x"$1" = x"nu" ; then printwarn "'nu' command name is deprecated, please use 'rnu' (for record-new-upstream)" fi shift do_new_upstream_branch "$@" || exit 1 ;; tag) shift do_tag "$@" || exit 1 ;; ref-tag) shift do_reftag "$@" || exit 1 ;; apply-patch|a-p) shift do_apply_patch "$@" || exit 1 ;; import-tar|i-t) shift do_import_tar "$@" || exit 1 ;; import-dsc) shift do_import_dsc "$@" || exit 1 ;; import-new-upstream|i-n-u|inu) shift do_import_new_upstream "$@" || exit 1 ;; cherry-pick) shift do_cherry_pick "$@" || exit 1 ;; dch) shift do_dch "$@" || exit 1 ;; record-dsc) shift do_record_dsc "$@" || exit 1 ;; testbranchnames) shift do_testbranchnames || exit 1 ;; *) printerror "Unrecognized command '$1'!" exit 1 ;; esac if ! $dosilent ; then case "$HEADBRANCH" in ""|"$ORIGHEADBRANCH"|DETACHED) ;; *) echo "You are now in branch '$HEADBRANCH'" ;; esac fi if $delete_temp_files ; then rm -f -- "$gitdir/dpm/oldcontrol" fi exit 0 git-dpm-0.9.1/NEWS0000644000175100017510000000762512420416065010516 00000000000000Changes between 0.9.0 and 0.9.1: - fix import-dsc broken by tar_exclude in 0.9.0 - add --tar-exclude option to import-dsc Changes between 0.8.5 and 0.9.0: - mark new-upstream subcommand as deprecated in favour of new name "record-new-upstream" (too avoid confusion with import-new-upstream). - allow to set default tag names in debian/.git-dpm (overriden by the old done via git-config) - add more possible variants in tag names templates (for different : and ~ escaping) - add --exclude options to import-tar and import-new-upstream - several small bugfixes Changes between 0.8.4 and 0.8.5: - fix handling of Author: lines in patches to import - try harder to find dpatch patches - fix importing .tar files with hardlinks - several small documentation fixes and improvements Changes between 0.8.3 and 0.8.4: - try harder to import dpatch patches - import-dsc --use-changelogs properly sets data of imported 1.0 patches Changes between 0.8.2 and 0.8.3: - fix manpage to produce correct hyphen-minus (0x2D) Changes between 0.8.1 and 0.8.2: - fix git version parsing - fix some manpage examples Changes between 0.8.0 and 0.8.1: - various bugfixes Changes between 0.7.1 and 0.8.0: - require at least git 1.7.2 - add record-dsc command to record a pristine .dsc file with contents - rewrite merge operation + add --ignore-deletions option to control file deletion + add --dot-git-files to control .git* behaviour - add --branch option to import-tar - use --no-signature in format-patch calls - add dpm.importWithoutParent config - author information can be set when importing tarballs - add --use-changelog to import-dsc - fix some little glitches and rough edges. Changes between 0.7.0 and 0.7.1: - bugfix: calculate size of files behind symlinks correctly Changes between 0.6.0 and 0.7.0: - add --init and --branch options to import-new-upstream - improve import-dsc (now looks more like generated in a normal workflow) - add --date option to import-tar - allow 'NONE' to disable a specific type of tag - add 'ref-tag' to tag a not checked out version - many small bugfixes, most prominently: + support branch names with slashes + make branch..dpmPatchedBranch actually work Changes between 0.5.0 and 0.6.0: - more checks to avoid running when not safe to - improve importing .tar files - make tag names git-dpm tag produces configurable - make related branch names configurable - wait a second between importing patches to not confuse git Changes between 0.4.0 and 0.5.0: - add support for .orig-component.tar files - add support for importing patches in subdirectories - add support for creating patches in subdirectories - add support for creating patches with arbirary names - warn against changes in the debian branch better - add --pristine-tar-commit option to import-dsc and import-new-upstream - remove 'git-dpm init --no-commit' option - do not get confused by importing patches with "Author:" not in git format Changes between 0.3.0 and 0.4.0: - allow running some commands without a branch checked out - multiple improvements to the implementation and some bugfixes Changes between 0.2.0 and 0.3.0: - add 'dch' command - many bugfixes, more prominently: + 'init' with upstream branch not yet existing + 'merge-patched' multiple issues (was only broken when called directly) + '--date' for the commands it was documented to work with (but didn't) Changes between 0.1.2 and 0.2.0: - add import-dsc command - add support for importing dpatch patches (only real patches are supported, no idea what happens with non-patches. Architecture specific patches are ignored) - add short aliases for most commands - many small bugfixes and improvements. Changes between 0.1.1 and 0.1.2: - multiple small bugfixes Changes between 0.1.0 and 0.1.1: - more end-of-patch-description detection magic - fix parsing problem when importing a patch series with filenames containing -p - fix error caused by typo in update-patches - fix some spelling mistakes git-dpm-0.9.1/Makefile.in0000644000175100017510000005662612420416171012067 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) COPYING \ ac/install-sh ac/missing $(top_srcdir)/ac/install-sh \ $(top_srcdir)/ac/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(htmldir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(html_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ GIT = @GIT@ GROFF = @GROFF@ GS = @GS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PS2PDF = @PS2PDF@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bin_SCRIPTS = git-dpm MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/stamp-h.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in $(srcdir)/INSTALL EXTRA_DIST = git-dpm.sh git-dpm.1 index.html examples.html git-dpm.sh image.ps IMAGES = image-full.png image-patches.png image-cloned.png image-prepared.png image-checkout.png image-commit.png image-updated.png image-tag.png image-newupstream.png image-upstreamrecorded.png image-rebased.png image-rebaserecorded.png image-newtag.png image-1.png image-2.png image-3.png image-4.png image-5.png image-6.png CLEANFILES = manpage.pdf manpage.html git-dpm $(IMAGES) @BUILDDOCS_TRUE@man_MANS = git-dpm.1 @BUILDDOCS_TRUE@html_DATA = index.html examples.html manpage.html $(IMAGES) manpage.pdf @BUILDDOCS_TRUE@GS_FLAGS = -dBATCH -dNOPAUSE -dSAFER @BUILDDOCS_TRUE@GS_PNG_OPTIONS = -sDEVICE=png16 -g600x300 -r100x100 @BUILDDOCS_TRUE@PS2PDF_FLAGS = -sPAPERSIZE=a4 all: all-am .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-htmlDATA: $(html_DATA) @$(NORMAL_INSTALL) @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done uninstall-htmlDATA: @$(NORMAL_UNINSTALL) @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(htmldir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(htmldir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-htmlDATA install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-htmlDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am am--refresh check check-am clean clean-generic \ clean-local cscopelist-am ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-htmlDATA \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am \ uninstall-binSCRIPTS uninstall-htmlDATA uninstall-man \ uninstall-man1 clean-local: -rm -rf autom4te.cache $(srcdir)/autom4te.cache maintainer-clean-local: -rm -rf $(srcdir)/ac git-dpm: git-dpm.sh Makefile sed -e 's#^VERSION=.*#VERSION="${PACKAGE_VERSION}"#' \ -e 's#^GIT=.*#GIT="${GIT}"#' \ $< > $@ @BUILDDOCS_TRUE@image-%.png: image.ps @BUILDDOCS_TRUE@ $(GS) $(GS_FLAGS) $(GS_PNG_OPTIONS) -sOutputFile="$@" -sMYPARAMETER="$*" $< @BUILDDOCS_TRUE@manpage.pdf: git-dpm.1 @BUILDDOCS_TRUE@ $(GROFF) -T ps -mandoc $< | $(PS2PDF) $(PS2PDF_FLAGS) - > $@ @BUILDDOCS_TRUE@manpage.html: git-dpm.1 @BUILDDOCS_TRUE@ $(GROFF) -T html -mandoc $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: git-dpm-0.9.1/configure0000755000175100017510000033101312420416171011713 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for git-dpm 0.9.1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: git-scm-devel@alioth.debian.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='git-dpm' PACKAGE_TARNAME='git-dpm' PACKAGE_VERSION='0.9.1' PACKAGE_STRING='git-dpm 0.9.1' PACKAGE_BUGREPORT='git-scm-devel@alioth.debian.org' PACKAGE_URL='' ac_unique_file="git-dpm.sh" ac_subst_vars='LTLIBOBJS LIBOBJS GROFF PS2PDF GS BUILDDOCS_FALSE BUILDDOCS_TRUE GIT MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_documentation ' ac_precious_vars='build_alias host_alias target_alias GIT GS PS2PDF GROFF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures git-dpm 0.9.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/git-dpm] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of git-dpm 0.9.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-documentation don't build documentation Some influential environment variables: GIT Git binary the installed script should use GS Ghostscript interpreter to generate the images for the documentation PS2PDF ps2pdf binary to produce manpage.pdf GROFF Groff binary (supporting mandoc, ps and html output) Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF git-dpm configure 0.9.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by git-dpm $as_me 0.9.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in ac "$srcdir"/ac; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in ac \"$srcdir\"/ac" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.14' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='git-dpm' VERSION='0.9.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Extract the first word of "git", so it can be a program name with args. set dummy git; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_GIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$GIT"; then ac_cv_prog_GIT="$GIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_GIT="git" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi GIT=$ac_cv_prog_GIT if test -n "$GIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5 $as_echo "$GIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$GIT" = x ; then as_fn_error $? "GIT variable not set and no git found!" "$LINENO" 5 fi builddocs=true # Check whether --enable-documentation was given. if test "${enable_documentation+set}" = set; then : enableval=$enable_documentation; if test x$enableval = xno ; then builddocs=false else builddocs=true fi else builddocs=true fi if $builddocs; then BUILDDOCS_TRUE= BUILDDOCS_FALSE='#' else BUILDDOCS_TRUE='#' BUILDDOCS_FALSE= fi if $builddocs ; then # Extract the first word of "gs", so it can be a program name with args. set dummy gs; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_GS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$GS"; then ac_cv_prog_GS="$GS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_GS="gs" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi GS=$ac_cv_prog_GS if test -n "$GS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GS" >&5 $as_echo "$GS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$GS" = x ; then as_fn_error $? "GS variable not set and no ghostscript gs found! Try --disable-documentation to do without." "$LINENO" 5 fi # Extract the first word of "ps2pdf", so it can be a program name with args. set dummy ps2pdf; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PS2PDF+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PS2PDF"; then ac_cv_prog_PS2PDF="$PS2PDF" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PS2PDF="ps2pdf" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PS2PDF=$ac_cv_prog_PS2PDF if test -n "$PS2PDF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PS2PDF" >&5 $as_echo "$PS2PDF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$PS2PDF" = x ; then as_fn_error $? "PS2PDF variable not set and no ps2pdf found! Try --disable-documentation to do without." "$LINENO" 5 fi # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_GROFF+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$GROFF"; then ac_cv_prog_GROFF="$GROFF" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_GROFF="groff" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi GROFF=$ac_cv_prog_GROFF if test -n "$GROFF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GROFF" >&5 $as_echo "$GROFF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$GROFF" = x ; then as_fn_error $? "GROFF variable not set and no groff found! Try --disable-documentation to do without." "$LINENO" 5 fi fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILDDOCS_TRUE}" && test -z "${BUILDDOCS_FALSE}"; then as_fn_error $? "conditional \"BUILDDOCS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by git-dpm $as_me 0.9.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ git-dpm config.status 0.9.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi git-dpm-0.9.1/image.ps0000644000175100017510000002013312420414724011432 00000000000000%!PS-Adobe-1.0 %%DocumentFonts: Times-Roman Times-Bold %%Title: Image for the git-dpm documenation %%Creator: Bernhard R. Link %%CreationDate: 2010-01-11 %%BoundingBox: 0 0 387 210 %%EndComments % Copyright (C) 2010 Bernhard R. Link % This document is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License version 2 as % published by the Free Software Foundation. % % This program 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 General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc. /inch { 72 mul } def /circle { % x y r dup % x y r r 3 index % x y r r x add % x y r r+x 2 index % x y r x+r y moveto % x y r 0 360 arc } def /shearfactor 0.65 def /radius 0.3 def /labely 3 radius 3 mul add def /labelx 7 4 shearfactor mul add def /xdef { exch def } def /setnodefont { /Times-Roman findfont 0.5 scalefont setfont } def /setlabelfont { /Times-Roman findfont 0.35 scalefont setfont } def /setboldlabelfont { /Times-Bold findfont 0.35 scalefont setfont } def 1 dict dup /colors xdef begin /tag { 1.0 1.0 0.0 setrgbcolor } def /branch { 0.0 1.0 0.0 setrgbcolor } def /nodeline { 0.0 setgray } def /upstream { 1.0 0.0 0.0 setrgbcolor } def /patch { 1.0 0.0 1.0 setrgbcolor } def /debian { 0.0 0.0 1.0 setrgbcolor } def end 1 dict dup /textcolors xdef begin /branch{ 0.0 0.0 0.0 setrgbcolor } def /tag { 0.0 0.0 0.0 setrgbcolor } def /upstream { 1.0 1.0 1.0 setrgbcolor } def /patch { 1.0 1.0 1.0 setrgbcolor } def /debian { 1.0 1.0 1.0 setrgbcolor } def end /setcolor { colors exch get exec } def /settextcolor { textcolors exch get exec } def /calcpos { % x y exch 1 index % y x y shearfactor mul add radius add exch radius add } def /node { % color text x y calcpos 2 copy /lastnodey xdef /lastnodex xdef 0 setlinewidth /nodeline setcolor 0.0 setgray 2 copy newpath radius circle gsave 3 index setcolor fill grestore stroke % color text x y radius 0.5 mul sub moveto % color text exch settextcolor setnodefont dup stringwidth -0.5 mul exch -0.5 mul exch rmoveto show } def /addtag { setlabelfont newpath 0.0 setgray lastnodex lastnodey radius add moveto lastnodex labely radius 2 div sub lineto stroke newpath lastnodex radius 2 div sub labely moveto radius 2 div dup neg rlineto radius 2 div dup rlineto dup stringwidth pop 0.2 add 0 exch rlineto radius neg 0 rlineto closepath gsave /tag setcolor fill grestore stroke gsave lastnodex radius 3 div add labely 0.1 add translate 90 rotate 0 0 moveto /tag settextcolor show grestore } def /branchboldin << /master [ (full) (cloned) (prepared) (updated) (tag) (rebaserecorded) (newtag) (3) ] /upstream [ (newupstream) (upstreamrecorded) ] /patched [ (checkout) (commit) (rebased) (1) (2) (4) (5) (6)] >> def /addbranch { dup branchboldin exch get isin { setboldlabelfont } { setlabelfont } ifelse newpath 0.0 setgray lastnodex radius add lastnodey moveto labelx lastnodey lineto stroke newpath labelx lastnodey radius 2 div sub moveto 0 radius rlineto dup stringwidth pop 0.2 add 0 rlineto 0 radius neg rlineto closepath gsave /branch setcolor fill grestore stroke labelx 0.1 add lastnodey radius 3 div sub moveto /branch settextcolor show } def /doline { 0.1 setlinewidth setcolor newpath calcpos moveto calcpos lineto stroke } def /MYPARAMETER where { pop } { /MYPARAMETER (full) def } ifelse /isin { false exch { MYPARAMETER eq { pop true exit } if } forall } def /disableifin { exch isin not exch if } def /enableifin { exch isin exch if } def %%EndProlog %%Page: image 1 gsave 0.5 inch 0.5 inch scale [ (cloned) (prepared) (checkout) (commit) (updated) (tag)] { 0 0 4 0 /upstream doline } disableifin 0 0 0 1 /patch doline [ (cloned) (prepared) (checkout) ] { 0 1 1 2 /patch doline } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) ] { 4 0 4 1 /patch doline 4 1 4 2 /patch doline } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) ] { 4 1 5 2 /patch doline } disableifin [ (5) ] { 5 2 6 2 /patch doline } enableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) (3) (4) (5) ] { 4 0 6 1 /patch doline 6 1 6 2 /patch doline } disableifin [ (patches) ] { 0 1 0 3 /debian doline } disableifin [ (patches) (cloned) (prepared) (checkout) (commit)] { 1 2 1 3 /debian doline 0 3 1 3 /debian doline } disableifin [ (upstreamrecorded) (rebased) ] { 1 3 3 3 /debian doline } enableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased)] { 1 3 4 3 /debian doline 4 2 4 3 /debian doline } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) ] { 5 2 5 3 /debian doline 4 3 5 3 /debian doline } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) (3) (4) (5) (6) ] { 6 2 6 3 /debian doline 5 3 6 3 /debian doline } disableifin /upstream (1) 0 0 node (upstream-1) addtag [ (cloned) (prepared) (checkout) (commit) (updated) (tag) ] { /upstream (2) 4 0 node } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) ] { (upstream-2) addtag } disableifin [ (patches) (full) (cloned) ] { (upstream) addbranch } disableifin /patch (A) 0 1 node (patched-1-1) addtag [ (cloned) (prepared) (checkout) ] { /patch (B) 1 2 node } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) ] { (patched-1-2) addtag } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) ] { /patch (a) 4 1 node /patch (b) 4 2 node } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) ] { (patched-2-1) addtag } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) ] { /patch (b') 5 2 node } disableifin [ (5) ] { /patch (a+) 6 2 node } enableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) (3) (4) (5) ] { /patch (a') 6 1 node /patch (b') 6 2 node } disableifin [ (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) (3) (4) (5) (6) ] { (patched-2-2) addtag } disableifin [ (patches) (full) (cloned) (prepared) (updated) (tag) (newupstream) (upstreamrecorded) (rebaserecorded) (newtag) (3) ] { (patched) addbranch } disableifin [ (patches) ] { /debian () 0 3 node (debian-1-1) addtag } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) ] { /debian () 1 3 node } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) ] { (debian-1-2) addtag } disableifin [ (upstreamrecorded) (rebased) ] { /debian () 3 3 node } enableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) ] { /debian () 4 3 node } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded)] { (debian-2-1) addtag } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) ] { /debian () 5 3 node } disableifin [ (patches) (cloned) (prepared) (checkout) (commit) (updated) (tag) (newupstream) (upstreamrecorded) (rebased) (rebaserecorded) (newtag) (1) (2) (3) (4) (5) (6)] { /debian () 6 3 node (debian-2-2) addtag } disableifin [ (patches) ] { (master) addbranch } disableifin grestore showpage %%Trailer git-dpm-0.9.1/configure.ac0000644000175100017510000000277712420416065012310 00000000000000dnl dnl Process this file with autoconf to produce a configure script dnl AC_INIT(git-dpm, 0.9.1, git-scm-devel@alioth.debian.org) AC_CONFIG_SRCDIR(git-dpm.sh) AC_CONFIG_AUX_DIR(ac) AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability]) AM_MAINTAINER_MODE AC_PROG_INSTALL AC_ARG_VAR([GIT], [Git binary the installed script should use]) AC_CHECK_PROG([GIT], [git], [git]) if test x"$GIT" = x ; then AC_MSG_ERROR([GIT variable not set and no git found!]) fi builddocs=true AC_ARG_ENABLE([documentation], AS_HELP_STRING([--disable-documentation], [don't build documentation]), [ if test x$enableval = xno ; then builddocs=false else builddocs=true fi], [builddocs=true]) AM_CONDITIONAL(BUILDDOCS, $builddocs) AC_ARG_VAR([GS], [Ghostscript interpreter to generate the images for the documentation]) AC_ARG_VAR([PS2PDF], [ps2pdf binary to produce manpage.pdf]) AC_ARG_VAR([GROFF], [Groff binary (supporting mandoc, ps and html output)]) if $builddocs ; then AC_CHECK_PROG([GS], [gs], [gs]) if test x"$GS" = x ; then AC_MSG_ERROR([GS variable not set and no ghostscript gs found! Try --disable-documentation to do without.]) fi AC_CHECK_PROG([PS2PDF], [ps2pdf], [ps2pdf]) if test x"$PS2PDF" = x ; then AC_MSG_ERROR([PS2PDF variable not set and no ps2pdf found! Try --disable-documentation to do without.]) fi AC_CHECK_PROG([GROFF], [groff], [groff]) if test x"$GROFF" = x ; then AC_MSG_ERROR([GROFF variable not set and no groff found! Try --disable-documentation to do without.]) fi fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT git-dpm-0.9.1/git-dpm.10000644000175100017510000013415612420416065011442 00000000000000.TH GIT-DPM 1 "2012-05-15" "git\-dpm" GIT-DPM \" I don't want hyphen (U+2010), nor minus (U+2212), but hyphen-minus(U+002D) .char \- \N'45' .char - \N'45' \" some for "'" .char ' \N'39' .SH NAME git\-dpm \- Debian packages in git manager .SH SYNOPSIS .B git\-dpm \-\-help .B git\-dpm [ \fIoptions\fP ] \fIcommand\fP [ \fIper\-command\-options and \-arguments\fP ] .SH DESCRIPTION Git\-dpm is a tool to handle a Debian source package in a git repository. Each project contains three branches, a Debian branch (\fBmaster\fP/\fIwhatever\fP), a patched branch (\fBpatched\fP/\fBpatched\-\fP\fIwhatever\fP) and an upstream branch (\fBupstream\fP/\fBupstream\-\fP\fIwhatever\fP) and \fBgit\-dpm\fP helps you store the information in there so you have your changes exportable as quilt series. Git\-dpm will guess the other two branches based on the branch it sees. (Most commands act based on the current HEAD, i.e. what branch you have currently checked out, though some as e.g. \fBstatus\fP allows an optional argument instead). So for example, if you are in branch \fBmaster\fP, git\-dpm assumes the corresponding upstream branch is called \fBupstream\fP. If you are in branch \fBupstream\-something\fP, it assumes the Debian branch is called \fBsomething\fP. Note that most commands may switch to another branch automatically, partly because it is easier to implement that way and hopefully so one does not need to switch branches manually so often. .SH SHORT EXPLANATION OF THE BRANCHES .IP "the upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP)" This branch contains the upstream sources. Its contents need to be equal enough to the contents in your upstream tarball. .IP "the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP)" This branch contains your patches to the upstream source. Every commit will be stored as a single patch in the resulting package. Most of the time it will not exist as a branch known to \fBgit\fP, but only as some point in the history of the Debian branch and possibly as tag for published versions. \fBGit\-dpm\fP will create it when needed and remove the branch when no longer needed. To help git generate a linear patch series, this should ideal be a linear chain of commits, whose description are helpful for other people. As this branch is regularly rebased, you should not publish it. .IP "the Debian branch (\fBmaster\fP|\fP\fIwhatever\fP)" This is the primary branch. This branch contains the \fBdebian/\fP directory and has the patched branch merged in. Every change not in \fBdebian/\fP, \fB.git\fP\fI*\fP or deleting files must be done in the patched branch. .SH EXAMPLES Let's start with some examples: .IP "Checking out a project" First get the master branch: \fBgit clone\fP \fIURL\fP Then create upstream branch and see if the .orig.tar is ready: \fBgit\-dpm prepare\fP Create the patched branch and check it out: \fBgit\-dpm checkout\-patched\fP Do some changes, apply some patches, commit them.. \fI...\fP \fBgit commit\fP If your modification fixes a previous change (and that is not the last commit, otherwise you could have used \-\-amend), you might want to squash those two commits into one, so use: \fBgit rebase \-i upstream\fP Then you want to get those changes into the Debian branch and the new patch files created (which you can do using \fBgit\-dpm update\-patches\fP), but you most likely want to also document what you did in the changelog, so all in one step: \fBgit\-dpm dch \-\- \-i\fP Perhaps change something in the Debian packaging: \fI...\fP \fBgit commit \-a\fP Then push the whole thing back: \fBgit push\fP .IP "Switching to a new upstream version" Get a new .orig.tar file. Either upgrade your upstream branch to the contents of that file and call \fBgit\-dpm record\-new\-upstream ../\fP\fInew\-stuff\fP\fB.orig.tar.gz\fP or tell git\-dpm to import and record it: \fBgit\-dpm import\-new\-upstream \-\-rebase ../\fP\fInew\-stuff\fP\fB.orig.tar.gz\fP This will rebase the patched branch to the new upstream branch, perhaps you will need to resolve some conflicts: \fIvim ...\fP \fBgit add\fP \fIresolved files\fP \fBgit rebase \-\-continue\fP After rebase is run (with some luck even in the first try): \fBgit\-dpm dch \-\- \-v \fP\fInewupstream\fP\fB\-1 "new upstream version"\fP You could have also done the last step in three by: \fBgit\-dpm update\-patches\fP \fBdch \-\- \-v \fP\fInewupstream\fP\fB\-1 "new upstream version"\fP \fBgit commit \-\-amend \-a\fP Do other debian/ changes: \fI...\fP \fBgit commit \-a\fP Then push the whole thing back: \fBgit push\fP .IP "Creating a new project" Create an \fBupstream\fP (or \fBupstream\-\fP\fIwhatever\fP) branch containing the contents of your orig.tar file: \fBtar \-xvf \fP\fIexample\fP\fB\(ul\fP\fI0\fP\fB.orig.tar.gz\fP \fBcd \fP\fIexample\fP\fB\-\fP\fI0\fP \fBgit init\fP \fBgit add .\fP \fBgit commit \-m "import \fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz"\fP \fBgit checkout \-b upstream\-unstable\fP You might want to use pristine tar to store your tar: \fBpristine\-tar commit ../\fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz upstream\-unstable\fP Then let git\-dpm know what tarball your upstream branch belongs to: \fBgit\-dpm init ../\fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz\fP Note that since you were in \fBupstream\-unstable\fP in this example, in the last example \fBgit\-dpm\fP assumed you want your Debian branch called \fBunstable\fP and not \fBmaster\fP, so after the command returned you are in the newly created \fBunstable\fP branch. Do the rest of the packaging: \fIvim\fP \fBdebian/control debian/rules\fP \fBdch \-\-create \-\-package \fP\fIexample\fP\fB \-v \fP\fI0\fP\fB\-1\fP \fBgit add debian/control debian/rules debian/changelog\fP \fBgit commit \-m "initial packaging"\fP Then add some patches: \fBgit\-dpm checkout\-patched\fP \fIvim ...\fP \fBgit commit \-a\fP \fBgit\-dpm dch "\fP\fIfix ... (Closes: num)\fP\fB"\fP The \fBgit\-dpm checkout\-patched\fP created a temporary branch \fBpatched\-unstable\fP (as you were in a branch called \fPunstable\fP. If you had called it with HEAD being a branch \fBmaster\fP, it would have been \fBpatched\fP) to which you added commits. Then the \fBgit\-dpm update\-patches\fP implied by \fBgit\-dpm dch\fP merged those changes into \fBunstable\fP, deleted the temporary branch and created new \fBdebian/patches/\fP files. Then build your package: \fBgit\-dpm status &&\fP \fB dpkg\-buildpackage \-rfakeroot \-us \-uc \-I".git*"\fP Now take a look what happened, perhaps you want to add some files to \fB.gitignore\fP (in the \fBunstable\fP branch), or remove some files from the \fBunstable\fP branch because your clean rule removes them. Continue the last few steps until the package is finished. Then push your package: \fBgit\-dpm tag\fP \fBgit push \-\-tags \fP\fItarget\fP\fB unstable:unstable pristine\-tar:pristine\-tar\fP .IP "Removing existing patches" First get the master branch: \fBgit clone\fP \fIURL\fP Create the patched branch and check it out: \fBgit\-dpm checkout\-patched\fP Get a list of commits since the last upstream release: \fBgit rebase \-i upstream\-unstable\fP This will open your default editor with a list of commits. Edit the list to remove undesired commits. \fI...\fP \fBgit commit\fP Then you want to get those changes into the Debian branch and the old patch files deleted (which you can do using \fBgit\-dpm update\-patches\fP), but you most likely want to also document what you did in the changelog, so all in one step: \fBgit\-dpm dch \-\- \-i\fP Perhaps change something in the Debian packaging: \fI...\fP \fBgit commit \-a\fP Then push the whole thing back: \fBgit push\fP .SH GLOBAL OPTIONS .TP .B \-\-debug Give verbose output what git\-dpm is doing. Mostly only useful for debugging or when preparing an bug report. .TP .B \-\-debug\-git\-calls Output git invocations to stderr. (For more complicated debugging cases). .TP .B \-\-allow\-changes\-in\-debian\-branch Ignore upstream changes in your Debian branch. This will either discard them if merge\-patched is called by come command or them being ignored elsewhere. .SH COMMANDS .TP .B init \fR[\fP\fIoptions\fP\fR]\fP \fItarfile\fP \fR[\fP\fIupstream-commit\fP \fR[\fP\fIpreapplied-commit\fP \fR[\fP\fIpatched-commit\fP\fR]]]\fP Create a new project. The first argument is an upstream tarball. You also need to have the contents of that file and the files given with \-\-component unpackaged as some branch or commit in your git repository (or similar enough so \fBdpkg\-source\fP will not know the difference). This will be stored in the upstream branch (called \fBupstream\fP or \fBupstream\-\fP\fIwhatever\fP). If the second argument is non-existing or empty, that branch must already exist, otherwise that branch will be initialized with what that second argument. (It's your responsibility that the contents match. git\-dpm does not know what your clean rule does, so cannot check (and does not even try to warn yet)). You can already have an Debian branch (called \fBmaster\fP or \fBwhatever\fP). If it does not exist, it will exist afterwards. Otherwise it can contain a \fBdebian/patches/series\fP file, which git\-dpm will import. The third argument can be a descendant of your upstream branch, that contains the changes of your Debian branch before any patches are applied (Most people prefer to have none and lintian warns, but if you have some, commit/cherry pick them in a new branch/detached head on top of your upstream branch and name them here). Without \-\-patches\-applied, your Debian branch may not have any upstream changes compared to this commit (or if it is not given, the upstream branch). If there is no fourth argument, git\-dpm will apply possible patches in your Debian branch on top of the third argument or upstream. You can also do so yourself and give that as fourth argument. The contents of this commit/branch given in the fourth commit or created by applying patches on top of the third/your upstream branch is then merged into your Debian branch and remembered as patched branch. Options: .RS .TP .B \-\-component \fIfilename\fP Record a \fB.orig\-\fP\fIcomponent\fP\fB.tar\fP file to be unpacked in your upstream branch. .TP .B \-\-patches\-applied Denote the Debian branch already has the patches applied. Without this git\-dpm will check there are no changes in the Debian branch outside patch management before applying the patches; with this, it will instead check there are no differences after applying the patches. .TP .B \-\-create\-no\-patches Do not create/override \fBdebian/patches\fP directory. You will have to call \fBupdate\-patches\fP yourself. Useful if you are importing historical data and keep the original patches in the Debian branch. .TP .B \-\-record\-patch\-category Add a \fBPatch-Category:\fP field to each imported patch that is in a subdirectory of \fBdebian/patches\fP. This causes \fBupdate\-patches\fP to store it in the same subdirectory. .TP .B \-\-record\-patch\-name Add a \fBPatch-Name:\fP field to each imported patch with its name. This causes \fBupdate\-patches\fP to store it under its original name. .RE .TP .B prepare Make sure upstream branch and upstream orig.tar ball are there and up to date. (Best called after a clone or a pull). .TP .B status \fR[\fP\fIbranch\fP\fR]\fP Check the status of the current project (or of the project belonging to the argument \fIbranch\fP if that is given). Returns with non-zero exit code if something to do is detected. .TP .B checkout\-patched Checkout the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP) after making sure it exists and is one recorded in the \fBdebian/.git\-dpm\fP file. If the patched branch references an old state (i.e. one that is already ancestor of the current Debian branch), it is changed to the recorded current one. Otherwise you can reset it to the last recorded state with the \fB\-\-force\fP option. .TP .B update\-patches \fR[\fP\fIoptions\fP\fR] [\fP\fIbranch-name\fP\fR]\fP After calling \fBmerge\-patched\-into\-debian\fP if necessary, update the contents of \fBdebian/patches\fP to the current state of the \fBpatched\fP branch. Also record in debian/.git\-dpm which state of the patched branch the patches directory belongs to. If a \fIbranch-name\fP is given, that branch is processed. Otherwise the name is derived from the currently checked out branch as usual. Options: .RS .TP .B \-\-redo Do something, even if it seems like there is nothing to do. .TP .BR \-\-allow\-revert ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files=\fI*\fP passed on to merge\-patched\-into\-debian .TP .B \-\-amend Do not create a new commit, but amend the last one in the Debian branch. (I.e. call merge\-patched\-into\-debian with \-\-amend and amend the updates patches into the last commit even if that was not created by merge\-patched\-into\-debian). .TP .B \-m \fImessage\fP Use \fImessage\fP as commit message. (If used together with \-\-amend, do not reuse old commit message, author or author date but replace the old commit with a new commit with that message). .TP .B \-\-keep\-branch do not remove an existing patched branch (usually that is removed and can be recreated with \fBcheckout\-patched\fP to avoid stale copies lurking around. .TP .B \-\-allow\-nonlinear passed to merge\-patched. .RE .TP .B dch \fR[\fP\fIoptions\fP\fR]\fP \-\- \fIdch-options\fP After calling update\-patches if necessary, run devscripts' dch with the specified options and then do a \fBgit commit\fP with a commit message containing changes to the \fBdebian/changelog\fP file. Options: .RS .TP .B \-\-amend Replace the commit currently the head of the Debian branch (\fBmaster\fP|\fIsomething\fP) instead of creating a new one on top. The commit message will also include changes done to \fBdebian/changelog\fP in the previous commit (unless reverted by the new edit). .TP .B \-\-ignore\-patches Do not call update\-patches but simply ignore the current state of the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIsomething\fP). .TP .BR \-\-keep\-branch ", " \-\-allow\-revert ", " \-\-allow\-nonlinear ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files=\fI*\fP Passed to update\-patches, if called. .TP .BR \-\-latest\-only | \-\-latest | \-l Only include changes between the current working directory before calling dch and after calling it (and not since the last commit or the last commit not replaced). .TP .BR \-e " | " \-v " | " \-a " | " \-\-all " | " \-s " | " \-n " | " \-\-no\-verify " | " \-u " | " \-\-untracked\-files " | " \-q " | " \-\-quiet " | " \-\-cleanup=\fI...\fP " | " \-\-author=\fI...\fP passed to git commit. .RE .TP .B merge\-patched\-into\-debian \fR[\fP\fIoptions\fP\fR] [\fR\fIbranch-name\fP\fR]\fP Usually \fBupdate\-patches\fP runs this for you if deemed necessary. This command is the core of \fBgit\-dpm\fP, but you usually do not call it directly. It is called by \fBupdate\-patches\fP and things calling \fBupdate\-patches\fP like \fBdch\fP when necessary. It replaces all files (with only the exceptions described below) in the current Debian branch (\fBmaster\fP|\fIwhatever\fP) with those found in the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP). Only the \fBdebian\fP directory and files in the root directory starting with ".git" are kept from the Debian branch (so \fB.gitignore\fP, \fB.gitattributes\fP, ... will stay). And all files that were found in the last recorded patched branch and deleted in the current Debian branch will also be deleted in the new one. Additionally the \fBdebian/.git\-dpm\fP file will be updated so the current patched branch is recorded and is marked as belonging to the last recorded upstream branch. If there is no \fIbranch-name\fP given on the command line the base name of the branches to operate on is computed from the currently checked out branch as usual. Otherwise this argument is used. Options: .RS .TP .B \-\-allow\-revert Usually reverting to an old state of the patched branch is not allowed, to avoid mistakes (like having only pulled the Debian branch and forgot to run \fBcheckout\-patched\fP). This option changes that so you can for example drop the last patch in your stack. .TP .BR \-\-no\-ignore\-deletions " (default)" Files deleted currently in the Debian branch relative to the recorded patched branch will still be deleted in the new Debian branch and not taken from the new patched branch. This is the default unless a different default was set with \fBgit config dpm.\fP\fIBRANCHNAME\fP\fB.dpmIgnoreDeletions true\fP. .TP .B \-\-ignore\-deletions Disable the behavior described in \fB\-\-no\-ignore\-deletions\fP. .TP .BI \-\-dot\-git\-files= method Specify how files starting with \fB.git\fP outside \fBdebian/\fP are handled. Those are handles specially as \fB.gitattributes\fP and \fB.gitignore\fP might be different in the Debian branch without being part of any patch. (The whole \fBdebian/\fP directory is always taken from the Debian branch, so files there are not affected). Possible methods are: .RS .TP .BR automatic " (default)" Any \fB.git\fP\fI*\fP files that are added, modified or removed in the current Debian branch compared to the old upstream branch are set to this state, everything else is taken as found in the new patched branch. .TP .B debian All \fB.git\fP\fI*\fP files are taken from the Debian branch. Files with a name like that from the patched branch are ignored. .TP .B upstream Files starting with \fB.git\fP are not given special handling. They are taken from the patched branch, unless they are deleted in the Debian branch and the default \fB\-\-no\-ignore\-deletions\fP is active. (i.e. just like any other file outside \fBdebian/\fP). .RE .TP .B \-\-keep\-branch do not remove an existing patched branch (usually that is removed and can be recreated with \fBcheckout\-patched\fP to avoid stale copies lurking around). .TP .B \-\-amend Replace the last commit on your Debian branch (as git commit \-\-amend would do). With the exception that every parent that is an ancestor of or equal to the new patched branch or the recorded patched branch is omitted. (That is, you lose not only the commit on the Debian branch, but also a previous state of the patched branch if your last commit also merged the patched branch). .TP .BI \-m " message" Commit message to use for the new commit created. (If used together with \-\-amend, this disables reusing the old author and date). .TP .B \-\-allow\-nonlinear do not abort with an error if the patched branch is no linear series of commits on top of the upstream branch. Using this option is not recommended as it easily hides problems with patched or upstream branch and may introduce broken debian/patches/ series, as format-patch does no serialisation. .RE .TP .B import\-new\-upstream \fR[\fIoptions\fR]\fP \fI.orig.tar\fP Import the contents of the given tarfile (as with \fBimport\-tar\fP) and record this branch (as with \fBrecord\-new\-upstream\fP). This is roughly equivalent to: \fBgit\-dpm import\-tar \-p \fP\fIupstream\fP \fIfilename\fP \fBgit checkout \-b \fP\fIupstream\fP \fBgit\-dpm record\-new\-upstream \fP\fIfilename\fP .RS .TP .B \-\-detached Don't make the new upstream branch an ancestor of the old upstream branch (unless you re-add that with \fB\-p\fP). .TP .B \-p \fIcommit-id\fP\fR|\fP\-\-parent \fIcommit-id\fP Give \fBimport\-tar\fP additional parents of the new commit to create. For example if you track upstream's git repository in some branch, you can name that here to make it part of the history of your Debian branch. .TP .B \-\-allow\-no\-parent If dpm.importWithoutParent is set to false via git config, git\-dpm will not allow import\-new\-upstream to be run without this option or at least on \-p option. .TP .B \-\-rebase\-patched After recording the new upstream branch, rebase the patched branch to the new upstream branch. .TP .B \-\-no\-rebase\-patched Do not call rebase\-patched after recording the new upstream branch. (This is currently the default, but that may change in the future). .TP .B \-m \fImessage\fP Commit message to use for the new commit to the Debian branch recording the new file and upstream branch. .TP .B \-\-component \fIpackage\fP_\fIversion\fP.orig\-\fIcomponent\fP.tar\fI.gz\fP Unpack the specified filename into the \fIcomponent\fP directory and record it so that \fBprepare\fP and \fBstatus\fP know to check for it. .TP .B \-\-init None of the branches yet exists, create them. As the branches to operate on are derived from \fBHEAD\fP if no \fB\-\-branch\fP option is given, you either need \fBHEAD\fP point to an not yet existing branch (like directly after \fBgit init\fP) or you need you give a name with \fB\-\-branch\fP. Otherwise one of the branches already exists and you only get an error message. .TP .B \-\-branch \fIdebianbranch\fP Don't derive the Debian branch name from current \fBHEAD\fP but use \fIdebianbranch\fP instead. (And upstream branch name and patched branch name derived from that as usual). .TP .B \-\-pristine\-tar\-commit \fR|\fP \-\-ptc Call \fBpristine\-tar commit\fP for all imported tarballs not yet found in the pristine\-tar branch. .TP .B \-\-no\-pristine\-tar\-commit Do not call \fBpristine\-tar commit\fP for all imported tarballs even if configured to do so by \fBgit config dpm.pristineTarCommit true\fP or by \fBgit config branch.\fPdebianbranch\fB.dpmPristineTarCommit true\fP. .TP .BR \-\-ignore\-deletions ", " \-\-dot\-git\-files= Passed to merge\-patched, if called (only done if there were no patches previously). .TP .B \-\-upstream\-author \fIauthor\fP Used as the \fB\-\-author\fP argument to \fBgit\-dpm import\-tar\fP. .TP .B \-\-upstream\-date \fIdate\fP Used as the \fB\-\-date\fP argument to \fBgit\-dpm import\-tar\fP (especially \fBauto\fP is supported to extract a date from the tar file). .TP .B \-\-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking. Can be given multiple times. .RE .TP .B import\-tar \fR[\fIoptions\fR]\fP \fI.tar-file\fP Create a new commit containing the contents of the given file. The commit will not have any parents, unless you give \fB\-p\fP options. .RS .TP .B \-p \fIcommit-id\fP\fR|\fP\-\-parent \fIcommit-id\fP Add the given commit as parent. (Can be specified multiple times). .TP .B \-\-branch \fIbranchname\fP\fR Create new branch \fIbranchname\fP if it does not already exist or replace \fIbranchname\fP with a commit created from the tarball with the current \fIbranchname\fP head as parent. .TP .B \-m \fImessage\fP Do not start an editor for the commit message, but use the argument instead. .TP .B \-\-date \fIdate\fP Date of the commit to create. If the value is \fBauto\fP then the newest date of any file or directory in the tarball is used. .TP .B \-\-author \fIauthor\fP Author of the commit to create. It has to be in the usual git format \fIauthor\fP \fB<\fP\fIemail\fP\fB>\fP. .TP .B \-\-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking. Can be given multiple times. .RE .TP .B record\-new\-upstream \fR[\fP\fIoptions\fP\fR]\fP \fI.orig.tar\fP \fR[\fP\fIcommit\fP\fR]\fP If you changed the upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP), git\-dpm needs to know which tarball this branch now corresponds to and you have to rebase your patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP) to the new upstream branch. If there is a second argument, this command first replaces your upstream branch with the specified commit. Then the new upstream branch is recorded in your Debian branch's \fBdebian/.git\-dpm\fP file. If you specified \fB\-\-rebase\-patched\fP (or short \fB\-\-rebase\fP), \fBgit\-dpm rebase\-patched\fP will be called to rebase your patched branch on top of the new upstream branch. After this (and if the branch then looks like what you want), you still need to call \fBgit\-dpm merge\-patched\-into\-debian\fP (or directly \fBgit\-dpm update\-patches\fP). \fBWARNING\fP to avoid any misunderstandings: You have to change the upstream branch before using this command. It's your responsibility to ensure the contents of the tarball match those of the upstream branch. .RS .TP .B \-\-rebase\-patched Automatically call \fBgit\-dpm rebase\-patched\fP. .TP .B \-\-new\-tarball\-only Don't refuse operation if the tarball changes but the upstream branch did not. (This is only sensible if the tarball changed without changing its contents, see the warning above). .TP .B \-m \fImessage\fP Commit message to use for the new commit to the Debian branch recording the new file and upstream branch. .TP .B \-\-amend Replace the last commit instead of creating a new one on top. .TP .B \-\-component \fIfilename\fP Record \fIfilename\fP as needed component source file (i.e. a \fIsourcename\fP\fB_\fP\fIupstreamversion\fP\fB.orig\-\fP\fIcomponent\fP\fB.tar.\fP\fIcompression\fP file). It's your responsible to have that file's contents already as part of your upstream branch (in a \fIcomponent\fP subdirectory). (Recorded files will be looked for by \fBstatus\fP and \fBprepare\fP. The list of recorded component source files is removed when a new upstream branch or upstream \fB.orig\fP source file is recorded). .TP .BR \-\-ignore\-deletions ", " \-\-\dot\-git\-files= Passed to merge\-patched, if called (which is only done if there were no patches previously, so the new upstream branch is merged in directly). .RE .TP .B rebase\-patched Try to rebase your current patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP) to your current current upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP). If those branches do not yet exist as git branches, they are (re)created from the information recorded in \fBdebian/.git\-dpm\fP first. This is only a convenience wrapper around git rebase that first tries to determine what exactly is to rebase. If there are any conflicts, git rebase will ask you to resolve them and tell rebase to continue. After this is finished (and if the branch then looks like what you want), you still need \fBmerge\-patched\-into\-debian\fP (or directly \fBupdate\-patches\fP). .TP .B tag \fR[\fP \fIoptions\fP \fR]\fP \fR[\fP \fIversion\fP \fR]\fP Add tags to the upstream, patched and Debian branches. If no version is given, it is taken from debian/changelog. Options: .RS .TP .B \-\-refresh Overwrite the tags if they are already there and differ (except upstream). .TP .B \-\-refresh\-upstream Overwrite the upstream if that is there and differs. .TP .B \-\-allow\-stale\-patches Don't error out if patches are not up to date. This is only useful if you are importing historical data and want to tag it. .TP .B \-\-named Use the package name as part of the names of the generated tags. (use \fBgit config dpm.tagsNamed true\fP to make this the default) .TP .B \-\-with\-name \fIname\fP Like \fB\-\-named\fP but give the name to use. .TP .B \-\-debian\-tag \fItag-name\fP .TP .B \-\-patched\-tag \fItag-name\fP .TP .B \-\-upstream\-tag \fItag-name\fP Specify the names of the tags to generate. .RS .HP \fB%p\fP is replaced with the package name, .HP \fB%v\fP with the version (without epoch) with colons (:) and tilde (~) replaced by underscore (_), .HP \fB%u\fP with the upstream version (without epoch or Debian revision) with colons (:) and tilde (~) replaced by underscore (_), .HP \fB%e\fP with the epoch, .HP \fB%f\fP with the epoch followed by an underscore (_) if there is an epoch, and with the empty string if there is no epoch, .HP \fB%V\fP with the version (without epoch) with colons (:) and tilde (~) replaced by dots (.), .HP \fB%U\fP with the upstream version (without epoch or Debian revision) with colons (:) and tilde (~) replaced with dots (.), .HP \fB%E\fP with the epoch followed by a dot if there is an epoch, and with the empty string if there is no epoch, .HP \fB%%\fP with a single \fB%\fP. .RE If one of those is not set via the command line option, \fBgit config\fP is asked about value of \fBdpm.debianTag\fP, \fBdpm.patchedTag\fP or \fBdpm.upstreamTag\fP. If that is also not set or the special value \fBAUTO\fP, then debian/.git-dpm is scanned for a line of the form \fBdebianTag="\fP\fIvalue\fP\fB"\fP, \fBpatchedTag="\fP\fIvalue\fP\fB"\fP or \fBupstreamTag="\fP\fIvalue\fP\fB"\fP. (Note: always add those to the end of the file, the first eight lines have fixed line numbers) If this still does not result in an pattern to use, the defaults are '\fB%p\-debian%e\-%v\fP', '\fB%p\-patched%e\-%v\fP' and '\fB%p\-upstream%e\-%u\fP' with \fB\-\-named\fP and '\fBdebian%e\-%v\fP', '\fBpatched%e\-%v\fP' and '\fBupstream%e\-%u\fP' without. If a tag name has the special value \fBNONE\fP, no tag is generated. .RE .TP .B ref\-tag \fR[ \fP\fIoptions\fP \fR]\fP \fIcommit\fP \fR[\fP \fIversion\fP \fR]\fP Like \fBtag\fP, but create tags for \fIcommit\fP, i.e. \fIcommit\fP will get the Debian tag and the other tags are placed where the \fBdebian/.git\-dpm\fP file of that commit points to. So it is mostly equivalent to: \fBgit checkout \-b temp \fP\fIcommit\fP \fBgit\-dpm tag \fR[\fP\fIoptions\fP\fR]\fP \fP\fR[\fP\fIversion\fP\fR]\fP \fBgit checkout \fP\fIprevious-head\fP \fBgit branch \-D temp\fP Options like \fBtag\fP. .TP .B apply\-patch \fR[\fP \fIoptions...\fP \fR]\fP \fR[\fP \fIfilename\fP \fR]\fP Switch to the patched branch (assuming it is up to date, use checkout\-patched first to make sure or get an warning), and apply the patch given as argument or from stdin. .RS .TP .B \-\-author "\fIauthor \fP" Override the author to be recorded. .TP .B \-\-defaultauthor "\fIauthor \fP" If no author could be determined from the commit, use this. .TP .B \-\-date "\fIdate\fP" Date to record this patch originally be from if non found. .TP .B \-\-dpatch Parse patch as dpatch patch (Only works for dpatch patches actually being a patch, might silently fail for others). .TP .B \-\-cdbs Parse patch as cdbs simple\-patchsys.mk patch (Only works for dpatch patches actually being a patch, might silently fail for others). .TP .B \-\-edit Start an editor before doing the commit (In case you are too lazy to amend). .TP .B \-\-record\-name Add a \fBPatch-Name:\fP field to tell \fBupdate\-patches\fP to export it with the same name again. .TP .B \-\-name \fIname\fP Add a \fBPatch\-Name:\fP field to tell \fBupdate\-patches\fP to use \fIname\fP as filename to store this patch into (relative to \fBdebian/patches\fP). .TP .B \-\-category \fIname\fP Add a \fBPatch\-Category:\fP field to tell \fBupdate\-patches\fP to always export this patch into a subdirectory \fIname\fP of \fBdebian/patches\fP. .RE .TP .B cherry\-pick \fR[\fP \fIoptions...\fP \fR]\fP \fIcommit\fP Recreate the patched branch and cherry\-pick the given commit. Then merge that back into the Debian branch and update the debian/patches directory (i.e. mostly equivalent to checkout\-patched, git's cherry\-pick, and update\-patches). .RS .TP .B \-\-merge\-only Only merge the patched branch back into the Debian branch but do not update the patches directory (You'll need to run update\-patches later to get this done). .TP .B \-e \fR|\fP \-\-edit Passed to git's cherry\-pick: edit the commit message picked. .TP .B \-s \fR|\fP \-\-signoff Passed to git's cherry\-pick: add a Signed\-off\-by header .TP .B \-x Passed to git's cherry\-pick: add a line describing what was picked .TP .B \-m \fInum\fP \fR|\fP \-\-mainline \fInum\fP Passed to git's cherry\-pick: allow picking a merge by specifying the parent to look at. .TP .B \-\-repick Don't abort if the specified commit is already contained. .TP .BR \-\-allow\-nonlinear ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files= Passed to update\-patches, if called. passed to merge\-patched\-into\-debian and update\-patches. .TP .B \-\-keep\-branch do not remove the patched branch when it is no longer needed. .TP .B \-\-amend passed to merge\-patched\-into\-debian: amend the last commit in the Debian branch. .RE .TP .B import\-dsc Import a Debian source package from a .dsc file. This can be used to create a new project or to import a source package into an existing project. While a possible old state of a project is recorded as parent commit, the state of the old Debian branch is not taken into account. Especially all file deletions and .gitignore files and the like need to be reapplied/re-added afterwards. (Assumption is that new source package versions from outside might change stuff significantly, so old information might more likely be outdated. And reapplying it is easier then reverting such changes.) First step is importing the \fB.orig.tar\fP file and possible \fB.orig\-\fP\fIcomponent\fP\fB.tar\fP files. You can either specify a branch to use. Otherwise \fBimport\-dsc\fP will look if the previous state of this project already has the needed file so the old upstream branch can be reused. If there is non, the file will be imported as a new commit, by default with a possible previous upstream branch as parent. Then \fBimport\-dsc\fP will try to import the source package in the state as \fBdpkg\-source \-x\fP would create it. (That is applying the .diff and making \fBdebian/rules\fP executable for 1.0 format packages and replacing the \fBdebian\fP directory with the contents of a .debian.tar and applying possible \fBdebian/patches/series\fP for 3.0 format packages). This is later referred to as verbatim import. If it is a 1.0 source format package, \fBimport\-dsc\fP then looks for a set of supported patch systems and tries to apply those patches. Those are then merged with the verbatim state into the new Debian branch. Then a \fBdebian/.git\-dpm\fP file is created and a possible old state of the project added as parent. Note that \fBdpkg\-source\fP is not used to extract packages, but they are extracted manually. Especially \fBgit\-apply\fP is used instead of \fBpatch\fP. While this generally works (and \fBgit\-dpm\fP has some magic to work around some of \fBgit\-apply\fP's shortcomings), unclean patches might sometimes need a \fB\-C0\fP option and then in same cases be applied at different positions than where \fBpatch\fP would apply them. General options: .RS .TP .B \-b \fR|\fP \-\-branch \fIbranch-name\fP Don't look at the current HEAD, but import the package into the git\-dpm project \fIbranchname\fP or create a new project (if that branch does not yet exist). .TP .B \-\-verbatim \fIbranch-name\fP After \fBimport\-dsc\fP has completed successfully, \fIbranch-name\fP will contain the verbatim import of the .dsc file. If a branch of that name already exists, the new verbatim commit will also have the old as parent. (This also causes the verbatim commit not being amended with other changes, which can result in more commits). .TP .B \-\-use\-changelog Parse debian/changelog of the imported package. Use the description as commit messages and the author and time as default for patches and import commits without that information. (Warning: may still contain some rough edges). .RE .RS Options about creating the upstream branch: .TP .B \-\-upstream\-to\-use \fIcommit\fP Do not import the .orig.tar nor try to reuse an old import, but always use the \fIcommit\fP specified. It is your responsibility that this branch is similar enough to the .orig.tar file plus possible .orig\-component.tar in their respective directories. (As usual, similar enough means: Does not miss any files that your patches touch or your build process requires (or recreates unless \fBdebian/rules clean\fP removes them again). Every file different than in .orig.tar or not existing there you must delete in the resulting Debian branch. No patch may touch those files.) Use with care. Nothing will warn you even if you use the contents of a totally wrong upstream version. .TP .B \-\-detached\-upstream If importing a .orig.tar as new commit, do not make an possible commit for an old upstream version parent. .TP .B \-\-upstream\-parent \fIcommit\fP Add \fIcommit\fP as (additional) parent if importing a new upstream version. (This can for example be used to make upstream's git history part of your package's history and thus help git when cherry-picking stuff). .TP .B \-\-allow\-no\-parent If dpm.importWithoutParent is set to false via git config, git\-dpm will not allow import\-dsc to be run without this option or at least on \-\-upstream\-parent option. .TP .B \-\-pristine\-tar\-commit \fR|\fP\-\-ptc Call \fBpristine\-tar commit\fP for all tarballs imported after the rest of the import\-dsc command was successful. .TP .B \-\-no\-pristine\-tar\-commit Do not call \fBpristine\-tar commit\fP for all imported tarballs even if configured to do so by \fBgit config dpm.pristineTarCommit true\fP or by \fBgit config branch.\fPdebianbranch\fB.dpmPristineTarCommit true\fP. .TP .B \-\-upstream\-author \fIauthor\fP Used as the \fB\-\-author\fP argument to \fBgit\-dpm import\-tar\fP. .TP .B \-\-upstream\-date \fIdate\fP Used as the \fB\-\-date\fP argument to \fBgit\-dpm import\-tar\fP (especially \fBauto\fP is supported to extract a date from the tar file). .TP .B \-\-tar-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking tarfiles. Can be given multiple times. .RE .RE .RS Options about applying patches: .TP .B \-f \fR|\fP \-\-force\-commit\-reuse Only look at parent and tree and no longer at the description when trying to reuse commits importing patches from previous package versions. .TP .B \-C\fInum\fP \fR|\fP \-\-patch\-context \fInum\fP Passed as \fB\-C\fP\fInum\fP to \fBgit\-apply\fP. Specifies the number of context lines that must match. .TP .B \-\-dpatch\-allow\-empty Do not error out if a dpatch file does not change anything when treated as patch. As dpatch files can be arbitrary scripts, \fBgit\-dpm\fP has some problems detecting if they are really patches. (It can only cope with patches). If a script that is not a patch is treated as patch that usually results in patch not modify anything, thus those are forbidden without this option. .TP .B \-\-patch\-system \fImode\fP Specify what patch system is used for source format 1.0 packages. .RS .TP .B auto \fR(this is the default)\fP Try to determine what patch system is used by looking at \fBdebian/rules\fP (and \fBdebian/control\fP). .TP .B none Those are not the patches you are looking for. .TP .B history Don't try to find any patches in the .diff (like \fBnone\fP). If if the project already exists and the upstream tarball is the same, create the patched state of the new one by using the patches of the old one and adding a patch of top bringing it to the new state. If you import multiple revisions of some package, where each new revision added at most a single change to upstream, this option allows you to almost automatically create a proper set of patches (ideally only missing descriptions). If there are same changes and reverts those will be visible in the patches created, so this mode is not very useful in that case. .TP .B quilt Extract and apply a \fBdebian/patches/series\fP quilt like series on top of possible upstream changes found in the .diff file. .TP .B quilt\-first As the \fBquilt\fP mode, but apply the patches to an unmodified upstream first and then cherry\-pick the changes found in the .diff file. As this is not the order in which patches are applied in a normal unpack/build cycle, this will fail if those changes are not distinct enough (for example when patches depend on changes done in the .diff). But if the .diff only contains unrelated changes which varies with each version, this gives a much nicer history, as the commits for the patches can more easily be reused. .TP .B quilt\-applied As the \fBquilt\-first\fP mode, but assume the patches are already applied in the .diff, so apply them on top of an unmodified upstream and then add a commit bringing it to the state in the .diff. (Or not if that patch would be empty). .TP .B dpatch \fR|\fP dpatch\-first \fR|\fP dpatch\-applied Like the \fBquilt\fP resp. \fBquilt\-first\fP resp. \fBquilt\-applied\fP modes, but instead look for dpatch-style patches in \fBdebian/patches/00list\fP. Note that only patches are supported and not dpatch running other commands. .TP .B simple \fR|\fP simple\-first \fR|\fP simple\-applied Like the \fBquilt\fP resp. \fBquilt\-first\fP resp. \fBquilt\-applied\fP modes, but instead assume \fBdebian/patches/\fP contains patches suitable for cdbs's \fBsimple\-patchsys.mk\fP. .RE .TP .B \-\-patch\-author \fR"\fP\fIname \fP\fR<\fP\fIemail\fP\fR>\fP\fR"\fP Set the author for all git commits importing patches. .TP .B \-\-patch\-default\-author \fR"\fP\fIname \fP\fR<\fP\fIemail\fP\fR>\fP\fR"\fP Set an author for all patches not containing author information (or where \fBgit\-dpm\fP cannot determine it). .TP .B \-\-edit\-patches For every patch imported, start an editor for the commit message. .TP .B \-\-record\-patch\-category Add a \fBPatch\-Category:\fP field to each imported patch that is in a subdirectory of \fBdebian/patches\fP. This causes \fBupdate\-patches\fP to store it in the same subdirectory. .TP .B \-\-record\-patch\-name Add a \fBPatch\-Name:\fP field to each imported patch with its name. This causes \fBupdate\-patches\fP to store it under its original name. .RE .TP .B record\-dsc \fR[\fP\fIoptions\fP\fR]\fP \fIcommit\fP \fI.dsc-file\fP Store a pristine .dsc file in a \fBdscs\fP branch after storing the files it contains using pristine\-tar. The first argument is an tag or commit storing the \fBgit\-dpm\fP project in the state belonging to the \fB.dsc\fP file and the second argument is the \fB.dsc\fP file itself. The files it references are expected in the same directory as the file itself (if they are needed). Some checks are done to make sure the file and its contents are named properly and match the commit in question, but only cursory to avoid obvious mistakes (for example only the version is checked, but .debian.tar is not unpacked to check the files are really the same, for example). Options: .RS .TP .B \-\-create\-branch Create a new \fBdscs\fP branch. .TP .B \-\-allow\-unsigned Allow recording a unsigned \fB.dsc\fP file. This usually defeats the point of storing them at all. .RE .SH the debian/.git\-dpm file You should not need to know about the contents if this file except for debugging git\-dpm. The file contains 8 lines, but future version may contain more. The first line is hint what this file is about and ignored. Then there are 4 git commit ids for the recorded states: .RS First the state of the patched branch when the patches in \fBdebian/patches\fP were last updated. Then the state of the patched branch when it was last merged into the Debian branch. Then the state upstream branch when the patched branch was last merged. Finally the upstream branch. .RE The following 3 lines are the filename, the sha1 checksum and the size of the origtarball belonging to the recorded upstream branch. .SH SHORTCUTS Most commands also have shorter aliases, to avoid typing: update\-patches: up, u\-p, ci prepare: prep checkout\-patched: co, c\-p rebase\-patched: r\-p apply\-patch: a\-p import\-tar: i\-t import\-new\-upstream: i\-n\-u, inu record\-new\-upstream: r\-n\-u, rnu merge\-patched\-in\-debian: merge\-patched record\-new\-upstream is also available under the old name new\-upstream, though likely will be removed in future versions (to avoid confusion). .SH BRANCHES .IP "the upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP)" This branch contains the upstream sources. It contents need to be equal enough to the contents in your upstream tarball. Equal enough means that dpkg\-source should see no difference between your patched tree and and original tarball unpackaged, the patched applied and \fBdebian/rules clean\fP run. Usually it is easiest to just store the verbatim contents of your orig tarball here. Then you can also use it for pristine tar. This branch may contain a debian/ subdirectory, which will usually be just ignored. You can either publish that branch or make it only implicitly visible via the \fBdebian/.git\-dpm\fP file in the Debian branch. While it usually makes sense that newer upstream branches contain older ones, this is not needed. You should be able to switch from one created yourself or by some foreign-vcs importing tool generated one to an native upstream branch or vice versa without problems. Note that since the Debian branch has the patched branch as ancestor and the patched branch the upstream branch, your upstream branches are part of the history of your Debian branch. Which has the advantage that you can recreate the exact state of your branches from your history directly (like \fBgit checkout \-b oldstate \fP\fImyoldtagorshaofdebianbranchcommit\fP\fB ; git\-dpm prepare ; git checkout unstable\-oldstate\fP) but the disadvantage that to remove those histories from your repository you have to do some manual work. .IP "the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP)" This branch contains your patches to the upstream source. (which of course means it is based on your upstream branch). Every commit will be stored as a single patch in the resulting package. To help git generate a linear patch series, this should ideal be a linear chain of commits, whose description are helpful for other people. As this branch is regularly rebase d, you should not publish it. Instead you can recreate this branch using \fBgit\-dpm checkout\-patched\fP using the information stored in \fBdebian/.git\-dpm\fP. You are not allowed to change the contents of the \fBdebian/\fP subdirectory in this branch. Renaming files or deleting files usually causes unnecessary large patches. .IP "the Debian branch (\fBmaster\fP|\fIwhatever\fP)" This is the primary branch. This branch contains the \fBdebian/\fP directory and has the patched branch merged in. Every change not in \fBdebian/\fP, \fB.git\fP\fI*\fP or deleting files must be done in the patched branch. .IP "alternative branch names" You can specify alternate branch names for upstream and patched branches of a specific Debian branch, or force a branch to be a Debian branch that would normally be considered e.g. upstream branch of another branch by adding \fBdpmUpstreamBranch\fP and \fBdpmPatchedBranch\fP configure items for the Debian branch in question (you need both, only one is treated as error). The following example is a no-op for all practical purposes: \fBgit config branch.master.dpmUpstreamBranch upstream\fP \fBgit config branch.master.dpmPatchedBranch patched\fP .SH COPYRIGHT Copyright \(co 2009,2010 Bernhard R. Link .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH "REPORTING BUGS AND ISSUES" You can report bugs or feature suggestions to git\-dpm\-devel@lists.alioth.debian.org or to me. Please send questions to git\-dpm\-user@lists.alioth.debian.org or to me at brlink@debian.org. git-dpm-0.9.1/AUTHORS0000644000175100017510000000004512420414724011054 00000000000000Bernhard R. Link git-dpm-0.9.1/index.html0000644000175100017510000002106112420414724012002 00000000000000 git-dpm: debian packages in git manager

git-dpm: debian packages in git manager

Contents

Short Introduction

[image of an example history of a git-dpm project]

The above image shows an idealized example of a history how git-dpm produces it. Each filled circle is a commit. The colored lines mean the commit to the left is an parent of the commit to the right.

The red commits are the commits in the upstream branch. That matches what is in your .orig.tar.(gz/bz2) file.

Then there are patches to the upstream sources. Those are managed as a normal branch you plan to submit upstream is: Rebased to every new upstream release, commits amended or interactively rebased to keep it in a proper shape to maximize the chances it is acceptable by upstream or useful to others:
[image of only upstream and patches]

If you look at only those patches, you see the problem git has with the history of such branches: Every rebase loses the previous state. Old history can be referenced by tags, but if only tagging meaningful states loses intermediate ones. Also pulling and pushing those around is a constant nightmare.

Now look at the first picture again: The blue commits are the debian branch, which in this example is master. The only changes done in this branch in a git-dpm work-flow are changes to the debian/ directory (with some exceptions, see the manpage), while all changes to the upstream sources are done in the patched branch.

After you have changed the patches, you call git-dpm update-patches, which will update the debian/patches/ directory in your debian branch and update the upstream files in the debian branch, so you can just call dpkg-buildpackage in there. The respective patched branch is a parent of the commit in the debian branch, so its history is preserved and by pushing and pulling the debian branch around, those commits are, too, so every team member has the full history and nothing is private to your repository.

But how to you manage such a setup with git-dpm? Assume you have cloned a git-dpm managed branch:

[image of beginning repository after clone]

First you call git-dpm prepare to check/get the proper .orig.tar file and mark the upstream branch:

[image after git-dpm prepare]

If you want to change something of the source, you call git-dpm checkout-patched:

[image after git-dpm checkout-patched]

You simply do your modifications and git commit them:

[image after git commit]

Now you call git-dpm update-patches to record those changes in your debian branch:

[image after git-dpm update-patches]

Now you build it and if everything is OK, you can push it, though you might want to git-dpm tag it:

[image after git-dpm tag]

Next consider there is a new upstream version.

First you need to update the upstream branch (git-dpm import-new-upstream will do this and the next step for you):

[image with new upstream]

Then record this new upstream with git-dpm new-upstream:

[image with new upstream recorded]

Then you rebase the patches on top of it. (git-dpm rebase-patched will help you with this, or give --rebase to the new-upstream or import-new-upstream calls):

[image with new upstream recorded]

After checking those patches still look good, record them with update-patches

[image with new upstream recorded]

Now you can push it, or tag and push it:

[image with tags for the new upstream added]

But of course in reality, the development of the changes will not be that linear.

Let's assume you found patch b is incomplete/improvable. Then you again call git-dpm checkout-patched:

[image with patched branch visible again]

Then you do your changes and call git commit --amend:

[image with amended patched branch]

And record this change using git-dpm update-patches:

[image with amended patched branch merged back]

If that improvement does not justify a new upload, you can just push it. Now assume another problem is found this time in the first modification. So you (or some team member -- remember this state can be pushed and pulled without problems) again call git-dpm checkout-patched:

[image with patched branch visible again]

Now you can either do a git rebase -i upstream, mark the first commit to be edited and amend it. Or you add a new commit:

[image with patched branch visible again]

And then use git rebase -i to squash the third into the first commit:

[image with patched branch visible again]

And them run git-dpm update-patches again and possibly tag it:

[the full image again]

Note that a real example will usually have much more commits in the debian branch master. (While one can amend all changes to get an image exactly as this, there will usually be other changes to the files in debian/ necessary, which usually will be put in their own commits).

Get git-dpm

It is available in the package git-dpm, or for the latest version you can do:
git clone git://anonscm.debian.org/git-dpm/git-dpm.git
You just need the git-dpm.sh and you want want to look at the manpage git-dpm.1 and the examples.html. You can ignore the rest of the files.

Documentation and examples

There is the manpage(PDF). And there are some examples. Also take a look in the Debian Wiki pages about git-dpm.

Mailing lists

There are two mailing lists: