Package daklib :: Module archive :: Class ArchiveUpload
[hide private]
[frames] | no frames]

Class ArchiveUpload

source code

handle an upload

This class can be used in a with-statement:

  with ArchiveUpload(...) as upload:
     ...

Doing so will automatically run any required cleanup and also rollback the transaction if it was not committed.

Instance Methods [hide private]
 
__init__(self, directory, changes, keyrings) source code
 
warn(self, message)
add a warning message
source code
 
prepare(self)
prepare upload for further processing
source code
str or None
unpacked_source(self)
Path to unpacked source
source code
 
_map_suite(self, suite_name) source code
list of daklib.dbconn.Suite
_mapped_suites(self)
Get target suites after mappings
source code
 
_check_new_binary_overrides(self, suite, overridesuite) source code
bool
_check_new(self, suite, overridesuite)
Check if upload is NEW
source code
 
_final_suites(self) source code
daklib.dbconn.Override or None
_binary_override(self, suite, binary)
Get override entry for a binary
source code
daklib.dbconn.Override or None
_source_override(self, suite, source)
Get override entry for a source
source code
daklib.dbconn.Component or None
_binary_component(self, suite, binary, only_overrides=True)
get component for a binary
source code
daklib.dbconn.Component or None
_source_component(self, suite, source, only_overrides=True)
get component for a source
source code
bool
check(self, force=False)
run checks against the upload
source code
 
_install_to_suite(self, target_suite, suite, source_component_func, binary_component_func, source_suites=None, extra_source_archives=None, policy_upload=False)
Install upload to the given suite
source code
 
_install_changes(self) source code
 
_install_policy(self, policy_queue, target_suite, db_changes, db_source, db_binaries) source code
list of daklib.upload.HashedFile
try_autobyhand(self)
Try AUTOBYHAND
source code
 
_install_byhand(self, policy_queue_upload, hashed_file)
install byhand file
source code
 
_do_bts_versiontracking(self) source code
 
_policy_queue(self, suite) source code
 
install(self)
install upload
source code
 
install_to_new(self)
install upload to NEW
source code
 
commit(self)
commit changes
source code
 
rollback(self)
rollback changes
source code
 
__enter__(self) source code
 
__exit__(self, type, value, traceback) source code
Instance Variables [hide private]
daklib.archive.ArchiveTransaction transaction
transaction used to handle the upload
  session
database session
daklib.upload.Changes changes
upload to process
str directory
directory with temporary copy of files.
daklib.dbconn.Fingerprint fingerprint
fingerprint of the key used to sign the upload
list of str reject_reasons
reasons why the upload cannot by accepted
list of str warnings
warnings
bool new
upload is NEW.
bool _checked
checks passes.
Method Details [hide private]

warn(self, message)

source code 

add a warning message

Adds a warning message that can later be seen in self.warnings

Parameters:
  • message (string) - warning message

prepare(self)

source code 

prepare upload for further processing

This copies the files involved to a temporary directory. If you use this method directly, you have to remove the directory given by the directory attribute later on your own.

Instead of using the method directly, you can also use a with-statement:

  with ArchiveUpload(...) as upload:
     ...

This will automatically handle any required cleanup.

unpacked_source(self)

source code 

Path to unpacked source

Get path to the unpacked source. This method does unpack the source into a temporary directory under self.directory if it has not been done so already.

Returns: str or None
string giving the path to the unpacked source directory or None if no source was included in the upload.

_mapped_suites(self)

source code 

Get target suites after mappings

Returns: list of daklib.dbconn.Suite
list giving the mapped target suites of this upload

_check_new(self, suite, overridesuite)

source code 

Check if upload is NEW

An upload is NEW if it has binary or source packages that do not have an override in overridesuite OR if it references files ONLY in a tainted archive (eg. when it references files in NEW).

Debug packages (*-dbgsym in Section: debug) are not considered as NEW if suite has a separate debug suite.

Returns: bool
True if the upload is NEW, False otherwise

_binary_override(self, suite, binary)

source code 

Get override entry for a binary

Parameters:
Returns: daklib.dbconn.Override or None
override for the given binary or None

_source_override(self, suite, source)

source code 

Get override entry for a source

Parameters:
Returns: daklib.dbconn.Override or None
override for the given source or None

_binary_component(self, suite, binary, only_overrides=True)

source code 

get component for a binary

By default this will only look at overrides to get the right component; if only_overrides is False this method will also look at the Section field.

Parameters:
Returns: daklib.dbconn.Component or None

_source_component(self, suite, source, only_overrides=True)

source code 

get component for a source

By default this will only look at overrides to get the right component; if only_overrides is False this method will also look at the Section field.

Parameters:
Returns: daklib.dbconn.Component or None

check(self, force=False)

source code 

run checks against the upload

Parameters:
  • force (bool) - ignore failing forcable checks
Returns: bool
True if all checks passed, False otherwise

_install_to_suite(self, target_suite, suite, source_component_func, binary_component_func, source_suites=None, extra_source_archives=None, policy_upload=False)

source code 

Install upload to the given suite

Parameters:
Returns:
tuple with two elements. The first is a daklib.dbconn.DBSource object for the install source or None if no source was included. The second is a list of daklib.dbconn.DBBinary objects for the installed binary packages.

try_autobyhand(self)

source code 

Try AUTOBYHAND

Try to handle byhand packages automatically.

Returns: list of daklib.upload.HashedFile
list of remaining byhand files

_install_byhand(self, policy_queue_upload, hashed_file)

source code 

install byhand file

Parameters:

install(self)

source code 

install upload

Install upload to a suite or policy queue. This method does not handle uploads to NEW.

You need to have called the check method before calling this method.

install_to_new(self)

source code 

install upload to NEW

Install upload to NEW. This method does not handle regular uploads to suites or policy queues.

You need to have called the check method before calling this method.


Instance Variable Details [hide private]

directory

directory with temporary copy of files. set by prepare

Type:
str

warnings

warnings

Type:
list of str

Note: Not used yet.

new

upload is NEW. set by check

Type:
bool

_checked

checks passes. set by check

Type:
bool