summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-02-05 12:48:31 +0100
committerRemi Collet <remi@php.net>2024-02-05 12:48:31 +0100
commit04e4cfbfc653ffd903a4deca901b2ffbe27ab382 (patch)
treea6dbad172295a8c93ac339fc08a3b013b3a0d916
parent5aeedec527a3e08e55334a17bd19164fd463219c (diff)
optimize sources
-rwxr-xr-xmakesrc.sh37
-rw-r--r--php-phpunit-php-code-coverage10.spec5
2 files changed, 25 insertions, 17 deletions
diff --git a/makesrc.sh b/makesrc.sh
index 8152336..b959795 100755
--- a/makesrc.sh
+++ b/makesrc.sh
@@ -1,28 +1,35 @@
#!/bin/bash
NAME=$(basename $PWD)
-OWNER=$(sed -n '/^%global gh_vendor/{s/.* //;p}' $NAME.spec)
+DATE=$(sed -n '/^%global gh_date/{s/.* //;p}' $NAME.spec)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
SHORT=${COMMIT:0:7}
-echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+DATE=$(date -d "$DATE -4 days" +%Y-%m-%d)
-echo "Cloning..."
-rm -rf $PROJECT-$COMMIT
-git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+if [ -f $NAME-$VERSION-$SHORT.tgz ]; then
+ echo "$NAME-$VERSION-$SHORT.tgz already there"
+else
+ echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Date=$DATE\n"
-echo "Getting commit..."
-pushd $PROJECT-$COMMIT
-git checkout $COMMIT
-cp composer.json ../composer.json
-popd
+ echo "Cloning..."
+ rm -rf $PROJECT-$COMMIT
+ git clone --shallow-since=$DATE https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT || exit 1
-echo "Archiving..."
-tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs --exclude tools $PROJECT-$COMMIT
+ echo "Getting commit..."
+ pushd $PROJECT-$COMMIT
+ git checkout $COMMIT || exit1
+ cp composer.json ../composer.json
+ popd
-echo "Cleaning..."
-rm -rf $PROJECT-$COMMIT
+ echo "Archiving..."
+ tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs --exclude tools $PROJECT-$COMMIT
-echo "Done."
+ echo "Cleaning..."
+ rm -rf $PROJECT-$COMMIT
+
+ echo "Done."
+fi
diff --git a/php-phpunit-php-code-coverage10.spec b/php-phpunit-php-code-coverage10.spec
index 7e83ede..9e17744 100644
--- a/php-phpunit-php-code-coverage10.spec
+++ b/php-phpunit-php-code-coverage10.spec
@@ -12,8 +12,9 @@
# Github
%global gh_commit 78c3b7625965c2513ee96569a4dbb62601784145
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
-%global gh_vendor sebastianbergmann
+%global gh_owner sebastianbergmann
%global gh_project php-code-coverage
+%global gh_date 2023-12-21
# Packagist
%global pk_vendor phpunit
%global pk_project php-code-coverage
@@ -33,7 +34,7 @@ Summary: PHP code coverage information, version %{ver_major}
# MIT: boostrap, d3, holder, html5shiv, jquery, respond
# Apache-2.0: nvd3
License: BSD-3-Clause AND MIT AND Apache-2.0
-URL: https://github.com/%{gh_vendor}/%{gh_project}
+URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: %{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh