Explorar o código

cleanup packaging and fix location of config files

Ralf S. Engelschall %!s(int64=20) %!d(string=hai) anos
pai
achega
7ecf726e4b
Modificáronse 2 ficheiros con 48 adicións e 18 borrados
  1. 9 0
      viewvc/viewvc.patch
  2. 39 18
      viewvc/viewvc.spec

+ 9 - 0
viewvc/viewvc.patch

@@ -21,6 +21,15 @@ Index: viewcvs-install
  
  
  ## list of files for installation
+@@ -75,7 +75,7 @@
+     ("lib/PyFontify.py", "lib/PyFontify.py", 0644, 0, 0, 1),
+     ("lib/blame.py", "lib/blame.py", 0644, 0, 0, 1),
+     ("lib/compat.py", "lib/compat.py", 0644, 0, 0, 1),
+-    ("lib/config.py", "lib/config.py", 0644, 0, 0, 1),
++    ("lib/config.py", "lib/config.py", 0644, 1, 0, 1),
+     ("lib/cvsdb.py", "lib/cvsdb.py", 0644, 1, 0, 1),
+     ("lib/dbi.py", "lib/dbi.py", 0644, 0, 0, 1),
+     ("lib/debug.py", "lib/debug.py", 0644, 0, 0, 1),
 @@ -159,6 +160,8 @@
  def InstallFile(src_path, dest_path, mode, set_python_paths, prompt_replace,
                  compile_it):

+ 39 - 18
viewvc/viewvc.spec

@@ -22,7 +22,9 @@
 ##  SUCH DAMAGE.
 ##
 
-#   FIXME: rse: the configuration files are not located under etc/viewvc/ and not tagged %config
+#   package version
+%define       V_dist   0.9.4
+%define       V_subdir 3330/27671
 
 #   package information
 Name:         viewvc
@@ -34,22 +36,21 @@ Distribution: OpenPKG
 Class:        EVAL
 Group:        Web
 License:      BSD
-Version:      0.9.4
-Release:      20060113
+Version:      %{V_dist}
+Release:      20060207
 
 #   package options
 %option       with_cvsgraph no
 
 #   list of sources
-Source0:      http://viewvc.tigris.org/files/documents/3330/27671/viewcvs-%{version}.tar.gz
+Source0:      http://viewvc.tigris.org/files/documents/%{V_subdir}/viewcvs-%{V_dist}.tar.gz
 Patch0:       viewvc.patch
 
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 20040130, python
-PreReq:       OpenPKG, openpkg >= 20040130
-PreReq:       diffutils, rcs, python, enscript
+PreReq:       OpenPKG, openpkg >= 20040130, python, diffutils, rcs, enscript
 %if  "%{with_cvsgraph}" == "yes"
 PreReq:       cvsgraph
 %endif
@@ -67,27 +68,32 @@ AutoReqProv:  no
 
 %track
     prog viewvc = {
-        version   = %{version}
-        url       = http://www.viewvc.tigris.org/files/documents/3330/27671/
-        regex     = view(vc|cvs)-(__VER__)\.tar\.gz
+        version   = %{V_dist}
+        url       = http://viewvc.tigris.org/servlets/ProjectDocumentList?folderID=6004
+        regex     = /files/documents/\d+/\d+/view(?:vc|cvs)-(__VER__)\.tar\.gz
+    }
+    prog viewvc:subdir = {
+        version   = %{V_subdir}
+        url       = http://viewvc.tigris.org/servlets/ProjectDocumentList?folderID=6004
+        regex     = /files/documents/(\d+/\d+)/view(?:vc|cvs)-__VER__\.tar\.gz
     }
 
 %prep
-    %setup -q -n viewcvs-%{version}
+    %setup -q -n viewcvs-%{V_dist}
     %patch -p0
 
 %build
     %{l_shtool} subst \
-        -e "s,@RPM_BUILD_ROOT@,$RPM_BUILD_ROOT," \
+        -e "s;@RPM_BUILD_ROOT@;$RPM_BUILD_ROOT;" \
         viewcvs-install
     %{l_shtool} subst \
-        -e "s,^use_enscript =.*,use_enscript = 1," \
-        -e "s,^enscript_path =.*,enscript_path = %{l_prefix}/bin/," \
+        -e "s;^use_enscript =.*;use_enscript = 1;" \
+        -e "s;^enscript_path =.*;enscript_path = %{l_prefix}/bin/;" \
         cgi/viewcvs.conf.dist
 %if "%{with_cvsgraph}" == "yes"
     %{l_shtool} subst \
-        -e "s,^use_cvsgraph =.*,use_cvsgraph = 1," \
-        -e "s,^cvsgraph_path =.*,cvsgraph_path = %{l_prefix}/bin/," \
+        -e "s;^use_cvsgraph =.*;use_cvsgraph = 1;" \
+        -e "s;^cvsgraph_path =.*;cvsgraph_path = %{l_prefix}/bin/;" \
         cgi/viewcvs.conf.dist
 %endif
 
@@ -96,9 +102,24 @@ AutoReqProv:  no
     %{l_shtool} mkdir -f -p -m 755 \
         $RPM_BUILD_ROOT%{l_prefix}/share/viewvc
     echo "%{l_prefix}/share/viewvc" | ./viewcvs-install
-    mv $RPM_BUILD_ROOT%{l_prefix}/share/viewvc/cgi \
-       $RPM_BUILD_ROOT%{l_prefix}/cgi
-    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+    for py in $RPM_BUILD_ROOT%{l_prefix}/share/viewvc/lib/*.py; do
+        %{l_shtool} subst -q \
+            -e 's;%{l_prefix}/share/viewvc/viewcvs\.conf;%{l_prefix}/etc/viewvc/viewcvs.conf;g' \
+            -e 's;%{l_prefix}/share/viewvc/cvsgraph\.conf;%{l_prefix}/etc/viewvc/cvsgraph.conf;g' \
+            $py
+        eval "%{l_prefix}/bin/python -c 'import py_compile; py_compile.compile(\"$py\")'"
+    done
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/viewvc
+    mv  $RPM_BUILD_ROOT%{l_prefix}/share/viewvc/viewcvs.conf \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/viewvc/viewcvs.conf
+    mv  $RPM_BUILD_ROOT%{l_prefix}/share/viewvc/cvsgraph.conf \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/viewvc/cvsgraph.conf
+    mv  $RPM_BUILD_ROOT%{l_prefix}/share/viewvc/cgi \
+        $RPM_BUILD_ROOT%{l_prefix}/cgi
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/viewvc/*'
 
 %files -f files