[BACK]Return to chkdatabase.awk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk / scripts

File: [cvs.NetBSD.org] / pkgsrc / mk / scripts / chkdatabase.awk (download)

Revision 1.3, Fri Dec 15 12:46:24 2006 UTC (17 years, 4 months ago) by martti
Branch: MAIN
CVS Tags: pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3, pkgsrc-2009Q2-base, pkgsrc-2009Q2, pkgsrc-2009Q1-base, pkgsrc-2009Q1, pkgsrc-2008Q4-base, pkgsrc-2008Q4, pkgsrc-2008Q3-base, pkgsrc-2008Q3, pkgsrc-2008Q2-base, pkgsrc-2008Q2, pkgsrc-2008Q1-base, pkgsrc-2008Q1, pkgsrc-2007Q4-base, pkgsrc-2007Q4, pkgsrc-2007Q3-base, pkgsrc-2007Q3, pkgsrc-2007Q2-base, pkgsrc-2007Q2, pkgsrc-2007Q1-base, pkgsrc-2007Q1, pkgsrc-2006Q4-base, pkgsrc-2006Q4, jlam-pkgviews-base, jlam-pkgviews, cwrapper, cube-native-xorg-base, cube-native-xorg
Changes since 1.2: +7 -7 lines

Remove trailing spaces.

#!/usr/bin/awk -f
#
# $NetBSD: chkdatabase.awk,v 1.3 2006/12/15 12:46:24 martti Exp $
#
# Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Dan McMahill.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#        This product includes software developed by the NetBSD
#        Foundation, Inc. and its contributors.
# 4. Neither the name of The NetBSD Foundation nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

# This script reads a pkgsrc database created with the 'print-summary-data'
# target and returns a lists of packages which are listed as DEPENDS and/or
# BUILD_DEPENDS but do not have their own dependencies recorded yet.
# This can be used as part of a loop which makes several passes to record
# the complete dependency tree for a package in the database
#

BEGIN {
  if(debug) {
    printf("Reading database file\n") > "/dev/stderr";
    fflush("/dev/stderr");
  }
}

/^(build_)?depends / {
#
# Read in the entire depends tree
# These lines look like:
#
#depends /usr/pkgsrc/math/scilab xless-[0-9]*:../../x11/xless pvm-3.4.3:../../parallel/pvm3
#build_depends /usr/pkgsrc/math/scilab libtool-base>=1.4.20010614nb9:../../devel/libtool-base
#
  pkg = $2;

# mark this package as having its depencencies listed
  depended_pkgs[pkg] = 1;

# now go through the dependency lists and pull out all pkg directories that
# we will need to examine to ensure they have been depended.
  for(i=3; i<=NF; i++) {
    split($i,a,":");
    pkgpat=a[1];
    pkgdir=a[2];
    sub(/[\.\/]*/,"",pkgdir);
    if(pkgdir !~ /\//) {
      pkgcat=pkg;
      gsub(/\/.*/,"",pkgcat);
      pkgdir=pkgcat "/" pkgdir;
      if(debug) printf("Corrected missing category directory to get \"%s\"\n",pkgdir) > "/dev/stderr";
    }
    if(debug){
      printf("package in directory %s %s on:\n",pkg,deptype) > "/dev/stderr";
      printf("\tpkgpat = %s\n",pkgpat) > "/dev/stderr";
      printf("\tpkgdir = %s\n",pkgdir) > "/dev/stderr";
    }

# mark this package directory as being one which is depended upon
    depended_on_pkgs[pkgdir] = 1;

  }
  next;
}


END {
  i=0;
  for(pkg in depended_on_pkgs) {
    if(pkg in depended_pkgs) {
      if(debug) printf("Package: %s is already depended\n",pkg) > "/dev/stderr";
    }
    else {
      if(debug)printf("Package: %s is NOT depended\n",pkg) > "/dev/stderr";
      not_depended[i]=pkg;
      i++;
    }
  }

  i=0;
  while(i in not_depended) {
    printf("%s\n",not_depended[i]);
    i++;
  }
  close("/dev/stderr");

  exit(0);
}