Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Fix E302: Expected 2 blank lines, found 0
· 32343595
Bastian Blank
authored
May 19, 2018
and
Joerg Jaspert
committed
May 19, 2018
32343595
Merge branch 'fix-E302' into 'master'
· 88aa701b
Joerg Jaspert
authored
May 19, 2018
Fix E302: Expected 2 blank lines, found 0 See merge request
!49
88aa701b
Show whitespace changes
Inline
Side-by-side
dak/acl.py
View file @
88aa701b
...
...
@@ -23,6 +23,7 @@ import sys
from
daklib.dbconn
import
DBConn
,
Fingerprint
,
Keyring
,
Uid
,
ACL
def
usage
():
print
(
"""
Usage:
dak acl set-fingerprints <acl-name>
...
...
@@ -42,6 +43,7 @@ def usage():
Grant (revoke) per-source upload rights for ACL <acl-name>.
"""
)
def
get_fingerprint
(
entry
,
session
):
"""
get fingerprint for given ACL entry
...
...
@@ -76,6 +78,7 @@ def get_fingerprint(entry, session):
return
q
.
all
()
def
acl_set_fingerprints
(
acl_name
,
entries
):
session
=
DBConn
().
session
()
acl
=
session
.
query
(
ACL
).
filter_by
(
name
=
acl_name
).
one
()
...
...
@@ -94,6 +97,7 @@ def acl_set_fingerprints(acl_name, entries):
session
.
commit
()
def
acl_export_per_source
(
acl_name
):
session
=
DBConn
().
session
()
acl
=
session
.
query
(
ACL
).
filter_by
(
name
=
acl_name
).
one
()
...
...
@@ -126,6 +130,7 @@ def acl_export_per_source(acl_name):
session
.
rollback
()
session
.
close
()
def
acl_allow
(
acl_name
,
fingerprint
,
sources
):
tbl
=
DBConn
().
tbl_acl_per_source
...
...
@@ -150,6 +155,7 @@ def acl_allow(acl_name, fingerprint, sources):
session
.
commit
()
def
acl_deny
(
acl_name
,
fingerprint
,
sources
):
tbl
=
DBConn
().
tbl_acl_per_source
...
...
@@ -167,6 +173,7 @@ def acl_deny(acl_name, fingerprint, sources):
session
.
commit
()
def
main
(
argv
=
None
):
if
argv
is
None
:
argv
=
sys
.
argv
...
...
dak/add_user.py
View file @
88aa701b
...
...
@@ -32,6 +32,7 @@ Logger = None
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: add-user [OPTION]...
Adds a new user to the dak databases and keyrings
...
...
@@ -43,6 +44,7 @@ Adds a new user to the dak databases and keyrings
################################################################################
def
main
():
global
Cnf
keyrings
=
None
...
...
dak/admin.py
View file @
88aa701b
...
...
@@ -36,17 +36,22 @@ dispatch = {}
dryrun
=
False
################################################################################
def
warn
(
msg
):
print
>>
sys
.
stderr
,
msg
def
die
(
msg
,
exit_code
=
1
):
print
>>
sys
.
stderr
,
msg
sys
.
exit
(
exit_code
)
def
die_arglen
(
args
,
args_needed
,
msg
):
if
len
(
args
)
<
args_needed
:
die
(
msg
)
def
usage
(
exit_code
=
0
):
"""
Perform administrative work on the dak database.
"""
...
...
@@ -153,6 +158,7 @@ Perform administrative work on the dak database.
################################################################################
def
__architecture_list
(
d
,
args
):
q
=
d
.
session
().
query
(
Architecture
).
order_by
(
Architecture
.
arch_string
)
for
j
in
q
.
all
():
...
...
@@ -162,6 +168,7 @@ def __architecture_list(d, args):
print
j
.
arch_string
sys
.
exit
(
0
)
def
__architecture_add
(
d
,
args
):
die_arglen
(
args
,
4
,
"
E: adding an architecture requires a name and a description
"
)
print
"
Adding architecture %s
"
%
args
[
2
]
...
...
@@ -188,6 +195,7 @@ def __architecture_add(d, args):
die
(
"
E: Error adding architecture %s (%s)
"
%
(
args
[
2
],
e
))
print
"
Architecture %s added
"
%
(
args
[
2
])
def
__architecture_rm
(
d
,
args
):
die_arglen
(
args
,
3
,
"
E: removing an architecture requires at least a name
"
)
print
"
Removing architecture %s
"
%
args
[
2
]
...
...
@@ -205,6 +213,7 @@ def __architecture_rm(d, args):
die
(
"
E: Error removing architecture %s (%s)
"
%
(
args
[
2
],
e
))
print
"
Architecture %s removed
"
%
args
[
2
]
def
architecture
(
command
):
args
=
[
str
(
x
)
for
x
in
command
]
Cnf
=
utils
.
get_conf
()
...
...
@@ -227,11 +236,13 @@ dispatch['a'] = architecture
################################################################################
def
component_list
():
session
=
DBConn
().
session
()
for
component
in
session
.
query
(
Component
).
order_by
(
Component
.
component_name
):
print
"
{0} ordering={1}
"
.
format
(
component
.
component_name
,
component
.
ordering
)
def
component_add
(
args
):
(
name
,
description
,
ordering
)
=
args
[
0
:
3
]
...
...
@@ -259,6 +270,7 @@ def component_add(args):
else
:
session
.
commit
()
def
component_rm
(
name
):
session
=
DBConn
().
session
()
component
=
get_component
(
name
,
session
)
...
...
@@ -270,6 +282,7 @@ def component_rm(name):
else
:
session
.
commit
()
def
component_rename
(
oldname
,
newname
):
session
=
DBConn
().
session
()
component
=
get_component
(
oldname
,
session
)
...
...
@@ -281,6 +294,7 @@ def component_rename(oldname, newname):
else
:
session
.
commit
()
def
component
(
command
):
mode
=
command
[
1
]
if
mode
==
'
list
'
:
...
...
@@ -298,6 +312,7 @@ dispatch['component'] = component
################################################################################
def
__suite_list
(
d
,
args
):
s
=
d
.
session
()
for
j
in
s
.
query
(
Suite
).
join
(
Suite
.
archive
).
order_by
(
Archive
.
archive_name
,
Suite
.
suite_name
).
all
():
...
...
@@ -306,6 +321,7 @@ def __suite_list(d, args):
else
:
print
"
{0}
"
.
format
(
j
.
suite_name
)
def
__suite_show
(
d
,
args
):
if
len
(
args
)
<
2
:
die
(
"
E: showing an suite entry requires a suite
"
)
...
...
@@ -317,6 +333,7 @@ def __suite_show(d, args):
print
su
.
details
()
def
__suite_add
(
d
,
args
,
addallarches
=
False
):
die_arglen
(
args
,
4
,
"
E: adding a suite requires at least a name and a version
"
)
suite_name
=
args
[
2
].
lower
()
...
...
@@ -372,6 +389,7 @@ def __suite_add(d, args, addallarches=False):
s
.
commit
()
def
__suite_rm
(
d
,
args
):
die_arglen
(
args
,
3
,
"
E: removing a suite requires at least a name
"
)
name
=
args
[
2
]
...
...
@@ -390,6 +408,7 @@ def __suite_rm(d, args):
die
(
"
E: Error removing suite {0} ({1})
"
.
format
(
name
,
e
))
print
"
Suite {0} removed
"
.
format
(
name
)
def
__suite_add_build_queue
(
d
,
args
):
session
=
d
.
session
()
...
...
@@ -444,6 +463,7 @@ def __suite_add_build_queue(d, args):
session
.
commit
()
def
suite
(
command
):
args
=
[
str
(
x
)
for
x
in
command
]
Cnf
=
utils
.
get_conf
()
...
...
@@ -473,6 +493,7 @@ dispatch['s'] = suite
################################################################################
def
__suite_architecture_list
(
d
,
args
):
s
=
d
.
session
()
for
j
in
s
.
query
(
Suite
).
order_by
(
Suite
.
suite_name
):
...
...
@@ -480,6 +501,7 @@ def __suite_architecture_list(d, args):
print
j
.
suite_name
+
'
:
'
+
\
'
,
'
.
join
([
a
.
arch_string
for
a
in
architectures
])
def
__suite_architecture_listarch
(
d
,
args
):
die_arglen
(
args
,
3
,
"
E: suite-architecture list-arch requires a suite
"
)
suite
=
get_suite
(
args
[
2
].
lower
(),
d
.
session
())
...
...
@@ -529,6 +551,7 @@ def __suite_architecture_add(d, args):
s
.
close
()
def
__suite_architecture_rm
(
d
,
args
):
if
len
(
args
)
<
3
:
die
(
"
E: removing an suite-architecture entry requires a suite and arch
"
)
...
...
@@ -581,6 +604,7 @@ dispatch['s-a'] = suite_architecture
################################################################################
def
__suite_component_list
(
d
,
args
):
s
=
d
.
session
()
for
j
in
s
.
query
(
Suite
).
order_by
(
Suite
.
suite_name
):
...
...
@@ -636,6 +660,7 @@ def __suite_component_add(d, args):
s
.
commit
()
s
.
close
()
def
__suite_component_rm
(
d
,
args
):
if
len
(
args
)
<
3
:
die
(
"
E: removing an suite-component entry requires a suite and component
"
)
...
...
@@ -688,11 +713,13 @@ dispatch['s-c'] = suite_component
################################################################################
def
archive_list
():
session
=
DBConn
().
session
()
for
archive
in
session
.
query
(
Archive
).
order_by
(
Archive
.
archive_name
):
print
"
{0} path={1} description={2} tainted={3}
"
.
format
(
archive
.
archive_name
,
archive
.
path
,
archive
.
description
,
archive
.
tainted
)
def
archive_add
(
args
):
(
name
,
path
,
description
)
=
args
[
0
:
3
]
...
...
@@ -720,6 +747,7 @@ def archive_add(args):
else
:
session
.
commit
()
def
archive_rm
(
name
):
session
=
DBConn
().
session
()
archive
=
get_archive
(
name
,
session
)
...
...
@@ -731,6 +759,7 @@ def archive_rm(name):
else
:
session
.
commit
()
def
archive_rename
(
oldname
,
newname
):
session
=
DBConn
().
session
()
archive
=
get_archive
(
oldname
,
session
)
...
...
@@ -742,6 +771,7 @@ def archive_rename(oldname, newname):
else
:
session
.
commit
()
def
archive
(
command
):
mode
=
command
[
1
]
if
mode
==
'
list
'
:
...
...
@@ -759,16 +789,19 @@ dispatch['archive'] = archive
################################################################################
def
__version_check_list
(
d
):
session
=
d
.
session
()
for
s
in
session
.
query
(
Suite
).
order_by
(
Suite
.
suite_name
):
__version_check_list_suite
(
d
,
s
.
suite_name
)
def
__version_check_list_suite
(
d
,
suite_name
):
vcs
=
get_version_checks
(
suite_name
)
for
vc
in
vcs
:
print
"
%s %s %s
"
%
(
suite_name
,
vc
.
check
,
vc
.
reference
.
suite_name
)
def
__version_check_add
(
d
,
suite_name
,
check
,
reference_name
):
suite
=
get_suite
(
suite_name
)
if
not
suite
:
...
...
@@ -785,6 +818,7 @@ def __version_check_add(d, suite_name, check, reference_name):
session
.
add
(
vc
)
session
.
commit
()
def
__version_check_rm
(
d
,
suite_name
,
check
,
reference_name
):
suite
=
get_suite
(
suite_name
)
if
not
suite
:
...
...
@@ -801,6 +835,7 @@ def __version_check_rm(d, suite_name, check, reference_name):
except
NoResultFound
:
print
"
W: version-check not found.
"
def
version_check
(
command
):
args
=
[
str
(
x
)
for
x
in
command
]
Cnf
=
utils
.
get_conf
()
...
...
@@ -831,6 +866,7 @@ dispatch['v-c'] = version_check
################################################################################
def
show_config
(
command
):
args
=
[
str
(
x
)
for
x
in
command
]
cnf
=
utils
.
get_conf
()
...
...
@@ -886,6 +922,7 @@ dispatch['c'] = show_config
################################################################################
def
show_keyring
(
command
):
args
=
[
str
(
x
)
for
x
in
command
]
cnf
=
utils
.
get_conf
()
...
...
@@ -910,6 +947,7 @@ def show_keyring(command):
for
k
in
q
.
all
():
print
k
.
keyring_name
def
keyring_add_buildd
(
command
):
name
=
command
[
2
]
arch_names
=
command
[
3
:]
...
...
@@ -934,6 +972,7 @@ def keyring_add_buildd(command):
session
.
commit
()
def
keyring
(
command
):
if
command
[
1
].
startswith
(
'
list-
'
):
show_keyring
(
command
)
...
...
@@ -947,6 +986,7 @@ dispatch['k'] = keyring
################################################################################
def
change_component_source
(
transaction
,
suite
,
component
,
source_names
):
session
=
transaction
.
session
...
...
@@ -961,6 +1001,7 @@ def change_component_source(transaction, suite, component, source_names):
print
"
Copying {0}={1}
"
.
format
(
source
.
source
,
source
.
version
)
transaction
.
copy_source
(
source
,
suite
,
component
)
def
change_component_binary
(
transaction
,
suite
,
component
,
binary_names
):
session
=
transaction
.
session
...
...
@@ -976,6 +1017,7 @@ def change_component_binary(transaction, suite, component, binary_names):
transaction
.
copy_binary
(
binary
,
suite
,
component
)
pass
def
change_component
(
args
):
with
daklib
.
archive
.
ArchiveTransaction
()
as
transaction
:
session
=
transaction
.
session
...
...
@@ -996,6 +1038,7 @@ dispatch['change-component'] = change_component
################################################################################
def
forget_signature
(
args
):
filename
=
args
[
1
]
with
open
(
filename
,
'
r
'
)
as
fh
:
...
...
@@ -1016,6 +1059,7 @@ dispatch['forget-signature'] = forget_signature
################################################################################
def
main
():
"""
Perform administrative work on the dak database
"""
global
dryrun
...
...
dak/archive_dedup_pool.py
View file @
88aa701b
...
...
@@ -40,6 +40,7 @@ Logger = None
################################################################################
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak archive-dedup-pool [OPTION]...
-h, --help show this help and exit.
...
...
@@ -49,6 +50,7 @@ def usage(exit_code=0):
################################################################################
def
dedup_one
(
size
,
reference
,
*
filenames
):
stat_reference
=
os
.
stat
(
reference
)
...
...
@@ -83,6 +85,7 @@ def dedup_one(size, reference, *filenames):
################################################################################
def
dedup
(
session
):
results
=
session
.
execute
(
"""
SELECT DISTINCT *
...
...
@@ -113,6 +116,7 @@ SELECT DISTINCT *
################################################################################
def
main
():
global
Options
,
Logger
...
...
dak/auto_decruft.py
View file @
88aa701b
...
...
@@ -412,6 +412,7 @@ def decruft_newer_version_in(othersuite, suite_name, suite_id, rm_msg, session,
################################################################################
def
main
():
global
Options
cnf
=
Config
()
...
...
dak/bts_categorize.py
View file @
88aa701b
...
...
@@ -36,6 +36,7 @@ import apt_pkg
from
daklib
import
utils
import
debianbts
as
bts
def
usage
():
print
"""
SYNOPSIS
...
...
@@ -65,6 +66,7 @@ arguments = [('s','simulate','BtsCategorize::Options::Simulate'),
(
'
q
'
,
'
quiet
'
,
'
BtsCategorize::Options::Quiet
'
),
(
'
h
'
,
'
help
'
,
'
BtsCategorize::Options::Help
'
)]
class
BugClassifier
(
object
):
"""
classify bugs using usertags based on the bug subject lines
...
...
@@ -135,6 +137,7 @@ class BugClassifier(object):
log
.
error
(
"
couldn
'
t retrieve bugs from soap interface: %s
"
%
sys
.
exc_info
()[
0
])
return
None
def
send_email
(
commands
,
simulate
=
False
):
global
Cnf
...
...
@@ -149,6 +152,7 @@ def send_email(commands, simulate=False):
else
:
utils
.
send_mail
(
bts_mail_message
)
def
main
():
"""
for now, we just dump a list of commands that could be sent for
...
...
dak/check_archive.py
View file @
88aa701b
...
...
@@ -54,6 +54,7 @@ current_time = time.time() #: now()
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak check-archive MODE
Run various sanity checks of the archive and/or database.
...
...
@@ -78,6 +79,7 @@ The following MODEs are available:
################################################################################
def
process_dir
(
unused
,
dirname
,
filenames
):
"""
Process a directory and output every files name which is not listed already
...
...
@@ -104,6 +106,7 @@ def process_dir(unused, dirname, filenames):
################################################################################
def
check_files
():
"""
Prepare the dictionary of existing filenames, then walk through the archive
...
...
@@ -167,6 +170,7 @@ def check_files():
################################################################################
def
check_dscs
():
"""
Parse every .dsc file in the archive and check for it
'
s validity.
...
...
@@ -196,6 +200,7 @@ def check_dscs():
################################################################################
def
check_override
():
"""
Check for missing overrides in stable and unstable.
...
...
@@ -265,6 +270,8 @@ def check_source_in_one_dir():
print
"
Found %d source packages where the source is not all in one directory.
"
%
(
broken_count
)
################################################################################
def
check_checksums
():
"""
Validate all files
...
...
@@ -305,6 +312,7 @@ def check_checksums():
################################################################################
#
def
Ent
(
Kind
,
Name
,
Link
,
Mode
,
UID
,
GID
,
Size
,
MTime
,
Major
,
Minor
):
global
future_files
...
...
@@ -312,6 +320,7 @@ def Ent(Kind,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor):
future_files
[
current_file
]
=
MTime
print
"
%s: %s
'
%s
'
,
'
%s
'
,%u,%u,%u,%u,%u,%u,%u
"
%
(
current_file
,
Kind
,
Name
,
Link
,
Mode
,
UID
,
GID
,
Size
,
MTime
,
Major
,
Minor
)
def
check_timestamps
():
"""
Check all files for timestamps in the future; common from hardware
...
...
@@ -340,6 +349,7 @@ def check_timestamps():
################################################################################
def
check_files_in_dsc
():
"""
Ensure each .dsc lists appropriate files in its Files field (according
...
...
@@ -410,6 +420,7 @@ def validate_sources(suite, component):
########################################
def
validate_packages
(
suite
,
component
,
architecture
):
"""
Ensure files mentioned in Packages exist
...
...
@@ -426,6 +437,7 @@ def validate_packages(suite, component, architecture):
########################################
def
check_indices_files_exist
():
"""
Ensure files mentioned in Packages & Sources exist
...
...
@@ -443,6 +455,7 @@ def check_indices_files_exist():
################################################################################
def
check_files_not_symlinks
():
"""
Check files in the database aren
'
t symlinks
...
...
@@ -461,6 +474,7 @@ def check_files_not_symlinks():
################################################################################
def
chk_bd_process_dir
(
unused
,
dirname
,
filenames
):
for
name
in
filenames
:
if
not
name
.
endswith
(
"
.dsc
"
):
...
...
@@ -478,6 +492,7 @@ def chk_bd_process_dir(unused, dirname, filenames):
################################################################################
def
check_build_depends
():
"""
Validate build-dependencies of .dsc files in the archive
"""
cnf
=
Config
()
...
...
@@ -512,6 +527,7 @@ SELECT
WHERE NOT EXISTS (SELECT 1 FROM source_metadata md WHERE md.src_id=s.id AND md.key_id = :checksum_key);
"""
def
add_missing_source_checksums
():
"""
Add missing source checksums to source_metadata
"""
session
=
DBConn
().
session
()
...
...
@@ -525,6 +541,7 @@ def add_missing_source_checksums():
################################################################################
def
main
():
global
db_files
,
waste
,
excluded
...
...
dak/check_overrides.py
View file @
88aa701b
...
...
@@ -73,6 +73,7 @@ blacklist = {}
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak check-overrides
Check for cruft in overrides.
...
...
@@ -84,6 +85,7 @@ Check for cruft in overrides.
################################################################################
def
process
(
osuite
,
affected_suites
,
originosuite
,
component
,
otype
,
session
):
global
Logger
,
Options
,
sections
,
priorities
...
...
dak/clean_queues.py
View file @
88aa701b
...
...
@@ -53,6 +53,7 @@ delete_date = None
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak clean-queues [OPTIONS]
Clean out incoming directories.
...
...
@@ -67,6 +68,7 @@ Clean out incoming directories.
################################################################################
def
init
(
cnf
):
global
delete_date
,
del_dir
...
...
@@ -106,6 +108,8 @@ def init(cnf):
utils
.
fubar
(
"
Cannot chdir to %s
"
%
incoming
)
# Remove a file to the morgue
def
remove
(
from_dir
,
f
):
fname
=
os
.
path
.
basename
(
f
)
if
os
.
access
(
f
,
os
.
R_OK
):
...
...
@@ -128,6 +132,8 @@ def remove(from_dir, f):
# Removes any old files.
# [Used for Incoming/REJECT]
#
def
flush_old
():
Logger
.
log
([
"
check Incoming/REJECT for old files
"
,
os
.
getcwd
()])
for
f
in
os
.
listdir
(
'
.
'
):
...
...
@@ -141,6 +147,8 @@ def flush_old():
# Removes any files which are old orphans (not associated with a valid .changes file).
# [Used for Incoming]
#
def
flush_orphans
():
all_files
=
{}
changes_files
=
[]
...
...
@@ -193,6 +201,7 @@ def flush_orphans():
################################################################################
def
main
():
global
Options
,
Logger
...
...
dak/clean_suites.py
View file @
88aa701b
...
...
@@ -55,6 +55,7 @@ Logger = None
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak clean-suites [OPTIONS]
Clean old packages from suites.
...
...
@@ -66,6 +67,7 @@ Clean old packages from suites.
################################################################################
def
check_binaries
(
now_date
,
session
):
Logger
.
log
([
"
Checking for orphaned binary packages...
"
])
...
...
@@ -108,6 +110,7 @@ def check_binaries(now_date, session):
########################################
def
check_sources
(
now_date
,
session
):
Logger
.
log
([
"
Checking for orphaned source packages...
"
])
...
...
@@ -167,6 +170,7 @@ def check_sources(now_date, session):
########################################
def
check_files
(
now_date
,
session
):
# FIXME: this is evil; nothing should ever be in this state. if
# they are, it's a bug.
...
...
@@ -194,6 +198,7 @@ def check_files(now_date, session):
if
not
Options
[
"
No-Action
"
]:
session
.
commit
()
def
clean_binaries
(
now_date
,
session
):
# We do this here so that the binaries we remove will have their
# source also removed (if possible).
...
...
@@ -217,6 +222,7 @@ def clean_binaries(now_date, session):
########################################
def
clean
(
now_date
,
archives
,
max_delete
,
session
):
cnf
=
Config
()
...
...
@@ -331,6 +337,7 @@ def clean(now_date, archives, max_delete, session):
################################################################################
def
clean_maintainers
(
now_date
,
session
):
Logger
.
log
([
"
Cleaning out unused Maintainer entries...
"
])
...
...
@@ -358,6 +365,7 @@ SELECT m.id, m.name FROM maintainer m
################################################################################
def
clean_fingerprints
(
now_date
,
session
):
Logger
.
log
([
"
Cleaning out unused fingerprint entries...
"
])
...
...
@@ -386,6 +394,7 @@ SELECT f.id, f.fingerprint FROM fingerprint f
################################################################################
def
clean_byhash
(
now_date
,
session
):
cnf
=
Config
()
suite_suffix
=
cnf
.
find
(
"
Dinstall::SuiteSuffix
"
,
""
)
...
...
@@ -419,6 +428,7 @@ def clean_byhash(now_date, session):
################################################################################
def
clean_empty_directories
(
session
):
"""
Removes empty directories from pool directories.
...
...
@@ -447,6 +457,7 @@ def clean_empty_directories(session):
################################################################################
def
set_archive_delete_dates
(
now_date
,
session
):
session
.
execute
(
"""
CREATE TEMPORARY TABLE archive_delete_date (
...
...
@@ -465,6 +476,7 @@ def set_archive_delete_dates(now_date, session):
################################################################################
def
main
():
global
Options
,
Logger
...
...
dak/contents.py
View file @
88aa701b
...
...
@@ -49,6 +49,7 @@ from daklib import utils
################################################################################
def
usage
(
exit_code
=
0
):
print
(
"""
Usage: dak contents [options] subcommand
...
...
@@ -89,6 +90,7 @@ OPTIONS for scan-source and scan-binary
################################################################################
def
write_all
(
cnf
,
archive_names
=
[],
suite_names
=
[],
component_names
=
[],
force
=
None
):
Logger
=
daklog
.
Logger
(
'
contents generate
'
)
ContentsWriter
.
write_all
(
Logger
,
archive_names
,
suite_names
,
component_names
,
force
)
...
...
@@ -96,6 +98,7 @@ def write_all(cnf, archive_names=[], suite_names=[], component_names=[], force=N
################################################################################
def
binary_scan_all
(
cnf
,
limit
):
Logger
=
daklog
.
Logger
(
'
contents scan-binary
'
)
result
=
BinaryContentsScanner
.
scan_all
(
limit
)
...
...
@@ -106,6 +109,7 @@ def binary_scan_all(cnf, limit):
################################################################################
def
source_scan_all
(
cnf
,
limit
):
Logger
=
daklog
.
Logger
(
'
contents scan-source
'
)
result
=
SourceContentsScanner
.
scan_all
(
limit
)
...
...
@@ -116,6 +120,7 @@ def source_scan_all(cnf, limit):
################################################################################
def
main
():
cnf
=
Config
()
cnf
[
'
Contents::Options::Help
'
]
=
''
...
...
dak/control_overrides.py
View file @
88aa701b
...
...
@@ -65,6 +65,7 @@ Logger = None
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak control-overrides [OPTIONS]
-h, --help print this help and exit
...
...
@@ -89,6 +90,7 @@ def usage(exit_code=0):
################################################################################
def
process_file
(
file
,
suite
,
component
,
otype
,
mode
,
action
,
session
):
cnf
=
Config
()
...
...
@@ -257,6 +259,7 @@ def process_file(file, suite, component, otype, mode, action, session):
################################################################################
def
list_overrides
(
suite
,
component
,
otype
,
session
):
dat
=
{}
s
=
get_suite
(
suite
,
session
)
...
...
@@ -295,6 +298,7 @@ def list_overrides(suite, component, otype, session):
################################################################################
def
main
():
global
Logger
...
...
dak/control_suite.py
View file @
88aa701b
...
...
@@ -58,6 +58,7 @@ Logger = None
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak control-suite [OPTIONS] [FILE]
Display or alter the contents of a suite using FILE(s), or stdin.
...
...
@@ -73,6 +74,7 @@ Display or alter the contents of a suite using FILE(s), or stdin.
#######################################################################################
def
get_pkg
(
package
,
version
,
architecture
,
session
):
if
architecture
==
'
source
'
:
q
=
session
.
query
(
DBSource
).
filter_by
(
source
=
package
,
version
=
version
)
\
...
...
@@ -89,6 +91,7 @@ def get_pkg(package, version, architecture, session):
#######################################################################################
def
britney_changelog
(
packages
,
suite
,
session
):
old
=
{}
...
...
@@ -154,6 +157,7 @@ def britney_changelog(packages, suite, session):
#######################################################################################
def
version_checks
(
package
,
architecture
,
target_suite
,
new_version
,
session
,
force
=
False
):
if
architecture
==
"
source
"
:
suite_version_list
=
get_suite_version_by_source
(
package
,
session
)
...
...
@@ -186,6 +190,7 @@ def version_checks(package, architecture, target_suite, new_version, session, fo
#######################################################################################
def
cmp_package_version
(
a
,
b
):
"""
comparison function for tuples of the form (package-name, version, arch, ...)
...
...
@@ -203,6 +208,7 @@ def cmp_package_version(a, b):
#######################################################################################
def
set_suite
(
file
,
suite
,
transaction
,
britney
=
False
,
force
=
False
):
session
=
transaction
.
session
suite_id
=
suite
.
suite_id
...
...
@@ -271,6 +277,7 @@ def set_suite(file, suite, transaction, britney=False, force=False):
#######################################################################################
def
process_file
(
file
,
suite
,
action
,
transaction
,
britney
=
False
,
force
=
False
):
session
=
transaction
.
session
...
...
@@ -365,6 +372,7 @@ def process_file(file, suite, action, transaction, britney=False, force=False):
#######################################################################################
def
get_list
(
suite
,
session
):
suite_id
=
suite
.
suite_id
# List binaries
...
...
@@ -385,6 +393,7 @@ def get_list(suite, session):
#######################################################################################
def
main
():
global
Logger
...
...
dak/copy_installer.py
View file @
88aa701b
...
...
@@ -28,6 +28,7 @@ import os.path
import
re
import
sys
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak copy-installer [OPTION]... VERSION
-h, --help show this help and exit
...
...
@@ -38,6 +39,7 @@ def usage(exit_code=0):
Exactly 1 version must be specified.
"""
sys
.
exit
(
exit_code
)
def
main
():
cnf
=
Config
()
Arguments
=
[
...
...
@@ -74,6 +76,7 @@ def main():
root_dir
=
Config
()[
'
Dir::Root
'
]
class
InstallerCopier
:
def
__init__
(
self
,
source
=
'
unstable
'
,
dest
=
'
testing
'
,
**
keywords
):
...
...
dak/cruft_report.py
View file @
88aa701b
...
...
@@ -56,6 +56,7 @@ source_versions = {}
################################################################################
def
usage
(
exit_code
=
0
):
print
"""
Usage: dak cruft-report
Check for obsolete or duplicated packages.
...
...
@@ -69,6 +70,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
package
in
no_longer_in_suite
:
...
...
@@ -89,6 +91,8 @@ def add_nbs(nbs_d, source, version, package, suite_id, session):
################################################################################
# Check for packages built on architectures they shouldn't be.
def
do_anais
(
architecture
,
binaries_list
,
source
,
session
):
if
architecture
==
"
any
"
or
architecture
==
"
all
"
:
return
""
...
...
@@ -164,6 +168,7 @@ def do_nfu(nfu_packages):
(
suite
.
suite_name
,
architecture
,
"
"
.
join
(
a2p
[
architecture
])))
print
def
parse_nfu
(
architecture
):
cnf
=
Config
()
# utils/hpodder_1.1.5.0: Not-For-Us [optional:out-of-date]
...
...
@@ -192,6 +197,7 @@ def parse_nfu(architecture):
################################################################################
def
do_newer_version
(
lowersuite_name
,
highersuite_name
,
code
,
session
):
list
=
newer_version
(
lowersuite_name
,
highersuite_name
,
session
)
if
len
(
list
)
>
0
:
...
...
@@ -234,6 +240,7 @@ def reportWithoutSource(suite_name, suite_id, session, rdeps=False):
else
:
print
def
queryNewerAll
(
suite_name
,
session
):
"""
searches for arch != all packages that have an arch == all
package with a higher version in the same suite
"""
...
...
@@ -253,6 +260,7 @@ select bab1.package, bab1.version as oldver,
group by bab1.package, oldver, bab1.suite, newver
"""
return
session
.
execute
(
query
,
{
'
suite_name
'
:
suite_name
})
def
reportNewerAll
(
suite_name
,
session
):
rows
=
queryNewerAll
(
suite_name
,
session
)
title
=
'
obsolete arch any packages in suite %s
'
%
suite_name
...
...
@@ -296,6 +304,7 @@ def reportNBS(suite_name, suite_id, rdeps=False):
print
session
.
close
()
def
reportAllNBS
(
suite_name
,
suite_id
,
session
,
rdeps
=
False
):
reportWithoutSource
(
suite_name
,
suite_id
,
session
,
rdeps
)
reportNewerAll
(
suite_name
,
session
)
...
...
@@ -303,6 +312,7 @@ def reportAllNBS(suite_name, suite_id, session, rdeps=False):
################################################################################
def
do_dubious_nbs
(
dubious_nbs
):
print
"
Dubious NBS
"
print
"
-----------
"
...
...
@@ -326,6 +336,7 @@ def do_dubious_nbs(dubious_nbs):
################################################################################
def
obsolete_source
(
suite_name
,
session
):
"""
returns obsolete source packages for suite_name without binaries
in the same suite sorted by install_date; install_date should help
...
...
@@ -354,6 +365,7 @@ SELECT ss.src, ss.source, ss.version,
args
=
{
'
suite_name
'
:
suite_name
}
return
session
.
execute
(
query
,
args
)
def
source_bin
(
source
,
session
):
"""
returns binaries built by source for all or no suite grouped and
ordered by package name
"""
...
...
@@ -368,6 +380,7 @@ SELECT b.package
args
=
{
'
source
'
:
source
}
return
session
.
execute
(
query
,
args
)
def
newest_source_bab
(
suite_name
,
package
,
session
):
"""
returns newest source that builds binary package in suite grouped
and sorted by source and package name
"""
...
...
@@ -383,6 +396,7 @@ SELECT sas.source, MAX(sas.version) AS srcver
args
=
{
'
suite_name
'
:
suite_name
,
'
package
'
:
package
}
return
session
.
execute
(
query
,
args
)
def
report_obsolete_source
(
suite_name
,
session
):
rows
=
obsolete_source
(
suite_name
,
session
)
if
rows
.
rowcount
==
0
:
...
...
@@ -406,6 +420,7 @@ def report_obsolete_source(suite_name, session):
rm_opts
=
"
-S -p -m
\"
[auto-cruft] obsolete source package
\"
"
print
"
dak rm -s %s %s %s
\n
"
%
(
suite_name
,
rm_opts
,
old_source
)
def
get_suite_binaries
(
suite
,
session
):
# Initalize a large hash table of all binary packages
binaries
=
{}
...
...
@@ -422,6 +437,7 @@ def get_suite_binaries(suite, session):
################################################################################
def
report_outdated_nonfree
(
suite
,
session
,
rdeps
=
False
):
packages
=
{}
...
...
@@ -500,6 +516,7 @@ def report_outdated_nonfree(suite, session, rdeps=False):
################################################################################
def
main
():
global
suite
,
suite_id
,
source_binaries
,
source_versions
...
...
dak/dak.py
View file @
88aa701b
...
...
@@ -44,6 +44,7 @@ from daklib.dak_exceptions import CantOpenError
################################################################################
def
init
():
"""
Setup the list of modules and brief explanation of what they
do.
"""
...
...
@@ -162,6 +163,7 @@ def init():
################################################################################
def
usage
(
functionality
,
exit_code
=
0
):
"""
Print a usage message and exit with
'
exit_code
'
.
"""
...
...
@@ -175,6 +177,7 @@ Available commands:"""
################################################################################
def
main
():
"""
Launch dak functionality.
"""
...
...
dak/dakdb/update100.py
View file @
88aa701b
...
...
@@ -31,6 +31,8 @@ from daklib.dak_exceptions import DBUpdateError
from
daklib.config
import
Config
################################################################################
def
do_update
(
self
):
print
__doc__
try
:
...
...
dak/dakdb/update101.py
View file @
88aa701b
...
...
@@ -30,6 +30,8 @@ from daklib.dak_exceptions import DBUpdateError
from
daklib.config
import
Config
################################################################################
def
do_update
(
self
):
"""
Add column to store compression type of indices
...
...
dak/dakdb/update102.py
View file @
88aa701b
...
...
@@ -57,6 +57,8 @@ COMMENT ON VIEW src_associations_full IS
]
################################################################################
def
do_update
(
self
):
print
__doc__
try
:
...
...
dak/dakdb/update103.py
View file @
88aa701b
...
...
@@ -36,6 +36,8 @@ statements = [
]
################################################################################
def
do_update
(
self
):
print
__doc__
try
:
...
...
Prev
1
2
3
4
5
…
9
Next