Giter Club home page Giter Club logo

brewkit's People

Contributors

abevier avatar branchvincent avatar diegoholiveira avatar felipecrs avatar jhheider avatar jrgoodle avatar magnusviri avatar mfts avatar mxcl avatar rustdevbtw avatar tsirysndr avatar uesyn avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

brewkit's Issues

error: Uncaught (in promise) Error: pantry entry invalid. please report this bug!

I know this is the cli, but I'm posting it here because it happens a lot when running pkg and I've got a lot of wip packages. In this case, I can't even use pkg search name.

Is there a way to just warn when using pkg?

error: Uncaught (in promise) Error: pantry entry invalid. please report this bug!

    https://github.com/teaxyz/pantry/issues/new

----------------------------------------------------->> attachment begin
apache.org/apache-arrow: undefined
<<------------------------------------------------------- attachment end
        throw new TeaError('parser: pantry: package.yml', {cause, project, filename})
              ^
    at Object.yml (https://raw.githubusercontent.com/teaxyz/cli/v0.26.0/src/hooks/usePantry.ts:114:15)
    at async Object.getProvides (https://raw.githubusercontent.com/teaxyz/cli/v0.26.0/src/hooks/usePantry.ts:51:15)
    at async file:///opt/tea/tea.xyz/brewkit/v0.15.1/libexec/search.ts:19:21
Caused by: null

script array lines starting with `{` don't work with `${`

    - run: ${{prefix}}/venv/bin/pip install paramiko #FIXME should we pin a version?
/Users/jacob/tea/pantry/builds/ansible.com-2.15.1+darwin/xyz.tea.build.sh: line 44: $/Users/jacob/.tea/ansible.com/v2.15.1/venv/bin/pip: No such file or directory
    - run: {{prefix}}/venv/bin/pip install paramiko #FIXME should we pin a version?
error: Uncaught Error: pantry entry invalid. please report this bug!
...
    - run: ./bin/pip install paramiko #FIXME should we pin a version?
      working-directory: ${{prefix}}/venv

^^^^ this works fine

gitlab specific versions

it's quite simple to do with the web scraper (see: wumpus, or shared-mime-info). if we wanted to be able to wrap that complexity up for people, it'll likely look like this:

versions:
  gitlab: [server/](user/repo|id)[/(releases|tags)]

it doesn't appear that we hit any obvious limits at either of the two API endpoints i used, and they're available on custom gitlab installs.

`useGithubAPI().getVersions()` should not need auth

Motivation

According to the comments on the getVersion method:

GitHub tags API returns in reverse alphabetical order so we have to use their graphql endpoint, [which] sadly requires auth :/

Why don't we just use the GitHub tags API and sort the tags according to semver? This should work for a majority of cases, and we can always be more clever if we need to.

I've written of proof of concept. It looks super ugly but it seems to work okay for the repos I have tested
async function getVersions(user, repo) {
  const url = `https://api.github.com/repos/${user}/${repo}/git/refs/tags`

  const req = await fetch(url)
  const res = await req.json()
  let tags = res.map((tag)=>tag.ref.slice(10)) // map object to just tag name

  const regex = /\d+.\d+.\d+/gm // extract semver (x.x.x) from tag name
  tags = tags.sort((a, b) => {
    a = a.match(regex)
    b = b.match(regex)

    // all invalid semver gets sorted at the start, is this a good idea? idk
    if(a === null) return -1;
    if(b === null) return 1;

    a = a[0].split(".").map((str)=>parseInt(str))
    b = b[0].split(".").map((str)=>parseInt(str))

    if(a[0] !== b[0]) return a[0] - b[0]
    if(a[1] !== b[1]) return a[1] - b[1]
    if(a[2] !== b[2]) return a[2] - b[2]

    return 0
  })

  return tags
}

This also has the added advantage (in my opinion) of actually sorting by semver. If I understand the current code setup correctly, this is not being done. This means that on the golang repo in the current implementation, the versions would look like:

[
    // ...earlier versions
    "go1.18.6", "go1.19.1", "go.1.18.7", "go1.19.2", "go.1.18.8", "go1.19.3"
]

which in my opinion is very unintuitive.

If there is no interest, feel free to close.

Tests

On this repo, it returns this which looks perfect
[
  "v0.1.0",   "v0.1.1",   "v0.1.2",   "v0.2.0",   "v0.3.0",   "v0.3.1",
  "v0.3.2",   "v0.3.3",   "v0.3.4",   "v0.3.5",   "v0.3.6",   "v0.3.7",
  "v0.3.8",   "v0.3.9",   "v0.4.0",   "v0.4.1",   "v0.4.2",   "v0.4.3",
  "v0.5.0",   "v0.5.1",   "v0.5.2",   "v0.5.3",   "v0.5.4",   "v0.5.5",
  "v0.5.6",   "v0.6.0",   "v0.6.1",   "v0.6.2",   "v0.6.3",   "v0.6.4",
  "v0.6.5",   "v0.6.6",   "v0.6.7",   "v0.6.8",   "v0.6.9",   "v0.6.10",
  "v0.7.0",   "v0.7.1",   "v0.8.0",   "v0.8.1",   "v0.8.2",   "v0.8.3",
  "v0.8.4",   "v0.8.5",   "v0.8.6",   "v0.8.7",   "v0.8.8",   "v0.8.9",
  "v0.8.10",  "v0.8.11",  "v0.8.12",  "v0.9.0",   "v0.9.1",   "v0.9.2",
  "v0.10.0",  "v0.10.1",  "v0.10.2",  "v0.10.3",  "v0.10.4",  "v0.10.5",
  "v0.10.6",  "v0.10.7",  "v0.10.8",  "v0.11.0",  "v0.11.1",  "v0.11.2",
  "v0.11.3",  "v0.11.4",  "v0.11.5",  "v0.11.6",  "v0.11.8",  "v0.11.9",
  "v0.11.10", "v0.11.11", "v0.11.13", "v0.11.14", "v0.12.0",  "v0.12.1",
  "v0.13.0",  "v0.13.1",  "v0.13.2",  "v0.13.3",  "v0.13.4",  "v0.13.5",
  "v0.13.6",  "v0.13.7",  "v0.13.8",  "v0.13.9",  "v0.13.10", "v0.13.11",
  "v0.14.0",  "v0.14.1",  "v0.14.2",  "v0.14.3",  "v0.14.4",  "v0.14.5"
]
On the golang repo, which is just super problematic, it looks like this (which is okay, we could probably do some smarter parsing):
[
	// unparsed, put at start
	"weekly.2012-03-27","weekly.2012-03-22","weekly.2012-03-13","weekly.2012-03-04","weekly.2012-02-22","weekly.2012-02-14",
	"weekly.2012-02-07","weekly.2012-01-27","weekly.2012-01-20","weekly.2012-01-15","weekly.2011-12-22","weekly.2011-12-14",
	"weekly.2011-12-06","weekly.2011-12-02","weekly.2011-12-01","weekly.2011-11-18","weekly.2011-11-09","weekly.2011-11-08",
	"weekly.2011-11-02","weekly.2011-11-01","weekly.2011-10-26","weekly.2011-10-25","weekly.2011-10-18","weekly.2011-10-06",
	"weekly.2011-09-21","weekly.2011-09-16","weekly.2011-09-07","weekly.2011-09-01","weekly.2011-08-17","weekly.2011-08-10",
	"weekly.2011-07-29","weekly.2011-07-19","weekly.2011-07-07","weekly.2011-06-23","weekly.2011-06-16","weekly.2011-06-09",
	"weekly.2011-06-02","weekly.2011-05-22","weekly.2011-04-27","weekly.2011-04-13","weekly.2011-04-04","weekly.2011-03-28",
	"weekly.2011-03-15","weekly.2011-03-07.1","weekly.2011-03-07","weekly.2011-02-24","weekly.2011-02-15","weekly.2011-02-01.1",
	"weekly.2011-02-01","weekly.2011-01-20","weekly.2011-01-19","weekly.2011-01-12","weekly.2011-01-06","weekly.2010-12-22",
	"weekly.2010-12-15.1","weekly.2010-12-15","weekly.2010-12-08","weekly.2010-12-02","weekly.2010-11-23","weekly.2010-11-10",
	"weekly.2010-11-02","weekly.2010-10-27","weekly.2010-10-20","weekly.2010-10-13.1","weekly.2010-10-13","weekly.2010-09-29",
	"weekly.2010-09-22","weekly.2010-09-15","weekly.2010-09-06","weekly.2010-08-25","weekly.2010-08-11","weekly.2010-08-04",
	"weekly.2010-07-29","weekly.2010-07-14","weekly.2010-07-01","weekly.2010-06-21","weekly.2010-06-09","weekly.2010-05-27",
	"weekly.2010-05-04","weekly.2010-04-27","weekly.2010-04-13","weekly.2010-03-30","weekly.2010-03-22","weekly.2010-03-15",
	"weekly.2010-03-04","weekly.2010-02-23","weekly.2010-02-17","weekly.2010-02-04","weekly.2010-01-27","weekly.2010-01-13",
	"weekly.2010-01-05","weekly.2009-12-22","weekly.2009-12-09","weekly.2009-12-07","weekly.2009-11-17","weekly.2009-11-12",
	"weekly.2009-11-10.1","weekly.2009-11-10","weekly.2009-11-06","weekly","release.r60.3","release.r60.2",
	"release.r60.1","release.r60","release.r59","release.r58.2","release.r58.1","release.r58",
	"release.r57.2","release.r57.1","release.r57","release.r56","go1.19","go1.19rc2",
	"go1.19rc1","go1.19beta1","go1.18","go1.18rc1","go1.18beta2","go1.18beta1",
	"go1.17","go1.17rc2","go1.17rc1","go1.17beta1","go1.16","go1.16rc1",
	"go1.16beta1","go1.15","go1.15rc2","go1.15rc1","go1.15beta1","go1.14",
	"go1.14rc1","go1.14beta1","go1.13","go1.13rc2","go1.13rc1","go1.13beta1",
	"go1.12","go1.12rc1","go1.12beta2","go1.12beta1","go1.11","go1.11rc2",
	"go1.11rc1","go1.11beta3","go1.11beta2","go1.11beta1","go1.10","go1.10rc2",
	"go1.10rc1","go1.10beta2","go1.10beta1","go1.9","go1.9rc2","go1.9rc1",
	"go1.9beta2","go1.9beta1","go1.8","go1.8rc3","go1.8rc2","go1.8rc1",
	"go1.8beta2","go1.8beta1","go1.7","go1.7rc6","go1.7rc5","go1.7rc4",
	"go1.7rc3","go1.7rc2","go1.7rc1","go1.7beta2","go1.7beta1","go1.6",
	"go1.6rc2","go1.6rc1","go1.6beta2","go1.6beta1","go1.5","go1.5rc1",
	"go1.5beta3","go1.5beta2","go1.5beta1","go1.4","go1.4rc2","go1.4rc1",
	"go1.4beta1","go1.3","go1.3rc2","go1.3rc1","go1.3beta2","go1.3beta1",
	"go1.2","go1.2rc5","go1.2rc4","go1.2rc3","go1.2rc2","go1.1",
	"go1.1rc3","go1.1rc2","go1",
  
	// parsed, sorted at end
	"go1.0.1","go1.0.2","go1.0.3",
	"go1.1.1","go1.1.2","go1.2.1","go1.2.2","go1.3.1","go1.3.2",
	"go1.3.3","go1.4.1","go1.4.2","go1.4.3","go1.5.1","go1.5.2",
	"go1.5.3","go1.5.4","go1.6.1","go1.6.2","go1.6.3","go1.6.4",
	"go1.7.1","go1.7.2","go1.7.3","go1.7.4","go1.7.5","go1.7.6",
	"go1.8.1","go1.8.2","go1.8.3","go1.8.4","go1.8.5rc4","go1.8.5rc5",
	"go1.8.5","go1.8.6","go1.8.7","go1.9.1","go1.9.2","go1.9.3",
	"go1.9.4","go1.9.5","go1.9.6","go1.9.7","go1.10.1","go1.10.2",
	"go1.10.3","go1.10.4","go1.10.5","go1.10.6","go1.10.7","go1.10.8",
	"go1.11.1","go1.11.2","go1.11.3","go1.11.4","go1.11.5","go1.11.6",
	"go1.11.7","go1.11.8","go1.11.9","go1.11.10","go1.11.11","go1.11.12",
	"go1.11.13","go1.12.1","go1.12.2","go1.12.3","go1.12.4","go1.12.5",
	"go1.12.6","go1.12.7","go1.12.8","go1.12.9","go1.12.10","go1.12.11",
	"go1.12.12","go1.12.13","go1.12.14","go1.12.15","go1.12.16","go1.12.17",
	"go1.13.1","go1.13.2","go1.13.3","go1.13.4","go1.13.5","go1.13.6",
	"go1.13.7","go1.13.8","go1.13.9","go1.13.10","go1.13.11","go1.13.12",
	"go1.13.13","go1.13.14","go1.13.15","go1.14.1","go1.14.2","go1.14.3",
	"go1.14.4","go1.14.5","go1.14.6","go1.14.7","go1.14.8","go1.14.9",
	"go1.14.10","go1.14.11","go1.14.12","go1.14.13","go1.14.14","go1.14.15",
	"go1.15.1","go1.15.2","go1.15.3","go1.15.4","go1.15.5","go1.15.6",
	"go1.15.7","go1.15.8","go1.15.9","go1.15.10","go1.15.11","go1.15.12",
	"go1.15.13","go1.15.14","go1.15.15","go1.16.1","go1.16.2","go1.16.3",
	"go1.16.4","go1.16.5","go1.16.6","go1.16.7","go1.16.8","go1.16.9",
	"go1.16.10","go1.16.11","go1.16.12","go1.16.13","go1.16.14","go1.16.15",
	"go1.17.1","go1.17.2","go1.17.3","go1.17.4","go1.17.5","go1.17.6",
	"go1.17.7","go1.17.8","go1.17.9","go1.17.10","go1.17.11","go1.17.12",
	"go1.17.13","go1.18.1","go1.18.2","go1.18.3","go1.18.4","go1.18.5",
	"go1.18.6","go1.18.7","go1.18.8","go1.19.1","go1.19.2","go1.19.3",
]

idea: run pkg build locally if dependencies exists locally but not in pantry

I am packaging leptonica.org and it has several dependencies that I have previously built and PR'd but are not yet merged and therefore not available in pantry.

I have them in my tea.out locally tho and it would be great if pkg build system could use these if pantry cannot find them.

 $ pkg build leptonica.org
error: Uncaught (in promise) Error: Not in pantry: github.com/uclouvain/openjpeg
$ ls tea.out/github.com
uclovain

Failure to resolve cellar packages

This regression was introduced in 0.5.1 and mainly affects pkg test. The cellar dependency is not resolved correctly and the following error occurs:

error: Uncaught (in promise) Error: invalid pkgspec: 
  if (!match) throw new Error(`invalid pkgspec: ${input}`)

find: bin: No such file or directory

If i run pkg I get this error.

available commands:

find: bin: No such file or directory

I'm looking at the code for pkg and I don't see it cd, so it's running find bin -type f | sed -ne 's/^pkg-/pkg /p' in my pwd. I think my build environment is messed up. Maybe that's the problem?

distributable.git performs no caching

It doesn't check to see if local cache or dist.tea.xyz has a src tar.xz already. It should at least do the former, and possibly the latter.

See fetch.ts:L118.

developer environment not found when running `pkg search node`

I'm not 100% clear on what pkg search does exactly. I thought perhaps it's finding all available tea packages with that binary name; in my case node.

$ tea +tea.xyz/brewkit pkg search node
error: not-found: dev-env (spilt-tea-006)
`/Users/mfts/dev` is not a developer environment.

a developer environment requires the presence of a file or directory
that uniquely identifies package requirements, eg. `package.json`.

I ran the same command in /Users/mfts/dev/tea/pantry.extra and there it works as expected.

$ tea +tea.xyz/brewkit pkg search node
nodejs.org: node: 19.7.0
nodejs.org: node: 19.7.0

Change location of docker mountpoint?

I decided to start over with my tea install and I decided to look at my old tea folder for interesting info, like to see why it was almost 29 GB large.

The folder that popped up to the top was tea.xyz/brewkit/mnt at 7GB. Maybe this can be moved somewhere else because I would never have thought that I needed to go in there to clean it up.

Allow git clone instead of tarball

I'm working on micro-editor.github.io and this is the output when I build.

> ./pantry.core/scripts/build.ts micro-editor.github.io
{ ignoring: "1.0rc1", reason: "unparsable" }
{ ignoring: "v1.0rc2", reason: "unparsable" }
{ ignoring: "v2.0.0-rc1", reason: "unparsable" }
{ ignoring: "v2.0.0-rc2", reason: "unparsable" }
{ ignoring: "v2.0.0-rc3", reason: "unparsable" }
{ ignoring: "nightly", reason: "unparsable" }
fetching [email protected]
{ ignoring: "1.0rc1", reason: "unparsable" }
{ ignoring: "v1.0rc2", reason: "unparsable" }
{ ignoring: "v2.0.0-rc1", reason: "unparsable" }
{ ignoring: "v2.0.0-rc2", reason: "unparsable" }
{ ignoring: "v2.0.0-rc3", reason: "unparsable" }
{ ignoring: "nightly", reason: "unparsable" }
querying
cache: hit
+ cd /opt/tea/micro-editor.github.io/src/v2.0.11
+ export SRCROOT=/opt/tea/micro-editor.github.io/src/v2.0.11
+ SRCROOT=/opt/tea/micro-editor.github.io/src/v2.0.11
+ export PATH=/opt/tea/tea.xyz/gx/cc/v0.1.1/bin:/opt/tea/openssl.org/v1.1.118/bin:/opt/tea/go.dev/v1.19.2/bin:/Users/james/.tea_bin:/usr/bin:/bin:/usr/sbin:/sbin
+ PATH=/opt/tea/tea.xyz/gx/cc/v0.1.1/bin:/opt/tea/openssl.org/v1.1.118/bin:/opt/tea/go.dev/v1.19.2/bin:/Users/james/.tea_bin:/usr/bin:/bin:/usr/sbin:/sbin
+ export PKG_CONFIG_PATH=/opt/tea/openssl.org/v1.1.118/lib/pkgconfig
+ PKG_CONFIG_PATH=/opt/tea/openssl.org/v1.1.118/lib/pkgconfig
+ export LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ export LD_LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ LD_LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ export CPATH=/opt/tea/openssl.org/v1.1.118/include
+ CPATH=/opt/tea/openssl.org/v1.1.118/include
+ export DYLD_FALLBACK_LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ DYLD_FALLBACK_LIBRARY_PATH=/opt/tea/openssl.org/v1.1.118/lib:/opt/tea/go.dev/v1.19.2/lib
+ export SSL_CERT_FILE=/opt/tea/openssl.org/v1.1.118/ssl/cert.pem
+ SSL_CERT_FILE=/opt/tea/openssl.org/v1.1.118/ssl/cert.pem
+ export LDFLAGS=-Wl,-rpath,/opt/tea
+ LDFLAGS=-Wl,-rpath,/opt/tea
+ export TEA_PREFIX=/opt/tea
+ TEA_PREFIX=/opt/tea
+ export MACOSX_DEPLOYMENT_TARGET=11.0
+ MACOSX_DEPLOYMENT_TARGET=11.0
+ export PATH=/Users/james/Tea/pantry.core/scripts/brewkit:/opt/tea/tea.xyz/gx/cc/v0.1.1/bin:/opt/tea/openssl.org/v1.1.118/bin:/opt/tea/go.dev/v1.19.2/bin:/Users/james/.tea_bin:/usr/bin:/bin:/usr/sbin:/sbin
+ PATH=/Users/james/Tea/pantry.core/scripts/brewkit:/opt/tea/tea.xyz/gx/cc/v0.1.1/bin:/opt/tea/openssl.org/v1.1.118/bin:/opt/tea/go.dev/v1.19.2/bin:/Users/james/.tea_bin:/usr/bin:/bin:/usr/sbin:/sbin
+ make build-tags
git fetch --tags
fatal: not a git repository (or any of the parent directories): .git
make: *** [fetch-tags] Error 128
error: Uncaught Error: cmd failed: 2: /opt/tea/micro-editor.github.io/src/build.sh
    if (!exit.success) throw new RunError(exit.code, cmd)
                             ^
    at run (file:///Users/james/Tea/pantry.core/src/utils/index.ts:234:30)
    at async build (file:///Users/james/Tea/pantry.core/scripts/build/build.ts:113:5)
    at async __build (file:///Users/james/Tea/pantry.core/scripts/build/build.ts:34:24)
    at async _build (file:///Users/james/Tea/pantry.core/scripts/build/build.ts:21:12)
    at async file:///Users/james/Tea/pantry.core/scripts/build.ts:43:3

The build script for micro requires the download to be a git repo. Is there a way to do a git clone instead of downloading a tarball?

idea: things to do if a version isn't found

  • run pkg inv ${pkg}
  • run gum confirm 'Would you like to open an issue to build ${pkg}${versionspec}?' && gh create issue -R teaxyz/pantry -t "${pkg}${versionspec}" -b "Please build ${pkg}${versionspec}!" -l "version-request"

pkg interactive build and test environments

I've been working on micro and on Linux it gets a segfault. I've been debugging it. I had to reverse engineer how the docker build environment is setup. By doing this I was able to make some headway, but I'm not exactly sure what I figured out. It might be a different bug.

Anyway, can you make it easier to get an interactive terminal to the build and test environments? Here's how I did it.

  • I had to run ps awwx so I could get the docker command.
  • I added "-it" to the docker command.
  • I substituted bash instead of the tea command.
  • I ran the new docker command
  • I commented out the "set ..." commands that forced an exit on error in xyz.tea.build.sh and xyz.tea.test.sh.
  • I ran the build and test scripts like this . /pantry/builds/micro-editor.github.io-2.0.11+linux/xyz.tea.build.sh

Doing this I was able to figure out that micro is actually working. So I'm not sure why the test is segfaulting. I think there's something in the test environment that is causing it to fail. I'm going to work on that next I think. If I figure it out I'll post another issue with the details.

Here's the docker command.

docker run -it --name tea --rm \
  --volume /opt/tea/tea.xyz/brewkit/mnt:/root \
  --volume /opt/tea/tea.xyz/var/www:/root/.tea/tea.xyz/var/www \
  --volume /root/.tea/tea.xyz/var/pantry \
  --volume /root/.tea/tea.xyz/var/pantries \
  --volume /opt/tea/tea.xyz/brewkit/v0.12.2:/opt/tea/tea.xyz/brewkit/v0.12.2 \
  --env GITHUB_TOKEN=ghp_secret \
  --env CLICOLOR_FORCE=1 \
  --volume /Users/james/pantry_mag:/pantry \
  --env TEA_PANTRY_PATH=/pantry \
  --env SRCROOT=/pantry teaxyz/cli bash

GITHUB_TOKEN required?

If I try to pkg build without GITHUB_TOKEN set then I get this message:

tea: installed: ~/Tea/pantry.extra/tea.out/cli.github.com/v2.24.0
no oauth token

If I set the GITHUB_TOKEN I get this error:

{
  rsp: Response {
  body: ReadableStream { locked: true },
  bodyUsed: true,
  headers: Headers {
  "access-control-allow-origin": "*",
  "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLim...",
  "content-length": "83",
  "content-security-policy": "default-src 'none'",
  "content-type": "application/json; charset=utf-8",
  date: "Wed, 08 Mar 2023 18:52:38 GMT",
  "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
  server: "GitHub.com",
  "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
  vary: "Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-media-type": "github.v4; format=json",
  "x-github-request-id": "CCDC:3C37:3C3AEE7:7B87119:6408D976",
  "x-ratelimit-limit": "0",
  "x-ratelimit-remaining": "0",
  "x-ratelimit-reset": "1678305158",
  "x-ratelimit-resource": "graphql",
  "x-ratelimit-used": "0",
  "x-xss-protection": "0"
},
  ok: false,
  redirected: false,
  status: 401,
  statusText: "Unauthorized",
  url: "https://api.github.com/graphql"
},
  json: {
    message: "Bad credentials",
    documentation_url: "https://docs.github.com/graphql"
  }
}
error: Uncaught (in promise) Error
        throw new Error()
              ^
    at Object.getVersions (https://raw.githubusercontent.com/teaxyz/cli/v0.24.7/src/hooks/useGitHubAPI.ts:78:15)
    at async handleComplexVersions (https://raw.githubusercontent.com/teaxyz/cli/v0.24.7/src/hooks/usePantry.ts:339:20)
    at async Object.resolve (https://raw.githubusercontent.com/teaxyz/cli/v0.24.7/src/hooks/usePantry.ts:42:20)
    at async file:///opt/tea/tea.xyz/brewkit/v0.6.0/libexec/resolve.ts:23:15

This is the package yml file I'm trying to build (I haven't gotten very far yet).

distributable:
  url: https://github.com/apple-oss-distributions/libtelnet/archive/refs/tags/libtelnet-{{ version }}.tar.gz
  strip-components: 1

versions:
  github: user/repo/tags
  strip: /^libtelnet-/

build:
  dependencies:
    tea.xyz/gx/cc: c99
    tea.xyz/gx/make: '*'
  script: |
    echo hi

.cmake files need more touchups

See facebook.com/folly:

tea $ rg double-conv ~/.tea/facebook.com/folly/v2023/lib/cmake/folly 
/root/.tea/facebook.com/folly/v2023/lib/cmake/folly/folly-targets.cmake
70:  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../../../boost.org/v1.82.0/include;${_IMPORT_PREFIX}/../../../google.com/double-conversion/v3.3.0/include;${_IMPORT_PREFIX}/../../../gflags.github.io/v2.2.2/include;${_IMPORT_PREFIX}/../../../google.com/glog/v0.6.0/include;${_IMPORT_PREFIX}/../../../libevent.org/v2.1.12/include;${_IMPORT_PREFIX}/../../../zlib.net/v1.2.13/include;${_IMPORT_PREFIX}/../../../openssl.org/v1.1.1t/include;${_IMPORT_PREFIX}/../../../sourceware.org/bzip2/v1.0.8/include;${_IMPORT_PREFIX}/../../../lz4.org/v1.9.4/include;${_IMPORT_PREFIX}/../../../facebook.com/zstd/v1.5.5/include;${_IMPORT_PREFIX}/../../../google.github.io/snappy/v1.1.10/include;${_IMPORT_PREFIX}/include"
71:  INTERFACE_LINK_LIBRARIES "fmt::fmt;Threads::Threads;Boost::context;Boost::filesystem;Boost::program_options;Boost::regex;Boost::system;Boost::thread;${_IMPORT_PREFIX}/../../../google.com/double-conversion/v3.3.0/lib/libdouble-conversion.so;gflags_shared;${_IMPORT_PREFIX}/../../../google.com/glog/v0.6.0/lib/libglog.so;${_IMPORT_PREFIX}/../../../libevent.org/v2.1.12/lib/libevent.so;${_IMPORT_PREFIX}/../../../zlib.net/v1.2.13/lib/libz.so;${_IMPORT_PREFIX}/../../../openssl.org/v1.1.1t/lib/libssl.so;${_IMPORT_PREFIX}/../../../openssl.org/v1.1.1t/lib/libcrypto.so;${_IMPORT_PREFIX}/../../../sourceware.org/bzip2/v1.0.8/lib/libbz2.so;${_IMPORT_PREFIX}/../../../lz4.org/v1.9.4/lib/liblz4.so;${_IMPORT_PREFIX}/../../../facebook.com/zstd/v1.5.5/lib/libzstd.so;${_IMPORT_PREFIX}/../../../google.github.io/snappy/v1.1.10/lib/libsnappy.so;dl;atomic;stdc++fs"

Our fixup.ts should do the same thing fix-machos/fix-elf do in terms of locating our software and shortening it to use v{{version.major}} to prevent hard-locking version dependencies. So far, this has only bitten us in facebook code.

can't bottle a package with non-SemVer versioning

This issue is a continuation of this discussion on discord

I'm trying to package mamba in 388, and it has weird version formatting i.e. 22.11.1-4

See releases here

Since tea currently forces SemVer formatting, this results in an error Uncaught (in promise) Error: invalid version: 22.11.1-4

Some examples of mamba versions here:

  • 22.11.1-4
  • 22.11.1-3
  • 22.11.1-2
  • 22.11.1-1
  • 22.11.1-0
  • 22.9.0-3
  • 22.9.0-2
  • 22.9.0-1
  • `22.9.0-0'

So it uses a semver plus a suffix

I wonder what's the solution here?

`pkg search` prints packages twice

$ tea +tea.xyz/brewkit pkg search xz  
tukaani.org/xz: xz, xzcat, xzcmp, xzdec, xzdiff, xzegrep, xzfgrep, xzgrep, xzless, xzmore: 5.2.7
tukaani.org/xz: xz, xzcat, xzcmp, xzdec, xzdiff, xzegrep, xzfgrep, xzgrep, xzless, xzmore: 5.2.7

Make `actions/bottle` take target platform+arch

Instead of bottle relying on the platform/arch of the runner it's on (not necessary, but of historical design), make it take the pair as an input so we can use freely-available ubuntu-latest runners for the bottle step, instead of queueing for our more limited custom runners.

idea: {{deps.foo.bar.prefix.relative}}

Satisfies a very weird problem set. @ABevier is packaging podman.io, which has oddly strict requirements for where to find things:

Error: unable to start host networking: "could not find \"gvproxy\" in one of [/usr/local/opt/podman/libexec /opt/homebrew/bin /opt/homebrew/opt/podman/libexec /usr/local/bin /usr/local/libexec/podman /usr/local/lib/podman /usr/libexec/podman /usr/lib/podman $BINDIR/../libexec/podman].  To resolve this error, set the helper_binaries_dir key in the `[engine]` section of containers.conf to the directory containing your helper binaries."

Since {{prefix}}/libexec is one of the options, one of my pitches to him is:

dependencies:
  foo.bar: ^8
build:
  script:
    - run: ln -s "../../../foo.bar/v8/bin/foobar" foobar
      working-directory: ${{prefix}}/libexec

Assuming {{prefix}} == $(tea --prefix)/podman.io/v$x, I'd expect {{deps.foo.bar.prefix.relative}} == ../../foo.bar/v$y. This is tighter coupling than I'd like, so we should (probably) discourage its usage, but it would solve issues like the above without having to alter the source code of podman. Which is the other option.

working-directory in build scripts doesn't like moustaches

    - run: |
        mv aws/* .
        rmdir aws
        ln -s . aws
      working-directory: "{{prefix}}/include"

produces:

mv aws/* .
rmdir aws
ln -s . aws

instead of:

OLDWD="$PWD"
mkdir -p "/Users/jacob/.tea/foo.bar/v1.2.3/include"
cd "/Users/jacob/.tea/foo.bar/v1.2.3/include"
mv aws/* .
rmdir aws
ln -s . aws
cd "$OLDWD"
unset OLDWD

feature: minimal match sets to `pkg` commands

support the following aliases:

build: b, bu
clean: c, cl
docker: d, do, dock
edit: e, ed
fetch: fe, fet
fixup: fi, fix
init: ini
inventory: inv
query: q, qu
search: se
status: st, sta
test: t, te

this mostly occurred to me because typing inventory is a pain.

useGitHubAPI might be too completionist

% time ./libexec/resolve.ts vim.org=9.0.1504
vim.org=9.0.1504
./libexec/resolve.ts vim.org=9.0.1504  0.53s user 0.13s system 0% cpu 1:18.21 total

78 seconds

https://github.com/teaxyz/pantry/actions/runs/4855206471/jobs/8654151355

Fails in GHA

https://github.com/vim/vim

16k tags

Perhaps we should pick a cap that will resolve in a reasonable amount of time? Since we're doing 100 tags per graphql query, this suggests vim is triggering 161 queries, or 2/s for 78s. Lets assume we only need the last 1000 (5s), maybe?

`fetch.ts` should display original download error if mirror returns a 404

When developing a local package.yml, if the initial download fails, the current behaviour (https://github.com/teaxyz/brewkit/blob/main/libexec/fetch.ts#L63) is to swallow the original location error and fallback to the mirror (which always errors with a confusing 404 error for local-only packages):

    try {
      // first try the original location
      return await download({ dst, src: url })
    } catch {
      // then try our mirror
      const src = useOffLicense('s3').url(stowage)
      return await download({ dst, src })
    }

It would be better to throw the original error message if the mirror returns a 404 (meaning it was a local pantry package)

Context

I was trying to build local pantry packages, but when I added a GITHUB_TOKEN environment variable, it broke pkg build with the following error:

  building stripe.com/stripe

  fetching /Users/leondreamed/.tea/tea.xyz/var/www/stripe.com∕stripe-1.13.12.tar.gz
downloading
downloading
404: https://dist.tea.xyz/stripe.com/stripe/v1.13.12.tar.gz
tea expands the full semantic version, which may mean the URL you are
fetching is now incorrect. Try `version.raw`?

To me, this error didn't make any sense (why would adding a GITHUB_TOKEN env variable cause it to fetch the package from dist.tea.xyz?), and I eventually traced it to the above section of code in brewkit/libexec/fetch.ts. Since the original download error is swallowed due to the mirror fallback, it's much harder for me to debug my issue of GITHUB_TOKEN causing the download to fail.

Update: turns out the issue was not checking the public_repo permission in my PAT

fixup.ts needs to do more work on .cmake files

Of interest is their encoding full versions for deps:

CMake Error in CMakeLists.txt:
  Imported target "sodium" includes non-existent path

    "/Users/jacob/.tea/libsodium.org/v1.0.18/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

fixup.ts should truncate those to e.g. v1 for proper compatibility.

level 1 folders gets removed in the SRCROOT directory

brewkit version 0.2.7
tea version 0.24.3

Assuming there is a v0.0.4.tar.gz file with the ff content:

build/index.html
build/styles/style.css
src/app.ts
deno.lock
deno.jsonc
import-map.json

when inside the pantry repo executing tea -SE pkg build,
after downloading the tgz package the extracted SRCROOT dir ie src-v0.0.4 has the ff content:

index.html
styles/style.css
app.ts

Uncaught (in promise) Error: 404: https://dist.tea.xyz/abseil.io/darwin/aarch64/versions.txt

This error makes no sense to me. My package.yml is far from done, so I'm not surprised I have an error. But afaik, there is no https://dist.tea.xyz/abseil.io, so I can't fathom why it's querying that url.

error: Uncaught (in promise) Error: 404: https://dist.tea.xyz/abseil.io/darwin/aarch64/versions.txt
    throw new TeaError('http', {cause})
          ^
    at get (https://raw.githubusercontent.com/teaxyz/cli/v0.25/src/hooks/useInventory.ts:37:11)
    at async select (https://raw.githubusercontent.com/teaxyz/cli/v0.25/src/hooks/useInventory.ts:16:20)
    at async file:///opt/tea/tea.xyz/brewkit/v0.11.4/libexec/install.ts:16:21
Caused by: Error: 404: https://dist.tea.xyz/abseil.io/darwin/aarch64/versions.txt
    at get (https://raw.githubusercontent.com/teaxyz/cli/v0.25/src/hooks/useInventory.ts:36:19)
    at async select (https://raw.githubusercontent.com/teaxyz/cli/v0.25/src/hooks/useInventory.ts:16:20)
    at async file:///opt/tea/tea.xyz/brewkit/v0.11.4/libexec/install.ts:16:21

Cannot download tar file for some github packages

While attempting to package gvisor-tap-vsock I encountered the following:

pkg build
  
  building github.com/containers/gvisor-tap-vsock
  
  fetching /Users/alanbevier/tea/pantry/srcs/github.com∕containers∕gvisor-tap-vsock-0.6.1.tar.gz
mirror: 404: https://dist.tea.xyz/github.com/containers/gvisor-tap-vsock/v0.6.1.tar.gz
404: https://github.com/containers/gvisor-tap-vsock/archive/refs/tags/v0.6.1.tar.gz
tea expands the full semantic version, which may mean the URL you are
fetching is now incorrect. Try `version.raw`?

Using curl or copying and pasting the url into browser downloaded the file correctly. This doesn't happen for all packages with code on github.

I was able to work around this issue by setting GITHUB_ACTIONS=1 which fails over to using curl to download.

Add support for cloning source using git

Currently Brewkit is only pulling tar'd archives from Github, however this results in a source structure where the .git folder is absent. As some projects may use the git metadata during the build process it would be nice if there were the option to clone source from Github based on a tag.

package.yml, versions, strip problem

OpenJDK releases have components that need to be stripped from the beginning and end of the string. This is the download url.

https://github.com/openjdk/jdk{{ version.major }}u/archive/refs/tags/jdk-{{ version.raw }}-ga.tar.gz

AFAIK, regex doesn't allow you to match the start and end but ignore the middle. This could be solved by using a match w/ parenthesis, like this.

   strip: /^jdk-(.*)-ga/

multiple builds: order not preserved in output values

See: https://github.com/teaxyz/pantry.core/actions/runs/4188188849/jobs/7259979438

Run upload.ts --pkgs unicode.org=71.1.0 cairographics.org=1.16.0 freetype.org=2.12.1 gnome.org/gobject-introspection=1.72.0 unicode.org=71.1.0 cairographics.org=1.16.0 freetype.org=2.12.1 gnome.org/gobject-introspection=1.72.0 --srcs tea.xyz/var/www/gnome.org∕gobject-introspection-1.72.0.tar.xz tea.xyz/var/www/freetype.org-2.12.1.tar.xz tea.xyz/var/www/cairographics.org-1.16.0.tar.xz tea.xyz/var/www/unicode.org-71.1.0.tgz tea.xyz/var/www/gnome.org∕gobject-introspection-1.72.0.tar.xz tea.xyz/var/www/freetype.org-2.12.1.tar.xz tea.xyz/var/www/cairographics.org-1.16.0.tar.xz tea.xyz/var/www/unicode.org-71.1.0.tgz --bottles $bottles --checksums $checksums --signatures $signatures

pkgs: unicode, cairo, freetype, etc
srcs: gobj-intr, freetype, cairo, unicode, etc

This has caused our stored sources to be for the wrong packages. Big bug. I'll clear out these 4 and stop building multiple packages at once until we fix this.

Feature Request: Include a .tea-meta file with installed packages

When tea installs a package it would be nice if it included some sort of metadata dotfile in the install dir, perhaps called .tea-meta. This could be useful for a few reasons:

  • when programmatically walking the tea install dir it becomes much easier to identify an installed package by the presence of this file
  • If the meta data file includes the a checksum of the installed package it can be used to determine if a package was yanked or rebuilt
  • Additional info from the pantry (display-name, dependencies, entry-point, etc) could be included in the meta file to prevent the need for additional pantry lookups.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.