Skip to content

added aur packaging + adjusted the scripts to meet the new setup way#30

Merged
moheladwy merged 4 commits intomainfrom
create-aur-package
Mar 21, 2026
Merged

added aur packaging + adjusted the scripts to meet the new setup way#30
moheladwy merged 4 commits intomainfrom
create-aur-package

Conversation

@moheladwy
Copy link
Copy Markdown
Owner

implements the issue #8

@moheladwy moheladwy self-assigned this Mar 21, 2026
@moheladwy moheladwy added enhancement New feature or request new feature labels Mar 21, 2026
@moheladwy moheladwy linked an issue Mar 21, 2026 that may be closed by this pull request
@moheladwy moheladwy removed a link to an issue Mar 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 21, 2026

Warning

Rate limit exceeded

@moheladwy has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62f0fbbc-28c3-4dad-9812-af6eb5252f9c

📥 Commits

Reviewing files that changed from the base of the PR and between 9d4da61 and 80dc25b.

📒 Files selected for processing (2)
  • .SRCINFO
  • PKGBUILD
📝 Walkthrough

Walkthrough

Bumps release to 1.4.2, adds an Arch PKGBUILD, adjusts shell script runtime/config paths and removes the update option, updates installer UX and deps, and adds .gitignore entries for Arch package artifacts.

Changes

Cohort / File(s) Summary
Packaging & VCS ignores
\.gitignore, PKGBUILD
Added Arch packaging ignore patterns to .gitignore; introduced PKGBUILD for ocr4linux-git with metadata, deps, and install rules.
Version bumps
OCR4Linux.py, README.md
Incremented project version from 1.4.11.4.2. Program.version updated in OCR4Linux.py.
Core script refactor
OCR4Linux.sh
Changed runtime path variables: OCR4Linux_HOME$(pwd), added OCR4Linux_CONFIG="$HOME/.config/OCR4Linux", moved output/log filenames into config dir; renamed check_if_files_exist()check_if_requirements_exists(); removed perform_update() and -u/--update CLI option; adjusted file references and preflight checks.
Installer UX & deps
setup.sh
Updated script version to 1.4.2, added print_help() and an interactive confirmation prompt that can exit early; modified package lists (added rofi, removed rofi-wayland / moved rofi entries).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰
A tiny hop, a tidy tree,
Packaging seeds for Arch to see.
Paths split neatly, logs in line,
Installer asks — then all is fine.
Version hopped to 1.4.2, hooray for me! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main changes: adding AUR packaging support (PKGBUILD) and adjusting scripts (setup.sh, OCR4Linux.sh) to accommodate a new setup methodology with config directory separation.
Description check ✅ Passed The description 'implements the issue #8' is related to the changeset, referencing a specific GitHub issue that motivated these changes, though it lacks detail about the actual modifications.
Docstring Coverage ✅ Passed Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch create-aur-package

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitignore:
- Around line 12-13: The .gitignore currently only ignores package artifacts
matching the pattern "*-any.pkg.*", which misses architecture-specific outputs
like "*-x86_64.pkg.tar.zst"; update the ignore entry in .gitignore to a broader
pattern (e.g., "*-*.pkg.*") so any architecture suffix is covered and built
artifacts don't get committed, replacing the existing "*-any.pkg.*" entry with
the new pattern.

In `@OCR4Linux.sh`:
- Around line 38-40: The script defines OCR4Linux_CONFIG, TEXT_OUTPUT_FILE_NAME
and LOGS_FILE_NAME but never creates OCR4Linux_CONFIG; add a mkdir -p
"$OCR4Linux_CONFIG" (and check its exit status) immediately after those variable
assignments so the directory exists before any code in OCR4Linux.py or clipboard
handling opens TEXT_OUTPUT_FILE_NAME or LOGS_FILE_NAME; ensure you log or exit
on failure to create the directory so subsequent file operations don't silently
fail.
- Line 36: The script sets OCR4Linux_HOME using pwd which breaks resolution when
invoked from elsewhere; change OCR4Linux_HOME to the script's directory (resolve
the location of OCR4Linux.sh / the invoking script) so OCR4Linux.py is loaded
relative to the script, and ensure OCR4Linux_CONFIG is created/validated before
writing outputs (call mkdir -p on OCR4Linux_CONFIG and error out if creation
fails) so fresh installs from setup.sh or PKGBUILD work reliably.

In `@PKGBUILD`:
- Around line 28-30: The PKGBUILD declares pkgver=1.4.2 but the git source is
unpinned (source=("$pkgname-$pkgver::git+$url")), so builds will track the
moving default branch and falsely claim 1.4.2; fix by either setting
pkgver=1.4.1 and pinning the source to the v1.4.1 tag (add the tag ref to
source) or keep pkgver=1.4.2 and pin the git source to a specific commit hash
(append @<commit> to the git+$url ref) so the build is reproducible; update the
sha256sums accordingly.

In `@README.md`:
- Line 3: Update README documentation for the 1.4.2 release: change the version
line to 1.4.2 if not already, add a note about the new ocr4linux AUR package and
include installation instructions for it, remove any references to the
deprecated -u/--update CLI option and update examples that call setup.sh to
reflect the new CLI surface (adjust command examples and flags), and verify the
README’s setup.sh section matches current behavior of the installer and CLI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 031b9963-1023-4ab9-8b27-227310aca271

📥 Commits

Reviewing files that changed from the base of the PR and between b0dd0cc and c34cee4.

📒 Files selected for processing (6)
  • .gitignore
  • OCR4Linux.py
  • OCR4Linux.sh
  • PKGBUILD
  • README.md
  • setup.sh

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 21, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 3

♻️ Duplicate comments (2)
PKGBUILD (1)

2-3: ⚠️ Potential issue | 🟠 Major

Don't ship a fixed pkgver from a moving git checkout.

source=("$pkgname-$pkgver::git+$url") follows the default branch, so two builds of pkgver=1.4.2 can contain different commits. For a -git package, derive pkgver() from the checkout, or pin the source to a specific tag/commit if this is meant to be a release snapshot.

Also applies to: 29-30

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@PKGBUILD` around lines 2 - 3, The PKGBUILD currently hardcodes pkgver=1.4.2
for a git checkout (pkgname ocr4linux-git) which is incorrect for moving
branches; either implement a pkgver() function that derives version from the
checked-out commit/tag (e.g., using git describe --tags or git rev-parse
--short) and remove the fixed pkgver assignment, or pin the source variable
(source=...) to a specific tag/commit instead of using the default branch;
update references to pkgver, pkgname and source accordingly so the package
version always reflects the actual checkout.
OCR4Linux.sh (1)

36-36: ⚠️ Potential issue | 🔴 Critical

Resolve OCR4Linux.py from the wrapper location, not the caller's cwd.

$(pwd) makes the packaged entrypoint fail whenever it is launched from another directory, because both the existence check and the python "$OCR4Linux_HOME/$OCR4Linux_PYTHON_NAME" call look for OCR4Linux.py under the current working directory instead of beside the installed script.

🛠️ Suggested fix
-OCR4Linux_HOME="$(pwd)"
+OCR4Linux_HOME="$(cd -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@OCR4Linux.sh` at line 36, The wrapper sets OCR4Linux_HOME="$(pwd)" which
breaks resolution when invoked from another CWD; change OCR4Linux_HOME in
OCR4Linux.sh to the directory containing the wrapper script (resolve the
script's own path via dirname of the script/source, falling back to $0 if
needed) and use that OCR4Linux_HOME when checking for OCR4Linux_PYTHON_NAME and
invoking python so the script always resolves OCR4Linux.py relative to the
installed wrapper location rather than the caller's cwd.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@OCR4Linux.sh`:
- Around line 89-100: The -d and --lang option handlers currently read "$2" and
do "shift 2" unconditionally; update the case branches for "-d)" and "--lang)"
to validate that a non-empty argument exists and is not another option (e.g.
starts with "-") before assigning SCREENSHOT_DIRECTORY or SPECIFIED_LANGS and
doing "shift 2", otherwise print a clear usage/error message and exit non-zero;
keep the "-l)" branch unchanged and ensure you still set LANG_SPECIFIED=true
when a valid --lang value is provided.
- Around line 119-122: The script currently unconditionally checks for rofi and
exits, which breaks non-interactive flows where LANG_SPECIFIED is true (handled
by process_specified_langs()); change the rofi presence check so it only runs
when interactive selection is required (i.e., when LANG_SPECIFIED is false and
choose_lang will be called). Locate the rofi check block and wrap or gate it
behind a condition that tests LANG_SPECIFIED (or the same flag/logic used to
decide between process_specified_langs() and choose_lang()), so rofi is only
validated when choose_lang() will be executed.
- Around line 255-265: The script currently always logs success and deletes
"$TEXT_OUTPUT_FILE_NAME" even if the OCR (python
"$OCR4Linux_HOME/$OCR4Linux_PYTHON_NAME" ...) or clipboard commands (cliphist /
xclip) fail; update the flow to check each command's exit status and abort on
failure: after running the python OCR invocation check its exit code and call
log_message with an error and exit non-zero if it failed (do not proceed to
clipboard steps), then after attempting clipboard copy (the cliphist and xclip
invocations) check their exit codes and on failure log an error and exit
non-zero without deleting "$TEXT_OUTPUT_FILE_NAME"; only log "Text extraction
completed successfully" and remove "$TEXT_OUTPUT_FILE_NAME" when OCR and
clipboard operations both succeeded.

---

Duplicate comments:
In `@OCR4Linux.sh`:
- Line 36: The wrapper sets OCR4Linux_HOME="$(pwd)" which breaks resolution when
invoked from another CWD; change OCR4Linux_HOME in OCR4Linux.sh to the directory
containing the wrapper script (resolve the script's own path via dirname of the
script/source, falling back to $0 if needed) and use that OCR4Linux_HOME when
checking for OCR4Linux_PYTHON_NAME and invoking python so the script always
resolves OCR4Linux.py relative to the installed wrapper location rather than the
caller's cwd.

In `@PKGBUILD`:
- Around line 2-3: The PKGBUILD currently hardcodes pkgver=1.4.2 for a git
checkout (pkgname ocr4linux-git) which is incorrect for moving branches; either
implement a pkgver() function that derives version from the checked-out
commit/tag (e.g., using git describe --tags or git rev-parse --short) and remove
the fixed pkgver assignment, or pin the source variable (source=...) to a
specific tag/commit instead of using the default branch; update references to
pkgver, pkgname and source accordingly so the package version always reflects
the actual checkout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 398976fd-0200-4109-801d-c0fa021d0742

📥 Commits

Reviewing files that changed from the base of the PR and between c34cee4 and 9d4da61.

📒 Files selected for processing (2)
  • OCR4Linux.sh
  • PKGBUILD

@moheladwy moheladwy linked an issue Mar 21, 2026 that may be closed by this pull request
@moheladwy moheladwy merged commit 74cd888 into main Mar 21, 2026
7 checks passed
@moheladwy moheladwy deleted the create-aur-package branch March 21, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Aur Package

1 participant