Skip to content

Commit

Permalink
feat(pacman): Add support for Arch Linux Packaging (#137)
Browse files Browse the repository at this point in the history
* Init Pacman Support

* Add Arch Linux packaging

* Add PKGBUILD generator

* cargo fmt

* Update ts config

* Remove `data` from path

* Add changes file

* Rectify Test

* Update Docs

* Rectify Test

* Remove redundant comment

Co-authored-by: Amr Bashir <[email protected]>

* clone single field instead of whole config

* Add file option to pacman config

* Update README files

* Improve docs

* Remove -bin suffix

* add back pacman

---------
  • Loading branch information
naman-crabnebula committed Jan 24, 2024
1 parent 4135a84 commit 9bdb953
Show file tree
Hide file tree
Showing 16 changed files with 536 additions and 77 deletions.
6 changes: 6 additions & 0 deletions .changes/add-pacman-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cargo-packager": minor
"@crabnebula/packager": minor
---

Add Arch Linux package manager, `pacman` support for cargo packager.
62 changes: 1 addition & 61 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ It also has a compatible updater through [cargo-packager-updater](./crates/updat
- Linux
- Debian package (.deb)
- AppImage (.AppImage)
- Pacman (.tar.gz and PKGBUILD)
- Windows
- NSIS (.exe)
- MSI using WiX Toolset (.msi)
Expand Down
1 change: 1 addition & 0 deletions bindings/packager/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ It also comes with useful addons:
- Linux
- Debian package (.deb)
- AppImage (.AppImage)
- Pacman (.tar.gz and PKGBUILD)
- Windows
- NSIS (.exe)
- MSI using WiX Toolset (.msi)
Expand Down
87 changes: 86 additions & 1 deletion bindings/packager/nodejs/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@
}
]
},
"pacman": {
"description": "Pacman configuration.",
"anyOf": [
{
"$ref": "#/definitions/PacmanConfig"
},
{
"type": "null"
}
]
},
"wix": {
"description": "WiX configuration.",
"anyOf": [
Expand Down Expand Up @@ -434,6 +445,13 @@
"enum": [
"appimage"
]
},
{
"description": "The Linux Pacman package (.tar.gz and PKGBUILD)",
"type": "string",
"enum": [
"pacman"
]
}
]
},
Expand Down Expand Up @@ -723,7 +741,7 @@
]
},
"section": {
"description": "Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections",
"description": "Define the section in Debian Control file. See : <https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections>",
"type": [
"string",
"null"
Expand Down Expand Up @@ -796,6 +814,73 @@
},
"additionalProperties": false
},
"PacmanConfig": {
"description": "The Linux pacman configuration.",
"type": "object",
"properties": {
"files": {
"description": "List of custom files to add to the pacman package. Maps a dir/file to a dir/file inside the pacman package.",
"type": [
"object",
"null"
],
"additionalProperties": {
"type": "string"
}
},
"depends": {
"description": "List of softwares that must be installed for the app to build and run.\n\nSee : <https://wiki.archlinux.org/title/PKGBUILD#provides>",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "Additional packages that are provided by this app.\n\nSee : <https://wiki.archlinux.org/title/PKGBUILD#provides>",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"conflicts": {
"description": "Packages that conflict or cause problems with the app. All these packages and packages providing this item will need to be removed\n\nSee : <https://wiki.archlinux.org/title/PKGBUILD#conflicts>",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"replaces": {
"description": "Only use if this app replaces some obsolete packages. For example, if you rename any package.\n\nSee : <https://wiki.archlinux.org/title/PKGBUILD#replaces>",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"source": {
"description": "Source of the package to be stored at PKGBUILD. PKGBUILD is a bash script, so version can be referred as ${pkgver}",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"WixConfig": {
"description": "The wix format configuration",
"type": "object",
Expand Down
47 changes: 45 additions & 2 deletions bindings/packager/nodejs/src-ts/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type LogLevel = "error" | "warn" | "info" | "debug" | "trace";
/**
* Types of supported packages by [`cargo-packager`](https://docs.rs/cargo-packager).
*/
export type PackageFormat = "all" | "default" | "app" | "dmg" | "wix" | "nsis" | "deb" | "appimage";
export type PackageFormat = "all" | "default" | "app" | "dmg" | "wix" | "nsis" | "deb" | "appimage" | "pacman";
/**
* The possible app categories. Corresponds to `LSApplicationCategoryType` on macOS and the GNOME desktop categories on Debian.
*/
Expand Down Expand Up @@ -264,6 +264,10 @@ export interface Config {
* AppImage configuration.
*/
appimage?: AppImageConfig | null;
/**
* Pacman configuration.
*/
pacman?: PacmanConfig | null;
/**
* WiX configuration.
*/
Expand Down Expand Up @@ -408,7 +412,7 @@ export interface DebianConfig {
*/
desktopTemplate?: string | null;
/**
* Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
* Define the section in Debian Control file. See : <https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections>
*/
section?: string | null;
/**
Expand Down Expand Up @@ -447,6 +451,45 @@ export interface AppImageConfig {
[k: string]: string;
} | null;
}
/**
* The Linux pacman configuration.
*/
export interface PacmanConfig {
/**
* List of custom files to add to the pacman package. Maps a dir/file to a dir/file inside the pacman package.
*/
files?: {
[k: string]: string;
} | null;
/**
* List of softwares that must be installed for the app to build and run.
*
* See : <https://wiki.archlinux.org/title/PKGBUILD#provides>
*/
depends?: string[] | null;
/**
* Additional packages that are provided by this app.
*
* See : <https://wiki.archlinux.org/title/PKGBUILD#provides>
*/
provides?: string[] | null;
/**
* Packages that conflict or cause problems with the app. All these packages and packages providing this item will need to be removed
*
* See : <https://wiki.archlinux.org/title/PKGBUILD#conflicts>
*/
conflicts?: string[] | null;
/**
* Only use if this app replaces some obsolete packages. For example, if you rename any package.
*
* See : <https://wiki.archlinux.org/title/PKGBUILD#replaces>
*/
replaces?: string[] | null;
/**
* Source of the package to be stored at PKGBUILD. PKGBUILD is a bash script, so version can be referred as ${pkgver}
*/
source?: string[] | null;
}
/**
* The wix format configuration
*/
Expand Down
2 changes: 1 addition & 1 deletion crates/packager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ walkdir = "2"
os_pipe = "1"
minisign = "0.7"
tar = { workspace = true }
libflate = "2.0"
flate2 = "1.0"
strsim = "0.10"
schemars = { workspace = true, optional = true }
native-tls = { version = "0.2", optional = true }
Expand Down
1 change: 1 addition & 0 deletions crates/packager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ It also comes with useful addons:
- Linux
- Debian package (.deb)
- AppImage (.AppImage)
- Pacman (.tar.gz and PKGBUILD)
- Windows
- NSIS (.exe)
- MSI using WiX Toolset (.msi)
Expand Down
Loading

0 comments on commit 9bdb953

Please sign in to comment.