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

Support Arch User Repositories #530

Merged
merged 4 commits into from
Feb 22, 2022
Merged

Support Arch User Repositories #530

merged 4 commits into from
Feb 22, 2022

Conversation

Integralist
Copy link
Collaborator

No description provided.

@Integralist Integralist added the enhancement New feature or request label Feb 3, 2022
@Integralist Integralist requested a review from mccurdyc February 3, 2022 17:30
Copy link
Collaborator Author

@Integralist Integralist left a comment

Choose a reason for hiding this comment

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

@mccurdyc some comments that hopefully you can help with. Please feel free to take over this PR as I think you are better suited to resolve them.

.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@mccurdyc mccurdyc left a comment

Choose a reason for hiding this comment

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

This is a great start!!! Gives me a ton of momentum to run with!

Referenced the gorelease AUR docs while reviewing this - https://goreleaser.com/customization/aur/

And https://wiki.archlinux.org/title/PKGBUILD

Also quickly browsed - https://github.com/goreleaser/goreleaser/blob/a1447a363579365f489458ad7636fd088a5b66ab/internal/pipe/aur/aur.go

I talked to @Integralist and I'm going to own this branch/PR from here and test it out on my Arch machine.

.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated
Comment on lines 95 to 101
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/mybin.bash" "${pkgdir}/usr/share/bash-completion/completions/mybin"
install -Dm644 "./completions/mybin.zsh" "${pkgdir}/usr/share/zsh/site-functions/_mybin"
install -Dm644 "./completions/mybin.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/mybin.fish"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have completions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do! Here's how Homebrew sets up the completions (in case it's helpful):
https://github.com/fastly/homebrew-tap/blob/master/Formula/fastly.rb

I also added a test to the CLI for validating the completion output (again, in case it's of interest/help):
https://github.com/fastly/cli/blob/main/pkg/app/run_test.go#L62-L167

.goreleaser.yml Outdated Show resolved Hide resolved
@mccurdyc
Copy link
Collaborator

mccurdyc commented Feb 8, 2022

Reading the "Rules of Submission" section of https://wiki.archlinux.org/title/AUR_submission_guidelines

  • checked that there is not an existing fastly package - https://archlinux.org/packages/?sort=&q=fastly&maintainer=&flagged=

  • "Packages that use prebuilt deliverables, when the sources are available, must use the -bin suffix...The AUR should not contain the binary tarball created by makepkg, nor should it contain the filelist."

  • "Please add a comment line to the top of the PKGBUILD file which contains information about the current maintainers"

  • Going through "Authentication" section of https://wiki.archlinux.org/title/AUR_submission_guidelines

    ssh-keygen -f ~/.ssh/aur -C noname
    

    And uploaded to a Fastly secret storage system and shared with @Integralist's team.

    Added the following to my ~/.ssh/config file

    Host aur.archlinux.org
     IdentityFile ~/.ssh/aur
     User aur
    
  • Registered for an account on https://aur.archlinux.org/register and used the generated Fastly SSH public key during registration.

  • Ran git clone ssh://aur@aur.archlinux.org/fastly-bin.git

  • Ran git init in the cloned repo

  • Ran git remote add origin ssh://aur@aur.archlinux.org/fastly-bin.git

  • Ran git fetch origin

  • I think we need to run goreleaser locally to test out the generated contents

    GOVERSION=1.17.6 goreleaser release --skip-publish --skip-validate --rm-dist
    ...
       • arch user repositories
      • guessing package to be "install -Dm755 \"./fastly\" \"${pkgdir}/usr/bin/fastly\""
      • writing                   file=dist/aur/fastly-bin.pkgbuild
      • writing                   file=dist/aur/fastly-bin.srcinfo
    
    # cat dist/aur/fastly-bin.pkgbuild
    
    # This file was generated by GoReleaser. DO NOT EDIT.
    # Maintainer: oss@fastly.com
    
    pkgname='fastly-bin'
    pkgver=1.6.0
    pkgrel=1
    pkgdesc='A CLI for interacting with the Fastly platform'
    url='https://github.com/fastly/cli'
    arch=('aarch64' 'i686' 'x86_64')
    license=('Apache license 2.0')
    provides=('fastly-bin')
    conflicts=('fastly-bin')
    optdepends=('viceroy: for running service locally')
    
    source_aarch64=('https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-arm64.tar.gz')
    sha256sums_aarch64=('5a52cb727ec06c4cbcd3f73031e9f1953f6ea4d251b7bc30bcea1d7b7377008d')
    
    source_i686=('https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-386.tar.gz')
    sha256sums_i686=('2a2618a3610b01b59ba4a622ae84ce18a26726503ef8918a547b60fa7d543288')
    
    source_x86_64=('https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-amd64.tar.gz')
    sha256sums_x86_64=('5723d56ae1e82974171af547bac67fa75945dab70b08d33d4cbd63b70337e897')
    
    package() {
     install -Dm755 "./fastly" "${pkgdir}/usr/bin/fastly"
    }
    
    # cat dist/aur/fastly-bin.srcinfo
    pkgbase = fastly-bin
            pkgdesc = A CLI for interacting with the Fastly platform
            pkgver = 1.6.0
            pkgrel = 1
            url = https://github.com/fastly/cli
            license = Apache license 2.0
            optdepends = viceroy: for running service locally
            conflicts = fastly-bin
            provides = fastly-bin
            arch = aarch64
            source_aarch64 = https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-arm64.tar.gz
            sha256sums_aarch64 = 5a52cb727ec06c4cbcd3f73031e9f1953f6ea4d251b7bc30bcea1d7b7377008d
            arch = i686
            source_i686 = https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-386.tar.gz
            sha256sums_i686 = 2a2618a3610b01b59ba4a622ae84ce18a26726503ef8918a547b60fa7d543288
            arch = x86_64
            source_x86_64 = https://github.com/fastly/cli/releases/download/v1.6.0/fastly_v1.6.0_linux-amd64.tar.gz
            sha256sums_x86_64 = 5723d56ae1e82974171af547bac67fa75945dab70b08d33d4cbd63b70337e897
    
    pkgname = fastly-bin
    
  • I will use these generated files locally to try to install the fastly bin (similar to how I do it today in https://github.com/mccurdyc/cli-PKGBUILD) via makepkg

    cd dust/aur/
    makepkg -p fastly-bin.pkgbuild
    
  • I think once we agree things look good from running goreleaser manually, we will run it to upload the PKGBUILD and .SRCINFO files

@mccurdyc mccurdyc force-pushed the integralist/support-aur branch from 0fe86c2 to 7db3fef Compare February 9, 2022 11:53
@mccurdyc
Copy link
Collaborator

mccurdyc commented Feb 9, 2022

makepkg -p fastly-bin.pkgbuild
==> Making package: fastly-bin 1.6.0-1 (Wed 09 Feb 2022 08:23:41 AM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading fastly_v1.6.0_linux-amd64.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   671  100   671    0     0   3384      0 --:--:-- --:--:-- --:--:--  3388
100 5901k  100 5901k    0     0  5363k      0  0:00:01  0:00:01 --:--:-- 9894k
==> Validating source_x86_64 files with sha256sums...
    fastly_v1.6.0_linux-amd64.tar.gz ... FAILED
==> ERROR: One or more files did not pass the validity check!

Need to fix this.

Actually, I think this might be because makepkg is fetching the tar.gz from GitHub and the sha256sums_* values in the .pkgbuild file are generated locally here via goreleaser when run manually with --skip-validate.

We might have to push a *-rc tag to test this part.

Running makepkg --skipchecksums -p fastly-bin.pkgbuild just to check to see if the binary gets properly downloaded and installed.

./dist/aur/pkg/fastly-bin/usr/bin/fastly version
Fastly CLI version 1.6.0 (49d5ad0)
Built with go version go1.17.6 linux/amd64

When this is run using yay (the official AUR tool), it will install it to a location on you $PATH.

@mccurdyc mccurdyc marked this pull request as ready for review February 9, 2022 14:05
Copy link
Collaborator

@mccurdyc mccurdyc left a comment

Choose a reason for hiding this comment

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

Approving because you are the PR author. I did do another pass and things make sense.

@mccurdyc mccurdyc assigned Integralist and unassigned mccurdyc Feb 15, 2022
.goreleaser.yml Show resolved Hide resolved
.github/workflows/tag_release.yml Show resolved Hide resolved
@Integralist
Copy link
Collaborator Author

@mccurdyc

I had a question about the 1.5.0 goreleaser version having a bug fix related to AUR + a comment about provides/conflicts having the same value, but otherwise LGTM.

@mccurdyc mccurdyc force-pushed the integralist/support-aur branch from 2c1e870 to f2be81c Compare February 22, 2022 13:25
Signed-off-by: Colton J. McCurdy <mccurdyc22@gmail.com>
@Integralist Integralist merged commit c5c9fc0 into main Feb 22, 2022
@Integralist Integralist deleted the integralist/support-aur branch February 22, 2022 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants