Skip to content
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 create command #9624

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add create command #9624

wants to merge 1 commit into from

Conversation

Zopolis4
Copy link
Collaborator

As discussed in #9594.

Pretty simple at the moment, only supports buildsystems, and you will still manually have to add dependencies yourself.

A step in the right direction though, and enough to provide the convenience that I'm taking away from crew upload.

It's hanging right now, and I'd welcome help figuring out why.

Run the following to get this pull request's changes locally for testing.

CREW_REPO=https://github.com/Zopolis4/chromebrew.git CREW_BRANCH=sintered crew update

class Command
def self.create
puts 'Example package names: libnvme, crew-profile-base'.lightblue
name = gets('Enter the package name:').chomp.capitalize.tr('-', '_')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check for invalid package names? First character must be a letter, only alphanumeric and - or _ allowed, search packages for duplicate names, etc.

puts 'Example package description: C Library for NVM Express on Linux.'.lightblue
description = gets('Enter the package description:').chomp
puts 'Example package homepage: https://github.com/linux-nvme/libnvme'.lightblue
homepage = gets('Enter the package homepage:').chomp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Must be a url?

puts 'Example package license: LGPL-2.1+'.lightblue
license = gets('Enter the package license:').chomp
puts 'Example package source_url: https://github.com/linux-nvme/libnvme/archive/refs/tags/v1.0-rc4.tar.gz'.lightblue
source_url = gets('Enter the package source_url:').chomp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Must be a url?

puts 'Example package source_url: https://github.com/linux-nvme/libnvme/archive/refs/tags/v1.0-rc4.tar.gz'.lightblue
source_url = gets('Enter the package source_url:').chomp
puts 'Example package source_sha256: 82dc150c09e5e211d5200a37fabbbe25c69f5b0f22582956e51587a5a54463b5'.lightblue
source_sha256 = gets('Enter the package source_sha256:').chomp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only hex characters allowed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't see how anyone would enter an invalid sha256 value in this way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just another validation possibility.

source_url = gets('Enter the package source_url:').chomp
puts 'Example package source_sha256: 82dc150c09e5e211d5200a37fabbbe25c69f5b0f22582956e51587a5a54463b5'.lightblue
source_sha256 = gets('Enter the package source_sha256:').chomp
puts 'Example package buildsystem: meson'.lightblue
Copy link
Collaborator

Choose a reason for hiding this comment

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

List all possible buildsystems?

puts 'Example package source_sha256: 82dc150c09e5e211d5200a37fabbbe25c69f5b0f22582956e51587a5a54463b5'.lightblue
source_sha256 = gets('Enter the package source_sha256:').chomp
puts 'Example package buildsystem: meson'.lightblue
buildsystem = gets('Enter the package buildsystem:').chomp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Select from a list of options?

@@ -335,6 +335,7 @@
crew build [options] [-k|--keep] [-v|--verbose] <name> ...
crew check [-V|--version] [-v|--verbose] <name> ...
crew const [-v|--verbose] [<name> ...]
crew create
Copy link
Collaborator

Choose a reason for hiding this comment

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

Allow switch options to bypass interactive prompts?

armv7l: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
i686: 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii',
x86_64: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if no_compile_needed is the intention?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe have a prompt to include binaries? Something like Will this package require prebuilt binaries? (Y/n):?

buildsystem = gets('Enter the package buildsystem:').chomp

puts <<~EOF
require "'buildsystems/#{buildsystem}'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about a standard package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I said in the PR description, this only supports buildsystems for now-- a significant chunk of packages are buildsystems anyways, and those that aren't buildsystems will have unique def self.build sections that benefit less from a template.

Copy link
Collaborator

Choose a reason for hiding this comment

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

package could be a choice and buildsystems/ can be added to the others as a replacement pattern. There are many packages that don't require buildsystems too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants