summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-10-28 10:45:35 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-10-28 10:45:35 +0300
commit3f152a1312d10a90249169f6b978d96b84e5991b (patch)
tree3db6bbc31785637b1099388cc98f315907112cad /build
parent98aff6e658a15202ebacd49c8a970be7affb6e5c (diff)
downloadlibrpm-tizen-3f152a1312d10a90249169f6b978d96b84e5991b.tar.gz
librpm-tizen-3f152a1312d10a90249169f6b978d96b84e5991b.tar.bz2
librpm-tizen-3f152a1312d10a90249169f6b978d96b84e5991b.zip
Argument passing hysteria in doScript()
- Callers know perfectly well which part they're passing to doScript() so they can just as well pass in the name and the scriptlet to run, avoiding silly stuff in the switch-case
Diffstat (limited to 'build')
-rw-r--r--build/build.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/build/build.c b/build/build.c
index fe65bc10a..9ba5f8f47 100644
--- a/build/build.c
+++ b/build/build.c
@@ -73,42 +73,31 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb,
switch (what) {
case RPMBUILD_PREP:
- name = "%prep";
- sb = spec->prep;
mTemplate = "%{__spec_prep_template}";
mPost = "%{__spec_prep_post}";
mCmd = "%{__spec_prep_cmd}";
break;
case RPMBUILD_BUILD:
- name = "%build";
- sb = spec->build;
mTemplate = "%{__spec_build_template}";
mPost = "%{__spec_build_post}";
mCmd = "%{__spec_build_cmd}";
break;
case RPMBUILD_INSTALL:
- name = "%install";
- sb = spec->install;
mTemplate = "%{__spec_install_template}";
mPost = "%{__spec_install_post}";
mCmd = "%{__spec_install_cmd}";
break;
case RPMBUILD_CHECK:
- name = "%check";
- sb = spec->check;
mTemplate = "%{__spec_check_template}";
mPost = "%{__spec_check_post}";
mCmd = "%{__spec_check_cmd}";
break;
case RPMBUILD_CLEAN:
- name = "%clean";
- sb = spec->clean;
mTemplate = "%{__spec_clean_template}";
mPost = "%{__spec_clean_post}";
mCmd = "%{__spec_clean_cmd}";
break;
case RPMBUILD_RMBUILD:
- name = "--clean";
mTemplate = "%{__spec_clean_template}";
mPost = "%{__spec_clean_post}";
mCmd = "%{__spec_clean_cmd}";
@@ -120,8 +109,6 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb,
mCmd = "%{___build_cmd}";
break;
}
- if (name == NULL) /* XXX shouldn't happen */
- name = "???";
if ((what != RPMBUILD_RMBUILD) && sb == NULL) {
rc = RPMRC_OK;
@@ -238,19 +225,19 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
int didBuild = (what & (RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL));
if ((what & RPMBUILD_PREP) &&
- (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_PREP, "%prep", spec->prep, test)))
goto exit;
if ((what & RPMBUILD_BUILD) &&
- (rc = doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_BUILD, "%build", spec->build, test)))
goto exit;
if ((what & RPMBUILD_INSTALL) &&
- (rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_INSTALL, "%install", spec->install, test)))
goto exit;
if ((what & RPMBUILD_CHECK) &&
- (rc = doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_CHECK, "%check", spec->check, test)))
goto exit;
if ((what & RPMBUILD_PACKAGESOURCE) &&
@@ -276,11 +263,11 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
goto exit;
if ((what & RPMBUILD_CLEAN) &&
- (rc = doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_CLEAN, "%clean", spec->clean, test)))
goto exit;
if ((what & RPMBUILD_RMBUILD) &&
- (rc = doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
+ (rc = doScript(spec, RPMBUILD_RMBUILD, "--clean", NULL, test)))
goto exit;
}