-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
239 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
image: ubuntu:latest | ||
services: | ||
- docker:dind | ||
cache: | ||
key: ${CI_COMMIT_REF_SLUG} | ||
paths: | ||
- /usr/portage | ||
- /var/portage | ||
before_script: | ||
- DEBIAN_FRONTEND=noninteractive apt update -qy | ||
- DEBIAN_FRONTEND=noninteractive apt install -y docker.io git perl6 | ||
- git fetch -a origin | ||
- git checkout master && git pull origin master && git checkout - | ||
|
||
build-ebuilds: | ||
script: | ||
- groups | ||
- ls -lah /etc/init.d | ||
- /etc/init.d/docker start | ||
- sleep 10 | ||
- /etc/init.d/docker status | ||
- docker ps | ||
- ./.tools/bin/updated-ebuilds | ./.tools/bin/ebuild2atom | ./.tools/bin/build |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#! /usr/bin/env perl6 | ||
|
||
#| Build packages | ||
sub MAIN ( | ||
#| Host's path to the Portage tree. | ||
Str:D :$tree = "/usr/portage", | ||
|
||
#| Host's path to Portage's var dir. This holds binpkgs and distfiles. | ||
Str:D :$var = "/var/portage", | ||
|
||
#| A list of packages to build | ||
*@packages, | ||
) { | ||
@packages = $*IN.lines unless @packages; | ||
|
||
my $root = shell("git rev-parse --show-toplevel", :out).out.slurp.trim.IO; | ||
|
||
build-pkg($_, :$tree, :$var, :$root) for @packages; | ||
} | ||
|
||
#| Build a given package in a clean Docker container | ||
sub build-pkg ( | ||
#| The name of the package to build | ||
Str:D $package, | ||
|
||
#| Host's path to the Portage tree. | ||
Str:D :$tree = "/usr/portage", | ||
|
||
#| Host's path to Portage's var dir. This holds binpkgs and distfiles. | ||
Str:D :$var = "/var/portage", | ||
|
||
#| Path to overlay's root | ||
IO::Path:D :$root, | ||
) { | ||
my Pair @volumes = ( | ||
$tree => "/usr/portage", | ||
$var => "/var/portage", | ||
$root.add(".tools").add("etc").absolute => "/etc/portage", | ||
$root.absolute => "/opt/scriptkitties/overlay", | ||
); | ||
|
||
my Str @cmd = < | ||
docker | ||
run | ||
-it | ||
>; | ||
|
||
for @volumes { | ||
@cmd.push: "-v $_.key():$_.value()"; | ||
} | ||
|
||
@cmd.push: "gentoo/stage3-amd64"; | ||
@cmd.push: "emerge"; | ||
@cmd.push: $package; | ||
|
||
@cmd.join(" ").say; | ||
run @cmd; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /usr/bin/env perl6 | ||
|
||
#| Convert a path to an ebuild into an atom that can be passed to emerge. | ||
sub MAIN (*@ebuilds) | ||
{ | ||
@ebuilds = $*IN.lines unless @ebuilds; | ||
|
||
for @ebuilds { | ||
my $category = $_.split("/").head; | ||
my $package = $_.split("/").tail.IO.extension("").Str; | ||
|
||
say "=$category/$package" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /usr/bin/env perl6 | ||
|
||
sub MAIN ( | ||
*@words, | ||
) { | ||
my @ebuilds = (run « git diff --name-status master », :out).out.lines.grep(*.ends-with(".ebuild")); | ||
|
||
if (@ebuilds.elems != 1) { | ||
exit note q:to/EOF/; | ||
Committed ebuilds does not equal to 1. Each commit should only | ||
contain a single ebuild update. | ||
EOF | ||
} | ||
|
||
my $ebuild = @ebuilds.head.split("\t").tail.split("/").head(2).join("/"); | ||
|
||
run « git commit -S -m "$ebuild: @words.join(" ")" »; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /usr/bin/env perl6 | ||
|
||
#| Get a list of all changed package atoms. | ||
sub MAIN () | ||
{ | ||
(run « git diff --name-status master », :out).out.lines | ||
.grep(*.ends-with(".ebuild")) | ||
.map(*.split("\t").tail) | ||
.map(*.say) | ||
; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
COMMON_FLAGS="-O2 -pipe" | ||
CFLAGS="${COMMON_FLAGS}" | ||
CXXFLAGS="${COMMON_FLAGS}" | ||
FCFLAGS="${COMMON_FLAGS}" | ||
FFLAGS="${COMMON_FLAGS}" | ||
|
||
FEATURES=" | ||
$FEATURES | ||
buildpkg | ||
network-sandbox | ||
parallel-fetch | ||
parallel-install | ||
sandbox | ||
userfetch | ||
userpriv | ||
usersandbox | ||
usersync | ||
" | ||
|
||
EMERGE_DEFAULT_OPTS=" | ||
$EMERGE_DEFAULT_OPTS | ||
--bindpkg-respect-use=y | ||
--binpkg-changed-deps=y | ||
--tree | ||
--usepkg | ||
--verbose | ||
" | ||
|
||
PKGDIR=/var/portage/packages | ||
DISTDIR=/var/portage/distfiles | ||
|
||
LC_MESSAGES=C | ||
L10N="en" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../usr/portage/profiles/default/linux/amd64/17.0/desktop |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*/*::sk-overlay ~* |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
# Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for | ||
# Portage to process it. | ||
# | ||
# With portage-2.2.16 and newer, all repo.postsync.d hooks will be called multiple | ||
# times after syncing each repository. | ||
# | ||
# Older versions of Portage support syncing only one repository. | ||
# In those versions, the postsync.d hooks will be called only once, | ||
# and they will not be passed any parameters. | ||
|
||
# On a repo.postsync.d hook call, positional parameters contain | ||
# information about the just-synced repository. | ||
|
||
# Your hook can control it's actions depending on any of the three | ||
# parameters passed in to it. | ||
# | ||
# They are as follows: | ||
# | ||
# The repository name. | ||
repository_name=${1} | ||
# The URI to which the repository was synced. | ||
sync_uri=${2} | ||
# The path to the repository. | ||
repository_path=${3} | ||
|
||
# Portage assumes that a hook succeeded if it exits with 0 code. If no | ||
# explicit exit is done, the exit code is the exit code of last spawned | ||
# command. Since our script is a bit more complex, we want to control | ||
# the exit code explicitly. | ||
ret=0 | ||
|
||
if [ -n "${repository_name}" ]; then | ||
# Repository name was provided, so we're in a post-repository hook. | ||
echo "* In post-repository hook for ${repository_name}" | ||
echo "** synced from remote repository ${sync_uri}" | ||
echo "** synced into ${repository_path}" | ||
|
||
# Gentoo comes with pregenerated cache but the other repositories | ||
# usually don't. Generate them to improve performance. | ||
if [ "${repository_name}" != "gentoo" ]; then | ||
if ! egencache --update --repo="${repository_name}" --jobs=4 | ||
then | ||
echo "!!! egencache failed!" | ||
ret=1 | ||
fi | ||
fi | ||
fi | ||
|
||
# Return explicit status. | ||
exit "${ret}" |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
repository_name=$1 | ||
repository_path=$3 | ||
|
||
if [ -n "${repository_name}" ]; then | ||
q ${PORTAGE_QUIET:+-q} --reinitialize="${repository_path}" | ||
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[sk-overlay] | ||
priority = 50 | ||
location = /opt/scriptkitties/overlay | ||
layman-type = git | ||
auto-sync = No | ||
|
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,33 +1,15 @@ | ||
# | ||
# Run repoman via travis | ||
# See https://github.com/mrueg/repoman-travis | ||
# | ||
language: python | ||
python: | ||
- pypy | ||
env: | ||
- PORTAGE_VER="2.3.51" | ||
sudo: required | ||
language: generic | ||
services: | ||
- docker | ||
|
||
before_install: | ||
- sudo apt-get -qq update | ||
- pip install lxml pyyaml | ||
before_script: | ||
- sudo chmod a+rwX /etc/passwd /etc/group /etc /usr | ||
- mkdir -p travis-overlay /etc/portage /usr/portage/distfiles | ||
- mv !(travis-overlay) travis-overlay/ | ||
- mv .git travis-overlay/ | ||
- wget "https://raw.githubusercontent.com/mrueg/repoman-travis/master/.travis.yml" -O .travis.yml.upstream | ||
- wget "https://raw.githubusercontent.com/mrueg/repoman-travis/master/spinner.sh" | ||
- wget -qO - "https://github.com/gentoo/portage/archive/portage-${PORTAGE_VER}.tar.gz" | tar xz | ||
- wget -qO - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | tar xz -C /usr/portage --strip-components=1 | ||
- chmod a+rwx spinner.sh | ||
- echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" >> /etc/passwd | ||
- echo "portage::250:portage,travis" >> /etc/group | ||
- wget "https://www.gentoo.org/dtd/metadata.dtd" -O /usr/portage/distfiles/metadata.dtd | ||
- ln -s $TRAVIS_BUILD_DIR/portage-portage-${PORTAGE_VER}/cnf/repos.conf /etc/portage/repos.conf | ||
- ln -s /usr/portage/profiles/default/linux/amd64/17.0 /etc/portage/make.profile | ||
- SIZE=$(stat -c %s .travis.yml.upstream) | ||
- if ! cmp -n $SIZE -s .travis.yml .travis.yml.upstream; then echo -e "\e[31m !!! .travis.yml outdated! Update available https://github.com/mrueg/repoman-travis \e[0m" > /tmp/update ; fi | ||
- cd travis-overlay | ||
- DEBIAN_FRONTEND=noninteractive sudo apt-get update -qy | ||
- DEBIAN_FRONTEND=noninteractive sudo apt-get install -y git perl6 | ||
- git fetch -a origin | ||
- git checkout master && git pull origin master && git checkout - | ||
|
||
script: | ||
- ./../spinner.sh "python ../portage-portage-${PORTAGE_VER}/repoman/bin/repoman full -d" | ||
# You can append own scripts after this line | ||
- groups | ||
- docker ps | ||
- ./.tools/bin/updated-ebuilds | ./.tools/bin/ebuild2atom | ./.tools/bin/build |