-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1472 from chainguard-dev/split-packagedir
feat(pipelines/split): Support overriding source package
- Loading branch information
Showing
6 changed files
with
142 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
name: Split GNU info pages | ||
|
||
needs: | ||
packages: | ||
- busybox | ||
|
||
inputs: | ||
package: | ||
description: | | ||
The package to split info pages files from | ||
required: false | ||
|
||
pipeline: | ||
- if: ${{targets.destdir}} != ${{targets.contextdir}} | ||
runs: | | ||
if [ -d "${{targets.destdir}}/usr/share/info" ]; then | ||
rm -f "${{targets.destdir}}"/usr/share/info/dir | ||
- runs: | | ||
PACKAGE_DIR="${{targets.destdir}}" | ||
if [ -n "${{inputs.package}}" ]; then | ||
PACKAGE_DIR="/home/build/melange-out/${{inputs.package}}" | ||
fi | ||
if [ "$PACKAGE_DIR" == "${{targets.contextdir}}" ]; then | ||
echo "ERROR: Package can not split files from itself!" && exit 1 | ||
fi | ||
if [ -d "$PACKAGE_DIR/usr/share/info" ]; then | ||
rm -f "$PACKAGE_DIR"/usr/share/info/dir | ||
mkdir -p "${{targets.contextdir}}/usr/share" | ||
mv "${{targets.destdir}}"/usr/share/info "${{targets.contextdir}}/usr/share" | ||
mv "$PACKAGE_DIR"/usr/share/info "${{targets.contextdir}}/usr/share" | ||
fi |
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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
name: Split locales | ||
|
||
needs: | ||
packages: | ||
- busybox | ||
|
||
inputs: | ||
package: | ||
description: | | ||
The package to split locales from | ||
required: false | ||
|
||
pipeline: | ||
- if: ${{targets.destdir}} != ${{targets.contextdir}} | ||
runs: | | ||
if [ -d "${{targets.destdir}}"/usr/share/locale ]; then | ||
- runs: | | ||
PACKAGE_DIR="${{targets.destdir}}" | ||
if [ -n "${{inputs.package}}" ]; then | ||
PACKAGE_DIR="/home/build/melange-out/${{inputs.package}}" | ||
fi | ||
if [ "$PACKAGE_DIR" == "${{targets.contextdir}}" ]; then | ||
echo "ERROR: Package can not split files from itself!" && exit 1 | ||
fi | ||
if [ -d "$PACKAGE_DIR"/usr/share/locale ]; then | ||
mkdir -p "${{targets.contextdir}}"/usr/share | ||
mv "${{targets.destdir}}"/usr/share/locale "${{targets.contextdir}}"/usr/share/locale | ||
mv "$PACKAGE_DIR"/usr/share/locale "${{targets.contextdir}}"/usr/share/locale | ||
fi |
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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
name: Split manpages | ||
|
||
needs: | ||
packages: | ||
- busybox | ||
|
||
inputs: | ||
package: | ||
description: | | ||
The package to split manpages from | ||
required: false | ||
|
||
pipeline: | ||
- if: ${{targets.destdir}} != ${{targets.contextdir}} | ||
runs: | | ||
if [ -d "${{targets.destdir}}/usr/share/man" ]; then | ||
- runs: | | ||
PACKAGE_DIR="${{targets.destdir}}" | ||
if [ -n "${{inputs.package}}" ]; then | ||
PACKAGE_DIR="/home/build/melange-out/${{inputs.package}}" | ||
fi | ||
if [ "$PACKAGE_DIR" == "${{targets.contextdir}}" ]; then | ||
echo "ERROR: Package can not split files from itself!" && exit 1 | ||
fi | ||
if [ -d "$PACKAGE_DIR/usr/share/man" ]; then | ||
mkdir -p "${{targets.contextdir}}/usr/share" | ||
mv "${{targets.destdir}}/usr/share/man" "${{targets.contextdir}}/usr/share" | ||
mv "$PACKAGE_DIR/usr/share/man" "${{targets.contextdir}}/usr/share" | ||
fi |
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 |
---|---|---|
@@ -1,19 +1,38 @@ | ||
name: Split static library files | ||
|
||
needs: | ||
packages: | ||
- busybox | ||
|
||
inputs: | ||
package: | ||
description: | | ||
The package to split static library files from | ||
required: false | ||
|
||
pipeline: | ||
- if: ${{targets.destdir}} != ${{targets.contextdir}} | ||
runs: | | ||
- runs: | | ||
PACKAGE_DIR="${{targets.destdir}}" | ||
if [ -n "${{inputs.package}}" ]; then | ||
PACKAGE_DIR="/home/build/melange-out/${{inputs.package}}" | ||
fi | ||
if [ "$PACKAGE_DIR" == "${{targets.contextdir}}" ]; then | ||
echo "ERROR: Package can not split files from itself!" && exit 1 | ||
fi | ||
i= j= | ||
cd "${{targets.destdir}}" || exit 0 | ||
cd "$PACKAGE_DIR" || exit 0 | ||
libdirs=usr/ | ||
[ -d lib/ ] && libdirs="lib/ $libdirs" | ||
[ -d lib64/ ] && libdirs="lib64/ $libdirs" | ||
for i in \ | ||
$(find $libdirs -name '*.a' 2>/dev/null); do | ||
if [ -e "${{targets.destdir}}/$i" ] || [ -L "${{targets.destdir}}/$i" ]; then | ||
if [ -e "$PACKAGE_DIR/$i" ] || [ -L "$PACKAGE_DIR/$i" ]; then | ||
d="${{targets.contextdir}}/${i%/*}" # dirname $i | ||
mkdir -p "$d" | ||
mv "${{targets.destdir}}/$i" "$d" | ||
rmdir "${{targets.destdir}}/${i%/*}" 2>/dev/null || : | ||
mv "$PACKAGE_DIR/$i" "$d" | ||
rmdir "$PACKAGE_DIR/${i%/*}" 2>/dev/null || : | ||
fi | ||
done |