[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xlibs-dev transition; helper script



Let me explain :)

I created this script allowing many packages to be pbuilt and patched
nearly automatically.  It isn't intended to be fully automatic,
because someone should actually read the .diff, of course.  It runs
pbuild using the recommended build-deps, and uses debdiff to assert
that nothing changed unexpectedly.

I just ran through the last 3 of these small packages in a matter of
minutes:

  jazip 346729
  groundhog 346716
  flying 346707
  gbase 346705
  hp2xx 346702

The point is that the result can be more easily consistent, and that
the user doesn't have to concentrate on crap like typing 'pdebuild >&
 >(tee log/foo.log)', but can instead just read the final proposed NMU
.diff and debdiff output to make sure they are sane, and hopefully
spend more time and effort doing that instead.  It would be good to
read the buildlogs too.

It depends on a hacked copy of xlibs-split script, which is attached.

Justin
#! /bin/sh

prefix="`echo $0 |sed -re 's,/[^/]*$,,'`";

TMPFILE=`mktemp /tmp/xlibssplit.XXXXXX` || exit 1

rgrep "include" $1 | grep -v "configure:" | grep -o "<X11.*>" | sort | uniq > $TMPFILE

if [ -s $TMPFILE ]; then
grep -HE "`awk '{printf("|%s", $1)};' $TMPFILE | cut -c 2- | tr -d '<' | tr -d '>'`" $prefix/includes/* |\
  cut -d: -f1 |sed -e 's,.*/,,' |uniq |tr '\n' ','
fi

rm $TMPFILE
#!/bin/bash
set -e;

package="$1";
mkdir done/ logs/ 2>/dev/null || true;

bug=$(grep "$package:.*xlibs-dev$" /tmp/rc |awk '{print $1}');

apt-get source "$package";
origdiff="$(ls $package*.diff.gz)" || true;
if [ -z $origdiff ]; then
	echo >&2 "Native package!";
	echo >&2 "bts clone $bug -1 , severity -1 normal , retitle -1 $package: native package should not be?" , submitter -1 justinpryzby@users.sourceforge.net
	exit 1;
fi;

dir=$(find -name "$package*" -type d);
cd $dir/;

newp=$(/tmp/xlibs-split-check/xlibs-split .)

sed -i -re "/^Build-Depends:/{ s/(,?) *xlibs-dev[^,]*(,?)/,$newp,/; s/, *,/,/g; s/ *, *$//; s/: *,/: /; }; s/,([^ ])/, \1/g;" ./debian/control;

bd=$(sed -ne '/^Build-Depends:/{ s/^[^:]*://; s/|[^,]*\(,\?\)//g; s/([^)]*)//g; s/,//g; s/\[[^]]*]//gp; };' ./debian/control;);

sudo apt-get -y install $bd;

if ! grep -q "closes: #$bug" ./debian/changelog; then
	dch -i --nmu "Update build-deps for xlibs-dev removal; closes: #$bug."
fi;

sudo rm -f /var/cache/pbuilder/result/$package*.deb;
nice -n+10 pdebuild >& >(tee ../logs/$package.buildlog)

cd ../;
gzip -f ./logs/$package.buildlog;

newdiff=$(ls ./$package*.diff.gz |grep -v $origdiff);
interdiff -z ./$origdiff $newdiff > >(tee ./$package.xlibs-dev.diff)

sudo apt-get -y --reinstall -d install $package/unstable
debdiff /var/cache/{apt/archives/,pbuilder/result}/$package*deb || true;

echo >&2 "Press enter to continue or ^C to abort";
read;

echo tag $bug patch >tmp
echo thanks >>tmp
echo >>tmp
cat message-body >>tmp

mutt -s "intent to upload sponsored NMU to fix xlibs-dev bug" -i ./tmp -a ./$package.xlibs-dev.diff $bug@bugs.debian.org, control@bugs.debian.org

mv -iv $package* ./done/
echo >>nmubugs $package $bug;

Reply to: