Skip to content

Commit

Permalink
Merge pull request #201 from homebysix/dev
Browse files Browse the repository at this point in the history
2.3.1 merge to main
  • Loading branch information
homebysix committed Oct 19, 2023
2 parents f6c9f15 + 1db59d3 commit b4161d0
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 30 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ All notable changes to this project will be documented in this file. This projec

Nothing yet.

## [2.3.1] - 2023-10-19

### Fixed

- Fixed an issue with Recipe Robot's Sparkle update feed that caused "you're up to date" to appear even when the app wasn't the newest version. Resolved by publishing new automation to the [gh-pages](https://github.com/homebysix/recipe-robot/tree/gh-pages) branch of the repo. (Although this is listed as a fix for 2.3.1, it should actually resolve the issue for all previous versions of Recipe Robot.)
- Jamf pkg upload recipes that use a parent download recipe that retrieves a package file won't fail (related to the behavior change below, #193).
- Fixed a very rare issue in which Recipe Robot is not able to remove its cache folder after a pkg is unpacked that contains files that aren't user-writeable.
- Adjusted SourceForge download URL search process and updated SF RSS parsing logic. Added support for detection of SourceForge `/project/` URLs, which apparently coexist with `/projects/` URLs.
- Made adjustments to functional tests for upcoming AutoPkg 3 recipe map compatibility.

### Changed

- Recipe Robot no longer skips creating 'pkg' type recipes if the download is already in pkg format. Instead, it creates a recipe with a `PkgCopier` process (and potentially other processes if necessary for versioning). (#193)

## [2.3.0] - 2023-10-16

### Added
Expand Down Expand Up @@ -396,7 +410,8 @@ Nothing yet.

- Initial public release of Recipe Robot (beta).

[Unreleased]: https://github.com/homebysix/recipe-robot/compare/v2.3.0...HEAD
[Unreleased]: https://github.com/homebysix/recipe-robot/compare/v2.3.1...HEAD
[2.3.1]: https://github.com/homebysix/recipe-robot/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/homebysix/recipe-robot/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/homebysix/recipe-robot/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/homebysix/recipe-robot/compare/v2.0.0...v2.1.0
Expand Down
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
git checkout gh-pages
git commit --allow-empty -m "Trigger gh-pages build"
git push
git checkout master
git checkout main

13. Announce to [autopkg](https://macadmins.slack.com/archives/C056155B4) and other relevant channels, if desired.

Expand Down
4 changes: 2 additions & 2 deletions app/Recipe Robot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.elliotjordan.recipe-robot";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -571,7 +571,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.elliotjordan.recipe-robot";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion app/Recipe Robot/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>RRBT</string>
<key>CFBundleVersion</key>
<string>1363</string>
<string>1375</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
9 changes: 8 additions & 1 deletion scripts/recipe-robot
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import os
import pprint
import pwd
import shutil
import subprocess
import sys
import traceback

Expand Down Expand Up @@ -128,7 +129,13 @@ def main():

# Clean up cache folder.
if os.path.exists(CACHE_DIR) and not facts["args"].keep_cache:
shutil.rmtree(CACHE_DIR)
try:
shutil.rmtree(CACHE_DIR)
except PermissionError:
# Rarely, pkgs unpack files that are not user-writeable
cmd = ["/bin/chmod", "-R", "u+w", CACHE_DIR]
_ = subprocess.run(cmd, check=False)
shutil.rmtree(CACHE_DIR)

# If debug is on, print all the things.
if OutputMode.debug_mode:
Expand Down
35 changes: 31 additions & 4 deletions scripts/recipe_robot_lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,14 @@ def inspect_sourceforge_url(input_path, args, facts):
proj_name = proj_str[: proj_str.find("/")]
else:
proj_name = proj_str
elif "/project/" in input_path:
# Example: https://www.sourceforge.net/project/vienna-rss
marker = "/project/"
proj_str = input_path[input_path.find(marker) + len(marker) :]
if proj_str.find("/") > 0:
proj_name = proj_str[: proj_str.find("/")]
else:
proj_name = proj_str
elif "/p/" in input_path:
# Example: https://sourceforge.net/p/grandperspectiv/wiki/Home/
marker = "/p/"
Expand All @@ -1867,7 +1875,12 @@ def inspect_sourceforge_url(input_path, args, facts):
# Example: http://grandperspectiv.sourceforge.net/
# Example: http://grandperspectiv.sourceforge.net/screenshots.html
marker = ".sourceforge.net"
proj_str = input_path.lstrip("http://")
proj_str = (
input_path.removeprefix("https://www.")
.removeprefix("http://www.")
.removeprefix("https://")
.removeprefix("http://")
)
proj_name = proj_str[: proj_str.find(marker)]
else:
facts["warnings"].append("Unable to parse SourceForge URL.")
Expand Down Expand Up @@ -1948,9 +1961,23 @@ def inspect_sourceforge_url(input_path, args, facts):
# (#21) Example:
# https://sourceforge.net/projects/grandperspectiv/rss
search = "{https://sourceforge.net/api/files.rdf#}extra-info"
if item.find(search).text.startswith("data"):
download_url = item.find("link").text.rstrip("/download")
break
if "text" in item.find(search).text:
# Skip README, LICENSE, and other text files
continue
link = item.find("link")
if "beta" in link.text.lower() or "-dSYM" in link.text:
# Skip betas and framework sources
continue
# Transform download URL to bypass interactive page. Before:
# https://sourceforge.net/projects/grandperspectiv/files/grandperspective/Bug-112/Bug-112.zip/download
# After:
# https://master.dl.sourceforge.net/project/grandperspectiv/grandperspective/Bug-112/Bug-112.zip?viasf=1
dl_path = link.text.split("/files/")[-1].removesuffix("/download")
download_url = "https://master.dl.sourceforge.net/project/%s/%s?viasf=1" % (
proj_name,
dl_path,
)
break
if download_url not in ("", None):
facts = inspect_download_url(download_url, args, facts)
else:
Expand Down
80 changes: 76 additions & 4 deletions scripts/recipe_robot_lib/recipe_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,82 @@ def generate_pkg_recipe(facts, prefs, recipe):
)

elif facts["download_format"] in SUPPORTED_INSTALL_FORMATS:
facts["warnings"].append(
"Skipping pkg recipe, since the download format is already pkg."
)
return
if facts.get("sparkle_provides_version") or "github_repo" in facts:
# Sparkle and GitHub provide version information.
recipe.append_processor(
{
"Processor": "PkgCopier",
"Arguments": {
"source_pkg": "%pathname%",
"pkg_path": "%RECIPE_CACHE_DIR%/%NAME%-%version%.pkg",
},
}
)
elif facts.get("app_relpath_from_payload"):
# Version available from an app inside the pkg payload.
recipe.append_processor(
{
"Processor": "FlatPkgUnpacker",
"Arguments": {
"destination_path": "%RECIPE_CACHE_DIR%/unpacked",
"flat_pkg_path": "%pathname%",
},
}
)
recipe.append_processor(
{
"Processor": "PkgPayloadUnpacker",
"Arguments": {
"destination_path": "%RECIPE_CACHE_DIR%/payload",
"pkg_payload_path": f"%RECIPE_CACHE_DIR%/unpacked/{facts['pkg_filename']}/Payload",
"purge_destination": True,
},
}
)
recipe.append_processor(
{
"Processor": "Versioner",
"Arguments": {
"input_plist_path": f"%RECIPE_CACHE_DIR%/payload/{facts['app_relpath_from_payload']}"
"/Contents/Info.plist",
"plist_version_key": facts.get(
"version_key", "CFBundleShortVersionString"
),
},
}
)
recipe.append_processor(
{
"Processor": "PkgCopier",
"Arguments": {
"source_pkg": "%pathname%",
"pkg_path": "%RECIPE_CACHE_DIR%/%NAME%-%version%.pkg",
},
}
)
recipe.append_processor(
{
"Processor": "PathDeleter",
"Arguments": {
"path_list": [
"%RECIPE_CACHE_DIR%/payload",
"%RECIPE_CACHE_DIR%/unpacked",
]
},
}
)
else:
# No version available.
# TODO: Are there other version retrieval possibilities?
recipe.append_processor(
{
"Processor": "PkgCopier",
"Arguments": {
"source_pkg": "%pathname%",
"pkg_path": "%RECIPE_CACHE_DIR%/%NAME%.pkg",
},
}
)

return recipe

Expand Down
2 changes: 1 addition & 1 deletion scripts/recipe_robot_lib/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# pylint: enable=no-name-in-module


__version__ = "2.3.0"
__version__ = "2.3.1"
ENDC = "\033[0m"
BUNDLE_ID = "com.elliotjordan.recipe-robot"
PREFS_FILE = os.path.expanduser("~/Library/Preferences/%s.plist" % BUNDLE_ID)
Expand Down
9 changes: 2 additions & 7 deletions scripts/test/sample_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
- app_name: DraftSight
bundle_id: com.3ds.draftsight
developer: 3ds
input_path: http://www.draftsight.com/download-mac
input_path: https://dl-ak.solidworks.com/nonsecure/draftsight/2023SP4-1-5WQLABEM/DraftSight.pkg

- app_name: duet
bundle_id: com.kairos.duet
Expand Down Expand Up @@ -610,11 +610,6 @@
developer: Techno-Grafik
input_path: https://www.itaskx3.com/services/appcast.ashx

- app_name: iThoughtsX
bundle_id: com.toketaware.ithoughtsx
developer: toketaWare
input_path: https://s3-eu-west-1.amazonaws.com/ithoughtsx/ithoughtsx.xml

- app_name: iZip
bundle_id: com.iboostup.izip
developer: iBoostUp
Expand Down Expand Up @@ -1253,7 +1248,7 @@
- app_name: Vienna
bundle_id: uk.co.opencommunity.vienna2
developer: Barijaona Ramaholimihaso
input_path: https://viennarss.github.io/sparkle-files/changelog.xml
input_path: https://github.com/ViennaRSS/vienna-rss

- app_name: VimR
bundle_id: com.qvacua.VimR
Expand Down
6 changes: 3 additions & 3 deletions scripts/test/test_curler.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def test_parse_http_protocol(self):
def test_parse_http_header(self):
"""Verify we can parse a single HTTP header line."""
header = {}
curler.parse_http_header("expires: Fri, 11 Dec 2020 08:37:42 GMT", header)
expected = {"expires": "Fri, 11 Dec 2020 08:37:42 GMT"}
curler.parse_http_header("expires: Fri, 11 Dec 2023 08:59:27 GMT", header)
expected = {"expires": "Fri, 11 Dec 2023 08:59:27 GMT"}
assert_equal(expected, header)

header = {}
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_parse_headers(self):
"content-length": "220",
"content-type": "text/html; charset=UTF-8",
"date": "Wed, 11 Nov 2020 08:59:27 GMT",
"expires": "Fri, 11 Dec 2020 08:59:27 GMT",
"expires": "Fri, 11 Dec 2023 08:59:27 GMT",
"http_redirected": None,
"http_result_code": "301",
"http_result_description": "",
Expand Down
17 changes: 12 additions & 5 deletions scripts/test/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@ def robot_runner(input_path):
def autopkg_runner(recipe_path):
"""For given recipe path, run AutoPkg and make sure the return code is zero."""

# Change to recipe directory so we can find the parent recipes easily
prevcwd = os.getcwd()
os.chdir(os.path.split(recipe_path)[0])

proc = subprocess.run(
["/usr/local/bin/autopkg", "run", recipe_path, "--quiet"], check=False
)
assert_equal(
proc.returncode,
0,
"{}: AutoPkg returned nonzero return code.".format(recipe_path),
)
try:
assert_equal(
proc.returncode,
0,
"{}: AutoPkg returned nonzero return code.".format(recipe_path),
)
finally:
os.chdir(prevcwd)


def verify_processor_args(processor_name, recipe, expected_args):
Expand Down

0 comments on commit b4161d0

Please sign in to comment.