<commit_before># cabal2pkgbuild

`cabal2pkgbuild` is a script used to generate proper PKGBUILD files from any `.cabal` file from Hackage, with the help of `cblrepo` (which is currently used to maintain Haskell packages on Arch Linux).
This version uses aria2 to download and caches cabal files. If you want to remove cache, just remove the cache folder.

## Dependencies

These are the following dependencies on Arch Linux:

- cblrepo
- coreutils
- grep
- pacman
- sed
- zsh
- aria2

## Usage

Create an empty folder, e.g., `my-haskell-packages`.

### Patch Folder

You should have an empty folder named `patch` within this folder.
This folder will be accessed by `cblrepo` to generate the proper PKGBUILD; you can have 3 kinds of patches:

  - <hackage_package_name>.cabal
  - <hackage_package_name>.pkgbuild
  - <hackage_package_name>.source

Essentially, the idea is to patch any misbehaving Hackage packages so that a proper, working Arch Linux package can be generated.
Refer to the [cblrepo](https://github.com/magthe/cblrepo) documentation for further explanation.

### Database Generation, PKGBUILD Creation, and Package Installation

Go into this folder, and create a file listing all Hackage packages, one on each line, that you'd like to create PKGBUIKLDs for.
This is called the `<hackage_packages_file>` file by convention.

The following is a sample `<hackage_pacakges_file>` file:

```
bindings-DSL
bindings-GLFW
GLFW-b
transformers-compat
contravariant
distributive
comonad
semigroupoids
bifunctors
generic-deriving
profunctors
reflection
distributive
MonadCatchIO-transformers
lens
linear
rosezipper
elerea
mersenne-random
vect
netwire
```

As you can see, the names of the packages are taken directly from the Hackage site (i.e., the case-sensitivity matches the original names on Hackage).
As the packages here are added in order, you should put them so that the dependencies are built first.
The `lens` package, for example, has a ton of dependencies and all of these are listed before `lens` itself.
It takes some trial and error to get this right (the `initdb-sync` mode will output failures), but it should not be too difficult.

We now run the script 3 times:

```
/path/to/cabal2pkgbuild.sh <hackage_packages_file> initdb-sync (or initdb)
/path/to/cabal2pkgbuild.sh <hackage_packages_file> pkgbuild
/path/to/cabal2pkgbuild.sh <hackage_packages_file> makepkg
```

The `initdb-sync` mode initializes the cblrepo database, populating it with all of the system Haskell packages already installed on your computer.[^symlink]
It then retrieves the latest Hackage package index, and then adds the listed packages in `<hackage_packages_file>`.
If you want to skip the sync with Hackage (e.g., on subsequent immediate runs of this script), use `initdb` instead of `initdb-sync`.

The `pkgbuild` mode removes all `haskell-*` folders in the current folder, before populating the current directory with all the Hackage packages' generated PKGBUILD folders.

Finally, the `makepkg` mode goes through each package and runs `makepkg` followed by `pacman -U` for that package.
This mode is a convenience mode: you can manually go into each generated PKGBUILD directory and do the usual `makepkg`/`pacman -U` combo yourself --- however, it is probably easier with this mode because you retain the dependency ordering information (the order of the packages in `<hackage_packages_file>`).
That is, if you manually built the packages yourself, you'd have to remember which packages to build first.

[^symlink]: NOTE: `cabal2pkgbuild`'s `initdb` and `initdb-sync` modes will *OVERWRITE* the file in `~/.cblrepo/cblrepo.db` with the one generated by it with a symlink.
<commit_msg>Reverted Readme<commit_after># cabal2pkgbuild

`cabal2pkgbuild` is a script used to generate proper PKGBUILD files from any `.cabal` file from Hackage, with the help of `cblrepo` (which is currently used to maintain Haskell packages on Arch Linux).

## Dependencies

These are the following dependencies on Arch Linux:

- cblrepo
- coreutils
- grep
- pacman
- sed
- zsh

## Usage

Create an empty folder, e.g., `my-haskell-packages`.

### Patch Folder

You *must* have an empty folder named `patch` within this folder.
This folder will be accessed by `cblrepo` to generate the proper PKGBUILD; you can have 3 kinds of patches:

  - <hackage_package_name>.cabal
  - <hackage_package_name>.pkgbuild
  - <hackage_package_name>.source

Essentially, the idea is to patch any misbehaving Hackage packages so that a proper, working Arch Linux package can be generated.
Refer to the [cblrepo](https://github.com/magthe/cblrepo) documentation for further explanation.

### Database Generation, PKGBUILD Creation, and Package Installation

Go into this folder, and create a file listing all Hackage packages, one on each line, that you'd like to create PKGBUIKLDs for.
This is called the `<hackage_packages_file>` file by convention.

The following is a sample `<hackage_pacakges_file>` file:

```
bindings-DSL
bindings-GLFW
GLFW-b
transformers-compat
contravariant
distributive
comonad
semigroupoids
bifunctors
generic-deriving
profunctors
reflection
distributive
MonadCatchIO-transformers
lens
linear
rosezipper
elerea
mersenne-random
vect
netwire
```

As you can see, the names of the packages are taken directly from the Hackage site (i.e., the case-sensitivity matches the original names on Hackage).
As the packages here are added in order, you should put them so that the dependencies are built first.
The `lens` package, for example, has a ton of dependencies and all of these are listed before `lens` itself.
It takes some trial and error to get this right (the `initdb-sync` mode will output failures), but it should not be too difficult.

We now run the script 3 times:

```
/path/to/cabal2pkgbuild.sh <hackage_packages_file> initdb-sync
/path/to/cabal2pkgbuild.sh <hackage_packages_file> pkgbuild
/path/to/cabal2pkgbuild.sh <hackage_packages_file> makepkg
```

The `initdb-sync` mode initializes the cblrepo database, populating it with all of the system Haskell packages already installed on your computer.[^symlink]
It then retrieves the latest Hackage package index, and then adds the listed packages in `<hackage_packages_file>`.
If you want to skip the sync with Hackage (e.g., on subsequent immediate runs of this script), use `initdb` instead of `initdb-sync`.

The `pkgbuild` mode removes all `haskell-*` folders in the current folder, before populating the current directory with all the Hackage packages' generated PKGBUILD folders.

Finally, the `makepkg` mode goes through each package and runs `makepkg` followed by `pacman -U` for that package.
This mode is a convenience mode: you can manually go into each generated PKGBUILD directory and do the usual `makepkg`/`pacman -U` combo yourself --- however, it is probably easier with this mode because you retain the dependency ordering information (the order of the packages in `<hackage_packages_file>`).
That is, if you manually built the packages yourself, you'd have to remember which packages to build first.

[^symlink]: NOTE: `cabal2pkgbuild`'s `initdb` and `initdb-sync` modes will *OVERWRITE* the file in `~/.cblrepo/cblrepo.db` with the one generated by it with a symlink.

{'fraction_non_alphanumeric': 0.06831696860738487, 'fraction_numerical': 0.0024892822569492464, 'mean_word_length': 4.879674796747968, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '431409', 'n_tokens_mistral': 2178, 'n_tokens_neox': 2061, 'n_words': 973}