Skip to content

Instantly share code, notes, and snippets.

@noraj
Last active April 7, 2024 16:08
Show Gist options
  • Save noraj/5045be32490f1161161e16fc5820066c to your computer and use it in GitHub Desktop.
Save noraj/5045be32490f1161161e16fc5820066c to your computer and use it in GitHub Desktop.
BlackArch dev tips

Lexicon

  • BA: BlackArch
  • AL: ArchLinux
  • SO: StackOverflow

PKGBUILD

See PKGBUILD(5) § USING VCS SOURCES and VCS package guidelines#VCS sources for details on VCS specific options, such as targeting a specific Git branch or commit.

Updating

To update pkgver automatically when there is a pkgver():

makepkg -o

pkgver() for non-VCS

Github release

curl -s "https://api.github.com/repos/<noraj>/<haiti>/releases/latest" | jq -r '.tag_name'

Ruby gem

gem list '^haiti-hash$' -r | grep -Po '\((.+)\)' | tr -d '()'
# or better
curl -s https://rubygems.org/api/v1/gems/<haiti-hash>.json | jq -r '.version'

Git

Remove ALL local branches that are not on remote (see on SO)

git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D

Remove untracked files and git ignored files (dry run)

git clean -xn

Remove untracked files and git ignored files (force)

git clean -xf

Checking out pull requests locally

$ git fetch origin pull/ID/head:BRANCH_NAME
$ git checkout BRANCH_NAME

Remove all branches named pr-*

git branch | awk '{print $1}' | grep -P '^pr-\d+' | xargs git branch -D

git rebase --onto

https://womanonrails.com/git-rebase-onto

BA

List categories

$ pacman -Sg | grep blackarch
$ curl https://raw.githubusercontent.com/BlackArch/blackarch/master/lists/groups

Testing

Install pacman-contrib to get updpkgsums.

  • blackarch-devtools: https://github.com/Edu4rdSHL/blackarch-devtools
    • Update env: ba-dev -u
    • Build ba dev -b
    • Install and test: ba-dev -e 'cmd' -p package.tar.zst
    • Build package requiring files that aren't available in repos: ba-dev -I ../dep/package.pkg.tar.zst

Misc

Python packaging

Removing useless dependencies

cf. https://github.com/BlackArch/blackarch/pulls?q=is%3Apr+%22remove+useless+dependencies%22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment