mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Get rid of overcomplicated AT&T copyright/license maintenance code
I'm now taking another small step towards extricating this build
system from the long-dead AT&T AST universe.
This commit modifies/reduces the tool called proto. AT&T used proto
for two purposes:
  1. To convert ANSI C code to a form compatible with ancient
     (pre-ANSI) K&R C compilers using extremely complex macro
     voodo. It was similarly capable of translating to C++.
     Theoretically, this entire code base should compile on
     anything from a 1980s K&R C compiler to a modern C++ compiler.
     In practice, given the massive amount of bit rot we inherited,
     I am 99.9% sure that this has been broken for many years.
  2. To automagically insert license comments into source files
     based on an extremely complicated license database system.
     (In all-too-typical AT&T fashion, this second function of
     proto is completely unrelated to the first.)
Function 2 has now been removed because, unlike the AT&T legal
department, I don't think it's worth going to unspeakably extreme
lengths to avoid maintaining license information in source code
files by hand.
In the process, proto.c was cleaned up to look halfway like actual
C code, but it's still processed code: most macros have been
expanded to their numeric value, all comments were stripped, etc.
So don't expect to understand this code. The actual source code is
in these two directories in the ast-open-history repo:
https://github.com/ksh93/ast-open-history/tree/master/src/cmd/proto
https://github.com/ksh93/ast-open-history/tree/master/src/lib/libpp
Meanwhile, nobody wants to compile ksh with a pre-ANSI K&R C
compiler in 2021 -- and there's no good reason to be compatible
with C++ because standard C compilers are universally available.
So, proto will go away when I manage to figure out how to pry it
loose from the innards of this build system.
src/lib/libast/port/astlicense.c:
- Removed. This is al the license handling code that was
  incorporated in proto.c in stripped form. It was not used
  anywhere else, and the environment where it was useful is gone.
src/cmd/INIT/proto.c:
- Cleanup to make this halfway maintainable: indentation, huge
  blocks of empty lines, #line directives, etc.
- Delete all the code corresponding to astlicense.c. This was
  actually easy as it was in a discrete block.
- proto(), pppopen(): Remove 'license'/'notice' and 'options'
  arguments.
- main(): Remove processing of -l (license) and -o (license
  options) flags.
**/Mamfile:
- Update all the proto invocations to remove the -l and -o flags.
bin/package, src/cmd/INIT/package.sh:
- Delete the 'copyright' command, which used the -l and -o
  options to tell proto to extract copyright information from
  *.lic/*.def files in lib/package.
COPYRIGHT:
- Added. This has the information from 'bin/package copyright', with
  the copyright years corrected to plausible values as the AST code
  used the current year (2021) for all of them. It adds ksh 93u+m
  copyright and contributor information at the top as well.
     (Yes, some of the lines in the old non-AT&T copyright notices
  are clipped. This is the actual output of the 'bin/package
  copyright' command as generated by 'proto' in the AST
  distribution. For all that extreme complexity, they couldn't even
  reproduce the notices correctly. But it's officially sanctioned
  by AT&T in exactly this form, so there you have it.)
lib/package/**:
- Removed. All these files are now obsolete and redundant.
			
			
This commit is contained in:
		
							parent
							
								
									c2ac69b2d5
								
							
						
					
					
						commit
						46593a89b7
					
				
					 38 changed files with 551 additions and 6286 deletions
				
			
		
							
								
								
									
										74
									
								
								bin/package
									
										
									
									
									
								
							
							
						
						
									
										74
									
								
								bin/package
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -253,10 +253,6 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
 | 
			
		|||
	    The hierarchy can be rebuilt by \bpackage make\b.]
 | 
			
		||||
        [+contents\b [ \apackage\a ... ]]?List description and
 | 
			
		||||
            components for \apackage\a on the standard output.]
 | 
			
		||||
        [+copyright\b [ \apackage\a ... ]]?List the general copyright
 | 
			
		||||
            notice(s) for \apackage\a on the standard output. Note that
 | 
			
		||||
            individual components in \apackage\a may contain additional or
 | 
			
		||||
            replacement notices.]
 | 
			
		||||
        [+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
 | 
			
		||||
            \avariable\a, one per line. If the \bonly\b attribute is
 | 
			
		||||
            specified then only the variable values are listed. If no
 | 
			
		||||
| 
						 | 
				
			
			@ -497,15 +493,6 @@ case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
 | 
			
		|||
    that contain the package name, package components, references to other
 | 
			
		||||
    packages, and a short package description. *\b.pkg\b files are used by
 | 
			
		||||
    \bpackage write\b to generate new source and binary packages.]
 | 
			
		||||
[+?\b$PACKAGEROOT/lib/package/\b\agroup\a\b.lic\b files contain license
 | 
			
		||||
    information that is used by the \bAST\b \bproto\b(1) and \bnmake\b(1)
 | 
			
		||||
    commands to generate source and binary license strings. \agroup\a is
 | 
			
		||||
    determined by the first \b:PACKAGE:\b operator name listed in the
 | 
			
		||||
    component \bnmake\b makefile. \agroup\a\b.lic\b files are part of the
 | 
			
		||||
    licensing documentation. Each component may have its own \bLICENSE\b file
 | 
			
		||||
    that overrides the \agroup\a\b.lic\b file. The full text of the licenses
 | 
			
		||||
    are in the \b$PACKAGEROOT/lib/package/LICENSES\b and
 | 
			
		||||
    \b$INSTALLROOT/lib/package/LICENSES\b directories.]
 | 
			
		||||
[+?A few files are generated in \b$PACKAGEROOT/lib/package/gen\b and
 | 
			
		||||
    \b$INSTALLROOT/lib/package/gen\b. \apackage\a\b.ver\b contains one line
 | 
			
		||||
    consisting of \apackage version release\a \b1\b for the most recent
 | 
			
		||||
| 
						 | 
				
			
			@ -635,7 +622,7 @@ do	case $# in
 | 
			
		|||
	0)	set host type ;;
 | 
			
		||||
	esac
 | 
			
		||||
	case $1 in
 | 
			
		||||
	admin|clean|clobber|contents|copyright|export|host|install|license|list|make|read|regress|release|remove|results|setup|test|update|use|verify|view|write|TEST)
 | 
			
		||||
	admin|clean|clobber|contents|export|host|install|license|list|make|read|regress|release|remove|results|setup|test|update|use|verify|view|write|TEST)
 | 
			
		||||
		action=$1
 | 
			
		||||
		shift
 | 
			
		||||
		break
 | 
			
		||||
| 
						 | 
				
			
			@ -849,15 +836,6 @@ are ${bB}ast${eB} ${Mnmake} makefiles that contain the package name, package com
 | 
			
		|||
references to other packages, and a short package description. *${bB}.pkg${eB} files
 | 
			
		||||
are used by ${bF}package write${eF} to generate new source and binary packages.
 | 
			
		||||
${bP}
 | 
			
		||||
${bB}\$PACKAGEROOT/lib/package/${eB}${bI}GROUP${eI}${bB}.lic${eB} files contain license information that
 | 
			
		||||
is used by the ${bB}ast${eB} ${Mproto} and ${Mnmake} commands to generate source and
 | 
			
		||||
binary license strings. ${bI}GROUP${eI} is determined by the first ${bB}:PACKAGE:${eB} operator
 | 
			
		||||
name listed in the component ${bB}nmake${eB} makefile. ${bI}GROUP${eI}${bB}.lic${eB} files are part of the
 | 
			
		||||
licensing documentation.  Each component may have its own ${bB}LICENSE${eB} file that
 | 
			
		||||
overrides the ${bI}GROUP${eI}${bB}.lic${eB} file.  The full text of the licenses are in the
 | 
			
		||||
${bB}\$PACKAGEROOT/lib/package/LICENSES${eB} and ${bB}\$INSTALLROOT/lib/package/LICENSES${eB}
 | 
			
		||||
directories.
 | 
			
		||||
${bP}
 | 
			
		||||
A few files are generated in ${bB}\$PACKAGEROOT/lib/package/gen${eB} and
 | 
			
		||||
${bB}\$INSTALLROOT/lib/package/gen${eB}. ${bI}PACKAGE${eI}${bB}.ver${eB} contains one line consisting of${bX}
 | 
			
		||||
	${bI}PACKAGE VERSION RELEASE${eI} 1${eX}
 | 
			
		||||
| 
						 | 
				
			
			@ -1073,10 +1051,6 @@ ${bT}(5)${bD}Read all unread package archive(s):${bX}
 | 
			
		|||
	contents [ package ... ]
 | 
			
		||||
		List description and components for PACKAGE on the standard
 | 
			
		||||
		output.
 | 
			
		||||
	copyright [ package ... ]
 | 
			
		||||
		List the general copyright notice(s) for PACKAGE on the
 | 
			
		||||
		standard output. Note that individual components in PACKAGE
 | 
			
		||||
		may contain additional or replacement notices.
 | 
			
		||||
	export [ VARIABLE ... ]
 | 
			
		||||
		List NAME=VALUE for each VARIABLE, one per line. If the
 | 
			
		||||
		\"only\" attribute is specified then only the variable
 | 
			
		||||
| 
						 | 
				
			
			@ -4289,26 +4263,6 @@ get() # host path [ file size ]
 | 
			
		|||
	esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# generate copyright notice
 | 
			
		||||
 | 
			
		||||
copyright()
 | 
			
		||||
{
 | 
			
		||||
	if	test -f $1.lic
 | 
			
		||||
	then	echo $1 package general copyright notice
 | 
			
		||||
		echo
 | 
			
		||||
		proto -c'#' -p -s -l $1.lic -o type=verbose,author='*' /dev/null
 | 
			
		||||
		return 0
 | 
			
		||||
	fi
 | 
			
		||||
	case $1 in
 | 
			
		||||
	*-*)	eval `echo '' $1 | sed 's/\([^-]*\)-\(.*\)/__j__="\1" __i__="\2"/'`
 | 
			
		||||
		if	copyright $__i__ || copyright $__j__
 | 
			
		||||
		then	return 0
 | 
			
		||||
		fi
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# run remote make on host
 | 
			
		||||
 | 
			
		||||
remote() # host no-exec-background
 | 
			
		||||
| 
						 | 
				
			
			@ -5240,32 +5194,6 @@ contents|list)
 | 
			
		|||
	esac
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
copyright)
 | 
			
		||||
	# all work in $PACKAGESRC
 | 
			
		||||
 | 
			
		||||
	cd $PACKAGESRC
 | 
			
		||||
 | 
			
		||||
	# generate the package list
 | 
			
		||||
 | 
			
		||||
	set '' $target $package
 | 
			
		||||
	shift
 | 
			
		||||
	argc=$#
 | 
			
		||||
	case $# in
 | 
			
		||||
	0)	set '' `echo *.lic | sed 's,\.lic,,g'`
 | 
			
		||||
		shift
 | 
			
		||||
		case $1 in
 | 
			
		||||
		'*')	echo $command: $action: no packages >&2
 | 
			
		||||
			exit 1
 | 
			
		||||
			;;
 | 
			
		||||
		esac
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	checkaout proto || exit
 | 
			
		||||
	for i
 | 
			
		||||
	do	copyright $i
 | 
			
		||||
	done
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
export)	case $INSTALLROOT in
 | 
			
		||||
	$PACKAGEROOT)
 | 
			
		||||
		INSTALLROOT=$INSTALLROOT/arch/$HOSTTYPE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue