From ce90466c39c197c8dc46096f0469baa2d06d6b79 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 21 May 2021 04:25:57 -0700 Subject: [PATCH] Remove unused code This code is not needed by the engine and so only makes maintenance of the project more difficult. Some of it because obsolete on the integration of Arduino Lint, while others had either fallen out of use during previous development epochs, or never ended up being used at all. --- go.mod | 4 +- go.sum | 6 -- libraries/bad_file_cleaner.go | 70 ----------------- libraries/bad_file_cleaner_test.go | 45 ----------- libraries/cron/fill_missing_checksums.go | 76 ------------------ libraries/github_release_downloader.go | 78 ------------------- libraries/github_release_downloader_test.go | 40 ---------- libraries/metadata/metadata.go | 32 -------- libraries/metadata/utils.go | 46 ----------- libraries/metadata/utils_test.go | 50 ------------ libraries/repolist.go | 53 ------------- libraries/testdata/lib_valid/test.txt | 0 libraries/testdata/lib_with_exe/fake.exe | 0 libraries/testdata/lib_with_exe/test.txt | 0 .../lib_with_forbidden_file/.development | 0 .../testdata/lib_with_forbidden_file/test.txt | 0 16 files changed, 1 insertion(+), 499 deletions(-) delete mode 100644 libraries/bad_file_cleaner.go delete mode 100644 libraries/bad_file_cleaner_test.go delete mode 100644 libraries/cron/fill_missing_checksums.go delete mode 100644 libraries/github_release_downloader.go delete mode 100644 libraries/github_release_downloader_test.go delete mode 100644 libraries/metadata/utils.go delete mode 100644 libraries/metadata/utils_test.go delete mode 100644 libraries/testdata/lib_valid/test.txt delete mode 100644 libraries/testdata/lib_with_exe/fake.exe delete mode 100644 libraries/testdata/lib_with_exe/test.txt delete mode 100644 libraries/testdata/lib_with_forbidden_file/.development delete mode 100644 libraries/testdata/lib_with_forbidden_file/test.txt diff --git a/go.mod b/go.mod index c94ef087..25176fb9 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,8 @@ go 1.14 require ( github.com/arduino/go-paths-helper v1.5.0 github.com/arduino/golang-concurrent-workers v0.0.0-20170202182617-6710cdc954bc - github.com/blang/semver v3.5.1+incompatible github.com/go-git/go-git/v5 v5.3.0 - github.com/google/go-github v17.0.0+incompatible - github.com/google/go-querystring v1.1.0 // indirect + github.com/google/go-cmp v0.5.2 // indirect github.com/stretchr/testify v1.7.0 github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec ) diff --git a/go.sum b/go.sum index 39c71200..32f59dfa 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,6 @@ github.com/arduino/golang-concurrent-workers v0.0.0-20170202182617-6710cdc954bc github.com/arduino/golang-concurrent-workers v0.0.0-20170202182617-6710cdc954bc/go.mod h1:E+WBbLkFBdPp+N+yijgbdDI33mr5pm6j42RYLN5K4do= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -36,10 +34,6 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= diff --git a/libraries/bad_file_cleaner.go b/libraries/bad_file_cleaner.go deleted file mode 100644 index ce13468a..00000000 --- a/libraries/bad_file_cleaner.go +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package libraries - -import ( - "errors" - "os" - "os/exec" - "path/filepath" -) - -// FailIfHasUndesiredFiles returns an error if the folder contains any undesired files. -func FailIfHasUndesiredFiles(folder string) error { - err := failIfContainsForbiddenFileInRoot(folder) - if err != nil { - return err - } - return failIfContainsExes(folder) -} - -// ForbiddenFiles is the names of the forbidden files. -var ForbiddenFiles = []string{".development"} - -func failIfContainsForbiddenFileInRoot(folder string) error { - for _, file := range ForbiddenFiles { - if _, err := os.Stat(filepath.Join(folder, file)); err == nil { - return errors.New(file + " file found, skipping") - } - } - - return nil -} - -// Patterns is the file patterns of executables. -var Patterns = []string{"*.exe"} - -func failIfContainsExes(folder string) error { - for _, pattern := range Patterns { - cmd := exec.Command("find", folder, "-type", "f", "-name", pattern) - output, err := cmd.CombinedOutput() - if err != nil { - return err - } - if len(string(output)) > 0 { - return errors.New(pattern + " files found, skipping") - } - } - return nil -} diff --git a/libraries/bad_file_cleaner_test.go b/libraries/bad_file_cleaner_test.go deleted file mode 100644 index d984dc72..00000000 --- a/libraries/bad_file_cleaner_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package libraries - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestBadFileFinderDotDevelopment(t *testing.T) { - err := FailIfHasUndesiredFiles("./testdata/lib_with_forbidden_file") - assert.Error(t, err) -} - -func TestBadFileFinderExe(t *testing.T) { - err := FailIfHasUndesiredFiles("./testdata/lib_with_exe") - assert.Error(t, err) -} - -func TestBadFileFinderValid(t *testing.T) { - err := FailIfHasUndesiredFiles("./testdata/lib_valid") - assert.NoError(t, err) -} diff --git a/libraries/cron/fill_missing_checksums.go b/libraries/cron/fill_missing_checksums.go deleted file mode 100644 index f5f5e562..00000000 --- a/libraries/cron/fill_missing_checksums.go +++ /dev/null @@ -1,76 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package cron - -import ( - "io" - "net/http" - "os" - - "arduino.cc/repository/libraries/hash" -) - -/* -FillMissingChecksumsForDownloadArchives checks for missing size and checksum field and fills them -by downloading a copy of the file. -*/ -func FillMissingChecksumsForDownloadArchives(URL string, filename string) (int64, string, error) { - size, err := download(URL, filename) - if err != nil { - return 0, "", err - } - - hash, err := hash.Checksum(filename) - if err != nil { - os.Remove(filename) - return 0, "", err - } - - return size, hash, nil -} - -func download(URL string, filename string) (int64, error) { - out, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) - if err != nil { - return 0, err - } - defer out.Close() - - resp, err := http.Get(URL) - if err != nil { - defer os.Remove(out.Name()) - return 0, err - } - defer resp.Body.Close() - - size, err := io.Copy(out, resp.Body) - if err != nil { - defer os.Remove(out.Name()) - return 0, err - } - - return size, nil -} - -// vi:ts=2 diff --git a/libraries/github_release_downloader.go b/libraries/github_release_downloader.go deleted file mode 100644 index 627b8243..00000000 --- a/libraries/github_release_downloader.go +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package libraries - -import ( - "io" - "io/ioutil" - "net/http" - "os" - "strings" - - "arduino.cc/repository/libraries/hash" -) - -// GithubDownloadRelease downloads GitHub's archive of the release. -func GithubDownloadRelease(repoURL, version string) (string, int64, string, error) { - tempfile, err := ioutil.TempFile("", "github") - if err != nil { - return "", -1, "", err - } - defer os.Remove(tempfile.Name()) - - zipFileURL := strings.Replace(repoURL, ".git", "", 1) + "/archive/" + version + ".zip" - - err = saveURLIn(zipFileURL, tempfile) - if err != nil { - return "", -1, "", err - } - - info, err := os.Stat(tempfile.Name()) - if err != nil { - return "", -1, "", err - } - size := info.Size() - - checksum, err := hash.Checksum(tempfile.Name()) - if err != nil { - return "", -1, "", err - } - - return zipFileURL, size, checksum, nil -} - -func saveURLIn(url string, tempfile *os.File) error { - resp, err := http.Get(url) - if err != nil { - return err - } - defer tempfile.Close() - defer resp.Body.Close() - - _, err = io.Copy(tempfile, resp.Body) - if err != nil { - return err - } - return nil -} diff --git a/libraries/github_release_downloader_test.go b/libraries/github_release_downloader_test.go deleted file mode 100644 index 3e14bfb3..00000000 --- a/libraries/github_release_downloader_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package libraries - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGithubDownload(t *testing.T) { - url, size, checksum, err := GithubDownloadRelease("https://github.com/arduino-libraries/Audio.git", "1.0.0") - - require.NoError(t, err) - require.Equal(t, url, "https://github.com/arduino-libraries/Audio/archive/1.0.0.zip") - require.Equal(t, checksum, "SHA-256:a4da301186904b0f95ea691681b40867bd5a1fe608963a79a7c0a2d45f80a320") - require.Equal(t, size, int64(7314)) - -} diff --git a/libraries/metadata/metadata.go b/libraries/metadata/metadata.go index c1000822..9d0ea4ba 100644 --- a/libraries/metadata/metadata.go +++ b/libraries/metadata/metadata.go @@ -37,11 +37,7 @@ package metadata import ( "bytes" - "context" - "encoding/base64" - "errors" - "github.com/google/go-github/github" ini "github.com/vaughan0/go-ini" ) @@ -62,34 +58,6 @@ type LibraryMetadata struct { Depends string } -// ParsePullRequest makes a LibraryMetadata by reading library.properties from a github.PullRequest -func ParsePullRequest(gh *github.Client, pull *github.PullRequest) (*LibraryMetadata, error) { - head := *pull.Head - headRepo := *head.Repo - - // Get library.properties from pull request HEAD - getContentOpts := &github.RepositoryContentGetOptions{ - Ref: *head.SHA, - } - libPropContent, _, _, err := gh.Repositories.GetContents(context.TODO(), *headRepo.Owner.Login, *headRepo.Name, "library.properties", getContentOpts) - if err != nil { - return nil, err - } - if libPropContent == nil { - return nil, errors.New("library.properties file not found") - } - return ParseRepositoryContent(libPropContent) -} - -// ParseRepositoryContent makes a LibraryMetadata by reading library.properties from a github.RepositoryContent -func ParseRepositoryContent(content *github.RepositoryContent) (*LibraryMetadata, error) { - libPropertiesData, err := base64.StdEncoding.DecodeString(*content.Content) - if err != nil { - return nil, err - } - return Parse(libPropertiesData) -} - // Parse makes a LibraryMetadata by parsing a library.properties file contained in a byte array func Parse(propertiesData []byte) (*LibraryMetadata, error) { // Create an io.Reader from []bytes diff --git a/libraries/metadata/utils.go b/libraries/metadata/utils.go deleted file mode 100644 index 8691b920..00000000 --- a/libraries/metadata/utils.go +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package metadata - -import ( - "strings" - - "github.com/blang/semver" -) - -// VersionToSemverCompliant transforms a truncated version to a semver compliant version, -// for example "1.0" is converted to "1.0.0". -func VersionToSemverCompliant(version string) (string, error) { - versionParts := len(strings.Split(version, ".")) - for versionParts < 3 { - versionParts++ - version += ".0" - } - - newVersion, err := semver.Parse(version) - if err != nil { - return "", err - } - return newVersion.String(), nil -} diff --git a/libraries/metadata/utils_test.go b/libraries/metadata/utils_test.go deleted file mode 100644 index 95110d9a..00000000 --- a/libraries/metadata/utils_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package metadata - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestVersionFix(t *testing.T) { - version, err := VersionToSemverCompliant("1") - require.NoError(t, err) - require.Equal(t, "1.0.0", version) - - version, err = VersionToSemverCompliant("1.2") - require.NoError(t, err) - require.Equal(t, "1.2.0", version) - - /* - version, err = VersionToSemverCompliant("1.2b") - require.NoError(t, err) - require.Equal(t, "1.2.1", version) - - version, err = VersionToSemverCompliant("05") - require.NoError(t, err) - require.Equal(t, "5.0.0", version) - */ -} diff --git a/libraries/repolist.go b/libraries/repolist.go index 2def5e43..c3b873b9 100644 --- a/libraries/repolist.go +++ b/libraries/repolist.go @@ -73,20 +73,6 @@ func (repoMatcherIfDotGit) Match(url string) bool { return strings.Index(url, "https://") == 0 && strings.LastIndex(url, ".git") == len(url)-len(".git") } -/* -type repoMatcherIfNotDotGit struct{} - -func (_ repoMatcherIfNotDotGit) Match(r string) bool { - return !repoMatcherIfDotGit{}.Match(r) -} - -type repoMatcherIfGithub struct{} - -func (_ repoMatcherIfGithub) Match(r string) bool { - return strings.Index(r, "//github.com") != -1 || strings.Index(r, "@github.com") != -1 -} -*/ - // GitURLsError is the type for the unknown or unsupported repositories data. type GitURLsError struct { Repos []*Repo @@ -153,45 +139,6 @@ func filterReposBy(repos []*Repo, matcher repoMatcher) ([]*Repo, error) { return filtered, err } -/* -func newGithubClient() *github.Client { - gh_auth := &oauth.Transport{Token: &oauth.Token{AccessToken: config.GithubAuthToken()}} - return github.NewClient(gh_auth.Client()) -} - -func reposFromGithubOrgs(orgs []*github.Organization) ([]string, error) { - client := newGithubClient() - var repos []string - for _, org := range orgs { - repositories, _, err := client.Repositories.ListByOrg(*org.Login, &github.RepositoryListByOrgOptions{}) - if err != nil { - return nil, err - } - for _, repository := range repositories { - repos = append(repos, *repository.CloneURL) - } - } - - return repos, nil -} - -func findGithubOrgs(repos []string) (orgs []*github.Organization, err error) { - client := newGithubClient() - for _, repo := range repos { - parsedURL, err := url.Parse(repo) - if err != nil { - return nil, err - } - orgName := strings.Split(parsedURL.Path, "/")[1] - org, _, err := client.Organizations.Get(orgName) - if err == nil { - orgs = append(orgs, org) - } - } - return orgs, nil -} -*/ - func toListOfUniqueRepos(repos []*Repo) []*Repo { repoMap := make(map[string]*Repo) var finalRepos []*Repo diff --git a/libraries/testdata/lib_valid/test.txt b/libraries/testdata/lib_valid/test.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/libraries/testdata/lib_with_exe/fake.exe b/libraries/testdata/lib_with_exe/fake.exe deleted file mode 100644 index e69de29b..00000000 diff --git a/libraries/testdata/lib_with_exe/test.txt b/libraries/testdata/lib_with_exe/test.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/libraries/testdata/lib_with_forbidden_file/.development b/libraries/testdata/lib_with_forbidden_file/.development deleted file mode 100644 index e69de29b..00000000 diff --git a/libraries/testdata/lib_with_forbidden_file/test.txt b/libraries/testdata/lib_with_forbidden_file/test.txt deleted file mode 100644 index e69de29b..00000000