openpkg/rpm.patch.feature

Tue, 29 Nov 2011 18:44:37 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Nov 2011 18:44:37 +0100
changeset 395
41738a0e98d1
parent 333
4ecfc2416fd8
child 427
71503088f51b
permissions
-rw-r--r--

Reduce private memory allocation after observing stable operation.

     1 ##
     2 ##  rpm.patch.feature -- Annotated OpenPKG RPM Patch file
     3 ##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     5 ##
     6 ##  This file assembles changes to existing RPM source files between
     7 ##  the original RedHat RPM and the OpenPKG RPM variant. It can be
     8 ##  automatically applied to a vanilla RedHat RPM source tree with the
     9 ##  'patch' tool to upgrade those files. Each patch snippet is annotated
    10 ##  with a short description.
    11 ##
    12 ##  Created on: 13-Sep-2006
    13 ##
    14 ##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
    15 ##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
    16 ##
    18 +---------------------------------------------------------------------------
    19 | Remove "tools" directory from sub-directory list because it contains
    20 | things we are not interested in and which cause some build trouble
    21 | anyway.
    22 | Use a plain "rpmpopt" file without any trailing version.
    23 | Adjust paths to conform to OpenPKG filesystem layout.
    24 | Do not run the "installplatform" script, because not needed for OpenPKG.
    25 +---------------------------------------------------------------------------
    26 Index: Makefile.am
    27 --- Makefile.am	29 May 2003 18:20:28 -0000	1.1.1.17
    28 +++ Makefile.am	22 Jan 2004 21:42:02 -0000	1.2
    29 @@ -12,9 +12,9 @@
    30  	xmlspec/examples/*.sh xmlspec/examples/*.lst \
    31  	xmlspec/examples/*.xmlspec \
    32  	po/*.in po/*.po po/rpm.pot \
    33 -	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
    34 +	rpm.magic rpmpopt rpmqv.c rpm.c
    36 -SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc .
    37 +SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc .
    39  INCLUDES = \
    40  	-I$(top_srcdir)/build \
    41 @@ -47,13 +47,10 @@
    43  pkglibdir =		@RPMCONFIGDIR@
    44  pkglib_PROGRAMS =	rpmb rpmd rpmi rpmk rpmq
    45 -pkglib_DATA =		rpmrc rpmpopt-$(VERSION) macros
    46 +pkglib_DATA =		rpmrc rpmpopt macros
    47  pkglib_SCRIPTS =	find-provides find-requires mkinstalldirs \
    48  			config.guess config.sub config.site
    50 -rpmpopt-$(VERSION): rpmpopt
    51 -	cp rpmpopt $@
    52 -
    53  noinst_HEADERS = build.h debug.h system.h
    55  rpm_SOURCES =
    56 @@ -124,32 +121,32 @@
    57  pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR)
    59  install-data-local:
    60 -	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
    61 +	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
    62  	@rm -f $(DESTDIR)$(libdir)/rpmrc
    63  	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
    64  	@rm -f $(DESTDIR)$(libdir)/rpmpopt
    65  	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
    66  	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
    67 -	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
    68 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
    69 -	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
    70 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
    71 -	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
    72 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
    73 -	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
    74 +	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
    75 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
    76 +	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
    77 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
    78 +	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
    79 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
    80 +	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
    81  	rm -f $(DESTDIR)$(bindir)/rpmbuild
    82 -	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
    83 +	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
    84  	rm -f $(DESTDIR)$(bindir)/rpmquery
    85 -	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
    86 +	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
    87  	rm -f $(DESTDIR)$(bindir)/rpmverify
    88 -	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
    89 +	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
    90  	rm -f $(DESTDIR)$(bindir)/rpmsign
    91 -	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
    92 +	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
    93  	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
    94 -	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
    95 +	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
    96  	for bf in e i u ; do \
    97  	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
    98 -	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
    99 +	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   100  	done
   101  	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
   102  	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
   103 @@ -174,11 +171,6 @@
   104  	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
   105  	esac
   106  	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
   107 -	@case "@host_os@" in \
   108 -	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
   109 -	solaris*|linux*) \
   110 -	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
   111 -	esac
   112  	@$(mkinstalldirs) $(DESTDIR)/var/tmp
   114  .PHONY:	setperms
   115 @@ -198,10 +190,10 @@
   116  	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
   117  	done
   118  	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
   119 -	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
   120 -	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
   121 -	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
   122 -	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
   123 +	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
   124 +	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
   125 +	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
   126 +	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
   128  .PHONY:	unsetgid
   129  unsetgid:
   130 @@ -244,7 +236,7 @@
   131  	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
   133  .PHONY:	doxygen
   134 -doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
   135 +doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
   136  	rm -rf $@
   137  	mkdir -p $@
   138  	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
   140 +---------------------------------------------------------------------------
   141 | Remove "tools" directory from sub-directory list because it contains
   142 | things we are not interested in and which cause some build trouble
   143 | anyway.
   144 | Use a plain "rpmpopt" file without any trailing version.
   145 | Adjust paths to conform to OpenPKG filesystem layout.
   146 | Do not run the "installplatform" script, because not needed for OpenPKG.
   147 +---------------------------------------------------------------------------
   148 Index: Makefile.in
   149 --- Makefile.in	16 Jul 2003 17:05:42 -0000	1.1.1.23
   150 +++ Makefile.in	22 Jan 2004 21:42:03 -0000	1.2
   151 @@ -265,10 +265,10 @@
   152  	xmlspec/examples/*.sh xmlspec/examples/*.lst \
   153  	xmlspec/examples/*.xmlspec \
   154  	po/*.in po/*.po po/rpm.pot \
   155 -	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
   156 +	rpm.magic rpmpopt rpmqv.c rpm.c
   159 -SUBDIRS = intl po @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc .
   160 +SUBDIRS = intl @WITH_ZLIB_SUBDIR@ @WITH_ELFUTILS_SUBDIR@ file @WITH_DB_SUBDIR@ popt @WITH_BEECRYPT_SUBDIR@ rpmio rpmdb lib build misc @WITH_PYTHON_SUBDIR@ scripts tests doc .
   162  INCLUDES = \
   163  	-I$(top_srcdir)/build \
   164 @@ -301,7 +301,7 @@
   165  bin_PROGRAMS = rpm2cpio
   166  bin_SCRIPTS = gendiff
   167  pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq
   168 -pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros
   169 +pkglib_DATA = rpmrc rpmpopt macros
   170  pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \
   171  			config.guess config.sub config.site
   173 @@ -1058,8 +1058,6 @@
   174  	uninstall-rpmbinPROGRAMS
   177 -rpmpopt-$(VERSION): rpmpopt
   178 -	cp rpmpopt $@
   179  rpm.o:	rpmqv.c
   180  	$(COMPILE) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV -o $@ -c rpmqv.c
   181  rpmb.o:	rpmqv.c
   182 @@ -1097,32 +1095,32 @@
   183  		`make -s sources -C popt`
   185  install-data-local:
   186 -	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
   187 +	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
   188  	@rm -f $(DESTDIR)$(libdir)/rpmrc
   189  	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
   190  	@rm -f $(DESTDIR)$(libdir)/rpmpopt
   191  	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
   192 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
   193 -	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
   194 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
   195 -	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
   196 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
   197 -	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
   198 -	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
   199 -	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
   200 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmt
   201 +	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
   202 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
   203 +	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
   204 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
   205 +	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
   206 +	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
   207 +	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
   208  	rm -f $(DESTDIR)$(bindir)/rpmbuild
   209 -	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
   210 +	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
   211  	rm -f $(DESTDIR)$(bindir)/rpmquery
   212 -	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
   213 +	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
   214  	rm -f $(DESTDIR)$(bindir)/rpmverify
   215 -	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
   216 +	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
   217  	rm -f $(DESTDIR)$(bindir)/rpmsign
   218 -	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
   219 +	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
   220  	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
   221 -	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   222 +	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   223  	for bf in e i u ; do \
   224  	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
   225 -	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   226 +	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   227  	done
   228  	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
   229  	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
   230 @@ -1147,11 +1145,6 @@
   231  	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
   232  	esac
   233  	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
   234 -	@case "@host_os@" in \
   235 -	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
   236 -	solaris*|linux*) \
   237 -	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
   238 -	esac
   239  	@$(mkinstalldirs) $(DESTDIR)/var/tmp
   241  .PHONY:	setperms
   242 @@ -1171,10 +1164,10 @@
   243  	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
   244  	done
   245  	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
   246 -	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
   247 -	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
   248 -	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
   249 -	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
   250 +	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
   251 +	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
   252 +	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
   253 +	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
   255  .PHONY:	unsetgid
   256  unsetgid:
   257 @@ -1217,7 +1210,7 @@
   258  	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
   260  .PHONY:	doxygen
   261 -doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
   262 +doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
   263  	rm -rf $@
   264  	mkdir -p $@
   265  	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
   267 +---------------------------------------------------------------------------
   268 | Add support for splitted source directories, i.e., source files
   269 | alternatively can be placed into the .spec directory and are picked
   270 | up there, too.
   271 +---------------------------------------------------------------------------
   272 Index: build/build.c
   273 --- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   274 +++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   275 @@ -33,7 +33,15 @@
   277      for (p = spec->sources; p != NULL; p = p->next) {
   278  	if (! (p->flags & RPMBUILD_ISNO)) {
   279 +#ifndef OPENPKG
   280  	    const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   281 +#else
   282 +	    const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
   283 +        if (access(fn, F_OK) == -1) {
   284 +            fn = _free(fn);
   285 +	        fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   286 +        }
   287 +#endif
   288  	    rc = Unlink(fn);
   289  	    fn = _free(fn);
   290  	}
   291 @@ -42,7 +50,15 @@
   292      for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   293  	for (p = pkg->icon; p != NULL; p = p->next) {
   294  	    if (! (p->flags & RPMBUILD_ISNO)) {
   295 +#ifndef OPENPKG
   296  		const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   297 +#else
   298 +		const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
   299 +        if (access(fn, F_OK) == -1) {
   300 +            fn = _free(fn);
   301 +		    fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   302 +        }
   303 +#endif
   304  		rc = Unlink(fn);
   305  		fn = _free(fn);
   306  	    }
   308 +---------------------------------------------------------------------------
   309 | Add support for the OpenPKG custom .spec file sections %track
   310 | (package build-time feature for performing vendor source tracking)
   311 | and %test (package install-time feature for performing package
   312 | run-time tests).
   313 +---------------------------------------------------------------------------
   314 Index: build/build.c
   315 --- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   316 +++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   317 @@ -129,6 +129,14 @@
   318  	mTemplate = "%{__spec_clean_template}";
   319  	mPost = "%{__spec_clean_post}";
   320  	break;
   321 +#ifdef OPENPKG
   322 +    case RPMBUILD_TRACK:
   323 +	name = "%track";
   324 +	sb = spec->track;
   325 +	mTemplate = "%{__spec_track_template}";
   326 +	mPost = "%{__spec_track_post}";
   327 +	break;
   328 +#endif
   329      case RPMBUILD_STRINGBUF:
   330      default:
   331  	mTemplate = "%{___build_template}";
   332 @@ -185,7 +193,11 @@
   334      (void) fputs(buildTemplate, fp);
   336 +#ifdef OPENPKG
   337 +    if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir && what != RPMBUILD_TRACK)
   338 +#else
   339      if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
   340 +#endif
   341  	fprintf(fp, "cd %s\n", spec->buildSubdir);
   343      if (what == RPMBUILD_RMBUILD) {
   344 @@ -231,6 +243,9 @@
   345      buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
   346      (void) poptParseArgvString(buildCmd, &argc, &argv);
   348 +#ifdef OPENPKG
   349 +    if (what != RPMBUILD_TRACK)
   350 +#endif
   351      rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
   352      if (!(child = fork())) {
   354 @@ -306,6 +323,12 @@
   355  /*@=boundsread@*/
   356  	}
   357      } else {
   358 +#ifdef OPENPKG
   359 +	if ((what & RPMBUILD_TRACK) &&
   360 +	    (rc = doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
   361 +		goto exit;
   362 +#endif
   363 +
   364  	if ((what & RPMBUILD_PREP) &&
   365  	    (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
   366  		goto exit;
   368 +---------------------------------------------------------------------------
   369 | Unconditionally remove temporary files ("rpm-tmp.XXXXX") which
   370 | were generated for the executed scripts. In OpenPKG we run the
   371 | scripts in debug mode ("set -x") anyway, so we never need to
   372 | see the whole generated script -- not even if it breaks.  Instead
   373 | we would just have temporary files staying around forever.
   374 +---------------------------------------------------------------------------
   375 Index: build/build.c
   376 --- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   377 +++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   378 @@ -273,7 +273,9 @@
   380  exit:
   381      if (scriptName) {
   382 +#ifndef OPENPKG
   383  	if (!rc)
   384 +#endif
   385  	    (void) Unlink(scriptName);
   386  	scriptName = _free(scriptName);
   387      }
   389 +---------------------------------------------------------------------------
   390 | In OpenPKG we use per-package %{_sourcedir} and %{_specdir}
   391 | definitions (macros have trailing ".../%{name}"). On removal
   392 | of source(s) and .spec file, this per-package directory would
   393 | be kept (usually <prefix>/RPM/SRC/<name>/), because RPM does
   394 | not know about this OpenPKG convention.  So, let RPM try(!) to
   395 | remove the two directories (if they are empty) and just ignore
   396 | removal failures (if they are still not empty).
   397 +---------------------------------------------------------------------------
   398 Index: build/build.c
   399 --- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   400 +++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   401 @@ -377,6 +377,21 @@
   402      if (what & RPMBUILD_RMSPEC)
   403  	(void) Unlink(spec->specFile);
   405 +#ifdef OPENPKG
   406 +    if (what & RPMBUILD_RMSOURCE) {
   407 +        const char *pn;
   408 +        pn = rpmGetPath("%{_sourcedir}", NULL);
   409 +        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
   410 +        pn = _free(pn);
   411 +    }
   412 +    if (what & RPMBUILD_RMSPEC) {
   413 +        const char *pn;
   414 +        pn = rpmGetPath("%{_specdir}", NULL);
   415 +        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
   416 +        pn = _free(pn);
   417 +    }
   418 +#endif
   419 +
   420  exit:
   421      if (rc && rpmlogGetNrecs() > 0) {
   422  	rpmMessage(RPMMESS_NORMAL, _("\n\nRPM build errors:\n"));
   424 +---------------------------------------------------------------------------
   425 | Do not declare any files as %doc files by default.
   426 +---------------------------------------------------------------------------
   427 Index: build/files.c
   428 --- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   429 +++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   430 @@ -1971,6 +1971,7 @@
   431      fl.defSpecdFlags = 0;
   433      fl.docDirCount = 0;
   434 +#if 0
   435      fl.docDirs[fl.docDirCount++] = xstrdup("/usr/doc");
   436      fl.docDirs[fl.docDirCount++] = xstrdup("/usr/man");
   437      fl.docDirs[fl.docDirCount++] = xstrdup("/usr/info");
   438 @@ -1981,6 +1982,7 @@
   439      fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_docdir}", NULL);
   440      fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_mandir}", NULL);
   441      fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_infodir}", NULL);
   442 +#endif
   444      fl.fileList = NULL;
   445      fl.fileListRecsAlloced = 0;
   447 +---------------------------------------------------------------------------
   448 | Make sure the "Provides" headers are available for querying from the
   449 | .src.rpm files.
   450 +---------------------------------------------------------------------------
   451 Index: build/files.c
   452 --- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   453 +++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   454 @@ -2185,6 +2185,12 @@
   455  	case RPMTAG_CHANGELOGTEXT:
   456  	case RPMTAG_URL:
   457  	case HEADER_I18NTABLE:
   458 +#ifdef OPENPKG
   459 +	case RPMTAG_PROVIDENAME:
   460 +	case RPMTAG_PROVIDEVERSION:
   461 +	case RPMTAG_PROVIDEFLAGS:
   462 +	case RPMTAG_CLASS:
   463 +#endif
   464  	    if (ptr)
   465  		(void)headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
   466  	    /*@switchbreak@*/ break;
   468 +---------------------------------------------------------------------------
   469 | Add support for splitted source directories, i.e., source files
   470 | alternatively can be placed into the .spec directory and are picked
   471 | up there, too.
   472 +---------------------------------------------------------------------------
   473 Index: build/files.c
   474 --- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   475 +++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   476 @@ -2261,8 +2261,20 @@
   477  	}
   479        {	const char * sfn;
   480 +#ifndef OPENPKG
   481  	sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   482  		"%{_sourcedir}/", srcPtr->source, NULL);
   483 +#else
   484 +        const char *sfn2;
   485 +	sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
   486 +        if (access(sfn2, F_OK) == 0)
   487 +	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   488 +                "%{_specdir}/", srcPtr->source, NULL);
   489 +        else
   490 +	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   491 +                "%{_sourcedir}/", srcPtr->source, NULL);
   492 +        sfn2 = _free(sfn2);
   493 +#endif
   494  	appendLineStringBuf(sourceFiles, sfn);
   495  	sfn = _free(sfn);
   496        }
   497 @@ -2271,8 +2283,20 @@
   498      for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   499  	for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) {
   500  	    const char * sfn;
   501 +#ifndef OPENPKG
   502  	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   503  		"%{_sourcedir}/", srcPtr->source, NULL);
   504 +#else
   505 +            const char *sfn2;
   506 +	    sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
   507 +        if (access(sfn2, F_OK) == 0)
   508 +	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   509 +                "%{_specdir}/", srcPtr->source, NULL);
   510 +        else
   511 +	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   512 +                "%{_sourcedir}/", srcPtr->source, NULL);
   513 +        sfn2 = _free(sfn2);
   514 +#endif
   515  	    appendLineStringBuf(sourceFiles, sfn);
   516  	    sfn = _free(sfn);
   517  	}
   519 +---------------------------------------------------------------------------
   520 | Add support for splitted source directories, i.e., source files
   521 | alternatively can be placed into the .spec directory and are picked
   522 | up there, too.
   523 +---------------------------------------------------------------------------
   524 Index: build/parsePreamble.c
   525 --- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
   526 +++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
   527 @@ -366,7 +368,15 @@
   528      size_t nb, iconsize;
   530      /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
   531 +#ifndef OPENPKG
   532      fn = rpmGetPath("%{_sourcedir}/", file, NULL);
   533 +#else
   534 +    fn = rpmGetPath("%{_specdir}/", file, NULL);
   535 +    if (access(fn, F_OK) == -1) {
   536 +        fn = _free(fn);
   537 +        fn = rpmGetPath("%{_sourcedir}/", file, NULL);
   538 +    }
   539 +#endif
   541      fd = Fopen(fn, "r.ufdio");
   542      if (fd == NULL || Ferror(fd)) {
   544 +---------------------------------------------------------------------------
   545 | In OpenPKG, the RPM package contains own local versions of the
   546 | "patch" and "tar" tools, so we cannot accept hard-coded names here.
   547 | Instead we expand a variable to allow us to direct RPM to our tools.
   548 | Additionally, pass option "-b" to patch(1) so it creates original
   549 | files not only if a non-standard (not ".orig") suffix is used.
   550 | Finally, add support for the GNU patch "-d" option for convenient
   551 | changing into a subdirectory.
   552 | Remove "unzip" support, because in OpenPKG there are less than
   553 | a dozend packages requiring unpacking of .zip files. For these
   554 | it is fully sufficient to explicitly require the "infozip"
   555 | package (containing "unzip") and leaving the less portable
   556 | "unzip" out of the bootstrap package.
   557 +---------------------------------------------------------------------------
   558 Index: build/parsePrep.c
   559 --- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
   560 +++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
   561 @@ -66,7 +66,7 @@
   562   */
   563  /*@-boundswrite@*/
   564  /*@observer@*/ static char *doPatch(Spec spec, int c, int strip, const char *db,
   565 -		     int reverse, int removeEmpties)
   566 +		     int reverse, int removeEmpties, const char *subdir)
   567  	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
   568  	/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
   569  {
   570 @@ -76,6 +76,7 @@
   571      struct Source *sp;
   572      rpmCompressedMagic compressed = COMPRESSED_NOT;
   573      int urltype;
   574 +    const char *patcher;
   576      for (sp = spec->sources; sp != NULL; sp = sp->next) {
   577  	if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) {
   578 @@ -97,6 +106,10 @@
   579  	strcat(args, "--suffix ");
   580  	strcat(args, db);
   581      }
   582 +    if (subdir) {
   583 +	strcat(args, "-d ");
   584 +	strcat(args, subdir);
   585 +    }
   586      if (reverse) {
   587  	strcat(args, " -R");
   588      }
   589 @@ -124,6 +137,10 @@
   590  	/*@notreached@*/ break;
   591      }
   593 +    patcher = rpmGetPath("%{_patchbin}", NULL);
   594 +    if (strcmp(patcher, "%{_patchbin}") == 0)
   595 +        patcher = "patch";
   596 +
   597      if (compressed) {
   598  	const char *zipper = rpmGetPath(
   599  	    (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"),
   600 @@ -131,22 +148,23 @@
   602  	sprintf(buf,
   603  		"echo \"Patch #%d (%s):\"\n"
   604 -		"%s -d < %s | patch -p%d %s -s\n"
   605 +		"%s -d <%s | %s -p%d %s -s -b\n"
   606  		"STATUS=$?\n"
   607  		"if [ $STATUS -ne 0 ]; then\n"
   608  		"  exit $STATUS\n"
   609  		"fi",
   610 -		c, /*@-unrecog@*/ (const char *) basename(fn), /*@=unrecog@*/
   611 +		c, /*@-unrecog@*/ basename(fn), /*@=unrecog@*/
   612  		zipper,
   613 -		fn, strip, args);
   614 +		fn, patcher, strip, args);
   615  	zipper = _free(zipper);
   616      } else {
   617  	sprintf(buf,
   618  		"echo \"Patch #%d (%s):\"\n"
   619 -		"patch -p%d %s -s < %s", c, (const char *) basename(fn),
   620 -		strip, args, fn);
   621 +		"%s -p%d %s -s -b <%s", c, basename(fn),
   622 +		patcher, strip, args, fn);
   623      }
   625 +    patcher = _free(patcher);
   626      urlfn = _free(urlfn);
   627      return buf;
   628  }
   629 @@ -171,6 +189,7 @@
   630      struct Source *sp;
   631      rpmCompressedMagic compressed = COMPRESSED_NOT;
   632      int urltype;
   633 +    const char *tar;
   635      for (sp = spec->sources; sp != NULL; sp = sp->next) {
   636  	if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) {
   637 @@ -228,6 +255,10 @@
   638  	/*@notreached@*/ break;
   639      }
   641 +    tar = rpmGetPath("%{_tarbin}", NULL);
   642 +    if (strcmp(tar, "%{_tarbin}") == 0)
   643 +        tar = "tar";
   644 +
   645      if (compressed != COMPRESSED_NOT) {
   646  	const char *zipper;
   647  	int needtar = 1;
   648 @@ -240,6 +271,7 @@
   649  	case COMPRESSED_BZIP2:
   650  	    t = "%{_bzip2bin} -dc";
   651  	    break;
   652 +#if 0
   653  	case COMPRESSED_ZIP:
   654  	    if (rpmIsVerbose() && !quietly)
   655  		t = "%{_unzipbin}";
   656 @@ -247,6 +279,7 @@
   657  		t = "%{_unzipbin} -qq";
   658  	    needtar = 0;
   659  	    break;
   660 +#endif
   661  	}
   662  	zipper = rpmGetPath(t, NULL);
   663  	buf[0] = '\0';
   664 @@ -254,8 +287,13 @@
   665  	zipper = _free(zipper);
   666  	*t++ = ' ';
   667  	t = stpcpy(t, fn);
   668 -	if (needtar)
   669 -	    t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -");
   670 +	if (needtar) {
   671 +	    t = stpcpy(t, " | ");
   672 +            t = stpcpy(t, tar);
   673 +            t = stpcpy(t, " ");
   674 +            t = stpcpy(t, taropts);
   675 +            t = stpcpy(t, " -");
   676 +        }
   677  	t = stpcpy(t,
   678  		"\n"
   679  		"STATUS=$?\n"
   680 @@ -264,11 +302,14 @@
   681  		"fi");
   682      } else {
   683  	buf[0] = '\0';
   684 -	t = stpcpy( stpcpy(buf, "tar "), taropts);
   685 -	*t++ = ' ';
   686 +	t = stpcpy(buf, tar);
   687 +	t = stpcpy(t, " ");
   688 +	t = stpcpy(t, taropts);
   689 +	t = stpcpy(t, " ");
   690  	t = stpcpy(t, fn);
   691      }
   693 +    tar = _free(tar);
   694      urlfn = _free(urlfn);
   695      return buf;
   696  }
   697 @@ -443,7 +484,7 @@
   698  	/*@modifies spec->prep, rpmGlobalMacroContext,
   699  		fileSystem, internalState  @*/
   700  {
   701 -    char *opt_b;
   702 +    char *opt_b, *opt_d;
   703      int opt_P, opt_p, opt_R, opt_E;
   704      char *s;
   705      char buf[BUFSIZ], *bp;
   706 @@ -453,6 +494,7 @@
   707      memset(patch_nums, 0, sizeof(patch_nums));
   708      opt_P = opt_p = opt_R = opt_E = 0;
   709      opt_b = NULL;
   710 +    opt_d = NULL;
   711      patch_index = 0;
   713      if (! strchr(" \t\n", line[6])) {
   714 @@ -492,6 +534,15 @@
   715  			spec->lineNum, spec->line);
   716  		return RPMERR_BADSPEC;
   717  	    }
   718 +	} else if (!strcmp(s, "-d")) {
   719 +	    /* orig suffix */
   720 +	    opt_d = strtok(NULL, " \t\n");
   721 +	    if (! opt_d) {
   722 +		rpmError(RPMERR_BADSPEC,
   723 +			_("line %d: Need arg to %%patch -d: %s\n"),
   724 +			spec->lineNum, spec->line);
   725 +		return RPMERR_BADSPEC;
   726 +	    }
   727  	} else if (!strncmp(s, "-p", sizeof("-p")-1)) {
   728  	    /* unfortunately, we must support -pX */
   729  	    if (! strchr(" \t\n", s[2])) {
   730 @@ -530,14 +581,14 @@
   731      /* All args processed */
   733      if (! opt_P) {
   734 -	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E);
   735 +	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E, opt_d);
   736  	if (s == NULL)
   737  	    return RPMERR_BADSPEC;
   738  	appendLineStringBuf(spec->prep, s);
   739      }
   741      for (x = 0; x < patch_index; x++) {
   742 -	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
   743 +	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E, opt_d);
   744  	if (s == NULL)
   745  	    return RPMERR_BADSPEC;
   746  	appendLineStringBuf(spec->prep, s);
   748 +---------------------------------------------------------------------------
   749 | Add support for splitted source directories, i.e., source files
   750 | alternatively can be placed into the .spec directory and are picked
   751 | up there, too.
   752 +---------------------------------------------------------------------------
   753 Index: build/parsePrep.c
   754 --- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
   755 +++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
   756 @@ -88,7 +88,15 @@
   757  	return NULL;
   758      }
   760 +#ifndef OPENPKG
   761      urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   762 +#else
   763 +    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
   764 +    if (access(urlfn, F_OK) == -1) {
   765 +        urlfn = _free(urlfn);
   766 +        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   767 +    }
   768 +#endif
   770      args[0] = '\0';
   771      if (db) {
   772 @@ -193,7 +201,15 @@
   773  	return NULL;
   774      }
   776 +#ifndef OPENPKG
   777      urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   778 +#else
   779 +    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
   780 +    if (access(urlfn, F_OK) == -1) {
   781 +        urlfn = _free(urlfn);
   782 +        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   783 +    }
   784 +#endif
   786      /*@-internalglobs@*/ /* FIX: shrug */
   787      taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
   789 +---------------------------------------------------------------------------
   790 | Not everything on a system is RPM based (for instance OpenPKG is
   791 | just an add-on to the system), so do not assume we can just require
   792 | a package to provide "/bin/sh".
   793 +---------------------------------------------------------------------------
   794 Index: build/parseScript.c
   795 --- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
   796 +++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
   797 @@ -261,6 +269,7 @@
   798      stripTrailingBlanksStringBuf(sb);
   799      p = getStringBuf(sb);
   801 +    if (progArgv[0] != NULL && strcmp(progArgv[0], "/bin/sh") != 0)
   802      (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
   804      /* Trigger script insertion is always delayed in order to */
   806 +---------------------------------------------------------------------------
   807 | Add support for splitted source directories, i.e., source files
   808 | alternatively can be placed into the spec directory and are picked
   809 | up there, too.
   810 +---------------------------------------------------------------------------
   811 Index: build/spec.c
   812 --- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
   813 +++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
   814 @@ -334,7 +337,15 @@
   816      if (tag != RPMTAG_ICON) {
   817  	/*@-nullpass@*/		/* LCL: varargs needs null annotate. */
   818 +#ifndef OPENPKG
   819  	const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   820 +#else
   821 +	const char *body = rpmGetPath("%{_specdir}/", p->source, NULL);
   822 +    if (access(body, F_OK) == -1) {
   823 +        body = _free(body);
   824 +	    body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   825 +    }
   826 +#endif
   827  	/*@=nullpass@*/
   829  	sprintf(buf, "%s%d",
   831 +---------------------------------------------------------------------------
   832 | Do not build with warnings on, because we do no RPM development
   833 | (so warnings are useless here), they cause some confusion inside
   834 | Berkeley-DB and also slow down building. Instead, increase the
   835 | optimization level. Additionally, disable static linking of RPM
   836 | tools. Finally, use "shtool mkdir" as the "mkdir -p" fallback.
   837 +---------------------------------------------------------------------------
   838 Index: configure.ac
   839 --- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   840 +++ configure.ac	13 Sep 2006 13:39:07 -0000
   841 @@ -53,7 +53,7 @@
   842  AS=${AS-as}
   843  AC_SUBST(AS)
   844  if test "$ac_cv_prog_gcc" = yes; then
   845 -    CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
   846 +    CFLAGS="$CFLAGS -O2 -D_GNU_SOURCE -D_REENTRANT"
   847  fi
   848  export CFLAGS
   850 @@ -142,6 +142,7 @@
   851  	# just link it dynamically
   852  	LDFLAGS_STATIC=""
   853  fi
   854 +LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools
   855  LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"	# libtool format
   856  AC_MSG_RESULT($LDFLAGS_STATIC)
   857  AC_SUBST(LDFLAGS_STATIC)
   858 @@ -201,7 +202,7 @@
   860  if test X"$MKDIR_P" = X0 ; then
   861  	AC_MSG_RESULT(no)
   862 -	MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
   863 +	MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755"
   864  else
   865  	AC_MSG_RESULT(yes)
   866  fi
   868 +---------------------------------------------------------------------------
   869 | Disable the use of the internal zlib library, because
   870 | we build against an external one.
   871 +---------------------------------------------------------------------------
   872 Index: configure.ac
   873 --- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   874 +++ configure.ac	13 Sep 2006 13:39:09 -0000
   875 @@ -311,7 +311,7 @@
   876  WITH_ZLIB_SUBDIR=
   877  WITH_ZLIB_INCLUDE=
   878  WITH_ZLIB_LIB=
   879 -if test -d zlib ; then
   880 +if false; then
   881    WITH_ZLIB_SUBDIR=zlib
   882    addlib \${top_builddir}/zlib
   883    WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
   885 +---------------------------------------------------------------------------
   886 | Disable unnecessary INCPATH checks, because in OpenPKG the
   887 | externally used libraries are all explicitly given. And they just
   888 | would make RPM pick up things which we do not want to be picked up.
   889 +---------------------------------------------------------------------------
   890 Index: configure.ac
   891 --- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   892 +++ configure.ac	13 Sep 2006 13:39:11 -0000
   893 @@ -325,38 +325,38 @@
   895  localdone=
   897 -dirs=$prefix
   898 -if test "$cross_compiling" != "yes"; then
   899 -  dirs="$dirs /usr/local"
   900 -fi
   901 -for dir in $dirs
   902 -do
   903 -	case $dir in
   904 -	NONE|/usr)	continue;;
   905 -	/usr/local)
   906 -		if test X$localdone != X ; then continue; fi
   907 -		localdone="$dir"
   908 -		;;
   909 -	esac
   910 -
   911 -	AC_MSG_CHECKING(for $dir/lib in LIBS)
   912 -	if test -d $dir/lib 2> /dev/null ; then
   913 -		addlib $dir/lib
   914 -		AC_MSG_RESULT(yes)
   915 -	else
   916 -		AC_MSG_RESULT(no)
   917 -	fi
   918 -
   919 -	AC_MSG_CHECKING(for $dir/include in INCPATH)
   920 -	if test -d $dir/include 2>/dev/null ; then
   921 -		if [ "$dir" != "/usr/local" ] ; then
   922 -		    INCPATH="$INCPATH -I$dir/include"
   923 -		fi
   924 -		AC_MSG_RESULT(yes)
   925 -	else
   926 -		AC_MSG_RESULT(no)
   927 -	fi
   928 -done
   929 +dnl dirs=$prefix
   930 +dnl if test "$cross_compiling" != "yes"; then
   931 +dnl   dirs="$dirs /usr/local"
   932 +dnl fi
   933 +dnl for dir in $dirs
   934 +dnl do
   935 +dnl 	case $dir in
   936 +dnl 	NONE|/usr)	continue;;
   937 +dnl 	/usr/local)
   938 +dnl 		if test X$localdone != X ; then continue; fi
   939 +dnl 		localdone="$dir"
   940 +dnl 		;;
   941 +dnl 	esac
   942 +dnl 
   943 +dnl 	AC_MSG_CHECKING(for $dir/lib in LIBS)
   944 +dnl 	if test -d $dir/lib 2> /dev/null ; then
   945 +dnl 		addlib $dir/lib
   946 +dnl 		AC_MSG_RESULT(yes)
   947 +dnl 	else
   948 +dnl 		AC_MSG_RESULT(no)
   949 +dnl 	fi
   950 +dnl 
   951 +dnl 	AC_MSG_CHECKING(for $dir/include in INCPATH)
   952 +dnl 	if test -d $dir/include 2>/dev/null ; then
   953 +dnl 		if test "$dir" != "/usr/local"; then
   954 +dnl 		    INCPATH="$INCPATH -I$dir/include"
   955 +dnl 		fi
   956 +dnl 		AC_MSG_RESULT(yes)
   957 +dnl 	else
   958 +dnl 		AC_MSG_RESULT(no)
   959 +dnl 	fi
   960 +dnl done
   962  AC_MSG_CHECKING(for /usr/ucblib in LIBS)
   963  if test -d /usr/ucblib ; then
   965 +---------------------------------------------------------------------------
   966 | Adjust paths for OpenPKG filesystem layout.
   967 +---------------------------------------------------------------------------
   968 Index: configure.ac
   969 --- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   970 +++ configure.ac	13 Sep 2006 13:39:12 -0000
   971 @@ -1201,12 +1201,12 @@
   972  AC_SUBST(LOCALEDIR)
   973  LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
   974  AC_SUBST(LIBDIR)
   975 -RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
   976 +RPMCONFIGDIR="@l_prefix@/lib/openpkg"
   977  AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
   978  	[Full path to rpm global configuration directory (usually /usr/lib/rpm)])
   979  AC_SUBST(RPMCONFIGDIR)
   981 -SYSCONFIGDIR="`echo /etc/rpm`"
   982 +SYSCONFIGDIR="@l_prefix@/etc/openpkg"
   983  AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR",
   984  	[Full path to rpm system configuration directory (usually /etc/rpm)])
   985  AC_SUBST(SYSCONFIGDIR)
   986 @@ -1216,17 +1216,17 @@
   987  	[Colon separated paths of macro files to read.])
   988  AC_SUBST(MACROFILES)
   990 -LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
   991 +LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc"
   992  AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME",
   993  	[Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)])
   994  AC_SUBST(LIBRPMRC_FILENAME)
   996 -VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
   997 +VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
   998  AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
   999         [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
  1000  AC_SUBST(VENDORRPMRC_FILENAME)
  1002 -LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
  1003 +LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
  1004  AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME",
  1005  	[Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)])
  1006  AC_SUBST(LIBRPMALIAS_FILENAME)
  1008 +---------------------------------------------------------------------------
  1009 | If running as "susr", do not unpack source RPM packages with "susr"
  1010 | file ownerships as the OpenPKG Set-UID wrapper switches from "musr"
  1011 | to "susr" on "openpkg rpm -Uvh *.src.rpm". As a result the installed
  1012 | files could be never removed again by "musr". It is more consistent
  1013 | to always unpack as "musr" if possible.
  1014 +---------------------------------------------------------------------------
  1015 Index: lib/psm.c
  1016 --- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
  1017 +++ lib/psm.c	13 Sep 2006 13:39:15 -0000
  1018 @@ -314,6 +314,20 @@
  1020      fi->uid = getuid();
  1021      fi->gid = getgid();
  1022 +#ifdef OPENPKG
  1023 +    if (fi->uid == 0) {
  1024 +        char *muid_str;
  1025 +        char *mgid_str;
  1026 +        uid_t *muid;
  1027 +        gid_t *mgid;
  1028 +        if ((muid_str = rpmExpand("%{l_muid}", NULL)) != NULL)
  1029 +            if ((muid = (uid_t)strtol(muid_str, (char **)NULL, 10)) > 0)
  1030 +                fi->uid = muid;
  1031 +        if ((mgid_str = rpmExpand("%{l_mgid}", NULL)) != NULL)
  1032 +            if ((mgid = (gid_t)strtol(mgid_str, (char **)NULL, 10)) > 0)
  1033 +                fi->gid = mgid;
  1034 +    }
  1035 +#endif
  1036      fi->astriplen = 0;
  1037      fi->striplen = 0;
  1039 @@ -352,6 +366,9 @@
  1040  	rpmrc = RPMRC_FAIL;
  1041  	goto exit;
  1043 +#ifdef OPENPKG
  1044 +    chown(_sourcedir, fi->uid, fi->gid);
  1045 +#endif
  1047      _specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
  1048      rpmrc = rpmMkdirPath(_specdir, "specdir");
  1049 @@ -359,6 +376,9 @@
  1050  	rpmrc = RPMRC_FAIL;
  1051  	goto exit;
  1053 +#ifdef OPENPKG
  1054 +    chown(_specdir, fi->uid, fi->gid);
  1055 +#endif
  1057      /* Build dnl/dil with {_sourcedir, _specdir} as values. */
  1058      if (i < fi->fc) {
  1060 +---------------------------------------------------------------------------
  1061 | RPM has two platform id canonicalizations: hard-coded ones in
  1062 | the "rpm" program and defined ones in the rpmrc files. The
  1063 | hard-coded ones make the defined ones inconsistent. Additionally,
  1064 | in OpenPKG we know exactly what we do. So, disable the hard-coded
  1065 | canonicalizations and use only the defined ones. The only thing we
  1066 | do inside RPM is to reduce the platform version to major and minor
  1067 | version numbers in order to simplify the "rpmrc" files. Then, RPM
  1068 | allows to read the platform from an external program. Adjust the
  1069 | hard-coded path to this program and allow it to be overridden with
  1070 | the macro %{__platform}. Finally, change the default definition of
  1071 | %{_host} to not contain the vendor stuff to more conform to what
  1072 | %{_target} usually is defined to and what we are using throughout
  1073 | OpenPKG, too.
  1074 +---------------------------------------------------------------------------
  1075 Index: lib/rpmrc.c
  1076 --- lib/rpmrc.c	4 Jun 2003 18:18:45 -0000	1.1.1.25
  1077 +++ lib/rpmrc.c	6 Jun 2005 15:53:06 -0000	1.3
  1078 @@ -27,7 +27,7 @@
  1079  const char * macrofiles = MACROFILES;
  1081  /*@observer@*/ /*@unchecked@*/
  1082 -static const char * platform = "/etc/rpm/platform";
  1083 +static const char * platform = "@l_prefix@/etc/openpkg/platform";
  1084  /*@only@*/ /*@relnull@*/ /*@unchecked@*/
  1085  static const char ** platpat = NULL;
  1086  /*@unchecked@*/
  1087 @@ -861,7 +861,11 @@
  1089  	platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat));
  1090  /*@-onlyunqglobaltrans@*/
  1091 +#ifdef OPENPKG
  1092 +	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_os}", NULL);
  1093 +#else
  1094  	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}", (gnu && *gnu ? "-" : NULL), gnu, NULL);
  1095 +#endif
  1096  	nplatpat++;
  1097  	platpat[nplatpat] = NULL;
  1098  /*@=onlyunqglobaltrans@*/
  1099 @@ -1055,14 +1059,35 @@
  1100  	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
  1101  	/*@modifies *arch, *os, rpmGlobalMacroContext, fileSystem, internalState @*/
  1103 +#ifdef OPENPKG
  1104 +    static struct utsname un_real;
  1105 +    /* utsname fields on some platforms (like HP-UX) are very small
  1106 +       (about 8 characters). This is too small for OpenPKG, so cheat! */
  1107 +    static struct {
  1108 +        char sysname[32];
  1109 +        char nodename[32];
  1110 +        char release[32];
  1111 +        char version[32];
  1112 +        char machine[32];
  1113 +    } un;
  1114 +#else
  1115      static struct utsname un;
  1116 +#endif
  1117      static int gotDefaults = 0;
  1118      char * chptr;
  1119      canonEntry canon;
  1120      int rc;
  1122      while (!gotDefaults) {
  1123 +#ifdef OPENPKG
  1124 +	const char *cp;
  1125 +	cp = rpmExpand("%{?__platform}", NULL);
  1126 +    if (cp == NULL || cp[0] == '\0')
  1127 +	    cp = platform;
  1128 +	if (!rpmPlatform(cp)) {
  1129 +#else
  1130  	if (!rpmPlatform(platform)) {
  1131 +#endif
  1132  	    const char * s;
  1133  	    s = rpmExpand("%{_host_cpu}", NULL);
  1134  	    if (s) {
  1135 @@ -1079,9 +1104,44 @@
  1136  	    gotDefaults = 1;
  1137  	    break;
  1139 +#ifdef OPENPKG
  1140 +	rc = uname(&un_real);
  1141 +        strncpy(un.sysname,  un_real.sysname,  sizeof(un.sysname));  un.sysname [sizeof(un.sysname)-1]  = '\0';
  1142 +        strncpy(un.nodename, un_real.nodename, sizeof(un.nodename)); un.nodename[sizeof(un.nodename)-1] = '\0';
  1143 +        strncpy(un.release,  un_real.release,  sizeof(un.release));  un.release [sizeof(un.release)-1]  = '\0';
  1144 +        strncpy(un.version,  un_real.version,  sizeof(un.version));  un.version [sizeof(un.version)-1]  = '\0';
  1145 +        strncpy(un.machine,  un_real.machine,  sizeof(un.machine));  un.machine [sizeof(un.machine)-1]  = '\0';
  1146 +#else
  1147  	rc = uname(&un);
  1148 +#endif
  1149  	if (rc < 0) return;
  1151 +#ifdef OPENPKG
  1152 +    {
  1153 +        char *cp;
  1154 +        char *cpR;
  1155 +        int n;
  1156 +        cpR = un.release;
  1157 +        if ((n = strcspn(cpR, "0123456789")) > 0)
  1158 +            cpR += n;
  1159 +        if ((n = strspn(cpR, "0123456789.")) > 0) {
  1160 +            /* terminate after "N.N.N...." prefix */
  1161 +            cpR[n] = '\0';
  1162 +            /* shorten to "N.N" if longer */
  1163 +            if ((cp = strchr(cpR, '.')) != NULL) {
  1164 +                if ((cp = strchr(cp+1, '.')) != NULL)
  1165 +                    *cp = '\0';
  1166 +            }
  1167 +            strcat(un.sysname, cpR);
  1168 +        }
  1169 +        /* fix up machine hardware name containing white-space as it
  1170 +         * happens to be on Power Macs running MacOS X
  1171 +         */
  1172 +        if (!strncmp(un.machine, "Power Macintosh", 15)) {
  1173 +            sprintf(un.machine, "powerpc");
  1174 +        }
  1175 +    }
  1176 +#else /* OPENPKG */
  1177  #if !defined(__linux__)
  1178  #ifdef SNI
  1179  	/* USUALLY un.sysname on sinix does start with the word "SINIX"
  1180 @@ -1298,6 +1358,7 @@
  1183  #	endif
  1184 +#endif /* OPENPKG */
  1186  	/* the uname() result goes through the arch_canon table */
  1187  	canon = lookupInCanonTable(un.machine,
  1189 +---------------------------------------------------------------------------
  1190 | In verbose file listing output, give the owner and group fields more
  1191 | width and at the same time reduce the nlink and size fields to more
  1192 | typical sizes within OpenPKG.
  1193 +---------------------------------------------------------------------------
  1194 Index: lib/query.c
  1195 --- lib/query.c	4 Jun 2003 18:24:14 -0000	1.1.1.13
  1196 +++ lib/query.c	22 Jan 2004 21:42:24 -0000	1.2
  1197 @@ -33,7 +33,11 @@
  1198  	/*@modifies *te @*/
  1200      char sizefield[15];
  1201 +#ifdef OPENPKG
  1202 +    char ownerfield[13+1], groupfield[13+1];
  1203 +#else
  1204      char ownerfield[8+1], groupfield[8+1];
  1205 +#endif
  1206      char timefield[100];
  1207      time_t when = mtime;  /* important if sizeof(int_32) ! sizeof(time_t) */
  1208      struct tm * tm;
  1209 @@ -58,7 +62,11 @@
  1210      groupfield[sizeof(groupfield)-1] = '\0';
  1212      /* this is normally right */
  1213 +#ifdef OPENPKG
  1214 +    sprintf(sizefield, "%8u", size);
  1215 +#else
  1216      sprintf(sizefield, "%12u", size);
  1217 +#endif
  1219      /* this knows too much about dev_t */
  1221 @@ -98,7 +106,11 @@
  1222  	(void)strftime(timefield, sizeof(timefield) - 1, fmt, tm);
  1225 +#ifdef OPENPKG
  1226 +    sprintf(te, "%s %d %-13s %-13s %8s %s %s", perms,
  1227 +#else
  1228      sprintf(te, "%s %4d %-8s%-8s %10s %s %s", perms,
  1229 +#endif
  1230  	(int)nlink, ownerfield, groupfield, sizefield, timefield, namefield);
  1231      perms = _free(perms);
  1234 +---------------------------------------------------------------------------
  1235 | Enable the exlusion of "%doc" files by default.
  1236 | Disable "check-files" feature, because it is useless in OpenPKG
  1237 | (we consistently use BuildRoot and our %files lists are fully
  1238 | autogenerated) and just makes problems on bootstrapping.
  1239 | Provide the possibility to optionally re-enable the old
  1240 | RPM 4.0.2 way of RPM database operation by defining the
  1241 | macro %{_rpmdb_private}. This is important for easily fixing
  1242 | corrupted/hanging RPM database (on upgrades, etc) or if you
  1243 | permanently have to operate RPM on a NFS filesystem where no
  1244 | rpc.lockd(8) support is available.
  1245 | Additionally, do not override the "_host_xx" macros because their
  1246 | value (derived from <prefix>/etc/openpkg/platform) is already
  1247 | correctly set internally.
  1248 | Additionally, provide default macros for the %track and %test
  1249 | section expansion.
  1250 | Finally, provide default for introduced variable
  1251 | %{_force_oldpackage}, which, if non-zero, automatically enforces
  1252 | --oldpackage on all upgrade operations (this is useful on
  1253 | mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE).
  1254 +---------------------------------------------------------------------------
  1255 Index: macros.in
  1256 --- macros.in	2 Jul 2003 19:20:52 -0000	1.1.1.14
  1257 +++ macros.in	30 Jan 2004 17:06:27 -0000	1.3
  1258 @@ -1,7 +1,7 @@
  1259  #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
  1260  # \verbatim
  1262 -# $Id: macros.in,v 1.138.2.1 2003/07/02 19:14:06 jbj Exp $
  1263 +# $Id: macros.in,v 1.2 2004/01/22 21:42:09 rse Exp $
  1265  # This is a global RPM configuration file. All changes made here will
  1266  # be lost when the rpm package is upgraded. Any per-system configuration
  1267 @@ -206,7 +206,7 @@
  1269  #	Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
  1270  #	marked as %doc should be installed.
  1271 -#%_excludedocs
  1272 +%_excludedocs 1
  1274  #	The port and machine name of a FTP proxy host running TIS firewall.
  1276 @@ -305,7 +305,7 @@
  1277  # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
  1279  # Note: Disable (by commenting out) for legacy compatibility.
  1280 -%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
  1281 +#%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
  1284  # Should unpackaged files in a build root terminate a build?
  1285 @@ -449,7 +449,7 @@
  1287  # Use a CDB database model for concurrent access.
  1288  # XXX Add "private" here for legacy interoperation transiting to glibc+nptl.
  1289 -%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb
  1290 +%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb %{?_rpmdb_private:private}
  1292  %__dbi_other			%{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb}
  1294 @@ -618,6 +618,10 @@
  1295  #	If non-zero, all erasures will be automagically repackaged.
  1296  %_repackage_all_erasures	0
  1298 +#   If non-zero, automatically enforce --oldpackage for all upgrade operations
  1299 +#   (useful on mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE)
  1300 +%_force_oldpackage          0
  1302  #	Verify digest/signature flags for various rpm modes:
  1303  #	     1	--nohdrchk	if set, don't check rpmdb headers
  1305 @@ -870,6 +874,26 @@
  1306  #%{__spec_clean_post}\
  1307  #%{nil}
  1309 +%__spec_track_shell    %{___build_shell}
  1310 +%__spec_track_args     %{___build_args}
  1311 +%__spec_track_cmd      %{___build_cmd}
  1312 +%__spec_track_pre      %{___build_pre}
  1313 +%__spec_track_body     %{___build_body}
  1314 +%__spec_track_post     %{___build_post}
  1315 +%__spec_track_template #!%{__spec_track_shell}\
  1316 +%{__spec_track_pre}\
  1317 +%{nil}
  1319 +%__spec_test_shell    %{___build_shell}
  1320 +%__spec_test_args     %{___build_args}
  1321 +%__spec_test_cmd      %{___build_cmd}
  1322 +%__spec_test_pre      %{___build_pre}
  1323 +%__spec_test_body     %{___build_body}
  1324 +%__spec_test_post     %{___build_post}
  1325 +%__spec_test_template #!%{__spec_test_shell}\
  1326 +%{__spec_test_pre}\
  1327 +%{nil}
  1329  %__spec_rmbuild_shell	%{___build_shell}
  1330  %__spec_rmbuild_args	%{___build_args}
  1331  %__spec_rmbuild_cmd	%{___build_cmd}
  1332 @@ -929,11 +953,11 @@
  1333  %_build_cpu		%{_host_cpu}
  1334  %_build_vendor		%{_host_vendor}
  1335  %_build_os		%{_host_os}
  1336 -%_host			@host@
  1337 -%_host_alias		@host_alias@%{nil}
  1338 -%_host_cpu		@host_cpu@
  1339 -%_host_vendor		@host_vendor@
  1340 -%_host_os		@host_os@
  1341 +#%_host			@host@
  1342 +#%_host_alias		@host_alias@%{nil}
  1343 +#%_host_cpu		@host_cpu@
  1344 +#%_host_vendor		@host_vendor@
  1345 +#%_host_os		@host_os@
  1346  %_target		%{_host}
  1347  %_target_alias		%{_host_alias}
  1348  %_target_cpu		%{_host_cpu}
  1350 +---------------------------------------------------------------------------
  1351 | Adjust path for OpenPKG filesystem layout.
  1352 +---------------------------------------------------------------------------
  1353 Index: scripts/Makefile.am
  1354 --- scripts/Makefile.am	20 Jun 2003 19:04:49 -0000	1.1.1.11
  1355 +++ scripts/Makefile.am	22 Jan 2004 21:42:34 -0000	1.2
  1356 @@ -22,7 +22,7 @@
  1358  all:
  1360 -configdir = ${prefix}/lib/rpm
  1361 +configdir = ${prefix}/lib/openpkg
  1362  config_SCRIPTS = \
  1363  	brp-compress brp-python-bytecompile brp-redhat \
  1364  	brp-strip brp-strip-comment-note \
  1366 +---------------------------------------------------------------------------
  1367 | Adjust path for OpenPKG filesystem layout.
  1368 +---------------------------------------------------------------------------
  1369 Index: scripts/Makefile.in
  1370 --- scripts/Makefile.in	16 Jul 2003 17:05:49 -0000	1.1.1.14
  1371 +++ scripts/Makefile.in	22 Jan 2004 21:42:34 -0000	1.2
  1372 @@ -273,7 +273,7 @@
  1374  installprefix = $(DESTDIR)
  1376 -configdir = ${prefix}/lib/rpm
  1377 +configdir = ${prefix}/lib/openpkg
  1378  config_SCRIPTS = \
  1379  	brp-compress brp-python-bytecompile brp-redhat \
  1380  	brp-strip brp-strip-comment-note \
  1382 +---------------------------------------------------------------------------
  1383 | Use GNU libtool's weaker -static (link with own static libraries)
  1384 | instead of the strong -all-static (link even with static libc, etc),
  1385 | because OpenPKG does not need to be fully static.
  1386 | Additionally, adjust the path to file(1)'s "magic" file.
  1387 +---------------------------------------------------------------------------
  1388 Index: file/Makefile.am
  1389 --- file/Makefile.am	24 Jan 2003 19:41:56 -0000	1.1.1.1
  1390 +++ file/Makefile.am	22 Jan 2004 21:42:21 -0000	1.2
  1391 @@ -36,7 +36,7 @@
  1392  #MAGIC	 = @datadir@/magic
  1393  #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1395 -pkglibdir =  @prefix@/lib/rpm
  1396 +pkglibdir =  @prefix@/lib/openpkg
  1397  pkglib_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1398  MAGIC	 = $(pkglibdir)/magic
  1399  CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  1401 +---------------------------------------------------------------------------
  1402 | Use GNU libtool's weaker -static (link with own static libraries)
  1403 | instead of the strong -all-static (link even with static libc, etc),
  1404 | because OpenPKG does not need to be fully static.
  1405 | Additionally, adjust the path to file(1)'s "magic" file.
  1406 +---------------------------------------------------------------------------
  1407 Index: file/Makefile.in
  1408 --- file/Makefile.in	16 Jul 2003 17:05:23 -0000	1.1.1.2
  1409 +++ file/Makefile.in	22 Jan 2004 21:42:22 -0000	1.2
  1410 @@ -39,7 +39,7 @@
  1412  #MAGIC	 = @datadir@/magic
  1413  #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1414 -pkglibdir = @prefix@/lib/rpm
  1415 +pkglibdir = @prefix@/lib/openpkg
  1416  ACLOCAL = @ACLOCAL@
  1417  AMDEP_FALSE = @AMDEP_FALSE@
  1418  AMDEP_TRUE = @AMDEP_TRUE@
  1419 @@ -159,7 +159,7 @@
  1420  noinst_PROGRAMS = file
  1422  file_SOURCES = file.c
  1423 -file_LDFLAGS = -all-static
  1424 +file_LDFLAGS = -static
  1425  file_LDADD = libfmagic.la
  1427  man_MAGIC = magic.@fsect@
  1429 +---------------------------------------------------------------------------
  1430 | Use GNU libtool's weaker -static (link with own static libraries)
  1431 | instead of the strong -all-static (link even with static libc, etc),
  1432 | because OpenPKG does not need to be fully static.
  1433 | Additionally, disable the building of gettext stuff we don't need.
  1434 +---------------------------------------------------------------------------
  1435 Index: popt/Makefile.am
  1436 --- popt/Makefile.am	6 Mar 2003 23:16:43 -0000	1.1.1.9
  1437 +++ popt/Makefile.am	22 Jan 2004 21:42:28 -0000	1.2
  1438 @@ -9,7 +9,7 @@
  1439  	po/*.in po/*.po po/popt.pot \
  1440  	popt.ps
  1442 -SUBDIRS = intl po
  1443 +SUBDIRS = intl
  1445  INCLUDES = -I. -I$(top_srcdir)
  1447 @@ -17,13 +17,13 @@
  1449  noinst_PROGRAMS = test1 test2 test3
  1450  test1_SOURCES = test1.c
  1451 -test1_LDFLAGS = -all-static
  1452 +test1_LDFLAGS = -static
  1453  test1_LDADD = $(usrlib_LTLIBRARIES)
  1454  test2_SOURCES = test2.c
  1455 -test2_LDFLAGS = -all-static
  1456 +test2_LDFLAGS = -static
  1457  test2_LDADD = $(usrlib_LTLIBRARIES)
  1458  test3_SOURCES = test3.c
  1459 -test3_LDFLAGS = -all-static
  1460 +test3_LDFLAGS = -static
  1461  test3_LDADD = $(usrlib_LTLIBRARIES)
  1463  noinst_SCRIPTS = testit.sh
  1465 +---------------------------------------------------------------------------
  1466 | Use GNU libtool's weaker -static (link with own static libraries)
  1467 | instead of the strong -all-static (link even with static libc, etc),
  1468 | because OpenPKG does not need to be fully static.
  1469 | Additionally, disable the building of gettext stuff we don't need.
  1470 +---------------------------------------------------------------------------
  1471 Index: popt/Makefile.in
  1472 --- popt/Makefile.in	16 Jul 2003 17:04:49 -0000	1.1.1.14
  1473 +++ popt/Makefile.in	22 Jan 2004 21:42:28 -0000	1.2
  1474 @@ -163,7 +163,7 @@
  1475  	popt.ps
  1478 -SUBDIRS = intl po
  1479 +SUBDIRS = intl
  1481  INCLUDES = -I. -I$(top_srcdir)
  1483 @@ -171,13 +171,13 @@
  1485  noinst_PROGRAMS = test1 test2 test3
  1486  test1_SOURCES = test1.c
  1487 -test1_LDFLAGS = -all-static
  1488 +test1_LDFLAGS = -static
  1489  test1_LDADD = $(usrlib_LTLIBRARIES)
  1490  test2_SOURCES = test2.c
  1491 -test2_LDFLAGS = -all-static
  1492 +test2_LDFLAGS = -static
  1493  test2_LDADD = $(usrlib_LTLIBRARIES)
  1494  test3_SOURCES = test3.c
  1495 -test3_LDFLAGS = -all-static
  1496 +test3_LDFLAGS = -static
  1497  test3_LDADD = $(usrlib_LTLIBRARIES)
  1499  noinst_SCRIPTS = testit.sh
  1501 +---------------------------------------------------------------------------
  1502 | Revert back to the old behaviour of passing to "exec" programs an
  1503 | extra "--" argument to separate options and arguments. Additionally,
  1504 | allow the "!#:+" constructs to be used multiple times and then each
  1505 | time eat another argument (instead of just eating an argument once
  1506 | and expanding this multiple times).
  1507 +---------------------------------------------------------------------------
  1508 Index: popt/popt.c
  1509 --- popt/popt.c	22 Aug 2002 14:17:44 -0000	1.1.1.12
  1510 +++ popt/popt.c	22 Jan 2004 21:42:28 -0000	1.2
  1511 @@ -400,9 +400,7 @@
  1514      if (con->leftovers != NULL && con->numLeftovers > 0) {
  1515 -#if 0
  1516  	argv[argc++] = "--";
  1517 -#endif
  1518  	memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
  1519  	argc += con->numLeftovers;
  1521 @@ -580,10 +578,8 @@
  1522  	    if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
  1523  		/*@switchbreak@*/ break;
  1524  	    /* XXX Make sure that findNextArg deletes only next arg. */
  1525 -	    if (a == NULL) {
  1526  		if ((a = findNextArg(con, 1, 1)) == NULL)
  1527  		    /*@switchbreak@*/ break;
  1528 -	    }
  1529  	    s += 3;
  1531  	    alen = strlen(a);
  1533 +---------------------------------------------------------------------------
  1534 | Dedefine the stdio variable BUFSIZ because it is usually just 1024
  1535 | on some platforms (on Linux it is 8192) and unfortunately RPM uses
  1536 | it here for the macro expansion buffer. For OpenPKG the size 1024 is
  1537 | definetely too small. So increase this to a 16KB buffer.
  1538 +---------------------------------------------------------------------------
  1539 Index: rpmio/macro.c
  1540 --- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1541 +++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1542 @@ -50,6 +50,9 @@
  1544  #include "debug.h"
  1546 +#undef  BUFSIZ
  1547 +#define BUFSIZ 16384
  1549  #if defined(__LCLINT__)
  1550  /*@-exportheader@*/
  1551  extern const unsigned short int **__ctype_b_loc (void) /*@*/;
  1553 +---------------------------------------------------------------------------
  1554 | Remove "unzip" support, because in OpenPKG there are less than
  1555 | a dozend packages requiring unpacking of .zip files. For these
  1556 | it is fully sufficient to explicitly require the "infozip"
  1557 | package (containing "unzip") and leaving the less portable
  1558 | "unzip" out of the bootstrap package.
  1559 +---------------------------------------------------------------------------
  1560 Index: rpmio/macro.c
  1561 --- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1562 +++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1563 @@ -1119,9 +1119,11 @@
  1564  	case 2:	/* COMPRESSED_BZIP2 */
  1565  	    sprintf(be, "%%_bzip2 %s", b);
  1566  	    break;
  1567 +#if 0
  1568  	case 3:	/* COMPRESSED_ZIP */
  1569  	    sprintf(be, "%%_unzip %s", b);
  1570  	    break;
  1571 +#endif
  1573  	b = be;
  1574      } else if (STREQ("S", f, fn)) {
  1575 @@ -1723,9 +1725,11 @@
  1577      if ((magic[0] == 'B') && (magic[1] == 'Z')) {
  1578  	*compressed = COMPRESSED_BZIP2;
  1579 +#if 0
  1580      } else if ((magic[0] == 0120) && (magic[1] == 0113) &&
  1581  	 (magic[2] == 0003) && (magic[3] == 0004)) {	/* pkzip */
  1582  	*compressed = COMPRESSED_ZIP;
  1583 +#endif
  1584      } else if (((magic[0] == 0037) && (magic[1] == 0213)) || /* gzip */
  1585  	((magic[0] == 0037) && (magic[1] == 0236)) ||	/* old gzip */
  1586  	((magic[0] == 0037) && (magic[1] == 0036)) ||	/* pack */
  1588 +---------------------------------------------------------------------------
  1589 | Make sure that an %{error:<msg>} macro really stops further
  1590 | processing. Else it would be nothing more than a %{warn:<msg>}.
  1591 +---------------------------------------------------------------------------
  1592 Index: rpmio/macro.c
  1593 --- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1594 +++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1595 @@ -1337,7 +1337,7 @@
  1596  	    STREQ("error", f, fn)) {
  1597  		int waserror = 0;
  1598  		if (STREQ("error", f, fn))
  1599 -			waserror = 1;
  1600 +			waserror = 1, rc = 1;
  1601  		if (g < ge)
  1602  			doOutput(mb, waserror, g, gn);
  1603  		else
  1605 +---------------------------------------------------------------------------
  1606 | Reactivate build mode aliases which were removed in rpm-4.1 
  1607 | (and now should be available through "rpmbuild" only).
  1608 +---------------------------------------------------------------------------
  1609 Index: rpmpopt.in
  1610 --- rpmpopt.in	24 Jan 2003 14:56:30 -0000	1.1.1.7
  1611 +++ rpmpopt.in	22 Jan 2004 21:42:11 -0000	1.2
  1612 @@ -147,28 +147,28 @@
  1613  # Popt glue to preserve legacy CLI behavior.
  1615  # XXX popt exec parsing doesn't honor POPT_ARGFLAG_ONEDASH
  1616 -# XXX Build mode aliases, removed in rpm-4.1.
  1617 -#rpm	exec --bp		rpmb -bp
  1618 -#rpm	exec --bc		rpmb -bc
  1619 -#rpm	exec --bi		rpmb -bi
  1620 -#rpm	exec --bl		rpmb -bl
  1621 -#rpm	exec --ba		rpmb -ba
  1622 -#rpm	exec --bb		rpmb -bb
  1623 -#rpm	exec --bs		rpmb -bs
  1624 -#rpm	exec --tp		rpmb -tp
  1625 -#rpm	exec --tc		rpmb -tc
  1626 -#rpm	exec --ti		rpmb -ti
  1627 -#rpm	exec --tl		rpmb -tl
  1628 -#rpm	exec --ta		rpmb -ta
  1629 -#rpm	exec --tb		rpmb -tb
  1630 -#rpm	exec --ts		rpmb -ts
  1631 -#rpm	exec --rebuild		rpmb --rebuild
  1632 -#rpm	exec --recompile	rpmb --recompile
  1633 -#rpm	exec --clean		rpmb --clean
  1634 -#rpm	exec --rmsource		rpmb --rmsource
  1635 -#rpm	exec --rmspec		rpmb --rmspec
  1636 -#rpm	exec --target		rpmb --target
  1637 -#rpm	exec --short-circuit	rpmb --short-circuit
  1638 +rpm	exec --bp		rpmb -bp
  1639 +rpm	exec --bc		rpmb -bc
  1640 +rpm	exec --bi		rpmb -bi
  1641 +rpm	exec --bl		rpmb -bl
  1642 +rpm	exec --ba		rpmb -ba
  1643 +rpm	exec --bb		rpmb -bb
  1644 +rpm	exec --bs		rpmb -bs
  1645 +rpm	exec --bt		rpmb -bt
  1646 +rpm	exec --tp		rpmb -tp
  1647 +rpm	exec --tc		rpmb -tc
  1648 +rpm	exec --ti		rpmb -ti
  1649 +rpm	exec --tl		rpmb -tl
  1650 +rpm	exec --ta		rpmb -ta
  1651 +rpm	exec --tb		rpmb -tb
  1652 +rpm	exec --ts		rpmb -ts
  1653 +rpm	exec --rebuild		rpmb --rebuild
  1654 +rpm	exec --recompile	rpmb --recompile
  1655 +rpm	exec --clean		rpmb --clean
  1656 +rpm	exec --rmsource		rpmb --rmsource
  1657 +rpm	exec --rmspec		rpmb --rmspec
  1658 +rpm	exec --target		rpmb --target
  1659 +rpm	exec --short-circuit	rpmb --short-circuit
  1661  rpm	exec --initdb		rpmd --initdb
  1662  rpm	exec --rebuilddb	rpmd --rebuilddb
  1664 +---------------------------------------------------------------------------
  1665 | Allow "-bb --short-circuit" for continuing building a binary package
  1666 | after the %install step (usually previously fixed and repeated with
  1667 | "-bi --short-circuit".
  1668 +---------------------------------------------------------------------------
  1669 Index: rpmqv.c
  1670 --- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1671 +++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1672 @@ -682,6 +682,10 @@
  1673  	case 'b':
  1674  	    ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
  1675  	    ba->buildAmount |= RPMBUILD_CLEAN;
  1676 +#ifdef OPENPKG
  1677 +	    if ((ba->buildChar == 'b') && ba->shortCircuit)
  1678 +		/*@innerbreak@*/ break;
  1679 +#endif
  1680  	    /*@fallthrough@*/
  1681  	case 'i':
  1682  	    ba->buildAmount |= RPMBUILD_INSTALL;
  1684 +---------------------------------------------------------------------------
  1685 | Because permissions and ownership on Berkeley-DB region files
  1686 | __db.XXX have to be already fixed in advance and those files cannot
  1687 | be created in advance on the command line with some reasonable
  1688 | default (as it is the case for the other files which are created
  1689 | with [rpm]db_load), so force Berkeley-DB to accept zero-sized files
  1690 | and create them (instead of thinking another process is currently
  1691 | creating them).
  1692 +---------------------------------------------------------------------------
  1693 Index: db/env/env_region.c
  1694 --- db/env/env_region.c	18 Jan 2003 14:05:01 -0000	1.1.1.5
  1695 +++ db/env/env_region.c	22 Jan 2004 21:42:17 -0000	1.2
  1696 @@ -184,6 +184,24 @@
  1699  	/*
  1700 +	 * OpenPKG hack: because permissions and ownership on Berkeley-DB
  1701 +	 * region files __db.XXX have to be already fixed in advance and
  1702 +	 * those files cannot be created in advance on the command line
  1703 +	 * with some reasonable default (as it is the case for the other
  1704 +	 * files which are created with [rpm]db_load), so force Berkeley-DB
  1705 +	 * to accept zero-sized files and create them (instead of thinking
  1706 +	 * another process is currently creating them).
  1707 +	 */
  1708 +	if (mbytes == 0 && bytes == 0) {
  1709 +		if (F_ISSET(dbenv, DB_ENV_CREATE))
  1710 +			goto creation;
  1711 +		else {
  1712 +			ret = ENOENT;
  1713 +			goto err;
  1714 +		}
  1715 +	}
  1717 +	/*
  1718  	 * !!!
  1719  	 * A size_t is OK -- regions get mapped into memory, and so can't
  1720  	 * be larger than a size_t.
  1722 +---------------------------------------------------------------------------
  1723 | Make sure RPM passes DB_CREATE to Berkeley-DB also if file exists,
  1724 | but is (still) zero-sized.
  1725 +---------------------------------------------------------------------------
  1726 Index: rpmdb/db3.c
  1727 --- rpmdb/db3.c	3 Mar 2003 16:18:29 -0000	1.1.1.5
  1728 +++ rpmdb/db3.c	22 Jan 2004 21:42:29 -0000	1.2
  1729 @@ -1019,9 +1019,13 @@
  1730  	} else {	/* dbhome is writable, check for persistent dbenv. */
  1731  	    /*@-mods@*/
  1732  	    const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
  1733 +            struct stat sb;
  1734 +            long size = -1;
  1735  	    /*@=mods@*/
  1737 -	    if (access(dbf, F_OK) == -1) {
  1738 +            if (stat(dbf, &sb) == 0)
  1739 +                size = (long)sb.st_size;
  1740 +	    if (access(dbf, F_OK) == -1 || size == 0) {
  1741  		/* ... non-existent (or unwritable) DBENV, will create ... */
  1742  		dbi->dbi_oeflags |= DB_CREATE;
  1743  		dbi->dbi_eflags &= ~DB_JOINENV;
  1745 +---------------------------------------------------------------------------
  1746 | Add internal feature variable %{_force_oldpackage} which, if
  1747 | non-zero, automatically enforces --oldpackage on all upgrade
  1748 | operations (this is useful on mass-upgrades from OpenPKG-CURRENT to
  1749 | OpenPKG-RELEASE).
  1750 +---------------------------------------------------------------------------
  1751 Index: rpm.c
  1752 --- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
  1753 +++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
  1754 @@ -1016,6 +1016,10 @@
  1756      if (oldPackage && !upgrade)
  1757  	argerror(_("--oldpackage may only be used during upgrades"));
  1758 +#ifdef OPENPKG
  1759 +    if (upgrade && rpmExpandNumeric("%{?_force_oldpackage}"))
  1760 +        probFilter |= RPMPROB_FILTER_OLDPACKAGE;
  1761 +#endif
  1763      if (noPgp && bigMode != MODE_CHECKSIG)
  1764  	argerror(_("--nopgp may only be used during signature checking"));
  1766 +---------------------------------------------------------------------------
  1767 | Add OpenPKG branding to make sure people do not intermix
  1768 | this RPM version with the stock RPM version.
  1769 +---------------------------------------------------------------------------
  1770 Index: lib/poptALL.c
  1771 --- lib/poptALL.c	25 Jun 2003 19:10:01 -0000	1.1.1.3
  1772 +++ lib/poptALL.c	22 Jan 2004 21:42:23 -0000	1.2
  1773 @@ -102,7 +102,7 @@
  1774  	/*@globals rpmEVR, fileSystem @*/
  1775  	/*@modifies *fp, fileSystem @*/
  1777 -    fprintf(fp, _("RPM version %s\n"), rpmEVR);
  1778 +    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
  1781  /**
  1783 +---------------------------------------------------------------------------
  1784 | Add OpenPKG branding to make sure people do not intermix
  1785 | this RPM version with the stock RPM version.
  1786 +---------------------------------------------------------------------------
  1787 Index: rpm.c
  1788 --- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
  1789 +++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
  1790 @@ -235,7 +235,7 @@
  1791  static void printHelpLine(char * prefix, char * help);
  1793  static void printVersion(void) {
  1794 -    fprintf(stdout, _("RPM version %s\n"), rpmEVR);
  1795 +    fprintf(stdout, _("OpenPKG RPM %s\n"), rpmEVR);
  1798  static void printBanner(void) {
  1800 +---------------------------------------------------------------------------
  1801 | Add OpenPKG branding to make sure people do not intermix
  1802 | this RPM version with the stock RPM version.
  1803 +---------------------------------------------------------------------------
  1804 Index: rpmqv.c
  1805 --- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1806 +++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1807 @@ -126,7 +126,7 @@
  1808  	/*@globals rpmEVR, fileSystem @*/
  1809  	/*@modifies *fp, fileSystem @*/
  1811 -    fprintf(fp, _("RPM version %s\n"), rpmEVR);
  1812 +    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
  1815  static void printBanner(FILE * fp)
  1817 +---------------------------------------------------------------------------
  1818 | Add support for the OpenPKG custom .spec file sections %track
  1819 | (package build-time feature for performing vendor source tracking)
  1820 | and %test (package install-time feature for performing package
  1821 | run-time tests).
  1822 +---------------------------------------------------------------------------
  1823 Index: rpmqv.c
  1824 --- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1825 +++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1826 @@ -707,7 +707,19 @@
  1827  	    /*@innerbreak@*/ break;
  1828  	case 's':
  1829  	    ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
  1830 +	    /* enforce no dependency checking */
  1831 +	    ba->noDeps = 1;
  1832  	    /*@innerbreak@*/ break;
  1833 +#ifdef OPENPKG
  1834 +	case 't':
  1835 +	    ba->buildAmount |= RPMBUILD_TRACK;
  1836 +	    /* enforce no dependency checking and expansion of %setup, %patch and %prep macros */
  1837 +	    ba->noDeps = 1;
  1838 +	    rpmDefineMacro(NULL, "setup #", RMIL_CMDLINE);
  1839 +	    rpmDefineMacro(NULL, "patch #", RMIL_CMDLINE);
  1840 +	    rpmDefineMacro(NULL, "prep %%prep", RMIL_CMDLINE);
  1841 +	    /*@innerbreak@*/ break;
  1842 +#endif
  1845  	if (!poptPeekArg(optCon)) {
  1847 +---------------------------------------------------------------------------
  1848 | Add support for the OpenPKG custom .spec file sections %track
  1849 | (package build-time feature for performing vendor source tracking)
  1850 | and %test (package install-time feature for performing package
  1851 | run-time tests).
  1852 +---------------------------------------------------------------------------
  1853 Index: build/pack.c
  1854 --- build/pack.c	4 Mar 2003 17:03:17 -0000	1.1.1.20
  1855 +++ build/pack.c	30 Jan 2004 17:06:29 -0000	1.2
  1856 @@ -252,6 +252,15 @@
  1857  	    return RPMERR_BADFILENAME;
  1860 +#ifdef OPENPKG
  1861 +    if (pkg->testFile) {
  1862 +	if (addFileToTag(spec, pkg->testFile, pkg->header, RPMTAG_TEST)) {
  1863 +	    rpmError(RPMERR_BADFILENAME,
  1864 +		     _("Could not open Test file: %s\n"), pkg->testFile);
  1865 +	    return RPMERR_BADFILENAME;
  1866 +	}
  1867 +    }
  1868 +#endif
  1870      for (p = pkg->triggerFiles; p != NULL; p = p->next) {
  1871  	(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
  1873 +---------------------------------------------------------------------------
  1874 | Add support for the OpenPKG custom .spec file sections %track
  1875 | (package build-time feature for performing vendor source tracking)
  1876 | and %test (package install-time feature for performing package
  1877 | run-time tests).
  1878 +---------------------------------------------------------------------------
  1879 Index: build/parseBuildInstallClean.c
  1880 --- build/parseBuildInstallClean.c	3 Mar 2003 20:43:30 -0000	1.1.1.9
  1881 +++ build/parseBuildInstallClean.c	30 Jan 2004 17:06:29 -0000	1.2
  1882 @@ -29,6 +29,11 @@
  1883      } else if (parsePart == PART_CLEAN) {
  1884  	sbp = &(spec->clean);
  1885  	name = "%clean";
  1886 +#ifdef OPENPKG
  1887 +    } else if (parsePart == PART_TRACK) {
  1888 +	sbp = &(spec->track);
  1889 +	name = "%track";
  1890 +#endif
  1892      /*@=branchstate@*/
  1895 +---------------------------------------------------------------------------
  1896 | Add support for the OpenPKG custom .spec file sections %track
  1897 | (package build-time feature for performing vendor source tracking)
  1898 | and %test (package install-time feature for performing package
  1899 | run-time tests).
  1900 +---------------------------------------------------------------------------
  1901 Index: build/parseScript.c
  1902 --- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
  1903 +++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
  1904 @@ -156,6 +156,14 @@
  1905  	progtag = RPMTAG_TRIGGERSCRIPTPROG;
  1906  	partname = "%triggerpostun";
  1907  	break;
  1908 +#ifdef OPENPKG
  1909 +      case PART_TEST:
  1910 +	tag = RPMTAG_TEST;
  1911 +	tagflags = RPMSENSE_SCRIPT_TEST;
  1912 +	progtag = RPMTAG_TESTPROG;
  1913 +	partname = "%test";
  1914 +	break;
  1915 +#endif
  1917      /*@=branchstate@*/
  1919 @@ -304,6 +313,11 @@
  1920  	      case PART_VERIFYSCRIPT:
  1921  		pkg->verifyFile = xstrdup(file);
  1922  		break;
  1923 +#ifdef OPENPKG
  1924 +	      case PART_TEST:
  1925 +		pkg->testFile = xstrdup(file);
  1926 +		break;
  1927 +#endif
  1932 +---------------------------------------------------------------------------
  1933 | Add support for the OpenPKG custom .spec file sections %track
  1934 | (package build-time feature for performing vendor source tracking)
  1935 | and %test (package install-time feature for performing package
  1936 | run-time tests).
  1937 +---------------------------------------------------------------------------
  1938 Index: build/parseSpec.c
  1939 --- build/parseSpec.c	15 May 2003 13:38:57 -0000	1.1.1.15
  1940 +++ build/parseSpec.c	30 Jan 2004 17:06:30 -0000	1.2
  1941 @@ -43,6 +43,10 @@
  1942      { PART_TRIGGERIN,     0, "%triggerin"},
  1943      { PART_TRIGGERIN,     0, "%trigger"},
  1944      { PART_VERIFYSCRIPT,  0, "%verifyscript"},
  1945 +#ifdef OPENPKG
  1946 +    { PART_TRACK,         0, "%track"},
  1947 +    { PART_TEST,          0, "%test"},
  1948 +#endif
  1949      {0, 0, 0}
  1950  };
  1952 @@ -489,6 +493,15 @@
  1953  	    parsePart = parseFiles(spec);
  1954  	    /*@switchbreak@*/ break;
  1956 +#ifdef OPENPKG
  1957 +	case PART_TRACK:
  1958 +	    parsePart = parseBuildInstallClean(spec, parsePart);
  1959 +	    /*@switchbreak@*/ break;
  1960 +	case PART_TEST:
  1961 +	    parsePart = parseScript(spec, parsePart);
  1962 +	    /*@switchbreak@*/ break;
  1963 +#endif
  1965  	case PART_NONE:		/* XXX avoid gcc whining */
  1966  	case PART_LAST:
  1967  	case PART_BUILDARCHITECTURES:
  1969 +---------------------------------------------------------------------------
  1970 | Add support for the OpenPKG custom .spec file sections %track
  1971 | (package build-time feature for performing vendor source tracking)
  1972 | and %test (package install-time feature for performing package
  1973 | run-time tests).
  1974 +---------------------------------------------------------------------------
  1975 Index: build/poptBT.c
  1976 --- build/poptBT.c	3 Mar 2003 20:04:12 -0000	1.1.1.3
  1977 +++ build/poptBT.c	30 Jan 2004 17:06:30 -0000	1.2
  1978 @@ -35,6 +35,9 @@
  1979  #define	POPT_BL			0x626c
  1980  #define	POPT_BP			0x6270
  1981  #define	POPT_BS			0x6273
  1982 +#ifdef OPENPKG
  1983 +#define	POPT_BT			0x6274
  1984 +#endif
  1985  #define	POPT_TA			0x7461
  1986  #define	POPT_TB			0x7462
  1987  #define	POPT_TC			0x7463
  1988 @@ -82,6 +85,9 @@
  1989      case POPT_BL:
  1990      case POPT_BP:
  1991      case POPT_BS:
  1992 +#ifdef OPENPKG
  1993 +    case POPT_BT:
  1994 +#endif
  1995      case POPT_TA:
  1996      case POPT_TB:
  1997      case POPT_TC:
  1998 @@ -177,6 +183,11 @@
  1999   { "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS,
  2000  	N_("build source package only from <specfile>"),
  2001  	N_("<specfile>") },
  2002 +#ifdef OPENPKG
  2003 + { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
  2004 +	N_("track versions of sources from <specfile>"),
  2005 +	N_("<specfile>") },
  2006 +#endif
  2008   { "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP,
  2009  	N_("build through %prep (unpack sources and apply patches) from <tarball>"),
  2011 +---------------------------------------------------------------------------
  2012 | Add support for the OpenPKG custom .spec file sections %track
  2013 | (package build-time feature for performing vendor source tracking)
  2014 | and %test (package install-time feature for performing package
  2015 | run-time tests).
  2016 +---------------------------------------------------------------------------
  2017 Index: build/rpmbuild.h
  2018 --- build/rpmbuild.h	4 Mar 2003 17:03:07 -0000	1.1.1.13
  2019 +++ build/rpmbuild.h	30 Jan 2004 17:06:30 -0000	1.2
  2020 @@ -34,6 +34,9 @@
  2021      RPMBUILD_RMSOURCE	= (1 <<  8),	/*!< Remove source(s) and patch(s). */
  2022      RPMBUILD_RMBUILD	= (1 <<  9),	/*!< Remove build sub-tree. */
  2023      RPMBUILD_STRINGBUF	= (1 << 10),	/*!< only for doScript() */
  2024 +#ifdef OPENPKG
  2025 +    RPMBUILD_TRACK	= (1 << 12),	/*!< Execute %%track. */
  2026 +#endif
  2027      RPMBUILD_RMSPEC	= (1 << 11)	/*!< Remove spec file. */
  2028  } rpmBuildFlags;
  2029  /*@=typeuse@*/
  2030 @@ -69,7 +72,13 @@
  2031      PART_VERIFYSCRIPT	= 16,	/*!< */
  2032      PART_BUILDARCHITECTURES= 17,/*!< */
  2033      PART_TRIGGERPOSTUN	= 18,	/*!< */
  2034 +#ifdef OPENPKG
  2035 +    PART_TRACK	        = 19,	/*!< */
  2036 +    PART_TEST	        = 20,	/*!< */
  2037 +    PART_LAST		= 21	/*!< */
  2038 +#else
  2039      PART_LAST		= 19	/*!< */
  2040 +#endif
  2041  } rpmParseState;
  2043  #define STRIP_NOTHING             0
  2045 +---------------------------------------------------------------------------
  2046 | Add support for the OpenPKG custom .spec file sections %track
  2047 | (package build-time feature for performing vendor source tracking)
  2048 | and %test (package install-time feature for performing package
  2049 | run-time tests).
  2050 +---------------------------------------------------------------------------
  2051 Index: build/rpmspec.h
  2052 --- build/rpmspec.h	4 Mar 2003 15:30:23 -0000	1.1.1.11
  2053 +++ build/rpmspec.h	30 Jan 2004 17:06:30 -0000	1.2
  2054 @@ -164,6 +164,10 @@
  2055      StringBuf check;		/*!< %check scriptlet. */
  2056  /*@only@*/
  2057      StringBuf clean;		/*!< %clean scriptlet. */
  2058 +#ifdef OPENPKG
  2059 +/*@only@*/
  2060 +    StringBuf track;		/*!< %track scriptlet. */
  2061 +#endif
  2063  /*@owned@*/
  2064      Package packages;		/*!< Package list. */
  2065 @@ -196,6 +200,10 @@
  2066      const char * postUnFile;	/*!< %postun scriptlet. */
  2067  /*@only@*/
  2068      const char * verifyFile;	/*!< %verifyscript scriptlet. */
  2069 +#ifdef OPENPKG
  2070 +/*@only@*/
  2071 +    const char * testFile;	/*!< %test scriptlet. */
  2072 +#endif
  2074  /*@only@*/
  2075      StringBuf specialDoc;
  2077 +---------------------------------------------------------------------------
  2078 | Add support for the OpenPKG custom .spec file sections %track
  2079 | (package build-time feature for performing vendor source tracking)
  2080 | and %test (package install-time feature for performing package
  2081 | run-time tests).
  2082 +---------------------------------------------------------------------------
  2083 Index: build/spec.c
  2084 --- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
  2085 +++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
  2086 @@ -138,6 +138,9 @@
  2087      p->preUnFile = NULL;
  2088      p->postUnFile = NULL;
  2089      p->verifyFile = NULL;
  2090 +#ifdef OPENPKG
  2091 +    p->testFile = NULL;
  2092 +#endif
  2094      p->specialDoc = NULL;
  2096 @@ -452,6 +463,9 @@
  2097      spec->install = NULL;
  2098      spec->check = NULL;
  2099      spec->clean = NULL;
  2100 +#ifdef OPENPKG
  2101 +    spec->track = NULL;
  2102 +#endif
  2104      spec->sources = NULL;
  2105      spec->packages = NULL;
  2106 @@ -499,6 +513,9 @@
  2107      spec->install = freeStringBuf(spec->install);
  2108      spec->check = freeStringBuf(spec->check);
  2109      spec->clean = freeStringBuf(spec->clean);
  2110 +#ifdef OPENPKG
  2111 +    spec->track = freeStringBuf(spec->track);
  2112 +#endif
  2114      spec->buildRootURL = _free(spec->buildRootURL);
  2115      spec->buildSubdir = _free(spec->buildSubdir);
  2117 +---------------------------------------------------------------------------
  2118 | Add support for the OpenPKG custom .spec file sections %track
  2119 | (package build-time feature for performing vendor source tracking)
  2120 | and %test (package install-time feature for performing package
  2121 | run-time tests).
  2122 +---------------------------------------------------------------------------
  2123 Index: lib/rpmlib.h
  2124 --- lib/rpmlib.h	19 Jun 2003 17:39:35 -0000	1.1.1.26
  2125 +++ lib/rpmlib.h	30 Jan 2004 17:06:31 -0000	1.2
  2126 @@ -414,6 +414,12 @@
  2127      RPMTAG_FILEDEPENDSN		= 1144,
  2128      RPMTAG_DEPENDSDICT		= 1145,
  2129      RPMTAG_SOURCEPKGID		= 1146,
  2130 +#ifdef OPENPKG
  2131 +    RPMTAG_TRACK 		= 1200,
  2132 +    RPMTAG_TEST 		= 1201,
  2133 +    RPMTAG_TESTPROG		= 1202,
  2134 +    RPMTAG_CLASS		= 1203,
  2135 +#endif
  2136  /*@-enummemuse@*/
  2137      RPMTAG_FIRSTFREE_TAG	/*!< internal */
  2138  /*@=enummemuse@*/
  2139 @@ -488,6 +494,9 @@
  2140      RPMSENSE_SCRIPT_BUILD = (1 << 21),	/*!< %build build dependency. */
  2141      RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
  2142      RPMSENSE_SCRIPT_CLEAN = (1 << 23),	/*!< %clean build dependency. */
  2143 +#ifdef OPENPKG
  2144 +    RPMSENSE_SCRIPT_TEST = (1 << 29),	/*!< %test build dependency. */
  2145 +#endif
  2146      RPMSENSE_RPMLIB	= ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
  2147  /*@-enummemuse@*/
  2148      RPMSENSE_TRIGGERPREIN = (1 << 25),	/*!< @todo Implement %triggerprein. */
  2150 +---------------------------------------------------------------------------
  2151 | Add support for the OpenPKG custom .spec file sections %track
  2152 | (package build-time feature for performing vendor source tracking)
  2153 | and %test (package install-time feature for performing package
  2154 | run-time tests).
  2155 | Additionally, add support for "Class" header.
  2156 +---------------------------------------------------------------------------
  2157 Index: rpmdb/tagtbl.c
  2158 --- rpmdb/tagtbl.c	2 Jul 2003 20:20:27 -0000	1.1.1.4
  2159 +++ rpmdb/tagtbl.c	30 Jan 2004 17:06:32 -0000	1.2
  2160 @@ -135,6 +135,12 @@
  2161  	{ "RPMTAG_FILEDEPENDSN", 1144, },
  2162  	{ "RPMTAG_DEPENDSDICT", 1145, },
  2163  	{ "RPMTAG_SOURCEPKGID", 1146, },
  2164 +#ifdef OPENPKG
  2165 +	{ "RPMTAG_TRACK", 1200, },
  2166 +	{ "RPMTAG_TEST", 1201, },
  2167 +	{ "RPMTAG_TESTPROG", 1202, },
  2168 +	{ "RPMTAG_CLASS", 1203, },
  2169 +#endif
  2170  	{ NULL, 0 }
  2171  };
  2174 +---------------------------------------------------------------------------
  2175 | Add support for "Class" header.
  2176 +---------------------------------------------------------------------------
  2177 Index: build/parsePreamble.c
  2178 --- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
  2179 +++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
  2180 @@ -21,6 +21,7 @@
  2181      RPMTAG_LICENSE,
  2182      RPMTAG_PACKAGER,
  2183      RPMTAG_DISTRIBUTION,
  2184 +    RPMTAG_CLASS,
  2185      RPMTAG_DISTURL,
  2186      RPMTAG_VENDOR,
  2187      RPMTAG_ICON,
  2188 @@ -327,6 +328,7 @@
  2189      { RPMTAG_VENDOR,		"%{vendor}" },
  2190      { RPMTAG_PACKAGER,		"%{packager}" },
  2191      { RPMTAG_DISTRIBUTION,	"%{distribution}" },
  2192 +    { RPMTAG_CLASS,		"%{class}" },
  2193      { RPMTAG_DISTURL,		"%{disturl}" },
  2194      { -1, NULL }
  2195  };
  2196 @@ -545,6 +547,7 @@
  2197  	(void) stashSt(spec, pkg->header, tag, lang);
  2198  	/*@fallthrough@*/
  2199      case RPMTAG_DISTRIBUTION:
  2200 +    case RPMTAG_CLASS:
  2201      case RPMTAG_VENDOR:
  2202      case RPMTAG_LICENSE:
  2203      case RPMTAG_PACKAGER:
  2204 @@ -751,6 +754,7 @@
  2205      {RPMTAG_LICENSE,		0, 0, "copyright"},
  2206      {RPMTAG_LICENSE,		0, 0, "license"},
  2207      {RPMTAG_DISTRIBUTION,	0, 0, "distribution"},
  2208 +    {RPMTAG_CLASS,		0, 0, "class"},
  2209      {RPMTAG_DISTURL,		0, 0, "disturl"},
  2210      {RPMTAG_VENDOR,		0, 0, "vendor"},
  2211      {RPMTAG_GROUP,		0, 1, "group"},

mercurial