[Pbuilder-maint] pbuilder CVS update: pbuildd/scripts build-progress cb-functions pbuildd pbuilderrc show_new show_outofdate

pbuilder CVS Commit pbuilder-maint at lists.alioth.debian.org
Mon Apr 3 09:01:32 UTC 2006


  User: schepler
  Date: 06/04/03 09:01:32

  Added:       scripts  build-progress cb-functions pbuildd pbuilderrc
                        show_new show_outofdate
  Log:
  Initial check in of pbuildd scripts.
  
  Revision  Changes    Path
  1.1                  pbuildd/scripts/build-progress
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/build-progress?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/build-progress?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: build-progress
  ===================================================================
  #!/bin/bash
  
  fmttime() {
      local interval=$(($2 - $1))
      local secs=$(($interval % 60))
      local mins=$(( ($interval / 60) % 60 ))
      local hours=$(($interval / 3600))
  
      printf "%02d:%02d:%02d\\n" $hours $mins $secs
  }
  
  if [ -f $1 ]; then
      newfile=$1
      package=`basename $(dirname $1)`
  else
      package=$1
      dir=`echo $package|sed -e 's/^\(\(lib\)\?.\).*/\1/'`
      newfile=build/$dir/$package/build-log
  fi
  
  if [ $# -gt 1 ]; then
      oldfile=$2
  else
      for sect in pool old-pool; do
  	if [ -f $sect/${newfile#*/} ]; then
  	    oldfile=$sect/${newfile#*/}
  	    break
  	fi
      done
      if ! [ -f $oldfile ]; then
  	echo "Cannot find old build-log for $1" 1>&2
  	exit 1
      fi
  fi
  
  oldstart=`head $oldfile|grep '^pbuilder-time-stamp'|sed -e 's/^pbuilder-time-stamp: //'`
  oldend=`tail $oldfile|grep '^pbuilder-time-stamp'|sed -e 's/^pbuilder-time-stamp: //'`
  totaltime=`fmttime $oldstart $oldend`
  oldsize=`stat -c %s $oldfile`
  
  newstart=`head $newfile|grep '^pbuilder-time-stamp'|sed -e 's/^pbuilder-time-stamp: //'`
  dcopref="`kdialog --title $package --progressbar \"$package build progress\" $oldsize`"
  
  while [ -e $newfile ]; do
      newsize=`stat -c %s $newfile`
      dcop "$dcopref" setLabel "$package build progress:
  Time so far: `fmttime $newstart $(date +%s)`
  Total time: $totaltime"
      dcop "$dcopref" setProgress $(($newsize < $oldsize ? $newsize : $oldsize))
      sleep 5s
  done
  
  dcop "$dcopref" close
  
  
  
  1.1                  pbuildd/scripts/cb-functions
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/cb-functions?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/cb-functions?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: cb-functions
  ===================================================================
  # -*- shell-script -*-
  
  . /usr/lib/pbuilder/pbuilder-checkparams
  . /usr/lib/pbuilder/pbuilder-modules
  . /usr/lib/pbuilder/pbuilder-buildpackage-funcs
  
  function dir() {
      echo $1|sed -e 's/^\(\(lib\)\?.\).*/\1/'
  }
  
  function inst_pkgs() {
      extractbuildplace
      trap umountproc_cleanbuildplace exit
  
      if [ -n "$BUILDUSERNAME" -a -n "$BUILDUSERID" ]; then
  	SUTOUSER="su $BUILDUSERNAME -- "
  	DEBBUILDOPTS="$DEBBUILDOPTS -rfakeroot"
  	EXTRAPACKAGES="${EXTRAPACKAGES} fakeroot"
  	FAKEROOT="fakeroot"
  	echo "I: using fakeroot in build."
      else
  	# run the build in root
  	SUTOUSER=""
  	BUILDUSERID=0
  	BUILDUSERNAME=root
  	FAKEROOT=""
      fi
  
      if ! $CHROOTEXEC apt-get -s install $* ${EXTRAPACKAGES} >&/dev/null; then
  	if [ "${PRESERVE_BUILDPLACE}" = "yes" ]; then
  	    trap umountproc exit
  	fi
      fi
      $CHROOTEXEC apt-get -y --force-yes install $* ${EXTRAPACKAGES}
  
      createbuilduser
  
      export HOME="/tmp/buildd"
      export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
  }
  
  function inst_src() {
      local dir
      local sect
      local p
      cd /var/cache/pbuildd
      for p; do
  	mkdir "$BUILDPLACE/tmp/$p"
  	dir=`dir $p`
  	for sect in build done partial pool fail old-pool; do
  	    if [ -d $sect/$dir/$p ]; then
  		break
  	    fi
  	done
  	if [ ! -d $sect/$dir/$p ]; then
  	    mkdir -p build/$dir/$p
  	    (cd build/$dir/$p && apt-get --only-source source $p)
  	    sect=build
  	fi
  	copydsc $sect/$dir/$p/*.dsc "$BUILDPLACE/tmp/$p"
  	$CHROOTEXEC /bin/bash -c "cd /tmp/$p; chown $BUILDUSERNAME:$BUILDUSERNAME * .; $SUTOUSER dpkg-source -x *.dsc"
  	if [ -f scripts/cb/$p.diff ]; then
  	    cp scripts/cb/$p.diff "$BUILDPLACE/tmp"
  	    $CHROOTEXEC /bin/bash -c "cd /tmp/$p/*/; chown $BUILDUSERNAME:$BUILDUSERNAME /tmp/$p.diff; $SUTOUSER patch -p1 </tmp/$p.diff"
  	fi
      done
  }
  
  function download_inst_pkgs() {
      echo "$DEBMIRROR" >>"$BUILDPLACE/etc/apt/sources.list"
      $CHROOTEXEC apt-get update
      $CHROOTEXEC apt-get --allow-unauthenticated install $*
  }
  
  function pkgs_done() {
      local dir
      local p
      for p; do
  	dir=`dir $p`
  	mkdir -p build/$dir/$p
  	cp -p "$BUILDPLACE"/tmp/$p/* build/$dir/$p 2>/dev/null || true
      done
      echo "Packages compiled: $*"  # Communicate back to pbuildd
  }
  
  
  
  1.1                  pbuildd/scripts/pbuildd
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/pbuildd?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/pbuildd?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: pbuildd
  ===================================================================
  #! /usr/bin/perl -w
  
  use File::Find;
  
  $buildroot = "/var/cache/pbuildd";
  
  # Speed optimization: read files lists from Sources to avoid having to
  # run apt-get --print-uris on each source package, which eliminates a
  # lot of time repeatedly loading the apt cache.
  
  $pkgcacheTime = 0;
  %sourcesFiles = ();
  
  sub readSourcesFiles {
      my @info = stat "/var/cache/apt/srcpkgcache.bin";
      if ($info[9] != $pkgcacheTime) { # mtime
  	print "\n ** ";
  	if ($pkgcacheTime == 0) { print "Reading"; } else { print "Rereading"; }
  	print " files lists from Sources **\n\n";
  	$pkgcacheTime = $info[9];
  	%sourcesFiles = ();
  	my ($package, $forUs);
  	foreach my $src (glob "/var/lib/apt/lists/*_main_source_Sources") {
  	    open(SRC, $src);
  	    while ($_ = <SRC>) {
  		chomp;
  		if (/^Package: (\S*)$/) {
  		    $package = $1;
  		    $forUs = 0;
  		}
  		elsif (/^Architecture:.* ($arch|any|all)( |$)/) {
  		    $forUs = 1;
  		}
  		elsif (/^Files:$/ && $forUs) {
  		    my @files = ();
  		    while ($_ = <SRC>) {
  			chomp;
  			last unless /^ /;
  			my @fields = split / +/;
  			push (@files, $fields[3]);
  		    }
  		    $sourcesFiles{$package} = \@files;
  		}
  	    }
  	    close(SRC);
  	}
      }
  }
  
  # Speed optimization: avoid having to rerun dpkg-scanpackages from
  # scratch on all of pool/ after every pass.
  
  sub readPackages {
      my $fname = shift;
      my %pkginfo = ();
      open(PKGS, "<$fname");
      while ($_ = <PKGS>) {
  	/Package: (.*)$/ || die "Invalid Packages file $fname";
  	my $package = $1;
  	my $text = $_;
  	while ($_ = <PKGS>) {
  	    last if /^$/;
  	    $text .= $_;
  	}
  	$pkginfo{$package} = $text;
      }
      close(PKGS);
      return \%pkginfo;
  }
  
  sub mergePackages {
      my $dir = shift;
      my $pkgref = shift;
      chdir $buildroot;
      open(PKGS, "dpkg-scanpackages $dir scripts/override.sid.main |");
      while ($_ = <PKGS>) {
  	/Package: (.*)$/ || die "Bad output from dpkg-scanpackages";
  	my $package = $1;
  	my $text = $_;
  	while ($_ = <PKGS>) {
  	    last if /^$/;
  	    $text .= $_;
  	}
  	if (exists $pkgref->{$package}) {
  	    $pkgref->{$package} =~ /\nFilename: (.*)\/[^\/]*\n/;
  	    print "Comparing version of $package in $dir to version in $1...\n";
  	    $text =~ /\nVersion: (.*)\n/;
  	    my $newver = $1;
  	    $pkgref->{$package} =~ /\nVersion: (.*)\n/;
  	    my $oldver = $1;
  	    system('dpkg', '--compare-versions', $oldver, 'gt', $newver);
  	    next if $? == 0;
  	}
  	$pkgref->{$package} = $text;
      }
      close(PKGS);
  }
  
  sub writePackages {
      my $fname = shift;
      my $pkgref = shift;
      open(PKGS, ">$fname");
      foreach my $package (sort keys %{$pkgref}) {
  	print PKGS "$pkgref->{$package}\n";
      }
      close(PKGS);
      system "gzip -c9 $fname >$fname.gz";
  }
  
  # Utility functions
  
  # debhelper -> d, libpng -> libp.
  sub pkgdir {
      my $pkg = shift;
      $pkg =~ /^((lib)?.)/;
      return $1;
  }
  
  sub basename {
      my $fname = shift;
      $fname =~ /\/([^\/]*)\/?$/;
      return $1;
  }
  
  # Archive manipulation functions
  
  sub prunepkg {
      my $pkg = shift;
      my $sect = shift;
  
      my $dir = pkgdir($pkg);
      return unless -d "$buildroot/$sect/$dir/$pkg";
      $changes{$sect} = 1;
      if (exists $pkginfos{$sect}) {
  	foreach my $pkgtodel (glob "$buildroot/$sect/$dir/$pkg/*.deb") {
  	    $pkgtodel =~ /\/([^\/_]*)_/ || die "$pkgtodel didn't match";
  	    my $pkgname = $1;
  	    delete $pkginfos{$sect}{$pkgname} if
  		exists $pkginfos{$sect}{$pkgname} &&
  		$pkginfos{$sect}{$pkgname} =~ /\nFilename: \Q$sect\E\/\Q$dir\E\/\Q$pkg\E\//;
  	}
      }
      system 'rm', '-rf', "$buildroot/$sect/$dir/$pkg";
      rmdir "$buildroot/$sect/$dir";
  }
  
  sub movetosect {
      my $pkg = shift;
      my $fromsect = shift;
      my $tosect = shift;
  
      my $dir = pkgdir($pkg);
  
      # The following line makes it safe for pbuildd to compile the
      # same package more than once in the same cycle.
      return unless -d "$buildroot/$fromsect/$dir/$pkg";
      $changes{$tosect} = 1;
      prunepkg($pkg, $tosect);
      mkdir "$buildroot/$tosect/$dir";
      rename "$buildroot/$fromsect/$dir/$pkg", "$buildroot/$tosect/$dir/$pkg";
      rmdir "$buildroot/$fromsect/$dir";
  
      mergePackages("$tosect/$dir/$pkg", $pkginfos{$tosect})
  	if exists $pkginfos{$tosect};
  }
  
  # Speed optimization: do a rough scan through the Build-Depends and
  # Build-Depends-Indep for packages which don't exist at all yet in
  # pool or partial.  This eliminates lots of calls to pbuilder during
  # the early passes.
  
  sub scanForExistingPkgs {
      my $fname = shift;
  
      open (DCTRL, "<$fname");
      while ($_ = <DCTRL>) {
  	chomp;
  	if (/^Package: (.*)$/) {
  	    $existingPkgs{$1} = 1;
  	}
  	if (/^Provides: (.*)$/) {
  	    foreach my $pkg (split(/ *, */, $1)) {
  		$existingPkgs{$pkg} = 1;
  	    }
  	}
      }
      close(DCTRL);
  }
  
  sub findExistingPkgs {
      unless (-d "$buildroot/chroot") {
  	chdir $buildroot;
  	mkdir 'chroot';
  	system 'tar', '-C', 'chroot', '-xz', '-f', 'base.tgz';
      }
      %existingPkgs = ();
      scanForExistingPkgs("chroot/var/lib/dpkg/status");
      foreach my $aptfile (glob "chroot/var/lib/apt/lists/*_Packages") {
  	scanForExistingPkgs($aptfile);
      }
  }
  
  sub nonexistentPkg {
      my $str = shift;
      foreach my $part (split (/ *, */, $str)) {
  	$part =~ s/^ *//; $part =~ s/ *$//;
  	my $found = 0;
  	foreach my $pkg (split (/ *\| */, $part)) {
  	    # Ignore anything with [i386] or [!i386], etc at this stage
  	    if ($pkg =~ /\[/) {
  		$found = 1;
  		last;
  	    }
  
  	    $pkg =~ s/ *(\(.*\) *)?$//;
  	    if ($existingPkgs{$pkg}) {
  		$found = 1;
  		last;
  	    }
  	}
  	return $part unless $found;
      }
      return undef;
  }
  
  sub trybuild {
      my $buildlog = shift;
  
      if (fork() == 0) {
  	open(STDOUT, "| tee $buildlog");
  	open(STDERR, ">&STDOUT");
  	exec(@_) || die "Couldn't execute $_[0]";
      }
  
      wait();
      return ($? == 0);
  }
  
  # Check the build-log file to see whether the pbuilder run failed
  # or just couldn't install the Build-Depends.
  sub checkfail {
      my $pkg = shift;
      my $logfile = shift;
      open(BUILDLOG, "tail $logfile |");
      while ($_ = <BUILDLOG>) {
  	chomp;
  	if ($_ eq 'pbuilder: Failed autobuilding of package') {
  	    close(BUILDLOG);
  	    movetosect($pkg, 'build', 'fail');
  	    print FAILED "$pkg\n";
  	    return 1;
  	}
      }
      close(BUILDLOG);
      return 0;
  }
  
  # Speed optimization: copy any files from the source package that we
  # already have into the new directory in build/.
  
  sub mkbuilddir {
      my $package = shift;
  
      # Copy any files which have already been downloaded
      readSourcesFiles();
      my $needdl = 0;
      if (! exists $sourcesFiles{$package}) {
  	print "E: Cannot find source package $package\n";
  	return 0;
      }
  
      my $dir = pkgdir($package);
      mkdir "$buildroot/build/$dir";
      mkdir "$buildroot/tmp/$package";
      foreach my $srcFile (@{$sourcesFiles{$package}}) {
  	my $needdlthis = 1;
  	foreach my $sect ('build', 'pool', 'fail', 'partial', 'old-pool',
  			  'done', 'done-partial', 'stuck') {
  	    if (-f "$buildroot/$sect/$dir/$package/$srcFile") {
  		link("$buildroot/$sect/$dir/$package/$srcFile",
  		     "$buildroot/tmp/$package/$srcFile");
  		$needdlthis = 0;
  		last;
  	    }
  	}
  	$needdl ||= $needdlthis;
      }
  
      system 'rm', '-rf', "$buildroot/build/$dir/$package";
      rename("$buildroot/tmp/$package",
  	   "$buildroot/build/$dir/$package");
      chdir "$buildroot/build/$dir/$package";
  
      if ($needdl && system 'apt-get', '--only-source', '-d', 'source', $package) {
  	return 0;
      }
      my @dscfile = glob("*.dsc");
      if ($#dscfile != 0) {
  	return 0;
      }
      return 1;
  }
  
  # The meat of the script: attempt to build the given package.
  sub buildpkg {
      my $package = shift;
      my $dir = pkgdir($package);
  
      print "\n ** Attempting to build $package **\n\n";
  
      if (! mkbuilddir($package)) {
  	return;
      }
  
      chdir "$buildroot/build/$dir/$package";
      my @dscfile = glob("*.dsc");
      my ($tryCB, $tryArch, $tryBuild);
      my $problemPkg;
      if (-f "$buildroot/partial/$dir/$package/$dscfile[0]" ||
  	-f "$buildroot/done-partial/$dir/$package/$dscfile[0]") {
  	$tryCB = $tryArch = 0;
      }
      elsif (-x "$buildroot/scripts/cb/$package") {
  	$tryCB = 1; $tryArch = 0;
      }
      else {
  	$tryCB = 0;
  	# Scan the dsc file to see whether to consider building
  	# a binary-arch version
  	open(DSC, $dscfile[0]);
  	$tryArch = 0;
  	while (<DSC>) {
  	    if (/^Architecture: all/) {
  		$tryArch = 0;
  		last;
  	    }
  	    $tryArch = 1 if (/^Build-Depends-Indep:/);
  	}
  	close(DSC);
      }
  
      # Scan the dsc file for any packages which don't even exist yet.
      $tryBuild = 1;
      open(DSC, $dscfile[0]);
      while ($_ = <DSC>) {
  	chomp;
  	if ((/^Build-Depends:(.*)$/ ||
  	     (/^Build-Depends-Indep:(.*)$/ && ! $tryArch)) &&
  	    ($problemPkg = nonexistentPkg($1))) {
  	    $tryBuild = $tryArch = 0;
  	    open(BUILDLOG, ">build-log");
  	    print "E: Could not find any package for $problemPkg\n";
  	    print BUILDLOG "E: Could not find any package for $problemPkg\n";
  	    close(BUILDLOG);
  	    last;
  	}
  	if (/^Build-Depends-Indep:(.*)$/ && $tryArch &&
  	    ($problemPkg = nonexistentPkg($1))) {
  	    print "W: Could not find any package for $problemPkg, not trying full build\n";
  	    open(BUILDLOG, ">build-log");
  	    print BUILDLOG "E: Could not find any package for $problemPkg\n";
  	    close(BUILDLOG);
  	    $tryBuild = 0;
  	}
      }
      close(DSC);
  
      if ($tryBuild) {
  	if (trybuild('build-log', 'pbuilder', 'build',
  		     '--configfile', "$buildroot/scripts/pbuilderrc",
  		     '--buildresult', "$buildroot/build/$dir/$package",
  		     '--preserve-buildplace', $dscfile[0])) {
  	    movetosect($package, 'build', 'done');
  	    prunepkg($package, 'fail');
  	    prunepkg($package, 'stuck');
  	    # Just in case a new version made a previous arch-build
  	    # in this cycle unnecessary...
  	    system 'rm', '-rf', "$buildroot/done-partial/$dir/$package";
  	    return;
  	}
  	return if checkfail($package, 'build-log');
      }
  
      # Consider building a version using the cycle-breaker scripts
      if ($tryCB) {
  	if (-x "$buildroot/scripts/cb/$package") {
  	    print "\n ** Attempting cycle-breaker build of $package **\n\n";
  	    if (trybuild('build-log-cb', "$buildroot/scripts/cb/$package",
  			 '--configfile', "$buildroot/scripts/pbuilderrc",
  			 '--preserve-buildplace')) {
  		# See what packages got built
  		open(LOG, "tail build-log-cb |");
  		while ($_ = <LOG>) {
  		    chomp;
  		    if (/^Packages compiled: /) {
  			my @pkgs = split;
  			shift @pkgs;
  			shift @pkgs;
  			foreach my $built (@pkgs) {
  			    movetosect($built, 'build', 'done-partial');
  			    mkbuilddir($built);
  			}
  			last;
  		    }
  		}
  		close(LOG);
  	    } else {
  		checkfail($package, 'build-log-cb');
  	    }
  	    return;
  	}
      }
  
      if ($tryArch) {
  	print "\n ** Attempting binary-arch build of $package **\n\n";
  	if (trybuild('build-log-arch', 'pbuilder', 'build',
  		     '--configfile', "$buildroot/scripts/pbuilderrc",
  		     '--buildresult', "$buildroot/build/$dir/$package",
  		     '--binary-arch', '--preserve-buildplace',
  		     $dscfile[0])) {
  	    movetosect($package, 'build', 'done-partial');
  	    mkbuilddir($package);
  	} else {
  	    checkfail($package, 'build-log-arch');
  	}
  	return;
      }
  }
  
  # Used in implementation of --upgrade, etc. as callback for find.
  sub get_curver {
      if (/(.*)_(.*)\.dsc/) {
  	if (exists $curver{$1}) {
  	    my $pkg = $1;
  	    my $newver = $2;
  	    my $oldver = $curver{$1};
  	    system "dpkg", "--compare-versions", $newver, "gt", $oldver;
  	    $curver{$pkg} = $newver if $? == 0;
  	}
  	else {
  	    $curver{$1} = $2;
  	}
      }
  }
  
  # MAIN
  $arch = `dpkg-architecture -qDEB_HOST_ARCH`;
  chomp $arch;
  
  open(FAILED, ">>failed");
  
  $upgrade = 0;
  $build_new = 0;
  $remove_obsolete = 0;
  
  foreach $arg (@ARGV) {
      if ($arg eq '--upgrade') {
  	$upgrade = 1;
      }
      elsif ($arg eq '--build-new') {
  	$build_new = 1;
      }
      elsif ($arg eq '--remove-obsolete') {
  	$remove_obsolete = 1;
      }
      else {
  	die "Unrecognized option $arg" if ($arg =~ /^--/);
  	mkbuilddir($arg);
      }
  }
  
  $pkginfos{'pool'} = readPackages("$buildroot/dists/sid/main/binary-${arch}/Packages");
  $pkginfos{'partial'} = readPackages("$buildroot/partial/Packages");
  $pkginfos{'old-pool'} = readPackages("$buildroot/old-pool/Packages");
  
  do {
      %changes = ();
  
      findExistingPkgs();
  
      chdir $buildroot;
      foreach $package (glob "build/*/*/") {
  	# Don't force a build if the directory was removed in the meantime
  	buildpkg(basename($package)) if (-d "$buildroot/$package");
      }
  
      if ($upgrade || $build_new || $remove_obsolete) {
  	print "\n ** Determining current package versions **\n\n";
  	%srcver = ();
  	%curver = ();
  
  	# Search for source package versions, but only for this architecture
  	foreach $src (glob("/var/lib/apt/lists/*_main_source_Sources")) {
  	    open(SRC, $src);
  	    while ($_ = <SRC>) {
  		chomp;
  		if (/^Package: (\S*)$/) {
  		    $package = $1;
  		}
  		elsif (/^Version: ([0-9]+:)?(\S*)$/) { # Forget the epoch
  		    $vers = $2;
  
  Reached max line limit 500!
  
  
  1.1                  pbuildd/scripts/pbuilderrc
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/pbuilderrc?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/pbuilderrc?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: pbuilderrc
  ===================================================================
  # this is your configuration file for pbuilder.
  # the file in /usr/share/pbuilder/pbuilderrc is the default template.
  # /etc/pbuilderrc is the one meant for editing.
  
  BASETGZ=/var/cache/pbuildd/base.tgz
  #EXTRAPACKAGES=gcc3.0-athlon-builder
  #export DEBIAN_BUILDARCH=athlon
  BUILDPLACE=/var/cache/pbuildd/chroot/
  MIRRORSITE=file:///var/cache/pbuildd
  #NONUSMIRRORSITE="http://www.jp.debian.org/debian-non-US"
  OTHERMIRROR="deb file:///var/cache/pbuildd partial/"
  #OTHERMIRROR="deb http://www.home.com/updates/ ./"
  #export http_proxy=http://your-proxy:8080/
  USEPROC=yes
  USEDEVPTS=yes
  USEDEVFS=no
  BUILDRESULT=/var/cache/pbuildd/result/
  BUILDRESULTUID=root
  BUILDRESULTGID=root
  
  # specifying the distribution forces the distribution on "pbuilder update"
  DISTRIBUTION=sid
  DEBMIRROR="deb http://http.us.debian.org/debian/ $DISTRIBUTION main"
  #specify no cache for APT 
  APTCACHE=""
  APTCACHEHARDLINK="yes"
  REMOVEPACKAGES="lilo"
  #HOOKDIR="/usr/lib/pbuilder/hooks"
  #HOOKDIR=""
  HOOKDIR="/var/cache/pbuildd/hooks"
  
  # make debconf not interact with user
  export DEBIAN_FRONTEND="noninteractive"
  
  DEBEMAIL=""
  
  #for pbuilder debuild
  BUILDSOURCEROOTCMD="fakeroot"
  PBUILDERROOTCMD="sudo"
  
  #default is to build everything. Passed on to dpkg-buildpackage
  DEBBUILDOPTS="-b"
  #DEBBUILDOPTS=""
  
  #APT configuration files directory
  APTCONFDIR=""
  
  # the username and ID used by pbuilder, inside chroot. Needs fakeroot, really
  BUILDUSERID=1234
  BUILDUSERNAME=pbuildd
  
  # BINDMOUNTS is a space separated list of things to mount
  # inside the chroot.
  BINDMOUNTS="/var/cache/pbuildd"
  
  
  
  
  1.1                  pbuildd/scripts/show_new
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/show_new?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/show_new?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: show_new
  ===================================================================
  #! /usr/bin/perl -w
  
  use File::Find;
  
  %pkgs = ();
  
  sub wanted() {
    if (/(.*)_.*\.dsc/) {
      $pkgs{$1} = 1;
    }
  }
  
  find(\&wanted, "/var/cache/pbuildd/build");
  find(\&wanted, "/var/cache/pbuildd/fail");
  find(\&wanted, "/var/cache/pbuildd/done");
  find(\&wanted, "/var/cache/pbuildd/done-partial");
  find(\&wanted, "/var/cache/pbuildd/partial");
  find(\&wanted, "/var/cache/pbuildd/pool");
  find(\&wanted, "/var/cache/pbuildd/old-pool");
  find(\&wanted, "/var/cache/pbuildd/stuck");
  
  $arch = `dpkg-architecture -qDEB_BUILD_ARCH`;
  
  @ARGV = glob("/var/lib/apt/lists/*_main_source_Sources");
  while (<>) {
    if (/Package: (\S*)$/) {
      # Check for architecture field
      $pkg = $1;
      next if $pkgs{$1};
      while (<>) {
        last if /^$/;
        if (/Architecture:.* ($arch|any|all)( |$)/) {
  	print "$pkg\n";
        }
      }
    }
  }
  
  exit;
  
  
  
  1.1                  pbuildd/scripts/show_outofdate
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/show_outofdate?annotate=1.1&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuildd/scripts/show_outofdate?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=
  
  -----------------------------------
  
  Index: show_outofdate
  ===================================================================
  #! /usr/bin/perl -w
  
  use File::Find;
  
  $verbose = 1 if ($#ARGV >= 0 && $ARGV[0] eq '-v');
  
  %srcver = ();
  
  @ARGV = glob("/var/lib/apt/lists/*_source_Sources");
  while (<>) {
    if (/\s(\S*)_(\S*)\.dsc$/) {
      if (exists $srcver{$1}) {
        warn "Duplicate source package $1";
        $pkg = $1;
        $newver = $2;
        $oldver = $srcver{$1};
        system "dpkg", "--compare-versions", $newver, "gt", $oldver;
        $srcver{$pkg} = $newver if $? == 0;
      } else {
        $srcver{$1} = $2;
      }
    }
  }
  
  sub wanted() {
    if (/(.*)_(.*)\.dsc/) {
      if (exists $curver{$1}) {
        $pkg = $1;
        $newver = $2;
        $oldver = $curver{$1};
        system "dpkg", "--compare-versions", $newver, "gt", $oldver;
        $curver{$pkg} = $newver if $? == 0;
      }
      else {
        $curver{$1} = $2;
      }
    }
  }
  
  %curver = ();
  
  find(\&wanted, "/var/cache/pbuildd/build");
  find(\&wanted, "/var/cache/pbuildd/fail");
  find(\&wanted, "/var/cache/pbuildd/done");
  find(\&wanted, "/var/cache/pbuildd/done-partial");
  find(\&wanted, "/var/cache/pbuildd/partial");
  find(\&wanted, "/var/cache/pbuildd/pool");
  find(\&wanted, "/var/cache/pbuildd/old-pool");
  find(\&wanted, "/var/cache/pbuildd/stuck");
  
  foreach $pkg (sort keys %curver) {
    next if (exists $srcver{$pkg} && $curver{$pkg} eq $srcver{$pkg});
    print $pkg;
    if ($verbose) {
      if (! exists $srcver{$pkg}) {
        print " (obsolete)";
      }
      else {
        system "dpkg", "--compare-versions", $curver{$pkg}, "gt", $srcver{$pkg};
        if ($? == 0) {
  	print " (version $curver{$pkg} newer than $srcver{$pkg})";
        }
        else {
  	print " (version $curver{$pkg} older than $srcver{$pkg})";
        }
      }
    }
    print "\n";
  }
  exit;
  
  
  



More information about the Pbuilder-maint mailing list