Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pcy
sspt
Commits
19755d21
Commit
19755d21
authored
Jul 23, 2017
by
PoroCYon
Browse files
added some switches, other stuff
parent
a7388635
Changes
19
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
19755d21
...
...
@@ -18,7 +18,7 @@ packages to happen.
*
`coreutils`
*
`bash`
*
`strace`
*
[
`strace`
](
https://gitlab.com/PoroCYon/sspt/blob/master/local/libexec/sspt/sspt-strace
)
### Optional
...
...
@@ -172,7 +172,7 @@ I'm ***NOT*** open to adding dependency management and other fancy stuff.
I'm
***NOT**
*
open to rewriting it in
`<insert language here>`
because
shell scritps are slow/ugly/not even a real language/... . sspt isn't meant
to be professional, or
look like something 'real'
.
to be professional, or
pretend to
.
## License
...
...
local/libexec/sspt/sspt-autogen
View file @
19755d21
...
...
@@ -3,10 +3,11 @@
print_help
()
{
(>
&2
cat
<<
EOF
Autogenerate an .sspt file for a package.
Usage:
$0
[-h|-?|--help]
Usage:
sspt autogen
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
Generate the .sspt file for this package.
- sspt autogen {-e|--edit} <package-name>
Generate the .sspt file for this package and optionally edit
it afterwards.
Supported VCSes: git, hg, svn, cvs, bzr, mtn, darcs
Supported build systems: npm, cargo, setuptools, idris, xbuild, stack,
cabal, scons, gradle, sbt, bazel, meson, ninja, ant, mvn, cmake,
...
...
@@ -125,8 +126,8 @@ autogen_vcs() {
elif
[
-d
"_darcs/"
]
;
then
autogen_darcs
else
(>
&2
echo
"NOTE: could not detect repository type
, add the .sspt
"
\
"file to make updating this pacakge possible."
)
(>
&2
echo
"NOTE: could not detect repository type
of package
"
\
"
'
$1
', add the .sspt
file to make updating this pacakge possible."
)
# no upstream?
cat
>>
".sspt"
<<
EOF
sspt_pull() {
...
...
@@ -563,7 +564,7 @@ EOF
DONT_LOOK_INTO_BUILD
=
1 autogen_buildsys
return
$?
else
(>
&2
echo
"Could not detect how to compile
the
package
.
"
)
(>
&2
echo
"Could not detect how to compile package
'
$1
'.
"
)
return
1
fi
...
...
@@ -575,8 +576,8 @@ EOF
autogen_cwd
()
{
touch
".sspt"
#echo "name=\"$(basename `pwd`)\"" >> ".sspt"
autogen_vcs
autogen_buildsys
autogen_vcs
"
$1
"
autogen_buildsys
"
$1
"
return
$?
}
...
...
@@ -587,6 +588,15 @@ main() {
-h
|
-?|--help
)
print_help
;;
-e
|
--edit
)
if
[
-z
"
$2
"
]
;
then
print_help
exit
fi
main
"
$2
"
exec_subcommand edit
"
$2
"
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"Package '
$1
' doesn't exist."
)
...
...
@@ -596,7 +606,7 @@ main() {
local
PACKAGE_DIR
=
"
$SSPT_DL_DIR
/
$ESCAPED_PKG
"
pushd
"
$PACKAGE_DIR
"
>
/dev/null
autogen_cwd
autogen_cwd
"
$1
"
local
RETVAL
=
$?
popd
>
/dev/null
exit
$RETVAL
...
...
local/libexec/sspt/sspt-bin-db
View file @
19755d21
...
...
@@ -3,15 +3,15 @@
print_help
()
{
(>
&2
cat
<<
EOF
Modify the database of installed binaries.
Usage:
$0
-h|-?|--help
Usage:
sspt bin-db
-h|-?|--help
Print this help text and exit.
-
$0
exists <package-name>
-
sspt bin-db
exists <package-name>
Check whether the package has been installed. The exit code
is set to 0 if the package exists, and 1 otherwise.
-
$0
reg(ister) <package-name> <file containing the list of files the package owns>
-
sspt bin-db
reg(ister) <package-name> <file containing the list of files the package owns>
Add the package to the list of registered packages.
Use
\`
sspt add
\`
to actually install the package.
-
$0
unreg(ister) <package-name>
-
sspt bin-db
unreg(ister) <package-name>
Remove the package from the list of registered packages.
NOTE: this subcommand is supposed to be used only by ssbt internally.
Proceed with caution.
...
...
local/libexec/sspt/sspt-build
View file @
19755d21
...
...
@@ -3,26 +3,37 @@
print_help
()
{
(>
&2
cat
<<
EOF
Build a package.
Usage:
$0
[-h|-?|--help]
Usage:
sspt build
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
Build the package.
-
sspt build {-c|--configure}
<package-name>
Build the package.
Optionally configure it as well.
EOF
)
}
DO_CONFIG
=
'auto'
main
()
{
case
$1
in
-h
|
-?|--help
)
print_help
;;
-c
|
--configure
)
DO_CONFIG
=
'y'
local
ALLARGS
=(
"
$@
"
)
main
"
${
ALLARGS
[@]
:1
}
"
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
# TODO: download if URL specified
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
exit
1
fi
# assume it is already configured
if
[
"
$DO_CONFIG
"
=
"y"
]
;
then
exec_subcommand pkgcmd configure
"
$1
"
fi
exec_subcommand pkgcmd build
"
$1
"
;;
esac
...
...
local/libexec/sspt/sspt-clean
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Clean a package.
Usage:
$0
[-h|-?|--help]
Usage:
sspt clean
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt clean
<package-name>
Clean the package.
EOF
)
...
...
@@ -18,7 +18,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
exit
1
fi
exec_subcommand pkgcmd clean
"
$1
"
...
...
local/libexec/sspt/sspt-clean-config
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Clean a package, including all configuration files.
Usage:
$0
[-h|-?|--help]
Usage:
sspt clean-config
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt clean-config
<package-name>
Clean the package.
EOF
)
...
...
@@ -18,7 +18,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This
package doesn't exist."
)
(>
&2
echo
"
Package '
$1
'
package doesn't exist."
)
exit
1
fi
exec_subcommand pkgcmd clean_config
"
$1
"
...
...
local/libexec/sspt/sspt-configure
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Configure a pacakge.
Usage:
$0
[-h|-?|--help]
Usage:
sspt configure
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt configure
<package-name>
Configure the package.
EOF
)
...
...
local/libexec/sspt/sspt-edit
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Edit the .sspt file of a package.
Usage:
$0
[-h|-?|--help]
Usage:
sspt edit
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt edit
<package-name>
Edit the .sspt file of the package using
\$
EDITOR.
EOF
)
...
...
local/libexec/sspt/sspt-install
View file @
19755d21
...
...
@@ -3,22 +3,66 @@
print_help
()
{
(>
&2
cat
<<
EOF
Install a package's binary files.
Usage:
$0
[-h|-?|--help]
Usage:
sspt install
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
Install the binary files of this package.
- sspt install {-f|--configure} {-b|--build } {-c|--clean}
{-C|--clean-cfg} <package-name>
Install the binary files of this package. Optionally configure,
build or clean it as well. (-C implies -c.)
EOF
)
}
DO_CONF
=
'auto'
DO_BUILD
=
'auto'
DO_CLEAN
=
'auto'
DO_CCFG
=
'auto'
main
()
{
local
ALLARGS
=(
"
$@
"
)
case
$1
in
-h
|
-?|--help
)
print_help
;;
-f
|
--configure
)
DO_CONF
=
'y'
main
"
${
ALLARGS
[@]
:1
}
"
;;
-b
|
--build
)
DO_BUILD
=
'y'
main
"
${
ALLARGS
[@]
:1
}
"
;;
-c
|
--clean
)
DO_CLEAN
=
'y'
main
"
${
ALLARGS
[@]
:1
}
"
;;
-C
|
--clean-cfg
)
DO_CLEAN
=
'y'
DO_CCFG
=
'y'
main
"
${
ALLARGS
[@]
:1
}
"
;;
*
)
# TODO: other stuff
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"Package '
$1
' doesn't exist."
)
exit
1
fi
if
[
"
$DO_CONF
"
=
"y"
]
;
then
exec_subcommand pkgcmd config
"
$1
"
fi
if
[
"
$DO_BUILD
"
=
"y"
]
;
then
exec_subcommand pkgcmd build
"
$1
"
fi
exec_subcommand strace
"
$1
"
if
[
"
$DO_CLEAN
"
=
"y"
]
;
then
exec_subcommand pkgcmd clean
"
$1
"
fi
if
[
"
$DO_CCFG
"
=
"y"
]
;
then
exec_subcommand pkgcmd clean_config
"
$1
"
fi
;;
esac
}
...
...
local/libexec/sspt/sspt-list
View file @
19755d21
...
...
@@ -3,11 +3,11 @@
print_help
()
{
(>
&2
cat
<<
EOF
List pulled and installed pacakges.
Usage:
$0
[-h|-?|--help]
Usage:
sspt list
[-h|-?|--help]
Print this help text and exit.
-
$0
List all packages
.
-
$0
[-i|--installed-only]
-
sspt list {-i|--installed-only|--only-installed}
List all packages
, optionally only displaying those that
are installed through
\`
sspt install
\`
.
EOF
)
}
...
...
local/libexec/sspt/sspt-orphanize
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Purge a package without deleting the installed binaries.
Usage:
$0
[-h|-?|--help]
Usage:
sspt orphanize
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt orphanize
<package-name>
Orphanize the package.
EOF
)
...
...
@@ -25,7 +25,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
exit
1
fi
...
...
@@ -33,7 +33,7 @@ main() {
if
exec_subcommand bin-db exists
"
$1
"
;
then
exec_subcommand bin-db unreg
"
$1
"
else
(>
&2
echo
"
This p
ackage isn't installed."
)
(>
&2
echo
"
P
ackage
'
$1
'
isn't installed."
)
exit
1
fi
...
...
local/libexec/sspt/sspt-pkgcmd
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Directly execute a command from a package's .sspt file.
Usage:
$0
[-h|-?|--help]
Usage:
sspt pkgcmd
[-h|-?|--help]
Print this help text and exit.
-
$0
<command> <package-name>
-
sspt pkgcmd
<command> <package-name>
Run <command> on the specified package.
NOTE: this subcommand is supposed to be used only by ssbt internally.
Proceed with caution.
...
...
@@ -27,7 +27,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$2
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$2
'
doesn't exist."
)
exit
1
fi
...
...
local/libexec/sspt/sspt-pull
View file @
19755d21
...
...
@@ -3,11 +3,17 @@
print_help
()
{
(>
&2
cat
<<
EOF
Pull the source code of a package from a remote location.
Usage:
$0
[-h|-?|--help]
Usage:
sspt pull
[-h|-?|--help]
Print this help text and exit.
-
$0
{--<vcs>} <repo url>
- sspt pull {-n|--no-autogen} {-f|--force-autogen} {-e|--edit}
{-b|--build} {-i|--install} {--<vcs>} <repo url>
Add the repo to the database and download the source code.
Optionally, the VCS type can be specified.
Optionally, the VCS type, whether to autogenerate the
.sspt file (-n, -f, defaults to generate if none exists),
whether to edit the .sspt file afterwards (-e, defaults to
edit if autogeneration failed) and whether to build or install
the package afterwards (resp. -b and -i, default to false, -i
implies -b) can be specified.
Supported VCSes: git, hg, svn, cvs, bzr, mtn, darcs, http(s), rsync
(Those last two aren't VCSes, but you can get tarballs over them.)
EOF
...
...
@@ -78,11 +84,49 @@ pull_with_vcs() {
esac
}
DO_AUTOGEN
=
'auto'
DO_EDIT
=
'auto'
DO_BUILD
=
'auto'
DO_INSTALL
=
'auto'
main
()
{
local
ALL_ARGS
=(
"
$@
"
)
if
[
$#
-eq
0
]
;
then
print_help
exit
fi
case
$1
in
-h
|
-?|--help
)
print_help
;;
-n
|
--no-autogen
)
DO_AUTOGEN
=
'n'
main
"
${
ALL_ARGS
[@]
:1
}
"
exit
;;
-f
|
--force-autogen
)
DO_AUTOGEN
=
'y'
main
"
${
ALL_ARGS
[@]
:1
}
"
exit
;;
-e
|
--edit
)
DO_EDIT
=
'y'
main
"
${
ALL_ARGS
[@]
:1
}
"
exit
;;
-b
|
--build
)
DO_BUILD
=
'y'
main
"
${
ALL_ARGS
[@]
:1
}
"
exit
;;
-i
|
--install
)
DO_BUILD
=
'y'
DO_INSTALL
=
'y'
main
"
${
ALL_ARGS
[@]
:1
}
"
exit
;;
--
*
)
pull_with_vcs
"
${
1
:2
}
"
"
$2
"
;;
...
...
@@ -121,15 +165,34 @@ main() {
# need to register it before we can autogen the .sspt file
exec_subcommand src-db reg
"
$PKG_NAME
"
dummy_revision
if
!
[
-f
"
$SSPT_DL_DIR
/
$PKG_NAME
/.sspt"
]
;
then
if
[
"
$DO_AUTOGEN
"
=
"auto"
]
&&
!
[
-f
"{SSPT_DL_DIR:?}/
$PKG_NAME
/.sspt"
]
;
then
DO_AUTOGEN
=
'y'
fi
if
[
"
$DO_AUTOGEN
"
=
"y"
]
;
then
if
!
exec_subcommand autogen
"
$PKG_NAME
"
;
then
# autogen failed -> resorting to manual edit
exec_subcommand edit
"
$PKG_NAME
"
DO_EDIT
=
'y'
fi
fi
if
[
"
$DO_EDIT
"
=
"y"
]
;
then
exec_subcommand edit
"
$PKG_NAME
"
# assume the .sspt file exists and is well-formed
fi
# now set the version of the package in the DB
# (this is only possible because the .sspt file is generated)
exec_subcommand src-db reg
"
$PKG_NAME
"
"
$(
exec_subcommand pkgcmd version
"
$PKG_NAME
"
)
"
if
[
"
$DO_BUILD
"
=
"y"
]
;
then
exec_subcommand pkgcmd config
"
$PKG_NAME
"
exec_subcommand pkgcmd build
"
$PKG_NAME
"
fi
if
[
"
$DO_INSTALL
"
=
"y"
]
;
then
exec_subcommand strace
"
$PKG_NAME
"
fi
}
if
[
$#
-eq
0
]
;
then
...
...
local/libexec/sspt/sspt-purge
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Delete a package's installed binaries and its source code.
Usage:
$0
[-h|-?|--help]
Usage:
sspt purge
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt purge
<package-name>
Purge the package.
EOF
)
...
...
@@ -20,7 +20,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
exit
1
fi
...
...
local/libexec/sspt/sspt-src-db
View file @
19755d21
...
...
@@ -3,15 +3,15 @@
print_help
()
{
(>
&2
cat
<<
EOF
Modify the database of pulled source code.
Usage:
$0
-h|-?|--help
Usage:
sspt src-db
-h|-?|--help
Print this help text and exit.
-
$0
exists <package-name>
-
sspt src-db
exists <package-name>
Check whether the package has been pulled. The exit code
is set to 0 if the package exists, and 1 otherwise.
-
$0
reg(ister) <package-name> <current commit id>
-
sspt src-db
reg(ister) <package-name> <current commit id>
Add the package to the list of registered packages.
Use
\`
sspt pull
\`
to actually download the package.
-
$0
unreg(ister) <package-name>
-
sspt src-db
unreg(ister) <package-name>
Remove the package from the list of registered packages.
NOTE: this subcommand is supposed to be used only by ssbt internally.
Proceed with caution.
...
...
local/libexec/sspt/sspt-strace
View file @
19755d21
...
...
@@ -4,9 +4,9 @@ print_help() {
(>
&2
cat
<<
EOF
Use strace to record which files are installed by a 'make install'
command (or something similar).
Usage:
$0
[-h|-?-|--help]
Usage:
sspt strace
[-h|-?-|--help]
Print this help text and exit.
-
$0
<package name>
-
sspt strace
<package name>
Runs strace on
\`
pkgcmd install <package name>
\`
.
NOTE: this subcommand is supposed to be used only by ssbt internally.
Proceed with caution.
...
...
@@ -86,7 +86,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
unset
OUTFILE
exit
1
fi
...
...
local/libexec/sspt/sspt-uninstall
View file @
19755d21
...
...
@@ -3,9 +3,9 @@
print_help
()
{
(>
&2
cat
<<
EOF
Delete a package's installed binaries.
Usage:
$0
[-h|-?|--help]
Usage:
sspt uninstall
[-h|-?|--help]
Print this help text and exit.
-
$0
<package-name>
-
sspt uninstall
<package-name>
Uninstall the package.
EOF
)
...
...
@@ -37,7 +37,7 @@ main() {
;;
*
)
if
!
exec_subcommand src-db exists
"
$1
"
;
then
(>
&2
echo
"
This p
ackage doesn't exist."
)
(>
&2
echo
"
P
ackage
'
$1
'
doesn't exist."
)
exit
1
fi
...
...
local/libexec/sspt/sspt-update
View file @
19755d21
...
...
@@ -2,13 +2,13 @@
print_help
()
{
(>
&2
cat
<<
EOF
Update packages.
Usage:
$0
[-h|-?|--help]
Update (pull, build and install) packages. Only if a newer version
exists, the package is recompiled and reinstalled.
Usage: sspt update [-h|-?|--help]
Print this help text and exit.
-
$0
<package-name...>
Update the selected packages.
-
$0
Update all packages.
- sspt update <package-name...>
Update the selected packages. If none are given, all packages
are updated.
EOF
)
}
...
...
todo
View file @
19755d21
* (optionally in .sspt) no strace
* aliases (sspt rm foo)
* bulk operations (pull pkg0 pkg1 pkg2 ...)
* auto-execution of other subcmds
* install -> auto-pull, auto-configure, auto-build
* build -> auto-configure
* auto-pull ~everywhere if an '/' is in the name
* add more switches to subcommands
* autogen -> always edit
* pull -> no autogen
* pull -> always edit
* install -> clean?
* install with '/' in package -> pull etc.
* modularize sspt-autogen, sspt-pull for easier addition of other vcs
& build system types
* make it more portable
...
...
Write
Preview
Supports
Markdown
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