Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
0cbd7162
You need to sign in or sign up before continuing.
Commit
0cbd7162
authored
Jul 12, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpmgs: rewrite predownloaded node_modules support
parent
f6290682
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
73 deletions
+34
-73
rpmgs
bin/rpmgs
+34
-73
No files found.
bin/rpmgs
View file @
0cbd7162
...
@@ -207,19 +207,13 @@ gear_update_from_tarball()
...
@@ -207,19 +207,13 @@ gear_update_from_tarball()
fatal
"can't import tarball '
$TARBALL
'"
fatal
"can't import tarball '
$TARBALL
'"
}
}
# if we have
rule for gear-sources
# if we have
named rule
is_
gear_sources
()
is_
predownloaded_rule
()
{
{
cat
$(
get_root_git_dir
)
/.gear/rules |
grep
-q
"^tar:.*
\.
gear/
gear-sources
"
cat
$(
get_root_git_dir
)
/.gear/rules |
grep
-q
"^tar:.*
\.
gear/
$1
"
#fatal "missed tar:.gear/gear-sources in $(get_root_git_dir)/.gear/rules"
#fatal "missed tar:.gear/gear-sources in $(get_root_git_dir)/.gear/rules"
}
}
# if we have rule for gear-production
is_gear_production
()
{
cat
$(
get_root_git_dir
)
/.gear/rules |
grep
-q
"^tar:.*
\.
gear/gear-production"
#fatal "missed tar:.gear/gear-sources in $(get_root_git_dir)/.gear/rules"
}
# Args: tarball dir
# Args: tarball dir
# Uses: RPMSOURCEDIR FORCEDOWNLOAD
# Uses: RPMSOURCEDIR FORCEDOWNLOAD
...
@@ -281,6 +275,7 @@ commit_tarball()
...
@@ -281,6 +275,7 @@ commit_tarball()
# uses: BASENAME VERSION
# uses: BASENAME VERSION
update_post_git_submodules
()
update_post_git_submodules
()
{
{
# TODO: check for rules
local
PSM
=
$(
get_root_git_dir
)
/.gear/
$BASENAME
-postsubmodules
local
PSM
=
$(
get_root_git_dir
)
/.gear/
$BASENAME
-postsubmodules
[
-d
$PSM
]
||
return
[
-d
$PSM
]
||
return
...
@@ -309,13 +304,15 @@ update_post_git_submodules()
...
@@ -309,13 +304,15 @@ update_post_git_submodules()
docmd git commit
$PSM
-m
"update source prepared with submodules for version
$VERSION
"
docmd git commit
$PSM
-m
"update source prepared with submodules for version
$VERSION
"
}
}
update_gear_production
()
# param: development, production
update_predownloaded
()
{
{
is_gear_production
||
return
local
MODE
=
"
$1
"
PSM
=
$(
get_root_git_dir
)
/.gear/gear-production
local
SDNAME
=
predownloaded-
$MODE
is_predownloaded_rule
$SDNAME
||
return
PSM
=
$(
get_root_git_dir
)
/.gear/
$SDNAME
local
RGD
=
$(
get_root_git_dir
)
local
RGD
=
$(
get_root_git_dir
)
info
"Detected npm install hook, run npm install --production ..."
# hack for subdir??
# hack for subdir??
CURNAME
=
$BASENAME
CURNAME
=
$BASENAME
...
@@ -332,82 +329,46 @@ update_gear_production()
...
@@ -332,82 +329,46 @@ update_gear_production()
cd
$PSM
||
fatal
cd
$PSM
||
fatal
#### npm only part
info
"Detected npm install hook, run npm install ..."
[
-s
"./package.json"
]
||
fatal
"
$RGD
/package.json is missed"
# CHECKME: drop postinstall due run dev scripts during install --production
# CHECKME: drop postinstall due run dev scripts during install --production
# replace with fake commands?
# replace with fake commands?
if
[
-s
$RGD
/.gear/
npm
-preinstall-hook
]
;
then
if
[
-s
$RGD
/.gear/
predownloaded
-preinstall-hook
]
;
then
sh
$RGD
/.gear/
npm-preinstall-hook
sh
$RGD
/.gear/
predownloaded-preinstall-hook
$MODE
fi
fi
local
COMMITMSG
=
''
#subst "s|.*postinstall.*||g" package.json
#subst "s|.*postinstall.*||g" package.json
if
[
"
$MODE
"
=
"production"
]
;
then
a
=
npm
install
--production
||
fatal
a
=
npm
install
--production
||
fatal
COMMITMSG
=
"update node_modules with npm install --production for
$VERSION
(see
$SDNAME
in .gear/rules)"
else
a
=
npm
install
||
fatal
COMMITMSG
=
"update node_modules with npm install for
$VERSION
(see
$SDNAME
in .gear/rules)"
fi
# drop all exclude node_modules
# drop all exclude node_modules
# TODO: correct .* removing
# TODO: correct .* removing
rm
-rf
$(
ls
-1
|
grep
-v
node_modules
)
.
*
rm
-rf
$(
ls
-1
|
grep
-v
node_modules
)
.
*
#epm assure jq || fatal
#(cd node_modules && rm -rf $(jq -r -c '.devDependencies | keys[]' ../package.json))
cd
-
>
/dev/null
docmd git add
-f
$PSM
docmd git commit
$PSM
-m
"update node_modules with npm install --production for
$VERSION
"
}
# note: for tarball based only now
# uses: BASENAME VERSION
update_gear_sources
()
{
is_gear_sources
||
return
PSM
=
$(
get_root_git_dir
)
/.gear/gear-sources
# npm install section
local
RGD
=
$(
get_root_git_dir
)
#if [ -d $PSM ] ; then
# only npm supported now
info
"Detected npm install hook, run npm install ..."
# if [ -d $RGD/package ] && [ -s $RGD/package/package.json ] ; then
if
[
-s
$RGD
/.gear/predownloaded-postinstall-hook
]
;
then
# info "Detected npm install hook"
sh
$RGD
/.gear/predownloaded-postinstall-hook
$MODE
# hack: try detect dir for unpacking
#test -d "$CURNAME" || CURNAME=$(get_tarballname "$spec")
#test -d "$CURNAME" || CURNAME=$BASENAME
# see in commit_tarball also
CURNAME
=
$BASENAME
# TODO: add support for git
rm
-rf
$PSM
if
[
-n
"
$GETSOURCEGIT
"
]
;
then
# cp -a exclude .dir
mkdir
-p
$PSM
||
fatal
cp
-a
$RGD
/
*
$PSM
||
fatal
else
cp
-a
$RGD
/
$CURNAME
$PSM
||
fatal
fi
fi
cd
$PSM
||
fatal
# CHECKME: drop postinstall due run dev scripts during install --production
# replace with fake commands?
if
[
-s
$RGD
/.gear/npm-preinstall-hook
]
;
then
sh
$RGD
/.gear/npm-preinstall-hook
fi
#subst "s|.*postinstall.*||g" package.json
#a= npm install --production || fatal
a
=
npm
install
||
fatal
# drop all exclude node_modules
# TODO: correct .* removing
rm
-rf
$(
ls
-1
|
grep
-v
node_modules
)
.
*
#epm assure jq || fatal
#epm assure jq || fatal
#(cd node_modules && rm -rf $(jq -r -c '.devDependencies | keys[]' ../package.json))
#(cd node_modules && rm -rf $(jq -r -c '.devDependencies | keys[]' ../package.json))
cd
-
>
/dev/null
cd
-
>
/dev/null
docmd git add
-f
$PSM
docmd git add
-f
$PSM
docmd git commit
$PSM
-m
"update node_modules with npm install for
$VERSION
"
docmd git commit
$PSM
-m
"
$COMMITMSG
"
#+fi
}
}
parse_cmd_pre_spec
"
$@
"
parse_cmd_pre_spec
"
$@
"
mygetopts
$LISTARGS
mygetopts
$LISTARGS
...
@@ -571,8 +532,8 @@ do
...
@@ -571,8 +532,8 @@ do
update_post_git_submodules
update_post_git_submodules
# TODO: make plugins
# TODO: make plugins
update_
gear_sources
update_
predownloaded development
update_
gear_
production
update_
predownloaded
production
#docmd gammit
#docmd gammit
#docmd git commit -m "merge $FTB with rpmgs script"
#docmd git commit -m "merge $FTB with rpmgs script"
...
@@ -580,8 +541,8 @@ do
...
@@ -580,8 +541,8 @@ do
elif
is_gear
;
then
elif
is_gear
;
then
commit_tarball
"
$FTB
"
commit_tarball
"
$FTB
"
# TODO: make plugins
# TODO: make plugins
update_
gear_sources
update_
predownloaded development
update_
gear_
production
update_
predownloaded
production
DOWNLOADSOME
=
1
DOWNLOADSOME
=
1
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment