packages: php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.p...

glen glen at pld-linux.org
Tue May 3 08:37:47 CEST 2011


Author: glen                         Date: Tue May  3 06:37:47 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- basic support for role package buildtime dep

---- Files affected:
packages/php-pear-PEAR_Command_Packaging:
   php-pear-PEAR_Command_Packaging.patch (1.14 -> 1.15) 

---- Diffs:

================================================================
Index: packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch
diff -u packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch:1.14 packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch:1.15
--- packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch:1.14	Sun Apr 10 21:09:25 2011
+++ packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch	Tue May  3 08:37:42 2011
@@ -1,5 +1,5 @@
---- PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php	2010-10-20 09:36:32.428771477 +0300
-+++ PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php	2011-04-10 18:34:41.270846822 +0300
+--- PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php	2011-04-10 18:34:41.270846822 +0300
++++ PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php	2011-05-03 09:26:29.397841813 +0300
 @@ -54,6 +54,11 @@
                      'arg' => 'FILE',
                      'doc' => 'Use FILE as RPM spec file template'
@@ -48,7 +48,7 @@
          'chan' => 'php-channel-%c.spec'
      );
      
-@@ -182,11 +189,11 @@
+@@ -182,22 +189,30 @@
       * need to be listed here
       */
      var $_file_prefixes = array(
@@ -64,7 +64,18 @@
          'script' => '%{_bindir}',
          'cfg' => '%{_sysconfdir}/pear',
          'www' => '%{_datadir}/pear/www'
-@@ -197,7 +204,7 @@
+     );
++
++    /**
++     * Role packages to use for non-standard file roles. Used when generating
++     * specs for packages only.
++     */
++    var $_role_packages = array(
++        'horde' => 'php-horde-Horde_Role',
++    );
+     
+     /**
+      * The format to use when adding new RPM header lines to the spec file, in
       * printf format. The first '%s' is the RPM header name followed by a colon,
       * the second is the header value.
       */
@@ -73,7 +84,7 @@
      
      // ------------------------------------------------------------------------
      // --- END DISTRIBUTION CONFIG
-@@ -247,6 +254,7 @@
+@@ -247,6 +262,7 @@
          'test_dir' => '',
          'test_files_statement' => '',// empty string, or list of test files
          'www_files_statement' => '', // empty string, or newline-separated list of files with "www" role
@@ -81,7 +92,7 @@
      );
      
      // The name of the template spec file to use
-@@ -330,15 +338,24 @@
+@@ -330,15 +346,24 @@
          
          // Initialise the RPM package/dep naming format options
          $this->_initialiseNamingOptions($options);        
@@ -108,7 +119,7 @@
          // If source file ends in ".xml" we assume we are creating an RPM spec
          // for a channel rather than an actual package
          if (substr(strtolower($source_file), -4) == '.xml') {
-@@ -378,13 +395,40 @@
+@@ -378,13 +403,40 @@
      /**
       * Format an RPM header line to be added to the spec file
       * @param  string $header The name of the RPM header to be added 
@@ -118,8 +129,7 @@
       */
 -    function _formatRpmHeader($header, $value)
 +    function _formatRpmHeader($header, $values)
-     {
--        return sprintf($this->_spec_line_format, $header . ':', $value);
++    {
 +        // PLD Linux: we want values sorted and each on their line
 +        $values = (array )$values;
 +        sort($values);
@@ -128,7 +138,7 @@
 +            $ret .= sprintf($this->_spec_line_format, $header . ':', $value) . "\n";
 +        }
 +        return $ret;
-     }
++    }
 +
 +
 +    /*
@@ -138,7 +148,8 @@
 +     * @return string Normalized version
 +     */
 +    function _formatRpmVersion($version)
-+    {
+     {
+-        return sprintf($this->_spec_line_format, $header . ':', $value);
 +
 +        // In PLD Linux alpha, beta, rc versions are noted in Release: not Version: tag.
 +        preg_match('/^(?P<version>[0-9.]+)(?P<extraversion>.*)$/', $version, $m);
@@ -147,12 +158,12 @@
 +        }
 +
 +        return $version;
-+    }
+     }
 +
      
      /**
       * Replace a macro in the output spec file
-@@ -410,16 +454,20 @@
+@@ -410,16 +462,20 @@
          } else {
              $package_name = null;
          }
@@ -182,7 +193,7 @@
          // Write the actual file
          $wp = fopen($spec_file, 'wb');
          if (!$wp) {
-@@ -457,7 +505,7 @@
+@@ -457,7 +513,7 @@
          
          $rpmdep = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chandep');
          if (!empty($rpmdep) && $rpmdep != $this->_output['rpm_package']) {
@@ -191,7 +202,7 @@
          }
              
          // Channels don't really have version numbers; this will need to be
-@@ -564,7 +612,7 @@
+@@ -564,7 +620,7 @@
          
          // Set up some of the basic macros
          $this->_output['rpm_package'] = $this->_getRPMName($pf->getPackage(), $pf->getChannel(), null, 'pkg');
@@ -200,7 +211,16 @@
          $this->_output['summary'] = trim($package_info['summary']);
          $this->_output['possible_channel'] = $pf->getChannel();
          $this->_output['channel_alias'] = $this->_getChannelAlias($pf->getPackage(), $pf->getChannel());
-@@ -646,14 +694,24 @@
+@@ -591,7 +647,7 @@
+ 
+         // Generate the Requires and Conflicts for the RPM
+         if ($pf->getDeps()) {
+-            $this->_generatePackageDeps($pf);
++            $this->_generatePackageDeps($pf, $package_info['filelist']);
+         }
+     
+         // Hook to support virtual Provides, where the dependency name differs
+@@ -646,14 +702,24 @@
              if (substr($this->_file_prefixes[$role], -2) == '%s') {
                  $this->_output[$macro_name] = str_replace('%s', $pf->getPackage(), $this->_file_prefixes[$role]);
              } else {
@@ -228,9 +248,12 @@
          
          // Handle doc files
          if (isset($file_list['doc'])) {
-@@ -685,12 +743,11 @@
+@@ -683,14 +749,13 @@
+     }
+     
  
-     function _generatePackageDeps($pf)
+-    function _generatePackageDeps($pf)
++    function _generatePackageDeps($pf, $filelist)
      {
 -        $requires = $conflicts = array();
 +        $buildrequires = $requires = $conflicts = $suggests = array();
@@ -245,7 +268,7 @@
                  
                  if (!isset($dep['type']) || $dep['type'] == 'pkg') {
                      $type = 'pkgdep';
-@@ -698,8 +755,14 @@
+@@ -698,8 +763,14 @@
                      $type = $dep['type'];
                  }
                  
@@ -261,7 +284,7 @@
                  
                  // $package contains the *dependency name* here, which may or may
                  // not be the same as the package name
-@@ -725,21 +788,25 @@
+@@ -725,21 +796,25 @@
                  if ($dep['rel'] == 'has') {
                      // We use $package as the index to the $requires array to de-duplicate deps.
                      // Note that in the case of duplicate deps, versioned deps will "win" - see several lines down.
@@ -296,7 +319,7 @@
          } else {
              $this->_output['package2xml'] = '2'; // tell the spec to use package2.xml
              $deps = $pf->getDeps(true);
-@@ -842,10 +909,10 @@
+@@ -842,10 +917,10 @@
                          }
                      } else {
                          if (isset($dep['min'])) {
@@ -309,7 +332,7 @@
                          }
                          if (isset($dep['exclude'])) {
                              $ex = $dep['exclude'];
-@@ -865,17 +932,108 @@
+@@ -865,17 +940,125 @@
                  $tar->popErrorHandling();
                  if ($a === null || PEAR::isError($a)) {
 -                    $this->_output['package2xml'] = '';
@@ -329,9 +352,7 @@
 +            if (isset($deps['required']['extension'])) {
 +                if (!isset($deps['required']['extension'][0])) {
 +                    $deps['required']['extension'] = array($deps['required']['extension']);
-                 }
--                if (count($conflicts)) {
--                    $this->_output['extra_headers'] .= $this->_formatRpmHeader('Conflicts', implode(', ', $conflicts)) . "\n";
++                }
 +                foreach ((array )$deps['required']['extension'] as $dep) {
 +                    if (!isset($dep['channel'])) $dep['channel'] = null;
 +                    // $package contains the *dependency name* here, which may or may
@@ -343,8 +364,8 @@
 +                    }
 +
 +                    $requires[$package] = $package;
-                 }
-             }
++                }
++            }
 +
 +            if (isset($deps['required']['subpackage'])) {
 +                if (!isset($deps['required']['subpackage'][0])) {
@@ -386,7 +407,9 @@
 +
 +                    // PLD Linux: Fill extra info for _noautoreq deps
 +                    $this->_output['_noautoreq'] .= " pear(". str_replace('_', '/', $dep['name']) . ".*)";
-+                }
+                 }
+-                if (count($conflicts)) {
+-                    $this->_output['extra_headers'] .= $this->_formatRpmHeader('Conflicts', implode(', ', $conflicts)) . "\n";
 +            }
 +
 +            if (isset($deps['optional']['extension'])) {
@@ -406,7 +429,24 @@
 +
 +                    // suggests are not versioned (makes no sense in poldek)
 +                    $suggests[$package] = $package;
+                 }
+             }
+         }
++
++        // go over filelist, to see if we need custom Role package presence
++        foreach ($filelist as $filename => $attr) {
++            // Ignore files with no role set or that didn't get installed
++            if (!isset($attr['role']) || !isset($attr['installed_as'])) {
++                continue;
++            }
++            $role = $attr['role'];
++            
++            if (!isset($this->_file_prefixes[$role])) {
++                if (isset($this->_role_packages[$role])) {
++                    $pkg = $this->_role_packages[$role];
++                    $buildrequires[$pkg] = $pkg;
 +                }
++                // TODO: else use some rpm virtual provides for role?
 +            }
 +        }
 +
@@ -422,10 +462,10 @@
 +        }
 +        if (count($suggests)) {
 +            $this->_output['extra_headers'] .= $this->_formatRpmHeader('Suggests', $suggests) . "\n";
-         }
++        }
      }
  
-@@ -927,9 +1085,21 @@
+@@ -927,9 +1110,21 @@
              case 'pkg':
                  return $this->_getRPMNameFromFormat($this->_rpm_pkgname_format['pkg'], $package_name, $chan_name, $chan_alias);
              case 'pkgdep':
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/php-pear-PEAR_Command_Packaging/php-pear-PEAR_Command_Packaging.patch?r1=1.14&r2=1.15&f=u



More information about the pld-cvs-commit mailing list