mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 10:34:05 +00:00 
			
		
		
		
	Move Dates into a new state-dir
Partly solves GH#2. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
		
							parent
							
								
									6d6a7ac529
								
							
						
					
					
						commit
						bcff800040
					
				@ -13,6 +13,11 @@ EXCUSES_YAML_OUTPUT = /srv/release.debian.org/britney/var/data-b2/output/excuses
 | 
			
		||||
UPGRADE_OUTPUT    = /srv/release.debian.org/britney/var/data-b2/output/output.txt
 | 
			
		||||
HEIDI_OUTPUT      = /srv/release.debian.org/britney/var/data-b2/output/HeidiResult
 | 
			
		||||
 | 
			
		||||
# Directory for input files that Britney will update herself
 | 
			
		||||
# (e.g. aging information) or will need regular updates
 | 
			
		||||
# (e.g. urgency information).
 | 
			
		||||
STATE_DIR          = /srv/release.debian.org/britney/state
 | 
			
		||||
 | 
			
		||||
# List of release architectures
 | 
			
		||||
ARCHITECTURES     = i386 amd64 arm64 armel armhf mips mipsel powerpc ppc64el s390x
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -91,7 +91,8 @@ class AgePolicy(BasePolicy):
 | 
			
		||||
         will simply use the default urgency (see the "Config" section below)
 | 
			
		||||
       - In Debian, these values are taken from the .changes file, but that is
 | 
			
		||||
         not a requirement for Britney.
 | 
			
		||||
     * ${TESTING}/Dates: File containing the age of all source packages.
 | 
			
		||||
     * ${STATE_DIR}/age-policy-dates: File containing the age of all source
 | 
			
		||||
       packages.
 | 
			
		||||
       - The policy will automatically update this file.
 | 
			
		||||
    Config:
 | 
			
		||||
     * DEFAULT_URGENCY: Name of the urgency used for packages without an urgency
 | 
			
		||||
@ -185,7 +186,14 @@ class AgePolicy(BasePolicy):
 | 
			
		||||
    def _read_dates_file(self):
 | 
			
		||||
        """Parse the dates file"""
 | 
			
		||||
        dates = self._dates
 | 
			
		||||
        filename = os.path.join(self.options.testing, 'Dates')
 | 
			
		||||
        fallback_filename = os.path.join(self.options.testing, 'Dates')
 | 
			
		||||
        try:
 | 
			
		||||
            filename = os.path.join(self.options.state_dir, 'age-policy-dates')
 | 
			
		||||
            if not os.path.exists(filename) and os.path.exists(fallback_filename):
 | 
			
		||||
                filename = fallback_filename
 | 
			
		||||
        except AttributeError:
 | 
			
		||||
            filename = fallback_filename
 | 
			
		||||
 | 
			
		||||
        with open(filename, encoding='utf-8') as fd:
 | 
			
		||||
            for line in fd:
 | 
			
		||||
                # <source> <version> <date>
 | 
			
		||||
@ -232,14 +240,24 @@ class AgePolicy(BasePolicy):
 | 
			
		||||
 | 
			
		||||
    def _write_dates_file(self):
 | 
			
		||||
        dates = self._dates
 | 
			
		||||
        directory = self.options.testing
 | 
			
		||||
        filename = os.path.join(directory, 'Dates')
 | 
			
		||||
        filename_tmp = os.path.join(directory, 'Dates_new')
 | 
			
		||||
        try:
 | 
			
		||||
            directory = self.options.state_dir
 | 
			
		||||
            basename = 'age-policy-dates'
 | 
			
		||||
            old_file = os.path.join(self.options.testing, 'Dates')
 | 
			
		||||
        except AttributeError:
 | 
			
		||||
            directory = self.options.testing
 | 
			
		||||
            basename = 'Dates'
 | 
			
		||||
            old_file = None
 | 
			
		||||
        filename = os.path.join(directory, basename)
 | 
			
		||||
        filename_tmp = os.path.join(directory, '%s_new' % basename)
 | 
			
		||||
        with open(filename_tmp, 'w', encoding='utf-8') as fd:
 | 
			
		||||
            for pkg in sorted(dates):
 | 
			
		||||
                version, date = dates[pkg]
 | 
			
		||||
                fd.write("%s %s %d\n" % (pkg, version, date))
 | 
			
		||||
        os.rename(filename_tmp, filename)
 | 
			
		||||
        if old_file is not None and os.path.exists(old_file):
 | 
			
		||||
            self.log("Removing old age-policy-dates file %s" % old_file)
 | 
			
		||||
            os.unlink(old_file)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RCBugPolicy(BasePolicy):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user