-
-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add archlinux packaging to nfpm backend (#21299)
This adds archlinux packaging to the nfpm backend introduced in #19308. New target (and related fields): - `nfpm_archlinux_package`
- Loading branch information
1 parent
0d43b27
commit 219cb02
Showing
13 changed files
with
500 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from pants.backend.nfpm.field_sets import ( | ||
NfpmApkPackageFieldSet, | ||
NfpmArchlinuxPackageFieldSet, | ||
NfpmDebPackageFieldSet, | ||
NfpmRpmPackageFieldSet, | ||
) | ||
|
@@ -15,6 +16,10 @@ | |
NfpmPackageNameField, | ||
) | ||
from pants.backend.nfpm.fields.apk import NfpmApkDependsField, NfpmApkMaintainerField | ||
from pants.backend.nfpm.fields.archlinux import ( | ||
NfpmArchlinuxDependsField, | ||
NfpmArchlinuxPackagerField, | ||
) | ||
from pants.backend.nfpm.fields.deb import ( | ||
NfpmDebDependsField, | ||
NfpmDebFieldsField, | ||
|
@@ -30,7 +35,12 @@ | |
) | ||
from pants.backend.nfpm.fields.scripts import NfpmPackageScriptsField | ||
from pants.backend.nfpm.fields.version import NfpmVersionField | ||
from pants.backend.nfpm.target_types import NfpmApkPackage, NfpmDebPackage, NfpmRpmPackage | ||
from pants.backend.nfpm.target_types import ( | ||
NfpmApkPackage, | ||
NfpmArchlinuxPackage, | ||
NfpmDebPackage, | ||
NfpmRpmPackage, | ||
) | ||
from pants.engine.addresses import Address | ||
from pants.engine.target import DescriptionField | ||
|
||
|
@@ -84,6 +94,53 @@ def test_generate_nfpm_config_for_apk(): | |
assert nfpm_config == expected_nfpm_config | ||
|
||
|
||
def test_generate_nfpm_config_for_archlinux(): | ||
depends = [ | ||
"git", | ||
"tcpdump<5", | ||
"foobar>=1.8.0", | ||
] | ||
tgt = NfpmArchlinuxPackage( | ||
{ | ||
NfpmPackageNameField.alias: "treasure", | ||
NfpmVersionField.alias: "3.2.1", | ||
DescriptionField.alias: "Black Beard's buried treasure.", | ||
NfpmPackageScriptsField.alias: { | ||
"preinstall": "hornswaggle", | ||
"preupgrade": "plunder", | ||
}, | ||
NfpmArchlinuxPackagerField.alias: "Black Beard <[email protected]", | ||
NfpmHomepageField.alias: "https://jolly.roger.example.com", | ||
NfpmLicenseField.alias: "MIT", | ||
NfpmArchlinuxDependsField.alias: depends, | ||
}, | ||
Address("", target_name="t"), | ||
) | ||
expected_nfpm_config = { | ||
"disable_globbing": True, | ||
"contents": [], | ||
"mtime": MTIME, | ||
"name": "treasure", | ||
"arch": "amd64", # default | ||
"version": "3.2.1", | ||
"version_schema": "semver", # default | ||
"release": 1, # default | ||
"homepage": "https://jolly.roger.example.com", | ||
"license": "MIT", | ||
"depends": tuple(depends), | ||
"scripts": {"preinstall": "hornswaggle"}, | ||
"archlinux": { | ||
"packager": "Black Beard <[email protected]", | ||
"scripts": {"preupgrade": "plunder"}, | ||
}, | ||
"description": "Black Beard's buried treasure.", | ||
} | ||
|
||
field_set = NfpmArchlinuxPackageFieldSet.create(tgt) | ||
nfpm_config = field_set.nfpm_config(tgt, default_mtime=MTIME) | ||
assert nfpm_config == expected_nfpm_config | ||
|
||
|
||
def test_generate_nfpm_config_for_deb(): | ||
depends = [ | ||
"git", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.