Skip to content

Commit

Permalink
update: include condas matchspec
Browse files Browse the repository at this point in the history
  • Loading branch information
YYYasin19 committed Jun 15, 2023
1 parent e7bf580 commit 0a37241
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions quetz/rest_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uuid
from datetime import date, datetime
from enum import Enum
from typing import Dict, Generic, List, Optional, TypeVar
from typing import Dict, Generic, List, Optional, TypeVar, Union

from pydantic import BaseModel, Field, root_validator, validator
from pydantic.generics import GenericModel
Expand Down Expand Up @@ -74,7 +74,7 @@ class ChannelBase(BaseModel):
None, title="size limit of the channel", nullable=True
)
ttl: int = Field(36000, title="ttl of the channel")
mirror_channel_url: Optional[str | List[str]] = Field(
mirror_channel_url: Optional[Union[str, List[str]]] = Field(
None, regex="^(http|https)://.+", nullable=True
)
mirror_mode: Optional[MirrorMode] = Field(None, nullable=True)
Expand Down
10 changes: 4 additions & 6 deletions quetz/tasks/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
from quetz.errors import DBError
from quetz.pkgstores import PackageStore
from quetz.tasks import indexing
from quetz.utils import (
TicToc,
add_static_file,
check_package_membership,
check_package_membership_pattern,
)
from quetz.utils import TicToc, add_static_file, check_package_membership_pattern

# copy common subdirs from conda:
# https://github.com/conda/conda/blob/a78a2387f26a188991d771967fc33aa1fb5bb810/conda/base/constants.py#L63
Expand Down Expand Up @@ -410,6 +405,9 @@ def handle_batch(update_batch):

return False

# TODO: also remove all packages that are not in the remote repository anymore
# practically re-write the complete sync mechanism?

for repo_package_name, metadata in packages.items():
# if check_package_membership(repo_package_name, includelist, excludelist):
if check_package_membership_pattern(
Expand Down
3 changes: 2 additions & 1 deletion quetz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from typing import Any, Callable
from urllib.parse import unquote

from conda.models.match_spec import MatchSpec, _parse_spec_str
from conda.models.match_spec import MatchSpec
from sqlalchemy import String, and_, cast, collate, not_, or_

from .db_models import Channel, Package, PackageVersion, User
Expand Down Expand Up @@ -54,6 +54,7 @@ def check_package_membership_pattern(
):
# TODO: validate performance, can we save the MatchSpec instances between calls?
# might be okay for <100 packages to check against, but what about 1000s?
# TODO: matchspec vs package spec and build string matching with *
name, version, build = _parse_package_spec(package_spec)
for include_pattern in include_pattern_list:
# TODO: how do we get the build number?
Expand Down

0 comments on commit 0a37241

Please sign in to comment.