aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/state_impl/_operations/load_packages.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/proxy/state_impl/_operations/load_packages.py')
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/load_packages.py52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/hydrilla/proxy/state_impl/_operations/load_packages.py b/src/hydrilla/proxy/state_impl/_operations/load_packages.py
index defa9b6..76a24d1 100644
--- a/src/hydrilla/proxy/state_impl/_operations/load_packages.py
+++ b/src/hydrilla/proxy/state_impl/_operations/load_packages.py
@@ -64,18 +64,6 @@ def make_repo_iteration(cursor: sqlite3.Cursor, repo_id: int) -> int:
cursor.execute(
'''
- UPDATE
- repos
- SET
- next_iteration = ?
- WHERE
- repo_id = ?;
- ''',
- (next_iteration + 1, repo_id)
- )
-
- cursor.execute(
- '''
INSERT INTO repo_iterations(repo_id, iteration)
VALUES(?, ?);
''',
@@ -96,6 +84,30 @@ def make_repo_iteration(cursor: sqlite3.Cursor, repo_id: int) -> int:
(repo_iteration_id,), = cursor.fetchall()
+ cursor.execute(
+ '''
+ UPDATE
+ repos
+ SET
+ next_iteration = ?,
+ active_iteration_id = (
+ CASE
+ WHEN repo_id = 1 THEN NULL
+ ELSE ?
+ END
+ ),
+ last_refreshed = (
+ CASE
+ WHEN repo_id = 1 THEN NULL
+ ELSE STRFTIME('%s', 'NOW')
+ END
+ )
+ WHERE
+ repo_id = ?;
+ ''',
+ (next_iteration + 1, repo_iteration_id, repo_id)
+ )
+
return repo_iteration_id
def get_or_make_item(cursor: sqlite3.Cursor, type: str, identifier: str) -> int:
@@ -162,12 +174,9 @@ def update_or_make_item_version(
item_versions
SET
installed = (
- CASE WHEN
- installed = 'I' OR ? = 'I'
- THEN
- 'I'
- ELSE
- 'N'
+ CASE
+ WHEN installed = 'I' OR ? = 'I' THEN 'I'
+ ELSE 'N'
END
),
repo_iteration_id = ?
@@ -213,10 +222,7 @@ def update_or_make_item_version(
def make_mapping_status(cursor: sqlite3.Cursor, item_id: int) -> None:
cursor.execute(
- '''
- INSERT OR IGNORE INTO mapping_statuses(item_id, enabled, required)
- VALUES(?, 'N', FALSE);
- ''',
+ 'INSERT OR IGNORE INTO mapping_statuses(item_id) VALUES(?);',
(item_id,)
)
@@ -395,6 +401,8 @@ def _load_packages_no_state_update(
repo_id = repo_id
)
+ prune_packages(cursor)
+
_recompute_dependencies_no_state_update(
cursor = cursor,
semirepo_file_resolver = MalcontentFileResolver(malcontent_path)