* Mark Huang <mlhuang@cs.princeton.edu>
* Copyright (C) 2006 The Trustees of Princeton University
*
- * $Id$
*/
#include <stdio.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[] = {
+ { 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 },
};
/* Stolen from rpm/build/spec.c:rpmspecQuery() */
-Spec
+rpmSpec
rpmspecGet(rpmts ts, const char * arg)
{
char * buildRoot = NULL;
poptContext context;
rpmts ts = NULL;
int ec = 0;
- Spec spec;
+ rpmSpec spec;
struct Source *source;
Package pkg;
const char *name, *version, *release, *arch, *unused;
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);
break;
}
}
arch=target;
}
}
- /* skip empty packages */
- if (pkg->fileList) {
- /* attach (add) rpm path to package */
- printf("%s.rpms += RPMS/%s/%s-%s-%s.%s.rpm\n",
- 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 package to rpm name for backward resolution - should be unique */
- printf("%s.package := %s\n",
- name,package_name);
+ /* skip empty packages
+ *
+ * Unfortunately, f8 + the RHEL kernel break this bit of cleverness. The following
+ * line returns false for the kernel-devel package even though it is not empty thereby breaking the build.
+ * Rather than unfolding the kernel package macros in the current specfile, this hack should work till f8 dies its natural death. */
+
+ if (pkg->fileList || !strncmp(name,"kernel",sizeof("kernel")-1)) {
+ /* attach (add) rpm path to package */
+ printf("%s.rpms += RPMS/%s/%s-%s-%s.%s.rpm\n",
+ 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 package to rpm name for backward resolution - should be unique */
+ printf("%s.package := %s\n",
+ name,package_name);
}
}
}
/* 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++) {