mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-17 13:27:27 +03:00
Merge pull request #76 from schnusch/unstable
update unstable packages from git to latest branch
This commit is contained in:
commit
f2004889fc
@ -95,7 +95,7 @@ def git_has_diff(git_dir: str, package: Package) -> bool:
|
||||
|
||||
|
||||
def format_commit_message(package: Package) -> str:
|
||||
new_version = package.new_version
|
||||
new_version = getattr(package.new_version, "number", None)
|
||||
if (
|
||||
new_version
|
||||
and package.old_version != new_version
|
||||
@ -112,7 +112,7 @@ def git_commit(git_dir: str, package: Package) -> None:
|
||||
msg = format_commit_message(package)
|
||||
new_version = package.new_version
|
||||
run(["git", "-C", git_dir, "add", package.filename], stdout=None)
|
||||
if new_version and package.old_version != new_version:
|
||||
if new_version and package.old_version != new_version.number:
|
||||
run(
|
||||
["git", "-C", git_dir, "commit", "--verbose", "--message", msg], stdout=None
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional
|
||||
from .errors import UpdateError
|
||||
from .options import Options
|
||||
from .utils import run
|
||||
from .version.version import VersionPreference
|
||||
from .version.version import Version, VersionPreference
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -35,7 +35,7 @@ class Package:
|
||||
|
||||
raw_version_position: InitVar[Optional[Dict[str, Any]]]
|
||||
|
||||
new_version: Optional[str] = None
|
||||
new_version: Optional[Version] = None
|
||||
version_position: Optional[Position] = field(init=False)
|
||||
|
||||
def __post_init__(self, raw_version_position: Optional[Dict[str, Any]]) -> None:
|
||||
@ -61,7 +61,7 @@ def eval_expression(import_path: str, attr: str) -> str:
|
||||
builtins.unsafeGetAttrPos "src" pkg;
|
||||
in {{
|
||||
name = pkg.name;
|
||||
old_version = (builtins.parseDrvName pkg.name).version;
|
||||
old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
|
||||
inherit raw_version_position;
|
||||
filename = position.file;
|
||||
line = position.line;
|
||||
|
@ -9,13 +9,13 @@ from .git import old_version_from_git
|
||||
from .options import Options
|
||||
from .utils import info, run
|
||||
from .version import fetch_latest_version
|
||||
from .version.version import VersionPreference
|
||||
from .version.version import Version, VersionPreference
|
||||
|
||||
|
||||
def replace_version(package: Package) -> bool:
|
||||
assert package.new_version is not None
|
||||
old_version = package.old_version
|
||||
new_version = package.new_version
|
||||
assert new_version is not None
|
||||
new_version = package.new_version.number
|
||||
if new_version.startswith("v"):
|
||||
new_version = new_version[1:]
|
||||
|
||||
@ -23,6 +23,8 @@ def replace_version(package: Package) -> bool:
|
||||
info(f"Update {old_version} -> {new_version} in {package.filename}")
|
||||
with fileinput.FileInput(package.filename, inplace=True) as f:
|
||||
for line in f:
|
||||
if package.new_version.rev:
|
||||
line = line.replace(package.rev, package.new_version.rev)
|
||||
print(line.replace(old_version, new_version), end="")
|
||||
else:
|
||||
info(f"Not updating version, already {old_version}")
|
||||
@ -131,7 +133,7 @@ def update_version(
|
||||
package: Package, version: str, preference: VersionPreference, version_regex: str
|
||||
) -> bool:
|
||||
if preference == VersionPreference.FIXED:
|
||||
new_version = version
|
||||
new_version = Version(version)
|
||||
else:
|
||||
if not package.url:
|
||||
if package.urls:
|
||||
@ -140,12 +142,23 @@ def update_version(
|
||||
raise UpdateError(
|
||||
"Could not find a url in the derivations src attribute"
|
||||
)
|
||||
new_version = fetch_latest_version(package.url, preference, version_regex)
|
||||
version
|
||||
if preference != VersionPreference.BRANCH:
|
||||
branch = None
|
||||
elif version == "branch":
|
||||
# fallback
|
||||
branch = "HEAD"
|
||||
else:
|
||||
assert version.startswith("branch=")
|
||||
branch = version[7:]
|
||||
new_version = fetch_latest_version(
|
||||
package.url, preference, version_regex, branch
|
||||
)
|
||||
package.new_version = new_version
|
||||
position = package.version_position
|
||||
if new_version == package.old_version and position:
|
||||
if new_version.number == package.old_version and position:
|
||||
recovered_version = old_version_from_git(
|
||||
position.file, position.line, new_version
|
||||
position.file, position.line, new_version.number
|
||||
)
|
||||
if recovered_version:
|
||||
package.old_version = recovered_version
|
||||
|
@ -1,11 +1,12 @@
|
||||
import re
|
||||
from functools import partial
|
||||
from typing import Callable, List, Optional
|
||||
from urllib.parse import ParseResult, urlparse
|
||||
|
||||
from ..errors import VersionError
|
||||
from .crate import fetch_crate_versions
|
||||
from .github import fetch_github_versions
|
||||
from .gitlab import fetch_gitlab_versions
|
||||
from .github import fetch_github_snapshots, fetch_github_versions
|
||||
from .gitlab import fetch_gitlab_snapshots, fetch_gitlab_versions
|
||||
from .pypi import fetch_pypi_versions
|
||||
from .rubygems import fetch_rubygem_versions
|
||||
from .savannah import fetch_savannah_versions
|
||||
@ -31,14 +32,19 @@ fetchers: List[Callable[[ParseResult], List[Version]]] = [
|
||||
fetch_sourcehut_versions,
|
||||
]
|
||||
|
||||
branch_snapshots_fetchers: List[Callable[[ParseResult, str], List[Version]]] = [
|
||||
fetch_github_snapshots,
|
||||
fetch_gitlab_snapshots,
|
||||
]
|
||||
|
||||
def extract_version(version: str, version_regex: str) -> Optional[str]:
|
||||
|
||||
def extract_version(version: Version, version_regex: str) -> Optional[Version]:
|
||||
pattern = re.compile(version_regex)
|
||||
match = re.match(pattern, version)
|
||||
match = re.match(pattern, version.number)
|
||||
if match is not None:
|
||||
group = match.group(1)
|
||||
if group is not None:
|
||||
return group
|
||||
return Version(group, prerelease=version.prerelease, rev=version.rev)
|
||||
return None
|
||||
|
||||
|
||||
@ -50,25 +56,31 @@ def is_unstable(version: Version, extracted: str) -> bool:
|
||||
|
||||
|
||||
def fetch_latest_version(
|
||||
url_str: str, preference: VersionPreference, version_regex: str
|
||||
) -> str:
|
||||
url_str: str,
|
||||
preference: VersionPreference,
|
||||
version_regex: str,
|
||||
branch: Optional[str] = None,
|
||||
) -> Version:
|
||||
url = urlparse(url_str)
|
||||
|
||||
unstable: List[str] = []
|
||||
filtered: List[str] = []
|
||||
for fetcher in fetchers:
|
||||
used_fetchers = fetchers
|
||||
if preference == VersionPreference.BRANCH:
|
||||
used_fetchers = [partial(f, branch=branch) for f in branch_snapshots_fetchers]
|
||||
for fetcher in used_fetchers:
|
||||
versions = fetcher(url)
|
||||
if versions == []:
|
||||
continue
|
||||
final = []
|
||||
for version in versions:
|
||||
extracted = extract_version(version.number, version_regex)
|
||||
extracted = extract_version(version, version_regex)
|
||||
if extracted is None:
|
||||
filtered.append(version.number)
|
||||
elif preference == VersionPreference.STABLE and is_unstable(
|
||||
version, extracted
|
||||
version, extracted.number
|
||||
):
|
||||
unstable.append(extracted)
|
||||
unstable.append(extracted.number)
|
||||
else:
|
||||
final.append(extracted)
|
||||
if final != []:
|
||||
|
@ -34,3 +34,29 @@ def fetch_github_versions(url: ParseResult) -> List[Version]:
|
||||
tree = ET.fromstring(resp.read())
|
||||
releases = tree.findall(".//{http://www.w3.org/2005/Atom}entry")
|
||||
return [version_from_entry(x) for x in releases]
|
||||
|
||||
|
||||
def fetch_github_snapshots(url: ParseResult, branch: str) -> List[Version]:
|
||||
if url.netloc != "github.com":
|
||||
return []
|
||||
parts = url.path.split("/")
|
||||
owner, repo = parts[1], parts[2]
|
||||
repo = re.sub(r"\.git$", "", repo)
|
||||
feed_url = f"https://github.com/{owner}/{repo}/commits/{branch}.atom"
|
||||
info(f"fetch {feed_url}")
|
||||
resp = urllib.request.urlopen(feed_url)
|
||||
tree = ET.fromstring(resp.read())
|
||||
commits = tree.findall(".//{http://www.w3.org/2005/Atom}entry")
|
||||
|
||||
for entry in commits:
|
||||
link = entry.find("{http://www.w3.org/2005/Atom}link")
|
||||
updated = entry.find("{http://www.w3.org/2005/Atom}updated")
|
||||
assert (
|
||||
link is not None and updated is not None and updated.text is not None
|
||||
), "cannot parse ATOM feed"
|
||||
url = urlparse(link.attrib["href"])
|
||||
commit = url.path.rsplit("/", maxsplit=1)[-1]
|
||||
date = updated.text.split("T", maxsplit=1)[0]
|
||||
return [Version(f"unstable-{date}", rev=commit)]
|
||||
|
||||
return []
|
||||
|
@ -1,8 +1,9 @@
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
from urllib.parse import ParseResult
|
||||
from urllib.parse import ParseResult, quote_plus
|
||||
|
||||
from ..errors import VersionError
|
||||
from ..utils import info
|
||||
@ -39,3 +40,20 @@ def fetch_gitlab_versions(url: ParseResult) -> List[Version]:
|
||||
if releases == []:
|
||||
return tags
|
||||
return releases
|
||||
|
||||
|
||||
def fetch_gitlab_snapshots(url: ParseResult, branch: str) -> List[Version]:
|
||||
match = GITLAB_API.match(url.geturl())
|
||||
if not match:
|
||||
return []
|
||||
domain = match.group("domain")
|
||||
project_id = match.group("project_id")
|
||||
gitlab_url = f"https://{domain}/api/v4/projects/{project_id}/repository/commits?ref_name={quote_plus(branch)}"
|
||||
info(f"fetch {gitlab_url}")
|
||||
resp = urllib.request.urlopen(gitlab_url)
|
||||
commits = json.load(resp)
|
||||
for commit in commits:
|
||||
date = datetime.strptime(commit["committed_date"], "%Y-%m-%dT%H:%M:%S.000%z")
|
||||
date -= date.utcoffset() # type: ignore[operator]
|
||||
return [Version(date.strftime("unstable-%Y-%m-%d"), rev=commit["id"])]
|
||||
return []
|
||||
|
@ -7,6 +7,7 @@ from typing import Optional
|
||||
class Version:
|
||||
number: str
|
||||
prerelease: Optional[bool] = None
|
||||
rev: Optional[str] = None
|
||||
|
||||
|
||||
class VersionPreference(Enum):
|
||||
@ -14,6 +15,7 @@ class VersionPreference(Enum):
|
||||
UNSTABLE = auto()
|
||||
FIXED = auto()
|
||||
SKIP = auto()
|
||||
BRANCH = auto()
|
||||
|
||||
@staticmethod
|
||||
def from_str(version: str) -> "VersionPreference":
|
||||
@ -24,4 +26,6 @@ class VersionPreference(Enum):
|
||||
return VersionPreference.UNSTABLE
|
||||
elif version == "skip":
|
||||
return VersionPreference.SKIP
|
||||
elif version == "branch" or version.startswith("branch="):
|
||||
return VersionPreference.BRANCH
|
||||
return VersionPreference.FIXED
|
||||
|
385
tests/test_branch.atom
Normal file
385
tests/test_branch.atom
Normal file
@ -0,0 +1,385 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
|
||||
<id>tag:github.com,2008:/Mic92/nix-update/commits/master</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commits/master"/>
|
||||
<link type="application/atom+xml" rel="self" href="https://github.com/Mic92/nix-update/commits/master.atom"/>
|
||||
<title>Recent Commits to nix-update:master</title>
|
||||
<updated>2021-12-13T14:02:42Z</updated>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/79dcae59a9d16ec003bda4e232319db2fb83e252</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/79dcae59a9d16ec003bda4e232319db2fb83e252"/>
|
||||
<title>
|
||||
Merge pull request #74 from Mic92/mypy-fix
|
||||
</title>
|
||||
<updated>2021-12-13T14:02:42Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #74 from Mic92/mypy-fix
|
||||
|
||||
fix mypy</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/8e88950e6cab1f2b5e7be759b14e21cef7e6615d</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/8e88950e6cab1f2b5e7be759b14e21cef7e6615d"/>
|
||||
<title>
|
||||
fix mypy
|
||||
</title>
|
||||
<updated>2021-12-13T14:00:12Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>fix mypy</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/4692eb3a5cd27cc0cbce2cafe013271b62c8ec03</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/4692eb3a5cd27cc0cbce2cafe013271b62c8ec03"/>
|
||||
<title>
|
||||
Merge pull request #72 from Mic92/dependabot/github_actions/cachix/in…
|
||||
</title>
|
||||
<updated>2021-11-22T07:01:11Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #72 from Mic92/dependabot/github_actions/cachix/install-nix-action-16
|
||||
|
||||
Bump cachix/install-nix-action from 15 to 16</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/4efc9f1f37f555b326cfb722572506a099c71e53</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/4efc9f1f37f555b326cfb722572506a099c71e53"/>
|
||||
<title>
|
||||
Bump cachix/install-nix-action from 15 to 16
|
||||
</title>
|
||||
<updated>2021-11-22T06:01:34Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&v=4"/>
|
||||
<author>
|
||||
<name>dependabot</name>
|
||||
<uri>https://github.com/dependabot</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Bump cachix/install-nix-action from 15 to 16
|
||||
|
||||
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 15 to 16.
|
||||
- [Release notes](https://github.com/cachix/install-nix-action/releases)
|
||||
- [Commits](https://github.com/cachix/install-nix-action/compare/v15...v16)
|
||||
|
||||
---
|
||||
updated-dependencies:
|
||||
- dependency-name: cachix/install-nix-action
|
||||
dependency-type: direct:production
|
||||
update-type: version-update:semver-major
|
||||
...
|
||||
|
||||
Signed-off-by: dependabot[bot] &lt;support@github.com&gt;</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/b668fe6ea0b3d8464a1ede78d7306f309a6fb7f6</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/b668fe6ea0b3d8464a1ede78d7306f309a6fb7f6"/>
|
||||
<title>
|
||||
Merge pull request #70 from Mic92/ci
|
||||
</title>
|
||||
<updated>2021-11-15T07:45:54Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #70 from Mic92/ci
|
||||
|
||||
drop install_url</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/079aac11c75d03e534e948a5f8cfa2bb6f5ffd52</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/079aac11c75d03e534e948a5f8cfa2bb6f5ffd52"/>
|
||||
<title>
|
||||
drop install_url
|
||||
</title>
|
||||
<updated>2021-11-15T07:40:32Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>drop install_url</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/a494f951a76c77c796dd739ce18717a989a9ec2c</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/a494f951a76c77c796dd739ce18717a989a9ec2c"/>
|
||||
<title>
|
||||
Merge pull request #69 from Mic92/dependabot/github_actions/cachix/in…
|
||||
</title>
|
||||
<updated>2021-11-15T07:39:58Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #69 from Mic92/dependabot/github_actions/cachix/install-nix-action-15
|
||||
|
||||
Bump cachix/install-nix-action from 14 to 15</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/543030454c3e65e10b4ce6dc18f2f0f3b65c5484</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/543030454c3e65e10b4ce6dc18f2f0f3b65c5484"/>
|
||||
<title>
|
||||
Bump cachix/install-nix-action from 14 to 15
|
||||
</title>
|
||||
<updated>2021-11-15T06:00:49Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&v=4"/>
|
||||
<author>
|
||||
<name>dependabot</name>
|
||||
<uri>https://github.com/dependabot</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Bump cachix/install-nix-action from 14 to 15
|
||||
|
||||
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 14 to 15.
|
||||
- [Release notes](https://github.com/cachix/install-nix-action/releases)
|
||||
- [Commits](https://github.com/cachix/install-nix-action/compare/v14...v15)
|
||||
|
||||
---
|
||||
updated-dependencies:
|
||||
- dependency-name: cachix/install-nix-action
|
||||
dependency-type: direct:production
|
||||
update-type: version-update:semver-major
|
||||
...
|
||||
|
||||
Signed-off-by: dependabot[bot] &lt;support@github.com&gt;</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/52582817e8c6474c23b2855aa4bed2b53e708741</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/52582817e8c6474c23b2855aa4bed2b53e708741"/>
|
||||
<title>
|
||||
Merge pull request #67 from Mic92/dependabot/github_actions/cachix/in…
|
||||
</title>
|
||||
<updated>2021-09-13T11:29:28Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #67 from Mic92/dependabot/github_actions/cachix/install-nix-action-14
|
||||
|
||||
Bump cachix/install-nix-action from 13 to 14</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/72527c376744fb03f9558b7bb7b4195b082268d8</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/72527c376744fb03f9558b7bb7b4195b082268d8"/>
|
||||
<title>
|
||||
Bump cachix/install-nix-action from 13 to 14
|
||||
</title>
|
||||
<updated>2021-09-13T06:00:54Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&v=4"/>
|
||||
<author>
|
||||
<name>dependabot</name>
|
||||
<uri>https://github.com/dependabot</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Bump cachix/install-nix-action from 13 to 14
|
||||
|
||||
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 13 to 14.
|
||||
- [Release notes](https://github.com/cachix/install-nix-action/releases)
|
||||
- [Commits](https://github.com/cachix/install-nix-action/compare/v13...v14)
|
||||
|
||||
---
|
||||
updated-dependencies:
|
||||
- dependency-name: cachix/install-nix-action
|
||||
dependency-type: direct:production
|
||||
update-type: version-update:semver-major
|
||||
...
|
||||
|
||||
Signed-off-by: dependabot[bot] &lt;support@github.com&gt;</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/70bdf762e5be36ddea70234daa0d476fea0498ff</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/70bdf762e5be36ddea70234daa0d476fea0498ff"/>
|
||||
<title>
|
||||
README: migrate from restructured text
|
||||
</title>
|
||||
<updated>2021-09-02T04:57:00Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>README: migrate from restructured text</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/b167cc623191bc8bb1afbc7f3ab5ac0a039f70dd</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/b167cc623191bc8bb1afbc7f3ab5ac0a039f70dd"/>
|
||||
<title>
|
||||
Merge pull request #65 from Mic92/cargo-sha256
|
||||
</title>
|
||||
<updated>2021-08-26T13:48:04Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #65 from Mic92/cargo-sha256
|
||||
|
||||
allow to upload cargo checksum when source is local</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/2f498d50d7d70217557804907244062cb35a9e6b</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/2f498d50d7d70217557804907244062cb35a9e6b"/>
|
||||
<title>
|
||||
don't require valid version if --version=skip
|
||||
</title>
|
||||
<updated>2021-08-26T13:45:05Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>don&#39;t require valid version if --version=skip</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/008e69ed04e4ff2bc962bb2b5c1e04bb3c725cb5</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/008e69ed04e4ff2bc962bb2b5c1e04bb3c725cb5"/>
|
||||
<title>
|
||||
allow to upload cargo checksum when source is local
|
||||
</title>
|
||||
<updated>2021-08-26T11:08:18Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>allow to upload cargo checksum when source is local</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/474e358eeab1dbeabddd0a16ecf647695e90f43b</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/474e358eeab1dbeabddd0a16ecf647695e90f43b"/>
|
||||
<title>
|
||||
Merge pull request #63 from Mic92/nixos-tests
|
||||
</title>
|
||||
<updated>2021-08-21T12:58:05Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #63 from Mic92/nixos-tests
|
||||
|
||||
fix evaluation on macos for pkgs with tests</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/bec42b219b9d4dfe6cef6abd5e71b4753996e00a</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/bec42b219b9d4dfe6cef6abd5e71b4753996e00a"/>
|
||||
<title>
|
||||
fix evaluation on macos for pkgs with tests
|
||||
</title>
|
||||
<updated>2021-08-21T08:33:02Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>fix evaluation on macos for pkgs with tests
|
||||
|
||||
fixes https://github.com/Mic92/nix-update/issues/62</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/3c77336eecf836c34b866271a58f74f1dc2a524d</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/3c77336eecf836c34b866271a58f74f1dc2a524d"/>
|
||||
<title>
|
||||
Merge pull request #60 from SuperSandro2000/sourcehut
|
||||
</title>
|
||||
<updated>2021-08-15T22:27:59Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&u=9ed15c85825694d00e996d605d728179b830c4fa&v=4"/>
|
||||
<author>
|
||||
<name>Mic92</name>
|
||||
<uri>https://github.com/Mic92</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Merge pull request #60 from SuperSandro2000/sourcehut
|
||||
|
||||
Add sourcehut support, minor cleanups</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/3ece737ad749ca480072921f145ca1b7d9da5498</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/3ece737ad749ca480072921f145ca1b7d9da5498"/>
|
||||
<title>
|
||||
Fix tests
|
||||
</title>
|
||||
<updated>2021-08-15T22:23:35Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&u=c524720e2844ffa8a2aa67944fde5af54031e06d&v=4"/>
|
||||
<author>
|
||||
<name>SuperSandro2000</name>
|
||||
<uri>https://github.com/SuperSandro2000</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Fix tests</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/45fef9987cc850c36a8ed2bca0177f44b267f095</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/45fef9987cc850c36a8ed2bca0177f44b267f095"/>
|
||||
<title>
|
||||
Add lorri files to run tests
|
||||
</title>
|
||||
<updated>2021-08-15T22:23:35Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&u=c524720e2844ffa8a2aa67944fde5af54031e06d&v=4"/>
|
||||
<author>
|
||||
<name>SuperSandro2000</name>
|
||||
<uri>https://github.com/SuperSandro2000</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Add lorri files to run tests</pre>
|
||||
</content>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>tag:github.com,2008:Grit::Commit/6ae3eb12864a4d5945f21a870ca4c97208a3a325</id>
|
||||
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/6ae3eb12864a4d5945f21a870ca4c97208a3a325"/>
|
||||
<title>
|
||||
Remove unused import
|
||||
</title>
|
||||
<updated>2021-08-15T15:09:09Z</updated>
|
||||
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&u=c524720e2844ffa8a2aa67944fde5af54031e06d&v=4"/>
|
||||
<author>
|
||||
<name>SuperSandro2000</name>
|
||||
<uri>https://github.com/SuperSandro2000</uri>
|
||||
</author>
|
||||
<content type="html">
|
||||
<pre style='white-space:pre-wrap;width:81ex'>Remove unused import</pre>
|
||||
</content>
|
||||
</entry>
|
||||
</feed>
|
28
tests/test_branch.py
Normal file
28
tests/test_branch.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
import unittest.mock
|
||||
from pathlib import Path
|
||||
from typing import BinaryIO
|
||||
|
||||
import conftest
|
||||
|
||||
from nix_update.version import fetch_latest_version
|
||||
from nix_update.version.version import VersionPreference
|
||||
|
||||
TEST_ROOT = Path(__file__).parent.resolve()
|
||||
|
||||
|
||||
def fake_urlopen(url: str) -> BinaryIO:
|
||||
return open(TEST_ROOT.joinpath("test_branch.atom"), "rb")
|
||||
|
||||
|
||||
def test_branch(helpers: conftest.Helpers) -> None:
|
||||
with unittest.mock.patch("urllib.request.urlopen", fake_urlopen):
|
||||
assert (
|
||||
fetch_latest_version(
|
||||
"https://github.com/Mic92/nix-update",
|
||||
VersionPreference.BRANCH,
|
||||
"(.*)",
|
||||
"master",
|
||||
).number
|
||||
== "unstable-2021-12-13"
|
||||
)
|
Loading…
Reference in New Issue
Block a user