Module Name: othersrc Committed By: agc Date: Sat May 14 00:08:45 UTC 2011
Modified Files: othersrc/external/bsd/gensetlist: bsd.setlist.mk gensetlist.c Log Message: add the ability to generate set list entries for SCRIPTS. clean up the sources so that the lines don't wrap (for the minimalists amongst us) past 80 columns To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/gensetlist/bsd.setlist.mk \ othersrc/external/bsd/gensetlist/gensetlist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/external/bsd/gensetlist/bsd.setlist.mk diff -u othersrc/external/bsd/gensetlist/bsd.setlist.mk:1.3 othersrc/external/bsd/gensetlist/bsd.setlist.mk:1.4 --- othersrc/external/bsd/gensetlist/bsd.setlist.mk:1.3 Tue May 10 06:42:13 2011 +++ othersrc/external/bsd/gensetlist/bsd.setlist.mk Sat May 14 00:08:45 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.setlist.mk,v 1.3 2011/05/10 06:42:13 agc Exp $ +# $NetBSD: bsd.setlist.mk,v 1.4 2011/05/14 00:08:45 agc Exp $ # Copyright (c) 2010,2011 Alistair Crooks <a...@netbsd.org> # All rights reserved. @@ -47,6 +47,11 @@ GENSETLIST_ARGS+=-v BINDIR=${BINDIR:Q} .endif +.if defined(SCRIPTS) +GENSETLIST_ARGS+=-v SCRIPTS=${SCRIPTS:Q} +GENSETLIST_ARGS+=-v SCRIPTSDIR=${SCRIPTSDIR:Q} +.endif + .if defined(MLINKS) GENSETLIST_ARGS+=-v MLINKS=${MLINKS:Q} .endif @@ -66,6 +71,8 @@ CATEGORY=${PROG} . elif defined(LIB) CATEGORY=${LIB} +. elif defined(SCRIPTS) +CATEGORY=${SCRIPTS:C|\.sh||} . endif .endif .if defined(CATEGORY) Index: othersrc/external/bsd/gensetlist/gensetlist.c diff -u othersrc/external/bsd/gensetlist/gensetlist.c:1.3 othersrc/external/bsd/gensetlist/gensetlist.c:1.4 --- othersrc/external/bsd/gensetlist/gensetlist.c:1.3 Tue May 10 06:41:26 2011 +++ othersrc/external/bsd/gensetlist/gensetlist.c Sat May 14 00:08:45 2011 @@ -33,11 +33,12 @@ #include <string.h> #include <unistd.h> -#define DISTLIST_VERSION "20101028" +#define SETLIST_VERSION "20110513" enum { MAX_DEFS = 64, MAX_VERSION = 20, + MAX_SCRIPTS = 32, MAX_LINKS = 512 }; @@ -53,16 +54,19 @@ int linkc; /* # of links */ char *symlinks[MAX_LINKS]; /* symbolic links */ int symlinkc; /* # of symbolic links */ + char *scripts[MAX_SCRIPTS]; /* scripts */ + int scriptc; /* # of scripts */ char progname[BUFSIZ]; /* program name */ char libname[BUFSIZ]; /* library name */ char bindir[MAXPATHLEN]; /* program directory */ + char scriptsdir[MAXPATHLEN];/* scripts directory */ char libdir[MAXPATHLEN]; /* library directory */ char incsdir[MAXPATHLEN]; /* include directory */ char mandir[MAXPATHLEN]; /* manual page directory */ int shlib; /* non-zero if lib is shared */ char major[MAX_VERSION]; /* shlib major */ char minor[MAX_VERSION]; /* shlib minor */ - char teeny[MAX_VERSION]; /* possible shlib minimus version */ + char teeny[MAX_VERSION]; /* possible minimus version */ char *category; /* category for syspkgs */ } vars_t; @@ -105,9 +109,12 @@ static int parse(vars_t *vars, const char *in) { + static regex_t scriptsdir; + static regex_t subscripts; static regex_t sublinks; static regex_t symlinks; static regex_t incsdir; + static regex_t scripts; static regex_t bindir; static regex_t libdir; static regex_t mandir; @@ -123,19 +130,39 @@ const char *cp; if (!compiled) { - (void) regcomp(&lib, "^[ \t]*LIB[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&libdir, "^[ \t]*LIBDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&man, "^[ \t]*MAN[ \t]*=", REG_EXTENDED); - (void) regcomp(&subman, "^[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&prog, "^[ \t]*PROG[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&bindir, "^[ \t]*BINDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&mandir, "^[ \t]*MANDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&incs, "^[ \t]*INCS[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&incsdir, "^[ \t]*INCSDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED); - (void) regcomp(&mlinks, "^[ \t]*MLINKS[ \t]*=", REG_EXTENDED); - (void) regcomp(&symlinks, "^[ \t]*SYMLINKS[ \t]*=", REG_EXTENDED); - (void) regcomp(&sublinks, "^[ \t]*([^ \t]+)[ \t]+([^ \t]+)", REG_EXTENDED); - (void) regcomp(&shlib, "^[ \t]*SHLIB_VERSION[ \t]*=[ \t]*([0-9]*)[:.]([0-9]*)[:.]([0-9]*)", + (void) regcomp(&lib, "^[ \t]*LIB[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&libdir, "^[ \t]*LIBDIR[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&scriptsdir, + "^[ \t]*SCRIPTSDIR[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&subscripts, "^[ \t]*([^ \t.]+)(\\.sh)?", + REG_EXTENDED); + (void) regcomp(&scripts, "^[ \t]*SCRIPTS[ \t]*=", + REG_EXTENDED); + (void) regcomp(&man, "^[ \t]*MAN[ \t]*=", + REG_EXTENDED); + (void) regcomp(&subman, "^[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&prog, "^[ \t]*PROG[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&bindir, "^[ \t]*BINDIR[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&mandir, "^[ \t]*MANDIR[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&incs, "^[ \t]*INCS[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&incsdir, "^[ \t]*INCSDIR[ \t]*=[ \t]*([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&mlinks, "^[ \t]*MLINKS[ \t]*=", + REG_EXTENDED); + (void) regcomp(&symlinks, "^[ \t]*SYMLINKS[ \t]*=", + REG_EXTENDED); + (void) regcomp(&sublinks, "^[ \t]*([^ \t]+)[ \t]+([^ \t]+)", + REG_EXTENDED); + (void) regcomp(&shlib, "^[ \t]*SHLIB_VERSION[ \t]*=[ \t]*" + "([0-9]*)[:.]([0-9]*)[:.]([0-9]*)", REG_EXTENDED); } if (regexec(&lib, in, 10, matches, 0) == 0) { @@ -163,6 +190,17 @@ } return 1; } + if (regexec(&scripts, in, 10, matches, 0) == 0) { + for (cp = &in[(int)matches[0].rm_eo] ; + regexec(&subscripts, cp, 10, matches, 0) == 0 ; + cp += matches[0].rm_eo) { + (void) asprintf(&vars->scripts[vars->scriptc++], + "%.*s", + (int)(matches[1].rm_eo - matches[1].rm_so), + &cp[(int)matches[1].rm_so]); + } + return 1; + } if (regexec(&prog, in, 10, matches, 0) == 0) { (void) snprintf(vars->progname, sizeof(vars->progname), "%.*s", @@ -184,6 +222,13 @@ &in[(int)matches[1].rm_so]); return 1; } + if (regexec(&scriptsdir, in, 10, matches, 0) == 0) { + (void) snprintf(vars->scriptsdir, sizeof(vars->scriptsdir), + "%.*s", + (int)(matches[1].rm_eo - matches[1].rm_so), + &in[(int)matches[1].rm_so]); + return 1; + } if (regexec(&incs, in, 10, matches, 0) == 0) { (void) asprintf(&vars->incs[vars->incc++], "%.*s", @@ -222,13 +267,16 @@ } if (regexec(&shlib, in, 10, matches, 0) == 0) { if (matches[1].rm_so >= 0) { - (void) snprintf(vars->major, sizeof(vars->major), "%.*s", + (void) snprintf(vars->major, sizeof(vars->major), + "%.*s", (int)(matches[1].rm_eo - matches[1].rm_so), &in[(int)matches[1].rm_so]); - (void) snprintf(vars->minor, sizeof(vars->minor), "%.*s", + (void) snprintf(vars->minor, sizeof(vars->minor), + "%.*s", (int)(matches[2].rm_eo - matches[2].rm_so), &in[(int)matches[2].rm_so]); - (void) snprintf(vars->teeny, sizeof(vars->teeny), "%.*s", + (void) snprintf(vars->teeny, sizeof(vars->teeny), + "%.*s", (int)(matches[3].rm_eo - matches[3].rm_so), &in[(int)matches[3].rm_so]); vars->shlib = 1; @@ -245,7 +293,9 @@ const char *ip; char *op; - for (op = out, ip = in ; *in && (int)(op - out) < (int)(size - 1) ; ip++, op++) { + for (op = out, ip = in ; + *in && (int)(op - out) < (int)(size - 1) ; + ip++, op++) { *op = tolower((unsigned char)*ip); } *op = 0x0; @@ -284,17 +334,20 @@ if (strncmp(optarg, "MK", 2) == 0) { optarg += 2; } - vars.defs[vars.defc++] = strdup(lowerit(optarg, buf, sizeof(buf))); + vars.defs[vars.defc++] = strdup(lowerit(optarg, buf, + sizeof(buf))); break; case 'V': - (void) fprintf(stderr, "distlist version: %s\n", DISTLIST_VERSION); + (void) fprintf(stderr, "distlist version: %s\n", + SETLIST_VERSION); exit(EXIT_SUCCESS); case 'c': vars.category = optarg; break; case 'v': if (!parse(&vars, optarg)) { - (void) fprintf(stderr, "bad arg: -v %s\n", optarg); + (void) fprintf(stderr, "bad arg: -v %s\n", + optarg); } break; default: @@ -310,14 +363,21 @@ /* base compat entries */ for (compat = compats ; compat->arch64 ; compat++) { psetname(setname, sizeof(setname), - "\n[src/distrib/sets/lists/base/%s.%s]\n", + "\n[src/distrib/sets/lists/" + "base/%s.%s]\n", compat->type, compat->arch64); - printf(".%s/%s/lib%s.so.%s\t\tbase-compat-shlib\t%s\n", - vars.libdir, compat->arch32, vars.libname, vars.major, - pdefs(&vars, buf, sizeof(buf), "compat,pic")); - printf(".%s/%s/lib%s.so.%s.%s\t\tbase-compat-shlib\t%s\n", - vars.libdir, compat->arch32, vars.libname, vars.major, vars.minor, - pdefs(&vars, buf, sizeof(buf), "compat,pic")); + printf(".%s/%s/lib%s.so.%s\t\t" + "base-compat-shlib\t%s\n", + vars.libdir, compat->arch32, + vars.libname, vars.major, + pdefs(&vars, buf, sizeof(buf), + "compat,pic")); + printf(".%s/%s/lib%s.so.%s.%s\t\t" + "base-compat-shlib\t%s\n", + vars.libdir, compat->arch32, + vars.libname, vars.major, vars.minor, + pdefs(&vars, buf, sizeof(buf), + "compat,pic")); } psetname(setname, sizeof(setname), "\n[src/distrib/sets/lists/base/shl.mi]\n"); @@ -325,10 +385,12 @@ vars.libdir, vars.libname, vars.category, pdefs(&vars, buf, sizeof(buf), NULL)); printf(".%s/lib%s.so.%s\t\tbase-%s-shlib\t%s\n", - vars.libdir, vars.libname, vars.major, vars.category, + vars.libdir, vars.libname, vars.major, + vars.category, pdefs(&vars, buf, sizeof(buf), NULL)); printf(".%s/lib%s.so.%s.%s\t\tbase-%s-shlib\t%s\n", - vars.libdir, vars.libname, vars.major, vars.minor, vars.category, + vars.libdir, vars.libname, vars.major, + vars.minor, vars.category, pdefs(&vars, buf, sizeof(buf), NULL)); } } @@ -340,6 +402,14 @@ vars.bindir, vars.progname, vars.category, pdefs(&vars, buf, sizeof(buf), NULL)); } + /* scripts */ + for (i = 0 ; i < vars.scriptc ; i++) { + printf(".%s/%s\t\tbase-%s-bin\t%s\n", + vars.scriptsdir, + vars.scripts[i], + vars.category, + pdefs(&vars, buf, sizeof(buf), NULL)); + } /* symbolic links */ if (vars.symlinkc > 0) { for (i = 0 ; i < vars.symlinkc ; i++) { @@ -369,34 +439,40 @@ for (i = 0 ; i < vars.manc ; i++) { printf(".%s/cat%c/%.*s.0\t\tcomp-%s-catman\t\t%s\n", vars.mandir, - vars.mans[i][strlen(vars.mans[i]) - 1], (int)strlen(vars.mans[i]) - 2, + vars.mans[i][strlen(vars.mans[i]) - 1], + (int)strlen(vars.mans[i]) - 2, vars.mans[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".cat")); printf(".%s/html%c/%.*s.html\t\tcomp-%s-htmlman\t\t%s\n", vars.mandir, - vars.mans[i][strlen(vars.mans[i]) - 1], (int)strlen(vars.mans[i]) - 2, + vars.mans[i][strlen(vars.mans[i]) - 1], + (int)strlen(vars.mans[i]) - 2, vars.mans[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".html")); printf(".%s/man%c/%s\t\tcomp-%s-man\t\t%s\n", vars.mandir, - vars.mans[i][strlen(vars.mans[i]) - 1], vars.mans[i], vars.category, + vars.mans[i][strlen(vars.mans[i]) - 1], + vars.mans[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".man")); } /* man page links */ for (i = 0 ; i < vars.linkc ; i++) { printf(".%s/cat%c/%.*s.0\t\tcomp-%s-catman\t\t%s\n", vars.mandir, - vars.links[i][strlen(vars.links[i]) - 1], (int)strlen(vars.links[i]) - 2, + vars.links[i][strlen(vars.links[i]) - 1], + (int)strlen(vars.links[i]) - 2, vars.links[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".cat")); printf(".%s/html%c/%.*s.html\t\tcomp-%s-htmlman\t\t%s\n", vars.mandir, - vars.links[i][strlen(vars.links[i]) - 1], (int)strlen(vars.links[i]) - 2, + vars.links[i][strlen(vars.links[i]) - 1], + (int)strlen(vars.links[i]) - 2, vars.links[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".html")); printf(".%s/man%c/%s\t\tcomp-%s-man\t\t%s\n", vars.mandir, - vars.links[i][strlen(vars.links[i]) - 1], vars.links[i], vars.category, + vars.links[i][strlen(vars.links[i]) - 1], + vars.links[i], vars.category, pdefs(&vars, buf, sizeof(buf), ".man")); } /* libs */ @@ -410,7 +486,8 @@ printf(".%s/lib%s_p.a\t\tcomp-%s-proflib\t%s\n", vars.libdir, vars.libname, vars.category, pdefs(&vars, buf, sizeof(buf), "profile")); - printf("./usr/libdata/lint/llib-l%s.ln\t\tcomp-%s-lintlib\t%s\n", + printf("./usr/libdata/lint/llib-l%s.ln\t\t" + "comp-%s-lintlib\t%s\n", vars.libname, vars.category, pdefs(&vars, buf, sizeof(buf), "lint")); if (vars.shlib) { @@ -419,8 +496,10 @@ printf(".%s/lib%s_pic.a\t\tcomp-%s-piclib\t%s\n", vars.libdir, vars.libname, vars.category, pdefs(&vars, buf, sizeof(buf), NULL)); - printf("./usr/libdata/debug%s/lib%s.so.%s.%s.debug\t\tcomp-%s-debug\t%s\n", - vars.libdir, vars.libname, vars.major, vars.minor, vars.category, + printf("./usr/libdata/debug%s/lib%s.so.%s.%s." + "debug\t\tcomp-%s-debug\t%s\n", + vars.libdir, vars.libname, vars.major, + vars.minor, vars.category, pdefs(&vars, buf, sizeof(buf), "debug")); } /* compat entries */ @@ -436,17 +515,23 @@ pdefs(&vars, buf, sizeof(buf), "compat")); printf(".%s/%s/lib%s_g.a\t\tcomp-c-proflib\t%s\n", vars.libdir, compat->arch32, vars.libname, - pdefs(&vars, buf, sizeof(buf), "compat,debuglib")); + pdefs(&vars, buf, sizeof(buf), + "compat,debuglib")); printf(".%s/%s/lib%s_p.a\t\tcomp-c-proflib\t%s\n", vars.libdir, compat->arch32, vars.libname, - pdefs(&vars, buf, sizeof(buf), "compat,profile")); + pdefs(&vars, buf, sizeof(buf), + "compat,profile")); printf(".%s/%s/lib%s_pic.a\t\tcomp-c-piclib\t%s\n", vars.libdir, compat->arch32, vars.libname, - pdefs(&vars, buf, sizeof(buf), "compat,pic")); + pdefs(&vars, buf, sizeof(buf), + "compat,pic")); if (vars.shlib) { - printf("./usr/libdata/debug%s/%s/lib%s.so.%s.%s.debug\t\tcomp-compat-shlib\t%s\n", - vars.libdir, compat->arch32, vars.libname, vars.major, vars.minor, - pdefs(&vars, buf, sizeof(buf), "compat,pic,debug")); + printf("./usr/libdata/debug%s/%s/lib%s.so.%s." + "%s.debug\t\tcomp-compat-shlib\t%s\n", + vars.libdir, compat->arch32, + vars.libname, vars.major, vars.minor, + pdefs(&vars, buf, sizeof(buf), + "compat,pic,debug")); } } }