git://git.onelab.eu
/
build.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added rpmbuild options, but not enough to properly handle
[build.git]
/
spec2make.c
diff --git
a/spec2make.c
b/spec2make.c
index
ff21e9d
..
712ce68
100644
(file)
--- a/
spec2make.c
+++ b/
spec2make.c
@@
-6,7
+6,6
@@
* Mark Huang <mlhuang@cs.princeton.edu>
* Copyright (C) 2006 The Trustees of Princeton University
*
* Mark Huang <mlhuang@cs.princeton.edu>
* Copyright (C) 2006 The Trustees of Princeton University
*
- * $Id$
*/
#include <stdio.h>
*/
#include <stdio.h>
@@
-20,10
+19,23
@@
#include <rpm/rpmbuild.h>
#include <rpm/rpmspec.h>
#include <rpm/rpmbuild.h>
#include <rpm/rpmspec.h>
+/* from f10 and up, Spec is renamed rpmSpec */
+#ifndef _RPMTYPES_H
+#define rpmSpec Spec
+#endif
+
+#ifndef PATH_MAX
+#include <linux/limits.h>
+#endif
+
extern size_t strnlen(const char *s, size_t maxlen);
/* the structure describing the options we take and the defaults */
static struct poptOption optionsTable[] = {
extern size_t strnlen(const char *s, size_t maxlen);
/* the structure describing the options we take and the defaults */
static struct poptOption optionsTable[] = {
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
+ "Build options with [ <specfile> | <tarball> | <source package> ]:",
+ NULL },
+
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
"Common options for all rpm modes and executables:",
NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
"Common options for all rpm modes and executables:",
NULL },
@@
-34,7
+46,7
@@
static struct poptOption optionsTable[] = {
};
/* Stolen from rpm/build/spec.c:rpmspecQuery() */
};
/* Stolen from rpm/build/spec.c:rpmspecQuery() */
-Spec
+
rpm
Spec
rpmspecGet(rpmts ts, const char * arg)
{
char * buildRoot = NULL;
rpmspecGet(rpmts ts, const char * arg)
{
char * buildRoot = NULL;
@@
-59,7
+71,7
@@
main(int argc, char *argv[])
poptContext context;
rpmts ts = NULL;
int ec = 0;
poptContext context;
rpmts ts = NULL;
int ec = 0;
- Spec spec;
+
rpm
Spec spec;
struct Source *source;
Package pkg;
const char *name, *version, *release, *arch, *unused;
struct Source *source;
Package pkg;
const char *name, *version, *release, *arch, *unused;
@@
-123,7
+135,7
@@
main(int argc, char *argv[])
char fullSource[PATH_MAX];
strncpy(fullSource, source->fullSource, sizeof(fullSource));
char fullSource[PATH_MAX];
strncpy(fullSource, source->fullSource, sizeof(fullSource));
- printf("%s
-TARBALLS
+= SOURCES/%s\n", package_name, basename(fullSource));
+ printf("%s
.tarballs
+= SOURCES/%s\n", package_name, basename(fullSource));
/* computes the SOURCEDIR variable by removing .tar.gz or .tar.bz2 */
{
char *suffixes[] = {".tar.gz",".tgz",".tar.bz2", NULL};
/* computes the SOURCEDIR variable by removing .tar.gz or .tar.bz2 */
{
char *suffixes[] = {".tar.gz",".tgz",".tar.bz2", NULL};
@@
-138,8
+150,7
@@
main(int argc, char *argv[])
size_t len = (size_t)(suffix_index-fullSource);
strncpy(sourcename,fullSource,len);
sourcename[len]='\0';
size_t len = (size_t)(suffix_index-fullSource);
strncpy(sourcename,fullSource,len);
sourcename[len]='\0';
- printf ("%s-SOURCE := SOURCES/%s\n",package_name,basename(sourcename));
- printf ("%s-CODEBASE := CODEBASES/%s\n",package_name,package_name);
+ printf ("%s.source := SOURCES/%s\n",package_name,basename(sourcename));
break;
}
}
break;
}
}
@@
-152,7
+163,7
@@
main(int argc, char *argv[])
name = version = release = NULL;
(void) headerNVR(pkg->header, &name, &version, &release);
if (name && version && release)
name = version = release = NULL;
(void) headerNVR(pkg->header, &name, &version, &release);
if (name && version && release)
- printf("%s
-SRPM
:= SRPMS/%s-%s-%s.src.rpm\n",
+ printf("%s
.srpm
:= SRPMS/%s-%s-%s.src.rpm\n",
package_name, name, version, release);
/* Print non-empty packages */
package_name, name, version, release);
/* Print non-empty packages */
@@
-168,8
+179,11
@@
main(int argc, char *argv[])
/* skip empty packages */
if (pkg->fileList) {
/* attach (add) rpm path to package */
/* skip empty packages */
if (pkg->fileList) {
/* attach (add) rpm path to package */
- printf("%s
-RPMS
+= RPMS/%s/%s-%s-%s.%s.rpm\n",
+ printf("%s
.rpms
+= RPMS/%s/%s-%s-%s.%s.rpm\n",
package_name, arch, name, version, release, arch);
package_name, arch, name, version, release, arch);
+ /* convenience */
+ printf("%s.rpmnames += %s\n",
+ package_name, name);
/* attach path to rpm name */
printf("%s.rpm-path := RPMS/%s/%s-%s-%s.%s.rpm\n",
name,arch, name, version, release, arch);
/* attach path to rpm name */
printf("%s.rpm-path := RPMS/%s/%s-%s-%s.%s.rpm\n",
name,arch, name, version, release, arch);
@@
-181,17
+195,21
@@
main(int argc, char *argv[])
}
/* export some macros to make */
}
/* export some macros to make */
+ /* note : this relies on pl-specific conventions and might be wrong */
{
{
- char *macros[] = { "release" , "name" , "version" , "
subversion
" , NULL } ;
+ char *macros[] = { "release" , "name" , "version" , "
taglevel
" , NULL } ;
char **nav;
char *macro=malloc(32);
for (nav=macros; *nav; nav++) {
sprintf(macro,"%%{%s}",*nav);
char *value = rpmExpand(macro,NULL);
char **nav;
char *macro=malloc(32);
for (nav=macros; *nav; nav++) {
sprintf(macro,"%%{%s}",*nav);
char *value = rpmExpand(macro,NULL);
- printf ("%s
-
rpm-%s := %s\n",package_name,*nav,value);
+ printf ("%s
.
rpm-%s := %s\n",package_name,*nav,value);
}
}
}
}
+ /* export arch */
+ printf ("%s.rpm-arch := %s\n",package_name,target);
+
spec = freeSpec(spec);
done:
spec = freeSpec(spec);
done: