fedora-rpmdevtools newspec.conf, NONE, 1.1 rpmdev-newspec, 1.6, 1.7 rpmdevtools.spec, 1.45, 1.46

Ville Skytta (scop) fedora-extras-commits at redhat.com
Sat Dec 8 18:44:11 UTC 2007


Author: scop

Update of /cvs/fedora/fedora-rpmdevtools
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12241

Modified Files:
	rpmdev-newspec rpmdevtools.spec 
Added Files:
	newspec.conf 
Log Message:
Add option to use macro style instead of shell style variables to newspec


--- NEW FILE newspec.conf ---
# Configuration file for rpmdev-newspec                              -*- sh -*-

# Set NEWSPEC_PREFER_MACROS to a non-empty value if you prefer macro style
# variables over shell style ones.
#
NEWSPEC_PREFER_MACROS=

# Source user configuration
if [ -f "$HOME/.config/rpmdevtools/newspec.conf" ] ; then
    . "$HOME/.config/rpmdevtools/newspec.conf"
fi


Index: rpmdev-newspec
===================================================================
RCS file: /cvs/fedora/fedora-rpmdevtools/rpmdev-newspec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- rpmdev-newspec	8 Dec 2007 16:20:33 -0000	1.6
+++ rpmdev-newspec	8 Dec 2007 18:44:09 -0000	1.7
@@ -22,6 +22,11 @@
 SPECDIR="/etc/rpmdevtools"
 DEFTYPE="minimal"
 DEFSPEC="newpackage.spec"
+CONFIG="/etc/rpmdevtools/newspec.conf"
+
+if [ -f "$CONFIG" ] ; then
+    . "$CONFIG"
+fi
 
 usage() {
     ret=${1:-0}
@@ -35,7 +40,10 @@
            from <appname>, falling back to "$DEFTYPE" if the guesswork
            does not result in a more specific one or if <appname> is not
            given.  See $SPECDIR/spectemplate-*.spec for available types.
+  -m       Emit templates that use macros instead of shell style variables.
   -h       Show this usage message
+
+System wide configuration file is $CONFIG.
 EOF
     exit $ret
 }
@@ -54,6 +62,9 @@
             shift
             specfile="$1"
             ;;
+        -m|--macros)
+            NEWSPEC_PREFER_MACROS=1
+            ;;
         -h|--help)
             usage 0
             ;;
@@ -117,6 +128,22 @@
     specfile=/dev/stdout
 fi
 
+if [ -n "$NEWSPEC_PREFER_MACROS" ] ; then
+    # This assumes templates are written using the shell style variables,
+    # without surrounding curly braces.
+    specfilter="$specfilter \
+                ; s/\\\$RPM_SOURCE_DIR\\b/%{_sourcedir}/g \
+                ; s/\\\$RPM_BUILD_DIR\\b/%{_builddir}/g \
+                ; s/\\\$RPM_OPT_FLAGS\\b/%{optflags}/g \
+                ; s/\\\$RPM_ARCH\\b/%{_arch}/g \
+                ; s/\\\$RPM_OS\\b/%{_os}/g \
+                ; s/\\\$RPM_DOC_DIR\\b/%{_docdir}/g \
+                ; s/\\\$RPM_PACKAGE_NAME\\b/%{name}/g \
+                ; s/\\\$RPM_PACKAGE_VERSION\\b/%{version}/g \
+                ; s/\\\$RPM_PACKAGE_RELEASE\\b/%{release}/g \
+                ; s/\\\$RPM_BUILD_ROOT\\b/%{buildroot}/g"
+fi
+
 cat "$tempspec" | sed -e "s/^\\(Name:\\s*\\)$/\\1$appname/ $specfilter" \
   > "$specfile"
 


Index: rpmdevtools.spec
===================================================================
RCS file: /cvs/fedora/fedora-rpmdevtools/rpmdevtools.spec,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- rpmdevtools.spec	8 Dec 2007 16:20:33 -0000	1.45
+++ rpmdevtools.spec	8 Dec 2007 18:44:09 -0000	1.46
@@ -125,6 +125,7 @@
 %changelog
 * Sat Dec  8 2007 Ville Skyttä <ville.skytta at iki.fi>
 - Add fonts spec template from the Fedora Fonts SIG (#407781).
+- Add option to use macro style instead of shell style variables to newspec.
 
 * Fri Oct 12 2007 Lubomir Kundrak <lkundrak at redhat.com> - 6.4-1
 - Import the previous fix into CVS to resync, bump version




More information about the fedora-extras-commits mailing list