From: Panu Matilainen Date: Thu, 2 Sep 2010 09:12:46 +0000 (+0300) Subject: Eliminate _noDirTokens from librpmbuild API+ABI X-Git-Tag: rpm-4.9.0-beta1~425 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53385ee67656692c811edd8b02b9cd2454e5fa89;p=platform%2Fupstream%2Frpm.git Eliminate _noDirTokens from librpmbuild API+ABI - Add another flag set to control package generation, passing around as necessary. Use this to implement --nodirtokens functionality in a cleaner manner. --- diff --git a/build/build.c b/build/build.c index cdc44a5..3e957ca 100644 --- a/build/build.c +++ b/build/build.c @@ -254,12 +254,13 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what) goto exit; if ((what & RPMBUILD_PACKAGESOURCE) && - (rc = processSourceFiles(spec))) + (rc = processSourceFiles(spec, buildArgs->pkgFlags))) goto exit; if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) || (what & RPMBUILD_FILECHECK)) && - (rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL, test))) + (rc = processBinaryFiles(spec, buildArgs->pkgFlags, + what & RPMBUILD_INSTALL, test))) goto exit; if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY)) && diff --git a/build/files.c b/build/files.c index d2272e0..e8c9f50 100644 --- a/build/files.c +++ b/build/files.c @@ -110,6 +110,7 @@ typedef struct FileList_s { int devminor; int isDir; + rpmBuildPkgFlags pkgFlags; rpmfileAttrs currentFlags; specdFlags currentSpecdFlags; rpmVerifyFlags currentVerifyFlags; @@ -1303,7 +1304,7 @@ static void genCpioListAndHeader(FileList fl, } /* Compress filelist unless legacy format requested */ - if (!_noDirTokens) { + if (!(fl->pkgFlags & RPMBUILD_PKG_NODIRTOKENS)) { headerConvert(h, HEADERCONV_COMPRESSFILELIST); /* Binary packages with dirNames cannot be installed by legacy rpm. */ (void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1"); @@ -1703,8 +1704,8 @@ exit: /** */ -static rpmRC processPackageFiles(rpmSpec spec, Package pkg, - int installSpecialDoc, int test) +static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + Package pkg, int installSpecialDoc, int test) { struct FileList_s fl; char *s, **fp; @@ -1789,6 +1790,7 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, fl.defSpecdFlags = 0; fl.largeFiles = 0; + fl.pkgFlags = pkgFlags; fl.docDirs = NULL; { char *docs = rpmGetPath("%{?__docdir_path}", NULL); @@ -1944,7 +1946,7 @@ static void genSourceRpmName(rpmSpec spec) } } -int processSourceFiles(rpmSpec spec) +int processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) { struct Source *srcPtr; StringBuf sourceFiles; @@ -1996,6 +1998,7 @@ int processSourceFiles(rpmSpec spec) fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList)); fl.processingFailed = 0; fl.fileListRecsUsed = 0; + fl.pkgFlags = pkgFlags; fl.buildRoot = NULL; s = getStringBuf(sourceFiles); @@ -2117,7 +2120,8 @@ exit: return rc; } -int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test) +int processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + int installSpecialDoc, int test) { Package pkg; int rc = RPMRC_OK; @@ -2134,7 +2138,7 @@ int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test) rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr); free(nvr); - if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test)) != RPMRC_OK || + if ((rc = processPackageFiles(spec, pkgFlags, pkg, installSpecialDoc, test)) != RPMRC_OK || (rc = rpmfcGenerateDepends(spec, pkg)) != RPMRC_OK) goto exit; diff --git a/build/poptBT.c b/build/poptBT.c index f7e12b6..3f83f43 100644 --- a/build/poptBT.c +++ b/build/poptBT.c @@ -20,7 +20,7 @@ struct rpmBuildArguments_s rpmBTArgs; #define POPT_NOBUILD -1017 #define POPT_SHORTCIRCUIT -1018 #define POPT_RMSPEC -1019 -#define POPT_SIGN -1020 +#define POPT_NODIRTOKENS -1020 #define POPT_REBUILD 0x4220 #define POPT_RECOMPILE 0x4320 @@ -41,8 +41,6 @@ struct rpmBuildArguments_s rpmBTArgs; extern int _fsm_debug; -int _noDirTokens = 0; - /** */ static void buildArgCallback( poptContext con, @@ -77,6 +75,7 @@ static void buildArgCallback( poptContext con, } break; + case POPT_NODIRTOKENS: rba->pkgFlags |= RPMBUILD_PKG_NODIRTOKENS; break; case POPT_NOBUILD: rba->buildAmount |= RPMBUILD_NOBUILD; break; case POPT_NOLANG: rba->specFlags |= RPMSPEC_NOLANG; break; case POPT_SHORTCIRCUIT: rba->shortCircuit = 1; break; @@ -179,8 +178,6 @@ struct poptOption rpmBuildPoptTable[] = { N_("override build root"), "DIRECTORY" }, { "clean", '\0', 0, 0, POPT_RMBUILD, N_("remove build tree when done"), NULL}, - { "dirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 0, - N_("generate headers compatible with rpm4 packaging"), NULL}, { "force", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_FORCE, N_("ignore ExcludeArch: directives from spec file"), NULL}, { "fsmdebug", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN), &_fsm_debug, -1, @@ -189,8 +186,8 @@ struct poptOption rpmBuildPoptTable[] = { N_("do not execute any stages of the build"), NULL }, { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS, N_("do not verify build dependencies"), NULL }, - { "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, - N_("generate package header(s) compatible with (legacy) rpm[23] packaging"), + { "nodirtokens", '\0', 0, 0, POPT_NODIRTOKENS, + N_("generate package header(s) compatible with (legacy) rpm v3 packaging"), NULL}, { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NODIGEST, diff --git a/build/rpmbuild.h b/build/rpmbuild.h index b34e7a7..7a699b8 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -36,11 +36,20 @@ typedef enum rpmBuildFlags_e { } rpmBuildFlags; /** \ingroup rpmbuild + * Bit(s) to control package generation + */ +typedef enum rpmBuildPkgFlags_e { + RPMBUILD_PKG_NONE = 0, + RPMBUILD_PKG_NODIRTOKENS = (1 << 0), /*!< Legacy filename layout */ +} rpmBuildPkgFlags; + +/** \ingroup rpmbuild * Describe build command line request. */ struct rpmBuildArguments_s { rpmQueryFlags qva_flags; /*!< Bit(s) to control verification. */ rpmSpecFlags specFlags; /*!< Bit(s) to control spec parsing. */ + rpmBuildPkgFlags pkgFlags; /*!< Bit(s) to control package generation. */ int buildAmount; /*!< Bit(s) to control operation. */ char * buildRootOverride; /*!< from --buildroot */ char * targets; /*!< Target platform(s), comma separated. */ @@ -65,11 +74,6 @@ extern struct rpmBuildArguments_s rpmBTArgs; extern struct poptOption rpmBuildPoptTable[]; /** \ingroup rpmbuild - * Should version 3 packages be produced? - */ -extern int _noDirTokens; - -/** \ingroup rpmbuild * Parse spec file into spec control structure. * @todo Eliminate buildRoot from here, its a build, not spec property * diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h index 93fcdd4..5ec8142 100644 --- a/build/rpmbuild_internal.h +++ b/build/rpmbuild_internal.h @@ -257,12 +257,14 @@ Package newPackage(rpmSpec spec); /** \ingroup rpmbuild * Post-build processing for binary package(s). * @param spec spec file control structure + * @param pkgFlags bit(s) to control package generation * @param installSpecialDoc * @param test don't execute scripts or package if testing * @return 0 on success */ RPM_GNUC_INTERNAL -int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test); +int processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + int installSpecialDoc, int test); /** \ingroup rpmbuild * Post-build processing for policies in binary package(s). @@ -276,10 +278,11 @@ int processBinaryPolicies(rpmSpec spec, int test); /** \ingroup rpmbuild * Post-build processing for source package. * @param spec spec file control structure + * @param pkgFlags bit(s) to control package generation * @return 0 on success */ RPM_GNUC_INTERNAL -int processSourceFiles(rpmSpec spec); +int processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags); /** \ingroup rpmbuild * Generate binary package(s).