Mercurial > hg
view contrib/buildrpm @ 4193:dd0d9bd91e0a
dirstate.statwalk: explicitly test for ignored directories
This removes a hack where we appended '/' to a dirname so that:
- it would not appear on the "dc" dict
- it would always be matched by the match function
This was a contorted way of checking if the directory was matched by
some hgignore pattern, and it would still fail with some uses of
--include/--exclude patterns.
Things would still work fine if we removed the check altogether and
just appended things to "work" directly, but then we would end up
walking ignored directories too, which could be quite a bit of work.
This allows further simplification of the match function returned by
util._matcher, and fixes walking the working directory with a
--include pattern that matches only the end of a name.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 10 Mar 2007 23:00:54 -0300 |
parents | ced5f5ceb172 |
children | e5e6dd8ba6bb |
line wrap: on
line source
#!/bin/sh # # Build a Mercurial RPM in place. # # Bryan O'Sullivan <bos@serpentine.com> root="`hg root 2>/dev/null`" specfile=contrib/mercurial.spec if [ -z "$root" ]; then echo 'You are not inside a Mercurial repository!' 1>&2 exit 1 fi rpmdir=/tmp/"`basename $root | sed 's/ /_/'`"-rpm cd "$root" rm -rf $rpmdir mkdir -p $rpmdir/RPMS hg clone "$root" $rpmdir/BUILD if [ ! -f $specfile ]; then echo "Cannot find $specfile!" 1>&2 exit 1 fi tmpspec=/tmp/`basename "$specfile"`.$$ # Use the most recent tag as the version. version=`hg tags | perl -e 'while(<STDIN>){if(/^(\d\S+)/){print$1;exit}}'` # Compute the release number as the difference in revision numbers # between the tip and the most recent tag. release=`hg tags | perl -e 'while(<STDIN>){/^(\S+)\s+(\d+)/;if($1eq"tip"){$t=$2}else{print$t-$2+1;exit}}'` tip=`hg -q tip` # Beat up the spec file sed -e 's,^Source:.*,Source: /dev/null,' \ -e "s,^Version:.*,Version: $version," \ -e "s,^Release:.*,Release: $release," \ -e "s,^%prep.*,Changeset: $tip\n\0," \ -e 's,^%setup.*,,' \ $specfile > $tmpspec rpmbuild --define "_topdir $rpmdir" -bb $tmpspec if [ $? = 0 ]; then rm -rf $tmpspec $rpmdir/BUILD mv $rpmdir/RPMS/*/* $rpmdir && rm -r $rpmdir/RPMS echo echo "Packages are in $rpmdir" fi