2012-12-26 17:07:30 +04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-07-29 10:35:55 +04:00
|
|
|
"fmt"
|
2013-04-08 23:45:13 +04:00
|
|
|
"goposm/cache"
|
2013-07-08 10:34:23 +04:00
|
|
|
"goposm/config"
|
2013-05-15 15:00:42 +04:00
|
|
|
"goposm/database"
|
|
|
|
_ "goposm/database/postgis"
|
2013-07-29 10:18:08 +04:00
|
|
|
"goposm/diff"
|
2013-07-19 11:35:21 +04:00
|
|
|
state "goposm/diff/state"
|
2013-07-30 10:17:47 +04:00
|
|
|
"goposm/geom/limit"
|
2013-05-23 19:53:58 +04:00
|
|
|
"goposm/logging"
|
2013-05-14 12:04:11 +04:00
|
|
|
"goposm/mapping"
|
2013-07-19 11:28:46 +04:00
|
|
|
"goposm/parser/pbf"
|
2013-05-21 11:07:37 +04:00
|
|
|
"goposm/reader"
|
2013-05-06 13:03:52 +04:00
|
|
|
"goposm/stats"
|
2013-05-14 18:15:35 +04:00
|
|
|
"goposm/writer"
|
2013-05-23 19:53:58 +04:00
|
|
|
golog "log"
|
2013-05-02 22:37:31 +04:00
|
|
|
"os"
|
2013-07-19 11:28:46 +04:00
|
|
|
"path"
|
2013-04-08 23:45:13 +04:00
|
|
|
"runtime"
|
2013-05-02 22:37:31 +04:00
|
|
|
"runtime/pprof"
|
2013-05-13 12:21:12 +04:00
|
|
|
"strings"
|
|
|
|
"time"
|
2012-12-26 17:07:30 +04:00
|
|
|
)
|
|
|
|
|
2013-05-23 19:53:58 +04:00
|
|
|
var log = logging.NewLogger("")
|
|
|
|
|
2013-07-26 17:59:03 +04:00
|
|
|
func reportErrors(errs []error) {
|
2013-07-29 10:35:55 +04:00
|
|
|
fmt.Println("errors in config/options:")
|
2013-07-26 17:59:03 +04:00
|
|
|
for _, err := range errs {
|
2013-07-29 10:35:55 +04:00
|
|
|
fmt.Printf("\t%s\n", err)
|
2013-07-26 17:59:03 +04:00
|
|
|
}
|
|
|
|
logging.Shutdown()
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2013-07-29 10:35:55 +04:00
|
|
|
func printCmds() {
|
|
|
|
fmt.Println("available commands:")
|
|
|
|
fmt.Println("\timport")
|
|
|
|
fmt.Println("\tdiff")
|
|
|
|
}
|
|
|
|
|
2012-12-26 17:07:30 +04:00
|
|
|
func main() {
|
2013-07-25 13:28:16 +04:00
|
|
|
|
2013-05-23 19:53:58 +04:00
|
|
|
golog.SetFlags(golog.LstdFlags | golog.Lshortfile)
|
2013-06-20 19:08:48 +04:00
|
|
|
if os.Getenv("GOMAXPROCS") == "" {
|
|
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
|
}
|
2013-07-25 13:28:16 +04:00
|
|
|
|
|
|
|
if len(os.Args) <= 1 {
|
2013-07-29 10:35:55 +04:00
|
|
|
printCmds()
|
|
|
|
logging.Shutdown()
|
2013-07-25 13:28:16 +04:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
switch os.Args[1] {
|
|
|
|
case "import":
|
2013-07-26 17:59:03 +04:00
|
|
|
errs := config.ParseImport(os.Args[2:])
|
|
|
|
if len(errs) > 0 {
|
2013-07-29 10:35:55 +04:00
|
|
|
config.ImportFlags.PrintDefaults()
|
2013-07-26 17:59:03 +04:00
|
|
|
reportErrors(errs)
|
|
|
|
break
|
|
|
|
}
|
|
|
|
mainimport()
|
2013-07-25 13:28:16 +04:00
|
|
|
case "diff":
|
2013-07-26 17:59:03 +04:00
|
|
|
errs := config.ParseDiffImport(os.Args[2:])
|
|
|
|
if len(errs) > 0 {
|
2013-07-29 10:35:55 +04:00
|
|
|
config.DiffImportFlags.PrintDefaults()
|
2013-07-26 17:59:03 +04:00
|
|
|
reportErrors(errs)
|
|
|
|
break
|
|
|
|
}
|
2013-07-30 10:17:47 +04:00
|
|
|
var geometryLimiter *limit.Limiter
|
2013-07-29 19:03:15 +04:00
|
|
|
if config.DiffImportOptions.Base.LimitTo != "" {
|
|
|
|
var err error
|
|
|
|
step := log.StartStep("Reading limitto geometries")
|
2013-07-30 10:30:06 +04:00
|
|
|
geometryLimiter, err = limit.NewFromOgrSourceWithBuffered(
|
|
|
|
config.DiffImportOptions.Base.LimitTo,
|
|
|
|
config.DiffImportOptions.Base.LimitToCacheBuffer,
|
|
|
|
)
|
2013-07-29 19:03:15 +04:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
log.StopStep(step)
|
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
for _, oscFile := range config.DiffImportFlags.Args() {
|
2013-07-30 10:17:47 +04:00
|
|
|
diff.Update(oscFile, geometryLimiter, false)
|
2013-07-25 13:28:16 +04:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
log.Fatal("invalid command")
|
|
|
|
}
|
|
|
|
logging.Shutdown()
|
|
|
|
os.Exit(0)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-07-26 17:59:03 +04:00
|
|
|
func mainimport() {
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Cpuprofile != "" {
|
|
|
|
f, err := os.Create(config.ImportOptions.Cpuprofile)
|
2013-05-05 22:14:39 +04:00
|
|
|
if err != nil {
|
2013-05-23 19:53:58 +04:00
|
|
|
golog.Fatal(err)
|
2013-05-05 22:14:39 +04:00
|
|
|
}
|
|
|
|
pprof.StartCPUProfile(f)
|
|
|
|
defer pprof.StopCPUProfile()
|
2013-05-02 22:37:31 +04:00
|
|
|
}
|
2013-05-05 22:14:39 +04:00
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Httpprofile != "" {
|
|
|
|
stats.StartHttpPProf(config.ImportOptions.Httpprofile)
|
2013-05-30 18:18:48 +04:00
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Memprofile != "" {
|
|
|
|
parts := strings.Split(config.ImportOptions.Memprofile, string(os.PathListSeparator))
|
2013-05-13 12:21:12 +04:00
|
|
|
var interval time.Duration
|
|
|
|
|
|
|
|
if len(parts) < 2 {
|
|
|
|
interval, _ = time.ParseDuration("1m")
|
|
|
|
} else {
|
|
|
|
var err error
|
|
|
|
interval, err = time.ParseDuration(parts[1])
|
|
|
|
if err != nil {
|
2013-05-23 19:53:58 +04:00
|
|
|
golog.Fatal(err)
|
2013-05-13 12:21:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
go stats.MemProfiler(parts[0], interval)
|
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Quiet {
|
2013-05-29 16:19:47 +04:00
|
|
|
logging.SetQuiet(true)
|
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if (config.ImportOptions.Write || config.ImportOptions.Read != "") && (config.ImportOptions.RevertDeploy || config.ImportOptions.RemoveBackup) {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("-revertdeploy and -removebackup not compatible with -read/-write")
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.RevertDeploy && (config.ImportOptions.RemoveBackup || config.ImportOptions.DeployProduction) {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("-revertdeploy not compatible with -deployproduction/-removebackup")
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
|
|
|
|
2013-07-30 10:17:47 +04:00
|
|
|
var geometryLimiter *limit.Limiter
|
2013-07-26 17:59:03 +04:00
|
|
|
if config.ImportOptions.Write && config.ImportOptions.Base.LimitTo != "" {
|
2013-05-28 10:59:59 +04:00
|
|
|
var err error
|
2013-05-28 18:06:52 +04:00
|
|
|
step := log.StartStep("Reading limitto geometries")
|
2013-07-30 10:17:47 +04:00
|
|
|
geometryLimiter, err = limit.NewFromOgrSource(config.ImportOptions.Base.LimitTo)
|
2013-05-28 10:59:59 +04:00
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-28 10:59:59 +04:00
|
|
|
}
|
2013-05-28 18:06:52 +04:00
|
|
|
log.StopStep(step)
|
2013-05-28 10:59:59 +04:00
|
|
|
}
|
|
|
|
|
2013-07-26 17:59:03 +04:00
|
|
|
tagmapping, err := mapping.NewMapping(config.ImportOptions.Base.MappingFile)
|
2013-05-13 15:58:44 +04:00
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("mapping file: ", err)
|
2013-05-13 15:58:44 +04:00
|
|
|
}
|
|
|
|
|
2013-05-22 10:36:37 +04:00
|
|
|
var db database.DB
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Write || config.ImportOptions.DeployProduction || config.ImportOptions.RevertDeploy || config.ImportOptions.RemoveBackup || config.ImportOptions.Optimize {
|
2013-07-26 17:59:03 +04:00
|
|
|
connType := database.ConnectionType(config.ImportOptions.Base.Connection)
|
2013-05-22 10:36:37 +04:00
|
|
|
conf := database.Config{
|
|
|
|
Type: connType,
|
2013-07-26 17:59:03 +04:00
|
|
|
ConnectionParams: config.ImportOptions.Base.Connection,
|
|
|
|
Srid: config.ImportOptions.Base.Srid,
|
2013-05-22 10:36:37 +04:00
|
|
|
}
|
|
|
|
db, err = database.Open(conf, tagmapping)
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 10:36:37 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-29 11:31:08 +04:00
|
|
|
osmCache := cache.NewOSMCache(config.ImportOptions.Base.CacheDir)
|
|
|
|
|
|
|
|
if config.ImportOptions.Read != "" && osmCache.Exists() {
|
|
|
|
if config.ImportOptions.Overwritecache {
|
|
|
|
log.Printf("removing existing cache %s", config.ImportOptions.Base.CacheDir)
|
|
|
|
err := osmCache.Remove()
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("unable to remove cache:", err)
|
2013-07-29 11:31:08 +04:00
|
|
|
}
|
|
|
|
} else if !config.ImportOptions.Appendcache {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("cache already exists use -appendcache or -overwritecache")
|
2013-07-29 11:31:08 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-28 16:42:14 +04:00
|
|
|
step := log.StartStep("Imposm")
|
|
|
|
|
2013-07-29 17:47:09 +04:00
|
|
|
var elementCounts *stats.ElementCounts
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Read != "" {
|
2013-05-28 16:42:14 +04:00
|
|
|
step := log.StartStep("Reading OSM data")
|
2013-06-20 11:21:30 +04:00
|
|
|
err = osmCache.Open()
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-06-20 11:21:30 +04:00
|
|
|
}
|
2013-07-29 17:47:09 +04:00
|
|
|
progress := stats.NewStatsReporter()
|
2013-07-19 11:28:46 +04:00
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
pbfFile, err := pbf.Open(config.ImportOptions.Read)
|
2013-07-19 11:28:46 +04:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2013-05-13 10:08:52 +04:00
|
|
|
osmCache.Coords.SetLinearImport(true)
|
2013-07-19 11:28:46 +04:00
|
|
|
reader.ReadPbf(osmCache, progress, tagmapping, pbfFile)
|
2013-05-13 10:08:52 +04:00
|
|
|
osmCache.Coords.SetLinearImport(false)
|
2013-07-29 17:47:09 +04:00
|
|
|
elementCounts = progress.Stop()
|
2013-06-20 11:21:30 +04:00
|
|
|
osmCache.Close()
|
2013-05-28 16:42:14 +04:00
|
|
|
log.StopStep(step)
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Diff {
|
2013-07-19 11:35:21 +04:00
|
|
|
diffstate := state.FromPbf(pbfFile)
|
|
|
|
if diffstate != nil {
|
2013-07-26 17:59:03 +04:00
|
|
|
diffstate.WriteToFile(path.Join(config.ImportOptions.Base.CacheDir, "last.state.txt"))
|
2013-07-19 11:28:46 +04:00
|
|
|
}
|
|
|
|
}
|
2013-05-06 14:51:30 +04:00
|
|
|
}
|
2013-05-02 22:37:31 +04:00
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Write {
|
2013-05-28 16:42:14 +04:00
|
|
|
stepImport := log.StartStep("Importing OSM data")
|
|
|
|
stepWrite := log.StartStep("Writing OSM data")
|
2013-07-29 17:47:09 +04:00
|
|
|
progress := stats.NewStatsReporterWithEstimate(elementCounts)
|
|
|
|
|
2013-05-28 16:42:14 +04:00
|
|
|
err = db.Init()
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-28 16:42:14 +04:00
|
|
|
}
|
2013-06-11 16:12:45 +04:00
|
|
|
|
2013-06-21 12:33:49 +04:00
|
|
|
bulkDb, ok := db.(database.BulkBeginner)
|
|
|
|
if ok {
|
|
|
|
err = bulkDb.BeginBulk()
|
|
|
|
} else {
|
|
|
|
err = db.Begin()
|
|
|
|
}
|
2013-06-11 16:12:45 +04:00
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-06-11 16:12:45 +04:00
|
|
|
}
|
2013-05-22 13:48:34 +04:00
|
|
|
|
2013-06-21 12:33:49 +04:00
|
|
|
var diffCache *cache.DiffCache
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Diff {
|
2013-07-26 17:59:03 +04:00
|
|
|
diffCache = cache.NewDiffCache(config.ImportOptions.Base.CacheDir)
|
2013-05-30 14:00:11 +04:00
|
|
|
if err = diffCache.Remove(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-30 14:00:11 +04:00
|
|
|
}
|
|
|
|
if err = diffCache.Open(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-30 14:00:11 +04:00
|
|
|
}
|
2013-05-28 16:42:14 +04:00
|
|
|
}
|
|
|
|
|
2013-06-20 11:21:30 +04:00
|
|
|
err = osmCache.Open()
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-06-20 11:21:30 +04:00
|
|
|
}
|
|
|
|
osmCache.Coords.SetReadOnly(true)
|
2013-05-28 16:42:14 +04:00
|
|
|
pointsTagMatcher := tagmapping.PointMatcher()
|
|
|
|
lineStringsTagMatcher := tagmapping.LineStringMatcher()
|
|
|
|
polygonsTagMatcher := tagmapping.PolygonMatcher()
|
|
|
|
|
|
|
|
relations := osmCache.Relations.Iter()
|
2013-05-30 18:04:14 +04:00
|
|
|
relWriter := writer.NewRelationWriter(osmCache, diffCache, relations,
|
2013-07-26 17:59:03 +04:00
|
|
|
db, polygonsTagMatcher, progress, config.ImportOptions.Base.Srid)
|
2013-07-30 10:17:47 +04:00
|
|
|
relWriter.SetLimiter(geometryLimiter)
|
2013-05-28 16:42:14 +04:00
|
|
|
relWriter.Start()
|
|
|
|
|
|
|
|
// blocks till the Relations.Iter() finishes
|
|
|
|
relWriter.Close()
|
2013-06-20 11:21:30 +04:00
|
|
|
osmCache.Relations.Close()
|
2013-05-28 16:42:14 +04:00
|
|
|
|
|
|
|
ways := osmCache.Ways.Iter()
|
2013-06-11 16:12:45 +04:00
|
|
|
wayWriter := writer.NewWayWriter(osmCache, diffCache, ways, db,
|
2013-07-26 17:59:03 +04:00
|
|
|
lineStringsTagMatcher, polygonsTagMatcher, progress, config.ImportOptions.Base.Srid)
|
2013-07-30 10:17:47 +04:00
|
|
|
wayWriter.SetLimiter(geometryLimiter)
|
2013-05-28 16:42:14 +04:00
|
|
|
wayWriter.Start()
|
|
|
|
|
2013-06-05 15:27:10 +04:00
|
|
|
// blocks till the Ways.Iter() finishes
|
|
|
|
wayWriter.Close()
|
2013-06-20 11:21:30 +04:00
|
|
|
osmCache.Ways.Close()
|
2013-06-05 15:27:10 +04:00
|
|
|
|
2013-05-28 16:42:14 +04:00
|
|
|
nodes := osmCache.Nodes.Iter()
|
2013-06-11 16:12:45 +04:00
|
|
|
nodeWriter := writer.NewNodeWriter(osmCache, nodes, db,
|
2013-07-26 17:59:03 +04:00
|
|
|
pointsTagMatcher, progress, config.ImportOptions.Base.Srid)
|
2013-07-30 10:17:47 +04:00
|
|
|
nodeWriter.SetLimiter(geometryLimiter)
|
2013-05-28 16:42:14 +04:00
|
|
|
nodeWriter.Start()
|
|
|
|
|
2013-06-05 15:27:10 +04:00
|
|
|
// blocks till the Nodes.Iter() finishes
|
2013-05-28 16:42:14 +04:00
|
|
|
nodeWriter.Close()
|
2013-06-20 12:34:22 +04:00
|
|
|
osmCache.Close()
|
2013-06-05 15:27:10 +04:00
|
|
|
|
2013-06-11 16:12:45 +04:00
|
|
|
err = db.End()
|
|
|
|
if err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-06-11 16:12:45 +04:00
|
|
|
}
|
|
|
|
|
2013-05-28 16:42:14 +04:00
|
|
|
progress.Stop()
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Diff {
|
2013-05-30 14:00:11 +04:00
|
|
|
diffCache.Close()
|
|
|
|
}
|
|
|
|
|
2013-05-28 16:42:14 +04:00
|
|
|
log.StopStep(stepWrite)
|
2013-05-15 15:21:31 +04:00
|
|
|
|
2013-05-22 13:48:34 +04:00
|
|
|
if db, ok := db.(database.Generalizer); ok {
|
|
|
|
if err := db.Generalize(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 13:48:34 +04:00
|
|
|
}
|
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not generalizeable")
|
2013-05-22 13:48:34 +04:00
|
|
|
}
|
2013-05-22 11:49:03 +04:00
|
|
|
|
|
|
|
if db, ok := db.(database.Finisher); ok {
|
|
|
|
if err := db.Finish(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not finishable")
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
2013-05-28 16:42:14 +04:00
|
|
|
log.StopStep(stepImport)
|
2013-05-22 10:36:37 +04:00
|
|
|
}
|
2013-05-15 15:21:31 +04:00
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.Optimize {
|
2013-07-04 13:26:53 +04:00
|
|
|
if db, ok := db.(database.Optimizer); ok {
|
|
|
|
if err := db.Optimize(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-07-04 13:26:53 +04:00
|
|
|
}
|
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not optimizable")
|
2013-07-04 13:26:53 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.DeployProduction {
|
2013-05-22 10:36:37 +04:00
|
|
|
if db, ok := db.(database.Deployer); ok {
|
2013-05-22 11:49:03 +04:00
|
|
|
if err := db.Deploy(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
2013-05-22 10:36:37 +04:00
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not deployable")
|
2013-05-22 10:36:37 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.RevertDeploy {
|
2013-05-22 10:36:37 +04:00
|
|
|
if db, ok := db.(database.Deployer); ok {
|
2013-05-22 11:49:03 +04:00
|
|
|
if err := db.RevertDeploy(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
2013-05-22 10:36:37 +04:00
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not deployable")
|
2013-05-22 10:36:37 +04:00
|
|
|
}
|
2013-05-02 22:37:31 +04:00
|
|
|
}
|
2013-05-22 10:46:39 +04:00
|
|
|
|
2013-07-25 13:28:16 +04:00
|
|
|
if config.ImportOptions.RemoveBackup {
|
2013-05-22 10:46:39 +04:00
|
|
|
if db, ok := db.(database.Deployer); ok {
|
2013-05-22 11:49:03 +04:00
|
|
|
if err := db.RemoveBackup(); err != nil {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal(err)
|
2013-05-22 11:49:03 +04:00
|
|
|
}
|
2013-05-22 10:46:39 +04:00
|
|
|
} else {
|
2013-07-29 11:34:00 +04:00
|
|
|
log.Fatal("database not deployable")
|
2013-05-22 10:46:39 +04:00
|
|
|
}
|
|
|
|
}
|
2013-05-28 16:42:14 +04:00
|
|
|
|
|
|
|
log.StopStep(step)
|
2013-05-06 14:51:30 +04:00
|
|
|
|
2012-12-26 17:07:30 +04:00
|
|
|
}
|