--- siegfried-1.1.0.orig/.pc/.quilt_patches +++ siegfried-1.1.0/.pc/.quilt_patches @@ -0,0 +1 @@ +/home/mdemeo/packaging/siegfried-1.1.0/debian/patches --- siegfried-1.1.0.orig/.pc/.quilt_series +++ siegfried-1.1.0/.pc/.quilt_series @@ -0,0 +1 @@ +series --- siegfried-1.1.0.orig/.pc/.version +++ siegfried-1.1.0/.pc/.version @@ -0,0 +1 @@ +2 --- siegfried-1.1.0.orig/.pc/applied-patches +++ siegfried-1.1.0/.pc/applied-patches @@ -0,0 +1,2 @@ +pronom_path.diff +fpr-tag.patch --- siegfried-1.1.0.orig/.pc/fpr-tag.patch/cmd/sf/fpr.go +++ siegfried-1.1.0/.pc/fpr-tag.patch/cmd/sf/fpr.go @@ -0,0 +1,98 @@ +// +build archivematica,linux + +// Copyright 2015 Richard Lehane. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "log" + "net" + "os" + "strings" + + "github.com/richardlehane/siegfried" + "github.com/richardlehane/siegfried/config" + "github.com/richardlehane/siegfried/pkg/pronom" +) + +var fprflag = flag.Bool("fpr", false, "start siegfried fpr server at "+config.Fpr()) + +func reply(s string) []byte { + if len(s) > 1024 { + return []byte(s[:1024]) + } + return []byte(s) +} + +func fpridentify(s *siegfried.Siegfried, path string) []byte { + fi, err := os.Open(path) + defer fi.Close() + if err != nil { + return reply("error: failed to open " + path + "; got " + err.Error()) + } + c, err := s.Identify(path, fi) + if err != nil { + return reply("error: failed to scan " + path + "; got " + err.Error()) + } + var ids []string + var warn string + for i := range c { + ids = append(ids, i.String()) + if len(ids) == 1 && ids[0] == "UNKNOWN" { + warn = i.(*pronom.Identification).Warning + } + } + switch len(ids) { + case 0: + return reply("error: scanning " + path + ": no puids returned") + case 1: + if ids[0] == "UNKNOWN" { + return reply("error: format unknown; got " + warn) + } + return reply(ids[0]) + default: + return reply("error: multiple formats returned; got " + strings.Join(ids, ", ")) + } +} + +func serveFpr(addr string, s *siegfried.Siegfried) { + // remove the address if it exists + if _, err := os.Stat(addr); err == nil { + os.Remove(addr) + } + uaddr, err := net.ResolveUnixAddr("unix", addr) + if err != nil { + log.Fatalf("FPR error: failed to get address: %v", err) + } + lis, err := net.ListenUnix("unix", uaddr) + if err != nil { + log.Fatalf("FPR error: failed to listen: %v", err) + } + defer os.Remove(addr) + buf := make([]byte, 4024) + for { + conn, err := lis.Accept() + if err != nil { + log.Fatalf("FPR error: bad connection: %v", err) + } + l, err := conn.Read(buf) + if err != nil { + conn.Write([]byte("error reading from connection: " + err.Error())) + } + conn.Write(fpridentify(s, string(buf[:l]))) + conn.Close() + } +} --- siegfried-1.1.0.orig/.pc/fpr-tag.patch/cmd/sf/nofpr.go +++ siegfried-1.1.0/.pc/fpr-tag.patch/cmd/sf/nofpr.go @@ -0,0 +1,26 @@ +// +build !archivematica !linux + +// Copyright 2015 Richard Lehane. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import "github.com/richardlehane/siegfried" + +var ( + fprcontent = false + fprflag *bool = &fprcontent +) + +func serveFpr(addr string, s *siegfried.Siegfried) {} --- siegfried-1.1.0.orig/.pc/pronom_path.diff/config/default.go +++ siegfried-1.1.0/.pc/pronom_path.diff/config/default.go @@ -0,0 +1,32 @@ +// +build !brew,!archivematica,!appengine + +// Copyright 2014 Richard Lehane. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "log" + "os/user" + "path/filepath" +) + +// the default Home location is a "siegfried" folder in the user's $HOME +func init() { + current, err := user.Current() + if err != nil { + log.Fatal(err) + } + siegfried.home = filepath.Join(current.HomeDir, "siegfried") +} --- siegfried-1.1.0.orig/cmd/sf/fpr.go +++ siegfried-1.1.0/cmd/sf/fpr.go @@ -1,4 +1,4 @@ -// +build archivematica,linux +// +build linux // Copyright 2015 Richard Lehane. All rights reserved. // --- siegfried-1.1.0.orig/cmd/sf/nofpr.go +++ siegfried-1.1.0/cmd/sf/nofpr.go @@ -1,4 +1,4 @@ -// +build !archivematica !linux +// +build !linux // Copyright 2015 Richard Lehane. All rights reserved. // --- siegfried-1.1.0.orig/config/default.go +++ siegfried-1.1.0/config/default.go @@ -1,32 +1,11 @@ // +build !brew,!archivematica,!appengine -// Copyright 2014 Richard Lehane. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package config -import ( - "log" - "os/user" - "path/filepath" -) - -// the default Home location is a "siegfried" folder in the user's $HOME func init() { - current, err := user.Current() - if err != nil { - log.Fatal(err) - } - siegfried.home = filepath.Join(current.HomeDir, "siegfried") + siegfried.home = "/usr/share/siegfried" + siegfried.signature = "archivematica.sig" + siegfried.fpr = "/tmp/siegfried" + identifier.name = "archivematica" + pronom.extend = []string{"archivematica-fmt2.xml", "archivematica-fmt3.xml", "archivematica-fmt4.xml", "archivematica-fmt5.xml"} } --- siegfried-1.1.0.orig/debian/changelog +++ siegfried-1.1.0/debian/changelog @@ -0,0 +1,101 @@ +siegfried (1.1.0-3~15.04) vivid; urgency=medium + + * Patch fpr file to work under default tag + + -- Misty De Meo Tue, 19 May 2015 16:46:49 -0700 + +siegfried (1.1.0-3~14.04) trusty; urgency=medium + + * Patch fpr file to work under default tag + + -- Misty De Meo Tue, 19 May 2015 16:46:26 -0700 + +siegfried (1.1.0-3~12.04) precise; urgency=medium + + * Patch fpr file to work under default tag + + -- Misty De Meo Tue, 19 May 2015 16:45:55 -0700 + +siegfried (1.1.0-2~15.04) vivid; urgency=medium + + * Update config patch + + -- Misty De Meo Tue, 19 May 2015 10:28:48 -0700 + +siegfried (1.1.0-2~14.04) trusty; urgency=medium + + * Update config patch + + -- Misty De Meo Tue, 19 May 2015 10:28:29 -0700 + +siegfried (1.1.0-2~12.04) precise; urgency=medium + + * Update config patch + + -- Misty De Meo Tue, 19 May 2015 10:27:55 -0700 + +siegfried (1.0.0-1~14.04) trusty; urgency=low + + * New upstream release + + -- Misty De Meo Mon, 23 Mar 2015 09:44:36 -0700 + +siegfried (1.0.0-1~12.04) precise; urgency=low + + * New upstream release + + -- Misty De Meo Mon, 23 Mar 2015 09:43:14 -0700 + +siegfried (0.8.3-2~14.04) trusty; urgency=low + + * Fix PRONOM path patches + + -- Misty De Meo Wed, 04 Mar 2015 11:49:54 -0800 + +siegfried (0.8.3-2~12.04) precise; urgency=low + + * Fix PRONOM path patches + + -- Misty De Meo Wed, 04 Mar 2015 11:49:30 -0800 + +siegfried (0.8.3-1~14.04) trusty; urgency=low + + * New upstream release + + -- Misty De Meo Wed, 04 Mar 2015 11:30:43 -0800 + +siegfried (0.8.3-1~12.04) precise; urgency=low + + * New upstream release + + -- Misty De Meo Wed, 04 Mar 2015 11:21:39 -0800 + +siegfried (0.7.1-1~12.04) precise; urgency=low + + * New upstream release + + -- Misty De Meo Mon, 05 Jan 2015 09:40:06 -0800 + +siegfried (0.7.0-1~14.04) trusty; urgency=low + + * New upstream release + + -- Misty De Meo Mon, 24 Nov 2014 17:26:29 -0800 + +siegfried (0.7.0-1~12.04) precise; urgency=low + + * New upstream release + + -- Misty De Meo Mon, 24 Nov 2014 16:35:36 -0800 + +siegfried (0.6.0-1~12.04) precise; urgency=low + + * New upstream release + + -- Misty De Meo Thu, 13 Nov 2014 10:38:19 -0800 + +siegfried (0.5-1~12.04) precise; urgency=low + + * Initial release. + + -- Misty De Meo Tue, 07 Oct 2014 14:29:41 -0700 --- siegfried-1.1.0.orig/debian/patches/fpr-tag.patch +++ siegfried-1.1.0/debian/patches/fpr-tag.patch @@ -0,0 +1,20 @@ +Index: siegfried-1.1.0/cmd/sf/fpr.go +=================================================================== +--- siegfried-1.1.0.orig/cmd/sf/fpr.go ++++ siegfried-1.1.0/cmd/sf/fpr.go +@@ -1,4 +1,4 @@ +-// +build archivematica,linux ++// +build linux + + // Copyright 2015 Richard Lehane. All rights reserved. + // +Index: siegfried-1.1.0/cmd/sf/nofpr.go +=================================================================== +--- siegfried-1.1.0.orig/cmd/sf/nofpr.go ++++ siegfried-1.1.0/cmd/sf/nofpr.go +@@ -1,4 +1,4 @@ +-// +build !archivematica !linux ++// +build !linux + + // Copyright 2015 Richard Lehane. All rights reserved. + // --- siegfried-1.1.0.orig/debian/patches/pronom_path.diff +++ siegfried-1.1.0/debian/patches/pronom_path.diff @@ -1,8 +1,8 @@ -Index: siegfried-0.7.0/config/default.go +Index: siegfried-1.1.0/config/default.go =================================================================== ---- siegfried-0.7.0.orig/config/default.go 2014-11-24 02:04:25.000000000 -0800 -+++ siegfried-0.7.0/config/default.go 2014-11-25 09:39:26.146183694 -0800 -@@ -1,32 +1,10 @@ +--- siegfried-1.1.0.orig/config/default.go ++++ siegfried-1.1.0/config/default.go +@@ -1,32 +1,11 @@ // +build !brew,!archivematica,!appengine -// Copyright 2014 Richard Lehane. All rights reserved. @@ -35,7 +35,8 @@ - } - siegfried.home = filepath.Join(current.HomeDir, "siegfried") + siegfried.home = "/usr/share/siegfried" -+ siegfried.signature = "archivematica.gob" ++ siegfried.signature = "archivematica.sig" ++ siegfried.fpr = "/tmp/siegfried" + identifier.name = "archivematica" + pronom.extend = []string{"archivematica-fmt2.xml", "archivematica-fmt3.xml", "archivematica-fmt4.xml", "archivematica-fmt5.xml"} } --- siegfried-1.1.0.orig/debian/patches/series +++ siegfried-1.1.0/debian/patches/series @@ -1 +1,2 @@ pronom_path.diff +fpr-tag.patch