-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a check to the nature of the package #4
Open
melis-m
wants to merge
42
commits into
raven-os:master
Choose a base branch
from
melis-m:pkg_nature
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
713a739
Start revamp, atm only take npf(s) and unwraps them
melis-m ea2baec
Add log functions (from nbuild + qlog)
melis-m 22be1a1
Remove Kind enum
melis-m 388406f
Add tarball/npf wrap function, no updates of the manifest.toml yet
melis-m fdb3be8
Remove args.{output,backup}, as they're not used yet
melis-m 8c5ff82
Add function to refresh date of manifest wrap_date
melis-m 4e39c71
Add log to data.tar.gz creation and manifest.toml
melis-m 230cd2f
Add options to args to choose from fix/edit/diff
melis-m a90ad70
Add .gitignore
melis-m f2adf6e
Add .gitignore and definition of core.pushd
melis-m 8409633
Add basis for checks
melis-m 0c0740c
Add executable checks on shlibs/binaries
melis-m 9ba0e49
Merge branch 'master' of github.com:raven-os/npf-checker into checks
melis-m 02c7e30
npf-checker now only takes one .npf
melis-m d9d7e42
Add base class for checks modifying manifest.toml
melis-m 0c4c80f
Fix utils.ask_yne default (when pressing enter directly)
melis-m 3fdc2d5
Add some log.push and use of colored_path in tar creation logs
melis-m 0599448
Reintroduce pkg to check_package, and to checks with manifest.toml
melis-m b8fe5f7
Add checks on manifest.toml's description
melis-m d82214b
Remove self.manifest{,path} from CheckWithManifest, now use self.pkg
melis-m fb7bff4
add correct caps formatting to default option to utils.ask_yne
melis-m 2f4964a
Add check on pkg kind, and a bit more logs to other things
melis-m 9624071
Add log when running DescCheck's run function
melis-m 6444c74
Add spacing in the sentences of utils.ask_yn{,e}
melis-m 67d7d8a
Rename nature to kind
melis-m f3cad7d
Fix pkg.show_manifest, version is now displayed properly
melis-m 6532775
Refresh self.pkg.is_effective in CheckWithManifest after manual edit
melis-m 6d63419
Add space after edit questions in pkg kind check
melis-m aebbcc2
Fix edit question in pkg kind check, when answer isn't 1 or 2
melis-m a87a832
Add /{,s}bin/ and /lib{,32,64}/ and /usr/lib/ to Exec Checks
melis-m 75791b3
Add help section to --action argument
melis-m 58afa1d
Merge branch 'master' of github.com:raven-os/npf-checker into checks
melis-m 77655e4
Merge branch 'checks' into pkg_nature
melis-m a5c79e9
Move run message to run function, and add write_manifest after fix
melis-m cddd150
Remove duplicate log
melis-m e5670dc
Remove extra space in question during run
melis-m d931a1d
Rename 'nest file' to 'NPF'
melis-m 982b7b8
Remove commented code
melis-m caca88d
Reformat indentation on one line
melis-m 6593347
Merge branch 'master' of github.com:raven-os/npf-checker
melis-m e92ee19
Merge branch 'master' into pkg_nature
melis-m 67eb5a1
Fix a typo in a variable definition
melis-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
import os | ||
import sys | ||
|
||
global _args | ||
global _argst | ||
global _parser | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import core.checks.executable as exe | ||
import core.checks.syntax_check as stx | ||
import core.checks.kind as kind | ||
import core.checks.version_validity as version | ||
|
||
|
||
def check_package(pkg): | ||
exe.ExecCheck().run() | ||
stx.DescriptionCheck(pkg).run() | ||
kind.KindCheck(pkg).run() | ||
version.VersionValidityCheck(pkg).run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import os | ||
import core.log as log | ||
import core.checks.base as base | ||
import core.checks.utils as utils | ||
|
||
|
||
class KindCheck(base.CheckWithManifest): | ||
def __init__(self, pkg): | ||
super().__init__(pkg, [None]) | ||
|
||
def run(self): | ||
log.s("Checking package kind") | ||
super().run() | ||
|
||
def validate(self, _): | ||
length = len(os.listdir(self.pkg.cache)) | ||
return (self.pkg.is_effective and length != 1) \ | ||
or (not self.pkg.is_effective and length == 1) | ||
|
||
def show(self, _): | ||
if self.pkg.is_effective: | ||
log.e("Package is effective but is missing a data.tar.gz") | ||
else: | ||
log.e("Package is virtual but has a data.tar.gz") | ||
|
||
def diff(self, _): | ||
target = 'virtual' if self.pkg.is_effective else 'effective' | ||
log.i(f"Package kind would be changed to {target}") | ||
|
||
def fix(self, _): | ||
target = 'virtual' if self.pkg.is_effective else 'effective' | ||
self.pkg.manifest['kind'] = target | ||
self.pkg.is_effective = not self.pkg.is_effective | ||
self.write_pkg_manifest() | ||
|
||
def edit(self, _): | ||
if self.pkg.is_effective: | ||
ans = self._ask_1or2("Would you like to edit the manifest.toml (1) " | ||
"or to add files to the package (2)? ") | ||
if ans == 1: | ||
super().edit(_) | ||
elif ans == 2: | ||
utils.open_shell(self.pkg.cache) | ||
else: | ||
|
||
ans = self._ask_1or2("Would you like to edit the manifest.toml (1) " | ||
"or to remove the files from the package? (2) ") | ||
if ans == 1: | ||
super().edit(_) | ||
|
||
@staticmethod | ||
def _ask_1or2(question): | ||
while True: | ||
ans = log.q(question) | ||
if ans == '1': | ||
return 1 | ||
elif ans == '2': | ||
return 2 | ||
else: | ||
log.w("Only recognized answers are 1 and 2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a lot like a mistake. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woops