Bug 886460

Summary: createrepo --checkts option only compares one RPM from repo with the repodata directory.
Product: Red Hat Enterprise Linux 6 Reporter: Kenneth MacDonald <k.macdonald>
Component: createrepoAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: james.antill, jzeleny, ksrot, zpavlas
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-14 13:51:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Check all RPM file timestamps
none
Fix checkts option none

Description Kenneth MacDonald 2012-12-12 10:47:53 UTC
Description of problem:

The --checkts option for createrepo only compares the timestamp on the repodata directory with the *first* rpm in the list of RPMs in the repo.

Version-Release number of selected component (if applicable):

createrepo-0.9.8-5.el6.noarch.rpm

How reproducible:

Almost all the time

Steps to Reproduce:
1. Use --checkts option

Additional info:

I tracked this down to a change in the source code between RHEL5 and RHEL6.

In RHEL5 (createrepo-0.4.11-3.el5.noarch.rpm) /usr/share/createrepo/genpkgmetadata.py:118

   118      def checkTimeStamps(self, directory):
   119          if self.cmds['checkts']:
   120              files = self.getFileList(self.cmds['basedir'], directory, '.
rpm')
   121              files = self.trimRpms(files)
   122              for f in files:
   123                  fn = os.path.join(self.cmds['basedir'], directory, f)
   124                  if not os.path.exists(fn):
   125                      errorprint(_('cannot get to file: %s') % fn)
   126                  if os.path.getctime(fn) > self.cmds['mdtimestamp']:
   127                      return False
   128          return True

In RHEL6 (createrepo-0.9.8-5.el6.noarch.rpm) /usr/lib/python2.6/site-packages/createrepo/__init__.py:288

   288      def checkTimeStamps(self):
   289          """check the timestamp of our target dir. If it is not newer tha
n 
   290             the repodata return False, else True"""
   291          if self.conf.checkts:
   292              dn = os.path.join(self.conf.basedir, self.conf.directory)
   293              files = self.getFileList(dn, '.rpm')
   294              files = self.trimRpms(files)
   295              for f in files:
   296                  fn = os.path.join(self.conf.basedir, self.conf.directory
, f)
   297                  if not os.path.exists(fn):
   298                      self.callback.errorlog(_('cannot get to file: %s') %
 fn)
   299                  if os.path.getctime(fn) > self.conf.mdtimestamp:
   300                      return False
   301                  else:
   302                      return True
   303                  
   304          return False

Lines 300 and 301 are not required.  They cause the function to return if the first RPM it looks at is older than the repodata.

Comment 2 Kenneth MacDonald 2012-12-13 11:38:29 UTC
Created attachment 662908 [details]
Check all RPM file timestamps

My earlier suggested fix was wrong.  I've tested this patch and it works against my repos.

Comment 3 RHEL Program Management 2012-12-17 06:48:46 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Kenneth MacDonald 2013-01-23 11:21:02 UTC
Created attachment 685832 [details]
Fix checkts option

The previous patch didn't work unless the --checkts option was used.

Comment 5 James Antill 2013-04-16 20:22:36 UTC
Upstream fix:

commit ad8110649baeb8bb9826c9d55be16c023734493e
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Mon Oct 5 16:13:48 2009 -0400

Comment 10 Zdeněk Pavlas 2013-05-14 12:48:02 UTC
commit ad8110649baeb8bb9826c9d55be16c023734493e is already in createrepo-0.9.9.tar.gz, the bug should not be in rhel-6.5.  Unless someone reproduces this, I'm closing it as CURRENTRELEASE.

Comment 11 James Antill 2013-05-14 13:51:02 UTC
Yeh, confirmed. This got fixed as part of the rebase for multitasking.