28.13 Producing an ALLPROSE Release Distribution

  28.13.1 Check Proper Compilation
  28.13.2 Collect Distribution Files
  28.13.3 Release Date
  28.13.4 Build an Archive

This section describes how to produce a release distribution of ALLPROSE. There are basically two targets available, namely checked-allprose-distribution and allprose-distribution.

28.13.1 Check Proper Compilation

Whereas checked-allprose-distribution first compiles and checks the library and compiles all sorts of documentation, allprose-distribution assumes that everything has been checked and simply puts the relevant files together into an archive.

408make ALLPROSE distribution file 408  (346)  409
checked-allprose-distribution:
        $(MAKE) distclean check
        $(MAKE) distclean include-allprose-documentation ps checklog
        $(MAKE) distclean include-allprose-documentation pdf checklog
        $(MAKE) distclean include-allprose-documentation html checklog
        $(MAKE) distclean allprose-distribution

Defines:
checked-allprose-distribution, never used.

Uses allprose-distribution 410, check 353, checklog 409, distclean 401b, html 375, include-allprose-documentation 391, pdf 374b, and ps 373b.

We do not like undefined references in the distribution, so we stop if we find one.

409make ALLPROSE distribution file 408+   (346)  408  410
checklog:
        $(PERL) \
          -e ’while(<>){’ \
          -e ’  if(/LaTeX Warning: There were undefined references\./){’\
          -e ’    exit 1;}}’ $(projectname).log

Defines:
checklog, used in chunks 408 and 418.

Uses PERL 427b and projectname 124.

28.13.2 Collect Distribution Files

The ALLPROSE distribution basically consist of all file that are listed in allprosefiles.list plus a few more files that can be found below.

We start by putting a release-date at the first line of the file ChangeLog file. Then we write any file name to a manifest file, create a directory with the name allprose-0.2.6, and copy all relevant files to that directory. Finally that directory is put into an archive and compressed.

410make ALLPROSE distribution file 408+   (346)  409  412a
allprose-distribution: allprosefiles.list release-date
        @echo "Creating ALLPROSE distribution..."
        echo manifest.allprose > manifest.allprose
        echo README           >> manifest.allprose
        echo GPL              >> manifest.allprose
        echo ChangeLog        >> manifest.allprose
        echo Makefile         >> manifest.allprose
        $(MAKE) $(shell $(PERL) -pe ’s/$$/.allprosedistro/’ allprosefiles.list)
        $(MAKE) VERSION=$(ALLPROSEVERSION) tgz.allprose

%/myalps.allprosedistro:
        $(FIND) $*/myalps -name ’*.nw’ >> manifest.allprose

%.allprosedistro:
        echo $* >> manifest.allprose

Defines:
allprose-distribution, used in chunk 408.

Uses allprosefiles.list 403, ALLPROSEVERSION 362, FIND 428, PERL 427b, and release-date 412b.

28.13.3 Release Date

We write the project name, its version, and the current date onto the top of the ChangeLog file. The ChangeLog file is not modified if a line of the form

-- ALLPROSE 0.2.2 -- 28-May-2006 --

is already there with identical name, version, and date. If just the date differs then the release-date target will not succeed.

Of course, we must make sure that a ChangeLog file actually exists.

412amake ALLPROSE distribution file 408+   (346)  410  412b
ChangeLog:
        $(CREATEIFNOTTHERE) $@

Uses CREATEIFNOTTHERE 429a.
412bmake ALLPROSE distribution file 408+   (346)  412a  415b
release-date: ChangeLog
        $(PERL) \
          PERL determine the current date in dd-Mmm-yyyy form 412c \
          PERL read the ChangeLog file to the variable @lines 413a \
          PERL set NAMEVERSION 415a \
          PERL exit if first line already contains NAMEVERSION 413b \
          PERL add release date to ChangeLog file 413c

Defines:
release-date, used in chunks 410 and 419.

Uses PERL 427b.
412cPERL determine the current date in dd-Mmm-yyyy form 412c  (412b)
-e ’($$s,$$m,$$h,$$D,$$M,$$Y) = localtime(time);’ \
-e ’@Month = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",’ \
-e ’"Jul", "Aug", "Sep", "Oct", "Nov", "Dec");’ \
-e ’$$date=sprintf("%02d-%s-%04d",$$D,$$Month[$$M],$$Y+1900);’
413aPERL read the ChangeLog file to the variable @lines 413a  (412b)
-e ’open(CL, "ChangeLog") || die "Cannot open ChangeLog";’ \
-e ’@lines=<CL>;’\
-e ’close CL;’

Here we exist with success, if name, version, and date are the same as appearing in the first line of ChangeLog. If name and version are OK, but the date is not the same as today then we abort with an error message.

413bPERL exit if first line already contains NAMEVERSION 413b  (412b)
-e ’if(0==index $$lines[0], $$NAMEVERSION){’ \
-e ’  $$D=substr $$lines[0], length $$NAMEVERSION;’ \
-e ’  if($$D=~/^ $$date --$$/){exit}’ \
-e ’  print STDERR "=====================================\n";’ \
-e ’  print STDERR "First line of ChangeLog differs from\n";’ \
-e ’  print STDERR "$$NAMEVERSION$$date --\n";’ \
-e ’  print STDERR "You probably want to increase MAJORVERSION,\n";’\
-e ’  print STDERR "MINORVERSION, or PATCHVERSION in the file\n";’ \
-e ’  print STDERR "Makefile.def.nw.\n";’ \
-e ’  die;’ \
-e ’}’

Uses MAJORVERSION 124, MINORVERSION 124, and PATCHVERSION 124.
413cPERL add release date to ChangeLog file 413c  (412b)
-e ’open(CL, ">ChangeLog") || die "Cannot create ChangeLog";’ \
-e ’print CL "$$NAMEVERSION $$date --\n";’ \
-e ’print CL @lines;’ \
-e ’close CL;’

The following part is very ALLPROSE-specific. We simply want that lines similar to

-- ALLPROSE 0.2.2 -- 28-May-2006

instead of

-- MyAlps 0.2.2 -- 28-May-2006

appear in the ChangeLog file.

415aPERL set NAMEVERSION 415a  (363 412b)
-e ’if ("$(PROJECTNAME)" eq "$(ALLPROSELIBPROJECTNAME)"){’ \
-e ’  $$RELEASENAME="ALLPROSE";’ \
-e ’} else {’\
-e ’  $$RELEASENAME="$(PROJECTNAME)";’ \
-e ’}’ \
-e ’$$NAMEVERSION="-- $$RELEASENAME $(LIBRARYVERSION) --";’

Uses ALLPROSELIBPROJECTNAME 346, LIBRARYVERSION 362, and PROJECTNAME 124.

28.13.4 Build an Archive

Since the following piece of code is also needed in Section 28.14, we separate it from the ALLPROSE specific part.

The first TAR command, basically copies the relevant files into a subdirectory with the name of the distribution. Then this directory will be put into an archive and compressed. The resulting archive extracts into a new directory.

415bmake ALLPROSE distribution file 408+   (346)  412b
tgz.%:
        $(MDparent) $*-$(VERSION)
        $(TAR) cpf - --files-from manifest.$* | \
            (cd $*-$(VERSION); $(TAR) xpf -)
        $(TAR) cf $*-$(VERSION).tar $*-$(VERSION)
        ${GNUZIP} $*-$(VERSION).tar
        $(RMrecursive) $*-$(VERSION)
        $(RM) tmp.tar

Uses GNUZIP 350b, MDparent 428, RMrecursive 428, and TAR 350b.