summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-17 23:58:57 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-17 23:58:57 +0300
commitaca5784832b090e0220bb6677c0d85fda5c4b0df (patch)
treeedc3ceea5d431b573a0ff9f868915bb02d452c3c
parent42d73969b1528347bcb73e9a94c46947da2c42e5 (diff)
downloadspm-aca5784832b090e0220bb6677c0d85fda5c4b0df.tar.gz
spm-aca5784832b090e0220bb6677c0d85fda5c4b0df.tar.bz2
spm-aca5784832b090e0220bb6677c0d85fda5c4b0df.tar.xz
spm-aca5784832b090e0220bb6677c0d85fda5c4b0df.zip
Add scripts resetsrc.sh and resetsrcall.sh for reset local changes in packages sources.
-rw-r--r--scripts/include/common.sh30
-rwxr-xr-xscripts/resetsrc.sh9
-rwxr-xr-xscripts/resetsrcall.sh5
3 files changed, 44 insertions, 0 deletions
diff --git a/scripts/include/common.sh b/scripts/include/common.sh
index 7b4b295..4431056 100644
--- a/scripts/include/common.sh
+++ b/scripts/include/common.sh
@@ -368,6 +368,19 @@ function common_update_source_all {
unset files
}
+function common_reset_source_all {
+ cd ../src/
+ check_error $?
+ files="*"
+ for package in $files
+ do
+ cd ../scripts/
+ ./resetsrc.sh $package
+ check_error $?
+ done
+ unset files
+}
+
function package_get_source {
echo "package_get_source"
run_clone "${SRCURL}"
@@ -393,6 +406,23 @@ function package_update_source {
fi
}
+function package_reset_source {
+ echo "package_reset_source"
+ cd "../src/${package}"
+ if [ -d .git ]; then
+ echo "git reset --hard HEAD"
+ git reset --hard HEAD
+ check_error $?
+ return
+ fi
+ if [ -d .hg ]; then
+ echo "hg update -C"
+ hg update -C
+ check_error $?
+ return
+ fi
+}
+
function common_clean_destination {
echo "clean ${bindir}"
rm -rf "${bindir}"
diff --git a/scripts/resetsrc.sh b/scripts/resetsrc.sh
new file mode 100755
index 0000000..05843c1
--- /dev/null
+++ b/scripts/resetsrc.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export package=$1
+source ../scripts/include/common.sh
+
+common_package_init
+
+common_run_package
+package_reset_source
diff --git a/scripts/resetsrcall.sh b/scripts/resetsrcall.sh
new file mode 100755
index 0000000..7185785
--- /dev/null
+++ b/scripts/resetsrcall.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source ../scripts/include/common.sh
+
+common_reset_source_all