openpkg/rpm.patch.feature

changeset 13
cb59d6afeb61
child 333
4ecfc2416fd8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/rpm.patch.feature	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,2211 @@
     1.4 +##
     1.5 +##  rpm.patch.feature -- Annotated OpenPKG RPM Patch file
     1.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.8 +##
     1.9 +##  This file assembles changes to existing RPM source files between
    1.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
    1.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
    1.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
    1.13 +##  with a short description.
    1.14 +##
    1.15 +##  Created on: 13-Sep-2006
    1.16 +##
    1.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
    1.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
    1.19 +##
    1.20 +
    1.21 ++---------------------------------------------------------------------------
    1.22 +| Remove "tools" directory from sub-directory list because it contains
    1.23 +| things we are not interested in and which cause some build trouble
    1.24 +| anyway.
    1.25 +| Use a plain "rpmpopt" file without any trailing version.
    1.26 +| Adjust paths to conform to OpenPKG filesystem layout.
    1.27 +| Do not run the "installplatform" script, because not needed for OpenPKG.
    1.28 ++---------------------------------------------------------------------------
    1.29 +Index: Makefile.am
    1.30 +--- Makefile.am	29 May 2003 18:20:28 -0000	1.1.1.17
    1.31 ++++ Makefile.am	22 Jan 2004 21:42:02 -0000	1.2
    1.32 +@@ -12,9 +12,9 @@
    1.33 + 	xmlspec/examples/*.sh xmlspec/examples/*.lst \
    1.34 + 	xmlspec/examples/*.xmlspec \
    1.35 + 	po/*.in po/*.po po/rpm.pot \
    1.36 +-	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
    1.37 ++	rpm.magic rpmpopt rpmqv.c rpm.c
    1.38 + 
    1.39 +-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 .
    1.40 ++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 .
    1.41 + 
    1.42 + INCLUDES = \
    1.43 + 	-I$(top_srcdir)/build \
    1.44 +@@ -47,13 +47,10 @@
    1.45 + 
    1.46 + pkglibdir =		@RPMCONFIGDIR@
    1.47 + pkglib_PROGRAMS =	rpmb rpmd rpmi rpmk rpmq
    1.48 +-pkglib_DATA =		rpmrc rpmpopt-$(VERSION) macros
    1.49 ++pkglib_DATA =		rpmrc rpmpopt macros
    1.50 + pkglib_SCRIPTS =	find-provides find-requires mkinstalldirs \
    1.51 + 			config.guess config.sub config.site
    1.52 + 
    1.53 +-rpmpopt-$(VERSION): rpmpopt
    1.54 +-	cp rpmpopt $@
    1.55 +-
    1.56 + noinst_HEADERS = build.h debug.h system.h
    1.57 + 
    1.58 + rpm_SOURCES =
    1.59 +@@ -124,32 +121,32 @@
    1.60 + pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR)
    1.61 + 
    1.62 + install-data-local:
    1.63 +-	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
    1.64 ++	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
    1.65 + 	@rm -f $(DESTDIR)$(libdir)/rpmrc
    1.66 + 	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
    1.67 + 	@rm -f $(DESTDIR)$(libdir)/rpmpopt
    1.68 + 	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
    1.69 + 	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
    1.70 +-	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
    1.71 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
    1.72 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
    1.73 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
    1.74 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
    1.75 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
    1.76 +-	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
    1.77 ++	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
    1.78 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
    1.79 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
    1.80 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
    1.81 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
    1.82 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
    1.83 ++	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
    1.84 + 	rm -f $(DESTDIR)$(bindir)/rpmbuild
    1.85 +-	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
    1.86 ++	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
    1.87 + 	rm -f $(DESTDIR)$(bindir)/rpmquery
    1.88 +-	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
    1.89 ++	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
    1.90 + 	rm -f $(DESTDIR)$(bindir)/rpmverify
    1.91 +-	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
    1.92 ++	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
    1.93 + 	rm -f $(DESTDIR)$(bindir)/rpmsign
    1.94 +-	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
    1.95 ++	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
    1.96 + 	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
    1.97 +-	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
    1.98 ++	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
    1.99 + 	for bf in e i u ; do \
   1.100 + 	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.101 +-	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.102 ++	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.103 + 	done
   1.104 + 	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
   1.105 + 	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
   1.106 +@@ -174,11 +171,6 @@
   1.107 + 	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
   1.108 + 	esac
   1.109 + 	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
   1.110 +-	@case "@host_os@" in \
   1.111 +-	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
   1.112 +-	solaris*|linux*) \
   1.113 +-	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
   1.114 +-	esac
   1.115 + 	@$(mkinstalldirs) $(DESTDIR)/var/tmp
   1.116 + 
   1.117 + .PHONY:	setperms
   1.118 +@@ -198,10 +190,10 @@
   1.119 + 	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
   1.120 + 	done
   1.121 + 	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
   1.122 +-	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
   1.123 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
   1.124 +-	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
   1.125 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
   1.126 ++	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
   1.127 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
   1.128 ++	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
   1.129 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
   1.130 + 
   1.131 + .PHONY:	unsetgid
   1.132 + unsetgid:
   1.133 +@@ -244,7 +236,7 @@
   1.134 + 	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
   1.135 + 
   1.136 + .PHONY:	doxygen
   1.137 +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
   1.138 ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
   1.139 + 	rm -rf $@
   1.140 + 	mkdir -p $@
   1.141 + 	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
   1.142 +
   1.143 ++---------------------------------------------------------------------------
   1.144 +| Remove "tools" directory from sub-directory list because it contains
   1.145 +| things we are not interested in and which cause some build trouble
   1.146 +| anyway.
   1.147 +| Use a plain "rpmpopt" file without any trailing version.
   1.148 +| Adjust paths to conform to OpenPKG filesystem layout.
   1.149 +| Do not run the "installplatform" script, because not needed for OpenPKG.
   1.150 ++---------------------------------------------------------------------------
   1.151 +Index: Makefile.in
   1.152 +--- Makefile.in	16 Jul 2003 17:05:42 -0000	1.1.1.23
   1.153 ++++ Makefile.in	22 Jan 2004 21:42:03 -0000	1.2
   1.154 +@@ -265,10 +265,10 @@
   1.155 + 	xmlspec/examples/*.sh xmlspec/examples/*.lst \
   1.156 + 	xmlspec/examples/*.xmlspec \
   1.157 + 	po/*.in po/*.po po/rpm.pot \
   1.158 +-	rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c
   1.159 ++	rpm.magic rpmpopt rpmqv.c rpm.c
   1.160 + 
   1.161 + 
   1.162 +-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 .
   1.163 ++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 .
   1.164 + 
   1.165 + INCLUDES = \
   1.166 + 	-I$(top_srcdir)/build \
   1.167 +@@ -301,7 +301,7 @@
   1.168 + bin_PROGRAMS = rpm2cpio
   1.169 + bin_SCRIPTS = gendiff
   1.170 + pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq
   1.171 +-pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros
   1.172 ++pkglib_DATA = rpmrc rpmpopt macros
   1.173 + pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \
   1.174 + 			config.guess config.sub config.site
   1.175 + 
   1.176 +@@ -1058,8 +1058,6 @@
   1.177 + 	uninstall-rpmbinPROGRAMS
   1.178 + 
   1.179 + 
   1.180 +-rpmpopt-$(VERSION): rpmpopt
   1.181 +-	cp rpmpopt $@
   1.182 + rpm.o:	rpmqv.c
   1.183 + 	$(COMPILE) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV -o $@ -c rpmqv.c
   1.184 + rpmb.o:	rpmqv.c
   1.185 +@@ -1097,32 +1095,32 @@
   1.186 + 		`make -s sources -C popt`
   1.187 + 
   1.188 + install-data-local:
   1.189 +-	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
   1.190 ++	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/openpkg
   1.191 + 	@rm -f $(DESTDIR)$(libdir)/rpmrc
   1.192 + 	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
   1.193 + 	@rm -f $(DESTDIR)$(libdir)/rpmpopt
   1.194 + 	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
   1.195 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
   1.196 +-	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
   1.197 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
   1.198 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
   1.199 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
   1.200 +-	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
   1.201 +-	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
   1.202 +-	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv
   1.203 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmt
   1.204 ++	@@LN_S@ rpmb $(DESTDIR)$(libdir)/openpkg/rpmt
   1.205 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpme
   1.206 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpme
   1.207 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmu
   1.208 ++	@@LN_S@ rpmi $(DESTDIR)$(libdir)/openpkg/rpmu
   1.209 ++	@rm -f $(DESTDIR)$(libdir)/openpkg/rpmv
   1.210 ++	@@LN_S@ rpmq $(DESTDIR)$(libdir)/openpkg/rpmv
   1.211 + 	rm -f $(DESTDIR)$(bindir)/rpmbuild
   1.212 +-	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
   1.213 ++	@LN_S@ ../lib/openpkg/rpmb $(DESTDIR)$(bindir)/rpmbuild
   1.214 + 	rm -f $(DESTDIR)$(bindir)/rpmquery
   1.215 +-	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
   1.216 ++	@LN_S@ ../lib/openpkg/rpmq $(DESTDIR)$(bindir)/rpmquery
   1.217 + 	rm -f $(DESTDIR)$(bindir)/rpmverify
   1.218 +-	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
   1.219 ++	@LN_S@ ../lib/openpkg/rpmv $(DESTDIR)$(bindir)/rpmverify
   1.220 + 	rm -f $(DESTDIR)$(bindir)/rpmsign
   1.221 +-	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
   1.222 ++	@LN_S@ ../lib/openpkg/rpmk $(DESTDIR)$(bindir)/rpmsign
   1.223 + 	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
   1.224 +-	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   1.225 ++	@LN_S@ ../lib/openpkg/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
   1.226 + 	for bf in e i u ; do \
   1.227 + 	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.228 +-	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.229 ++	    @LN_S@ ../lib/openpkg/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
   1.230 + 	done
   1.231 + 	@for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\
   1.232 + 	    $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\
   1.233 +@@ -1147,11 +1145,6 @@
   1.234 + 	*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
   1.235 + 	esac
   1.236 + 	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
   1.237 +-	@case "@host_os@" in \
   1.238 +-	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
   1.239 +-	solaris*|linux*) \
   1.240 +-	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ;; \
   1.241 +-	esac
   1.242 + 	@$(mkinstalldirs) $(DESTDIR)/var/tmp
   1.243 + 
   1.244 + .PHONY:	setperms
   1.245 +@@ -1171,10 +1164,10 @@
   1.246 + 	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
   1.247 + 	done
   1.248 + 	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
   1.249 +-	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
   1.250 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
   1.251 +-	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
   1.252 +-	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
   1.253 ++	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/openpkg
   1.254 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/[A-Z]*
   1.255 ++	-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/openpkg
   1.256 ++	-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/openpkg/__db.*
   1.257 + 
   1.258 + .PHONY:	unsetgid
   1.259 + unsetgid:
   1.260 +@@ -1217,7 +1210,7 @@
   1.261 + 	@sudo ./rpm -ta rpm-$(VERSION).tar.gz
   1.262 + 
   1.263 + .PHONY:	doxygen
   1.264 +-doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
   1.265 ++doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt
   1.266 + 	rm -rf $@
   1.267 + 	mkdir -p $@
   1.268 + 	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
   1.269 +
   1.270 ++---------------------------------------------------------------------------
   1.271 +| Add support for splitted source directories, i.e., source files
   1.272 +| alternatively can be placed into the .spec directory and are picked
   1.273 +| up there, too.
   1.274 ++---------------------------------------------------------------------------
   1.275 +Index: build/build.c
   1.276 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   1.277 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   1.278 +@@ -33,7 +33,15 @@
   1.279 + 
   1.280 +     for (p = spec->sources; p != NULL; p = p->next) {
   1.281 + 	if (! (p->flags & RPMBUILD_ISNO)) {
   1.282 ++#ifndef OPENPKG
   1.283 + 	    const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.284 ++#else
   1.285 ++	    const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
   1.286 ++        if (access(fn, F_OK) == -1) {
   1.287 ++            fn = _free(fn);
   1.288 ++	        fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.289 ++        }
   1.290 ++#endif
   1.291 + 	    rc = Unlink(fn);
   1.292 + 	    fn = _free(fn);
   1.293 + 	}
   1.294 +@@ -42,7 +50,15 @@
   1.295 +     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   1.296 + 	for (p = pkg->icon; p != NULL; p = p->next) {
   1.297 + 	    if (! (p->flags & RPMBUILD_ISNO)) {
   1.298 ++#ifndef OPENPKG
   1.299 + 		const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.300 ++#else
   1.301 ++		const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
   1.302 ++        if (access(fn, F_OK) == -1) {
   1.303 ++            fn = _free(fn);
   1.304 ++		    fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.305 ++        }
   1.306 ++#endif
   1.307 + 		rc = Unlink(fn);
   1.308 + 		fn = _free(fn);
   1.309 + 	    }
   1.310 +
   1.311 ++---------------------------------------------------------------------------
   1.312 +| Add support for the OpenPKG custom .spec file sections %track
   1.313 +| (package build-time feature for performing vendor source tracking)
   1.314 +| and %test (package install-time feature for performing package
   1.315 +| run-time tests).
   1.316 ++---------------------------------------------------------------------------
   1.317 +Index: build/build.c
   1.318 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   1.319 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   1.320 +@@ -113,6 +129,14 @@
   1.321 + 	mTemplate = "%{__spec_clean_template}";
   1.322 + 	mPost = "%{__spec_clean_post}";
   1.323 + 	break;
   1.324 ++#ifdef OPENPKG
   1.325 ++    case RPMBUILD_TRACK:
   1.326 ++	name = "%track";
   1.327 ++	sb = spec->track;
   1.328 ++	mTemplate = "%{__spec_track_template}";
   1.329 ++	mPost = "%{__spec_track_post}";
   1.330 ++	break;
   1.331 ++#endif
   1.332 +     case RPMBUILD_STRINGBUF:
   1.333 +     default:
   1.334 + 	mTemplate = "%{___build_template}";
   1.335 +@@ -169,7 +193,11 @@
   1.336 + 
   1.337 +     (void) fputs(buildTemplate, fp);
   1.338 + 
   1.339 ++#ifdef OPENPKG
   1.340 ++    if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir && what != RPMBUILD_TRACK)
   1.341 ++#else
   1.342 +     if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
   1.343 ++#endif
   1.344 + 	fprintf(fp, "cd %s\n", spec->buildSubdir);
   1.345 + 
   1.346 +     if (what == RPMBUILD_RMBUILD) {
   1.347 +@@ -215,6 +243,9 @@
   1.348 +     buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
   1.349 +     (void) poptParseArgvString(buildCmd, &argc, &argv);
   1.350 + 
   1.351 ++#ifdef OPENPKG
   1.352 ++    if (what != RPMBUILD_TRACK)
   1.353 ++#endif
   1.354 +     rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
   1.355 +     if (!(child = fork())) {
   1.356 + 
   1.357 +@@ -290,6 +323,12 @@
   1.358 + /*@=boundsread@*/
   1.359 + 	}
   1.360 +     } else {
   1.361 ++#ifdef OPENPKG
   1.362 ++	if ((what & RPMBUILD_TRACK) &&
   1.363 ++	    (rc = doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
   1.364 ++		goto exit;
   1.365 ++#endif
   1.366 ++
   1.367 + 	if ((what & RPMBUILD_PREP) &&
   1.368 + 	    (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
   1.369 + 		goto exit;
   1.370 +
   1.371 ++---------------------------------------------------------------------------
   1.372 +| Unconditionally remove temporary files ("rpm-tmp.XXXXX") which
   1.373 +| were generated for the executed scripts. In OpenPKG we run the
   1.374 +| scripts in debug mode ("set -x") anyway, so we never need to
   1.375 +| see the whole generated script -- not even if it breaks.  Instead
   1.376 +| we would just have temporary files staying around forever.
   1.377 ++---------------------------------------------------------------------------
   1.378 +Index: build/build.c
   1.379 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   1.380 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   1.381 +@@ -242,7 +273,9 @@
   1.382 +     
   1.383 + exit:
   1.384 +     if (scriptName) {
   1.385 ++#ifndef OPENPKG
   1.386 + 	if (!rc)
   1.387 ++#endif
   1.388 + 	    (void) Unlink(scriptName);
   1.389 + 	scriptName = _free(scriptName);
   1.390 +     }
   1.391 +
   1.392 ++---------------------------------------------------------------------------
   1.393 +| In OpenPKG we use per-package %{_sourcedir} and %{_specdir}
   1.394 +| definitions (macros have trailing ".../%{name}"). On removal
   1.395 +| of source(s) and .spec file, this per-package directory would
   1.396 +| be kept (usually <prefix>/RPM/SRC/<name>/), because RPM does
   1.397 +| not know about this OpenPKG convention.  So, let RPM try(!) to
   1.398 +| remove the two directories (if they are empty) and just ignore
   1.399 +| removal failures (if they are still not empty).
   1.400 ++---------------------------------------------------------------------------
   1.401 +Index: build/build.c
   1.402 +--- build/build.c	4 Mar 2003 15:27:33 -0000	1.1.1.20
   1.403 ++++ build/build.c	6 Feb 2004 15:37:57 -0000	1.4
   1.404 +@@ -338,6 +377,21 @@
   1.405 +     if (what & RPMBUILD_RMSPEC)
   1.406 + 	(void) Unlink(spec->specFile);
   1.407 + 
   1.408 ++#ifdef OPENPKG
   1.409 ++    if (what & RPMBUILD_RMSOURCE) {
   1.410 ++        const char *pn;
   1.411 ++        pn = rpmGetPath("%{_sourcedir}", NULL);
   1.412 ++        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
   1.413 ++        pn = _free(pn);
   1.414 ++    }
   1.415 ++    if (what & RPMBUILD_RMSPEC) {
   1.416 ++        const char *pn;
   1.417 ++        pn = rpmGetPath("%{_specdir}", NULL);
   1.418 ++        Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
   1.419 ++        pn = _free(pn);
   1.420 ++    }
   1.421 ++#endif
   1.422 ++
   1.423 + exit:
   1.424 +     if (rc && rpmlogGetNrecs() > 0) {
   1.425 + 	rpmMessage(RPMMESS_NORMAL, _("\n\nRPM build errors:\n"));
   1.426 +
   1.427 ++---------------------------------------------------------------------------
   1.428 +| Do not declare any files as %doc files by default.
   1.429 ++---------------------------------------------------------------------------
   1.430 +Index: build/files.c
   1.431 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   1.432 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   1.433 +@@ -1971,6 +1971,7 @@
   1.434 +     fl.defSpecdFlags = 0;
   1.435 + 
   1.436 +     fl.docDirCount = 0;
   1.437 ++#if 0
   1.438 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/doc");
   1.439 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/man");
   1.440 +     fl.docDirs[fl.docDirCount++] = xstrdup("/usr/info");
   1.441 +@@ -1981,6 +1982,7 @@
   1.442 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_docdir}", NULL);
   1.443 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_mandir}", NULL);
   1.444 +     fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_infodir}", NULL);
   1.445 ++#endif
   1.446 +     
   1.447 +     fl.fileList = NULL;
   1.448 +     fl.fileListRecsAlloced = 0;
   1.449 +
   1.450 ++---------------------------------------------------------------------------
   1.451 +| Make sure the "Provides" headers are available for querying from the
   1.452 +| .src.rpm files.
   1.453 ++---------------------------------------------------------------------------
   1.454 +Index: build/files.c
   1.455 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   1.456 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   1.457 +@@ -2183,6 +2185,12 @@
   1.458 + 	case RPMTAG_CHANGELOGTEXT:
   1.459 + 	case RPMTAG_URL:
   1.460 + 	case HEADER_I18NTABLE:
   1.461 ++#ifdef OPENPKG
   1.462 ++	case RPMTAG_PROVIDENAME:
   1.463 ++	case RPMTAG_PROVIDEVERSION:
   1.464 ++	case RPMTAG_PROVIDEFLAGS:
   1.465 ++	case RPMTAG_CLASS:
   1.466 ++#endif
   1.467 + 	    if (ptr)
   1.468 + 		(void)headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
   1.469 + 	    /*@switchbreak@*/ break;
   1.470 +
   1.471 ++---------------------------------------------------------------------------
   1.472 +| Add support for splitted source directories, i.e., source files
   1.473 +| alternatively can be placed into the .spec directory and are picked
   1.474 +| up there, too.
   1.475 ++---------------------------------------------------------------------------
   1.476 +Index: build/files.c
   1.477 +--- build/files.c	4 Mar 2003 17:04:13 -0000	1.1.1.20
   1.478 ++++ build/files.c	6 Feb 2004 15:37:57 -0000	1.3
   1.479 +@@ -2253,8 +2261,20 @@
   1.480 + 	}
   1.481 + 
   1.482 +       {	const char * sfn;
   1.483 ++#ifndef OPENPKG
   1.484 + 	sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.485 + 		"%{_sourcedir}/", srcPtr->source, NULL);
   1.486 ++#else
   1.487 ++        const char *sfn2;
   1.488 ++	sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
   1.489 ++        if (access(sfn2, F_OK) == 0)
   1.490 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.491 ++                "%{_specdir}/", srcPtr->source, NULL);
   1.492 ++        else
   1.493 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.494 ++                "%{_sourcedir}/", srcPtr->source, NULL);
   1.495 ++        sfn2 = _free(sfn2);
   1.496 ++#endif
   1.497 + 	appendLineStringBuf(sourceFiles, sfn);
   1.498 + 	sfn = _free(sfn);
   1.499 +       }
   1.500 +@@ -2263,8 +2283,20 @@
   1.501 +     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
   1.502 + 	for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) {
   1.503 + 	    const char * sfn;
   1.504 ++#ifndef OPENPKG
   1.505 + 	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.506 + 		"%{_sourcedir}/", srcPtr->source, NULL);
   1.507 ++#else
   1.508 ++            const char *sfn2;
   1.509 ++	    sfn2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
   1.510 ++        if (access(sfn2, F_OK) == 0)
   1.511 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.512 ++                "%{_specdir}/", srcPtr->source, NULL);
   1.513 ++        else
   1.514 ++	    sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
   1.515 ++                "%{_sourcedir}/", srcPtr->source, NULL);
   1.516 ++        sfn2 = _free(sfn2);
   1.517 ++#endif
   1.518 + 	    appendLineStringBuf(sourceFiles, sfn);
   1.519 + 	    sfn = _free(sfn);
   1.520 + 	}
   1.521 +
   1.522 ++---------------------------------------------------------------------------
   1.523 +| Add support for splitted source directories, i.e., source files
   1.524 +| alternatively can be placed into the .spec directory and are picked
   1.525 +| up there, too.
   1.526 ++---------------------------------------------------------------------------
   1.527 +Index: build/parsePreamble.c
   1.528 +--- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
   1.529 ++++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
   1.530 +@@ -366,7 +368,15 @@
   1.531 +     size_t nb, iconsize;
   1.532 + 
   1.533 +     /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
   1.534 ++#ifndef OPENPKG
   1.535 +     fn = rpmGetPath("%{_sourcedir}/", file, NULL);
   1.536 ++#else
   1.537 ++    fn = rpmGetPath("%{_specdir}/", file, NULL);
   1.538 ++    if (access(fn, F_OK) == -1) {
   1.539 ++        fn = _free(fn);
   1.540 ++        fn = rpmGetPath("%{_sourcedir}/", file, NULL);
   1.541 ++    }
   1.542 ++#endif
   1.543 + 
   1.544 +     fd = Fopen(fn, "r.ufdio");
   1.545 +     if (fd == NULL || Ferror(fd)) {
   1.546 +
   1.547 ++---------------------------------------------------------------------------
   1.548 +| In OpenPKG, the RPM package contains own local versions of the
   1.549 +| "patch" and "tar" tools, so we cannot accept hard-coded names here.
   1.550 +| Instead we expand a variable to allow us to direct RPM to our tools.
   1.551 +| Additionally, pass option "-b" to patch(1) so it creates original
   1.552 +| files not only if a non-standard (not ".orig") suffix is used.
   1.553 +| Finally, add support for the GNU patch "-d" option for convenient
   1.554 +| changing into a subdirectory.
   1.555 +| Remove "unzip" support, because in OpenPKG there are less than
   1.556 +| a dozend packages requiring unpacking of .zip files. For these
   1.557 +| it is fully sufficient to explicitly require the "infozip"
   1.558 +| package (containing "unzip") and leaving the less portable
   1.559 +| "unzip" out of the bootstrap package.
   1.560 ++---------------------------------------------------------------------------
   1.561 +Index: build/parsePrep.c
   1.562 +--- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
   1.563 ++++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
   1.564 +@@ -66,7 +66,7 @@
   1.565 +  */
   1.566 + /*@-boundswrite@*/
   1.567 + /*@observer@*/ static char *doPatch(Spec spec, int c, int strip, const char *db,
   1.568 +-		     int reverse, int removeEmpties)
   1.569 ++		     int reverse, int removeEmpties, const char *subdir)
   1.570 + 	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
   1.571 + 	/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
   1.572 + {
   1.573 +@@ -76,6 +76,7 @@
   1.574 +     struct Source *sp;
   1.575 +     rpmCompressedMagic compressed = COMPRESSED_NOT;
   1.576 +     int urltype;
   1.577 ++    const char *patcher;
   1.578 + 
   1.579 +     for (sp = spec->sources; sp != NULL; sp = sp->next) {
   1.580 + 	if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) {
   1.581 +@@ -97,6 +106,10 @@
   1.582 + 	strcat(args, "--suffix ");
   1.583 + 	strcat(args, db);
   1.584 +     }
   1.585 ++    if (subdir) {
   1.586 ++	strcat(args, "-d ");
   1.587 ++	strcat(args, subdir);
   1.588 ++    }
   1.589 +     if (reverse) {
   1.590 + 	strcat(args, " -R");
   1.591 +     }
   1.592 +@@ -124,6 +137,10 @@
   1.593 + 	/*@notreached@*/ break;
   1.594 +     }
   1.595 + 
   1.596 ++    patcher = rpmGetPath("%{_patchbin}", NULL);
   1.597 ++    if (strcmp(patcher, "%{_patchbin}") == 0)
   1.598 ++        patcher = "patch";
   1.599 ++
   1.600 +     if (compressed) {
   1.601 + 	const char *zipper = rpmGetPath(
   1.602 + 	    (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"),
   1.603 +@@ -131,22 +148,23 @@
   1.604 + 
   1.605 + 	sprintf(buf,
   1.606 + 		"echo \"Patch #%d (%s):\"\n"
   1.607 +-		"%s -d < %s | patch -p%d %s -s\n"
   1.608 ++		"%s -d <%s | %s -p%d %s -s -b\n"
   1.609 + 		"STATUS=$?\n"
   1.610 + 		"if [ $STATUS -ne 0 ]; then\n"
   1.611 + 		"  exit $STATUS\n"
   1.612 + 		"fi",
   1.613 +-		c, /*@-unrecog@*/ (const char *) basename(fn), /*@=unrecog@*/
   1.614 ++		c, /*@-unrecog@*/ basename(fn), /*@=unrecog@*/
   1.615 + 		zipper,
   1.616 +-		fn, strip, args);
   1.617 ++		fn, patcher, strip, args);
   1.618 + 	zipper = _free(zipper);
   1.619 +     } else {
   1.620 + 	sprintf(buf,
   1.621 + 		"echo \"Patch #%d (%s):\"\n"
   1.622 +-		"patch -p%d %s -s < %s", c, (const char *) basename(fn),
   1.623 +-		strip, args, fn);
   1.624 ++		"%s -p%d %s -s -b <%s", c, basename(fn),
   1.625 ++		patcher, strip, args, fn);
   1.626 +     }
   1.627 + 
   1.628 ++    patcher = _free(patcher);
   1.629 +     urlfn = _free(urlfn);
   1.630 +     return buf;
   1.631 + }
   1.632 +@@ -171,6 +189,7 @@
   1.633 +     struct Source *sp;
   1.634 +     rpmCompressedMagic compressed = COMPRESSED_NOT;
   1.635 +     int urltype;
   1.636 ++    const char *tar;
   1.637 + 
   1.638 +     for (sp = spec->sources; sp != NULL; sp = sp->next) {
   1.639 + 	if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) {
   1.640 +@@ -228,6 +255,10 @@
   1.641 + 	/*@notreached@*/ break;
   1.642 +     }
   1.643 + 
   1.644 ++    tar = rpmGetPath("%{_tarbin}", NULL);
   1.645 ++    if (strcmp(tar, "%{_tarbin}") == 0)
   1.646 ++        tar = "tar";
   1.647 ++
   1.648 +     if (compressed != COMPRESSED_NOT) {
   1.649 + 	const char *zipper;
   1.650 + 	int needtar = 1;
   1.651 +@@ -240,6 +271,7 @@
   1.652 + 	case COMPRESSED_BZIP2:
   1.653 + 	    t = "%{_bzip2bin} -dc";
   1.654 + 	    break;
   1.655 ++#if 0
   1.656 + 	case COMPRESSED_ZIP:
   1.657 + 	    if (rpmIsVerbose() && !quietly)
   1.658 + 		t = "%{_unzipbin}";
   1.659 +@@ -247,6 +279,7 @@
   1.660 + 		t = "%{_unzipbin} -qq";
   1.661 + 	    needtar = 0;
   1.662 + 	    break;
   1.663 ++#endif
   1.664 + 	}
   1.665 + 	zipper = rpmGetPath(t, NULL);
   1.666 + 	buf[0] = '\0';
   1.667 +@@ -254,8 +287,13 @@
   1.668 + 	zipper = _free(zipper);
   1.669 + 	*t++ = ' ';
   1.670 + 	t = stpcpy(t, fn);
   1.671 +-	if (needtar)
   1.672 +-	    t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -");
   1.673 ++	if (needtar) {
   1.674 ++	    t = stpcpy(t, " | ");
   1.675 ++            t = stpcpy(t, tar);
   1.676 ++            t = stpcpy(t, " ");
   1.677 ++            t = stpcpy(t, taropts);
   1.678 ++            t = stpcpy(t, " -");
   1.679 ++        }
   1.680 + 	t = stpcpy(t,
   1.681 + 		"\n"
   1.682 + 		"STATUS=$?\n"
   1.683 +@@ -264,11 +302,14 @@
   1.684 + 		"fi");
   1.685 +     } else {
   1.686 + 	buf[0] = '\0';
   1.687 +-	t = stpcpy( stpcpy(buf, "tar "), taropts);
   1.688 +-	*t++ = ' ';
   1.689 ++	t = stpcpy(buf, tar);
   1.690 ++	t = stpcpy(t, " ");
   1.691 ++	t = stpcpy(t, taropts);
   1.692 ++	t = stpcpy(t, " ");
   1.693 + 	t = stpcpy(t, fn);
   1.694 +     }
   1.695 + 
   1.696 ++    tar = _free(tar);
   1.697 +     urlfn = _free(urlfn);
   1.698 +     return buf;
   1.699 + }
   1.700 +@@ -443,7 +484,7 @@
   1.701 + 	/*@modifies spec->prep, rpmGlobalMacroContext,
   1.702 + 		fileSystem, internalState  @*/
   1.703 + {
   1.704 +-    char *opt_b;
   1.705 ++    char *opt_b, *opt_d;
   1.706 +     int opt_P, opt_p, opt_R, opt_E;
   1.707 +     char *s;
   1.708 +     char buf[BUFSIZ], *bp;
   1.709 +@@ -453,6 +494,7 @@
   1.710 +     memset(patch_nums, 0, sizeof(patch_nums));
   1.711 +     opt_P = opt_p = opt_R = opt_E = 0;
   1.712 +     opt_b = NULL;
   1.713 ++    opt_d = NULL;
   1.714 +     patch_index = 0;
   1.715 + 
   1.716 +     if (! strchr(" \t\n", line[6])) {
   1.717 +@@ -492,6 +534,15 @@
   1.718 + 			spec->lineNum, spec->line);
   1.719 + 		return RPMERR_BADSPEC;
   1.720 + 	    }
   1.721 ++	} else if (!strcmp(s, "-d")) {
   1.722 ++	    /* orig suffix */
   1.723 ++	    opt_d = strtok(NULL, " \t\n");
   1.724 ++	    if (! opt_d) {
   1.725 ++		rpmError(RPMERR_BADSPEC,
   1.726 ++			_("line %d: Need arg to %%patch -d: %s\n"),
   1.727 ++			spec->lineNum, spec->line);
   1.728 ++		return RPMERR_BADSPEC;
   1.729 ++	    }
   1.730 + 	} else if (!strncmp(s, "-p", sizeof("-p")-1)) {
   1.731 + 	    /* unfortunately, we must support -pX */
   1.732 + 	    if (! strchr(" \t\n", s[2])) {
   1.733 +@@ -530,14 +581,14 @@
   1.734 +     /* All args processed */
   1.735 + 
   1.736 +     if (! opt_P) {
   1.737 +-	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E);
   1.738 ++	s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E, opt_d);
   1.739 + 	if (s == NULL)
   1.740 + 	    return RPMERR_BADSPEC;
   1.741 + 	appendLineStringBuf(spec->prep, s);
   1.742 +     }
   1.743 + 
   1.744 +     for (x = 0; x < patch_index; x++) {
   1.745 +-	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
   1.746 ++	s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E, opt_d);
   1.747 + 	if (s == NULL)
   1.748 + 	    return RPMERR_BADSPEC;
   1.749 + 	appendLineStringBuf(spec->prep, s);
   1.750 +
   1.751 ++---------------------------------------------------------------------------
   1.752 +| Add support for splitted source directories, i.e., source files
   1.753 +| alternatively can be placed into the .spec directory and are picked
   1.754 +| up there, too.
   1.755 ++---------------------------------------------------------------------------
   1.756 +Index: build/parsePrep.c
   1.757 +--- build/parsePrep.c	7 Aug 2002 14:20:45 -0000	1.1.1.10
   1.758 ++++ build/parsePrep.c	6 Jun 2005 15:53:04 -0000	1.4
   1.759 +@@ -87,7 +88,15 @@
   1.760 + 	return NULL;
   1.761 +     }
   1.762 + 
   1.763 ++#ifndef OPENPKG
   1.764 +     urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   1.765 ++#else
   1.766 ++    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
   1.767 ++    if (access(urlfn, F_OK) == -1) {
   1.768 ++        urlfn = _free(urlfn);
   1.769 ++        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   1.770 ++    }
   1.771 ++#endif
   1.772 + 
   1.773 +     args[0] = '\0';
   1.774 +     if (db) {
   1.775 +@@ -182,7 +201,15 @@
   1.776 + 	return NULL;
   1.777 +     }
   1.778 + 
   1.779 ++#ifndef OPENPKG
   1.780 +     urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   1.781 ++#else
   1.782 ++    urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
   1.783 ++    if (access(urlfn, F_OK) == -1) {
   1.784 ++        urlfn = _free(urlfn);
   1.785 ++        urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
   1.786 ++    }
   1.787 ++#endif
   1.788 + 
   1.789 +     /*@-internalglobs@*/ /* FIX: shrug */
   1.790 +     taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
   1.791 +
   1.792 ++---------------------------------------------------------------------------
   1.793 +| Not everything on a system is RPM based (for instance OpenPKG is
   1.794 +| just an add-on to the system), so do not assume we can just require
   1.795 +| a package to provide "/bin/sh".
   1.796 ++---------------------------------------------------------------------------
   1.797 +Index: build/parseScript.c
   1.798 +--- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
   1.799 ++++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
   1.800 +@@ -261,6 +269,7 @@
   1.801 +     stripTrailingBlanksStringBuf(sb);
   1.802 +     p = getStringBuf(sb);
   1.803 + 
   1.804 ++    if (progArgv[0] != NULL && strcmp(progArgv[0], "/bin/sh") != 0)
   1.805 +     (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
   1.806 + 
   1.807 +     /* Trigger script insertion is always delayed in order to */
   1.808 +
   1.809 ++---------------------------------------------------------------------------
   1.810 +| Add support for splitted source directories, i.e., source files
   1.811 +| alternatively can be placed into the spec directory and are picked
   1.812 +| up there, too.
   1.813 ++---------------------------------------------------------------------------
   1.814 +Index: build/spec.c
   1.815 +--- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
   1.816 ++++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
   1.817 +@@ -334,7 +337,15 @@
   1.818 + 
   1.819 +     if (tag != RPMTAG_ICON) {
   1.820 + 	/*@-nullpass@*/		/* LCL: varargs needs null annotate. */
   1.821 ++#ifndef OPENPKG
   1.822 + 	const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.823 ++#else
   1.824 ++	const char *body = rpmGetPath("%{_specdir}/", p->source, NULL);
   1.825 ++    if (access(body, F_OK) == -1) {
   1.826 ++        body = _free(body);
   1.827 ++	    body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
   1.828 ++    }
   1.829 ++#endif
   1.830 + 	/*@=nullpass@*/
   1.831 + 
   1.832 + 	sprintf(buf, "%s%d",
   1.833 +
   1.834 ++---------------------------------------------------------------------------
   1.835 +| Do not build with warnings on, because we do no RPM development
   1.836 +| (so warnings are useless here), they cause some confusion inside
   1.837 +| Berkeley-DB and also slow down building. Instead, increase the
   1.838 +| optimization level. Additionally, disable static linking of RPM
   1.839 +| tools. Finally, use "shtool mkdir" as the "mkdir -p" fallback.
   1.840 ++---------------------------------------------------------------------------
   1.841 +Index: configure.ac
   1.842 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.843 ++++ configure.ac	13 Sep 2006 13:39:07 -0000
   1.844 +@@ -53,7 +53,7 @@
   1.845 + AS=${AS-as}
   1.846 + AC_SUBST(AS)
   1.847 + if test "$ac_cv_prog_gcc" = yes; then
   1.848 +-    CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
   1.849 ++    CFLAGS="$CFLAGS -O2 -D_GNU_SOURCE -D_REENTRANT"
   1.850 + fi
   1.851 + export CFLAGS
   1.852 + 
   1.853 +@@ -142,6 +142,7 @@
   1.854 + 	# just link it dynamically
   1.855 + 	LDFLAGS_STATIC=""
   1.856 + fi
   1.857 ++LDFLAGS_STATIC="" # OpenPKG wants dynamically linked RPM tools
   1.858 + LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"	# libtool format
   1.859 + AC_MSG_RESULT($LDFLAGS_STATIC)
   1.860 + AC_SUBST(LDFLAGS_STATIC)
   1.861 +@@ -201,7 +202,7 @@
   1.862 + 
   1.863 + if test X"$MKDIR_P" = X0 ; then
   1.864 + 	AC_MSG_RESULT(no)
   1.865 +-	MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
   1.866 ++	MKDIR_P="@l_prefix@/lib/openpkg/shtool mkdir -f -p -m 755"
   1.867 + else
   1.868 + 	AC_MSG_RESULT(yes)
   1.869 + fi
   1.870 +
   1.871 ++---------------------------------------------------------------------------
   1.872 +| Disable the use of the internal zlib library, because
   1.873 +| we build against an external one.
   1.874 ++---------------------------------------------------------------------------
   1.875 +Index: configure.ac
   1.876 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.877 ++++ configure.ac	13 Sep 2006 13:39:09 -0000
   1.878 +@@ -310,7 +311,7 @@
   1.879 + WITH_ZLIB_SUBDIR=
   1.880 + WITH_ZLIB_INCLUDE=
   1.881 + WITH_ZLIB_LIB=
   1.882 +-if test -d zlib ; then
   1.883 ++if false; then
   1.884 +   WITH_ZLIB_SUBDIR=zlib
   1.885 +   addlib \${top_builddir}/zlib
   1.886 +   WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
   1.887 +
   1.888 ++---------------------------------------------------------------------------
   1.889 +| Disable unnecessary INCPATH checks, because in OpenPKG the
   1.890 +| externally used libraries are all explicitly given. And they just
   1.891 +| would make RPM pick up things which we do not want to be picked up.
   1.892 ++---------------------------------------------------------------------------
   1.893 +Index: configure.ac
   1.894 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.895 ++++ configure.ac	13 Sep 2006 13:39:11 -0000
   1.896 +@@ -324,38 +325,38 @@
   1.897 + 
   1.898 + localdone=
   1.899 + 
   1.900 +-dirs=$prefix
   1.901 +-if test "$cross_compiling" != "yes"; then
   1.902 +-  dirs="$dirs /usr/local"
   1.903 +-fi
   1.904 +-for dir in $dirs
   1.905 +-do
   1.906 +-	case $dir in
   1.907 +-	NONE|/usr)	continue;;
   1.908 +-	/usr/local)
   1.909 +-		if test X$localdone != X ; then continue; fi
   1.910 +-		localdone="$dir"
   1.911 +-		;;
   1.912 +-	esac
   1.913 +-
   1.914 +-	AC_MSG_CHECKING(for $dir/lib in LIBS)
   1.915 +-	if test -d $dir/lib 2> /dev/null ; then
   1.916 +-		addlib $dir/lib
   1.917 +-		AC_MSG_RESULT(yes)
   1.918 +-	else
   1.919 +-		AC_MSG_RESULT(no)
   1.920 +-	fi
   1.921 +-
   1.922 +-	AC_MSG_CHECKING(for $dir/include in INCPATH)
   1.923 +-	if test -d $dir/include 2>/dev/null ; then
   1.924 +-		if [ "$dir" != "/usr/local" ] ; then
   1.925 +-		    INCPATH="$INCPATH -I$dir/include"
   1.926 +-		fi
   1.927 +-		AC_MSG_RESULT(yes)
   1.928 +-	else
   1.929 +-		AC_MSG_RESULT(no)
   1.930 +-	fi
   1.931 +-done
   1.932 ++dnl dirs=$prefix
   1.933 ++dnl if test "$cross_compiling" != "yes"; then
   1.934 ++dnl   dirs="$dirs /usr/local"
   1.935 ++dnl fi
   1.936 ++dnl for dir in $dirs
   1.937 ++dnl do
   1.938 ++dnl 	case $dir in
   1.939 ++dnl 	NONE|/usr)	continue;;
   1.940 ++dnl 	/usr/local)
   1.941 ++dnl 		if test X$localdone != X ; then continue; fi
   1.942 ++dnl 		localdone="$dir"
   1.943 ++dnl 		;;
   1.944 ++dnl 	esac
   1.945 ++dnl 
   1.946 ++dnl 	AC_MSG_CHECKING(for $dir/lib in LIBS)
   1.947 ++dnl 	if test -d $dir/lib 2> /dev/null ; then
   1.948 ++dnl 		addlib $dir/lib
   1.949 ++dnl 		AC_MSG_RESULT(yes)
   1.950 ++dnl 	else
   1.951 ++dnl 		AC_MSG_RESULT(no)
   1.952 ++dnl 	fi
   1.953 ++dnl 
   1.954 ++dnl 	AC_MSG_CHECKING(for $dir/include in INCPATH)
   1.955 ++dnl 	if test -d $dir/include 2>/dev/null ; then
   1.956 ++dnl 		if test "$dir" != "/usr/local"; then
   1.957 ++dnl 		    INCPATH="$INCPATH -I$dir/include"
   1.958 ++dnl 		fi
   1.959 ++dnl 		AC_MSG_RESULT(yes)
   1.960 ++dnl 	else
   1.961 ++dnl 		AC_MSG_RESULT(no)
   1.962 ++dnl 	fi
   1.963 ++dnl done
   1.964 + 
   1.965 + AC_MSG_CHECKING(for /usr/ucblib in LIBS)
   1.966 + if test -d /usr/ucblib ; then
   1.967 +
   1.968 ++---------------------------------------------------------------------------
   1.969 +| Adjust paths for OpenPKG filesystem layout.
   1.970 ++---------------------------------------------------------------------------
   1.971 +Index: configure.ac
   1.972 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.973 ++++ configure.ac	13 Sep 2006 13:39:12 -0000
   1.974 +@@ -1200,12 +1202,12 @@
   1.975 + AC_SUBST(LOCALEDIR)
   1.976 + LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
   1.977 + AC_SUBST(LIBDIR)
   1.978 +-RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
   1.979 ++RPMCONFIGDIR="@l_prefix@/lib/openpkg"
   1.980 + AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
   1.981 + 	[Full path to rpm global configuration directory (usually /usr/lib/rpm)])
   1.982 + AC_SUBST(RPMCONFIGDIR)
   1.983 + 
   1.984 +-SYSCONFIGDIR="`echo /etc/rpm`"
   1.985 ++SYSCONFIGDIR="@l_prefix@/etc/openpkg"
   1.986 + AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR",
   1.987 + 	[Full path to rpm system configuration directory (usually /etc/rpm)])
   1.988 + AC_SUBST(SYSCONFIGDIR)
   1.989 +@@ -1215,17 +1217,17 @@
   1.990 + 	[Colon separated paths of macro files to read.])
   1.991 + AC_SUBST(MACROFILES)
   1.992 + 
   1.993 +-LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
   1.994 ++LIBRPMRC_FILENAME="${SYSCONFIGDIR}/rpmrc"
   1.995 + AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME",
   1.996 + 	[Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)])
   1.997 + AC_SUBST(LIBRPMRC_FILENAME)
   1.998 + 
   1.999 +-VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
  1.1000 ++VENDORRPMRC_FILENAME="${SYSCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
  1.1001 + AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
  1.1002 +        [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
  1.1003 + AC_SUBST(VENDORRPMRC_FILENAME)
  1.1004 + 
  1.1005 +-LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
  1.1006 ++LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
  1.1007 + AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME",
  1.1008 + 	[Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)])
  1.1009 + AC_SUBST(LIBRPMALIAS_FILENAME)
  1.1010 +
  1.1011 ++---------------------------------------------------------------------------
  1.1012 +| If running as "susr", do not unpack source RPM packages with "susr"
  1.1013 +| file ownerships as the OpenPKG Set-UID wrapper switches from "musr"
  1.1014 +| to "susr" on "openpkg rpm -Uvh *.src.rpm". As a result the installed
  1.1015 +| files could be never removed again by "musr". It is more consistent
  1.1016 +| to always unpack as "musr" if possible.
  1.1017 ++---------------------------------------------------------------------------
  1.1018 +Index: lib/psm.c
  1.1019 +--- lib/psm.c	5 Jun 2003 12:43:18 -0000	1.1.1.6
  1.1020 ++++ lib/psm.c	13 Sep 2006 13:39:15 -0000
  1.1021 +@@ -314,6 +314,20 @@
  1.1022 + 
  1.1023 +     fi->uid = getuid();
  1.1024 +     fi->gid = getgid();
  1.1025 ++#ifdef OPENPKG
  1.1026 ++    if (fi->uid == 0) {
  1.1027 ++        char *muid_str;
  1.1028 ++        char *mgid_str;
  1.1029 ++        uid_t *muid;
  1.1030 ++        gid_t *mgid;
  1.1031 ++        if ((muid_str = rpmExpand("%{l_muid}", NULL)) != NULL)
  1.1032 ++            if ((muid = (uid_t)strtol(muid_str, (char **)NULL, 10)) > 0)
  1.1033 ++                fi->uid = muid;
  1.1034 ++        if ((mgid_str = rpmExpand("%{l_mgid}", NULL)) != NULL)
  1.1035 ++            if ((mgid = (gid_t)strtol(mgid_str, (char **)NULL, 10)) > 0)
  1.1036 ++                fi->gid = mgid;
  1.1037 ++    }
  1.1038 ++#endif
  1.1039 +     fi->astriplen = 0;
  1.1040 +     fi->striplen = 0;
  1.1041 + 
  1.1042 +@@ -352,6 +366,9 @@
  1.1043 + 	rpmrc = RPMRC_FAIL;
  1.1044 + 	goto exit;
  1.1045 +     }
  1.1046 ++#ifdef OPENPKG
  1.1047 ++    chown(_sourcedir, fi->uid, fi->gid);
  1.1048 ++#endif
  1.1049 + 
  1.1050 +     _specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
  1.1051 +     rpmrc = rpmMkdirPath(_specdir, "specdir");
  1.1052 +@@ -359,6 +376,9 @@
  1.1053 + 	rpmrc = RPMRC_FAIL;
  1.1054 + 	goto exit;
  1.1055 +     }
  1.1056 ++#ifdef OPENPKG
  1.1057 ++    chown(_specdir, fi->uid, fi->gid);
  1.1058 ++#endif
  1.1059 + 
  1.1060 +     /* Build dnl/dil with {_sourcedir, _specdir} as values. */
  1.1061 +     if (i < fi->fc) {
  1.1062 +
  1.1063 ++---------------------------------------------------------------------------
  1.1064 +| RPM has two platform id canonicalizations: hard-coded ones in
  1.1065 +| the "rpm" program and defined ones in the rpmrc files. The
  1.1066 +| hard-coded ones make the defined ones inconsistent. Additionally,
  1.1067 +| in OpenPKG we know exactly what we do. So, disable the hard-coded
  1.1068 +| canonicalizations and use only the defined ones. The only thing we
  1.1069 +| do inside RPM is to reduce the platform version to major and minor
  1.1070 +| version numbers in order to simplify the "rpmrc" files. Then, RPM
  1.1071 +| allows to read the platform from an external program. Adjust the
  1.1072 +| hard-coded path to this program and allow it to be overridden with
  1.1073 +| the macro %{__platform}. Finally, change the default definition of
  1.1074 +| %{_host} to not contain the vendor stuff to more conform to what
  1.1075 +| %{_target} usually is defined to and what we are using throughout
  1.1076 +| OpenPKG, too.
  1.1077 ++---------------------------------------------------------------------------
  1.1078 +Index: lib/rpmrc.c
  1.1079 +--- lib/rpmrc.c	4 Jun 2003 18:18:45 -0000	1.1.1.25
  1.1080 ++++ lib/rpmrc.c	6 Jun 2005 15:53:06 -0000	1.3
  1.1081 +@@ -27,7 +27,7 @@
  1.1082 + const char * macrofiles = MACROFILES;
  1.1083 + 
  1.1084 + /*@observer@*/ /*@unchecked@*/
  1.1085 +-static const char * platform = "/etc/rpm/platform";
  1.1086 ++static const char * platform = "@l_prefix@/etc/openpkg/platform";
  1.1087 + /*@only@*/ /*@relnull@*/ /*@unchecked@*/
  1.1088 + static const char ** platpat = NULL;
  1.1089 + /*@unchecked@*/
  1.1090 +@@ -861,7 +861,11 @@
  1.1091 + 
  1.1092 + 	platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat));
  1.1093 + /*@-onlyunqglobaltrans@*/
  1.1094 ++#ifdef OPENPKG
  1.1095 ++	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_os}", NULL);
  1.1096 ++#else
  1.1097 + 	platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}", (gnu && *gnu ? "-" : NULL), gnu, NULL);
  1.1098 ++#endif
  1.1099 + 	nplatpat++;
  1.1100 + 	platpat[nplatpat] = NULL;
  1.1101 + /*@=onlyunqglobaltrans@*/
  1.1102 +@@ -1055,14 +1059,35 @@
  1.1103 + 	/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
  1.1104 + 	/*@modifies *arch, *os, rpmGlobalMacroContext, fileSystem, internalState @*/
  1.1105 + {
  1.1106 ++#ifdef OPENPKG
  1.1107 ++    static struct utsname un_real;
  1.1108 ++    /* utsname fields on some platforms (like HP-UX) are very small
  1.1109 ++       (about 8 characters). This is too small for OpenPKG, so cheat! */
  1.1110 ++    static struct {
  1.1111 ++        char sysname[32];
  1.1112 ++        char nodename[32];
  1.1113 ++        char release[32];
  1.1114 ++        char version[32];
  1.1115 ++        char machine[32];
  1.1116 ++    } un;
  1.1117 ++#else
  1.1118 +     static struct utsname un;
  1.1119 ++#endif
  1.1120 +     static int gotDefaults = 0;
  1.1121 +     char * chptr;
  1.1122 +     canonEntry canon;
  1.1123 +     int rc;
  1.1124 + 
  1.1125 +     while (!gotDefaults) {
  1.1126 ++#ifdef OPENPKG
  1.1127 ++	const char *cp;
  1.1128 ++	cp = rpmExpand("%{?__platform}", NULL);
  1.1129 ++    if (cp == NULL || cp[0] == '\0')
  1.1130 ++	    cp = platform;
  1.1131 ++	if (!rpmPlatform(cp)) {
  1.1132 ++#else
  1.1133 + 	if (!rpmPlatform(platform)) {
  1.1134 ++#endif
  1.1135 + 	    const char * s;
  1.1136 + 	    s = rpmExpand("%{_host_cpu}", NULL);
  1.1137 + 	    if (s) {
  1.1138 +@@ -1079,9 +1104,44 @@
  1.1139 + 	    gotDefaults = 1;
  1.1140 + 	    break;
  1.1141 + 	}
  1.1142 ++#ifdef OPENPKG
  1.1143 ++	rc = uname(&un_real);
  1.1144 ++        strncpy(un.sysname,  un_real.sysname,  sizeof(un.sysname));  un.sysname [sizeof(un.sysname)-1]  = '\0';
  1.1145 ++        strncpy(un.nodename, un_real.nodename, sizeof(un.nodename)); un.nodename[sizeof(un.nodename)-1] = '\0';
  1.1146 ++        strncpy(un.release,  un_real.release,  sizeof(un.release));  un.release [sizeof(un.release)-1]  = '\0';
  1.1147 ++        strncpy(un.version,  un_real.version,  sizeof(un.version));  un.version [sizeof(un.version)-1]  = '\0';
  1.1148 ++        strncpy(un.machine,  un_real.machine,  sizeof(un.machine));  un.machine [sizeof(un.machine)-1]  = '\0';
  1.1149 ++#else
  1.1150 + 	rc = uname(&un);
  1.1151 ++#endif
  1.1152 + 	if (rc < 0) return;
  1.1153 + 
  1.1154 ++#ifdef OPENPKG
  1.1155 ++    {
  1.1156 ++        char *cp;
  1.1157 ++        char *cpR;
  1.1158 ++        int n;
  1.1159 ++        cpR = un.release;
  1.1160 ++        if ((n = strcspn(cpR, "0123456789")) > 0)
  1.1161 ++            cpR += n;
  1.1162 ++        if ((n = strspn(cpR, "0123456789.")) > 0) {
  1.1163 ++            /* terminate after "N.N.N...." prefix */
  1.1164 ++            cpR[n] = '\0';
  1.1165 ++            /* shorten to "N.N" if longer */
  1.1166 ++            if ((cp = strchr(cpR, '.')) != NULL) {
  1.1167 ++                if ((cp = strchr(cp+1, '.')) != NULL)
  1.1168 ++                    *cp = '\0';
  1.1169 ++            }
  1.1170 ++            strcat(un.sysname, cpR);
  1.1171 ++        }
  1.1172 ++        /* fix up machine hardware name containing white-space as it
  1.1173 ++         * happens to be on Power Macs running MacOS X
  1.1174 ++         */
  1.1175 ++        if (!strncmp(un.machine, "Power Macintosh", 15)) {
  1.1176 ++            sprintf(un.machine, "powerpc");
  1.1177 ++        }
  1.1178 ++    }
  1.1179 ++#else /* OPENPKG */
  1.1180 + #if !defined(__linux__)
  1.1181 + #ifdef SNI
  1.1182 + 	/* USUALLY un.sysname on sinix does start with the word "SINIX"
  1.1183 +@@ -1298,6 +1358,7 @@
  1.1184 + 	    }
  1.1185 + 	}
  1.1186 + #	endif
  1.1187 ++#endif /* OPENPKG */
  1.1188 + 
  1.1189 + 	/* the uname() result goes through the arch_canon table */
  1.1190 + 	canon = lookupInCanonTable(un.machine,
  1.1191 +
  1.1192 ++---------------------------------------------------------------------------
  1.1193 +| In verbose file listing output, give the owner and group fields more
  1.1194 +| width and at the same time reduce the nlink and size fields to more
  1.1195 +| typical sizes within OpenPKG.
  1.1196 ++---------------------------------------------------------------------------
  1.1197 +Index: lib/query.c
  1.1198 +--- lib/query.c	4 Jun 2003 18:24:14 -0000	1.1.1.13
  1.1199 ++++ lib/query.c	22 Jan 2004 21:42:24 -0000	1.2
  1.1200 +@@ -33,7 +33,11 @@
  1.1201 + 	/*@modifies *te @*/
  1.1202 + {
  1.1203 +     char sizefield[15];
  1.1204 ++#ifdef OPENPKG
  1.1205 ++    char ownerfield[13+1], groupfield[13+1];
  1.1206 ++#else
  1.1207 +     char ownerfield[8+1], groupfield[8+1];
  1.1208 ++#endif
  1.1209 +     char timefield[100];
  1.1210 +     time_t when = mtime;  /* important if sizeof(int_32) ! sizeof(time_t) */
  1.1211 +     struct tm * tm;
  1.1212 +@@ -58,7 +62,11 @@
  1.1213 +     groupfield[sizeof(groupfield)-1] = '\0';
  1.1214 + 
  1.1215 +     /* this is normally right */
  1.1216 ++#ifdef OPENPKG
  1.1217 ++    sprintf(sizefield, "%8u", size);
  1.1218 ++#else
  1.1219 +     sprintf(sizefield, "%12u", size);
  1.1220 ++#endif
  1.1221 + 
  1.1222 +     /* this knows too much about dev_t */
  1.1223 + 
  1.1224 +@@ -98,7 +106,11 @@
  1.1225 + 	(void)strftime(timefield, sizeof(timefield) - 1, fmt, tm);
  1.1226 +     }
  1.1227 + 
  1.1228 ++#ifdef OPENPKG
  1.1229 ++    sprintf(te, "%s %d %-13s %-13s %8s %s %s", perms,
  1.1230 ++#else
  1.1231 +     sprintf(te, "%s %4d %-8s%-8s %10s %s %s", perms,
  1.1232 ++#endif
  1.1233 + 	(int)nlink, ownerfield, groupfield, sizefield, timefield, namefield);
  1.1234 +     perms = _free(perms);
  1.1235 + }
  1.1236 +
  1.1237 ++---------------------------------------------------------------------------
  1.1238 +| Enable the exlusion of "%doc" files by default.
  1.1239 +| Disable "check-files" feature, because it is useless in OpenPKG
  1.1240 +| (we consistently use BuildRoot and our %files lists are fully
  1.1241 +| autogenerated) and just makes problems on bootstrapping.
  1.1242 +| Provide the possibility to optionally re-enable the old
  1.1243 +| RPM 4.0.2 way of RPM database operation by defining the
  1.1244 +| macro %{_rpmdb_private}. This is important for easily fixing
  1.1245 +| corrupted/hanging RPM database (on upgrades, etc) or if you
  1.1246 +| permanently have to operate RPM on a NFS filesystem where no
  1.1247 +| rpc.lockd(8) support is available.
  1.1248 +| Additionally, do not override the "_host_xx" macros because their
  1.1249 +| value (derived from <prefix>/etc/openpkg/platform) is already
  1.1250 +| correctly set internally.
  1.1251 +| Additionally, provide default macros for the %track and %test
  1.1252 +| section expansion.
  1.1253 +| Finally, provide default for introduced variable
  1.1254 +| %{_force_oldpackage}, which, if non-zero, automatically enforces
  1.1255 +| --oldpackage on all upgrade operations (this is useful on
  1.1256 +| mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE).
  1.1257 ++---------------------------------------------------------------------------
  1.1258 +Index: macros.in
  1.1259 +--- macros.in	2 Jul 2003 19:20:52 -0000	1.1.1.14
  1.1260 ++++ macros.in	30 Jan 2004 17:06:27 -0000	1.3
  1.1261 +@@ -1,7 +1,7 @@
  1.1262 + #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
  1.1263 + # \verbatim
  1.1264 + #
  1.1265 +-# $Id: macros.in,v 1.138.2.1 2003/07/02 19:14:06 jbj Exp $
  1.1266 ++# $Id: macros.in,v 1.2 2004/01/22 21:42:09 rse Exp $
  1.1267 + #
  1.1268 + # This is a global RPM configuration file. All changes made here will
  1.1269 + # be lost when the rpm package is upgraded. Any per-system configuration
  1.1270 +@@ -206,7 +206,7 @@
  1.1271 + 
  1.1272 + #	Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
  1.1273 + #	marked as %doc should be installed.
  1.1274 +-#%_excludedocs
  1.1275 ++%_excludedocs 1
  1.1276 + 
  1.1277 + #	The port and machine name of a FTP proxy host running TIS firewall.
  1.1278 + #
  1.1279 +@@ -305,7 +305,7 @@
  1.1280 + # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
  1.1281 + #
  1.1282 + # Note: Disable (by commenting out) for legacy compatibility.
  1.1283 +-%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
  1.1284 ++#%__check_files         @RPMCONFIGDIR@/check-files %{buildroot}
  1.1285 + 
  1.1286 + #
  1.1287 + # Should unpackaged files in a build root terminate a build?
  1.1288 +@@ -449,7 +449,7 @@
  1.1289 + 
  1.1290 + # Use a CDB database model for concurrent access.
  1.1291 + # XXX Add "private" here for legacy interoperation transiting to glibc+nptl.
  1.1292 +-%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb
  1.1293 ++%__dbi_cdb			create cdb mpool mp_mmapsize=16Mb mp_size=1Mb %{?_rpmdb_private:private}
  1.1294 + 
  1.1295 + %__dbi_other			%{?_tmppath:tmpdir=%{_tmppath}} %{?__dbi_cdb}
  1.1296 + 
  1.1297 +@@ -618,6 +618,10 @@
  1.1298 + #	If non-zero, all erasures will be automagically repackaged.
  1.1299 + %_repackage_all_erasures	0
  1.1300 + 
  1.1301 ++#   If non-zero, automatically enforce --oldpackage for all upgrade operations
  1.1302 ++#   (useful on mass-upgrades from OpenPKG-CURRENT to OpenPKG-RELEASE)
  1.1303 ++%_force_oldpackage          0
  1.1304 ++
  1.1305 + #	Verify digest/signature flags for various rpm modes:
  1.1306 + #	     1	--nohdrchk	if set, don't check rpmdb headers
  1.1307 + #
  1.1308 +@@ -870,6 +874,26 @@
  1.1309 + #%{__spec_clean_post}\
  1.1310 + #%{nil}
  1.1311 + 
  1.1312 ++%__spec_track_shell    %{___build_shell}
  1.1313 ++%__spec_track_args     %{___build_args}
  1.1314 ++%__spec_track_cmd      %{___build_cmd}
  1.1315 ++%__spec_track_pre      %{___build_pre}
  1.1316 ++%__spec_track_body     %{___build_body}
  1.1317 ++%__spec_track_post     %{___build_post}
  1.1318 ++%__spec_track_template #!%{__spec_track_shell}\
  1.1319 ++%{__spec_track_pre}\
  1.1320 ++%{nil}
  1.1321 ++
  1.1322 ++%__spec_test_shell    %{___build_shell}
  1.1323 ++%__spec_test_args     %{___build_args}
  1.1324 ++%__spec_test_cmd      %{___build_cmd}
  1.1325 ++%__spec_test_pre      %{___build_pre}
  1.1326 ++%__spec_test_body     %{___build_body}
  1.1327 ++%__spec_test_post     %{___build_post}
  1.1328 ++%__spec_test_template #!%{__spec_test_shell}\
  1.1329 ++%{__spec_test_pre}\
  1.1330 ++%{nil}
  1.1331 ++
  1.1332 + %__spec_rmbuild_shell	%{___build_shell}
  1.1333 + %__spec_rmbuild_args	%{___build_args}
  1.1334 + %__spec_rmbuild_cmd	%{___build_cmd}
  1.1335 +@@ -929,11 +953,11 @@
  1.1336 + %_build_cpu		%{_host_cpu}
  1.1337 + %_build_vendor		%{_host_vendor}
  1.1338 + %_build_os		%{_host_os}
  1.1339 +-%_host			@host@
  1.1340 +-%_host_alias		@host_alias@%{nil}
  1.1341 +-%_host_cpu		@host_cpu@
  1.1342 +-%_host_vendor		@host_vendor@
  1.1343 +-%_host_os		@host_os@
  1.1344 ++#%_host			@host@
  1.1345 ++#%_host_alias		@host_alias@%{nil}
  1.1346 ++#%_host_cpu		@host_cpu@
  1.1347 ++#%_host_vendor		@host_vendor@
  1.1348 ++#%_host_os		@host_os@
  1.1349 + %_target		%{_host}
  1.1350 + %_target_alias		%{_host_alias}
  1.1351 + %_target_cpu		%{_host_cpu}
  1.1352 +
  1.1353 ++---------------------------------------------------------------------------
  1.1354 +| Adjust path for OpenPKG filesystem layout.
  1.1355 ++---------------------------------------------------------------------------
  1.1356 +Index: scripts/Makefile.am
  1.1357 +--- scripts/Makefile.am	20 Jun 2003 19:04:49 -0000	1.1.1.11
  1.1358 ++++ scripts/Makefile.am	22 Jan 2004 21:42:34 -0000	1.2
  1.1359 +@@ -22,7 +22,7 @@
  1.1360 + 
  1.1361 + all:
  1.1362 + 
  1.1363 +-configdir = ${prefix}/lib/rpm
  1.1364 ++configdir = ${prefix}/lib/openpkg
  1.1365 + config_SCRIPTS = \
  1.1366 + 	brp-compress brp-python-bytecompile brp-redhat \
  1.1367 + 	brp-strip brp-strip-comment-note \
  1.1368 +
  1.1369 ++---------------------------------------------------------------------------
  1.1370 +| Adjust path for OpenPKG filesystem layout.
  1.1371 ++---------------------------------------------------------------------------
  1.1372 +Index: scripts/Makefile.in
  1.1373 +--- scripts/Makefile.in	16 Jul 2003 17:05:49 -0000	1.1.1.14
  1.1374 ++++ scripts/Makefile.in	22 Jan 2004 21:42:34 -0000	1.2
  1.1375 +@@ -273,7 +273,7 @@
  1.1376 + 
  1.1377 + installprefix = $(DESTDIR)
  1.1378 + 
  1.1379 +-configdir = ${prefix}/lib/rpm
  1.1380 ++configdir = ${prefix}/lib/openpkg
  1.1381 + config_SCRIPTS = \
  1.1382 + 	brp-compress brp-python-bytecompile brp-redhat \
  1.1383 + 	brp-strip brp-strip-comment-note \
  1.1384 +
  1.1385 ++---------------------------------------------------------------------------
  1.1386 +| Use GNU libtool's weaker -static (link with own static libraries)
  1.1387 +| instead of the strong -all-static (link even with static libc, etc),
  1.1388 +| because OpenPKG does not need to be fully static.
  1.1389 +| Additionally, adjust the path to file(1)'s "magic" file.
  1.1390 ++---------------------------------------------------------------------------
  1.1391 +Index: file/Makefile.am
  1.1392 +--- file/Makefile.am	24 Jan 2003 19:41:56 -0000	1.1.1.1
  1.1393 ++++ file/Makefile.am	22 Jan 2004 21:42:21 -0000	1.2
  1.1394 +@@ -36,7 +36,7 @@
  1.1395 + #MAGIC	 = @datadir@/magic
  1.1396 + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1.1397 + 
  1.1398 +-pkglibdir =  @prefix@/lib/rpm
  1.1399 ++pkglibdir =  @prefix@/lib/openpkg
  1.1400 + pkglib_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1.1401 + MAGIC	 = $(pkglibdir)/magic
  1.1402 + CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  1.1403 +
  1.1404 ++---------------------------------------------------------------------------
  1.1405 +| Use GNU libtool's weaker -static (link with own static libraries)
  1.1406 +| instead of the strong -all-static (link even with static libc, etc),
  1.1407 +| because OpenPKG does not need to be fully static.
  1.1408 +| Additionally, adjust the path to file(1)'s "magic" file.
  1.1409 ++---------------------------------------------------------------------------
  1.1410 +Index: file/Makefile.in
  1.1411 +--- file/Makefile.in	16 Jul 2003 17:05:23 -0000	1.1.1.2
  1.1412 ++++ file/Makefile.in	22 Jan 2004 21:42:22 -0000	1.2
  1.1413 +@@ -39,7 +39,7 @@
  1.1414 + 
  1.1415 + #MAGIC	 = @datadir@/magic
  1.1416 + #data_DATA = magic magic.mime magic.mgc magic.mime.mgc
  1.1417 +-pkglibdir = @prefix@/lib/rpm
  1.1418 ++pkglibdir = @prefix@/lib/openpkg
  1.1419 + ACLOCAL = @ACLOCAL@
  1.1420 + AMDEP_FALSE = @AMDEP_FALSE@
  1.1421 + AMDEP_TRUE = @AMDEP_TRUE@
  1.1422 +@@ -159,7 +159,7 @@
  1.1423 + noinst_PROGRAMS = file
  1.1424 + 
  1.1425 + file_SOURCES = file.c
  1.1426 +-file_LDFLAGS = -all-static
  1.1427 ++file_LDFLAGS = -static
  1.1428 + file_LDADD = libfmagic.la
  1.1429 + 
  1.1430 + man_MAGIC = magic.@fsect@
  1.1431 +
  1.1432 ++---------------------------------------------------------------------------
  1.1433 +| Use GNU libtool's weaker -static (link with own static libraries)
  1.1434 +| instead of the strong -all-static (link even with static libc, etc),
  1.1435 +| because OpenPKG does not need to be fully static.
  1.1436 +| Additionally, disable the building of gettext stuff we don't need.
  1.1437 ++---------------------------------------------------------------------------
  1.1438 +Index: popt/Makefile.am
  1.1439 +--- popt/Makefile.am	6 Mar 2003 23:16:43 -0000	1.1.1.9
  1.1440 ++++ popt/Makefile.am	22 Jan 2004 21:42:28 -0000	1.2
  1.1441 +@@ -9,7 +9,7 @@
  1.1442 + 	po/*.in po/*.po po/popt.pot \
  1.1443 + 	popt.ps
  1.1444 + 
  1.1445 +-SUBDIRS = intl po
  1.1446 ++SUBDIRS = intl
  1.1447 + 
  1.1448 + INCLUDES = -I. -I$(top_srcdir)
  1.1449 + 
  1.1450 +@@ -17,13 +17,13 @@
  1.1451 + 
  1.1452 + noinst_PROGRAMS = test1 test2 test3
  1.1453 + test1_SOURCES = test1.c
  1.1454 +-test1_LDFLAGS = -all-static
  1.1455 ++test1_LDFLAGS = -static
  1.1456 + test1_LDADD = $(usrlib_LTLIBRARIES)
  1.1457 + test2_SOURCES = test2.c
  1.1458 +-test2_LDFLAGS = -all-static
  1.1459 ++test2_LDFLAGS = -static
  1.1460 + test2_LDADD = $(usrlib_LTLIBRARIES)
  1.1461 + test3_SOURCES = test3.c
  1.1462 +-test3_LDFLAGS = -all-static
  1.1463 ++test3_LDFLAGS = -static
  1.1464 + test3_LDADD = $(usrlib_LTLIBRARIES)
  1.1465 + 
  1.1466 + noinst_SCRIPTS = testit.sh
  1.1467 +
  1.1468 ++---------------------------------------------------------------------------
  1.1469 +| Use GNU libtool's weaker -static (link with own static libraries)
  1.1470 +| instead of the strong -all-static (link even with static libc, etc),
  1.1471 +| because OpenPKG does not need to be fully static.
  1.1472 +| Additionally, disable the building of gettext stuff we don't need.
  1.1473 ++---------------------------------------------------------------------------
  1.1474 +Index: popt/Makefile.in
  1.1475 +--- popt/Makefile.in	16 Jul 2003 17:04:49 -0000	1.1.1.14
  1.1476 ++++ popt/Makefile.in	22 Jan 2004 21:42:28 -0000	1.2
  1.1477 +@@ -163,7 +163,7 @@
  1.1478 + 	popt.ps
  1.1479 + 
  1.1480 + 
  1.1481 +-SUBDIRS = intl po
  1.1482 ++SUBDIRS = intl
  1.1483 + 
  1.1484 + INCLUDES = -I. -I$(top_srcdir)
  1.1485 + 
  1.1486 +@@ -171,13 +171,13 @@
  1.1487 + 
  1.1488 + noinst_PROGRAMS = test1 test2 test3
  1.1489 + test1_SOURCES = test1.c
  1.1490 +-test1_LDFLAGS = -all-static
  1.1491 ++test1_LDFLAGS = -static
  1.1492 + test1_LDADD = $(usrlib_LTLIBRARIES)
  1.1493 + test2_SOURCES = test2.c
  1.1494 +-test2_LDFLAGS = -all-static
  1.1495 ++test2_LDFLAGS = -static
  1.1496 + test2_LDADD = $(usrlib_LTLIBRARIES)
  1.1497 + test3_SOURCES = test3.c
  1.1498 +-test3_LDFLAGS = -all-static
  1.1499 ++test3_LDFLAGS = -static
  1.1500 + test3_LDADD = $(usrlib_LTLIBRARIES)
  1.1501 + 
  1.1502 + noinst_SCRIPTS = testit.sh
  1.1503 +
  1.1504 ++---------------------------------------------------------------------------
  1.1505 +| Revert back to the old behaviour of passing to "exec" programs an
  1.1506 +| extra "--" argument to separate options and arguments. Additionally,
  1.1507 +| allow the "!#:+" constructs to be used multiple times and then each
  1.1508 +| time eat another argument (instead of just eating an argument once
  1.1509 +| and expanding this multiple times).
  1.1510 ++---------------------------------------------------------------------------
  1.1511 +Index: popt/popt.c
  1.1512 +--- popt/popt.c	22 Aug 2002 14:17:44 -0000	1.1.1.12
  1.1513 ++++ popt/popt.c	22 Jan 2004 21:42:28 -0000	1.2
  1.1514 +@@ -400,9 +400,7 @@
  1.1515 +     }
  1.1516 + 
  1.1517 +     if (con->leftovers != NULL && con->numLeftovers > 0) {
  1.1518 +-#if 0
  1.1519 + 	argv[argc++] = "--";
  1.1520 +-#endif
  1.1521 + 	memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
  1.1522 + 	argc += con->numLeftovers;
  1.1523 +     }
  1.1524 +@@ -580,10 +578,8 @@
  1.1525 + 	    if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
  1.1526 + 		/*@switchbreak@*/ break;
  1.1527 + 	    /* XXX Make sure that findNextArg deletes only next arg. */
  1.1528 +-	    if (a == NULL) {
  1.1529 + 		if ((a = findNextArg(con, 1, 1)) == NULL)
  1.1530 + 		    /*@switchbreak@*/ break;
  1.1531 +-	    }
  1.1532 + 	    s += 3;
  1.1533 + 
  1.1534 + 	    alen = strlen(a);
  1.1535 +
  1.1536 ++---------------------------------------------------------------------------
  1.1537 +| Dedefine the stdio variable BUFSIZ because it is usually just 1024
  1.1538 +| on some platforms (on Linux it is 8192) and unfortunately RPM uses
  1.1539 +| it here for the macro expansion buffer. For OpenPKG the size 1024 is
  1.1540 +| definetely too small. So increase this to a 16KB buffer.
  1.1541 ++---------------------------------------------------------------------------
  1.1542 +Index: rpmio/macro.c
  1.1543 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1.1544 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1.1545 +@@ -50,6 +50,9 @@
  1.1546 + 
  1.1547 + #include "debug.h"
  1.1548 + 
  1.1549 ++#undef  BUFSIZ
  1.1550 ++#define BUFSIZ 16384
  1.1551 ++
  1.1552 + #if defined(__LCLINT__)
  1.1553 + /*@-exportheader@*/
  1.1554 + extern const unsigned short int **__ctype_b_loc (void) /*@*/;
  1.1555 +
  1.1556 ++---------------------------------------------------------------------------
  1.1557 +| Remove "unzip" support, because in OpenPKG there are less than
  1.1558 +| a dozend packages requiring unpacking of .zip files. For these
  1.1559 +| it is fully sufficient to explicitly require the "infozip"
  1.1560 +| package (containing "unzip") and leaving the less portable
  1.1561 +| "unzip" out of the bootstrap package.
  1.1562 ++---------------------------------------------------------------------------
  1.1563 +Index: rpmio/macro.c
  1.1564 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1.1565 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1.1566 +@@ -1114,9 +1119,11 @@
  1.1567 + 	case 2:	/* COMPRESSED_BZIP2 */
  1.1568 + 	    sprintf(be, "%%_bzip2 %s", b);
  1.1569 + 	    break;
  1.1570 ++#if 0
  1.1571 + 	case 3:	/* COMPRESSED_ZIP */
  1.1572 + 	    sprintf(be, "%%_unzip %s", b);
  1.1573 + 	    break;
  1.1574 ++#endif
  1.1575 + 	}
  1.1576 + 	b = be;
  1.1577 +     } else if (STREQ("S", f, fn)) {
  1.1578 +@@ -1717,9 +1725,11 @@
  1.1579 + 
  1.1580 +     if ((magic[0] == 'B') && (magic[1] == 'Z')) {
  1.1581 + 	*compressed = COMPRESSED_BZIP2;
  1.1582 ++#if 0
  1.1583 +     } else if ((magic[0] == 0120) && (magic[1] == 0113) &&
  1.1584 + 	 (magic[2] == 0003) && (magic[3] == 0004)) {	/* pkzip */
  1.1585 + 	*compressed = COMPRESSED_ZIP;
  1.1586 ++#endif
  1.1587 +     } else if (((magic[0] == 0037) && (magic[1] == 0213)) || /* gzip */
  1.1588 + 	((magic[0] == 0037) && (magic[1] == 0236)) ||	/* old gzip */
  1.1589 + 	((magic[0] == 0037) && (magic[1] == 0036)) ||	/* pack */
  1.1590 +
  1.1591 ++---------------------------------------------------------------------------
  1.1592 +| Make sure that an %{error:<msg>} macro really stops further
  1.1593 +| processing. Else it would be nothing more than a %{warn:<msg>}.
  1.1594 ++---------------------------------------------------------------------------
  1.1595 +Index: rpmio/macro.c
  1.1596 +--- rpmio/macro.c	15 May 2003 13:42:01 -0000	1.1.1.7
  1.1597 ++++ rpmio/macro.c	22 Jan 2004 21:42:32 -0000	1.2
  1.1598 +@@ -1329,7 +1337,7 @@
  1.1599 + 	    STREQ("error", f, fn)) {
  1.1600 + 		int waserror = 0;
  1.1601 + 		if (STREQ("error", f, fn))
  1.1602 +-			waserror = 1;
  1.1603 ++			waserror = 1, rc = 1;
  1.1604 + 		if (g < ge)
  1.1605 + 			doOutput(mb, waserror, g, gn);
  1.1606 + 		else
  1.1607 +
  1.1608 ++---------------------------------------------------------------------------
  1.1609 +| Reactivate build mode aliases which were removed in rpm-4.1 
  1.1610 +| (and now should be available through "rpmbuild" only).
  1.1611 ++---------------------------------------------------------------------------
  1.1612 +Index: rpmpopt.in
  1.1613 +--- rpmpopt.in	24 Jan 2003 14:56:30 -0000	1.1.1.7
  1.1614 ++++ rpmpopt.in	22 Jan 2004 21:42:11 -0000	1.2
  1.1615 +@@ -147,28 +147,28 @@
  1.1616 + # Popt glue to preserve legacy CLI behavior.
  1.1617 + #
  1.1618 + # XXX popt exec parsing doesn't honor POPT_ARGFLAG_ONEDASH
  1.1619 +-# XXX Build mode aliases, removed in rpm-4.1.
  1.1620 +-#rpm	exec --bp		rpmb -bp
  1.1621 +-#rpm	exec --bc		rpmb -bc
  1.1622 +-#rpm	exec --bi		rpmb -bi
  1.1623 +-#rpm	exec --bl		rpmb -bl
  1.1624 +-#rpm	exec --ba		rpmb -ba
  1.1625 +-#rpm	exec --bb		rpmb -bb
  1.1626 +-#rpm	exec --bs		rpmb -bs
  1.1627 +-#rpm	exec --tp		rpmb -tp
  1.1628 +-#rpm	exec --tc		rpmb -tc
  1.1629 +-#rpm	exec --ti		rpmb -ti
  1.1630 +-#rpm	exec --tl		rpmb -tl
  1.1631 +-#rpm	exec --ta		rpmb -ta
  1.1632 +-#rpm	exec --tb		rpmb -tb
  1.1633 +-#rpm	exec --ts		rpmb -ts
  1.1634 +-#rpm	exec --rebuild		rpmb --rebuild
  1.1635 +-#rpm	exec --recompile	rpmb --recompile
  1.1636 +-#rpm	exec --clean		rpmb --clean
  1.1637 +-#rpm	exec --rmsource		rpmb --rmsource
  1.1638 +-#rpm	exec --rmspec		rpmb --rmspec
  1.1639 +-#rpm	exec --target		rpmb --target
  1.1640 +-#rpm	exec --short-circuit	rpmb --short-circuit
  1.1641 ++rpm	exec --bp		rpmb -bp
  1.1642 ++rpm	exec --bc		rpmb -bc
  1.1643 ++rpm	exec --bi		rpmb -bi
  1.1644 ++rpm	exec --bl		rpmb -bl
  1.1645 ++rpm	exec --ba		rpmb -ba
  1.1646 ++rpm	exec --bb		rpmb -bb
  1.1647 ++rpm	exec --bs		rpmb -bs
  1.1648 ++rpm	exec --bt		rpmb -bt
  1.1649 ++rpm	exec --tp		rpmb -tp
  1.1650 ++rpm	exec --tc		rpmb -tc
  1.1651 ++rpm	exec --ti		rpmb -ti
  1.1652 ++rpm	exec --tl		rpmb -tl
  1.1653 ++rpm	exec --ta		rpmb -ta
  1.1654 ++rpm	exec --tb		rpmb -tb
  1.1655 ++rpm	exec --ts		rpmb -ts
  1.1656 ++rpm	exec --rebuild		rpmb --rebuild
  1.1657 ++rpm	exec --recompile	rpmb --recompile
  1.1658 ++rpm	exec --clean		rpmb --clean
  1.1659 ++rpm	exec --rmsource		rpmb --rmsource
  1.1660 ++rpm	exec --rmspec		rpmb --rmspec
  1.1661 ++rpm	exec --target		rpmb --target
  1.1662 ++rpm	exec --short-circuit	rpmb --short-circuit
  1.1663 + 
  1.1664 + rpm	exec --initdb		rpmd --initdb
  1.1665 + rpm	exec --rebuilddb	rpmd --rebuilddb
  1.1666 +
  1.1667 ++---------------------------------------------------------------------------
  1.1668 +| Allow "-bb --short-circuit" for continuing building a binary package
  1.1669 +| after the %install step (usually previously fixed and repeated with
  1.1670 +| "-bi --short-circuit".
  1.1671 ++---------------------------------------------------------------------------
  1.1672 +Index: rpmqv.c
  1.1673 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1.1674 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1.1675 +@@ -682,6 +682,10 @@
  1.1676 + 	case 'b':
  1.1677 + 	    ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
  1.1678 + 	    ba->buildAmount |= RPMBUILD_CLEAN;
  1.1679 ++#ifdef OPENPKG
  1.1680 ++	    if ((ba->buildChar == 'b') && ba->shortCircuit)
  1.1681 ++		/*@innerbreak@*/ break;
  1.1682 ++#endif
  1.1683 + 	    /*@fallthrough@*/
  1.1684 + 	case 'i':
  1.1685 + 	    ba->buildAmount |= RPMBUILD_INSTALL;
  1.1686 +
  1.1687 ++---------------------------------------------------------------------------
  1.1688 +| Because permissions and ownership on Berkeley-DB region files
  1.1689 +| __db.XXX have to be already fixed in advance and those files cannot
  1.1690 +| be created in advance on the command line with some reasonable
  1.1691 +| default (as it is the case for the other files which are created
  1.1692 +| with [rpm]db_load), so force Berkeley-DB to accept zero-sized files
  1.1693 +| and create them (instead of thinking another process is currently
  1.1694 +| creating them).
  1.1695 ++---------------------------------------------------------------------------
  1.1696 +Index: db/env/env_region.c
  1.1697 +--- db/env/env_region.c	18 Jan 2003 14:05:01 -0000	1.1.1.5
  1.1698 ++++ db/env/env_region.c	22 Jan 2004 21:42:17 -0000	1.2
  1.1699 +@@ -184,6 +184,24 @@
  1.1700 + 	}
  1.1701 + 
  1.1702 + 	/*
  1.1703 ++	 * OpenPKG hack: because permissions and ownership on Berkeley-DB
  1.1704 ++	 * region files __db.XXX have to be already fixed in advance and
  1.1705 ++	 * those files cannot be created in advance on the command line
  1.1706 ++	 * with some reasonable default (as it is the case for the other
  1.1707 ++	 * files which are created with [rpm]db_load), so force Berkeley-DB
  1.1708 ++	 * to accept zero-sized files and create them (instead of thinking
  1.1709 ++	 * another process is currently creating them).
  1.1710 ++	 */
  1.1711 ++	if (mbytes == 0 && bytes == 0) {
  1.1712 ++		if (F_ISSET(dbenv, DB_ENV_CREATE))
  1.1713 ++			goto creation;
  1.1714 ++		else {
  1.1715 ++			ret = ENOENT;
  1.1716 ++			goto err;
  1.1717 ++		}
  1.1718 ++	}
  1.1719 ++
  1.1720 ++	/*
  1.1721 + 	 * !!!
  1.1722 + 	 * A size_t is OK -- regions get mapped into memory, and so can't
  1.1723 + 	 * be larger than a size_t.
  1.1724 +
  1.1725 ++---------------------------------------------------------------------------
  1.1726 +| Make sure RPM passes DB_CREATE to Berkeley-DB also if file exists,
  1.1727 +| but is (still) zero-sized.
  1.1728 ++---------------------------------------------------------------------------
  1.1729 +Index: rpmdb/db3.c
  1.1730 +--- rpmdb/db3.c	3 Mar 2003 16:18:29 -0000	1.1.1.5
  1.1731 ++++ rpmdb/db3.c	22 Jan 2004 21:42:29 -0000	1.2
  1.1732 +@@ -1019,9 +1019,13 @@
  1.1733 + 	} else {	/* dbhome is writable, check for persistent dbenv. */
  1.1734 + 	    /*@-mods@*/
  1.1735 + 	    const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
  1.1736 ++            struct stat sb;
  1.1737 ++            long size = -1;
  1.1738 + 	    /*@=mods@*/
  1.1739 + 
  1.1740 +-	    if (access(dbf, F_OK) == -1) {
  1.1741 ++            if (stat(dbf, &sb) == 0)
  1.1742 ++                size = (long)sb.st_size;
  1.1743 ++	    if (access(dbf, F_OK) == -1 || size == 0) {
  1.1744 + 		/* ... non-existent (or unwritable) DBENV, will create ... */
  1.1745 + 		dbi->dbi_oeflags |= DB_CREATE;
  1.1746 + 		dbi->dbi_eflags &= ~DB_JOINENV;
  1.1747 +
  1.1748 ++---------------------------------------------------------------------------
  1.1749 +| Add internal feature variable %{_force_oldpackage} which, if
  1.1750 +| non-zero, automatically enforces --oldpackage on all upgrade
  1.1751 +| operations (this is useful on mass-upgrades from OpenPKG-CURRENT to
  1.1752 +| OpenPKG-RELEASE).
  1.1753 ++---------------------------------------------------------------------------
  1.1754 +Index: rpm.c
  1.1755 +--- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
  1.1756 ++++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
  1.1757 +@@ -1016,6 +1016,10 @@
  1.1758 + 
  1.1759 +     if (oldPackage && !upgrade)
  1.1760 + 	argerror(_("--oldpackage may only be used during upgrades"));
  1.1761 ++#ifdef OPENPKG
  1.1762 ++    if (upgrade && rpmExpandNumeric("%{?_force_oldpackage}"))
  1.1763 ++        probFilter |= RPMPROB_FILTER_OLDPACKAGE;
  1.1764 ++#endif
  1.1765 + 
  1.1766 +     if (noPgp && bigMode != MODE_CHECKSIG)
  1.1767 + 	argerror(_("--nopgp may only be used during signature checking"));
  1.1768 +
  1.1769 ++---------------------------------------------------------------------------
  1.1770 +| Add OpenPKG branding to make sure people do not intermix
  1.1771 +| this RPM version with the stock RPM version.
  1.1772 ++---------------------------------------------------------------------------
  1.1773 +Index: lib/poptALL.c
  1.1774 +--- lib/poptALL.c	25 Jun 2003 19:10:01 -0000	1.1.1.3
  1.1775 ++++ lib/poptALL.c	22 Jan 2004 21:42:23 -0000	1.2
  1.1776 +@@ -102,7 +102,7 @@
  1.1777 + 	/*@globals rpmEVR, fileSystem @*/
  1.1778 + 	/*@modifies *fp, fileSystem @*/
  1.1779 + {
  1.1780 +-    fprintf(fp, _("RPM version %s\n"), rpmEVR);
  1.1781 ++    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
  1.1782 + }
  1.1783 + 
  1.1784 + /**
  1.1785 +
  1.1786 ++---------------------------------------------------------------------------
  1.1787 +| Add OpenPKG branding to make sure people do not intermix
  1.1788 +| this RPM version with the stock RPM version.
  1.1789 ++---------------------------------------------------------------------------
  1.1790 +Index: rpm.c
  1.1791 +--- rpm.c	16 May 2002 16:55:25 -0000	1.1.1.23
  1.1792 ++++ rpm.c	22 Jan 2004 21:42:10 -0000	1.2
  1.1793 +@@ -235,7 +235,7 @@
  1.1794 + static void printHelpLine(char * prefix, char * help);
  1.1795 + 
  1.1796 + static void printVersion(void) {
  1.1797 +-    fprintf(stdout, _("RPM version %s\n"), rpmEVR);
  1.1798 ++    fprintf(stdout, _("OpenPKG RPM %s\n"), rpmEVR);
  1.1799 + }
  1.1800 + 
  1.1801 + static void printBanner(void) {
  1.1802 +
  1.1803 ++---------------------------------------------------------------------------
  1.1804 +| Add OpenPKG branding to make sure people do not intermix
  1.1805 +| this RPM version with the stock RPM version.
  1.1806 ++---------------------------------------------------------------------------
  1.1807 +Index: rpmqv.c
  1.1808 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1.1809 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1.1810 +@@ -126,7 +126,7 @@
  1.1811 + 	/*@globals rpmEVR, fileSystem @*/
  1.1812 + 	/*@modifies *fp, fileSystem @*/
  1.1813 + {
  1.1814 +-    fprintf(fp, _("RPM version %s\n"), rpmEVR);
  1.1815 ++    fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
  1.1816 + }
  1.1817 + 
  1.1818 + static void printBanner(FILE * fp)
  1.1819 +
  1.1820 ++---------------------------------------------------------------------------
  1.1821 +| Add support for the OpenPKG custom .spec file sections %track
  1.1822 +| (package build-time feature for performing vendor source tracking)
  1.1823 +| and %test (package install-time feature for performing package
  1.1824 +| run-time tests).
  1.1825 ++---------------------------------------------------------------------------
  1.1826 +Index: rpmqv.c
  1.1827 +--- rpmqv.c	4 Mar 2003 15:32:57 -0000	1.1.1.8
  1.1828 ++++ rpmqv.c	6 Feb 2004 15:37:56 -0000	1.4
  1.1829 +@@ -703,7 +707,19 @@
  1.1830 + 	    /*@innerbreak@*/ break;
  1.1831 + 	case 's':
  1.1832 + 	    ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
  1.1833 ++	    /* enforce no dependency checking */
  1.1834 ++	    ba->noDeps = 1;
  1.1835 + 	    /*@innerbreak@*/ break;
  1.1836 ++#ifdef OPENPKG
  1.1837 ++	case 't':
  1.1838 ++	    ba->buildAmount |= RPMBUILD_TRACK;
  1.1839 ++	    /* enforce no dependency checking and expansion of %setup, %patch and %prep macros */
  1.1840 ++	    ba->noDeps = 1;
  1.1841 ++	    rpmDefineMacro(NULL, "setup #", RMIL_CMDLINE);
  1.1842 ++	    rpmDefineMacro(NULL, "patch #", RMIL_CMDLINE);
  1.1843 ++	    rpmDefineMacro(NULL, "prep %%prep", RMIL_CMDLINE);
  1.1844 ++	    /*@innerbreak@*/ break;
  1.1845 ++#endif
  1.1846 + 	}
  1.1847 + 
  1.1848 + 	if (!poptPeekArg(optCon)) {
  1.1849 +
  1.1850 ++---------------------------------------------------------------------------
  1.1851 +| Add support for the OpenPKG custom .spec file sections %track
  1.1852 +| (package build-time feature for performing vendor source tracking)
  1.1853 +| and %test (package install-time feature for performing package
  1.1854 +| run-time tests).
  1.1855 ++---------------------------------------------------------------------------
  1.1856 +Index: build/pack.c
  1.1857 +--- build/pack.c	4 Mar 2003 17:03:17 -0000	1.1.1.20
  1.1858 ++++ build/pack.c	30 Jan 2004 17:06:29 -0000	1.2
  1.1859 +@@ -252,6 +252,15 @@
  1.1860 + 	    return RPMERR_BADFILENAME;
  1.1861 + 	}
  1.1862 +     }
  1.1863 ++#ifdef OPENPKG
  1.1864 ++    if (pkg->testFile) {
  1.1865 ++	if (addFileToTag(spec, pkg->testFile, pkg->header, RPMTAG_TEST)) {
  1.1866 ++	    rpmError(RPMERR_BADFILENAME,
  1.1867 ++		     _("Could not open Test file: %s\n"), pkg->testFile);
  1.1868 ++	    return RPMERR_BADFILENAME;
  1.1869 ++	}
  1.1870 ++    }
  1.1871 ++#endif
  1.1872 + 
  1.1873 +     for (p = pkg->triggerFiles; p != NULL; p = p->next) {
  1.1874 + 	(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
  1.1875 +
  1.1876 ++---------------------------------------------------------------------------
  1.1877 +| Add support for the OpenPKG custom .spec file sections %track
  1.1878 +| (package build-time feature for performing vendor source tracking)
  1.1879 +| and %test (package install-time feature for performing package
  1.1880 +| run-time tests).
  1.1881 ++---------------------------------------------------------------------------
  1.1882 +Index: build/parseBuildInstallClean.c
  1.1883 +--- build/parseBuildInstallClean.c	3 Mar 2003 20:43:30 -0000	1.1.1.9
  1.1884 ++++ build/parseBuildInstallClean.c	30 Jan 2004 17:06:29 -0000	1.2
  1.1885 +@@ -29,6 +29,11 @@
  1.1886 +     } else if (parsePart == PART_CLEAN) {
  1.1887 + 	sbp = &(spec->clean);
  1.1888 + 	name = "%clean";
  1.1889 ++#ifdef OPENPKG
  1.1890 ++    } else if (parsePart == PART_TRACK) {
  1.1891 ++	sbp = &(spec->track);
  1.1892 ++	name = "%track";
  1.1893 ++#endif
  1.1894 +     }
  1.1895 +     /*@=branchstate@*/
  1.1896 +     
  1.1897 +
  1.1898 ++---------------------------------------------------------------------------
  1.1899 +| Add support for the OpenPKG custom .spec file sections %track
  1.1900 +| (package build-time feature for performing vendor source tracking)
  1.1901 +| and %test (package install-time feature for performing package
  1.1902 +| run-time tests).
  1.1903 ++---------------------------------------------------------------------------
  1.1904 +Index: build/parseScript.c
  1.1905 +--- build/parseScript.c	23 Jun 2002 19:47:12 -0000	1.1.1.12
  1.1906 ++++ build/parseScript.c	30 Jan 2004 17:06:29 -0000	1.3
  1.1907 +@@ -156,6 +156,14 @@
  1.1908 + 	progtag = RPMTAG_TRIGGERSCRIPTPROG;
  1.1909 + 	partname = "%triggerpostun";
  1.1910 + 	break;
  1.1911 ++#ifdef OPENPKG
  1.1912 ++      case PART_TEST:
  1.1913 ++	tag = RPMTAG_TEST;
  1.1914 ++	tagflags = RPMSENSE_SCRIPT_TEST;
  1.1915 ++	progtag = RPMTAG_TESTPROG;
  1.1916 ++	partname = "%test";
  1.1917 ++	break;
  1.1918 ++#endif
  1.1919 +     }
  1.1920 +     /*@=branchstate@*/
  1.1921 + 
  1.1922 +@@ -303,6 +312,11 @@
  1.1923 + 	      case PART_VERIFYSCRIPT:
  1.1924 + 		pkg->verifyFile = xstrdup(file);
  1.1925 + 		break;
  1.1926 ++#ifdef OPENPKG
  1.1927 ++	      case PART_TEST:
  1.1928 ++		pkg->testFile = xstrdup(file);
  1.1929 ++		break;
  1.1930 ++#endif
  1.1931 + 	    }
  1.1932 + 	}
  1.1933 +     }
  1.1934 +
  1.1935 ++---------------------------------------------------------------------------
  1.1936 +| Add support for the OpenPKG custom .spec file sections %track
  1.1937 +| (package build-time feature for performing vendor source tracking)
  1.1938 +| and %test (package install-time feature for performing package
  1.1939 +| run-time tests).
  1.1940 ++---------------------------------------------------------------------------
  1.1941 +Index: build/parseSpec.c
  1.1942 +--- build/parseSpec.c	15 May 2003 13:38:57 -0000	1.1.1.15
  1.1943 ++++ build/parseSpec.c	30 Jan 2004 17:06:30 -0000	1.2
  1.1944 +@@ -43,6 +43,10 @@
  1.1945 +     { PART_TRIGGERIN,     0, "%triggerin"},
  1.1946 +     { PART_TRIGGERIN,     0, "%trigger"},
  1.1947 +     { PART_VERIFYSCRIPT,  0, "%verifyscript"},
  1.1948 ++#ifdef OPENPKG
  1.1949 ++    { PART_TRACK,         0, "%track"},
  1.1950 ++    { PART_TEST,          0, "%test"},
  1.1951 ++#endif
  1.1952 +     {0, 0, 0}
  1.1953 + };
  1.1954 + 
  1.1955 +@@ -489,6 +493,15 @@
  1.1956 + 	    parsePart = parseFiles(spec);
  1.1957 + 	    /*@switchbreak@*/ break;
  1.1958 + 
  1.1959 ++#ifdef OPENPKG
  1.1960 ++	case PART_TRACK:
  1.1961 ++	    parsePart = parseBuildInstallClean(spec, parsePart);
  1.1962 ++	    /*@switchbreak@*/ break;
  1.1963 ++	case PART_TEST:
  1.1964 ++	    parsePart = parseScript(spec, parsePart);
  1.1965 ++	    /*@switchbreak@*/ break;
  1.1966 ++#endif
  1.1967 ++
  1.1968 + 	case PART_NONE:		/* XXX avoid gcc whining */
  1.1969 + 	case PART_LAST:
  1.1970 + 	case PART_BUILDARCHITECTURES:
  1.1971 +
  1.1972 ++---------------------------------------------------------------------------
  1.1973 +| Add support for the OpenPKG custom .spec file sections %track
  1.1974 +| (package build-time feature for performing vendor source tracking)
  1.1975 +| and %test (package install-time feature for performing package
  1.1976 +| run-time tests).
  1.1977 ++---------------------------------------------------------------------------
  1.1978 +Index: build/poptBT.c
  1.1979 +--- build/poptBT.c	3 Mar 2003 20:04:12 -0000	1.1.1.3
  1.1980 ++++ build/poptBT.c	30 Jan 2004 17:06:30 -0000	1.2
  1.1981 +@@ -35,6 +35,9 @@
  1.1982 + #define	POPT_BL			0x626c
  1.1983 + #define	POPT_BP			0x6270
  1.1984 + #define	POPT_BS			0x6273
  1.1985 ++#ifdef OPENPKG
  1.1986 ++#define	POPT_BT			0x6274
  1.1987 ++#endif
  1.1988 + #define	POPT_TA			0x7461
  1.1989 + #define	POPT_TB			0x7462
  1.1990 + #define	POPT_TC			0x7463
  1.1991 +@@ -82,6 +85,9 @@
  1.1992 +     case POPT_BL:
  1.1993 +     case POPT_BP:
  1.1994 +     case POPT_BS:
  1.1995 ++#ifdef OPENPKG
  1.1996 ++    case POPT_BT:
  1.1997 ++#endif
  1.1998 +     case POPT_TA:
  1.1999 +     case POPT_TB:
  1.2000 +     case POPT_TC:
  1.2001 +@@ -177,6 +183,11 @@
  1.2002 +  { "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS,
  1.2003 + 	N_("build source package only from <specfile>"),
  1.2004 + 	N_("<specfile>") },
  1.2005 ++#ifdef OPENPKG
  1.2006 ++ { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
  1.2007 ++	N_("track versions of sources from <specfile>"),
  1.2008 ++	N_("<specfile>") },
  1.2009 ++#endif
  1.2010 + 
  1.2011 +  { "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP,
  1.2012 + 	N_("build through %prep (unpack sources and apply patches) from <tarball>"),
  1.2013 +
  1.2014 ++---------------------------------------------------------------------------
  1.2015 +| Add support for the OpenPKG custom .spec file sections %track
  1.2016 +| (package build-time feature for performing vendor source tracking)
  1.2017 +| and %test (package install-time feature for performing package
  1.2018 +| run-time tests).
  1.2019 ++---------------------------------------------------------------------------
  1.2020 +Index: build/rpmbuild.h
  1.2021 +--- build/rpmbuild.h	4 Mar 2003 17:03:07 -0000	1.1.1.13
  1.2022 ++++ build/rpmbuild.h	30 Jan 2004 17:06:30 -0000	1.2
  1.2023 +@@ -34,6 +34,9 @@
  1.2024 +     RPMBUILD_RMSOURCE	= (1 <<  8),	/*!< Remove source(s) and patch(s). */
  1.2025 +     RPMBUILD_RMBUILD	= (1 <<  9),	/*!< Remove build sub-tree. */
  1.2026 +     RPMBUILD_STRINGBUF	= (1 << 10),	/*!< only for doScript() */
  1.2027 ++#ifdef OPENPKG
  1.2028 ++    RPMBUILD_TRACK	= (1 << 12),	/*!< Execute %%track. */
  1.2029 ++#endif
  1.2030 +     RPMBUILD_RMSPEC	= (1 << 11)	/*!< Remove spec file. */
  1.2031 + } rpmBuildFlags;
  1.2032 + /*@=typeuse@*/
  1.2033 +@@ -69,7 +72,13 @@
  1.2034 +     PART_VERIFYSCRIPT	= 16,	/*!< */
  1.2035 +     PART_BUILDARCHITECTURES= 17,/*!< */
  1.2036 +     PART_TRIGGERPOSTUN	= 18,	/*!< */
  1.2037 ++#ifdef OPENPKG
  1.2038 ++    PART_TRACK	        = 19,	/*!< */
  1.2039 ++    PART_TEST	        = 20,	/*!< */
  1.2040 ++    PART_LAST		= 21	/*!< */
  1.2041 ++#else
  1.2042 +     PART_LAST		= 19	/*!< */
  1.2043 ++#endif
  1.2044 + } rpmParseState;
  1.2045 + 
  1.2046 + #define STRIP_NOTHING             0
  1.2047 +
  1.2048 ++---------------------------------------------------------------------------
  1.2049 +| Add support for the OpenPKG custom .spec file sections %track
  1.2050 +| (package build-time feature for performing vendor source tracking)
  1.2051 +| and %test (package install-time feature for performing package
  1.2052 +| run-time tests).
  1.2053 ++---------------------------------------------------------------------------
  1.2054 +Index: build/rpmspec.h
  1.2055 +--- build/rpmspec.h	4 Mar 2003 15:30:23 -0000	1.1.1.11
  1.2056 ++++ build/rpmspec.h	30 Jan 2004 17:06:30 -0000	1.2
  1.2057 +@@ -164,6 +164,10 @@
  1.2058 +     StringBuf check;		/*!< %check scriptlet. */
  1.2059 + /*@only@*/
  1.2060 +     StringBuf clean;		/*!< %clean scriptlet. */
  1.2061 ++#ifdef OPENPKG
  1.2062 ++/*@only@*/
  1.2063 ++    StringBuf track;		/*!< %track scriptlet. */
  1.2064 ++#endif
  1.2065 + 
  1.2066 + /*@owned@*/
  1.2067 +     Package packages;		/*!< Package list. */
  1.2068 +@@ -196,6 +200,10 @@
  1.2069 +     const char * postUnFile;	/*!< %postun scriptlet. */
  1.2070 + /*@only@*/
  1.2071 +     const char * verifyFile;	/*!< %verifyscript scriptlet. */
  1.2072 ++#ifdef OPENPKG
  1.2073 ++/*@only@*/
  1.2074 ++    const char * testFile;	/*!< %test scriptlet. */
  1.2075 ++#endif
  1.2076 + 
  1.2077 + /*@only@*/
  1.2078 +     StringBuf specialDoc;
  1.2079 +
  1.2080 ++---------------------------------------------------------------------------
  1.2081 +| Add support for the OpenPKG custom .spec file sections %track
  1.2082 +| (package build-time feature for performing vendor source tracking)
  1.2083 +| and %test (package install-time feature for performing package
  1.2084 +| run-time tests).
  1.2085 ++---------------------------------------------------------------------------
  1.2086 +Index: build/spec.c
  1.2087 +--- build/spec.c	4 Mar 2003 15:25:51 -0000	1.1.1.21
  1.2088 ++++ build/spec.c	30 Jan 2004 17:06:31 -0000	1.3
  1.2089 +@@ -138,6 +138,9 @@
  1.2090 +     p->preUnFile = NULL;
  1.2091 +     p->postUnFile = NULL;
  1.2092 +     p->verifyFile = NULL;
  1.2093 ++#ifdef OPENPKG
  1.2094 ++    p->testFile = NULL;
  1.2095 ++#endif
  1.2096 + 
  1.2097 +     p->specialDoc = NULL;
  1.2098 + 
  1.2099 +@@ -444,6 +455,9 @@
  1.2100 +     spec->install = NULL;
  1.2101 +     spec->check = NULL;
  1.2102 +     spec->clean = NULL;
  1.2103 ++#ifdef OPENPKG
  1.2104 ++    spec->track = NULL;
  1.2105 ++#endif
  1.2106 + 
  1.2107 +     spec->sources = NULL;
  1.2108 +     spec->packages = NULL;
  1.2109 +@@ -491,6 +505,9 @@
  1.2110 +     spec->install = freeStringBuf(spec->install);
  1.2111 +     spec->check = freeStringBuf(spec->check);
  1.2112 +     spec->clean = freeStringBuf(spec->clean);
  1.2113 ++#ifdef OPENPKG
  1.2114 ++    spec->track = freeStringBuf(spec->track);
  1.2115 ++#endif
  1.2116 + 
  1.2117 +     spec->buildRootURL = _free(spec->buildRootURL);
  1.2118 +     spec->buildSubdir = _free(spec->buildSubdir);
  1.2119 +
  1.2120 ++---------------------------------------------------------------------------
  1.2121 +| Add support for the OpenPKG custom .spec file sections %track
  1.2122 +| (package build-time feature for performing vendor source tracking)
  1.2123 +| and %test (package install-time feature for performing package
  1.2124 +| run-time tests).
  1.2125 ++---------------------------------------------------------------------------
  1.2126 +Index: lib/rpmlib.h
  1.2127 +--- lib/rpmlib.h	19 Jun 2003 17:39:35 -0000	1.1.1.26
  1.2128 ++++ lib/rpmlib.h	30 Jan 2004 17:06:31 -0000	1.2
  1.2129 +@@ -414,6 +414,12 @@
  1.2130 +     RPMTAG_FILEDEPENDSN		= 1144,
  1.2131 +     RPMTAG_DEPENDSDICT		= 1145,
  1.2132 +     RPMTAG_SOURCEPKGID		= 1146,
  1.2133 ++#ifdef OPENPKG
  1.2134 ++    RPMTAG_TRACK 		= 1200,
  1.2135 ++    RPMTAG_TEST 		= 1201,
  1.2136 ++    RPMTAG_TESTPROG		= 1202,
  1.2137 ++    RPMTAG_CLASS		= 1203,
  1.2138 ++#endif
  1.2139 + /*@-enummemuse@*/
  1.2140 +     RPMTAG_FIRSTFREE_TAG	/*!< internal */
  1.2141 + /*@=enummemuse@*/
  1.2142 +@@ -488,6 +494,9 @@
  1.2143 +     RPMSENSE_SCRIPT_BUILD = (1 << 21),	/*!< %build build dependency. */
  1.2144 +     RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
  1.2145 +     RPMSENSE_SCRIPT_CLEAN = (1 << 23),	/*!< %clean build dependency. */
  1.2146 ++#ifdef OPENPKG
  1.2147 ++    RPMSENSE_SCRIPT_TEST = (1 << 29),	/*!< %test build dependency. */
  1.2148 ++#endif
  1.2149 +     RPMSENSE_RPMLIB	= ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
  1.2150 + /*@-enummemuse@*/
  1.2151 +     RPMSENSE_TRIGGERPREIN = (1 << 25),	/*!< @todo Implement %triggerprein. */
  1.2152 +
  1.2153 ++---------------------------------------------------------------------------
  1.2154 +| Add support for the OpenPKG custom .spec file sections %track
  1.2155 +| (package build-time feature for performing vendor source tracking)
  1.2156 +| and %test (package install-time feature for performing package
  1.2157 +| run-time tests).
  1.2158 +| Additionally, add support for "Class" header.
  1.2159 ++---------------------------------------------------------------------------
  1.2160 +Index: rpmdb/tagtbl.c
  1.2161 +--- rpmdb/tagtbl.c	2 Jul 2003 20:20:27 -0000	1.1.1.4
  1.2162 ++++ rpmdb/tagtbl.c	30 Jan 2004 17:06:32 -0000	1.2
  1.2163 +@@ -135,6 +135,12 @@
  1.2164 + 	{ "RPMTAG_FILEDEPENDSN", 1144, },
  1.2165 + 	{ "RPMTAG_DEPENDSDICT", 1145, },
  1.2166 + 	{ "RPMTAG_SOURCEPKGID", 1146, },
  1.2167 ++#ifdef OPENPKG
  1.2168 ++	{ "RPMTAG_TRACK", 1200, },
  1.2169 ++	{ "RPMTAG_TEST", 1201, },
  1.2170 ++	{ "RPMTAG_TESTPROG", 1202, },
  1.2171 ++	{ "RPMTAG_CLASS", 1203, },
  1.2172 ++#endif
  1.2173 + 	{ NULL, 0 }
  1.2174 + };
  1.2175 + 
  1.2176 +
  1.2177 ++---------------------------------------------------------------------------
  1.2178 +| Add support for "Class" header.
  1.2179 ++---------------------------------------------------------------------------
  1.2180 +Index: build/parsePreamble.c
  1.2181 +--- build/parsePreamble.c	3 Mar 2003 20:46:34 -0000	1.1.1.13
  1.2182 ++++ build/parsePreamble.c	6 Feb 2004 15:37:58 -0000	1.3
  1.2183 +@@ -21,6 +21,7 @@
  1.2184 +     RPMTAG_LICENSE,
  1.2185 +     RPMTAG_PACKAGER,
  1.2186 +     RPMTAG_DISTRIBUTION,
  1.2187 ++    RPMTAG_CLASS,
  1.2188 +     RPMTAG_DISTURL,
  1.2189 +     RPMTAG_VENDOR,
  1.2190 +     RPMTAG_ICON,
  1.2191 +@@ -327,6 +328,7 @@
  1.2192 +     { RPMTAG_VENDOR,		"%{vendor}" },
  1.2193 +     { RPMTAG_PACKAGER,		"%{packager}" },
  1.2194 +     { RPMTAG_DISTRIBUTION,	"%{distribution}" },
  1.2195 ++    { RPMTAG_CLASS,		"%{class}" },
  1.2196 +     { RPMTAG_DISTURL,		"%{disturl}" },
  1.2197 +     { -1, NULL }
  1.2198 + };
  1.2199 +@@ -537,6 +547,7 @@
  1.2200 + 	(void) stashSt(spec, pkg->header, tag, lang);
  1.2201 + 	/*@fallthrough@*/
  1.2202 +     case RPMTAG_DISTRIBUTION:
  1.2203 ++    case RPMTAG_CLASS:
  1.2204 +     case RPMTAG_VENDOR:
  1.2205 +     case RPMTAG_LICENSE:
  1.2206 +     case RPMTAG_PACKAGER:
  1.2207 +@@ -743,6 +754,7 @@
  1.2208 +     {RPMTAG_LICENSE,		0, 0, "copyright"},
  1.2209 +     {RPMTAG_LICENSE,		0, 0, "license"},
  1.2210 +     {RPMTAG_DISTRIBUTION,	0, 0, "distribution"},
  1.2211 ++    {RPMTAG_CLASS,		0, 0, "class"},
  1.2212 +     {RPMTAG_DISTURL,		0, 0, "disturl"},
  1.2213 +     {RPMTAG_VENDOR,		0, 0, "vendor"},
  1.2214 +     {RPMTAG_GROUP,		0, 1, "group"},

mercurial