Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Replace instances of ``if x.has_key(y)`` with ``if y in x``.
· 84bb4881
Chris Lamb
authored
May 17, 2018
and
Joerg Jaspert
committed
May 18, 2018
84bb4881
Merge branch 'has-key' into 'master'
· 63738b1e
Joerg Jaspert
authored
May 18, 2018
Replace instances of ``if x.has_key(y)`` with ``if y in x``. See merge request
!28
63738b1e
Show whitespace changes
Inline
Side-by-side
dak/add_user.py
View file @
63738b1e
...
...
@@ -55,8 +55,9 @@ def main():
]
for
i
in
[
"
help
"
]:
if
not
Cnf
.
has_key
(
"
Add-User::Options::%s
"
%
(
i
)):
Cnf
[
"
Add-User::Options::%s
"
%
(
i
)]
=
""
key
=
"
Add-User::Options::%s
"
%
i
if
key
not
in
Cnf
:
Cnf
[
key
]
=
""
apt_pkg
.
parse_commandline
(
Cnf
,
Arguments
,
sys
.
argv
)
...
...
@@ -83,7 +84,7 @@ def main():
primary_key
=
primary_key
.
replace
(
"
"
,
""
)
uid
=
""
if
Cnf
.
has_key
(
"
Add-User::Options::User
"
)
and
Cnf
[
"
Add-User::Options::User
"
]:
if
"
Add-User::Options::User
"
in
Cnf
and
Cnf
[
"
Add-User::Options::User
"
]:
uid
=
Cnf
[
"
Add-User::Options::User
"
]
name
=
Cnf
[
"
Add-User::Options::User
"
]
else
:
...
...
@@ -120,7 +121,7 @@ def main():
session
.
commit
()
# Lets add user to the email-whitelist file if its configured.
if
Cnf
.
has_key
(
"
Dinstall::MailWhiteList
"
)
and
Cnf
[
"
Dinstall::MailWhiteList
"
]
!=
""
:
if
"
Dinstall::MailWhiteList
"
in
Cnf
and
Cnf
[
"
Dinstall::MailWhiteList
"
]
!=
""
:
f
=
utils
.
open_file
(
Cnf
[
"
Dinstall::MailWhiteList
"
],
"
a
"
)
for
mail
in
emails
:
f
.
write
(
mail
+
'
\n
'
)
...
...
dak/admin.py
View file @
63738b1e
...
...
@@ -836,13 +836,13 @@ def show_config(command):
if
mode
==
'
db
'
:
connstr
=
""
if
cnf
.
has_key
(
"
DB::Service
"
)
:
if
"
DB::Service
"
in
cnf
:
# Service mode
connstr
=
"
postgresql://service=%s
"
%
cnf
[
"
DB::Service
"
]
elif
cnf
.
has_key
(
"
DB::Host
"
)
:
elif
"
DB::Host
"
in
cnf
:
# TCP/IP
connstr
=
"
postgres://%s
"
%
cnf
[
"
DB::Host
"
]
if
cnf
.
has_key
(
"
DB::Port
"
)
and
cnf
[
"
DB::Port
"
]
!=
"
-1
"
:
if
"
DB::Port
"
in
cnf
and
cnf
[
"
DB::Port
"
]
!=
"
-1
"
:
connstr
+=
"
:%s
"
%
cnf
[
"
DB::Port
"
]
connstr
+=
"
/%s
"
%
cnf
[
"
DB::Name
"
]
else
:
...
...
@@ -853,16 +853,16 @@ def show_config(command):
print
connstr
elif
mode
==
'
db-shell
'
:
e
=
[]
if
cnf
.
has_key
(
"
DB::Service
"
)
:
if
"
DB::Service
"
in
cnf
:
e
.
append
(
'
PGSERVICE
'
)
print
"
PGSERVICE=%s
"
%
cnf
[
"
DB::Service
"
]
if
cnf
.
has_key
(
"
DB::Name
"
)
:
if
"
DB::Name
"
in
cnf
:
e
.
append
(
'
PGDATABASE
'
)
print
"
PGDATABASE=%s
"
%
cnf
[
"
DB::Name
"
]
if
cnf
.
has_key
(
"
DB::Host
"
)
:
if
"
DB::Host
"
in
cnf
:
print
"
PGHOST=%s
"
%
cnf
[
"
DB::Host
"
]
e
.
append
(
'
PGHOST
'
)
if
cnf
.
has_key
(
"
DB::Port
"
)
and
cnf
[
"
DB::Port
"
]
!=
"
-1
"
:
if
"
DB::Port
"
in
cnf
and
cnf
[
"
DB::Port
"
]
!=
"
-1
"
:
print
"
PGPORT=%s
"
%
cnf
[
"
DB::Port
"
]
e
.
append
(
'
PGPORT
'
)
print
"
export
"
+
"
"
.
join
(
e
)
...
...
@@ -1018,8 +1018,9 @@ def main():
arguments
=
[(
'
h
'
,
"
help
"
,
"
Admin::Options::Help
"
),
(
'
n
'
,
"
dry-run
"
,
"
Admin::Options::Dry-Run
"
)]
for
i
in
[
"
help
"
,
"
dry-run
"
]:
if
not
Cnf
.
has_key
(
"
Admin::Options::%s
"
%
(
i
)):
Cnf
[
"
Admin::Options::%s
"
%
(
i
)]
=
""
key
=
"
Admin::Options::%s
"
%
i
if
key
not
in
Cnf
:
Cnf
[
key
]
=
""
arguments
=
apt_pkg
.
parse_commandline
(
Cnf
,
arguments
,
sys
.
argv
)
...
...
dak/archive_dedup_pool.py
View file @
63738b1e
...
...
@@ -124,8 +124,9 @@ def main():
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
for
i
in
[
"
help
"
]:
if
not
cnf
.
has_key
(
"
Archive-Dedup-Pool::Options::%s
"
%
(
i
)):
cnf
[
"
Archive-Dedup-Pool::Options::%s
"
%
(
i
)]
=
""
key
=
"
Archive-Dedup-Pool::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
Options
=
cnf
.
subtree
(
"
Archive-Dedup-Pool::Options
"
)
...
...
dak/auto_decruft.py
View file @
63738b1e
...
...
@@ -426,8 +426,9 @@ def main ():
(
"
\0
"
,
'
decruft-equal-versions
'
,
"
Auto-Decruft::Options::OtherSuiteDecruftEqual
"
)
]
for
i
in
[
"
help
"
,
"
Dry-Run
"
,
"
Debug
"
,
"
OtherSuite
"
,
"
OtherSuiteRMMsg
"
,
"
OtherSuiteDecruftEqual
"
]:
if
not
cnf
.
has_key
(
"
Auto-Decruft::Options::%s
"
%
(
i
)):
cnf
[
"
Auto-Decruft::Options::%s
"
%
(
i
)]
=
""
key
=
"
Auto-Decruft::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
cnf
[
"
Auto-Decruft::Options::Suite
"
]
=
cnf
.
get
(
"
Dinstall::DefaultSuite
"
,
"
unstable
"
)
...
...
dak/bts_categorize.py
View file @
63738b1e
...
...
@@ -159,7 +159,7 @@ def main():
for
arg
in
arguments
:
opt
=
"
BtsCategorize::Options::%s
"
%
arg
[
1
]
if
not
Cnf
.
has_key
(
opt
)
:
if
opt
not
in
Cnf
:
Cnf
[
opt
]
=
""
packages
=
apt_pkg
.
parse_commandline
(
Cnf
,
arguments
,
sys
.
argv
)
...
...
dak/check_archive.py
View file @
63738b1e
...
...
@@ -98,7 +98,7 @@ def process_dir (unused, dirname, filenames):
return
for
name
in
filenames
:
filename
=
os
.
path
.
abspath
(
os
.
path
.
join
(
dirname
,
name
))
if
os
.
path
.
isfile
(
filename
)
and
not
os
.
path
.
islink
(
filename
)
and
not
db_files
.
has_key
(
filename
)
and
not
excluded
.
has_key
(
filename
)
:
if
os
.
path
.
isfile
(
filename
)
and
not
os
.
path
.
islink
(
filename
)
and
filename
not
in
db_files
and
filename
not
in
excluded
:
waste
+=
os
.
stat
(
filename
)[
stat
.
ST_SIZE
]
print
"
%s
"
%
(
filename
)
...
...
@@ -532,8 +532,9 @@ def main ():
Arguments
=
[(
'
h
'
,
"
help
"
,
"
Check-Archive::Options::Help
"
)]
for
i
in
[
"
help
"
]:
if
not
cnf
.
has_key
(
"
Check-Archive::Options::%s
"
%
(
i
)):
cnf
[
"
Check-Archive::Options::%s
"
%
(
i
)]
=
""
key
=
"
Check-Archive::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
args
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
...
...
dak/check_overrides.py
View file @
63738b1e
...
...
@@ -148,10 +148,10 @@ SELECT s.source FROM source s
if
otype
==
"
dsc
"
:
for
i
in
q
.
fetchall
():
package
=
i
[
0
]
if
src_
package
s
.
has_key
(
package
)
:
if
package
in
src_
package
s
:
src_packages
[
package
]
=
1
else
:
if
blacklist
.
has_key
(
package
)
:
if
package
in
blacklist
:
utils
.
warn
(
"
%s in incoming, not touching
"
%
package
)
continue
Logger
.
log
([
"
removing unused override
"
,
osuite
,
component
,
...
...
@@ -170,7 +170,7 @@ SELECT s.source FROM source s
{
'
suite_id
'
:
osuite_id
,
'
component_id
'
:
component_id
})
for
i
in
q
.
fetchall
():
package
=
i
[
0
]
if
not
src_packages
.
has_key
(
package
)
or
src_packages
[
package
]:
if
package
not
in
src_
package
s
or
src_packages
[
package
]:
continue
src_packages
[
package
]
=
1
...
...
@@ -202,7 +202,7 @@ SELECT s.source FROM source s
'
component_id
'
:
component_id
,
'
type_id
'
:
type_id
})
for
i
in
q
.
fetchall
():
package
=
i
[
0
]
if
not
src_packages
.
has_key
(
package
)
or
src_packages
[
package
]:
if
package
not
in
src_
package
s
or
src_packages
[
package
]:
if
i
[
4
]
and
(
i
[
1
]
!=
i
[
4
]
or
i
[
2
]
!=
i
[
5
]
or
i
[
3
]
!=
i
[
6
]):
Logger
.
log
([
"
syncing override
"
,
osuite
,
component
,
otype
,
package
,
"
source
"
,
sections
[
i
[
5
]],
i
[
6
],
"
source
"
,
sections
[
i
[
2
]],
i
[
3
]])
...
...
@@ -240,10 +240,10 @@ SELECT s.source FROM source s
else
:
# binary override
for
i
in
q
.
fetchall
():
package
=
i
[
0
]
if
package
s
.
has_key
(
package
)
:
if
package
in
package
s
:
packages
[
package
]
=
1
else
:
if
blacklist
.
has_key
(
package
)
:
if
package
in
blacklist
:
utils
.
warn
(
"
%s in incoming, not touching
"
%
package
)
continue
Logger
.
log
([
"
removing unused override
"
,
osuite
,
component
,
...
...
@@ -274,7 +274,7 @@ SELECT s.source FROM source s
'
component_id
'
:
component_id
,
'
type_id
'
:
type_id
})
for
i
in
q
.
fetchall
():
package
=
i
[
0
]
if
not
package
s
.
has_key
(
package
)
or
packages
[
package
]:
if
package
not
in
package
s
or
packages
[
package
]:
if
i
[
4
]
and
(
i
[
1
]
!=
i
[
4
]
or
i
[
2
]
!=
i
[
5
]
or
i
[
3
]
!=
i
[
6
]):
Logger
.
log
([
"
syncing override
"
,
osuite
,
component
,
otype
,
package
,
priorities
[
i
[
4
]],
sections
[
i
[
5
]],
...
...
@@ -324,8 +324,9 @@ def main ():
Arguments
=
[(
'
h
'
,
"
help
"
,
"
Check-Overrides::Options::Help
"
),
(
'
n
'
,
"
no-action
"
,
"
Check-Overrides::Options::No-Action
"
)]
for
i
in
[
"
help
"
,
"
no-action
"
]:
if
not
cnf
.
has_key
(
"
Check-Overrides::Options::%s
"
%
(
i
)):
cnf
[
"
Check-Overrides::Options::%s
"
%
(
i
)]
=
""
key
=
"
Check-Overrides::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
Options
=
cnf
.
subtree
(
"
Check-Overrides::Options
"
)
...
...
dak/clean_queues.py
View file @
63738b1e
...
...
@@ -173,7 +173,7 @@ def flush_orphans ():
for
i
in
(
files
.
keys
(),
dsc_files
.
keys
(),
[
changes_filename
]):
keys
.
extend
(
i
)
for
key
in
keys
:
if
all_files
.
has_key
(
key
)
:
if
key
in
all_files
:
if
Options
[
"
Verbose
"
]:
print
"
Skipping, has parents,
'
%s
'
.
"
%
(
key
)
del
all_files
[
key
]
...
...
@@ -195,9 +195,10 @@ def main ():
cnf
=
Config
()
for
i
in
[
"
Help
"
,
"
Incoming
"
,
"
No-Action
"
,
"
Verbose
"
]:
if
not
cnf
.
has_key
(
"
Clean-Queues::Options::%s
"
%
(
i
)):
cnf
[
"
Clean-Queues::Options::%s
"
%
(
i
)]
=
""
if
not
cnf
.
has_key
(
"
Clean-Queues::Options::Days
"
):
key
=
"
Clean-Queues::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
if
"
Clean-Queues::Options::Days
"
not
in
cnf
:
cnf
[
"
Clean-Queues::Options::Days
"
]
=
"
14
"
Arguments
=
[(
'
h
'
,
"
help
"
,
"
Clean-Queues::Options::Help
"
),
...
...
dak/clean_suites.py
View file @
63738b1e
...
...
@@ -471,8 +471,9 @@ def main():
cnf
=
Config
()
for
i
in
[
"
Help
"
,
"
No-Action
"
,
"
Maximum
"
]:
if
not
cnf
.
has_key
(
"
Clean-Suites::Options::%s
"
%
(
i
)):
cnf
[
"
Clean-Suites::Options::%s
"
%
(
i
)]
=
""
key
=
"
Clean-Suites::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
Arguments
=
[(
'
h
'
,
"
help
"
,
"
Clean-Suites::Options::Help
"
),
(
'
a
'
,
'
archive
'
,
'
Clean-Suites::Options::Archive
'
,
'
HasArg
'
),
...
...
dak/control_overrides.py
View file @
63738b1e
...
...
@@ -161,27 +161,27 @@ def process_file(file, suite, component, otype, mode, action, session):
c_error
+=
1
continue
if
not
section_cache
.
has_key
(
section
)
:
if
section
not
in
section_cache
:
utils
.
warn
(
"'
%s
'
is not a valid section. [
'
%s
'
in suite %s, component %s].
"
%
(
section
,
package
,
suite
,
component
))
c_error
+=
1
continue
section_id
=
section_cache
[
section
]
if
not
priority_cache
.
has_key
(
priority
)
:
if
priority
not
in
priority_cache
:
utils
.
warn
(
"'
%s
'
is not a valid priority. [
'
%s
'
in suite %s, component %s].
"
%
(
priority
,
package
,
suite
,
component
))
c_error
+=
1
continue
priority_id
=
priority_cache
[
priority
]
if
new
.
has_key
(
package
)
:
if
package
in
new
:
utils
.
warn
(
"
Can
'
t insert duplicate entry for
'
%s
'
; ignoring all but the first. [suite %s, component %s]
"
%
(
package
,
suite
,
component
))
c_error
+=
1
continue
new
[
package
]
=
""
if
original
.
has_key
(
package
)
:
if
package
in
original
:
(
old_priority_id
,
old_section_id
,
old_maintainer_override
,
old_priority
,
old_section
)
=
original
[
package
]
if
mode
==
"
add
"
or
old_priority_id
==
priority_id
and
\
old_section_id
==
section_id
and
\
...
...
@@ -236,7 +236,7 @@ def process_file(file, suite, component, otype, mode, action, session):
if
mode
==
"
set
"
:
# Delete any packages which were removed
for
package
in
original
.
keys
():
if
not
new
.
has_key
(
package
)
:
if
package
not
in
new
:
if
action
:
session
.
execute
(
"""
DELETE FROM override
WHERE suite = :suiteid AND component = :componentid
...
...
@@ -311,13 +311,14 @@ def main ():
# Default arguments
for
i
in
[
"
add
"
,
"
help
"
,
"
list
"
,
"
quiet
"
,
"
set
"
,
"
change
"
,
"
no-action
"
]:
if
not
cnf
.
has_key
(
"
Control-Overrides::Options::%s
"
%
(
i
)):
cnf
[
"
Control-Overrides::Options::%s
"
%
(
i
)]
=
""
if
not
cnf
.
has_key
(
"
Control-Overrides::Options::Component
"
):
key
=
"
Control-Overrides::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
if
"
Control-Overrides::Options::Component
"
not
in
cnf
:
cnf
[
"
Control-Overrides::Options::Component
"
]
=
"
main
"
if
not
cnf
.
has_key
(
"
Control-Overrides::Options::Suite
"
)
:
if
"
Control-Overrides::Options::Suite
"
not
in
cnf
:
cnf
[
"
Control-Overrides::Options::Suite
"
]
=
"
unstable
"
if
not
cnf
.
has_key
(
"
Control-Overrides::Options::Type
"
)
:
if
"
Control-Overrides::Options::Type
"
not
in
cnf
:
cnf
[
"
Control-Overrides::Options::Type
"
]
=
"
deb
"
file_list
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
...
...
dak/control_suite.py
View file @
63738b1e
...
...
@@ -398,8 +398,9 @@ def main ():
(
'
s
'
,
"
set
"
,
"
Control-Suite::Options::Set
"
,
"
HasArg
"
)]
for
i
in
[
"
add
"
,
"
britney
"
,
"
help
"
,
"
list
"
,
"
remove
"
,
"
set
"
,
"
version
"
]:
if
not
cnf
.
has_key
(
"
Control-Suite::Options::%s
"
%
(
i
)):
cnf
[
"
Control-Suite::Options::%s
"
%
(
i
)]
=
""
key
=
"
Control-Suite::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
try
:
file_list
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
);
...
...
@@ -411,7 +412,7 @@ def main ():
if
Options
[
"
Help
"
]:
usage
()
force
=
Options
.
has_key
(
"
Force
"
)
and
Options
[
"
Force
"
]
force
=
"
Force
"
in
Options
and
Options
[
"
Force
"
]
action
=
None
...
...
dak/copy_installer.py
View file @
63738b1e
...
...
@@ -43,8 +43,9 @@ def main():
(
'
n
'
,
"
no-action
"
,
"
Copy-Installer::Options::No-Action
"
),
]
for
option
in
[
"
help
"
,
"
source
"
,
"
destination
"
,
"
no-action
"
]:
if
not
cnf
.
has_key
(
"
Copy-Installer::Options::%s
"
%
(
option
)):
cnf
[
"
Copy-Installer::Options::%s
"
%
(
option
)]
=
""
key
=
"
Copy-Installer::Options::%s
"
%
option
if
key
not
in
cnf
:
cnf
[
key
]
=
""
extra_arguments
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
Options
=
cnf
.
subtree
(
"
Copy-Installer::Options
"
)
...
...
dak/cruft_report.py
View file @
63738b1e
...
...
@@ -68,7 +68,7 @@ Check for obsolete or duplicated packages.
def
add_nbs
(
nbs_d
,
source
,
version
,
package
,
suite_id
,
session
):
# Ensure the package is still in the suite (someone may have already removed it)
if
no_longer_in_suite
.
has_key
(
package
)
:
if
package
in
no_longer_in_suite
:
return
else
:
q
=
session
.
execute
(
"""
SELECT b.id FROM binaries b, bin_associations ba
...
...
@@ -105,7 +105,7 @@ def do_anais(architecture, binaries_list, source, session):
for
i
in
ql
:
arch
=
i
[
0
]
version
=
i
[
1
]
if
architectures
.
has_key
(
arch
)
:
if
arch
in
architectures
:
versions
.
append
(
version
)
versions
.
sort
(
apt_pkg
.
version_compare
)
if
versions
:
...
...
@@ -117,7 +117,7 @@ def do_anais(architecture, binaries_list, source, session):
for
i
in
ql
:
arch
=
i
[
0
]
version
=
i
[
1
]
if
not
architectures
.
has_key
(
arch
)
:
if
arch
not
in
architectures
:
versions_d
.
setdefault
(
version
,
[])
versions_d
[
version
].
append
(
arch
)
...
...
@@ -508,15 +508,16 @@ def main ():
(
'
s
'
,
"
suite
"
,
"
Cruft-Report::Options::Suite
"
,
"
HasArg
"
),
(
'
w
'
,
"
wanna-build-dump
"
,
"
Cruft-Report::Options::Wanna-Build-Dump
"
,
"
HasArg
"
)]
for
i
in
[
"
help
"
,
"
Rdep-Check
"
]:
if
not
cnf
.
has_key
(
"
Cruft-Report::Options::%s
"
%
(
i
)):
cnf
[
"
Cruft-Report::Options::%s
"
%
(
i
)]
=
""
key
=
"
Cruft-Report::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
cnf
[
"
Cruft-Report::Options::Suite
"
]
=
cnf
.
get
(
"
Dinstall::DefaultSuite
"
,
"
unstable
"
)
if
not
cnf
.
has_key
(
"
Cruft-Report::Options::Mode
"
)
:
if
"
Cruft-Report::Options::Mode
"
not
in
cnf
:
cnf
[
"
Cruft-Report::Options::Mode
"
]
=
"
daily
"
if
not
cnf
.
has_key
(
"
Cruft-Report::Options::Wanna-Build-Dump
"
)
:
if
"
Cruft-Report::Options::Wanna-Build-Dump
"
not
in
cnf
:
cnf
[
"
Cruft-Report::Options::Wanna-Build-Dump
"
]
=
"
/srv/ftp-master.debian.org/scripts/nfu
"
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
...
...
@@ -591,7 +592,7 @@ def main ():
if
"
bnb
"
in
checks
:
# Check for binaries not built on any architecture.
for
binary
in
binaries_list
:
if
not
bins_in_suite
.
has_key
(
binary
)
:
if
binary
not
in
bins_in_suite
:
bin_not_built
.
setdefault
(
source
,
{})
bin_not_built
[
source
][
binary
]
=
""
...
...
@@ -632,7 +633,7 @@ def main ():
version
=
Packages
.
section
.
find
(
'
Version
'
)
if
source
==
""
:
source
=
package
if
bin2source
.
has_key
(
package
)
and
\
if
package
in
bin2source
and
\
apt_pkg
.
version_compare
(
version
,
bin2source
[
package
][
"
version
"
])
>
0
:
bin2source
[
package
][
"
version
"
]
=
version
bin2source
[
package
][
"
source
"
]
=
source
...
...
@@ -644,7 +645,7 @@ def main ():
m
=
re_extract_src_version
.
match
(
source
)
source
=
m
.
group
(
1
)
version
=
m
.
group
(
2
)
if
not
bin_pkgs
.
has_key
(
package
)
:
if
package
not
in
bin_pkgs
:
nbs
.
setdefault
(
source
,{})
nbs
[
source
].
setdefault
(
package
,
{})
nbs
[
source
][
package
][
version
]
=
""
...
...
dak/dakdb/update70.py
View file @
63738b1e
...
...
@@ -46,7 +46,7 @@ def do_update(self):
c
.
execute
(
"
COMMENT ON COLUMN suite.overrideprocess IS %s
"
,
[
'
If NOT NULL, check-overrides will take missing overrides from the named suite
'
])
# Migrate config file values into database
if
cnf
.
has_key
(
"
Check-Overrides::OverrideSuites
"
)
:
if
"
Check-Overrides::OverrideSuites
"
in
cnf
:
for
suitename
in
cnf
.
subtree
(
"
Check-Overrides::OverrideSuites
"
).
list
():
if
cnf
.
get
(
"
Check-Overrides::OverrideSuites::%s::Process
"
%
suitename
,
"
0
"
)
==
"
1
"
:
print
"
Marking %s to have overrides processed automatically
"
%
suitename
.
lower
()
...
...
dak/examine_package.py
View file @
63738b1e
...
...
@@ -426,7 +426,7 @@ def output_deb_info(suite, filename, packagename, session = None):
if
control
==
''
:
return
formatted_text
(
"
no control info
"
)
to_print
=
""
if
not
package_relations
.
has_key
(
packagename
)
:
if
packagename
not
in
package_relations
:
package_relations
[
packagename
]
=
{}
for
key
in
control_keys
:
if
key
==
'
Pre-Depends
'
:
...
...
@@ -507,7 +507,7 @@ def get_copyright (deb_filename):
copyrightmd5
=
md5
.
md5
(
cright
).
hexdigest
()
res
=
""
if
printed
.
copyright
s
.
has_key
(
copyright
md5
)
and
printed
.
copyrights
[
copyrightmd5
]
!=
"
%s (%s)
"
%
(
package
,
os
.
path
.
basename
(
deb_filename
)):
if
copyright
md5
in
printed
.
copyright
s
and
printed
.
copyrights
[
copyrightmd5
]
!=
"
%s (%s)
"
%
(
package
,
os
.
path
.
basename
(
deb_filename
)):
res
+=
formatted_text
(
"
NOTE: Copyright is the same as %s.
\n\n
"
%
\
(
printed
.
copyrights
[
copyrightmd5
]))
else
:
...
...
@@ -623,8 +623,9 @@ def main ():
(
'
H
'
,
"
html-output
"
,
"
Examine-Package::Options::Html-Output
"
),
]
for
i
in
[
"
Help
"
,
"
Html-Output
"
,
"
partial-html
"
]:
if
not
Cnf
.
has_key
(
"
Examine-Package::Options::%s
"
%
(
i
)):
Cnf
[
"
Examine-Package::Options::%s
"
%
(
i
)]
=
""
key
=
"
Examine-Package::Options::%s
"
%
i
if
key
not
in
Cnf
:
Cnf
[
key
]
=
""
args
=
apt_pkg
.
parse_commandline
(
Cnf
,
Arguments
,
sys
.
argv
)
Options
=
Cnf
.
subtree
(
"
Examine-Package::Options
"
)
...
...
dak/external_overrides.py
View file @
63738b1e
...
...
@@ -159,11 +159,11 @@ def main():
except
KeyError
:
Options
=
{}
if
Options
.
has_key
(
"
Help
"
)
:
if
"
Help
"
in
Options
:
usage
()
force
=
False
if
Options
.
has_key
(
"
Force
"
)
and
Options
[
"
Force
"
]:
if
"
Force
"
in
Options
and
Options
[
"
Force
"
]:
force
=
True
logger
=
daklog
.
Logger
(
'
external-overrides
'
)
...
...
dak/generate_index_diffs.py
View file @
63738b1e
...
...
@@ -135,7 +135,7 @@ class Updates:
fname
=
l
[
2
]
if
fname
.
endswith
(
'
.gz
'
):
fname
=
fname
[:
-
3
]
if
not
self
.
history
.
has_key
(
fname
)
:
if
fname
not
in
self
.
history
:
self
.
history
[
fname
]
=
[
None
,
None
,
None
]
self
.
history_order
.
append
(
fname
)
if
not
self
.
history
[
fname
][
ind
]:
...
...
@@ -262,7 +262,7 @@ def sizehashes(f):
return
(
size
,
sha1sum
,
sha256sum
)
def
genchanges
(
Options
,
outdir
,
oldfile
,
origfile
,
maxdiffs
=
56
):
if
Options
.
has_key
(
"
NoAct
"
)
:
if
"
NoAct
"
in
Options
:
print
"
Not acting on: od: %s, oldf: %s, origf: %s, md: %s
"
%
(
outdir
,
oldfile
,
origfile
,
maxdiffs
)
return
...
...
@@ -304,7 +304,7 @@ def genchanges(Options, outdir, oldfile, origfile, maxdiffs = 56):
# if upd.filesizesha1 != oldsizesha1:
# print "info: old file " + oldfile + " changed! %s %s => %s %s" % (upd.filesizesha1 + oldsizesha1)
if
Options
.
has_key
(
"
CanonicalPath
"
)
:
upd
.
can_path
=
Options
[
"
CanonicalPath
"
]
if
"
CanonicalPath
"
in
Options
:
upd
.
can_path
=
Options
[
"
CanonicalPath
"
]
if
os
.
path
.
exists
(
newfile
):
os
.
unlink
(
newfile
)
smartlink
(
origfile
,
newfile
)
...
...
@@ -364,14 +364,14 @@ def main():
]
suites
=
apt_pkg
.
parse_commandline
(
Cnf
,
Arguments
,
sys
.
argv
)
Options
=
Cnf
.
subtree
(
"
Generate-Index-Diffs::Options
"
)
if
Options
.
has_key
(
"
Help
"
)
:
usage
()
if
"
Help
"
in
Options
:
usage
()
maxdiffs
=
Options
.
get
(
"
MaxDiffs::Default
"
,
"
56
"
)
maxpackages
=
Options
.
get
(
"
MaxDiffs::Packages
"
,
maxdiffs
)
maxcontents
=
Options
.
get
(
"
MaxDiffs::Contents
"
,
maxdiffs
)
maxsources
=
Options
.
get
(
"
MaxDiffs::Sources
"
,
maxdiffs
)
if
not
Options
.
has_key
(
"
PatchName
"
)
:
if
"
PatchName
"
not
in
Options
:
format
=
"
%Y-%m-%d-%H%M.%S
"
Options
[
"
PatchName
"
]
=
time
.
strftime
(
format
)
...
...
@@ -442,12 +442,12 @@ def main():
# Process Contents
file
=
"
%s/%s/Contents-%s
"
%
(
tree
,
component
,
architecture
)
if
Options
.
has_key
(
"
Verbose
"
)
:
print
(
file
)
if
"
Verbose
"
in
Options
:
print
(
file
)
storename
=
"
%s/%s_%s_contents_%s
"
%
(
Options
[
"
TempDir
"
],
suite
,
component
,
architecture
)
genchanges
(
Options
,
file
+
"
.diff
"
,
storename
,
file
,
maxcontents
)
file
=
"
%s/%s/%s/%s
"
%
(
tree
,
component
,
longarch
,
packages
)
if
Options
.
has_key
(
"
Verbose
"
)
:
print
(
file
)
if
"
Verbose
"
in
Options
:
print
(
file
)
storename
=
"
%s/%s_%s_%s
"
%
(
Options
[
"
TempDir
"
],
suite
,
component
,
architecture
)
genchanges
(
Options
,
file
+
"
.diff
"
,
storename
,
file
,
maxsuite
)
...
...
dak/generate_packages_sources2.py
View file @
63738b1e
...
...
@@ -367,7 +367,7 @@ def main():
except
KeyError
:
Options
=
{}
if
Options
.
has_key
(
"
Help
"
)
:
if
"
Help
"
in
Options
:
usage
()
from
daklib.dakmultiprocessing
import
DakProcessPool
,
PROC_STATUS_SUCCESS
,
PROC_STATUS_SIGNALRAISED
...
...
@@ -382,7 +382,7 @@ def main():
import
daklib.utils
if
Options
.
has_key
(
"
Suite
"
)
:
if
"
Suite
"
in
Options
:
suites
=
[]
suite_names
=
daklib
.
utils
.
split_args
(
Options
[
'
Suite
'
])
for
s
in
suite_names
:
...
...
@@ -399,7 +399,7 @@ def main():
query
=
query
.
join
(
Suite
.
archive
).
filter
(
Archive
.
archive_name
.
in_
(
archive_names
))
suites
=
query
.
all
()
force
=
Options
.
has_key
(
"
Force
"
)
and
Options
[
"
Force
"
]
force
=
"
Force
"
in
Options
and
Options
[
"
Force
"
]
def
parse_results
(
message
):
...
...
dak/generate_releases.py
View file @
63738b1e
...
...
@@ -452,8 +452,9 @@ def main ():
cnf
=
Config
()
for
i
in
[
"
Help
"
,
"
Suite
"
,
"
Force
"
,
"
Quiet
"
]:
if
not
cnf
.
has_key
(
"
Generate-Releases::Options::%s
"
%
(
i
)):
cnf
[
"
Generate-Releases::Options::%s
"
%
(
i
)]
=
""
key
=
"
Generate-Releases::Options::%s
"
%
i
if
key
not
in
cnf
:
cnf
[
key
]
=
""
Arguments
=
[(
'
h
'
,
"
help
"
,
"
Generate-Releases::Options::Help
"
),
(
'
a
'
,
'
archive
'
,
'
Generate-Releases::Options::Archive
'
,
'
HasArg
'
),
...
...
dak/graph.py
View file @
63738b1e
...
...
@@ -172,8 +172,9 @@ def main():
(
'
i
'
,
"
images
"
,
"
Graph::Options::Images
"
,
"
HasArg
"
),
(
'
n
'
,
"
names
"
,
"
Graph::Options::Names
"
,
"
HasArg
"
)]
for
i
in
[
"
help
"
]:
if
not
Cnf
.
has_key
(
"
Graph::Options::%s
"
%
(
i
)):
Cnf
[
"
Graph::Options::%s
"
%
(
i
)]
=
""
key
=
"
Graph::Options::%s
"
%
i
if
key
not
in
Cnf
:
Cnf
[
key
]
=
""
apt_pkg
.
parse_commandline
(
Cnf
,
Arguments
,
sys
.
argv
)
...
...
@@ -183,36 +184,36 @@ def main():
names
=
[]
if
Cnf
.
has_key
(
"
Graph::Options::Names
"
)
:
if
"
Graph::Options::Names
"
in
Cnf
:
for
i
in
Cnf
[
"
Graph::Options::Names
"
].
split
(
"
,
"
):
names
.
append
(
i
)
elif
Cnf
.
has_key
(
"
Graph::Names
"
)
:
elif
"
Graph::Names
"
in
Cnf
:
names
=
Cnf
.
value_list
(
"
Graph::Names
"
)
else
:
names
=
default_names
extra_rrdtool_args
=
[]
if
Cnf
.
has_key
(
"
Graph::Options::Extra-Rrd
"
)
:
if
"
Graph::Options::Extra-Rrd
"
in
Cnf
:
for
i
in
Cnf
[
"
Graph::Options::Extra-Rrd
"
].
split
(
"
,
"
):
f
=
open
(
i
)
extra_rrdtool_args
.
extend
(
f
.
read
().
strip
().
split
(
"
\n
"
))
f
.
close
()
elif
Cnf
.
has_key
(
"
Graph::Extra-Rrd
"
)
:
elif
"
Graph::Extra-Rrd
"
in
Cnf
:
for
i
in
Cnf
.
value_list
(
"
Graph::Extra-Rrd
"
):
f
=
open
(
i
)
extra_rrdtool_args
.
extend
(
f
.
read
().
strip
().
split
(
"
\n
"
))
f
.
close
()
if
Cnf
.
has_key
(
"
Graph::Options::Rrd
"
)
:
if
"
Graph::Options::Rrd
"
in
Cnf
:
rrd_dir
=
Cnf
[
"
Graph::Options::Rrd
"
]
elif
Cnf
.
has_key
(
"
Dir::Rrd
"
)
:
elif
"
Dir::Rrd
"
in
Cnf
:
rrd_dir
=
Cnf
[
"
Dir::Rrd
"
]
else
:
print
>>
sys
.
stderr
,
"
No directory to read RRD files from
\n
"
sys
.
exit
(
1
)
if
Cnf
.
has_key
(
"
Graph::Options::Images
"
)
:
if
"
Graph::Options::Images
"
in
Cnf
:
image_dir
=
Cnf
[
"
Graph::Options::Images
"
]
else
:
print
>>
sys
.
stderr
,
"
No directory to write graph images to
\n
"
...
...
Prev
1
2
3
Next