Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
Renew Repo
Browse files Browse the repository at this point in the history
- Migrate to CircleCI from Travis
- Use zstd compression over tar archive

Signed-off-by: rokibhasansagar <rokibhasansagar2014@outlook.com>
  • Loading branch information
rokibhasansagar committed Dec 11, 2020
1 parent 4688d98 commit daf789c
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 146 deletions.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2.1

executors:
alpine:
docker:
- image: fr3akyphantom/skadoosh:latest
auth:
username: "$DOCKER_USERNAME"
password: "$DOCKERHUB_TOKEN"

jobs:
build:
executor: alpine
steps:
- checkout
- run:
name: "Compression Job for Minimal PBRP for Marshmallow branch"
command: |
chmod a+x .circleci/keepalive.sh
.circleci/keepalive.sh & ./script.sh
kill -s SIGTERM $(cat /tmp/keepalive.pid) || true
workflows:
version: 2
compress-norepo:
jobs:
- build:
context: org-global

6 changes: 6 additions & 0 deletions .circleci/keepalive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
echo $$ > /tmp/keepalive.pid
while true; do
echo "." && sleep 300
done

48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# TWRP Compressed Sources
# PBRP Compressed Sources

[![Project tranSkadooSH](https://img.shields.io/badge/Project%20tranSkadooSH-On%20Travis%20CI-green.svg "Go to Project tranSkadooSH")](https://github.com/rokibhasansagar/tranSkadooSH)
![Travis Build Status](https://travis-ci.org/rokibhasansagar/twrp_compressed_sources.svg?branch=master "Build Status")
![CircleCI Build Status](https://img.shields.io/circleci/build/github/PhantomZone54/pbrp_compressed_sources/master?label=CircleCI%20Builds&logo=circleci "Build Status")
![GitHub all releases](https://img.shields.io/github/downloads/PhantomZone54/pbrp_compressed_sources/total?label=Total%20Downloads)

Sometimes it is hard to get the _repo files_ to build _TWRP_
Sometimes it is hard to get the _repo files_ to build _PBRP_
:worried:

That's why I used _Regalstreak_'s Project *Skadoosh* by slightly modifying as my [_tranSkadooSH_](https://github.com/rokibhasansagar/tranSkadooSH). :smirk:
Expand Down
94 changes: 0 additions & 94 deletions magic.sh

This file was deleted.

136 changes: 136 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/bin/bash

# Authors - Neil "regalstreak" Agarwal, Harsh "MSF Jarvis" Shandilya, Tarang "DigiGoon" Kagathara
# 2017
# -----------------------------------------------------
# Modified by - Rokib Hasan Sagar @rokibhasansagar
# To be used via Travis CI to Release on GitHub/AFH
# -----------------------------------------------------

# Definitions
DIR=$(pwd)
RecName="PitchBlackRecoveryProject"
LINK="https://github.com/PhantomZone54/PitchBlack-Manifest.git"
BRANCH="master"

printf "Github Authorization...\n"
git config --global user.email $GitHubMail
git config --global user.name $GitHubName
git config --global color.ui true

git clone -q "https://$GITHUB_TOKEN@github.com/rokibhasansagar/google-git-cookies.git" &> /dev/null
if [ -e google-git-cookies ]; then
bash google-git-cookies/setup_cookies.sh
rm -rf google-git-cookies
fi

printf "Main Function Starts HERE\n"
cd $DIR; mkdir $RecName; cd $RecName

printf "Initialize the repo data fetching\n"
repo init -q -u $LINK -b $BRANCH --depth 1 || repo init -q -u $LINK --depth 1

printf "Removing Unimportant Darwin-specific Files from syncing\n"
cd .repo/manifests
sed -i '/darwin/d' default.xml
( find . -type f -name '*.xml' | xargs sed -i '/darwin/d' ) || true
git commit -a -m "Magic" || true
cd ../
sed -i '/darwin/d' manifest.xml
cd ../

printf "Syncing it up...\n"
time repo sync -c -q --force-sync --no-clone-bundle --optimized-fetch --prune --no-tags -j$(nproc --all)
printf "SHALLOW Source Syncing done\n"

printf "\nThe total size of the .repo folder was --- " && du -sh .repo

# Keep the whole .repo/manifests folder
mkdir -p repomanifests && cp -a .repo/manifests repomanifests/
printf "Cleaning up the .repo, no use of it now\n"
rm -rf .repo
mkdir -p .repo && mv repomanifests/manifests .repo/ && ln -s .repo/manifests/default.xml .repo/manifest.xml && rm -rf repomanifests


find . \( \( -type d -a -name ".git" \) -o \( -type f -a \( -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" \) \) \) -exec rm -rf -- '{}' +; 2>/dev/null

cd $DIR
DDF=$(du -sh -BM $RecName | awk '{print $1}' | sed 's/M//')
printf "The total size of the checked-out files is --- " && printf "%s MB\n" "$DDF"

cd $RecName

# Get the Version
export version=$(cat bootable/recovery/variables.h | grep "define TW_MAIN_VERSION_STR" | cut -d '"' -f2)
printf "The Recovery Version is -- " && printf "$s\n" $version

# Compress non-repo folder in one piece
printf "Compressing files --- \n"
printf "Please be patient, this will take time\n"
# Take a break
sleep 2s

mkdir -p ~/project/files/
datetime=$(date +%Y%m%d)

if [ $DDF -gt 6144 ]; then
printf "Compressing and Making 1 GB parts Because of Huge Data Amount \nBe Patient...\n"
tar -I'zstd -19 -T3 --long --adapt --format=zstd' -cf - * | split -b 1024M - ~/project/files/$RecName-$BRANCH-norepo-$datetime.tzst. || exit 1
else
tar -I'zstd -19 -T3 --long --adapt --format=zstd' -cf ~/project/files/$RecName-$BRANCH-norepo-$datetime.tzst * || exit 1
fi

if [[ $? -eq 0 ]]; then
printf "Compression Done\n"
else
printf "Compression Failed! \n" && exit 1
fi

cd ~/project/files

printf "Taking md5 Hash\n"
md5sum * > $RecName-$BRANCH-norepo-$datetime.tzst.md5sum
cat $RecName-$BRANCH-norepo-$datetime.tzst.md5sum

printf "Final Compressed archives --- \n"
ls -lA ~/project/files/
printf "\n\n"

# Make a Compressed file list for future reference
cd ~/project/$RecName
find . -type f | cut -d'/' -f'2-' > $RecName-$BRANCH-$datetime-filelist.txt || printf "filelist generation error\n"
tar -I'zstd -19 -T3 --long --adapt --format=zstd' -cf ~/project/files/$RecName-$BRANCH-norepo-$datetime.filelist.tzst *filelist.txt

printf "Preparing for Upload...\n"
cd ~/project/files/
for file in $RecName-$BRANCH*; do
printf "Uploading %s...\n" $file
curl --progress-bar --ftp-create-dirs --ftp-pasv -T $file ftp://"$FTPUser":"$FTPPass"@"$FTPHost"//$RecName-NoRepo/
sleep 1s
done
[[ $? -eq 0 ]] && printf "Done uploading to AndroidFileHost\n"

cd ~/project/
printf "Uploading %s to SourceForge...\n" $RecName-$BRANCH
sf_gen=''
until [ $sf_gen -eq 0 ]; do
printf "exit\n" | sshpass -p "$SFPass" ssh -tto StrictHostKeyChecking=no $SFUser@shell.sourceforge.net create
sf_gen=$?
printf "SF FRS SSH returned %d\n" $sf_gen
sleep 1s
done
sleep 2s
sf_return=''
until [ $sf_return -eq 0 ]; do
rsync -arvPz --rsh="sshpass -p $SFPass ssh -l $SFUser" files/ $SFUser@shell.sourceforge.net:/home/frs/project/transkadoosh/$RecName-NoRepo/
sf_return=$?
sleep 1s
done
[[ $? -eq 0 ]] && printf "Done uploading to SourceForge\n"

rm -f files/core* || true
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} \
-b "Releasing Latest PBRP Sources using OmniROM's Minimal-Manifest" TWRPv$version-$datetime files/

printf "\nCongratulations! Job Done!\n"

0 comments on commit daf789c

Please sign in to comment.