3 """ Generate Packages/Sources files
5 @contact: Debian FTPMaster <ftpmaster@debian.org>
6 @copyright: 2000, 2001, 2002, 2006 James Troup <james@nocrew.org>
7 @copyright: 2009 Mark Hymers <mhy@debian.org>
8 @copyright: 2010 Joerg Jaspert <joerg@debian.org>
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ################################################################################
32 from datetime import datetime
35 from daklib import daklog
36 from daklib.dbconn import *
37 from daklib.config import Config
38 from daklib.threadpool import ThreadPool
40 ################################################################################
45 ################################################################################
47 def usage (exit_code=0):
48 print """Usage: dak generate-packages-sources [OPTIONS]
49 Generate the Packages/Sources files
51 -s, --suite=SUITE(s) process this suite
52 Default: All suites not marked 'untouchable'
53 -f, --force Allow processing of untouchable suites
54 CAREFUL: Only to be used at point release time!
55 -h, --help show this help and exit
57 SUITE can be a space seperated list, e.g.
58 --suite=unstable testing
63 ################################################################################
66 global Options, Logger
70 for i in ["Help", "Suite", "Force"]:
71 if not cnf.has_key("Generate-Packages-Sources::Options::%s" % (i)):
72 cnf["Generate-Packages-Sources::Options::%s" % (i)] = ""
74 Arguments = [('h',"help","Generate-Packages-Sources::Options::Help"),
75 ('s',"suite","Generate-Packages-Sources::Options::Suite"),
76 ('f',"force","Generate-Packages-Sources::Options::Force")]
78 suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
79 Options = cnf.SubTree("Generate-Packages-Sources::Options")
84 Logger = daklog.Logger(cnf, 'generate-packages-sources')
86 session = DBConn().session()
92 suite = get_suite(s.lower(), session)
96 print "cannot find suite %s" % s
97 Logger.log(['cannot find suite %s' % s])
99 suites=session.query(Suite).filter(Suite.untouchable == False).all()
101 threadpool = ThreadPool()
103 startdir = os.getcwd()
104 os.chdir(cnf["Dir::TempPath"])
106 # For each given suite, each architecture, run one apt-ftparchive
108 arch_list=get_suite_architectures(s.suite_name, skipsrc=False, skipall=True, session=session)
109 Logger.log(['generating output for Suite %s, Architectures %s' % (s.suite_name, arch_list)])
111 threadpool.queueTask(s.generate_packages_sources, (a.arch_string))
115 # this script doesn't change the database
119 #######################################################################################
121 if __name__ == '__main__':