[git-buildpackage] [PATCH] Add --git-packaging-exclude to gbp buildpackage-rpm

Tzafrir Cohen tzafrir at cohens.org.il
Wed Feb 17 10:34:19 CET 2016


On Thu, Feb 04, 2016 at 07:25:02PM +0100, Guido Günther wrote:
> Hi,
> On Thu, Feb 04, 2016 at 06:34:31PM +0100, Tzafrir Cohen wrote:
> > Add an option to exclude copying some of the files from the source tree
> > to the packaging directory (a single regular expression).
> > 
> > This can be handy when running gbp buildpackage-rpm from a complete
> > source tree in a non-native mode and and some files in the top-level
> > directory can't or should not be copies to the packaging directory.
> 
> Thanks for the patch! Can you describe the concrete use case a bit so we
> can check if "gbp buildpackage" needs this as well or if we need it at
> all?
> Markus do you have comments on this or maybe a similar patch in your queue?
> 
> The patch is lacking the manpage update btw.

The patch is indeed too agressive, but the problem is that copying all
the top-level files in the tree may fail if one of them is a symlink to
somewhere below in the tree.

Note that symlink is readable. It's not a dandling symlink. However the
copying of the packaging files only copies the top-level files.


#!/bin/sh
# Place this script in an empty directory and run it from there

cat <<EOF >package.spec
Summary: summary
Name: package
Version: 1.0
Release: 1
Group: Development/Libraries
Source: %{name}-%{version}.tar.gz
License: GPLv2

%description
description
EOF

rm -rf subdir symlink 
mkdir subdir
touch subdir/file
ln -s subdir/file symlink

rm -rf .git
git init
git add *
git commit -m "Source files"
gbp buildpackage-rpm --git-no-build "$@"
#####################################################



A trace of a run:

$ ./gen --git-verbose
Initialized empty Git repository in /tmp/gbp-test/package/.git/
[master (root-commit) c778e6d] Source files
 4 files changed, 36 insertions(+)
 create mode 100755 gen
 create mode 100644 package.spec
 create mode 100644 subdir/file
 create mode 120000 symlink
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'ls-tree', 'HEAD']
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/master']
gbp:debug: ['git', 'ls-tree', 'HEAD']
gbp:debug: ['git', 'ls-tree', '-z', '-r', 'HEAD', '--']
gbp:debug: Found a preferred spec file package.spec
gbp:debug: ['git', 'show', '--pretty=medium', 'HEAD:package.spec']
gbp:debug: Using 'package.spec' from 'HEAD'
gbp:debug: /bin/true [] []
gbp:debug: ['git', 'status', '--porcelain']
gbp:debug: Dumping packaging files to
'/var/tmp/gbp/buildpackage-rpm_EzcpUb/packaging_4VMZwp'
gbp:debug: ['git', 'ls-tree', '-z', 'HEAD:', '--']
gbp:debug: Exporting packaging files from '/var/tmp/gbp/buildpackage-rpm_EzcpUb/packaging_4VMZwp' to '../rpmbuild'
gbp:error: Error exporting packaging files: [Errno 2] No such file or directory: '/var/tmp/gbp/buildpackage-rpm_EzcpUb/packaging_4VMZwp/symlink'

-- 
Tzafrir Cohen         | tzafrir at jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir at cohens.org.il |                    |  best
tzafrir at debian.org    |                    | friend


More information about the git-buildpackage mailing list