SOURCES: rpm-specdump.c - add nosource sample, fox rpmExpand usage

glen glen at pld-linux.org
Wed Jan 23 02:29:55 CET 2008


Author: glen                         Date: Wed Jan 23 01:29:55 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add nosource sample, fox rpmExpand usage

---- Files affected:
SOURCES:
   rpm-specdump.c (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/rpm-specdump.c
diff -u SOURCES/rpm-specdump.c:1.2 SOURCES/rpm-specdump.c:1.3
--- SOURCES/rpm-specdump.c:1.2	Wed Jan 23 02:12:34 2008
+++ SOURCES/rpm-specdump.c	Wed Jan 23 02:29:50 2008
@@ -38,6 +38,19 @@
  *  s SOURCE0 /home/glen/rpm/pld/SOURCES/qemu-0.9.0.tar.gz
  *  s SOURCEURL0 http://fabrice.bellard.free.fr/qemu/qemu-0.9.0.tar.gz
  *
+ * And with NoSource: 1, NoSource: 2
+ *
+ *  $ ../test/rpm-specdump ./ZendDebugger.spec
+ *  h PACKAGE_NAME ZendDebugger
+ *  h PACKAGE_VERSION 5.2.10
+ *  h PACKAGE_RELEASE 0.4
+ *  s SOURCE1 /home/glen/rpm/pld/SOURCES!/ZendDebugger-5.2.10-linux-glibc23-x86_64.tar.gz
+ *  s SOURCEURL1 http://downloads.zend.com/pdt/server-debugger/ZendDebugger-5.2.10-linux-glibc23-x86_64.tar.gz
+ *  s nosource 1
+ *  s SOURCE0 /home/glen/rpm/pld/SOURCES!/ZendDebugger-5.2.10-linux-glibc21-i386.tar.gz
+ *  s SOURCEURL0 http://downloads.zend.com/pdt/server-debugger/ZendDebugger-5.2.10-linux-glibc21-i386.tar.gz
+ *  s nosource 0
+ *
  * Compile with:
  * gcc -lrpm -I/usr/include/rpm -lrpmbuild rpm-specdump.c -o rpm-specdump
  *
@@ -265,16 +278,15 @@
 		headerGetEntryMinMemory(h, RPMTAG_VERSION, NULL, (void *)&version, NULL) == 0 ||
 		headerGetEntryMinMemory(h, RPMTAG_RELEASE, NULL, (void *)&release, NULL) == 0
 		) {
-		printf(stderr, "NVR query failed\n");
+		fprintf(stderr, "NVR query failed\n");
 		return EXIT_FAILURE;
 	}
 
 	printf("h PACKAGE_NAME %s\n", name);
 	printf("h PACKAGE_VERSION %s\n", version);
 	printf("h PACKAGE_RELEASE %s\n", release);
-	// XXX kill the ! hack
-	const char *sourcedir = rpmExpand("%{_sourcedir}!"); *(strchr(sourcedir, '!')) = '\0';
-	const char *patchdir = rpmExpand("%{_patchdir}!"); *(strchr(patchdir, '!')) = '\0';
+	const char *sourcedir = rpmExpand("%{_sourcedir}", NULL);
+	const char *patchdir = rpmExpand("%{_patchdir}", NULL);
 
 	struct Source *ps = s->sources;
 	while (ps) {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/rpm-specdump.c?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list